Updates
This commit is contained in:
62
.local/bin/fa_dd_download
Executable file
62
.local/bin/fa_dd_download
Executable file
@@ -0,0 +1,62 @@
|
||||
#! /bin/zsh
|
||||
|
||||
target_dir="/home/chris/.local/share/Dungeondraft/asset_packs"
|
||||
download_dir="/home/chris/Downloads"
|
||||
|
||||
for file in $download_dir/FA_(Objects|Textures)_*.zip; do
|
||||
dir=$(mktemp -d)
|
||||
unzip -qq $file -d $dir
|
||||
|
||||
extracted=$(find "$dir" -type f -name "*.dungeondraft_pack")
|
||||
|
||||
if [[ -z "$extracted" ]]; then
|
||||
echo "No .dungeondraft_pack file found in the ZIP."
|
||||
rm -rf "$dir"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Extracted file: $extracted"
|
||||
|
||||
# Extract the version number from the filename
|
||||
file=$(basename "$extracted")
|
||||
basename=$(echo "$file" | grep -oP '^FA_[^_]+_[^_]+')
|
||||
version_rx="v([0-9]+\.[0-9]+)"
|
||||
if [[ "$file" =~ v([0-9]+\.[0-9]+) ]]; then
|
||||
new_version=${match[1]}
|
||||
else
|
||||
echo "Could not extract version number from filename."
|
||||
rm -rf "$fir"
|
||||
continue
|
||||
fi
|
||||
|
||||
echo "New version detected: $new_version"
|
||||
|
||||
# Check for an existing file in the target directory
|
||||
existing=$(ls "$target_dir"/"${basename}"_v*.dungeondraft_pack 2>/dev/null | head -n 1)
|
||||
|
||||
if [[ -n "$existing" ]]; then
|
||||
existing_filename=$(basename "$existing")
|
||||
if [[ "$existing_filename" =~ v([0-9]+\.[0-9]+) ]]; then
|
||||
existing_version=${match[1]}
|
||||
fi
|
||||
|
||||
echo "Existing file found: $existing_filename (Version: $existing_version)"
|
||||
|
||||
if [[ "$existing_version" == "$new_version" ]]; then
|
||||
echo "Same version already exists. No action taken."
|
||||
rm -rf "$dir"
|
||||
exit 0
|
||||
else
|
||||
echo "Different version detected. Removing old version."
|
||||
rm -f "$existing"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Move the new file to the target directory
|
||||
mv "$extracted" "$target_dir"
|
||||
|
||||
echo "File moved to $target_dir: $filename"
|
||||
|
||||
# Clean up
|
||||
rm -rf "$dir"
|
||||
done
|
||||
@@ -3,7 +3,8 @@
|
||||
target_dir="/home/chris/Foundry/FA"
|
||||
download_dir="/home/chris/Downloads"
|
||||
|
||||
for file in $download_dir/(FA_|Creature_Tokens)*.zip; do
|
||||
for file in $download_dir/(Creature_Tokens|Adversaries_|Epic_Creatures_)*.zip; do
|
||||
echo "Unzipping ${file}"
|
||||
dir=$(mktemp -d)
|
||||
unzip -qq $file -d $dir
|
||||
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
#! /bin/bash
|
||||
|
||||
notebook="$(joplin ls / --sort updated_time | dmenu -i -l 30)"
|
||||
|
||||
[ -z "$notebook" ] && exit 1;
|
||||
|
||||
joplin use "$notebook"
|
||||
|
||||
joplin
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
#! /bin/bash
|
||||
|
||||
notebook="$(joplin ls / --sort updated_time | dmenu -i -l 30)"
|
||||
|
||||
[ -z "$notebook" ] && exit 1;
|
||||
|
||||
joplin use "$notebook"
|
||||
|
||||
notes="$(joplin ls --sort updated_time --long)"
|
||||
|
||||
index="$(echo "$notes" | cut -d" " -f4- | dmenu -n -ix -i -l 30 || exit 1)"
|
||||
|
||||
[ -z "$index" ] && exit 1;
|
||||
|
||||
line="$(($index + 1))"
|
||||
|
||||
id="$(echo "$notes" | sed "${line}q;d")"
|
||||
|
||||
echo "$id"
|
||||
|
||||
joplin edit "$id"
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
if echo "$1" | grep "https*://\S\+\.[A-Za-z]\+\S*" >/dev/null; then
|
||||
url="$1"
|
||||
else
|
||||
url="$(grep -Eom1 '<[^>]+(rel="self"|application/[a-z]+\+xml)[^>]+>' "$1" |
|
||||
sed -E 's_^.*href="(https?://[^"]+)".*$_\1_')"
|
||||
|
||||
! grep "https*://\S\+\.[A-Za-z]\+\S*" <<<"$url" &&
|
||||
notify-send "That doesn't look like a full URL." && exit 1
|
||||
fi
|
||||
|
||||
RSSFILE="${XDG_CONFIG_HOME:-$HOME/.config}/newsboat/urls"
|
||||
if awk '{print $1}' "$RSSFILE" | grep "^$url$" >/dev/null; then
|
||||
notify-send "You already have this RSS feed."
|
||||
else
|
||||
echo "$url" >> "$RSSFILE" && notify-send "RSS feed added."
|
||||
fi
|
||||
Reference in New Issue
Block a user