本文整理汇总了Python中song.Song.getTagName方法的典型用法代码示例。如果您正苦于以下问题:Python Song.getTagName方法的具体用法?Python Song.getTagName怎么用?Python Song.getTagName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类song.Song
的用法示例。
在下文中一共展示了Song.getTagName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: sortFunc
# 需要导入模块: from song import Song [as 别名]
# 或者: from song.Song import getTagName [as 别名]
def sortFunc(self,chanson):
(emptiedLevel, tagNames) = Song.getTagName(self.comm)
values = ' '.join(chanson.getValues(tagNames))
def tryint(s):
try:
return int(s)
except:
return s
# Split the string between numeric and literal chunks and
# return a list of string and int
return [ tryint(c) for c in re.split('([0-9]+)', values) ]
示例2: onTag
# 需要导入模块: from song import Song [as 别名]
# 或者: from song.Song import getTagName [as 别名]
def onTag(self, bus, msg):
song = self.model().item(self.playingId, 0).data()
(emptiedStr, tagNames) = Song.getTagName(self.radioConfig['prefered_informations'])
taglist = msg.parse_tag()
#print(taglist.to_string())
def handle_tag(tagslist, tag, userdata):
# Look there for list of available tags
#http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstTagList.html
if tag == "bitrate":
song['bitrate'] = tagslist.get_uint(tag)[1]//1000
elif tag == "title":
tmp = tagslist.get_string(tag)[1].split("-", 1)
song['title'] = tmp[0].strip()
song['artist'] = tmp[0].strip()
elif tag == "genre":
song['genre'] = tagslist.get_string(tag)[1]
elif tag == "channel-mode":
song['channels'] = tagslist.get_string(tag)[1]
taglist.foreach(handle_tag, None)
attribs = song.getOptionalValues(self.radioConfig['prefered_informations'])
self.model().item(self.playingId, 2).setText(attribs[0])