How to Import Playlists into the G1

Music playlists on my T-Mobile G1 (with the Android operating system) are a little mysterious.  I'm okay with having to poke around a little, but I'm pretty sure most G1 users just want it to work.  And, most don't know Unix in the way that I do; I'm by no means an expert, but I'm comfortable.

Having said that, here's a little information about how I was able to take a playlist from Banshee and import it into my phone.

I have about 600 songs in Banshee, and they are divided into playlists. Banshee works how I expect it to, and I like it a million times better than iTunes, but most people will probably disagree.  iTunes makes music management easy for a lot of people.  I hated it.  The playlists exported from Banshee almost work as-is with the G1 -- it's closer than any of the other Linux-based music players at least.

Get a Banshee Playlist onto your Phone

  1. Plug the phone in via the USB cable. On the phone a USB icon will appear in the status bar, swipe it, tap it and choose "mount".  Now your computer (me: OpenSuse) should show it as a drive.  I copy songs to the Music folder on there.
  2. In Banshee, right-click your playlist, choose Export, and navigate to the phone (on my OpenSuse & Ubuntu systems, this in /media, usually "disk" or "disk-1" if you already have a flash drive or something attached).  This is the SD card, BTW, not the phone itself.
  3. Save the playlist.

Now, the problem with Banshee is that it saves absolute paths to the songs as seen to Banshee on the home file system.  Here's an example:

/home/ha17/Phone_Music/Song Title.mp3

The problem with that absolute path is that when it's run via the phone's music player, none of the songs can be found.  The file system is different.

What you need to do, is make each path look like

Song Title.mp3

(if you're music is in the phone's Music directory)

Apparently the music player starts in SDCard/Music as it's working directory.

You also need to put all playlists (with the .m3u extension) into that SDCard/Music folder or they won't be found.

Here's a php script you can run from the command line to build the m3u files.  The script also rsync's the files over at the end, so make sure you edit the variables on the first few lines and know what you are doing.

 
#!/usr/bin/php -q
<?php
 
/**
 * Change these to configure
 */
 
$local_music_path = '/home/ha17/Phone_Music';
$phone_music_path = '/media/disk-1/Music/';
 
$find = `which find`; $find = trim ( $find );
 
/**
 * Simple script to locate all of your mp3 (add ogg if you need to)
 * and create an Android-friendly playlist from them
 *
 * The problem is programs like Banshee save the full path to the file
 * when you export the playlist.  Once you get it on the phone, it's invalid
 *
 * The playlist will only be found if it's IN ~/Music!
 *
 */
 
// all music
chdir ( $local_music_path );
$exec = "$find . -iname \"*.mp3\" -print|grep -v Podcast";
 
$e_res = array ();
exec ( $exec, $e_res );
 
$fp = fopen ( $local_music_path . '/All_Music.m3u', 'w' );
foreach ( $e_res as $mp3 )
{
	fputs ( $fp, "{$mp3}\n" );
}
fclose ( $fp );
 
// Sync the Music folder with the one on the phone
$exec = "rsync -r -i --size-only --copy-links --verbose {$local_music_path}/* {$phone_music_path}";
 //print "$exec\n";
 exec ( $exec );
 

Copy that php to a file called "make_music.php" or something EDIT the config variables and then run it like this: >php make_music.php

--- August 15th, 2009 :: Misc ::