alexta69 / metube

Self-hosted YouTube downloader (web UI for youtube-dl / yt-dlp)
GNU Affero General Public License v3.0
6.25k stars 390 forks source link

Plex friendly like ytdl-sub #414

Closed prologic closed 6 months ago

prologic commented 6 months ago

I tried this out today, and it looks promising. What I need it to do though, and I'm not yet sure how to do this, but it looks like it might? Is make this Plex friendly like ytdl-sub. ytdl-sub creates a structure like this:

./Friendly Jordies
./Friendly Jordies/fanart.jpg
./Friendly Jordies/poster.jpg
./Friendly Jordies/Season 2024
./Friendly Jordies/Season 2024/s2024.e020101 - statement from friendlyjordies.info.json
./Friendly Jordies/Season 2024/s2024.e020101 - statement from friendlyjordies.mp4
./Friendly Jordies/Season 2024/s2024.e020101 - statement from friendlyjordies-thumb.jpg
./Friendly Jordies/.ytdl-sub-Friendly Jordies-download-archive.json

Which Plex happily picks up using its normal "TV Show" agent. The .json file tracks Youtube Video ID(s) so videos already present are not downloaded again.

PikuZheng commented 6 months ago

are you means download-archive like #328

prologic commented 6 months ago

I think - 'YTDL_OPTIONS={"download_archive":"archive_downloads.txt","updatetime":false,"postprocessors":[{"key":"Exec","exec_cmd":"chmod 0664","when":"after_move"},{"key":"FFmpegMetadata","add_chapters":true}]}' is only half the equation. I need to create the same structure that the Plex TV Show scanner/agent understand hmmm

prologic commented 6 months ago

For example I'm not actually sure (yet) how ytdl-sub creates Season 2024/s2024.e020101 <-- this part of the structure...

prologic commented 6 months ago

Just playing around with yt-dlp directly and this is sooo close:

$ yt-dlp -c -i -v -f "bv+ba/b" --write-thumbnail --convert-thumbnails png --embed-thumbnail --embed-metadata --embed-info-json --download-archive ./Youtube/archive.txt -i -o "./Youtube/%(uploader)s/Season %(upload_date>%Y)s/s%(upload_date>%Y)s.e%(upload_date>%m%d)s01 - %(title)s.%(ext)s" 'https://youtu.be/AADUUz2xqos'

All I'm missing is the channel's poster art. Is there an option for this?

And how do I configure metube to use such a complex array of options?

prologic commented 6 months ago

Success! (partially) 🥳 I have set these enviornment variables:

DOWNLOAD_DIR=/youtube
OUTPUT_TEMPLATE=%(uploader)s/Season %(upload_date>%Y)s/s%(upload_date>%Y)s.e%(upload_date>%m%d)s01 - %(title)s.%(ext)s
YTDL_OPTIONS={"format":"bv+ba/b","format_sort":["codec:avc:m4a"],"writeinfojson":true,"writethumbnail":true,"download_archive":"/youtube/archive.txt"}

Full Docker Compose YAML:

---

version: "3.8"

services:
  metube:
    image: ghcr.io/alexta69/metube:latest
    environment:
      - DOWNLOAD_DIR=/youtube
      - OUTPUT_TEMPLATE=%(uploader)s/Season %(upload_date>%Y)s/s%(upload_date>%Y)s.e%(upload_date>%m%d)s01 - %(title)s.%(ext)s
      - 'YTDL_OPTIONS={"format":"bv+ba/b","format_sort":["codec:avc:m4a"],"writeinfojson":true,"writethumbnail":true,"download_archive":"/youtube/archive.txt"}'
    volumes:
      - youtube:/youtube

volumes:
  youtube: {}
prologic commented 6 months ago

I just need to figure out how to download the channel's logo/artwork/psoter. e.g:

$ ls -lah ../a\ Cookie\ God/
total 460K
drwxr-xr-x  3 1000 1000    6 Mar  2 17:46 .
drwxr-xr-x 13 1000 1000   14 Mar 24 14:30 ..
-rw-r--r--  1 1000 1000 397K Mar 17 00:05 fanart.jpg
-rw-r--r--  1 1000 1000  43K Mar 17 00:05 poster.jpg
drwxr-xr-x  2 1000 1000   11 Mar 17 00:07 Season 2024
-rw-r--r--  1 1000 1000 1.4K Mar 17 00:07 .ytdl-sub-a Cookie God-download-archive.json
prologic commented 6 months ago

Small issue I've run into though, I'm getting really weird extensions on the files:

$ find Tennis\ TV/
Tennis TV/
Tennis TV/Season 2024
Tennis TV/Season 2024/s2024.e031501 - Men vs Bees | Extended Cut Of Alcaraz & Zverev's Unexpected Interruption! ?.info.jsonson
Tennis TV/Season 2024/s2024.e031501 - Men vs Bees | Extended Cut Of Alcaraz & Zverev's Unexpected Interruption! ?.mp4mp4
Tennis TV/Season 2024/s2024.e031501 - Men vs Bees | Extended Cut Of Alcaraz & Zverev's Unexpected Interruption! ?.webpebp

Where is this "double"? webpebp and .jsonson coming from?!

prologic commented 6 months ago

Sooved

LECOQQ commented 2 months ago

Would have liked the solution!!! :D

badi95 commented 1 month ago

@prologic Can you share what was the final solution? I'm currently on ytdl-sub for its integration into plex, but metube seems to have much nicer UI.