add ffmpeg_find
api, don't recheck for it in status
This commit is contained in:
parent
947017e334
commit
23b4b9e230
2 changed files with 31 additions and 8 deletions
|
@ -765,6 +765,26 @@ class Daemon(metaclass=JSONRPCServerType):
|
|||
asyncio.get_event_loop().call_later(0, shutdown)
|
||||
return "Shutting down"
|
||||
|
||||
async def jsonrpc_ffmpeg_find(self):
|
||||
"""
|
||||
Get ffmpeg installation information
|
||||
|
||||
Usage:
|
||||
ffmpeg_find
|
||||
|
||||
Options:
|
||||
None
|
||||
|
||||
Returns:
|
||||
(dict) Dictionary of ffmpeg information
|
||||
{
|
||||
'available': (bool) found ffmpeg,
|
||||
'which': (str) path to ffmpeg,
|
||||
'analyze_audio_volume': (bool) should ffmpeg analyze audio
|
||||
}
|
||||
"""
|
||||
return await self._video_file_analyzer.status(recheck=True)
|
||||
|
||||
async def jsonrpc_status(self):
|
||||
"""
|
||||
Get daemon status
|
||||
|
|
|
@ -19,6 +19,7 @@ class VideoFileAnalyzer:
|
|||
self._available_encoders = ""
|
||||
self._ffmpeg_installed = False
|
||||
self._which = None
|
||||
self._checked_ffmpeg = False
|
||||
|
||||
async def _execute(self, command, arguments):
|
||||
args = shlex.split(arguments)
|
||||
|
@ -48,18 +49,20 @@ class VideoFileAnalyzer:
|
|||
self._ffmpeg_installed = True
|
||||
log.debug("Using %s at %s", version.splitlines()[0].split(" Copyright")[0], self._which)
|
||||
|
||||
async def status(self, reset=False):
|
||||
async def status(self, reset=False, recheck=False):
|
||||
if reset:
|
||||
self._available_encoders = ""
|
||||
self._ffmpeg_installed = False
|
||||
self._which = None
|
||||
|
||||
installed = True
|
||||
try:
|
||||
await self._verify_ffmpeg_installed()
|
||||
except FileNotFoundError:
|
||||
installed = False
|
||||
|
||||
if self._checked_ffmpeg and not recheck:
|
||||
installed = self._ffmpeg_installed
|
||||
else:
|
||||
installed = True
|
||||
try:
|
||||
await self._verify_ffmpeg_installed()
|
||||
except FileNotFoundError:
|
||||
installed = False
|
||||
self._checked_ffmpeg = True
|
||||
return {
|
||||
"available": installed,
|
||||
"which": self._which,
|
||||
|
|
Loading…
Reference in a new issue