Import script functionality

Luke
2010-01-27
2013-05-30
  • Luke
    Luke
    2010-01-27

    Hi,

    I am considering to use mediatomb on my synology diskstation instead of the default one, which is very low on features.
    I will be using the precompiled IPKG package in opware for this, not sure how it is compiled.

    I would like to write a script which reads metadata files i have for all my movies, for this to work the SpiderMoney script engine in MediaTomb has to be compiled with the JS_HAS_FILE_OBJECT flag. This flag is by default disabled for security reasons.

    Does anyone know if MediaTomb is compiled with this flag on or off? Or is there any other way to read a xml file from inside the import script? Maybe the only options is to make a custom compilation of mediatomb to enable this flag?

    The reading of the metadata files would enable me to import my files in genres, production year, etc.

    Another way would be to rename the movie folder to hold metadata tags like "Moviename  (2008)". The import script would then only have to parse the foldername, that approach should work but i in my opinion not really stream lined.

    Any input would be greatly appreciated, as this would give mediatomb some great functionality import wise.

     
  • Jin
    Jin
    2010-01-27

    Hi,

    I'm pretty sure it was compiled without the JS_HAS_FILE_OBJECT flag, there is no way to read an XML from the import script. The only other way would be to go via the playlist parser, i.e. come up with a playlist format that has the  metadata the way you want it and then adapt the default parser (also in js) to handle the format that you invented.

    Taking the approach with directory names as you suggested and parsing them in the import script is of course also a possibility. But I think in your case it would also be easier to go the playlist route. Btw, just as a hint - since JS can parse JSON you might want to convert your XML to JSON format and use that as a playlist.

    Kind regards,
    Jin

     
  • Luke
    Luke
    2010-01-28

    Hi Jin,

    Thanks for the quick reply :)

    I see what you mean by using playlists, so basicly i can add "<map from=“xml” to=“video/xml”/>" and  "<treat mimetype=“video/xml” as=“playlist”/>" to the config.

    Throw away all xml files not having the correct name/format, and parse the rest.

    I dont know if the JSOPTION_XML is enabled in the spidermonkey context, if it was parsing the xml would be easy. If not the JSON would be an approach, though i would not like to convert all the files, as this brings another process when adding video files.

    Just reading the entire xml file with ReadLn() and using RegEx to extract a few metatags would not be too hard.

    If this is possible i will start fidling around with it :)

    To make it easy i plan on installing on Ubuntu until i have a working script, then transfering the script to a OptWare installation, are you aware of any differences between the Ubuntu and OptWare binaries which make them incompatible?

    For future versions, may i suggest some new features for handling metadata on movies, there are a few movie metadata formats like mymovies.xml and nfo out there, and already a lot of programs which generates these files. This would greatly increase the flexability of mediatomb for movie users.

     
  • Jin
    Jin
    2010-01-28

    I see what you mean by using playlists, so basicly i can add "<map from=“xml” to=“video/xml”/>" and "<treat mimetype=“video/xml” as=“playlist”/>" to the config.

    Throw away all xml files not having the correct name/format, and parse the rest.

    Right.

    I dont know if the JSOPTION_XML is enabled in the spidermonkey context, if it was parsing the xml would be easy. If not the JSON would be an approach, though i would not like to convert all the files, as this brings another process when adding video files.

    Just reading the entire xml file with ReadLn() and using RegEx to extract a few metatags would not be too hard.

    I doubt that the XML option in JS is enabled, I think it has to be set when compiling MediaTomb? If so - it's not set, so you get only the "default" JS settings. You could of course recompile… and even enable the file stuff if you want.

    To make it easy i plan on installing on Ubuntu until i have a working script, then transfering the script to a OptWare installation, are you aware of any differences between the Ubuntu and OptWare binaries which make them incompatible?

    Ubuntu constantly ships broken JS packages, the library itself works but if you want to install the dev package - and you need that - you often run into trouble. I'd suggest Fedora 12, btw Fedora is the distro I am using, so you can expect best MT support there - if there are problems I'm the first to run into them.

    Optware cross compiles stuff for your embedded target, Ubuntu is a linux distro, you can compile Optware packages under Ubuntu or under Fedora or under any other distro. So I do not quite get the question…

    For future versions, may i suggest some new features for handling metadata on movies, there are a few movie metadata formats like mymovies.xml and nfo out there, and already a lot of programs which generates these files. This would greatly increase the flexability of mediatomb for movie users.

    Those .NFO files look quite weird… what's the mymovies.xml stuff? I did think about adding some support for "movie metadata files" but so far could not find a free and open service that would provide such files… Can you point me to something useful?

     
  • Luke
    Luke
    2010-01-28

    Quick reply :)

    Regarding the OptWare, i installed the optware on my synology box compiled for its ARM cpu, and I think compiling stuff for it myself, goes beyond my Linux skills (I'm a MS developer, so only using Linux for fun and private)

    Thanks for the Fedora hint, I will install a clean Fedora 12 in a VirtualBox, making the script work there in a local mediatomb. Then tranfering the script to the MediaTomb on the Synology box.

    MyMovies ( www.mymovies.dk) is an application to handle a movie library (normally for Windows Media Center) but it generates a MyMovies.xml for each movie which contains the metadata. The format can also be generated by MetaBrowser and Yammm.

    NFO files (NFO) is another metadata format which can be generated my MyMovies and Yammm, it is used by XBMC for metadata.

    There a other programs which download metadata, and most of them does it from imdb or themoviedb.org.

    If you are looking for an open API to integrate into MediaTomb i think themoviedb.org will do, they even have an API. Not sure about their policies, but I think they are open. There is also thetvdb.org for TV shows.

    I am not sure that integrating metadata extraction directly into MediaTomb is the way to go, but maybe a plugin or advanced import script. Programs that generate NFO and Mymovies will place the metadata file in the same folder as the movie, so picking them up and import into MediaTomb will make sense, and leave the generation to the specialized programs.

    There is not really a standard way to do it, so thats why i like Mediatomb, because of the flexability it has in its impoirt script.

    My setup is a synology nas, wdtv live player. I plan to use metabrowser or YAMMM to generate the metadata (Windows machine, would love to find a tool like YAMMM for OptWare). Then run Mediatomb on my synology with a specialized script which gives a good tree to navigate.

    If i need to do advanced searching on movies, i will use a program i wrote myself to make specialized searches,  and read the movie plot.

    Everything my be overkill, but I kinda like to have fun with stuff like this instead of the everyday business related programming.

     
  • Luke
    Luke
    2010-01-28

    Sorry about all the spelling mistakes.

    Just had a look at themoviedb.org and their API is open, here is an index of other programs that used their api http://api.themoviedb.org/2.1/current-apps