Yearly Season Folders with Plex

Using Absolute Series Scanner, YouTube Agent Bundle and yt-dlp a system can be created for automatically downloading videos from YouTube.

The following naming convention seems to work in making all the Absolute Series Scanner and YouTube-Agent sort YouTube videos by year using folders named after the year that the video has been released:

/Channel Name [Channel ID]/YYYYmmdd - Channel Name - Title [Video ID].webm

with a generated filesystem layout such as:

+-----+ Channel Name [Channel ID]
                  +
                  |
                  +----------------+ YYYYmmdd - Channel Name - Video Title [Video ID].webm
                  |
                  +----------------+ YYYYmmdd - Channel Name - Video Title [Video ID].webm
                  |
                  .
                  .
                  .

In yt-dlp terminology, the following string must be passed to the output parameter corresponding to the layout described above:

/%(uploader)s [%(channel_id)s]/%(upload_date>%Y%m%d)s - %(uploader)s - %(title)s [%(id)s].%(ext)s

Or, script-wise, the following script seems suitable to generate the required layout for every channel or playlist:

#!/bin/sh
###########################################################################
##  Copyright (C) Wizardry and Steamworks 2024 - License: MIT            ##
###########################################################################
 
# Acquire a lock.
LOCK_FILE="/tmp/lock"
if mkdir $LOCK_FILE 2>&1 >/dev/null; then
    trap '{ rm -rf $LOCK_FILE; }' KILL QUIT TERM EXIT INT HUP
else
    exit 0
fi
 
FULL_PATH="/mnt/storage/YouTube/%(uploader)s [%(channel_id)s]/%(upload_date>%Y%m%d)s - %(uploader)s - %(title)s [%(id)s].%(ext)s"
 
mkdir -p /archives
yt-dlp \
        --output "${FULL_PATH}" \
        --replace-in-metadata "title" "[^\x20\x30-\x39\x40-\x5a\x61-\x7a\x2f\x5c\x5b\x5d]" "" \
        -S "height:480" \
        --username oauth2 --password '' \
        --continue \
        --download-archive "/archives/$0.txt" \
        --write-info-json \
        --write-subs \
        YOUTUBE_PLAYLIST_OR_CHANNEL_URL 2>&1 | logger

where:

  • YOUTUBE_PLAYLIST_OR_CHANNEL_URL is a placeholder for the YouTube channel or playlist

The result is that when Plex Media Server is made to scan the folder using the plugins above, with the settings:

  • Select typeTV Shows,
  • AdvancedScannerAbsolute Series Scanner,
  • AdvancedAgentYouTubeSeries
  • AdvancedSeasonsShow

as pictured in the screenshot below:

Scanner and Agent Season Folders

then browsing the folder will result in all videos being organized underneath season folders labeled by year.


fuss/yt-dlp.txt · Last modified: 2024/06/23 03:08 by office

Access website using Tor Access website using i2p Wizardry and Steamworks PGP Key


For the contact, copyright, license, warranty and privacy terms for the usage of this website please see the contact, license, privacy, copyright.