本文整理汇总了Python中library.MediaDB.get_songs_by_uri方法的典型用法代码示例。如果您正苦于以下问题:Python MediaDB.get_songs_by_uri方法的具体用法?Python MediaDB.get_songs_by_uri怎么用?Python MediaDB.get_songs_by_uri使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类library.MediaDB
的用法示例。
在下文中一共展示了MediaDB.get_songs_by_uri方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from library import MediaDB [as 别名]
# 或者: from library.MediaDB import get_songs_by_uri [as 别名]
def __init__(self):
uri =WinFile().run()
if uri and common.file_is_supported(utils.get_path_from_uri(uri)):
try:
MediaDB.get_songs_by_uri(uri)
except:
traceback.print_exc()
示例2: load_taginfo
# 需要导入模块: from library import MediaDB [as 别名]
# 或者: from library.MediaDB import get_songs_by_uri [as 别名]
def load_taginfo(self, uris, pos=None, sort=True):
start = time.time()
if pos is None:
pos = len(self.items)
for uri in uris:
songs = MediaDB.get_songs_by_uri(uri)
if not songs:
continue
self.add_song_cache.extend(songs)
end = time.time()
if end - start > 0.2:
self.render_song(self.add_song_cache, pos, sort)
pos += len(self.add_song_cache)
del self.add_song_cache[:]
start = time.time()
if self.add_song_cache:
self.render_song(self.add_song_cache, pos, sort)
del self.add_song_cache[:]
# save playlists
try:
self.category_view.save_to_library()
except:
pass
示例3: play_uris
# 需要导入模块: from library import MediaDB [as 别名]
# 或者: from library.MediaDB import get_songs_by_uri [as 别名]
def play_uris(self, uris, pos=None, sort=True):
# self.get_toplevel().window.set_cursor(None)
songs = []
for uri in uris:
db_songs = MediaDB.get_songs_by_uri(uri)
if db_songs:
songs.extend(db_songs)
if not songs:
return
if sort: songs.sort()
self.add_songs(songs, pos, sort, True)
示例4: add_file
# 需要导入模块: from library import MediaDB [as 别名]
# 或者: from library.MediaDB import get_songs_by_uri [as 别名]
def add_file(self, filename=None, play=False):
if filename is None:
uri = WinFile().run()
else:
uri = utils.get_uri_from_path(filename)
if uri and common.file_is_supported(utils.get_path_from_uri(uri)):
try:
songs = MediaDB.get_songs_by_uri(uri)
except:
pass
else:
self.add_songs(songs, play=play)
示例5: load_taginfo
# 需要导入模块: from library import MediaDB [as 别名]
# 或者: from library.MediaDB import get_songs_by_uri [as 别名]
def load_taginfo(self, uris, pos=None, sort=True):
start = time.time()
if pos is None:
pos = len(self.items)
for uri in uris:
songs = MediaDB.get_songs_by_uri(uri)
if not songs:
continue
self.add_song_cache.extend(songs)
end = time.time()
if end - start > 0.2:
self.render_song(self.add_song_cache, pos, sort)
pos += len(self.add_song_cache)
del self.add_song_cache[:]
start = time.time()
if self.add_song_cache:
self.render_song(self.add_song_cache, pos, sort)
del self.add_song_cache[:]
示例6: add_to_library
# 需要导入模块: from library import MediaDB [as 别名]
# 或者: from library.MediaDB import get_songs_by_uri [as 别名]
def add_to_library(self, uri):
try:
MediaDB.get_songs_by_uri(uri)
except:
self.logerror("Failed load %s", uri)
示例7: __get_or_create_song
# 需要导入模块: from library import MediaDB [as 别名]
# 或者: from library.MediaDB import get_songs_by_uri [as 别名]
def __get_or_create_song(self, uri):
try:
songs = MediaDB.get_songs_by_uri(uri)
self.add_song_cache.extend(songs)
except:
self.logerror("Failed load %s", uri)