Skip to content

Commit de5b453

Browse files
committed
migliorato il restart Rai e LA7 + fixato San Marino RTV
1 parent 875da39 commit de5b453

File tree

2 files changed

+67
-14
lines changed

2 files changed

+67
-14
lines changed

assets/css/main.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1549,6 +1549,10 @@ a#reopen-window svg {
15491549
height: 2rem;
15501550
place-content: center;
15511551
}
1552+
.source-header {
1553+
backdrop-filter: none;
1554+
box-shadow: none;
1555+
}
15521556
}
15531557
@media screen and (min-width: 769px) {
15541558
.columns {

assets/js/main.js

Lines changed: 63 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -857,6 +857,26 @@ const loadChannel = async ({ type, url, api = false, name, lcn, logo, fullLogo,
857857
}, ((json.expire_time - DateTime.now().toSeconds()) * 1000) - 3000);
858858
});
859859
break;
860+
861+
case "acdsolutions":
862+
window.acdSolutionsPlay = (url) => {
863+
loadStream({
864+
type: type,
865+
url: url,
866+
name: name,
867+
lcn: lcn,
868+
logo: logo
869+
});
870+
};
871+
const acdSolutionsScript = document.createElement("script");
872+
acdSolutionsScript.setAttribute("src", `https://catchup.acdsolutions.it/jstag/videoplayerLiveFluid/TV?ch=${parameter}&vID=%27%29%3B%7D%7D%29%7D%3B%20window.acdSolutionsPlay%28videoElement_playerElement.querySelector%28%22source%22%29.src%29%3B%20%7D%20catch%20%7B%7D%3B%20%2F%2F`);
873+
acdSolutionsScript.setAttribute("async", true);
874+
acdSolutionsScript.addEventListener("load", () => {
875+
acdSolutionsScript.remove();
876+
delete window.acdSolutionsPlay;
877+
});
878+
document.head.appendChild(acdSolutionsScript);
879+
break;
860880
};
861881
} else if (license) {
862882
switch(license) {
@@ -1083,6 +1103,9 @@ let fastChannelsPresent = true;
10831103
await fetch(getFASTChannelsURL(selectedCountry))
10841104
.then(response => response.json())
10851105
.then(fastChannels => {
1106+
if (ipLocation != selectedCountry) {
1107+
fastChannels.channels = fastChannels.channels.filter(el => (el.url && !el.url.includes("pluto.tv") || (el.id && el.id != "plutotv")));
1108+
};
10861109
window.zappr.channels = window.zappr.channels.concat(fastChannels.channels);
10871110
})
10881111
.catch(e => {
@@ -1359,6 +1382,19 @@ const createScheduler = (scheduleData) => ({
13591382
remove: () => remove()
13601383
});
13611384

1385+
const addAutoRestart = (el, startTime, manual) => {
1386+
if (!el.querySelector(".epg-restart")) {
1387+
el.querySelector(".epg-buttons").insertAdjacentHTML("beforeend", `<div class="epg-restart${manual ? " manual": ""}"><img src="${new URL("/assets/icons/restart.svg", import.meta.url)}">Restart</div>`);
1388+
el.querySelector(".epg-restart").addEventListener("click", () => {
1389+
player.currentTime(player.liveTracker.liveCurrentTime() - ((DateTime.now().ts - startTime) / 1000) + 10);
1390+
el.classList.add("restart-soon");
1391+
setTimeout(() => {
1392+
el.classList.remove("restart-soon");
1393+
}, 10000);
1394+
});
1395+
} else el.querySelector(".epg-restart").remove();
1396+
};
1397+
13621398
let manualRestart = {
13631399
fetchCache: {},
13641400
run: async (channel, source, data) => {
@@ -1516,6 +1552,17 @@ let manualRestart = {
15161552
let json;
15171553

15181554
switch (source) {
1555+
case "rai":
1556+
if (ipLocation === selectedCountry) {
1557+
if (els[el].classList.contains("on-air")) {
1558+
const onAirStartTime = await fetch(`https://www.raiplay.it/palinsesto/onAir.json`)
1559+
.then(response => response.json())
1560+
.then(json => DateTime.fromISO(json.on_air.filter(el => el.palinsesto_url === id)[0].currentItem.tech_datetime_en).toMillis() + 25000);
1561+
addAutoRestart(els[el], onAirStartTime, true);
1562+
} else if (startTime.ts >= DateTime.now().ts - ((player.seekable().end(0) - player.seekable().start(0)) * 1000) && startTime.ts <= DateTime.now().ts) addAutoRestart(els[el], startTime.ts, true);
1563+
};
1564+
break;
1565+
15191566
case "mediaset":
15201567
if (ipLocation === selectedCountry) {
15211568
if (manualRestart.fetchCache[source] && manualRestart.fetchCache[source][id]) json = manualRestart.fetchCache[source][id];
@@ -1547,7 +1594,15 @@ let manualRestart = {
15471594
}).ts;
15481595
if (entryStartTime.hour < 6) entryStartTime = entryStartTime.plus({ days: 1 });
15491596
if (entryStartTime >= rangeStart && entryStartTime <= rangeEnd) manualRestart.addButton(els[el], channel, source, entry.nid);
1597+
else if (startTime.ts >= DateTime.now().ts - ((player.seekable().end(0) - player.seekable().start(0)) * 1000) && startTime.ts <= DateTime.now().ts && !els[el].classList.contains("on-air")) addAutoRestart(els[el], startTime.ts, true);
15501598
});
1599+
1600+
if (els[el].classList.contains("on-air")) {
1601+
const onAirStartTime = await fetch(`https://static.iltrovatore.it/StreamingStatus/${id}.rivedi2.txt`)
1602+
.then(response => response.text())
1603+
.then(text => DateTime.fromFormat(text.split("\t")[0], "yyyy.MM.dd-hh.mm.ss").toMillis());
1604+
addAutoRestart(els[el], onAirStartTime, true);
1605+
};
15511606
break;
15521607

15531608
case "sky":
@@ -1578,9 +1633,9 @@ let manualRestart = {
15781633
.then(response => response.json())
15791634
.then(json => json.containers[0].configUrl.replaceAll("http://", "https://"));
15801635

1581-
let channelConfigURL = await fetch(channelModulesURL)
1582-
.then(response => response.json())
1583-
.then(json => json.bundles.filter(el => el.javascript.module === "galaxy")[0].javascript.configUrl.replaceAll("http://", "https://"));
1636+
let channelModules = await fetch(channelModulesURL)
1637+
.then(response => response.json());
1638+
let channelConfigURL = channelModules.bundles.filter(el => el.javascript.module === "galaxy")[0].javascript.configUrl.replaceAll("http://", "https://");
15841639
let channelConfig = await fetch(channelConfigURL)
15851640
.then(response => response.json());
15861641

@@ -1593,7 +1648,8 @@ let manualRestart = {
15931648
json = {
15941649
startOverWindow: startOverWindow,
15951650
epgConfig: epgConfig,
1596-
restartID: restartID
1651+
restartID: restartID,
1652+
channelID: channelModules.currentChannel.name
15971653
};
15981654

15991655
manualRestart.fetchCache[source] = {};
@@ -1605,7 +1661,7 @@ let manualRestart = {
16051661
buffer: parseInt(json.epgConfig.channelDelay),
16061662
epgEndpoint: new URL(json.epgConfig.epgApiEndpoint).origin,
16071663
epgChunkSize: parseInt(json.epgConfig.epgChunkSize),
1608-
id: id,
1664+
id: json.channelID,
16091665
restartID: json.restartID,
16101666
startTime: startTime.ts
16111667
});
@@ -1623,14 +1679,7 @@ const updateRestartablePrograms = async (manual = false) => {
16231679
if (document.querySelector(".channel.watching") && document.querySelector(".channel.watching").dataset.epgSource && document.querySelector("#channels-column").classList.contains("epg-visible") && document.querySelector(`#epg[data-epg-source="${document.querySelector(".channel.watching").dataset.epgSource}"][data-epg-id="${document.querySelector(".channel.watching").dataset.epgId}"]`)) {
16241680
document.querySelectorAll(".epg-item-container").forEach(el => {
16251681
if ((parseInt(el.dataset.startTime) >= DateTime.now().ts - ((player.seekable().end(0) - player.seekable().start(0)) * 1000) && parseInt(el.dataset.startTime) <= DateTime.now().ts) && !document.querySelector(".channel.watching").dataset.manualRestartSource) {
1626-
el.querySelector(".epg-buttons").insertAdjacentHTML("beforeend", `<div class="epg-restart"><img src="${new URL("/assets/icons/restart.svg", import.meta.url)}">Restart</div>`);
1627-
el.querySelector(".epg-restart").addEventListener("click", () => {
1628-
player.currentTime(player.liveTracker.liveCurrentTime() - ((DateTime.now().ts - parseInt(el.dataset.startTime)) / 1000) + 10);
1629-
el.classList.add("restart-soon");
1630-
setTimeout(() => {
1631-
el.classList.remove("restart-soon");
1632-
}, 10000);
1633-
});
1682+
addAutoRestart(el, parseInt(el.dataset.startTime));
16341683
};
16351684
});
16361685
if (manual) await manualRestart.check(document.querySelector(".channel.watching"), Array.from(document.querySelectorAll(".epg-item-container")));
@@ -1751,7 +1800,7 @@ document.querySelectorAll(".channel").forEach(el => {
17511800
17521801
return `<div class="epg-item-container${expandable ? " expandable" : ""}${entry.startTime.unix <= now && entry.endTime.unix >= now ? " on-air" : ""}${!entry.image ? " no-image" : ""}" ${entry.image ? `style="background-image: url('${entry.image}');"` : ""} data-start-time="${entry.startTime.unix}">
17531802
<div class="epg-item">
1754-
${entry.image ? `<img src="${entry.image}" class="epg-image">` : ""}
1803+
${entry.image ? `<img src="${entry.image}" class="epg-image" onerror="this.parentElement.parentElement.classList.add('no-image'); this.remove();">` : ""}
17551804
<div class="epg-info">
17561805
<span class="epg-start-time">${DateTime.fromMillis(entry.startTime.unix).toFormat("HH:mm")}</span>
17571806
<h1 class="epg-name">${entry.name}${entry.season ? ` <b>S${entry.season}</b>` : " "}${entry.episode ? `<b>E${entry.episode}</b>` : ""}${entry.rating && entry.rating.label != "6+" ? `<span class="epg-rating" style="background-color: ${entry.rating.background}; color: ${entry.rating.text};">${entry.rating.label}</span>` : ""}</h1>

0 commit comments

Comments
 (0)