Unverified Commit 1446190b authored by Ilan Joselevich's avatar Ilan Joselevich Committed by GitHub
Browse files

Merge pull request #227777 from mausch/pianoteq

pianoteq: fixes and upgrade
parents c7591eba ee193797
Loading
Loading
Loading
Loading
+27 −19
Original line number Diff line number Diff line
{ 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,10 +93,14 @@ 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}'
        )

        signature="$(echo "$html" | ${htmlq}/bin/htmlq '#download-form' --attribute action | cut -f2 -d'&' | cut -f2 -d=)"

        json=$(
          "''${curl[@]}" --silent --request POST \
@@ -105,11 +109,15 @@ let
          --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"}' \
          --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 {