2020-07-06, 14:29
I'd like to read the playlist, and see what files are on it. This works charm:
playList = xbmc.PlayList(xbmc.PLAYLIST_MUSIC)
for s in range(playList.size()):
path = playList.getPath()
log(f"{s}: {path}")
The only problem is the paths are inconsistent.
Some are filesystem paths, others are of the format: musicdb://songs/229107.mp3?albumid=31229
In fact I have a gut feel this is just dependent on who added them and how. If I add songs to the playlist using Kodi, or Chorus or Kore then they appear with this musicdb:// path. If I add them in my plug int using: playList.add(url=filename), using a filesystem path then they appear with that ins the playlist.
I'd love to know how to move between the two formats. Convert a musicdb:// path to a filesystem path and ideally the reverse too. Can't see any means in the doc.
I found xbmc.translatePath but that isn't for this type of translation. I'd both like to get a musicdb:// path (from a filesystem path) to add to the playlist, and I'd like to interpret a musicdb:// path as a filesystem path.
The two must translate with 100% reliability one way (musicdb:// to filesystem) and maybe the other way (if the file is in the database).
playList = xbmc.PlayList(xbmc.PLAYLIST_MUSIC)
for s in range(playList.size()):
path = playList.getPath()
log(f"{s}: {path}")
The only problem is the paths are inconsistent.
Some are filesystem paths, others are of the format: musicdb://songs/229107.mp3?albumid=31229
In fact I have a gut feel this is just dependent on who added them and how. If I add songs to the playlist using Kodi, or Chorus or Kore then they appear with this musicdb:// path. If I add them in my plug int using: playList.add(url=filename), using a filesystem path then they appear with that ins the playlist.
I'd love to know how to move between the two formats. Convert a musicdb:// path to a filesystem path and ideally the reverse too. Can't see any means in the doc.
I found xbmc.translatePath but that isn't for this type of translation. I'd both like to get a musicdb:// path (from a filesystem path) to add to the playlist, and I'd like to interpret a musicdb:// path as a filesystem path.
The two must translate with 100% reliability one way (musicdb:// to filesystem) and maybe the other way (if the file is in the database).