|
Rockbox mail archiveSubject: bash-script: automatic upload of new files to archos/rockboxbash-script: automatic upload of new files to archos/rockbox
From: Christian Folini <christian.folini_at_unifr.ch>
Date: Sat, 21 Sep 2002 11:35:57 +0200 Hi, i do a lot of radio streaming. Since i do not want to bother with copying the files to my archos, i wrote the following script which might be of use for someone. I run it once a minute as a cronjob and simply attach my archos to the computer once a day for a certain time. Christian P.S. I am looking forward to file-management in 2.0, as the ability to remove/delete a radiostream-file i have listened to would be more fun. Including that, rockbox is a great project. ------ #! /bin/bash # Put daily updated files on the archos Player # christian.folini_at_unifr.ch # This file is not exactly proper, but you can easily # adapt it to your needs. export TRUE=-1 export FALSE=0 export VERBOSE=$FALSE export DEBUG=$FALSE export LOCK=/tmp/archos-lock function vprint { # print if verbose is set if [ $VERBOSE -eq $TRUE ]; then echo $1 fi } function upload { wavp ~/data/beep.wav > /dev/null mount /mnt/archos vprint "archos mounted" cp -v /archive/mp3/rawstreams/*.mp3 /mnt/archos/actual vprint "all files copied." mv /archive/mp3/rawstreams/*.mp3 /archive/mp3/rawstreams/transferred vprint "all files on server moved to directory transferred." umount /mnt/archos vprint "archos unmounted" wavp ~/data/beep.wav > /dev/null } export FILES=`ls -1 /archive/mp3/rawstreams/*.mp3 2>/dev/null` export ARCHOSMOUNT=`mount 2>&1 | grep "sda1"` export ARCHOS=`/usr/sbin/lsusb -t 2>&1 | grep "Vendor 0x05ab Product 0x0060"` if [ ! "$FILES" ]; then vprint "No new files found. Aborting." exit fi if [ "$ARCHOSMOUNT" ]; then vprint "Archos already mounted. Aborting." exit fi if [ "$ARCHOS" ]; then vprint "Archos present." if [ -e $LOCK ]; then vprint "Archos lockfile found. Aborting." exit fi touch $LOCK upload rm $LOCK else vprint "Archos not present. Aborting." fi exit for opt in $_at_; do case $opt in "") echo "none.";; -d) export DEBUG=$TRUE;; -v) export VERBOSE=$TRUE;; esac done Received on 2002-09-21 Page template was last modified "Tue Sep 7 00:00:02 2021" The Rockbox Crew -- Privacy Policy |