2023-04-29 16:46:19 +00:00
|
|
|
{ lib, stdenv, fetchurl, coreutils, openjdk17, makeWrapper, autoPatchelfHook
|
2022-06-16 17:23:12 +00:00
|
|
|
, zlib, libzen, libmediainfo, curlWithGnuTls, libmms, glib
|
2023-07-15 17:15:38 +00:00
|
|
|
, genericUpdater, writeShellScript
|
2020-09-25 04:45:31 +00:00
|
|
|
}:
|
|
|
|
|
2023-04-29 16:46:19 +00:00
|
|
|
let
|
|
|
|
lanterna = fetchurl {
|
|
|
|
url = "https://search.maven.org/remotecontent?filepath=com/googlecode/lanterna/lanterna/3.1.1/lanterna-3.1.1.jar";
|
|
|
|
hash = "sha256-7zxCeXYW5v9ritnvkwRpPKdgSptCmkT3HJOaNgQHUmQ=";
|
|
|
|
};
|
2023-07-15 17:15:38 +00:00
|
|
|
in stdenv.mkDerivation (finalAttrs: {
|
2020-09-25 04:45:31 +00:00
|
|
|
pname = "filebot";
|
2024-04-21 15:54:59 +00:00
|
|
|
version = "5.1.3";
|
2020-09-25 04:45:31 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2023-10-09 19:29:22 +00:00
|
|
|
url = "https://web.archive.org/web/20230917142929/https://get.filebot.net/filebot/FileBot_${finalAttrs.version}/FileBot_${finalAttrs.version}-portable.tar.xz";
|
2024-04-21 15:54:59 +00:00
|
|
|
hash = "sha256-1TkCV3Cjg/5YZODceV5mQDsPYk09IU7+UHwPRwt2vAQ=";
|
2020-09-25 04:45:31 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
unpackPhase = "tar xvf $src";
|
|
|
|
|
|
|
|
nativeBuildInputs = [ makeWrapper autoPatchelfHook ];
|
|
|
|
|
|
|
|
buildInputs = [ zlib libzen libmediainfo curlWithGnuTls libmms glib ];
|
|
|
|
|
2023-04-29 16:46:19 +00:00
|
|
|
postPatch = ''
|
|
|
|
# replace lanterna.jar to be able to specify `com.googlecode.lanterna.terminal.UnixTerminal.sttyCommand`
|
|
|
|
cp ${lanterna} jar/lanterna.jar
|
|
|
|
'';
|
|
|
|
|
2020-09-25 04:45:31 +00:00
|
|
|
dontBuild = true;
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/opt $out/bin
|
|
|
|
# Since FileBot has dependencies on relative paths between files, all required files are copied to the same location as is.
|
|
|
|
cp -r filebot.sh lib/ jar/ $out/opt/
|
|
|
|
# Filebot writes to $APP_DATA, which fails due to read-only filesystem. Using current user .local directory instead.
|
|
|
|
substituteInPlace $out/opt/filebot.sh \
|
2020-11-03 02:18:15 +00:00
|
|
|
--replace 'APP_DATA="$FILEBOT_HOME/data/$(id -u)"' 'APP_DATA=''${XDG_DATA_HOME:-$HOME/.local/share}/filebot/data' \
|
2023-04-29 16:46:19 +00:00
|
|
|
--replace '$FILEBOT_HOME/data/.license' '$APP_DATA/.license' \
|
|
|
|
--replace '-jar "$FILEBOT_HOME/jar/filebot.jar"' '-Dcom.googlecode.lanterna.terminal.UnixTerminal.sttyCommand=${coreutils}/bin/stty -jar "$FILEBOT_HOME/jar/filebot.jar"'
|
2020-09-25 04:45:31 +00:00
|
|
|
wrapProgram $out/opt/filebot.sh \
|
2022-03-05 16:20:37 +00:00
|
|
|
--prefix PATH : ${lib.makeBinPath [ openjdk17 ]}
|
2020-09-25 04:45:31 +00:00
|
|
|
# Expose the binary in bin to make runnable.
|
|
|
|
ln -s $out/opt/filebot.sh $out/bin/filebot
|
|
|
|
'';
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
passthru.updateScript = genericUpdater {
|
|
|
|
versionLister = writeShellScript "filebot-versionLister" ''
|
|
|
|
curl -s https://www.filebot.net \
|
|
|
|
| sed -rne 's,^.*FileBot_([0-9]*\.[0-9]+\.[0-9]+)-portable.tar.xz.*,\1,p'
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-09-25 04:45:31 +00:00
|
|
|
description = "The ultimate TV and Movie Renamer";
|
|
|
|
longDescription = ''
|
|
|
|
FileBot is the ultimate tool for organizing and renaming your Movies, TV
|
|
|
|
Shows and Anime as well as fetching subtitles and artwork. It's smart and
|
|
|
|
just works.
|
|
|
|
'';
|
|
|
|
homepage = "https://filebot.net";
|
|
|
|
changelog = "https://www.filebot.net/forums/viewforum.php?f=7";
|
2022-06-26 10:26:21 +00:00
|
|
|
sourceProvenance = with sourceTypes; [
|
|
|
|
binaryBytecode
|
|
|
|
binaryNativeCode
|
|
|
|
];
|
2020-09-25 04:45:31 +00:00
|
|
|
license = licenses.unfreeRedistributable;
|
|
|
|
maintainers = with maintainers; [ gleber felschr ];
|
|
|
|
platforms = platforms.linux;
|
2024-01-02 11:29:13 +00:00
|
|
|
mainProgram = "filebot";
|
2020-09-25 04:45:31 +00:00
|
|
|
};
|
2023-07-15 17:15:38 +00:00
|
|
|
})
|