Browse Source

Remove update tab

Keep youtube-dl under package dir
doc-issue-template
MrS0m30n3 11 years ago
parent
commit
0f632128ac
4 changed files with 7 additions and 76 deletions
  1. 16
      youtube_dl_gui/OptionsHandler.py
  2. 11
      youtube_dl_gui/UpdateThread.py
  3. 56
      youtube_dl_gui/YoutubeDLGUI.py
  4. BIN
      youtube_dl_gui/youtube-dl

16
youtube_dl_gui/OptionsHandler.py

@ -6,7 +6,8 @@ from .Utils import (
file_exist,
get_os_type,
fix_path,
makedir
makedir,
abs_path
)
SETTINGS_FILENAME = 'settings'
@ -62,8 +63,7 @@ class OptionsHandler():
self.username = ""
self.password = ""
self.videoPass = ""
self.updatePath = self.get_config_path()
self.autoUpdate = False
self.updatePath = abs_path(__file__)
self.cmdArgs = ""
self.enableLog = True
self.writeTimeToLog = True
@ -136,11 +136,9 @@ class OptionsHandler():
self.referer = opts[27]
self.proxy = opts[28]
self.username = opts[29]
self.updatePath = opts[30].decode('utf8')
self.autoUpdate = opts[31] in ['True']
self.cmdArgs = opts[32]
self.enableLog = opts[33] in ['True']
self.writeTimeToLog = opts[34] in ['True']
self.cmdArgs = opts[30]
self.enableLog = opts[31] in ['True']
self.writeTimeToLog = opts[32] in ['True']
except:
self.statusBarWrite('Error while loading settings file. Loading default settings.')
self.load_default()
@ -184,8 +182,6 @@ class OptionsHandler():
f.write('Proxy='+str(self.proxy)+'\n')
f.write('Username='+str(self.username)+'\n')
# We dont store password & videoPass for security reasons
f.write('UpdatePath='+self.updatePath.encode('utf-8')+'\n')
f.write('AutoUpdate='+str(self.autoUpdate)+'\n')
f.write('CmdArgs='+str(self.cmdArgs)+'\n')
f.write('EnableLog='+str(self.enableLog)+'\n')
f.write('WriteTimeToLog='+str(self.writeTimeToLog)+'\n')

11
youtube_dl_gui/UpdateThread.py

@ -7,11 +7,7 @@ from wx.lib.pubsub import pub as Publisher
from threading import Thread
from urllib2 import urlopen, URLError, HTTPError
from .Utils import (
fix_path,
file_exist,
makedir
)
from .Utils import fix_path
LATEST_YOUTUBE_DL = 'https://yt-dl.org/latest/'
PUBLISHER_TOPIC = 'update'
@ -24,7 +20,6 @@ class UpdateThread(Thread):
self.youtubeDLFile = youtubeDLFile
self.updatePath = fix_path(updatePath)
self.url = LATEST_YOUTUBE_DL + youtubeDLFile
self.check_path()
self.start()
def run(self):
@ -38,7 +33,3 @@ class UpdateThread(Thread):
msg = 'Youtube-dl download failed ' + str(e)
CallAfter(Publisher.sendMessage, PUBLISHER_TOPIC, msg)
CallAfter(Publisher.sendMessage, PUBLISHER_TOPIC, 'finish')
def check_path(self):
if not file_exist(self.updatePath):
makedir(self.updatePath)

56
youtube_dl_gui/YoutubeDLGUI.py

@ -110,9 +110,6 @@ class MainFrame(wx.Frame):
# check & update libraries (youtube-dl)
self.check_if_youtube_dl_exist()
if (self.optionsList.autoUpdate):
self.status_bar_write("Auto update enable")
self.update_youtube_dl()
def InitGUI(self):
self.panel = wx.Panel(self)
@ -426,45 +423,6 @@ class LogPanel(wx.Panel):
def restart_popup(self):
wx.MessageBox('Please restart ' + __appname__, 'Restart', wx.OK | wx.ICON_INFORMATION)
class UpdatePanel(wx.Panel):
def __init__(self, parent, optList):
wx.Panel.__init__(self, parent)
self.optList = optList
mainBoxSizer = wx.BoxSizer(wx.VERTICAL)
text = '''Enter the path where youtube-dlG should
download the latest youtube-dl.'''
helpText = wx.BoxSizer(wx.HORIZONTAL)
helpText.Add(wx.StaticText(self, label=text), flag = wx.TOP, border=10)
mainBoxSizer.Add(helpText, flag = wx.LEFT, border=80)
pathText = wx.BoxSizer(wx.HORIZONTAL)
pathText.Add(wx.StaticText(self, label='Path'), flag = wx.TOP, border=20)
mainBoxSizer.Add(pathText, flag = wx.LEFT, border=95)
upPathBox = wx.BoxSizer(wx.HORIZONTAL)
self.updatePathBox = wx.TextCtrl(self)
upPathBox.Add(self.updatePathBox, 1, flag = wx.TOP, border=5)
mainBoxSizer.Add(upPathBox, flag = wx.EXPAND | wx.LEFT | wx.RIGHT, border=90)
autoUpBox = wx.BoxSizer(wx.HORIZONTAL)
self.autoUpdateChk = wx.CheckBox(self, label='Auto Update youtube-dl')
autoUpBox.Add(self.autoUpdateChk, flag = wx.TOP, border=30)
mainBoxSizer.Add(autoUpBox, flag = wx.LEFT, border=100)
self.SetSizer(mainBoxSizer)
def load_options(self):
self.updatePathBox.SetValue(self.optList.updatePath)
self.autoUpdateChk.SetValue(self.optList.autoUpdate)
def save_options(self):
self.optList.updatePath = fix_path(self.updatePathBox.GetValue())
self.optList.autoUpdate = self.autoUpdateChk.GetValue()
class PlaylistPanel(wx.Panel):
def __init__(self, parent, optList):
@ -1172,7 +1130,6 @@ class OptionsFrame(wx.Frame):
self.filesysTab = FilesystemPanel(notebook, self.optionsList)
self.subtitlesTab = SubtitlesPanel(notebook, self.optionsList)
self.otherTab = OtherPanel(notebook, self.optionsList)
self.updateTab = UpdatePanel(notebook, self.optionsList)
self.authTab = AuthenticationPanel(notebook, self.optionsList)
self.videoselTab = PlaylistPanel(notebook, self.optionsList)
self.logTab = LogPanel(notebook, self.optionsList, logger)
@ -1187,7 +1144,6 @@ class OptionsFrame(wx.Frame):
notebook.AddPage(self.filesysTab, "Filesystem")
notebook.AddPage(self.connectionTab, "Connection")
notebook.AddPage(self.authTab, "Authentication")
notebook.AddPage(self.updateTab, "Update")
notebook.AddPage(self.logTab, "Log")
notebook.AddPage(self.otherTab, "Commands")
@ -1207,18 +1163,8 @@ class OptionsFrame(wx.Frame):
def OnClose(self, event):
self.save_all_options()
if not file_exist(fix_path(self.optionsList.updatePath)+YOUTUBE_DL_FILENAME):
self.wrong_youtubedl_path()
self.Destroy()
def wrong_youtubedl_path(self):
text = '''The path under Options>Update is invalid
please do one of the following:
*) restart program
*) click the update button
*) change the path to point where youtube-dl is'''
wx.MessageBox(text, 'Error', wx.OK | wx.ICON_EXCLAMATION)
def reset(self):
self.optionsList.load_default()
self.load_all_options()
@ -1231,7 +1177,6 @@ class OptionsFrame(wx.Frame):
self.filesysTab.load_options()
self.subtitlesTab.load_options()
self.otherTab.load_options()
self.updateTab.load_options()
self.authTab.load_options()
self.videoselTab.load_options()
self.logTab.load_options()
@ -1245,7 +1190,6 @@ class OptionsFrame(wx.Frame):
self.filesysTab.save_options()
self.subtitlesTab.save_options()
self.otherTab.save_options()
self.updateTab.save_options()
self.authTab.save_options()
self.videoselTab.save_options()
self.logTab.save_options()

BIN
youtube_dl_gui/youtube-dl

Loading…
Cancel
Save