|
|
@ -1,36 +1,6 @@ |
|
|
|
#!/usr/bin/env python2 |
|
|
|
|
|
|
|
"""Youtubedlg module responsible for the options window. |
|
|
|
|
|
|
|
Attributes: |
|
|
|
AUDIO_QUALITY (list): Contains audio qualities. See AUDIO_QUALITY |
|
|
|
attribute of the parser module for available values. |
|
|
|
|
|
|
|
AUDIO_FORMATS (list): Contains audio formats. |
|
|
|
See optionsmanager.OptionsManager 'audio_format' option for available |
|
|
|
values. |
|
|
|
|
|
|
|
FORMATS (list): Contains video formats. This list contains all the |
|
|
|
available video formats without the 'default' and 'none' options. |
|
|
|
See VIDEO_FORMATS attribute of the parsers module for available |
|
|
|
values. |
|
|
|
|
|
|
|
SUBS_LANG (list): Contains subtitles languages. See SUBS_LANG attribute |
|
|
|
of the parsers module for available values. |
|
|
|
|
|
|
|
FILESIZES (list): Contains filesize units. See FILESIZE_UNITS attribute |
|
|
|
of the parsers module for available values. |
|
|
|
|
|
|
|
Note: |
|
|
|
For every item inside the attributes of this module (except AUDIO_FORMATS) |
|
|
|
there must be a valid key on the corresponding attribute of the parsers |
|
|
|
module. For example to add a new video format you need to specify the |
|
|
|
video format {'name': 'key'} on the parsers module (inside VIDEO_FORMATS |
|
|
|
attribute) and then add the 'name' of the video format on the FORMATS |
|
|
|
attribute of this module in order for the new video format to be visible |
|
|
|
on the GUI. |
|
|
|
|
|
|
|
""" |
|
|
|
"""Youtubedlg module responsible for the options window. """ |
|
|
|
|
|
|
|
import os |
|
|
|
|
|
|
@ -38,7 +8,6 @@ import wx |
|
|
|
|
|
|
|
from .version import __version__ |
|
|
|
|
|
|
|
|
|
|
|
from .info import ( |
|
|
|
__descriptionfull__, |
|
|
|
__licensefull__, |
|
|
@ -47,82 +16,6 @@ from .info import ( |
|
|
|
__author__ |
|
|
|
) |
|
|
|
|
|
|
|
AUDIO_QUALITY = ['high', 'mid', 'low'] |
|
|
|
|
|
|
|
AUDIO_FORMATS = [ |
|
|
|
"mp3", |
|
|
|
"wav", |
|
|
|
"aac", |
|
|
|
"m4a", |
|
|
|
"vorbis" |
|
|
|
] |
|
|
|
|
|
|
|
FORMATS = [ |
|
|
|
"3gp [176x144]", |
|
|
|
"3gp [320x240]", |
|
|
|
"flv [400x240]", |
|
|
|
"flv [640x360]", |
|
|
|
"flv [854x480]", |
|
|
|
"webm [640x360]", |
|
|
|
"webm [854x480]", |
|
|
|
"webm [1280x720]", |
|
|
|
"webm [1920x1080]", |
|
|
|
"mp4 [640x360]", |
|
|
|
"mp4 [1280x720]", |
|
|
|
"mp4 [1920x1080]", |
|
|
|
"mp4 [4096x3072]", |
|
|
|
"mp4 144p (DASH)", |
|
|
|
"mp4 240p (DASH)", |
|
|
|
"mp4 360p (DASH)", |
|
|
|
"mp4 480p (DASH)", |
|
|
|
"mp4 720p (DASH)", |
|
|
|
"mp4 1080p (DASH)", |
|
|
|
"mp4 1440p (DASH)", |
|
|
|
"mp4 2160p (DASH)", |
|
|
|
"webm 240p (DASH)", |
|
|
|
"webm 360p (DASH)", |
|
|
|
"webm 480p (DASH)", |
|
|
|
"webm 720p (DASH)", |
|
|
|
"webm 1080p (DASH)", |
|
|
|
"webm 1440p (DASH)", |
|
|
|
"webm 2160p (DASH)", |
|
|
|
"mp4 360p (3D)", |
|
|
|
"mp4 480p (3D)", |
|
|
|
"mp4 720p (3D)", |
|
|
|
"mp4 1080p (3D)", |
|
|
|
"webm 360p (3D)", |
|
|
|
"webm 480p (3D)", |
|
|
|
"webm 720p (3D)", |
|
|
|
"m4a 48k (DASH AUDIO)", |
|
|
|
"m4a 128k (DASH AUDIO)", |
|
|
|
"m4a 256k (DASH AUDIO)", |
|
|
|
"webm 48k (DASH AUDIO)", |
|
|
|
"webm 256k (DASH AUDIO)" |
|
|
|
] |
|
|
|
|
|
|
|
SUBS_LANG = [ |
|
|
|
"English", |
|
|
|
"Greek", |
|
|
|
"Portuguese", |
|
|
|
"French", |
|
|
|
"Italian", |
|
|
|
"Russian", |
|
|
|
"Spanish", |
|
|
|
"German" |
|
|
|
] |
|
|
|
|
|
|
|
FILESIZES = [ |
|
|
|
'Bytes', |
|
|
|
'Kilobytes', |
|
|
|
'Megabytes', |
|
|
|
'Gigabytes', |
|
|
|
'Terabytes', |
|
|
|
'Petabytes', |
|
|
|
'Exabytes', |
|
|
|
'Zettabytes', |
|
|
|
'Yottabytes' |
|
|
|
] |
|
|
|
|
|
|
|
|
|
|
|
class OptionsFrame(wx.Frame): |
|
|
|
|
|
|
@ -827,10 +720,25 @@ class AudioTab(TabPanel): |
|
|
|
"""Options frame audio tab. |
|
|
|
|
|
|
|
Attributes: |
|
|
|
AUDIO_QUALITY (list): Contains audio qualities. See AUDIO_QUALITY |
|
|
|
attribute of the parsers module for available values. |
|
|
|
|
|
|
|
AUDIO_FORMATS (list): Contains audio formats. |
|
|
|
See optionsmanager.OptionsManager 'audio_format' option for available |
|
|
|
values. |
|
|
|
|
|
|
|
*_LABEL (string): Constant string label for the widgets. |
|
|
|
|
|
|
|
""" |
|
|
|
|
|
|
|
AUDIO_QUALITY = ['high', 'mid', 'low'] |
|
|
|
AUDIO_FORMATS = [ |
|
|
|
"mp3", |
|
|
|
"wav", |
|
|
|
"aac", |
|
|
|
"m4a", |
|
|
|
"vorbis" |
|
|
|
] |
|
|
|
|
|
|
|
TO_AUDIO_LABEL = "Convert to Audio" |
|
|
|
KEEP_VIDEO_LABEL = "Keep Video" |
|
|
|
AUDIO_FORMAT_LABEL = "Audio Format" |
|
|
@ -841,8 +749,8 @@ class AudioTab(TabPanel): |
|
|
|
|
|
|
|
self.to_audio_checkbox = self.create_checkbox(self.TO_AUDIO_LABEL, self._on_audio_check) |
|
|
|
self.keep_video_checkbox = self.create_checkbox(self.KEEP_VIDEO_LABEL) |
|
|
|
self.audioformat_combo = self.create_combobox(AUDIO_FORMATS, (160, 30)) |
|
|
|
self.audioquality_combo = self.create_combobox(AUDIO_QUALITY, (80, 25)) |
|
|
|
self.audioformat_combo = self.create_combobox(self.AUDIO_FORMATS, (160, 30)) |
|
|
|
self.audioquality_combo = self.create_combobox(self.AUDIO_QUALITY, (80, 25)) |
|
|
|
|
|
|
|
self.audioformat_text = self.create_statictext(self.AUDIO_FORMAT_LABEL) |
|
|
|
self.audioquality_text = self.create_statictext(self.AUDIO_QUALITY_LABEL) |
|
|
@ -891,6 +799,11 @@ class VideoTab(TabPanel): |
|
|
|
"""Options frame video tab. |
|
|
|
|
|
|
|
Attributes: |
|
|
|
FORMATS (list): Contains video formats. This list contains all the |
|
|
|
available video formats without the 'default' and 'none' options. |
|
|
|
See VIDEO_FORMATS attribute of the parsers module for available |
|
|
|
values. |
|
|
|
|
|
|
|
VIDEO_FORMATS (list): List that contains all the video formats |
|
|
|
plus the 'default' one. |
|
|
|
|
|
|
@ -904,6 +817,49 @@ class VideoTab(TabPanel): |
|
|
|
|
|
|
|
""" |
|
|
|
|
|
|
|
FORMATS = [ |
|
|
|
"3gp [176x144]", |
|
|
|
"3gp [320x240]", |
|
|
|
"flv [400x240]", |
|
|
|
"flv [640x360]", |
|
|
|
"flv [854x480]", |
|
|
|
"webm [640x360]", |
|
|
|
"webm [854x480]", |
|
|
|
"webm [1280x720]", |
|
|
|
"webm [1920x1080]", |
|
|
|
"mp4 [640x360]", |
|
|
|
"mp4 [1280x720]", |
|
|
|
"mp4 [1920x1080]", |
|
|
|
"mp4 [4096x3072]", |
|
|
|
"mp4 144p (DASH)", |
|
|
|
"mp4 240p (DASH)", |
|
|
|
"mp4 360p (DASH)", |
|
|
|
"mp4 480p (DASH)", |
|
|
|
"mp4 720p (DASH)", |
|
|
|
"mp4 1080p (DASH)", |
|
|
|
"mp4 1440p (DASH)", |
|
|
|
"mp4 2160p (DASH)", |
|
|
|
"webm 240p (DASH)", |
|
|
|
"webm 360p (DASH)", |
|
|
|
"webm 480p (DASH)", |
|
|
|
"webm 720p (DASH)", |
|
|
|
"webm 1080p (DASH)", |
|
|
|
"webm 1440p (DASH)", |
|
|
|
"webm 2160p (DASH)", |
|
|
|
"mp4 360p (3D)", |
|
|
|
"mp4 480p (3D)", |
|
|
|
"mp4 720p (3D)", |
|
|
|
"mp4 1080p (3D)", |
|
|
|
"webm 360p (3D)", |
|
|
|
"webm 480p (3D)", |
|
|
|
"webm 720p (3D)", |
|
|
|
"m4a 48k (DASH AUDIO)", |
|
|
|
"m4a 128k (DASH AUDIO)", |
|
|
|
"m4a 256k (DASH AUDIO)", |
|
|
|
"webm 48k (DASH AUDIO)", |
|
|
|
"webm 256k (DASH AUDIO)" |
|
|
|
] |
|
|
|
|
|
|
|
VIDEO_FORMATS = ["default"] + FORMATS |
|
|
|
SECOND_VIDEO_FORMATS = ["none"] + FORMATS |
|
|
|
|
|
|
@ -1048,10 +1004,25 @@ class FilesystemTab(TabPanel): |
|
|
|
"""Options frame filesystem tab. |
|
|
|
|
|
|
|
Attributes: |
|
|
|
FILESIZES (list): Contains filesize units. See FILESIZE_UNITS attribute |
|
|
|
of the parsers module for available values. |
|
|
|
|
|
|
|
*_LABEL (string): Constant string label for the widgets. |
|
|
|
|
|
|
|
""" |
|
|
|
|
|
|
|
FILESIZES = [ |
|
|
|
'Bytes', |
|
|
|
'Kilobytes', |
|
|
|
'Megabytes', |
|
|
|
'Gigabytes', |
|
|
|
'Terabytes', |
|
|
|
'Petabytes', |
|
|
|
'Exabytes', |
|
|
|
'Zettabytes', |
|
|
|
'Yottabytes' |
|
|
|
] |
|
|
|
|
|
|
|
IGN_ERR_LABEL = "Ignore Errors" |
|
|
|
OPEN_DIR_LABEL = "Open destination folder" |
|
|
|
WRT_INFO_LABEL = "Write info to (.json) file" |
|
|
@ -1072,8 +1043,8 @@ class FilesystemTab(TabPanel): |
|
|
|
|
|
|
|
self.min_filesize_spinner = self.create_spinctrl((0, 1024)) |
|
|
|
self.max_filesize_spinner = self.create_spinctrl((0, 1024)) |
|
|
|
self.min_filesize_combo = self.create_combobox(FILESIZES) |
|
|
|
self.max_filesize_combo = self.create_combobox(FILESIZES) |
|
|
|
self.min_filesize_combo = self.create_combobox(self.FILESIZES) |
|
|
|
self.max_filesize_combo = self.create_combobox(self.FILESIZES) |
|
|
|
self.min_text = self.create_statictext(self.MIN_LABEL) |
|
|
|
self.max_text = self.create_statictext(self.MAX_LABEL) |
|
|
|
|
|
|
@ -1166,9 +1137,22 @@ class SubtitlesTab(TabPanel): |
|
|
|
"""Options frame subtitles tab. |
|
|
|
|
|
|
|
Attributes: |
|
|
|
SUBS_LANG (list): Contains subtitles languages. See SUBS_LANG attribute |
|
|
|
of the parsers module for available values. |
|
|
|
|
|
|
|
*_LABEL (string): Constant string label for the widgets. |
|
|
|
|
|
|
|
""" |
|
|
|
SUBS_LANG = [ |
|
|
|
"English", |
|
|
|
"Greek", |
|
|
|
"Portuguese", |
|
|
|
"French", |
|
|
|
"Italian", |
|
|
|
"Russian", |
|
|
|
"Spanish", |
|
|
|
"German" |
|
|
|
] |
|
|
|
|
|
|
|
DL_SUBS_LABEL = "Download subtitle file by language" |
|
|
|
DL_ALL_SUBS_LABEL = "Download all available subtitles" |
|
|
@ -1183,7 +1167,7 @@ class SubtitlesTab(TabPanel): |
|
|
|
self.write_all_subs_checkbox = self.create_checkbox(self.DL_ALL_SUBS_LABEL, self._on_subs_pick) |
|
|
|
self.write_auto_subs_checkbox = self.create_checkbox(self.DL_AUTO_SUBS_LABEL, self._on_subs_pick) |
|
|
|
self.embed_subs_checkbox = self.create_checkbox(self.EMBED_SUBS_LABEL) |
|
|
|
self.subs_lang_combo = self.create_combobox(SUBS_LANG, (140, 30)) |
|
|
|
self.subs_lang_combo = self.create_combobox(self.SUBS_LANG, (140, 30)) |
|
|
|
|
|
|
|
self.subs_lang_text = self.create_statictext(self.SUBS_LANG_LABEL) |
|
|
|
|
|
|
|