summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/videocr/default.nix
blob: 0be19fa99e4371b1a76b6a3e69e3039544caa090 (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
{
  lib,
  buildPythonPackage,
  fetchPypi,
  setuptools,
  levenshtein,
  pytesseract,
  opencv-python,
  fuzzywuzzy,
}:

buildPythonPackage rec {
  pname = "videocr";
  version = "0.1.6";
  pyproject = true;

  src = fetchPypi {
    inherit pname version;
    hash = "sha256-w0hPfUK4un5JAjAP7vwOAuKlsZ+zv6sFV2vD/Rl3kbI=";
  };

  build-system = [ setuptools ];

  dependencies = [
    levenshtein
    pytesseract
    opencv-python
    fuzzywuzzy
  ];

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

  # Project has no tests
  doCheck = false;

  pythonImportsCheck = [ "videocr" ];

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