Skip to content

Commit

Permalink
fix for iptveditor users
Browse files Browse the repository at this point in the history
  • Loading branch information
lKinderBueno committed May 22, 2021
1 parent 306b16b commit 43128a6
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 15 deletions.
Binary file removed logo.png
Binary file not shown.
12 changes: 2 additions & 10 deletions src/components/Player/Player.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Fullscreen from "../Live/Fullscreen"
import Button from "./Buttons/Button"
import VolumeButton from "./Buttons/VolumeButton"
import PiPButton from "./Buttons/PiPButton"
import {generateUrl, catchupUrlGenerator} from "../../other/generate-url"
import {generateUrl, catchupUrlGenerator, convertTsToM3u8} from "../../other/generate-url"

import "./Player.css"

Expand Down Expand Up @@ -86,15 +86,7 @@ const Player = () => {
if (!playingChannel)
return;

let ip = playingChannel.url || generateUrl("live", playingChannel.stream_id, "m3u8");
if (playingChannel.url) {
let splitted = ip.split("/");
if (splitted.includes("/live/"))
ip = ip.replace(".ts", ".m3u8");
else if (splitted.length >= 5) {
ip = splitted.slice(0, splitted.length - 3).join("/") + "/live/" + splitted.slice(splitted.length - 3, splitted.length).join("/") + ".m3u8"
} else ip = ip.replace("ts", "m3u8");
}
let ip = playingChannel.url ? convertTsToM3u8(playingChannel.url) : generateUrl("live", playingChannel.stream_id, "m3u8")

if (playingChannel.timeshift)
ip = catchupUrlGenerator(ip, playingChannel.timeshift, playingChannel.duration);
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 @@ -43,7 +43,7 @@ const GroupRow = ({category_id, name, style, playlist, isSeries}) => {
<H3 to={`/${isSeries ? "series" : "movie"}/category/${category_id}/`}>{name}</H3>
<div className="row" style={{marginTop:".5rem"}}>
{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.url} category_id={category_id} last={id+1===maxItem} isSeries={isSeries}/>)
(<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.url} category_id={category_id} container_extension={x.container_extension} last={id+1===maxItem} isSeries={isSeries}/>)
)}
{playlist.length > maxItem && (<NextArrow category_id={category_id}/>)}
</div>
Expand Down
1 change: 1 addition & 0 deletions src/components/Vod/MainVod.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ const MainVod = () => {
stream_id={playlist[index].stream_id || playlist[index].series_id}
stream_url={playlist[index].url}
isSeries={playingMode==="series"}
container_extension={playlist[index].container_extension}
category_id={playlist[index].category_id}
last={false} style={{...style,paddingBottom:".7rem", marginLeft:"1%", textDecoration: "none"}}/>
)
Expand Down
5 changes: 3 additions & 2 deletions src/components/Vod/RowItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {optimizeName} from "../../other/vod-series-name-optimizer"
import PopupHover from "./PopupHover"
import {Link} from "react-router-dom";
import DB from "../../other/local-db"
import {generateUrl} from "../../other/generate-url"

const Li = styled(Link)`
height: calc(15vw * 1.5);
Expand Down Expand Up @@ -91,7 +92,7 @@ const noCoverStyle = {
justifyContent: "center"
}

const RowItem = ({name, stream_icon, last, stream_id, stream_url, category_id, id, style, isSeries}) => {
const RowItem = ({name, stream_icon, last, stream_id, category_id, id, style, isSeries, container_extension}) => {
const [noCover,setNoCover] = useState(!stream_icon);
const [streamStat, setStreamStat] = useState()
const [popup, setPopup] = useState(false);
Expand Down Expand Up @@ -153,7 +154,7 @@ const RowItem = ({name, stream_icon, last, stream_id, stream_url, category_id, i
<div style={{width:streamStat.tot+"%"}}/>
</Bar>
)}
{popup && !last && (<PopupHover name={name} stream_icon={stream_icon} stream_id={stream_id} stream_url={stream_url} category_id={category_id} style={popupStyle} isSeries={isSeries}/>)}
{popup && !last && (<PopupHover name={name} stream_icon={stream_icon} stream_id={stream_id} stream_url={generateUrl("movie", stream_id, container_extension)} category_id={category_id} style={popupStyle} isSeries={isSeries}/>)}
</Li>
)
}
Expand Down
20 changes: 18 additions & 2 deletions src/other/generate-url.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,30 @@ export function generateUrl (type, id, extension){
return `${dns}${type}/${user}/${pass}/${id}.${ getIsIptveditor()===true ? "mp4" : extension}`
}

export function catchupUrlGenerator (url,time, duration){
export function convertTsToM3u8(ip) {
let url = ip;
url = url.replace("/live/","/").replace(/\.ts|\.m3u8/g,"")
const splitted = url.split("/");

const id = splitted[splitted.length-1];
if(isNaN(id))
return ip;
const user = splitted[splitted.length-3];
const pass = splitted[splitted.length-2];
const domain = splitted.slice(0,splitted.length-3).join("/");

return domain + "/live/" + user + "/" + pass + "/" + id + ".m3u8";
}

export function catchupUrlGenerator (ip,time, duration){
let url = ip;
time = timeConverter(time)
url = url.replace.replace("/live/","/").replace(/\.ts|\.m3u8/g,"")
const splitted = url.split("/");

const id = splitted[splitted.length-1];
if(isNaN(id))
return;
return ip;
const user = splitted[splitted.length-3];
const pass = splitted[splitted.length-2];
const domain = splitted.slice(0,splitted.length-3).join("/");
Expand Down

0 comments on commit 43128a6

Please sign in to comment.