stremiok 2.3.2 → 2.3.4
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 +28 -0
- package/README.md +15 -14
- package/config.xml +1 -1
- package/css/modern.css +1 -0
- package/css/style.css +5 -2
- package/index.html +40 -38
- package/js/app.js +4 -0
- package/js/jellyfin.js +96 -17
- package/js/local.js +99 -31
- package/js/netfolders.js +157 -0
- package/js/player-audio.js +25 -1
- package/js/player-controls.js +3 -2
- package/js/player-core.js +63 -15
- package/js/player-store.js +12 -5
- package/js/plex.js +58 -10
- package/js/stremio-account.js +11 -6
- package/js/stremio-sync.js +641 -0
- package/js/stremio.js +1 -0
- package/js/util.js +1 -1
- package/js/view-core.js +19 -2
- package/js/view-detail.js +15 -4
- package/js/view-home.js +42 -19
- package/js/view-settings.js +218 -28
- package/js/ytplay.js +1 -1
- package/package.json +1 -1
- package/service/index.js +353 -12
- package/tizenbrew.html +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,34 @@
|
|
|
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.3.4 — 2026-11-09
|
|
7
|
+
- **Your Stremio account, kept in step** (Settings › Content › Integrations › *Stremio account*):
|
|
8
|
+
Continue Watching, watched marks and your Library sync with it, both ways; the latest change to
|
|
9
|
+
a title wins. Your Library is a *Stremio Library* row; *+ Stremio Library* on a title page adds
|
|
10
|
+
to it.
|
|
11
|
+
- **Importing addons** uses the connected account, without signing in again.
|
|
12
|
+
- **Large media server libraries:** Jellyfin, Emby and Plex lists of titles are read 2,000 at a
|
|
13
|
+
time, so a big library's copies show on title pages; one too big or slow is searched by name
|
|
14
|
+
(the same IMDb or TMDB id), now on Plex too.
|
|
15
|
+
|
|
16
|
+
## 2.3.3 — 2026-11-08
|
|
17
|
+
- **After a lot of debugging & troubleshooting: TizenBrew has no TV player** (#17): the TV gives
|
|
18
|
+
its own player only to installed apps, so under TizenBrew a file with several audio tracks only
|
|
19
|
+
plays its first one. The audio menu, Settings › Playback › Audio and the installation guide now
|
|
20
|
+
say so; Diagnostics names the player in use.
|
|
21
|
+
- **Network folders (WebDAV)** (Settings › Content › Network folders): a folder a NAS, Nextcloud
|
|
22
|
+
or a computer running rclone shares, in the Local tab beside USB drives: browsed, matched,
|
|
23
|
+
indexed, its videos sources (*On your network folder*), with their subtitle files.
|
|
24
|
+
- **A network folder's sign-in** is kept on the TV and sent only to that folder.
|
|
25
|
+
- **Large Jellyfin catalogs:** when a server's list of titles doesn't come (too big or slow), a
|
|
26
|
+
title is searched for by name and taken only with the same IMDb or TMDB id; a film or episode
|
|
27
|
+
listed without its files gets them from the server.
|
|
28
|
+
- **A live channel's choppy sound** is repaired on raw MPEG-TS channels too (an Xtream account's
|
|
29
|
+
default), not only HLS ones; and it's your choice (Red): *straight from the server* or
|
|
30
|
+
*repacked by StremioK's service*, kept for that channel.
|
|
31
|
+
- **Fixed:** a cast or crew card cut off the role under a two-line name; under TizenBrew, a closed
|
|
32
|
+
player's video stayed loaded and could play behind the menus.
|
|
33
|
+
|
|
6
34
|
## 2.3.2 — 2026-11-07
|
|
7
35
|
- **TizenBrew runs one version at a time:** a TV could keep an old version, or a mix of two, for
|
|
8
36
|
hours after a release (2.3.0 with 2.3.1 listed, #17). TizenBrew now opens a start page that
|
package/README.md
CHANGED
|
@@ -22,20 +22,20 @@ video through Samsung's AVPlay API.
|
|
|
22
22
|
|
|
23
23
|
- **Your addons:** catalogs, details, sources and subtitles from the Stremio addons you add
|
|
24
24
|
(Cinemeta and OpenSubtitles to start with), in the order you choose.
|
|
25
|
-
- **Home** with Watching (Continue Watching, synced with **Trakt** if you connect
|
|
25
|
+
- **Home** with Watching (Continue Watching, synced with **Trakt** or **Stremio** if you connect them), Movies,
|
|
26
26
|
Series, IPTV, Guide, Radio, Sports, YouTube and Local tabs; **Discover** to browse any catalog in full;
|
|
27
27
|
**Search** across every addon that can search, and people by name.
|
|
28
28
|
- **Title pages:** ranked sources with **▶ Play best**, trailers, ratings (IMDb, Rotten
|
|
29
29
|
Tomatoes, Metacritic… with your own API keys), seasons and episodes with their own pages,
|
|
30
30
|
*Cast & more*, *More like this* and collections.
|
|
31
31
|
- **The player:** resume where you stopped, skip intros, recaps and credits, next episode,
|
|
32
|
-
subtitles (addons', the file's own, and your own files
|
|
32
|
+
subtitles (addons', the file's own, and your own files) with your choice of look, audio
|
|
33
33
|
tracks remembered, switching source mid-playback, private viewing.
|
|
34
34
|
- **IPTV and radio** from your M3U playlists, Xtream accounts and Stalker portals (with their
|
|
35
35
|
films and series), with CH+ / CH−.
|
|
36
36
|
- **YouTube:** live channels, trailers, and your own YouTube channels, playlists and searches,
|
|
37
37
|
with SponsorBlock, DeArrow, chapters and captions.
|
|
38
|
-
- **Local:** the videos on a USB drive, matched to their titles.
|
|
38
|
+
- **Local:** the videos on a USB drive or a network folder (WebDAV), matched to their titles.
|
|
39
39
|
- **Jellyfin, Emby and Plex:** your server's libraries on Home, its files as sources.
|
|
40
40
|
- **Torrents**, through Stremio's streaming server or a TorrServer you run on your network.
|
|
41
41
|
- **Made for the remote:** D-pad navigation throughout; ▶ Play on a movie, episode or channel plays
|
|
@@ -46,8 +46,9 @@ video through Samsung's AVPlay API.
|
|
|
46
46
|
|
|
47
47
|
Three ways, all covered step by step in the **[installation guide](docs/INSTALL.md)**:
|
|
48
48
|
|
|
49
|
-
- **TizenBrew** (Tizen 3.0 to 6.0): add the NPM module `stremiok`. No certificate needed
|
|
50
|
-
|
|
49
|
+
- **TizenBrew** (Tizen 3.0 to 6.0): add the NPM module `stremiok`. No certificate needed, but
|
|
50
|
+
[Web Player is limited](docs/INSTALL.md#tizenbrew-has-no-tv-player) (ie: no audio switching), and
|
|
51
|
+
storage shared with other modules.
|
|
51
52
|
- **Apps2Samsung:** installs a [release](https://github.com/Kepler75/StremioK/releases)'s
|
|
52
53
|
`.wgt`, signing it with your own Samsung certificate. No Tizen Studio needed.
|
|
53
54
|
- **Tizen Studio:** build the `.wgt` from this repository and sideload it.
|
|
@@ -60,10 +61,11 @@ Three ways, all covered step by step in the **[installation guide](docs/INSTALL.
|
|
|
60
61
|
titles playable.
|
|
61
62
|
2. **API keys**, optional: your own TMDB, OMDb and MDBList keys add ratings, *Cast & more*,
|
|
62
63
|
*where to watch* and episode trailers.
|
|
63
|
-
3. **Trakt**, optional: connect
|
|
64
|
+
3. **Trakt** or **Stremio**, optional: connect to share watched marks and Continue Watching.
|
|
64
65
|
4. **IPTV**, optional: your M3U playlist links, an Xtream account (its server, username and
|
|
65
66
|
password) or a Stalker portal (its address and MAC address).
|
|
66
|
-
5. **A USB drive**, optional: plug
|
|
67
|
+
5. **A USB drive or network folder**, optional: plug a drive in, or add a WebDAV folder; the
|
|
68
|
+
Local tab appears.
|
|
67
69
|
|
|
68
70
|
[Getting started](docs/USER-GUIDE.md#getting-started) in the user guide walks through each.
|
|
69
71
|
|
|
@@ -94,10 +96,10 @@ responsibility.
|
|
|
94
96
|
|
|
95
97
|
- AVPlay behavior varies by TV generation, codec and HLS provider.
|
|
96
98
|
- Torrents play only through a streaming server you run on your network.
|
|
97
|
-
-
|
|
98
|
-
|
|
99
|
+
- Under TizenBrew there's no TV player (only the `.wgt` has it): one audio track per file, no
|
|
100
|
+
built-in subtitle tracks, no PlayReady or Widevine channels; opening apps depends on TizenBrew.
|
|
99
101
|
- No StremioK account and no profiles: settings, addons and progress stay on the TV. The
|
|
100
|
-
only
|
|
102
|
+
only syncs are optional: Trakt and your Stremio account.
|
|
101
103
|
- Subtitles use an HTML overlay; gzipped (`.gz`) subtitle files aren't decoded.
|
|
102
104
|
- No playback speed control (the TV's player mutes audio at other speeds), and no
|
|
103
105
|
HDR / frame-rate mode switching (not available to web apps on Tizen 3).
|
|
@@ -105,8 +107,7 @@ responsibility.
|
|
|
105
107
|
opens a one-time page StremioK serves on your home network. It's plain HTTP (unencrypted),
|
|
106
108
|
so use it only on a network you trust, since addon and playlist links often carry tokens.
|
|
107
109
|
- "Where to watch" sources open the app on its home screen, or on the title only where an
|
|
108
|
-
addon you added gives the app's own link and the app takes it.
|
|
109
|
-
depends on what TizenBrew allows its modules; the `.wgt` has the permission.
|
|
110
|
+
addon you added gives the app's own link and the app takes it.
|
|
110
111
|
- YouTube channels and trailers depend on the bundled service and on YouTube's
|
|
111
112
|
undocumented behavior, so YouTube changes may need resolver updates.
|
|
112
113
|
|
|
@@ -124,5 +125,5 @@ the [ODbL 1.0](https://opendatacommons.org/licenses/odbl/1-0/) (see its
|
|
|
124
125
|
reads it through SkipDB's public API and keeps none of it.
|
|
125
126
|
|
|
126
127
|
`js/qrcode.js` is [qrcode-generator](https://github.com/kazuhikoarase/qrcode-generator) by
|
|
127
|
-
Kazuhiko Arase (MIT), unchanged; it draws the TV's QR codes (
|
|
128
|
-
|
|
128
|
+
Kazuhiko Arase (MIT), unchanged; it draws the TV's QR codes (sign-ins, entering text from your
|
|
129
|
+
phone, Continue on phone, an addon's Share and Configure).
|
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.3.
|
|
3
|
+
id="http://stremiok.tizen/StremioKTizen" version="2.3.4" 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
CHANGED
|
@@ -85,6 +85,7 @@ body.look-modern #screen-home .row-title { margin: 0 0 4px 90px; } /* (Home: i
|
|
|
85
85
|
body.look-modern #screen-home .row-scroller { padding: 26px 90px; }
|
|
86
86
|
body.look-modern .card { border: 0; border-radius: 16px; background: rgba(255,255,255,0.07); margin-right: 26px; }
|
|
87
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.person-card .cap { max-height: none; padding-top: 16px; } /* (a person's: as tall as name and role need; style.css) */
|
|
88
89
|
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
90
|
body.look-modern .card.focusable.moving { border: 0; box-shadow: 0 0 0 4px #f59e0b; }
|
|
90
91
|
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; }
|
package/css/style.css
CHANGED
|
@@ -442,8 +442,11 @@ html, body {
|
|
|
442
442
|
.more-panel { top: 440px; left: 0; right: 0; bottom: 0; }
|
|
443
443
|
.more-rows { position: absolute; top: 0; left: 0; right: 0; bottom: 0; overflow: hidden; }
|
|
444
444
|
.card.person-card { width: 150px; height: 225px; }
|
|
445
|
-
|
|
446
|
-
|
|
445
|
+
/* A person's caption: the name in up to two lines, the role in one ("…" past it), the caption as
|
|
446
|
+
tall as they need (a fixed height cut the role off under a two-line name). */
|
|
447
|
+
.card.person-card .cap { max-height: none; padding-top: 18px; }
|
|
448
|
+
.card .cap .cap-name { font-weight: bold; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
|
|
449
|
+
.card .cap .cap-sub { font-size: 15px; color: #c7cbd4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
447
450
|
.person-photo { position: absolute; top: 116px; right: 80px; width: 220px; height: 330px; border-radius: 12px; background-size: cover; background-position: center top; }
|
|
448
451
|
|
|
449
452
|
/* --- Episode ratings grid --- */
|
package/index.html
CHANGED
|
@@ -4,8 +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.3.
|
|
8
|
-
<link rel="stylesheet" href="css/modern.css?v=2.3.
|
|
7
|
+
<link rel="stylesheet" href="css/style.css?v=2.3.4">
|
|
8
|
+
<link rel="stylesheet" href="css/modern.css?v=2.3.4">
|
|
9
9
|
</head>
|
|
10
10
|
<body>
|
|
11
11
|
<!-- CSS-applied sentinel (kept off-screen); app.js waits for its width before rendering -->
|
|
@@ -54,41 +54,43 @@
|
|
|
54
54
|
|
|
55
55
|
<!-- Load order matters: polyfills -> util -> iptv -> data -> input -> tvapps -> player parts -> player -> ytplay -> view parts -> views -> app -->
|
|
56
56
|
<!-- ?v= busts the TV webview cache on every release (keep in sync with package.json) -->
|
|
57
|
-
<script src="js/polyfills.js?v=2.3.
|
|
58
|
-
<script src="js/util.js?v=2.3.
|
|
59
|
-
<script src="js/iptv.js?v=2.3.
|
|
60
|
-
<script src="js/xtvod.js?v=2.3.
|
|
61
|
-
<script src="js/stvod.js?v=2.3.
|
|
62
|
-
<script src="js/jellyfin.js?v=2.3.
|
|
63
|
-
<script src="js/plex.js?v=2.3.
|
|
64
|
-
<script src="js/epg.js?v=2.3.
|
|
65
|
-
<script src="js/youtube.js?v=2.3.
|
|
66
|
-
<script src="js/stremio.js?v=2.3.
|
|
67
|
-
<script src="js/trakt.js?v=2.3.
|
|
68
|
-
<script src="js/keys.js?v=2.3.
|
|
69
|
-
<script src="js/focus.js?v=2.3.
|
|
70
|
-
<script src="js/tvapps.js?v=2.3.
|
|
71
|
-
<script src="js/player-core.js?v=2.3.
|
|
72
|
-
<script src="js/player-store.js?v=2.3.
|
|
73
|
-
<script src="js/player-lang.js?v=2.3.
|
|
74
|
-
<script src="js/player-quality.js?v=2.3.
|
|
75
|
-
<script src="js/player-subs.js?v=2.3.
|
|
76
|
-
<script src="js/player-audio.js?v=2.3.
|
|
77
|
-
<script src="js/player-controls.js?v=2.3.
|
|
78
|
-
<script src="js/player.js?v=2.3.
|
|
79
|
-
<script src="js/ytplay.js?v=2.3.
|
|
80
|
-
<script src="js/
|
|
81
|
-
<script src="js/
|
|
82
|
-
<script src="js/
|
|
83
|
-
<script src="js/
|
|
84
|
-
<script src="js/
|
|
85
|
-
<script src="js/view-
|
|
86
|
-
<script src="js/view-
|
|
87
|
-
<script src="js/view-
|
|
88
|
-
<script src="js/view-
|
|
89
|
-
<script src="js/view-
|
|
90
|
-
<script src="js/
|
|
91
|
-
<script src="js/
|
|
92
|
-
<script src="js/
|
|
57
|
+
<script src="js/polyfills.js?v=2.3.4"></script>
|
|
58
|
+
<script src="js/util.js?v=2.3.4"></script>
|
|
59
|
+
<script src="js/iptv.js?v=2.3.4"></script>
|
|
60
|
+
<script src="js/xtvod.js?v=2.3.4"></script>
|
|
61
|
+
<script src="js/stvod.js?v=2.3.4"></script>
|
|
62
|
+
<script src="js/jellyfin.js?v=2.3.4"></script>
|
|
63
|
+
<script src="js/plex.js?v=2.3.4"></script>
|
|
64
|
+
<script src="js/epg.js?v=2.3.4"></script>
|
|
65
|
+
<script src="js/youtube.js?v=2.3.4"></script>
|
|
66
|
+
<script src="js/stremio.js?v=2.3.4"></script>
|
|
67
|
+
<script src="js/trakt.js?v=2.3.4"></script>
|
|
68
|
+
<script src="js/keys.js?v=2.3.4"></script>
|
|
69
|
+
<script src="js/focus.js?v=2.3.4"></script>
|
|
70
|
+
<script src="js/tvapps.js?v=2.3.4"></script>
|
|
71
|
+
<script src="js/player-core.js?v=2.3.4"></script>
|
|
72
|
+
<script src="js/player-store.js?v=2.3.4"></script>
|
|
73
|
+
<script src="js/player-lang.js?v=2.3.4"></script>
|
|
74
|
+
<script src="js/player-quality.js?v=2.3.4"></script>
|
|
75
|
+
<script src="js/player-subs.js?v=2.3.4"></script>
|
|
76
|
+
<script src="js/player-audio.js?v=2.3.4"></script>
|
|
77
|
+
<script src="js/player-controls.js?v=2.3.4"></script>
|
|
78
|
+
<script src="js/player.js?v=2.3.4"></script>
|
|
79
|
+
<script src="js/ytplay.js?v=2.3.4"></script>
|
|
80
|
+
<script src="js/netfolders.js?v=2.3.4"></script>
|
|
81
|
+
<script src="js/local.js?v=2.3.4"></script>
|
|
82
|
+
<script src="js/downloads.js?v=2.3.4"></script>
|
|
83
|
+
<script src="js/stremio-account.js?v=2.3.4"></script>
|
|
84
|
+
<script src="js/stremio-sync.js?v=2.3.4"></script>
|
|
85
|
+
<script src="js/view-core.js?v=2.3.4"></script>
|
|
86
|
+
<script src="js/view-home.js?v=2.3.4"></script>
|
|
87
|
+
<script src="js/view-guide.js?v=2.3.4"></script>
|
|
88
|
+
<script src="js/view-detail.js?v=2.3.4"></script>
|
|
89
|
+
<script src="js/view-search.js?v=2.3.4"></script>
|
|
90
|
+
<script src="js/view-settings.js?v=2.3.4"></script>
|
|
91
|
+
<script src="js/view-discover.js?v=2.3.4"></script>
|
|
92
|
+
<script src="js/views.js?v=2.3.4"></script>
|
|
93
|
+
<script src="js/app.js?v=2.3.4"></script>
|
|
94
|
+
<script src="js/hubpreview.js?v=2.3.4"></script>
|
|
93
95
|
</body>
|
|
94
96
|
</html>
|
package/js/app.js
CHANGED
|
@@ -270,6 +270,10 @@ var App = (function () {
|
|
|
270
270
|
if (typeof Trakt !== 'undefined' && Trakt.isConnected()) {
|
|
271
271
|
Trakt.refreshCaches().then(function () { if (_current === 'home') { Views.renderHome(); } });
|
|
272
272
|
}
|
|
273
|
+
// ...and your Stremio account, both ways (js/stremio-sync.js).
|
|
274
|
+
if (typeof StremioSync !== 'undefined' && StremioSync.isConnected()) {
|
|
275
|
+
StremioSync.sync().then(function () { if (_current === 'home' && !Player.isActive()) { Views.renderHome(); } });
|
|
276
|
+
}
|
|
273
277
|
serverMarks();
|
|
274
278
|
}
|
|
275
279
|
// Your media servers' watched marks: read at launch, when a server is added, reloaded or
|
package/js/jellyfin.js
CHANGED
|
@@ -23,7 +23,8 @@ var Jellyfin = (function () {
|
|
|
23
23
|
'use strict';
|
|
24
24
|
|
|
25
25
|
var KEY = 'stremiok.jellyfin.servers', DEV_KEY = 'stremiok.jellyfin.device', LIBS_KEY = 'stremiok.jellyfin.libs';
|
|
26
|
-
var PAGE = 100, INDEX_FRESH_MS = 30 * 60000, INDEX_RETRY_MS = 60000, LIBS_FRESH_MS = 86400000;
|
|
26
|
+
var PAGE = 100, INDEX_FRESH_MS = 30 * 60000, INDEX_RETRY_MS = 60000, INDEX_SLOW_MS = 30 * 60000, LIBS_FRESH_MS = 86400000;
|
|
27
|
+
var INDEX_PAGE = 2000, INDEX_PAGES = 25; // (a server's list read 2,000 titles at a time, 50,000 at most: see pages)
|
|
27
28
|
var QC_EVERY = 3000, QC_FOR = 10 * 60000, REPORT_EVERY = 60000, TICKS = 10000000;
|
|
28
29
|
var _changeFns = [];
|
|
29
30
|
function onChange(fn) { _changeFns.push(fn); }
|
|
@@ -283,7 +284,7 @@ var Jellyfin = (function () {
|
|
|
283
284
|
kind = KINDS[kind] ? kind : 'jellyfin';
|
|
284
285
|
if (!_addons[kind]) {
|
|
285
286
|
_addons[kind] = { __local: true, __sources: true, url: 'local:' + kind, base: 'local:' + kind,
|
|
286
|
-
__impl: { catalog: catalog, meta: meta, streams: function (type, id) { return streams(type, id, kind); } },
|
|
287
|
+
__impl: { catalog: catalog, meta: meta, streams: function (type, id, m) { return streams(type, id, kind, m); } },
|
|
287
288
|
manifest: { id: 'org.stremiok.' + kind, name: KINDS[kind].name, version: '1.0.0', types: ['movie', 'series'], resources: RESOURCES, catalogs: [] } };
|
|
288
289
|
}
|
|
289
290
|
fillCatalogs(kind);
|
|
@@ -406,27 +407,62 @@ var Jellyfin = (function () {
|
|
|
406
407
|
// ---- Which titles each server has (for titles from your addons) ----
|
|
407
408
|
// type|tt… and type|tmdb:… -> its item ids; read when first asked, kept INDEX_FRESH_MS (the
|
|
408
409
|
// old list answers while a new one is read).
|
|
410
|
+
// A list is read a page at a time (page(start) -> a Promise of that page's items), INDEX_PAGE
|
|
411
|
+
// titles a page, each with the server's own wait, until a page comes short, INDEX_PAGES at
|
|
412
|
+
// most: { items, part } (part: not all of it: more than that, or a page after the first that
|
|
413
|
+
// didn't come, its error in part.e). The first page not coming: the whole read fails.
|
|
414
|
+
function pages(page) {
|
|
415
|
+
var items = [];
|
|
416
|
+
function next(n) {
|
|
417
|
+
return page(n * INDEX_PAGE).then(function (l) {
|
|
418
|
+
items = items.concat(l);
|
|
419
|
+
if (l.length < INDEX_PAGE) { return { items: items, part: null }; }
|
|
420
|
+
if (n + 1 >= INDEX_PAGES) { return { items: items, part: { more: true } }; }
|
|
421
|
+
return next(n + 1);
|
|
422
|
+
}, function (e) {
|
|
423
|
+
if (!n) { throw e; }
|
|
424
|
+
return { items: items, part: { e: e } };
|
|
425
|
+
});
|
|
426
|
+
}
|
|
427
|
+
return next(0);
|
|
428
|
+
}
|
|
409
429
|
var _index = {};
|
|
410
430
|
function index(srv) {
|
|
411
431
|
var x = _index[srv.id];
|
|
412
432
|
if (x && x.map && (x.p || Date.now() - x.at < INDEX_FRESH_MS)) { return Promise.resolve(x.map); }
|
|
413
433
|
if (x && x.p) { return x.p; }
|
|
414
|
-
var p =
|
|
434
|
+
var p = pages(function (start) {
|
|
435
|
+
return get(srv, K(srv).items(uid(srv)) + 'recursive=true&includeItemTypes=Movie,Series&fields=ProviderIds&enableImages=false&enableUserData=true&enableTotalRecordCount=false' +
|
|
436
|
+
'&sortBy=SortName&sortOrder=Ascending&startIndex=' + start + '&limit=' + INDEX_PAGE, 8 * 1048576).then(function (r) { return U.listOf(r && r.Items, INDEX_PAGE); });
|
|
437
|
+
}).then(function (got) {
|
|
415
438
|
var map = { __ids: {}, __tm: {}, __played: [] }; // (__ids, __tm: an item's IMDb, TMDB id, for Next up's cards and watched marks; __played: its played films and shows)
|
|
416
439
|
function add(k, v) { (map[k] = map[k] || []).push(v); }
|
|
417
|
-
|
|
440
|
+
got.items.forEach(function (it) {
|
|
418
441
|
var t = it.Type === 'Movie' ? 'movie' : it.Type === 'Series' ? 'series' : '', tt = imdbOf(it), tm = tmdbOf(it);
|
|
419
442
|
if (!t || !it.Id) { return; }
|
|
420
443
|
if (tt) { add(t + '|' + tt, '' + it.Id); map.__ids['' + it.Id] = tt; }
|
|
421
444
|
if (tm) { add(t + '|tmdb:' + tm, '' + it.Id); map.__tm['' + it.Id] = tm; }
|
|
422
445
|
if (it.UserData && it.UserData.Played) { map.__played.push({ t: t, ids: titleIds(map, (t === 'movie' ? 'jfm.' : 'jfs.') + srv.id + '.', '' + it.Id), at: Date.parse(it.UserData.LastPlayedDate || '') || 1 }); }
|
|
423
446
|
});
|
|
424
|
-
|
|
447
|
+
// Not all of it (__part): titles looked up by name too (idsFor). A page that didn't come:
|
|
448
|
+
// the list read again as a failed one would be (in a minute; timed out: in 30).
|
|
449
|
+
var at = Date.now();
|
|
450
|
+
if (got.part) {
|
|
451
|
+
map.__part = true;
|
|
452
|
+
if (got.part.e) {
|
|
453
|
+
U.log('jellyfin', '“' + srv.name + '” (' + kindName(srv) + '): only ' + got.items.length + ' of its titles read (' + U.problem(got.part.e) + ')');
|
|
454
|
+
at -= INDEX_FRESH_MS - (/Timed out/i.test(got.part.e.message || '') ? INDEX_SLOW_MS : INDEX_RETRY_MS);
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
if (_index[srv.id] && _index[srv.id].p === p) { _index[srv.id] = { at: at, map: map }; }
|
|
425
458
|
return map;
|
|
426
459
|
}, function (e) {
|
|
427
460
|
U.log('jellyfin', '“' + srv.name + '” (' + kindName(srv) + '): its titles couldn’t be read (' + U.problem(e) + ')');
|
|
428
461
|
var old = _index[srv.id], map = (old && old.map) || { __ids: {}, __tm: {}, __played: [], __err: true }; // (__err: never read)
|
|
429
|
-
|
|
462
|
+
// (asked again in a minute; one that timed out — a list too big or slow for one answer, as a server
|
|
463
|
+
// presenting a whole catalog has — after 30 minutes, titles looked up one at a time meanwhile: idsFor)
|
|
464
|
+
var slow = /Timed out/i.test((e && e.message) || '');
|
|
465
|
+
if (old && old.p === p) { _index[srv.id] = { at: Date.now() - INDEX_FRESH_MS + (slow ? INDEX_SLOW_MS : INDEX_RETRY_MS), map: map }; }
|
|
430
466
|
return map;
|
|
431
467
|
});
|
|
432
468
|
_index[srv.id] = { at: x ? x.at : 0, map: x ? x.map : null, p: p };
|
|
@@ -441,7 +477,48 @@ var Jellyfin = (function () {
|
|
|
441
477
|
if (map.__tm && map.__tm[id]) { l.push('tmdb:' + map.__tm[id]); }
|
|
442
478
|
return l;
|
|
443
479
|
}
|
|
444
|
-
|
|
480
|
+
// A title the server's list can't give (never read, or not all of it: too big or slow, as a
|
|
481
|
+
// server presenting a whole catalog is): searched for by its name, taken only when its IMDb or
|
|
482
|
+
// TMDB id is the one asked for. Kept FOUND_MS (a failed search: asked again next time).
|
|
483
|
+
var FOUND_MS = 30 * 60000, _found = U.lru(300);
|
|
484
|
+
function lookup(srv, type, key, name) {
|
|
485
|
+
name = ('' + (name || '')).replace(/\s+/g, ' ').trim().slice(0, 100);
|
|
486
|
+
if (!name) { return Promise.resolve([]); }
|
|
487
|
+
var k = srv.id + '|' + type + '|' + key, had = _found.get(k);
|
|
488
|
+
if (had && had.p && Date.now() - had.at < FOUND_MS) { return had.p; }
|
|
489
|
+
var p = get(srv, K(srv).items(uid(srv)) + 'recursive=true&includeItemTypes=' + (type === 'movie' ? 'Movie' : 'Series') + '&searchTerm=' + enc(name) +
|
|
490
|
+
'&fields=ProviderIds&enableImages=false&enableUserData=false&limit=40').then(function (r) {
|
|
491
|
+
return U.listOf(r && r.Items, 40, function (it) { return it && it.Id && (imdbOf(it) === key || (!!tmdbOf(it) && 'tmdb:' + tmdbOf(it) === key)); }).map(function (it) { return '' + it.Id; });
|
|
492
|
+
}, function (e) {
|
|
493
|
+
_found.set(k, null);
|
|
494
|
+
U.log('jellyfin', '“' + srv.name + '”: “' + name + '” couldn’t be looked up (' + U.problem(e) + ')');
|
|
495
|
+
return [];
|
|
496
|
+
});
|
|
497
|
+
_found.set(k, { at: Date.now(), p: p });
|
|
498
|
+
return p;
|
|
499
|
+
}
|
|
500
|
+
// The server's items for a title: from its list, as before; with no list yet, none to be had or
|
|
501
|
+
// not all of it, looked up by name meanwhile (lookup), the list's answer used when that finds none.
|
|
502
|
+
function idsFor(srv, type, key, name) {
|
|
503
|
+
var x = _index[srv.id];
|
|
504
|
+
var fromList = index(srv).then(function (map) { return map[type + '|' + key] || []; });
|
|
505
|
+
if (x && x.map && !x.map.__err && !x.map.__part) { return fromList; }
|
|
506
|
+
return lookup(srv, type, key, name).then(function (ids) { return ids.length ? ids : fromList; });
|
|
507
|
+
}
|
|
508
|
+
// A film or episode listed without its files (a server presenting remote ones gives them only
|
|
509
|
+
// when asked to play it: PlaybackInfo): asked for them then.
|
|
510
|
+
function withFiles(srv, it) {
|
|
511
|
+
if (!it || !it.Id || (it.MediaSources && it.MediaSources.length)) { return Promise.resolve(it); }
|
|
512
|
+
return U.getJSON(api(srv) + '/Items/' + enc(it.Id) + '/PlaybackInfo?userId=' + uid(srv), waitMs(), 8 * 1048576, null, headers(srv, srv.token, true), '{}').then(function (r) {
|
|
513
|
+
var l = U.listOf(r && r.MediaSources, 200, function (ms) { return ms && ms.Id; });
|
|
514
|
+
return l.length ? Object.assign({}, it, { MediaSources: l }) : it;
|
|
515
|
+
}, function (e) {
|
|
516
|
+
U.log('jellyfin', '“' + srv.name + '”: the files of “' + (it.Name || it.Id) + '” couldn’t be read (' + U.problem(e) + ')');
|
|
517
|
+
return it;
|
|
518
|
+
});
|
|
519
|
+
}
|
|
520
|
+
function filesOf(srv, it) { return withFiles(srv, it).then(function (x) { return sourcesOf(srv, x); }); }
|
|
521
|
+
function copies(type, id, kind, meta) {
|
|
445
522
|
var key = '', season = null, episode = null;
|
|
446
523
|
if (type === 'movie') { key = /^(tt\d+|tmdb:\d+)$/.test('' + id) ? '' + id : ''; }
|
|
447
524
|
else if (type === 'series') {
|
|
@@ -449,10 +526,11 @@ var Jellyfin = (function () {
|
|
|
449
526
|
if (mm) { key = mm[1]; season = +mm[2]; episode = +mm[3]; }
|
|
450
527
|
}
|
|
451
528
|
if (!key) { return Promise.resolve([]); }
|
|
529
|
+
var name = meta && typeof meta.name === 'string' ? meta.name : '';
|
|
452
530
|
return Promise.all(servers(kind).map(function (srv) {
|
|
453
|
-
return
|
|
454
|
-
return Promise.all(
|
|
455
|
-
return type === 'movie' ? item(srv, iid).then(function (it) { return
|
|
531
|
+
return idsFor(srv, type, key, name).then(function (ids) {
|
|
532
|
+
return Promise.all(ids.slice(0, 3).map(function (iid) {
|
|
533
|
+
return type === 'movie' ? item(srv, iid).then(function (it) { return filesOf(srv, it); }, none) : episodeSources(srv, iid, season, episode);
|
|
456
534
|
}));
|
|
457
535
|
}).then(flat, none);
|
|
458
536
|
})).then(flat);
|
|
@@ -763,24 +841,25 @@ var Jellyfin = (function () {
|
|
|
763
841
|
}
|
|
764
842
|
function sourcesOf(srv, it) {
|
|
765
843
|
if (!it || !it.Id) { return []; }
|
|
766
|
-
return U.listOf(it.MediaSources,
|
|
844
|
+
return U.listOf(it.MediaSources, 16, function (ms) { return ms.Id; }).map(function (ms) { return source(srv, it, ms); });
|
|
767
845
|
}
|
|
768
846
|
function episodeSources(srv, sid, season, episode) {
|
|
769
847
|
return episodes(srv, sid).then(function (eps) {
|
|
770
848
|
var e = eps.filter(function (x) { return x.season === season && x.episode === episode; })[0];
|
|
771
|
-
return e ?
|
|
772
|
-
}, none);
|
|
849
|
+
return e ? filesOf(srv, e.it) : [];
|
|
850
|
+
}).then(null, none);
|
|
773
851
|
}
|
|
774
852
|
// A title's sources: its own (jfm / jfs ids), or the servers' copies (of that kind: each
|
|
775
853
|
// kind's addon asks for its own) of a title from your addons.
|
|
776
|
-
|
|
854
|
+
// meta: the title's details (its name: lookup).
|
|
855
|
+
function streams(type, id, kind, meta) {
|
|
777
856
|
var x = parseId(id);
|
|
778
857
|
if (x) {
|
|
779
858
|
if (!x.srv) { return Promise.resolve([]); }
|
|
780
|
-
if (x.kind === 'm') { return item(x.srv, x.item).then(function (it) { return
|
|
859
|
+
if (x.kind === 'm') { return item(x.srv, x.item).then(function (it) { return filesOf(x.srv, it); }).then(null, none); }
|
|
781
860
|
return x.season != null ? episodeSources(x.srv, x.item, x.season, x.episode) : Promise.resolve([]);
|
|
782
861
|
}
|
|
783
|
-
return copies(type, id, kind);
|
|
862
|
+
return copies(type, id, kind, meta);
|
|
784
863
|
}
|
|
785
864
|
function isJellyfinId(id) { return /^jf[ms]\./.test('' + id); }
|
|
786
865
|
function nameOfId(id) { var x = parseId(id); return x && x.srv ? kindName(x.srv) : 'Jellyfin'; }
|
|
@@ -827,6 +906,6 @@ var Jellyfin = (function () {
|
|
|
827
906
|
signIn: signIn, quickConnect: quickConnect, remove: remove, reload: reload, libraries: libsOf, synthAddon: synthAddon, synthAddons: synthAddons, kindsOn: kindsOn,
|
|
828
907
|
kindName: kindName, nameOfId: nameOfId, catalog: catalog, meta: meta, streams: streams, isJellyfinId: isJellyfinId, onPlayer: onPlayer, resumeFor: resumeFor,
|
|
829
908
|
segments: segments, trickplayAt: trickplayAt, waitMs: waitMs, sourceKind: sourceKind, refreshMarks: refreshMarks, watchedAt: watchedAt,
|
|
830
|
-
shared: { chapterSegments: chapterSegments, namedChapters: namedChapters, marksFrom: marksFrom } // (Plex's chapters
|
|
909
|
+
shared: { chapterSegments: chapterSegments, namedChapters: namedChapters, marksFrom: marksFrom, pages: pages, INDEX_PAGE: INDEX_PAGE } // (Plex's chapters, watched marks and lists read the same way)
|
|
831
910
|
};
|
|
832
911
|
})();
|