Merge pull request #227777 from mausch/pianoteq

pianoteq: fixes and upgrade
This commit is contained in:
Ilan Joselevich 2023-05-03 08:15:48 +03:00 committed by GitHub
commit 1446190b02
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,4 +1,4 @@
{ lib, stdenv, curl, jq, xorg, alsa-lib, freetype, p7zip, autoPatchelfHook, writeShellScript, zlib, libjack2, makeWrapper }:
{ lib, stdenv, curl, jq, htmlq, xorg, alsa-lib, freetype, p7zip, autoPatchelfHook, writeShellScript, zlib, libjack2, makeWrapper }:
let
versionForFile = v: builtins.replaceStrings ["."] [""] v;
@ -93,24 +93,32 @@ let
fetchWithCurlScript {
inherit name sha256;
script = ''
html=$(
"''${curl[@]}" --silent --request GET \
--cookie cookies \
--header "accept: */*" \
https://www.modartt.com/ -o /dev/null
'https://www.modartt.com/try?file=${name}'
)
json=$(
"''${curl[@]}" --silent --request POST \
--cookie cookies \
--header "modartt-json: request" \
--header "origin: https://www.modartt.com" \
--header "content-type: application/json; charset=UTF-8" \
--header "accept: application/json, text/javascript, */*" \
--data-raw '{"file": "${name}", "get": "url"}' \
https://www.modartt.com/api/0/download
)
signature="$(echo "$html" | ${htmlq}/bin/htmlq '#download-form' --attribute action | cut -f2 -d'&' | cut -f2 -d=)"
url=$(echo $json | ${jq}/bin/jq -r .url)
"''${curl[@]}" --progress-bar --cookie cookies -o $out "$url"
json=$(
"''${curl[@]}" --silent --request POST \
--cookie cookies \
--header "modartt-json: request" \
--header "origin: https://www.modartt.com" \
--header "content-type: application/json; charset=UTF-8" \
--header "accept: application/json, text/javascript, */*" \
--data-raw '{"file": "${name}", "get": "url", "signature": "'"$signature"'"}' \
https://www.modartt.com/api/0/download
)
url=$(echo $json | ${jq}/bin/jq -r .url)
if [ "$url" == "null" ]; then
echo "Could not get download URL, open an issue on https://github.com/NixOS/nixpkgs"
return 1
fi
"''${curl[@]}" --progress-bar --cookie cookies -o $out "$url"
'';
};
@ -160,20 +168,20 @@ in {
# TODO currently can't install more than one because `lame` clashes
stage-trial = mkPianoteq rec {
name = "stage-trial";
version = "8.0.5";
version = "8.0.8";
archdir = "x86-64bit";
src = fetchPianoteqTrial {
name = "pianoteq_stage_linux_trial_v${versionForFile version}.7z";
sha256 = "sha256-9Lo4e1SM1gw2/+TmpDUdZCOQcHEpT/aaG6P80/GRPQY=";
sha256 = "sha256-dp0bTzzh4aQ2KQ3z9zk+3meKQY4YRYQ86rccHd3+hAQ=";
};
};
standard-trial = mkPianoteq rec {
name = "standard-trial";
version = "8.0.5";
version = "8.0.8";
archdir = "x86-64bit";
src = fetchPianoteqTrial {
name = "pianoteq_linux_trial_v${versionForFile version}.7z";
sha256 = "sha256-qxViVIbld8zTMj1+TIfOsIOhmujOGJux2/u2J4hvsqw=";
sha256 = "sha256-LSrnrjkEhsX9TirUUFs9tNqH2A3cTt3I7YTfcTT6EP8=";
};
};
stage-6 = mkPianoteq rec {