Video Database update from server script (1 Viewer)

MeHoo

Portal Member
October 16, 2008
15
0
Home Country
United States of America United States of America
Hello all. First and foremost if this has been mentioned i apologize. Hopefully this can help others and someone can improve on my methods.. since im not a programmer by far [dyslexic lol] i'm sure this isnt the best method at all. Without further delay, the situation:

I have been annoyed since the beginning of my usage of MediaPortal by the lack of server support for the databases as well as the half-implemented feel of the built in IMDB search support within MP [not the config database search].

So.. i resorted to using my main machine to build my video database, modifying thumbs, filenames, etc.. then manually copying them to my server.. going to the mediaportal machine, closing MP, copying the new files, etc.

It was tedious, but i dont like the replacement plugins for videos much and wanted to use MP's default video "page"

Well anyways.. tonight i got bored and fed up with copying thumbnails off the server using my dinovo mini keyboard/mouse which works like crap.. i decided there had to be a better way.

So my solution is to use multishortcut plugin [amazingly simple but effective plugin] as a "Update Movie Database" plugin in my home screen. This points to a shortcut [.lnk file] that points to a .bat file on my machine. Simple enough. The need for a .lnk file is so the .bat does not open a cmd window over MP. I set the shortcut preferences to minimize and point it at the .bat file. Simple.

The code for the .bat is really simple as well.. its basically just using XCOPY and some switches. My config has one thing i dont like but can't seem to avoid. Well your videodatabase file seems to update when you watch movies due to the "watched" status changing. This changes the data modified on the file to newer than the file on your server sometimes, and thus the /d flag on XCOPY ignores the file. So i just force copy it over the local database and lose my "watched" status. Not a huge deal for me to be honest, but may annoy some.

So, the code and my halfwit explanation of it all:
Code:
XCOPY "Y:\Team MediaPortal\MediaPortal\thumbs\Videos\Title\"*.* "C:\Documents and Settings\All Users\Application Data\Team MediaPortal\MediaPortal\thumbs\Videos\Title\" /C /E /D /Y /I /H
XCOPY "Y:\Team MediaPortal\MediaPortal\database\"*.* "C:\Documents and Settings\All Users\Application Data\Team MediaPortal\MediaPortal\database\" /C /E /Y /I /H

I pasted that into a notepad file and saved it as a .bat

What it means basically is that it looks at the first location in quotes as the source, and the *.* basically means "select all". It copies the files into the destination folder defined by the next set of quotes. This is my location but may not be yours. And obviously my server location will not be the same as yours. The flags mean a ton of different things, but the one to notice is the /d on the thumbnails but not on the database. This allows new thumbs to be uploaded, but more importantly it skips the ones already on the local machine that are older. When you have over 500+ movies like me, this saves a TON of time copying files. It only grabs whats new. This is turned off for the database since i need to force copy it.

So this goes into the .bat and i make the shortcut [.lnk] file to this, make it minimized in its properties page, and point multishortcut to the .lnk file NOT the .bat file and name it appropriately. So now in mediaportal i have a home menu option for "Update Movie Database" and once i click it, and wait a second or two, then go back into movies, its all updated with new movies and thumbnails for me =]

I think i'm a rare case that i use another machine to build my database, but if not I hope this helps people. Oh, also.. to aid in uploading FROM my main machine to the server i also wrote a simple .bat file i run once i'm done using mpconfig to build the database. Here's that bat file:

Code:
XCOPY "C:\ProgramData\Team MediaPortal\MediaPortal\database\VideoDatabaseV5.db3" "Y:\Team MediaPortal\MediaPortal\database\" /C /E /Y /I /H
XCOPY "C:\ProgramData\Team MediaPortal\MediaPortal\thumbs\Videos\Title\"*.* "Y:\Team MediaPortal\MediaPortal\thumbs\Videos\Title\" /C /E /D /Y /I /H

This file has the two options mainly because i only use MP for videos.. not music, etc so copying the other database files is a waste of time. I wanted to specify that one file.

Hope this helps someone. I'd love to see this go away to be honest, and allow the use of networked databases, but then again pulling 500 thumbnails off my server most likely isnt the best option either, so perhaps a batch file to randomly check every once in a while that MP is idle would be more intelligent for a refresh. Also, if there was a way to add the new movies without losing the "watched" data in the DB that would be ideal also.

Ok well reply if you need further explaining or have questions, or if you make better files =]

In the end i never have to leave MP now which is nice. One step closer to pure shell-like mediacenter goodness.
 

Users who are viewing this thread

Top Bottom