Robust Folder Manipulation - folders.tcl

Discussion in 'TiVo Underground' started by rbautch, Sep 2, 2007.

  1. Sep 2, 2007 #1 of 124
    rbautch

    rbautch User

    3,629
    0
    Feb 5, 2004
    Chicago, IL
    Here is a script that will:

    1) Add shows to a folder

    2) Create new folders (See here for details).

    3) Remove shows from a folder

    4) Rename a folder

    5) Duplicate the directory structure from your Tivoserver PC so that shows automatically get put into folders after they transfer to your Tivo. See here for more details.

    6) List all folders and their contents

    7) List orphan shows that aren't in a folder

    6) Change the attributes of all shows in a particular folder, such as the Original Air Date, Actors, Title, or Episode Description.

    8) Reorder shows based on original air date or showing date.

    9) Reorder shows in a folder using season/episode notation. So show.S02E12.mpg appears before show.S03E09.mpg in NPL.

    10) Make show titles "nice". This includes:
    - If the show does not have an episode title, set the episode title equal to the show title, and then change the show title to equal the series title.
    - Strip off file extensions from episode titles.
    - Remove tivo formatting from tivoserver insertions - i.e. strip off braces.
    - Strip off torrent formatting, so "My.Boys.S01E18.DSR.XviD-SYS.mpg" gets changed to "My Boys" Season episode info then gets added to show description.

    11) Automatically match shows with folders. Can run from cron to organize shows periodically. More information here.

    Here's an example of what features 9 and 10 do:
    Before:
    [​IMG]

    After:
    [​IMG]

    Note that the episodes have been ordered according to the season/episode designation, the season/episode information has been moved to the episode description, formatting and extensions have been stripped off, and periods and underscores have been converted to spaces.

    Current version is 2.9
     

    Attached Files:

  2. Sep 3, 2007 #2 of 124
    crxrocks

    crxrocks Well-Known Member

    1,382
    73
    Mar 30, 2004
    Etherville
    Thanks for all of the hard work you do, rbautch.

    I copied over the new script, used dos2unix to strip out the crap, changed the permissions so that I could execute it and then ran the script.

    I had a folder created called "Doctor Who" and wanted to rename it to "Kids Shows". I chose #2 and then put in the old folder and new folder names. The script did a CR and then just sat at the next line for about 5 minutes before my zippered DirecTivo rebooted.

    Any ideas or troubleshooting I can do for you?
     
  3. Sep 3, 2007 #3 of 124
    rbautch

    rbautch User

    3,629
    0
    Feb 5, 2004
    Chicago, IL
    I couldn't duplicate your error. Try downloading the file again, try a different folder, try a different tivo, and try downloading it from the files section of DDB (just in case the zipping process introduced something).
     
  4. Sep 3, 2007 #4 of 124
    crxrocks

    crxrocks Well-Known Member

    1,382
    73
    Mar 30, 2004
    Etherville
    Downloaded the tcl file directly from DDB and tried different folder names. I don't have another hacked tivo at the moment so I cannot try on another tivo. I will try it again in a couple of weeks once I get to work on my other tivo.
     
  5. Sep 3, 2007 #5 of 124
    unclemoosh

    unclemoosh I Wish I knew Then..

    368
    0
    Sep 11, 2004
    Gulf South
    I have downloaded and used it without a problem. It works great. Thanks for your contribution!
     
  6. Sep 9, 2007 #6 of 124
    Soapm

    Soapm Active Member

    1,662
    8
    May 9, 2007
    Aurora, CO
    I have about 100 MASH episodes and am still keeping all I can. Unfortunately the list in the folder based on the date they were recorded. Will this allow me to sort them by original air date? Can this be a possible future enhancement?
     
  7. Sep 19, 2007 #7 of 124
    Soapm

    Soapm Active Member

    1,662
    8
    May 9, 2007
    Aurora, CO
    Hey rbautch, you know how you gave us shortcut commands like TWP to launch Tivo WebPlus and TWPRS to restart it. How do I add "folders" to launch this application?
     
  8. Sep 19, 2007 #8 of 124
    Soapm

    Soapm Active Member

    1,662
    8
    May 9, 2007
    Aurora, CO
    Also, I tried to resort my MASH folder by episode using option 6f (Reorder episodes based on season/episode information in show title) and got this error...

    Found a folder named "M*A*S*H" containing 126 episodes.
    no such object: {CONFLICT err=0x30019}
    while executing
    "dbobj $program get Title"
    (procedure "get_objects_byfsid" line 21)
    invoked from within
    "get_objects_byfsid"
    ("foreach" body line 2)
    invoked from within
    "foreach fsid $targetlist {
    get_objects_byfsid
    # Does show have Sxx Exx designation?
    # set episodetitle bigbrotherS04E09.04; if { [rege..."
    ("uplevel" body line 2)
    invoked from within
    "uplevel $body"
    invoked from within
    "transaction {uplevel $body}"
    (procedure "RetryTransaction" line 5)
    invoked from within
    "RetryTransaction {
    foreach fsid $targetlist {
    get_objects_byfsid
    # Does show have Sxx Exx designation?
    # set episodetitle bigbroth..."
    invoked from within
    "if {$selection == 1} {
    puts ""
    set targetfolder [ askuser "Enter the name of the TARGET FOLDER you want to add shows to
    : " ]
    ############# Find ..."
    (file "/enhancements/folders.tcl" line 318)
     
  9. Sep 19, 2007 #9 of 124
    rbautch

    rbautch User

    3,629
    0
    Feb 5, 2004
    Chicago, IL
    Look in a file called .profile in the root directory, and you'll see how the shortcut commands work. Note that this is a hidden file, and you can't see it with the standard ls command.
     
  10. Sep 19, 2007 #10 of 124
    rbautch

    rbautch User

    3,629
    0
    Feb 5, 2004
    Chicago, IL
    Looks like your MASH program might have a title set to "{CONFLICT err=0x30019}". Or possibly the script set the title to that on a previous run. Please post a screen capture from this show's object in MFS. You can get to it in TWP by selecting the MFS option, then recording, then nowshowingbybuckettitle, then select the MASH episode, the select showing, then select program.
     
  11. Sep 19, 2007 #11 of 124
    Soapm

    Soapm Active Member

    1,662
    8
    May 9, 2007
    Aurora, CO
    Here is one of them, I was under the impression this would resort the entire folder.. Are you saying it only does one episode at a time?

    Program 215168/11 {
    ServerVersion = 45
    TmsId = EP0027100209
    Title = M*A*S*H
    Series = 7825/-1
    Description = {Charles is permanently assigned to the 4077th.}
    DescLanguage = English
    ShowType = 5
    SourceType = 2
    EpisodeTitle = {Fade Out, Fade In}
    Actor = Alda|Alan Morgan|Harry {Stiers|David Ogden} Farrell|Mike Burghoff|Gary Swit|Loretta Farr|Jamie Christopher|William
    GuestStar = Lough|James Singer|Raymond Stovall|Tom Hurst|Rick Symonds|Robert Flatley|William Hiroshige|Kimiko Burns|Joseph James|Barbara Poss|Ray {Pettee Jr.|Robert Holmes}
    Genre = 91 115 1002
    ColorCode = 4
    EpisodeNum = 0
    IsEpisode = 1
    OriginalAirDate = 2819 (9/20/1977)
    ServerId = 26702
    Version = 1
    IndexPath = /Server/26702
    }
     
  12. Sep 19, 2007 #12 of 124
    Soapm

    Soapm Active Member

    1,662
    8
    May 9, 2007
    Aurora, CO
    Do I have to restart the Tivo before this works?
     
  13. Sep 19, 2007 #13 of 124
    Soapm

    Soapm Active Member

    1,662
    8
    May 9, 2007
    Aurora, CO
    Looking closely at a lot of the files using the Info button on the Tivo remote, I see none of the shows so far have a season setting and the majority of the episode number set to 0. Could this be part of the problem?

    One thing I did notice is all of them, no matter which channel they were recorded from has the original air date. Is it possible to make the script sort by original air date?

    Edit to also add, could it be that this information (season and episode) is not in the actual shows title?
     
  14. Sep 19, 2007 #14 of 124
    rbautch

    rbautch User

    3,629
    0
    Feb 5, 2004
    Chicago, IL
    It sorts the entire folder, but the title of the show or the episode has to have season/episode info in the name. The script looks for this information in SxxEyy format, so in order for it to work for you, you'd have to change the episode title to "Charles is permanently assigned to the 4077th_S02E12", assuming this was the 12th episode from the second season. Sorting by the original air date shouldn't be too hard, maybe I'll add it in a future version. Still looking into the error you got. Might be related to asterisks in the title.
     
  15. Sep 26, 2007 #15 of 124
    bengalfreak

    bengalfreak Active Member

    2,147
    17
    Oct 20, 2002
    After installing the robust folders.tcl. I do not get an option to reorder the shows in a folder using season and episode notation. What gives?
     
  16. Sep 26, 2007 #16 of 124
    rbautch

    rbautch User

    3,629
    0
    Feb 5, 2004
    Chicago, IL
    Use option 6. That gives you another menu of stuff you can change within a folder.
     
  17. Sep 26, 2007 #17 of 124
    bengalfreak

    bengalfreak Active Member

    2,147
    17
    Oct 20, 2002
    Gotcha.

    Thanks.
     
  18. Sep 26, 2007 #18 of 124
    Soapm

    Soapm Active Member

    1,662
    8
    May 9, 2007
    Aurora, CO
    rbautch, are you still considering making the original air date an option? It would sure save me from having to rename over 200 shows.
     
  19. Sep 26, 2007 #19 of 124
    rbautch

    rbautch User

    3,629
    0
    Feb 5, 2004
    Chicago, IL
    Yes.
     
  20. Sep 27, 2007 #20 of 124
    StanSimmons

    StanSimmons Senior Moment Member

    4,717
    0
    Jun 10, 2000
    Flower...
    Love the folders.tcl !

    Is there any way to create new folders, rather than renaming existing folders?
     

Share This Page