本文整理汇总了Python中gmusicapi.Webclient.remove_songs_from_playlist方法的典型用法代码示例。如果您正苦于以下问题:Python Webclient.remove_songs_from_playlist方法的具体用法?Python Webclient.remove_songs_from_playlist怎么用?Python Webclient.remove_songs_from_playlist使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gmusicapi.Webclient
的用法示例。
在下文中一共展示了Webclient.remove_songs_from_playlist方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: MusicSync
# 需要导入模块: from gmusicapi import Webclient [as 别名]
# 或者: from gmusicapi.Webclient import remove_songs_from_playlist [as 别名]
#.........这里部分代码省略.........
print "Connection Error -- Reattempting login"
fatal_count += 1
self.wc.logout()
self.mm.logout()
result = []
time.sleep(STANDARD_SLEEP)
except:
result = []
time.sleep(STANDARD_SLEEP)
try:
if result[0]:
song_id = result[0].itervalues().next()
else:
song_id = result[1].itervalues().next()
print " upload complete [%s]" % song_id
except:
print " upload failed - skipping"
if not song_id:
failed_files += 1
continue
added = self.wc.add_songs_to_playlist(plid, song_id)
time.sleep(.3) # Don't spam the server too fast...
print " done adding to playlist"
added_files += 1
if remove_missing:
for s in goog_songs:
print " removing: %s" % s['title']
self.wc.remove_songs_from_playlist(plid, s.id)
time.sleep(.3) # Don't spam the server too fast...
removed_files += 1
print "%d songs unmodified" % existing_files
print "%d songs added" % added_files
print "%d songs failed" % failed_files
print "%d songs removed" % removed_files
print "Ended: %s" % filename
else:
print " playlist %s didn't exist - skipping" % filename
def get_files_from_playlist(self, filename):
files = []
f = codecs.open(filename, encoding='utf-8')
for line in f:
line = line.rstrip().replace(u'\ufeff',u'')
if line == "" or line[0] == "#":
continue
path = os.path.abspath(self.get_platform_path(line))
if not os.path.exists(path):
print " file not found: %s" % line
continue
files.append(path)
f.close()
return files
def file_already_in_list(self, filename, goog_songs):
tag = self.get_id3_tag(filename)
i = 0
while i < len(goog_songs):
# print "checking: %s" % tag
# print "against: %s" % goog_songs[i]