Browse Source

Add 'get command' option to context menu

doc-issue-template
MrS0m30n3 8 years ago
parent
commit
aea606695a
2 changed files with 19 additions and 1 deletions
  1. 1
      TODO
  2. 19
      youtube_dl_gui/mainframe.py

1
TODO

@ -5,7 +5,6 @@ NEW_LAYOUT
* Create new button with two stages (like toggle) * Create new button with two stages (like toggle)
* Add more statistics (Average download speed, etc) * Add more statistics (Average download speed, etc)
* Adjust layout see #131 * Adjust layout see #131
* GUI command line builder like zenmap
* Swap some of the Error messages with Info * Swap some of the Error messages with Info
* Add clear list button ? * Add clear list button ?
* Icons theme selection (vote on github) * Icons theme selection (vote on github)

19
youtube_dl_gui/mainframe.py

@ -35,6 +35,7 @@ from .downloadmanager import (
) )
from .utils import ( from .utils import (
YOUTUBEDL_BIN,
get_pixmaps_dir, get_pixmaps_dir,
get_config_path, get_config_path,
get_icon_file, get_icon_file,
@ -227,6 +228,7 @@ class MainFrame(wx.Frame):
statuslist_menu_data = ( statuslist_menu_data = (
(_("Get url"), self._on_geturl), (_("Get url"), self._on_geturl),
(_("Get command"), self._on_getcmd)
) )
# Create options frame # Create options frame
@ -337,6 +339,23 @@ class MainFrame(wx.Frame):
wx.TheClipboard.SetData(clipdata) wx.TheClipboard.SetData(clipdata)
wx.TheClipboard.Close() wx.TheClipboard.Close()
def _on_getcmd(self, event):
selected = self._status_list.get_selected()
if selected != -1:
object_id = self._status_list.GetItemData(selected)
download_item = self._download_list.get_item(object_id)
cmd = [YOUTUBEDL_BIN] + download_item.options + [download_item.url]
cmd = " ".join(cmd)
if not wx.TheClipboard.IsOpened():
clipdata = wx.TextDataObject()
clipdata.SetText(cmd)
wx.TheClipboard.Open()
wx.TheClipboard.SetData(clipdata)
wx.TheClipboard.Close()
def _on_timer(self, event): def _on_timer(self, event):
msg = self.URL_REPORT_MSG.format(self.download_manager.active()) msg = self.URL_REPORT_MSG.format(self.download_manager.active())
self._status_bar_write(msg) self._status_bar_write(msg)

Loading…
Cancel
Save