diff options
Diffstat (limited to 'util')
| -rwxr-xr-x | util/dpath | 5 | ||||
| -rwxr-xr-x | util/hpath | 11 | ||||
| -rwxr-xr-x | util/menu/deasy | 12 | ||||
| -rwxr-xr-x | util/menu/deasy-core | 10 | ||||
| -rwxr-xr-x | util/notify | 6 | ||||
| -rwxr-xr-x | util/verify/cbd-core | 25 | ||||
| -rwxr-xr-x | util/verify/cbd-https | 8 | ||||
| -rwxr-xr-x | util/verify/cbd-magnet | 8 |
8 files changed, 85 insertions, 0 deletions
diff --git a/util/dpath b/util/dpath new file mode 100755 index 0000000..e981068 --- /dev/null +++ b/util/dpath @@ -0,0 +1,5 @@ +#! /bin/bash + +DPATH="$HOME/Downloads" +[ -d "$DPATH" ] || mkdir -p "$DPATH" + diff --git a/util/hpath b/util/hpath new file mode 100755 index 0000000..c8362aa --- /dev/null +++ b/util/hpath @@ -0,0 +1,11 @@ +#! /bin/bash + +histdir() { + CACHEDIR="$HOME/.cache/EZown" + [ -d "$CACHEDIR" ] || mkdir -p "$CACHEDIR" + + echo "$CACHEDIR" +} + +HPATH="$(histdir)/History" + diff --git a/util/menu/deasy b/util/menu/deasy new file mode 100755 index 0000000..a63fa74 --- /dev/null +++ b/util/menu/deasy @@ -0,0 +1,12 @@ +#! /bin/bash + +deasy() { + source ./util/menu/deasy-core + + [ ! -z "$1" ] && query="$1" \ + || query="$(deasy_core "$2")" + [ -z "$query" ] && kill -15 $$ + + echo "$query" +} + diff --git a/util/menu/deasy-core b/util/menu/deasy-core new file mode 100755 index 0000000..36e88d3 --- /dev/null +++ b/util/menu/deasy-core @@ -0,0 +1,10 @@ +#! /bin/bash + +deasy_core() { + echo "$(: | dmenu -p "$1:" \ + -nb '#ffffff' \ + -nf '#000080' \ + -sb '#000080' \ + -sf '#ffffff')" +} + diff --git a/util/notify b/util/notify new file mode 100755 index 0000000..a7a7e6c --- /dev/null +++ b/util/notify @@ -0,0 +1,6 @@ +#! /bin/bash + +notify() { + notify-send -t 4000 -i "$HOME/.icons/EZown.png" "$1 — Try Again!" +} + diff --git a/util/verify/cbd-core b/util/verify/cbd-core new file mode 100755 index 0000000..99dcbde --- /dev/null +++ b/util/verify/cbd-core @@ -0,0 +1,25 @@ +#! /bin/bash + +source ./util/notify +source ./util/hpath + +get_cbd() { + echo "$(xclip -o)" +} + +end_script() { + notify "$1" + kill -15 $$ +} + +url_pattern_match() { + [[ "$1" != "$2"* ]] && end_script "$3" \ + || echo "$1" >> "$HPATH" +} + +url_pattern_match_cbd() { + [ -z "$3" ] && cbd="$(get_cbd)" || cbd="$3" + url_pattern_match "$cbd" "$1" "$2" + echo "$cbd" +} + diff --git a/util/verify/cbd-https b/util/verify/cbd-https new file mode 100755 index 0000000..4eefc8b --- /dev/null +++ b/util/verify/cbd-https @@ -0,0 +1,8 @@ +#! /bin/bash + +source ./util/verify/cbd-core + +is_https_url_cbd() { + echo "$(url_pattern_match_cbd 'https://' 'Invalid URL' "$1")" +} + diff --git a/util/verify/cbd-magnet b/util/verify/cbd-magnet new file mode 100755 index 0000000..837bf87 --- /dev/null +++ b/util/verify/cbd-magnet @@ -0,0 +1,8 @@ +#! /bin/bash + +source ./util/verify/cbd-core + +is_magnet_url_cbd() { + echo "$(url_pattern_match_cbd 'magnet:?xt=urn:btih:' 'Invalid Magnet URL' "$1")" +} + |
