Skip to content

Commit

Permalink
use lastest version of mediainfo.js
Browse files Browse the repository at this point in the history
  • Loading branch information
SoulMelody committed Sep 30, 2024
1 parent 979558e commit 51e3df3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,11 @@ cython_debug/
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
.idea/

# Visual Studio Code
.vscode/settings.json

assets/
node_modules/
.nicegui/
tests/data/*
!tests/data/.gitkeep
6 changes: 2 additions & 4 deletions libresvip/utils/audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,9 @@ def filter_func(track: MediaInfoTrack) -> bool:
from .mediainfo_wasm import MediaInfo
from .mediainfo_wasm import Track as MediaInfoTrack

mediainfo_js_ver = "0.3.1"

if not hasattr(js, "MediaInfo"):
js.importScripts(
f"https://fastly.jsdelivr.net/npm/mediainfo.js@{mediainfo_js_ver}/dist/umd/index.min.js"
"https://fastly.jsdelivr.net/npm/mediainfo.js@latest/dist/umd/index.min.js"
)

def audio_track_info(
Expand All @@ -79,7 +77,7 @@ def read_chunk(size: int, offset: int) -> js.Uint8Array:
return js_buf

def locate_file(path: str, prefix: str) -> str:
return f"https://fastly.jsdelivr.net/npm/mediainfo.js@{mediainfo_js_ver}/dist/MediaInfoModule.wasm"
return "https://fastly.jsdelivr.net/npm/mediainfo.js@latest/dist/MediaInfoModule.wasm"

async def parse_media_info() -> str:
media_info = await MediaInfo.mediaInfoFactory(format="XML", locateFile=locate_file)
Expand Down

0 comments on commit 51e3df3

Please sign in to comment.