From d11742ec8a0ab5ec5405047ee647f3b8d005d212 Mon Sep 17 00:00:00 2001 From: Alex Thomassen Date: Sun, 12 May 2024 16:56:36 +0200 Subject: [PATCH] WIP as of May 12th 2024 --- .gitignore | 1 + README.md | 2 +- config.sample.php | 1 + existing.js | 128 ----------- calendar.js => public/calendar.js | 34 ++- existing.html => public/existing.html | 14 +- public/existing.js | 306 ++++++++++++++++++++++++++ ical.min.js => public/ical.min.js | 0 index.html => public/index.html | 4 +- moment.min.js => public/moment.min.js | 0 10 files changed, 347 insertions(+), 143 deletions(-) create mode 100644 .gitignore create mode 100644 config.sample.php delete mode 100644 existing.js rename calendar.js => public/calendar.js (90%) rename existing.html => public/existing.html (60%) create mode 100644 public/existing.js rename ical.min.js => public/ical.min.js (100%) rename index.html => public/index.html (93%) rename moment.min.js => public/moment.min.js (100%) diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4e9b47a --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +config.php \ No newline at end of file diff --git a/README.md b/README.md index 718ee1d..8d2cbea 100644 --- a/README.md +++ b/README.md @@ -2,4 +2,4 @@ The code powering [tv.cocks.no](https://tv.cocks.no/) -Most of it relies on parsing the [Sonarr iCalendar feed](https://wiki.servarr.com/sonarr/calendar) and rendering it with [FullCalendar](https://fullcalendar.io/). \ No newline at end of file +Most of it relies on parsing the [Sonarr iCalendar feed](https://wiki.servarr.com/sonarr/calendar) and rendering it with [FullCalendar](https://fullcalendar.io/). diff --git a/config.sample.php b/config.sample.php new file mode 100644 index 0000000..a814366 --- /dev/null +++ b/config.sample.php @@ -0,0 +1 @@ + { - item.server = `${apiUrl.name}|${apiUrl.domain}|${item.titleSlug}|${item.tmdbId || item.id}`; - item.mediaType = apiUrl.url.includes('sonarr') ? 'Series' : 'Movie'; - - return item; - }); - - media = [...media, ...json]; - } - - media = media.sort((a, b) => { - return a.sortTitle.localeCompare(b.sortTitle); - }); - - let rows = media.map((mediaItem) => { - const { title, mediaType, year, server } = mediaItem; - - return [ - title, - mediaType, - year, - server, - ]; - }); - - const tblData = { - headings: [ - 'Series/Movie name', - 'Type', - 'Year', - 'Server', - ], - data: rows, - }; - - const tbl = document.querySelector('#media-table'); - const dataTblConfig = { - searchable: true, - fixedHeight: false, - perPage: 100, - perPageSelect: [25, 50, 100, 250, 500, 750, 1000], - data: tblData, - layout: { - top: '{search}{select}', - bottom: '{pager}{info}', - }, - columns: [ - { - select: [3], - render: function(data, cell, row) { - const [name, domain, slug, id] = data.split('|'); - - let url = `https://${domain}.decicus.com`; - if (domain.includes('sonarr')) { - url += `/series/${slug}`; - } - else { - url += `/movie/${id}`; - } - - return `${name}`; - }, - } - ], - }; - - removeMessage(); - - const dataTbl = new simpleDatatables.DataTable(tbl, dataTblConfig); - - dataTbl.on('datatable.init', function() { - const search = document.querySelector('.dataTable-search input'); - search.focus(); - }); -} - -window.addEventListener('DOMContentLoaded', function() { - initial(); -}); \ No newline at end of file diff --git a/calendar.js b/public/calendar.js similarity index 90% rename from calendar.js rename to public/calendar.js index ba36538..d7c339b 100644 --- a/calendar.js +++ b/public/calendar.js @@ -5,13 +5,29 @@ const icsUrls = [ url: '/sonarr-hs-ics', name: 'hidden-sea', }, + // { + // url: '/sonarr-cb-ics', + // name: 'cold-badlands', + // }, + // { + // url: '/sonarr-fv-ics', + // name: 'fancy-valley', + // }, { - url: '/sonarr-cb-ics', - name: 'cold-badlands', + url: '/sonarr-ag-ics', + name: 'ancient-grove', }, { - url: '/sonarr-fv-ics', - name: 'fancy-valley', + url: '/sonarr-bs-ics', + name: 'bold-silence', + }, + { + url: '/sonarr-fd-ics', + name: 'frosty-darkness', + }, + { + url: '/sonarr-rs-ics', + name: 'royal-stream [4K]', }, ]; @@ -206,18 +222,16 @@ async function loadSonarrCalendar(shouldForce = false) calendar.render(); if (message) { - message.remove(); + message.textContent = ''; } keyHandlers(calendar); - - if (shouldScroll) { - scrollToCalendarDay(); - } } catch (err) { console.error(err); - message.textContent = 'An error occurred loading schedule...'; + if (message) { + message.textContent = 'An error occurred loading schedule...'; + } } } diff --git a/existing.html b/public/existing.html similarity index 60% rename from existing.html rename to public/existing.html index d5a978a..17b3a37 100644 --- a/existing.html +++ b/public/existing.html @@ -6,8 +6,8 @@ - - + + Cactflix [Main] — Plex — Existing Media