def get_addons_that_have_watch_history(self): addons = [] sql_select = "SELECT DISTINCT addon_id FROM watch_history ORDER BY addon_id" self.dbcur.execute(sql_select) for matchedrow in self.dbcur.fetchall(): match = dict(matchedrow) try: tmp_addon_id = match['addon_id'] tmp_addon = Addon(tmp_addon_id) tmp_addon_name = tmp_addon.get_name() except: tmp_addon_name = tmp_addon_id pass tmp_addon_dtl = {'title' : tmp_addon_name, 'id' : tmp_addon_id} addons.append(tmp_addon_dtl) return addons
def add_my_fav_directory(self, title='Favorites', img='', fanart='', item_mode='main'): if not self.sys_argv: common.addon.log_error('-' + HELPER + '- -' +'sys.argv not passed in Favorites __init__(); Favorites directory will not be created.') return try: tmp_addon_id = 'plugin.video.favorites' tmp_addon = Addon(tmp_addon_id) tmp_addon_name = tmp_addon.get_name() except: common.addon.log_error('-' + HELPER + '- -' +'Favorites video plugin not installed; Favorites directory will not be created.') common.notify(self.addon_id, 'small', ' - My Favorites video addon required', 'Please install My Favorites video addon from The ONE\'s XBMC Addons Repository.', '10000') return listitem = xbmcgui.ListItem(title, iconImage=img, thumbnailImage=img) listitem.setProperty('fanart_image', fanart) uni_fav = { 'uni_fav_addon_id': self.addon_id, 'uni_fav_mode': 'display', 'uni_fav_item_mode': item_mode } params = self._build_params( {'mode':'browse', 'addon_id':self.addon_id, 'local':'true', 'item_mode':item_mode} ) xbmcplugin.addDirectoryItem(handle=int(self.sys_argv[1]),url='plugin://plugin.video.favorites/'+params,isFolder=True,listitem=listitem)
def get_addons_that_have_favorites(self): addons = [] sql_select = "SELECT DISTINCT addon_id FROM favorites ORDER BY addon_id" self.dbcur.execute(sql_select) for matchedrow in self.dbcur.fetchall(): match = dict(matchedrow) try: tmp_addon_id = match['addon_id'] tmp_addon = Addon(tmp_addon_id) tmp_addon_name = tmp_addon.get_name() tmp_addon_img = tmp_addon.get_icon() tmp_addon_fanart = tmp_addon.get_fanart() except: tmp_addon_name = tmp_addon_id tmp_addon_img = '' tmp_addon_fanart = '' pass tmp_addon_dtl = {'title' : tmp_addon_name, 'id' : tmp_addon_id, 'img':tmp_addon_img, 'fanart':tmp_addon_fanart} addons.append(tmp_addon_dtl) return addons
def notify(addon_id, typeq, title, message, times, line2='', line3=''): addon_tmp = Addon(addon_id) if title == '' : title='[B]' + addon_tmp.get_name() + '[/B]' if typeq == 'small': if times == '': times='5000' smallicon= addon_tmp.get_icon() xbmc.executebuiltin("XBMC.Notification("+title+","+message+","+times+","+smallicon+")") elif typeq == 'big': dialog = xbmcgui.Dialog() dialog.ok(' '+title+' ', ' '+message+' ', line2, line3) else: dialog = xbmcgui.Dialog() dialog.ok(' '+title+' ', ' '+message+' ')
def add_my_history_directory(self, title='Watch History', img='', fanart=''): if not self.sys_argv: common.addon.log_error('-' + HELPER + '- -' +'sys.argv not passed in WatchHistory __init__(); Watch History directory will not be created.') return try: tmp_addon_id = 'plugin.video.watchhistory' tmp_addon = Addon(tmp_addon_id) tmp_addon_name = tmp_addon.get_name() except: common.addon.log_error('-' + HELPER + '- -' +'Watch History video plugin not installed; Watch History directory will not be created.') common.notify(self.addon_id, 'small', ' - Watch History video addon required', 'Please install Watch History video addon from The ONE\'s XBMC Addons Repository.', '10000') return listitem = xbmcgui.ListItem(title, iconImage=img, thumbnailImage=img) listitem.setProperty('fanart_image', fanart) params = '?' + common.dict_to_paramstr( {'mode':'browse', 'addon_id':self.addon_id, 'local':'true'} ) xbmcplugin.addDirectoryItem(handle=int(self.sys_argv[1]),url='plugin://plugin.video.watchhistory/'+params,isFolder=True,listitem=listitem)
def add_my_history_directory(self, title='Watch History', img='', fanart=''): if not self.sys_argv: common.addon.log_error( '-' + HELPER + '- -' + 'sys.argv not passed in WatchHistory __init__(); Watch History directory will not be created.' ) return try: tmp_addon_id = 'plugin.video.watchhistory' tmp_addon = Addon(tmp_addon_id) tmp_addon_name = tmp_addon.get_name() except: common.addon.log_error( '-' + HELPER + '- -' + 'Watch History video plugin not installed; Watch History directory will not be created.' ) common.notify( self.addon_id, 'small', ' - Watch History video addon required', 'Please install Watch History video addon from The ONE\'s XBMC Addons Repository.', '10000') return listitem = xbmcgui.ListItem(title, iconImage=img, thumbnailImage=img) listitem.setProperty('fanart_image', fanart) params = '?' + common.dict_to_paramstr({ 'mode': 'browse', 'addon_id': self.addon_id, 'local': 'true' }) xbmcplugin.addDirectoryItem(handle=int(self.sys_argv[1]), url='plugin://plugin.video.watchhistory/' + params, isFolder=True, listitem=listitem)