Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > App idea: Sharing iTunes Library

App idea: Sharing iTunes Library
Thread Tools
3R1C
Mac Enthusiast
Join Date: Oct 2001
Status: Offline
Reply With Quote
Sep 8, 2002, 01:05 AM
 
I've noticed an xml file in my my iTunes music directory. This file has entries for all iTunes songs with their tags and the physical path to the file. My idea is this: an app which allows users to share their iTunes library via internet. The fact that this file is already maintained by apple on the users machine seems to me to make this app fairly straight forward. The way it might work is, a symlink could be created of the users music directory and link to the users sites folder. By default apache does not allow the following of symlinks in sites folders, so an admin password would be required to make the change to the apache conf for sites. The client could then init the xml file of the remote server and browse the sharing users library in a column view browser. Since the locations are maintained by apple in the described xml file, it would be trivial to then download selected tracks. I guess a tiny irc bot could be dev'ed which broadcast on a given irc channel and intermittently told all the other bots on the channel, "Hey, I'm sharing, and heres the url for my library xml file". The client could then get all the xml files from all the servers on the channel and compile them together to populate the file browser. I'm prepared to dev this my self, but I thought it would be cool to all work on it together via a source forge project. Also I know how to do it all except for the irc bot which would do the match-making. So what do you all think? Do any of you see any pitfalls? Seems pretty straight forward to me. It would be cool if a windows version was made so that they too could share. I dont have any general love for pc, but they've got mp3's too.

I also had an idea for another feature that crawled your iTunes library file structure and maintained little xml files in each album dir of what is supposed to be on a given album. This info could be gleaned from freedb.com. I was there a few months ago and noticed that the album tracklisting was also maintained by freedb in a variant of xml. A little coerrsion and that file can also be nicely inited as an array of the track listing. These xml files could be compared and missing tracks could be determined. A nice little 'Want List'. Then a filter could be utillezed which only showed tracks from sharing users that you dont have and need to complete an album.

Damn thats the longest post I've ever written. Does any of this make any sense? If I dont get a favorable respose, I'll just stumble along myself and figure it out myself, but it would be alot more fun to make this together. Anyway, thanx for reading.
3R1C
     
Ibson
Mac Enthusiast
Join Date: Nov 2001
Status: Offline
Reply With Quote
Sep 8, 2002, 01:44 AM
 
Sounds pretty cool. I'd be happy to work on it on Sourceforge (in Obj-C/Cocoa of course )...but, is this legal? I mean, downloading others' copyrighted music? Or maybe I'm not getting the full picture...
     
Rickster
Mac Elite
Join Date: Feb 2001
Location: Vancouver, WA
Status: Offline
Reply With Quote
Sep 8, 2002, 02:13 AM
 
Rickster gets mental picture of Darth Sidious: "I will make it legal."

Rick Roe
icons.cx | weblog
     
Ibson
Mac Enthusiast
Join Date: Nov 2001
Status: Offline
Reply With Quote
Sep 8, 2002, 02:16 AM
 
Originally posted by Rickster:
Rickster gets mental picture of Darth Sidious: "I will make it legal."

If only it were so...
     
3R1C  (op)
Mac Enthusiast
Join Date: Oct 2001
Status: Offline
Reply With Quote
Sep 8, 2002, 03:38 AM
 
Well, writting software isnt illegal. The actions it may automate may be. Without turning this into a debate, I myself and am an artist and have 2 albums. I will share my music. This tool will make it very easy. It also would allow quasi synchronization of two music libraries on different computers. Perhaps "the beach house" and "the permanent residence" I've never collaborated via cvs and sourceforge. I have no idea how to do it. I would be a poor choice of "head d00d" for the project.
3R1C
     
HashPipeK
Forum Regular
Join Date: Feb 2002
Location: MN
Status: Offline
Reply With Quote
Sep 12, 2002, 01:53 AM
 
all artists cept for fatty mettalica want their music to be shares, cuz the more people that hear their music. the mor epeople that come ot their concerts and buy their stuff and support them. and thats what its all about. ive interviewed man bands and not one has said anythign but download music. F*ck the riaa and the big 5
WSUP Program Director and Mac Fanatic
     
Diggory Laycock
Professional Poster
Join Date: Oct 2001
Location: London
Status: Offline
Reply With Quote
Sep 12, 2002, 03:32 PM
 
You wouldn't need to use apache - in fact allowing apache access to your general file system is a bad idea security-wise.

I'd suggest looking at the source to Fire on SourceForge. It does peer to peer file transfers doesn't it?

Another potential pitfall for sharing apps is scalability. Will your system work well when it becomes exponentially more popular?

good luck!
     
3R1C  (op)
Mac Enthusiast
Join Date: Oct 2001
Status: Offline
Reply With Quote
Sep 14, 2002, 01:21 AM
 
Im confused. How is symlinking the iTunes library to the users sites folder a security risk?
3R1C
     
3R1C  (op)
Mac Enthusiast
Join Date: Oct 2001
Status: Offline
Reply With Quote
Sep 26, 2002, 11:41 PM
 
Loki progresses nicely, however, I seem to run into a snag which has halted development for last 2 days. Heres a method which is supposed to itterate through the users library.xml and get the keys we care about, and then write it to a file. As you can guess it crashes. Can someone look at this code and tell me the Im sure obvious flaw?

-(void)parseLibrary{
NSMutableDictionary *iTunesTrackDictionary = [[NSMutableDictionary dictionaryWithContentsOfFile:[NSString stringWithFormat:@"%@/Music/iTunes/iTunes Music Library.xml", NSHomeDirectory()]] objectForKey:@"Tracks"];
NSArray *theSongs = [iTunesTrackDictionary allKeys];
NSEnumerator *songEnumerator = [theSongs objectEnumerator];
NSDictionary *theSong;
NSMutableArray *workingArray;
NSString *name, *location, *artist, *album;
// int bitrate;
while ( theSong = [songEnumerator nextObject] ) {
if ([[theSong objectForKey:@"Kind"] isEqualToString:@"MPEG audio file"] ) {
location = [theSong objectForKey:@"Location"];
name = [theSong objectForKey:@"Name"];
// bitrate = [theSong objectForKey:@"Bit Rate"];
if ( (artist = [theSong objectForKey:@"Artist"]) == nil ) {
artist = @"N/A";
}
if ( (album = [theSong objectForKey:@"Album"]) == nil ) {
album = @"N/A";
}
[workingArray addObject:[NSDictionary dictionaryWithObjectsAndKeys:location, @"Location", name, @"Name", artist, @"Artist", album, @"Album", nil]];
}
}
[workingArray writeToFile:@"/Library/WebServer/Documents/Loki/Shared_iTunes_Library.xml" atomically:YES];
}
( Last edited by 3R1C; Sep 26, 2002 at 11:51 PM. )
     
Ibson
Mac Enthusiast
Join Date: Nov 2001
Status: Offline
Reply With Quote
Sep 27, 2002, 01:16 AM
 
Woah! You're doing some funky stuff there. It's crashing because you're enumerating through all the keys in the library, but you've told the compiler that you're in fact enumerating through the values. So, you're trying to send -objectForKey: to a string. Also, you haven't initialized workingArray, so trying to mutate an object that doesn't even exist! In addition, iTunesTrackDictionary doesn't need to be mutable because you're not changing it. If you did want to enumerator through the keys in the dictionary, you don't need to get an array of all the keys in the dictionary, then get an enumerator from that. You just need to sent it a -keyEnumerator message. But, you don't want the keys, so you want the dictionary's objectEnumerator. Here's a cleaned up version that compiles and runs on my machine:
Code:
-(void)parseLibrary { NSDictionary *iTunesLibrary; NSDictionary *trackLibrary; NSDictionary *thisTrack; NSString *libraryLocation; NSEnumerator *trackEnumerator; NSMutableArray *finalTracks; libraryLocation = [@"~/Music/iTunes/iTunes Music Library.xml" stringByExpandingTildeInPath]; iTunesLibrary = [NSDictionary dictionaryWithContentsOfFile:libraryLocation]; trackLibrary = [iTunesLibrary objectForKey:@"Tracks"]; trackEnumerator = [trackLibrary objectEnumerator]; finalTracks = [NSMutableArray array]; while ((thisTrack = [trackEnumerator nextObject])) { if ([[thisTrack objectForKey:@"Kind"] isEqualToString:@"MPEG audio file"]) { NSDictionary *trackInfo; NSNumber *bitRate; NSString *location; NSString *name; NSString *artist; NSString *album; if (!(artist = [thisTrack objectForKey:@"Artist"])) { artist = @"N/A"; } if (!(album = [thisTrack objectForKey:@"Album"])) { album = @"N/A"; } location = [thisTrack objectForKey:@"Location"]; name = [thisTrack objectForKey:@"Name"]; bitRate = [thisTrack objectForKey:@"Bit Rate"]; trackInfo = [NSDictionary dictionaryWithObjectsAndKeys: location, @"Location", artist, @"Artist", name, @"Name", album, @"Album", bitRate, @"BitRate", nil]; [finalTracks addObject:trackInfo]; } } [finalTracks writeToFile:@"/Library/WebServer/Documents/Loki/Shared_iTunes_Library.xml" atomically:YES]; }
( Last edited by Ibson; Sep 27, 2002 at 02:41 AM. )
     
3R1C  (op)
Mac Enthusiast
Join Date: Oct 2001
Status: Offline
Reply With Quote
Sep 27, 2002, 02:23 AM
 
I have much to learn. Alot of the stuff I do now know is through you all. Thank you.

I was close tho!
     
   
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 12:53 PM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,