This commit is contained in:
parent
a9e3ec7ada
commit
777e9a6a4c
3 changed files with 29 additions and 0 deletions
|
@ -14,6 +14,7 @@
|
|||
};
|
||||
|
||||
home.packages = with pkgs; [
|
||||
import-to-jellyfin
|
||||
vix
|
||||
yt-dlp
|
||||
];
|
||||
|
|
|
@ -16,6 +16,7 @@ in
|
|||
get-tags = callPackage ./get-tags.nix { };
|
||||
git-exclude = callPackage ./git-exclude.nix { };
|
||||
git-graph = callPackage ./git-graph.nix { };
|
||||
import-to-jellyfin = callPackage ./import-to-jellyfin.nix { };
|
||||
mounter = callPackage ./mounter.nix { };
|
||||
move-firefox-screenshots = callPackage ./move-firefox-screenshots.nix { };
|
||||
notes = callPackage ./notes { };
|
||||
|
|
27
packages/import-to-jellyfin.nix
Normal file
27
packages/import-to-jellyfin.nix
Normal file
|
@ -0,0 +1,27 @@
|
|||
{ pkgs }:
|
||||
|
||||
pkgs.writeShellApplication {
|
||||
name = "import-to-jellyfin";
|
||||
|
||||
runtimeInputs = with pkgs; [ coreutils ];
|
||||
|
||||
text = ''
|
||||
source_path="/home/opdavies/import"
|
||||
|
||||
mapfile -t files < <(find "$source_path" -type f -name "*.mp4")
|
||||
|
||||
for filepath in "''${files[@]}"; do
|
||||
echo "Moving $filepath..."
|
||||
|
||||
filename="$(basename "$filepath")"
|
||||
filename_without_extension="''${filename%.mp4}"
|
||||
|
||||
destination_path="/mnt/media/jellyfin/Movies/$filename_without_extension"
|
||||
mkdir -p "$destination_path"
|
||||
|
||||
mv "$source_path/$filename" "$destination_path"
|
||||
done
|
||||
|
||||
chown -R jellyfin:media /mnt/media/jellyfin
|
||||
'';
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue