Add an intermediate directory in show directory path.

For discussion related to MythTV which doesn't belong in another forum.

Moderator: Forum Moderators

Post Reply
zcubist
Newcomer
Posts: 1
Joined: Tue Jun 20, 2017 4:32 am
United States of America

Add an intermediate directory in show directory path.

Post by zcubist »

With over 360 TV show titles, it is a pain to navigate to a desired show - with over 40 pages to scroll thru, an average of 20 pages are required for each navigation.
I'm thinking that adding an intermediate directory level would mitigate this problem.

/root/tv/raid/sickbeard/Banshee would be moved to /root/tv/raid/sickbeard/B/Banshee
/root/tv/raid/sickbeard/Billions would be moved to /root/tv/raid/sickbeard/B/Billions
/root/tv/raid/sickbeard/Continuum would be moved to /root/tv/raid/sickbeard/C/Continuum

When navigating, only 1 of 26 items would need to be selected (3 pages) and then another page or two of show titles to navigate to the desired show directory.
Has anyone done this or know how to accomplish this?
Thanks in advance for any response :D
phatest
Newcomer
Posts: 5
Joined: Sun Feb 09, 2014 9:41 am
Canada

Re: Add an intermediate directory in show directory path.

Post by phatest »

I do this. Not for TV but originally for music now movies. i use this script to create a new directory that makes symlinks to to the content, so that makes no changes to the original location.
I am not the original author but I have made changes over the years. and tweaks as my thought process and desires change over the years.
here you go, try this out. Modify as necessary.

Code: Select all

#!/bin/bash


DIR=/original/directory/of/TV_Shows
DSTDIR=/new/directory/TV


find $DSTDIR -type l -print0 | xargs -0 rm


for BASE in A-C D-F G-I J-L M-O P-R S-U V-Z 0-9; do

if [ $BASE == "A-C" ]; then
        declare -a LETTERS=(a b c)
    elif [ $BASE == "D-F" ]; then
        declare -a LETTERS=(d e f)
    elif [ $BASE == "G-I" ]; then
        declare -a LETTERS=(g h i)
    elif [ $BASE == "J-L" ]; then
        declare -a LETTERS=(j k l)
    elif [ $BASE == "M-O" ]; then
        declare -a LETTERS=(m n o)
    elif [ $BASE == "P-R" ]; then
        declare -a LETTERS=(p q r)
    elif [ $BASE == "S-U" ]; then
        declare -a LETTERS=(s t u)
    elif [ $BASE == "V-Z" ]; then
        declare -a LETTERS=(v w x y z)
    elif [ $BASE == "0-9" ]; then
        declare -a LETTERS=(0 1 2 3 4 5 6 7 8 9)
    fi

    for LETTER in ${LETTERS[@]}; do
            mkdir -p $DSTDIR/$BASE/$LETTER
            find $DIR -maxdepth 1 -mindepth 1 -iname $LETTER\* | while read PATH; do
                /bin/ln -s "$PATH" $DSTDIR/$BASE/$LETTER
            done
    done

done
Post Reply