Phpvideodb to xbmc
#1
Thumbs Up 
hi,
i am a total newbie to python but i have an idea.
i use this to organize my dvd movies:
phpvideodb

i created a xml file which contains information about the movies, taken from the database and converted to xml using perl.
it looks like this:

Quote:<row>
<title>barfly</title>
<language>english</language>
<year>1987</year>
<imgurl>http://ia.imdb.com/media/imdb/01/i/44/72/80m.jpg</imgurl>
//some other lines go here
</row>
now is there a way to write a python script that creates from this information a listing?
i looked at some rss news scripts to understand hot it works,
but often they are to specific to use them for my needs.
the xml file can be accessed through a local apache server or simply copied to the xbox.

if someone can give me some hints or has free time to set up an initial code, i would do my best to help and finish the script to perfection.

thx
rupert04
Reply
#2
python can easily parse your xml and do whatever you want with all the informations.
it will download the xml, then read it to extract all the tags.

i am too much a beginner, and i don't know anything with xml... but many many existing scripts are doing like this
Reply
#3
no one?
it couldn't be that uninterresting, only thing is that many people dont have a apache or something else running.
but from my knowledge many other media(movie, music) databases tools have a export function, maybe there is a way to make this thing multi backend able.
i wish i could start python, but atm i have to learn java for school.
Reply
#4
sorry, but you answered like if you didn't see my answer....
Reply
#5
oh, i read it.
can you point me to some scripts that can be converted,
the ones i tried where to special.
Reply
#6
the script that use the most xml i think is named kml browser.
i don't know yet how to use dom.minidom xml parser. but i need to learn.
Reply
#7
hi there,
i have done this two weeks ago with my movies db. now i can see my movie db using the xbmc. and with the posters  of the movies! Smile

i have my movies db in a apache web server and i use this php program to manage the db: modified version of php4flicks version 0.33.4
this php script can retrieve all the information from imdb inclued the poster of the moive similar to phpvideodb.


this is my web movies db: http://www.afeno.no-ip.com/pelisdb/index4.php

and this is the xml that it's automatically created using a php that i mafe to have the hole list of the movies:
http://www.afeno.no-ip.com/pelisdb/print/listxml.xml

then, my phyton scrip access to this xml and generate the list. it also download the poster and save them in the hd the first time that you check one movie.

this script was designed to work with this xml design, but you can adapt it to your xml format.

here you are phytom script that i created:
http://www.afeno.no-ip.com/mymovies.py
screenshot:
http://www.afeno.no-ip.com/screenshot.jpg

i have to say that i'm a beginner. i just used some others scripts to understand how does it works...

now, i'm trying to check the imdb information directly throw the phytom script. does anyone know if i can call to some function/procedure from phytom to access to the imdb information for a movie?


saludos.
alfredo.
Reply
#8
sounds very good,
i will check your scripts out when they arrive.
--
it dont really understand how the xml file gets parsed,
i think its this lines:
Quote:for item in items:
peli = str(item.childnodes[3].childnodes[0].nodevalue)
dura = str(item.childnodes[7].childnodes[0].nodevalue)
medias = str(item.childnodes[1].childnodes[0].nodevalue)
id = str(item.childnodes[11].childnodes[0].nodevalue)

self.posters.append(id)

game = medias+"-> "+peli+" ("+dura+" min)"

what do i have to change that my xml style gets parsed?
peli is the title, right?
is that spain?
Reply
#9
hi,
in my case, the xml file has this format:

Quote:  <item>
 <nr>d028</nr>
 <name>before sunset</name>
 <lang>en</lang>
 <runtime>80</runtime>
 <medium>divx/xvid</medium>
 <id>381681</id>
 </item>

and the way that i access the data from the xml that i want is:

item.childnodes[1].childnodes[0].nodevalue -> is d028 (dvd number)
item.childnodes[3].childnodes[0].nodevalue -> before sunset (movie name)
item.childnodes[5].childnodes[0].nodevalue -> en (language)
item.childnodes[7].childnodes[0].nodevalue -> 80 (time)
item.childnodes[9].childnodes[0].nodevalue -> divx/xvid (type of avi)
item.childnodes[11].childnodes[0].nodevalue -> 381681 (imdb movie id)

and then i creat the row to add in the list:
game = medias+"->  "+peli+"   ("+dura+" min)"

d028->  before sunset (80 min)

and i do this for each item (movie)

Quote:for item in items:
peli = str(item.childnodes[3].childnodes[0].nodevalue)
dura = str(item.childnodes[7].childnodes[0].nodevalue)
medias = str(item.childnodes[1].childnodes[0].nodevalue)
id = str(item.childnodes[11].childnodes[0].nodevalue)

self.posters.append(id)

game = medias+"->  "+peli+"   ("+dura+" min)"
Quote:what do i have to change that my xml style gets parsed?
1) first, made the necessary changes to get the movie list working.
2) then you have to modify the code to get the posters properly.


1) you have to change this part of the code in order to get all the movies properly:

source:
for node in dados.documentelement.childnodes:
if (node.nodename == "item"):
items.append(node)

changed:
for node in dados.documentelement.childnodes:
if (node.nodename == "row"):
items.append(node)

source:


for item in items:
peli = str(item.childnodes[3].childnodes[0].nodevalue)
dura = str(item.childnodes[7].childnodes[0].nodevalue)
medias = str(item.childnodes[1].childnodes[0].nodevalue)
id = str(item.childnodes[11].childnodes[0].nodevalue)

self.posters.append(id)

game = medias+"->  "+peli+"   ("+dura+" min)"

changed  for your xml:

for item in items:
title= str(item.childnodes[1].childnodes[0].nodevalue)
lang = str(item.childnodes[3].childnodes[0].nodevalue)
year= str(item.childnodes[5].childnodes[0].nodevalue)
image = str(item.childnodes[7].childnodes[0].nodevalue)

self.posters.append(image)

game = year+"  "+title+"   ("+lang+")"

2) now, you have to change the 'poster()' function:
(all the posters are stored in the 'posters' array)

source:
def poster(self,post):
bg2 = downloadimage2('http://'+dirip+'/pelisdb/imgget.php?for='+self.posters[post],self.posters[post]+".jpg")
self.addcontrol(xbmcgui.controlimage(580,50,97,150, bg2))

changed for your xml:
def poster(self,post):
bg2 = downloadimage2(self.posters[post],imgname(self.posters[post]))
self.addcontrol(xbmcgui.controlimage(580,50,97,150, bg2))

and in your case you have to create a new function 'imgname':
imgname (url)Confusedtring

that takes as argument the url and return the a name of the image. you only have to ensure that it generate a different name of different urls but it have to generate the same name for the same url... or something like this:
imgname(http://ia.imdb.com/media/imdb/01/i/44/72/80m.jpg)=
01i447280m.jpg

please, take in mind that the 'changed for your xml' code is just a suggestion but i didn't try it and may be it doesn't work or may be it has syntax errors. it's just the idea.


Quote:peli is the title, right?
yes, peli is the title of the movie.
Quote:is that spain?
yes, it's spanish.

good luck!
if you have any doubt just let me know.
i hope that i can help you, but i'm not use to program in phytom....

best regards.
alfredo fenoglio
Reply
#10
Thumbs Up 
hi guys...
interesting topic i think ! Smile but the most interesting thing isn´t said there. did anyone manage to solve the issue to convert his data to the xbmc - for example as mentioned as a python solution.
i´m very interested in this topic and if anyone has brought this topice any further plz post it in here. i think a proper solution is a great for all of us thinking of doing something like that.

i´m interested in everything beginning from what software are you using for webserver/php/perl/python to the scripts themselves.

plz email me instantly :thumbsup:

thank you very much for your work !
Reply
#11
i have sent you an email.
Reply
#12
:bowdown:
thanks for the reply - i had already a look at you site and your scripts and adopted that to my needs. a problem comming up here is if i am looking through some films and covers sometimes the picture isn´t changing ! the last one working is displayed an nothing more. shure i can go back to the script menu and start a new try. do you have any problems similar to that description or any hint for me -- maybe am memory prob? but how can i check that? btw what sript do you use to convert your db into to xml? the second problem i have is that special letters like ä ö ß aren´t converted in the right way! on my xbmc they look misspelled. Image


i am new to coding and englisch language - sorry for misspelling and silly questioning Smile big thx 4 support
Reply
#13
hi there,
yes, sometimes the poster of the movie is not the one that it's selected. you just have to press the a or x (i don't remember).
i'm working in the new version that will solve this problem. and it will include more features. i'm traing to get the movie information from imdb like the xbmc does.
here you are the php script that i'm using (very simple) to generate the xml from the db: http://www.afeno.no-ip.com/listxml.txt
and to correct the letters problem you can replace the charactes that you want with the correct code (check in the script, i replaced the á with a, etc...) but i don't know if xmbc support special characters...

see you.
best regards.
Reply

Logout Mark Read Team Forum Stats Members Help
Phpvideodb to xbmc0