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
63 changes: 63 additions & 0 deletions websites/S/ShqipCinema/iframe.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
const iframe = new iFrame()

function getVideosFromOpenShadowRoots(root: Document | ShadowRoot): HTMLVideoElement[] {
const directVideos = Array.from(root.querySelectorAll<HTMLVideoElement>('video'))
if (directVideos.length)
return directVideos

const videos: HTMLVideoElement[] = []
for (const element of Array.from(root.querySelectorAll<HTMLElement>('*'))) {
if (element.shadowRoot)
videos.push(...getVideosFromOpenShadowRoots(element.shadowRoot))
}

return videos
}

function getVideoScore(video: HTMLVideoElement): number {
let score = 0

if (!video.ended)
score += 20
if (!video.paused)
score += 100
if (Number.isFinite(video.duration) && video.duration > 0)
score += 40
if (Number.isFinite(video.currentTime) && video.currentTime > 0)
score += 20

score += Math.max(0, video.readyState) * 5

if (video.clientWidth > 0 && video.clientHeight > 0)
score += 10

return score
}

iframe.on('UpdateData', async () => {
const frameUrl = await iframe.getUrl()
const videos = getVideosFromOpenShadowRoots(document)
const video = videos.sort((a, b) => getVideoScore(b) - getVideoScore(a))[0]

if (!video) {
iframe.send({
frameUrl,
video: {
found: false,
},
})
return
}

iframe.send({
frameUrl,
video: {
found: true,
paused: video.paused,
ended: video.ended,
currentTime: video.currentTime,
duration: video.duration,
readyState: video.readyState,
},
})
})
64 changes: 64 additions & 0 deletions websites/S/ShqipCinema/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{
"$schema": "https://schemas.premid.app/metadata/1.17",
"apiVersion": 1,
"author": {
"id": "1088052955896356925",
"name": "ShqipCinema"
},
"service": "ShqipCinema",
"description": {
"en": "Watch anime and movies with Albanian subtitles and dubbing on ShqipCinema."
},
"url": "shqipcinema.org",
"regExp": "^https?[:][/][/](?:www[.])?shqipcinema[.]org[/]",
"version": "1.0.0",
"logo": "https://i.imgur.com/nOWvabN.png",
"thumbnail": "https://i.imgur.com/ZKgS8nf.png",
"color": "#e50914",
"category": "anime",
"tags": [
"anime",
"movies",
"albanian",
"shqip"
],
"iframe": true,
"iFrameRegExp": "^https?[:][/][/](?:(?:www[.])?bysedikamoum[.]com[/].*|player[.]abyssplayer[.]com[/].*|(?:www[.])?shqipcinema[.]upn[.]one(?:[/].*)?|(?:www[.])?shqipcinema[.]org[/](?:server1|server2)_shqipcinema[.]php.*)$",
"settings": [
{
"id": "showBrowsing",
"title": "Show Browsing",
"icon": "fad fa-search",
"value": false,
"description": "Show a Rich Presence while browsing regular ShqipCinema pages."
},
{
"id": "showCover",
"title": "Show Cover",
"icon": "fas fa-images",
"value": true,
"description": "Display the current anime or movie poster as the large image."
},
{
"id": "showPlaybackTimer",
"title": "Show Playback Timer",
"icon": "fas fa-clock",
"value": true,
"description": "Display playback progress when the active video iframe exposes its video state."
},
{
"id": "showEpisodeTitle",
"title": "Show Episode Title",
"icon": "fas fa-tv",
"value": true,
"description": "Show the episode title when it is available in the episode list."
},
{
"id": "showButtons",
"title": "Show Content Buttons",
"icon": "fas fa-external-link-alt",
"value": true,
"description": "Add buttons for the current episode/movie and its anime details page."
}
]
}
Loading
Loading