about summary refs log tree commit diff stats
path: root/pkgs/by-name/be/beetsExtraPlugins/xtractor.nix
blob: 01c6207aadc303edec6bd57274ba9f0602c5dc67 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
{
  lib,
  fetchFromGitHub,
  python3Packages,
  beets,
}:
# FIXME: Find a way to update this derivation <2024-08-11>
let
  version = "0.4.2";
  models = builtins.fetchTarball {
    url = "https://essentia.upf.edu/svm_models/essentia-extractor-svm_models-v2.1_beta5.tar.gz";
    sha256 = "11ps1l4h8bl4l9rlvkhjs61908l18dh7mpq65brm8ki99hnp9g64";
  };
in
  python3Packages.buildPythonApplication {
    inherit version;
    pname = "beets-xtractor";
    pyproject = true;

    src = fetchFromGitHub {
      repo = "BeetsPluginXtractor";
      owner = "adamjakab";
      rev = "v${version}";
      hash = "sha256-it4qQ2OS4qBEaGLJK8FVGpjlvg0MQICazV7TAM8lH9s=";
    };

    nativeBuildInputs = [
      beets
      python3Packages.setuptools
    ];

    passthru = {inherit models;};

    nativeCheckInputs = with python3Packages; [
      pytestCheckHook
      pytest-cov
      mock
      typeguard
    ];

    preCheck = ''
      export HOME="$(mktemp -d)"
    '';
    postInstall = ''
      mkdir --parents $out/models
      cp ${models}/* $out/models
    '';

    meta = {
      description = "Obtain low and high level musical information from your song";
      homepage = "https://github.com/adamjakab/BeetsPluginXtractor/releasesfhhhhh";
      license = lib.licenses.mit;
    };
  }