mirror of
https://github.com/LBRYFoundation/lbry-sdk.git
synced 2025-09-01 09:45:13 +00:00
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)
|
asyncio.get_event_loop().call_later(0, shutdown)
|
||||||
return "Shutting down"
|
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):
|
async def jsonrpc_status(self):
|
||||||
"""
|
"""
|
||||||
Get daemon status
|
Get daemon status
|
||||||
|
|
|
@ -19,6 +19,7 @@ class VideoFileAnalyzer:
|
||||||
self._available_encoders = ""
|
self._available_encoders = ""
|
||||||
self._ffmpeg_installed = False
|
self._ffmpeg_installed = False
|
||||||
self._which = None
|
self._which = None
|
||||||
|
self._checked_ffmpeg = False
|
||||||
|
|
||||||
async def _execute(self, command, arguments):
|
async def _execute(self, command, arguments):
|
||||||
args = shlex.split(arguments)
|
args = shlex.split(arguments)
|
||||||
|
@ -48,18 +49,20 @@ class VideoFileAnalyzer:
|
||||||
self._ffmpeg_installed = True
|
self._ffmpeg_installed = True
|
||||||
log.debug("Using %s at %s", version.splitlines()[0].split(" Copyright")[0], self._which)
|
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:
|
if reset:
|
||||||
self._available_encoders = ""
|
self._available_encoders = ""
|
||||||
self._ffmpeg_installed = False
|
self._ffmpeg_installed = False
|
||||||
self._which = None
|
self._which = None
|
||||||
|
if self._checked_ffmpeg and not recheck:
|
||||||
installed = True
|
installed = self._ffmpeg_installed
|
||||||
try:
|
else:
|
||||||
await self._verify_ffmpeg_installed()
|
installed = True
|
||||||
except FileNotFoundError:
|
try:
|
||||||
installed = False
|
await self._verify_ffmpeg_installed()
|
||||||
|
except FileNotFoundError:
|
||||||
|
installed = False
|
||||||
|
self._checked_ffmpeg = True
|
||||||
return {
|
return {
|
||||||
"available": installed,
|
"available": installed,
|
||||||
"which": self._which,
|
"which": self._which,
|
||||||
|
|
Loading…
Add table
Reference in a new issue