Skip to content

Commit

Permalink
youtube-dl make log
Browse files Browse the repository at this point in the history
  • Loading branch information
gianluca authored and gianluca committed May 2, 2020
1 parent 6fb0c8a commit 29eae7d
Show file tree
Hide file tree
Showing 14 changed files with 45 additions and 16 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ BUGS:
that YouTube.

IMPROVEMENTS:
* [YOUTUBE DOWNLOADER] now write file log.
* warning message in the status bar when the list of incoming files has
changed.
* Improve Home panel buttons `choose_topic.py`
Expand Down
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
include launcher README.md AUTHORS BUGS CHANGELOG INSTALL COPYING TODO
include tests/*
recursive-include utilities *
recursive-include videomass3 *
recursive-include docs *
recursive-include art *
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

## Requirements

- Python3 >= 3.6.9
- Python3 >= 3.7.0
- wxPython4 (phoenix)
- PyPubSub (https://pypi.org/project/PyPubSub/)
- ffmpeg >= 4.1.4
Expand Down
Binary file removed docs/AESTD1004_1_15_10.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion share/videomass.conf
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
# in the "/vdms_SYS/ctrl_run.py" file on the "check videomass.conf and
# configuration folder" section. This will automatically restore the current
# version of the configuration file in the user conf. directory
1.8
1.9

# set default directory to file save:
none
Expand Down
2 changes: 1 addition & 1 deletion share/videomassWin32.conf
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
# in the "/vdms_SYS/ctrl_run.py" file on the "check videomass.conf and
# configuration folder" section. This will automatically restore the current
# version of the configuration file in the user conf. directory
1.8
1.9

# set default directory to file save:
none
Expand Down
2 changes: 1 addition & 1 deletion utilities/make application bundles/pyinstaller/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Compile with pyinstaller:

NOTE: when you use installerpy.py script will generate a Videomass.spec which
you can handle by edit the statements of the class instance to leading
any aspect on next bundled application, e.g `excludes=['youtube-dl']`
any aspect on next bundled application, e.g `excludes=['youtube_dl']`
in Analysis to excludes that python package from bundle.

see https://pyinstaller.readthedocs.io/en/stable/spec-files.html
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "Videomass"
#define MyAppVersion "2.0.5 (64-bit)"
#define MyAppVersion "2.1.0 (64-bit)"
#define MyAppPublisher "Gianluca Pernigotto"
#define MyAppURL "http://jeanslack.github.io/Videomass/"
#define MyAppExeName "Videomass.exe"
Expand All @@ -28,7 +28,7 @@ LicenseFile=C:\Users\gianluca\Documents\Videomass\DOC\COPYING
InfoBeforeFile=C:\Users\gianluca\Documents\Videomass\DOC\NOTICE.rtf
InfoAfterFile=C:\Users\gianluca\Documents\Videomass\DOC\AUTHORS
OutputDir=C:\Users\gianluca\Documents
OutputBaseFilename=Videomass-v2.0.5-py3-x64-Setup
OutputBaseFilename=Videomass-v2.1.0-py3-x64-Setup
SetupIconFile=C:\Users\gianluca\Documents\Videomass\art\videomass.ico
Password=
Compression=lzma
Expand Down
5 changes: 4 additions & 1 deletion videomass3/vdms_dialogs/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,10 @@ def onAppearanceDefault(self, event):
Restore to default settings colors and icons set
"""
self.full_list[self.rowsNum[11]] = "Material_Design_Icons_black\n"
self.full_list[self.rowsNum[12]] = '228, 21, 68\n'
if OS == 'Windows':
self.full_list[self.rowsNum[12]] = '40, 148, 255, 255\n'
else:
self.full_list[self.rowsNum[12]] = '228, 21, 68\n'
self.full_list[self.rowsNum[13]] = '176, 176, 176, 255\n'
self.full_list[self.rowsNum[14]] = '0, 0, 0\n'
# ----------------------------------------------------------------------#
Expand Down
7 changes: 7 additions & 0 deletions videomass3/vdms_panels/long_processing_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,9 @@ def youtubedl_from_import(self, output, duration, status):
self.OutText.AppendText('%s\n' % output)
self.OutText.SetDefaultStyle(wx.TextAttr(wx.NullColour))

with open(os.path.join(LOGDIR, self.logname), "a") as logerr:
logerr.write("[YOUTUBE_DL]: %s > %s\n" % (status,
output))
elif status == 'DOWNLOAD':
self.labPerc.SetLabel("%s" % duration[0])
self.barProg.SetValue(duration[1])
Expand All @@ -234,6 +237,10 @@ def youtubedl_from_import(self, output, duration, status):
self.OutText.SetDefaultStyle(wx.TextAttr(wx.Colour(YELLOW)))
self.OutText.AppendText('%s\n' % duration)
self.OutText.SetDefaultStyle(wx.TextAttr(wx.NullColour))

if status in ['ERROR', 'WARNING']:
with open(os.path.join(LOGDIR, self.logname), "a") as logerr:
logerr.write("[YOUTUBE_DL]: %s\n" % (output))
# ---------------------------------------------------------------------#

def youtubedl_exec(self, output, duration, status):
Expand Down
6 changes: 3 additions & 3 deletions videomass3/vdms_panels/youtubedl_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ def on_Start(self):
with subprocess. This depends on some cases.
"""
urls = self.parent.data_url
logname = 'Youtube_downloader.log'
logname = 'Youtube_LIB_downloader.log'

def _getformatcode():
"""return format code"""
Expand Down Expand Up @@ -621,7 +621,7 @@ def _getformatcode():
None,
'',
'',
logname,
'Youtube_LIB_downloader.log',
len(urls),
)
else: # ----------- with youtube-dl command line execution
Expand Down Expand Up @@ -674,6 +674,6 @@ def _getformatcode():
None,
'',
'',
logname,
'Youtube_EXEC_downloader.log',
len(urls),
)
4 changes: 2 additions & 2 deletions videomass3/vdms_sys/ctrl_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
FILEconf = os.path.join(USERName + bpath)
DIRconf = os.path.join(USERName + "\\AppData\\Roaming\\videomass")
LOGdir = os.path.join(DIRconf, 'log') # logs
CACHEdir = DIRconf # updates
CACHEdir = os.path.join(DIRconf, 'cache') # updates executable

elif OS == "Darwin":
bpath = "Library/Application Support/videomass/videomass.conf"
Expand Down Expand Up @@ -131,7 +131,7 @@ def system_check():
if not DATAconf:
print("The file configuration is damaged! try to restore..")
existfileconf = False
if float(DATAconf[0]) != 1.8:
if float(DATAconf[0]) != 1.9:
existfileconf = False
else:
existfileconf = False
Expand Down
8 changes: 4 additions & 4 deletions videomass3/vdms_threads/ydl_executable.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def logWrite(cmd, sterr, logname):
class Ydl_DL_Exec(Thread):
"""
Ydl_DL_Exec represents a separate thread for running
youtube-dl executable from subprocess class and capturing its
youtube-dl executable with subprocess class and capturing its
stdout/stderr output in real time .
"""
def __init__(self, varargs, logname):
Expand Down Expand Up @@ -203,9 +203,9 @@ def stop(self):

class Ydl_EI_Exec(Thread):
"""
Ydl_EI_Exec it is a separate thread to run
youtube-dl executable from subprocess class and getting
its stdout/stderr output at the end of the process .
Ydl_EI_Exec it is a separate thread to run youtube-dl executable
with subprocess class to get -at the end of the process- 'Format
code' data and exit status from stdout/stderr output .
"""
def __init__(self, url):
"""
Expand Down
17 changes: 17 additions & 0 deletions videomass3/vdms_threads/ydl_pylibdownloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

#########################################################
import wx
import os
from threading import Thread
import time
from pubsub import pub
Expand All @@ -41,6 +42,20 @@
import youtube_dl


def logWrite(cmd, sterr, logname):
"""
writes youtube-dl commands and status error during
threads below
"""
if sterr:
apnd = "...%s\n\n" % (sterr)
else:
apnd = "%s\n\n" % (cmd)

with open(os.path.join(LOGDIR, logname), "a") as log:
log.write(apnd)


class MyLogger(object):
"""
Intercepts youtube-dl's output by setting a logger object;
Expand Down Expand Up @@ -186,6 +201,8 @@ def run(self):
'progress_hooks': [my_hook],
}

logWrite(ydl_opts, '', self.logname) # write n/n + command only

with youtube_dl.YoutubeDL(ydl_opts) as ydl:
ydl.download(["{}".format(url)])

Expand Down

0 comments on commit 29eae7d

Please sign in to comment.