[ Pobierz całość w formacie PDF ]
07 # Test player is mounted and folder podcasts exists
08 [ ! -d $mp3player/ ] && echo "mp3 player not mounted" && exit 1
09 [ ! -d $mp3player/podcasts ] && echo "Device folder podcasts not present" && exit 1
10 # Perform the synchronisation process
11 rsync -r --progress --delete --existing --size-only $mp3player/podcasts/ $podmirror/
12 mv $podin/* $podmirror/
13 rsync -r --progress --delete --size-only $podmirror/ $mp3player/podcasts
To automatically run this script when new podcasts arrive, you can set iPodder to call it by specifying
syncplayer in the option to run scripts on download (File/Preferences/Advanced).
If you are using bashpodder, you just need to add a line to to the end of bashpodder.shell, either by editing it
or by simply typing echo "/path/to/syncplayer" >> bashpodder.shell. (Be careful to type >> not > in order to
append rather than overwrite the file.)
If you want to automatically run the script on insertion of your player, you can take advantage of hotplug to
trigger it.
Find the vendor id and product id for the device by plugging it in and checking the output of cat
/proc/bus/usb/devices for the relevant details of your mp3 player.
For my PowerMusic player, the following section is relevant:
P: Vendor=0d7d ProdID=0153 Rev= 1.00
Audio Delivery 6
S: Product=PowerMusic
Now create /etc/hotplug/usb/powermusic.usermap to trigger a script we'll call on_plug_powermusic to run
when the device is plugged in:
# /etc/hotplug/usb/powermusic.usermap
# powermusic mp3 player
on_plug_powermusic 0x0003 0x0d7d 0x0153 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0
The first field labels which flags to match. This field should be left as 0x0003. The second and third field are
the vendor id and product id, respectively, that we obtained from /proc/usb/devices. The other fields are not
used so they can be left as 0x0.
Next we need to create on_plug_powermusic in /etc/hotplug/usb/
# /etc/hotplug/usb/on_plug_powermusic
# on_plug_powermusic
until [ -e /path/to/mp3player ];do sleep 1; done
su user -c /path/to/syncplayer>& /var/log/messages
exit 0
Change user in line 3 to your user name and fill in both cases of /path/to/. Make the file executable, then
restart hotplug:
chmod +x on_plug_powermusic && /etc/init.d/boot.hotplug restart
Now, whenever you plug the device in, the syncplayer script is triggered, transferring any new podcasts to
your mp3 player. Just remember to unmount it when it is done.
INFO
[1] IT Conversations: http://www.itconversations.com/
[2] Adam Curry's Website:http://live.curry.com/
[3] RSS Payloads: http://www.thetwowayweb.com/payloadsforrss
[4] iPodder: http://ipodder.org/
[5] GNUpod: http://www.gnu.org/software/gnupod/gnupod.html
[6] gtkpod: http://gtkpod.sourceforge.net/
[7] iPodder: http://ipodder.sourceforge.net/index.php
[8] jPodder: http://jpodder.com/
[9] Azureus: http://azureus.sourceforge.net/
[10] BashPodder: http://linc.homeunix.org:8080/scripts/bashpodder/
[11] BFConf: http://www.leonscape.co.uk/linux/bpconf/
[12] rsync homepage: http://freshmeat.net/projects/rsync/
Audio Delivery 7
[ Pobierz całość w formacie PDF ]