Cataloging offline movie discs as stubs from mymovies xml export
#1
Hi Everyone,

Hoping somebody might have dealt with this before and already have a script or program they may be able to share.

I basically have approx 600 offline bluray discs on my bookshelf that I have traditionally managed with the MyMovies collection management program. I would like to import these titles into xbmc as .disc stub files so I can see the collection and perhaps have it prompt me to insert the correct disc.

The mymovies export is a monolithic xml file that contains all the titles and their various attributes in one huge file.

Does anyone already have a script they have used to convert this file into a folder full of stubs that can then be scraped as normal?

Any help would be greatly appreciated.
Reply
#2
Looks like nobody else has had to deal with offline disc collection from mymovies.dk management program??
Reply
#3
Give a sample of the xml output from mymovies? (Not the whole 600 thanks!)
If I have helped you or increased your knowledge, click the 'thumbs up' button to give thanks :) (People with less than 20 posts won't see the "thumbs up" button.)
Reply
#4
(2014-09-14, 05:39)nickr Wrote: Give a sample of the xml output from mymovies? (Not the whole 600 thanks!)

Thanks for your response.

I have pasted an example with only two titles as per http://pastebin.com/D8pAqKkQ

Appreciate you having a look at this.
Reply
#5
OK cool.

Do you have access to a linux computer?
If I have helped you or increased your knowledge, click the 'thumbs up' button to give thanks :) (People with less than 20 posts won't see the "thumbs up" button.)
Reply
#6
(2014-09-14, 07:28)nickr Wrote: OK cool.

Do you have access to a linux computer?

I'm sure I could fire up a virtual machine without too much difficulty. Probably ubuntu or mint...
Reply
#7
OK my shell scripting isn't the best, but in linux I installed a package called xmlstarlet. In a directory with nothing else present I downloaded your mymovies.xml file.

I then ran:

Code:
SAVEIFS=$IFS
IFS=$(echo -en "\n\b")
for movietitle in $(xmlstarlet sel -t -m '//LocalTitle' -v . -n <mymovies.xml)  ; do\\ touch  $movietitle.disc; done
IFS=$SAVEIFS

This created a .disc file for each LocalTitle entry in the mymovies.xml. Of course you might want OriginalTitle, in which case the change should be obvious.

What this script does is:

Lines 1 & 2 - save the current value of field separator (shell variable IFS) somewhere temporary called SAVEIFS, then set IFS to ignore spaces
Line 3 - select all the LocalTitle entries in the input file and then output them. That output is put through a loop which takes each LocalTitle and saves it to a temporay name called movietitle. For each entry it uses touch to create an empty file called movietitle.disc
Line 4 - restore IFS to what it was before we started.

PS the line starting "for" and ending "done" is all one line, the forum is wrapping it. Here is the directory listing after running the script.

Code:
nick@envy ~/Downloads/xml $ ls -l
total 32
-rw-r--r-- 1 nick nick     0 Sep 14 18:01 Crank: High Voltage.disc
-rw-r--r-- 1 nick nick 30891 Sep 14 17:28 mymovies.xml
-rw-r--r-- 1 nick nick     0 Sep 14 18:01 The League of Extraordinary Gentlemen.disc
If I have helped you or increased your knowledge, click the 'thumbs up' button to give thanks :) (People with less than 20 posts won't see the "thumbs up" button.)
Reply
#8
Second PS - if you don't have access to a linux machine, PM me a link to your entire xml file on, say, dropbox, and I'll send you back a zip of the .disc files.
If I have helped you or increased your knowledge, click the 'thumbs up' button to give thanks :) (People with less than 20 posts won't see the "thumbs up" button.)
Reply
#9
Wow, thanks for doing that so quickly.

That is great and will meet the core objective for sure. At the risk of pushing my luck, the filename can also support media flags as per http://wiki.xbmc.org/index.php?title=Med...dia_source . Now its easy enough for me to just change line 3 to be movietitle.bluray.disc (because they are all bluray), but some of them are 3d bluray which is also indicated in the xml file as a separate tag. Is it easy to modify this so that if the title is flagged as 3d bluray it adds .3d to the filename as well - such as movietitle.bluray.3d.disc in those cases?

In the same vein, the ideal filename creation should include the year of the title in brackets so that scraping from movie db has best chance at correct identification. If it is easy enough to add .3d for 3d flagged bluray, would it also be possible to append the movie year as well. e.g. Jurassic Park (1993).bluray.3d.disc? The release date is also included in the xml file under <release date>. TBH that is probably more important than the correct flagging of 3d movies as xbmc doesnt understand frame-packed 3d bluray format anyway atm.

I know I'm stretching the friendship here but I thought I would ask considering that its a certainty this will also help other people in the future. If not possible I totally understand and more than appreciate what you have already done.

Thanks for all your help!!
Reply
#10
Yeah I'll have to think about how I do that. This was pretty quick and dirty. It's 8.00 pm here and I'm likely to go and actually watch XBMC soon. But yeah, all that is undoubtedly possible.

Just one thing, should the 3d flag be set if <Type BluRay3D="True">Blu-ray</Type> ??
If I have helped you or increased your knowledge, click the 'thumbs up' button to give thanks :) (People with less than 20 posts won't see the "thumbs up" button.)
Reply
#11
It's all done apart from the 3D bit. The main line is:

Code:
for movietitle in $(xmlstarlet sel -T -t -m Titles/Title -v "concat(LocalTitle,'(', ProductionYear,').bluray.disc')" -n mymovies.xml)  ; do touch  $movietitle; done

Again all one line.

Edit note that I used ProductionYear not ReleaseDate - if that is a problem I need to figure out how to convert ReleaseDate to just the year.

Can you post an xml with a couple of 3D movies in it so I can test the next bit?

This gives:

Code:
Crank: High Voltage(2009).bluray.disc
The League of Extraordinary Gentlemen(2003).bluray.disc
If I have helped you or increased your knowledge, click the 'thumbs up' button to give thanks :) (People with less than 20 posts won't see the "thumbs up" button.)
Reply
#12
Wow, I certainly didn't expect you to knock it over again in one line just like that lol. Production year is actually more accurate so that is perfect.

Happy to paste another xml for the 3d bit, but I can confirm from looking that the only difference seems to be the <Type BluRay3D="True">Blu-ray</Type> section. With True rather than False obviously.

Is a bit late here so will post an actual xml if needed tomorrow.

Thank you again!!!
Reply
#13
Yeah do one with a 3d movie.
If I have helped you or increased your knowledge, click the 'thumbs up' button to give thanks :) (People with less than 20 posts won't see the "thumbs up" button.)
Reply
#14
Here is the link to a couple of 3d movie examples http://pastebin.com/WMF6MKWP

I have also tested the script in an ubuntu vm that I spun up and it has worked great! Of the 610 titles it correctly processed 609. The only one it didn't handle was Face/Off, I'm guessing due to the slash in the title name. I'm certainly not going to complain about having to create one manually though lol if the other 609 have already been done for me. Big Grin

Have got the environment prepped now so happy to test the 3d modification if you are still up for it.
Reply
#15
Yes the / in the filename would lead to problems as / is a reserved character in unix - it is the path separator, like \ is in windows. (Why the creators of DOS went against all convention is beyond me!!).

I think the script as it stands would be trying to create a directory called Face and then a file in it called Off(year).bluray.disc

Sorry the addition of the 3D tag is beating me. You may need to do that manually.
If I have helped you or increased your knowledge, click the 'thumbs up' button to give thanks :) (People with less than 20 posts won't see the "thumbs up" button.)
Reply

Logout Mark Read Team Forum Stats Members Help
Cataloging offline movie discs as stubs from mymovies xml export0