Vitunes fails to access Library for non-english locale
Closed this issue · 2 comments
Nice hack :)
Small problem: I found that ViTunes could not access the song library on my (German-Language) Macbook.
After a bit of debugging, it turned out that these lines in main.m fail:
library = [[iTunes sources] objectWithName:@"Library"];
libraryPlaylist = [[library playlists] objectWithName:@"Library"];
because the object names in question ('Library') are localized in international versions (they are called 'Mediathek' in German locale).
I don't know if it is possible to query the objects in a locale-independent fashion. However, I found that these objects seem to be at index 0 (always?). So you may want to collect the object at index 0, like so:
This solves the issue for me.
Cheers,
-- Andi
--- a/vitunes/main.m
+++ b/vitunes/main.m
@@ -254,9 +254,9 @@ int main (int argc, const char * argv[]) {
args = [rawArgs subarrayWithRange:aRange];
}
iTunes = [SBApplication applicationWithBundleIdentifier:@"com.apple.iTunes"];
- library = [[iTunes sources] objectWithName:@"Library"];
- libraryPlaylist = [[library playlists] objectWithName:@"Library"];
-
+ library = [[iTunes sources] objectAtIndex:0];
+ libraryPlaylist = [[library playlists] objectAtIndex:0 ];
+
if ([action isEqual: @"search"]) {
printTracks(search(args));
} else if ([action isEqual: @"playTrackID"]) {
This patch solved the same problem I had on my (French-Language) MacBook.
Thanks!
Thank you very much for this patch. Version 0.4.3 incorporates it.