def _insert_cache(self, url, form_data={}, http_response=None): if self._cached == False or not http_response: return request_url = url if form_data: from entertainment import odict ordered_form_data = odict.odict(form_data) ordered_form_data.sort(key=lambda x: x[0].lower()) request_url = request_url + '?' + urllib.urlencode(ordered_form_data) import hashlib id = hashlib.md5(request_url).hexdigest() sql_insert = '' if self._DB == 'mysql': sql_insert = "INSERT INTO netcache( id, request_url, response_url, headers, content, cached ) VALUES(%s, %s, %s, %s, %s, %s)" else: sql_insert = "INSERT INTO netcache( id, request_url, response_url, headers, content, cached ) VALUES(?, ?, ?, ?, ?, ?)" import datetime cache_tm = datetime.datetime.today().strftime('%Y-%m-%d %H:%M:%S') common.addon.log('-' + HELPER + '- -' +'%s: %s, %s' % (sql_insert, id, cache_tm), 2) try: self.dbcur.execute(sql_insert, (id, request_url, http_response.get_url(), common.ConvertListToString(http_response.get_headers()), http_response.content, cache_tm) ) self.dbcon.commit() #common.addon.log('-' + HELPER + '- - success') except Exception, e: common.addon.log('-' + HELPER + '- - failure: %s' % e ) pass
def GetSortOrderOptions(self): from entertainment import odict sort_order_dict = odict.odict() return sort_order_dict
def Search(self, srcr, keywords, type, list, lock, message_queue, page='', total_pages=''): import elementtree.ElementTree as ET import urllib from entertainment.net import Net net = Net(cached=False) keywords = self.CleanTextForSearch(keywords) import re from entertainment import odict search_dict = odict.odict({'search_keywords':keywords}) name = urllib.urlencode(search_dict) id_search = 'http://services.tvrage.com/myfeeds/search.php?key=ag6txjP0RH4m0c8sZk2j&show='+name content = net.http_GET(id_search).content try: root = ET.fromstring(content) except: content = common.CleanText2(content, True, True) root = ET.fromstring(content) shows = root.findall('.//show') for show in shows: show_id = show.find('showid').text show_url = 'http://services.tvrage.com/myfeeds/episode_list.php?key=ag6txjP0RH4m0c8sZk2j&sid='+str(show_id) show_name = show.find('name').text show_year = show.find('started').text self.AddContent(list, srcr, common.mode_Content, show_name, '', 'tv_seasons', url=show_url, name=show_name, year=show_year)
def Search(self, srcr, keywords, type, list, lock, message_queue, page='', total_pages=''): import elementtree.ElementTree as ET import urllib from entertainment.net import Net net = Net() keywords = self.CleanTextForSearch(keywords) import re from entertainment import odict search_dict = odict.odict({'search_keywords':keywords}) name = urllib.urlencode(search_dict) id_search = 'http://services.tvrage.com/myfeeds/search.php?key=ag6txjP0RH4m0c8sZk2j&show='+name content = net.http_GET(id_search).content try: root = ET.fromstring(content) except: content = common.CleanText2(content, True, True) root = ET.fromstring(content) shows = root.findall('.//show') for show in shows: show_id = show.find('showid').text show_url = 'http://services.tvrage.com/myfeeds/episode_list.php?key=ag6txjP0RH4m0c8sZk2j&sid='+str(show_id) show_name = show.find('name').text show_year = show.find('started').text self.AddContent(list, srcr, common.mode_Content, show_name, '', 'tv_seasons', url=show_url, name=show_name, year=show_year)
def Search(self, srcr, keywords, type, list, lock, message_queue, page='', total_pages=''): from entertainment.net import Net net = Net(cached=False, do_not_cache_if_any=do_no_cache_keywords_list) if self.Settings().get_setting('proxy') == "true": import socks (proxy, port) = self.get_proxy() socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, proxy, port) net.set_socket_class(socks.socksocket) custom_url = self.get_url() keywords = self.CleanTextForSearch(keywords) search_page_url = custom_url + 'index.php?search' search_page_content = common.unescape( common.str_conv(net.http_GET(search_page_url).content)) import re search_key = re.compile( 'input type="hidden" name="key" value="([0-9a-f]*)"', re.DOTALL).findall(search_page_content)[0] import urllib from entertainment import odict search_dict = odict.odict({ 'key': search_key, 'search_keywords': keywords, 'search_section': '1' if type == 'movies' else '2', 'sort': 'featured' }) search_dict.sort(key=lambda x: x[0].lower()) search_for_url = custom_url + 'index.php?' + urllib.urlencode( search_dict) self.ExtractContentAndAddtoList(srcr, 'search', search_for_url, type, list, page=page, total_pages=total_pages)
def GetSortOrderOptions(self): from entertainment import odict sort_order_dict = odict.odict() sort_order_dict['asc'] = 'Ascending' sort_order_dict['desc'] = 'Descending' return sort_order_dict
def SearchContent(self, search_key, search_keywords, type, year): from entertainment.net import Net net = Net(do_not_cache_if_any=do_no_cache_keywords_list) if self.Settings().get_setting('proxy') == "true": import socks (proxy, port) = self.get_proxy() socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, proxy, port) net.set_socket_class(socks.socksocket) custom_url = self.get_url() import re import urllib search_dict = { 'key': search_key, 'search_keywords': search_keywords, 'search_section': '1' if type == 'movies' else '2', 'year': year } search_for_url = custom_url + 'index.php?' + urllib.urlencode( search_dict) from entertainment import odict search_dict_for_cache = odict.odict(search_dict) search_dict_for_cache.update({'key': ''}) search_dict_for_cache.sort(key=lambda x: x[0].lower()) search_for_url_for_cache = custom_url + 'index.php?' + urllib.urlencode( search_dict_for_cache) search_results = common.unescape( common.str_conv( net.http_GET(search_for_url, url_for_cache=search_for_url_for_cache).content)) search_content = None #print search_results for search_item in re.finditer( r"<div class=\"index_item.+?\"><a href=\"(.+?)\" title=\"Watch (.+?)\"", search_results): searchitem = search_item.group(2) if year == '0' or year == '': searchitem = re.sub(' \([0-9]+\)', '', searchitem) if common.CreateIdFromString( searchitem) == common.CreateIdFromString( search_keywords + (' (' + year + ')' if year != '0' and year != '' else '')): search_content = search_item break return search_content
def GetSortByOptions(self): from entertainment import odict sort_by_dict = odict.odict() sort_by_dict['added'] = 'Date Added' sort_by_dict['release'] = 'Date Released' sort_by_dict['popular'] = 'Popular' sort_by_dict['rating'] = 'Rating' return sort_by_dict
def SearchContent(self, search_key, search_keywords, type, year): from entertainment.net import Net net = Net(do_not_cache_if_any=do_no_cache_keywords_list) if self.Settings().get_setting("proxy") == "true": import socks (proxy, port) = self.get_proxy() socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, proxy, port) net.set_socket_class(socks.socksocket) custom_url = self.get_url() import re import urllib search_dict = { "key": search_key, "search_keywords": search_keywords, "search_section": "1" if type == "movies" else "2", "year": year, "advanced": "1", } search_for_url = custom_url + "index.php?" + urllib.urlencode(search_dict) from entertainment import odict search_dict_for_cache = odict.odict(search_dict) search_dict_for_cache.update({"key": ""}) search_dict_for_cache.sort(key=lambda x: x[0].lower()) search_for_url_for_cache = custom_url + "index.php?" + urllib.urlencode(search_dict_for_cache) search_results = common.unescape( common.str_conv(net.http_GET(search_for_url, url_for_cache=search_for_url_for_cache).content) ) search_content = None for search_item in re.finditer( r"<div class=\"index_item.+?\"><a href=\"(.+?)\" title=\"Watch (.+?)\"", search_results ): searchitem = search_item.group(2) if year == "0" or year == "": searchitem = re.sub(" \([0-9]+\)", "", searchitem) if common.CreateIdFromString(searchitem) == common.CreateIdFromString( search_keywords + (" (" + year + ")" if year != "0" and year != "" else "") ): search_content = search_item break return search_content
def GetSortByOptions(self): from entertainment import odict sort_by_dict = odict.odict() sort_by_dict['alphabet'] = 'Alphabet' sort_by_dict['date'] = 'Date Added' sort_by_dict['release'] = 'Date Released' sort_by_dict['featured'] = 'Featured' sort_by_dict['ratings'] = 'Ratings' sort_by_dict['views'] = 'Views' return sort_by_dict
def GetSortByOptions(self): from entertainment import odict sort_by_dict = odict.odict() sort_by_dict['alpha'] = 'Alphabet' sort_by_dict['user_rating'] = 'Ratings' sort_by_dict['boxoffice_gross_us'] = 'US Box Office' sort_by_dict['moviemeter'] = 'Views' sort_by_dict['num_votes'] = 'Votes' sort_by_dict['year'] = 'Year' sort_by_dict['release_date_us'] = 'Release Date US' return sort_by_dict
def GetSortByOptions(self): from entertainment import odict sort_by_dict = odict.odict() sort_by_dict["alphabet"] = "Alphabet" sort_by_dict["date"] = "Date Added" sort_by_dict["release"] = "Date Released" sort_by_dict["featured"] = "Featured" sort_by_dict["ratings"] = "Ratings" sort_by_dict["views"] = "Views" return sort_by_dict
def Search(self, srcr, keywords, type, list, lock, message_queue, page="", total_pages=""): from entertainment.net import Net net = Net(cached=False, do_not_cache_if_any=do_no_cache_keywords_list) if self.Settings().get_setting("proxy") == "true": import socks (proxy, port) = self.get_proxy() socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, proxy, port) net.set_socket_class(socks.socksocket) custom_url = self.get_url() keywords = self.CleanTextForSearch(keywords) search_page_url = custom_url + "index.php?search" search_page_content = common.unescape(common.str_conv(net.http_GET(search_page_url).content)) import re search_key = re.search('input type="hidden" name="key" value="([0-9a-f]*)"', search_page_content).group(1) import urllib from entertainment import odict search_dict = odict.odict( { "key": search_key, "search_keywords": keywords, "search_section": "1" if type == "movies" else "2", "sort": "featured", } ) search_dict.sort(key=lambda x: x[0].lower()) search_for_url = custom_url + "index.php?" + urllib.urlencode(search_dict) self.ExtractContentAndAddtoList(srcr, "search", search_for_url, type, list, page=page, total_pages=total_pages)
def _update_cache(self, url, form_data={}, http_response=None): if self._cached == False or not http_response: return request_url = url if form_data: from entertainment import odict ordered_form_data = odict.odict(form_data) ordered_form_data.sort(key=lambda x: x[0].lower()) request_url = request_url + '?' + urllib.urlencode( ordered_form_data) import hashlib id = hashlib.md5(request_url).hexdigest() sql_update = '' if self._DB == 'mysql': sql_update = "UPDATE netcache SET response_url = %s, headers = %s, content = %s, cached = %s WHERE id = %s" else: sql_update = "UPDATE netcache SET response_url = ?, headers = ?, content = ?, cached = ? WHERE id = ?" import datetime cache_tm = datetime.datetime.today().strftime('%Y-%m-%d %H:%M:%S') common.addon.log( '-' + HELPER + '- -' + '%s: %s, %s' % (sql_update, cache_tm, id), 2) try: self.dbcur.execute( sql_update, (http_response.get_url(), common.ConvertListToString(http_response.get_headers()), http_response.content, cache_tm, id)) self.dbcon.commit() #common.addon.log('-' + HELPER + '- - success') except Exception, e: common.addon.log('-' + HELPER + '- - failure: %s' % e) pass
def _get_from_cache(self, url, form_data={}): if self._cached == False: return (Cache_None, False, None) request_url = url if form_data: from entertainment import odict ordered_form_data = odict.odict(form_data) ordered_form_data.sort(key=lambda x: x[0].lower()) request_url = request_url + '?' + urllib.urlencode( ordered_form_data) import hashlib id = hashlib.md5(request_url).hexdigest() cache_action = Cache_Insert cache_found = False cache_content = None try: sql_select = '' if self._DB == 'mysql': sql_select = "SELECT response_url, headers, content, cached FROM netcache WHERE id = %s " else: sql_select = "SELECT response_url, headers, content, cached FROM netcache WHERE id = ? " self.dbcur.execute(sql_select, (id, )) matchedrow = self.dbcur.fetchall()[0] #common.addon.log('Cache - Item Found') match = dict(matchedrow) import datetime try: cached_tm = datetime.datetime.strptime(str(match['cached']), "%Y-%m-%d %H:%M:%S") except: import time cached_tm = datetime.datetime(*(time.strptime( str(match['cached']), "%Y-%m-%d %H:%M:%S")[0:6])) curr_dt = datetime.datetime.today() time_diff = curr_dt - cached_tm interval = datetime.timedelta(hours=Cache_Interval) if time_diff < interval: #common.addon.log('Cache - Item Found - Valid') cache_action = Cache_None cache_found = True cache_content = HttpResponseCached( match['response_url'], common.ConvertStringToList(match['headers']), match['content']) else: #common.addon.log('Cache - Item Found - Invalid') cache_action = Cache_Update cache_found = True cache_content = None except: common.addon.log('Cache - Item Not Found') cache_action = Cache_Insert cache_found = False cache_content = None pass return (cache_action, cache_found, cache_content)
def Resolve(self, url): api_key = self.get_api_key() if api_key == None or api_key == '': return import json from entertainment.net import Net net = Net() from entertainment import odict resolved_media_urls = odict.odict() trans_table = ''.join( [chr(i) for i in range(128)] + [' '] * 128 ) file_get_command = "/api/file/get" file_get_params = {"id" : url, 't_files':'1', 'api_key':api_key} file_get_url = "%s%s" % (self.api_url, file_get_command) file_get_content = net.http_POST(file_get_url, file_get_params).content.translate(trans_table) file_get_data = json.loads(file_get_content) if file_get_data['status'] != 'ok' or file_get_data['found_files'] != '1' : return data_files = file_get_data['files'] data_files = (data_files[0])['t_files'] for data_file in data_files: data_file_name = data_file['name'] data_file_format = "[COLOR red][" + (data_file_name[data_file_name.rfind('.')+1:]).upper() + "][/COLOR]" if 'video' in data_file['ct'] and 'sample' not in data_file_name.lower(): bitrate = data_file.get('bitrate', None) if bitrate: file_url = data_file.get('url_dl', None) if file_url: file_size_fmt = '[COLOR orange][%s][/COLOR]' file_size = 'NA' file_size_in_bytes = data_file['size'] if file_size_in_bytes: flt_file_size_in_bytes = float(file_size_in_bytes) if flt_file_size_in_bytes <= 1024: file_size = '.%2f KB' % (flt_file_size_in_bytes/1024) elif flt_file_size_in_bytes <= 1048576: file_size = '%.2f MB' % (flt_file_size_in_bytes/1048576) else: file_size = "%.2f GB" % (flt_file_size_in_bytes/1073741824) file_name = data_file_format + " " + (file_size_fmt % file_size) + " " + data_file_name resolved_media_urls[file_name] = file_url if len(resolved_media_urls) == 0: resolved_media_urls == None elif len(resolved_media_urls) == 1: resolved_media_urls = ((resolved_media_urls.items())[0])[1] return resolved_media_urls
def Resolve(self, url): api_key = self.get_api_key() if api_key == None or api_key == '': return import json from entertainment.net import Net net = Net(cached=False) from entertainment import odict resolved_media_urls = odict.odict() trans_table = ''.join( [chr(i) for i in range(256)] + [' '] * 256 ) file_get_command = "/api/file/get" file_get_params = {"id" : url, 't_files':'1', 'api_key':api_key} file_get_url = "%s%s" % (self.api_url, file_get_command) try: file_get_content = net.http_POST(file_get_url, file_get_params).content.translate(trans_table) except: file_get_content = net.http_POST(file_get_url, file_get_params).content#.translate(trans_table) file_get_data = json.loads(file_get_content) if file_get_data['status'] != 'ok' or file_get_data['found_files'] != '1' : return data_files = file_get_data['files'] data_files = (data_files[0])['t_files'] for data_file in data_files: data_file_name = data_file['name'] data_file_format = "[COLOR red][" + (data_file_name[data_file_name.rfind('.')+1:]).upper() + "][/COLOR]" if 'video' in data_file['ct'] and 'sample' not in data_file_name.lower(): bitrate = data_file.get('bitrate', None) if bitrate: file_url = data_file.get('url_dl', None) if file_url: file_size_fmt = '[COLOR orange][%s][/COLOR]' file_size = 'NA' file_size_in_bytes = data_file['size'] if file_size_in_bytes: flt_file_size_in_bytes = float(file_size_in_bytes) if flt_file_size_in_bytes <= 1024: file_size = '.%2f KB' % (flt_file_size_in_bytes/1024) elif flt_file_size_in_bytes <= 1048576: file_size = '%.2f MB' % (flt_file_size_in_bytes/1048576) else: file_size = "%.2f GB" % (flt_file_size_in_bytes/1073741824) file_name = data_file_format + " " + (file_size_fmt % file_size) + " " + data_file_name resolved_media_urls[file_name] = file_url if len(resolved_media_urls) == 0: resolved_media_urls == None elif len(resolved_media_urls) == 1: resolved_media_urls = ((resolved_media_urls.items())[0])[1] return resolved_media_urls
def Search(self, indexer, keywords, type, list, lock, message_queue, page='', total_pages=''): from entertainment.net import Net net = Net() keywords = self.CleanTextForSearch(keywords) keywords_lower = keywords.lower().split(' ') match_total = float( len(keywords_lower) ) from entertainment import odict search_dict = odict.odict({ 's' : 'tt', 'q' : keywords}) if indexer == common.indxr_Movies: search_dict.update({'ttype':'ft'}) elif indexer == common.indxr_TV_Shows: search_dict.update({'ttype':'tv'}) search_dict.sort(key=lambda x: x[0].lower()) import urllib search_for_url = self.get_url() + 'find?' + urllib.urlencode(search_dict) content = net.http_GET(search_for_url).content if '<h1 class="findHeader">No results found' in content: return self.AddInfo(list, indexer, 'search', self.get_url(), type, '1', '1') mode = common.mode_File_Hosts if type == 'tv_shows': mode = common.mode_Content type = 'tv_seasons' import re search_results = re.search('(?s)<table class="findList">(.+?)</table>', content) if search_results: search_results = search_results.group(1) search_term_not_found_count = 0 for search_item in re.finditer('<td class="result_text"> <a href="/title/(.+?)/.+?" >(.+?)</a> (.+?) </td>', content): item_id = search_item.group(1) item_url = self.get_url() + 'title/' + item_id item_name = search_item.group(2).strip() item_name_lower = item_name.lower().strip() match_count = 0 for kw in keywords_lower: if kw in item_name_lower: match_count = match_count + 1 match_fraction = ( match_count / match_total ) if not ( match_fraction >= 0.8 ): aka_item = search_item.group(4) aka_name = re.search('aka <i>"(.+?)"</i>', aka_item) if aka_name: item_name = aka_name.group(1) item_name_lower = item_name.lower() match_count = 0 for kw in keywords_lower: if kw in item_name_lower: match_count = match_count + 1 match_fraction = ( match_count / match_total ) if not ( match_fraction >= 0.8 ): search_term_not_found_count += 1 if search_term_not_found_count >= 2: break else: continue else: search_term_not_found_count += 1 if search_term_not_found_count >= 2: break else: continue item_title = item_name.strip() item_other_info = search_item.group(3) item_year = re.search('\(([0-9]+)\)', item_other_info) if item_year: item_year = item_year.group(1) item_title += ' (' + item_year + ')' else: item_year = '' if 'movie' in item_other_info.lower(): type = common.indxr_Movies mode = common.mode_File_Hosts indexer = common.indxr_Movies elif 'series' in item_other_info.lower(): type = 'tv_seasons' mode = common.mode_Content indexer = common.indxr_TV_Shows self.AddContent(list, indexer, mode, item_title.strip(), '', type, url=item_url, name=item_name.strip(), year=item_year, imdb_id=item_id)
def Search(self, indexer, keywords, type, list, lock, message_queue, page='', total_pages=''): from entertainment.net import Net net = Net() keywords = self.CleanTextForSearch(keywords) keywords_lower = keywords.lower().split(' ') match_total = float( len(keywords_lower) ) from entertainment import odict search_dict = odict.odict({ 's' : 'tt', 'q' : keywords}) if indexer == common.indxr_Movies: search_dict.update({'ttype':'ft'}) elif indexer == common.indxr_TV_Shows: search_dict.update({'ttype':'tv'}) search_dict.sort(key=lambda x: x[0].lower()) import urllib search_for_url = self.get_url() + 'find?' + urllib.urlencode(search_dict) content = net.http_GET(search_for_url).content if '<h1 class="findHeader">No results found' in content: return self.AddInfo(list, indexer, 'search', self.get_url(), type, '1', '1') mode = common.mode_File_Hosts if type == 'tv_shows': mode = common.mode_Content type = 'tv_seasons' import re search_results = re.search('(?s)<table class="findList">(.+?)</table>', content) if search_results: search_results = search_results.group(1) search_term_not_found_count = 0 for search_item in re.finditer('<td class="result_text"> <a href="/title/(.+?)/.+?" >(.+?)</a> (.+?) <(.+?)</td>', content): item_id = search_item.group(1) item_url = self.get_url() + 'title/' + item_id item_name = search_item.group(2) item_name_lower = item_name.lower() match_count = 0 for kw in keywords_lower: if kw in item_name_lower: match_count = match_count + 1 match_fraction = ( match_count / match_total ) if not ( match_fraction >= 0.8 ): aka_item = search_item.group(4) aka_name = re.search('aka <i>"(.+?)"</i>', aka_item) if aka_name: item_name = aka_name.group(1) item_name_lower = item_name.lower() match_count = 0 for kw in keywords_lower: if kw in item_name_lower: match_count = match_count + 1 match_fraction = ( match_count / match_total ) if not ( match_fraction >= 0.8 ): search_term_not_found_count += 1 if search_term_not_found_count >= 2: break else: continue else: search_term_not_found_count += 1 if search_term_not_found_count >= 2: break else: continue item_title = item_name item_other_info = search_item.group(3) item_year = re.search('\(([0-9]+)\)', item_other_info) if item_year: item_year = item_year.group(1) item_title += ' (' + item_year + ')' else: item_year = '' if 'movie' in item_other_info.lower(): type = common.indxr_Movies mode = common.mode_File_Hosts indexer = common.indxr_Movies elif 'series' in item_other_info.lower(): type = 'tv_seasons' mode = common.mode_Content indexer = common.indxr_TV_Shows self.AddContent(list, indexer, mode, item_title, '', type, url=item_url, name=item_name, year=item_year, imdb_id=item_id)
def _get_from_cache(self, url, form_data={}): if self._cached == False: return (Cache_None, False, None) request_url = url if form_data: from entertainment import odict ordered_form_data = odict.odict(form_data) ordered_form_data.sort(key=lambda x: x[0].lower()) request_url = request_url + '?' + urllib.urlencode(ordered_form_data) import hashlib id = hashlib.md5(request_url).hexdigest() cache_action = Cache_Insert cache_found = False cache_content = None try: sql_select = '' if self._DB == 'mysql': sql_select = "SELECT response_url, headers, content, cached FROM netcache WHERE id = %s " else: sql_select = "SELECT response_url, headers, content, cached FROM netcache WHERE id = ? " self.dbcur.execute(sql_select, (id, ) ) matchedrow = self.dbcur.fetchall()[0] #common.addon.log('Cache - Item Found') match = dict(matchedrow) import datetime try: cached_tm = datetime.datetime.strptime(str(match['cached']), "%Y-%m-%d %H:%M:%S") except: import time cached_tm = datetime.datetime(*(time.strptime(str(match['cached']), "%Y-%m-%d %H:%M:%S")[0:6])) curr_dt = datetime.datetime.today() time_diff = curr_dt - cached_tm interval = datetime.timedelta ( hours = Cache_Interval ) if time_diff < interval: #common.addon.log('Cache - Item Found - Valid') cache_action = Cache_None cache_found = True cache_content = HttpResponseCached(match['response_url'], common.ConvertStringToList(match['headers']), match['content']) else: #common.addon.log('Cache - Item Found - Invalid') cache_action = Cache_Update cache_found = True cache_content = None except: common.addon.log('Cache - Item Not Found') cache_action = Cache_Insert cache_found = False cache_content = None pass return (cache_action, cache_found, cache_content)
epoch_str = epoch_str.replace('.', '') epoch_str = epoch_str[:-3] return epoch_str from entertainment import odict quality_dict = odict.odict({ 'ts': 'TS', 'hdts': 'TS', 'tsrip': 'TS', 'cam': 'CAM', 'camrip': 'CAM', 'hdcam': 'CAM', 'dvdscr': 'DVD', 'dvdrip': 'DVD', 'dvd': 'DVD', 'brrip': 'HD', 'bdrip': 'HD', 'bluray': 'HD', 'hd': 'HD', '720p': '720P', '1080p': '1080P', '3d': '3D' }) movie_container_dict = odict.odict({'mkv': 'MKV', 'mp4': 'MP4', 'avi': 'AVI'}) def RemoveNonAscii(text): import re cleaned = re.sub(r'[^\x00-\x7F]+', ' ', text)
epoch_str = str('%f' % epoch) epoch_str = epoch_str.replace('.','') epoch_str = epoch_str[:-3] return epoch_str from entertainment import odict quality_dict = odict.odict({ 'ts' : 'TS', 'hdts' : 'TS', 'tsrip' : 'TS', 'cam' : 'CAM', 'camrip' : 'CAM', 'hdcam' : 'CAM', 'dvdscr' : 'DVD', 'dvdrip' : 'DVD', 'dvd' : 'DVD', 'brrip' : 'HD', 'bdrip' : 'HD', 'bluray' : 'HD', 'hd' : 'HD', '720p' : '720P', '1080p' : '1080P', '3d' : '3D' }) movie_container_dict = odict.odict( { 'mkv' : 'MKV', 'mp4' : 'MP4', 'avi' : 'AVI' })