Skip to content

Commit

Permalink
opus: pre-download dnn model before autogen
Browse files Browse the repository at this point in the history
this will prevent it from constantly redownloading everytime since
we clean the git dirs
  • Loading branch information
1480c1 committed Mar 6, 2024
1 parent 7397aff commit 837d06d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
8 changes: 8 additions & 0 deletions build/media-suite_compile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -801,6 +801,14 @@ if enabled libopus && do_vcs "$SOURCE_REPO_OPUS"; then
do_pacman_remove opus
do_pacman_install wget # autogen calls wget, but msys/wget seems to fail for some people, while the mingw64 one works
do_uninstall include/opus "${_check[@]}"
(
sha=$(grep dnn/download_model.sh autogen.sh | awk -F'"' '{print $2}')
model=opus_data-${sha:-735117b}.tar.gz
pushd . > /dev/null
do_wget -r -q -n "https://media.xiph.org/opus/models/$model"
popd > /dev/null || return 1
ln -s "$LOCALBUILDDIR/$model" .
)
do_autogen
do_separate_confmakeinstall --disable-{stack-protector,doc,extra-programs}
do_checkIfExist
Expand Down
5 changes: 3 additions & 2 deletions build/media-suite_helper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -417,14 +417,15 @@ check_hash() {

# get wget download
do_wget() {
local nocd=false norm=false quiet=false notmodified=false hash
local nocd=false norm=false quiet=false notmodified=false noextract=false hash
while true; do
case $1 in
-c) nocd=true && shift ;;
-r) norm=true && shift ;;
-q) quiet=true && shift ;;
-h) hash="$2" && shift 2 ;;
-z) notmodified=true && shift ;;
-n) noextract=true && shift ;;
--)
shift
break
Expand Down Expand Up @@ -493,7 +494,7 @@ do_wget() {
done

$norm || add_to_remove "$(pwd)/$archive"
do_extract "$archive" "$dirName"
$noextract || do_extract "$archive" "$dirName"
! $norm && [[ -n $dirName ]] && ! $nocd && add_to_remove
[[ -z $response_code || $response_code != "304" ]] && return 0
}
Expand Down

0 comments on commit 837d06d

Please sign in to comment.