Topic: Automatically copy music to Chumby One's flash card

Hi,

I realised I have a lot of unused flash space on my Chumby One, that I wanted to fill in some easy way. My idea was that when I inserted a usb stick with a folder named "Music" on root, it would automatically copy all music to the flash card and remove possible old music there. For this, I created the following script that I stored as /root/copymusic.sh

#!/bin/sh

FOLDER="Music"

if [ -d /mnt/usb/$FOLDER ]
then
 /usr/bin/btplay /root/startsound.wav
 rm -rf /mnt/storage/$FOLDER
 cp -dpR /mnt/usb/$FOLDER /mnt/storage/
 umount /mnt/usb
 /usr/bin/btplay /root/endsound.wav
fi

and added the following udev rule to /etc/udev/rules.d/98-copymusic.rules

SUBSYSTEMS=="usb", RUN+="/root/copymusic.sh"

I also borrowed Windows XP's "Hardware Insert.wav" and "Hardware Remove.wav" (they seemed appropriate) and put them as /root/startsound.wav and endsound.wav

Now, when I insert my usb stick, I get a ding-dong, the files are copied over and then I get a dong-ding and can remove the stick again. Success!  smile

Re: Automatically copy music to Chumby One's flash card

Great idea.  Worked like a charm!  Even w/ how crappy the current "my music files" player is, this makes it a little more likely I'll use it.

Linux Guy - Occasional Chumby Hacker

Re: Automatically copy music to Chumby One's flash card

I'd really love to try this on my Infocast 3.5" (I'm assuming it will work) since my junky flash drive seems to get hot and unmount after a while, but I have no idea how to check how much memory is left on my internal card, I know how to enable ssh and log in, I'm assuming there would be a semi-obvious command to check memory before I add these modification, could you please advise me? Thank you

Re: Automatically copy music to Chumby One's flash card

The command is "df".  To report in useful values, try "df -H".

Re: Automatically copy music to Chumby One's flash card

I like this idea but wouldn't you be better off rewriting the script with some checking to prevent you from using *ALL* extra memory for audio files, and checking the space avalible and used periodically while copying files to the device?... It be nice to have a hard limit where the script will stop/fail if it sees a set amount of space is left on the device..