nuvio-tizen 1.8.3 → 1.8.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/index.html CHANGED
@@ -4,7 +4,7 @@
4
4
  <meta charset="utf-8">
5
5
  <meta name="viewport" content="width=1920, height=1080, user-scalable=no">
6
6
  <title>Nuvio</title>
7
- <link rel="stylesheet" href="css/style.css?v=1.8.3">
7
+ <link rel="stylesheet" href="css/style.css?v=1.8.4">
8
8
  </head>
9
9
  <body>
10
10
  <!-- CSS-applied sentinel (kept off-screen); app.js waits for its width before rendering -->
@@ -47,13 +47,13 @@
47
47
 
48
48
  <!-- Load order matters: polyfills -> util -> data -> input -> player -> views -> app -->
49
49
  <!-- ?v= busts the TV webview cache on every release (keep in sync with package.json) -->
50
- <script src="js/polyfills.js?v=1.8.3"></script>
51
- <script src="js/util.js?v=1.8.3"></script>
52
- <script src="js/stremio.js?v=1.8.3"></script>
53
- <script src="js/keys.js?v=1.8.3"></script>
54
- <script src="js/focus.js?v=1.8.3"></script>
55
- <script src="js/player.js?v=1.8.3"></script>
56
- <script src="js/views.js?v=1.8.3"></script>
57
- <script src="js/app.js?v=1.8.3"></script>
50
+ <script src="js/polyfills.js?v=1.8.4"></script>
51
+ <script src="js/util.js?v=1.8.4"></script>
52
+ <script src="js/stremio.js?v=1.8.4"></script>
53
+ <script src="js/keys.js?v=1.8.4"></script>
54
+ <script src="js/focus.js?v=1.8.4"></script>
55
+ <script src="js/player.js?v=1.8.4"></script>
56
+ <script src="js/views.js?v=1.8.4"></script>
57
+ <script src="js/app.js?v=1.8.4"></script>
58
58
  </body>
59
59
  </html>
package/js/stremio.js CHANGED
@@ -63,7 +63,7 @@ var Stremio = (function () {
63
63
 
64
64
  function getIntegrations() {
65
65
  var o = U.store.get(INTEG_KEY, {}) || {};
66
- return { tmdb: o.tmdb || '', mdblist: o.mdblist || '', theintrodb: o.theintrodb || '' };
66
+ return { omdb: o.omdb || '', tmdb: o.tmdb || '', mdblist: o.mdblist || '', theintrodb: o.theintrodb || '' };
67
67
  }
68
68
  function setIntegration(key, val) {
69
69
  var o = getIntegrations();
@@ -301,6 +301,36 @@ var Stremio = (function () {
301
301
  }, function () { _tmdbSeasonCache[ck] = null; return null; });
302
302
  }
303
303
 
304
+ // ---- OMDb (real IMDb per-episode ratings) ----
305
+ var _omdbCache = {};
306
+ function omdbKey() { return getIntegrations().omdb; }
307
+
308
+ function omdbValidate(key) {
309
+ if (!key) { return Promise.resolve(false); }
310
+ return U.getJSON('https://www.omdbapi.com/?apikey=' + encodeURIComponent(key) + '&i=tt0111161', 8000)
311
+ .then(function (r) { return !!(r && r.Response === 'True'); }, function () { return false; });
312
+ }
313
+
314
+ // One request per season → { episodeNumber: imdbRatingString }.
315
+ function omdbSeasonRatings(seriesImdb, season) {
316
+ var key = omdbKey();
317
+ if (!key || !seriesImdb) { return Promise.resolve(null); }
318
+ var ck = seriesImdb + ':' + season;
319
+ if (_omdbCache[ck] !== undefined) { return Promise.resolve(_omdbCache[ck]); }
320
+ return U.getJSON('https://www.omdbapi.com/?apikey=' + encodeURIComponent(key) +
321
+ '&i=' + encodeURIComponent(seriesImdb) + '&Season=' + encodeURIComponent(season), 12000)
322
+ .then(function (r) {
323
+ var map = {};
324
+ if (r && r.Episodes) {
325
+ r.Episodes.forEach(function (ep) {
326
+ var n = parseInt(ep.Episode, 10);
327
+ if (!isNaN(n) && ep.imdbRating && ep.imdbRating !== 'N/A') { map[n] = ep.imdbRating; }
328
+ });
329
+ }
330
+ _omdbCache[ck] = map; return map;
331
+ }, function () { _omdbCache[ck] = null; return null; });
332
+ }
333
+
304
334
  // ---- Skip segments (TheIntroDB) ----
305
335
  // GET https://api.theintrodb.org/v3/media?imdb_id=tt..[&season=&episode=][&duration_ms=]
306
336
  // Returns { intro, recap, credits, preview } arrays of {start,end} in seconds (null = open).
@@ -416,8 +446,9 @@ var Stremio = (function () {
416
446
  getAddonUrls: getAddonUrls, addAddon: addAddon, removeAddon: removeAddon, resetAddons: resetAddons,
417
447
  getIntegrations: getIntegrations, setIntegration: setIntegration, getPrefs: getPrefs, setPref: setPref,
418
448
  getIntroSegments: getIntroSegments,
419
- tmdbValidate: tmdbValidate, mdblistValidate: mdblistValidate,
449
+ tmdbValidate: tmdbValidate, mdblistValidate: mdblistValidate, omdbValidate: omdbValidate,
420
450
  tmdbFindTvId: tmdbFindTvId, tmdbSeasonEpisodes: tmdbSeasonEpisodes, tmdbImg: tmdbImg,
451
+ omdbSeasonRatings: omdbSeasonRatings,
421
452
  loadAddons: loadAddons, listCatalogs: listCatalogs, getCatalog: getCatalog,
422
453
  getMeta: getMeta, getStreams: getStreams, getSubtitles: getSubtitles,
423
454
  getSearchCatalogs: getSearchCatalogs, search: search,
package/js/views.js CHANGED
@@ -356,9 +356,21 @@ var Views = (function () {
356
356
  });
357
357
  panel.appendChild(listScroll);
358
358
 
359
- // Enrich with TMDB episode images + ratings (one request per season) if a key is set.
360
- if (Stremio.getIntegrations().tmdb) {
361
- var seasonAtFetch = _d.season;
359
+ // Enrich episodes (one request per season each). Rating source priority:
360
+ // OMDb (real IMDb) when its key is set, else TMDB vote_average. Images come from TMDB.
361
+ var integ = Stremio.getIntegrations();
362
+ var seasonAtFetch = _d.season;
363
+
364
+ if (integ.omdb) {
365
+ Stremio.omdbSeasonRatings(_d.id, seasonAtFetch).then(function (map) {
366
+ if (!map || _d.season !== seasonAtFetch) { return; }
367
+ epRefs.forEach(function (r) {
368
+ var rt = map[r.num];
369
+ if (rt) { r.rating.textContent = ' ★ ' + rt + ' IMDb'; }
370
+ });
371
+ });
372
+ }
373
+ if (integ.tmdb) {
362
374
  Stremio.tmdbFindTvId(_d.id).then(function (tvId) {
363
375
  if (!tvId || _d.season !== seasonAtFetch) { return; }
364
376
  return Stremio.tmdbSeasonEpisodes(tvId, seasonAtFetch).then(function (map) {
@@ -367,7 +379,8 @@ var Views = (function () {
367
379
  var ep = map[r.num];
368
380
  if (!ep) { return; }
369
381
  if (ep.still && !r.thumb.style.backgroundImage) { r.thumb.style.backgroundImage = 'url("' + ep.still + '")'; }
370
- if (ep.rating) { r.rating.textContent = ' ' + (Math.round(ep.rating * 10) / 10); }
382
+ // TMDB rating only when OMDb isn't the configured source.
383
+ if (ep.rating && !integ.omdb) { r.rating.textContent = ' ★ ' + (Math.round(ep.rating * 10) / 10); }
371
384
  if (ep.overview && !r.ov.textContent) { r.ov.textContent = ep.overview; }
372
385
  });
373
386
  });
@@ -784,9 +797,10 @@ var Views = (function () {
784
797
 
785
798
  function settingsIntegrations(wrap) {
786
799
  wrap.appendChild(U.el('h2', null, 'Integrations'));
800
+ wrap.appendChild(keyRow('OMDb API key', 'omdb', 'OMDb API key', Stremio.omdbValidate));
787
801
  wrap.appendChild(keyRow('TMDB API key (v3)', 'tmdb', 'TMDB v3 API key', Stremio.tmdbValidate));
788
802
  wrap.appendChild(keyRow('MDBList API key', 'mdblist', 'MDBList API key', Stremio.mdblistValidate));
789
- wrap.appendChild(U.el('div', 'hint', 'Keys are stored on this TV only. TMDB enables episode images & ratings. RETURN goes back.'));
803
+ wrap.appendChild(U.el('div', 'hint', 'Keys are stored on this TV only. OMDb gives real IMDb per-episode ratings (used first when set); TMDB adds episode images & ratings. RETURN goes back.'));
790
804
  Focus.setScope(scr('settings'));
791
805
  }
792
806
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuvio-tizen",
3
- "version": "1.8.3",
3
+ "version": "1.8.4",
4
4
  "description": "Nuvio-style Stremio-addon streaming client for Tizen 3.0+ Samsung TVs (TizenBrew app module).",
5
5
  "packageType": "app",
6
6
  "appName": "Nuvio",