2022-10-30 15:09:59 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, makeWrapper
|
|
|
|
, python3Packages
|
|
|
|
, perl
|
|
|
|
, zip
|
|
|
|
, gitMinimal
|
|
|
|
, ffmpeg
|
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
inherit (python3Packages)
|
2023-11-16 04:20:00 +00:00
|
|
|
python pytest nose3 cryptography pyyaml requests mock requests-mock
|
2021-09-18 10:52:07 +00:00
|
|
|
python-dateutil setuptools;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-06-24 18:47:55 +00:00
|
|
|
version = "4.89";
|
2022-10-30 15:09:59 +00:00
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "svtplay-dl";
|
2022-10-30 15:09:59 +00:00
|
|
|
inherit version;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "spaam";
|
|
|
|
repo = "svtplay-dl";
|
|
|
|
rev = version;
|
2024-06-24 18:47:55 +00:00
|
|
|
hash = "sha256-EuLXDbJembiFFEuIihrc8KkdqxLBgT4Ib3xwkKibVS8=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-04-08 16:26:57 +00:00
|
|
|
pythonPaths = [ cryptography pyyaml requests ];
|
2021-09-18 10:52:07 +00:00
|
|
|
buildInputs = [ python perl python-dateutil setuptools ] ++ pythonPaths;
|
2021-03-09 03:18:52 +00:00
|
|
|
nativeBuildInputs = [ gitMinimal zip makeWrapper ];
|
2023-11-16 04:20:00 +00:00
|
|
|
nativeCheckInputs = [ nose3 pytest mock requests-mock ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace scripts/run-tests.sh \
|
|
|
|
--replace 'PYTHONPATH=lib' 'PYTHONPATH=lib:$PYTHONPATH'
|
2020-10-07 09:15:18 +00:00
|
|
|
|
|
|
|
sed -i '/def test_sublang2\?(/ i\ @unittest.skip("accesses network")' \
|
|
|
|
lib/svtplay_dl/tests/test_postprocess.py
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
makeFlags = [ "PREFIX=$(out)" "SYSCONFDIR=$(out)/etc" "PYTHON=${python.interpreter}" ];
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
wrapProgram "$out/bin/svtplay-dl" \
|
2020-11-24 20:58:05 +00:00
|
|
|
--prefix PATH : "${ffmpeg}" \
|
2020-04-24 23:36:52 +00:00
|
|
|
--prefix PYTHONPATH : "$PYTHONPATH"
|
|
|
|
'';
|
|
|
|
|
2024-07-27 06:49:29 +00:00
|
|
|
doCheck = python3Packages.pythonOlder "3.12";
|
2020-04-24 23:36:52 +00:00
|
|
|
checkPhase = ''
|
2024-07-27 06:49:29 +00:00
|
|
|
runHook preCheck
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
sh scripts/run-tests.sh -2
|
2024-07-27 06:49:29 +00:00
|
|
|
|
|
|
|
runHook postCheck
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2021-07-14 22:03:04 +00:00
|
|
|
doInstallCheck = true;
|
|
|
|
installCheckPhase = ''
|
|
|
|
runHook preInstallCheck
|
|
|
|
$out/bin/svtplay-dl --help > /dev/null
|
|
|
|
runHook postInstallCheck
|
|
|
|
'';
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://github.com/spaam/svtplay-dl";
|
|
|
|
description = "Command-line tool to download videos from svtplay.se and other sites";
|
|
|
|
license = licenses.mit;
|
2021-01-15 22:18:51 +00:00
|
|
|
platforms = lib.platforms.unix;
|
2024-01-02 11:29:13 +00:00
|
|
|
mainProgram = "svtplay-dl";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|