Browse Source

Move video formats from data/formats -> formats.py

doc-issue-template
MrS0m30n3 8 years ago
parent
commit
ba9eb9f951
3 changed files with 49 additions and 47 deletions
  1. 41
      youtube_dl_gui/data/formats
  2. 44
      youtube_dl_gui/formats.py
  3. 11
      youtube_dl_gui/mainframe.py

41
youtube_dl_gui/data/formats

@ -1,41 +0,0 @@
0 - default
17 - 3gp [176x144]
36 - 3gp [320x240]
5 - flv [400x240]
34 - flv [640x360]
35 - flv [854x480]
43 - webm [640x360]
44 - webm [854x480]
45 - webm [1280x720]
46 - webm [1920x1080]
18 - mp4 [640x360]
22 - mp4 [1280x720]
37 - mp4 [1920x1080]
38 - mp4 [4096x3072]
160 - mp4 144p (DASH)
133 - mp4 240p (DASH)
134 - mp4 360p (DASH)
135 - mp4 480p (DASH)
136 - mp4 720p (DASH)
137 - mp4 1080p (DASH)
264 - mp4 1440p (DASH)
138 - mp4 2160p (DASH)
242 - webm 240p (DASH)
243 - webm 360p (DASH)
244 - webm 480p (DASH)
247 - webm 720p (DASH)
248 - webm 1080p (DASH)
271 - webm 1440p (DASH)
272 - webm 2160p (DASH)
82 - mp4 360p (3D)
83 - mp4 480p (3D)
84 - mp4 720p (3D)
85 - mp4 1080p (3D)
100 - webm 360p (3D)
101 - webm 480p (3D)
102 - webm 720p (3D)
139 - m4a 48k (DASH AUDIO)
140 - m4a 128k (DASH AUDIO)
141 - m4a 256k (DASH AUDIO)
171 - webm 48k (DASH AUDIO)
172 - webm 256k (DASH AUDIO)

44
youtube_dl_gui/formats.py

@ -9,3 +9,47 @@ OUTPUT_FORMATS = tdict([
(2, "Title + ID"),
(3, "Custom")
])
VIDEO_FORMATS = tdict([
("0", "default"),
("17", "3gp [176x144]"),
("36", "3gp [320x240]"),
("5,", "flv [400x240]"),
("34,", "flv [640x360]"),
("35,", "flv [854x480]"),
("43,", "webm [640x360]"),
("44,", "webm [854x480]"),
("45,", "webm [1280x720]"),
("46,", "webm [1920x1080]"),
("18,", "mp4 [640x360]"),
("22,", "mp4 [1280x720]"),
("37,", "mp4 [1920x1080]"),
("38,", "mp4 [4096x3072]"),
("160,", "mp4 144p (DASH)"),
("133,", "mp4 240p (DASH)"),
("134,", "mp4 360p (DASH)"),
("135,", "mp4 480p (DASH)"),
("136,", "mp4 720p (DASH)"),
("137,", "mp4 1080p (DASH)"),
("264,", "mp4 1440p (DASH)"),
("138,", "mp4 2160p (DASH)"),
("242,", "webm 240p (DASH)"),
("243,", "webm 360p (DASH)"),
("244,", "webm 480p (DASH)"),
("247,", "webm 720p (DASH)"),
("248,", "webm 1080p (DASH)"),
("271,", "webm 1440p (DASH)"),
("272,", "webm 2160p (DASH)"),
("82,", "mp4 360p (3D)"),
("83,", "mp4 480p (3D)"),
("84,", "mp4 720p (3D)"),
("85,", "mp4 1080p (3D)"),
("100,", "webm 360p (3D)"),
("101,", "webm 480p (3D)"),
("102,", "webm 720p (3D)"),
("139,", "m4a 48k (DASH AUDIO)"),
("140,", "m4a 128k (DASH AUDIO)"),
("141,", "m4a 256k (DASH AUDIO)"),
("171,", "webm 48k (DASH AUDIO)"),
("172,", "webm 256k (DASH AUDIO)")
])

11
youtube_dl_gui/mainframe.py

@ -49,6 +49,8 @@ from .utils import (
get_time
)
from .formats import VIDEO_FORMATS
from .info import (
__descriptionfull__,
__licensefull__,
@ -188,9 +190,6 @@ class MainFrame(wx.Frame):
# Get the pixmaps directory
self._pixmaps_path = get_pixmaps_dir()
# Get video formats
self._video_formats = read_formats()
# Set the Timer
self._app_timer = wx.Timer(self)
@ -263,7 +262,7 @@ class MainFrame(wx.Frame):
self._folder_icon = self._create_static_bitmap(self._bitmaps["folder"])
self._path_combobox = ExtComboBox(self._panel, 5, style=wx.CB_READONLY)
self._videoformat_combobox = ExtComboBox(self._panel, choices=self._video_formats.values(), style=wx.CB_READONLY)
self._videoformat_combobox = ExtComboBox(self._panel, choices=VIDEO_FORMATS.values(), style=wx.CB_READONLY)
self._download_text = self._create_statictext(self.DOWNLOAD_LIST_LABEL)
self._status_list = ListCtrl(self.STATUSLIST_COLUMNS,
@ -315,7 +314,7 @@ class MainFrame(wx.Frame):
self._set_buttons_width()
self._status_bar_write(self.WELCOME_MSG)
self._videoformat_combobox.SetValue(self._video_formats[self.opt_manager.options["video_format"]])
self._videoformat_combobox.SetValue(VIDEO_FORMATS[self.opt_manager.options["video_format"]])
self._path_combobox.LoadMultiple(self.opt_manager.options["save_path_dirs"])
self._path_combobox.SetValue(self.opt_manager.options["save_path"])
@ -429,7 +428,7 @@ class MainFrame(wx.Frame):
self._buttons["pause"].SetBitmap(self._bitmaps["pause"], wx.TOP)
def _update_videoformat(self, event):
self.opt_manager.options["video_format"] = self._video_formats[self._videoformat_combobox.GetValue()]
self.opt_manager.options["video_format"] = VIDEO_FORMATS[self._videoformat_combobox.GetValue()]
def _update_savepath(self, event):
self.opt_manager.options["save_path"] = self._path_combobox.GetValue()

Loading…
Cancel
Save