2016-04-09 140 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