2016-04-09 53 views
0

我试图国防部AutoResume插件的KODI。现在addon只保存当前播放的歌曲位置。重新启动后,它将播放该歌曲,然后停止播放。 但我希望它开始播放歌曲,然后播放整个播放列表,这是以前播放的。KODI - getPlayListId()缺少参数

所以我试图改变代码,但我有一个问题。

我想读播放列表ID是这样的:

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() 

但是Python给了我这样的:

-->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<-- 

如果我没有理解这getPlaylistId()正确地存在缺失的说法,但这方法不需要参数: http://mirrors.xbmc.org/docs/python-docs/stable/xbmc.html#PlayList-getPlayListId

我在做什么错?

+0

你能尝试使用'帮助()'内置在shell此功能,看看它说什么? – vmonteco

+0

对不起,你是怎么做到的? – Kamion

+0

尝试'import xbmc'然后'help(xbmc.PlayList()。getPlayListId)'。 – vmonteco

回答

0

你试过getPlayListId(个体经营),如果你在一个类?

0

XBMC有以下几种类型必须被使用,如果你将有一个播放列表的一些信息:

  • xbmc.PLAYLIST_MUSIC
  • xbmc.PLAYLIST_VIDEO

因此,对于你的榜样,你有选择从播放列表中你想要这个信息,所以如果你想拥有音乐播放列表ID,那么你必须做到以下几点:

xbmc.PlayList(xbmc.PLAYLIST_MUSIC).getPlayListId() 

检查此链接了解更多信息: http://www.programcreek.com/python/example/77742/xbmc.PLAYLIST_VIDEO