mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-20 05:13:16 -07:00
add test file to verify FFprobe works. #531
This commit is contained in:
parent
bf727877d1
commit
a84e9c3475
5 changed files with 30 additions and 7 deletions
|
@ -22,6 +22,7 @@ CONFIG_FILE = os.path.join(PROGRAM_DIR, 'autoProcessMedia.cfg')
|
||||||
CONFIG_SPEC_FILE = os.path.join(PROGRAM_DIR, 'autoProcessMedia.cfg.spec')
|
CONFIG_SPEC_FILE = os.path.join(PROGRAM_DIR, 'autoProcessMedia.cfg.spec')
|
||||||
CONFIG_MOVIE_FILE = os.path.join(PROGRAM_DIR, 'autoProcessMovie.cfg')
|
CONFIG_MOVIE_FILE = os.path.join(PROGRAM_DIR, 'autoProcessMovie.cfg')
|
||||||
CONFIG_TV_FILE = os.path.join(PROGRAM_DIR, 'autoProcessTv.cfg')
|
CONFIG_TV_FILE = os.path.join(PROGRAM_DIR, 'autoProcessTv.cfg')
|
||||||
|
TEST_FILE = os.path.join(os.path.join(PROGRAM_DIR, 'tests'), 'test.mp4')
|
||||||
MYAPP = None
|
MYAPP = None
|
||||||
|
|
||||||
from nzbtomedia.autoProcess.autoProcessComics import autoProcessComics
|
from nzbtomedia.autoProcess.autoProcessComics import autoProcessComics
|
||||||
|
@ -188,7 +189,7 @@ def initialize(section=None):
|
||||||
SABNZB_NO_OF_ARGUMENTS, SABNZB_0717_NO_OF_ARGUMENTS, CATEGORIES, TORRENT_CLIENTAGENT, USELINK, OUTPUTDIRECTORY, \
|
SABNZB_NO_OF_ARGUMENTS, SABNZB_0717_NO_OF_ARGUMENTS, CATEGORIES, TORRENT_CLIENTAGENT, USELINK, OUTPUTDIRECTORY, \
|
||||||
NOFLATTEN, UTORRENTPWD, UTORRENTUSR, UTORRENTWEBUI, DELUGEHOST, DELUGEPORT, DELUGEUSR, DELUGEPWD, \
|
NOFLATTEN, UTORRENTPWD, UTORRENTUSR, UTORRENTWEBUI, DELUGEHOST, DELUGEPORT, DELUGEUSR, DELUGEPWD, \
|
||||||
TRANSMISSIONHOST, TRANSMISSIONPORT, TRANSMISSIONPWD, TRANSMISSIONUSR, COMPRESSEDCONTAINER, MEDIACONTAINER, \
|
TRANSMISSIONHOST, TRANSMISSIONPORT, TRANSMISSIONPWD, TRANSMISSIONUSR, COMPRESSEDCONTAINER, MEDIACONTAINER, \
|
||||||
METACONTAINER, SECTIONS, ALL_FORKS, \
|
METACONTAINER, SECTIONS, ALL_FORKS, TEST_FILE, \
|
||||||
__INITIALIZED__, AUTO_UPDATE, APP_FILENAME, USER_DELAY, APP_NAME, TRANSCODE, DEFAULTS, GIT_PATH, GIT_USER, \
|
__INITIALIZED__, AUTO_UPDATE, APP_FILENAME, USER_DELAY, APP_NAME, TRANSCODE, DEFAULTS, GIT_PATH, GIT_USER, \
|
||||||
GIT_BRANCH, GIT_REPO, SYS_ENCODING, NZB_CLIENTAGENT, SABNZBDHOST, SABNZBDPORT, SABNZBDAPIKEY, \
|
GIT_BRANCH, GIT_REPO, SYS_ENCODING, NZB_CLIENTAGENT, SABNZBDHOST, SABNZBDPORT, SABNZBDAPIKEY, \
|
||||||
DUPLICATE, IGNOREEXTENSIONS, VEXTENSION, OUTPUTVIDEOPATH, PROCESSOUTPUT, VCODEC, VCODEC_ALLOW, VPRESET, \
|
DUPLICATE, IGNOREEXTENSIONS, VEXTENSION, OUTPUTVIDEOPATH, PROCESSOUTPUT, VCODEC, VCODEC_ALLOW, VPRESET, \
|
||||||
|
|
|
@ -75,7 +75,8 @@ def autoFork(section, inputCategory):
|
||||||
r = requests.get(url, verify=False)
|
r = requests.get(url, verify=False)
|
||||||
except requests.ConnectionError:
|
except requests.ConnectionError:
|
||||||
logger.info("Could not connect to %s:%s to perform auto-fork detection!" % (section, inputCategory))
|
logger.info("Could not connect to %s:%s to perform auto-fork detection!" % (section, inputCategory))
|
||||||
if r.ok:
|
r = []
|
||||||
|
if r and r.ok:
|
||||||
for param in params:
|
for param in params:
|
||||||
if not 'name="%s"' %(param) in r.text:
|
if not 'name="%s"' %(param) in r.text:
|
||||||
rem_params.append(param)
|
rem_params.append(param)
|
||||||
|
|
|
@ -14,11 +14,25 @@ from nzbtomedia.nzbToMediaUtil import makeDir
|
||||||
def isVideoGood(videofile, status):
|
def isVideoGood(videofile, status):
|
||||||
fileNameExt = os.path.basename(videofile)
|
fileNameExt = os.path.basename(videofile)
|
||||||
fileName, fileExt = os.path.splitext(fileNameExt)
|
fileName, fileExt = os.path.splitext(fileNameExt)
|
||||||
|
disable = False
|
||||||
if fileExt not in nzbtomedia.MEDIACONTAINER or not nzbtomedia.FFPROBE or not nzbtomedia.CHECK_MEDIA:
|
if fileExt not in nzbtomedia.MEDIACONTAINER or not nzbtomedia.FFPROBE or not nzbtomedia.CHECK_MEDIA:
|
||||||
if status: # if the download was "failed", assume bad. If it was successful, assume good.
|
disable = True
|
||||||
return False
|
else:
|
||||||
else:
|
test_details, res = getVideoDetails(nzbtomedia.TEST_FILE)
|
||||||
return True
|
if res !=0 or test_details.get("error"):
|
||||||
|
disable = True
|
||||||
|
logger.info("DISABLED: ffprobe failed to analyse test file. Stopping corruption check.", 'TRANSCODER')
|
||||||
|
if test_details.get("streams"):
|
||||||
|
vidStreams = [item for item in test_details["streams"] if item["codec_type"] == "video"]
|
||||||
|
audStreams = [item for item in test_details["streams"] if item["codec_type"] == "audio"]
|
||||||
|
if not (len(vidStreams) > 0 and len(audStreams) > 0):
|
||||||
|
disable = True
|
||||||
|
logger.info("DISABLED: ffprobe failed to analyse streams from test file. Stopping corruption check.", 'TRANSCODER')
|
||||||
|
if disable:
|
||||||
|
if status: # if the download was "failed", assume bad. If it was successful, assume good.
|
||||||
|
return False
|
||||||
|
else:
|
||||||
|
return True
|
||||||
|
|
||||||
logger.info('Checking [%s] for corruption, please stand by ...' % (fileNameExt), 'TRANSCODER')
|
logger.info('Checking [%s] for corruption, please stand by ...' % (fileNameExt), 'TRANSCODER')
|
||||||
video_details, result = getVideoDetails(videofile)
|
video_details, result = getVideoDetails(videofile)
|
||||||
|
|
|
@ -5,11 +5,17 @@ import re
|
||||||
import nzbtomedia
|
import nzbtomedia
|
||||||
from nzbtomedia.nzbToMediaAutoFork import autoFork
|
from nzbtomedia.nzbToMediaAutoFork import autoFork
|
||||||
from nzbtomedia import nzbToMediaDB
|
from nzbtomedia import nzbToMediaDB
|
||||||
|
from nzbtomedia.transcoder import transcoder
|
||||||
from nzbtomedia.nzbToMediaUtil import get_downloadInfo, server_responding
|
from nzbtomedia.nzbToMediaUtil import get_downloadInfo, server_responding
|
||||||
|
|
||||||
# Initialize the config
|
# Initialize the config
|
||||||
nzbtomedia.initialize()
|
nzbtomedia.initialize()
|
||||||
|
|
||||||
|
if transcoder.isVideoGood(nzbtomedia.TEST_FILE, 0):
|
||||||
|
print "FFPROBE Works"
|
||||||
|
else:
|
||||||
|
print "FFPROBE FAILED"
|
||||||
|
|
||||||
test = nzbtomedia.CFG['SickBeard','NzbDrone']['tv'].isenabled()
|
test = nzbtomedia.CFG['SickBeard','NzbDrone']['tv'].isenabled()
|
||||||
section = nzbtomedia.CFG.findsection('tv').isenabled()
|
section = nzbtomedia.CFG.findsection('tv').isenabled()
|
||||||
print section
|
print section
|
||||||
|
@ -32,3 +38,4 @@ print Language('eng')
|
||||||
import subliminal
|
import subliminal
|
||||||
|
|
||||||
subliminal.cache_region.configure('dogpile.cache.memory')
|
subliminal.cache_region.configure('dogpile.cache.memory')
|
||||||
|
del nzbtomedia.MYAPP
|
BIN
tests/test.mp4
Normal file
BIN
tests/test.mp4
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue