summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/knowit/default.nix
blob: c4c49ebddf0f73dc9bb2fd014c4e5c91a771f073 (plain)
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  fetchzip,

  # build-system
  poetry-core,

  # dependencies
  babelfish,
  enzyme,
  pymediainfo,
  pyyaml,
  trakit,
  pint,

  # nativeCheckInputs
  pytestCheckHook,
  ffmpeg,
  mediainfo,
  mkvtoolnix,
  requests,
}:

buildPythonPackage rec {
  pname = "knowit";
  version = "0.5.11";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "ratoaq2";
    repo = "knowit";
    tag = version;
    hash = "sha256-JqzCLdXEWZyvqXpeTJRW0zhY+wVcHLuBYrJbuSqfgkg=";
  };

  matroska_test_zip = fetchzip {
    url = "http://downloads.sourceforge.net/project/matroska/test_files/matroska_test_w1_1.zip";
    hash = "sha256-X8gIfDj2iP043kjO3yqxuIgn8mZMX7XaqzhQ7CTLUhc=";
    stripRoot = false;
  };

  postPatch = ''
    mkdir -p tests/data/videos
    cp ${matroska_test_zip}/*.mkv tests/data/videos/
  '';

  build-system = [
    poetry-core
  ];

  dependencies = [
    babelfish
    enzyme
    pymediainfo
    pyyaml
    trakit
  ];

  optional-dependencies = {
    pint = [
      pint
    ];
  };

  pythonImportsCheck = [
    "knowit"
  ];

  nativeCheckInputs = [
    pytestCheckHook
    ffmpeg
    mediainfo
    mkvtoolnix
    requests
  ];

  meta = {
    changelog = "https://github.com/ratoaq2/knowit/releases/tag/${src.tag}";
    description = "Extract metadata from media files";
    homepage = "https://github.com/ratoaq2/knowit";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ iynaix ];
    mainProgram = "knowit";
  };
}