Skip to content

Commit 8db8f8d

Browse files
author
Francesco
committed
aggiunte le Marche e migliorato il sistema di seek
1 parent c1caf58 commit 8db8f8d

File tree

2 files changed

+17
-13
lines changed

2 files changed

+17
-13
lines changed

assets/js/main.js

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ const createModal = async (title, text, buttons) => {
118118
(document.querySelector(".modal")).classList.add("is-visible");
119119
};
120120

121-
const loadStream = async (type, url, seek, api, name, lcn, logo, http) => {
121+
const loadStream = async (type, url, seek, api, name, lcn, logo, http, ondemand) => {
122122
if (api) {
123123
url = `${window["zappr"].config.backend.host[api]}/api?${url}`;
124124
};
@@ -362,14 +362,14 @@ const loadStream = async (type, url, seek, api, name, lcn, logo, http) => {
362362
currentType = type;
363363
};
364364

365-
if (seek === "false" || type === "dash" || type === "flv" || type === "direct") {
365+
if (seek === "false" || type === "dash" || type === "flv" || (type === "direct" && ondemand != "true")) {
366366
hideProgress.media = "";
367367
} else {
368368
hideProgress.media = "not all";
369369
};
370370
};
371371

372-
const loadChannel = async (type, url, seek, api, name, lcn, logo, http, license) => {
372+
const loadChannel = async (type, url, seek, api, name, lcn, logo, http, license, ondemand) => {
373373
if (url.startsWith("zappr://")) {
374374
const parameter = url.split("/")[3];
375375
switch(url.split("/")[2]) {
@@ -378,15 +378,15 @@ const loadChannel = async (type, url, seek, api, name, lcn, logo, http, license)
378378
await fetch(`https://apid.sky.it/vdp/v1/getLivestream?id=${parameter}&isMobile=false`)
379379
.then(response => response.json())
380380
.then(json => {
381-
loadStream(type, json.streaming_url, seek, false, name, lcn, logo, false);
381+
loadStream(type, json.streaming_url, seek, false, name, lcn, logo, false, false);
382382
});
383383
break;
384384

385385
case "la7-hbbtv":
386386
await fetch(`https://www.la7.it/appPlayer/liveUrlWithFailPerApp.php?channel=${parameter}`)
387387
.then(response => response.json())
388388
.then(json => {
389-
loadStream(type, json.main, seek, false, name, lcn, logo, false);
389+
loadStream(type, json.main, seek, false, name, lcn, logo, false, false);
390390
});
391391
break;
392392

@@ -412,8 +412,9 @@ const loadChannel = async (type, url, seek, api, name, lcn, logo, http, license)
412412
})
413413
.then(response => response.json())
414414
.then(json => {
415-
loadStream(type, json.srcs[0].uniqueStreamer, seek, false, name, lcn, logo, false);
415+
loadStream(type, json.srcs[0].uniqueStreamer, seek, false, name, lcn, logo, false, false);
416416
});
417+
break;
417418

418419
};
419420
} else if (license != undefined) {
@@ -423,12 +424,12 @@ const loadChannel = async (type, url, seek, api, name, lcn, logo, http, license)
423424
await fetch("https://play.xdevel.com/was")
424425
.then(response => response.json())
425426
.then(json => {
426-
loadStream(type, `${url}?wmsAuthSign=${json.was}`, seek, false, name, lcn, logo, false);
427+
loadStream(type, `${url}?wmsAuthSign=${json.was}`, seek, false, name, lcn, logo, false, false);
427428
});
428429
break;
429430

430431
};
431-
} else await loadStream(type, url, seek, api, name, lcn, logo, http);
432+
} else await loadStream(type, url, seek, api, name, lcn, logo, http, ondemand);
432433
};
433434

434435
const getChannelLogoURL = (logo) => {
@@ -448,7 +449,7 @@ const addChannels = (channels) => {
448449
channels.forEach(channel => {
449450
channelslist.insertAdjacentHTML("beforeend", `
450451
${channel.hbbtv ? `<div class="hbbtv-container">` : ""}
451-
<div class="${channel.hbbtvapp ? "hbbtv-app" : ""} ${channel.hbbtvmosaic ? "hbbtv-enabler hbbtv-mosaic": "channel"} ${channel.adult === true ? "adult" : channel.adult === "night" ? "adult at-night" : ""}" data-name="${channel.name}" data-logo="${getChannelLogoURL(channel.logo)}" ${channel.type != undefined ? `data-type="${channel.type}"` : ""} ${channel.url != undefined ? `data-url="${channel.url}"` : ""} data-lcn="${channel.lcn}" ${channel.seek != undefined ? `data-seek="${channel.seek}"` : ""} ${channel.disabled ? `disabled data-disabled="${channel.disabled}"` : ""} ${channel.api ? `data-api="${channel.api}"` : ""} ${channel.cssfix ? `data-cssfix="${channel.cssfix}"` : ""} ${channel.http ? `data-http="true"` : ""} ${channel.license ? `data-license="${channel.license}"` : ""}>
452+
<div class="${channel.hbbtvapp ? "hbbtv-app" : ""} ${channel.hbbtvmosaic ? "hbbtv-enabler hbbtv-mosaic": "channel"} ${channel.adult === true ? "adult" : channel.adult === "night" ? "adult at-night" : ""}" data-name="${channel.name}" data-logo="${getChannelLogoURL(channel.logo)}" ${channel.type != undefined ? `data-type="${channel.type}"` : ""} ${channel.url != undefined ? `data-url="${channel.url}"` : ""} data-lcn="${channel.lcn}" ${channel.seek != undefined ? `data-seek="${channel.seek}"` : ""} ${channel.disabled ? `disabled data-disabled="${channel.disabled}"` : ""} ${channel.api ? `data-api="${channel.api}"` : ""} ${channel.cssfix ? `data-cssfix="${channel.cssfix}"` : ""} ${channel.http ? `data-http="true"` : ""} ${channel.license ? `data-license="${channel.license}"` : ""} ${channel.ondemand ? `data-ondemand="${channel.ondemand}"` : ""}>
452453
<div class="lcn">${channel.lcn}</div>
453454
<img class="logo" src="${getChannelLogoURL(channel.logo)}" crossorigin="anonymous">
454455
<div class="channel-title-subtitle">
@@ -473,7 +474,7 @@ const addChannels = (channels) => {
473474
${channel.hbbtv ? `<div class="hbbtv-channels">
474475
${channel.hbbtv.map(subchannel =>
475476
subchannel.categorySeparator === undefined
476-
? `<div class="channel ${subchannel.adult === true ? "adult" : subchannel.adult === "night" ? "adult at-night" : ""}" data-name="${subchannel.name}" data-logo="${getChannelLogoURL(subchannel.logo)}" ${subchannel.type != undefined ? `data-type="${subchannel.type}"` : ""} ${subchannel.url != undefined ? `data-url="${subchannel.url}"` : ""} data-lcn="${channel.lcn}.${subchannel.sublcn}" ${subchannel.seek ? `data-seek="${subchannel.seek}"` : ""} ${subchannel.disabled ? `disabled data-disabled="${subchannel.disabled}"` : ""} ${subchannel.api ? `data-api="${subchannel.api}"` : ""} ${subchannel.cssfix ? `data-cssfix="${subchannel.cssfix}"` : ""} ${subchannel.http ? `data-http="true"` : ""} ${subchannel.license ? `data-license="${subchannel.license}"` : ""}>
477+
? `<div class="channel ${subchannel.adult === true ? "adult" : subchannel.adult === "night" ? "adult at-night" : ""}" data-name="${subchannel.name}" data-logo="${getChannelLogoURL(subchannel.logo)}" ${subchannel.type != undefined ? `data-type="${subchannel.type}"` : ""} ${subchannel.url != undefined ? `data-url="${subchannel.url}"` : ""} data-lcn="${channel.lcn}.${subchannel.sublcn}" ${subchannel.seek ? `data-seek="${subchannel.seek}"` : ""} ${subchannel.disabled ? `disabled data-disabled="${subchannel.disabled}"` : ""} ${subchannel.api ? `data-api="${subchannel.api}"` : ""} ${subchannel.cssfix ? `data-cssfix="${subchannel.cssfix}"` : ""} ${subchannel.http ? `data-http="true"` : ""} ${subchannel.license ? `data-license="${subchannel.license}"` : ""} ${subchannel.ondemand ? `data-ondemand="${subchannel.ondemand}"` : ""}>
477478
<div class="lcn">${channel.lcn}.${subchannel.sublcn}</div>
478479
<img class="logo" src="${getChannelLogoURL(subchannel.logo)}" crossorigin="anonymous">
479480
<div class="channel-title-subtitle">
@@ -743,7 +744,7 @@ document.querySelectorAll(".channel").forEach(el => {
743744
return;
744745
};
745746
};
746-
await loadChannel(el.dataset.type, el.dataset.url, el.dataset.seek, el.dataset.api, el.dataset.name, el.dataset.lcn, el.dataset.logo, el.dataset.http, el.dataset.license);
747+
await loadChannel(el.dataset.type, el.dataset.url, el.dataset.seek, el.dataset.api, el.dataset.name, el.dataset.lcn, el.dataset.logo, el.dataset.http, el.dataset.license, el.dataset.ondemand);
747748
});
748749
};
749750
});

index.html

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,15 @@
105105
<option value="veneto">Veneto</option>
106106
</optgroup>
107107
<optgroup label="Centro Italia">
108+
<option value="marche">Marche</option>
108109
<option value="lazio">Lazio</option>
109-
<option value="abruzzo">Abruzzo</option>
110-
<option value="molise">Molise</option>
110+
<option value="toscana">Toscana</option>
111+
<option value="umbria">Umbria</option>
111112
</optgroup>
112113
<optgroup label="Sud Italia">
114+
<option value="abruzzo">Abruzzo</option>
113115
<option value="campania">Campania</option>
116+
<option value="molise">Molise</option>
114117
</optgroup>
115118
<optgroup label=""></optgroup>
116119
<optgroup label="Altre regioni in arrivo!"></optgroup>

0 commit comments

Comments
 (0)