def user_torrents_to_listItem(self): try: sysaddon, syshandle = argv[0], int(argv[1]) torrent_files = self.user_torrents() if not torrent_files: return # torrent_files = [i for i in torrent_files if i['status'] == 'downloaded'] folder_str, deleteMenu = getLS(40046).upper(), getLS(40050) for count, item in enumerate(torrent_files, 1): try: cm = [] isFolder = True if item['status'] == 'downloaded' else False status = '[COLOR %s]%s[/COLOR]' % (control.getHighlightColor(), item['status'].capitalize()) folder_name = string_tools.strip_non_ascii_and_unprintable(item['filename']) label = '%02d | [B]%s[/B] - %s | [B]%s[/B] | [I]%s [/I]' % (count, status, str(item['progress']) + '%', folder_str, folder_name) url = '%s?action=rd_BrowseUserTorrents&id=%s' % (sysaddon, item['id']) if isFolder else None cm.append((deleteMenu % 'Torrent', 'RunPlugin(%s?action=rd_DeleteUserTorrent&id=%s&name=%s)' % (sysaddon, item['id'], quote_plus(folder_name)))) item = control.item(label=label, offscreen=True) item.addContextMenuItems(cm) item.setArt({'icon': rd_icon, 'poster': rd_icon, 'thumb': rd_icon, 'fanart': addonFanart, 'banner': rd_icon}) item.setInfo(type='video', infoLabels='') control.addItem(handle=syshandle, url=url, listitem=item, isFolder=isFolder) except: log_utils.error() control.content(syshandle, 'files') control.directory(syshandle, cacheToDisc=True) except: log_utils.error()
def set_properties(self): try: self.setProperty('dg.total_results', self.total_results) self.setProperty('dg.highlight.color', getHighlightColor()) except: from resources.lib.modules import log_utils log_utils.error()
def upload_LogFile(name): from resources.lib.modules.control import notification url = 'https://paste.kodi.tv/' log_file = joinPath(LOGPATH, '%s.log' % name.lower()) if not existsPath(log_file): return notification(message='Log File not found, likely logging is not enabled.') try: import requests from resources.lib.modules.control import addonVersion, selectDialog, getHighlightColor f = open(log_file, 'r', encoding='utf-8', errors='ignore') text = f.read() f.close() UserAgent = 'Venom %s' % addonVersion('plugin.video.venom') response = requests.post(url + 'documents', data=text.encode('utf-8', errors='ignore'), headers={'User-Agent': UserAgent}) if 'key' in response.json(): result = url + response.json()['key'] log('%s log file uploaded to: %s' % (name, result)) from sys import platform as sys_platform supported_platform = any(value in sys_platform for value in ('win32', 'linux2')) highlight_color = getHighlightColor() list = [('[COLOR %s]url:[/COLOR] %s' % (highlight_color, str(result)), str(result))] if supported_platform: list += [('[COLOR %s] -- Copy url To Clipboard[/COLOR]' % highlight_color, ' ')] select = selectDialog([i[0] for i in list], lang(32196) if name.lower() == 'venom' else lang(32199)) if 'Copy url To Clipboard' in list[select][0]: from resources.lib.modules.source_utils import copy2clip copy2clip(list[select - 1][1]) elif 'message' in response.json(): notification(message='%s Log upload failed: %s' % (name, str(response.json()['message']))) log('%s Log upload failed: %s' % (name, str(response.json()['message'])), level=LOGERROR) else: notification(message='%s Log upload failed' % name) log('%s Log upload failed: %s' % (name, response.text), level=LOGERROR) except: error('%s log upload failed' % name) notification(message='pastebin post failed: See log for more info')
def user_transfers_to_listItem(self): try: sysaddon, syshandle = argv[0], int(argv[1]) extensions = supported_video_extensions() transfer_files = self.user_transfers() if not transfer_files: if self.server_notifications: control.notification(message='Request Failure-Empty Content', icon=pm_icon) log_utils.log('Premiumize.me: Request Failure-Empty Content', __name__, log_utils.LOGDEBUG) return except: log_utils.error() return folder_str, file_str, downloadMenu, renameMenu, deleteMenu, clearFinishedMenu = control.lang(40046).upper(), control.lang(40047).upper(), control.lang(40048), control.lang(40049), control.lang(40050), control.lang(40051) for count, item in enumerate(transfer_files, 1): try: cm = [] type = 'folder' if item['file_id'] is None else 'file' name = control.strip_non_ascii_and_unprintable(item['name']) status = item['status'] progress = item['progress'] if status == 'finished': progress = 100 else: try: progress = re.findall(r'(?:\d{0,1}\.{0,1})(\d+)', str(progress))[0][:2] except: progress = 'UNKNOWN' if type == 'folder': isFolder = True if status == 'finished' else False status_str = '[COLOR %s]%s[/COLOR]' % (control.getHighlightColor(), status.capitalize()) label = '%02d | [B]%s[/B] - %s | [B]%s[/B] | [I]%s [/I]' % (count, status_str, str(progress) + '%', folder_str, name) url = '%s?action=pm_MyFiles&id=%s&name=%s' % (sysaddon, item['folder_id'], quote_plus(name)) # Till PM addresses issue with item also being removed from public acess if item not accessed for 60 days this option is disabled. # cm.append((clearFinishedMenu, 'RunPlugin(%s?action=pm_ClearFinishedTransfers)' % sysaddon)) else: isFolder = False details = self.item_details(item['file_id']) if not details: if self.server_notifications: control.notification(message='Request Failure-Empty Content', icon=pm_icon) log_utils.log('Premiumize.me: Request Failure-Empty Content', __name__, log_utils.LOGDEBUG) return url_link = details['link'] if url_link.startswith('/'): url_link = 'https' + url_link size = details['size'] display_size = float(int(size)) / 1073741824 label = '%02d | %s%% | [B]%s[/B] | %.2f GB | [I]%s [/I]' % (count, str(progress), file_str, display_size, name) url = '%s?action=play_URL&url=%s' % (sysaddon, url_link) cm.append((downloadMenu, 'RunPlugin(%s?action=download&name=%s&image=%s&url=%s&caller=premiumize)' % (sysaddon, quote_plus(name), quote_plus(pm_icon), url_link))) cm.append((deleteMenu % 'Transfer', 'RunPlugin(%s?action=pm_DeleteTransfer&id=%s&name=%s)' % (sysaddon, item['id'], quote_plus(name)))) item = control.item(label=label) item.addContextMenuItems(cm) item.setArt({'icon': pm_icon, 'poster': pm_icon, 'thumb': pm_icon, 'fanart': addonFanart, 'banner': pm_icon}) item.setInfo(type='video', infoLabels='') control.addItem(handle=syshandle, url=url, listitem=item, isFolder=isFolder) except: log_utils.error() control.content(syshandle, 'files') control.directory(syshandle, cacheToDisc=True)
def set_properties(self): try: self.setProperty('dg.total_results', self.total_results) self.setProperty('dg.highlight.color', getHighlightColor()) self.setProperty('dg.trakt_icon', joinPath(artPath(), 'trakt.png')) except: from resources.lib.modules import log_utils log_utils.error()
def __init__(self): self.base_link = 'https://members.easynews.com' self.search_link = '/2.0/search/solr-search/advanced' # self.moderation = 1 if getSetting('easynews_moderation') == 'true' else 0 self.auth = self._get_auth() self.account_link = 'https://account.easynews.com/editinfo.php' self.usage_link = 'https://account.easynews.com/usageview.php' self.highlight_color = control.getHighlightColor()
def __init__(self): self.artPath = control.artPath() self.iconLogos = getSetting('icon.logos') != 'Traditional' self.indexLabels = getSetting('index.labels') == 'true' self.traktCredentials = getTraktCredentialsInfo() self.traktIndicators = getTraktIndicatorsInfo() self.imdbCredentials = getSetting('imdb.user') != '' self.tmdbSessionID = getSetting('tmdb.session_id') != '' self.highlight_color = control.getHighlightColor()
def __init__(self): self.base_link = "https://www.furk.net" self.account_info_link = "/api/account/info?api_key=%s" self.search_link = "/api/plugins/metasearch?api_key=%s&q=%s&cached=yes" \ "&match=%s&moderated=%s%s&sort=relevance&type=video&offset=0&limit=200" self.tfile_link = "/api/file/get?api_key=%s&t_files=1&id=%s" self.get_user_files_link = "/api/file/get?api_key=%s&type=video" self.file_info_link = "/api/file/info?api_key%s" self.file_link_link = "/api/file/link?" self.protect_file_link = "/api/file/protect?" self.user_feeds_link = "/api/feed/get?" self.add_download_link = "/api/dl/add?" self.api_key = control.setting('furk.api') self.highlight_color = control.getHighlightColor() self.files = []
def user_cloud_to_listItem(self, folder_id=None): sysaddon, syshandle = argv[0], int(argv[1]) folder_str, deleteMenu = control.lang(40046).upper(), control.lang( 40050) cloud_dict = self.user_cloud()['magnets'] cloud_dict = [i for i in cloud_dict if i['statusCode'] == 4] for count, item in enumerate(cloud_dict, 1): try: cm = [] folder_name = control.strip_non_ascii_and_unprintable( item['filename']) id = item['id'] status_str = '[COLOR %s]%s[/COLOR]' % ( control.getHighlightColor(), item['status'].capitalize()) label = '%02d | [B]%s[/B] | [B]%s[/B] | [I]%s [/I]' % ( count, status_str, folder_str, folder_name) url = '%s?action=ad_BrowseUserCloud&source=%s' % ( sysaddon, quote_plus(jsdumps(item))) cm.append( (deleteMenu % 'Transfer', 'RunPlugin(%s?action=ad_DeleteTransfer&id=%s&name=%s)' % (sysaddon, id, folder_name))) item = control.item(label=label) item.addContextMenuItems(cm) item.setArt({ 'icon': ad_icon, 'poster': ad_icon, 'thumb': ad_icon, 'fanart': addonFanart, 'banner': ad_icon }) item.setInfo(type='video', infoLabels='') control.addItem(handle=syshandle, url=url, listitem=item, isFolder=True) except: log_utils.error() control.content(syshandle, 'files') control.directory(syshandle, cacheToDisc=True)
def user_transfers_to_listItem(self): sysaddon, syshandle = argv[0], int(argv[1]) transfer_files = self.user_cloud()['magnets'] if not transfer_files: if self.server_notifications: control.notification(message='Request Failure-Empty Content', icon=ad_icon) log_utils.log('AllDebrid: Request Failure-Empty Content', __name__, log_utils.LOGDEBUG) return folder_str, deleteMenu, restartMenu = control.lang( 40046).upper(), control.lang(40050), control.lang(40008) for count, item in enumerate(transfer_files, 1): try: status_code = item['statusCode'] if status_code in (0, 1, 2, 3): active = True downloaded = item['downloaded'] size = item['size'] try: percent = str(round(float(downloaded) / size * 100, 1)) except: percent = '0' else: active = False folder_name = control.strip_non_ascii_and_unprintable( item['filename']) id = item['id'] status_str = '[COLOR %s]%s[/COLOR]' % ( control.getHighlightColor(), item['status'].capitalize()) if active: label = '%02d | [B]%s[/B] - %s | [B]%s[/B]' % ( count, status_str, str(percent) + '%', folder_name) else: label = '%02d | [B]%s[/B] | [B]%s[/B] | [I]%s [/I]' % ( count, status_str, folder_str, folder_name) if status_code == 4: url = '%s?action=ad_BrowseUserCloud&source=%s' % ( sysaddon, quote_plus(jsdumps(item))) isFolder = True else: url = '' isFolder = False cm = [] cm.append( (deleteMenu % 'Transfer', 'RunPlugin(%s?action=ad_DeleteTransfer&id=%s&name=%s)' % (sysaddon, id, folder_name))) if status_code in (6, 7, 9, 10): cm.append(( restartMenu, 'RunPlugin(%s?action=ad_RestartTransfer&id=%s&name=%s)' % (sysaddon, id, folder_name))) item = control.item(label=label) item.addContextMenuItems(cm) item.setArt({ 'icon': ad_icon, 'poster': ad_icon, 'thumb': ad_icon, 'fanart': addonFanart, 'banner': ad_icon }) item.setInfo(type='video', infoLabels='') control.addItem(handle=syshandle, url=url, listitem=item, isFolder=isFolder) except: log_utils.error() control.content(syshandle, 'files') control.directory(syshandle, cacheToDisc=True)