Merge branch 'master' into alpha
This commit is contained in:
@@ -136,11 +136,12 @@ class autorenumber():
|
||||
else:
|
||||
self.renumberdict = {}
|
||||
for item in self.itemlist:
|
||||
item.context = [{"title": typo(config.get_localized_string(70585), 'bold'),
|
||||
"action": "start",
|
||||
"channel": "autorenumber",
|
||||
"from_channel": item.channel,
|
||||
"from_action": item.action}]
|
||||
if item.contentType != 'movie':
|
||||
item.context = [{"title": typo(config.get_localized_string(70585), 'bold'),
|
||||
"action": "start",
|
||||
"channel": "autorenumber",
|
||||
"from_channel": item.channel,
|
||||
"from_action": item.action}]
|
||||
|
||||
def config(self):
|
||||
# Pulizia del Titolo
|
||||
@@ -149,16 +150,18 @@ class autorenumber():
|
||||
elif not self.item.infoLabels['tmdb_id']:
|
||||
self.item.contentSerieName = self.title.rstrip('123456789 ')
|
||||
|
||||
self.item.infoLabels['imdb_id'] = ''
|
||||
self.item.infoLabels['tvdb_id'] = ''
|
||||
self.item.infoLabels['tmdb_id'] = ''
|
||||
self.item.infoLabels['year'] = '-'
|
||||
self.item.contentType = 'tvshow'
|
||||
|
||||
while not self.item.exit:
|
||||
tmdb.find_and_set_infoLabels(self.item)
|
||||
if self.item.infoLabels['tmdb_id']: self.item.exit = True
|
||||
else:self.item = platformtools.dialog_info(self.item, 'tmdb')
|
||||
if not self.item.disabletmdb:
|
||||
self.item.infoLabels['imdb_id'] = ''
|
||||
self.item.infoLabels['tvdb_id'] = ''
|
||||
self.item.infoLabels['tmdb_id'] = ''
|
||||
self.item.infoLabels['year'] = '-'
|
||||
|
||||
while not self.item.exit:
|
||||
tmdb.find_and_set_infoLabels(self.item)
|
||||
if self.item.infoLabels['tmdb_id']: self.item.exit = True
|
||||
else:self.item = platformtools.dialog_info(self.item, 'tmdb')
|
||||
|
||||
# Rinumerazione Automatica
|
||||
if (not self.id and self.auto) or self.item.setrenumber:
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
# Backup and restore video library
|
||||
# ------------------------------------------------------------
|
||||
|
||||
import datetime, xbmc, os, shutil
|
||||
import datetime, xbmc, os, shutil, sys
|
||||
|
||||
from zipfile import ZipFile
|
||||
from core import videolibrarytools, filetools
|
||||
@@ -11,12 +11,15 @@ from platformcode import logger, config, platformtools, xbmc_videolibrary
|
||||
from distutils.dir_util import copy_tree
|
||||
from specials import videolibrary
|
||||
|
||||
temp_path = u'' + xbmc.translatePath("special://userdata/addon_data/plugin.video.kod/temp/")
|
||||
videolibrary_temp_path = u'' + xbmc.translatePath("special://userdata/addon_data/plugin.video.kod/temp/videolibrary")
|
||||
movies_path = u'' + filetools.join(videolibrary_temp_path, "movies")
|
||||
tvshows_path = u'' + filetools.join(videolibrary_temp_path, "tvshows")
|
||||
videolibrary_movies_path = u'' + videolibrarytools.MOVIES_PATH
|
||||
videolibrary_tvshows_path = u'' + videolibrarytools.TVSHOWS_PATH
|
||||
PY3 = False
|
||||
if sys.version_info[0] >= 3: PY3 = True; unicode = str; unichr = chr; long = int
|
||||
|
||||
temp_path = unicode(xbmc.translatePath("special://userdata/addon_data/plugin.video.kod/temp/"))
|
||||
videolibrary_temp_path = unicode(xbmc.translatePath("special://userdata/addon_data/plugin.video.kod/temp/videolibrary"))
|
||||
movies_path = unicode(filetools.join(videolibrary_temp_path, "movies"))
|
||||
tvshows_path = unicode(filetools.join(videolibrary_temp_path, "tvshows"))
|
||||
videolibrary_movies_path = unicode(videolibrarytools.MOVIES_PATH)
|
||||
videolibrary_tvshows_path = unicode(videolibrarytools.TVSHOWS_PATH)
|
||||
|
||||
|
||||
def export_videolibrary(item):
|
||||
@@ -25,7 +28,7 @@ def export_videolibrary(item):
|
||||
zip_file_folder = platformtools.dialog_browse(3, config.get_localized_string(80002))
|
||||
if zip_file_folder == "":
|
||||
return
|
||||
zip_file = u'' + xbmc.translatePath(zip_file_folder + "KoD_video_library-" + str(datetime.date.today()) + ".zip")
|
||||
zip_file = unicode(xbmc.translatePath(zip_file_folder + "KoD_video_library-" + str(datetime.date.today()) + ".zip"))
|
||||
|
||||
p_dialog = platformtools.dialog_progress_bg(config.get_localized_string(20000), config.get_localized_string(80003))
|
||||
# p_dialog.update(0)
|
||||
@@ -53,7 +56,7 @@ def export_videolibrary(item):
|
||||
def import_videolibrary(item):
|
||||
logger.info()
|
||||
|
||||
zip_file = u'' + platformtools.dialog_browse(1, config.get_localized_string(80005), mask=".zip")
|
||||
zip_file = unicode(platformtools.dialog_browse(1, config.get_localized_string(80005), mask=".zip"))
|
||||
if zip_file == "":
|
||||
return
|
||||
if not platformtools.dialog_yesno(config.get_localized_string(20000), config.get_localized_string(80006)):
|
||||
@@ -112,6 +115,7 @@ def zip(dir, file):
|
||||
if smb:
|
||||
filetools.move(file, temp)
|
||||
|
||||
|
||||
def unzip(dir, file):
|
||||
if file.lower().startswith('smb://'):
|
||||
temp = filetools.join(temp_path, os.path.split(file)[-1])
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
[
|
||||
"platformcode.contextmenu.search",
|
||||
"platformcode.contextmenu.update_tv_show",
|
||||
"platformcode.contextmenu.tvshow_options",
|
||||
"platformcode.contextmenu.trailer"
|
||||
]
|
||||
@@ -1,163 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import xbmc, sys, xbmcgui, os, xbmcvfs, traceback
|
||||
from platformcode import config, logger
|
||||
|
||||
librerias = xbmc.translatePath(os.path.join(config.get_runtime_path(), 'lib'))
|
||||
sys.path.insert(0, librerias)
|
||||
|
||||
from core.item import Item
|
||||
from lib.sambatools import libsmb as samba
|
||||
from core import scrapertools, support
|
||||
|
||||
path = ''
|
||||
mediatype = ''
|
||||
|
||||
|
||||
def exists(path, silent=False, vfs=True):
|
||||
path = xbmc.translatePath(path)
|
||||
try:
|
||||
if vfs:
|
||||
result = bool(xbmcvfs.exists(path))
|
||||
if not result and not path.endswith('/') and not path.endswith('\\'):
|
||||
result = bool(xbmcvfs.exists(join(path, ' ').rstrip()))
|
||||
return result
|
||||
elif path.lower().startswith("smb://"):
|
||||
return samba.exists(path)
|
||||
else:
|
||||
return os.path.exists(path)
|
||||
except:
|
||||
logger.error("ERROR when checking the path: %s" % path)
|
||||
if not silent:
|
||||
logger.error(traceback.format_exc())
|
||||
return False
|
||||
|
||||
|
||||
def join(*paths):
|
||||
list_path = []
|
||||
if paths[0].startswith("/"):
|
||||
list_path.append("")
|
||||
for path in paths:
|
||||
if path:
|
||||
list_path += path.replace("\\", "/").strip("/").split("/")
|
||||
|
||||
if scrapertools.find_single_match(paths[0], r'(^\w+:\/\/)'):
|
||||
return str("/".join(list_path))
|
||||
else:
|
||||
return str(os.sep.join(list_path))
|
||||
|
||||
|
||||
def search_paths(Id):
|
||||
records = execute_sql('SELECT idPath FROM tvshowlinkpath WHERE idShow LIKE "%s"' % Id)
|
||||
if len(records) >= 1:
|
||||
for record in records:
|
||||
path_records = execute_sql('SELECT strPath FROM path WHERE idPath LIKE "%s"' % record[0])
|
||||
for path in path_records:
|
||||
if config.get_setting('videolibrarypath') in path[0] and exists(join(path[0], 'tvshow.nfo')):
|
||||
return path[0]
|
||||
return ''
|
||||
|
||||
|
||||
def execute_sql(sql):
|
||||
logger.debug()
|
||||
file_db = ""
|
||||
records = None
|
||||
|
||||
# We look for the archive of the video database according to the version of kodi
|
||||
video_db = config.get_platform(True)['video_db']
|
||||
if video_db:
|
||||
file_db = os.path.join(xbmc.translatePath("special://userdata/Database"), video_db)
|
||||
|
||||
# alternative method to locate the database
|
||||
if not file_db or not os.path.exists(file_db):
|
||||
file_db = ""
|
||||
for f in os.path.listdir(xbmc.translatePath("special://userdata/Database")):
|
||||
path_f = os.path.join(xbmc.translatePath("special://userdata/Database"), f)
|
||||
|
||||
if os.path.pathoos.pathols.isfile(path_f) and f.lower().startswith('myvideos') and f.lower().endswith('.db'):
|
||||
file_db = path_f
|
||||
break
|
||||
|
||||
if file_db:
|
||||
logger.debug("DB file: %s" % file_db)
|
||||
conn = None
|
||||
try:
|
||||
import sqlite3
|
||||
conn = sqlite3.connect(file_db)
|
||||
cursor = conn.cursor()
|
||||
|
||||
logger.debug("Running sql: %s" % sql)
|
||||
cursor.execute(sql)
|
||||
conn.commit()
|
||||
|
||||
records = cursor.fetchall()
|
||||
if sql.lower().startswith("select"):
|
||||
if len(records) == 1 and records[0][0] is None:
|
||||
records = []
|
||||
|
||||
conn.close()
|
||||
logger.debug("Query executed. Records: %s" % len(records))
|
||||
|
||||
except:
|
||||
logger.error("Error executing sql query")
|
||||
if conn:
|
||||
conn.close()
|
||||
|
||||
else:
|
||||
logger.debug("Database not found")
|
||||
|
||||
return records
|
||||
|
||||
|
||||
def get_id():
|
||||
global mediatype
|
||||
|
||||
mediatype = xbmc.getInfoLabel('ListItem.DBTYPE')
|
||||
if mediatype == 'tvshow':
|
||||
dbid = xbmc.getInfoLabel('ListItem.DBID')
|
||||
elif mediatype in ('season', 'episode'):
|
||||
dbid = xbmc.getInfoLabel('ListItem.TvShowDBID')
|
||||
else:
|
||||
dbid = ''
|
||||
return dbid
|
||||
|
||||
def check_condition():
|
||||
# support.dbg()
|
||||
global path
|
||||
path = search_paths(get_id())
|
||||
return path
|
||||
|
||||
|
||||
def get_menu_items():
|
||||
logger.debug('get menu item')
|
||||
if check_condition():
|
||||
items = [(config.get_localized_string(70269), update)]
|
||||
from core.videolibrarytools import read_nfo
|
||||
nfo = path + 'tvshow.nfo'
|
||||
item = read_nfo(nfo)[1]
|
||||
if item:
|
||||
item.nfo = nfo
|
||||
item_url = item.tourl()
|
||||
# Context menu: Automatically search for new episodes or not
|
||||
if item.active and int(item.active) > 0:
|
||||
update_text = config.get_localized_string(60022)
|
||||
value = 0
|
||||
else:
|
||||
update_text = config.get_localized_string(60023)
|
||||
value = 1
|
||||
items.append((update_text, lambda: xbmc.executebuiltin("RunPlugin(plugin://plugin.video.kod/?{}&title={}&action=mark_tvshow_as_updatable&channel=videolibrary&active={})".format(item_url, update_text, str(value)))))
|
||||
if item.local_episodes_path == "":
|
||||
items.append((config.get_localized_string(80048), lambda: xbmc.executebuiltin("RunPlugin(plugin://plugin.video.kod/?{}&action=add_local_episodes&channel=videolibrary&path={})".format(item_url, path))))
|
||||
|
||||
return items
|
||||
else:
|
||||
return []
|
||||
|
||||
|
||||
def update():
|
||||
dbid = get_id()
|
||||
path = search_paths(dbid)
|
||||
if path:
|
||||
item = Item(action="update_tvshow", channel="videolibrary", path=path)
|
||||
# Why? I think it is not necessary, just commented
|
||||
# item.tourl()
|
||||
xbmc.executebuiltin("RunPlugin(plugin://plugin.video.kod/?" + item.tourl() + ")")
|
||||
@@ -10,12 +10,14 @@ import channelselector
|
||||
addon_icon = filetools.join( config.__settings__.getAddonInfo( "path" ),'resources', 'media', 'logo.png' )
|
||||
|
||||
background = 'FF232323'
|
||||
overlay = '77232323'
|
||||
text = 'FFFFFFFF'
|
||||
select = 'FF0082C2'
|
||||
if config.get_setting('icon_set') == 'dark':
|
||||
background = 'FFDCDCDC'
|
||||
overlay = '77DCDCDC'
|
||||
text = 'FF232323'
|
||||
select = '880082C2'
|
||||
select = 'FF78BDDF'
|
||||
|
||||
class KeyListener(xbmcgui.WindowXMLDialog):
|
||||
TIMEOUT = 10
|
||||
@@ -122,13 +124,15 @@ class Main(xbmcgui.WindowXMLDialog):
|
||||
|
||||
def menulist(self, menu):
|
||||
itemlist = []
|
||||
self.getControl(200).setLabel(background)
|
||||
self.getControl(201).setLabel(overlay)
|
||||
self.getControl(202).setLabel(select)
|
||||
self.getControl(203).setLabel(text)
|
||||
for menuentry in menu:
|
||||
# if not menuentry.channel: menuentry.channel = 'news'
|
||||
|
||||
title = re.sub(r'(\[[/]?COLOR[^\]]*\])','',menuentry.title)
|
||||
item = xbmcgui.ListItem(title)
|
||||
item.setProperty('background', background)
|
||||
item.setProperty('text', text)
|
||||
item.setProperty('select', select)
|
||||
item.setProperty('channel', menuentry.channel)
|
||||
item.setProperty('focus', '0')
|
||||
item.setProperty('thumbnail', menuentry.thumbnail)
|
||||
@@ -175,6 +179,7 @@ class Main(xbmcgui.WindowXMLDialog):
|
||||
|
||||
|
||||
def submenu(self):
|
||||
itmlist = []
|
||||
channel_name = self.MENU.getSelectedItem().getProperty('channel')
|
||||
focus = int(self.MENU.getSelectedItem().getProperty('focus'))
|
||||
if channel_name == 'channelselector':
|
||||
|
||||
@@ -5,11 +5,12 @@
|
||||
|
||||
from specials import videolibrary
|
||||
import sys, os
|
||||
|
||||
PY3 = False
|
||||
if sys.version_info[0] >= 3:PY3 = True; unicode = str; unichr = chr; long = int
|
||||
|
||||
from core.item import Item
|
||||
from core import filetools, jsontools, videolibrarydb
|
||||
from core import filetools, videolibrarydb
|
||||
from platformcode import config, logger, platformtools
|
||||
from platformcode.logger import WebErrorException
|
||||
temp_search_file = config.get_temp_file('temp-search')
|
||||
@@ -144,14 +145,20 @@ def run(item=None):
|
||||
if not webbrowser.open(item.url):
|
||||
import xbmc
|
||||
if xbmc.getCondVisibility('system.platform.linux') and xbmc.getCondVisibility('system.platform.android'): # android
|
||||
xbmc.executebuiltin('StartAndroidActivity("", "android.intent.action.VIEW", "", "%s")' % (item.url))
|
||||
xbmc.executebuiltin('StartAndroidActivity("", "android.intent.action.VIEW", "", "%s")' % item.url)
|
||||
else:
|
||||
try:
|
||||
import urllib.request as urllib
|
||||
except ImportError:
|
||||
import urllib
|
||||
short = urllib.urlopen('https://u.nu/api.php?action=shorturl&format=simple&url=' + item.url).read().decode('utf-8')
|
||||
platformtools.dialog_ok(config.get_localized_string(20000), config.get_localized_string(70740) % short)
|
||||
platformtools.dialog_ok(config.get_localized_string(20000), config.get_localized_string(70740) % "\n".join([item.url[j:j+57] for j in range(0, len(item.url), 57)]))
|
||||
elif item.action == "gotopage":
|
||||
page = platformtools.dialog_numeric(0, config.get_localized_string(70513))
|
||||
if page:
|
||||
import xbmc
|
||||
item.action = item.real_action
|
||||
if item.page:
|
||||
item.page = page
|
||||
else:
|
||||
import re
|
||||
item.url = re.sub('([=/])[0-9]+(/?)$', '\g<1>' + page + '\g<2>', item.url)
|
||||
xbmc.executebuiltin("Container.Update(%s?%s)" % (sys.argv[0], item.tourl()))
|
||||
else:
|
||||
# Checks if channel exists
|
||||
if os.path.isfile(os.path.join(config.get_runtime_path(), 'channels', item.channel + ".py")):
|
||||
@@ -251,6 +258,11 @@ def run(item=None):
|
||||
from core import videolibrarytools
|
||||
videolibrarytools.add_to_videolibrary(item, channel)
|
||||
|
||||
# Special action for adding a undefined to the library
|
||||
elif item.action == "add_to_library":
|
||||
from core import videolibrarytools
|
||||
videolibrarytools.add_to_videolibrary(item, channel)
|
||||
|
||||
# Special action for downloading all episodes from a serie
|
||||
elif item.action == "download_all_episodes":
|
||||
from specials import downloads
|
||||
|
||||
@@ -416,15 +416,18 @@ def render_items(itemlist, parent_item):
|
||||
context_commands = def_context_commands
|
||||
listitem.addContextMenuItems(context_commands)
|
||||
return item, item_url, listitem
|
||||
# from core.support import dbg;dbg()
|
||||
r_list = [set_item(i, item, parent_item) for i, item in enumerate(itemlist)]
|
||||
# r_list = []
|
||||
|
||||
# with futures.ThreadPoolExecutor() as executor:
|
||||
# searchList = [executor.submit(set_item, i, item, parent_item) for i, item in enumerate(itemlist)]
|
||||
# for res in futures.as_completed(searchList):
|
||||
# r_list.append(res.result())
|
||||
# r_list.sort(key=lambda it: it[0].itemlistPosition)
|
||||
# For Debug
|
||||
# from core.support import dbg;dbg()
|
||||
# r_list = [set_item(i, item, parent_item) for i, item in enumerate(itemlist)]
|
||||
|
||||
r_list = []
|
||||
|
||||
with futures.ThreadPoolExecutor() as executor:
|
||||
searchList = [executor.submit(set_item, i, item, parent_item) for i, item in enumerate(itemlist)]
|
||||
for res in futures.as_completed(searchList):
|
||||
r_list.append(res.result())
|
||||
r_list.sort(key=lambda it: it[0].itemlistPosition)
|
||||
|
||||
for item, item_url, listitem in r_list:
|
||||
dirItems.append(('%s?%s' % (sys.argv[0], item_url), listitem, item.folder, len(r_list)))
|
||||
@@ -435,7 +438,7 @@ def render_items(itemlist, parent_item):
|
||||
elif parent_item.sorted == 'name':xbmcplugin.addSortMethod(int(sys.argv[1]), xbmcplugin.SORT_METHOD_TITLE_IGNORE_THE)
|
||||
|
||||
if parent_item.list_type == '':
|
||||
breadcrumb = parent_item.category.capitalize()
|
||||
breadcrumb = parent_item.category #.capitalize()
|
||||
else:
|
||||
if 'similar' in parent_item.list_type:
|
||||
if parent_item.contentTitle != '':
|
||||
@@ -682,7 +685,7 @@ def set_context_commands(item, item_url, parent_item, **kwargs):
|
||||
context_commands.append((config.get_localized_string(60350), "Container.Refresh (%s?%s&%s)" % (sys.argv[0], item_url, urllib.urlencode({'channel': 'search', 'action': "from_context", 'from_channel': item.channel, 'contextual': True, 'text': item.wanted}))))
|
||||
context_commands.append( (config.get_localized_string(70561), "Container.Update (%s?%s&%s)" % (sys.argv[0], item_url, 'channel=search&action=from_context&search_type=list&page=1&list_type=%s/%s/similar' % (mediatype, item.infoLabels['tmdb_id']))))
|
||||
|
||||
if item.channel != "videolibrary" and item.videolibrary != False:
|
||||
if item.channel != "videolibrary" and item.videolibrary != False and not item.disable_videolibrary:
|
||||
# Add Series to the video library
|
||||
if item.action in ["episodios", "get_episodios", "get_seasons"] and item.contentSerieName:
|
||||
context_commands.append((config.get_localized_string(60352), "RunPlugin(%s?%s&%s)" % (sys.argv[0], item_url, 'action=add_serie_to_library&from_action={}&contentChannel=videolibrary'.format(item.action))))
|
||||
@@ -692,7 +695,7 @@ def set_context_commands(item, item_url, parent_item, **kwargs):
|
||||
elif item.action in ['check'] and item.contentTitle or item.contentSerieName:
|
||||
context_commands.append((config.get_localized_string(30161), "RunPlugin(%s?%s&%s)" % (sys.argv[0], item_url, 'action=add_to_library&from_action={}&contentChannel=videolibrary'.format(item.action))))
|
||||
|
||||
if not item.local and item.channel not in ["downloads", "filmontv", "search"] and item.server != 'torrent' and parent_item.action != 'mainlist' and config.get_setting('downloadenabled'):
|
||||
if not item.local and item.channel not in ["downloads", "filmontv", "search"] and item.server != 'torrent' and parent_item.action != 'mainlist' and config.get_setting('downloadenabled') and not item.disable_videolibrary:
|
||||
# Download movie
|
||||
if item.contentType == "movie":
|
||||
context_commands.append((config.get_localized_string(60354), "RunPlugin(%s?%s&%s)" % (sys.argv[0], item_url, 'channel=downloads&action=save_download&from_channel=' + item.channel + '&from_action=' + item.action)))
|
||||
@@ -715,6 +718,8 @@ def set_context_commands(item, item_url, parent_item, **kwargs):
|
||||
if (item.contentTitle and item.contentType in ['movie', 'tvshow']) or "buscar_trailer" in context:
|
||||
context_commands.append((config.get_localized_string(60359), "RunPlugin(%s?%s&%s)" % (sys.argv[0], item_url, urllib.urlencode({ 'channel': "trailertools", 'action': "buscartrailer", 'search_title': item.contentTitle if item.contentTitle else item.fulltitle, 'contextual': True}))))
|
||||
|
||||
if item.nextPage:
|
||||
context_commands.append((config.get_localized_string(70511), "RunPlugin(%s?%s&%s)" % (sys.argv[0], item_url, 'action=gotopage&real_action='+item.action)))
|
||||
if config.dev_mode():
|
||||
context_commands.insert(0, ("item info", "Container.Update (%s?%s)" % (sys.argv[0], Item(action="itemInfo", parent=item.tojson()).tourl())))
|
||||
return context_commands
|
||||
@@ -1041,7 +1046,7 @@ def play_video(item, strm=False, force_direct=False, autoplay=False):
|
||||
xlistitem.setProperty("inputstream.adaptive.license_type", item.drm)
|
||||
xlistitem.setProperty("inputstream.adaptive.license_key", item.license)
|
||||
xlistitem.setMimeType('application/dash+xml')
|
||||
elif item.manifest == 'hls' or mediaurl.split('|')[0].endswith('m3u8'):
|
||||
elif item.manifest == 'hls' or (mediaurl.split('|')[0].endswith('m3u8') and mediaurl.startswith('http')):
|
||||
if not install_inputstream():
|
||||
return
|
||||
xlistitem.setProperty('inputstream' if PY3 else 'inputstreamaddon', 'inputstream.adaptive')
|
||||
@@ -1122,23 +1127,23 @@ def get_seleccion(default_action, opciones, seleccion, video_urls):
|
||||
|
||||
|
||||
def calcResolution(option):
|
||||
match = scrapertools.find_single_match(option, '([0-9]{2,4})x([0-9]{2,4})')
|
||||
resolution = False
|
||||
match = scrapertools.find_single_match(option, '([0-9]{2,4})(?:p|i|x[0-9]{2,4}|)')
|
||||
resolution = 0
|
||||
|
||||
if match:
|
||||
resolution = int(match[0]) * int(match[1])
|
||||
else:
|
||||
if '240p' in option:
|
||||
resolution = 320 * 240
|
||||
elif '360p' in option:
|
||||
resolution = 480 * 360
|
||||
elif ('480p' in option) or ('480i' in option):
|
||||
resolution = 720 * 480
|
||||
elif ('576p' in option) or ('576p' in option):
|
||||
resolution = 720 * 576
|
||||
elif ('720p' in option) or ('HD' in option):
|
||||
resolution = 1280 * 720
|
||||
elif ('1080p' in option) or ('1080i' in option) or ('Full HD' in option):
|
||||
resolution = 1920 * 1080
|
||||
resolution = int(match)
|
||||
elif 'sd' in option.lower():
|
||||
resolution = 480
|
||||
elif 'hd' in option.lower():
|
||||
resolution = 720
|
||||
if 'full' in option.lower():
|
||||
resolution = 1080
|
||||
elif '2k' in option.lower():
|
||||
resolution = 1440
|
||||
elif '4k' in option.lower():
|
||||
resolution = 2160
|
||||
elif 'auto' in option.lower():
|
||||
resolution = 10000
|
||||
|
||||
return resolution
|
||||
|
||||
|
||||
Reference in New Issue
Block a user