Results 1 to 2 of 2

Thread: Script for Tivoserver

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2004

    Script for Tivoserver

    I've written a script for tivoserver to help migrate to Media center, but still be able to use tivoserver. What this does is shorten names and works with sub directories to get rid of them by making symbolic links. I run my tivoserver in vmware so it run on ubuntu which in turns runs on my windows 7 home media center. Guess the best way is by example. Here is a layout

    current layout
    \shows\Friends\Season 01\s01e01 example.avi
    \shows\Friends\Season 01\s01e02 example.avi
    \shows\Friends\Season 02\s02e01 example.avi
    \shows\Friends\Season 02\s02e02 example.avi

    converts it to
    \tivo\Friends\Friends s01e01 example.avi
    \tivo\Friends\Friends s01e02 example.avi
    \tivo\Friends\Friends s02e01 example.avi
    \tivo\Friends\Friends s02e02 example.avi

    the #(enter your name).name, adds it to the beginning of the file name, so you can see what show it is.

    this scripts cuts off all sub directories after the first, and add to the file in the current directory and sub directory, if the file exist in the sub directory, it will use that one.

    I've just started using it. just change the /share1 to where the symbolic links will be created and the tivoserver to look there for the shows

    change the /shows to where your shows exist.

    You don't have use the if it doesn't exist it just won't add any information.

    This will also look to validate exsisting symbolic links, if there not valid, it removes them.

    let me know what you think and if you use it.

    #version 1.02
    # by Snake98
    # create symbolic links to ne directory for tivoserver.  Tivoserver sorts directory
    # by the last direcotry. this over comes this problem by combinding all sub directories
    # and adding to the name  xxxxx is the name you want to add.
    [ ! -d "$shows" ] && echo "$shows does not exsist" && exit
    [ ! -d "$tivo" ] &&  mkdir "$tivo"
    find "$tivo" -type l | while read f; do if [ ! -e "$f" ]; then rm -f "$f"; fi; done
    find "$shows" -type f | sort | while read readline; do
    	[ "$(echo $readline | awk -F"/" '{ print NF-1}')" -le "$(echo $shows | awk -F"/" '{ print NF}')" ] && newdir=$tivo/
    	if  [[ "$readline" != "$subdir"* ]] ||	[[ $subdir == $shows ]] ;then
    		if [ "$(echo $readline | awk -F"/" '{ print NF-1}')" -gt "$(echo $shows | awk -F"/" '{ print NF}')" ]; then
    			for ((i="$(echo $readline | awk -F"/" '{ print NF-3}')"; i>="$(echo $shows | awk -F"/" '{ print NF}')"; i--))
    			[ ! -d "$newdir" ] &&  mkdir "$newdir"
    	if  [[ "$readline" == *".name" ]];then
    		addname="${addname/*\/\#/} "
    	elif [ ! -L "$newdir$addname${readline/*\//}" ]; then
    		echo ln -s "$readline" "$newdir$addname${readline/*\//}"
    		ln -s "$readline" "$newdir$addname${readline/*\//}"
    		counterx=$(expr $counterx + 1)
    		echo file already exist "$newdir$addname${readline/*\//}"
    updated to 1.02 deleted invalid symbolic links
    updated to 1.01 fix a file issues in the main directory
    Last edited by snake98; 09-29-2010 at 06:40 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts