Skip to content

Commit

Permalink
fix video player + show current season and episode
Browse files Browse the repository at this point in the history
  • Loading branch information
eclipse7723 committed Oct 21, 2024
1 parent 2fd1ba4 commit f452221
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 13 deletions.
4 changes: 2 additions & 2 deletions plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
"id": "UASerials",
"file": "uaserials.js",
"showtimeVersion": "5",
"version": "1.3.4",
"version": "1.4",
"author": "eclipse7723",
"title": "UASerials",
"icon": "logo.svg",
"synopsis": "UASerials — твої улюблені серіали українською мовою онлайн",
"category": "video",
"description": "Плагін для відтворення відео UASerials.pro — твої улюблені серіали українською мовою онлайн",
"description": "Твої улюблені серіали українською мовою онлайн",
"homepage": "https://github.com/eclipse7723/movian-plugin-uaserials"
}
24 changes: 19 additions & 5 deletions src/movie-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ function findSoundsByEpisode(movieData, season, episode) {

data.seasons.forEach(function(seasonData) {
seasonData.episodes.forEach(function(episodeData) {
if (seasonData.title == season && episodeData.title == episode) {
if (seasonData.title === season && episodeData.title == episode) {
sounds = episodeData.sounds;
}
});
Expand All @@ -144,11 +144,16 @@ function parseTvEpisode(page, movieData, season, episode) {

if (!sounds) {
// error handled in `findSoundsByEpisode`
// console.error("Not found sounds for " + season + " " + episode)
}

sounds.forEach(function(data) {
page.appendItem(PLUGIN.id + ":play:" + data.url + ":" + movieData.title, "directory", {
const playData = JSON.stringify({
title: movieData.title,
href: data.url,
season: season,
episode: episode
})
page.appendItem(PLUGIN.id + ":play:" + playData, "directory", {
title: data.title
});
})
Expand All @@ -157,7 +162,11 @@ function parseTvEpisode(page, movieData, season, episode) {
/* фильм */

function __parseMovieVideo(page, movieData, videoUrl) {
page.appendItem(PLUGIN.id + ":play:" + videoUrl + ":" + movieData.title, "directory", {
const playData = JSON.stringify({
title: movieData.title,
href: videoUrl,
})
page.appendItem(PLUGIN.id + ":play:" + playData, "directory", {
title: movieData.title
});
}
Expand All @@ -171,7 +180,12 @@ function parseTrailer(page, movieData) {
page.appendPassiveItem("separator", '', {
title: "Трейлер (HLS)"
});
page.appendItem(PLUGIN.id + ":play:" + data.url + ":" + movieData.title, "directory", {

const playData = JSON.stringify({
title: movieData.title,
href: data.url,
})
page.appendItem(PLUGIN.id + ":play:" + playData, "directory", {
title: movieData.title
});
})
Expand Down
29 changes: 23 additions & 6 deletions uaserials.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ new page.Route(PLUGIN.id + ":moviepage:(.*):(.*)", function(page, href, title) {

/* setup info on the page */

infoData = {
var infoData = {
title: title,
icon: img,
description: description,
Expand All @@ -160,7 +160,12 @@ new page.Route(PLUGIN.id + ":moviepage:(.*):(.*)", function(page, href, title) {
currentMovieData = UASJsonDecrypt(htmlText);
currentMovieData["title"] = title;
currentMovieData["href"] = href;
currentMovieData["img"] = href;
currentMovieData["img"] = img;
currentMovieData["description"] = description;
currentMovieData["rating"] = infoData.rating;
currentMovieData["year"] = infoData.year;
currentMovieData["genre"] = infoData.genre;

// logDebug({currentMovieData:currentMovieData})

parseTrailer(page, currentMovieData);
Expand All @@ -175,11 +180,23 @@ new page.Route(PLUGIN.id + ":moviepage:(.*):(.*)", function(page, href, title) {

});

new page.Route(PLUGIN.id + ':play:(.*):(.*)', function(page, href, title) {
setPageHeader(page, "video", PLUGIN.id + " - " + title)
new page.Route(PLUGIN.id + ':play:(.*)', function(page, data) {
data = JSON.parse(data);

setPageHeader(page, "video", PLUGIN.id + " - " + data.title)

const videoURL = parseVideoURL(href);
page.source = videoURL;
page.type = 'video';
page.source = 'videoparams:' + JSON.stringify({
title: data.title + (data.season ? ": " + data.season + " " + data.episode : ""),
sources: [{
url: "hls:" + parseVideoURL(data.href),
}],
year: data.year ? data.year : 0,
// season: data.season ? data.season : -1,
// episode: data.episode ? data.episode : -1,
no_subtitle_scan: false, // Don't scan for subtitles at all
no_fs_scan: false, // Don't scan FS for subtitles
});

page.loading = false;
});
Expand Down

0 comments on commit f452221

Please sign in to comment.