Browse Source

Fix filename extraction

doc-issue-template
MrS0m30n3 9 years ago
parent
commit
9059338a1d
2 changed files with 8 additions and 8 deletions
  1. 2
      youtube_dl_gui/downloaders.py
  2. 14
      youtube_dl_gui/optionsmanager.py

2
youtube_dl_gui/downloaders.py

@ -292,7 +292,7 @@ def extract_data(stdout):
# Get filename # Get filename
if stdout[1] == 'Destination:': if stdout[1] == 'Destination:':
data_dictionary['filename'] = ' '.join(stdout[1:])
data_dictionary['filename'] = ' '.join(stdout[2:])
# Get progress info # Get progress info
if '%' in stdout[1]: if '%' in stdout[1]:

14
youtube_dl_gui/optionsmanager.py

@ -175,10 +175,10 @@ class OptionsManager(object):
the LogManager. See main() function under __init__(). the LogManager. See main() function under __init__().
log_time (boolean): See logmanager.LogManager add_time attribute. log_time (boolean): See logmanager.LogManager add_time attribute.
workers_number (int): Number of download workers that download manager workers_number (int): Number of download workers that download manager
will spawn. Must be greater than zero. will spawn. Must be greater than zero.
locale_name (string): Locale name (e.g. ru_RU). locale_name (string): Locale name (e.g. ru_RU).
""" """
@ -235,7 +235,7 @@ class OptionsManager(object):
with open(self.settings_file, 'rb') as settings_file: with open(self.settings_file, 'rb') as settings_file:
try: try:
options = json.load(settings_file) options = json.load(settings_file)
if self._settings_are_valid(options): if self._settings_are_valid(options):
self.options = options self.options = options
except: except:
@ -277,11 +277,11 @@ class OptionsManager(object):
VALID_FILESIZE_UNIT = ('', 'k', 'm', 'g', 't', 'p', 'e', 'z', 'y') VALID_FILESIZE_UNIT = ('', 'k', 'm', 'g', 't', 'p', 'e', 'z', 'y')
VALID_SUB_LANGUAGE = ('en', 'gr', 'pt', 'fr', 'it', 'ru', 'es', 'de') VALID_SUB_LANGUAGE = ('en', 'gr', 'pt', 'fr', 'it', 'ru', 'es', 'de')
for key in self.options: for key in self.options:
if key not in settings_dictionary: if key not in settings_dictionary:
return False return False
# Check if each key has a valid value # Check if each key has a valid value
rules_dict = { rules_dict = {
'video_format': VALID_VIDEO_FORMAT, 'video_format': VALID_VIDEO_FORMAT,
@ -297,9 +297,9 @@ class OptionsManager(object):
for key, valid_list in rules_dict.items(): for key, valid_list in rules_dict.items():
if settings_dictionary[key] not in valid_list: if settings_dictionary[key] not in valid_list:
return False return False
settings_dictionary['workers_number'] = int(settings_dictionary['workers_number']) settings_dictionary['workers_number'] = int(settings_dictionary['workers_number'])
if settings_dictionary['workers_number'] < 1: if settings_dictionary['workers_number'] < 1:
return False return False

Loading…
Cancel
Save