Menu

Spring cleaning 3000+ entries

bill
2011-06-09
2013-02-12
  • bill

    bill - 2011-06-09

    Hi bro, I just revamped my storage and ran into a few problems with your excellent software that have forced me to offer my suggestions ;)  During this revamp, I found over 80 erroneous entries and over 20 missing entries.

    I use WinXP,  Win7, and Leenux, an Intel 2600K processor with eight GB RAM, a SSD system drive, and I now alphabetically store movies on two separate 1.5GB drives.

    1. Even though I now do not show thumbnails on movie list, scrolling the list often causes a lock-up of MMM software, especially if I scroll after making a change in one or more entries without first exiting/re-entering program.  What would be nice to help my issue is a alphabetical Rolodex, maybe lined up with the scroll bar in betwixt the list and info panes.  Click on the 'C' button and it jumps the list to the first 'C' movie (not show only 'C's).

    2. I have no reasonable way to confirm what movies are in the HD directory, compared to what is in the MMM list.  I can browse each movie in the list (tedious), and if the 'play' button is grayed out, I know the movie is in some way not available on the HD, BUT, how can I verify all of the movies on the HD are actually in the list?  We're talking 1600+ files in a HD directory.  Could some compare function be made available to list all files in a dir that are not listed in MMM and vise-versa?

    3. Adding new movies can be quite difficult.  I have found for my organization method, I must name the file the same as is named in MMM.  It often takes an overnight or weekend for myself and IMDB to schedule ourselves to complete this task.  By the time I'm done, I will have probably added several movies that have foreign default names, and I'm sure I missed a couple that need renaming to my preferred English.  How do I find those movies in MMM?  I may have no memory that 'The Prisoner of Zenda' was renamed to 'et ali babab' or whatever.  So now I have to search through 3000+ entries in MMM for something foreign which I don't know I'm looking for.  Could maybe a List be automatically generated after the add movies session to show this session of added movies, regenerated each time movies are added?  Then I could view and fix whatever 'et ali babab' refers to.

    4. Cut, copy, and paste mouse functionality desperately needed.

    If you don't have the time, or don't wish to improve on my potentially trivial matters, what would it cost me for you to add the above functionality?

     
  • bill

    bill - 2011-06-09

    Actually, the rolodex idea might be better if it only showed that letter's entries.  Then just have an 'all' button at the top and bottom of the rolodex list.  That way, I could jump into the 'Cs'  and back out into something else, using less resources all around.  Of course, search would still work across the whole alphabet, not just the loaded letter (or whatever you thought was best).

     
  • Eric Mcknight

    Eric Mcknight - 2011-08-01

    I created a php script that can rename / move movies around with ease.

    By default, my script will rename movies to their imbd number identifier. It has a few differant formats it c an use to rename movies, and, it has the ability to move them around and organize them better. Pretty simple, but, it gets the job done.

    <!doctype html>
    <html>
      <head>
    
        <meta http-equiv="Content-Type" content="text/html">
          <title>
            Renaming all media to names present in the database.
          </title>
        <link type="text/css" href="dvdresult.css" rel="stylesheet">
        <link rel="shortcut icon" href="moviedb/icon.ico"/>
      </head>
      
    <body>
    <?php
    /*
    //////////////////////////////////////////////////////////////////////////////////////////////
    // Credits.. Myself -> Eric Mcknight, Admin@xtremeownage.com, Xtremeownage.com              //
    // I spent about 2 days working on this here and there..... it was only going to            //  
    // be used on my computer... but, i figured what the hell and decided to add all            //
    // of this commenting and all of these adjustable options. Should work fine on              //
    // anybody elses computer... well, save for the fact everybody isnt running their           //
    // own private php/apache/mysql servers... but, anyways, here it is. Comments / questions   //
    // and complaints can be directed to xtremeownage.com, you can also ask for help there.     //
    //////////////////////////////////////////////////////////////////////////////////////////////
    */
    //<meta charset="UTF-8">
    // OPTIONS!!!! LOTS OF OPTIONS!!!
    // TITLE FORMAT
    // You may need to fix the .css stylesheet paths above....
    //and.... This file was designed to be placed in my root movie dir.... no guarentees it will work differantly.
    //If you would like a differant format for the title, email me at admin@xtremeownage.com
     // 1 = tt32098324.avi = Save as IMDB number format - This is what i default to.
     // 2 = 10,000bc (2010).avi = Save as TITLE ( YEAR ) format - This is what most of you will use.
     // 3 = 10,000bc.avi = Save as title format - can cause errors with multiple movies with same name
     // 4 = 1.avi, 399.avi = Save as database ID number - not a very useful idea.
      // 5 = tt32098324-10,000bc (2010).avi
    //Ie, #3 can mess up if you have say.... Moviename (2010) and Moviename (2004).... belive me, i have movies like this.
     //i presonally prefer #1 because, in the event my database and their backups die.... 
     //it would take about 10 seconds for meds to import everything... because.. the imdb id is in the filename.
    $titleformat = 2; //options... 1,2,3,4
    //DISPLAY OPTIONS CHANGE THESE TO TRUE TO HIDE THESE MESSAGES
    //If you change them to true, any movie that output one of these errors will be suppressed and that line
    //will not be shown. The best settings are just how they are...
    //TRUE OR FALSE
    $suppress[0] = TRUE;//"NO IMDB INFO FOUND"
    $suppress[1] = TRUE;//"FILE IGNORED, MULTIPLE PARTS"
    $suppress[2] = FALSE;//"FILE NOT FOUND"
    $suppress[3] = TRUE;//"NO RENAME NEEDED"
    $suppress[4] = FALSE;//"SQL UPDATE FAILED"
    $suppress[5] = FALSE;//"SUCCESS"
    $suppress[6] = FALSE;//"RENAME FAILED"
    $suppress[9] = FALSE;//"TARGET FILE ALREADY EXISTS"
    //These varibles are special. They will suppress a entire group of shit. 
    //TRUE OR FALSE
    $suppress[7] = FALSE;//supress all successful queries.... Successful is.... success or completed or no rename needed file ignored... etc. pretty much anything that completed successfully
    $suppress[8] = FALSE; //suppresses things that were not successful... ie, file not found.... renamed or sql update failed... 
    //HERE, YOU CAN CHANGE THESE MESSAGES.... FOR DIFFERANT LANGUAGES OR SOMETHING.
    $msgs[0] = "NO IMDB INFO FOUND";                //When a IMDB number is not found
    $msgs[1] = "FILE IGNORED, MULTIPLE PARTS";      //When a * is found.... Meds puts those for multiple files.
    $msgs[2] = "FILE NOT FOUND";                    //Could not find or access the source file
    $msgs[3] = "NO MODIFICATION NEEDED";            //File already has proper filename and location
    $msgs[4] = "SQL UPDATE FAILED";                 //Updating the sql database failed.
    $msgs[5] = "SUCCESS";                           //Transfer successful
    $msgs[6] = "RENAME/MOVE FAILED";                //The rename/move process failed... check permissions
    $msgs[7] = "ERROR";                             //General error message shown when something goes wrong
    $msgs[9] = "TARGET FILE ALREADY EXISTS";        //file in destination folder has the new name already.
    //How many queries to execute... If your testing this, i reccomend a low number to ensure you get the proper results.
    //change to -1 to execute all. If you change to... say 5, it will only execute 5 queries.
    $qtoexec = -1;
    //change to true to overwrite existing files when moving or renaming.
    $overwritefiles = FALSE;
    //SQL CONNECTION STRINGS AND DATABASE SETTINGS!!!
    //mysql_connect("Host","User","Password");
    mysql_connect("server ip / hostname here","database name","password") or die ("no connection possible");
    mysql_select_db("opendb") or die ("db does not exist");
    //SQL STRING.... THIS SELECTS ALL MOVIES IN DATABASE.
    $sql = "SELECT ID, file_location FROM Additional_Info";
    //TARGET DIRECTORY TO MOVE FILES TOO
    $zpath = "Z:/";
    //removies the path from a given filename
    function remove_path($filename){return basename($filename);}
    //This simple function returns the extension of the file. usually works pretty good.
    function findExt($filename){return strtolower(substr(strrchr($filename,'.'),1));}
    //this function will remove the illegal characters when saving a filename as the imdb title.
    //will also remove empty ()s resulting from no year being in the database.
    function fix_chars($filename)
    {
    //remove the illegal characters
    $illegal = array("?", "*", "|", "/", "\\", "\"", "<", ">");
    $filename = str_replace($illegal, "", $filename);
    //replace :s with ;s looks pretty i guess....
    $filename = str_replace(":", ";", $filename);
    //replace () ie, years with no defined year.
    $filename = str_replace("()", "", $filename);
    //return the corrected filename
    return $filename;
    }
    $query = mysql_query($sql);
    $numresults = mysql_num_rows($query);
    $helper = 0;
    if ($numresults == 0) 
        echo "<p class=\"msg\">Nothing found, Check your database query.</p>";
    else 
        { //the html to make up the pretty columns. i didnt make this. just modified preexisting code. no reason to reinvent the wheel
            echo "<table align=center id=\"listing\"><tr><td><p class=\"msg\">$sql</p></td></tr><tr>";
            echo "<td class=\"title\"><p class=\"msg\">$numresults results found.</p></td></tr></table>";
            echo "<table id=\"listing\"><tr><td class=\"title\">OLD FILENAME</a></td>";
            echo "<td class=\"title\">MOVIENAME</a></td><td class=\"title\">NEW NAME</a></td>";
            echo "<td class=\"title\">SUCCESS?</a></td><td class=\"title\">MESSAGE</a></td></tr>";
            while($line = mysql_fetch_row($query))
            {
                $line[1] = iconv('UTF-8', 'ISO-8859-1',$line[1]);
                $helper += 1;
                //this pulls the imdb stored movie name from the database. currently pulls date, title, and imdb number.
                $movietitle = mysql_fetch_row(mysql_query("SELECT TITLE, DATE, IMDB FROM General_Info WHERE ID = $line[0]"));
                if(strlen($movietitle[2])<1)    //ignore movies without imdb shit... nothing to update.
                {
                    $newname = $msgs[7];
                    $successful = TRUE;
                    $errormessage = $msgs[0];       
                }
                else if (strpos($line[1], "*")) //multiple cds..... lets take care of this...... on second though, fuck that.
                {                               //This would be more code then i care to do tonight. might fix it sometime else
                    $newname = $msgs[7];        //until then, i like avijoiner anyways....
                    $successful = TRUE; 
                    $errormessage = $msgs[1];
                }
                else if(!file_exists($line[1])) //Cannot find the source file.... Nothing else to do here.
                {
                    $newname = $msgs[7];
                    $successful = FALSE;
                    $errormessage = $msgs[2];
                }
                else                            //Hey.... we got past the error checking!!
                {
                $movietitle[0] = iconv('UTF-8', 'ISO-8859-1',$movietitle[0]);
                //get the extension from the file name. 
                $extension = findext($line[1]);
    
                    //this calculates the new name to rename the files as. also removes illegal chars and empty name tags.
                switch ($titleformat)
                {
                    case 1: //Name as IMDB number, had to put the tt in there for some reason. i dont know why... dont ask... it works  
                            $newname = $zpath . "tt" . $movietitle[2].".".$extension;
                            break;
                    case 2: //Name as IMDB title + (year)
                            $newname = $zpath . fix_chars($movietitle[0] . " (" . $movietitle[1] . ")." . $extension);
                            break;                      
                    case 3: //Name as IMDB TITLE
                            $newname = $zpath . fix_chars($movietitle[0] . "." . $extension);
                            break;
                    case 4: //Name as Database number. Dont know why anybody would ever do this...
                            $newname = $zpath . $line[0] . "." . $extension;
                            break;
                    case 5: // IMDB NAME (YEAR)
                            $newname = $zpath . "tt" . $movietitle[2]."-".fix_chars($movietitle[0] . " (" . $movietitle[1] . ")." . $extension);
                    default://default.... if somebody doesnt put in titleformat right... saves as name (year).extension
                            $newname = $zpath . fix_chars($movietitle[0] . " (" . $movietitle[1] . ")." . $extension);
                            break;
                }       
                            //ok. last minute error checking
                    if($newname == $line[1]) //if the file is already named properly, dont do anything.
                    {
                        $successful = TRUE;
                        $errormessage = $msgs[3];       
                    }
                    else
                    {
                        if(file_exists($newname) && !$overwritefiles)   //if the newfilename.avi already exists, we have a problem... abort.
                        {   //looks like we already have a $newname.ext in our destination directory.... abort, error.
                            $successful = FALSE;
                            $errormessage = $msgs[9];
                        }   
                        else    
                        {
    
                            if(rename($line[1], $newname)) //if all goes well... the rename will work... 
                            {
                                if(mysql_query("UPDATE Additional_Info SET file_location = \"$newname\" WHERE ID = \"$line[0]\""))
                                {   //yay, our rename and move worked. lets hope the sql query works... if so, we are done!
                                    $successful = TRUE;
                                    $errormessage = $msgs[5];
                                }
                                else
                                {   //damn, the sql update failed. lets attempt to undo the file move and then throw a error.
                                    rename($newname, $line[1]);
                                    $successful = FALSE;
                                    $errormessage = $msgs[4];
                                }
                            }
                            else
                            {       //our rename/move did not work... throw a error
                            $successful = FALSE;
                            $errormessage = $msgs[6];               
                            }
                        }
                    }
                }
    
                //If somebody can tell me the proper way to write this clusterfuck... that would be appreciated.
                //until then... this works... but, it just seems unefficient.
                //oh.. and this is the code that suppresses outputting different errors or messages.
                    if($errormessage == $msgs[0] && $suppress[0]){}//do nothing
                elseif($errormessage == $msgs[1] && $suppress[1]){}//do nothing
                elseif($errormessage == $msgs[2] && $suppress[2]){}//do nothing
                elseif($errormessage == $msgs[3] && $suppress[3]){}//do nothing
                elseif($errormessage == $msgs[4] && $suppress[4]){}//do nothing
                elseif($errormessage == $msgs[5] && $suppress[5]){}//do nothing
                elseif($errormessage == $msgs[6] && $suppress[6]){}//do nothing
                elseif($errormessage == $msgs[9] && $suppress[9]){}//do nothing
                elseif($suppress[7] && $successful){}//do nothing
                elseif($suppress[8] && !$successful){}//do nothing
                else
                {
                // aah, nice, this movie did not fail the error/success message remover.
                //this displays the information in the table so that i can see it is working properly.
                if($successful){$successful="TRUE";}else{$successful="FALSE";} //i hate when it gives me a 1 or a 0....
                echo "<td class=\"title\">$line[1]</a></td>";
                echo "<td class=\"title\">$movietitle[0]</a></td>";
                echo "<td class=\"title\">$newname</a></td>";
                echo "<td class=\"title\">$successful</a></td>";
                echo "<td class=\"title\">$errormessage</a></td></tr>";
                }
                if($helper == $qtoexec){break;} //This line will limit the number of queries that can be executed.
    
            }
        //we are all done... table closing tags.
        echo "</table>";
        }
    mysql_free_result($query); 
    ?>
    </body>
    </html>
    
     
  • Gianni B

    Gianni B - 2011-08-09

    would you be so kind to tell me how to use it?

     
  • Eric Mcknight

    Eric Mcknight - 2011-10-25

    You need to setup a php/mysql server. You can download xampp which is a portable version of the needed programs. Then, put this in a file called… index.php in your documentroot, and goto http://localhost/

     
  • new2nas

    new2nas - 2012-04-22

    To verify my files I just use the export function.
    I'm sure you could find a freeware file locator that reads in a flat file created by the export to do what you want. Its a job that needs doing only occasionally. If you know Excel or Access you could write a script pretty easy….
     

     

Log in to post a comment.