about summary refs log tree commit diff
path: root/pkgs/development/python-modules/videocr/default.nix
blob: 1f027563d480de7bc4d32d8115f2bd367c309dbc (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
{ lib
, buildPythonPackage
, fetchPypi
, levenshtein
, pytesseract
, opencv4
, fuzzywuzzy
}:

buildPythonPackage rec {
  pname = "videocr";
  version = "0.1.6";
  format = "setuptools";

  src = fetchPypi {
    inherit pname version;
    sha256 = "1clifwczvhvbaw2spgxkkyqsbqh21vyfw3rh094pxfmq89ylyj63";
  };

  propagatedBuildInputs = [
    levenshtein
    pytesseract
    opencv4
    fuzzywuzzy
  ];

  postPatch = ''
    substituteInPlace setup.py \
      --replace "python-Levenshtein" "Levenshtein" \
      --replace "opencv-python" "opencv"
    substituteInPlace videocr/constants.py \
      --replace "master" "main"
    substituteInPlace videocr/video.py \
      --replace '--tessdata-dir "{}"' '--tessdata-dir="{}"'
  '';

  # Project has no tests
  doCheck = false;

  pythonImportsCheck = [ "videocr" ];

  meta = with lib; {
    description = "Extract hardcoded subtitles from videos using machine learning";
    homepage = "https://github.com/apm1467/videocr";
    license = licenses.mit;
    maintainers = with maintainers; [ ozkutuk ];
  };
}