stremiok 2.2.8 → 2.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/config.xml +1 -1
- package/css/modern.css +146 -0
- package/css/style.css +7 -3
- package/index.html +36 -35
- package/js/focus.js +13 -2
- package/js/player-core.js +50 -2
- package/js/player-store.js +2 -1
- package/js/stremio.js +3 -1
- package/js/stvod.js +7 -2
- package/js/util.js +40 -6
- package/js/view-core.js +3 -1
- package/js/view-detail.js +32 -5
- package/js/view-discover.js +10 -5
- package/js/view-home.js +72 -7
- package/js/view-settings.js +25 -5
- package/js/ytplay.js +1 -1
- package/package.json +1 -1
- package/service/index.js +48 -14
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,27 @@
|
|
|
3
3
|
What changed in each version of StremioK, newest first. How everything works is in the
|
|
4
4
|
[user guide](docs/USER-GUIDE.md).
|
|
5
5
|
|
|
6
|
+
## 2.2.9 — 2026-11-05
|
|
7
|
+
- **A Modern look** (Settings › Appearance › *Look*): the focused title's backdrop behind Home and
|
|
8
|
+
its page, large logos, rounder posters, a centered menu, with any background. *Effects*: blur and
|
|
9
|
+
motion where the TV handles them (Auto: Tizen 6 and later), Light, or Full. Classic stays as it
|
|
10
|
+
was.
|
|
11
|
+
- **ClearKey channels with a key server** whose stream names only Widevine or PlayReady now ask
|
|
12
|
+
that server (they stopped with Shaka's error 6012) (#11).
|
|
13
|
+
- **HLS through StremioK's service** (Settings › Playback › Seeking & buffering), for hosts that want
|
|
14
|
+
a Referer, User-Agent or Cookie on every piece, which the TV's player can't always send: for the
|
|
15
|
+
sources that need it, or all HLS. Hold OK on a source › *Play through StremioK's service* for just
|
|
16
|
+
that one (#13).
|
|
17
|
+
- **Anime and "other" catalogs:** their shows open on their seasons and episodes from Discover and
|
|
18
|
+
Search too, not on sources, and a debrid download on its files (#13).
|
|
19
|
+
- **Episode pictures:** one that doesn't load (Cinemeta's for long shows past their first seasons)
|
|
20
|
+
gives way to TMDB's, with a TMDB key (#13).
|
|
21
|
+
- **Stalker films and series** (Settings › Content › IPTV): what's read of a portal is kept 10
|
|
22
|
+
minutes, 5, or not at all.
|
|
23
|
+
- **YouTube backdrops** in 1280×720 where the video has them.
|
|
24
|
+
- **Fixed:** a row's title cut off scrolling back up at high zooms; Discover's bar too wide at 140%;
|
|
25
|
+
LEFT / RIGHT on a single line of Discover titles; the Guide unreadable on Light Gray and White.
|
|
26
|
+
|
|
6
27
|
## 2.2.8 — 2026-11-04
|
|
7
28
|
- **DRM channels** (a playlist's `#KODIPROP` lines): Widevine and PlayReady play in the TV's player
|
|
8
29
|
with the license server the playlist names; ClearKey with its keys or key server, through Shaka
|
package/config.xml
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
2
|
<widget xmlns="http://www.w3.org/ns/widgets" xmlns:tizen="http://tizen.org/ns/widgets"
|
|
3
|
-
id="http://stremiok.tizen/StremioKTizen" version="2.2.
|
|
3
|
+
id="http://stremiok.tizen/StremioKTizen" version="2.2.9" viewmodes="maximized">
|
|
4
4
|
<tizen:application id="StremioK01.StremioK" package="StremioK01" required_version="3.0"/>
|
|
5
5
|
<content src="index.html"/>
|
|
6
6
|
<feature name="http://tizen.org/feature/screen.size.all"/>
|
package/css/modern.css
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/* StremioK — the Modern look (Settings › Appearance › Look). Every rule here is under
|
|
2
|
+
body.look-modern, so Classic stays exactly as style.css draws it. body.fx-full adds the
|
|
3
|
+
effects a newer TV handles (blur behind the menu, fades, cards easing into focus, a soft
|
|
4
|
+
shadow); without it (Effects: Light, and Auto on Tizen 3 to 5.5) the same look, drawn
|
|
5
|
+
without them: a large blur repainted on every move is what slows an older TV down.
|
|
6
|
+
Chromium 47 (Tizen 3): no CSS variables, no backdrop-filter; gradients, flexbox and
|
|
7
|
+
transforms are fine. */
|
|
8
|
+
|
|
9
|
+
body.look-modern { background: #0e1117; font-family: 'SK Roboto', Arial, "Tizen Sans", sans-serif; }
|
|
10
|
+
body.look-modern #screen-home { background: #0e1117; }
|
|
11
|
+
|
|
12
|
+
/* --- Home: the focused title's backdrop, behind everything (view-home.js homeBackdrop) --- */
|
|
13
|
+
.home-bg { display: none; }
|
|
14
|
+
body.look-modern .home-bg { display: block; position: absolute; top: 0; left: 0; width: 100%; height: 100%; overflow: hidden; background: #0e1117; }
|
|
15
|
+
body.look-modern .home-bg .hb { position: absolute; top: 0; right: 0; width: 80%; height: 86%; background-size: cover; background-position: center top; opacity: 0; }
|
|
16
|
+
body.look-modern .home-bg .hb.on { opacity: 1; }
|
|
17
|
+
body.look-modern.fx-full .home-bg .hb { -webkit-transition: opacity 0.45s ease; transition: opacity 0.45s ease; }
|
|
18
|
+
/* dark on the left, under the text, and at the bottom, under the rows */
|
|
19
|
+
body.look-modern .home-bg .hb-shade { position: absolute; top: 0; left: 0; right: 0; bottom: 0;
|
|
20
|
+
background: linear-gradient(90deg, #0e1117 20%, rgba(14,17,23,0.78) 32%, rgba(14,17,23,0.3) 52%, rgba(14,17,23,0) 72%),
|
|
21
|
+
linear-gradient(0deg, #0e1117 30%, rgba(14,17,23,0.82) 44%, rgba(14,17,23,0) 66%),
|
|
22
|
+
linear-gradient(180deg, rgba(14,17,23,0.55) 0%, rgba(14,17,23,0) 16%); }
|
|
23
|
+
|
|
24
|
+
/* --- The top menu: light text on the picture, the current item a soft pill, focus white --- */
|
|
25
|
+
body.look-modern .header { position: relative; z-index: 3; height: 104px; padding: 30px 90px 0 90px; }
|
|
26
|
+
body.look-modern .home-header .tabbar-inline { background: rgba(22,27,38,0.78); border-radius: 36px; padding: 5px; }
|
|
27
|
+
body.look-modern.fx-full .home-header .tabbar-inline { background: rgba(42,51,70,0.42); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); }
|
|
28
|
+
body.look-modern .tab-pill, body.look-modern .header .hchip { background: transparent; color: rgba(255,255,255,0.74); font-size: 23px; padding: 9px 22px; margin-right: 2px; border: 3px solid transparent; border-radius: 30px; }
|
|
29
|
+
body.look-modern .menu-scroll > .hchip { background: rgba(22,27,38,0.78); margin-left: 10px; } /* (Settings, after the bar) */
|
|
30
|
+
body.look-modern.fx-full .menu-scroll > .hchip { background: rgba(42,51,70,0.42); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); }
|
|
31
|
+
body.look-modern .tab-ic { display: none; }
|
|
32
|
+
body.look-modern .tab-pill.active, body.look-modern .home-header .hchip.active { background: rgba(255,255,255,0.16); color: #ffffff; }
|
|
33
|
+
body.look-modern .tab-pill.focusable.focused, body.look-modern .header .hchip.focusable.focused { background: #fff; color: #000; border-color: #ffffff; box-shadow: none; }
|
|
34
|
+
body.look-modern .brand { font-size: 34px; color: #ffffff; letter-spacing: 0.5px; }
|
|
35
|
+
/* the menu centered on the screen: its items centered in their strip (auto margins, which give
|
|
36
|
+
way to sideways scrolling when they don't all fit), and a space on the left as wide as the
|
|
37
|
+
StremioK name and its gap on the right, the first to give way when the menu fills the line */
|
|
38
|
+
body.look-modern .home-header::before { content: ''; display: block; -webkit-flex: 0 1000 170px; flex: 0 1000 170px; min-width: 0; }
|
|
39
|
+
body.look-modern .home-header .menu-scroll > :first-child { margin-left: auto; }
|
|
40
|
+
body.look-modern .home-header .menu-scroll > :last-child { margin-right: auto; }
|
|
41
|
+
body.look-modern .brand .dot { color: #818cf8; }
|
|
42
|
+
|
|
43
|
+
/* --- Home: the focused title, large, over its backdrop (.hero: the title tabs) ---
|
|
44
|
+
Anchored to the rows: the synopsis just above them, a taller logo growing upward. Its room
|
|
45
|
+
is set for each zoom (U.setZoom's zoom-110 … zoom-140 on the page, which is laid out
|
|
46
|
+
1080 / zoom tall): one row of posters always fits below it. */
|
|
47
|
+
body.look-modern .home-info.hero, body.look-modern .home-info.hero.on { top: 120px; left: 90px; right: auto; width: 940px; height: 446px; padding: 0;
|
|
48
|
+
border: 0; border-radius: 0; background: none; z-index: 2;
|
|
49
|
+
display: -webkit-flex; display: flex; -webkit-flex-direction: column; flex-direction: column; -webkit-justify-content: flex-end; justify-content: flex-end; }
|
|
50
|
+
body.look-modern .home-info.hero .home-info-title { height: auto; line-height: 1.1; font-size: 66px; font-weight: bold; letter-spacing: -1px; white-space: normal; max-height: 150px; -webkit-flex: none; flex: none; }
|
|
51
|
+
body.look-modern .home-info.hero .home-info-logo { display: block; max-height: 150px; max-width: 620px; }
|
|
52
|
+
body.look-modern .home-info.hero .home-info-meta { font-size: 25px; line-height: 32px; color: rgba(255,255,255,0.86); margin: 22px 0 12px 0; -webkit-flex: none; flex: none; }
|
|
53
|
+
body.look-modern .home-info.hero .home-info-desc { font-size: 25px; line-height: 36px; color: rgba(255,255,255,0.8); max-height: 144px; max-width: 900px; -webkit-flex: none; flex: none; }
|
|
54
|
+
body.look-modern .home-info.hero + .rows { top: 586px; }
|
|
55
|
+
body.look-modern.zoom-110 .home-info.hero { top: 112px; height: 398px; }
|
|
56
|
+
body.look-modern.zoom-110 .home-info.hero + .rows { top: 530px; }
|
|
57
|
+
body.look-modern.zoom-110 .home-info.hero .home-info-logo { max-height: 130px; }
|
|
58
|
+
body.look-modern.zoom-110 .home-info.hero .home-info-desc { max-height: 108px; }
|
|
59
|
+
body.look-modern.zoom-120 .home-info.hero { top: 106px; height: 346px; }
|
|
60
|
+
body.look-modern.zoom-120 .home-info.hero + .rows { top: 476px; }
|
|
61
|
+
body.look-modern.zoom-120 .home-info.hero .home-info-logo { max-height: 112px; }
|
|
62
|
+
body.look-modern.zoom-120 .home-info.hero .home-info-desc { max-height: 108px; }
|
|
63
|
+
body.look-modern.zoom-130 .home-info.hero { top: 100px; height: 296px; }
|
|
64
|
+
body.look-modern.zoom-130 .home-info.hero + .rows { top: 418px; }
|
|
65
|
+
body.look-modern.zoom-130 .home-info.hero .home-info-logo { max-height: 96px; }
|
|
66
|
+
body.look-modern.zoom-130 .home-info.hero .home-info-desc { max-height: 72px; }
|
|
67
|
+
body.look-modern.zoom-140 .home-info.hero { top: 94px; height: 248px; }
|
|
68
|
+
body.look-modern.zoom-140 .home-info.hero + .rows { top: 356px; }
|
|
69
|
+
body.look-modern.zoom-140 .home-info.hero .home-info-logo { max-height: 80px; }
|
|
70
|
+
body.look-modern.zoom-140 .home-info.hero .home-info-title { font-size: 48px; }
|
|
71
|
+
body.look-modern.zoom-140 .home-info.hero .home-info-meta { margin: 12px 0 8px 0; }
|
|
72
|
+
body.look-modern.zoom-140 .home-info.hero .home-info-desc { max-height: 72px; }
|
|
73
|
+
body.look-modern .rows { z-index: 2; }
|
|
74
|
+
|
|
75
|
+
/* the details strip elsewhere (the live tabs, Local, Discover): as in Classic, in its place,
|
|
76
|
+
with the Modern colors */
|
|
77
|
+
body.look-modern .home-info:not(.hero) { left: 72px; right: 72px; border-left: 0; border-radius: 16px; }
|
|
78
|
+
body.look-modern .home-info.on:not(.hero) { background: rgba(255,255,255,0.07); }
|
|
79
|
+
body.look-modern .home-info:not(.hero) .home-info-meta { color: rgba(255,255,255,0.78); }
|
|
80
|
+
body.look-modern .home-info:not(.hero) .home-info-desc { color: rgba(255,255,255,0.8); }
|
|
81
|
+
|
|
82
|
+
/* --- Rows and posters: rounder, no frame, focus a white ring --- */
|
|
83
|
+
body.look-modern .row-title { font-size: 28px; color: #ffffff; }
|
|
84
|
+
body.look-modern #screen-home .row-title { margin: 0 0 4px 90px; } /* (Home: in line with the title above; Search, Discover: their own margins) */
|
|
85
|
+
body.look-modern #screen-home .row-scroller { padding: 26px 90px; }
|
|
86
|
+
body.look-modern .card { border: 0; border-radius: 16px; background: rgba(255,255,255,0.07); margin-right: 26px; }
|
|
87
|
+
body.look-modern .card .cap { padding: 20px 12px 8px 12px; font-size: 18px; line-height: 22px; max-height: 72px; background: linear-gradient(rgba(0,0,0,0), rgba(0,0,0,0.9)); } /* (two lines fit, a landscape poster's too) */
|
|
88
|
+
body.look-modern .card.focusable.focused { border: 0; box-shadow: 0 0 0 4px #fff; -webkit-transform: scale(1.06); transform: scale(1.06); }
|
|
89
|
+
body.look-modern .card.focusable.moving { border: 0; box-shadow: 0 0 0 4px #f59e0b; }
|
|
90
|
+
body.look-modern.fx-full .card { -webkit-transition: -webkit-transform 0.16s ease-out, box-shadow 0.16s ease-out; transition: transform 0.16s ease-out, box-shadow 0.16s ease-out; }
|
|
91
|
+
body.look-modern.fx-full .card.focusable.focused { box-shadow: 0 0 0 4px #fff, 0 18px 44px rgba(0,0,0,0.7); }
|
|
92
|
+
body.look-modern .card .prog { height: 6px; border-radius: 0 3px 3px 0; }
|
|
93
|
+
body.look-modern #screen-home .row-empty { margin-left: 90px; }
|
|
94
|
+
|
|
95
|
+
/* --- A light background (Light Gray, White: body.bg-light): the see-through white fills
|
|
96
|
+
see-through dark instead; the rest follows the background through U.applyTheme --- */
|
|
97
|
+
body.look-modern.bg-light .tab-pill.active, body.look-modern.bg-light .home-header .hchip.active { background: rgba(0,0,0,0.1); }
|
|
98
|
+
body.look-modern.bg-light .btn-row .pill, body.look-modern.bg-light .season-bar .pill { background: rgba(0,0,0,0.08); }
|
|
99
|
+
body.look-modern.bg-light .btn-row .pill:first-child { background: rgba(0,0,0,0.82); color: #f5f5f5; } /* (not #ffffff: that one turns dark on a light background) */
|
|
100
|
+
body.look-modern.bg-light .btn-row .pill.focusable.focused, body.look-modern.bg-light .tab-pill.focusable.focused, body.look-modern.bg-light .header .hchip.focusable.focused,
|
|
101
|
+
body.look-modern.bg-light .season-bar .pill.focusable.focused, body.look-modern.bg-light .stream.focusable.focused, body.look-modern.bg-light .ep.focusable.focused { background: #111111; color: #f5f5f5; border-color: #111111; }
|
|
102
|
+
body.look-modern.bg-light .card { background: rgba(0,0,0,0.06); }
|
|
103
|
+
body.look-modern.bg-light .card.focusable.focused { box-shadow: 0 0 0 4px #111111; }
|
|
104
|
+
body.look-modern.bg-light .home-info.on:not(.hero) { background: rgba(0,0,0,0.05); }
|
|
105
|
+
|
|
106
|
+
/* --- A title's page: its backdrop over the whole screen, a large logo, round buttons --- */
|
|
107
|
+
body.look-modern #screen-detail { background: #0e1117; }
|
|
108
|
+
body.look-modern .detail-hero, body.look-modern .detail-hero.hero-full { height: 100%; }
|
|
109
|
+
body.look-modern .detail-hero .shade, body.look-modern .detail-hero.hero-full .shade {
|
|
110
|
+
background: linear-gradient(90deg, #0e1117 6%, rgba(14,17,23,0.84) 30%, rgba(14,17,23,0.3) 60%, rgba(14,17,23,0) 82%),
|
|
111
|
+
linear-gradient(0deg, #0e1117 0%, rgba(14,17,23,0.6) 26%, rgba(14,17,23,0) 56%),
|
|
112
|
+
linear-gradient(180deg, rgba(14,17,23,0.5) 0%, rgba(14,17,23,0) 16%); }
|
|
113
|
+
body.look-modern .detail-body { left: 90px; right: 90px; top: 150px; }
|
|
114
|
+
body.look-modern .detail-title { font-size: 62px; letter-spacing: -1px; }
|
|
115
|
+
body.look-modern .detail-title.has-logo { height: 130px; }
|
|
116
|
+
body.look-modern .detail-logo { max-height: 130px; max-width: 640px; }
|
|
117
|
+
body.look-modern .series-body .detail-title.has-logo { height: 84px; }
|
|
118
|
+
body.look-modern .series-body .detail-logo { max-height: 84px; }
|
|
119
|
+
body.look-modern.zoom-120 .detail-title.has-logo, body.look-modern.zoom-130 .detail-title.has-logo, body.look-modern.zoom-140 .detail-title.has-logo { height: 84px; }
|
|
120
|
+
body.look-modern.zoom-120 .detail-logo, body.look-modern.zoom-130 .detail-logo, body.look-modern.zoom-140 .detail-logo { max-height: 84px; }
|
|
121
|
+
body.look-modern.zoom-130 .series-body .detail-title.has-logo, body.look-modern.zoom-140 .series-body .detail-title.has-logo { height: 64px; }
|
|
122
|
+
body.look-modern.zoom-130 .series-body .detail-logo, body.look-modern.zoom-140 .series-body .detail-logo { max-height: 64px; }
|
|
123
|
+
body.look-modern .detail-meta { color: rgba(255,255,255,0.86); font-size: 23px; }
|
|
124
|
+
body.look-modern .detail-desc { color: rgba(255,255,255,0.82); font-size: 23px; line-height: 32px; max-width: 980px; } /* (whole lines in its capped height) */
|
|
125
|
+
/* A series: its text block right under the menu, as in Classic (the episode panel starts where
|
|
126
|
+
it ends, view-detail.js fitPanel, and no lower than 512px); under a high zoom a shorter
|
|
127
|
+
synopsis, so two episodes show below it */
|
|
128
|
+
body.look-modern .series-body { top: 112px; }
|
|
129
|
+
body.look-modern.zoom-130 .series-body { max-height: 340px; }
|
|
130
|
+
body.look-modern.zoom-130 .series-body .detail-desc { max-height: 96px; }
|
|
131
|
+
body.look-modern.zoom-140 .series-body { max-height: 292px; }
|
|
132
|
+
body.look-modern.zoom-140 .series-body .detail-desc { max-height: 64px; }
|
|
133
|
+
body.look-modern.zoom-140 .series-body .detail-ratings { margin-bottom: 8px; }
|
|
134
|
+
body.look-modern.zoom-140 .series-body .detail-meta { margin-bottom: 8px; }
|
|
135
|
+
body.look-modern.zoom-120 .series-body .detail-title.has-logo { height: 64px; }
|
|
136
|
+
body.look-modern.zoom-120 .series-body .detail-logo { max-height: 64px; }
|
|
137
|
+
body.look-modern.zoom-140 .series-body .detail-title.has-logo { height: 56px; }
|
|
138
|
+
body.look-modern.zoom-140 .series-body .detail-logo { max-height: 56px; }
|
|
139
|
+
body.look-modern .btn-row .pill { background: rgba(255,255,255,0.16); color: #ffffff; border: 3px solid transparent; border-radius: 40px; padding: 14px 32px; font-size: 23px; }
|
|
140
|
+
body.look-modern .btn-row .pill:first-child { background: rgba(255,255,255,0.9); color: #000; }
|
|
141
|
+
body.look-modern .btn-row .pill.focusable.focused { background: #fff; color: #000; border-color: #ffffff; box-shadow: 0 0 0 4px rgba(255,255,255,0.35); }
|
|
142
|
+
body.look-modern.fx-full .btn-row .pill { -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); }
|
|
143
|
+
body.look-modern .season-bar .pill { background: rgba(255,255,255,0.12); color: #ffffff; border-radius: 30px; }
|
|
144
|
+
body.look-modern .season-bar .pill.focusable.focused { background: #fff; color: #000; }
|
|
145
|
+
body.look-modern .stream.focusable.focused, body.look-modern .ep.focusable.focused { background: #fff; color: #000; border-color: #ffffff; box-shadow: none; }
|
|
146
|
+
body.look-modern .stream, body.look-modern .ep { border-radius: 14px; background: rgba(22,27,38,0.72); }
|
package/css/style.css
CHANGED
|
@@ -476,9 +476,13 @@ html, body {
|
|
|
476
476
|
.format-row.focusable.focused .a-name { color: inherit; }
|
|
477
477
|
|
|
478
478
|
/* --- Discover --- */
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
.discover-
|
|
479
|
+
/* one line that fits under any zoom: the search field gives way first (down to 130px), then the
|
|
480
|
+
catalog's name and the count (cut short …); the other pickers and Clear keep their size */
|
|
481
|
+
.discover-bar { position: absolute; top: 112px; left: 60px; right: 60px; white-space: nowrap; display: -webkit-flex; display: flex; -webkit-align-items: center; align-items: center; }
|
|
482
|
+
.discover-bar .pill { margin-right: 12px; -webkit-flex: none; flex: none; }
|
|
483
|
+
.discover-bar .pill.discover-cat { -webkit-flex: 0 1 auto; flex: 0 1 auto; min-width: 180px; overflow: hidden; text-overflow: ellipsis; }
|
|
484
|
+
.discover-count { -webkit-flex: 0 2 auto; flex: 0 2 auto; min-width: 150px; overflow: hidden; text-overflow: ellipsis; }
|
|
485
|
+
.discover-search { -webkit-flex: 0 1 300px; flex: 0 4 300px; min-width: 130px; width: 300px; margin-right: 12px; padding: 12px 22px; font-size: 22px; vertical-align: middle; background: #1a1f2b; color: #e6e9ef; border: 4px solid transparent; border-radius: 30px; }
|
|
482
486
|
.discover-search.focused { border-color: #818cf8; }
|
|
483
487
|
.discover-count { display: inline-block; margin-left: 14px; font-size: 20px; color: #8b93a5; vertical-align: middle; }
|
|
484
488
|
#screen-discover .home-info { top: 196px; height: 124px; }
|
package/index.html
CHANGED
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
<meta charset="utf-8">
|
|
5
5
|
<meta name="viewport" content="width=1920, height=1080, user-scalable=no">
|
|
6
6
|
<title>StremioK</title>
|
|
7
|
-
<link rel="stylesheet" href="css/style.css?v=2.2.
|
|
7
|
+
<link rel="stylesheet" href="css/style.css?v=2.2.9">
|
|
8
|
+
<link rel="stylesheet" href="css/modern.css?v=2.2.9">
|
|
8
9
|
</head>
|
|
9
10
|
<body>
|
|
10
11
|
<!-- CSS-applied sentinel (kept off-screen); app.js waits for its width before rendering -->
|
|
@@ -53,39 +54,39 @@
|
|
|
53
54
|
|
|
54
55
|
<!-- Load order matters: polyfills -> util -> iptv -> data -> input -> tvapps -> player parts -> player -> ytplay -> view parts -> views -> app -->
|
|
55
56
|
<!-- ?v= busts the TV webview cache on every release (keep in sync with package.json) -->
|
|
56
|
-
<script src="js/polyfills.js?v=2.2.
|
|
57
|
-
<script src="js/util.js?v=2.2.
|
|
58
|
-
<script src="js/iptv.js?v=2.2.
|
|
59
|
-
<script src="js/xtvod.js?v=2.2.
|
|
60
|
-
<script src="js/stvod.js?v=2.2.
|
|
61
|
-
<script src="js/epg.js?v=2.2.
|
|
62
|
-
<script src="js/youtube.js?v=2.2.
|
|
63
|
-
<script src="js/stremio.js?v=2.2.
|
|
64
|
-
<script src="js/trakt.js?v=2.2.
|
|
65
|
-
<script src="js/keys.js?v=2.2.
|
|
66
|
-
<script src="js/focus.js?v=2.2.
|
|
67
|
-
<script src="js/tvapps.js?v=2.2.
|
|
68
|
-
<script src="js/player-core.js?v=2.2.
|
|
69
|
-
<script src="js/player-store.js?v=2.2.
|
|
70
|
-
<script src="js/player-lang.js?v=2.2.
|
|
71
|
-
<script src="js/player-quality.js?v=2.2.
|
|
72
|
-
<script src="js/player-subs.js?v=2.2.
|
|
73
|
-
<script src="js/player-audio.js?v=2.2.
|
|
74
|
-
<script src="js/player-controls.js?v=2.2.
|
|
75
|
-
<script src="js/player.js?v=2.2.
|
|
76
|
-
<script src="js/ytplay.js?v=2.2.
|
|
77
|
-
<script src="js/local.js?v=2.2.
|
|
78
|
-
<script src="js/downloads.js?v=2.2.
|
|
79
|
-
<script src="js/stremio-account.js?v=2.2.
|
|
80
|
-
<script src="js/view-core.js?v=2.2.
|
|
81
|
-
<script src="js/view-home.js?v=2.2.
|
|
82
|
-
<script src="js/view-guide.js?v=2.2.
|
|
83
|
-
<script src="js/view-detail.js?v=2.2.
|
|
84
|
-
<script src="js/view-search.js?v=2.2.
|
|
85
|
-
<script src="js/view-settings.js?v=2.2.
|
|
86
|
-
<script src="js/view-discover.js?v=2.2.
|
|
87
|
-
<script src="js/views.js?v=2.2.
|
|
88
|
-
<script src="js/app.js?v=2.2.
|
|
89
|
-
<script src="js/hubpreview.js?v=2.2.
|
|
57
|
+
<script src="js/polyfills.js?v=2.2.9"></script>
|
|
58
|
+
<script src="js/util.js?v=2.2.9"></script>
|
|
59
|
+
<script src="js/iptv.js?v=2.2.9"></script>
|
|
60
|
+
<script src="js/xtvod.js?v=2.2.9"></script>
|
|
61
|
+
<script src="js/stvod.js?v=2.2.9"></script>
|
|
62
|
+
<script src="js/epg.js?v=2.2.9"></script>
|
|
63
|
+
<script src="js/youtube.js?v=2.2.9"></script>
|
|
64
|
+
<script src="js/stremio.js?v=2.2.9"></script>
|
|
65
|
+
<script src="js/trakt.js?v=2.2.9"></script>
|
|
66
|
+
<script src="js/keys.js?v=2.2.9"></script>
|
|
67
|
+
<script src="js/focus.js?v=2.2.9"></script>
|
|
68
|
+
<script src="js/tvapps.js?v=2.2.9"></script>
|
|
69
|
+
<script src="js/player-core.js?v=2.2.9"></script>
|
|
70
|
+
<script src="js/player-store.js?v=2.2.9"></script>
|
|
71
|
+
<script src="js/player-lang.js?v=2.2.9"></script>
|
|
72
|
+
<script src="js/player-quality.js?v=2.2.9"></script>
|
|
73
|
+
<script src="js/player-subs.js?v=2.2.9"></script>
|
|
74
|
+
<script src="js/player-audio.js?v=2.2.9"></script>
|
|
75
|
+
<script src="js/player-controls.js?v=2.2.9"></script>
|
|
76
|
+
<script src="js/player.js?v=2.2.9"></script>
|
|
77
|
+
<script src="js/ytplay.js?v=2.2.9"></script>
|
|
78
|
+
<script src="js/local.js?v=2.2.9"></script>
|
|
79
|
+
<script src="js/downloads.js?v=2.2.9"></script>
|
|
80
|
+
<script src="js/stremio-account.js?v=2.2.9"></script>
|
|
81
|
+
<script src="js/view-core.js?v=2.2.9"></script>
|
|
82
|
+
<script src="js/view-home.js?v=2.2.9"></script>
|
|
83
|
+
<script src="js/view-guide.js?v=2.2.9"></script>
|
|
84
|
+
<script src="js/view-detail.js?v=2.2.9"></script>
|
|
85
|
+
<script src="js/view-search.js?v=2.2.9"></script>
|
|
86
|
+
<script src="js/view-settings.js?v=2.2.9"></script>
|
|
87
|
+
<script src="js/view-discover.js?v=2.2.9"></script>
|
|
88
|
+
<script src="js/views.js?v=2.2.9"></script>
|
|
89
|
+
<script src="js/app.js?v=2.2.9"></script>
|
|
90
|
+
<script src="js/hubpreview.js?v=2.2.9"></script>
|
|
90
91
|
</body>
|
|
91
92
|
</html>
|
package/js/focus.js
CHANGED
|
@@ -55,8 +55,11 @@ var Focus = (function () {
|
|
|
55
55
|
else if (nr.right > pr.right - mx) { p.scrollLeft += (nr.right - (pr.right - mx)) / z; }
|
|
56
56
|
}
|
|
57
57
|
if (canY) {
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
// going up into a row of posters: its title in view too (a margin in
|
|
59
|
+
// screen pixels is less of the page under a zoom: at 140% it cut the title)
|
|
60
|
+
var my = 70, top = nr.top, mt = my, row = rowAbove(node, p);
|
|
61
|
+
if (row) { var rr = row.getBoundingClientRect(); if (rr.top <= nr.top && rr.bottom >= nr.bottom && nr.top - rr.top < 160 * z) { top = rr.top; mt = 6 * z; } } // (its first line only; a rect that doesn't hold the node: not used)
|
|
62
|
+
if (top < pr.top + mt) { p.scrollTop -= (pr.top + mt - top) / z; }
|
|
60
63
|
else if (nr.bottom > pr.bottom - my) { p.scrollTop += (nr.bottom - (pr.bottom - my)) / z; }
|
|
61
64
|
}
|
|
62
65
|
}
|
|
@@ -64,6 +67,14 @@ var Focus = (function () {
|
|
|
64
67
|
}
|
|
65
68
|
}
|
|
66
69
|
|
|
70
|
+
// The row of posters (.row: its title above them) the node is in, inside the box p.
|
|
71
|
+
function rowAbove(node, p) {
|
|
72
|
+
for (var n = node.parentNode; n && n !== p; n = n.parentNode) {
|
|
73
|
+
if (n.classList && n.classList.contains('row')) { return n; }
|
|
74
|
+
}
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
|
|
67
78
|
function move(dir) {
|
|
68
79
|
if (!_scope) { return; }
|
|
69
80
|
var r = _current ? _current.getBoundingClientRect() : null;
|
package/js/player-core.js
CHANGED
|
@@ -396,7 +396,7 @@ var PlayerParts = {};
|
|
|
396
396
|
// is what's learned from it (s.stream, through ctx.learnFor); the title, its episodes and
|
|
397
397
|
// whether it's private stay.
|
|
398
398
|
var SOURCE_FIELDS = ['url', 'variantUrl', 'initialQualityHeight', 'yt', 'ytLang', '_headers', 'localSubs', 'localFile', 'subExtra', 'sourceSubs', 'formatInfo', 'onStarted', 'onFailed', 'stream',
|
|
399
|
-
'_reported', 'fromStart', 'resumeSec', 'switching'];
|
|
399
|
+
'_reported', 'fromStart', 'resumeSec', 'switching', 'viaService', '_relay', '_relayFor', '_relayCc'];
|
|
400
400
|
// keep: a source that didn't start gives way to the next (nextSourceOnFail): the same place to
|
|
401
401
|
// resume, and Play from the start as it was.
|
|
402
402
|
function replaceSource(s, keep) {
|
|
@@ -881,6 +881,28 @@ var PlayerParts = {};
|
|
|
881
881
|
else { shakaStop(); try { S.videoEl.pause(); S.videoEl.removeAttribute('src'); } catch (e2) {} S.videoEl.className = ''; }
|
|
882
882
|
useAV = av; P.useAV = av;
|
|
883
883
|
}
|
|
884
|
+
// A key server, and a DASH manifest naming only other systems (Widevine, PlayReady): Shaka asks
|
|
885
|
+
// a key server only for a system the manifest names (else its error 6012), so ClearKey is
|
|
886
|
+
// named after each group of them, its key ids the manifest's own (their default_KID). One
|
|
887
|
+
// naming it already (or its common key-id system), an HLS playlist: as they are.
|
|
888
|
+
var CK_URI = 'urn:uuid:e2719d58-a985-b3c9-781a-b030af78d30e';
|
|
889
|
+
var CP_RUN = /(?:<((?:[\w.-]+:)?)ContentProtection\b[^>]*?(?:\/>|>[\s\S]*?<\/(?:[\w.-]+:)?ContentProtection>)\s*)+/g;
|
|
890
|
+
var CK_NAMED = /e2719d58-a985-b3c9-781a-b030af78d30e|1077efec-c0b2-4d02-ace3-3c1e52e2fb4b/i;
|
|
891
|
+
function ckNamed(text) {
|
|
892
|
+
if (!/<(?:[\w.-]+:)?MPD\b/.test(text) || CK_NAMED.test(text)) { return text; }
|
|
893
|
+
return text.replace(CP_RUN, function (run, pre) { return run + '<' + pre + 'ContentProtection schemeIdUri="' + CK_URI + '" value="ClearKey1.0"/>'; });
|
|
894
|
+
}
|
|
895
|
+
function ckManifests(pl) {
|
|
896
|
+
var said = false, SU = shaka.util && shaka.util.StringUtils;
|
|
897
|
+
if (!SU) { return; }
|
|
898
|
+
pl.getNetworkingEngine().registerResponseFilter(function (type, resp) {
|
|
899
|
+
if (type !== shaka.net.NetworkingEngine.RequestType.MANIFEST || !resp || !resp.data) { return; }
|
|
900
|
+
var text = SU.fromUTF8(resp.data), out = ckNamed(text);
|
|
901
|
+
if (out === text) { return; }
|
|
902
|
+
resp.data = SU.toUTF8(out);
|
|
903
|
+
if (!said) { said = true; U.log('player', 'ClearKey named in the manifest beside its other DRM, for the playlist’s key server'); }
|
|
904
|
+
});
|
|
905
|
+
}
|
|
884
906
|
function shakaLoadInto(url, drm, token, fail) {
|
|
885
907
|
loadShaka().then(function () {
|
|
886
908
|
if (!S.active || token !== _playToken) { return; }
|
|
@@ -890,6 +912,7 @@ var PlayerParts = {};
|
|
|
890
912
|
var pl = _shakaPl = new shaka.Player(), cfg = { streaming: { bufferingGoal: 10 } };
|
|
891
913
|
cfg.drm = drm.keys ? { clearKeys: drm.keys } : { servers: { 'org.w3.clearkey': drm.url } };
|
|
892
914
|
pl.configure(cfg);
|
|
915
|
+
if (!drm.keys) { ckManifests(pl); }
|
|
893
916
|
var h = drm.h || {};
|
|
894
917
|
if (!drm.keys && Object.keys(h).length) { // (the key server's own headers: those a page may send)
|
|
895
918
|
pl.getNetworkingEngine().registerRequestFilter(function (type, req) {
|
|
@@ -1345,7 +1368,32 @@ var PlayerParts = {};
|
|
|
1345
1368
|
ctx._relay = r.url; ctx._relayFor = ctx.url; ctx._relayCc = cc || null; ctx._ccOffer = cc ? null : ctx._ccOffer;
|
|
1346
1369
|
return true;
|
|
1347
1370
|
}
|
|
1371
|
+
// HLS through StremioK's service (Settings › Playback › Seeking & buffering: 'off' | 'headers':
|
|
1372
|
+
// sources with their own User-Agent, Referer or Cookie | 'all'; or ctx.viaService, hold OK on a
|
|
1373
|
+
// source): the relay without the look, so every playlist and piece is fetched with the source's
|
|
1374
|
+
// headers (the TV's player can't always send them). A film's relay keeps every link (film=1).
|
|
1375
|
+
// Not YouTube, DRM, USB files or the service's own links; the service not answering: as it is.
|
|
1376
|
+
var HLS_LINK = /\.m3u8?(?:[?#]|$)/i;
|
|
1377
|
+
function viaService(ctx) {
|
|
1378
|
+
if (!useAV || !ctx || ctx.yt || ctx.trailer || ctx.localFile || (ctx.stream && ctx.stream._drm)) { return false; }
|
|
1379
|
+
if (typeof YTPlay === 'undefined' || !YTPlay.liveOpen || YTPlay.installMode() === 'browser') { return false; }
|
|
1380
|
+
var url = ctx.url || '';
|
|
1381
|
+
if (!/^https?:\/\//i.test(url) || /^http:\/\/(localhost|127\.0\.0\.1)[:\/]/i.test(url)) { return false; }
|
|
1382
|
+
if (!HLS_LINK.test(url) && !(ctx.formatInfo && ctx.formatInfo.container === 'hls')) { return false; }
|
|
1383
|
+
if (ctx.viaService) { return true; }
|
|
1384
|
+
var mode = P.playerCfg().hls;
|
|
1385
|
+
return mode === 'all' || (mode === 'headers' && !!U.sanitizeHeaders(ctx._headers));
|
|
1386
|
+
}
|
|
1387
|
+
function startViaService(ctx, settle) {
|
|
1388
|
+
var live = !!S.isLive, known = live && liveFixable(ctx) ? liveKnown(ctx.url) : null;
|
|
1389
|
+
YTPlay.liveOpen(ctx.url, ctx._headers, true, { fix: !!(known && known.fix), film: !live }).then(function (r) {
|
|
1390
|
+
if (S.ctx !== ctx || !S.active) { return; }
|
|
1391
|
+
relayed(ctx, r, null);
|
|
1392
|
+
startAV(ctx.url, settle);
|
|
1393
|
+
}, function () { if (S.ctx === ctx && S.active) { startAV(ctx.url, settle); } });
|
|
1394
|
+
}
|
|
1348
1395
|
function startLive(ctx, settle) {
|
|
1396
|
+
if (!ctx._relay && viaService(ctx)) { startViaService(ctx, settle); return; }
|
|
1349
1397
|
var known = liveFixable(ctx) ? liveKnown(ctx.url) : null, cc = ccOf(known);
|
|
1350
1398
|
if (cc && cc.length) { ctx._ccOffer = cc; }
|
|
1351
1399
|
var withCc = ccWanted(ctx, cc) ? cc : null;
|
|
@@ -1404,7 +1452,7 @@ var PlayerParts = {};
|
|
|
1404
1452
|
// The relay didn't start (StremioK's service gone): the channel as it is.
|
|
1405
1453
|
function relayFailed() {
|
|
1406
1454
|
if (S.playStarted || !S.ctx || !S.ctx._relay) { return false; }
|
|
1407
|
-
U.log('player', '
|
|
1455
|
+
U.log('player', 'StremioK’s service relay didn’t start: playing the stream as it is');
|
|
1408
1456
|
S.ctx._relay = null;
|
|
1409
1457
|
startAV(S.ctx.url);
|
|
1410
1458
|
return true;
|
package/js/player-store.js
CHANGED
|
@@ -248,7 +248,8 @@
|
|
|
248
248
|
return { aspect: d.aspect || 'fit', seek: SEEK_STEPS.indexOf(+d.seek) !== -1 ? +d.seek : 10,
|
|
249
249
|
buffer: d.buffer === 'more' || d.buffer === 'most' ? d.buffer : 'normal',
|
|
250
250
|
reconnect: d.reconnect === 'off' || d.reconnect === 'always' ? d.reconnect : 'few',
|
|
251
|
-
phone: d.phone === 'infuse' || d.phone === 'link' ? d.phone : 'vlc'
|
|
251
|
+
phone: d.phone === 'infuse' || d.phone === 'link' ? d.phone : 'vlc', // (Continue on phone: what the QR opens)
|
|
252
|
+
hls: d.hls === 'headers' || d.hls === 'all' ? d.hls : 'off' }; // (HLS through StremioK's service: see player-core's viaService)
|
|
252
253
|
}
|
|
253
254
|
function setPlayerCfg(cfg) { // (what's given changes; the rest stays)
|
|
254
255
|
var d = U.store.get(PLAYERCFG_KEY, {}) || {};
|
package/js/stremio.js
CHANGED
|
@@ -162,6 +162,8 @@ var Stremio = (function () {
|
|
|
162
162
|
function getPrefs() {
|
|
163
163
|
var p = U.store.get(PREFS_KEY, {}) || {};
|
|
164
164
|
return { posterShape: p.posterShape || 'portrait', accent: p.accent || 'indigo', bg: p.bg || 'dark',
|
|
165
|
+
look: p.look === 'modern' ? 'modern' : 'classic', // Settings > Appearance: Classic, or Modern (a backdrop behind Home, the title's logo, rounder posters)
|
|
166
|
+
effects: p.effects === 'light' || p.effects === 'full' ? p.effects : 'auto', // ...Modern's blur and motion: by the TV (auto), off (light) or on (full)
|
|
165
167
|
zoom: [110, 120, 130, 140].indexOf(p.zoom) !== -1 ? p.zoom : 100, // Settings > Appearance: everything bigger (percent)
|
|
166
168
|
rowCards: p.rowCards === 'all' || [50, 100, 200].indexOf(p.rowCards) !== -1 ? p.rowCards : 30, // Settings > Home: titles in a Home row ('all': Unlimited)
|
|
167
169
|
formatsAuto: p.formatsAuto !== false, // Settings > Formats: mark "Not working" on its own
|
|
@@ -553,7 +555,7 @@ var Stremio = (function () {
|
|
|
553
555
|
var EXPORT_LINE = '#!stremiok ';
|
|
554
556
|
var EXPORT_STORE = ['stremiok.prefs', 'stremiok.feeds', 'stremiok.searchfeeds', 'stremiok.sourcefeeds', 'stremiok.ranking', 'stremiok.server', 'stremiok.formats',
|
|
555
557
|
'stremiok.resblock', 'stremiok.subcfg', 'stremiok.audiocfg', 'stremiok.playercfg', 'stremiok.private', 'stremiok.youtube', 'stremiok.appshortcuts',
|
|
556
|
-
'stremiok.appsallowed', 'stremiok.aiomanager', 'stremiok.iptv.stalkerall', 'stremiok.iptv.every', 'stremiok.local.matching', 'stremiok.local.hidden',
|
|
558
|
+
'stremiok.appsallowed', 'stremiok.aiomanager', 'stremiok.iptv.stalkerall', 'stremiok.iptv.stalkerkeep', 'stremiok.iptv.every', 'stremiok.local.matching', 'stremiok.local.hidden',
|
|
557
559
|
'stremiok.addonsoff', 'stremiok.integrations'];
|
|
558
560
|
function plural(n, one) { return n + ' ' + one + (n === 1 ? '' : 's'); }
|
|
559
561
|
function iptvLists() { return (_hasIptv && IPTV.getPlaylists) ? IPTV.getPlaylists() : []; }
|
package/js/stvod.js
CHANGED
|
@@ -27,10 +27,15 @@ var StVod = (function () {
|
|
|
27
27
|
for (var i = 0; i < l.length; i++) { if (l[i].id === id) { return l[i]; } }
|
|
28
28
|
return null;
|
|
29
29
|
}
|
|
30
|
+
// How long the service keeps what it read of a portal (Settings › Content › IPTV › Stalker films
|
|
31
|
+
// and series): 10 minutes, 5, or 0 (not kept).
|
|
32
|
+
var KEEP_KEY = 'stremiok.iptv.stalkerkeep', KEEPS = [10, 5, 0];
|
|
33
|
+
function keepMinutes() { var m = U.store.get(KEEP_KEY, 10); return KEEPS.indexOf(m) !== -1 ? m : 10; }
|
|
34
|
+
function setKeepMinutes(m) { U.store.set(KEEP_KEY, KEEPS.indexOf(+m) !== -1 ? +m : 10); }
|
|
30
35
|
// The service's answer ({ why }: an error).
|
|
31
36
|
function ask(acc, more) {
|
|
32
37
|
if (typeof YTPlay === 'undefined' || !YTPlay.stalkerVod) { return Promise.reject(new Error('Stalker portals are read by StremioK’s service (not in a desktop browser)')); }
|
|
33
|
-
return YTPlay.stalkerVod(acc.url, acc.mac, more).then(function (r) {
|
|
38
|
+
return YTPlay.stalkerVod(acc.url, acc.mac, more + '&keep=' + keepMinutes()).then(function (r) {
|
|
34
39
|
if (!r || r.why) { throw new Error((r && r.why) || 'no answer'); }
|
|
35
40
|
return r;
|
|
36
41
|
});
|
|
@@ -285,5 +290,5 @@ var StVod = (function () {
|
|
|
285
290
|
})).then(function (all) { return [].concat.apply([], all).filter(Boolean); });
|
|
286
291
|
}
|
|
287
292
|
|
|
288
|
-
return { accounts: accounts, isEnabled: isEnabled, onChange: onChange, reload: reload, synthAddon: synthAddon, catalog: catalog, meta: meta, streams: streams, refreshCats: refreshCats };
|
|
293
|
+
return { accounts: accounts, keepMinutes: keepMinutes, setKeepMinutes: setKeepMinutes, isEnabled: isEnabled, onChange: onChange, reload: reload, synthAddon: synthAddon, catalog: catalog, meta: meta, streams: streams, refreshCats: refreshCats };
|
|
289
294
|
})();
|
package/js/util.js
CHANGED
|
@@ -1115,8 +1115,9 @@ var U = (function () {
|
|
|
1115
1115
|
function showOn(item) { // the image is in the browser now: put it on this node
|
|
1116
1116
|
if (item.bg) { item.img.style.backgroundImage = cssUrl(item.src); } else { item.img.src = item.src; }
|
|
1117
1117
|
}
|
|
1118
|
-
function failOn(item) { // it can't load: this node's own fallback
|
|
1119
|
-
|
|
1118
|
+
function failOn(item) { // it can't load: this node's own fallback (a background's: its __bgFail)
|
|
1119
|
+
var f = item.bg ? item.img.__bgFail : item.img.onerror;
|
|
1120
|
+
if (typeof f === 'function') { try { f.call(item.img); } catch (e) {} }
|
|
1120
1121
|
}
|
|
1121
1122
|
// A download that neither loads nor fails (a stalled host) gives up after this, so a
|
|
1122
1123
|
// few of them can't hold every slot and stop all later artwork.
|
|
@@ -1243,7 +1244,7 @@ var U = (function () {
|
|
|
1243
1244
|
function done(ok) {
|
|
1244
1245
|
if (finished) { return; }
|
|
1245
1246
|
stop();
|
|
1246
|
-
if (ok) { markLoaded(it.src); if (it.bg) { showOn(it); } } else { _failedAt.set(it.src, Date.now()); }
|
|
1247
|
+
if (ok) { markLoaded(it.src); if (it.bg) { showOn(it); } } else { _failedAt.set(it.src, Date.now()); if (it.bg) { failOn(it); } }
|
|
1247
1248
|
var waiting = _inflight[it.src] || [];
|
|
1248
1249
|
delete _inflight[it.src];
|
|
1249
1250
|
waiting.forEach(function (w) { if (ok) { showOn(w); } else { failOn(w); } });
|
|
@@ -1307,6 +1308,16 @@ var U = (function () {
|
|
|
1307
1308
|
// role: 'poster' | 'landscape' | 'still' (episode thumbnail) | 'hero' (a title page's
|
|
1308
1309
|
// backdrop) | 'logo' | 'cast' (a cast card) | 'profile' (a person page's photo)
|
|
1309
1310
|
var TMDB_W = { poster: 342, landscape: 780, still: 300, hero: 1280, logo: 500, cast: 185, profile: 342 };
|
|
1311
|
+
// A backdrop behind a page (the Modern look's Home, a title's page): its pictures to try, the
|
|
1312
|
+
// best first. A YouTube video's thumbnail (hqdefault: 480x360, bars above and below) gives
|
|
1313
|
+
// way to its 1280x720 ones (maxresdefault, else hq720; an older video may have neither, so
|
|
1314
|
+
// the thumbnail last). Anything else: its 'hero' size.
|
|
1315
|
+
function heroImages(url) {
|
|
1316
|
+
var yt = typeof url === 'string' && url.match(/^(https:\/\/i\.ytimg\.com\/vi\/[\w-]{6,20}\/)(?:hq|mq|sd)?default\.jpg$/);
|
|
1317
|
+
if (yt) { return [yt[1] + 'maxresdefault.jpg', yt[1] + 'hq720.jpg', url]; }
|
|
1318
|
+
var one = cardImage(url, 'hero');
|
|
1319
|
+
return one ? [one] : [];
|
|
1320
|
+
}
|
|
1310
1321
|
function cardImage(url, role) {
|
|
1311
1322
|
if (!url || typeof url !== 'string') { return null; }
|
|
1312
1323
|
if (/^\/\//.test(url)) { url = 'https:' + url; } // (a scheme-relative link)
|
|
@@ -1410,7 +1421,7 @@ var U = (function () {
|
|
|
1410
1421
|
[[255, 210, 87], [138, 90, 0]] // gold ratings
|
|
1411
1422
|
];
|
|
1412
1423
|
// Drawn over video or pictures: keep their own (light-on-dark) look.
|
|
1413
|
-
var KEEP_DARK = /#osd|#player-|#subs|#sub-menu|#skip-prompt|#stream-info|#cast-strip|#yt-links|#yt-card|#toast|#hold-hint|#spinner|\.skip-btn|\.pb-btn|\.sm-|\.si-|\.card \.cap|\.card-new|\.card-watched|\.card-rating|\.grid-cell|\.r-|\.spin\b/;
|
|
1424
|
+
var KEEP_DARK = /#osd|#player-|#subs|#sub-menu|#skip-prompt|#stream-info|#cast-strip|#yt-links|#yt-card|#toast|#hold-hint|#spinner|\.skip-btn|\.pb-btn|\.sm-|\.si-|\.card \.cap|\.card-new|\.card-watched|\.card-rating|\.card-epg|\.grid-cell|\.r-|\.spin\b/;
|
|
1414
1425
|
var LIGHT_EXTRA = '.card .cap { color: #ffffff }\n' +
|
|
1415
1426
|
// title logos are made for dark backgrounds: a soft dark outline keeps them readable
|
|
1416
1427
|
'.detail-logo, .home-info-logo { -webkit-filter: drop-shadow(0 0 2px rgba(0,0,0,0.85)) drop-shadow(0 0 6px rgba(0,0,0,0.45)); ' +
|
|
@@ -1430,6 +1441,26 @@ var U = (function () {
|
|
|
1430
1441
|
s.height = on ? Math.ceil(1080 / _zoom) + 'px' : '';
|
|
1431
1442
|
s.webkitTransform = s.transform = on ? 'scale(' + _zoom + ')' : '';
|
|
1432
1443
|
s.webkitTransformOrigin = s.transformOrigin = on ? '0 0' : '';
|
|
1444
|
+
var cl = document.body.classList; // (zoom-110 … zoom-140: the Modern look's room for each, css/modern.css)
|
|
1445
|
+
if (cl) { [110, 120, 130, 140].forEach(function (z) { cl.remove('zoom-' + z); }); if (on) { cl.add('zoom-' + Math.round(_zoom * 100)); } }
|
|
1446
|
+
}
|
|
1447
|
+
|
|
1448
|
+
// Look (Settings › Appearance): 'modern' puts look-modern on the page (css/modern.css), and
|
|
1449
|
+
// fx-full for its blur and motion: 'auto' where the TV's browser can blur what's behind a
|
|
1450
|
+
// panel (Tizen 6, 2021 TVs, and later), so not on older ones, where they'd slow it down.
|
|
1451
|
+
function canBlur() {
|
|
1452
|
+
try { return !!(window.CSS && CSS.supports && (CSS.supports('backdrop-filter', 'blur(2px)') || CSS.supports('-webkit-backdrop-filter', 'blur(2px)'))); } catch (e) { return false; }
|
|
1453
|
+
}
|
|
1454
|
+
var _look = 'classic';
|
|
1455
|
+
function look() { return _look; }
|
|
1456
|
+
function setLook(lk, fx, light) { // (light: Light Gray or White, bg-light: css/modern.css's fills for them)
|
|
1457
|
+
_look = lk === 'modern' ? 'modern' : 'classic';
|
|
1458
|
+
var b = document.body;
|
|
1459
|
+
if (!b || !b.classList) { return; }
|
|
1460
|
+
var full = _look === 'modern' && (fx === 'full' || (fx !== 'light' && canBlur()));
|
|
1461
|
+
b.classList[_look === 'modern' ? 'add' : 'remove']('look-modern');
|
|
1462
|
+
b.classList[full ? 'add' : 'remove']('fx-full');
|
|
1463
|
+
b.classList[light ? 'add' : 'remove']('bg-light');
|
|
1433
1464
|
}
|
|
1434
1465
|
|
|
1435
1466
|
// bg: 'dark' (the stylesheet's own), 'black', 'gray' or 'white' (the last two with dark text)
|
|
@@ -1444,7 +1475,10 @@ var U = (function () {
|
|
|
1444
1475
|
if (light) {
|
|
1445
1476
|
pairs.push([THEME_BASE.bg, light.page, 'bg'], [[22, 27, 38], light.panel, 'bg'], [[26, 31, 43], light.card, 'bg'],
|
|
1446
1477
|
[[42, 51, 70], light.raised, 'bg'], [[38, 48, 74], light.raised, 'bg'], [[23, 32, 58], light.deep, 'bg'],
|
|
1447
|
-
[[58, 33, 48], [243, 214, 220], 'bg'], [[255, 255, 255], [17, 17, 17], 'color']
|
|
1478
|
+
[[58, 33, 48], [243, 214, 220], 'bg'], [[255, 255, 255], [17, 17, 17], 'color'],
|
|
1479
|
+
// the Guide: its channel column, the strip behind the programs (the lines
|
|
1480
|
+
// between them), the program on now
|
|
1481
|
+
[[18, 23, 34], light.deep, 'bg'], [[14, 18, 25], light.page, 'bg'], [[34, 43, 61], light.raised, 'bg']);
|
|
1448
1482
|
LIGHT_TEXT.forEach(function (t) { pairs.push([t[0], t[1], 'text']); });
|
|
1449
1483
|
}
|
|
1450
1484
|
var el = byId('theme-override');
|
|
@@ -1628,7 +1662,7 @@ var U = (function () {
|
|
|
1628
1662
|
postJSON: postJSON, redactUrl: redactUrl, problem: problem, problemDetail: problemDetail, listOf: listOf, lru: lru, cachedJSON: cachedJSON,
|
|
1629
1663
|
parseUrl: parseUrl, urlProblem: urlProblem, isPlaylistUrl: isPlaylistUrl, isManifestUrl: isManifestUrl,
|
|
1630
1664
|
isPrivateHost: isPrivateHost, urlIsPrivate: urlIsPrivate, setLocalPolicy: setLocalPolicy, sanitizeHeaders: sanitizeHeaders, drawable: drawable,
|
|
1631
|
-
log: log, logEntries: logEntries, clearLog: clearLog, bigStore: bigStore, diskInfo: diskInfo,
|
|
1665
|
+
look: look, setLook: setLook, canBlur: canBlur, heroImages: heroImages, log: log, logEntries: logEntries, clearLog: clearLog, bigStore: bigStore, diskInfo: diskInfo,
|
|
1632
1666
|
store: store, toast: toast, spinner: spinner,
|
|
1633
1667
|
deferImage: deferImage, deferBg: deferBg, cardImage: cardImage, prioritizeImages: prioritizeImages, requeueImages: requeueImages,
|
|
1634
1668
|
fmtTime: fmtTime, dayLabel: dayLabel, settleAll: settleAll, cancelToken: cancelToken, isHidden: isHidden, whenVisible: whenVisible, crumb: crumb, sessionStart: sessionStart, sessionState: sessionState, mark: mark, startupMarks: startupMarks, loadScript: loadScript, qrModules: qrModules, qrCanvas: qrCanvas, qrScale: qrScale,
|
package/js/view-core.js
CHANGED
|
@@ -656,7 +656,9 @@ var ViewParts = {};
|
|
|
656
656
|
}
|
|
657
657
|
function isLive() {
|
|
658
658
|
var t = titleType(meta.type || fallbackType);
|
|
659
|
-
|
|
659
|
+
// (an "anime" or "other" item: a title whatever its id; a debrid library's download, an
|
|
660
|
+
// addon's own "cnc:…" show: its page, so its episodes or files, not a channel's sources)
|
|
661
|
+
var isTitle = t === 'movie' || t === 'series' || TITLE_ID.test(meta.id || '') || /^(anime|other)$/i.test(t || '');
|
|
660
662
|
return !!fallbackType && fallbackType !== 'movie' && fallbackType !== 'series' && !isTitle && !/^(youtube|channel)$/i.test(fallbackType) && !/^(ytk|yt_id):/.test(meta.id || '');
|
|
661
663
|
}
|
|
662
664
|
c.__onselect = function () {
|
package/js/view-detail.js
CHANGED
|
@@ -257,7 +257,14 @@
|
|
|
257
257
|
var listed = _d.mode === 'streams' || (_d.mode === 'info' && _d.type === 'series'); // (a source list, an episode list)
|
|
258
258
|
var hero = U.el('div', 'detail-hero' + (listed ? ' hero-full' : '')); // (a list: over the whole backdrop)
|
|
259
259
|
var bg = meta.background || meta.poster;
|
|
260
|
-
|
|
260
|
+
// (sized for the page, first in the queue; one that doesn't load: the next of its
|
|
261
|
+
// pictures, a YouTube video's 1280x720 ones first: U.heroImages)
|
|
262
|
+
var heroes = bg ? U.heroImages(bg) : [];
|
|
263
|
+
(function heroTry(i) {
|
|
264
|
+
if (i >= heroes.length) { return; }
|
|
265
|
+
hero.__bgFail = function () { heroTry(i + 1); };
|
|
266
|
+
U.deferBg(hero, heroes[i], true);
|
|
267
|
+
})(0);
|
|
261
268
|
hero.appendChild(U.el('div', 'shade'));
|
|
262
269
|
s.appendChild(hero);
|
|
263
270
|
s.appendChild(buildTopMenu('detail')); // the main menu, above the title
|
|
@@ -1276,6 +1283,13 @@
|
|
|
1276
1283
|
var hide = spoilerFor(v); // (Hide spoilers: an episode not watched yet)
|
|
1277
1284
|
var thumb = U.el('div', 'ep-thumb' + (hide ? ' spoiler' : ''));
|
|
1278
1285
|
// through the poster queue: a season's thumbnails don't all download at once
|
|
1286
|
+
var ref = { num: v.episode, thumb: thumb, hasThumb: !!v.thumbnail, hideOv: hide === 'all', still: null };
|
|
1287
|
+
// (the addon's picture doesn't load, now or earlier: TMDB's, with a key, once known; see below)
|
|
1288
|
+
thumb.__bgFail = function () {
|
|
1289
|
+
thumb.__bgFail = null; // (once: TMDB's failing too is the end of it)
|
|
1290
|
+
ref.hasThumb = false;
|
|
1291
|
+
if (ref.still) { ref.hasThumb = true; U.deferBg(thumb, U.cardImage(ref.still, 'still')); }
|
|
1292
|
+
};
|
|
1279
1293
|
if (v.thumbnail) { U.deferBg(thumb, U.cardImage(v.thumbnail, 'still')); }
|
|
1280
1294
|
var pr = !watched && Player.progressFor(_d.collection ? 'movie' : 'series', v.id);
|
|
1281
1295
|
if (pr && pr.duration && pr.position > 0) { // partly watched: progress stripe
|
|
@@ -1309,7 +1323,8 @@
|
|
|
1309
1323
|
e.__onlongpress = function () { if (_d.collection) { collectionMenu(meta, v); } else { episodeMenu(meta, v); } };
|
|
1310
1324
|
if (_d.target && v.id === _d.target) { _d._epFocus = e; }
|
|
1311
1325
|
listScroll.appendChild(e);
|
|
1312
|
-
|
|
1326
|
+
ref.rating = rating; ref.ov = ov;
|
|
1327
|
+
epRefs.push(ref);
|
|
1313
1328
|
});
|
|
1314
1329
|
panel.appendChild(listScroll);
|
|
1315
1330
|
|
|
@@ -1336,6 +1351,7 @@
|
|
|
1336
1351
|
epRefs.forEach(function (r) {
|
|
1337
1352
|
var ep = map[r.num];
|
|
1338
1353
|
if (!ep) { return; }
|
|
1354
|
+
if (ep.still) { r.still = ep.still; } // (kept: for the addon's picture, should it fail)
|
|
1339
1355
|
if (ep.still && !r.hasThumb) { r.hasThumb = true; U.deferBg(r.thumb, U.cardImage(ep.still, 'still')); }
|
|
1340
1356
|
// Fill the rating only if OMDb didn't provide one for this episode
|
|
1341
1357
|
// (OMDb's dataset is missing IMDb ratings for some episodes).
|
|
@@ -1605,19 +1621,30 @@
|
|
|
1605
1621
|
}
|
|
1606
1622
|
U.store.set(UNSUIT_KEY, all);
|
|
1607
1623
|
}
|
|
1608
|
-
// Hold OK on a source: Play from the start (a place to resume),
|
|
1624
|
+
// Hold OK on a source: Play from the start (a place to resume), Play through StremioK's service
|
|
1625
|
+
// (an HLS one), Not suitable (or back), and
|
|
1609
1626
|
// with a USB drive plugged in, Download to it (js/downloads.js). With only Not suitable to
|
|
1610
1627
|
// offer, it's asked at once.
|
|
1628
|
+
// An HLS source (not YouTube, DRM or a USB file): Play through StremioK's service, this once
|
|
1629
|
+
// (Settings › Playback › Seeking & buffering › HLS through StremioK's service, for all of them).
|
|
1630
|
+
function serviceHlsOk(stream) {
|
|
1631
|
+
if (!stream || stream._yt || stream._localFile || stream._drm || typeof YTPlay === 'undefined' || YTPlay.installMode() === 'browser') { return false; }
|
|
1632
|
+
var url = '' + (stream.url || '');
|
|
1633
|
+
return /^https?:\/\//i.test(url) && (/\.m3u8?(?:[?#]|$)/i.test(url) || Stremio.streamInfo(stream).container === 'hls');
|
|
1634
|
+
}
|
|
1611
1635
|
function sourceMenu(stream) {
|
|
1612
1636
|
var canStart = !howHere() && savedPlace(_d.streamId);
|
|
1613
1637
|
var canDownload = typeof Downloads !== 'undefined' && Downloads.available() && (Downloads.isFileLink ? Downloads.isFileLink(stream) : /^https?:\/\//i.test(stream.url || '')) && !stream._localFile && !stream._yt;
|
|
1614
|
-
|
|
1638
|
+
var canService = serviceHlsOk(stream);
|
|
1639
|
+
if (!canStart && !canDownload && !canService) { toggleUnsuitable(stream); return; }
|
|
1615
1640
|
var unsuit = isUnsuitable(_d.id, stream), opts = [];
|
|
1616
1641
|
if (canStart) { opts.push(['start', 'Play from the start']); }
|
|
1642
|
+
if (canService) { opts.push(['service', 'Play through StremioK’s service']); }
|
|
1617
1643
|
if (canDownload) { opts.push(['download', '⬇ Download to USB drive']); }
|
|
1618
1644
|
opts.push(['suit', unsuit ? 'Put back among the sources' : 'Not suitable']);
|
|
1619
1645
|
pickList(Stremio.streamName(stream), opts, null, function (k) {
|
|
1620
1646
|
if (k === 'start') { startPlayback(stream, _d.streamId, _d.streamLabel || _d.meta.name, { fromStart: true }); }
|
|
1647
|
+
else if (k === 'service') { startPlayback(stream, _d.streamId, _d.streamLabel || _d.meta.name, { viaService: true, fromStart: !!howHere() }); }
|
|
1621
1648
|
else if (k === 'download') { downloadSource(stream); }
|
|
1622
1649
|
else { toggleUnsuitable(stream); }
|
|
1623
1650
|
});
|
|
@@ -2140,7 +2167,7 @@
|
|
|
2140
2167
|
var ctx = { url: stream.url, type: _d.type, addonType: _d.addonType, id: videoId, name: label, parent: _d.id,
|
|
2141
2168
|
poster: _d.meta.poster, background: _d.meta.background, streams: playableSources(), _headers: U.sanitizeHeaders(stream._headers) || undefined, zap: zap, zapTo: zap ? zapToChannel : null,
|
|
2142
2169
|
localSubs: stream._localSubs, localFile: stream._localFile,
|
|
2143
|
-
subExtra: fileHintsOf(stream), sourceSubs: sourceSubsOf(stream), formatInfo: Stremio.streamInfo(stream), fromStart: !!(how && how.fromStart) || undefined,
|
|
2170
|
+
subExtra: fileHintsOf(stream), sourceSubs: sourceSubsOf(stream), formatInfo: Stremio.streamInfo(stream), fromStart: !!(how && how.fromStart) || undefined, viaService: !!(how && how.viaService) || undefined,
|
|
2144
2171
|
titleIds: titleIdsOf(_d.meta, videoId), stream: stream, nextSource: nextSourceFor, downloadAs: typeof Downloads !== 'undefined' ? downloadTitle(videoId) : undefined,
|
|
2145
2172
|
onStarted: learn.onStarted, onFailed: learn.onFailed, learnFor: learnFor };
|
|
2146
2173
|
if (_d.type === 'series' && _d.meta.videos) {
|
package/js/view-discover.js
CHANGED
|
@@ -227,13 +227,13 @@
|
|
|
227
227
|
});
|
|
228
228
|
});
|
|
229
229
|
var ofType = _dv.cats.filter(function (c) { return c.type === _dv.type; });
|
|
230
|
-
pill('Catalog: ' + catLabel(_dv.cat) + ' ▾', function () {
|
|
230
|
+
pill('Catalog: ' + catLabel(_dv.cat) + ' ▾', function () { // (.discover-cat: the one cut short when the bar is full)
|
|
231
231
|
pickList('Catalog', ofType.map(function (c) { return [Stremio.catalogKey(c), catLabel(c)]; }), Stremio.catalogKey(_dv.cat), function (k) {
|
|
232
232
|
var c = ofType.filter(function (x) { return Stremio.catalogKey(x) === k; })[0];
|
|
233
233
|
if (!c || c === _dv.cat) { return; }
|
|
234
234
|
choose(_dv.type, c); reload();
|
|
235
235
|
});
|
|
236
|
-
});
|
|
236
|
+
}).className += ' discover-cat';
|
|
237
237
|
var f = genreFilter(_dv.cat);
|
|
238
238
|
if (f) {
|
|
239
239
|
pill(f.label + ': ' + (_dv.value ? genreLabel(_dv.value) : 'All') + ' ▾', function () { genrePicker(f, false); });
|
|
@@ -323,18 +323,23 @@
|
|
|
323
323
|
// measures nothing.
|
|
324
324
|
var WINDOW = 600;
|
|
325
325
|
function gridEl() { return scr('discover').querySelector('.discover-grid'); }
|
|
326
|
+
// A card's top in the grid's own pixels: where it's laid out (offsetTop), not where it's
|
|
327
|
+
// drawn: the focused card is drawn larger (its scale), its top a few pixels higher, and a
|
|
328
|
+
// single row (three titles) measured with it counted one card per row: LEFT / RIGHT went
|
|
329
|
+
// nowhere and UP / DOWN went along the row.
|
|
330
|
+
function cardTop(el) { return typeof el.offsetTop === 'number' ? el.offsetTop : el.getBoundingClientRect().top / U.zoom(); }
|
|
326
331
|
function cols() {
|
|
327
332
|
var els = _dv.cardEls || [];
|
|
328
333
|
if (_dv.cols && els.length > _dv.cols) { return _dv.cols; }
|
|
329
334
|
if (els.length < 2) { return 1; }
|
|
330
|
-
var top = els[0]
|
|
331
|
-
while (n < els.length && Math.abs(els[n]
|
|
335
|
+
var top = cardTop(els[0]), n = 1; // (the cards of the first row share its top)
|
|
336
|
+
while (n < els.length && Math.abs(cardTop(els[n]) - top) < 2) { n++; }
|
|
332
337
|
if (n < els.length) { _dv.cols = n; } // (known once a second row exists)
|
|
333
338
|
return Math.max(1, n);
|
|
334
339
|
}
|
|
335
340
|
function rowHeight() {
|
|
336
341
|
var els = _dv.cardEls, c = cols();
|
|
337
|
-
return (els.length > c) ? (els[c]
|
|
342
|
+
return (els.length > c) ? cardTop(els[c]) - cardTop(els[0]) : 0; // (in the grid's own pixels)
|
|
338
343
|
}
|
|
339
344
|
function drawGrid() {
|
|
340
345
|
var grid = gridEl();
|
package/js/view-home.js
CHANGED
|
@@ -650,7 +650,7 @@
|
|
|
650
650
|
};
|
|
651
651
|
c.__onlongpress = function () { continueActions(e, base, preview, target, c); };
|
|
652
652
|
c.__cwKey = showKey(e);
|
|
653
|
-
c.__meta = { name: e.name, description: e.position
|
|
653
|
+
c.__meta = { _id: base, _bg: a.background || e.background || '', _ep: e.type === 'series' && target ? codeOfId(target) : '', name: e.name, description: e.position
|
|
654
654
|
? 'Resume at ' + U.fmtTime(e.position) + (e.duration ? ' of ' + U.fmtTime(e.duration) : '')
|
|
655
655
|
: e.upNext !== undefined ? 'Next episode' + (e.upNext ? ': “' + e.upNext + '”' : '') + ' · from Trakt'
|
|
656
656
|
: 'Added, not started yet' };
|
|
@@ -786,7 +786,7 @@
|
|
|
786
786
|
var c = posterCard({ id: u.show, type: 'series', name: u.name, poster: u.poster || calPoster(u.show) }, 'series');
|
|
787
787
|
var code = epCodeOf(u.ep);
|
|
788
788
|
c.appendChild(U.el('div', 'card-new card-code', code));
|
|
789
|
-
c.__meta = { name: u.name, description: code + (u.ep.t ? ' “' + u.ep.t + '”' : '') + ' · ' + (u.ep.r > now ? 'out ' : 'came out ') + U.dayLabel(u.ep.r) };
|
|
789
|
+
c.__meta = { _id: u.show, name: u.name, description: code + (u.ep.t ? ' “' + u.ep.t + '”' : '') + ' · ' + (u.ep.r > now ? 'out ' : 'came out ') + U.dayLabel(u.ep.r) };
|
|
790
790
|
c.__onselect = function () { App.openDetail('series', u.show, { name: u.name, poster: u.poster, type: 'series' }, u.ep.id); };
|
|
791
791
|
c.__onplay = function () { App.openDetail('series', u.show, { name: u.name, poster: u.poster, type: 'series' }, u.ep.id, { playBest: true }); };
|
|
792
792
|
return c;
|
|
@@ -1240,9 +1240,12 @@
|
|
|
1240
1240
|
if (launch && asked === 'guide' && (Stremio.getPrefs().hiddenTabs || []).indexOf('guide') === -1) { _wantGuide = _homeTab; } // (see EPG.onChange below)
|
|
1241
1241
|
}
|
|
1242
1242
|
|
|
1243
|
+
var hero = U.look() === 'modern' && !NO_HERO[_homeTab]; // (Modern: the focused title's backdrop, behind it all)
|
|
1244
|
+
if (hero) { s.appendChild(homeBackdrop(_homeTab)); }
|
|
1243
1245
|
s.appendChild(buildTopMenu(_homeTab));
|
|
1244
|
-
// The focused title's details, between the top menu and the rows (#home-info)
|
|
1245
|
-
|
|
1246
|
+
// The focused title's details, between the top menu and the rows (#home-info); Modern's
|
|
1247
|
+
// title tabs: large, over the backdrop (hero).
|
|
1248
|
+
var info = U.el('div', 'home-info' + (hero ? ' hero' : ''));
|
|
1246
1249
|
info.appendChild(U.el('div', 'home-info-title'));
|
|
1247
1250
|
info.appendChild(U.el('div', 'home-info-meta'));
|
|
1248
1251
|
info.appendChild(U.el('div', 'home-info-desc'));
|
|
@@ -1315,7 +1318,61 @@
|
|
|
1315
1318
|
// Details strip: updated when focus settles on a Home card (debounced, so holding a
|
|
1316
1319
|
// direction doesn't redo it for every card passed).
|
|
1317
1320
|
var _homeInfoTimer = null;
|
|
1318
|
-
function fillHomeInfo(m) { fillInfoBox(scr('home').querySelector('.home-info'), m); }
|
|
1321
|
+
function fillHomeInfo(m) { fillInfoBox(scr('home').querySelector('.home-info'), m); fillBackdrop(scr('home').querySelector('.home-bg'), m); }
|
|
1322
|
+
// Modern look: the focused title's backdrop behind Home, two layers taking turns, so the
|
|
1323
|
+
// new one fades in over the last (Effects: Full) once it has loaded; a picture that doesn't
|
|
1324
|
+
// load gives way to the next of its choices (U.heroImages). A title without one: black; the
|
|
1325
|
+
// menu (no title): the last kept. Not on the live tabs and Local (their pictures are
|
|
1326
|
+
// logos and program stills: the details strip shows those).
|
|
1327
|
+
var NO_HERO = { tv: 1, guide: 1, radio: 1, sport: 1, local: 1 };
|
|
1328
|
+
var _homeBg = { tab: '', src: '' }; // (the last one, for when Home draws that tab again)
|
|
1329
|
+
function homeBackdrop(tab) {
|
|
1330
|
+
var bg = U.el('div', 'home-bg');
|
|
1331
|
+
bg.appendChild(U.el('div', 'hb'));
|
|
1332
|
+
bg.appendChild(U.el('div', 'hb'));
|
|
1333
|
+
bg.appendChild(U.el('div', 'hb-shade'));
|
|
1334
|
+
if (_homeBg.src && _homeBg.tab === tab) { bg.children[0].style.backgroundImage = 'url("' + _homeBg.src + '")'; bg.children[0].className = 'hb on'; bg.__src = _homeBg.src; }
|
|
1335
|
+
bg.__tab = tab;
|
|
1336
|
+
return bg;
|
|
1337
|
+
}
|
|
1338
|
+
// Continue Watching and the Calendar keep only a little of a title: for an IMDb one, its logo
|
|
1339
|
+
// is Cinemeta's for that id (one that doesn't load: its name, as for any logo).
|
|
1340
|
+
function ttLogo(m) {
|
|
1341
|
+
var tt = m && m._id && /^(tt\d{5,10})(?::|$)/.exec(m._id);
|
|
1342
|
+
return tt ? 'https://images.metahub.space/logo/medium/' + tt[1] + '/img' : '';
|
|
1343
|
+
}
|
|
1344
|
+
// A title's backdrop: its own; else, for an IMDb title (Continue Watching, the Calendar keep
|
|
1345
|
+
// only a little of it), Cinemeta's picture for that id.
|
|
1346
|
+
function backdropOf(m) {
|
|
1347
|
+
if (!m) { return null; }
|
|
1348
|
+
var b = m.background || m._bg || '', tt = !b && /^(tt\d{5,10})(?::|$)/.exec(m.id || m._id || '');
|
|
1349
|
+
if (tt) { b = 'https://images.metahub.space/background/medium/' + tt[1] + '/img'; }
|
|
1350
|
+
return U.heroImages(b);
|
|
1351
|
+
}
|
|
1352
|
+
function fillBackdrop(bg, m) {
|
|
1353
|
+
if (!bg || !m || !(m.name || m.title)) { return; } // (the menu: the last one stays)
|
|
1354
|
+
var list = backdropOf(m) || [], key = list.join(' ');
|
|
1355
|
+
if (bg.__src === key) { return; }
|
|
1356
|
+
bg.__src = key;
|
|
1357
|
+
function show(src) {
|
|
1358
|
+
var on = bg.querySelector('.hb.on'), next = on === bg.children[0] ? bg.children[1] : bg.children[0];
|
|
1359
|
+
if (src) { next.style.backgroundImage = 'url("' + src + '")'; next.className = 'hb on'; }
|
|
1360
|
+
if (on) { on.className = 'hb'; }
|
|
1361
|
+
_homeBg = { tab: bg.__tab, src: src || '' };
|
|
1362
|
+
}
|
|
1363
|
+
if (!list.length) { show(''); return; }
|
|
1364
|
+
(function next(i) {
|
|
1365
|
+
if (i >= list.length) { if (bg.__src === key) { show(''); } return; }
|
|
1366
|
+
var img = new Image();
|
|
1367
|
+
img.onload = function () {
|
|
1368
|
+
if (bg.__src !== key) { return; } // (focus moved on before it came)
|
|
1369
|
+
if (img.naturalWidth && img.naturalWidth < 200) { next(i + 1); return; } // (a stand-in, not the picture)
|
|
1370
|
+
show(list[i]);
|
|
1371
|
+
};
|
|
1372
|
+
img.onerror = function () { if (bg.__src === key) { next(i + 1); } };
|
|
1373
|
+
img.src = list[i];
|
|
1374
|
+
})(0);
|
|
1375
|
+
}
|
|
1319
1376
|
// Fill a details strip (Home, Discover) with a title's logo / name, facts and synopsis.
|
|
1320
1377
|
function fillInfoBox(box, m) {
|
|
1321
1378
|
if (!box) { return; }
|
|
@@ -1329,10 +1386,17 @@
|
|
|
1329
1386
|
if (m.name || m.title) { box.classList.add('on'); } else { box.classList.remove('on'); } // shaded only while describing a title
|
|
1330
1387
|
var t = box.children[0], name = m.name || m.title || '';
|
|
1331
1388
|
U.clear(t);
|
|
1332
|
-
var logoSrc = U.cardImage(m.logo, 'logo');
|
|
1389
|
+
var logoSrc = U.cardImage(m.logo || ttLogo(m), 'logo');
|
|
1390
|
+
// an episode in Continue Watching: its name says which (Breaking Bad S1E1), its logo
|
|
1391
|
+
// doesn't, so the facts begin with it then
|
|
1392
|
+
var ep = logoSrc && m._ep ? m._ep : '';
|
|
1333
1393
|
if (logoSrc) { // the title's logo when it has one; its name if that fails to load
|
|
1334
1394
|
var img = U.el('img', 'home-info-logo');
|
|
1335
|
-
img.onerror = function () {
|
|
1395
|
+
img.onerror = function () {
|
|
1396
|
+
if (img.parentNode !== t) { return; }
|
|
1397
|
+
U.clear(t); t.textContent = name;
|
|
1398
|
+
if (ep && box.children[1].textContent.indexOf(ep) === 0) { box.children[1].textContent = box.children[1].textContent.slice(ep.length).replace(/^\s*·\s*/, ''); }
|
|
1399
|
+
};
|
|
1336
1400
|
t.appendChild(img);
|
|
1337
1401
|
U.deferImage(img, logoSrc, true); // (through the queue, ahead of the rest)
|
|
1338
1402
|
} else {
|
|
@@ -1344,6 +1408,7 @@
|
|
|
1344
1408
|
bits = ['Now ' + EPG.hhmm(g.now.start) + '–' + EPG.hhmm(g.now.stop) + ' ' + g.now.title];
|
|
1345
1409
|
desc = (g.now.desc ? g.now.desc + ' ' : '') + (g.next ? 'Next ' + EPG.hhmm(g.next.start) + ' ' + g.next.title : '');
|
|
1346
1410
|
}
|
|
1411
|
+
if (ep) { bits.unshift(ep); }
|
|
1347
1412
|
box.children[1].textContent = bits.join(' · ');
|
|
1348
1413
|
box.children[2].textContent = desc;
|
|
1349
1414
|
// a program's picture from the TV guide (the Guide tab's focused one, a channel's now)
|
package/js/view-settings.js
CHANGED
|
@@ -197,9 +197,15 @@
|
|
|
197
197
|
// Zoom: everything bigger (see U.setZoom), in percent.
|
|
198
198
|
var ZOOMS = [['100', '100%'], ['110', '110%'], ['120', '120%'], ['130', '130%'], ['140', '140%']];
|
|
199
199
|
function zoomPct() { return Stremio.getPrefs().zoom; }
|
|
200
|
+
// Look: Classic (the stylesheet as it is) or Modern (css/modern.css, its rules only under
|
|
201
|
+
// body.look-modern). Effects, Modern's blur and motion: Auto turns them on where the TV's
|
|
202
|
+
// browser can blur behind a panel (Tizen 6 and later), Light keeps them off, Full on.
|
|
203
|
+
var LOOKS = [['classic', 'Classic'], ['modern', 'Modern']];
|
|
204
|
+
var EFFECTS = [['auto', 'Auto (by the TV)'], ['light', 'Light'], ['full', 'Full']];
|
|
200
205
|
function applyAppearance() {
|
|
201
|
-
var a = appearance();
|
|
206
|
+
var a = appearance(), p = Stremio.getPrefs();
|
|
202
207
|
U.applyTheme(a.accent, a.bg);
|
|
208
|
+
U.setLook(p.look, p.effects, a.bg === 'gray' || a.bg === 'white');
|
|
203
209
|
U.setZoom(zoomPct() / 100);
|
|
204
210
|
}
|
|
205
211
|
function settingsAppearance(wrap) {
|
|
@@ -210,6 +216,10 @@
|
|
|
210
216
|
} };
|
|
211
217
|
var accents = U.ACCENT_KEYS.map(function (k) { return [k, ACCENT_NAMES[k] || k, null, U.accentColor(k)]; });
|
|
212
218
|
wrap.appendChild(U.el('h2', null, 'Appearance'));
|
|
219
|
+
var looks = { get: function () { var p = Stremio.getPrefs(); return { look: p.look, effects: p.effects }; },
|
|
220
|
+
set: function (cfg) { Stremio.setPref('look', cfg.look); Stremio.setPref('effects', cfg.effects); applyAppearance(); markHomeDirty(); } };
|
|
221
|
+
wrap.appendChild(subPickRow('Look', LOOKS, 'look', looks));
|
|
222
|
+
wrap.appendChild(subPickRow('Effects', EFFECTS, 'effects', looks));
|
|
213
223
|
wrap.appendChild(subPickRow('Background', BACKGROUNDS, 'bg', store));
|
|
214
224
|
wrap.appendChild(subPickRow('Accent color', accents, 'accent', store));
|
|
215
225
|
wrap.appendChild(subPickRow('Zoom', ZOOMS, 'zoom', {
|
|
@@ -478,7 +488,7 @@
|
|
|
478
488
|
wrap.appendChild(U.el('h2', null, 'Settings'));
|
|
479
489
|
wrap.appendChild(sectionRow('Content', 'Addons, API keys, IPTV playlists, streaming apps, importing a configuration file', 'content'));
|
|
480
490
|
wrap.appendChild(sectionRow('Playback', 'Audio and subtitles, source ranking, feed sources, formats', 'playback'));
|
|
481
|
-
wrap.appendChild(sectionRow('Appearance', '
|
|
491
|
+
wrap.appendChild(sectionRow('Appearance', 'Look, background, accent color, zoom, posters, spoilers', 'appearance'));
|
|
482
492
|
wrap.appendChild(sectionRow('Home', 'The tab it opens on, the top menu, Home feeds, Search results', 'home'));
|
|
483
493
|
wrap.appendChild(sectionRow('Diagnostics', 'Logs, storage, installed apps; how StremioK was installed', 'diagnostics'));
|
|
484
494
|
if (typeof YTPlay !== 'undefined' && YTPlay.installMode && YTPlay.installMode() === 'tizenbrew') { wrap.appendChild(U.el('div', 'hint', TIZENBREW_NOTE)); }
|
|
@@ -1229,6 +1239,13 @@
|
|
|
1229
1239
|
}
|
|
1230
1240
|
}));
|
|
1231
1241
|
|
|
1242
|
+
if (typeof StVod !== 'undefined' && StVod.keepMinutes) { // (what the service keeps of a portal's films and series)
|
|
1243
|
+
wrap.appendChild(subPickRow('Stalker films and series', [['10', 'Kept 10 minutes'], ['5', 'Kept 5 minutes'], ['0', 'Off (asked each time)']], 'keep', {
|
|
1244
|
+
get: function () { return { keep: String(StVod.keepMinutes()) }; },
|
|
1245
|
+
set: function (c) { StVod.setKeepMinutes(+c.keep); }
|
|
1246
|
+
}));
|
|
1247
|
+
}
|
|
1248
|
+
|
|
1232
1249
|
wrap.appendChild(U.el('div', 'hint',
|
|
1233
1250
|
'Channels are grouped into IPTV and Radio rows on Home. ▲ / ▼ set the playlists\' order: a channel in two playlists comes from the first.'));
|
|
1234
1251
|
var s = scr('settings'), want = null;
|
|
@@ -1636,14 +1653,17 @@
|
|
|
1636
1653
|
// Seeking & buffering: how far LEFT / RIGHT jump; a bigger buffer for slow connections; how
|
|
1637
1654
|
// often a live channel that drops is opened again.
|
|
1638
1655
|
var RECONNECTS = [['off', 'Off'], ['few', 'A few times (3 in 5 minutes)'], ['always', 'Keep trying']];
|
|
1656
|
+
// (an HLS source through the service, with its own headers on every piece: see player-core's viaService)
|
|
1657
|
+
var HLS_ROUTES = [['off', 'Off'], ['headers', 'Sources that need headers'], ['all', 'All HLS sources']];
|
|
1639
1658
|
function settingsSeeking(wrap) {
|
|
1640
1659
|
wrap.appendChild(U.el('h2', null, 'Seeking & buffering'));
|
|
1641
|
-
var store = { get: function () { var c = Player.playerCfg(); return { seek: '' + c.seek, buffer: c.buffer, reconnect: c.reconnect }; },
|
|
1642
|
-
set: function (cfg) { Player.setPlayerCfg({ seek: +cfg.seek || 10, buffer: cfg.buffer, reconnect: cfg.reconnect }); } };
|
|
1660
|
+
var store = { get: function () { var c = Player.playerCfg(); return { seek: '' + c.seek, buffer: c.buffer, reconnect: c.reconnect, hls: c.hls }; },
|
|
1661
|
+
set: function (cfg) { Player.setPlayerCfg({ seek: +cfg.seek || 10, buffer: cfg.buffer, reconnect: cfg.reconnect, hls: cfg.hls }); } };
|
|
1643
1662
|
wrap.appendChild(subPickRow('Seek step', [['5', '5 s'], ['10', '10 s'], ['15', '15 s'], ['30', '30 s']], 'seek', store));
|
|
1644
1663
|
wrap.appendChild(subPickRow('Buffer', [['normal', 'Normal (the TV’s own)'], ['more', 'More'], ['most', 'Most']], 'buffer', store));
|
|
1645
1664
|
wrap.appendChild(subPickRow('Reconnect live channels', RECONNECTS, 'reconnect', store));
|
|
1646
|
-
wrap.appendChild(
|
|
1665
|
+
wrap.appendChild(subPickRow('HLS through StremioK’s service', HLS_ROUTES, 'hls', store));
|
|
1666
|
+
wrap.appendChild(U.el('div', 'hint', 'Seek step: FF / REW jump three. Buffer: More or Most starts slower but stops less on a slow connection. Reconnect: a live channel that drops opens again (BACK stops it). HLS through StremioK’s service: for a host that wants headers the TV’s player can’t send; a step more before it starts.'));
|
|
1647
1667
|
focusSettings();
|
|
1648
1668
|
}
|
|
1649
1669
|
function settingsSkipping(wrap) {
|
package/js/ytplay.js
CHANGED
|
@@ -87,7 +87,7 @@ var YTPlay = (function () {
|
|
|
87
87
|
var cc = opts && opts.cc ? opts.cc.map(function (c) { return c.ch + (c.lang ? '-' + c.lang : ''); }).join(',') : '';
|
|
88
88
|
return ensureService().then(entryAuth).then(function (a) {
|
|
89
89
|
var q = '/live/open?u=' + encodeURIComponent(url) + (h && h.ua ? '&ua=' + encodeURIComponent(h.ua) : '') + (h && h.ref ? '&ref=' + encodeURIComponent(h.ref) : '') + (h && h.cookie ? '&cookie=' + encodeURIComponent(h.cookie) : '') + (force ? '&force=1' : '') +
|
|
90
|
-
(force && opts && opts.fix === false ? '&fix=0' : '') + (force && cc ? '&cc=' + encodeURIComponent(cc) : '');
|
|
90
|
+
(force && opts && opts.fix === false ? '&fix=0' : '') + (force && cc ? '&cc=' + encodeURIComponent(cc) : '') + (force && opts && opts.film ? '&film=1' : '');
|
|
91
91
|
return U.getJSON(PROXY + q + a.q, force ? 5000 : 30000, 65536, cancel || null, a.h);
|
|
92
92
|
});
|
|
93
93
|
}
|
package/package.json
CHANGED
package/service/index.js
CHANGED
|
@@ -2003,6 +2003,7 @@ function liveGet(u, who, max, cb, part) {
|
|
|
2003
2003
|
var h = { 'User-Agent': who.ua || TV_UA };
|
|
2004
2004
|
if (who.ref) { h.Referer = who.ref; }
|
|
2005
2005
|
if (who.cookie) { h.Cookie = who.cookie; }
|
|
2006
|
+
if (who.range) { h.Range = who.range; } // (a film's piece that's part of a file: EXT-X-BYTERANGE)
|
|
2006
2007
|
var opts = { hostname: pu.hostname, port: pu.port, path: pu.path, headers: h };
|
|
2007
2008
|
if (pu.protocol === 'https:' && caList().length) { opts.ca = caList(); }
|
|
2008
2009
|
var chunks = [], size = 0, done = false;
|
|
@@ -2021,7 +2022,8 @@ function liveGet(u, who, max, cb, part) {
|
|
|
2021
2022
|
if (!gone) { get(urllib.resolve(url, resp.headers.location)); }
|
|
2022
2023
|
return;
|
|
2023
2024
|
}
|
|
2024
|
-
if (sc
|
|
2025
|
+
if (who.range && sc === 200) { resp.resume(); end(upError('the server sent the whole file, not the part asked for', 502)); return; }
|
|
2026
|
+
if (sc !== 200 && !(sc === 206 && who.range)) { resp.resume(); end(upError('HTTP ' + sc, sc >= 400 && sc < 600 ? sc : 502)); return; }
|
|
2025
2027
|
resp.on('data', function (c) {
|
|
2026
2028
|
if (done) { return; }
|
|
2027
2029
|
chunks.push(c); size += c.length; held += c.length; _liveHeld += c.length;
|
|
@@ -2489,31 +2491,57 @@ function ccList(s, text, base, k) {
|
|
|
2489
2491
|
// A playlist with its links through the relay: a master's variants and renditions (m), a media
|
|
2490
2492
|
// playlist's segments (s, numbered from its media sequence); encrypted or fMP4 segments, keys:
|
|
2491
2493
|
// fetched directly (their absolute links).
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
+
// A film's relay (&film=1: HLS through StremioK's service) keeps every link (up to
|
|
2495
|
+
// LIVE_FILM_LINKS: seeking goes back to any of them), a live channel's its last LIVE_LINKS.
|
|
2496
|
+
// raw: a key, an init section or an encrypted / fMP4 piece, passed on as it is; range: a byte
|
|
2497
|
+
// range of its link ('bytes=a-b').
|
|
2498
|
+
var LIVE_FILM_LINKS = 30000, LIVE_FILM_IDLE_MS = 3 * 3600 * 1000;
|
|
2499
|
+
function liveLink(s, url, kind, seq, ch, raw, range) {
|
|
2500
|
+
var key = kind + (ch !== undefined ? ch : '') + (range ? '@' + range : '') + ' ' + url;
|
|
2494
2501
|
if (s.at[key] !== undefined) { return s.at[key]; }
|
|
2495
|
-
var n = s.next
|
|
2496
|
-
s.links[n] = { url: url, kind: kind, seq: seq, ch: ch, key: key };
|
|
2502
|
+
var n = s.next++, keep = s.film ? LIVE_FILM_LINKS : LIVE_LINKS;
|
|
2503
|
+
s.links[n] = { url: url, kind: kind, seq: seq, ch: ch, key: key, raw: !!raw, range: range || '' };
|
|
2497
2504
|
s.at[key] = n;
|
|
2498
|
-
var old = s.links[n -
|
|
2499
|
-
if (old) { delete s.at[old.key]; delete s.links[n -
|
|
2505
|
+
var old = s.links[n - keep];
|
|
2506
|
+
if (old) { delete s.at[old.key]; delete s.links[n - keep]; }
|
|
2500
2507
|
return n;
|
|
2501
2508
|
}
|
|
2509
|
+
// EXT-X-BYTERANGE's "<length>[@<offset>]" as a Range header, after the one before it (a piece
|
|
2510
|
+
// without an offset follows the last of the same link): { range, end } or null.
|
|
2511
|
+
function liveRange(v, last, url) {
|
|
2512
|
+
var m = /^\s*(\d+)(?:@(\d+))?\s*$/.exec(v || '');
|
|
2513
|
+
if (!m) { return null; }
|
|
2514
|
+
var len = +m[1], off = m[2] !== undefined ? +m[2] : (last && last.url === url ? last.end : 0);
|
|
2515
|
+
if (!(len > 0)) { return null; }
|
|
2516
|
+
return { range: 'bytes=' + off + '-' + (off + len - 1), end: off + len, url: url };
|
|
2517
|
+
}
|
|
2502
2518
|
function liveBase(s) { return 'http://localhost:' + PORT + '/live/' + s.id + '/'; }
|
|
2503
2519
|
function liveRewrite(s, text, base) {
|
|
2504
2520
|
var master = /#EXT-X-STREAM-INF/.test(text), direct = !master && /#EXT-X-KEY:METHOD=(?!NONE)|#EXT-X-MAP/.test(text);
|
|
2505
2521
|
var sq = /#EXT-X-MEDIA-SEQUENCE:\s*(\d+)/.exec(text), seq = sq ? +sq[1] : 0, pre = liveBase(s);
|
|
2522
|
+
var span = null, last = null; // (a film's: the byte range of the next piece, and of the one before)
|
|
2506
2523
|
return String(text).split(/\r?\n/).map(function (ln) {
|
|
2507
2524
|
var t = ln.trim();
|
|
2508
2525
|
if (!t) { return ln; }
|
|
2509
2526
|
if (t.charAt(0) === '#') {
|
|
2527
|
+
if (s.film && /^#EXT-X-BYTERANGE:/.test(t)) { span = t.slice(17); return ln; }
|
|
2510
2528
|
return t.replace(/URI="([^"]*)"/, function (all, v) {
|
|
2511
2529
|
var abs = urllib.resolve(base, v);
|
|
2512
|
-
|
|
2530
|
+
if (/^#EXT-X-MEDIA:/.test(t)) { return 'URI="' + pre + 'm?n=' + liveLink(s, abs, 'm') + '"'; }
|
|
2531
|
+
if (s.film && /^#EXT-X-(KEY|MAP|SESSION-KEY):/.test(t)) { // (a film's key or init section: with its headers too)
|
|
2532
|
+
var br = /^#EXT-X-MAP:/.test(t) && /BYTERANGE="([^"]*)"/.exec(t), r = br ? liveRange(br[1], null, abs) : null;
|
|
2533
|
+
return 'URI="' + pre + 's?n=' + liveLink(s, abs, 's', -1, undefined, true, r ? r.range : '') + '"';
|
|
2534
|
+
}
|
|
2535
|
+
return 'URI="' + abs + '"';
|
|
2513
2536
|
});
|
|
2514
2537
|
}
|
|
2515
2538
|
var abs = urllib.resolve(base, t);
|
|
2516
2539
|
if (master) { return pre + 'm?n=' + liveLink(s, abs, 'm'); }
|
|
2540
|
+
if (s.film) {
|
|
2541
|
+
var rg = span !== null ? liveRange(span, last, abs) : null;
|
|
2542
|
+
span = null; last = rg;
|
|
2543
|
+
return pre + 's?n=' + liveLink(s, abs, 's', seq++, undefined, direct, rg ? rg.range : '');
|
|
2544
|
+
}
|
|
2517
2545
|
if (direct) { seq++; return abs; }
|
|
2518
2546
|
return pre + 's?n=' + liveLink(s, abs, 's', seq++);
|
|
2519
2547
|
}).join('\n');
|
|
@@ -2526,14 +2554,14 @@ function liveSession(u, who, opts) {
|
|
|
2526
2554
|
delete _live[ids[0]];
|
|
2527
2555
|
}
|
|
2528
2556
|
var s = { id: crypto.randomBytes(16).toString('hex'), ua: who.ua, ref: who.ref, cookie: who.cookie || '', links: {}, at: {}, next: 0, last: Date.now(), a: liveAudio(),
|
|
2529
|
-
fix: opts.fix !== false, cc: opts.cc && opts.cc.length ? opts.cc : null, c: ccState(), got: Object.create(null) };
|
|
2557
|
+
fix: opts.fix !== false && !opts.film, cc: opts.cc && opts.cc.length && !opts.film ? opts.cc : null, film: !!opts.film, c: ccState(), got: Object.create(null) };
|
|
2530
2558
|
_live[s.id] = s;
|
|
2531
2559
|
s.top = liveLink(s, u, 'm');
|
|
2532
2560
|
return s;
|
|
2533
2561
|
}
|
|
2534
2562
|
function livePurge() {
|
|
2535
2563
|
var now = Date.now();
|
|
2536
|
-
Object.keys(_live).forEach(function (id) { if (now - _live[id].last > LIVE_IDLE_MS) { delete _live[id]; } });
|
|
2564
|
+
Object.keys(_live).forEach(function (id) { if (now - _live[id].last > (_live[id].film ? LIVE_FILM_IDLE_MS : LIVE_IDLE_MS)) { delete _live[id]; } }); // (a film may be paused a while)
|
|
2537
2565
|
}
|
|
2538
2566
|
// The look: the playlist (a master's first variant), then the start of the segment a player
|
|
2539
2567
|
// starts with (the third from the end); with captions in that start, the whole segment (up to
|
|
@@ -2594,7 +2622,7 @@ function liveControl(req, res, path, query, leaving) {
|
|
|
2594
2622
|
if (!/^https?:\/\/[^\s]+$/i.test(u) || u.length > 2000) { send(res, 400, 'text/plain', 'bad link'); return; }
|
|
2595
2623
|
var cc = ccAsked(q.cc);
|
|
2596
2624
|
if (q.force === '1') {
|
|
2597
|
-
var sf = liveSession(u, who, { fix: q.fix !== '0', cc: cc });
|
|
2625
|
+
var sf = liveSession(u, who, { fix: q.fix !== '0', cc: cc, film: q.film === '1' });
|
|
2598
2626
|
send(res, 200, 'application/json', JSON.stringify({ fix: true, sure: true, why: 'asked for', url: liveBase(sf) + 'm?n=' + sf.top }));
|
|
2599
2627
|
return;
|
|
2600
2628
|
}
|
|
@@ -2615,11 +2643,13 @@ function liveControl(req, res, path, query, leaving) {
|
|
|
2615
2643
|
try { return ccSegment(s.c, body, link.seq); } catch (e) { log('live captions: ' + (e && e.message)); s.c = ccState(); return null; }
|
|
2616
2644
|
}
|
|
2617
2645
|
if (kind === 'v' && s.c.segs[link.seq]) { send(res, 200, 'text/vtt; charset=utf-8', ccVtt(s.c.segs[link.seq], link.ch)); return; }
|
|
2618
|
-
|
|
2646
|
+
var who = link.range ? { ua: s.ua, ref: s.ref, cookie: s.cookie, range: link.range } : s; // (a byte range: asked as one)
|
|
2647
|
+
leaving.push((seg && s.cc ? liveShared : liveGet)(link.url, who, seg ? LIVE_SEG_MAX : LIVE_LIST_MAX, function (err, body, at) {
|
|
2619
2648
|
if (err) { send(res, err.status || 502, 'text/plain', 'failed: ' + (err.message || 'unknown')); return; }
|
|
2620
2649
|
if (kind === 'v') { var cs = captions(body); send(res, 200, 'text/vtt; charset=utf-8', cs ? ccVtt(cs, link.ch) : 'WEBVTT\n'); return; }
|
|
2621
2650
|
if (kind === 'c') { send(res, 200, 'application/vnd.apple.mpegurl', ccList(s, body.toString('utf8'), at, link.ch)); return; }
|
|
2622
2651
|
if (kind !== 's') { send(res, 200, 'application/vnd.apple.mpegurl', s.cc && kind === 'm' && +q.n === s.top ? ccMaster(s, body.toString('utf8'), at) : liveRewrite(s, body.toString('utf8'), at)); return; }
|
|
2652
|
+
if (link.raw) { send(res, 200, 'application/octet-stream', body); return; } // (a film's key, init section or encrypted piece: as it came)
|
|
2623
2653
|
var out = body;
|
|
2624
2654
|
if (s.cc) { captions(body); }
|
|
2625
2655
|
if (s.fix) { try { out = liveFix(s, body, link.seq); } catch (e) { log('live: ' + (e && e.message)); s.a = liveAudio(); } }
|
|
@@ -3199,8 +3229,10 @@ var STALKER_VOD_TAKE = 42, STALKER_VOD_PAGES = 4, STALKER_VOD_CATS_MS = 10 * 600
|
|
|
3199
3229
|
// What a portal answered (a list from a position, a search, a series' seasons): kept
|
|
3200
3230
|
// STALKER_VOD_KEEP_MS, the last STALKER_VOD_KEEP a portal, so a row or category shown again isn't
|
|
3201
3231
|
// asked again (a portal may stop answering many quick asks); fresh=1 (Reload) lets it all go.
|
|
3232
|
+
// &keep=: the app's Stalker films and series setting, in minutes (0: not kept; up to 10).
|
|
3202
3233
|
var STALKER_VOD_KEEP_MS = 10 * 60000, STALKER_VOD_KEEP = 40;
|
|
3203
|
-
function
|
|
3234
|
+
function stalkerKeepMs(q) { var m = /^\d{1,2}$/.test(q.keep || '') ? +q.keep : 10; return Math.min(m, 10) * 60000; }
|
|
3235
|
+
function stalkerKept(s, key, ms) { var k = s.vodKept && s.vodKept[key]; return k && Date.now() - k.at < Math.min(ms, STALKER_VOD_KEEP_MS) ? k.v : null; }
|
|
3204
3236
|
function stalkerKeepVod(s, key, v) {
|
|
3205
3237
|
if (!s.vodKept) { s.vodKept = Object.create(null); s.vodOrder = []; }
|
|
3206
3238
|
if (!s.vodKept[key]) { s.vodOrder.push(key); while (s.vodOrder.length > STALKER_VOD_KEEP) { delete s.vodKept[s.vodOrder.shift()]; } }
|
|
@@ -3364,7 +3396,9 @@ function stalkerControl(req, res, path, query, leaving) {
|
|
|
3364
3396
|
var type = q.type === 'series' ? 'series' : 'movie', what = String(q.do || '');
|
|
3365
3397
|
if (q.fresh === '1') { s.vodCats = null; s.vodKept = null; s.vodOrder = null; } // (Reload: all of it read again)
|
|
3366
3398
|
var vkey = what === 'list' || what === 'seasons' ? [what, type, q.cat || '*', String(q.q || '').trim().slice(0, 120), parseInt(q.skip, 10) || 0, q.id || '', q.via || ''].join('|') : '';
|
|
3367
|
-
var
|
|
3399
|
+
var keepMs = stalkerKeepMs(q);
|
|
3400
|
+
if (!keepMs) { vkey = ''; } // (not kept: asked each time)
|
|
3401
|
+
var kept = vkey && stalkerKept(s, vkey, keepMs);
|
|
3368
3402
|
if (kept) { json(kept); return; }
|
|
3369
3403
|
stalkerWith(s, portal, mac, ctl, function (ss, done) {
|
|
3370
3404
|
if (what === 'cats') { stalkerVodCats(ss, type, ctl, function (err, list) { done(err, { cats: list }); }); return; }
|