Menu

Scripting with the 'simple structured i...

oconnellc
2010-01-25
2013-05-30
  • oconnellc

    oconnellc - 2010-01-25

    I'm brand new to media tomb and playing with the 'simple structured import script' from the Wiki.  It doesn't appear to operate the way I would expect it to.  My media is stored on "/mnt/usr/Movies" with a folder for each genre of movie below that.  So, if I use that simple script and set 'skip' to 2, then I get the "Videos" area created, and under it is 'usr/Movies/etc', which is what I would expect.  However, if I set 'skip' to 3, then I don't get the "Videos" area created at all.  This is not what I would expect.  I starting the server via the command line, so I don't see anything output to the console.  Any reason why the 'Videos' area doesn't even get created?

    Also, a second question…  When it creates the 'Videos' area, it scans in all my content.  Except for a single movie that I have ripped as an ".iso".  The item is in my library, at least, it shows up in the "PC Directory" listing.  It just doesn't show up in that other view of my library.

    Also, is there some way to debug the execution of the import script?  Either a js function I could call that would add stuff to the log or something?

    Thanks,
    Chris

     
  • Jin

    Jin - 2010-01-25

    I'm brand new to media tomb and playing with the 'simple structured import script' from the Wiki. It doesn't appear to operate the way I would expect it to. My media is stored on "/mnt/usr/Movies" with a folder for each genre of movie below that. So, if I use that simple script and set 'skip' to 2, then I get the "Videos" area created, and under it is 'usr/Movies/etc', which is what I would expect. However, if I set 'skip' to 3, then I don't get the "Videos" area created at all. This is not what I would expect. I starting the server via the command line, so I don't see anything output to the console. Any reason why the 'Videos' area doesn't even get created?

    I can't comment on this particular script, the scripts on the Wiki are submitted by our users so that's a question to the original author. Just to make sure, you did switch the layout in the config.xml from "builtin" to "js", right?

    Also, a second question… When it creates the 'Videos' area, it scans in all my content. Except for a single movie that I have ripped as an ".iso". The item is in my library, at least, it shows up in the "PC Directory" listing. It just doesn't show up in that other view of my library.

    An ISO image is recognized by filemagic as: application/x-iso9660, it's not directly playable (at lest I do not now a player that would play an ISO via UPnP), so it's treated as any other non playable file. The basic rule is: the mimetype is being recognized, then everything that starts with "video" goes to the Video containers, "image" goes to Photos, "audio" to Audio respectively. You can of course fine tune this in the import.js script.

    Also, is there some way to debug the execution of the import script? Either a js function I could call that would add stuff to the log or something?

    Did you read the scripting documentation? :) http://mediatomb.cc/pages/scripting#id2488427 The function is called print and will produce output in the console or log file (depending how you started the server). The printout is marked with "JS" so you can keep it apart from the regular DEBUG/INFO/WARNING/ERROR messages.

    Kind regards,
    Jin

     
  • oconnellc

    oconnellc - 2010-01-26

    Jin,

    Thanks for your thoughts.  I did modify the import type to "js", but I don't blame you for reminding me…  I read the documentation for scripting, but I will confess to skimming a couple parts, and I did miss that part about the 'print' function.

    I did some playing around with that script.  I appreciate that you didn't write that script, so this might be of help to some others.  I did figure out that I needed to add the mimetype for "iso".  However, setting the mimetype to "application/x-iso9660" didn't do me any good.  I had to set the mimetype to "video/mpeg".  I know that may not make any sense, but that was the only way I could get it to work.

    However, writing this out is making me think that the "map" elements didn't include a "map" for mimetypes that started with "application".  So, my ISO never got created as a Video item.  I'm now thinking that I could switch the mimetype back to the correct type and then add that mapping and it would get correctly imported.  I'm not sure what the long term implications of that are, though.  Does it make any sense to map that mimetype to "Video"?  Or is that not going to affect anything other than importing of items in my library?

    FWIW, I was able to play the ISO using the Western Digital HD Live.  However, the audio was screwed up and I had no sound.

    Anyway, thanks for your help and maybe this post will save someone else some time…

    Chris

     
  • Jin

    Jin - 2010-01-26

    I did some playing around with that script. I appreciate that you didn't write that script, so this might be of help to some others. I did figure out that I needed to add the mimetype for "iso". However, setting the mimetype to "application/x-iso9660" didn't do me any good. I had to set the mimetype to "video/mpeg". I know that may not make any sense, but that was the only way I could get it to work.

    I think you did not get my idea here. Look at the default import.js script, at the very bottom:

        if (orig.mimetype == 'application/ogg')
        {
            if (orig.theora == 1)
                addVideo(obj);
            else
                addAudio(obj);
        }
    

    You'd have to do something similar for the application/x-iso9660 mime type. Then your ISOs would go to the Video container.

    The main question when choosing the mime type is - what does your player expect here? Does it care at all? For some players the mime type is just a helper to the UPnP browser part, so it will allow you to press "Play" on a particular item. Others may use this information to start the right decoder, you'd have to try.

    FWIW, I was able to play the ISO using the Western Digital HD Live. However, the audio was screwed up and I had no sound.

    Maybe it struggles with all those streams that you find in the ISO - multiple audio tracks, subtitles, etc.? We planned to add a feature where we would parse the ISO using libdvdnav and offer possibility to play "by chapter" or "by title" and so on. Turned out - most players can not handle the MPEG that comes from a DVD, mostly because there is are numerous streams inside that MPEG. So we tried to remux the MPEG and keep only the desired streams, however it turned out to be quite complicated so the feature is still not finished and will not be present in the upcoming 0.12 release.

     

Log in to post a comment.