I am trying to mod AutoResume
addon for KODI
. Now the addon
only saves current playing song an position. And after reboot it will play that song and then stop.
But I want it to begin playing the song and then play whole playlist, that was playing before.
So I tried to change the code, but I have a problem.
I am trying to read playlist id like this:
mediaFile = xbmc.Player().getPlayingFile()
position = xbmc.Player().getTime()
# The line in question:
playList = xbmc.PlayList().getPlayListId()
# Write info to file
f = open('/home/pi/autoresume.txt', 'w')
f.write(mediaFile)
f.write('\n')
f.write(repr(position))
f.write('\n')
f.write(repr(playList))
f.close()
But python gives me this:
-->Python callback/script returned the following error<--
- NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
Error Type: <type 'exceptions.TypeError'>
Error Contents: function takes exactly 1 argument (0 given)
Traceback (most recent call last):
File "/home/pi/.kodi/addons/service.autoResume-master/default.py", line 79, in <module>
recordPosition()
File "/home/pi/.kodi/addons/service.autoResume-master/default.py", line 59, in recordPosition
playList = xbmc.PlayList().getPlayListId()
TypeError: function takes exactly 1 argument (0 given)
-->End of Python script error report<--
If I understand this correctly there is missing argument in getPlaylistId(), but this method does not need parameter: http://mirrors.xbmc.org/docs/python-docs/stable/xbmc.html#PlayList-getPlayListId
What am I doing wrong?
XBMC has following types that have to be used if you would have some information of a Playlist:
So for your example you have to choose from which playlist you want this information so if you want to have the Music Playlist ID then you have to do the following:
xbmc.PlayList(xbmc.PLAYLIST_MUSIC).getPlayListId()
Check this link for more information: http://www.programcreek.com/python/example/77742/xbmc.PLAYLIST_VIDEO