Mopidy songid sequence (small change request)

Hi,

The songids generated by mopidy in the current playlist start at 0.

This is a problem for the upmpdcli UPnP/OpenHome gateway because it reuses the songids “as is” for the OpenHome PlayList service, and 0 is special in this context and causes problems. As far as I know, mpd never generates a songid of 0.

This is a minor issue, because it only occurs for the first song, but anyway, would it be possible to change Mopidy so that the ids start at 1 ? The following patch seems to do the trick for me:

diff --git a/mopidy/core/tracklist.py b/mopidy/core/tracklist.py
index 13efe32..4729ab8 100644
--- a/mopidy/core/tracklist.py
+++ b/mopidy/core/tracklist.py
@@ -16,7 +16,7 @@ class TracklistController(object):

     def __init__(self, core):
         self.core = core
-        self._next_tlid = 0
+        self._next_tlid = 1
         self._tl_tracks = []
         self._version = 0

Cheers,

jf

I tested the original MPD server, and you’re right. Thus, I made a pull request implementing this change: https://github.com/mopidy/mopidy/pull/1293

1 Like