convert byte to string from Popen. Fix Sick* failed processing. Fixes #1545

This commit is contained in:
clinton-hall 2019-02-05 22:01:20 +13:00
parent f91f40d643
commit f47f68f699
4 changed files with 23 additions and 18 deletions

View file

@ -1017,17 +1017,17 @@ def configure_utility_locations():
else: else:
try: try:
SEVENZIP = subprocess.Popen(['which', '7z'], stdout=subprocess.PIPE).communicate()[0].strip() SEVENZIP = subprocess.Popen(['which', '7z'], stdout=subprocess.PIPE).communicate()[0].strip().decode()
except Exception: except Exception:
pass pass
if not SEVENZIP: if not SEVENZIP:
try: try:
SEVENZIP = subprocess.Popen(['which', '7zr'], stdout=subprocess.PIPE).communicate()[0].strip() SEVENZIP = subprocess.Popen(['which', '7zr'], stdout=subprocess.PIPE).communicate()[0].strip().decode()
except Exception: except Exception:
pass pass
if not SEVENZIP: if not SEVENZIP:
try: try:
SEVENZIP = subprocess.Popen(['which', '7za'], stdout=subprocess.PIPE).communicate()[0].strip() SEVENZIP = subprocess.Popen(['which', '7za'], stdout=subprocess.PIPE).communicate()[0].strip().decode()
except Exception: except Exception:
pass pass
if not SEVENZIP: if not SEVENZIP:
@ -1035,7 +1035,7 @@ def configure_utility_locations():
logger.warning( logger.warning(
'Failed to locate 7zip. Transcoding of disk images and extraction of .7z files will not be possible!') 'Failed to locate 7zip. Transcoding of disk images and extraction of .7z files will not be possible!')
try: try:
PAR2CMD = subprocess.Popen(['which', 'par2'], stdout=subprocess.PIPE).communicate()[0].strip() PAR2CMD = subprocess.Popen(['which', 'par2'], stdout=subprocess.PIPE).communicate()[0].strip().decode()
except Exception: except Exception:
pass pass
if not PAR2CMD: if not PAR2CMD:
@ -1050,12 +1050,12 @@ def configure_utility_locations():
FFMPEG = os.path.join(FFMPEG_PATH, 'avconv') FFMPEG = os.path.join(FFMPEG_PATH, 'avconv')
else: else:
try: try:
FFMPEG = subprocess.Popen(['which', 'ffmpeg'], stdout=subprocess.PIPE).communicate()[0].strip() FFMPEG = subprocess.Popen(['which', 'ffmpeg'], stdout=subprocess.PIPE).communicate()[0].strip().decode()
except Exception: except Exception:
pass pass
if not FFMPEG: if not FFMPEG:
try: try:
FFMPEG = subprocess.Popen(['which', 'avconv'], stdout=subprocess.PIPE).communicate()[0].strip() FFMPEG = subprocess.Popen(['which', 'avconv'], stdout=subprocess.PIPE).communicate()[0].strip().decode()
except Exception: except Exception:
pass pass
if not FFMPEG: if not FFMPEG:
@ -1071,12 +1071,12 @@ def configure_utility_locations():
FFPROBE = os.path.join(FFMPEG_PATH, 'avprobe') FFPROBE = os.path.join(FFMPEG_PATH, 'avprobe')
else: else:
try: try:
FFPROBE = subprocess.Popen(['which', 'ffprobe'], stdout=subprocess.PIPE).communicate()[0].strip() FFPROBE = subprocess.Popen(['which', 'ffprobe'], stdout=subprocess.PIPE).communicate()[0].strip().decode()
except Exception: except Exception:
pass pass
if not FFPROBE: if not FFPROBE:
try: try:
FFPROBE = subprocess.Popen(['which', 'avprobe'], stdout=subprocess.PIPE).communicate()[0].strip() FFPROBE = subprocess.Popen(['which', 'avprobe'], stdout=subprocess.PIPE).communicate()[0].strip().decode()
except Exception: except Exception:
pass pass
if not FFPROBE: if not FFPROBE:

View file

@ -168,12 +168,14 @@ def process(section, dir_name, input_name=None, failed=False, client_agent='manu
for param in copy.copy(fork_params): for param in copy.copy(fork_params):
if param == 'failed': if param == 'failed':
fork_params[param] = failed fork_params[param] = failed
if 'proc_type' in fork_params:
del fork_params['proc_type'] del fork_params['proc_type']
if 'type' in fork_params: if 'type' in fork_params:
del fork_params['type'] del fork_params['type']
if param == 'return_data': if param == 'return_data':
fork_params[param] = 0 fork_params[param] = 0
if 'quiet' in fork_params:
del fork_params['quiet'] del fork_params['quiet']
if param == 'type': if param == 'type':

View file

@ -95,7 +95,7 @@ def get_video_details(videofile, img=None, bitbucket=None):
proc = subprocess.Popen(command, stdout=subprocess.PIPE) proc = subprocess.Popen(command, stdout=subprocess.PIPE)
out, err = proc.communicate() out, err = proc.communicate()
result = proc.returncode result = proc.returncode
video_details = json.loads(out) video_details = json.loads(out.decode())
except Exception: except Exception:
pass pass
if not video_details: if not video_details:
@ -109,7 +109,7 @@ def get_video_details(videofile, img=None, bitbucket=None):
proc = subprocess.Popen(command, stdout=subprocess.PIPE) proc = subprocess.Popen(command, stdout=subprocess.PIPE)
out, err = proc.communicate() out, err = proc.communicate()
result = proc.returncode result = proc.returncode
video_details = json.loads(out) video_details = json.loads(out.decode())
except Exception: except Exception:
logger.error('Checking [{0}] has failed'.format(file), 'TRANSCODER') logger.error('Checking [{0}] has failed'.format(file), 'TRANSCODER')
return video_details, result return video_details, result

View file

@ -1,15 +1,18 @@
#! /usr/bin/env python2 #! /usr/bin/env python2
from __future__ import print_function from __future__ import print_function
from babelfish import Language import datetime
import guessit import os
import requests import sys
import subliminal
import core import core
from core import transcoder from core import logger, main_db, transcoder
from core.auto_process import comics, games, movies, music, tv
from core.auto_process.common import ProcessResult
from core.user_scripts import external_script
from core.forks import auto_fork from core.forks import auto_fork
from core.utils import server_responding from core.utils import char_replace, clean_dir, convert_to_ascii, extract_files, get_dirs, get_download_info, get_nzoid, plex_update, update_download_info_status, server_responding
# Initialize the config # Initialize the config
core.initialize() core.initialize()