zenUtils/rezonate.sh

29 lines
586 B
Bash
Raw Permalink Normal View History

2024-10-17 16:03:04 +00:00
#!/bin/sh
urldecode(){
echo "$1" | perl -pe 's/\+/\ /g;' -e 's/%(..)/chr(hex($1))/eg;'
}
if [ -z "$2" ]; then
echo "usage: $0 PLIST DEST"
echo " dumps the local files from the audacious playlist PLIST to the connected android device's filesystem at DEST"
exit 1
fi
plist=$1
dest=$2
if [ ! -f "${plist}" ]; then
echo "playlist doesn't exist!"
exit 2
fi
if ! adb shell "test -d ${dest}"; then
echo "dest doesn't exist or the device isn't properly connected!"
exit 3
fi
for f in $(grep ^uri= $1 | awk -Ffile:// '{print $2}'); do
adb push "$(urldecode $f)" $2
done