Skip to content

Commit

Permalink
Fix compatibility with iptveditor and minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
lKinderBueno committed Jun 5, 2023
1 parent 6768d5a commit 3100995
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 57 deletions.
6 changes: 3 additions & 3 deletions src/components/Series/PlayerSeries.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ const PlayerSeries = () => {
setStreams(streamsTemp.map(x => {
return {
...x,
playing: parseInt(x.episode_num) === parseInt(episode),
id: x.episode_num,
playing: parseInt(x.episode_num || x.episode) === parseInt(episode),
id: x.episode_num || x.episode,
name: x.title
}
}))
Expand Down Expand Up @@ -68,7 +68,7 @@ const PlayerSeries = () => {
return (
<Container>
<ReactNetflixPlayer
src={stream && stream.direct_source}
src={stream && (stream.direct_source || stream.url || stream.url2)}
title={stream && (optimizeName(tvseries))}
titleMedia={stream && (optimizeName(tvseries))}
extraInfoMedia = {stream && (optimizeName(stream.title))}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Series/Seasons.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const Seasons = ({seasonData, cover}) => {
return {
...y,
episode_num: parseInt(y.episode_num),
url: y.direct_source || generateUrl("series", y.id, y.container_extension),
url: y.url || y.direct_source || generateUrl("series", y.id, y.container_extension),
url2: generateUrl("series", y.id, y.container_extension)
}
})
Expand Down
2 changes: 1 addition & 1 deletion src/components/Vod/GroupRow.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const GroupRow = ({category_id, name, style, playlist, isSeries, existingTmdb})
{playlist.slice(0, maxItem).map((x,id)=>
(<RowItem id={id} key={"vod"+ (x.stream_id || x.series_id)} name={x.name} stream_icon={x.stream_icon || x.cover} stream_id={x.stream_id || x.series_id} stream_url={x.direct_source} category_id={category_id} container_extension={x.container_extension} last={id+1===maxItem} isSeries={isSeries} existingTmdb={x.tmdb}/>)
)}
{playlist.length > maxItem && (<NextArrow category_id={category_id}/>)}
{playlist.length > maxItem && (<NextArrow category_id={category_id} isSeries={isSeries}/>)}
</div>
</Li>
)
Expand Down
4 changes: 2 additions & 2 deletions src/components/Vod/NextArrow.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ padding-top: calc(6.5vw * 1.5);
`


const NextArrow = ({category_id}) => {
const NextArrow = ({category_id, isSeries}) => {
return (
<Li className="vod" data-id="7" to={`/movie/category/${category_id}/`}>
<Li className="vod" data-id="7" to={`/${isSeries ? "series":"movie"}/category/${category_id}/`}>
<I className="fas fa-chevron-right"></I>
</Li>
)
Expand Down
6 changes: 6 additions & 0 deletions src/other/load-playlist.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@ export async function getSeriesInfo(series_id, name, only_info, existingTmdb) {
series_id: series_id,
}).catch(err => null)
.then(result => {
if(result.data && Array.isArray(result.data)){
result.data.forEach(x=> {
if(!x.episode_num && x.episode)
x.episode_num = x.episode
})
}
return result.data;
});
}
Expand Down
12 changes: 6 additions & 6 deletions src/other/tmdb.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,10 @@ export async function getSeriesTmdbData(name, streams, existingTmdb) {
ratingEp = (epData.vote_average / 2).toString();
imageEp = epData.still_path ? `https://image.tmdb.org/t/p/original${epData.still_path}` : "";
overview = epData.overview;
episodes[season.toString()].push(createEpisode(ep.direct_source, ep.id, ep.season, ep.episode, duration_secEp, durationEp, titleEp, airdateEp, crewEp, ratingEp, imageEp, overview));
} else episodes[season.toString()].push(createEpisode(ep.direct_source, ep.id, ep.season, ep.episode, duration_secEp, durationEp));
episodes[season.toString()].push(createEpisode(ep.direct_source || ep.url, ep.id, ep.season, ep.episode, duration_secEp, durationEp, titleEp, airdateEp, crewEp, ratingEp, imageEp, overview));
} else episodes[season.toString()].push(createEpisode(ep.direct_source || ep.url, ep.id, ep.season, ep.episode, duration_secEp, durationEp));
} else {
episodes[season.toString()].push(createEpisode(ep.direct_source, ep.id, ep.season, ep.episode, duration_secEp, durationEp));
episodes[season.toString()].push(createEpisode(ep.direct_source || ep.url, ep.id, ep.season, ep.episode, duration_secEp, durationEp));
}
});
})
Expand All @@ -180,7 +180,7 @@ export async function getSeriesTmdbData(name, streams, existingTmdb) {
episodes[season.toString()] = [];

eps.forEach(ep => {
episodes[season.toString()].push(createEpisode(ep.direct_source, ep.id, ep.season, ep.episode));
episodes[season.toString()].push(createEpisode(ep.direct_source || ep.url, ep.id, ep.season, ep.episode));
});
})
}
Expand All @@ -194,7 +194,7 @@ export async function getSeriesTmdbData(name, streams, existingTmdb) {


eps.forEach(ep => {
episodes[season.toString()].push(createEpisode(ep.direct_source, ep.season, ep.episode));
episodes[season.toString()].push(createEpisode(ep.direct_source || ep.url, ep.id, ep.season, ep.episode));
});
})
}
Expand All @@ -211,7 +211,7 @@ export function clearEpisodeName(seriesName, data){
data.episodes[season].forEach(ep=>{
ep.title = ep.title.replace(seriesName,"").replace(/S\d{1,2}E\d{1,2}/,"").trim();
if(!ep.title || ep.title === "-")
ep.title = "episode " + ep.episode_num
ep.title = "Episode " + (ep.episode_num || ep.episode)
})
})
}
88 changes: 44 additions & 44 deletions src/other/vod-series-name-optimizer.js
Original file line number Diff line number Diff line change
@@ -1,54 +1,54 @@
export function optimizeName(name){
name = name.replace("\r","").replace(/(-\s*\d{2,4})|vod|fhd|hd|360p|4k|h264|h265|24fps|60fps|720p|1080p|vod|x264|x265|\.avi|\.mp4|\.mkv|\[.*]|\(.*\)|\{.*\}|-|_|\./gim, " ").replace(/(- \d\d\d\d$)/,"");
name = name.replace(" ", " ");
name = name.replace(" ", " ");
return name.trim();
}
export function optimizeName(name) {
name = name.replace("\r", "").replace(/(-\s*\d{2,4})|vod|fhd|hd|360p|4k|h264|h265|24fps|60fps|720p|1080p|vod|x264|x265|\.avi|\.mp4|\.mkv|\[.*]|\(.*\)|\{.*\}|-|_|\./gim, " ").replace(/(- \d\d\d\d$)/, "");
name = name.replace(" ", " ");
name = name.replace(" ", " ");
return name.trim();
}

export function secondsToHms(d) {
d = Number(d);
var h = Math.floor(d / 3600);
var m = Math.floor(d % 3600 / 60);
var s = Math.floor(d % 3600 % 60);
return `${h}:${m<10 ? `0${m}` : m}:${s<10 ? `0${s}` : s}`;
}
export function secondsToHms(d) {
d = Number(d);
var h = Math.floor(d / 3600);
var m = Math.floor(d % 3600 / 60);
var s = Math.floor(d % 3600 % 60);
return `${h}:${m < 10 ? `0${m}` : m}:${s < 10 ? `0${s}` : s}`;
}

export function createMovieInfo (name, image, tmdbId = -1, releaseDate = "", coverBig = "", youtubeTrailer = "", director = "", actors = "", cast = "", description = "", plot = "", age = "", country = "", genre = "", backdropPath = "", durationSecs = 0, duration = "", rating10 = 0, status = "Released", runtime = 0) {
return {
"info":{
"name" : name,
"tmdb_id": tmdbId,
"cover_big":coverBig,
"movie_image": image,
"releasedate": releaseDate,
"youtube_trailer": youtubeTrailer,
"director": director,
"actors": actors,
"cast": cast,
"description": description,
"plot": plot,
"age": age,
"country": country,
"genre": genre,
"backdrop_path":[
backdropPath
],
"duration_secs": durationSecs,
"duration": duration,
"rating": rating10,
"status": status,
"runtime":runtime
},
}
}
export function createMovieInfo(name, image, tmdbId = -1, releaseDate = "", coverBig = "", youtubeTrailer = "", director = "", actors = "", cast = "", description = "", plot = "", age = "", country = "", genre = "", backdropPath = "", durationSecs = 0, duration = "", rating10 = 0, status = "Released", runtime = 0) {
return {
"info": {
"name": name,
"tmdb_id": tmdbId,
"cover_big": coverBig,
"movie_image": image,
"releasedate": releaseDate,
"youtube_trailer": youtubeTrailer,
"director": director,
"actors": actors,
"cast": cast,
"description": description,
"plot": plot,
"age": age,
"country": country,
"genre": genre,
"backdrop_path": [
backdropPath
],
"duration_secs": durationSecs,
"duration": duration,
"rating": rating10,
"status": status,
"runtime": runtime
},
}
}

export function createEpisode(url,id,season, episode_number,duration_sec = 0, duration = "",title="",airdate="", crew ="", rating = "0", image = "", overview){
export function createEpisode(url, id, season, episode_number, duration_sec = 0, duration = "", title = "", airdate = "", crew = "", rating = "0", image = "", overview) {
return { //season
"episode_num": episode_number,
"title": title === "" ? `Episode ${episode_number}` : title,
"container_extension": "mp4",
"url":url,
"id":id,
"url": url,
"id": id,
"overview": overview,
"info": {
"air_date": airdate,
Expand Down

0 comments on commit 3100995

Please sign in to comment.