diff --git a/Changelog.rtf b/Changelog.rtf index a6c5471..708faaa 100644 --- a/Changelog.rtf +++ b/Changelog.rtf @@ -88,4 +88,14 @@ \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural \i0 \cf0 -Preferred order of lyrics hosters will now be saved\ --Translation Improvements} \ No newline at end of file +-Translation Improvements\ +\ +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc + +\i \cf0 06/25/2012\ +\ +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural + +\i0 \cf0 -Fixed a search bug: Returned false results when having a & in query\ +-Added Functionality: Send Lyrics to matching iTunes Tracks\ + -Added Toolbar Items} \ No newline at end of file diff --git a/de.lproj/Localizable.strings b/de.lproj/Localizable.strings index e81e57c..8338da5 100644 --- a/de.lproj/Localizable.strings +++ b/de.lproj/Localizable.strings @@ -5,6 +5,8 @@ "No" = "Nein"; +"Cancel" = "Abbrechen"; + /* ---------- iLyrics - Hauptfenster ---------- */ @@ -78,6 +80,17 @@ //----- Warnmeldungen +/* Diese Warnmeldung wird angezeigt, wenn der Benutzer "An iTunes senden" auswählt */ +"iTunes.messages.sentToiTunes.title" = "Möchten Sie den Songtext an den aktuellen iTunes Titel senden (wenn zur Zeit einer wiedergegeben wird), oder möchten Sie, dass iLyrics nach Titeln mit passendem Namen und Interpreten sucht?"; +"iTunes.messages.sentToiTunes.detail" = "iLyrcs kann nach iTunes Titeln suchen, die eine passende Titel-Interpret Kombination haben und für diese Titel die Songtexte ändern (alte Songtexte werden ersetzt). Wenn Sie dies wollen, wählen Sie \"Passende Titel suchen\"."; +"iTunes.messages.sentToiTunes.sendToCurrent" = "An aktuellen Titel senden"; +"iTunes.messages.sentToiTunes.sendToMatching" = "Passende Titel suchen"; + +/* Dies wird angezeigt, wenn der Benutzer nach passenden Titeln sucht und keine passenden Titel gefunden wurden. (In der detaillierten Beschreibung können %track% (Titelname) und %artst% (Interpret) verwendet werden) */ +"iTunes.messages.noMatchingTracks.title" = "Es wurden keine passenden Titel gefunden."; +"iTunes.messages.noMatchingTracks.detail" = "Sie haben \"%track%\" von \"%artist%\" nicht in Ihrer iTunes Mediathek."; + + /* Es wird kein Titel wiedergegeben */ "iTunes.messages.noTrackPlaying.title" = "iTunes spielt zur Zeit keine Musik."; "iTunes.messages.noTrackPlaying.detail" = "Geben Sie einen Titel mit iTunes wieder oder wählen Sie \"Wiedergabe/Pause\" aus dem iTunes Menu, um diese Funktion zu verwenden."; diff --git a/en.lproj/Localizable.strings b/en.lproj/Localizable.strings index f8a2940..6b1929b 100644 --- a/en.lproj/Localizable.strings +++ b/en.lproj/Localizable.strings @@ -5,6 +5,8 @@ "No" = "No"; +"Cancel" = "Cancel"; + /* ---------- iLyrics - Main Window ---------- */ @@ -78,6 +80,16 @@ //----- Alert Texts +/* Alert Sheet shown when the user selects "send to iTunes" */ +"iTunes.messages.sentToiTunes.title" = "Do you want to send the lyrics to the currently playing track (if there is one) or do you want iLyrics to search for a track matching to the artist and song name?"; +"iTunes.messages.sentToiTunes.detail" = "iLyrics can search for tracks matching to the songname-artist combination and set the lyrics for these songs (old lyrics will be replaced). If you want that choose \"Send to matching track\"."; +"iTunes.messages.sentToiTunes.sendToCurrent" = "Send to current track"; +"iTunes.messages.sentToiTunes.sendToMatching" = "Send to matching tracks"; + +/* Displayed when the user selects send to matching track and no tracks are found (in the detail message %track% and %artist% are available) */ +"iTunes.messages.noMatchingTracks.title" = "No Matching tracks found."; +"iTunes.messages.noMatchingTracks.detail" = "You do not have \"%track%\" by \"%artist%\" in your iTunes library."; + /* No Track is currently playing */ "iTunes.messages.noTrackPlaying.title" = "iTunes does currently not play any music."; "iTunes.messages.noTrackPlaying.detail" = "Play a track using iTunes or select \"Play/Pause\" from the iTunes menu."; diff --git a/iLyrics/LyricsHosterUtil.m b/iLyrics/LyricsHosterUtil.m index 080a76a..4aaf710 100644 --- a/iLyrics/LyricsHosterUtil.m +++ b/iLyrics/LyricsHosterUtil.m @@ -18,6 +18,6 @@ -(NSString *) stringByFormattingForURL { //Can replace äöü with aou, no difference in results NSCharacterSet *characters = [[NSCharacterSet alphanumericCharacterSet] invertedSet]; - return [[[self stringByReplacingOccurrencesOfString:@" " withString:@"+"] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding] stringByTrimmingCharactersInSet:characters]; + return [[[[self stringByReplacingOccurrencesOfString:@" " withString:@"+"] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding] stringByReplacingOccurrencesOfString:@"&" withString:@"%26"] stringByTrimmingCharactersInSet:characters]; } @end diff --git a/iLyrics/MainController.h b/iLyrics/MainController.h index 60a2c5e..c3b89e0 100644 --- a/iLyrics/MainController.h +++ b/iLyrics/MainController.h @@ -27,6 +27,8 @@ - (IBAction)resetLoadedResults:(id)sender; - (IBAction)lyricsSelectionChanged:(NSOutlineView *)sender; - (IBAction)sendLyricsToiTunes:(id)sender; +- (IBAction)sendLyricsToCurrentiTunesTrack:(id)sender; +- (IBAction)sendLyricsToTracksMatchingTrack:(id)sender; - (IBAction)downloadLyrics:(id)sender; - (IBAction)showLyricsInBrowser:(id)sender; - (IBAction)showiLyricsWindow:(id)sender; diff --git a/iLyrics/MainController.m b/iLyrics/MainController.m index a28c1cd..78115a3 100644 --- a/iLyrics/MainController.m +++ b/iLyrics/MainController.m @@ -77,7 +77,7 @@ NSMenuItem *titleItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"iLyrics.text.loadNextResultsFrom", @"") action:@selector(nothingResponsible:soDisable:titleItem:) keyEquivalent:@""]; [menu addItem:titleItem]; for (id hoster in [ilyrics lyricsHosters]) { - NSMenuItem *menuItem = [[NSMenuItem alloc] initWithTitle:[NSString stringWithFormat:@" %@", [hoster name]] action:@selector(loadNextResults:) keyEquivalent:@""]; + NSMenuItem *menuItem = [[NSMenuItem alloc] initWithTitle:[hoster name] action:@selector(loadNextResults:) keyEquivalent:@""]; [menuItem setTarget:self]; [menu addItem:menuItem]; } @@ -265,6 +265,23 @@ } - (IBAction)sendLyricsToiTunes:(id)sender { + NSString *title = NSLocalizedString(@"iTunes.messages.sentToiTunes.title", @""); + NSString *detail = NSLocalizedString(@"iTunes.messages.sentToiTunes.detail", @""); + NSString *sendToCurrent = NSLocalizedString(@"iTunes.messages.sentToiTunes.sendToCurrent", @""); + NSString *sendToMatching = NSLocalizedString(@"iTunes.messages.sentToiTunes.sendToMatching", @""); + NSString *cancel = NSLocalizedString(@"Cancel", @""); + NSBeginAlertSheet(title, sendToCurrent, cancel, sendToMatching, window, self, nil, @selector(sendLyricsToiTunesSheetDidDismiss:returnCode:contextInfo:), nil, detail); +} + +- (void)sendLyricsToiTunesSheetDidDismiss: (NSWindow *) sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo { + if (returnCode == NSAlertDefaultReturn) { + [self sendLyricsToCurrentiTunesTrack:nil]; + } else if (returnCode == NSAlertOtherReturn) { + [self sendLyricsToTracksMatchingTrack:nil]; + } +} + +- (IBAction)sendLyricsToCurrentiTunesTrack:(id)sender { iTunesTrack *track = [[ilyrics iTunes] currentTrack]; NSString *name = [track name]; if (name == nil) { @@ -275,18 +292,43 @@ if (oldLyrics != nil && [oldLyrics length] > 0) { NSBeginAlertSheet(NSLocalizedString(@"iTunes.messages.replaceLyrics.title", @""), NSLocalizedString(@"Yes", @""), NSLocalizedString(@"No", @""), nil, window, self, @selector(replaceLyricsSheetDidEnd:returnCode:contextInfo:), nil, nil, NSLocalizedString(@"iTunes.messages.replaceLyrics.detail", @"")); } else { - [self replaceLyricsSheetDidEnd:nil returnCode:NSAlertDefaultReturn contextInfo:nil]; + [self sendLyricsToiTunesTrack:[[ilyrics iTunes] currentTrack]]; + } +} + +- (IBAction)sendLyricsToTracksMatchingTrack:(id)sender { + iTunesSource *iTunesSrc = [[[ilyrics iTunes] sources] objectAtIndex:0]; + iTunesLibraryPlaylist *library = [[iTunesSrc libraryPlaylists] objectAtIndex:0]; + NSString *name = [currentLyrics name]; + NSString *artist = [currentLyrics artist]; + BOOL foundTrack = NO; + for (iTunesFileTrack *track in [library fileTracks]) { + if ([[track name] rangeOfString:name options:NSCaseInsensitiveSearch].location != NSNotFound && [[track artist] rangeOfString:artist options:NSCaseInsensitiveSearch].location != NSNotFound) { + [self sendLyricsToiTunesTrack:track]; + foundTrack = YES; + } + } + if (!foundTrack) { + NSString *title = NSLocalizedString(@"iTunes.messages.noMatchingTracks.title", @""); + NSString *detail = [[NSLocalizedString(@"iTunes.messages.noMatchingTracks.detail", @"") stringByReplacingOccurrencesOfString:@"%track%" withString:name] stringByReplacingOccurrencesOfString:@"%artist%" withString:artist]; + NSString *ok = NSLocalizedString(@"OK", @""); + NSBeginAlertSheet(title, ok, nil, nil, window, nil, nil, nil, nil, detail); } } - (void)replaceLyricsSheetDidEnd:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo { if (returnCode == NSAlertDefaultReturn) { iTunesTrack *track = [[ilyrics iTunes] currentTrack]; - [track setLyrics:[lyricsArea string]]; - [GrowlApplicationBridge notifyWithTitle:NSLocalizedString(@"Growl.messages.lyricsSent.title", @"") description:[NSString stringWithFormat:NSLocalizedString(@"Growl.messages.lyricsSent.detail", @""), [track name]] notificationName:@"Lyrics sent to iTunes" iconData:nil priority:0 isSticky:NO clickContext:nil]; + [self sendLyricsToiTunesTrack:track]; } } +- (void)sendLyricsToiTunesTrack:(iTunesTrack *)track { + [track setLyrics:[lyricsArea string]]; + [GrowlApplicationBridge notifyWithTitle:NSLocalizedString(@"Growl.messages.lyricsSent.title", @"") description:[NSString stringWithFormat:NSLocalizedString(@"Growl.messages.lyricsSent.detail", @""), [track name]] notificationName:@"Lyrics sent to iTunes" iconData:nil priority:0 isSticky:NO clickContext:nil]; + +} + - (IBAction)downloadLyrics:(id)sender { NSSavePanel *savePanel = [NSSavePanel savePanel]; [savePanel setAllowedFileTypes:[NSArray arrayWithObject:@"txt"]]; @@ -373,6 +415,18 @@ BOOL enabled = lyricsSelected && [[ilyrics iTunes] isRunning]; return enabled; } + if (action == @selector(sendLyricsToCurrentiTunesTrack:)) { + if (![[ilyrics iTunes] isRunning]) { + return NO; + } + NSString *name = [[[ilyrics iTunes] currentTrack] name]; + BOOL enabled = lyricsSelected && name != nil && [name length]>0; + return enabled; + } + if (action == @selector(sendLyricsToMatchingiTunesTrack:)) { + BOOL enabled = lyricsSelected && [[ilyrics iTunes] isRunning]; + return enabled; + } if (action == @selector(getCurrentiTunesSong:)) { return [[ilyrics iTunes] isRunning]; } diff --git a/iLyrics/de.lproj/MainMenu.xib b/iLyrics/de.lproj/MainMenu.xib index bf0a620..2d85ba9 100644 --- a/iLyrics/de.lproj/MainMenu.xib +++ b/iLyrics/de.lproj/MainMenu.xib @@ -921,11 +921,9 @@ Suchen - + 268 {{0, 14}, {96, 22}} - - _NS:9 YES @@ -1007,6 +1005,47 @@ YES 0 + + + 14B40E10-2B11-4F8C-B79F-5577F59A71C9 + + An aktuellen Titel senden + An aktuellen iTunes Titel senden + + + + NSImage + iTunes + + + + {0, 0} + {0, 0} + YES + YES + -1 + YES + 0 + + + + 5A0D9D97-8ED0-45E1-B7D9-100BDA7542E7 + + An passende senden + An alle passenden iTunes Titel senden + + + + + + {0, 0} + {0, 0} + YES + YES + -1 + YES + 0 + 5B496B66-64F2-4E7B-9926-E769A97FCF71 @@ -1037,10 +1076,7 @@ Von Tunes holen - - NSImage - iTunes - + {0, 0} @@ -1059,7 +1095,7 @@ An iTunes senden - + {0, 0} @@ -1149,6 +1185,8 @@ + + @@ -1168,7 +1206,7 @@ {650, 350} - + 256 @@ -1249,7 +1287,7 @@ 4352 {368, 415} - + _NS:13 YES @@ -1451,7 +1489,7 @@ {{0, 29}, {370, 433}} - + _NS:9 133682 @@ -1505,7 +1543,7 @@ 1 - 67244001 + 100798433 0 @@ -1655,16 +1693,39 @@ OtherViews - + An iTunes senden - 1048576 2147483647 - _popUpItemAction: - + submenuAction: + + An iTunes senden + + + + An den aktuellen Titel senden + + 2147483647 + + + _popUpItemAction: + + + + + An alle passenden Titel senden + + 2147483647 + + + _popUpItemAction: + + + + @@ -1680,7 +1741,6 @@ - -1 YES 1 YES @@ -1790,7 +1850,6 @@ {841, 462} - {{0, 0}, {1680, 1028}} @@ -1826,7 +1885,7 @@ YES - + 268 @@ -1834,7 +1893,6 @@ 268 {{195, -1}, {108, 19}} - _NS:9 YES @@ -1869,7 +1927,7 @@ 2322 {301, 14} - + _NS:13 @@ -1890,7 +1948,7 @@ 1 - 67112865 + 100667297 0 @@ -1966,7 +2024,7 @@ {{0, 20}, {303, 172}} - + _NS:9 133138 @@ -1975,7 +2033,6 @@ {303, 192} - _NS:9 NSView @@ -2007,7 +2064,7 @@ Auto-Lyrics - + {0, 0} @@ -2110,11 +2167,9 @@ - + 256 {480, 270} - - _NS:20 {{0, 0}, {1680, 1028}} @@ -2125,7 +2180,7 @@ PreferencesController - + 268 @@ -2161,7 +2216,7 @@ 256 {424, 146} - + _NS:13 YES @@ -2300,7 +2355,7 @@ {{20, 20}, {426, 164}} - + _NS:9 133682 @@ -2336,13 +2391,12 @@ {466, 251} - _NS:9 NSView - + 268 @@ -2487,7 +2541,6 @@ 268 {{71, 22}, {386, 42}} - _NS:9 {250, 750} YES @@ -2586,7 +2639,6 @@ {466, 251} - _NS:9 NSView @@ -3210,14 +3262,6 @@ 751 - - - sendLyricsToiTunes: - - - - 2749 - downloadLyrics: @@ -3226,6 +3270,46 @@ 2750 + + + sendLyricsToCurrentiTunesTrack: + + + + 3047 + + + + sendLyricsToiTunes: + + + + 3052 + + + + sendLyricsToCurrentiTunesTrack: + + + + 3054 + + + + sendLyricsToTracksMatchingTrack: + + + + 3056 + + + + sendLyricsToTracksMatchingTrack: + + + + 3057 + delegate @@ -4084,6 +4168,8 @@ + + @@ -6134,17 +6220,12 @@ 2717 - + - - 2719 - - - 2720 @@ -6435,6 +6516,43 @@ + + 3045 + + + + + 3046 + + + + + 3049 + + + + + + + + 3050 + + + + + + + + + 3051 + + + + + 3053 + + + @@ -6721,7 +6839,6 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -6785,6 +6902,12 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -6888,7 +7011,7 @@ - 3043 + 3057 0 diff --git a/iLyrics/en.lproj/MainMenu.xib b/iLyrics/en.lproj/MainMenu.xib index 87f6a23..7b6bd83 100644 --- a/iLyrics/en.lproj/MainMenu.xib +++ b/iLyrics/en.lproj/MainMenu.xib @@ -1069,6 +1069,44 @@ YES 0 + + + A7DBA208-905D-4FF5-9F62-D0011CD811B6 + + Send to matching + Send to all matching Tracks + + + + + + {0, 0} + {0, 0} + YES + YES + -1 + YES + 0 + + + + B5E59498-369E-4FA6-B378-0110FF0D7D82 + + Sent to current + Send to current iTunes Track + + + + + + {0, 0} + {0, 0} + YES + YES + -1 + YES + 0 + F19D1A15-FED6-48F9-B670-7D7F2D798C5A @@ -1148,6 +1186,8 @@ + + @@ -1251,7 +1291,7 @@ {368, 415} - + _NS:13 YES @@ -1459,7 +1499,7 @@ {{0, 29}, {370, 433}} - + _NS:9 133682 @@ -1670,16 +1710,39 @@ OtherViews - + Send to iTunes - 1048576 2147483647 - _popUpItemAction: - + submenuAction: + + Send to iTunes + + + + Send to current Track + + 2147483647 + + + _popUpItemAction: + + + + + Send to all matching Tracks + + 2147483647 + + + _popUpItemAction: + + + + @@ -1695,6 +1758,7 @@ + 1 YES 1 YES @@ -3224,14 +3288,6 @@ 751 - - - sendLyricsToiTunes: - - - - 2749 - downloadLyrics: @@ -3240,6 +3296,46 @@ 2750 + + + sendLyricsToCurrentiTunesTrack: + + + + 2911 + + + + sendLyricsToiTunes: + + + + 2917 + + + + sendLyricsToCurrentiTunesTrack: + + + + 2919 + + + + sendLyricsToTracksMatchingTrack: + + + + 2921 + + + + sendLyricsToTracksMatchingTrack: + + + + 2922 + delegate @@ -4098,6 +4194,8 @@ + + @@ -6256,17 +6354,12 @@ 2717 - + - - 2719 - - - 2720 @@ -6407,6 +6500,43 @@ + + 2909 + + + + + 2910 + + + + + 2914 + + + + + + + + 2915 + + + + + + + + + 2916 + + + + + 2918 + + + @@ -6716,7 +6846,6 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -6746,6 +6875,12 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -6852,7 +6987,7 @@ - 2908 + 2922 @@ -6931,6 +7066,8 @@ id NSOutlineView id + id + id id id id @@ -6957,6 +7094,14 @@ resetLoadedResults: id + + sendLyricsToCurrentiTunesTrack: + id + + + sendLyricsToTracksMatchingTrack: + id + sendLyricsToiTunes: id