Getting music from iTunes to your G1
I wanted to export all my music from iTunes to my G1, but I wanted to maintain the folder structure like this:
Artist\Album\TrackName.mp3
Couldn’t find anything on Google so here’s some C# code to get it done. Remember to add a reference to iTunesLib (Add Reference / COM).
1: private static class ITunesExporter{
2: public static void Export(string playlistName, string path) {
3: iTunesAppClass iTunes = new iTunesAppClass();
4:
5: foreach (IITPlaylist playlist in iTunes.LibrarySource.Playlists) {
6: if (playlist.Name == playlistName) {
7: foreach (IITTrack track in playlist.Tracks) {
8: if (track.Kind == ITTrackKind.ITTrackKindFile) {
9: IITFileOrCDTrack file = (IITFileOrCDTrack)track;
10: string extension = Path.GetExtension(file.Location);
11: string newPath = ITunesExporter.createValidFileName(path, file.Artist, file.Album, file.Name, extension);
12: string newDirectoryName = Path.GetDirectoryName(newPath);
13: Directory.CreateDirectory(newDirectoryName);
14:
15: if (File.Exists(newPath) == false) {
16: File.Copy(file.Location, newPath);
17: }
18: }
19: }
20: }
21: }
22: }
23: private static string createValidFileName(string exportPath, string artist, string album, string track, string extension) {
24: artist = ITunesExporter.removeInvalidFileNameCharacters(artist);
25: album = ITunesExporter.removeInvalidFileNameCharacters(album);
26: track = ITunesExporter.removeInvalidFileNameCharacters(track);
27:
28: string filePath = exportPath;
29: filePath = Path.Combine(filePath, artist);
30: filePath = Path.Combine(filePath, album);
31: filePath = Path.Combine(filePath, track);
32: filePath = Path.ChangeExtension(filePath, extension);
33: return filePath;
34: }
35: private static string removeInvalidFileNameCharacters(string str) {
36: char[] chars = Path.GetInvalidFileNameChars();
37: foreach (char c in chars) {
38: str = str.Replace(c.ToString(), null);
39: }
40: return str;
41: }
42: }
You can use the code like this:
1: ITunesExporter.Export("Phone", @"D:\Music");
”Phone” is the playlist name and “D:\Music” is the path that the files will be exported to.
If anyone want’s to recode it to use the iTunes XML file please post the code! (I am to lazy).
LivePlasma, a Music and Movie discovery service.
Similar to the music discovery service OneLlama (recently blogged here), LivePlasma allows you to do the same with music and movies!
In the screen shot below, I searched for "quentin tarantino" under Directors...
You can even create your own maps!
More and more of these services are popping up lately, and I'm really interested to see which ones become the industry leaders. Anyone got any ideas?
One Llama: A new music discovery service!
Lately I've been trying every one of these services, but this one really sticks out.
You type in your favourite artist, which isn't really different from the rest, and then click Discovery at the top to get here:
Each song branches off into another group of songs. Sadly, you can only preview the songs. Maybe they will take it a step further and stream full songs in the future? I hope.
Apparently they use some sort of analysis system (non-human) to determine if songs are similar.
I've already found four new albums I want to buy, even though their music database seems to be quite limited.
Another thing which makes this service stick out from the crowd is their iTunes plugin. Now you can discover music from inside iTunes! Ok, wait a minute, i just checked out the plugin and it's not really a normal plugin. It's actually a program (that has no shortcut installed?!) that makes playlists from the song that's selected in iTunes. Not really that useful (Yet?). Oh, it also doesn't work with my iTunes version.
Something that is odd is the fact that I haven't received a verification email yet and can't seem to login. It's been about five minutes now.
Enjoy!
RadioBlogClub
Quite a sweet service. You can stream nearly anything, and you can also embed tracks on your site/blag.
Last.Fm
No matter how much you know about the net, it can always make you feel like a newb at some point.
I checked out other music radio song suggestion type thingies, and I found Last.Fm.
It's much sweeter in my opinion because:
- You can skip songs as much as you like.
- You can tag songs.
- It comes with its own client! No need for a hack like Pandoras Box! It works on a variety of different OSes too!
I don't know how they work but I'm still pretty interested in Pandora, and will be waiting patiently for them implement these three features...
peace
Pandora!
Whoa. If you don't know about Pandora then you better get on over there NOW! Pandora.Com. You type in the name of your favourite artist, and it builds a radio station for you, consisting of music that you probably like, but don't worry you can skip the ones you don't!
So much good music! Sweet!
EDIT: Get Pandoras Box so you can run Pandora as a desktop app, hiding in the system tray! It even integrates with MSN Messenger!

