How do I update video database after hard-drive update? (1 Viewer)

RobAtBentley

Portal Pro
July 31, 2013
64
0
64
Suffolk
Home Country
United Kingdom United Kingdom
Question: How best to update my video database when replacing one of my HD drives, containing my video mkv files?

Bit of background...
I've run out of space on my suite of 1Tb hard-drives and will be installing a new 3Tb HD (U: drive) in place of one of the old (in this case the E: drive) as I don't have any spare HD slots in my server. I have copied all my videos from my E: drive (1Tb) onto the new 3Tb HD E: drive. I'm not sure of the best way of refreshing the video database and need some advice. I'd like to avoid adding duplicates of the videos in the database. I think there are options on the video database scan but would like some guidance before playing around with it.

I assume that ensuring that my new 3Tb HD has the same drive letter (E: in this case) as the old 1Tb it's replacing, then I shouldn't have to refresh the video database at all. Is this the case? ...but if I retain the new 3Tb HD drive letter of U: then are there options for updating without producing duplicates? i.e. Getting the video scan to update the file location path and leave everything else the same.

Edit: I may have to go with the latter solution (retaining drive letter of U:) as I'm using o/s WHS 2011 and it won't allow me to create a duplicate logical path name of DVDFilmsOnE (already exists!) so have to call it DVDFilmsOnU which, consequently, means that the path is different. ...and WHS 2011 Dashboard doesn't seem to like it!

I'm also doing the same for the TV Series (i.e. Using MP-TVSeries Configuration) as well (on the same drives) so would also need best practice guide as to how to do this as well.

Thanks...
 
Last edited:

RobAtBentley

Portal Pro
July 31, 2013
64
0
64
Suffolk
Home Country
United Kingdom United Kingdom
Okay. Managed to find a solution to my WHS2011 logical path issue. I can now rename the new 3Tb disk drive letter from U: to E: using Server Manager tool, and WHS2011 requests a reboot which removes the old path references in the WHS2011 Dashboard leaving me to recreate the logical paths using the renamed folders. i.e.
1) Reset drive letter from U: to E: Server Manager tool.
2) Rebooted server.
3) Renamed folders on new 3Tb drive from E:/Serverfolders/DVDFilmsOnU to E:/Serverfolders/DVDFilmsOnE.
4) Recreated WHS2011 logical paths using its dashboard.
5) Re-ran MediaPortalConfiguration video database scan and didn't find any new films as their paths were unchanged.
 

JimCatMP

Documentation Group
  • Team MediaPortal
  • April 1, 2010
    654
    285
    Leeds
    Home Country
    United Kingdom United Kingdom
    You can update drive details [I've done it] by using sql commands [sqlite3] on the database itself - I wrote most of this BEFORE your 2nd posting, so for info only as you've cracked the problem:)

    ---------------------------------------------------
    Limited guide only - use with caution.
    ---------------------------------------------------

    BACKUP the db3 file!!!

    In database dir, run sqlite3 movingpictures.db3

    sqlite> .output Movies.txt
    sqlite> select fullpath,ID from local_media;
    sqlite> .quit

    Above will create file called Movies.txt with one line per movie.

    Example [assume I have only two movies:) -

    D:\Films\Sci Fi\Star Wars\Star Wars II - Attack of the Clones.mkv|1574
    D:\Films\Sci Fi\Star Wars\Star Wars I - The Phantom Menace.mkv|1575

    You now need to edit file so it reads

    update local_media set fullpath="U:\Films\Sci Fi\Star Wars\Star Wars II - Attack of the Clones.mkv" where ID=1574;
    update local_media set fullpath="U:\Films\Sci Fi\Star Wars\Star Wars I - The Phantom Menace.mkv" where ID=1575;

    You also need to work out how to run this file as a script to sqlite

    As I'm UNIX scripter of old, the whole process for me would be [yes, could do it all in one AWK statement....:whistle::

    cat Movies.txt | sed 's/D:/U:/' | awk 'BEGIN{FS="|"}{printf(update local_media set fullpath=\"%s\" where ID=%s;\n",$1,$2)}' | sqlite3 movingpictures.db3


    In DOS, your on your own on how you'd edit the data and stream to sqlite3.

    Then again run sqlite3 movingpictures.db3

    sqlite> .output Import.txt
    sqlite3 > select path,id from import_path;
    sqlite3> .quit

    You now have similar file to Movies.txt, this time your import paths.

    Again, do the editing, your update string per path should look like:

    update import_path set path="U:......" where id=1;

    IMPORTANT - " characters MUST be in correct place.

    Run this a script to do the updates.

    Finally,

    sqlite3 movingpictures.db3
    sqlite> vacuum;
    sqlite> reindex;
    sqlite> .quit

    These last 2 commands free up space in DB structure and update the index's - if you do NOT reindex, it may well not work.

    MP-TVSeres, same approach but you need to work out which tables to update and the fields within the tables.

    TTFN - J.
     

    Users who are viewing this thread

    Top Bottom