mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-07-05 20:51:11 -07:00
Transcode patch 1 (#1627)
* Add Piping of stderr to capture transcoding failures. #1619 * Allow passing absolute nice command. #1619 * Change .cfg description for niceness * Fix errors due to VM packages out of date (ffmpeg) * Fix Sqlite import error on tests * Fix Azure issues https://developercommunity.visualstudio.com/content/problem/598264/known-issue-azure-pipelines-images-missing-sqlite3.html
This commit is contained in:
parent
ce50a1c27d
commit
9f6c068cde
14 changed files with 93 additions and 30 deletions
|
@ -36,7 +36,9 @@
|
||||||
[Posix]
|
[Posix]
|
||||||
### Process priority setting for External commands (Extractor and Transcoder) on Posix (Unix/Linux/OSX) systems.
|
### Process priority setting for External commands (Extractor and Transcoder) on Posix (Unix/Linux/OSX) systems.
|
||||||
# Set the Niceness value for the nice command. These range from -20 (most favorable to the process) to 19 (least favorable to the process).
|
# Set the Niceness value for the nice command. These range from -20 (most favorable to the process) to 19 (least favorable to the process).
|
||||||
niceness = 0
|
# If entering an integer e.g 'niceness = 4', this is added to the nice command and passed as 'nice -n4' (Default).
|
||||||
|
# If entering a comma separated list e.g. 'niceness = nice,4' this will be passed as 'nice 4' (Safer).
|
||||||
|
niceness = nice,-n0
|
||||||
# Set the ionice scheduling class. 0 for none, 1 for real time, 2 for best-effort, 3 for idle.
|
# Set the ionice scheduling class. 0 for none, 1 for real time, 2 for best-effort, 3 for idle.
|
||||||
ionice_class = 0
|
ionice_class = 0
|
||||||
# Set the ionice scheduling class data. This defines the class data, if the class accepts an argument. For real time and best-effort, 0-7 is valid data.
|
# Set the ionice scheduling class data. This defines the class data, if the class accepts an argument. For real time and best-effort, 0-7 is valid data.
|
||||||
|
|
|
@ -24,6 +24,42 @@ jobs:
|
||||||
maxParallel: 4
|
maxParallel: 4
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
- script: |
|
||||||
|
# Make sure all packages are pulled from latest
|
||||||
|
sudo apt-get update
|
||||||
|
|
||||||
|
# Fail out if any setups fail
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Delete old Pythons
|
||||||
|
rm -rf $AGENT_TOOLSDIRECTORY/Python/2.7.16
|
||||||
|
rm -rf $AGENT_TOOLSDIRECTORY/Python/3.5.7
|
||||||
|
rm -rf $AGENT_TOOLSDIRECTORY/Python/3.7.3
|
||||||
|
|
||||||
|
# Download new Pythons
|
||||||
|
azcopy --recursive \
|
||||||
|
--source https://vstsagenttools.blob.core.windows.net/tools/hostedtoolcache/linux/Python/2.7.15 \
|
||||||
|
--destination $AGENT_TOOLSDIRECTORY/Python/2.7.15
|
||||||
|
|
||||||
|
azcopy --recursive \
|
||||||
|
--source https://vstsagenttools.blob.core.windows.net/tools/hostedtoolcache/linux/Python/3.5.5 \
|
||||||
|
--destination $AGENT_TOOLSDIRECTORY/Python/3.5.5
|
||||||
|
|
||||||
|
azcopy --recursive \
|
||||||
|
--source https://vstsagenttools.blob.core.windows.net/tools/hostedtoolcache/linux/Python/3.7.2 \
|
||||||
|
--destination $AGENT_TOOLSDIRECTORY/Python/3.7.2
|
||||||
|
|
||||||
|
# Install new Pythons
|
||||||
|
original_directory=$PWD
|
||||||
|
setups=$(find $AGENT_TOOLSDIRECTORY/Python -name setup.sh)
|
||||||
|
for setup in $setups; do
|
||||||
|
chmod +x $setup;
|
||||||
|
cd $(dirname $setup);
|
||||||
|
./$(basename $setup);
|
||||||
|
cd $original_directory;
|
||||||
|
done;
|
||||||
|
displayName: 'Workaround: update apt and roll back Python versions'
|
||||||
|
|
||||||
- task: UsePythonVersion@0
|
- task: UsePythonVersion@0
|
||||||
inputs:
|
inputs:
|
||||||
versionSpec: '$(python.version)'
|
versionSpec: '$(python.version)'
|
||||||
|
@ -41,10 +77,10 @@ jobs:
|
||||||
displayName: 'pytest'
|
displayName: 'pytest'
|
||||||
|
|
||||||
- script: |
|
- script: |
|
||||||
rm -rf .git
|
rm -rf .git
|
||||||
python cleanup.py
|
python cleanup.py
|
||||||
python TorrentToMedia.py
|
python TorrentToMedia.py
|
||||||
python nzbToMedia.py
|
python nzbToMedia.py
|
||||||
displayName: 'Test source install cleanup'
|
displayName: 'Test source install cleanup'
|
||||||
|
|
||||||
- task: PublishTestResults@2
|
- task: PublishTestResults@2
|
||||||
|
|
|
@ -457,7 +457,10 @@ def configure_niceness():
|
||||||
with open(os.devnull, 'w') as devnull:
|
with open(os.devnull, 'w') as devnull:
|
||||||
try:
|
try:
|
||||||
subprocess.Popen(['nice'], stdout=devnull, stderr=devnull).communicate()
|
subprocess.Popen(['nice'], stdout=devnull, stderr=devnull).communicate()
|
||||||
NICENESS.extend(['nice', '-n{0}'.format(int(CFG['Posix']['niceness']))])
|
if len(CFG['Posix']['niceness'].split(',')) > 1: #Allow passing of absolute command, not just value.
|
||||||
|
NICENESS.extend(CFG['Posix']['niceness'].split(','))
|
||||||
|
else:
|
||||||
|
NICENESS.extend(['nice', '-n{0}'.format(int(CFG['Posix']['niceness']))])
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -607,7 +607,7 @@ def extract_subs(file, newfile_path, bitbucket):
|
||||||
result = 1 # set result to failed in case call fails.
|
result = 1 # set result to failed in case call fails.
|
||||||
try:
|
try:
|
||||||
proc = subprocess.Popen(command, stdout=bitbucket, stderr=bitbucket)
|
proc = subprocess.Popen(command, stdout=bitbucket, stderr=bitbucket)
|
||||||
proc.communicate()
|
out, err = proc.communicate()
|
||||||
result = proc.returncode
|
result = proc.returncode
|
||||||
except Exception:
|
except Exception:
|
||||||
logger.error('Extracting subtitle has failed')
|
logger.error('Extracting subtitle has failed')
|
||||||
|
@ -930,17 +930,19 @@ def transcode_directory(dir_name):
|
||||||
result = 1 # set result to failed in case call fails.
|
result = 1 # set result to failed in case call fails.
|
||||||
try:
|
try:
|
||||||
if isinstance(file, string_types):
|
if isinstance(file, string_types):
|
||||||
proc = subprocess.Popen(command, stdout=bitbucket, stderr=bitbucket)
|
proc = subprocess.Popen(command, stdout=bitbucket, stderr=subprocess.PIPE)
|
||||||
else:
|
else:
|
||||||
img, data = next(iteritems(file))
|
img, data = next(iteritems(file))
|
||||||
proc = subprocess.Popen(command, stdout=bitbucket, stderr=bitbucket, stdin=subprocess.PIPE)
|
proc = subprocess.Popen(command, stdout=bitbucket, stderr=subprocess.PIPE, stdin=subprocess.PIPE)
|
||||||
for vob in data['files']:
|
for vob in data['files']:
|
||||||
procin = zip_out(vob, img, bitbucket)
|
procin = zip_out(vob, img, bitbucket)
|
||||||
if procin:
|
if procin:
|
||||||
logger.debug('Feeding in file: {0} to Transcoder'.format(vob))
|
logger.debug('Feeding in file: {0} to Transcoder'.format(vob))
|
||||||
shutil.copyfileobj(procin.stdout, proc.stdin)
|
shutil.copyfileobj(procin.stdout, proc.stdin)
|
||||||
procin.stdout.close()
|
procin.stdout.close()
|
||||||
proc.communicate()
|
out, err = proc.communicate()
|
||||||
|
if err:
|
||||||
|
logger.error('Transcoder returned:{0} has failed'.format(err))
|
||||||
result = proc.returncode
|
result = proc.returncode
|
||||||
except Exception:
|
except Exception:
|
||||||
logger.error('Transcoding of video {0} has failed'.format(newfile_path))
|
logger.error('Transcoding of video {0} has failed'.format(newfile_path))
|
||||||
|
|
|
@ -112,8 +112,10 @@
|
||||||
|
|
||||||
# Niceness for external tasks Extractor and Transcoder.
|
# Niceness for external tasks Extractor and Transcoder.
|
||||||
#
|
#
|
||||||
# Set the Niceness value for the nice command. These range from -20 (most favorable to the process) to 19 (least favorable to the process).
|
# Set the Niceness value for the nice command. These range from -20 (most favorable to the process) to 19 (least favorable to the process).
|
||||||
#niceness=10
|
# If entering an integer e.g 'niceness=4', this is added to the nice command and passed as 'nice -n4' (Default).
|
||||||
|
# If entering a comma separated list e.g. 'niceness=nice,4' this will be passed as 'nice 4' (Safer).
|
||||||
|
#niceness=nice,-n0
|
||||||
|
|
||||||
# ionice scheduling class (0, 1, 2, 3).
|
# ionice scheduling class (0, 1, 2, 3).
|
||||||
#
|
#
|
||||||
|
|
|
@ -68,8 +68,10 @@
|
||||||
|
|
||||||
# Niceness for external tasks Extractor and Transcoder.
|
# Niceness for external tasks Extractor and Transcoder.
|
||||||
#
|
#
|
||||||
# Set the Niceness value for the nice command. These range from -20 (most favorable to the process) to 19 (least favorable to the process).
|
# Set the Niceness value for the nice command. These range from -20 (most favorable to the process) to 19 (least favorable to the process).
|
||||||
#niceness=10
|
# If entering an integer e.g 'niceness=4', this is added to the nice command and passed as 'nice -n4' (Default).
|
||||||
|
# If entering a comma separated list e.g. 'niceness=nice,4' this will be passed as 'nice 4' (Safer).
|
||||||
|
#niceness=nice,-n0
|
||||||
|
|
||||||
# ionice scheduling class (0, 1, 2, 3).
|
# ionice scheduling class (0, 1, 2, 3).
|
||||||
#
|
#
|
||||||
|
|
|
@ -82,8 +82,10 @@
|
||||||
|
|
||||||
# Niceness for external tasks Extractor and Transcoder.
|
# Niceness for external tasks Extractor and Transcoder.
|
||||||
#
|
#
|
||||||
# Set the Niceness value for the nice command. These range from -20 (most favorable to the process) to 19 (least favorable to the process).
|
# Set the Niceness value for the nice command. These range from -20 (most favorable to the process) to 19 (least favorable to the process).
|
||||||
#niceness=10
|
# If entering an integer e.g 'niceness=4', this is added to the nice command and passed as 'nice -n4' (Default).
|
||||||
|
# If entering a comma separated list e.g. 'niceness=nice,4' this will be passed as 'nice 4' (Safer).
|
||||||
|
#niceness=nice,-n0
|
||||||
|
|
||||||
# ionice scheduling class (0, 1, 2, 3).
|
# ionice scheduling class (0, 1, 2, 3).
|
||||||
#
|
#
|
||||||
|
|
|
@ -76,8 +76,10 @@
|
||||||
|
|
||||||
# Niceness for external tasks Extractor and Transcoder.
|
# Niceness for external tasks Extractor and Transcoder.
|
||||||
#
|
#
|
||||||
# Set the Niceness value for the nice command. These range from -20 (most favorable to the process) to 19 (least favorable to the process).
|
# Set the Niceness value for the nice command. These range from -20 (most favorable to the process) to 19 (least favorable to the process).
|
||||||
#niceness=10
|
# If entering an integer e.g 'niceness=4', this is added to the nice command and passed as 'nice -n4' (Default).
|
||||||
|
# If entering a comma separated list e.g. 'niceness=nice,4' this will be passed as 'nice 4' (Safer).
|
||||||
|
#niceness=nice,-n0
|
||||||
|
|
||||||
# ionice scheduling class (0, 1, 2, 3).
|
# ionice scheduling class (0, 1, 2, 3).
|
||||||
#
|
#
|
||||||
|
|
|
@ -97,8 +97,10 @@
|
||||||
|
|
||||||
# Niceness for external tasks Extractor and Transcoder.
|
# Niceness for external tasks Extractor and Transcoder.
|
||||||
#
|
#
|
||||||
# Set the Niceness value for the nice command. These range from -20 (most favorable to the process) to 19 (least favorable to the process).
|
# Set the Niceness value for the nice command. These range from -20 (most favorable to the process) to 19 (least favorable to the process).
|
||||||
#niceness=10
|
# If entering an integer e.g 'niceness=4', this is added to the nice command and passed as 'nice -n4' (Default).
|
||||||
|
# If entering a comma separated list e.g. 'niceness=nice,4' this will be passed as 'nice 4' (Safer).
|
||||||
|
#niceness=nice,-n0
|
||||||
|
|
||||||
# ionice scheduling class (0, 1, 2, 3).
|
# ionice scheduling class (0, 1, 2, 3).
|
||||||
#
|
#
|
||||||
|
|
|
@ -468,8 +468,10 @@
|
||||||
|
|
||||||
# Niceness for external tasks Extractor and Transcoder.
|
# Niceness for external tasks Extractor and Transcoder.
|
||||||
#
|
#
|
||||||
# Set the Niceness value for the nice command. These range from -20 (most favorable to the process) to 19 (least favorable to the process).
|
# Set the Niceness value for the nice command. These range from -20 (most favorable to the process) to 19 (least favorable to the process).
|
||||||
#niceness=10
|
# If entering an integer e.g 'niceness=4', this is added to the nice command and passed as 'nice -n4' (Default).
|
||||||
|
# If entering a comma separated list e.g. 'niceness=nice,4' this will be passed as 'nice 4' (Safer).
|
||||||
|
#niceness=nice,-n0
|
||||||
|
|
||||||
# ionice scheduling class (0, 1, 2, 3).
|
# ionice scheduling class (0, 1, 2, 3).
|
||||||
#
|
#
|
||||||
|
|
|
@ -73,8 +73,10 @@
|
||||||
|
|
||||||
# Niceness for external tasks Extractor and Transcoder.
|
# Niceness for external tasks Extractor and Transcoder.
|
||||||
#
|
#
|
||||||
# Set the Niceness value for the nice command. These range from -20 (most favorable to the process) to 19 (least favorable to the process).
|
# Set the Niceness value for the nice command. These range from -20 (most favorable to the process) to 19 (least favorable to the process).
|
||||||
#niceness=10
|
# If entering an integer e.g 'niceness=4', this is added to the nice command and passed as 'nice -n4' (Default).
|
||||||
|
# If entering a comma separated list e.g. 'niceness=nice,4' this will be passed as 'nice 4' (Safer).
|
||||||
|
#niceness=nice,-n0
|
||||||
|
|
||||||
# ionice scheduling class (0, 1, 2, 3).
|
# ionice scheduling class (0, 1, 2, 3).
|
||||||
#
|
#
|
||||||
|
|
|
@ -102,8 +102,10 @@
|
||||||
|
|
||||||
# Niceness for external tasks Extractor and Transcoder.
|
# Niceness for external tasks Extractor and Transcoder.
|
||||||
#
|
#
|
||||||
# Set the Niceness value for the nice command. These range from -20 (most favorable to the process) to 19 (least favorable to the process).
|
# Set the Niceness value for the nice command. These range from -20 (most favorable to the process) to 19 (least favorable to the process).
|
||||||
#niceness=10
|
# If entering an integer e.g 'niceness=4', this is added to the nice command and passed as 'nice -n4' (Default).
|
||||||
|
# If entering a comma separated list e.g. 'niceness=nice,4' this will be passed as 'nice 4' (Safer).
|
||||||
|
#niceness=nice,-n0
|
||||||
|
|
||||||
# ionice scheduling class (0, 1, 2, 3).
|
# ionice scheduling class (0, 1, 2, 3).
|
||||||
#
|
#
|
||||||
|
|
|
@ -107,8 +107,10 @@
|
||||||
|
|
||||||
# Niceness for external tasks Extractor and Transcoder.
|
# Niceness for external tasks Extractor and Transcoder.
|
||||||
#
|
#
|
||||||
# Set the Niceness value for the nice command. These range from -20 (most favorable to the process) to 19 (least favorable to the process).
|
# Set the Niceness value for the nice command. These range from -20 (most favorable to the process) to 19 (least favorable to the process).
|
||||||
#niceness=10
|
# If entering an integer e.g 'niceness=4', this is added to the nice command and passed as 'nice -n4' (Default).
|
||||||
|
# If entering a comma separated list e.g. 'niceness=nice,4' this will be passed as 'nice 4' (Safer).
|
||||||
|
#niceness=nice,-n0
|
||||||
|
|
||||||
# ionice scheduling class (0, 1, 2, 3).
|
# ionice scheduling class (0, 1, 2, 3).
|
||||||
#
|
#
|
||||||
|
|
|
@ -113,8 +113,10 @@
|
||||||
|
|
||||||
# Niceness for external tasks Extractor and Transcoder.
|
# Niceness for external tasks Extractor and Transcoder.
|
||||||
#
|
#
|
||||||
# Set the Niceness value for the nice command. These range from -20 (most favorable to the process) to 19 (least favorable to the process).
|
# Set the Niceness value for the nice command. These range from -20 (most favorable to the process) to 19 (least favorable to the process).
|
||||||
#niceness=10
|
# If entering an integer e.g 'niceness=4', this is added to the nice command and passed as 'nice -n4' (Default).
|
||||||
|
# If entering a comma separated list e.g. 'niceness=nice,4' this will be passed as 'nice 4' (Safer).
|
||||||
|
#niceness=nice,-n0
|
||||||
|
|
||||||
# ionice scheduling class (0, 1, 2, 3).
|
# ionice scheduling class (0, 1, 2, 3).
|
||||||
#
|
#
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue