aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorInigoGutierrez <inigogf.95@gmail.com>2023-06-22 17:39:52 +0200
committerInigoGutierrez <inigogf.95@gmail.com>2023-06-22 17:39:52 +0200
commit8b922c1f00b7bd22f922b7169dab812595c9a031 (patch)
tree3d20074db5838fb0582ebecaad1f10b452cd8737
parent6ec0f9b2a2475d0bf39fc85b5dc38597d0df7542 (diff)
downloadscripts-8b922c1f00b7bd22f922b7169dab812595c9a031.tar.gz
scripts-8b922c1f00b7bd22f922b7169dab812595c9a031.zip
Created dominion scripts and updated docs.sh to not need a page number.
-rwxr-xr-xdocs.sh9
-rwxr-xr-xgames/dominion/showKingdom.sh42
-rwxr-xr-xscreenRecord.sh2
3 files changed, 51 insertions, 2 deletions
diff --git a/docs.sh b/docs.sh
index fefb2b8..5e59a39 100755
--- a/docs.sh
+++ b/docs.sh
@@ -16,8 +16,15 @@ referencesFile="$HOME/.config/zathura/refs"
lines="$(wc -l "$referencesFile")"
if reference="$(sed '/^#/d' "$referencesFile" | sed '/^\s*$/d' | cut -d# -f1 |
dmenu -l "$lines" -p "Reference: ")"; then
+
line="$(grep "$reference" "$referencesFile" | sed q)"
file="$(echo "$line" | cut -d# -f2)"
page="$(echo "$line" | cut -d# -f3)"
- zathura -P "$page" "$file" &
+
+ if [ -n "$page" ]; then
+ zathura -P "$page" "$file" &
+ else
+ zathura "$file" &
+ fi
+
fi
diff --git a/games/dominion/showKingdom.sh b/games/dominion/showKingdom.sh
new file mode 100755
index 0000000..e405867
--- /dev/null
+++ b/games/dominion/showKingdom.sh
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+# showKingdom.sh: Shows the images of a card list received as input
+#
+# Usage: showKingdom.sh
+
+scriptName="${0##*/}"
+
+usageMessage="Usage: ${scriptName}"
+
+error() {
+ printf '%s error: %s\n' "$scriptName" "$*" >&2
+}
+
+errorAndUsage() {
+ printf '%s error: %s\n%s\n' "$scriptName" "$*" "$usageMessage" >&2
+}
+
+outputDirBase='/tmp/showKingdom'
+outputDir="${outputDirBase}/$(date '+%y%m%d%H%M%S')"
+[ -d "$outputDir" ] || mkdir -p "$outputDir"
+
+counter=1
+
+while read -r card; do
+ name="$(echo "$card" | grep -Eo '[A-Za-z][A-Za-z ]*[A-Za-z]' | sed 's/ /_/g')"
+
+ # Avoid redownload if image exists already
+ existingFile="$(find "$outputDirBase" -name "${name}.jpg" | sed 1q)"
+ if [ -n "$existingFile" ]; then
+ if ! cp "$existingFile" "$outputDir"; then
+ # If copy fails, assume file exists and copy it with an appended counter
+ cp "$existingFile" "${outputDir}/${name}${counter}.jpg"
+ counter=$((counter+1))
+ fi
+ else
+ wget "https://robinzigmond.github.io/Dominion-app/images/card_images/${name}.jpg" --directory-prefix="$outputDir"
+ fi
+
+done
+
+sxiv -tb "$outputDir" &
diff --git a/screenRecord.sh b/screenRecord.sh
index 3aed794..7cb7c77 100755
--- a/screenRecord.sh
+++ b/screenRecord.sh
@@ -1,7 +1,7 @@
#!/bin/sh
markfile='/tmp/screenRec.mark'
-recsFolder="$HOME/videos/recs"
+recsFolder="$HOME/media/videos/recs"
# Check if already recording
[ -e "$markfile" ] && stopScreenRecord.sh && exit 0