本文整理汇总了Python中xbmcplugin.setProperty方法的典型用法代码示例。如果您正苦于以下问题:Python xbmcplugin.setProperty方法的具体用法?Python xbmcplugin.setProperty怎么用?Python xbmcplugin.setProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xbmcplugin
的用法示例。
在下文中一共展示了xbmcplugin.setProperty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_authkey
# 需要导入模块: import xbmcplugin [as 别名]
# 或者: from xbmcplugin import setProperty [as 别名]
def get_authkey(self):
'''get authentication key'''
auth_token = None
count = 10
while not auth_token and count: # wait max 5 seconds for the token
auth_token = self.win.getProperty("spotify-token").decode("utf-8")
count -= 1
if not auth_token:
xbmc.sleep(500)
if not auth_token:
if self.win.getProperty("spotify.supportsplayback"):
if self.win.getProperty("spotify-discovery") == "disabled":
msg = self.addon.getLocalizedString(11050)
else:
msg = self.addon.getLocalizedString(11065)
dialog = xbmcgui.Dialog()
header = self.addon.getAddonInfo("name")
dialog.ok(header, msg)
del dialog
else:
# login with browser
request_token_web(force=True)
self.win.setProperty("spotify-cmd", "__LOGOUT__")
return auth_token
示例2: browse_album
# 需要导入模块: import xbmcplugin [as 别名]
# 或者: from xbmcplugin import setProperty [as 别名]
def browse_album(self):
xbmcplugin.setContent(self.addon_handle, "songs")
album = self.sp.album(self.albumid, market=self.usercountry)
xbmcplugin.setProperty(self.addon_handle, 'FolderName', album["name"])
tracks = self.get_album_tracks(album)
if album.get("album_type") == "compilation":
self.add_track_listitems(tracks, True)
else:
self.add_track_listitems(tracks)
xbmcplugin.addSortMethod(self.addon_handle, xbmcplugin.SORT_METHOD_UNSORTED)
xbmcplugin.addSortMethod(self.addon_handle, xbmcplugin.SORT_METHOD_TRACKNUM)
xbmcplugin.addSortMethod(self.addon_handle, xbmcplugin.SORT_METHOD_TITLE)
xbmcplugin.addSortMethod(self.addon_handle, xbmcplugin.SORT_METHOD_VIDEO_YEAR)
xbmcplugin.addSortMethod(self.addon_handle, xbmcplugin.SORT_METHOD_SONG_RATING)
xbmcplugin.addSortMethod(self.addon_handle, xbmcplugin.SORT_METHOD_ARTIST)
xbmcplugin.endOfDirectory(handle=self.addon_handle)
if self.defaultview_songs:
xbmc.executebuiltin('Container.SetViewMode(%s)' % self.defaultview_songs)
示例3: search_artists
# 需要导入模块: import xbmcplugin [as 别名]
# 或者: from xbmcplugin import setProperty [as 别名]
def search_artists(self):
xbmcplugin.setContent(self.addon_handle, "artists")
xbmcplugin.setProperty(self.addon_handle, 'FolderName', xbmc.getLocalizedString(133))
result = self.sp.search(
q="artist:%s" %
self.artistid,
type='artist',
limit=self.limit,
offset=self.offset,
market=self.usercountry)
artists = self.prepare_artist_listitems(result['artists']['items'])
self.add_artist_listitems(artists)
self.add_next_button(result['artists']['total'])
xbmcplugin.addSortMethod(self.addon_handle, xbmcplugin.SORT_METHOD_UNSORTED)
xbmcplugin.endOfDirectory(handle=self.addon_handle)
if self.defaultview_artists:
xbmc.executebuiltin('Container.SetViewMode(%s)' % self.defaultview_artists)
示例4: search_tracks
# 需要导入模块: import xbmcplugin [as 别名]
# 或者: from xbmcplugin import setProperty [as 别名]
def search_tracks(self):
xbmcplugin.setContent(self.addon_handle, "songs")
xbmcplugin.setProperty(self.addon_handle, 'FolderName', xbmc.getLocalizedString(134))
result = self.sp.search(
q="track:%s" %
self.trackid,
type='track',
limit=self.limit,
offset=self.offset,
market=self.usercountry)
tracks = self.prepare_track_listitems(tracks=result["tracks"]["items"])
self.add_track_listitems(tracks, True)
self.add_next_button(result['tracks']['total'])
xbmcplugin.addSortMethod(self.addon_handle, xbmcplugin.SORT_METHOD_UNSORTED)
xbmcplugin.endOfDirectory(handle=self.addon_handle)
if self.defaultview_songs:
xbmc.executebuiltin('Container.SetViewMode(%s)' % self.defaultview_songs)
示例5: search_albums
# 需要导入模块: import xbmcplugin [as 别名]
# 或者: from xbmcplugin import setProperty [as 别名]
def search_albums(self):
xbmcplugin.setContent(self.addon_handle, "albums")
xbmcplugin.setProperty(self.addon_handle, 'FolderName', xbmc.getLocalizedString(132))
result = self.sp.search(
q="album:%s" %
self.albumid,
type='album',
limit=self.limit,
offset=self.offset,
market=self.usercountry)
albumids = []
for album in result['albums']['items']:
albumids.append(album["id"])
albums = self.prepare_album_listitems(albumids)
self.add_album_listitems(albums, True)
self.add_next_button(result['albums']['total'])
xbmcplugin.addSortMethod(self.addon_handle, xbmcplugin.SORT_METHOD_UNSORTED)
xbmcplugin.endOfDirectory(handle=self.addon_handle)
if self.defaultview_albums:
xbmc.executebuiltin('Container.SetViewMode(%s)' % self.defaultview_albums)
示例6: search_playlists
# 需要导入模块: import xbmcplugin [as 别名]
# 或者: from xbmcplugin import setProperty [as 别名]
def search_playlists(self):
xbmcplugin.setContent(self.addon_handle, "files")
result = self.sp.search(
q=self.playlistid,
type='playlist',
limit=self.limit,
offset=self.offset,
market=self.usercountry)
log_msg(result)
xbmcplugin.setProperty(self.addon_handle, 'FolderName', xbmc.getLocalizedString(136))
playlists = self.prepare_playlist_listitems(result['playlists']['items'])
self.add_playlist_listitems(playlists)
self.add_next_button(result['playlists']['total'])
xbmcplugin.endOfDirectory(handle=self.addon_handle)
if self.defaultview_playlists:
xbmc.executebuiltin('Container.SetViewMode(%s)' % self.defaultview_playlists)
示例7: precache_library
# 需要导入模块: import xbmcplugin [as 别名]
# 或者: from xbmcplugin import setProperty [as 别名]
def precache_library(self):
if not self.win.getProperty("Spotify.PreCachedItems"):
monitor = xbmc.Monitor()
self.win.setProperty("Spotify.PreCachedItems", "busy")
userplaylists = self.get_user_playlists(self.userid)
for playlist in userplaylists:
self.get_playlist_details(playlist['owner']['id'], playlist["id"])
if monitor.abortRequested():
return
self.get_savedalbums()
if monitor.abortRequested():
return
self.get_savedartists()
if monitor.abortRequested():
return
self.get_saved_tracks()
del monitor
self.win.setProperty("Spotify.PreCachedItems", "done")
示例8: finish_container
# 需要导入模块: import xbmcplugin [as 别名]
# 或者: from xbmcplugin import setProperty [as 别名]
def finish_container(self):
if self.params.get('random'):
return
for k, v in self.params.items():
if not k or not v:
continue
try:
xbmcplugin.setProperty(self.handle, u'Param.{}'.format(k), u'{}'.format(v)) # Set params to container properties
except Exception as exc:
utils.kodi_log(u'Error: {}\nUnable to set Param.{} to {}'.format(exc, k, v), 1)
if self.item_dbtype in ['movie', 'tvshow', 'episode']:
xbmcplugin.addSortMethod(self.handle, xbmcplugin.SORT_METHOD_UNSORTED)
xbmcplugin.addSortMethod(self.handle, xbmcplugin.SORT_METHOD_EPISODE) if self.item_dbtype == 'episode' else None
xbmcplugin.addSortMethod(self.handle, xbmcplugin.SORT_METHOD_TITLE_IGNORE_THE)
xbmcplugin.addSortMethod(self.handle, xbmcplugin.SORT_METHOD_LASTPLAYED)
xbmcplugin.addSortMethod(self.handle, xbmcplugin.SORT_METHOD_PLAYCOUNT)
xbmcplugin.endOfDirectory(self.handle, updateListing=self.updatelisting)
示例9: refresh_connected_device
# 需要导入模块: import xbmcplugin [as 别名]
# 或者: from xbmcplugin import setProperty [as 别名]
def refresh_connected_device(self):
'''set reconnect flag for main_loop'''
if self.addon.getSetting("playback_device") == "connect":
self.win.setProperty("spotify-cmd", "__RECONNECT__")
示例10: logoff_user
# 需要导入模块: import xbmcplugin [as 别名]
# 或者: from xbmcplugin import setProperty [as 别名]
def logoff_user(self):
''' logoff user '''
dialog = xbmcgui.Dialog()
if dialog.yesno(self.addon.getLocalizedString(11066), self.addon.getLocalizedString(11067)):
xbmcvfs.delete("special://profile/addon_data/%s/credentials.json" % ADDON_ID)
xbmcvfs.delete("special://profile/addon_data/%s/spotipy.cache" % ADDON_ID)
self.win.clearProperty("spotify-token")
self.win.clearProperty("spotify-username")
self.win.clearProperty("spotify-country")
self.addon.setSetting("username", "")
self.addon.setSetting("password", "")
self.win.setProperty("spotify-cmd", "__LOGOUT__")
xbmc.executebuiltin("Container.Refresh")
del dialog
示例11: switch_user_multi
# 需要导入模块: import xbmcplugin [as 别名]
# 或者: from xbmcplugin import setProperty [as 别名]
def switch_user_multi(self):
'''switch the currently logged in user'''
usernames = []
count = 1
while True:
username = self.addon.getSetting("username%s" % count).decode("utf-8")
count += 1
if not username:
break
else:
display_name = ""
try:
display_name = self.sp.user(username)["display_name"]
except Exception:
pass
if not display_name:
display_name = username
usernames.append(display_name)
dialog = xbmcgui.Dialog()
ret = dialog.select(self.addon.getLocalizedString(11048), usernames)
del dialog
if ret != -1:
ret += 1
new_user = self.addon.getSetting("username%s" % ret)
new_pass = self.addon.getSetting("password%s" % ret)
self.addon.setSetting("username", new_user)
self.addon.setSetting("password", new_pass)
xbmcvfs.delete("special://profile/addon_data/%s/credentials.json" % ADDON_ID)
self.win.setProperty("spotify-cmd", "__LOGOUT__")
self.win.clearProperty("spotify-token")
self.win.clearProperty("spotify-username")
self.win.clearProperty("spotify-country")
xbmc.executebuiltin("Container.Refresh")
示例12: browse_main
# 需要导入模块: import xbmcplugin [as 别名]
# 或者: from xbmcplugin import setProperty [as 别名]
def browse_main(self):
# main listing
xbmcplugin.setContent(self.addon_handle, "files")
items = []
items.append(
(self.addon.getLocalizedString(11013),
"plugin://plugin.audio.spotify/?action=browse_main_library",
"DefaultMusicCompilations.png", True))
items.append(
(self.addon.getLocalizedString(11014),
"plugin://plugin.audio.spotify/?action=browse_main_explore",
"DefaultMusicGenres.png", True))
items.append(
(xbmc.getLocalizedString(137),
"plugin://plugin.audio.spotify/?action=search",
"DefaultMusicSearch.png", True))
items.append(
("%s: %s" % (self.addon.getLocalizedString(11039), self.playername),
"plugin://plugin.audio.spotify/?action=browse_playback_devices",
"DefaultMusicPlugins.png", True))
cur_user_label = self.sp.me()["display_name"]
if not cur_user_label:
cur_user_label = self.sp.me()["id"]
label = "%s: %s" % (self.addon.getLocalizedString(11047), cur_user_label)
items.append(
(label,
"plugin://plugin.audio.spotify/?action=switch_user",
"DefaultActor.png", False))
for item in items:
li = xbmcgui.ListItem(
item[0],
path=item[1],
iconImage=item[2]
)
li.setProperty('IsPlayable', 'false')
li.setArt({"fanart": "special://home/addons/plugin.audio.spotify/fanart.jpg"})
li.addContextMenuItems([], True)
xbmcplugin.addDirectoryItem(handle=self.addon_handle, url=item[1], listitem=li, isFolder=item[3])
xbmcplugin.addSortMethod(self.addon_handle, xbmcplugin.SORT_METHOD_UNSORTED)
xbmcplugin.endOfDirectory(handle=self.addon_handle)
self.refresh_connected_device()
示例13: browse_main_explore
# 需要导入模块: import xbmcplugin [as 别名]
# 或者: from xbmcplugin import setProperty [as 别名]
def browse_main_explore(self):
# explore nodes
xbmcplugin.setContent(self.addon_handle, "files")
xbmcplugin.setProperty(self.addon_handle, 'FolderName', self.addon.getLocalizedString(11014))
items = []
items.append(
(self.addon.getLocalizedString(11015),
"plugin://plugin.audio.spotify/?action=browse_playlists&applyfilter=featured",
"DefaultMusicPlaylists.png"))
items.append(
(self.addon.getLocalizedString(11016),
"plugin://plugin.audio.spotify/?action=browse_newreleases",
"DefaultMusicAlbums.png"))
# add categories
items += self.get_explore_categories()
for item in items:
li = xbmcgui.ListItem(
item[0],
path=item[1],
iconImage=item[2]
)
li.setProperty('do_not_analyze', 'true')
li.setProperty('IsPlayable', 'false')
li.setArt({"fanart": "special://home/addons/plugin.audio.spotify/fanart.jpg"})
li.addContextMenuItems([], True)
xbmcplugin.addDirectoryItem(handle=self.addon_handle, url=item[1], listitem=li, isFolder=True)
xbmcplugin.addSortMethod(self.addon_handle, xbmcplugin.SORT_METHOD_UNSORTED)
xbmcplugin.endOfDirectory(handle=self.addon_handle)
示例14: artist_toptracks
# 需要导入模块: import xbmcplugin [as 别名]
# 或者: from xbmcplugin import setProperty [as 别名]
def artist_toptracks(self):
xbmcplugin.setContent(self.addon_handle, "songs")
xbmcplugin.setProperty(self.addon_handle, 'FolderName', self.addon.getLocalizedString(11011))
tracks = self.sp.artist_top_tracks(self.artistid, country=self.usercountry)
tracks = self.prepare_track_listitems(tracks=tracks["tracks"])
self.add_track_listitems(tracks)
xbmcplugin.addSortMethod(self.addon_handle, xbmcplugin.SORT_METHOD_UNSORTED)
xbmcplugin.addSortMethod(self.addon_handle, xbmcplugin.SORT_METHOD_TRACKNUM)
xbmcplugin.addSortMethod(self.addon_handle, xbmcplugin.SORT_METHOD_TITLE)
xbmcplugin.addSortMethod(self.addon_handle, xbmcplugin.SORT_METHOD_VIDEO_YEAR)
xbmcplugin.addSortMethod(self.addon_handle, xbmcplugin.SORT_METHOD_SONG_RATING)
xbmcplugin.endOfDirectory(handle=self.addon_handle)
if self.defaultview_songs:
xbmc.executebuiltin('Container.SetViewMode(%s)' % self.defaultview_songs)
示例15: related_artists
# 需要导入模块: import xbmcplugin [as 别名]
# 或者: from xbmcplugin import setProperty [as 别名]
def related_artists(self):
xbmcplugin.setContent(self.addon_handle, "artists")
xbmcplugin.setProperty(self.addon_handle, 'FolderName', self.addon.getLocalizedString(11012))
cachestr = "spotify.relatedartists.%s" % self.artistid
checksum = self.cache_checksum()
artists = self.cache.get(cachestr, checksum=checksum)
if not artists:
artists = self.sp.artist_related_artists(self.artistid)
artists = self.prepare_artist_listitems(artists['artists'])
self.cache.set(cachestr, artists, checksum=checksum)
self.add_artist_listitems(artists)
xbmcplugin.addSortMethod(self.addon_handle, xbmcplugin.SORT_METHOD_UNSORTED)
xbmcplugin.endOfDirectory(handle=self.addon_handle)
if self.defaultview_artists:
xbmc.executebuiltin('Container.SetViewMode(%s)' % self.defaultview_artists)