music: attempt to remap HLS urls to not be relative and see if ffmpeg accepts it

This commit is contained in:
Cynthia Foxwell 2023-09-28 21:39:23 -06:00
parent 2e6383c493
commit cd7d7b3c36
2 changed files with 51 additions and 6 deletions

View file

@ -232,10 +232,13 @@ async function enqueue({
length = info?.duration * 1000; length = info?.duration * 1000;
thumbnail = info?.thumbnailUrl; thumbnail = info?.thumbnailUrl;
const hlsUrl = new URL(info.hls);
media = Readable.from( media = Readable.from(
await fetch( await fetch(info.hls)
info?.audioStreams?.sort((a, b) => a.bitrate - b.bitrate)?.[0]?.url .then((res) => res.text())
).then((res) => res.body) .then((data) =>
data.replaceAll("/api/manifest/", `https://${hlsUrl.hostname}$1`)
)
); );
} else if (type == "sc") { } else if (type == "sc") {
if (url?.startsWith("sc:")) if (url?.startsWith("sc:"))

View file

@ -145,17 +145,24 @@ const GUILD_FEATURES = {
ANIMATED_ICON: {icon: "\u{1f39e}"}, ANIMATED_ICON: {icon: "\u{1f39e}"},
APPLICATION_COMMAND_PERMISSIONS_V2: {icon: "\u2699\ufe0f"}, APPLICATION_COMMAND_PERMISSIONS_V2: {icon: "\u2699\ufe0f"},
AUTO_MODERATION: {icon: "\u{1f6e1}"}, AUTO_MODERATION: {icon: "\u{1f6e1}"},
AUTOMOD_TRIGGER_KEYWORD_FILTER: {icon: "\u{1f6e1}"},
AUTOMOD_TRIGGER_ML_SPAM_FILTER: {icon: "\u{1f6e1}"},
AUTOMOD_TRIGGER_SPAM_LINK_FILTER: {icon: "\u{1f6e1}"},
AUTOMOD_TRIGGER_USER_PROFILE: {icon: "\u{1faaa}"}, AUTOMOD_TRIGGER_USER_PROFILE: {icon: "\u{1faaa}"},
BANNER: {icon: "\u{1f5bc}"}, BANNER: {icon: "\u{1f5bc}"},
BFG: {icon: "\u{1f388}", name: "BFG"}, BFG: {icon: "\u{1f388}", name: "BFG"},
BOOSTING_TIERS_EXPERIMENT_MEDIUM_GUILD: {icon: "\u{1f48e}"},
BOOSTING_TIERS_EXPERIMENT_SMALL_GUILD: {icon: "\u{1f48e}"},
BOT_DEVELOPER_EARLY_ACCESS: {icon: "\u{1f9ea}"}, BOT_DEVELOPER_EARLY_ACCESS: {icon: "\u{1f9ea}"},
BURST_REACTIONS: {icon: "\u2728", name: "Super Reactions"}, BURST_REACTIONS: {icon: "\u2728", name: "Super Reactions"},
CHANNEL_BANNER: {icon: "\u{1f5bc}"},
CHANNEL_ICON_EMOJIS_GENERATED: {icon: "\u{1f603}"}, CHANNEL_ICON_EMOJIS_GENERATED: {icon: "\u{1f603}"},
CHANNEL_HIGHLIGHTS: {icon: "\u{1f5c3}"}, CHANNEL_HIGHLIGHTS: {icon: "\u{1f5c3}"},
CHANNEL_HIGHLIGHTS_DISABLED: {icon: "\u{1f6ab}"}, CHANNEL_HIGHLIGHTS_DISABLED: {icon: "\u{1f6ab}"},
CLYDE_DISABLED: {icon: "\u{1f6ab}"}, CLYDE_DISABLED: {icon: "\u{1f6ab}"},
CLYDE_ENABLED: {icon: "\u{1f916}"}, CLYDE_ENABLED: {icon: "\u{1f916}"},
CLYDE_EXPERIMENT_ENABLED: {icon: "\u{1f9ea}"}, CLYDE_EXPERIMENT_ENABLED: {icon: "\u{1f9ea}"},
COMMERCE: {icon: "\u{1f6cd}"},
COMMUNITY: {icon: "\u{1f3d8}"}, COMMUNITY: {icon: "\u{1f3d8}"},
COMMUNITY_CANARY: {icon: "\u{1f9ea}"}, COMMUNITY_CANARY: {icon: "\u{1f9ea}"},
COMMUNITY_EXP_LARGE_GATED: {icon: "\u{1f3d8}"}, COMMUNITY_EXP_LARGE_GATED: {icon: "\u{1f3d8}"},
@ -175,15 +182,25 @@ const GUILD_FEATURES = {
DISCOVERABLE_DISABLED: {icon: "\u{1f6ab}"}, DISCOVERABLE_DISABLED: {icon: "\u{1f6ab}"},
ENABLED_DISCOVERABLE_BEFORE: {icon: "\u{1f9ed}"}, ENABLED_DISCOVERABLE_BEFORE: {icon: "\u{1f9ed}"},
EXPOSED_TO_ACTIVITIES_WTP_EXPERIMENT: {icon: "\u{1f9ea}"}, EXPOSED_TO_ACTIVITIES_WTP_EXPERIMENT: {icon: "\u{1f9ea}"},
EXPOSED_TO_BOOSTING_TIERS_EXPERIMENT: {icon: "\u{1f9ea}"},
FEATURABLE: {icon: "\u{1f9ed}"},
FORCE_RELAY: {icon: "\u{1f4fb}"},
GUESTS_ENABLED: {icon: "\u{1f465}"}, GUESTS_ENABLED: {icon: "\u{1f465}"},
GUILD_AUTOMOD_DEFAULT_LIST: {icon: "\u{1f6e1}"},
GUILD_COMMUNICATION_DISABLED_GUILDS: {icon: "\u{1f6d1}"},
GUILD_HOME_DEPRECATION_OVERRIDE: {icon: "\u{1f3da}"}, GUILD_HOME_DEPRECATION_OVERRIDE: {icon: "\u{1f3da}"},
GUILD_HOME_OVERRIDE: {icon: "\u{1f3e0}"}, GUILD_HOME_OVERRIDE: {icon: "\u{1f3e0}"},
GUILD_HOME_TEST: {icon: "\u{1f9ea}"}, GUILD_HOME_TEST: {icon: "\u{1f9ea}"},
GUILD_MEMBER_VERIFICATION_EXPERIMENT: {icon: "\u{1f9ea}"}, GUILD_MEMBER_VERIFICATION_EXPERIMENT: {icon: "\u{1f9ea}"},
GUILD_ONBOARDING: {icon: "\u{1f5f3}"}, GUILD_ONBOARDING: {icon: "\u{1f5f3}"},
GUILD_ONBOARDING_ADMIN_ONLY: {icon: "\u{1f5f3}"},
GUILD_ONBOARDING_EVER_ENABLED: {icon: "\u{1f5f3}"}, GUILD_ONBOARDING_EVER_ENABLED: {icon: "\u{1f5f3}"},
GUILD_ONBOARDING_HAS_PROMPTS: {icon: "\u{1f5f3}"}, GUILD_ONBOARDING_HAS_PROMPTS: {icon: "\u{1f5f3}"},
GUILD_PRODUCTS: {icon: "\u{1f6cd}"}, GUILD_PRODUCTS: {icon: "\u{1f6cd}"},
GUILD_ROLE_SUBSCRIPTIONS: {icon: "\u{1f4b3}"},
GUILD_ROLE_SUBSCRIPTION_PURCHASE_FEEDBACK_LOOP: {icon: "\u{1f4b3}"},
GUILD_ROLE_SUBSCRIPTION_TIER_TEMPLATE: {icon: "\u{1f4b3}"},
GUILD_ROLE_SUBSCRIPTION_TRIALS: {icon: "\u{1f4b3}"},
GUILD_SERVER_GUIDE: {icon: "\u{1f9ae}"}, GUILD_SERVER_GUIDE: {icon: "\u{1f9ae}"},
GUILD_WEB_PAGE_VANITY_URL: {icon: "\u{1f4c4}"}, GUILD_WEB_PAGE_VANITY_URL: {icon: "\u{1f4c4}"},
HAD_EARLY_ACTIVITIES_ACCESS: {icon: "\u{1f680}"}, HAD_EARLY_ACTIVITIES_ACCESS: {icon: "\u{1f680}"},
@ -195,22 +212,37 @@ const GUILD_FEATURES = {
INVITE_SPLASH: {icon: "\u{1f5bc}"}, INVITE_SPLASH: {icon: "\u{1f5bc}"},
INVITES_DISABLED: {icon: "\u26d4"}, INVITES_DISABLED: {icon: "\u26d4"},
LINKED_TO_HUB: {icon: "\u{1f3eb}"}, LINKED_TO_HUB: {icon: "\u{1f3eb}"},
LURKABLE: {icon: "\u{1f441}"},
MARKETPLACES_CONNECTION_ROLES: {icon: "\u{1f517}"},
MEDIA_CHANNEL_ALPHA: {icon: "\u{1f5bc}"},
MEMBER_LIST_DISABLED: {icon: "\u{1f6ab}"},
MEMBER_PROFILES: {icon: "\u{1faaa}"},
MEMBER_SAFETY_PAGE_ROLLOUT: {icon: "\u{1f6e1}"}, MEMBER_SAFETY_PAGE_ROLLOUT: {icon: "\u{1f6e1}"},
MEMBER_VERIFICATION_GATE_ENABLED: {icon: "\u{1f6e1}"}, MEMBER_VERIFICATION_GATE_ENABLED: {icon: "\u{1f6e1}"},
MEMBER_VERIFICATION_MANUAL_APPROVAL: {icon: "\u2705"}, MEMBER_VERIFICATION_MANUAL_APPROVAL: {icon: "\u2705"},
MOBILE_WEB_ROLE_SUBSCRIPTION_PURCHASE_PAGE: {icon: "\u{1f4b3}"},
MONETIZATION_ENABLED: {icon: "\u{1f4b0}"},
MORE_EMOJI: {icon: "\u{1f603}"}, MORE_EMOJI: {icon: "\u{1f603}"},
MORE_STICKERS: {icon: "\u{1f5bc}"}, MORE_STICKERS: {icon: "\u{1f5bc}"},
NEWS: {icon: "\u{1f4f0}"}, NEWS: {icon: "\u{1f4f0}"},
NEW_THREAD_PERMISSIONS: {icon: "\u{1f9f5}"},
NON_COMMUNITY_RAID_ALERTS: {icon: "\u{1f6a8}"}, NON_COMMUNITY_RAID_ALERTS: {icon: "\u{1f6a8}"},
PARTNERED: {icon: "\u267e\ufe0f"}, PARTNERED: {icon: "\u267e\ufe0f"},
PREMIUM_TIER_3_OVERRIDE: {icon: "\u{1f48e}"}, PREMIUM_TIER_3_OVERRIDE: {icon: "\u{1f48e}"},
PREVIEW_ENABLED: {icon: "\u{1f441}"}, PREVIEW_ENABLED: {icon: "\u{1f441}"},
PRIVATE_THREADS: {icon: "\u{1f9f5}"},
PRODUCTS_AVAILABLE_FOR_PURCHASE: {icon: "\u{1f6cd}"}, PRODUCTS_AVAILABLE_FOR_PURCHASE: {icon: "\u{1f6cd}"},
PUBLIC: {icon: "\u{1f9ed}"},
PUBLIC_DISABLED: {icon: "\u{1f6ab}"},
RAID_ALERTS_DISABLED: {icon: "\u{1f6ab}"}, RAID_ALERTS_DISABLED: {icon: "\u{1f6ab}"},
RAID_ALERTS_ENABLED: {icon: "\u{1f6a8}"},
RELAY_ENABLED: {icon: "\u{1f4fb}"}, RELAY_ENABLED: {icon: "\u{1f4fb}"},
RESTRICT_SPAM_RISK_GUILDS: {icon: "\u{1f6d1}"},
ROLE_ICONS: {icon: "\u{1f3f7}"}, ROLE_ICONS: {icon: "\u{1f3f7}"},
ROLE_SUBSCRIPTIONS_AVAILABLE_FOR_PURCHASE: {icon: "\u{1f4b3}"}, ROLE_SUBSCRIPTIONS_AVAILABLE_FOR_PURCHASE: {icon: "\u{1f4b3}"},
ROLE_SUBSCRIPTIONS_ENABLED: {icon: "\u{1f4b3}"}, ROLE_SUBSCRIPTIONS_ENABLED: {icon: "\u{1f4b3}"},
ROLE_SUBSCRIPTIONS_ENABLED_FOR_PURCHASE: {icon: "\u{1f4b3}"},
SEVEN_DAY_THREAD_ARCHIVE: {icon: "\u{1f9f5}"},
SHARD: {icon: "\u{1f4a0}"}, SHARD: {icon: "\u{1f4a0}"},
SHARED_CANVAS_FRIENDS_AND_FAMILY_TEST: {icon: "\u{1f58c}"}, SHARED_CANVAS_FRIENDS_AND_FAMILY_TEST: {icon: "\u{1f58c}"},
SOUNDBOARD: {icon: "\u{1f50a}"}, SOUNDBOARD: {icon: "\u{1f50a}"},
@ -224,10 +256,19 @@ const GUILD_FEATURES = {
SUMMARIES_LONG_LOOKBACK: {icon: "\u{1f5c2}"}, SUMMARIES_LONG_LOOKBACK: {icon: "\u{1f5c2}"},
STAFF_LEVEL_COLLABORATOR_REQUIRED: {icon: "\u{1f6e0}"}, STAFF_LEVEL_COLLABORATOR_REQUIRED: {icon: "\u{1f6e0}"},
STAFF_LEVEL_RESTRICTED_COLLABORATOR_REQUIRED: {icon: "\u{1f6e0}"}, STAFF_LEVEL_RESTRICTED_COLLABORATOR_REQUIRED: {icon: "\u{1f6e0}"},
TEXT_IN_STAGE_ENABLED: {icon: "\u{1f5e8}"},
TEXT_IN_VOICE_ENABLED: {icon: "\u{1f5e8}"},
THREADS_ENABLED_TESTING: {icon: "\u{1f9f5}"},
THREADS_ENABLED: {icon: "\u{1f9f5}"},
THREAD_DEFAULT_AUTO_ARCHIVE_DURATION: {icon: "\u{1f9f5}"}, THREAD_DEFAULT_AUTO_ARCHIVE_DURATION: {icon: "\u{1f9f5}"},
THREADS_ONLY_CHANNEL: {icon: "\u{1f5e8}", name: "Forum Channels"},
THREE_DAY_THREAD_ARCHIVE: {icon: "\u{1f9f5}"},
TICKETED_EVENTS_ENABLED: {icon: "\u{1f39f}"},
TICKETING_ENABLED: {icon: "\u{1f39f}"},
VANITY_URL: {icon: "\u{1f517}"}, VANITY_URL: {icon: "\u{1f517}"},
VERIFIED: {icon: "\u2b50"}, VERIFIED: {icon: "\u2b50"},
VIP_REGIONS: {icon: "\u{1f399}"}, VIP_REGIONS: {icon: "\u{1f399}"},
VOICE_CHANNEL_EFFECTS: {icon: "\u2728"},
VOICE_IN_THREADS: {icon: "\u{1f399}"}, VOICE_IN_THREADS: {icon: "\u{1f399}"},
WELCOME_SCREEN_ENABLED: {icon: "\u{1f44b}"}, WELCOME_SCREEN_ENABLED: {icon: "\u{1f44b}"},
}; };
@ -991,11 +1032,12 @@ presence.callback = async function (msg, line) {
if (target) { if (target) {
if (!target.clientStatus) return `**${pomello(target)}** is offline.`; if (!target.clientStatus) return `**${pomello(target)}** is offline.`;
let icons = ""; const icons = [];
for (const platform of Object.keys(target.clientStatus)) { for (const platform of Object.keys(target.clientStatus)) {
const status = target.clientStatus[platform]; const status = target.clientStatus[platform];
if (status == "offline") continue;
icons += (PRESENCE_ICONS[platform][status] ?? "") + " "; icons.push(PRESENCE_ICONS[platform][status]);
} }
const embeds = []; const embeds = [];
@ -1203,7 +1245,7 @@ presence.callback = async function (msg, line) {
} }
return { return {
content: `Presence for **${pomello(target)}**: ${icons.trim()}`, content: `Presence for **${pomello(target)}**: ${icons.join(" ")}`,
embeds, embeds,
files, files,
}; };