Sunday, May 30, 2010

Syncing your music at home with Android

I was a bit tired to use always a cable for syncing music inside my home pc with my phone, even more to continue hearing the same music all the days on the tram or the bike because I forgot to plug the cable, mount and cp the files.
Using an Android G1/Dream phone, I've been able to synchronize music and other files on the fly while arriving home via wifi and an encrypted connection.

First I thought to try scp and control the access time of the files to synchronize, but then I thought that rsync would do a better job, so I went for installing CyanogenMod 5.0.7 that it is and Android 2.1 (Eclair) with our great rsync.

Once done the dirty job, I installed ASE scripting for Android, and from there I started my little one liner script.

We can also create dsa and rsa keys in our android device, for that just open a terminal and write:

$ su 

# dropbear-keygen

just in case we want to do password-less sync. If you want to show the rsa key from your phone do:
dropbearkey -y -f /data/dropbear/dropbear_rsa_host_key
More information about ssh at

Finally create a new shell script for ASE scripting with something like: (note the non default ssh port if you use something different than 22)
su -c "rsync -av --partial --stats --progress --delete --rsh='ssh -p1234' 

dani@my_ip:/media/Music/android/ /sdcard/Music"
Add a new launcher on the phone's desktop and you're all set. If apart from wifi, you also use 3G and one gps locale application, the possibilities for sync your music are almost infinite.

2 comments:

Vicente said...

Máquina, este post pinta muy bien eso de sincronizar tu musica via wifi, pero supongo que tienes que ser root y movidas a las que todavia no llego.
Espero que puedas entender mis palabras, o ¿se te ha olvidado el español? No pasa nada es uno de los problemas de ser un cosmopolita como tú. Un abrazo.

Dani said...

La verdad no sé si es necesario ser root en el telefono, para poder sincronizar via wifi. En mi caso si soy root, pero no debería ser necesario, la manera más sencilla de comprobarlo, es abrir el programa "terminal" y ejecutar el comando rsync y ver que te dice el telefono.

 

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.