alexta69 / metube

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

OUTPUT_TEMPLATE doesn't seem to work #251

Open BrightCandle opened 1 year ago

BrightCandle commented 1 year ago

I am adding the environment variable in a docker_compose file as the following but instead of the title.ext I am seeing a random ID with no extension. I was trying to see if I could update the file naming but it appears setting the output template even to the default breaks the naming.

A glance at how the config gets loaded and how the template is used in the download has left me none the wiser as to how I should format this or what I have done wrong or if there is a bug.

PikuZheng commented 1 year ago

Some websites do not provide title, please try YouTube to see if it is normal

BrightCandle commented 1 year ago

This is on Youtube. The files get named correctly if I don't add the environment parameter but the moment I do they get an ID name even when just using what should be the default.

PikuZheng commented 1 year ago

I see. Can you post the full compose file?

BrightCandle commented 1 year ago

This is what I am using that causes me issues.

version: "2.2"
services:  
  metube:
    image: alexta69/metube
    container_name: metube
    restart: unless-stopped
    ports:
      - "8081:8081"
    volumes:
      - ${STORAGE}/Youtube:/downloads
    environment:
      - UID=${PUID}
      - GID=${PGID}
      - STATE_DIR=${STORAGE}/metube/
      - OUTPUT_TEMPLATE="%(title)s.%(ext)s"
      - YTDL_OPTIONS={"updatetime":false}
PikuZheng commented 1 year ago

this works for me:

version: "2.2"
services:  
  metube:
    image: alexta69/metube
    container_name: metube
    restart: unless-stopped
    ports:
      - "8081:8081"
    volumes:
      - ${STORAGE}/Youtube:/downloads
    environment:
      - UID=${PUID}
      - GID=${PGID}
      - STATE_DIR=${STORAGE}/metube/
      - OUTPUT_TEMPLATE=%(title)s.%(ext)s
      - YTDL_OPTIONS={"updatetime":false}
om555 commented 4 months ago

I have the same issue with the following docker-compose file.

    image: ghcr.io/alexta69/metube
    container_name: metube
    restart: unless-stopped
    environment:
      - UID=${PUID}
      - GID=${PGID}
      - TZ=${TZ}
      - STATE_DIR=.
      - OUTPUT_TEMPLATE=%(playlist&{}/|)s%(playlist_index&{} - |)s%(title)s.%(ext)s
    volumes:
      - ${MEDIA_ROOT}/youtube:/downloads
    ports:
      - 4848:8081

When I tried with yt-dlp directly, the output file was what I expected. yt-dlp.exe -s --print filename -o "%(playlist&{}/|)s%(playlist_index&{} - |)s%(title)s.%(ext)s" <youtube_playlist_url>

PikuZheng commented 4 months ago

When I tried with yt-dlp directly, the output file was what I expected. yt-dlp.exe -s --print filename -o "%(playlist&{}/|)s%(playlist_index&{} - |)s%(title)s.%(ext)s" <youtube_playlist_url>

can you use yt-dlp commandline in linux and see what's happend?

om555 commented 4 months ago

I tried in wsl2 (ubuntu) and it gave me the correct result as well. yt-dlp -s --print filename -o "%(playlist&{}/|)s%(playlist_index&{} - |)s%(title)s.%(ext)s" "https://www.youtube.com/playlist?list=PLAqhIrjkxbuW9U8-vZ_s_cjKPT_FqRStI" Correct output: General Audience⧸1 - [1hr Talk] Intro to Large Language Models.webm

PikuZheng commented 4 months ago

well...it works for me except your example playlist. image maybe try this https://www.youtube.com/watch?v=cLVCGEmkJs0&list=PL-JHk6egAofdrAEgO1xnRs-6fkMOvP1ZF

om555 commented 4 months ago

You're right, it works with your playlist. I will look at this further--it is probably the playlist itself. Thanks.