Menu

Disc number and UPnP

Help
Anonymous
2011-03-21
2015-05-28
  • Anonymous

    Anonymous - 2011-03-21

    Hello,

    I am using MediaTomb on a server and the uPnP plugin in foobar2000 to playback files from it.  Unfortunately the track list reported by MediaTomb when selecting Albums does not seem to respect disc number.  I inquired at the foobar2000 forums with the following post describing my problem:

    Unfortunately, when I select an album from mediatomb in the UPnP browser, I am provided with a track list populated with Artist/album, Track no, Title / Track artist, Duration, and Date only. So the tracks come across ordered as Disc 1 Track 1, Disc 2 Track 1, Disc 3 Track 1, … It appears that only when I manually select one of the tracks for playback does the disc number for that track get loaded. After preloading them in this fashion I can re-sort the playlist by clicking the "Track no" column header and foobar2000 displays them in the correct order in the playlist (Disc 1 Track 1 -> X, Disc 2 Track 1 -> Y). Therefore for these multi-CD albums I have to manually preload each individual track to get the disc number field populated and play them back straight through. This is quite burdensome as I have some classical symphony sets of 10 CDs or more, which I am forced to manually preload 100s of tracks or hunt and peck to listen to them in the proper order. Is it possible to make the UPnP browser automatically populate the disc number in the playlist when albums are selected?

    This was the uPnP plugin author's response:

    There's no concept of discnumber in UPnP metadata land (except when foo_upnp is the server but this is a custom field), so it is likely that MediaTomb sorts the tracks by tracknumber like you describe ( Disc 1 Track 1, Disc 2 Track 1, Disc 3 Track 1). The UPnP Browser cannot change that as discnumber is not available, and it just displays the track in the order MediaTomb sort them. The discnumber you see when playing a track comes from foobar2000 http reader that extracted the tag.
    The only solution I can see to have MediaTomb use the correct order, is to prepend the discnumber to the tracknumber in your files. Set track numbers to 101, 102, … 201, 202, …
    You can also check if it is possible to configure MediaTomb with a custom sort order for albums, that would sort first by discnumber and then by tracknumber, but I doubt this is possible.

    He seems to say the plugin is coded to simply list the tracks in the order provided by MediaTomb.  Is it possible to make MediaTomb respect the disc number field in the metadata when reporting tracks in Album mode over uPnP?

    Thank you.

     
  • BT

    BT - 2011-03-21

    I believe it's possible with the aux property that is available via scripting. It's specifically mentioned in section 3.1.1 of the scripting documentation.

    You will also need to have MediaTomb compiled with libextractor support which it most likely isn't by default. You then need to configure MediaTomb to extract the metadata you want via <library-options> in config.xml. This option is explained in detail in section 6.2 of the Mediatomb documentation.

    Finally you will also need to modify the import.js script to make use of the extra metadata available. This is also explained in the scripting documentation.

     
  • Christian Weiske

    I don't think the aux property will help.
    If a folder/container is of type "UPNP_CLASS_CONTAINER_MUSIC_ALBUM", mediatomb internally orders them by the track number stored in the database. There is nothing you can do against that.

    You would have to modify the track number during import, prepending the disc number to the track number.. which might work.

     
  • Christian Weiske

    I tried it, and I failed:
    Mediatomb on Debian 7 is compiled with taglib support, as the compile info shows:

    $ mediatomb --compile-info|grep tagl
        taglib:         yes
    

    My ogg files have a DISCNUMBER property as ogginfo shows:

    $ ogginfo file.ogg
    DISCNUMBER=1
    

    The documentation__ told me to add this tag to the <id3> section::

    </mappings>
    <library-options>
      <id3>
        <auxdata>
          <add-data tag="DISCNUMBER"/>
        </auxdata>
      </id3>
    </library-options>
    

    __ http://mediatomb.cc/pages/documentation

    This data should now be available in obj.aux['DISCNUMBER'] as
    the scripting docs__ say::

    obj.title = obj.aux['DISCNUMBER'] + ': ' + track + artist + ' - ' + title;
    

    __ http://mediatomb.cc/pages/scripting

    But I only got "undefined: ..." instead of the disc number.

    This is probably because taglib's tag class__ only supports the default
    tags:

    The default implementation in this class considers only the usual built-in
    tags (artist, album, ...) and only one value per key.

    __ http://taglib.github.io/api/classTagLib_1_1Tag.html#a4fb9d5edf5cf9549f23b46e7a2572c4e

     
  • cf+

    cf+ - 2015-05-28

    I tried it with an mp3 file, there it worked.

    config.xml

    <library-options>
      <id3>
        <auxdata>
          <add-data tag="TPOS"/>
        </auxdata>
      </id3>
    </library-options>
    

    import.js

    var disc = obj.aux['TPOS'];
    if (disc) {
        track = disc + ' - ' + track;
    }
    

    That now results in the album containing the track in this order:
    1 - 01 ...
    2 - 01 ...
    1 - 02 ...
    2 - 02 ...
    ...
    i.e. as before, but now with disc and track number.

    I'll have a look into the code to see whether I can make the album appear in the correct order. I also thought about modifying the track number but that means that for tracks on disc #2 and later you need the number of tracks on all earlier discs. I don't think that information is available, also the earlier tracks might not have been imported yet. You could of course just add a big number for each disc, say 100.

     

Log in to post a comment.