1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 fetchzip,
6
7 # build-system
8 poetry-core,
9
10 # dependencies
11 babelfish,
12 enzyme,
13 pymediainfo,
14 pyyaml,
15 trakit,
16 pint,
17
18 # nativeCheckInputs
19 pytestCheckHook,
20 ffmpeg,
21 mediainfo,
22 mkvtoolnix,
23 requests,
24}:
25
26buildPythonPackage rec {
27 pname = "knowit";
28 version = "0.5.11";
29 pyproject = true;
30
31 src = fetchFromGitHub {
32 owner = "ratoaq2";
33 repo = "knowit";
34 tag = version;
35 hash = "sha256-JqzCLdXEWZyvqXpeTJRW0zhY+wVcHLuBYrJbuSqfgkg=";
36 };
37
38 matroska_test_zip = fetchzip {
39 url = "http://downloads.sourceforge.net/project/matroska/test_files/matroska_test_w1_1.zip";
40 hash = "sha256-X8gIfDj2iP043kjO3yqxuIgn8mZMX7XaqzhQ7CTLUhc=";
41 stripRoot = false;
42 };
43
44 postPatch = ''
45 mkdir -p tests/data/videos
46 cp ${matroska_test_zip}/*.mkv tests/data/videos/
47 '';
48
49 build-system = [
50 poetry-core
51 ];
52
53 dependencies = [
54 babelfish
55 enzyme
56 pymediainfo
57 pyyaml
58 trakit
59 ];
60
61 optional-dependencies = {
62 pint = [
63 pint
64 ];
65 };
66
67 pythonImportsCheck = [
68 "knowit"
69 ];
70
71 nativeCheckInputs = [
72 pytestCheckHook
73 ffmpeg
74 mediainfo
75 mkvtoolnix
76 requests
77 ];
78
79 meta = {
80 changelog = "https://github.com/ratoaq2/knowit/releases/tag/${src.tag}";
81 description = "Extract metadata from media files";
82 homepage = "https://github.com/ratoaq2/knowit";
83 license = lib.licenses.mit;
84 maintainers = with lib.maintainers; [ iynaix ];
85 mainProgram = "knowit";
86 };
87}