videoconverter-worker 1.0.1__py3-none-any.whl → 1.0.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ffmpeg_runner.py +29 -0
- {videoconverter_worker-1.0.1.dist-info → videoconverter_worker-1.0.2.dist-info}/METADATA +1 -1
- videoconverter_worker-1.0.2.dist-info/RECORD +10 -0
- worker.py +6 -0
- videoconverter_worker-1.0.1.dist-info/RECORD +0 -10
- {videoconverter_worker-1.0.1.dist-info → videoconverter_worker-1.0.2.dist-info}/WHEEL +0 -0
- {videoconverter_worker-1.0.1.dist-info → videoconverter_worker-1.0.2.dist-info}/entry_points.txt +0 -0
- {videoconverter_worker-1.0.1.dist-info → videoconverter_worker-1.0.2.dist-info}/top_level.txt +0 -0
ffmpeg_runner.py
CHANGED
|
@@ -21,6 +21,35 @@ def _find_ffprobe() -> str:
|
|
|
21
21
|
return os.environ.get("FFPROBE_PATH", "ffprobe")
|
|
22
22
|
|
|
23
23
|
|
|
24
|
+
def check_ffmpeg_available() -> Optional[str]:
|
|
25
|
+
"""
|
|
26
|
+
检测 ffmpeg / ffprobe 是否可用。可用则返回 None,不可用则返回错误说明(含安装提示)。
|
|
27
|
+
"""
|
|
28
|
+
missing = []
|
|
29
|
+
for name, getter in [("ffmpeg", _find_ffmpeg), ("ffprobe", _find_ffprobe)]:
|
|
30
|
+
path = getter()
|
|
31
|
+
try:
|
|
32
|
+
r = subprocess.run(
|
|
33
|
+
[path, "-version"],
|
|
34
|
+
capture_output=True,
|
|
35
|
+
text=True,
|
|
36
|
+
timeout=5,
|
|
37
|
+
)
|
|
38
|
+
if r.returncode != 0:
|
|
39
|
+
missing.append(name)
|
|
40
|
+
except (FileNotFoundError, OSError):
|
|
41
|
+
missing.append(name)
|
|
42
|
+
if not missing:
|
|
43
|
+
return None
|
|
44
|
+
return (
|
|
45
|
+
"未检测到 {},请先安装 FFmpeg(本程序不会自动安装系统依赖)。\n"
|
|
46
|
+
" macOS: brew install ffmpeg\n"
|
|
47
|
+
" Ubuntu: sudo apt install ffmpeg\n"
|
|
48
|
+
" Windows: 从 https://ffmpeg.org/download.html 下载或将 ffmpeg/ffprobe 加入 PATH\n"
|
|
49
|
+
" 或设置环境变量: FFMPEG_PATH=... FFPROBE_PATH=..."
|
|
50
|
+
).format(" / ".join(missing))
|
|
51
|
+
|
|
52
|
+
|
|
24
53
|
def _format_time(seconds: float) -> str:
|
|
25
54
|
if seconds < 0:
|
|
26
55
|
return "0"
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
ffmpeg_runner.py,sha256=swnOI6cLw9Pe_Vn1XhOnjVzOI7GpUEkqNUgwcpPtlxY,11633
|
|
2
|
+
metadata.py,sha256=PPigPLAZIZ_vI6zeQgY6EQ4uuZskJEXvE-md7nNI7G4,2881
|
|
3
|
+
schema.py,sha256=3ILdGl5qSQOSvKfiKWcnaxdyHwV4rDvGnRZIparVp3o,4361
|
|
4
|
+
task_queue.py,sha256=sYQelPRuTbP9g_sPs69xOR3n5SIxGBFxY4EI5ueQrQs,11822
|
|
5
|
+
worker.py,sha256=NvR_dQQWaHelf7rnX-vGSMUocLkpYr5k37FWyCHhGyA,18002
|
|
6
|
+
videoconverter_worker-1.0.2.dist-info/METADATA,sha256=Dm9e4sYkLd3JDk8J5m1y-kSkx0KKXqe6ZVwsvAg2zwI,5139
|
|
7
|
+
videoconverter_worker-1.0.2.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
8
|
+
videoconverter_worker-1.0.2.dist-info/entry_points.txt,sha256=qedJjjix02n9Hz8adBioDIpGHghm8S3fQZdFwM5LV1A,83
|
|
9
|
+
videoconverter_worker-1.0.2.dist-info/top_level.txt,sha256=iamWyiqUZ4X0_2UZx6GEk9gsPmiI9qhse_15HqtzUj8,48
|
|
10
|
+
videoconverter_worker-1.0.2.dist-info/RECORD,,
|
worker.py
CHANGED
|
@@ -19,6 +19,7 @@ from ffmpeg_runner import (
|
|
|
19
19
|
merge_chunks,
|
|
20
20
|
get_duration,
|
|
21
21
|
get_video_size,
|
|
22
|
+
check_ffmpeg_available,
|
|
22
23
|
)
|
|
23
24
|
|
|
24
25
|
logging.basicConfig(
|
|
@@ -417,6 +418,11 @@ def main() -> int:
|
|
|
417
418
|
print(INPUT_SCHEMA)
|
|
418
419
|
return 0
|
|
419
420
|
|
|
421
|
+
err = check_ffmpeg_available()
|
|
422
|
+
if err:
|
|
423
|
+
logger.error("%s", err)
|
|
424
|
+
return 1
|
|
425
|
+
|
|
420
426
|
if args.simple:
|
|
421
427
|
base = Path(args.dir).resolve()
|
|
422
428
|
if not base.is_dir():
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
ffmpeg_runner.py,sha256=d3nM7GekNj3iMcOUSIUosrGKFSt8D2e04zgzvy-8iAY,10545
|
|
2
|
-
metadata.py,sha256=PPigPLAZIZ_vI6zeQgY6EQ4uuZskJEXvE-md7nNI7G4,2881
|
|
3
|
-
schema.py,sha256=3ILdGl5qSQOSvKfiKWcnaxdyHwV4rDvGnRZIparVp3o,4361
|
|
4
|
-
task_queue.py,sha256=sYQelPRuTbP9g_sPs69xOR3n5SIxGBFxY4EI5ueQrQs,11822
|
|
5
|
-
worker.py,sha256=BmAr0uO_g7HadeFRJfxCz15GvdiVoyzDMBBckAmhNu0,17877
|
|
6
|
-
videoconverter_worker-1.0.1.dist-info/METADATA,sha256=BcBvOZyiD5T0-wEE7qHGn3ovugacp-TFE1mzQ8QrQzI,5139
|
|
7
|
-
videoconverter_worker-1.0.1.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
8
|
-
videoconverter_worker-1.0.1.dist-info/entry_points.txt,sha256=qedJjjix02n9Hz8adBioDIpGHghm8S3fQZdFwM5LV1A,83
|
|
9
|
-
videoconverter_worker-1.0.1.dist-info/top_level.txt,sha256=iamWyiqUZ4X0_2UZx6GEk9gsPmiI9qhse_15HqtzUj8,48
|
|
10
|
-
videoconverter_worker-1.0.1.dist-info/RECORD,,
|
|
File without changes
|
{videoconverter_worker-1.0.1.dist-info → videoconverter_worker-1.0.2.dist-info}/entry_points.txt
RENAMED
|
File without changes
|
{videoconverter_worker-1.0.1.dist-info → videoconverter_worker-1.0.2.dist-info}/top_level.txt
RENAMED
|
File without changes
|