diff --git a/flake.nix b/flake.nix index 6bd6519..0e914f1 100644 --- a/flake.nix +++ b/flake.nix @@ -2,7 +2,7 @@ description = "Nix flake for the activity logging script"; inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05"; - sudoku-solver.url = "path:./src/sudoku-hs"; + # sudoku-solver.url = "path:./src/sudoku-hs"; }; outputs = { nixpkgs, ... }@inputs: @@ -48,7 +48,7 @@ citra = pkgs.callPackage ./pkgs/citra/default.nix { branch = "nightly"; }; pano = pkgs.callPackage ./pkgs/pano/default.nix { }; vdhcoapp = pkgs.callPackage ./pkgs/vdhcoapp/default.nix { }; - sudoku-solver = inputs.sudoku-solver.packages.${system}.default; + # sudoku-solver = inputs.sudoku-solver.packages.${system}.default; } // generatePackages { dir = "pkgs"; diff --git a/src/scripts/generate-gallery-index.sh b/src/scripts/generate-gallery-index.sh new file mode 100644 index 0000000..5287d10 --- /dev/null +++ b/src/scripts/generate-gallery-index.sh @@ -0,0 +1,45 @@ +#! /usr/bin/env nix-shell +#! nix-shell -i bash -p bash fd + +SOURCE_DIR="/srv/pool/scrapping/JawZ/gallery-dl/" +OUTPUT_DIR="/var/www/gallery" +PREVIEW_COUNT=24 + +mkdir -p "$OUTPUT_DIR" +cd "$SOURCE_DIR" || exit 1 + +while IFS= read -r dir; do + artist_name="${dir%/}" + artist_output="$OUTPUT_DIR/$artist_name" + mkdir -p "$artist_output/.preview" + + # Clean any previous preview + rm -rf "$artist_output/.preview"/* + fd . "$dir" --maxdepth 1 -tf -e jpg -e jpeg -e png | + shuf -n "$PREVIEW_COUNT" | + while read -r img; do + cp "$img" "$artist_output/.preview/" + done + + # Generate index.html for the artist + { + echo "$artist_name" + echo "" + echo "

$artist_name

" + for img in "$artist_output/.preview/"*; do + img_name="$(basename "$img")" + echo "" + done + echo "

Back to index

" + } >"$artist_output/index.html" +done < <(fd . -td) + +# Generate master index.html +{ + echo "Gallery Index

Gallery Index

" +} >"$OUTPUT_DIR/index.html" diff --git a/src/scripts/split-gallery-videos.sh b/src/scripts/split-gallery-videos.sh index 4e5b237..8ee7c2a 100644 --- a/src/scripts/split-gallery-videos.sh +++ b/src/scripts/split-gallery-videos.sh @@ -2,8 +2,8 @@ #! nix-shell -i bash -p bash # Source and destination directories -SRC_DIR="/srv/server/pool/scrapping/JawZ/gallery-dl" -DEST_DIR="/srv/server/pool/scrapping/JawZ/videos-dl" +SRC_DIR="/srv/pool/scrapping/JawZ/gallery-dl" +DEST_DIR="/srv/pool/scrapping/JawZ/videos-dl" # Create destination directory if it doesn't exist mkdir -p "$DEST_DIR" diff --git a/src/scripts/sync-keep.sh b/src/scripts/sync-keep.sh new file mode 100755 index 0000000..7984c9b --- /dev/null +++ b/src/scripts/sync-keep.sh @@ -0,0 +1,46 @@ +#!/etc/profiles/per-user/jawz/bin/bash + +KEEP_DIR="/srv/pool/scrapping/JawZ/keep" +SOURCE_DIR="/srv/pool/scrapping/JawZ/gallery-dl" + +shopt -s globstar nullglob + +cd "$KEEP_DIR" || exit 1 + +for keep_path in **/; do + relative_path="${keep_path%/}" + src_path="$SOURCE_DIR/$relative_path" + dest_path="$KEEP_DIR/$relative_path" + + if [ ! -d "$src_path" ]; then + continue + fi + + echo "Processing: $relative_path" + mkdir -p "$dest_path" + + for src_file in "$src_path"/*; do + filename="$(basename "$src_file")" + dest_file="$dest_path/$filename" + + if [ ! -f "$src_file" ]; then + continue + fi + + if [ ! -f "$dest_file" ]; then + mv "$src_file" "$dest_file" + echo "→ Moved: $filename" + continue + fi + + if cmp -s "$src_file" "$dest_file"; then + echo "✓ Duplicate: $filename — deleting source" + rm "$src_file" + continue + fi + + echo "⚠ Conflict (not identical): $filename" + done +done + +fd . "$SOURCE_DIR" -td -te -x rmdir {} \;