Exclude cover art files in audio collection

  • Pierre

    Pierre - 2011-01-14

    My media files are in 3 separate folders on my NAS server: video, audio and photos.

    My music collection (around 30,000 files & 2,500 albums) is 99% in FLAC format with one file per track, one folder per album and a file named "cover.jpg" for the cover art..

    When browsing in the "Photos" container in Mediatomb, all those cover files are seen as Photos.

    Is it possible:
    - Eithert o exclude all "cover.jpg" files when importing into Mediatomb
    - Either, when adding a folder from my filesystem, to say import only on type of files (audio in my case)


  • Giulio Martinat

    Giulio Martinat - 2011-01-18

    Have a look at the scripting howto: I know very little about scripting but import.js deals with images in function addImage, which accepts an obj as its only parameter. At the top of the page, amongst the properties of an object, location is the one that contains the path and filename. You could filter out all files that are images and are located in a path used for your FLAC audio files and/or have a name of 'cover.jpg', which is also stored in property `title'. Try experimenting on that

  • Pierre

    Pierre - 2011-01-21

    Thanks for this reply
    I modified the script to exclude the cover art files and everything is perfect.

    I  modified the script to change the levels organization for Audio tracks.
    I tried to create a sub level for composer but as my files are manly FLAC I have to use "taglib" to recover the COMPOSER tag. I didn't success when using obj.aux in the import.js script after modify the config.xml file

                  <add-data tag="TCOM"/>
                  <add-data tag="COMPOSER"/>

    What is wrong? I didn't find any example on Internet with taglib

  • giulix

    giulix - 2011-01-21

    I suspect you're not free in the choice of tag names. If you have a look at the library-options in the docs, you'll see that for tag id3 the allowed child-tags are listed. But, as I said, I am not a scripting expert…

  • freeekbert

    freeekbert - 2011-04-27

    @ltsv38: Could you please explain in detail how you modified the import script? I too want to exclude JPG files in my music directory from being scanned.
    Thanks a lot.

  • Pierre

    Pierre - 2011-04-27

    Hello freeekbert

    I modified the "addImage" function in the "import.js" script to exclude all files with a name corresponding to covers images.

    function addImage(obj)
    {   // To exclude cover files in audio folders
        var title = obj.meta[M_TITLE];
        if (!title) title = obj.title;
        if ((title == 'cover.jpg') || (title == 'Cover.jpg') || (title == 'folder.jpg') || (title == 'Folder.jpg')) return;
        var chain = new Array('Photos', 'All Photos');
        addCdsObject(obj, createContainerChain(chain), UPNP_CLASS_CONTAINER);
  • freeekbert

    freeekbert - 2011-04-27

    Thanks for your quick reply. I'll give it a try later. Looks very promising ;-)
    But first I'll have to take a look at scripting in mediatomb in general.

  • Anonymous - 2013-01-21

    somebody else did the same with libexif : http://my.opera.com/maurice118/blog/how-to-use-the-import-js-with-mediatomb-upnp-server

    so, did you try using the good id3 tag names as on http://id3.org/id3v2.3.0 ?

    // obj.meta: obj.aux:
    // M_ARTIST TPE1 - Lead performer(s)/Soloist(s)
    // M_ALBUM TALB - Album/Movie/Show title
    // N/A TPOS - Part of a set
    // M_TRACKNUMBER TRCK - Track number/Position in set
    // M_TITLE TIT2 - Title/songname/content description
    // M_DATE TYER - Year
    // M_GENRE TCON - Content type (Genre)

    // M_REGION
    // M_AUTHOR
    // M_RATING POPM ?
    // M_ACTOR
    // M_MAX

    // ? APIC - Attached picture (Album Art)
    // N/A TPE2 - Band/orchestra/accompaniment = "Album Artist" (iTunes/Tag&Rename/etc)
    // ? APIC - Attached picture (Album Art)
    // ? TPE3 - Conductor/performer refinement
    // ? TCOM - Composer


Log in to post a comment.