music: Fix multidisc indexing

Kodi uses internally a right-shift operation to codify in a
single integer disc number and track number. This is taken
into account in this addon but, incorrectly, it is done for
discnumber > 1 only, while Kodi uses it for tracks in all
discs.

Fix this by directly codifying the track and disc number
for all discs.

This patch is based on investigation by user @neightwulf in
github.
This commit is contained in:
Claudio Saavedra 2023-08-16 12:24:45 +03:00
parent eadcc46395
commit d98d64f28a

View file

@ -291,8 +291,7 @@ class Music(KodiDb):
if obj['DatePlayed']:
obj['DatePlayed'] = Local(obj['DatePlayed']).split('.')[0].replace('T', " ")
if obj['Disc'] != 1:
obj['Index'] = obj['Disc'] * 2 ** 16 + obj['Index']
obj['Index'] = obj['Disc'] * 2 ** 16 + obj['Index']
if update:
self.song_update(obj)