~smlavine/scripts

8ec12e5ae617f4262b1ee630a7bc1a4cc4d31bff — Sebastian LaVine 4 months ago d01b5e6
Shorten lines to less than 80 chars
3 files changed, 9 insertions(+), 8 deletions(-)

M src/musicsum
M src/pausemusic
M src/watchyt
M src/musicsum => src/musicsum +4 -3
@@ 6,7 6,8 @@
# Description: Sums the length of given audio files.
# Arguments:   Audio files to sum the duration of

mediainfo "$@" | \
	grep Duration | tr -s ' ' | cut -d' ' -f'3,5' | \
mediainfo "$@" |
	grep Duration | tr -s ' ' | cut -d' ' -f'3,5' |
	awk 'NR % 2 != 1 { sum += $2; sum += $1*60 }
	END { printf "%dh%dm%ds\n", sum / (60*60), sum % (60*60) / 60, sum % 60 } '
	END { printf "%dh%dm%ds\n",
		sum / (60*60), sum % (60*60) / 60, sum % 60 }'

M src/pausemusic => src/pausemusic +2 -2
@@ 3,8 3,8 @@
# Licensed under the MIT license. See MIT.txt for details.
#
# File:        pausemusic
# Description: Toggles music playback, if music is playing in either pianobar or
#              cmus. 
# Description: Toggles music playback, if music is playing in either pianobar
#              or cmus.

pidof cmus && cmus-remote -u
pidof pianobar && printf ' ' > ~/.config/pianobar/ctl

M src/watchyt => src/watchyt +3 -3
@@ 27,9 27,9 @@ shift $((OPTIND - 1))
# if there isn't already a url and there is no argument, get a url through a
# dmenu prompt.
if [ "$url" ]; then
	# if there is already a url, then it came from the xclip clipboard. Firefox
	# removes text clipped from it if it closes, so re-write url to the xclip
	# clipboard to counteract this.
	# if there is already a url, then it came from the xclip clipboard.
	# Firefox removes text clipped from it if it closes, so re-write url to
	# the xclip clipboard to counteract this.
	printf "%s" "$url" | xclip -selection c -i
else
	if [ "$#" -eq 0 ]; then