Retrieve URL / run subprocess from import.js

Anonymous
2011-03-30
2013-05-30

  • Anonymous
    2011-03-30

    I am trying to do an import script that categorises by genres and IMDB ratings. I already did a python script that does the heavy stuff (will share it eventually if I manage to get everything working). Now, my problem is how to get that data to the import script. I can have an HTTP interface on the python script, but I can't seem to find a way how to fetch a URL from SpiderMonkey. It would also be good if I could run the python script as a subprocess which would then return the data.. or even save the data to a text file which I would then read through JS.

    Is any of this possible or am I asking for too much?

     

  • Anonymous
    2011-03-30

    Thinking about it.. file I/O might even be enough, although not ideal. Is file I/O available? Still.. I would like to avoid that.

     

  • Anonymous
    2011-03-30

    Kept experimenting a bit. It appears that from the import scripts, there is no way to interface to anything outside. Correct me if I'm wrong, but I highly doubt it :(

    So, my other question would be… is there a way to interface with the metadata parser or something? Maybe it would be possible to inject the metadata before it actually goes to the import scripts?

     

  • Anonymous
    2011-04-05

    it seems to me that the most realistic way of getting info from IMDB to categorize movies in your library would be something along these lines:

    1. build a custom script that would scan library and fetch needed info from IMDB
    2. embed that info into video container tags, see http://www.matroska.org/technical/specs/tagging/index.html for MKV
    3. check if MediaTomb provides access to  arbitrary tag from MKV, and use them when importing library with import script. If access to those TAGS are not supported by mediatomb, I think it would be much easier to add than execture an external script within import.js

    Alternatively, you can check if SpiderMonkey (mediatomb's JavaScrtip engine) provides any hooks to load a resource via HTTP or read a file from local FS and then if it does, implement this functionality in whole from within import.js

    I'm highly interested in something like that myself, so please share your progress :)

     

  • Anonymous
    2011-04-07

    Unless I'm missing something, no I/O is possible from SpiderMonkey, so the only way seems to pre-process the files. The problem with that is automation.. maybe doing inotify in python would be possible. I need to look into that.

     

  • Anonymous
    2011-04-10

    I did some further investigation, and found out the following:

    - Using inotify from a python script is possible
    - Tagging video files is possible, but to read the tags, you need libextractor, which is slow.

    So, I think the following is the best way to go:

    - Turn off automatic scanning from mediatomb
    - Have a python script monitoring (inotify) the movies directory
    - When a new movie comes in, get the data from IMDB
    - The script should then create symlinks according the the genres and rating, as you want the to appear in mediatomb.
    - The script finally instructs mediatomb to run a scan, which will find the new movie and the symlinks and add them to the library.

    I will keep experimenting when I find some time…