当前位置: 首页>>代码示例>>Python>>正文


Python FModel.vk_audio_id方法代码示例

本文整理汇总了Python中foobnix.gui.model.FModel.vk_audio_id方法的典型用法代码示例。如果您正苦于以下问题:Python FModel.vk_audio_id方法的具体用法?Python FModel.vk_audio_id怎么用?Python FModel.vk_audio_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在foobnix.gui.model.FModel的用法示例。


在下文中一共展示了FModel.vk_audio_id方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: find_tracks_by_url

# 需要导入模块: from foobnix.gui.model import FModel [as 别名]
# 或者: from foobnix.gui.model.FModel import vk_audio_id [as 别名]
    def find_tracks_by_url(self, url):
        logging.debug("Search By URL")

        index = url.rfind("#")
        if index > 0:
            url = url[:index]
        index = url.find("id=")
        if index < 0:
            return None

        id = url[index + 3:]
        id = int(id)
        if id > 0:
            results = self.get_result('audio.get', "uid=" + str(id))
        else:
            results = self.get_result('audio.get', "gid=" + str(abs(id)))

        childs = []
        for line in results:
            bean = FModel(line['artist'] + ' - ' + line['title'])
            bean.aritst = line['artist']
            bean.title = line['title']
            bean.time = convert_seconds_to_text(line['duration'])
            bean.path = line['url'].replace("https://", "http://")
            bean.vk_audio_id = "%s_%s" % (line['owner_id'], line['aid'])
            childs.append(bean)

        return childs
开发者ID:Cgruppo,项目名称:foobnix,代码行数:30,代码来源:vk_service.py

示例2: find_track_by_id

# 需要导入模块: from foobnix.gui.model import FModel [as 别名]
# 或者: from foobnix.gui.model.FModel import vk_audio_id [as 别名]
 def find_track_by_id(self, id):
     result = self.get_result("audio.get", "audios=" + str(id))
     if not result:
         return None
     line = result[0]
     bean = FModel(line['artist'] + ' - ' + line['title'])
     bean.aritst = line['artist']
     bean.title = line['title']
     bean.time = convert_seconds_to_text(line['duration'])
     bean.path = line['url']
     bean.vk_audio_id = "%s_%s" % (line['owner_id'], line['aid'])
     return bean
开发者ID:Andresteve07,项目名称:foobnix,代码行数:14,代码来源:vk_service.py

示例3: find_track_by_id

# 需要导入模块: from foobnix.gui.model import FModel [as 别名]
# 或者: from foobnix.gui.model.FModel import vk_audio_id [as 别名]
 def find_track_by_id(self, id):
     if id is not None:
         parts = id.split("_")
         result = self.get_result("audio.get", "owner_id=%s&audio_ids=%s" % (str(parts[0]), str(parts[1])))
         line = result[1]
     else:
         result = self.get_result("audio.get", "audios=" + str(id))
         line = result[0]
     if not result:
         return None
     bean = FModel(line['artist'] + ' - ' + line['title'])
     bean.aritst = line['artist']
     bean.title = line['title']
     bean.time = convert_seconds_to_text(line['duration'])
     bean.path = line['url'].replace("https://", "http://")
     bean.vk_audio_id = "%s_%s" % (line['owner_id'], line['aid'])
     return bean
开发者ID:Cgruppo,项目名称:foobnix,代码行数:19,代码来源:vk_service.py

示例4: get_user_tracks_as_beans

# 需要导入模块: from foobnix.gui.model import FModel [as 别名]
# 或者: from foobnix.gui.model.FModel import vk_audio_id [as 别名]
 def get_user_tracks_as_beans(self, user_id):
     beans = []
     result = self.controls.vk_service.get_result('audio.get', "uid=" + user_id)
     if not result:
         beans = [FDModel(_("No results found")).add_is_file(True)]
     else:
         for line in result:
             bean = FModel(line['artist'] + ' - ' + line['title'])
             bean.aritst = line['artist']
             bean.title = line['title']
             bean.time = convert_seconds_to_text(line['duration'])
             bean.path = line['url']
             bean.aid = line['aid']
             bean.oid = line['owner_id']
             bean.is_file = True
             bean.vk_audio_id = "%s_%s" % (line['owner_id'], line['aid'])
             beans.append(bean)
     return beans
开发者ID:foobnix,项目名称:foobnix,代码行数:20,代码来源:vk_integration_tree.py

示例5: find_tracks_by_query

# 需要导入模块: from foobnix.gui.model import FModel [as 别名]
# 或者: from foobnix.gui.model.FModel import vk_audio_id [as 别名]
    def find_tracks_by_query(self, query):
        logging.info("start search songs " + query)
        query = urllib.quote(query.encode("utf-8"))

        list = self.get_result("audio.search", "q=" + query)
        childs = []

        if not list:
            return childs

        for line in list[1:]:
            bean = FModel(line['artist'] + ' - ' + line['title'])
            bean.aritst = line['artist']
            bean.title = line['title']
            bean.time = convert_seconds_to_text(line['duration'])
            bean.path = line['url'].replace("https://", "http://")
            bean.vk_audio_id = "%s_%s" % (line['owner_id'], line['aid'])
            childs.append(bean)

        return childs
开发者ID:Cgruppo,项目名称:foobnix,代码行数:22,代码来源:vk_service.py


注:本文中的foobnix.gui.model.FModel.vk_audio_id方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。