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


Python Addon.build_plugin_url方法代码示例

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


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

示例1: __init__

# 需要导入模块: from t0mm0.common.addon import Addon [as 别名]
# 或者: from t0mm0.common.addon.Addon import build_plugin_url [as 别名]

#.........这里部分代码省略.........
                
    def delete_item_from_db(self, title, fmtd_title, section_title, section_addon_title, sub_section_title, sub_section_addon_title, item_mode='main'):
    
        hash_title = hashlib.md5(title).hexdigest()
        
        item_column_section = ''
        item_column_sub_section = ''
        if item_mode == 'main':
            item_column_section = 'section_title'
            item_column_sub_section = 'sub_section_title'
        elif item_mode == 'addon':
            item_column_section = 'section_addon_title'
            item_column_sub_section = 'sub_section_addon_title'
        
        sql_delete = ''
        if DB == 'mysql':
            sql_delete = "DELETE FROM favorites WHERE addon_id = %s AND " + item_column_section + " = %s AND " + item_column_sub_section + " = %s AND hash_title = %s"
        else:
            sql_delete = "DELETE FROM favorites WHERE addon_id = ? AND " + item_column_section + " = ? AND " + item_column_sub_section + " = ? AND hash_title = ?"
        
        common.addon.log('-' + HELPER + '- -' + '%s: %s, %s, %s, %s' % (sql_delete, self.addon_id, section_title, sub_section_title, hash_title), 2)
        
        try:
            self.dbcur.execute(sql_delete, (self.addon_id, section_title, sub_section_title, hash_title) )            
            self.dbcon.commit()
            #common.notify(self.addon_id, 'small', '', 'Item: ' + fmtd_title + ' - removed successfully from Favorites.', '8000')
            common.notify(self.addon_id, 'small', '[B]' + fmtd_title + '[/B]', '[B]Removed from Favorites.[/B]', '8000')
        except:
            #common.notify(self.addon_id, 'small', '', 'Item: ' + fmtd_title + ' - unable to remove from Favorites.', '8000')                
            common.notify(self.addon_id, 'small', '[B]' + fmtd_title + '[/B]', '[B]Unable to remove from Favorites.[/B]', '8000')
            pass
        
    def build_url(self, queries):
        return self.addon.build_plugin_url(queries)
    
    def add_item(self, title, url, fmtd_title='', section_title='Misc.', section_addon_title='', sub_section_title='', sub_section_addon_title='', infolabels='', img='', fanart='', is_playable=False, is_folder=False):
        
        if not fmtd_title: fmtd_title = title
        if not section_addon_title: section_addon_title = section_title
        if not sub_section_addon_title: sub_section_addon_title = sub_section_title
        
        uni_fav = {
            'uni_fav_addon_id': self.addon_id,
            'uni_fav_mode': 'add',
            'uni_fav_title': title,
            'uni_fav_fmtd_title': fmtd_title,
            'uni_fav_url': url,
            'uni_fav_section_title': section_title,
            'uni_fav_section_addon_title': section_addon_title,
            'uni_fav_sub_section_title': sub_section_title,
            'uni_fav_sub_section_addon_title': sub_section_addon_title,
            'uni_fav_img': img,
            'uni_fav_fanart': fanart,
            'uni_fav_is_playable': common.bool2str(is_playable),
            'uni_fav_is_folder': common.bool2str(is_folder)            
            }
        
        uni_fav_add_script = 'XBMC.RunScript(%s, %s, %s, "%s")' % (self._get_script_path(), self.sys_argv[1], self._build_params(uni_fav, infolabels), 'plugin.video.couchtuner.favorites')
        
        return uni_fav_add_script
        
    def add_video_item(self, title, url, fmtd_title='', section_title='', section_addon_title='', sub_section_title='', sub_section_addon_title='', infolabels='', img='', fanart='', is_playable=False):
        return self.add_item(title, url, fmtd_title=fmtd_title, section_title=section_title, section_addon_title=section_addon_title, sub_section_title=sub_section_title, sub_section_addon_title=sub_section_addon_title, infolabels=infolabels, img=img, fanart=fanart, is_playable=is_playable)
        
    def add_directory(self, title, url, fmtd_title='', section_title='', section_addon_title='', sub_section_title='', sub_section_addon_title='', infolabels='', img='', fanart=''):
        return self.add_item(title, url, fmtd_title=fmtd_title, section_title=section_title, section_addon_title=section_addon_title, sub_section_title=sub_section_title, sub_section_addon_title=sub_section_addon_title, infolabels=infolabels, img=img, fanart=fanart, is_folder=True)
开发者ID:ArchUser,项目名称:Kasiks-Repo,代码行数:70,代码来源:favorites.py


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