<commit_before>{ stdenv, fetchurl, pythonPackages, gettext, pyqt4
, pkgconfig, libdiscid, libofa, ffmpeg, acoustidFingerprinter
}:

pythonPackages.buildPythonPackage rec {
  name = "picard-${version}";
  namePrefix = "";
  version = "1.2";

  src = fetchurl {
    url = "http://ftp.musicbrainz.org/pub/musicbrainz/picard/${name}.tar.gz";
    md5 = "d1086687b7f7b0d359a731b1a25e7b66";
  };

  postPatch = let
    fpr = "${acoustidFingerprinter}/bin/acoustid_fpcalc";
  in ''
    sed -ri -e 's|(TextOption.*"acoustid_fpcalc"[^"]*")[^"]*|\1${fpr}|' \
      picard/ui/options/fingerprinting.py
  '';

  buildInputs = [
    pkgconfig
    ffmpeg
    libofa
    gettext
  ];

  propagatedBuildInputs = [
    pythonPackages.mutagen
    pyqt4
    libdiscid
  ];

  configurePhase = ''<commit_msg>picard: Fix acoustid-fingerprinter binary path.<commit_after>{ stdenv, fetchurl, pythonPackages, gettext, pyqt4
, pkgconfig, libdiscid, libofa, ffmpeg, acoustidFingerprinter
}:

pythonPackages.buildPythonPackage rec {
  name = "picard-${version}";
  namePrefix = "";
  version = "1.2";

  src = fetchurl {
    url = "http://ftp.musicbrainz.org/pub/musicbrainz/picard/${name}.tar.gz";
    md5 = "d1086687b7f7b0d359a731b1a25e7b66";
  };

  postPatch = let
    fpr = "${acoustidFingerprinter}/bin/acoustid-fingerprinter";
  in ''
    sed -ri -e 's|(TextOption.*"acoustid_fpcalc"[^"]*")[^"]*|\1${fpr}|' \
      picard/ui/options/fingerprinting.py
  '';

  buildInputs = [
    pkgconfig
    ffmpeg
    libofa
    gettext
  ];

  propagatedBuildInputs = [
    pythonPackages.mutagen
    pyqt4
    libdiscid
  ];

  configurePhase = ''
{'fraction_non_alphanumeric': 0.15108359133126936, 'fraction_numerical': 0.0346749226006192, 'mean_word_length': 3.5139664804469275, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7546758', 'n_tokens_mistral': 682, 'n_tokens_neox': 637, 'n_words': 92}