From 1eadbed765315bdc055b1772e98270cd15ed94cc Mon Sep 17 00:00:00 2001 From: Seehed Date: Tue, 23 Dec 2025 19:56:23 -1000 Subject: [PATCH 1/4] feat(activity): add Typical Media Group and RBC Radio --- websites/R/RBC Radio/metadata.json | 95 +++ websites/R/RBC Radio/presence.ts | 468 +++++++++++++++ websites/T/Typical Media Group/metadata.json | 61 ++ websites/T/Typical Media Group/package.json | 36 ++ websites/T/Typical Media Group/presence.ts | 580 +++++++++++++++++++ 5 files changed, 1240 insertions(+) create mode 100644 websites/R/RBC Radio/metadata.json create mode 100644 websites/R/RBC Radio/presence.ts create mode 100644 websites/T/Typical Media Group/metadata.json create mode 100644 websites/T/Typical Media Group/package.json create mode 100644 websites/T/Typical Media Group/presence.ts diff --git a/websites/R/RBC Radio/metadata.json b/websites/R/RBC Radio/metadata.json new file mode 100644 index 000000000000..fb0fbd06aef7 --- /dev/null +++ b/websites/R/RBC Radio/metadata.json @@ -0,0 +1,95 @@ +{ + "$schema": "https://schemas.premid.app/metadata/1.9", + "author": { + "name": "RBC Radio", + "id": "1137989736544354354" + }, + "contributors": [ + { + "name": "RBC Technology Department", + "id": "1137989736544354354" + } + ], + "service": "RBC Radio", + "altnames": [ + "Roblox Broadcasting Corporation", + "RBC", + "DRBC 98.4 FM" + ], + "description": { + "en": "RBC Radio is Roblox's #1 hit music station with the latest Roblox news, and everything Roblox entertainment.", + "es": "RBC Radio es la estación de música número 1 de Roblox con las últimas noticias de Roblox y todo el entretenimiento de Roblox.", + "fr": "RBC Radio est la station de musique numéro 1 de Roblox avec les dernières nouvelles de Roblox et tout le divertissement Roblox.", + "de": "RBC Radio ist Roblox' #1 Hit-Musiksender mit den neuesten Roblox-Nachrichten und allem rund um Roblox-Entertainment." + }, + "url": [ + "rbcradio.xyz", + "www.rbcradio.xyz", + "rbctelevision.org", + "rbctelevision.org/radio" + ], + "regExp": "([a-z0-9-]+[.])*rbcradio[.]xyz[/]?", + "version": "1.0.0", + "logo": "https://i.typicalmedia.net/stationlogos/rbcradio.webp", + "thumbnail": "https://i.imgur.com/RdPcWI3.png", + "color": "#DC2626", + "tags": [ + "radio", + "music", + "streaming", + "roblox", + "entertainment", + "live", + "news", + "podcasts", + "community" + ], + "category": "music", + "iframe": false, + "settings": [ + { + "id": "lang", + "title": "Language", + "icon": "fas fa-language", + "value": "en", + "values": { + "en": "English", + "es": "Español", + "fr": "Français", + "de": "Deutsch" + } + }, + { + "id": "showButtons", + "title": "Show Buttons", + "icon": "fas fa-link", + "value": true + }, + { + "id": "showTimestamp", + "title": "Show Timestamp", + "icon": "fas fa-clock", + "value": true + }, + { + "id": "showCover", + "title": "Show Song Cover Art", + "icon": "fas fa-image", + "value": true + }, + { + "id": "details", + "title": "Details Text (Playing)", + "icon": "fas fa-align-left", + "value": "%title%", + "placeholder": "Use: %title%, %artist%, %show%, %presenter%" + }, + { + "id": "state", + "title": "State Text (Playing)", + "icon": "fas fa-align-left", + "value": " %artist%", + "placeholder": "Use: %title%, %artist%, %show%, %presenter%" + } + ] +} diff --git a/websites/R/RBC Radio/presence.ts b/websites/R/RBC Radio/presence.ts new file mode 100644 index 000000000000..813bd04a4a29 --- /dev/null +++ b/websites/R/RBC Radio/presence.ts @@ -0,0 +1,468 @@ +// Custom assets for RBC Radio +const CustomAssets = { + Play: "https://i.typicalmedia.net/icons/_states/play.png", + Pause: "https://i.typicalmedia.net/icons/_states/Pause.png", + Browse: "https://i.typicalmedia.net/icons/_states/Browse.png", + Radio: "https://i.typicalmedia.net/icons/_states/Radio.png", + Video: "https://i.typicalmedia.net/icons/_states/Video.png", + Reading: "https://i.typicalmedia.net/icons/_states/Reading.png", + News: "https://i.typicalmedia.net/icons/_states/News.png", + Weather: "https://i.typicalmedia.net/icons/_states/Weather.png", + Contact: "https://i.typicalmedia.net/icons/_states/Contact.png", + Advertising: "https://i.typicalmedia.net/icons/_states/Advertising.png", + Upload: "https://i.typicalmedia.net/icons/_states/Upload.png", + SongNote: "https://i.typicalmedia.net/icons/_states/SongNote.png", + Search: "https://i.typicalmedia.net/icons/_states/Search.png", + Tv: "https://i.typicalmedia.net/icons/_states/Tv.png", + RadioShows: "https://i.typicalmedia.net/icons/_states/RadioShows.png", + Podcast: "https://i.typicalmedia.net/icons/_states/Podcast.png", + Calendar: "https://i.typicalmedia.net/icons/_states/Calendar.png", +}; + +const presence = new Presence({ + clientId: '1137989736544354354', +}); + +const browsingTimestamp = Math.floor(Date.now() / 1000); + +async function getStrings() { + return presence.getStrings({ + play: 'general.playing', + pause: 'general.paused', + browse: 'general.browsing', + listen: 'general.buttonListenAlong', + viewPage: 'general.viewPage', + btnViewPage: 'general.buttonViewPage', + readArticle: 'general.readingArticle', + btnReadArticle: 'general.buttonReadArticle', + viewProfile: 'general.viewProfile', + btnViewProfile: 'general.buttonViewProfile', + watchingLive: 'general.watchingLive', + viewShow: 'general.viewShow', + viewPodcast: 'general.viewPodcast', + }); +} + +let strings: Awaited>; +let oldLang: string | null = null; + +presence.on('UpdateData', async () => { + let presenceData: PresenceData = { + largeImageKey: 'https://i.typicalmedia.net/stationlogos/rbcradio.webp', + startTimestamp: browsingTimestamp, + }; + + const [ + newLang, + details, + state, + showButtons, + showTimestamp, + showCover, + ] = await Promise.all([ + presence.getSetting('lang').catch(() => 'en'), + presence.getSetting('details'), + presence.getSetting('state'), + presence.getSetting('showButtons'), + presence.getSetting('showTimestamp'), + presence.getSetting('showCover'), + ]); + + if (oldLang !== newLang || !strings) { + oldLang = newLang; + strings = await getStrings(); + } + + // Get current page path first to determine context + const path = location.pathname; + + // Check if we're on a specific content page (not homepage) + const isOnContentPage = + path !== '/' && + path !== '' && + (path.startsWith('/song/') || + path.startsWith('/show/') || + path.startsWith('/podcast/') || + path.startsWith('/news/') || + path.startsWith('/presenter') || + path.startsWith('/charts') || + path.startsWith('/timetable') || + path.startsWith('/podcasts') || + path.startsWith('/jobs') || + path.startsWith('/public-file') || + path.startsWith('/privacy') || + path.startsWith('/staff')); + + // Check if player is active (looking for play/pause button state) + const playButton = document.querySelector('[aria-label*="Play"], [aria-label*="Pause"], .play-button, .pause-button'); + const isPlaying = + playButton?.getAttribute('aria-label')?.toLowerCase().includes('pause') || + playButton?.classList.contains('playing') || + document.querySelector('.player-playing, [data-playing="true"]') !== null; + + // Get current song info from PLAYER ONLY (not from page content) + const playerSongTitle = + document.querySelector('.now-playing-title[data-song-title]')?.textContent?.trim(); + + const playerSongArtist = + document.querySelector('.now-playing-artist[data-song-artist]')?.textContent?.trim(); + + const showName = + document.querySelector('.live-show, [class*="show-name"], [data-show-name]')?.textContent?.trim(); + + const presenterName = + document.querySelector('.live-presenter, [class*="presenter-name"], [data-presenter-name]')?.textContent?.trim(); + + // Get album art from player + const playerAlbumArtElement = + document.querySelector('[data-album-art]') || + document.querySelector('.album-art'); + + const playerAlbumArt = + playerAlbumArtElement?.getAttribute('data-album-art') || + playerAlbumArtElement?.src || + document.querySelector('[class*="album-cover"]')?.src || + document.querySelector('[class*="album"], [class*="cover"]')?.style.backgroundImage?.match(/url\(['"]?([^'"]+)['"]?\)/)?.[1]; + + // Priority: Show page content if on a content page, otherwise show player status + if (isOnContentPage) { + // User is browsing specific pages - show page content instead of player + + if (path === '/' || path === '') { + presenceData.details = strings.browse; + presenceData.state = 'RBC Radio'; + presenceData.smallImageKey = CustomAssets.Browse; + presenceData.smallImageText = strings.browse; + } else if (path.startsWith('/news/')) { + const articleTitle = + document.querySelector('[data-article-title]')?.getAttribute('data-article-title') || + document.querySelector('.article-title')?.textContent?.trim() || + document.querySelector('h1')?.textContent?.trim(); + presenceData.details = strings.readArticle; + presenceData.state = articleTitle || 'News Article'; + presenceData.smallImageKey = CustomAssets.News; + presenceData.smallImageText = strings.readArticle; + + if (showButtons) { + presenceData.buttons = [ + { + label: strings.btnReadArticle, + url: location.href, + }, + ]; + } + } else if (path === '/news') { + presenceData.details = strings.viewPage; + presenceData.state = 'News'; + presenceData.smallImageKey = CustomAssets.News; + + if (showButtons) { + presenceData.buttons = [ + { + label: strings.btnViewPage, + url: location.href, + }, + ]; + } + } else if (path.startsWith('/podcast/')) { + const podcastTitle = + document.querySelector('[data-podcast-name]')?.getAttribute('data-podcast-name') || + document.querySelector('.podcast-title')?.textContent?.trim() || + document.querySelector('h1')?.textContent?.trim(); + presenceData.details = 'Viewing Podcast'; + presenceData.state = podcastTitle || 'Podcast'; + presenceData.smallImageKey = CustomAssets.Podcast; + + if (showButtons) { + presenceData.buttons = [ + { + label: 'View Podcast', + url: location.href, + }, + ]; + } + } else if (path === '/podcasts') { + presenceData.details = strings.viewPage; + presenceData.state = 'Podcasts'; + presenceData.smallImageKey = CustomAssets.Podcast; + + if (showButtons) { + presenceData.buttons = [ + { + label: strings.btnViewPage, + url: location.href, + }, + ]; + } + } else if (path === '/timetable') { + presenceData.details = strings.viewPage; + presenceData.state = 'Timetable'; + presenceData.smallImageKey = CustomAssets.Calendar; + + if (showButtons) { + presenceData.buttons = [ + { + label: strings.btnViewPage, + url: location.href, + }, + ]; + } + } else if (path === '/charts') { + presenceData.details = strings.viewPage; + presenceData.state = 'Charts'; + presenceData.smallImageKey = CustomAssets.SongNote; + + if (showButtons) { + presenceData.buttons = [ + { + label: strings.btnViewPage, + url: location.href, + }, + ]; + } + } else if (path === '/jobs') { + presenceData.details = strings.viewPage; + presenceData.state = 'Jobs'; + presenceData.smallImageKey = CustomAssets.Contact; + + if (showButtons) { + presenceData.buttons = [ + { + label: strings.btnViewPage, + url: location.href, + }, + ]; + } + } else if (path === '/public-file') { + presenceData.details = strings.viewPage; + presenceData.state = 'Public File'; + presenceData.smallImageKey = CustomAssets.Reading; + + if (showButtons) { + presenceData.buttons = [ + { + label: strings.btnViewPage, + url: location.href, + }, + ]; + } + } else if (path === '/privacy') { + presenceData.details = strings.viewPage; + presenceData.state = 'Privacy Policy'; + presenceData.smallImageKey = CustomAssets.Reading; + } else if (path.startsWith('/presenters/') || path.startsWith('/presenter/')) { + const presenterName = + document.querySelector('[data-presenter-name]')?.getAttribute('data-presenter-name') || + document.querySelector('.presenter-name')?.textContent?.trim() || + document.querySelector('h1')?.textContent?.trim(); + presenceData.details = 'Viewing Presenter'; + presenceData.state = presenterName || 'Presenter Profile'; + presenceData.smallImageKey = CustomAssets.Radio; + + if (showButtons) { + presenceData.buttons = [ + { + label: 'View Profile', + url: location.href, + }, + ]; + } + } else if (path === '/presenters') { + presenceData.details = strings.viewPage; + presenceData.state = 'Presenters'; + presenceData.smallImageKey = CustomAssets.Reading; + + if (showButtons) { + presenceData.buttons = [ + { + label: strings.btnViewPage, + url: location.href, + }, + ]; + } + } else if (path.startsWith('/staff')) { + const pageTitle = document.querySelector('[data-page-title]')?.getAttribute('data-page-title'); + presenceData.details = 'Staff Panel'; + presenceData.state = pageTitle || 'SHHHH'; + presenceData.smallImageKey = CustomAssets.Reading; + } else if (path.startsWith('/song/')) { + // Get song info from PAGE content only (exclude player using :not selector) + const songName = + document.querySelector('h1.song-title[data-song-title]')?.getAttribute('data-song-title') || + document.querySelector('h1.song-title')?.textContent?.trim() || + document.querySelector('h1')?.textContent?.trim(); + const songArtistPage = + document.querySelector('p.song-artist[data-song-artist]')?.getAttribute('data-song-artist') || + document.querySelector('p.song-artist')?.textContent?.trim(); + const songAlbum = + document.querySelector('p.song-album[data-song-album]')?.getAttribute('data-song-album') || + document.querySelector('p.song-album')?.textContent?.trim(); + + presenceData.details = songName || 'Viewing Song'; + presenceData.state = songArtistPage ? `by ${songArtistPage}${songAlbum ? ` • ${songAlbum}` : ''}` : 'Song Info'; + presenceData.smallImageKey = CustomAssets.SongNote; + + // Show album art if available from the page (not player) + const songArtwork = + document.querySelector('img.song-art[data-song-art]')?.getAttribute('data-song-art') || + document.querySelector('img.song-art')?.src; + + if (showCover && songArtwork) { + presenceData.largeImageKey = songArtwork; + } + + if (showButtons) { + presenceData.buttons = [ + { + label: 'View Song Info', + url: location.href, + }, + ]; + } + } else if (path.startsWith('/show/')) { + const showNamePage = + document.querySelector('[data-show-name]')?.getAttribute('data-show-name') || + document.querySelector('.show-title')?.textContent?.trim() || + document.querySelector('h1')?.textContent?.trim(); + + presenceData.details = 'Viewing Show'; + presenceData.state = showNamePage || 'Show Profile'; + presenceData.smallImageKey = CustomAssets.RadioShows; + + // Show artwork if available + const showArtwork = + document.querySelector('[data-show-art]')?.getAttribute('data-show-art') || + document.querySelector('.show-art')?.src; + + if (showCover && showArtwork) { + presenceData.largeImageKey = showArtwork; + } + + if (showButtons) { + presenceData.buttons = [ + { + label: 'View Show', + url: location.href, + }, + ]; + } + } else if (path.startsWith('/podcast/')) { + const podcastNamePage = + document.querySelector('[data-podcast-name]')?.getAttribute('data-podcast-name') || + document.querySelector('.podcast-title')?.textContent?.trim() || + document.querySelector('h1')?.textContent?.trim(); + const podcastAuthorPage = + document.querySelector('[data-podcast-author]')?.getAttribute('data-podcast-author') || + document.querySelector('.podcast-author')?.textContent?.trim(); + + presenceData.details = 'Viewing Podcast'; + presenceData.state = podcastNamePage ? `${podcastNamePage}${podcastAuthorPage ? ` • ${podcastAuthorPage}` : ''}` : 'Podcast'; + presenceData.smallImageKey = CustomAssets.Podcast; + + // Show podcast artwork if available + const podcastArtwork = + document.querySelector('[data-podcast-art]')?.getAttribute('data-podcast-art') || + document.querySelector('.podcast-art')?.src; + + if (showCover && podcastArtwork) { + presenceData.largeImageKey = podcastArtwork; + } + + if (showButtons) { + presenceData.buttons = [ + { + label: 'View Podcast', + url: location.href, + }, + ]; + } + } else { + presenceData.details = strings.browse; + presenceData.state = 'RBC Radio'; + presenceData.smallImageKey = CustomAssets.Browse; + } + + // Add small playing/paused indicator if music is playing in background + if (isPlaying && playerSongTitle) { + presenceData.smallImageKey = CustomAssets.Play; + presenceData.smallImageText = `Playing: ${playerSongTitle}`; + } else if (!isPlaying && playerSongTitle) { + presenceData.smallImageKey = CustomAssets.Pause; + presenceData.smallImageText = strings.pause; + } + } else { + // User is on homepage - show player status + if (isPlaying && (playerSongTitle || playerSongArtist)) { + if (details !== '{0}' && details) { + presenceData.details = replacePlaceholders(details, { + title: playerSongTitle || 'Unknown Track', + artist: playerSongArtist || 'Unknown Artist', + show: showName || '', + presenter: presenterName || '', + }); + } else { + presenceData.details = playerSongTitle || 'Listening to RBC Radio'; + } + + if (state !== '{0}' && state) { + presenceData.state = replacePlaceholders(state, { + title: playerSongTitle || '', + artist: playerSongArtist || 'Unknown Artist', + show: showName || '', + presenter: presenterName || '', + }); + } else { + presenceData.state = playerSongArtist ? `by ${playerSongArtist}` : 'Roblox\'s #1 Hit Music Station'; + } + + presenceData.smallImageKey = CustomAssets.Play; + presenceData.smallImageText = strings.play; + + // Show album art if enabled + if (showCover && playerAlbumArt) { + presenceData.largeImageKey = playerAlbumArt; + } + + if (showButtons) { + presenceData.buttons = [ + { + label: strings.listen, + url: 'https://rbcradio.xyz/', + }, + ]; + } + } else { + // Not playing or paused - show browsing homepage + presenceData.details = strings.browse; + presenceData.state = playerSongTitle ? `Paused: ${playerSongTitle}` : 'RBC Radio'; + presenceData.smallImageKey = playerSongTitle ? CustomAssets.Pause : CustomAssets.Browse; + presenceData.smallImageText = playerSongTitle ? strings.pause : strings.browse; + } + } + + if (!showTimestamp) { + delete presenceData.startTimestamp; + } + + if (!showButtons) { + delete presenceData.buttons; + } + + presence.setActivity(presenceData); +}); + +function replacePlaceholders( + template: string, + data: { + title: string; + artist: string; + show: string; + presenter: string; + } +): string { + return template + .replace(/%title%/g, data.title) + .replace(/%artist%/g, data.artist) + .replace(/%show%/g, data.show) + .replace(/%presenter%/g, data.presenter); +} diff --git a/websites/T/Typical Media Group/metadata.json b/websites/T/Typical Media Group/metadata.json new file mode 100644 index 000000000000..2c846cd6c6a1 --- /dev/null +++ b/websites/T/Typical Media Group/metadata.json @@ -0,0 +1,61 @@ +{ + "$schema": "https://schemas.premid.app/metadata/1.9", + "author": { + "name": "Typical Media Group", + "id": "289156747347165184" + }, + "contributors": [ + { + "name": "TMG Development Team", + "id": "289156747347165184" + } + ], + "service": "Typical Media Group", + "altnames": ["TMG Radio", "TMG", "Typical Media"], + "description": { + "en": "Typical Media Group - Stream live radio stations, discover new music, Typical Media Group is a Next Generation Audio Company." + +", + "es": "Typical Media Group - Transmite estaciones de radio en vivo, descubre nueva música y disfruta del entretenimiento de audio premium con una interfaz hermosa y moderna.", + "fr": "Typical Media Group - Diffusez des stations de radio en direct, découvrez de la nouvelle musique et profitez d'un divertissement audio premium avec une interface belle et moderne." + }, + "url": [ + "typicalmedia.net", + "www.typicalmedia.net" + ], + "regExp": "([a-z0-9-]+[.])*typicalmedia[.]net[/]?", + "version": "1.0.0", + "logo": "https://typicalmedia.net/favi/favicon-96x96.png", + "thumbnail": "https://typicalmedia.net/favi/web-app-manifest-512x512.png", + "color": "#00BCD4", + "tags": [ + "radio", + "music", + "streaming", + "audio", + "entertainment", + "live", + "media" + ], + "category": "music", + "settings": [ + { + "id": "buttons", + "title": "Show Buttons", + "icon": "fas fa-mouse-pointer", + "value": true + }, + { + "id": "timestamps", + "title": "Show Listening Time", + "icon": "fas fa-clock", + "value": true + }, + { + "id": "privacy", + "title": "Privacy Mode (Hide Details)", + "icon": "fas fa-eye-slash", + "value": false + } + ] +} diff --git a/websites/T/Typical Media Group/package.json b/websites/T/Typical Media Group/package.json new file mode 100644 index 000000000000..906792e17268 --- /dev/null +++ b/websites/T/Typical Media Group/package.json @@ -0,0 +1,36 @@ +{ + "name": "typicalmediagroup", + "version": "1.0.0", + "description": "PreMiD Presence for Typical Media Group", + "author": "Typical Media Group", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/PreMiD/Presences" + }, + "scripts": { + "build": "tsc", + "watch": "tsc --watch", + "validate": "premid-validate", + "lint": "eslint . --ext .ts", + "format": "prettier --write \"**/*.{ts,json,md}\"" + }, + "devDependencies": { + "@premid/typescript": "^1.0.0", + "@types/node": "^20.0.0", + "@typescript-eslint/eslint-plugin": "^6.0.0", + "@typescript-eslint/parser": "^6.0.0", + "eslint": "^8.0.0", + "prettier": "^3.0.0", + "typescript": "^5.0.0" + }, + "keywords": [ + "premid", + "presence", + "radio", + "music", + "streaming", + "tmg", + "typical-media-group" + ] +} diff --git a/websites/T/Typical Media Group/presence.ts b/websites/T/Typical Media Group/presence.ts new file mode 100644 index 000000000000..8ca3d55c6a86 --- /dev/null +++ b/websites/T/Typical Media Group/presence.ts @@ -0,0 +1,580 @@ +const presence = new Presence({ + clientId: "1405798741075824793" +}); + +const Assets = { + TmgLogo: "https://i.typicalmedia.net/TMG_NEW.png", + TmgIcon: "https://i.typicalmedia.net/TMG_NEW.png", + Play: "https://i.typicalmedia.net/icons/_states/play.png", + Pause: "https://i.typicalmedia.net/icons/_states/Pause.png", + Browse: "https://i.typicalmedia.net/icons/_states/Browse.png", + Radio: "https://i.typicalmedia.net/icons/_states/Radio.png", + Video: "https://i.typicalmedia.net/icons/_states/Video.png", + Reading: "https://i.typicalmedia.net/icons/_states/Reading.png", + News: "https://i.typicalmedia.net/icons/_states/News.png", + Weather: "https://i.typicalmedia.net/icons/_states/Weather.png", + Contact: "https://i.typicalmedia.net/icons/_states/Contact.png", + Advertising: "https://i.typicalmedia.net/icons/_states/Advertising.png", + Upload: "https://i.typicalmedia.net/icons/_states/Upload.png", + SongNote: "https://i.typicalmedia.net/icons/_states/SongNote.png", + Search: "https://i.typicalmedia.net/icons/_states/Search.png", + Tv: "https://i.typicalmedia.net/icons/_states/Tv.png" +}; + +const strings = presence.getStrings({ + play: 'general.playing', + pause: 'general.paused', + browsing: 'general.browsing', + live: 'general.live', + viewing: 'general.viewing', + reading: 'general.reading', + watching: 'general.watching' +}); + +let startTimestamp: number | null = null; +let lastStation: string | null = null; +let wasPlaying = false; + +function getAlbumArt(): string | null { + const logoElement = document.querySelector('[data-station-logo]'); + let imageUrl = logoElement?.getAttribute('data-station-logo') || (logoElement as HTMLImageElement)?.src; + + if (!imageUrl) { + const imgElements = document.querySelectorAll('img[src*="framerusercontent"], img[src*="typicalmedia"], img[src*="azura"], img[alt*="logo"], img[alt*="station"], img[alt*="album"], img[alt*="art"]'); + for (let i = 0; i < imgElements.length; i++) { + const img = imgElements[i]; + const src = (img as HTMLImageElement).src; + if (src && src.startsWith('http')) { + imageUrl = src; + break; + } + } + } + + if (imageUrl && imageUrl.startsWith('http')) { + return imageUrl; + } + + return null; +} + +function getStationData() { + const stationElement = document.querySelector('[data-station-name]'); + const stationApiUrlElement = document.querySelector('[data-station-apiurl]'); + const trackElement = document.querySelector('[data-track-title]'); + const artistElement = document.querySelector('[data-track-artist]'); + const playingElement = document.querySelector('[data-playing]'); + const sloganElement = document.querySelector('[data-station-slogan]'); + const tunerFreqElement = document.querySelector('[data-tuner-frequency]'); + const signalStrengthElement = document.querySelector('[data-signal-strength]'); + const hdRadioElement = document.querySelector('[data-hd-radio]'); + const hdChannelElement = document.querySelector('[data-hd-channel]'); + const rdsPsElement = document.querySelector('[data-rds-ps]'); + + return { + stationName: stationElement?.getAttribute('data-station-name') || null, + stationApiUrl: stationApiUrlElement?.getAttribute('data-station-apiurl') || null, + slogan: sloganElement?.getAttribute('data-station-slogan') || stationElement?.getAttribute('data-station-slogan') || null, + isPlaying: playingElement?.getAttribute('data-playing') === 'true', + trackTitle: trackElement?.getAttribute('data-track-title') || null, + artistName: artistElement?.getAttribute('data-track-artist') || null, + imageUrl: getAlbumArt(), + tunerFrequency: tunerFreqElement?.getAttribute('data-tuner-frequency') || null, + signalStrength: signalStrengthElement?.getAttribute('data-signal-strength') || null, + isHDRadio: hdRadioElement?.getAttribute('data-hd-radio') === 'true', + hdChannel: hdChannelElement?.getAttribute('data-hd-channel') || null, + rdsPS: rdsPsElement?.getAttribute('data-rds-ps') || null + }; +} + + +function checkLength(text: string, maxLength: number = 128): string { + if (text.length > maxLength) { + return `${text.substring(0, maxLength - 3)}...`; + } + return text; +} + +presence.on("UpdateData", async () => { + const presenceData: PresenceData = {} as PresenceData; + + const showButtons = await presence.getSetting("buttons"); + const privacyMode = await presence.getSetting("privacy"); + const showTimestamps = await presence.getSetting("timestamps"); + + try { + const path = window.location.pathname; + const stationData = getStationData(); + + if (stationData.isPlaying && lastStation !== stationData.stationName) { + startTimestamp = Math.floor(Date.now() / 1000); + lastStation = stationData.stationName; + wasPlaying = true; + } else if (!stationData.isPlaying && wasPlaying) { + startTimestamp = null; + wasPlaying = false; + } + + if (stationData.stationName) { + if (stationData.imageUrl) { + presenceData.largeImageKey = stationData.imageUrl; + presenceData.largeImageText = checkLength(stationData.stationName); + } else { + presenceData.largeImageKey = Assets.TmgLogo; + presenceData.largeImageText = checkLength(stationData.stationName); + } + + const isSecretRadio = path.startsWith('/secret-radio') || stationData.tunerFrequency !== null; + + if (stationData.isPlaying) { + if (stationData.trackTitle && stationData.artistName && stationData.trackTitle !== 'Live Radio') { + presenceData.details = privacyMode + ? "Listening to music" + : checkLength(stationData.trackTitle); + + let stateText = privacyMode + ? "on a station" + : checkLength(`${stationData.artistName} • ${stationData.stationName}`); + + // Add frequency for Secret Radio even with track info + if (isSecretRadio && stationData.tunerFrequency) { + stateText += ` • FM ${stationData.tunerFrequency}`; + } + + if (isSecretRadio && stationData.isHDRadio && stationData.hdChannel) { + stateText += ` • HD${stationData.hdChannel}`; + } + + presenceData.state = checkLength(stateText); + } else { + let detailsText = privacyMode + ? "Listening to radio" + : checkLength(`Listening to ${stationData.stationName}`); + + if (isSecretRadio && stationData.tunerFrequency) { + detailsText = privacyMode + ? `Tuned to FM ${stationData.tunerFrequency}` + : `${stationData.stationName} • FM ${stationData.tunerFrequency}`; + } + + presenceData.details = detailsText; + + let stateText = privacyMode ? "Live" : checkLength(stationData.slogan || "Live Radio"); + + if (isSecretRadio) { + // Add RDS PS text in brackets like real FM radios + if (stationData.rdsPS) { + stateText = `((( ${stationData.rdsPS.trim()} )))`; + } + + if (stationData.isHDRadio && stationData.hdChannel) { + stateText += ` • HD${stationData.hdChannel}`; + } + if (stationData.signalStrength) { + const strength = parseInt(stationData.signalStrength); + const bars = strength > 85 ? '▰▰▰▰▰' : strength > 70 ? '▰▰▰▰▱' : strength > 50 ? '▰▰▰▱▱' : strength > 30 ? '▰▰▱▱▱' : '▰▱▱▱▱'; + stateText += ` • ${bars}`; + } + } + + presenceData.state = checkLength(stateText); + } + + presenceData.smallImageKey = Assets.Play; + presenceData.smallImageText = (await strings).play; + + if (showTimestamps && startTimestamp) { + presenceData.startTimestamp = startTimestamp; + } + + if (showButtons && !privacyMode) { + if (isSecretRadio) { + presenceData.buttons = [ + { + label: "Open Radio Tuner", + url: "https://typicalmedia.net/secret-radio" + } + ]; + } else if (stationData.stationApiUrl) { + presenceData.buttons = [ + { + label: "Listen Live", + url: `https://typicalmedia.net/station/${stationData.stationApiUrl}` + }, + { + label: "View All Stations", + url: "https://typicalmedia.net/stations" + } + ]; + } + } + } else { + presenceData.details = privacyMode + ? "Viewing a station" + : checkLength(`Viewing ${stationData.stationName}`); + + let stateText = checkLength(stationData.slogan || "Paused"); + + if (isSecretRadio && stationData.tunerFrequency) { + stateText = `Tuned to FM ${stationData.tunerFrequency}`; + } + + presenceData.state = stateText; + presenceData.smallImageKey = Assets.Pause; + presenceData.smallImageText = (await strings).pause; + + if (showButtons && !privacyMode) { + if (isSecretRadio) { + presenceData.buttons = [ + { + label: "Open Radio Tuner", + url: "https://typicalmedia.net/secret-radio" + } + ]; + } else if (stationData.stationApiUrl) { + presenceData.buttons = [ + { + label: "View Station", + url: `https://typicalmedia.net/station/${stationData.stationApiUrl}` + } + ]; + } + } + } + } else { + if (path === '/' || path === '/home') { + presenceData.details = "Browsing Home"; + presenceData.state = "Discovering stations"; + presenceData.smallImageKey = Assets.Browse; + presenceData.smallImageText = (await strings).browsing; + + if (showButtons && !privacyMode) { + presenceData.buttons = [ + { label: "Visit Home", url: "https://typicalmedia.net" } + ]; + } + } else if (path === '/stations') { + presenceData.details = "Browsing Stations"; + presenceData.state = "Looking for music"; + presenceData.smallImageKey = Assets.Radio; + presenceData.smallImageText = "Browsing Stations"; + + if (showButtons && !privacyMode) { + presenceData.buttons = [ + { label: "View Stations", url: "https://typicalmedia.net/stations" } + ]; + } + } else if (path.startsWith('/station/')) { + const stationSlug = path.replace('/station/', '').split('?')[0]; + + if (stationSlug) { + const stationTitle = stationSlug + .split('-') + .map(word => word.charAt(0).toUpperCase() + word.slice(1)) + .join(' '); + + presenceData.details = `Viewing ${stationTitle}`; + presenceData.state = "Exploring station"; + presenceData.smallImageKey = Assets.Radio; + presenceData.smallImageText = "Viewing Station"; + + if (showButtons && !privacyMode) { + presenceData.buttons = [ + { label: "View Station", url: window.location.href } + ]; + } + } + } else if (path.startsWith('/aurora-tv')) { + if (path.includes('/broadcasts')) { + presenceData.details = "Watching Broadcasts"; + presenceData.state = "Aurora TV"; + presenceData.smallImageKey = Assets.Radio; + presenceData.smallImageText = (await strings).live; + } else if (path.includes('/shows')) { + presenceData.details = "Browsing Shows"; + presenceData.state = "Aurora TV"; + presenceData.smallImageKey = Assets.Video; + presenceData.smallImageText = "Watching Shows"; + } else if (path.includes('/socials')) { + presenceData.details = "Viewing Social Posts"; + presenceData.state = "Aurora TV"; + presenceData.smallImageKey = Assets.Reading; + presenceData.smallImageText = "Reading Socials"; + } else if (path.includes('/articles')) { + presenceData.details = "Reading Articles"; + presenceData.state = "Aurora TV"; + presenceData.smallImageKey = Assets.News; + presenceData.smallImageText = "Reading Articles"; + } else if (path.includes('/advances')) { + presenceData.details = "Viewing Advances"; + presenceData.state = "Aurora TV"; + presenceData.smallImageKey = Assets.Reading; + presenceData.smallImageText = "Reading Advances"; + } else { + presenceData.details = "Browsing Aurora TV"; + presenceData.state = "Entertainment & News"; + presenceData.smallImageKey = Assets.Video; + presenceData.smallImageText = "Browsing TV"; + } + + if (showButtons && !privacyMode) { + presenceData.buttons = [ + { label: "Watch Aurora TV", url: "https://typicalmedia.net/aurora-tv" } + ]; + } + } else if (path.startsWith('/news')) { + const newsTitle = document.querySelector('h1')?.textContent; + const category = document.querySelector('[data-category]')?.textContent; + const author = document.querySelector('[data-author]')?.textContent; + + if (path.includes('/post/') && newsTitle) { + presenceData.details = "Reading Article"; + presenceData.state = checkLength(newsTitle); + presenceData.smallImageKey = Assets.News; + presenceData.smallImageText = "Reading News"; + + if (showButtons && !privacyMode) { + presenceData.buttons = [ + { label: "Read Article", url: window.location.href }, + { label: "View News", url: "https://typicalmedia.net/news" } + ]; + } + } else if (path.includes('/category/') && category) { + presenceData.details = `Browsing ${category}`; + presenceData.state = "News Category"; + presenceData.smallImageKey = Assets.News; + presenceData.smallImageText = "Browsing News"; + + if (showButtons && !privacyMode) { + presenceData.buttons = [ + { label: "View Category", url: window.location.href } + ]; + } + } else if (path.includes('/author/') && author) { + presenceData.details = `Reading by ${author}`; + presenceData.state = "News Author"; + presenceData.smallImageKey = Assets.News; + presenceData.smallImageText = "Reading News"; + + if (showButtons && !privacyMode) { + presenceData.buttons = [ + { label: "View Author", url: window.location.href } + ]; + } + } else { + presenceData.details = "Browsing News"; + presenceData.state = "Staying informed"; + presenceData.smallImageKey = Assets.News; + presenceData.smallImageText = "Browsing News"; + + if (showButtons && !privacyMode) { + presenceData.buttons = [ + { label: "Read News", url: "https://typicalmedia.net/news" } + ]; + } + } + } else if (path === '/weather') { + presenceData.details = "Checking Weather"; + presenceData.state = "Local forecast"; + presenceData.smallImageKey = Assets.Weather; + presenceData.smallImageText = "Viewing Weather"; + + if (showButtons && !privacyMode) { + presenceData.buttons = [ + { label: "View Weather", url: "https://typicalmedia.net/weather" } + ]; + } + } else if (path === '/about') { + presenceData.details = "Learning About TMG"; + presenceData.state = "Company information"; + presenceData.smallImageKey = Assets.Reading; + presenceData.smallImageText = "Reading About"; + + if (showButtons && !privacyMode) { + presenceData.buttons = [ + { label: "About TMG", url: "https://typicalmedia.net/about" } + ]; + } + } else if (path === '/contact') { + presenceData.details = "Contact Page"; + presenceData.state = "Getting in touch"; + presenceData.smallImageKey = Assets.Contact; + presenceData.smallImageText = "Contact Form"; + + if (showButtons && !privacyMode) { + presenceData.buttons = [ + { label: "Contact Us", url: "https://typicalmedia.net/contact" } + ]; + } + } else if (path.startsWith('/advertising')) { + if (path.includes('/cost')) { + presenceData.details = "Viewing Advertising Costs"; + presenceData.state = "Planning campaign"; + } else if (path.includes('/faq')) { + presenceData.details = "Reading Advertising FAQ"; + presenceData.state = "Getting answers"; + } else if (path.includes('/how-to-get-started')) { + presenceData.details = "Getting Started"; + presenceData.state = "Advertising Guide"; + } else if (path.includes('/is-radio-right')) { + presenceData.details = "Is Radio Right?"; + presenceData.state = "Learning about radio advertising"; + } else if (path.includes('/should-i-advertise')) { + presenceData.details = "Should I Advertise?"; + presenceData.state = "Exploring options"; + } else { + presenceData.details = "Browsing Advertising"; + presenceData.state = "Business solutions"; + } + + presenceData.smallImageKey = Assets.Advertising; + presenceData.smallImageText = "Advertising Info"; + + if (showButtons && !privacyMode) { + presenceData.buttons = [ + { label: "Advertise with Us", url: "https://typicalmedia.net/advertising" } + ]; + } + } else if (path === '/broadcast') { + presenceData.details = "Broadcast Services"; + presenceData.state = "Professional solutions"; + presenceData.smallImageKey = Assets.Radio; + presenceData.smallImageText = "Broadcast Services"; + + if (showButtons && !privacyMode) { + presenceData.buttons = [ + { label: "Learn More", url: "https://typicalmedia.net/broadcast" } + ]; + } + } else if (path === '/submit-station') { + presenceData.details = "Submitting Station"; + presenceData.state = "Adding new content"; + presenceData.smallImageKey = Assets.Upload; + presenceData.smallImageText = "Uploading Station"; + + if (showButtons && !privacyMode) { + presenceData.buttons = [ + { label: "Submit Station", url: "https://typicalmedia.net/submit-station" } + ]; + } + } else if (path === '/music-submission') { + presenceData.details = "Submitting Music"; + presenceData.state = "Sharing content"; + presenceData.smallImageKey = Assets.SongNote; + presenceData.smallImageText = "Submitting Music"; + + if (showButtons && !privacyMode) { + presenceData.buttons = [ + { label: "Submit Music", url: "https://typicalmedia.net/music-submission" } + ]; + } + } else if (path.startsWith('/contest')) { + if (path.includes('/success')) { + presenceData.details = "Contest Entry Submitted"; + presenceData.state = "Good luck!"; + } else if (path === '/contests') { + presenceData.details = "Browsing Contests"; + presenceData.state = "Win prizes!"; + } else { + const contestTitle = document.querySelector('h1')?.textContent; + presenceData.details = contestTitle ? checkLength(contestTitle) : "Viewing Contest"; + presenceData.state = "Enter to win"; + } + + if (showButtons && !privacyMode) { + presenceData.buttons = [ + { label: "View Contests", url: "https://typicalmedia.net/contests" } + ]; + } + } else if (path === '/portfolio') { + presenceData.details = "Viewing Portfolio"; + presenceData.state = "Our work"; + + if (showButtons && !privacyMode) { + presenceData.buttons = [ + { label: "View Portfolio", url: "https://typicalmedia.net/portfolio" } + ]; + } + } else if (path === '/media-kit') { + presenceData.details = "Viewing Media Kit"; + presenceData.state = "Brand resources"; + + if (showButtons && !privacyMode) { + presenceData.buttons = [ + { label: "Download Media Kit", url: "https://typicalmedia.net/media-kit" } + ]; + } + } else if (path === '/privacy-policy') { + presenceData.details = "Reading Privacy Policy"; + presenceData.state = "Legal information"; + } else if (path === '/terms-of-service') { + presenceData.details = "Reading Terms of Service"; + presenceData.state = "Legal information"; + } else if (path === '/contest-rules') { + presenceData.details = "Reading Contest Rules"; + presenceData.state = "Official rules"; + } else if (path.startsWith('/embed')) { + presenceData.details = "Embedded Player"; + presenceData.state = "Listening"; + } else if (path.startsWith('/secret-radio')) { + const tunerFreq = document.querySelector('[data-tuner-frequency]')?.getAttribute('data-tuner-frequency'); + const signalStrength = document.querySelector('[data-signal-strength]')?.getAttribute('data-signal-strength'); + + presenceData.details = "Using Radio Tuner"; + + if (tunerFreq) { + let stateText = `Tuned to FM ${tunerFreq}`; + + if (signalStrength) { + const strength = parseInt(signalStrength); + if (strength < 30) { + stateText += " • Scanning..."; + } else if (strength < 70) { + stateText += " • Weak signal"; + } + } + + presenceData.state = stateText; + } else { + presenceData.state = "Scanning frequencies"; + } + + presenceData.smallImageKey = Assets.Search; + presenceData.smallImageText = (await strings).browsing; + + if (showButtons && !privacyMode) { + presenceData.buttons = [ + { label: "Open Radio Tuner", url: "https://typicalmedia.net/secret-radio" } + ]; + } + } else { + presenceData.details = "Browsing TMG"; + presenceData.state = (await strings).browsing; + presenceData.smallImageKey = Assets.TmgIcon; + presenceData.smallImageText = "Typical Media Group"; + + if (showButtons && !privacyMode) { + presenceData.buttons = [ + { label: "Visit Website", url: "https://typicalmedia.net" } + ]; + } + } + } + } catch (error) { + console.error("[PreMiD] Error:", error); + presenceData.details = "Browsing TMG"; + } + + if (!presenceData.largeImageKey) { + presenceData.largeImageKey = Assets.TmgLogo; + presenceData.largeImageText = "Typical Media Group"; + } + + if (!presenceData.details) { + presenceData.details = "Browsing TMG"; + } + + if (presenceData.details || presenceData.state) { + presence.setActivity(presenceData); + } +}); From dd2aaee69631782b574316295e3c799e5693ac0b Mon Sep 17 00:00:00 2001 From: Seehed Date: Tue, 23 Dec 2025 20:00:35 -1000 Subject: [PATCH 2/4] feat(activity): add BVF Radio and City Radio --- websites/B/BVF Radio/metadata.json | 49 +++++ websites/B/BVF Radio/presence.ts | 291 ++++++++++++++++++++++++++ websites/C/City Radio/README.md | 82 ++++++++ websites/C/City Radio/metadata.json | 44 ++++ websites/C/City Radio/presence.ts | 310 ++++++++++++++++++++++++++++ 5 files changed, 776 insertions(+) create mode 100644 websites/B/BVF Radio/metadata.json create mode 100644 websites/B/BVF Radio/presence.ts create mode 100644 websites/C/City Radio/README.md create mode 100644 websites/C/City Radio/metadata.json create mode 100644 websites/C/City Radio/presence.ts diff --git a/websites/B/BVF Radio/metadata.json b/websites/B/BVF Radio/metadata.json new file mode 100644 index 000000000000..84c8a375d1f0 --- /dev/null +++ b/websites/B/BVF Radio/metadata.json @@ -0,0 +1,49 @@ +{ + "$schema": "https://schemas.premid.app/metadata/1.7", + "author": { + "name": "Seehed", + "id": "1030394088974991423" + }, + "contributors": [], + "service": "BVF Radio", + "altnames": ["BVF Your Home For House", "BVF"], + "description": { + "en": "Your Home For House" + }, + "url": [ + "bvf.wtf", + "https://bvf.bolt.host/" + ], + "version": "1.0.0", + "logo": "https://i.typicalmedia.net/stationlogos/bvf.png", + "thumbnail": "https://i.typicalmedia.net/stationlogos/bvf.png", + "color": "#EC4899", + "tags": [ + "music", + "radio", + "entertainment", + "live", + "podcast" + ], + "category": "music", + "settings": [ + { + "id": "showButtons", + "title": "Show Buttons", + "icon": "fas fa-mouse-pointer", + "value": true + }, + { + "id": "showTimestamp", + "title": "Show Timestamp", + "icon": "fas fa-clock", + "value": true + }, + { + "id": "showSongInfo", + "title": "Show Song Info", + "icon": "fas fa-music", + "value": true + } + ] +} diff --git a/websites/B/BVF Radio/presence.ts b/websites/B/BVF Radio/presence.ts new file mode 100644 index 000000000000..36a6744f957a --- /dev/null +++ b/websites/B/BVF Radio/presence.ts @@ -0,0 +1,291 @@ +const presence = new Presence({ + clientId: "1439901141579071641" +}); + +const CustomAssets = { + Play: "https://i.typicalmedia.net/icons/_states/play.png", + Pause: "https://i.typicalmedia.net/icons/_states/Pause.png", + Browse: "https://i.typicalmedia.net/icons/_states/Browse.png", + Radio: "https://i.typicalmedia.net/icons/_states/Radio.png", + Video: "https://i.typicalmedia.net/icons/_states/Video.png", + Reading: "https://i.typicalmedia.net/icons/_states/Reading.png", + News: "https://i.typicalmedia.net/icons/_states/News.png", + Weather: "https://i.typicalmedia.net/icons/_states/Weather.png", + Contact: "https://i.typicalmedia.net/icons/_states/Contact.png", + Advertising: "https://i.typicalmedia.net/icons/_states/Advertising.png", + Upload: "https://i.typicalmedia.net/icons/_states/Upload.png", + SongNote: "https://i.typicalmedia.net/icons/_states/SongNote.png", + Search: "https://i.typicalmedia.net/icons/_states/Search.png", + Tv: "https://i.typicalmedia.net/icons/_states/Tv.png", + RadioShows: "https://i.typicalmedia.net/icons/_states/RadioShows.png", + Podcast: "https://i.typicalmedia.net/icons/_states/Podcast.png", + Calendar: "https://i.typicalmedia.net/icons/_states/Calendar.png" +}; + +let lastPlaybackState = false; +let startTimestamp = Date.now(); + +presence.on("UpdateData", async () => { + const presenceData = {} as PresenceData; + + const settings = await presence.getSetting("showButtons"); + const showTimestamp = await presence.getSetting("showTimestamp"); + const showSongInfo = await presence.getSetting("showSongInfo"); + + const path = window.location.pathname; + const hostname = window.location.hostname; + + const isPlaying = document.querySelector('button[aria-label="Pause"]') !== null; + + if (isPlaying !== lastPlaybackState) { + startTimestamp = Date.now(); + lastPlaybackState = isPlaying; + } + + if (path === "/" || path === "") { + const currentSongTitle = document.querySelector('h2.text-4xl.md\\:text-5xl.font-black.text-white')?.textContent?.trim(); + const currentArtist = document.querySelector('p.text-2xl.text-gray-300.font-bold')?.textContent?.trim(); + const artwork = document.querySelector('.aspect-square img')?.getAttribute('src'); + const liveDJ = document.querySelector('p.text-white.text-sm.font-black')?.textContent?.trim(); + + presenceData.largeImageKey = artwork || "https://i.typicalmedia.net/stationlogos/bvf.png"; + presenceData.largeImageText = liveDJ ? `Live with ${liveDJ}` : "BVF Radio"; + + if (isPlaying && currentSongTitle && currentArtist && showSongInfo) { + presenceData.details = "Listening to BVF"; + presenceData.state = `${currentSongTitle} - ${currentArtist}`; + presenceData.smallImageKey = CustomAssets.Play; + presenceData.smallImageText = "Playing"; + + if (showTimestamp) { + presenceData.startTimestamp = startTimestamp; + } + + if (settings) { + presenceData.buttons = [ + { + label: "Listen Live", + url: `https://${hostname}` + } + ]; + } + } else if (isPlaying) { + presenceData.details = "Listening to BVF Radio"; + presenceData.state = "Live Stream"; + presenceData.smallImageKey = CustomAssets.Radio; + presenceData.smallImageText = "BVF"; + + if (showTimestamp) { + presenceData.startTimestamp = startTimestamp; + } + } else { + presenceData.details = "Browsing Home"; + presenceData.state = "BVF Radio"; + presenceData.smallImageKey = CustomAssets.Browse; + presenceData.smallImageText = "Browsing"; + } + } else if (path.startsWith("/shows")) { + if (path === "/shows" || path === "/shows/") { + presenceData.largeImageKey = "https://i.typicalmedia.net/stationlogos/bvf.png"; + presenceData.largeImageText = "BVF Radio"; + presenceData.details = "Browsing Shows"; + presenceData.state = "Viewing all shows"; + presenceData.smallImageKey = CustomAssets.RadioShows; + presenceData.smallImageText = "Radio Shows"; + } else { + const showTitle = document.querySelector('h1.text-3xl.md\\:text-5xl.font-black.text-white')?.textContent?.trim(); + const showImage = document.querySelector('.w-48.h-48.rounded-2xl img, .aspect-square img')?.getAttribute('src'); + + presenceData.largeImageKey = showImage || "https://i.typicalmedia.net/stationlogos/bvf.png"; + presenceData.largeImageText = showTitle || "BVF Radio"; + + if (showTitle) { + presenceData.details = "Viewing Show"; + presenceData.state = showTitle; + presenceData.smallImageKey = CustomAssets.RadioShows; + presenceData.smallImageText = "Radio Show"; + + if (settings) { + presenceData.buttons = [ + { + label: "View Show", + url: window.location.href + } + ]; + } + } + } + } else if (path.startsWith("/jocks") || path.startsWith("/presenters")) { + if (path === "/jocks" || path === "/jocks/" || path === "/presenters" || path === "/presenters/") { + presenceData.largeImageKey = "https://i.typicalmedia.net/stationlogos/bvf.png"; + presenceData.largeImageText = "BVF Radio"; + presenceData.details = "Browsing Presenters"; + presenceData.state = "Viewing all presenters"; + presenceData.smallImageKey = CustomAssets.Browse; + presenceData.smallImageText = "Browsing"; + } else { + const jockName = document.querySelector('h1.text-3xl.md\\:text-5xl.font-black.text-white')?.textContent?.trim(); + const jockImage = document.querySelector('.w-48.h-48.rounded-2xl img, .aspect-square img')?.getAttribute('src'); + + presenceData.largeImageKey = jockImage || "https://i.typicalmedia.net/stationlogos/bvf.png"; + presenceData.largeImageText = jockName || "BVF Radio"; + + if (jockName) { + presenceData.details = "Viewing Presenter"; + presenceData.state = jockName; + presenceData.smallImageKey = CustomAssets.Radio; + presenceData.smallImageText = "Presenter"; + + if (settings) { + presenceData.buttons = [ + { + label: "View Profile", + url: window.location.href + } + ]; + } + } + } + } else if (path.startsWith("/podcasts")) { + if (path === "/podcasts" || path === "/podcasts/") { + presenceData.largeImageKey = "https://i.typicalmedia.net/stationlogos/bvf.png"; + presenceData.largeImageText = "BVF Radio"; + presenceData.details = "Browsing Podcasts"; + presenceData.state = "Viewing all podcasts"; + presenceData.smallImageKey = CustomAssets.Podcast; + presenceData.smallImageText = "Podcasts"; + } else { + const podcastTitle = document.querySelector('h1.text-4xl.md\\:text-5xl.font-black.text-white')?.textContent?.trim(); + const episodePlaying = document.querySelector('button[aria-label="Pause"]') !== null; + const episodeTitle = document.querySelector('h2.text-4xl.md\\:text-5xl.font-black.text-white')?.textContent?.trim(); + const podcastImage = document.querySelector('.aspect-square img, .w-full.max-w-sm img')?.getAttribute('src'); + + presenceData.largeImageKey = podcastImage || "https://i.typicalmedia.net/stationlogos/bvf.png"; + presenceData.largeImageText = podcastTitle || "BVF Radio"; + + if (episodePlaying && episodeTitle) { + presenceData.details = `Listening to ${podcastTitle || 'Podcast'}`; + presenceData.state = episodeTitle; + presenceData.smallImageKey = CustomAssets.Play; + presenceData.smallImageText = "Playing Episode"; + + if (showTimestamp) { + presenceData.startTimestamp = startTimestamp; + } + + if (settings) { + presenceData.buttons = [ + { + label: "Listen Now", + url: window.location.href + } + ]; + } + } else if (podcastTitle) { + presenceData.details = "Viewing Podcast"; + presenceData.state = podcastTitle; + presenceData.smallImageKey = CustomAssets.Podcast; + presenceData.smallImageText = "Podcast"; + + if (settings) { + presenceData.buttons = [ + { + label: "View Podcast", + url: window.location.href + } + ]; + } + } + } + } else if (path.startsWith("/news")) { + const articleTitle = document.querySelector('h1.text-4xl.md\\:text-5xl.font-black.text-white')?.textContent?.trim(); + const articleImage = document.querySelector('.aspect-video img')?.getAttribute('src'); + + presenceData.largeImageKey = articleImage || "https://i.typicalmedia.net/stationlogos/bvf.png"; + presenceData.largeImageText = articleTitle || "BVF Media Group"; + + if (articleTitle) { + presenceData.details = "Reading News"; + presenceData.state = articleTitle.length > 50 ? articleTitle.substring(0, 47) + "..." : articleTitle; + presenceData.smallImageKey = CustomAssets.Reading; + presenceData.smallImageText = "Reading"; + + if (settings) { + presenceData.buttons = [ + { + label: "Read Article", + url: window.location.href + } + ]; + } + } else { + presenceData.largeImageKey = "https://i.typicalmedia.net/stationlogos/bvf.png"; + presenceData.largeImageText = "BVF Radio"; + presenceData.details = "Browsing News"; + presenceData.state = "BVF Media Group"; + presenceData.smallImageKey = CustomAssets.News; + presenceData.smallImageText = "News"; + } + } else if (path.startsWith("/articles")) { + const articleTitle = document.querySelector('h1')?.textContent?.trim(); + const articleImage = document.querySelector('img')?.getAttribute('src'); + const contentType = path.includes('/articles/') ? 'Article' : 'Content'; + + presenceData.largeImageKey = articleImage || "https://i.typicalmedia.net/stationlogos/bvf.png"; + presenceData.largeImageText = articleTitle || "TMG Media Hub"; + + if (articleTitle) { + presenceData.details = `Reading ${contentType}`; + presenceData.state = articleTitle.length > 50 ? articleTitle.substring(0, 47) + "..." : articleTitle; + presenceData.smallImageKey = CustomAssets.Reading; + presenceData.smallImageText = "Reading"; + + if (settings) { + presenceData.buttons = [ + { + label: `Read ${contentType}`, + url: window.location.href + } + ]; + } + } else { + presenceData.largeImageKey = "https://i.typicalmedia.net/stationlogos/bvf.png"; + presenceData.largeImageText = "BVF Radio"; + presenceData.details = "Browsing Content"; + presenceData.state = "TMG Media Hub"; + presenceData.smallImageKey = CustomAssets.Browse; + presenceData.smallImageText = "Browsing"; + } + } else if (path === "/contact") { + presenceData.largeImageKey = "https://i.typicalmedia.net/stationlogos/bvf.png"; + presenceData.largeImageText = "BVF Radio"; + presenceData.details = "Contact Page"; + presenceData.state = "Getting in touch"; + presenceData.smallImageKey = CustomAssets.Contact; + presenceData.smallImageText = "Contact"; + } else if (path.startsWith("/staff")) { + presenceData.largeImageKey = "https://i.typicalmedia.net/stationlogos/bvf.png"; + presenceData.largeImageText = "BVF Radio"; + if (path === "/staff/login") { + presenceData.details = "Staff Login"; + presenceData.state = "Accessing staff area"; + presenceData.smallImageKey = CustomAssets.Browse; + presenceData.smallImageText = "Login"; + } else { + presenceData.details = "Staff Dashboard"; + presenceData.state = "Managing station"; + presenceData.smallImageKey = CustomAssets.Upload; + presenceData.smallImageText = "Staff Area"; + } + } else { + presenceData.largeImageKey = "https://i.typicalmedia.net/stationlogos/bvf.png"; + presenceData.largeImageText = "BVF Radio"; + presenceData.details = "Browsing BVF Radio"; + presenceData.state = "Exploring the site"; + presenceData.smallImageKey = CustomAssets.Browse; + presenceData.smallImageText = "Browsing"; + } + + + presence.setActivity(presenceData); +}); diff --git a/websites/C/City Radio/README.md b/websites/C/City Radio/README.md new file mode 100644 index 000000000000..e36143a96fee --- /dev/null +++ b/websites/C/City Radio/README.md @@ -0,0 +1,82 @@ +# City Radio PreMiD Presence + +This is the official PreMiD presence for City Radio. + +## Features + +- Shows current page being viewed +- Displays live radio listening status with song information +- Shows podcast playback status +- Displays show and jock information when browsing +- Customizable settings for timestamps, buttons, and song info +- Full support for all City Radio pages + +## Settings + +- **Show Timestamps**: Toggle elapsed time display +- **Show Buttons**: Toggle clickable buttons in Discord +- **Show Song Info When Playing**: Display current song and artist when listening to radio + +## Installation + +### For Users + +1. Install [PreMiD](https://premid.app/) application and browser extension +2. The presence will automatically be available once submitted to PreMiD store +3. Visit [City Radio](https://cityradio.typicalmedia.net) and your status will update + +### For Development + +1. Clone the PreMiD presences repository: +```bash +git clone https://github.com/PreMiD/Presences +``` + +2. Copy the `premid` folder contents to `Presences/websites/C/City Radio/` + +3. Build the presence: +```bash +cd "Presences/websites/C/City Radio" +tsc -b +``` + +4. Load the presence in PreMiD for testing + +## Supported Pages + +- **Home** - Shows browsing or listening status +- **Shows** - Browse all shows or view individual show details +- **Jocks** - Browse jocks or view jock profiles +- **Podcasts** - Browse podcasts or listen to episodes +- **TMG Content** - Read news articles and content +- **Contact** - Contact page +- **Staff Dashboard** - Staff management area (with privacy) + +## Status Examples + +- "Listening to Live Radio" - When playing the live stream +- "🎵 Song Title by Artist" - When a song is playing (if enabled in settings) +- "Viewing Show: Morning Show" - When viewing a show page +- "🎧 Podcast Name: Episode Title" - When playing a podcast +- "Reading News: Article Title" - When reading news + +## Custom Assets + +The presence uses custom image assets for different states: +- Play/Pause indicators +- Radio, Podcast, News icons +- Browse, Contact, and other state icons + +All assets are hosted on Typical Media's CDN. + +## Support + +For issues or suggestions, contact the development team or open an issue on the PreMiD Presences repository. + +## Author + +- **Seehed** (Discord ID: 1030394088974991423) + +## Version + +Current version: 1.0.0 diff --git a/websites/C/City Radio/metadata.json b/websites/C/City Radio/metadata.json new file mode 100644 index 000000000000..2efba7f6c518 --- /dev/null +++ b/websites/C/City Radio/metadata.json @@ -0,0 +1,44 @@ +{ + "$schema": "https://schemas.premid.app/metadata/1.7", + "author": { + "name": "Seehed", + "id": "1030394088974991423" + }, + "contributors": [], + "service": "City Radio", + "description": { + "en": "City Radio--Mega Manila's Hit Music Station!" + }, + "url": [ + "935cityradio.com", + "www.935cityradio.com", + "cityradio.typicalmedia.net" + ], + "version": "1.0.0", + "logo": "https://i.typicalmedia.net/stationlogos/cityradio.jpg", + "thumbnail": "https://i.typicalmedia.net/stationlogos/cityradio.jpg", + "color": "#FF1744", + "tags": ["radio", "music", "podcast", "media", "entertainment"], + "category": "music", + "iframe": false, + "settings": [ + { + "id": "showTimestamp", + "title": "Show Timestamps", + "icon": "fas fa-clock", + "value": true + }, + { + "id": "showButtons", + "title": "Show Buttons", + "icon": "fas fa-link", + "value": true + }, + { + "id": "showSongInfo", + "title": "Show Song Info When Playing", + "icon": "fas fa-music", + "value": true + } + ] +} diff --git a/websites/C/City Radio/presence.ts b/websites/C/City Radio/presence.ts new file mode 100644 index 000000000000..6dbec3547022 --- /dev/null +++ b/websites/C/City Radio/presence.ts @@ -0,0 +1,310 @@ +const presence = new Presence({ + clientId: "1172085751534592071" +}); + +const CustomAssets = { + Play: "https://i.typicalmedia.net/icons/_states/play.png", + Pause: "https://i.typicalmedia.net/icons/_states/Pause.png", + Browse: "https://i.typicalmedia.net/icons/_states/Browse.png", + Radio: "https://i.typicalmedia.net/icons/_states/Radio.png", + Video: "https://i.typicalmedia.net/icons/_states/Video.png", + Reading: "https://i.typicalmedia.net/icons/_states/Reading.png", + News: "https://i.typicalmedia.net/icons/_states/News.png", + Weather: "https://i.typicalmedia.net/icons/_states/Weather.png", + Contact: "https://i.typicalmedia.net/icons/_states/Contact.png", + Advertising: "https://i.typicalmedia.net/icons/_states/Advertising.png", + Upload: "https://i.typicalmedia.net/icons/_states/Upload.png", + SongNote: "https://i.typicalmedia.net/icons/_states/SongNote.png", + Search: "https://i.typicalmedia.net/icons/_states/Search.png", + Tv: "https://i.typicalmedia.net/icons/_states/Tv.png", + RadioShows: "https://i.typicalmedia.net/icons/_states/RadioShows.png", + Podcast: "https://i.typicalmedia.net/icons/_states/Podcast.png", + Calendar: "https://i.typicalmedia.net/icons/_states/Calendar.png" +}; + +presence.on("UpdateData", async () => { + const presenceData: PresenceData = { + largeImageKey: "http://i.typicalmedia.net/stationlogos/cityradio.jpg", + startTimestamp: Date.now() + }, + { pathname, href, search } = document.location, + [ + showTimestamp, + showButtons, + showSongInfo + ] = await Promise.all([ + presence.getSetting("showTimestamp"), + presence.getSetting("showButtons"), + presence.getSetting("showSongInfo") + ]); + + if (!showTimestamp) delete presenceData.startTimestamp; + + // Check if audio player is active + const audioElement = document.querySelector('audio[data-premid-mode]') as HTMLAudioElement; + const isPlaying = audioElement?.getAttribute('data-premid-playing') === 'true'; + const playerMode = audioElement?.getAttribute('data-premid-mode'); + const songTitle = document.querySelector('[data-premid-title]')?.getAttribute('data-premid-title'); + const songArtist = document.querySelector('[data-premid-subtitle]')?.getAttribute('data-premid-subtitle'); + const podcastName = audioElement?.getAttribute('data-premid-podcast-name'); + const episodeName = audioElement?.getAttribute('data-premid-episode-name'); + const artwork = audioElement?.getAttribute('data-premid-artwork'); + + // Home page + if (pathname === "/" || pathname === "/home") { + if (isPlaying && playerMode === 'radio' && showSongInfo && songTitle) { + if (artwork) presenceData.largeImageKey = artwork; + presenceData.details = `🎵 ${songTitle}`; + if (songArtist) presenceData.state = `by ${songArtist}`; + presenceData.smallImageKey = CustomAssets.Play; + presenceData.smallImageText = "Listening to Radio"; + } else if (isPlaying && playerMode === 'radio') { + if (artwork) presenceData.largeImageKey = artwork; + presenceData.details = "Listening to Live Radio"; + presenceData.state = "City Radio - Live Stream"; + presenceData.smallImageKey = CustomAssets.Radio; + presenceData.smallImageText = "Live Radio"; + } else if (isPlaying && playerMode === 'podcast' && episodeName && podcastName) { + if (artwork) presenceData.largeImageKey = artwork; + presenceData.details = `🎧 ${podcastName}`; + presenceData.state = episodeName; + presenceData.smallImageKey = CustomAssets.Play; + presenceData.smallImageText = "Listening to Podcast"; + } else { + presenceData.details = "Viewing Home Page"; + presenceData.state = "Browsing City Radio"; + presenceData.smallImageKey = CustomAssets.Browse; + presenceData.smallImageText = "Browsing"; + } + + if (showButtons) { + presenceData.buttons = [ + { + label: "Listen Now", + url: href + } + ]; + } + } + + // Shows page + else if (pathname === "/shows") { + presenceData.details = "Browsing Shows"; + presenceData.state = "Looking for radio shows"; + presenceData.smallImageKey = CustomAssets.RadioShows; + presenceData.smallImageText = "Radio Shows"; + + if (showButtons) { + presenceData.buttons = [ + { + label: "View Shows", + url: href + } + ]; + } + } + + // Individual show page + else if (pathname.startsWith("/shows/")) { + const showTitle = document.querySelector('[data-premid-show-title]')?.getAttribute('data-premid-show-title'); + const showImage = document.querySelector('[data-premid-show-image]')?.getAttribute('data-premid-show-image'); + if (showTitle) { + if (showImage) presenceData.largeImageKey = showImage; + presenceData.details = "Viewing Show"; + presenceData.state = showTitle; + presenceData.smallImageKey = CustomAssets.RadioShows; + presenceData.smallImageText = "Show Details"; + + if (showButtons) { + presenceData.buttons = [ + { + label: "View Show", + url: href + }, + { + label: "All Shows", + url: href.split("/shows/")[0] + "/shows" + } + ]; + } + } + } + + // Jocks page + else if (pathname === "/jocks") { + presenceData.details = "Browsing Jocks"; + presenceData.state = "Looking at radio hosts"; + presenceData.smallImageKey = CustomAssets.Browse; + presenceData.smallImageText = "Browsing Jocks"; + + if (showButtons) { + presenceData.buttons = [ + { + label: "View Jocks", + url: href + } + ]; + } + } + + // Individual jock page + else if (pathname.startsWith("/jocks/")) { + const jockName = document.querySelector('[data-premid-jock-name]')?.getAttribute('data-premid-jock-name'); + const jockImage = document.querySelector('[data-premid-jock-image]')?.getAttribute('data-premid-jock-image'); + if (jockName) { + if (jockImage) presenceData.largeImageKey = jockImage; + presenceData.details = "Viewing Jock Profile"; + presenceData.state = jockName; + presenceData.smallImageKey = CustomAssets.Browse; + presenceData.smallImageText = "Jock Profile"; + + if (showButtons) { + presenceData.buttons = [ + { + label: "View Profile", + url: href + }, + { + label: "All Jocks", + url: href.split("/jocks/")[0] + "/jocks" + } + ]; + } + } + } + + // Podcasts page + else if (pathname === "/podcasts") { + presenceData.details = "Browsing Podcasts"; + presenceData.state = "Looking for podcasts"; + presenceData.smallImageKey = CustomAssets.Podcast; + presenceData.smallImageText = "Podcasts"; + + if (showButtons) { + presenceData.buttons = [ + { + label: "View Podcasts", + url: href + } + ]; + } + } + + // Individual podcast page + else if (pathname.startsWith("/podcast/")) { + const podcastTitle = document.querySelector('[data-premid-podcast-title]')?.getAttribute('data-premid-podcast-title'); + const podcastAuthor = document.querySelector('[data-premid-podcast-author]')?.getAttribute('data-premid-podcast-author'); + const podcastImage = document.querySelector('[data-premid-podcast-image]')?.getAttribute('data-premid-podcast-image'); + + if (isPlaying && playerMode === 'podcast' && episodeName && podcastName) { + if (artwork) presenceData.largeImageKey = artwork; + presenceData.details = `🎧 ${podcastName}`; + presenceData.state = episodeName; + presenceData.smallImageKey = CustomAssets.Play; + presenceData.smallImageText = "Playing Podcast"; + } else if (podcastTitle) { + if (podcastImage) presenceData.largeImageKey = podcastImage; + presenceData.details = "Viewing Podcast"; + presenceData.state = podcastAuthor ? `by ${podcastAuthor}` : podcastTitle; + presenceData.smallImageKey = CustomAssets.Podcast; + presenceData.smallImageText = "Podcast"; + } + + if (showButtons) { + presenceData.buttons = [ + { + label: "Listen to Podcast", + url: href + }, + { + label: "All Podcasts", + url: href.split("/podcast/")[0] + "/podcasts" + } + ]; + } + } + + // TMG Content/News page + else if (pathname === "/tmg-content" || pathname.startsWith("/tmg")) { + if (pathname === "/tmg-content") { + presenceData.details = "Browsing TMG Content"; + presenceData.state = "Typical Media Group News"; + presenceData.smallImageKey = CustomAssets.News; + presenceData.smallImageText = "TMG Content"; + } else if (pathname.startsWith("/tmg-content/news/") || pathname.startsWith("/tmg-content/article/")) { + const articleTitle = document.querySelector('[data-premid-article-title]')?.getAttribute('data-premid-article-title'); + const articleType = document.querySelector('[data-premid-article-type]')?.getAttribute('data-premid-article-type'); + if (articleTitle) { + presenceData.details = articleType === 'news' ? "Reading News" : "Reading Article"; + presenceData.state = articleTitle; + presenceData.smallImageKey = CustomAssets.Reading; + presenceData.smallImageText = "Reading"; + } + } + + if (showButtons) { + presenceData.buttons = [ + { + label: "View Content", + url: href + } + ]; + } + } + + // Contact page + else if (pathname === "/contact") { + presenceData.details = "Contact Page"; + presenceData.state = "Getting in touch"; + presenceData.smallImageKey = CustomAssets.Contact; + presenceData.smallImageText = "Contact"; + + if (showButtons) { + presenceData.buttons = [ + { + label: "Contact Us", + url: href + } + ]; + } + } + + // Staff Login + else if (pathname === "/staff/login") { + presenceData.details = "Staff Area"; + presenceData.state = "Logging in..."; + presenceData.smallImageKey = CustomAssets.Browse; + presenceData.smallImageText = "Staff Login"; + } + + // Staff Dashboard + else if (pathname === "/staff/dashboard") { + const urlParams = new URLSearchParams(search); + const tab = urlParams.get("tab") || "jocks"; + + presenceData.details = "Staff Dashboard"; + presenceData.state = `Managing ${tab.charAt(0).toUpperCase() + tab.slice(1)}`; + presenceData.smallImageKey = CustomAssets.Upload; + presenceData.smallImageText = "Staff Area"; + } + + // Default fallback + else { + presenceData.details = "Browsing City Radio"; + presenceData.state = "Exploring the website"; + presenceData.smallImageKey = CustomAssets.Browse; + presenceData.smallImageText = "Browsing"; + + if (showButtons) { + presenceData.buttons = [ + { + label: "Visit Website", + url: "https://935cityradio.com" + } + ]; + } + } + + if (presenceData.details) presence.setActivity(presenceData); + else presence.setActivity(); +}); From 76e62eb33fdfe0dfb9ab0e8e28a168b611b03509 Mon Sep 17 00:00:00 2001 From: Seehed Date: Tue, 23 Dec 2025 20:08:11 -1000 Subject: [PATCH 3/4] chore(activity): remove BVF Radio --- websites/B/BVF Radio/metadata.json | 49 ----- websites/B/BVF Radio/presence.ts | 291 ----------------------------- 2 files changed, 340 deletions(-) delete mode 100644 websites/B/BVF Radio/metadata.json delete mode 100644 websites/B/BVF Radio/presence.ts diff --git a/websites/B/BVF Radio/metadata.json b/websites/B/BVF Radio/metadata.json deleted file mode 100644 index 84c8a375d1f0..000000000000 --- a/websites/B/BVF Radio/metadata.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "$schema": "https://schemas.premid.app/metadata/1.7", - "author": { - "name": "Seehed", - "id": "1030394088974991423" - }, - "contributors": [], - "service": "BVF Radio", - "altnames": ["BVF Your Home For House", "BVF"], - "description": { - "en": "Your Home For House" - }, - "url": [ - "bvf.wtf", - "https://bvf.bolt.host/" - ], - "version": "1.0.0", - "logo": "https://i.typicalmedia.net/stationlogos/bvf.png", - "thumbnail": "https://i.typicalmedia.net/stationlogos/bvf.png", - "color": "#EC4899", - "tags": [ - "music", - "radio", - "entertainment", - "live", - "podcast" - ], - "category": "music", - "settings": [ - { - "id": "showButtons", - "title": "Show Buttons", - "icon": "fas fa-mouse-pointer", - "value": true - }, - { - "id": "showTimestamp", - "title": "Show Timestamp", - "icon": "fas fa-clock", - "value": true - }, - { - "id": "showSongInfo", - "title": "Show Song Info", - "icon": "fas fa-music", - "value": true - } - ] -} diff --git a/websites/B/BVF Radio/presence.ts b/websites/B/BVF Radio/presence.ts deleted file mode 100644 index 36a6744f957a..000000000000 --- a/websites/B/BVF Radio/presence.ts +++ /dev/null @@ -1,291 +0,0 @@ -const presence = new Presence({ - clientId: "1439901141579071641" -}); - -const CustomAssets = { - Play: "https://i.typicalmedia.net/icons/_states/play.png", - Pause: "https://i.typicalmedia.net/icons/_states/Pause.png", - Browse: "https://i.typicalmedia.net/icons/_states/Browse.png", - Radio: "https://i.typicalmedia.net/icons/_states/Radio.png", - Video: "https://i.typicalmedia.net/icons/_states/Video.png", - Reading: "https://i.typicalmedia.net/icons/_states/Reading.png", - News: "https://i.typicalmedia.net/icons/_states/News.png", - Weather: "https://i.typicalmedia.net/icons/_states/Weather.png", - Contact: "https://i.typicalmedia.net/icons/_states/Contact.png", - Advertising: "https://i.typicalmedia.net/icons/_states/Advertising.png", - Upload: "https://i.typicalmedia.net/icons/_states/Upload.png", - SongNote: "https://i.typicalmedia.net/icons/_states/SongNote.png", - Search: "https://i.typicalmedia.net/icons/_states/Search.png", - Tv: "https://i.typicalmedia.net/icons/_states/Tv.png", - RadioShows: "https://i.typicalmedia.net/icons/_states/RadioShows.png", - Podcast: "https://i.typicalmedia.net/icons/_states/Podcast.png", - Calendar: "https://i.typicalmedia.net/icons/_states/Calendar.png" -}; - -let lastPlaybackState = false; -let startTimestamp = Date.now(); - -presence.on("UpdateData", async () => { - const presenceData = {} as PresenceData; - - const settings = await presence.getSetting("showButtons"); - const showTimestamp = await presence.getSetting("showTimestamp"); - const showSongInfo = await presence.getSetting("showSongInfo"); - - const path = window.location.pathname; - const hostname = window.location.hostname; - - const isPlaying = document.querySelector('button[aria-label="Pause"]') !== null; - - if (isPlaying !== lastPlaybackState) { - startTimestamp = Date.now(); - lastPlaybackState = isPlaying; - } - - if (path === "/" || path === "") { - const currentSongTitle = document.querySelector('h2.text-4xl.md\\:text-5xl.font-black.text-white')?.textContent?.trim(); - const currentArtist = document.querySelector('p.text-2xl.text-gray-300.font-bold')?.textContent?.trim(); - const artwork = document.querySelector('.aspect-square img')?.getAttribute('src'); - const liveDJ = document.querySelector('p.text-white.text-sm.font-black')?.textContent?.trim(); - - presenceData.largeImageKey = artwork || "https://i.typicalmedia.net/stationlogos/bvf.png"; - presenceData.largeImageText = liveDJ ? `Live with ${liveDJ}` : "BVF Radio"; - - if (isPlaying && currentSongTitle && currentArtist && showSongInfo) { - presenceData.details = "Listening to BVF"; - presenceData.state = `${currentSongTitle} - ${currentArtist}`; - presenceData.smallImageKey = CustomAssets.Play; - presenceData.smallImageText = "Playing"; - - if (showTimestamp) { - presenceData.startTimestamp = startTimestamp; - } - - if (settings) { - presenceData.buttons = [ - { - label: "Listen Live", - url: `https://${hostname}` - } - ]; - } - } else if (isPlaying) { - presenceData.details = "Listening to BVF Radio"; - presenceData.state = "Live Stream"; - presenceData.smallImageKey = CustomAssets.Radio; - presenceData.smallImageText = "BVF"; - - if (showTimestamp) { - presenceData.startTimestamp = startTimestamp; - } - } else { - presenceData.details = "Browsing Home"; - presenceData.state = "BVF Radio"; - presenceData.smallImageKey = CustomAssets.Browse; - presenceData.smallImageText = "Browsing"; - } - } else if (path.startsWith("/shows")) { - if (path === "/shows" || path === "/shows/") { - presenceData.largeImageKey = "https://i.typicalmedia.net/stationlogos/bvf.png"; - presenceData.largeImageText = "BVF Radio"; - presenceData.details = "Browsing Shows"; - presenceData.state = "Viewing all shows"; - presenceData.smallImageKey = CustomAssets.RadioShows; - presenceData.smallImageText = "Radio Shows"; - } else { - const showTitle = document.querySelector('h1.text-3xl.md\\:text-5xl.font-black.text-white')?.textContent?.trim(); - const showImage = document.querySelector('.w-48.h-48.rounded-2xl img, .aspect-square img')?.getAttribute('src'); - - presenceData.largeImageKey = showImage || "https://i.typicalmedia.net/stationlogos/bvf.png"; - presenceData.largeImageText = showTitle || "BVF Radio"; - - if (showTitle) { - presenceData.details = "Viewing Show"; - presenceData.state = showTitle; - presenceData.smallImageKey = CustomAssets.RadioShows; - presenceData.smallImageText = "Radio Show"; - - if (settings) { - presenceData.buttons = [ - { - label: "View Show", - url: window.location.href - } - ]; - } - } - } - } else if (path.startsWith("/jocks") || path.startsWith("/presenters")) { - if (path === "/jocks" || path === "/jocks/" || path === "/presenters" || path === "/presenters/") { - presenceData.largeImageKey = "https://i.typicalmedia.net/stationlogos/bvf.png"; - presenceData.largeImageText = "BVF Radio"; - presenceData.details = "Browsing Presenters"; - presenceData.state = "Viewing all presenters"; - presenceData.smallImageKey = CustomAssets.Browse; - presenceData.smallImageText = "Browsing"; - } else { - const jockName = document.querySelector('h1.text-3xl.md\\:text-5xl.font-black.text-white')?.textContent?.trim(); - const jockImage = document.querySelector('.w-48.h-48.rounded-2xl img, .aspect-square img')?.getAttribute('src'); - - presenceData.largeImageKey = jockImage || "https://i.typicalmedia.net/stationlogos/bvf.png"; - presenceData.largeImageText = jockName || "BVF Radio"; - - if (jockName) { - presenceData.details = "Viewing Presenter"; - presenceData.state = jockName; - presenceData.smallImageKey = CustomAssets.Radio; - presenceData.smallImageText = "Presenter"; - - if (settings) { - presenceData.buttons = [ - { - label: "View Profile", - url: window.location.href - } - ]; - } - } - } - } else if (path.startsWith("/podcasts")) { - if (path === "/podcasts" || path === "/podcasts/") { - presenceData.largeImageKey = "https://i.typicalmedia.net/stationlogos/bvf.png"; - presenceData.largeImageText = "BVF Radio"; - presenceData.details = "Browsing Podcasts"; - presenceData.state = "Viewing all podcasts"; - presenceData.smallImageKey = CustomAssets.Podcast; - presenceData.smallImageText = "Podcasts"; - } else { - const podcastTitle = document.querySelector('h1.text-4xl.md\\:text-5xl.font-black.text-white')?.textContent?.trim(); - const episodePlaying = document.querySelector('button[aria-label="Pause"]') !== null; - const episodeTitle = document.querySelector('h2.text-4xl.md\\:text-5xl.font-black.text-white')?.textContent?.trim(); - const podcastImage = document.querySelector('.aspect-square img, .w-full.max-w-sm img')?.getAttribute('src'); - - presenceData.largeImageKey = podcastImage || "https://i.typicalmedia.net/stationlogos/bvf.png"; - presenceData.largeImageText = podcastTitle || "BVF Radio"; - - if (episodePlaying && episodeTitle) { - presenceData.details = `Listening to ${podcastTitle || 'Podcast'}`; - presenceData.state = episodeTitle; - presenceData.smallImageKey = CustomAssets.Play; - presenceData.smallImageText = "Playing Episode"; - - if (showTimestamp) { - presenceData.startTimestamp = startTimestamp; - } - - if (settings) { - presenceData.buttons = [ - { - label: "Listen Now", - url: window.location.href - } - ]; - } - } else if (podcastTitle) { - presenceData.details = "Viewing Podcast"; - presenceData.state = podcastTitle; - presenceData.smallImageKey = CustomAssets.Podcast; - presenceData.smallImageText = "Podcast"; - - if (settings) { - presenceData.buttons = [ - { - label: "View Podcast", - url: window.location.href - } - ]; - } - } - } - } else if (path.startsWith("/news")) { - const articleTitle = document.querySelector('h1.text-4xl.md\\:text-5xl.font-black.text-white')?.textContent?.trim(); - const articleImage = document.querySelector('.aspect-video img')?.getAttribute('src'); - - presenceData.largeImageKey = articleImage || "https://i.typicalmedia.net/stationlogos/bvf.png"; - presenceData.largeImageText = articleTitle || "BVF Media Group"; - - if (articleTitle) { - presenceData.details = "Reading News"; - presenceData.state = articleTitle.length > 50 ? articleTitle.substring(0, 47) + "..." : articleTitle; - presenceData.smallImageKey = CustomAssets.Reading; - presenceData.smallImageText = "Reading"; - - if (settings) { - presenceData.buttons = [ - { - label: "Read Article", - url: window.location.href - } - ]; - } - } else { - presenceData.largeImageKey = "https://i.typicalmedia.net/stationlogos/bvf.png"; - presenceData.largeImageText = "BVF Radio"; - presenceData.details = "Browsing News"; - presenceData.state = "BVF Media Group"; - presenceData.smallImageKey = CustomAssets.News; - presenceData.smallImageText = "News"; - } - } else if (path.startsWith("/articles")) { - const articleTitle = document.querySelector('h1')?.textContent?.trim(); - const articleImage = document.querySelector('img')?.getAttribute('src'); - const contentType = path.includes('/articles/') ? 'Article' : 'Content'; - - presenceData.largeImageKey = articleImage || "https://i.typicalmedia.net/stationlogos/bvf.png"; - presenceData.largeImageText = articleTitle || "TMG Media Hub"; - - if (articleTitle) { - presenceData.details = `Reading ${contentType}`; - presenceData.state = articleTitle.length > 50 ? articleTitle.substring(0, 47) + "..." : articleTitle; - presenceData.smallImageKey = CustomAssets.Reading; - presenceData.smallImageText = "Reading"; - - if (settings) { - presenceData.buttons = [ - { - label: `Read ${contentType}`, - url: window.location.href - } - ]; - } - } else { - presenceData.largeImageKey = "https://i.typicalmedia.net/stationlogos/bvf.png"; - presenceData.largeImageText = "BVF Radio"; - presenceData.details = "Browsing Content"; - presenceData.state = "TMG Media Hub"; - presenceData.smallImageKey = CustomAssets.Browse; - presenceData.smallImageText = "Browsing"; - } - } else if (path === "/contact") { - presenceData.largeImageKey = "https://i.typicalmedia.net/stationlogos/bvf.png"; - presenceData.largeImageText = "BVF Radio"; - presenceData.details = "Contact Page"; - presenceData.state = "Getting in touch"; - presenceData.smallImageKey = CustomAssets.Contact; - presenceData.smallImageText = "Contact"; - } else if (path.startsWith("/staff")) { - presenceData.largeImageKey = "https://i.typicalmedia.net/stationlogos/bvf.png"; - presenceData.largeImageText = "BVF Radio"; - if (path === "/staff/login") { - presenceData.details = "Staff Login"; - presenceData.state = "Accessing staff area"; - presenceData.smallImageKey = CustomAssets.Browse; - presenceData.smallImageText = "Login"; - } else { - presenceData.details = "Staff Dashboard"; - presenceData.state = "Managing station"; - presenceData.smallImageKey = CustomAssets.Upload; - presenceData.smallImageText = "Staff Area"; - } - } else { - presenceData.largeImageKey = "https://i.typicalmedia.net/stationlogos/bvf.png"; - presenceData.largeImageText = "BVF Radio"; - presenceData.details = "Browsing BVF Radio"; - presenceData.state = "Exploring the site"; - presenceData.smallImageKey = CustomAssets.Browse; - presenceData.smallImageText = "Browsing"; - } - - - presence.setActivity(presenceData); -}); From 4ba2ebe5f985a01b68203fd7038c7ee843843616 Mon Sep 17 00:00:00 2001 From: Seehed Date: Tue, 23 Dec 2025 20:20:23 -1000 Subject: [PATCH 4/4] fix(activity): correct metadata JSON for all activities --- package-lock.json | 22 +- websites/B/BVF Radio/metadata.json | 49 ++++ websites/B/BVF Radio/presence.ts | 291 +++++++++++++++++++ websites/T/Typical Media Group/metadata.json | 12 +- 4 files changed, 353 insertions(+), 21 deletions(-) create mode 100644 websites/B/BVF Radio/metadata.json create mode 100644 websites/B/BVF Radio/presence.ts diff --git a/package-lock.json b/package-lock.json index 03d6ee3c57dd..f94d1dc2ae88 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2169,7 +2169,6 @@ "integrity": "sha512-1LFfa/qnMQvEOAdzlQymH0ulepxbxnCYAKJZfMci/5XJyIHWgEYnDmgnKakbTh7CH2tFQ5O60oYDvns4i9RAIg==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@octokit/auth-token": "^4.0.0", "@octokit/graphql": "^7.1.0", @@ -2845,7 +2844,6 @@ "integrity": "sha512-IbKooQVqUBrlzWTi79E8Fw78l8k1RNtlDDNWsFZs7XonuQSJ8oNYfEeclhprUldXISRMLzBpILuKgPlIxm+/Yw==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "undici-types": "~7.14.0" } @@ -2927,7 +2925,6 @@ "integrity": "sha512-n1H6IcDhmmUEG7TNVSspGmiHHutt7iVKtZwRppD7e04wha5MrkV1h3pti9xQLcCMt6YWsncpoT0HMjkH1FNwWQ==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@typescript-eslint/scope-manager": "8.46.0", "@typescript-eslint/types": "8.46.0", @@ -3325,6 +3322,7 @@ "integrity": "sha512-oOdAkwqUfW1WqpwSYJce06wvt6HljgY3fGeM9NcVA1HaYOij3mZG9Rkysn0OHuyUAGMbEbARIpsG+LPVlBJ5/Q==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@babel/parser": "^7.25.3", "@vue/shared": "3.5.13", @@ -3339,6 +3337,7 @@ "integrity": "sha512-ZOJ46sMOKUjO3e94wPdCzQ6P1Lx/vhp2RSvfaab88Ajexs0AHeV0uasYhi99WPaogmBlRHNRuly8xV75cNTMDA==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@vue/compiler-core": "3.5.13", "@vue/shared": "3.5.13" @@ -3369,6 +3368,7 @@ "integrity": "sha512-wMH6vrYHxQl/IybKJagqbquvxpWCuVYpoUJfCqFZwa/JY1GdATAQ+TgVtgrwwMZ0D07QhA99rs/EAAWfvG6KpA==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@vue/compiler-dom": "3.5.13", "@vue/shared": "3.5.13" @@ -3379,7 +3379,8 @@ "resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.5.13.tgz", "integrity": "sha512-/hnE/qP5ZoGpol0a5mDi45bOd7t3tjYJBjsgCsivow7D48cJeV5l05RD82lPqi7gRiphZM37rnhW1l6ZoCNNnQ==", "dev": true, - "license": "MIT" + "license": "MIT", + "peer": true }, "node_modules/acorn": { "version": "8.15.0", @@ -3387,7 +3388,6 @@ "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", "dev": true, "license": "MIT", - "peer": true, "bin": { "acorn": "bin/acorn" }, @@ -3667,7 +3667,6 @@ } ], "license": "MIT", - "peer": true, "dependencies": { "baseline-browser-mapping": "^2.8.9", "caniuse-lite": "^1.0.30001746", @@ -4328,6 +4327,7 @@ "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==", "dev": true, "license": "BSD-2-Clause", + "peer": true, "engines": { "node": ">=0.12" }, @@ -4462,7 +4462,6 @@ "integrity": "sha512-XyLmROnACWqSxiGYArdef1fItQd47weqB7iwtfr9JHwRrqIXZdcFMvvEcL9xHCmL0SNsOvF0c42lWyM1U5dgig==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@eslint-community/eslint-utils": "^4.8.0", "@eslint-community/regexpp": "^4.12.1", @@ -4694,7 +4693,6 @@ "integrity": "sha512-ySrDaLQZbreNAr/Betq6ocd5Hxy3+LBIfWNV2621EQQ6yGf/ZSLtN2MiM62WO2YQTX+nSFhv332Tpp51q+AkZQ==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@dprint/formatter": "^0.3.0", "@dprint/markdown": "^0.17.8", @@ -5323,7 +5321,8 @@ "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", "dev": true, - "license": "MIT" + "license": "MIT", + "peer": true }, "node_modules/esutils": { "version": "2.0.3", @@ -6348,7 +6347,6 @@ "integrity": "sha512-uuPNLJkKN8NXAlZlQ6kmUF9qO+T6Kyd7oV4+/7yy8Jz6+MZNyhPq8EdLpdfnPVzUC8qSf1b4j1azKaGnFsjmsw==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "acorn": "^8.5.0", "eslint-visitor-keys": "^3.0.0", @@ -9156,7 +9154,6 @@ "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", "dev": true, "license": "Apache-2.0", - "peer": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -9325,7 +9322,6 @@ "integrity": "sha512-cZn6NDFE7wdTpINgs++ZJ4N49W2vRp8LCKrn3Ob1kYNtOo21vfDoaV5GzBfLU4MovSAB8uNRm4jgzVQZ+mBzPQ==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "esbuild": "^0.25.0", "fdir": "^6.4.4", @@ -9424,7 +9420,6 @@ "integrity": "sha512-LUCP5ev3GURDysTWiP47wRRUpLKMOfPh+yKTx3kVIEiu5KOMeqzpnYNsKyOoVrULivR8tLcks4+lga33Whn90A==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@types/chai": "^5.2.2", "@vitest/expect": "3.2.4", @@ -9505,7 +9500,6 @@ "integrity": "sha512-CydUvFOQKD928UzZhTp4pr2vWz1L+H99t7Pkln2QSPdvmURT0MoC4wUccfCnuEaihNsu9aYYyk+bep8rlfkUXw==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "debug": "^4.4.0", "eslint-scope": "^8.2.0", diff --git a/websites/B/BVF Radio/metadata.json b/websites/B/BVF Radio/metadata.json new file mode 100644 index 000000000000..84c8a375d1f0 --- /dev/null +++ b/websites/B/BVF Radio/metadata.json @@ -0,0 +1,49 @@ +{ + "$schema": "https://schemas.premid.app/metadata/1.7", + "author": { + "name": "Seehed", + "id": "1030394088974991423" + }, + "contributors": [], + "service": "BVF Radio", + "altnames": ["BVF Your Home For House", "BVF"], + "description": { + "en": "Your Home For House" + }, + "url": [ + "bvf.wtf", + "https://bvf.bolt.host/" + ], + "version": "1.0.0", + "logo": "https://i.typicalmedia.net/stationlogos/bvf.png", + "thumbnail": "https://i.typicalmedia.net/stationlogos/bvf.png", + "color": "#EC4899", + "tags": [ + "music", + "radio", + "entertainment", + "live", + "podcast" + ], + "category": "music", + "settings": [ + { + "id": "showButtons", + "title": "Show Buttons", + "icon": "fas fa-mouse-pointer", + "value": true + }, + { + "id": "showTimestamp", + "title": "Show Timestamp", + "icon": "fas fa-clock", + "value": true + }, + { + "id": "showSongInfo", + "title": "Show Song Info", + "icon": "fas fa-music", + "value": true + } + ] +} diff --git a/websites/B/BVF Radio/presence.ts b/websites/B/BVF Radio/presence.ts new file mode 100644 index 000000000000..36a6744f957a --- /dev/null +++ b/websites/B/BVF Radio/presence.ts @@ -0,0 +1,291 @@ +const presence = new Presence({ + clientId: "1439901141579071641" +}); + +const CustomAssets = { + Play: "https://i.typicalmedia.net/icons/_states/play.png", + Pause: "https://i.typicalmedia.net/icons/_states/Pause.png", + Browse: "https://i.typicalmedia.net/icons/_states/Browse.png", + Radio: "https://i.typicalmedia.net/icons/_states/Radio.png", + Video: "https://i.typicalmedia.net/icons/_states/Video.png", + Reading: "https://i.typicalmedia.net/icons/_states/Reading.png", + News: "https://i.typicalmedia.net/icons/_states/News.png", + Weather: "https://i.typicalmedia.net/icons/_states/Weather.png", + Contact: "https://i.typicalmedia.net/icons/_states/Contact.png", + Advertising: "https://i.typicalmedia.net/icons/_states/Advertising.png", + Upload: "https://i.typicalmedia.net/icons/_states/Upload.png", + SongNote: "https://i.typicalmedia.net/icons/_states/SongNote.png", + Search: "https://i.typicalmedia.net/icons/_states/Search.png", + Tv: "https://i.typicalmedia.net/icons/_states/Tv.png", + RadioShows: "https://i.typicalmedia.net/icons/_states/RadioShows.png", + Podcast: "https://i.typicalmedia.net/icons/_states/Podcast.png", + Calendar: "https://i.typicalmedia.net/icons/_states/Calendar.png" +}; + +let lastPlaybackState = false; +let startTimestamp = Date.now(); + +presence.on("UpdateData", async () => { + const presenceData = {} as PresenceData; + + const settings = await presence.getSetting("showButtons"); + const showTimestamp = await presence.getSetting("showTimestamp"); + const showSongInfo = await presence.getSetting("showSongInfo"); + + const path = window.location.pathname; + const hostname = window.location.hostname; + + const isPlaying = document.querySelector('button[aria-label="Pause"]') !== null; + + if (isPlaying !== lastPlaybackState) { + startTimestamp = Date.now(); + lastPlaybackState = isPlaying; + } + + if (path === "/" || path === "") { + const currentSongTitle = document.querySelector('h2.text-4xl.md\\:text-5xl.font-black.text-white')?.textContent?.trim(); + const currentArtist = document.querySelector('p.text-2xl.text-gray-300.font-bold')?.textContent?.trim(); + const artwork = document.querySelector('.aspect-square img')?.getAttribute('src'); + const liveDJ = document.querySelector('p.text-white.text-sm.font-black')?.textContent?.trim(); + + presenceData.largeImageKey = artwork || "https://i.typicalmedia.net/stationlogos/bvf.png"; + presenceData.largeImageText = liveDJ ? `Live with ${liveDJ}` : "BVF Radio"; + + if (isPlaying && currentSongTitle && currentArtist && showSongInfo) { + presenceData.details = "Listening to BVF"; + presenceData.state = `${currentSongTitle} - ${currentArtist}`; + presenceData.smallImageKey = CustomAssets.Play; + presenceData.smallImageText = "Playing"; + + if (showTimestamp) { + presenceData.startTimestamp = startTimestamp; + } + + if (settings) { + presenceData.buttons = [ + { + label: "Listen Live", + url: `https://${hostname}` + } + ]; + } + } else if (isPlaying) { + presenceData.details = "Listening to BVF Radio"; + presenceData.state = "Live Stream"; + presenceData.smallImageKey = CustomAssets.Radio; + presenceData.smallImageText = "BVF"; + + if (showTimestamp) { + presenceData.startTimestamp = startTimestamp; + } + } else { + presenceData.details = "Browsing Home"; + presenceData.state = "BVF Radio"; + presenceData.smallImageKey = CustomAssets.Browse; + presenceData.smallImageText = "Browsing"; + } + } else if (path.startsWith("/shows")) { + if (path === "/shows" || path === "/shows/") { + presenceData.largeImageKey = "https://i.typicalmedia.net/stationlogos/bvf.png"; + presenceData.largeImageText = "BVF Radio"; + presenceData.details = "Browsing Shows"; + presenceData.state = "Viewing all shows"; + presenceData.smallImageKey = CustomAssets.RadioShows; + presenceData.smallImageText = "Radio Shows"; + } else { + const showTitle = document.querySelector('h1.text-3xl.md\\:text-5xl.font-black.text-white')?.textContent?.trim(); + const showImage = document.querySelector('.w-48.h-48.rounded-2xl img, .aspect-square img')?.getAttribute('src'); + + presenceData.largeImageKey = showImage || "https://i.typicalmedia.net/stationlogos/bvf.png"; + presenceData.largeImageText = showTitle || "BVF Radio"; + + if (showTitle) { + presenceData.details = "Viewing Show"; + presenceData.state = showTitle; + presenceData.smallImageKey = CustomAssets.RadioShows; + presenceData.smallImageText = "Radio Show"; + + if (settings) { + presenceData.buttons = [ + { + label: "View Show", + url: window.location.href + } + ]; + } + } + } + } else if (path.startsWith("/jocks") || path.startsWith("/presenters")) { + if (path === "/jocks" || path === "/jocks/" || path === "/presenters" || path === "/presenters/") { + presenceData.largeImageKey = "https://i.typicalmedia.net/stationlogos/bvf.png"; + presenceData.largeImageText = "BVF Radio"; + presenceData.details = "Browsing Presenters"; + presenceData.state = "Viewing all presenters"; + presenceData.smallImageKey = CustomAssets.Browse; + presenceData.smallImageText = "Browsing"; + } else { + const jockName = document.querySelector('h1.text-3xl.md\\:text-5xl.font-black.text-white')?.textContent?.trim(); + const jockImage = document.querySelector('.w-48.h-48.rounded-2xl img, .aspect-square img')?.getAttribute('src'); + + presenceData.largeImageKey = jockImage || "https://i.typicalmedia.net/stationlogos/bvf.png"; + presenceData.largeImageText = jockName || "BVF Radio"; + + if (jockName) { + presenceData.details = "Viewing Presenter"; + presenceData.state = jockName; + presenceData.smallImageKey = CustomAssets.Radio; + presenceData.smallImageText = "Presenter"; + + if (settings) { + presenceData.buttons = [ + { + label: "View Profile", + url: window.location.href + } + ]; + } + } + } + } else if (path.startsWith("/podcasts")) { + if (path === "/podcasts" || path === "/podcasts/") { + presenceData.largeImageKey = "https://i.typicalmedia.net/stationlogos/bvf.png"; + presenceData.largeImageText = "BVF Radio"; + presenceData.details = "Browsing Podcasts"; + presenceData.state = "Viewing all podcasts"; + presenceData.smallImageKey = CustomAssets.Podcast; + presenceData.smallImageText = "Podcasts"; + } else { + const podcastTitle = document.querySelector('h1.text-4xl.md\\:text-5xl.font-black.text-white')?.textContent?.trim(); + const episodePlaying = document.querySelector('button[aria-label="Pause"]') !== null; + const episodeTitle = document.querySelector('h2.text-4xl.md\\:text-5xl.font-black.text-white')?.textContent?.trim(); + const podcastImage = document.querySelector('.aspect-square img, .w-full.max-w-sm img')?.getAttribute('src'); + + presenceData.largeImageKey = podcastImage || "https://i.typicalmedia.net/stationlogos/bvf.png"; + presenceData.largeImageText = podcastTitle || "BVF Radio"; + + if (episodePlaying && episodeTitle) { + presenceData.details = `Listening to ${podcastTitle || 'Podcast'}`; + presenceData.state = episodeTitle; + presenceData.smallImageKey = CustomAssets.Play; + presenceData.smallImageText = "Playing Episode"; + + if (showTimestamp) { + presenceData.startTimestamp = startTimestamp; + } + + if (settings) { + presenceData.buttons = [ + { + label: "Listen Now", + url: window.location.href + } + ]; + } + } else if (podcastTitle) { + presenceData.details = "Viewing Podcast"; + presenceData.state = podcastTitle; + presenceData.smallImageKey = CustomAssets.Podcast; + presenceData.smallImageText = "Podcast"; + + if (settings) { + presenceData.buttons = [ + { + label: "View Podcast", + url: window.location.href + } + ]; + } + } + } + } else if (path.startsWith("/news")) { + const articleTitle = document.querySelector('h1.text-4xl.md\\:text-5xl.font-black.text-white')?.textContent?.trim(); + const articleImage = document.querySelector('.aspect-video img')?.getAttribute('src'); + + presenceData.largeImageKey = articleImage || "https://i.typicalmedia.net/stationlogos/bvf.png"; + presenceData.largeImageText = articleTitle || "BVF Media Group"; + + if (articleTitle) { + presenceData.details = "Reading News"; + presenceData.state = articleTitle.length > 50 ? articleTitle.substring(0, 47) + "..." : articleTitle; + presenceData.smallImageKey = CustomAssets.Reading; + presenceData.smallImageText = "Reading"; + + if (settings) { + presenceData.buttons = [ + { + label: "Read Article", + url: window.location.href + } + ]; + } + } else { + presenceData.largeImageKey = "https://i.typicalmedia.net/stationlogos/bvf.png"; + presenceData.largeImageText = "BVF Radio"; + presenceData.details = "Browsing News"; + presenceData.state = "BVF Media Group"; + presenceData.smallImageKey = CustomAssets.News; + presenceData.smallImageText = "News"; + } + } else if (path.startsWith("/articles")) { + const articleTitle = document.querySelector('h1')?.textContent?.trim(); + const articleImage = document.querySelector('img')?.getAttribute('src'); + const contentType = path.includes('/articles/') ? 'Article' : 'Content'; + + presenceData.largeImageKey = articleImage || "https://i.typicalmedia.net/stationlogos/bvf.png"; + presenceData.largeImageText = articleTitle || "TMG Media Hub"; + + if (articleTitle) { + presenceData.details = `Reading ${contentType}`; + presenceData.state = articleTitle.length > 50 ? articleTitle.substring(0, 47) + "..." : articleTitle; + presenceData.smallImageKey = CustomAssets.Reading; + presenceData.smallImageText = "Reading"; + + if (settings) { + presenceData.buttons = [ + { + label: `Read ${contentType}`, + url: window.location.href + } + ]; + } + } else { + presenceData.largeImageKey = "https://i.typicalmedia.net/stationlogos/bvf.png"; + presenceData.largeImageText = "BVF Radio"; + presenceData.details = "Browsing Content"; + presenceData.state = "TMG Media Hub"; + presenceData.smallImageKey = CustomAssets.Browse; + presenceData.smallImageText = "Browsing"; + } + } else if (path === "/contact") { + presenceData.largeImageKey = "https://i.typicalmedia.net/stationlogos/bvf.png"; + presenceData.largeImageText = "BVF Radio"; + presenceData.details = "Contact Page"; + presenceData.state = "Getting in touch"; + presenceData.smallImageKey = CustomAssets.Contact; + presenceData.smallImageText = "Contact"; + } else if (path.startsWith("/staff")) { + presenceData.largeImageKey = "https://i.typicalmedia.net/stationlogos/bvf.png"; + presenceData.largeImageText = "BVF Radio"; + if (path === "/staff/login") { + presenceData.details = "Staff Login"; + presenceData.state = "Accessing staff area"; + presenceData.smallImageKey = CustomAssets.Browse; + presenceData.smallImageText = "Login"; + } else { + presenceData.details = "Staff Dashboard"; + presenceData.state = "Managing station"; + presenceData.smallImageKey = CustomAssets.Upload; + presenceData.smallImageText = "Staff Area"; + } + } else { + presenceData.largeImageKey = "https://i.typicalmedia.net/stationlogos/bvf.png"; + presenceData.largeImageText = "BVF Radio"; + presenceData.details = "Browsing BVF Radio"; + presenceData.state = "Exploring the site"; + presenceData.smallImageKey = CustomAssets.Browse; + presenceData.smallImageText = "Browsing"; + } + + + presence.setActivity(presenceData); +}); diff --git a/websites/T/Typical Media Group/metadata.json b/websites/T/Typical Media Group/metadata.json index 2c846cd6c6a1..db0571841967 100644 --- a/websites/T/Typical Media Group/metadata.json +++ b/websites/T/Typical Media Group/metadata.json @@ -12,13 +12,11 @@ ], "service": "Typical Media Group", "altnames": ["TMG Radio", "TMG", "Typical Media"], - "description": { - "en": "Typical Media Group - Stream live radio stations, discover new music, Typical Media Group is a Next Generation Audio Company." - -", - "es": "Typical Media Group - Transmite estaciones de radio en vivo, descubre nueva música y disfruta del entretenimiento de audio premium con una interfaz hermosa y moderna.", - "fr": "Typical Media Group - Diffusez des stations de radio en direct, découvrez de la nouvelle musique et profitez d'un divertissement audio premium avec une interface belle et moderne." - }, + "description": { + "en": "Typical Media Group - Stream live radio stations, discover new music, Typical Media Group is a Next Generation Audio Company.", + "es": "Typical Media Group - Transmite estaciones de radio en vivo, descubre nueva música y disfruta del entretenimiento de audio premium con una interfaz hermosa y moderna.", + "fr": "Typical Media Group - Diffusez des stations de radio en direct, découvrez de la nouvelle musique et profitez d'un divertissement audio premium avec une interface belle et moderne." +}, "url": [ "typicalmedia.net", "www.typicalmedia.net"