jaynesmax commited on
Commit
1e5e370
·
verified ·
1 Parent(s): 905b99b

Upload index.html

Browse files
Files changed (1) hide show
  1. index.html +28 -0
index.html CHANGED
@@ -1493,6 +1493,34 @@ const TRAILER_KEY = SUPABASE_ANON_KEY;
1493
 
1494
  // Chanzo kimoja cha Zilizotafsiriwa: movie-translated-all (inaunganisha old + n2 + absalom)
1495
  const TRANSLATED_ALL = JM_CONFIG.CONTENT_URL + '/functions/v1/movie-translated-all';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1496
  async function fetchTranslatedMovie(id) { // -> { ok, error?, movie } kutoka movie-translated-all
1497
  const r = await fetch(TRANSLATED_ALL + '?id=' + encodeURIComponent(id), { headers: { apikey: SUPABASE_ANON_KEY } });
1498
  const d = await r.json().catch(() => ({}));
 
1493
 
1494
  // Chanzo kimoja cha Zilizotafsiriwa: movie-translated-all (inaunganisha old + n2 + absalom)
1495
  const TRANSLATED_ALL = JM_CONFIG.CONTENT_URL + '/functions/v1/movie-translated-all';
1496
+ const TR_MODEL_URL = 'https://huggingface.co/jaynesmaxtv/translated-recommender/resolve/main/model.json';
1497
+ let trModelP = null;
1498
+ function loadTrModel() {
1499
+ if (!trModelP) trModelP = fetch(TR_MODEL_URL, { cache: 'no-cache' }).then(r => r.ok ? r.json() : null).catch(() => null);
1500
+ return trModelP;
1501
+ }
1502
+ // Rails za mlalo: Trending Now (Top 10, kwa model au mpya zaidi) -> New Releases -> kila DJ (DJ Mack kwanza) -> Series -> More to Watch
1503
+ function buildTranslatedSections(items, model) {
1504
+ const pop = (model && model.popularity) || {}, sections = [], covered = new Set();
1505
+ const hot = items.filter(it => pop[it.id] > 0).sort((a, b) => pop[b.id] - pop[a.id]);
1506
+ // Trending halisi (Top 10) inaonekana tu pale model ina data ya kutosha; kabla ya hapo ni "New Releases" tu (si udanganyifu)
1507
+ if (hot.length >= 5) sections.push({ title: t('tr_trending'), items: hot.slice(0, 10).map((it, i) => ({ ...it, rank: i + 1 })) });
1508
+ if (hot.length < 5 || items.length > 6) sections.push({ title: t('tr_new'), items: items.slice(0, 20) }); // orodha tayari ni mpya -> zamani
1509
+ const byDj = {};
1510
+ items.forEach(it => {
1511
+ const dj = String(it.subtitle || '').trim();
1512
+ if (!dj || dj === 'Series' || dj === 'Movie') return;
1513
+ (byDj[dj.toLowerCase()] = byDj[dj.toLowerCase()] || { name: dj, list: [] }).list.push(it);
1514
+ });
1515
+ Object.values(byDj).filter(g => g.list.length >= 2)
1516
+ .sort((a, b) => (/mack/i.test(b.name) - /mack/i.test(a.name)) || b.list.length - a.list.length)
1517
+ .forEach(g => { g.list.forEach(it => covered.add(it.id)); sections.push({ title: g.name, items: g.list.slice(0, 40).map(it => ({ ...it, subtitle: '' })) }); });
1518
+ const series = items.filter(it => it.isSeries);
1519
+ if (series.length) { series.forEach(it => covered.add(it.id)); sections.push({ title: t('tr_series'), items: series }); }
1520
+ const more = items.filter(it => !covered.has(it.id));
1521
+ if (more.length) sections.push({ title: t('tr_more'), items: more.slice(0, 40) });
1522
+ return sections;
1523
+ }
1524
  async function fetchTranslatedMovie(id) { // -> { ok, error?, movie } kutoka movie-translated-all
1525
  const r = await fetch(TRANSLATED_ALL + '?id=' + encodeURIComponent(id), { headers: { apikey: SUPABASE_ANON_KEY } });
1526
  const d = await r.json().catch(() => ({}));