Developing MeD's Movie Manager interface to XBMC - assistance is needed
#61
phunkyfish Wrote:Has someone come up with a solution in the meantime or might my stuff still be useful?
No solution yet, but it is still being activly discussed, see:
http://forum.xbmc.org/tags.php?tag=odbc
in particularly in this thread:
http://forum.xbmc.org/showthread.php?tid=37449

However this development project might be more interesting for you to join now:
http://forum.xbmc.org/showthread.php?tid=50388

You see, while you where away MeD's Movie Manager have become rather out-dated compared to all the other media manager applications that are available for XBMC today, see:
http://forum.xbmc.org/tags.php?tag=media+manager

Wink
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.
Reply
#62
Hi,
I don't know if there is an easier alternative to import XBMC's database into MeD's, but I just wrote a small python script to convert the most important data (title, imdb id, file path) to a CSV readable by MeD's.
Here it is:

Code:
#!/bin/python
import re,sys
from xml.sax.saxutils import unescape

def getElems(fc,elem):
    a=re.findall("<"+elem+">(.+?)</"+elem+">",fc,re.M|re.DOTALL)
    return a

def getElem(fc,elem):
    a=getElems(fc,elem)
    if len(a)>0:
        return unescape(a[0], {"&apos;": "'", "&quot;": '"'})
    else:
        return None

def printHeader():
    print '"title","imdb","location"'

def correctPath(path):
    if path.find("stack://")>-1:
        path=path.replace("stack://","")
        path=path.replace(" , ","*")
        path=path.replace(",,",",")
    return path

if len(sys.argv) !=2 :
    sys.stderr.write("usage: "+sys.argv[0]+" path/to/videodb.xml [> output.csv]\r\n")
    sys.exit(1)

printHeader()
f=open(sys.argv[1],"r")
fc=f.read()
movies=getElems(fc,"movie")
for movie in movies:
    title=getElem(movie,"title").replace("\"","'")
    imdb=getElem(movie,"id")[2:]
    path=correctPath(getElem(movie,"filenameandpath"))
    print '"'+title+'","'+imdb+'","'+path+'"'

Install python, export your database to a single file and start the following from the command line (assuming you are in the directory of videodb.xml and have python in your path):
python xml2csv.py videodb.xml > videodb.csv

In MeD's, select import from csv, select UTF-8 encoding and import your file. Important: Select the option NOT to query IMDB for information. Otherwise it'll search imdb for every movie's title.
In the next screen with the spreadsheet, right-click the columns to assign "IMDB", "Title" and "File Location" to the fields. Import everything.
Select tools->Update IMDB info. Select everything you want to fetch from IMDB (I unchecked title and AKA, because they both(!) overwrite the title I renamed the movie to). It takes a while to re-fetch all information from IMDB, but at least you don't have to re-select every movie in you collection.

Hope this works for you too!
Reply

Logout Mark Read Team Forum Stats Members Help
Developing MeD's Movie Manager interface to XBMC - assistance is needed1