App to Copy Artwork and Details to Movie Folder v0.5.6 (4 Viewers)

RoChess

Extension Developer
  • Premium Supporter
  • March 10, 2006
    4,434
    1,897
    Re: App to Copy Artwork and Details to Movie Folder

    I planned on adding a prepend movie name option to all the files it creates and most of the code is already there, just never finished it, I'll see if I have time today to get to it. For the folder names, it would be possible, however having it update the MP database as well would add quite a bit of work to it. Also if I start moving files around and changing the database, I would like the problem below fixed first.

    Keep in mind that you could just rely on the Moving Picture plugin itself to take care of a lot of things. The Disk Watcher seems almost ideal as of new v1.0.x beta with DELAYED support on locked files as well as support for moving files between monitored folders.

    Right now I go into the Movie Import configuration to manually approve some movies that failed to auto-approve, and instead of using the drop down box to select the right one, I usually have Windows Explorer open at the same time and just rename the file and then restart the importer.

    I just wasn't doing it this way until recently, so my existing collection has a lot of files that I manually approved via the drop down selection. Your program would allow me to have all those files renamed auto based on the existing MovPic database info, so that if disaster strikes and I have to re-import everything from scratch that at least everything will auto-approve correctly (based on filename alone if needed, but NFO to seal the deal). It also makes it easier to 'share' with non-MediaPortal clients.
     

    jmcentire

    Portal Pro
    November 7, 2008
    85
    136
    Home Country
    United States of America United States of America
    Re: App to Copy Artwork and Details to Movie Folder

    New version 0.3.9 - Updated first post.

    The app now handles special characters! However I only have a few movies with special characters so let me know how it works for you. Thanks to dongadomski for finding the cause of this problem!

    With this version you can now prepend the movie's filename(without extension) to your cover, fanart, info and link files. If you enable this option remember to add a space or _ to the input field for the file name(otherwise it will end up movienamecover.jpg). Some may ask why I used the movie's filename instead of the title...First if your movies are all in one folder you probably want the cover to show up next to the movie file(which may be named different than the title)....Second quite a few movies have : or other chars in their name which windows doesn't support in filenames. The downside to this is if you have multiple files for a movie(cd1 and cd2 etc.) it will create a file for each.

    Here is the link from XBMC's Wiki for nfo formatting:

    Import - Export Library - XBMC

    Thanks for the link....I'll get working on this, but it may take a little while.

    Would anyone be opposed to dropping the current info file format and replacing it with the xbmc xml format:

    Current:
    Code:
    Title: The 40 Year Old Virgin 
    SortBy Title: 40 Year Old Virgin, The 
    Year: 2005 
    Certification: NC-17 
    Tagline: A Comedy about the moments that touch us in ways we've never been touched before.

    XBMC:
    Code:
    <movie>
    <title>The 40 Year Old Virgin</title>
    <sorttitle>40 Year Old Virgin, The</sorttitle>
    <year>2005</year>
    <mpaa> NC-17</mpaa>
    <tagline>A Comedy about the moments that touch us in ways we've never been touched before.</tagline>
    </movie>
     

    sjcato

    Portal Member
    May 28, 2007
    16
    0
    Re: App to Copy Artwork and Details to Movie Folder

    I, for one, would love to see the XBMC format used - since MoPi can now scrape it, it will be very useful. And who could object to XML anyway?:D
     

    kiwijunglist

    Super Moderator
  • Team MediaPortal
  • June 10, 2008
    6,746
    1,751
    New Zealand
    Home Country
    New Zealand New Zealand
    Re: App to Copy Artwork and Details to Movie Folder

    There is a disadvantage to renaming the filename of the movie.

    1. If you play the movie and find that it is a bad encoding, you don't know what version/rip you downloaded.
    2. If you play a movie and realise you need the subtitles, it is hard to find the correct subtitle version unless you know the original filename of the movie.

    I prefer to have the folder name nicely formatted as \%title% (%year%)\ and keep the filename as the original filename.
     

    jmcentire

    Portal Pro
    November 7, 2008
    85
    136
    Home Country
    United States of America United States of America
    Re: App to Copy Artwork and Details to Movie Folder

    There is a disadvantage to renaming the filename of the movie.

    1. If you play the movie and find that it is a bad encoding, you don't know what version/rip you downloaded.
    2. If you play a movie and realise you need the subtitles, it is hard to find the correct subtitle version unless you know the original filename of the movie.

    I prefer to have the folder name nicely formatted as \%title% (%year%)\ and keep the filename as the original filename.

    No plans for renaming movie files, especially with this app I don't want to change anything with your movies or database.

    If I do decide to create an app for RoChess that organizes movies into folders based on movie title, that would be a separate app just for that purpose.
    BTW if RoChess or anyone would like to help you could write a ahk function to accept a movie title string and return a windows filename compatible string. Should be fairly easy just remove any of the following: \ / : * ? " < > |
    After that is done, it wouldn't take me too long to finish it.
     

    kiwijunglist

    Super Moderator
  • Team MediaPortal
  • June 10, 2008
    6,746
    1,751
    New Zealand
    Home Country
    New Zealand New Zealand
    Re: App to Copy Artwork and Details to Movie Folder

    BTW if RoChess or anyone would like to help you could write a ahk function to accept a movie title string and return a windows filename compatible string. Should be fairly easy just remove any of the following: \ / : * ? " < > |
    After that is done, it wouldn't take me too long to finish it.

    Convert text string to acceptable filename format

    Below example will convert movietitle="Æon Flùx*" into movietitle="Aeon Flux"
    Obviously the special character list should be expanded.

    Code:
    txt=Æon Flùx*
    
    MsgBox % txt
    
    ;replace special characters with non special equivalents
    
    replace=àa|áa|âa|ãa|äa|åa|çc|èe|ée|êe|ëe|ìi|íi|îi|ùu
    Loop, Parse, Replace, |
    {
    StringSplit, Part, A_LoopField
    StringReplace, txt, txt, %Part1%, %Part2%, All
    }
    
    ;replace Æ with AE
    
    txt := RegExReplace(txt, "Æ", "AE")
    
    ;replace æ with ae
    
    txt := RegExReplace(txt, "æ", "ae")
    
    ;replace space with underscore
    
    txt := RegExReplace(txt, " ", "_")
    
    ;remove any chars that remain that are not "a-zA-Z0-9_"
    
    txt := RegExReplace(txt, "\W", "")
    
    ;replace underscore with space
    
    txt := RegExReplace(txt, "_", " ")
    
    MsgBox % txt
     

    RoChess

    Extension Developer
  • Premium Supporter
  • March 10, 2006
    4,434
    1,897
    Re: App to Copy Artwork and Details to Movie Folder

    I personally use the ; character to replace : in a title, which still allows for a valid filename.

    And not sure what OS you guys are using, but this is the official Microsoft answer:

    Use any character in the current code page for a name, including Unicode characters and characters in the extended character set (128–255), except for the following:

    • The following reserved characters: < > : " / \ | ? *
    • Integer value zero, sometimes referred to as the ASCII NUL character.
    • Characters whose integer representations are in the range from 1 through 31, except for streams where these characters are allowed.
    • Any other character that the target file system does not allow.

    The only obvious conversion into filename problem are the :, / and ? chars that are used in certain titles (have never seen any other of the reserved ones, unless somebody can point them out, actually scratch that, I just remembered movie "Bat*21").

    So "Star Wars; Episode III - Revenge of the Sith [2005].mkv", "Æon Flux [2005].mkv" and "Vi på Väddö [1958].avi" are perfect valid filenames. The only reason I sometimes do not use those weird characters is when the auto-approve rate declines from it.

    My personal replacement list is as follows:

    • : = ;
    • / = _
    • ? = (nothing, just remove)
    • * = ¤ (ALT+0164)
    • " = '' (two single quotes)
    • < = [ or (
    • > = ] or )

    Chars that MediaPortal or MovingPictures don't recognize are replaced with nothing or space. The only problem I run into is in filenames such as "That's A Problem", because it doesn't always get the right auto-approval on "that s a problem" (but that is mainly with MediaPortal).
     

    jmcentire

    Portal Pro
    November 7, 2008
    85
    136
    Home Country
    United States of America United States of America
    Re: App to Copy Artwork and Details to Movie Folder

    Ok, the folder organizer script is almost done...actually it is done, but now I am playing with updating the MoPics db with the new locations...so I'll be back when that is done. I am also adding an option to rename existing directories instead of creating new ones, so those of us who already have our movies in individual dirs can use this to get our directory names in order.
     

    kiwijunglist

    Super Moderator
  • Team MediaPortal
  • June 10, 2008
    6,746
    1,751
    New Zealand
    Home Country
    New Zealand New Zealand
    Re: App to Copy Artwork and Details to Movie Folder

    I am also adding an option to rename existing directories instead of creating new ones, so those of us who already have our movies in individual dirs can use this to get our directory names in order.

    That's cool.

    You have to decide what to do about foreign movies

    eg. Das Leben der Anderen (2006)

    Title = Das Leben der Anderen
    AKA = The Lives of Others (UK) (USA)

    So options are;

    \Das Leben der Anderen (2006)\
    or \The Lives of Others (2006)\
    or \The Lives of Others [Das Leben der Anderen] (2006)\

    I prefer to have the English title in the directory structure, This doesn't work as well for parsing, however since your app is working with movies that are already in the database then this doesn't matter. Also since we have method for adding the .nfo file this doesn't matter either.
     

    jmcentire

    Portal Pro
    November 7, 2008
    85
    136
    Home Country
    United States of America United States of America
    Re: App to Copy Artwork and Details to Movie Folder

    I should probably start a new thread for this, but thought a couple people could test it first :D

    Attached is my Folder Organizer script.

    For people who have their movies in common folders:
    Creates a new folder for your movies based on the Title from Moving Pictures, then moves the movie files into their respective folder, then updates the Moving Pictures Database with the new locations.

    For people who already have their movies in individual folders:
    In options you can change it so that it renames existing folders(instead of creating new ones like above) to the Title from Moving Pictures then updates the Moving Pictures Database with the new folder names.

    The default replacements for incompatible characters are as follows:
    • : = ;
    • / = _
    • \ = _
    • ? = (blank)
    • * = (blank)
    • " = '' (two single quotes)
    • < = (
    • > = )

    But you can change any of these in the options screen.

    Remember, use at your own risk. It only updates the db if the move or rename was successful, so it shouldn't cause any problems.

    Let me know how it works!
     

    Attachments

    • options.JPG
      options.JPG
      34.8 KB
    • MP Folder Organizer v0.1.1.zip
      30.7 KB

    Users who are viewing this thread

    Top Bottom