dot

packages and services management
Log | Files | Refs | README

commit 0a98e3223c974bd567397fee1447e77abf3e0327
parent 6b2b3b0b14989aa2127baa2a67e6db14b232568c
Author: Josuah Demangeon <mail@josuah.net>
Date:   Mon,  1 Jan 2018 22:43:01 +0100

added mv-sane back (less dangerous version)

Diffstat:
Abin/34c3-stream | 76++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mbin/io | 11++++-------
Mbin/mblaze-filter | 2+-
Abin/mv-sane | 10++++++++++
Mbin/xdg-open | 9+++++++--
5 files changed, 98 insertions(+), 10 deletions(-)

diff --git a/bin/34c3-stream b/bin/34c3-stream @@ -0,0 +1,76 @@ +#!/bin/sh + +sformat="webm" +squality="hd" +mediaplayer="mpv --mute=yes" +translated="native" + +usage() { + printf "usage: %s [-t] [-f format] [-q quality] hall\n" \ + "$(basename "$1")" >&2 + exit 1 +} + +while getopts "f:q:t" opt; +do + case "$opt" in + f) + sformat="$OPTARG" + ;; + q) + squality="$OPTARG" + ;; + t) + translated="translated" + ;; + \?) + usage $0 + ;; + esac +done + +shift "$(($OPTIND - 1))" + +hall="$1" + +case "$hall" in +1|2|3|4) + ;; +*) + printf "There are only hall »1«, »2«, »3« and »4«.\n" >&2 + exit 1 + ;; +esac + +case "$squality" in +hd|sd|slides) + ;; +*) + printf "The quality has to be »sd«, »hd« or »slides«.\n" >&2 + exit 1 + ;; +esac + +webmbase="http://cdn.c3voc.de/s%s_%s_%s.webm" +hlsbase="http://cdn.c3voc.de/hls/s%s_%s_%s.m3u8" +audiobase="http://cdn.c3voc.de/s%s_%s.%s" + +slink="" +case "$sformat" in +webm) + slink="$(printf "$webmbase" "${hall}" "${translated}" "${squality}")" + ;; +m3u8|hls) + slink="$(printf "$hlsbase" "${hall}" "${translated}" "${squality}")" + ;; +mp3|opus) + slink="$(printf "$audiobase" "${hall}" "${translated}" "${sformat}")" + ;; +*) + printf "Only the stream formats »webm«, »hls«, »opus« and »mp3« are available.\n" >&2 + exit 1 + ;; +esac + +http_proxy= https_proxy= $mediaplayer "$slink" + diff --git a/bin/io b/bin/io @@ -11,11 +11,8 @@ case $PWD in ($HOME/*) sort > "$cache/$dir" esac -exec xdg-open "$(iomenu -# << EOF | cut -f 2 -$(find "$HOME" -maxdepth 1 -mindepth 1 | sort | cut -c $((${#HOME} + 2))- | - xargs -I {} printf '%s/%s\n' "$cache" {} | - xargs -I {} cat "$cache" {} 2> /dev/null) -#------------------------------------------------------------------------------- -$(cat "$HOME/etc/lib/uri") -EOF +exec xdg-open "$(find "$HOME" -maxdepth 1 -mindepth 1 | sort | + cut -c $((${#HOME} + 2))- | xargs -I {} printf '%s/%s\n' "$cache" {} | + xargs -I {} cat "$cache" {} 2> /dev/null | cat - "$HOME/etc/lib/uri" | + iomenu -# | cut -f 2- )" diff --git a/bin/mblaze-filter b/bin/mblaze-filter @@ -1,7 +1,6 @@ #!/bin/sh # read and filter mails using mblaze -mpop minc "$MAILDIR/INBOX" > /dev/null while read -r dir test @@ -61,6 +60,7 @@ transports "From" ~~~ "*megabus*" transports "From" ~~~ "*ouibus*" transports "From" ~~~ "*ouigo*" transports "From" ~~~ "*sncf.com*" +transports "From" ~~~ "*oui.sncf*" univ-rennes1.fr "List-Id" ~~~ "*univ-rennes1.fr*" wordpress.com "From" ~~~ "*wordpress.com*" yammer.com "From" ~~~ "*yammer.com*" diff --git a/bin/mv-sane b/bin/mv-sane @@ -0,0 +1,10 @@ +#!/bin/sh +# Remove evil characters + +find . -mindepth 1 | while IFS='' read -r path +do + + mv "$path" "$(dirname "$path")/$(basename "$path" | + tr '\t #&;*?<>|"()[]{}\\-=+'\' _ | + sed -e 's/__*/_/g' -e 's/^_//' -e 's/_$//')" +done diff --git a/bin/xdg-open b/bin/xdg-open @@ -77,8 +77,8 @@ case $scheme in (http|https) case $host in (vimeo.com|*youtube.com|*youtu.be) - mkdir -p "$HOME/lib/video/$host" - cd "$HOME/lib/video/$host" + mkdir -p "$HOME/lib/http/video/$host" + cd "$HOME/lib/http/video/$host" exec youtube-dl "$1" ;; (*bandcamp.com) @@ -108,6 +108,11 @@ case $scheme in curl -Lo "$HOME/lib/http/video/$host/${path##*/}" "$1" exec "$0" "$HOME/lib/http/video/$host/${path##*/}" ;; + (*.pdf|*.ps) + mkdir -p "$HOME/lib/http/doc" + curl -Lo "$HOME/lib/http/doc/${path##*/}" "$1" + exec "$0" "$HOME/lib/http/doc/${path##*/}" + ;; (*.txt) mkdir -p "$HOME/lib/http/text/$host" curl -Lo "$HOME/lib/http/text/$host/${path##*/}" "$1"