Page 1 of 1

Multi-Disc Albums

PostPosted: Fri Apr 05, 2013 3:03 pm
by rubbersoul
Just wondering how or if musiccabinet handles multi-disc albums. Currently, I have multi-disc albums tagged with %discnumber% to differentiate them. Musiccabinet does not recognize this tag, but I'm wondering if it recognizes another tag? At the moment all my multi-disc albums play like this:

disc 1 track 1
disc 2 track 1
disc 1 track 2
disc 2 track 2

One way to handle this is to put the disc number into the album name field, but this is generally frowned upon for last.fm users.

Re: Multi-Disc Albums

PostPosted: Fri Apr 05, 2013 3:36 pm
by hakko
What type of files do you refer to? FLAC, OGG, MP3 etc? Disc number works for me but the exact tag to use will vary depending on file type + tag type (id3, vorbis etc).

Re: Multi-Disc Albums

PostPosted: Fri Apr 05, 2013 9:50 pm
by DivBy0
Like hakko noted, I denote the Disc number in the album name within the ID Tag i.e.: "Album" = Frampton Comes Alive, Disc 1 then the next disc's "Album" = Frampton Comes Alive, Disc 2
Ya I know Frampton....well it's a well know 2 disc set. Anyway, this work great for me; and if you want the albums in alphabetical, change the preference "Album sorting" to By Name

Re: Multi-Disc Albums

PostPosted: Sat Apr 06, 2013 9:29 am
by hakko
That's not how I do it, I use the disc number tag that beets writes to my files and it gets displayed like this in MusicCabinet:

Image

Re: Multi-Disc Albums

PostPosted: Sat Apr 06, 2013 2:19 pm
by rubbersoul
OK, my mistake. The disc number tag is working for me also in the web player. It isn't recognized by DSub or Ultrasonic mobile android clients. Would this be a bug on their end then?

Re: Multi-Disc Albums

PostPosted: Sat Apr 06, 2013 3:14 pm
by hakko
Disc number was introduced in the REST API in version 1.8.0. It could be that DSub and Ultrasonic doesn't use this for sorting tracks.

The response for the album above looks like this:

Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<subsonic-response xmlns="http://subsonic.org/restapi" status="ok" version="1.8.0">
  <directory id="-1720" name="(2010) A Bureaucratic Desire for Extra-Capsular Extraction">
    <child id="654337" parent="-1720" title="A Bureaucratic Desire for Revenge, Part 1" album="A Bureaucratic Desire for Extra-Capsular Extraction" artist="Earth" isDir="false" track="1" discNumber="1" year="2010" coverArt="..." size="11742208" contentType="audio/mpeg" suffix="mp3" duration="435" bitRate="214" path="Earth/A Bureaucratic Desire for Extra-Capsular Extraction/1-01 A Bureaucratic Desire for Revenge, Part 1.mp3"/>
    <child id="667287" parent="-1720" title="Geometry of Murder" album="A Bureaucratic Desire for Extra-Capsular Extraction" artist="Earth" isDir="false" track="1" discNumber="2" year="2010" coverArt="..." size="11527522" contentType="audio/mpeg" suffix="mp3" duration="439" bitRate="208" path="Earth/A Bureaucratic Desire for Extra-Capsular Extraction/2-01 Geometry of Murder.mp3"/>

[...]



iSub handles this so you could ask other app developers to have a look at this thread too.

Re: Multi-Disc Albums

PostPosted: Sat Apr 06, 2013 3:30 pm
by rubbersoul
great, thanks for clearing this up hakko!!

Re: Multi-Disc Albums

PostPosted: Sat Apr 06, 2013 3:59 pm
by daneren2005
Yah I just haven't done it yet on DSub

Sent from my HTC One X using Tapatalk 2

Re: Multi-Disc Albums

PostPosted: Thu Apr 11, 2013 9:48 pm
by phantom4
hakko wrote:Disc number was introduced in the REST API in version 1.8.0. It could be that DSub and Ultrasonic doesn't use this for sorting tracks.

The response for the album above looks like this:

Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<subsonic-response xmlns="http://subsonic.org/restapi" status="ok" version="1.8.0">
  <directory id="-1720" name="(2010) A Bureaucratic Desire for Extra-Capsular Extraction">
    <child id="654337" parent="-1720" title="A Bureaucratic Desire for Revenge, Part 1" album="A Bureaucratic Desire for Extra-Capsular Extraction" artist="Earth" isDir="false" track="1" discNumber="1" year="2010" coverArt="..." size="11742208" contentType="audio/mpeg" suffix="mp3" duration="435" bitRate="214" path="Earth/A Bureaucratic Desire for Extra-Capsular Extraction/1-01 A Bureaucratic Desire for Revenge, Part 1.mp3"/>
    <child id="667287" parent="-1720" title="Geometry of Murder" album="A Bureaucratic Desire for Extra-Capsular Extraction" artist="Earth" isDir="false" track="1" discNumber="2" year="2010" coverArt="..." size="11527522" contentType="audio/mpeg" suffix="mp3" duration="439" bitRate="208" path="Earth/A Bureaucratic Desire for Extra-Capsular Extraction/2-01 Geometry of Murder.mp3"/>

[...]



iSub handles this so you could ask other app developers to have a look at this thread too.


I don't think iSub handles discNumber yet either. I think it works (at least for the above album) because you're filenames have the disc number in them and sort properly.

Here is the xml for an album that doesn't work for me:

Code: Select all
<subsonic-response xmlns="http://subsonic.org/restapi" status="ok" version="1.8.0">
  <directory id="-22527" name="(2013) Black">
    <child id="208659" parent="-22527" title="Midnight Moon Misery" album="Black" artist="Project Pitchfork" isDir="false" track="1" discNumber="2" year="2013" coverArt="..." size="11504339" contentType="audio/mpeg" suffix="mp3" duration="334" bitRate="273" path="Project Pitchfork/Black/1. Midnight Moon Misery.mp3"/>
    <child id="208551" parent="-22527" title="Pitch-Black" album="Black" artist="Project Pitchfork" isDir="false" track="1" discNumber="1" year="2013" coverArt="..." size="14705459" contentType="audio/mpeg" suffix="mp3" duration="445" bitRate="263" path="Project Pitchfork/Black/1. Pitch-Black.mp3"/>

[...]



It sorts 1, 1, 2, 2, etc (but sorts properly in the web interface).

Re: Multi-Disc Albums

PostPosted: Mon Apr 15, 2013 9:19 am
by vollbr0t
I think it would be great to have additional buttons to play only one specific cd of multi-disc albums. For example I often want to hear only the first cd, so i have to add the whole album and delete the songs from the second disc...

Re: Multi-Disc Albums

PostPosted: Wed May 15, 2013 8:30 pm
by germain35
Hi guys,

I just found a solution for multi-Discs Albums display into iSub (which actually doesn't use DiscNumber parameter).

The problem is in the file RESTBrowseController.java, in the definition of trackComparator variable.

The current definition :

Code: Select all
private final Comparator<Track> trackComparator = new Comparator<Track>() {
        @Override
        public int compare(Track t1, Track t2) {
            return Integer.compare(getTrackNr(t1.getMetaData().getTrackNr()),
                    getTrackNr(t2.getMetaData().getTrackNr()));
        }

        private int getTrackNr(Short nr) {
            return nr == null ? 0 : nr.intValue();
        }
    };


with this method, the rest response is sorted only on trackNumber parameter, so when you call a multi-disc album, it returns tracks sorted like this : 1, 1, 2, 2, 3, 3...

To correct this issue, we need to use discNumber parameter and trackNumber parameters together.

So, the idea is to concatenate discNumber and trackNumber (formatted with 2 digits).

For exemple for the first track of the first disc, we will have 0101 and for the first track of the second disc, we'l have 0201 which is greater than 0101, the rest response is now correctly sorted by changing the variable definition like this :

Code: Select all
private final Comparator<Track> trackComparator = new Comparator<Track>() {
        @Override
        public int compare(Track t1, Track t2) {
            //germain
            Short x1 = Short.valueOf(String.format("%02d", t1.getMetaData().getDiscNr()).concat(String.format("%02d", t1.getMetaData().getTrackNr())));
            Short x2 = Short.valueOf(String.format("%02d", t2.getMetaData().getDiscNr()).concat(String.format("%02d", t2.getMetaData().getTrackNr())));
            return Integer.compare(x1,x2);
            //germain
        }

        private int getTrackNr(Short nr) {
            return nr == null ? 0 : nr.intValue();
        }
    };

Re: Multi-Disc Albums

PostPosted: Thu May 16, 2013 7:35 am
by rmnma
@Germain35 Can you give me a roadmap how to edit this? I cannot find the file RESTBrowseController.java.
Do I need Java Platform (JDK) 7u21 for this?

Re: Multi-Disc Albums

PostPosted: Thu May 16, 2013 2:24 pm
by germain35
@rmnma

I use the 7u21 JDK to compile under Ubuntu server 12.04 64bits and I have the tomcat version of MusicCabinet.

Roadmap to patch MusicCabinet under linux:

- Download RESTBrowseController.java from Hakko GitHub :
https://github.com/hakko/subsonic/blob/master/subsonic-main/src/main/java/net/sourceforge/subsonic/controller/RESTBrowseController.java

- Modify the code like this (trackComparator variable definiton ) :
Code: Select all
private final Comparator<Track> trackComparator = new Comparator<Track>() {
        @Override
        public int compare(Track t1, Track t2) {
            //germain
            Short x1 = Short.valueOf(String.format("%02d", t1.getMetaData().getDiscNr()).concat(String.format("%02d", t1.getMetaData().getTrackNr())));
            Short x2 = Short.valueOf(String.format("%02d", t2.getMetaData().getDiscNr()).concat(String.format("%02d", t2.getMetaData().getTrackNr())));
            return Integer.compare(x1,x2);
            //germain
        }

        private int getTrackNr(Short nr) {
            return nr == null ? 0 : nr.intValue();
        }
    };


- To compile, you need to specify the library directory of MusicCabinet, the servlet library that you can find in the tomcat's library directory and the class directory of MusicCabinet (in WEB-INF), the command looks like this :
Code: Select all
TOMCAT_DIRECTORY=...
javac -Xlint:unchecked -cp $(echo ${TOMCAT_DIRECTORY}/webapps/subsonic/WEB-INF/lib/*.jar | tr ' ' ':'):${TOMCAT_DIRECTORY}/lib/servlet-api.jar:${TOMCAT_DIRECTORY}/webapps/subsonic/WEB-INF/classes RESTBrowseController.java


2 classes are generated : RESTBrowseController.class and RESTBrowseController$1.class.

- Stop tomcat
- Copy thoses 2 classes into ${TOMCAT_DIRECTORY}/webapps/subsonic/WEB-INF/classes/net/sourceforge/subsonic/controller/
- Start tomcat

Re: Multi-Disc Albums

PostPosted: Thu May 16, 2013 5:50 pm
by rmnma
Thank you!