Kodi Community Forum

Full Version: Retrieving total disc number tag
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi all,

I was wondering if there is a way for kodi to read the total disc number for a specific album from the relative tag.

I'm editing a skin and I'm customizing the fullscreen music playback.
I'd like the track number to work dinamically: I'd like the have specific track numbering when the total discs of the album are more then one (by adding a prefix like 01.01, 01.02 or a suffix like disc 01, disc 02). In order to do that, I need to use the total disc number as condition.

I've checked the skinning tutorial in the wiki but I don't see a specific info label for that, but I was thinking that maybe there are some workarounds.
Maybe kodi can "count" the discs in the album or something like that?
I'm very new to skinning, but I'm very passionate. I just need to know if that is feasible. 
Any ideas?

Thank you!
Couldn't you just use a visibility condition Integer.IsGreater(ListItem.disknumber,1) or MusicPlayer.disknumber?  But I suspect you need to format your own label, as ListItem.label will show eg [%S.] as long as a disknumber exists.

scott s.
.
Like I said, I'm new to skinning, but...
Let me explain better what I'd like to obtain.
- When the total disc number of an album is one: the track number should look like 01.first_song, 02. second_song (there is no need to have to disc number)
- For album with more than one album, I'd like to have something that tells me which disc I'm listening too: so 01.01.first_song_first_disc, 01.02 second_song_first_disc, or something similar.
Does this makes more sense?

AFAIK the MusicPlayer.disknumber only retrieve the number of the disc you're actually listening to, not the number of discs in that album. Same, I think, with the ListItem.disknumber.
Sorry, the second situation should be: "For albums with more than one disc....".
OT: no edit button?
I see now what you mean.  I guess it is possible in song tags to use the format 1/1 meaning "disc 1 of 1 total discs", but it doesn't look like Kodi stores the "total discs" part of that.  Something skin.helper.service could probably provide that (I don't see that it is currently available though).

BTW, there is an "edit" but then you have to select "quick" or "full" on the right before you get an edit window.

scott s.
.
@PacoM Has not been a member long enough to have full forum privileges .
Thank you for the info.

@scott967 I've tagged all my music with Musicbrainz Picard, which uses two tags: disc number and total discs.
I don't think Kodi can look at the total discs tag, like you said. So I must find a workaround.
By the way I've seen that you can get the total number of albums of a specific artist or the total number of tracks on a specific album by using $INFO[Container(50).NumItems],
I'm trying to understand how this works, but I don't think you can use it for my purpose.

I was thinking of an indirect way of knowing if an album as more than one disc, by summing the disc number tags for all the tracks in the album. If that number is greater than the total tracks number, the album as more than one disc. Does this makes sense?
So, if the album as these tracks:
- disc 1, track 1
- disc 1, track 2
- disc 2, track 1
- disc 2, track 2
The sum of the disc tag for all the track is 6 (1+1+2+2) which is greater than 4 (total track number): so there is more than one disc.
Can this be done in your opinion?
Unfortunately no Kodi does not currently process the total discs tag, but I do have it on my long todo list to consider saving it to the music db.

You could possibly retrieve the last track of an album using JSON API, the disc number of that song would be the total discs (assuming that is that all the songs on the album are scanned into the library. Rather than summing just order by track (inc. disc) descending and read the disc number of the first.
Thank you Dave!
I like your approach, it seems very logic.
Considering that my programming knowledge is nearly zero, I have a lot of ground to cover, but I think I'll give it a try.
I would like to remind that in the digital world there are no discs. If one must preserve the information of provenance it would make more sense to tag like
D1.T1
D1.T2
D1.T3
D2.T4
D2.T5

and so on. This avoids the potential pitfall of having track 1 twice (or more) in a multi-disc album.