From 86148d5c4b3e56e985cea9b1cf2f05990fc9103b Mon Sep 17 00:00:00 2001 From: David Ball Date: Thu, 23 May 2024 15:19:20 -0400 Subject: [PATCH] Update server, CSS, video player, README.md support on video player, example youtube-cookies.txt file, add sync script for my Richmond Youtube videos. --- .gitattributes | 3 ++ app/server.js | 38 ++++++++++++---- static/css/nm3clol.css | 81 +++++++++++++++++++++++++++++++++- sync-my-youtube-videos.cmd | 3 ++ views/includes/common-head.ejs | 36 +++++++-------- views/video-player.ejs | 5 ++- youtube-cookies.example.txt | 17 +++++++ 7 files changed, 154 insertions(+), 29 deletions(-) create mode 100644 sync-my-youtube-videos.cmd create mode 100644 youtube-cookies.example.txt diff --git a/.gitattributes b/.gitattributes index e59cbd55..4641b8ce 100644 --- a/.gitattributes +++ b/.gitattributes @@ -6,3 +6,6 @@ *.mkv filter=lfs diff=lfs merge=lfs -text *.epub filter=lfs diff=lfs merge=lfs -text *.gif filter=lfs diff=lfs merge=lfs -text +*.xlxs filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.woff2 filter=lfs diff=lfs merge=lfs -text diff --git a/app/server.js b/app/server.js index 898ec8e2..af2b9802 100644 --- a/app/server.js +++ b/app/server.js @@ -133,7 +133,7 @@ glob.globSync('Web_Site_Archives/**/*{.htm,.html}', { // Endpoints for all the site's YouTube videos. console.log("Scanning for archived videos to create routes"); -glob.globSync(['Russell_County/Board_of_Supervisors/YouTube_Archive/**/*.info.json', 'Virginia_Energy/YouTube_Archive/**/*.info.json'], { +glob.globSync(['Russell_County/Board_of_Supervisors/YouTube_Archive/**/*.info.json', 'Virginia_Energy/YouTube_Archive/**/*.info.json', 'Virginia_Governor/**/*.info.json'], { cwd: path.join(__dirname, '..', 'public'), matchBase: true, follow: true, @@ -168,15 +168,37 @@ glob.globSync(['Russell_County/Board_of_Supervisors/YouTube_Archive/**/*.info.js const fullFilePath = path.join(__dirname, '..', 'public', filePath); console.log(`Setting route for ${route}`); app.get(route, async (req, res) => { - let info = require(fullFilePath); - let subtitleVTT = fs.existsSync(subtitleFile)?fs.readFileSync(subtitleFile, 'utf8'):undefined; - const renderData = { route, filePath, fullFilePath, req, paths, directory, videoURL, subtitleURL, subtitleVTT, info }; - res.render("video-player", { h: helpers, require, ...renderData }); + if (!req.path.endsWith('/')) { + res.redirect(req.path + '/'); + } + else { + let info = require(fullFilePath); + let subtitleVTT = fs.existsSync(subtitleFile)?fs.readFileSync(subtitleFile, 'utf8'):undefined; + const renderData = { route, filePath, fullFilePath, req, paths, directory: path.join('public', directory), videoURL, subtitleURL, subtitleVTT, info }; + res.render("video-player", { h: helpers, require, ...renderData }); + } }); }); //app.get('/OCR-Encoded-PDFs/Russell-County-Web-Site_2024-02-13_19_50_Modified-With-OCR-Encoding**', rewriter.rewrite('/Web_Site_Archives/Russell_County_Web_Site-2024-02-13_19_50_Modified_With_OCR_Encoding/$1')); +console.log(`Setting routes for /vendor/**/*`);; +app.get('/vendor/**/*', async (req, res) => { + await serve(req, res, { + public: path.join(__dirname, '..', 'static'), + symlinks: true, + trailingSlash: true, + cleanUrls: false, + renderSingle: false, + unlisted: [ + ".DS_Store", + ".git", + "Thumbs.db", + "README*", + ], + }); +}); + console.log(`Setting routes for /css/*.css`);; app.get('/css/*.css', async (req, res) => { await serve(req, res, { @@ -189,7 +211,7 @@ app.get('/css/*.css', async (req, res) => { ".DS_Store", ".git", "Thumbs.db", - // "README*", + "README*", ], }); }); @@ -206,7 +228,7 @@ app.get('/svg/*.svg', async (req, res) => { ".DS_Store", ".git", "Thumbs.db", - // "README*", + "README*", ], }); }); @@ -223,7 +245,7 @@ app.get('*', async (req, res) => { ".DS_Store", ".git", "Thumbs.db", - // "README*", + "README*", ], redirects: [ { diff --git a/static/css/nm3clol.css b/static/css/nm3clol.css index 99c77c95..9d40d446 100644 --- a/static/css/nm3clol.css +++ b/static/css/nm3clol.css @@ -112,7 +112,7 @@ a { line-height: 20px; } a:hover, a:active { - color: #0076FF; + color: #0076ff; display: inline-block; line-height: 20px; } @@ -121,7 +121,7 @@ a .pretty, a .cool { } a:hover .david, a:active .david, a:hover .cool, a:active .cool { display: inline; - color: #0076FF; + color: #0076ff; } a:hover .allen, a:active .allen { display: inline; @@ -243,4 +243,81 @@ thead { .total { border-top: 5pt double #222; +} + +.winner { + color: #00A000; +} + +tr.republican, tr.democratic, tr.independent, tr.write-in { + padding-top: 1pt; +} + +tr.republican .progress, tr.democratic .progress, tr.independent .progress, tr.write-in .progress { + border-radius: 0; +} + +tr.republican .progress-bar { + background-color: #f44336; + color: #f44336; +} + +tr.democratic .progress-bar { + background-color: #0076ff; + color: #0076ff; +} + +tr.independent .progress-bar { + background-color: #ffa500; + color: #ffa500; +} + +tr.write-in .progress-bar { + background-color: #555; + color: #555; +} + +tr.republican td:first-child, tr.democratic td:first-child, tr.independent td:first-child, tr.write-in td:first-child { + border-left: 6pt solid; +} + +tr.republican td:first-child { + border-color: #f44336; +} + +tr.democratic td:first-child { + border-color: #0076ff; +} + +tr.independent td:first-child { + border-color: #ffa500; +} + +tr.write-in td:first-child { + border-color: #555; +} + +@media print{ + @page { size: portrait; } + body { font-size: 12pt; background-color: #fff; } + img.no-trash-svg { display: none; visibility: hidden; opacity: 0.00; } + .page-break { page-break-after: always; } + .navbar { position: relative; } + img, a img, a:link img, a:visited img, a:hover img, a:active img{ + width: auto !important; + page-break-inside: avoid !important; + max-height: 85vh !important; + max-width: 85vw !important; + } + embed { + width: 90vw !important; + page-break-inside: avoid !important; + max-height: 80vh !important; + max-width: 80vw !important; + display: block; + } + .container { max-width: fit-content; } + .nmc3clol-navbar-brand { color: #f44336; } + .daball-navbar-brand { color: #000; } + .pt-1500 { padding-top: 150px;} } \ No newline at end of file diff --git a/sync-my-youtube-videos.cmd b/sync-my-youtube-videos.cmd new file mode 100644 index 00000000..3cedb189 --- /dev/null +++ b/sync-my-youtube-videos.cmd @@ -0,0 +1,3 @@ +S:\bin\yt-dlp.exe --live-from-start --yes-playlist -N 8 -R infinite -c --no-force-overwrites --mtime --write-description --write-info-json --write-playlist-metafiles --write-comments --no-cookies-from-browser --cookies S:\srv\www\no-moss-3-carbo-landfill-library.online\youtube-cookies.txt --write-thumbnail --write-all-thumbnails --write-url-link --write-webloc-link --write-desktop-link --progress --video-multistreams --audio-multistreams --write-subs --write-auto-subs --embed-subs --embed-thumbnail --embed-metadata --embed-chapters --embed-info-json -o "S:\srv\www\no-moss-3-carbo-landfill-library.online\YouTube\%%(uploader_id)s\%%(upload_date>%%Y-%%m-%%d)s-%%(title)s\%%(id)s.%%(ext)s" "https://www.youtube.com/watch?v=WMEw18t9p1Q" +S:\bin\yt-dlp.exe --live-from-start --yes-playlist -N 8 -R infinite -c --no-force-overwrites --mtime --write-description --write-info-json --write-playlist-metafiles --write-comments --no-cookies-from-browser --cookies S:\srv\www\no-moss-3-carbo-landfill-library.online\youtube-cookies.txt --write-thumbnail --write-all-thumbnails --write-url-link --write-webloc-link --write-desktop-link --progress --video-multistreams --audio-multistreams --write-subs --write-auto-subs --embed-subs --embed-thumbnail --embed-metadata --embed-chapters --embed-info-json -o "S:\srv\www\no-moss-3-carbo-landfill-library.online\YouTube\%%(uploader_id)s\%%(upload_date>%%Y-%%m-%%d)s-%%(title)s\%%(id)s.%%(ext)s" "https://www.youtube.com/watch?v=lZfmk1RPdbk" +S:\bin\yt-dlp.exe --live-from-start --yes-playlist -N 8 -R infinite -c --no-force-overwrites --mtime --write-description --write-info-json --write-playlist-metafiles --write-comments --no-cookies-from-browser --cookies S:\srv\www\no-moss-3-carbo-landfill-library.online\youtube-cookies.txt --write-thumbnail --write-all-thumbnails --write-url-link --write-webloc-link --write-desktop-link --progress --video-multistreams --audio-multistreams --write-subs --write-auto-subs --embed-subs --embed-thumbnail --embed-metadata --embed-chapters --embed-info-json -o "S:\srv\www\no-moss-3-carbo-landfill-library.online\YouTube\%%(uploader_id)s\%%(upload_date>%%Y-%%m-%%d)s-%%(title)s\%%(id)s.%%(ext)s" "https://www.youtube.com/watch?v=RRGeIh_fh_M" diff --git a/views/includes/common-head.ejs b/views/includes/common-head.ejs index e3706bbf..7188b755 100644 --- a/views/includes/common-head.ejs +++ b/views/includes/common-head.ejs @@ -1,28 +1,28 @@ - - - +// --> + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + diff --git a/views/video-player.ejs b/views/video-player.ejs index 0836e41a..9c02d16f 100644 --- a/views/video-player.ejs +++ b/views/video-player.ejs @@ -33,6 +33,9 @@ <% if (typeof videoURL !== 'undefined') {%>
+ <% if (h.directoryContainsReadme({directory})) {%> + <%- h.printReadme({directory}) %> + <% }%>

<%= (typeof info.title !== 'undefined') ? info.fulltitle : "" %>

<% } %> - + <%- include('./includes/bottom-navbar.ejs') %> diff --git a/youtube-cookies.example.txt b/youtube-cookies.example.txt new file mode 100644 index 00000000..5e5868af --- /dev/null +++ b/youtube-cookies.example.txt @@ -0,0 +1,17 @@ +# Netscape HTTP Cookie File +# This file is generated by yt-dlp. Do not edit. I think I might have once needed to create it first in Edge and copy my values from my logged in browser. + +.youtube.com TRUE / TRUE ... GPS ... +.youtube.com TRUE / FALSE ... PREF tz=...&f6=...&f7=...&hl=... +.youtube.com TRUE / TRUE ... SOCS ... +.youtube.com TRUE / TRUE ... VISITOR_INFO1_LIVE ... +.youtube.com TRUE / TRUE ... VISITOR_PRIVACY_METADATA ... +.youtube.com TRUE / TRUE ... YSC ... +youtube.com FALSE / FALSE ... APISID .../... +youtube.com FALSE / TRUE ... PREF tz=...&f6=...&f7=... +youtube.com FALSE / TRUE ... SAPISID .../... +youtube.com FALSE / FALSE ... SID ... +youtube.com FALSE / FALSE ... SIDCC ... +youtube.com FALSE / TRUE ... __Secure-1PAPISID .../... +youtube.com FALSE / TRUE ... __Secure-3PAPISID .../... +youtube.com FALSE / FALSE ... _gcl_au ...