Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion websites/A/atomicradio/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,19 @@
"name": "VocalZero",
"id": "223891083724193792"
},
"contributors": [
{
"name": "InstabilSpielt",
"id": "425706045453893642"
}
],
"service": "atomicradio",
"description": {
"en": "The future of radio is here. Experience 12 Spaces with non-stop music you'll love."
},
"url": "atomic.radio",
"regExp": "^https?[:][/][/]([a-z0-9-]+[.])*atomic[.]radio[/]",
"version": "2.0.0",
"version": "2.0.1",
"logo": "https://cdn.rcd.gg/PreMiD/websites/A/atomicradio/assets/logo.png",
"thumbnail": "https://cdn.rcd.gg/PreMiD/websites/A/atomicradio/assets/thumbnail.jpg",
"color": "#a9f923",
Expand Down
10 changes: 2 additions & 8 deletions websites/A/atomicradio/presence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@ presence.on('UpdateData', () => {
if (player && currentSpaceItem) {
const currentSpace = JSON.parse(currentSpaceItem)
presenceData.largeImageKey = currentSpace.current_track.artwork
presenceData.smallImageKey = player.querySelector<HTMLButtonElement>('[id*="-button"]')?.id
=== 'play-button'
? Assets.Play
: Assets.Pause
presenceData.smallImageKey = Assets.Play
presenceData.details = currentSpace.current_track.title
presenceData.state = currentSpace.current_track.artist
presenceData.startTimestamp = Math.floor(new Date(currentSpace.current_track.startingAt).getTime() / 1000)
Expand All @@ -34,11 +31,8 @@ presence.on('UpdateData', () => {
},
]
}
else if (document.location.pathname === '/') {
presenceData.details = 'Browsing spaces...'
}
else {
presenceData.details = `Browsing ${document.location.pathname.split('/').at(-1)}...`
presenceData.details = 'Browsing...'
}
if (presenceData.details)
presence.setActivity(presenceData)
Expand Down
27 changes: 27 additions & 0 deletions websites/M/MagentaTV Deutschland/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"$schema": "https://schemas.premid.app/metadata/1.16",
"apiVersion": 1,
"author": {
"id": "425706045453893642",
"name": "instabilspielt"
},
"service": "MagentaTV Deutschland",
"description": {
"de": "Schaue Live-TV, Filme und Serien auf MagentaTV Deutschland.",
"en": "Watch live TV, movies and series on MagentaTV Germany."
},
"url": "www.magenta.tv",
"regExp": "^https?:[/][/]([a-z0-9-]+[.])*magenta[.]tv[/]",
"version": "1.0.0",
"logo": "https://is1-ssl.mzstatic.com/image/thumb/PurpleSource211/v4/cc/0e/46/cc0e4697-6748-4d0d-81b4-e882be3c7df6/Placeholder.mill/512x512.png",
"thumbnail": "https://www.telekom.de/resources/images/1292150/stage-s-2x.webp",
"color": "#E20074",
"category": "videos",
"tags": [
"tv",
"streaming",
"live-tv",
"vod",
"telekom"
]
}
91 changes: 91 additions & 0 deletions websites/M/MagentaTV Deutschland/presence.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
import { ActivityType, Assets, getTimestampsFromMedia } from 'premid'

const presence = new Presence({
clientId: '1518224294465900564',
})

presence.on('UpdateData', async () => {
const video = document.querySelector('video')

const title
= document.querySelector('#PARAGRAPH-TITLE')
?.textContent
?.trim()
|| document.title.replace('MagentaTV - ', '').trim()

if (!title)
return presence.clearActivity()

const logoImage = document.querySelector(
'[id^="PARAGRAPH-LOGO"]',
) as HTMLImageElement | null

const logoUrl = logoImage?.src
?.replace(/x=\d+/, 'x=250')
?.replace(/y=\d+/, 'y=250')
?.replace('ar=keep', 'ar=ignore')

const isLive
= document.querySelector('#PLAYER-PREVIOUS-CHANNEL') !== null

const presenceData: PresenceData = {
type: ActivityType.Watching,
largeImageKey:
logoUrl
?? 'https://is1-ssl.mzstatic.com/image/thumb/PurpleSource211/v4/cc/0e/46/cc0e4697-6748-4d0d-81b4-e882be3c7df6/Placeholder.mill/512x512.png',
}

const parts = title.split(' - ')

if (parts.length >= 3) {
const seriesName = parts[0]!
const seasonEpisode = parts[1]!
const episodeTitle = parts.slice(2).join(' - ')

presenceData.name = seriesName
presenceData.details = episodeTitle
presenceData.state = seasonEpisode
}
else {
presenceData.details = title

if (isLive)
presenceData.state = 'Live TV'
}

const detailsLink = document.querySelector<HTMLAnchorElement>(
'#PLAYER-INFO-DETAILS',
)

if (detailsLink?.href) {
presenceData.buttons = [
{
label: 'View Details',
url: detailsLink.href,
},
]
}

if (video instanceof HTMLVideoElement) {
const { paused } = video

presenceData.smallImageKey = isLive
? Assets.Live
: paused
? Assets.Pause
: Assets.Play

if (!paused) {
const [startTimestamp, endTimestamp]
= getTimestampsFromMedia(video)

presenceData.startTimestamp = startTimestamp
presenceData.endTimestamp = endTimestamp
}
}
else if (isLive) {
presenceData.smallImageKey = Assets.Live
}

presence.setActivity(presenceData)
})
Loading