hs-m3u8 0.1.4__py3-none-any.whl → 0.1.5__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.
hs_m3u8/__init__.py CHANGED
@@ -1,3 +1,3 @@
1
1
  from hs_m3u8.main import M3u8Downloader, M3u8Key
2
2
 
3
- __version__ = "0.1.4"
3
+ __version__ = "0.1.5"
hs_m3u8/main.py CHANGED
@@ -9,6 +9,7 @@ import shutil
9
9
  import subprocess
10
10
  from collections.abc import Callable
11
11
  from hashlib import md5
12
+ from importlib import resources
12
13
  from pathlib import Path
13
14
  from urllib.parse import urljoin, urlparse
14
15
  from zipfile import ZipFile
@@ -28,20 +29,18 @@ def get_ffmpeg():
28
29
  if current_os != "Windows":
29
30
  return "ffmpeg"
30
31
 
31
- res_path = Path(__file__).parent.parent.parent / "res"
32
- ffmpeg_bin = res_path / "ffmpeg_win.exe"
32
+ with resources.as_file(resources.files("hs_m3u8.res")) as package_dir:
33
+ ffmpeg_bin = package_dir / "ffmpeg_win.exe"
34
+ if ffmpeg_bin.exists():
35
+ return str(ffmpeg_bin)
33
36
 
34
- if ffmpeg_bin.exists():
35
- return str(ffmpeg_bin)
37
+ # ZIP 文件
38
+ ffmpeg_bin_zip = package_dir / "ffmpeg_win.exe.zip"
39
+ if ffmpeg_bin_zip.exists():
40
+ with ZipFile(ffmpeg_bin_zip, "r") as zip_ref:
41
+ zip_ref.extractall(ffmpeg_bin.parent)
36
42
 
37
- # ZIP 文件
38
- ffmpeg_bin_zip = Path(ffmpeg_bin.parent) / f"{ffmpeg_bin.name}.zip"
39
- if ffmpeg_bin_zip.exists():
40
- # 解压缩到同一目录
41
- with ZipFile(ffmpeg_bin_zip, "r") as zip_ref:
42
- zip_ref.extractall(ffmpeg_bin.parent)
43
-
44
- return ffmpeg_bin
43
+ return ffmpeg_bin
45
44
 
46
45
 
47
46
  class M3u8Key:
Binary file
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hs-m3u8
3
- Version: 0.1.4
3
+ Version: 0.1.5
4
4
  Summary: m3u8 下载器
5
5
  Project-URL: homepage, https://github.com/x-haose/hs-m3u8
6
6
  Project-URL: repository, https://github.com/x-haose/hs-m3u8
@@ -0,0 +1,6 @@
1
+ hs_m3u8/__init__.py,sha256=HINaNDvyRMsgqg9VY_AsV9ierd8KhdtNyJRdQ8BcFg8,72
2
+ hs_m3u8/main.py,sha256=jZ0650qosfrhiS1r3-UGhjp8shx6TvcElXAEls7f3jQ,11609
3
+ hs_m3u8/res/ffmpeg_win.exe.zip,sha256=x_7Fa9N3hzN1d7Ph9ZwOiwpuRfLEVnhNL8tPjuZZMe0,60131319
4
+ hs_m3u8-0.1.5.dist-info/METADATA,sha256=3htPtN-CKSxXaS3o9oootUP4RMdS_tQSIyn4vBT0B4I,2204
5
+ hs_m3u8-0.1.5.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
6
+ hs_m3u8-0.1.5.dist-info/RECORD,,
@@ -1,5 +0,0 @@
1
- hs_m3u8/__init__.py,sha256=WxYMLrnGwdYDEmbxZmUV-l2DPs9jrYDP0cAnHxkqtFs,72
2
- hs_m3u8/main.py,sha256=RELt4z7AM7OuXYiRkCe-yf4A1JGQ9FtIaBj6Vov3Ig0,11574
3
- hs_m3u8-0.1.4.dist-info/METADATA,sha256=ddVI5SkdoINuFHSPS9uFGDeOmCybhT1al4_4SmXPHRs,2204
4
- hs_m3u8-0.1.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
5
- hs_m3u8-0.1.4.dist-info/RECORD,,