Archived
1

Release 1.0

iLyrics functionality added
Magistrix Lyrics Hoster added

Release 1.0.1
Added Split View in Main Window
Some little code changes
This commit is contained in:
Kim Wittenburg
2012-06-16 16:29:56 +02:00
parent a31765d6b1
commit e4fdd7e306
27 changed files with 4250 additions and 2610 deletions

22
Changelog.rtf Normal file
View File

@@ -0,0 +1,22 @@
{\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf470
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
\margl1440\margr1440\vieww9000\viewh8400\viewkind0
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\qc
\f0\fs24 \cf0 ---------- iLyrics Changelog ----------\
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural
\cf0 \
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\qc
\cf0 Release No. 1.0 - 06/16/2012\
\
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural
\cf0 - iLyrics functionality added\
- Magistrix Lyrics Hoster added\
\
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\qc
\cf0 Release No. 1.0.1 - 06/16/2012\
\
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural
\cf0 - Added Split View on Main Window\
- Some little code changes}

BIN
Diamond.tiff Normal file

Binary file not shown.

BIN
Download-icon.icns Normal file

Binary file not shown.

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>TicketVersion</key>
<integer>1</integer>
<key>AllNotifications</key>
<array>
<string>Lyrics sent to iTunes</string>
<string>Lyrics saved to File</string>
</array>
</dict>
</plist>

View File

@@ -0,0 +1,68 @@
/* Standards */
"OK" = "OK";
"Yes" = "Ja";
"No" = "Nein";
/* "No Selection" label(s) in the main window */
"iLyrics.text.noSelection" = "Keine Auswahl";
/* Text displayed when a lyrics hoster does not return a valid NSDate in it's hosterVersion method */
"iLyrics.text.illegalDateFormat" = "Keine Angabe";
/* Preferences */
/* Search Token Replacements */
"iLyrics.searchToken.%name%" = "Songname";
"iLyrics.searchToken.%artist%" = "Interpret";
"iLyrics.searchToken.%album%" = "Album";
/* Magistrix Hoster */
"Magistrix.text.noPreview" = "Keine Vorschau verfügbar.";
"Hoster.text.noNetwork" = "Keine Netzwerkverbindung.";
"Hoster.messages.networkError.title" = "Sie sind zur Zeit nicht mit dem Internet verbunden.";
"Hoster.messages.networkError.detail" = "Prüfen Sie, ob ihre WLAN oder Ethernet-Verbndung korrekt funktioniert. Weitere Informationenen erhalten Sie mit dem Netzwerkdiagnose Programm.";
"Hoster.messages.noResults.title" = "Ihre Suche ergab keine Ergebnisse.";
"Hoster.messages.noResults.detail" = "Magistrix.de hat keine Songtexte in der Datenbank, die mit der Suchanfrage übereinstimmen.";
"Magistrix.messages.unknownPage.title" = "Ein Fehler ist beim Verarbeiten der Anfrage aufgetreten.";
"Magistrix.messages.unknownPage.detail" = "Normalerweise kann dieses Problem behoben werden, wenn Sie die neuste Version von iLyrics laden.";
/* iTunes connection */
/* By text used in the artist menu item where %@ is the artist */
"iTunes.text.byFormat" = "von %@";
/* iTunes (error) messages */
"iTunes.messages.iTunesIdle.title" = "iTunes ist zurzeit nicht geöffnet.";
"iTunes.messages.iTunesIdle.detail" = "Öffnen Sie iTunes um dieses Feature nutzen zu können.";
"iTunes.messages.noTrackPlaying.title" = "iTunes spielt zurzeit keine Musik.";
"iTunes.messages.noTrackPlaying.detail" = "Starten sie die Wiedergabe über iTunes oder über den \"Play/Pause\" Button.";
"iTunes.messages.replaceLyrics.title" = "Der aktuelle iTunes Titel hat bereits einen Songtext. Möchten Sie ihn ersetzen?";
"iTunes.messages.replaceLyrics.detail" = "Beim Eretzen geht der alte Songtext vollständig verloren. Diese Aktion kann nicht wiederrufen werden.";
/* Error while saving */
"messages.error.saveLyrics.title" = "Der Songtext konnte nicht gespeichert werden.";
"messages.error.saveLyrics.detail" = "Prüfen Sie, ob Sie Schreibberechtigung an diesem Ort haben.";
/* Growl */
"Growl.messages.lyricsSaved.title" = "Songtext gespeichert";
"Growl.messages.lyricsSaved.detail" = "nach \"%@\"";
"Growl.messages.lyricsSent.title" = "Songtext an iTunes gesendet";
"Growl.messages.lyricsSent.detail" = "";

View File

@@ -0,0 +1,68 @@
/* Standards */
"OK" = "OK";
"Yes" = "Yes";
"No" = "No";
/* "No Selection" label(s) in the main window */
"iLyrics.text.noSelection" = "No Selection";
/* Text displayed when a lyrics hoster does not return a valid NSDate in it's hosterVersion method */
"iLyrics.text.illegalDateFormat" = "No Specification";
/* Preferences */
/* Search Token Replacements */
"iLyrics.searchToken.%name%" = "Song Name";
"iLyrics.searchToken.%artist%" = "Artist";
"iLyrics.searchToken.%album%" = "Album";
/* Magistrix Hoster */
"Magistrix.text.noPreview" = "No Preview available.";
"Hoster.text.noNetwork" = "No Network connection";
"Hoster.messages.networkError.title" = "You are not connected to the internet.";
"Hoster.messages.networkError.detail" = "Check if you are connected through WLAN or Ethernet. Use the Network Diagnostics for more information.";
"Hoster.messages.noResults.title" = "Your search did not return any results.";
"Hoster.messages.noResults.detail" = "Magistrix.de does not provide any lyrics for this search.";
"Magistrix.messages.unknownPage.title" = "There occured an error while parsing the request.";
"Magistrix.messages.unknownPage.detail" = "Normally this can be fixed by getting the newest versin of iLyrics.";
/* iTunes connection */
/* By text used in the artist menu item where %@ is the artist */
"iTunes.text.byFormat" = "by %@";
/* iTunes (error) messages */
"iTunes.messages.iTunesIdle.title" = "iTunes is idle.";
"iTunes.messages.iTunesIdle.detail" = "Please start iTunes to use this feature.";
"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.";
"iTunes.messages.replaceLyrics.title" = "The current iTunes track already has lyrics. Do you want to replace them?";
"iTunes.messages.replaceLyrics.detail" = "If you replace the old lyrics they can not be restored anymore.";
/* Error while saving */
"messages.error.saveLyrics.title" = "The Lyrics could not be saved.";
"messages.error.saveLyrics.detail" = "Ceck if you have the rights to write to the selected location.";
/* Growl */
"Growl.messages.lyricsSaved.title" = "Lyrics Saved";
"Growl.messages.lyricsSaved.detail" = "to \"%@\"";
"Growl.messages.lyricsSent.title" = "Lyrics sent to iTunes";
"Growl.messages.lyricsSent.detail" = "";

BIN
iLyrics.icns Normal file

Binary file not shown.

View File

@@ -13,22 +13,72 @@
3B20EF3C1584EA9A006C0CDF /* Credits.rtf in Resources */ = {isa = PBXBuildFile; fileRef = 3B20EF3A1584EA9A006C0CDF /* Credits.rtf */; };
3B20EF3F1584EA9A006C0CDF /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 3B20EF3E1584EA9A006C0CDF /* AppDelegate.m */; };
3B20EF421584EA9A006C0CDF /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3B20EF401584EA9A006C0CDF /* MainMenu.xib */; };
3B20EF491584EAA3006C0CDF /* iLyrics.icns in Resources */ = {isa = PBXBuildFile; fileRef = 3B20EF481584EAA3006C0CDF /* iLyrics.icns */; };
3B20EF4D1584EAAD006C0CDF /* iTunes-icon.icns in Resources */ = {isa = PBXBuildFile; fileRef = 3B20EF4A1584EAAD006C0CDF /* iTunes-icon.icns */; };
3B20EF4E1584EAAD006C0CDF /* Diamond.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 3B20EF4B1584EAAD006C0CDF /* Diamond.tiff */; };
3B20EF4F1584EAAD006C0CDF /* Download-icon.icns in Resources */ = {isa = PBXBuildFile; fileRef = 3B20EF4C1584EAAD006C0CDF /* Download-icon.icns */; };
3B20EF521584EAF8006C0CDF /* MainController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3B20EF511584EAF8006C0CDF /* MainController.m */; };
3B20EF551584ECD9006C0CDF /* Lyrics.m in Sources */ = {isa = PBXBuildFile; fileRef = 3B20EF541584ECD9006C0CDF /* Lyrics.m */; };
3B20EF5C1584F34E006C0CDF /* SearchResult.m in Sources */ = {isa = PBXBuildFile; fileRef = 3B20EF5B1584F34E006C0CDF /* SearchResult.m */; };
3B20EF6115853345006C0CDF /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 3B20EF6315853345006C0CDF /* Localizable.strings */; };
3B81D4FE1586248F00916CE3 /* ScriptingBridge.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B81D4FD1586248F00916CE3 /* ScriptingBridge.framework */; };
3BBD9B76158C873F00A5CD2C /* Growl.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3BBD9B75158C873F00A5CD2C /* Growl.framework */; };
3BBD9B78158C876200A5CD2C /* Growl.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 3BBD9B75158C873F00A5CD2C /* Growl.framework */; };
3BBD9B7A158C87D000A5CD2C /* Growl Registration Ticket.growlRegDict in Resources */ = {isa = PBXBuildFile; fileRef = 3BBD9B79158C87D000A5CD2C /* Growl Registration Ticket.growlRegDict */; };
3BE95011158A269D00E78FEF /* Magistrix.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BE95010158A269D00E78FEF /* Magistrix.m */; };
3BE95017158A291500E78FEF /* PreferencesController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BE95016158A291500E78FEF /* PreferencesController.m */; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
3BBD9B77158C874F00A5CD2C /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
3BBD9B78158C876200A5CD2C /* Growl.framework in CopyFiles */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
3B20EF271584EA9A006C0CDF /* iLyrics.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = iLyrics.app; sourceTree = BUILT_PRODUCTS_DIR; };
3B20EF2B1584EA9A006C0CDF /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
3B20EF2E1584EA9A006C0CDF /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; };
3B20EF2F1584EA9A006C0CDF /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; };
3B20EF301584EA9A006C0CDF /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
3B20EF331584EA9A006C0CDF /* iLyrics-Info.plist */ = {isa = PBXFileReference; path = "iLyrics-Info.plist"; sourceTree = "<group>"; };
3B20EF331584EA9A006C0CDF /* iLyrics-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "iLyrics-Info.plist"; sourceTree = "<group>"; };
3B20EF351584EA9A006C0CDF /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
3B20EF371584EA9A006C0CDF /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
3B20EF391584EA9A006C0CDF /* iLyrics-Prefix.pch */ = {isa = PBXFileReference; path = "iLyrics-Prefix.pch"; sourceTree = "<group>"; };
3B20EF391584EA9A006C0CDF /* iLyrics-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "iLyrics-Prefix.pch"; sourceTree = "<group>"; };
3B20EF3B1584EA9A006C0CDF /* en */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = en; path = en.lproj/Credits.rtf; sourceTree = "<group>"; };
3B20EF3D1584EA9A006C0CDF /* AppDelegate.h */ = {isa = PBXFileReference; path = AppDelegate.h; sourceTree = "<group>"; };
3B20EF3D1584EA9A006C0CDF /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
3B20EF3E1584EA9A006C0CDF /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
3B20EF411584EA9A006C0CDF /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/MainMenu.xib; sourceTree = "<group>"; };
3B20EF481584EAA3006C0CDF /* iLyrics.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = iLyrics.icns; sourceTree = "<group>"; };
3B20EF4A1584EAAD006C0CDF /* iTunes-icon.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = "iTunes-icon.icns"; sourceTree = "<group>"; };
3B20EF4B1584EAAD006C0CDF /* Diamond.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = Diamond.tiff; sourceTree = "<group>"; };
3B20EF4C1584EAAD006C0CDF /* Download-icon.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = "Download-icon.icns"; sourceTree = "<group>"; };
3B20EF501584EAF8006C0CDF /* MainController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MainController.h; sourceTree = "<group>"; };
3B20EF511584EAF8006C0CDF /* MainController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MainController.m; sourceTree = "<group>"; };
3B20EF531584ECD9006C0CDF /* Lyrics.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Lyrics.h; sourceTree = "<group>"; };
3B20EF541584ECD9006C0CDF /* Lyrics.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Lyrics.m; sourceTree = "<group>"; };
3B20EF5A1584F34E006C0CDF /* SearchResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SearchResult.h; sourceTree = "<group>"; };
3B20EF5B1584F34E006C0CDF /* SearchResult.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SearchResult.m; sourceTree = "<group>"; };
3B20EF5D1584F458006C0CDF /* LyricsHoster.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LyricsHoster.h; sourceTree = "<group>"; };
3B20EF6215853345006C0CDF /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = "<group>"; };
3B2DC558158CCE8100C004A4 /* Changelog.rtf */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; path = Changelog.rtf; sourceTree = SOURCE_ROOT; };
3B81D4FD1586248F00916CE3 /* ScriptingBridge.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ScriptingBridge.framework; path = System/Library/Frameworks/ScriptingBridge.framework; sourceTree = SDKROOT; };
3B81D5041586298100916CE3 /* iTunes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iTunes.h; sourceTree = "<group>"; };
3BBD9B72158C7F8A00A5CD2C /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/Localizable.strings; sourceTree = "<group>"; };
3BBD9B74158C86DA00A5CD2C /* de */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = de; path = de.lproj/Credits.rtf; sourceTree = "<group>"; };
3BBD9B75158C873F00A5CD2C /* Growl.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Growl.framework; sourceTree = "<group>"; };
3BBD9B79158C87D000A5CD2C /* Growl Registration Ticket.growlRegDict */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = "Growl Registration Ticket.growlRegDict"; sourceTree = "<group>"; };
3BE9500F158A269D00E78FEF /* Magistrix.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Magistrix.h; sourceTree = "<group>"; };
3BE95010158A269D00E78FEF /* Magistrix.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Magistrix.m; sourceTree = "<group>"; };
3BE95015158A291500E78FEF /* PreferencesController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PreferencesController.h; sourceTree = "<group>"; };
3BE95016158A291500E78FEF /* PreferencesController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PreferencesController.m; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -36,6 +86,8 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
3BBD9B76158C873F00A5CD2C /* Growl.framework in Frameworks */,
3B81D4FE1586248F00916CE3 /* ScriptingBridge.framework in Frameworks */,
3B20EF2C1584EA9A006C0CDF /* Cocoa.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
@@ -46,6 +98,7 @@
3B20EF1C1584EA9A006C0CDF = {
isa = PBXGroup;
children = (
3B20EF5E15853331006C0CDF /* Resources */,
3B20EF311584EA9A006C0CDF /* iLyrics */,
3B20EF2A1584EA9A006C0CDF /* Frameworks */,
3B20EF281584EA9A006C0CDF /* Products */,
@@ -63,6 +116,8 @@
3B20EF2A1584EA9A006C0CDF /* Frameworks */ = {
isa = PBXGroup;
children = (
3BBD9B75158C873F00A5CD2C /* Growl.framework */,
3B81D4FD1586248F00916CE3 /* ScriptingBridge.framework */,
3B20EF2B1584EA9A006C0CDF /* Cocoa.framework */,
3B20EF2D1584EA9A006C0CDF /* Other Frameworks */,
);
@@ -82,9 +137,19 @@
3B20EF311584EA9A006C0CDF /* iLyrics */ = {
isa = PBXGroup;
children = (
3B2DC558158CCE8100C004A4 /* Changelog.rtf */,
3B20EF3D1584EA9A006C0CDF /* AppDelegate.h */,
3B20EF3E1584EA9A006C0CDF /* AppDelegate.m */,
3B20EF401584EA9A006C0CDF /* MainMenu.xib */,
3BE95015158A291500E78FEF /* PreferencesController.h */,
3BE95016158A291500E78FEF /* PreferencesController.m */,
3B20EF501584EAF8006C0CDF /* MainController.h */,
3B20EF511584EAF8006C0CDF /* MainController.m */,
3B20EF5A1584F34E006C0CDF /* SearchResult.h */,
3B20EF5B1584F34E006C0CDF /* SearchResult.m */,
3B20EF531584ECD9006C0CDF /* Lyrics.h */,
3B20EF541584ECD9006C0CDF /* Lyrics.m */,
3B20EF591584F31D006C0CDF /* Lyrics Hoster */,
3B20EF321584EA9A006C0CDF /* Supporting Files */,
);
path = iLyrics;
@@ -93,6 +158,7 @@
3B20EF321584EA9A006C0CDF /* Supporting Files */ = {
isa = PBXGroup;
children = (
3B81D5041586298100916CE3 /* iTunes.h */,
3B20EF331584EA9A006C0CDF /* iLyrics-Info.plist */,
3B20EF341584EA9A006C0CDF /* InfoPlist.strings */,
3B20EF371584EA9A006C0CDF /* main.m */,
@@ -102,6 +168,29 @@
name = "Supporting Files";
sourceTree = "<group>";
};
3B20EF591584F31D006C0CDF /* Lyrics Hoster */ = {
isa = PBXGroup;
children = (
3BE9500F158A269D00E78FEF /* Magistrix.h */,
3BE95010158A269D00E78FEF /* Magistrix.m */,
3B20EF5D1584F458006C0CDF /* LyricsHoster.h */,
);
name = "Lyrics Hoster";
sourceTree = "<group>";
};
3B20EF5E15853331006C0CDF /* Resources */ = {
isa = PBXGroup;
children = (
3BBD9B79158C87D000A5CD2C /* Growl Registration Ticket.growlRegDict */,
3B20EF481584EAA3006C0CDF /* iLyrics.icns */,
3B20EF4A1584EAAD006C0CDF /* iTunes-icon.icns */,
3B20EF4B1584EAAD006C0CDF /* Diamond.tiff */,
3B20EF4C1584EAAD006C0CDF /* Download-icon.icns */,
3B20EF6315853345006C0CDF /* Localizable.strings */,
);
name = Resources;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
@@ -112,6 +201,7 @@
3B20EF231584EA9A006C0CDF /* Sources */,
3B20EF241584EA9A006C0CDF /* Frameworks */,
3B20EF251584EA9A006C0CDF /* Resources */,
3BBD9B77158C874F00A5CD2C /* CopyFiles */,
);
buildRules = (
);
@@ -136,6 +226,7 @@
hasScannedForEncodings = 0;
knownRegions = (
en,
de,
);
mainGroup = 3B20EF1C1584EA9A006C0CDF;
productRefGroup = 3B20EF281584EA9A006C0CDF /* Products */;
@@ -155,6 +246,12 @@
3B20EF361584EA9A006C0CDF /* InfoPlist.strings in Resources */,
3B20EF3C1584EA9A006C0CDF /* Credits.rtf in Resources */,
3B20EF421584EA9A006C0CDF /* MainMenu.xib in Resources */,
3B20EF491584EAA3006C0CDF /* iLyrics.icns in Resources */,
3B20EF4D1584EAAD006C0CDF /* iTunes-icon.icns in Resources */,
3B20EF4E1584EAAD006C0CDF /* Diamond.tiff in Resources */,
3B20EF4F1584EAAD006C0CDF /* Download-icon.icns in Resources */,
3B20EF6115853345006C0CDF /* Localizable.strings in Resources */,
3BBD9B7A158C87D000A5CD2C /* Growl Registration Ticket.growlRegDict in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -167,6 +264,11 @@
files = (
3B20EF381584EA9A006C0CDF /* main.m in Sources */,
3B20EF3F1584EA9A006C0CDF /* AppDelegate.m in Sources */,
3B20EF521584EAF8006C0CDF /* MainController.m in Sources */,
3B20EF551584ECD9006C0CDF /* Lyrics.m in Sources */,
3B20EF5C1584F34E006C0CDF /* SearchResult.m in Sources */,
3BE95011158A269D00E78FEF /* Magistrix.m in Sources */,
3BE95017158A291500E78FEF /* PreferencesController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -185,6 +287,7 @@
isa = PBXVariantGroup;
children = (
3B20EF3B1584EA9A006C0CDF /* en */,
3BBD9B74158C86DA00A5CD2C /* de */,
);
name = Credits.rtf;
sourceTree = "<group>";
@@ -197,6 +300,15 @@
name = MainMenu.xib;
sourceTree = "<group>";
};
3B20EF6315853345006C0CDF /* Localizable.strings */ = {
isa = PBXVariantGroup;
children = (
3B20EF6215853345006C0CDF /* en */,
3BBD9B72158C7F8A00A5CD2C /* de */,
);
name = Localizable.strings;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
@@ -250,6 +362,10 @@
3B20EF461584EA9A006C0CDF /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)\"",
);
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "iLyrics/iLyrics-Prefix.pch";
INFOPLIST_FILE = "iLyrics/iLyrics-Info.plist";
@@ -261,6 +377,10 @@
3B20EF471584EA9A006C0CDF /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)\"",
);
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "iLyrics/iLyrics-Prefix.pch";
INFOPLIST_FILE = "iLyrics/iLyrics-Info.plist";
@@ -288,6 +408,7 @@
3B20EF471584EA9A006C0CDF /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};

View File

@@ -7,9 +7,25 @@
//
#import <Cocoa/Cocoa.h>
#import <ScriptingBridge/ScriptingBridge.h>
#import "iTunes.h"
#import "PreferencesController.h"
#import "MainController.h"
@interface AppDelegate : NSObject <NSApplicationDelegate>
@interface AppDelegate : NSObject <NSApplicationDelegate, NSTokenFieldDelegate>
@property (assign) IBOutlet NSWindow *window;
@property (weak) IBOutlet MainController *mainController;
@property (unsafe_unretained) IBOutlet NSWindow *preferencesWindow;
@property (weak) IBOutlet PreferencesController *preferencesController;
@property (weak) IBOutlet NSButton *quitWhenAllWindowClosedCheckBox;
//- (IBAction)showPreferences:(id)sender;
//- (IBAction)searchFormatChanged:(id)sender;
- (IBAction)runiTunes:(id)sender;
- (IBAction)quitiTunes:(id)sender;
- (IBAction)playPauseiTunes:(id)sender;
- (IBAction)previousTrack:(id)sender;
- (IBAction)nextTrack:(id)sender;
@end

View File

@@ -7,14 +7,95 @@
//
#import "AppDelegate.h"
#import "Magistrix.h"
@implementation AppDelegate
@implementation AppDelegate {
iTunesApplication *iTunes;
NSArray *keyTokens;
NSMutableArray *searchFormat;
Magistrix *magistrix;
}
@synthesize window = _window;
@synthesize window;
@synthesize mainController;
@synthesize preferencesWindow;
@synthesize preferencesController;
@synthesize quitWhenAllWindowClosedCheckBox;
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
// Insert code here to initialize your application
magistrix = [[Magistrix alloc] init];
[preferencesController addHoster:magistrix];
keyTokens = [NSArray arrayWithObjects:@"%name%", @"%artist%", @"%album%", nil];
[window setExcludedFromWindowsMenu:YES];
iTunes = [SBApplication applicationWithBundleIdentifier:@"com.apple.iTunes"];
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[quitWhenAllWindowClosedCheckBox setState:[defaults boolForKey:@"Quit when all windows are closed"]?NSOnState:NSOffState];
[mainController loadFromDefaults:defaults];
}
-(NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender {
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[defaults setBool:[quitWhenAllWindowClosedCheckBox state] == NSOnState forKey:@"Quit when all windows are closed"];
[mainController saveToDefalts:defaults];
[defaults synchronize];
return NSTerminateNow;
}
-(BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)sender {
return [quitWhenAllWindowClosedCheckBox state] == NSOnState;
}
-(BOOL)validateMenuItem:(NSMenuItem *)menuItem {
SEL action = [menuItem action];
if (action == @selector(runitunes:)) {
return ![iTunes isRunning];
}
if (action == @selector(quitiTunes:) || action == @selector(playPauseiTunes:) || action == @selector(previousTrack:) || action == @selector(nextTrack:)) {
return [iTunes isRunning];
}
return [self respondsToSelector:action];
}
/*
- (IBAction)showPreferences:(id)sender {
[searchFormatField setObjectValue:searchFormat];
[preferencesWindow makeKeyAndOrderFront:sender];
}
- (IBAction)searchFormatChanged:(id)sender {
NSArray *tokens = [searchFormatField objectValue];
[searchFormat removeAllObjects];
[searchFormat addObjectsFromArray:tokens];
}
*/
-(NSString *)searchFormat {
NSMutableString *string = [[NSMutableString alloc] init];
for (NSString *token in searchFormat) {
[string appendString:token];
}
return string;
}
- (IBAction)runiTunes:(id)sender {
[iTunes run];
[window update];
}
- (IBAction)quitiTunes:(id)sender {
[iTunes quit];
[window update];
}
- (IBAction)playPauseiTunes:(id)sender {
[iTunes playpause];
[window update];
}
- (IBAction)previousTrack:(id)sender {
[iTunes previousTrack];
}
- (IBAction)nextTrack:(id)sender {
[iTunes nextTrack];
}
@end

17
iLyrics/Lyrics.h Normal file
View File

@@ -0,0 +1,17 @@
//
// Lyrics.h
// iLyrics
//
// Created by Kim Wittenburg on 10.06.12.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface Lyrics : NSObject
@property NSString *name;
@property NSString *artist;
@property NSString *lyrics;
-(id)initWithName: (NSString*) name byArtist: (NSString*) artist withLyrics: (NSString*) lyrics;
@end

24
iLyrics/Lyrics.m Normal file
View File

@@ -0,0 +1,24 @@
//
// Lyrics.m
// iLyrics
//
// Created by Kim Wittenburg on 10.06.12.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//
#import "Lyrics.h"
@implementation Lyrics
@synthesize name;
@synthesize artist;
@synthesize lyrics;
-(id)initWithName:(NSString *)son byArtist:(NSString *)art withLyrics:(NSString *)lyr {
lyrics = lyr;
artist = art;
name = son;
return self;
}
@end

30
iLyrics/LyricsHoster.h Normal file
View File

@@ -0,0 +1,30 @@
//
// LyricsHoster.h
// iLyrics
//
// Created by Kim Wittenburg on 10.06.12.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "SearchResult.h"
#import "Lyrics.h"
@protocol LyricsHoster <NSObject>
-(NSString*) name;
-(NSDate*) hosterVersion;
-(void) startNewSearchForQuery: (NSString*) query;
-(BOOL) hasMoreResults;
//Return an empty array for a "No results found" message and nil for a "network error".
-(NSArray*) nextResults;
-(void) resetLoadedResults;
-(Lyrics*) lyricsBySearchResult: (SearchResult *) result;
@end

14
iLyrics/Magistrix.h Normal file
View File

@@ -0,0 +1,14 @@
//
// Magistrix.h
// iLyrics
//
// Created by Kim Wittenburg on 14.06.12.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "LyricsHoster.h"
@interface Magistrix : NSObject <LyricsHoster>
@end

210
iLyrics/Magistrix.m Normal file
View File

@@ -0,0 +1,210 @@
//
// Magistrix.m
// iLyrics
//
// Created by Kim Wittenburg on 14.06.12.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//
//
//TODO: Use correct Date
#import "Magistrix.h"
typedef enum {
LyricsPage,
ResultsPage,
NoResultsPage,
UnknownPage
} PageType;
@implementation Magistrix {
NSString *query;
int loadedResults;
int resultCount;
}
-(NSString*) name {
return @"Magistrix";
}
-(NSDate *)hosterVersion {
return [NSDate dateWithString:@"2012-06-16 11:00:00 +0100"];
}
-(void) startNewSearchForQuery: (NSString*) q {
[self resetLoadedResults];
query = q;
}
-(BOOL) hasMoreResults {
return loadedResults < resultCount;
}
-(NSArray*) nextResults {
int site = (loadedResults/10) + 1;
NSString *searchPath = [NSString stringWithFormat:@"http://www.magistrix.de/lyrics/search?q=%@&page=%i", [query stringByReplacingOccurrencesOfString:@" " withString:@"+"], site];
NSURL *searchURL = [NSURL URLWithString:searchPath];
NSError *error;
NSString *page = [NSString stringWithContentsOfURL:searchURL encoding:NSUTF8StringEncoding error:&error];
if (error) {
return nil;
}
PageType pType = [self typeOfPage:page];
if (pType == LyricsPage) {
resultCount = 1;
loadedResults = 1;
return [NSArray arrayWithObject:[self searchResultFromLyricsPage:page atURL:searchURL]];
} else if (pType == ResultsPage) {
[self shouldSetResultCountFromPage:page];
return [self searchResultsFromPage:page];
} else if (pType == NoResultsPage) {
return [[NSArray alloc] init];
} else {
NSRunAlertPanel(NSLocalizedString(@"Magistrix.messages.unknownPage.title", @""), NSLocalizedString(@"Magistrix.messages.unknownPage.detail", @""), NSLocalizedString(@"OK", @""), nil, nil);
return [[NSArray alloc] init];
}
}
-(PageType) typeOfPage: (NSString *) page {
if ([page rangeOfString:@"<title>Songtext-Suche</title>"].location != NSNotFound) {
if ([page rangeOfString:@"<div class='empty_collection'>"].location != NSNotFound) {
return NoResultsPage;
} else {
return ResultsPage;
}
}
if ([page rangeOfString:@"<div id='songtext'>"].location != NSNotFound) {
return LyricsPage;
}
return UnknownPage;
}
-(SearchResult*) searchResultFromLyricsPage: (NSString *) page atURL: (NSURL *) url{
int headingStart = NSMaxRange([page rangeOfString:@"<h1>"]);
int headingEnd = [page rangeOfString:@"</h1>"].location;
int artistStart = NSMaxRange([page rangeOfString:@">" options:NSCaseInsensitiveSearch range:NSMakeRange(headingStart, headingEnd-headingStart)]);
NSRange artistEndTag = [page rangeOfString:@"</a>" options:NSCaseInsensitiveSearch range:NSMakeRange(artistStart, headingEnd-artistStart)];
int artistEnd = artistEndTag.location;
int songNameStart = NSMaxRange(artistEndTag);
int songNameEnd = headingEnd;
NSString *artist = [page substringWithRange:NSMakeRange(artistStart, artistEnd-artistStart)];
NSString *songName = [page substringWithRange:NSMakeRange(songNameStart, songNameEnd-songNameStart)];
//Remove the " Lyric" and the " &ndash; " from the Song name
songName = [[songName substringToIndex:[songName length]-[@" Lyric" length]] substringFromIndex:[@" &ndash; " length]];
NSString *preview = [self lyricsFromPage:page];
return [[SearchResult alloc]initWithName:songName fromArtist:artist preview:preview link:url];
}
-(NSArray*) searchResultsFromPage: (NSString *) page {
int resultsTableStart = NSMaxRange([page rangeOfString:@"<table>"]);
int resultsTableEnd = [page rangeOfString:@"</table>"].location;
NSArray *resultTags = [self resultTagsFromTable:[page substringWithRange:NSMakeRange(resultsTableStart, resultsTableEnd-resultsTableStart)]];
NSMutableArray *searchResults = [[NSMutableArray alloc] init];
for (NSString *tag in resultTags) {
[searchResults addObject:[self searchResultFromResultTag:tag]];
}
//Increase loadedResults by 10 which is a full results site
//Even if there are less than 10 results on a page (would not have any effect)
loadedResults += 10;
return searchResults;
}
-(NSArray*) resultTagsFromTable: (NSString *) table {
NSRange restRange = NSMakeRange(0, [table length]);
NSMutableArray *tags = [[NSMutableArray alloc] init];
NSUInteger currentIndex = [table rangeOfString:@"<td>"].location;
while (currentIndex != NSNotFound) {
int startIndex = currentIndex + [@"<td>" length];
int endIndex = [table rangeOfString:@"</td>" options:NSCaseInsensitiveSearch range:restRange].location;
NSRange tagRange = NSMakeRange(startIndex, endIndex-startIndex);
[tags addObject:[table substringWithRange:tagRange]];
restRange = [self restRangeFromString:table subtractingRange:tagRange];
restRange.length -= [@"</td>" length];
restRange.location += [@"</td>" length];
currentIndex = [table rangeOfString:@"<td>" options:NSCaseInsensitiveSearch range:restRange].location;
}
return tags;
}
-(SearchResult*) searchResultFromResultTag: (NSString *) tag {
NSRange artistStartRange = [tag rangeOfString:@">"];
int artistEndIndex = [tag rangeOfString:@"<" options:NSCaseInsensitiveSearch range:[self restRangeFromString:tag subtractingRange:artistStartRange]].location;
int artistStartIndex = NSMaxRange(artistStartRange);
NSString *artist = [tag substringWithRange:NSMakeRange(artistStartIndex, artistEndIndex-artistStartIndex)];
NSRange restRange = [self restRangeFromString:tag subtractingRange:NSMakeRange(artistEndIndex, [@"</a>" length])];
NSRange songNameTagStartRange = [tag rangeOfString:@"<a href=\"" options:NSCaseInsensitiveSearch range:restRange];
int linkStart = NSMaxRange(songNameTagStartRange);
NSRange linkEndRage = [tag rangeOfString:@"\"" options:NSCaseInsensitiveSearch range:[self restRangeFromString:tag subtractingRange:songNameTagStartRange]];
NSURL *link = [self urlFromHref:[tag substringWithRange:NSMakeRange(linkStart, linkEndRage.location-linkStart)]];
int songNameStart = NSMaxRange([tag rangeOfString:@">" options:NSCaseInsensitiveSearch range:[self restRangeFromString:tag subtractingRange:songNameTagStartRange]]);
int songNameEnd = [tag rangeOfString:@"</a>" options:NSCaseInsensitiveSearch range:[self restRangeFromString:tag subtractingRange:songNameTagStartRange]].location;
NSString *songName = [tag substringWithRange:NSMakeRange(songNameStart, songNameEnd-songNameStart)];
int previewStart = songNameEnd + [@"</a>" length] + [@"\n<p>" length];
NSRange previewRestRange = NSMakeRange(previewStart, [tag length]-previewStart);
int previewEnd = [tag rangeOfString:@"</p>" options:NSCaseInsensitiveSearch range:previewRestRange].location;
NSString *preview = [self stringByRemovingHTMLTags:[tag substringWithRange:NSMakeRange(previewStart, previewEnd-previewStart)]];
return [[SearchResult alloc] initWithName:songName fromArtist:artist preview:preview link:link];
}
-(NSURL*) urlFromHref: (NSString *) link {
if ([link hasPrefix:@"/"]) {
return [NSURL URLWithString:[NSString stringWithFormat:@"http://www.Magistrix.de%@", link]];
} else {
return [NSURL URLWithString:link];
}
}
-(NSString*) stringByRemovingHTMLTags: (NSString *)string {
return [[[[[[[[[[string stringByReplacingOccurrencesOfString:@"<strong>" withString:@""] stringByReplacingOccurrencesOfString:@"</strong>" withString:@""] stringByReplacingOccurrencesOfString:@"<b>" withString:@""] stringByReplacingOccurrencesOfString:@"</b>" withString:@""] stringByReplacingOccurrencesOfString:@"<i>" withString:@""] stringByReplacingOccurrencesOfString:@"</i>" withString:@""] stringByReplacingOccurrencesOfString:@"<p>" withString:@""] stringByReplacingOccurrencesOfString:@"</p>" withString:@""] stringByReplacingOccurrencesOfString:@"<br />" withString:@""] stringByReplacingOccurrencesOfString:@"&quot;" withString:@"\""];
}
-(NSRange) restRangeFromString: (NSString *) page subtractingRange: (NSRange) aRange {
int loc = NSMaxRange(aRange);
return NSMakeRange(loc, [page length]-loc);
}
-(void) shouldSetResultCountFromPage: (NSString *) page {
if (resultCount == 0) {
//Nothing loaded before
NSRange resultsLabelStartRange = [page rangeOfString:@"<p>Ergebnisse 1 bis "];
int resultsLabelEnd = [page rangeOfString:@"</p>" options:NSCaseInsensitiveSearch range:[self restRangeFromString:page subtractingRange:resultsLabelStartRange]].location;
NSString *resultsLabel = [page substringWithRange:NSMakeRange(NSMaxRange(resultsLabelStartRange), resultsLabelEnd-resultsLabelStartRange.location)];
if ([resultsLabel rangeOfString:@"ungefähr"].location != NSNotFound){
//Needs not more than 100 which means 10 sites (which is the maximum)
resultCount = 100;
} else {
int resultsStart = NSMaxRange([resultsLabel rangeOfString:@"von "]);
int resultsEnd = [resultsLabel rangeOfString:@"<"].location;
NSString *results = [resultsLabel substringWithRange:NSMakeRange(resultsStart, resultsEnd-resultsStart)];
resultCount = [results intValue];
}
if (resultCount > 100) {
resultCount = 100;
}
}
}
-(void) resetLoadedResults {
loadedResults = 0;
}
-(Lyrics*) lyricsBySearchResult: (SearchResult *) result {
NSError *error = nil;
NSString *page = [NSString stringWithContentsOfURL:[result link] encoding:NSUTF8StringEncoding error:&error];
if (error) {
return nil;
}
NSString *lyrics = [self lyricsFromPage:page];
return [[Lyrics alloc] initWithName:[result name] byArtist:[result artist] withLyrics:lyrics];
}
-(NSString *) lyricsFromPage: (NSString *)page {
int lyricsStart = NSMaxRange([page rangeOfString:@"<div id='songtext'>"]) + [@"\n" length];
NSRange restRange = NSMakeRange(lyricsStart, [page length]-lyricsStart);
int lyricsEnd = [page rangeOfString:@"<div class='clear'></div>" options:NSCaseInsensitiveSearch range:restRange].location;
NSString *lyrics = [self stringByRemovingHTMLTags:[page substringWithRange:NSMakeRange(lyricsStart, lyricsEnd-lyricsStart)]];
return lyrics;
}
@end

46
iLyrics/MainController.h Normal file
View File

@@ -0,0 +1,46 @@
//
// MainController.h
// iLyrics
//
// Created by Kim Wittenburg on 10.06.12.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//
#import <Cocoa/Cocoa.h>
#import <Scripting/Scripting.h>
#import <ScriptingBridge/ScriptingBridge.h>
#import <AppKitScripting/AppKitScripting.h>
#import "iTunes.h"
#import "Magistrix.h"
#import "SearchResult.h"
#import "Lyrics.h"
#import <Growl/Growl.h>
@interface MainController : NSObject <NSWindowDelegate, NSOutlineViewDataSource, NSOutlineViewDelegate>
@property (weak) IBOutlet NSMenuItem *iLyricsMenuItem;
@property (unsafe_unretained) IBOutlet NSWindow *window;
@property (weak) IBOutlet NSSearchField *searchField;
@property (weak) IBOutlet NSOutlineView *resultsOutline;
@property (weak) IBOutlet NSButton *loadMoreResultsButton;
@property (weak) IBOutlet NSButton *showPreviewCheckBox;
@property (weak) IBOutlet NSPopover *previewPopover;
@property (unsafe_unretained) IBOutlet NSTextView *previewTextArea;
@property (weak) IBOutlet NSTextField *songLabel;
@property (weak) IBOutlet NSTextField *artistLabel;
@property (weak) IBOutlet NSButton *sendToiTunesButton;
@property (weak) IBOutlet NSButton *downloadLyricsButton;
@property (unsafe_unretained) IBOutlet NSTextView *lyricsArea;
@property (readonly) Lyrics *currentLyrics;
- (IBAction)getCurrentiTunesSong:(id)sender;
- (IBAction)startNewSearch:(id)sender;
- (IBAction)loadNextResults:(id)sender;
- (IBAction)resetLoadedResults:(id)sender;
- (IBAction)lyricsSelectionChanged:(NSOutlineView *)sender;
- (IBAction)sendLyricsToiTunes:(id)sender;
- (IBAction)downloadLyrics:(id)sender;
- (IBAction)showiLyricsWindow:(id)sender;
- (void)saveToDefalts: (NSUserDefaults *)defaults;
- (void)loadFromDefaults: (NSUserDefaults *)defaults;
@end

283
iLyrics/MainController.m Normal file
View File

@@ -0,0 +1,283 @@
//
// MainController.m
// iLyrics
//
// Created by Kim Wittenburg on 10.06.12.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//
#import "MainController.h"
@implementation MainController {
NSMutableArray *data;
id<LyricsHoster> currentHoster;
BOOL lyricsSelected;
NSInteger selectedSavePanelButton;
NSURL *saveFile;
iTunesApplication *iTunes;
Lyrics *currentLyrics;
int selectedRow;
}
@synthesize iLyricsMenuItem;
@synthesize window;
@synthesize searchField;
@synthesize resultsOutline;
@synthesize loadMoreResultsButton;
@synthesize showPreviewCheckBox;
@synthesize previewPopover;
@synthesize previewTextArea;
@synthesize songLabel;
@synthesize artistLabel;
@synthesize sendToiTunesButton;
@synthesize downloadLyricsButton;
@synthesize lyricsArea;
-(id)init {
iTunes = [SBApplication applicationWithBundleIdentifier:@"com.apple.iTunes"];
data = [[NSMutableArray alloc] init];
currentHoster = [[Magistrix alloc] init];
return [super init];
}
#pragma mark -
#pragma mark Outline view Data Source and Delegate
-(NSInteger)outlineView:(NSOutlineView *)outlineView numberOfChildrenOfItem:(id)item {
return item == nil ? [data count] : 0;
}
-(id)outlineView:(NSOutlineView *)outlineView child:(NSInteger)index ofItem:(id)item {
return [data objectAtIndex:index];
}
-(BOOL)outlineView:(NSOutlineView *)outlineView isItemExpandable:(id)item {
return NO;
}
-(id)outlineView:(NSOutlineView *)outlineView objectValueForTableColumn:(NSTableColumn *)tableColumn byItem:(id)item {
if ([[tableColumn identifier] isEqualToString:@"song"]) {
return [item name];
} else {
return [item artist];
}
return nil;
}
-(NSString *)outlineView:(NSOutlineView *)outlineView toolTipForCell:(NSCell *)cell rect:(NSRectPointer)rect tableColumn:(NSTableColumn *)tableColumn item:(id)item mouseLocation:(NSPoint)mouseLocation {
//item is an instance of SearchResult
[self shouldShowPreviewForCellRect:*rect searchResult:item];
return nil;
}
#pragma mark -
#pragma mark Responding to Lyrics Search
- (IBAction)getCurrentiTunesSong:(id)sender {
iTunesTrack *track = [iTunes currentTrack];
if (track == nil) {
NSBeginAlertSheet(NSLocalizedString(@"iTunes.messages.iTunesIdle.title", @""), NSLocalizedString(@"OK", @""), nil, nil, window, nil, nil, nil, nil, NSLocalizedString(@"iTunes.messages.iTunesIdle.detail", @""));
return;
}
NSString *name = [track name];
NSString *artist = [track artist];
if (name == nil) {
NSBeginAlertSheet(NSLocalizedString(@"iTunes.messages.noTrackPlaying.title", @""), NSLocalizedString(@"OK", @""), nil, nil, window, nil, nil, nil, nil, NSLocalizedString(@"iTunes.messages.noTrackPlaying.detail", @""));
return;
}
NSString *searchText = [NSString stringWithFormat:@"%@ - %@", name, artist];
[searchField setStringValue:searchText];
[searchField performClick:sender];
}
- (IBAction)startNewSearch:(id)sender {
[self resetLoadedResults:sender];
if ([[searchField stringValue] length] > 0) {
[currentHoster startNewSearchForQuery:[searchField stringValue]];
[self loadNextResults:sender];
}
}
- (IBAction)loadNextResults:(id)sender {
NSArray *nextResults = [currentHoster nextResults];
if (nextResults == nil) {
NSRunCriticalAlertPanel(NSLocalizedString(@"Hoster.messages.networkError.title", @""), NSLocalizedString(@"Hoster.messages.networkError.detail", @""), NSLocalizedString(@"OK", @""), nil, nil);
return;
}
if ([nextResults count] == 0) {
NSRunAlertPanel(NSLocalizedString(@"Hoster.messages.noResults.title", @""), NSLocalizedString(@"Hoster.messages.noResults.detail", @""), NSLocalizedString(@"OK", @""), nil, nil);
return;
}
[data addObjectsFromArray:nextResults];
[resultsOutline reloadData];
[loadMoreResultsButton setEnabled:[currentHoster hasMoreResults]];
}
-(IBAction)resetLoadedResults:(id)sender {
[currentHoster resetLoadedResults];
[data removeAllObjects];
[resultsOutline reloadData];
[loadMoreResultsButton setEnabled:[currentHoster hasMoreResults]];
[self lyricsSelectionChanged:resultsOutline];
}
- (IBAction)lyricsSelectionChanged:(NSOutlineView *)sender {
int index = [sender selectedRow];
if (index < 0) {
lyricsSelected = NO;
currentLyrics = nil;
NSString *noSelectionText = NSLocalizedString(@"iLyrics.text.noSelection", @"");
[songLabel setStringValue:noSelectionText];
[artistLabel setStringValue:noSelectionText];
[lyricsArea setString:noSelectionText];
[lyricsArea setEditable:NO];
} else {
if (selectedRow != index) {
lyricsSelected = YES;
SearchResult *result = [data objectAtIndex:index];
Lyrics *lyrics = [currentHoster lyricsBySearchResult:result];
currentLyrics = lyrics;
if (lyrics == nil) {
NSRunCriticalAlertPanel(NSLocalizedString(@"Hoster.messages.networkError.title", @""), NSLocalizedString(@"Hoster.messages.networkError.detail", @""), NSLocalizedString(@"OK", @""), nil, nil);
NSString *noNetwork = NSLocalizedString(@"Hoster.text.noNetwork", @"");
[songLabel setStringValue:noNetwork];
[artistLabel setStringValue:noNetwork];
[lyricsArea setString:noNetwork];
[lyricsArea setEditable:NO];
}
[songLabel setStringValue:[lyrics name]];
[artistLabel setStringValue:[lyrics artist]];
[lyricsArea setString:[lyrics lyrics]];
[lyricsArea setEditable:YES];
}
}
selectedRow = index;
[window update];
}
-(void) shouldShowPreviewForCellRect: (NSRect) rect searchResult: (SearchResult *) result {
if ([showPreviewCheckBox state] == NSOnState) {
NSString *lyrics = [result preview];
if (lyrics) {
rect.size.width = [resultsOutline frame].size.width;
[previewTextArea setString:lyrics];
[previewPopover showRelativeToRect:rect ofView:resultsOutline preferredEdge:NSMaxXEdge];
}
}
}
- (IBAction)sendLyricsToiTunes:(id)sender {
iTunesTrack *track = [iTunes currentTrack];
NSString *name = [track name];
if (name == nil) {
NSBeginAlertSheet(NSLocalizedString(@"iTunes.messages.noTrackPlaying.title", @""), NSLocalizedString(@"OK", @""), nil, nil, window, nil, nil, nil, nil, NSLocalizedString(@"iTunes.messages.noTrackPlaying.detail", @""));
return;
}
NSString *oldLyrics = [track lyrics];
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];
}
}
- (void)replaceLyricsSheetDidEnd:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo {
if (returnCode == NSAlertDefaultReturn) {
[[iTunes currentTrack] setLyrics:[lyricsArea string]];
[GrowlApplicationBridge notifyWithTitle:NSLocalizedString(@"Growl.messages.lyricsSent.title", @"") description:NSLocalizedString(@"Growl.messages.lyricsSent.detail", @"") 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"]];
[savePanel setAllowsOtherFileTypes:YES];
[savePanel setCanSelectHiddenExtension:YES];
[savePanel setExtensionHidden:YES];
[savePanel setNameFieldStringValue:[currentLyrics name]];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(savePanelDidClose:) name:NSWindowDidEndSheetNotification object:window];
void (^handler) (NSInteger) = ^(NSInteger result) {
selectedSavePanelButton = result;
saveFile = [savePanel URL];
};
[savePanel beginSheetModalForWindow:window completionHandler:handler];
}
-(void) savePanelDidClose: (NSNotification *) notification{
[[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowDidEndSheetNotification object:window];
if (selectedSavePanelButton == NSOKButton) {
BOOL success = [[[lyricsArea string] dataUsingEncoding:NSUTF8StringEncoding] writeToURL:saveFile atomically:NO];
if (!success) {
NSBeginAlertSheet(NSLocalizedString(@"messages.error.saveLyrics.title", @""), NSLocalizedString(@"OK", @""), nil, nil, window, nil, nil, nil, nil, NSLocalizedString(@"messages.error.saveLyrics.detail", @""));
} else {
[GrowlApplicationBridge notifyWithTitle:NSLocalizedString(@"Growl.messages.lyricsSaved.title", @"") description:[NSString stringWithFormat:NSLocalizedString(@"Growl.messages.lyricsSaved.detail", @""), [saveFile path]] notificationName:@"Lyrics saved to File" iconData:nil priority:0 isSticky:NO clickContext:nil];
}
}
}
-(Lyrics *)currentLyrics {
return currentLyrics;
}
#pragma mark -
#pragma mark Show the window
- (IBAction)showiLyricsWindow:(id)sender {
[window makeKeyAndOrderFront:sender];
}
#pragma mark window delegate
-(BOOL)validateMenuItem:(NSMenuItem *)menuItem {
return [self validateUserInterfaceItem:menuItem];
}
-(BOOL)validateToolbarItem:(NSToolbarItem *)theItem {
return [self validateUserInterfaceItem:theItem];
}
-(BOOL)validateUserInterfaceItem:(id<NSValidatedUserInterfaceItem>)item {
SEL action = [item action];
if (action == @selector(downloadLyrics:)) {
[downloadLyricsButton setEnabled:lyricsSelected];
return lyricsSelected;
}
if (action == @selector(sendLyricsToiTunes:)) {
BOOL enabled = lyricsSelected && [iTunes isRunning];
[sendToiTunesButton setEnabled:enabled];
return enabled;
}
if (action == @selector(getCurrentiTunesSong:)) {
return [iTunes isRunning];
}
if (action == @selector(showPreview:)) {
return [resultsOutline clickedRow] >= 0;
}
return [self respondsToSelector:[item action]];
}
-(void)windowDidBecomeMain:(NSNotification *)notification {
[iLyricsMenuItem setOffStateImage:nil];
[iLyricsMenuItem setState:NSOnState];
}
-(void)windowDidResignMain:(NSNotification *)notification {
[iLyricsMenuItem setOffStateImage:nil];
[iLyricsMenuItem setState:NSOffState];
}
-(void)windowDidMiniaturize:(NSNotification *)notification {
NSString *imgPath = [[NSBundle mainBundle] pathForImageResource:@"Diamond"];
NSImage *miniaturizedImage = [[NSImage alloc] initWithContentsOfFile:imgPath];
[iLyricsMenuItem setOffStateImage:miniaturizedImage];
[iLyricsMenuItem setState:NSOffState];
}
-(void)saveToDefalts:(NSUserDefaults *)defaults {
[defaults setBool:[showPreviewCheckBox state] == NSOnState forKey:@"Show preview"];
}
-(void)loadFromDefaults:(NSUserDefaults *)defaults {
[showPreviewCheckBox setState:[defaults boolForKey:@"Show preview"]?NSOnState:NSOffState];
}
@end

View File

@@ -0,0 +1,20 @@
//
// PreferencesController.h
// iLyrics
//
// Created by Kim Wittenburg on 14.06.12.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "LyricsHoster.h"
@interface PreferencesController : NSObject <NSTableViewDataSource>
@property (weak) IBOutlet NSTableView *hosterTable;
@property NSArray *hosters;
-(void) addHoster: (id<LyricsHoster>) hoster;
-(void) removeHoster: (id<LyricsHoster>) hoster;
@end

View File

@@ -0,0 +1,64 @@
//
// PreferencesController.m
// iLyrics
//
// Created by Kim Wittenburg on 14.06.12.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//
#import "PreferencesController.h"
@implementation PreferencesController {
NSMutableArray *hosters;
}
@synthesize hosterTable;
-(id)init {
hosters = [[NSMutableArray alloc] init];
return [super init];
}
#pragma mark -
#pragma mark Properties
-(NSArray *)hosters {
return hosters;
}
-(void)setHosters:(NSArray *)hstrs {
hosters = [NSMutableArray arrayWithArray:hstrs];
[hosterTable reloadData];
}
#pragma mark Modifying hosters
-(void)addHoster:(id<LyricsHoster>)hoster {
[hosters addObject:hoster];
[hosterTable reloadData];
}
-(void)removeHoster:(id<LyricsHoster>)hoster {
[hosters removeObject:hoster];
[hosterTable reloadData];
}
#pragma mark -
#pragma mark Table Data Source
-(NSInteger)numberOfRowsInTableView:(NSTableView *)tableView {
return [hosters count];
}
-(id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row {
if ([[tableColumn identifier] isEqualToString:@"hoster"]) {
return [[hosters objectAtIndex:row] name];
} else {
NSDate *version = [[hosters objectAtIndex:row] hosterVersion];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateStyle:NSDateFormatterLongStyle];
[dateFormatter setTimeStyle:NSDateFormatterNoStyle];
return [dateFormatter stringFromDate:version];
// return desc == nil ? NSLocalizedString(@"iLyrics.text.illegalDateFormat", @"") : desc;
}
}
@end

19
iLyrics/SearchResult.h Normal file
View File

@@ -0,0 +1,19 @@
//
// SearchResult.h
// iLyrics
//
// Created by Kim Wittenburg on 10.06.12.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface SearchResult : NSObject
@property NSString *name;
@property NSString *artist;
@property NSString *preview;
@property id link;
-(id)initWithName: (NSString*) name fromArtist: (NSString*) artist preview: (NSString*) preview link: (id) link;
@end

25
iLyrics/SearchResult.m Normal file
View File

@@ -0,0 +1,25 @@
//
// SearchResult.m
// iLyrics
//
// Created by Kim Wittenburg on 10.06.12.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//
#import "SearchResult.h"
@implementation SearchResult
@synthesize name;
@synthesize artist;
@synthesize preview;
@synthesize link;
-(id)initWithName:(NSString *)sng fromArtist:(NSString *)art preview:(NSString *)pre link:(id)l {
name = sng;
artist = art;
preview = pre;
link = l;
return self;
}
@end

View File

@@ -0,0 +1,19 @@
{\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf470
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
\paperw11900\paperh16840\vieww9600\viewh8400\viewkind0
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720
\f0\b\fs24 \cf0 Entwickelt von:
\b0 \
Kim Wittenburg\
\
\b Designed von:
\b0 \
Kim Wittenburg\
\
\b Getestet von:
\b0 \
Kim Wittenbug}

View File

@@ -1,29 +1,19 @@
{\rtf0\ansi{\fonttbl\f0\fswiss Helvetica;}
{\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf470
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
\paperw9840\paperh8400
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural
\paperw11900\paperh16840\vieww9600\viewh8400\viewkind0
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720
\f0\b\fs24 \cf0 Engineering:
\b0 \
Some people\
Kim Wittenburg\
\
\b Human Interface Design:
\b0 \
Some other people\
Kim Wittenburg\
\
\b Testing:
\b0 \
Hopefully not nobody\
\
\b Documentation:
\b0 \
Whoever\
\
\b With special thanks to:
\b0 \
Mom\
}
Kim Wittenbug}

File diff suppressed because it is too large Load Diff

View File

@@ -7,7 +7,7 @@
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIconFile</key>
<string></string>
<string>iLyrics.icns</string>
<key>CFBundleIdentifier</key>
<string>wittenburg.kim.${PRODUCT_NAME:rfc1034identifier}</string>
<key>CFBundleInfoDictionaryVersion</key>

506
iLyrics/iTunes.h Normal file
View File

@@ -0,0 +1,506 @@
/*
* iTunes.h
*/
#import <AppKit/AppKit.h>
#import <ScriptingBridge/ScriptingBridge.h>
@class iTunesPrintSettings, iTunesApplication, iTunesItem, iTunesArtwork, iTunesEncoder, iTunesEQPreset, iTunesPlaylist, iTunesAudioCDPlaylist, iTunesDevicePlaylist, iTunesLibraryPlaylist, iTunesRadioTunerPlaylist, iTunesSource, iTunesTrack, iTunesAudioCDTrack, iTunesDeviceTrack, iTunesFileTrack, iTunesSharedTrack, iTunesURLTrack, iTunesUserPlaylist, iTunesFolderPlaylist, iTunesVisual, iTunesWindow, iTunesBrowserWindow, iTunesEQWindow, iTunesPlaylistWindow;
enum iTunesEKnd {
iTunesEKndTrackListing = 'kTrk' /* a basic listing of tracks within a playlist */,
iTunesEKndAlbumListing = 'kAlb' /* a listing of a playlist grouped by album */,
iTunesEKndCdInsert = 'kCDi' /* a printout of the playlist for jewel case inserts */
};
typedef enum iTunesEKnd iTunesEKnd;
enum iTunesEnum {
iTunesEnumStandard = 'lwst' /* Standard PostScript error handling */,
iTunesEnumDetailed = 'lwdt' /* print a detailed report of PostScript errors */
};
typedef enum iTunesEnum iTunesEnum;
enum iTunesEPlS {
iTunesEPlSStopped = 'kPSS',
iTunesEPlSPlaying = 'kPSP',
iTunesEPlSPaused = 'kPSp',
iTunesEPlSFastForwarding = 'kPSF',
iTunesEPlSRewinding = 'kPSR'
};
typedef enum iTunesEPlS iTunesEPlS;
enum iTunesERpt {
iTunesERptOff = 'kRpO',
iTunesERptOne = 'kRp1',
iTunesERptAll = 'kAll'
};
typedef enum iTunesERpt iTunesERpt;
enum iTunesEVSz {
iTunesEVSzSmall = 'kVSS',
iTunesEVSzMedium = 'kVSM',
iTunesEVSzLarge = 'kVSL'
};
typedef enum iTunesEVSz iTunesEVSz;
enum iTunesESrc {
iTunesESrcLibrary = 'kLib',
iTunesESrcIPod = 'kPod',
iTunesESrcAudioCD = 'kACD',
iTunesESrcMP3CD = 'kMCD',
iTunesESrcDevice = 'kDev',
iTunesESrcRadioTuner = 'kTun',
iTunesESrcSharedLibrary = 'kShd',
iTunesESrcUnknown = 'kUnk'
};
typedef enum iTunesESrc iTunesESrc;
enum iTunesESrA {
iTunesESrAAlbums = 'kSrL' /* albums only */,
iTunesESrAAll = 'kAll' /* all text fields */,
iTunesESrAArtists = 'kSrR' /* artists only */,
iTunesESrAComposers = 'kSrC' /* composers only */,
iTunesESrADisplayed = 'kSrV' /* visible text fields */,
iTunesESrASongs = 'kSrS' /* song names only */
};
typedef enum iTunesESrA iTunesESrA;
enum iTunesESpK {
iTunesESpKNone = 'kNon',
iTunesESpKBooks = 'kSpA',
iTunesESpKFolder = 'kSpF',
iTunesESpKGenius = 'kSpG',
iTunesESpKITunesU = 'kSpU',
iTunesESpKLibrary = 'kSpL',
iTunesESpKMovies = 'kSpI',
iTunesESpKMusic = 'kSpZ',
iTunesESpKPartyShuffle = 'kSpS',
iTunesESpKPodcasts = 'kSpP',
iTunesESpKPurchasedMusic = 'kSpM',
iTunesESpKTVShows = 'kSpT'
};
typedef enum iTunesESpK iTunesESpK;
enum iTunesEVdK {
iTunesEVdKNone = 'kNon' /* not a video or unknown video kind */,
iTunesEVdKMovie = 'kVdM' /* movie track */,
iTunesEVdKMusicVideo = 'kVdV' /* music video track */,
iTunesEVdKTVShow = 'kVdT' /* TV show track */
};
typedef enum iTunesEVdK iTunesEVdK;
enum iTunesERtK {
iTunesERtKUser = 'kRtU' /* user-specified rating */,
iTunesERtKComputed = 'kRtC' /* iTunes-computed rating */
};
typedef enum iTunesERtK iTunesERtK;
/*
* Standard Suite
*/
@interface iTunesPrintSettings : SBObject
@property (readonly) NSInteger copies; // the number of copies of a document to be printed
@property (readonly) BOOL collating; // Should printed copies be collated?
@property (readonly) NSInteger startingPage; // the first page of the document to be printed
@property (readonly) NSInteger endingPage; // the last page of the document to be printed
@property (readonly) NSInteger pagesAcross; // number of logical pages laid across a physical page
@property (readonly) NSInteger pagesDown; // number of logical pages laid out down a physical page
@property (readonly) iTunesEnum errorHandling; // how errors are handled
@property (copy, readonly) NSDate *requestedPrintTime; // the time at which the desktop printer should print the document
@property (copy, readonly) NSArray *printerFeatures; // printer specific options
@property (copy, readonly) NSString *faxNumber; // for fax number
@property (copy, readonly) NSString *targetPrinter; // for target printer
- (void) printPrintDialog:(BOOL)printDialog withProperties:(iTunesPrintSettings *)withProperties kind:(iTunesEKnd)kind theme:(NSString *)theme; // Print the specified object(s)
- (void) close; // Close an object
- (void) delete; // Delete an element from an object
- (SBObject *) duplicateTo:(SBObject *)to; // Duplicate one or more object(s)
- (BOOL) exists; // Verify if an object exists
- (void) open; // open the specified object(s)
- (void) playOnce:(BOOL)once; // play the current track or the specified track or file.
@end
/*
* iTunes Suite
*/
// The application program
@interface iTunesApplication : SBApplication
- (SBElementArray *) browserWindows;
- (SBElementArray *) encoders;
- (SBElementArray *) EQPresets;
- (SBElementArray *) EQWindows;
- (SBElementArray *) playlistWindows;
- (SBElementArray *) sources;
- (SBElementArray *) visuals;
- (SBElementArray *) windows;
@property (copy) iTunesEncoder *currentEncoder; // the currently selected encoder (MP3, AIFF, WAV, etc.)
@property (copy) iTunesEQPreset *currentEQPreset; // the currently selected equalizer preset
@property (copy, readonly) iTunesPlaylist *currentPlaylist; // the playlist containing the currently targeted track
@property (copy, readonly) NSString *currentStreamTitle; // the name of the current song in the playing stream (provided by streaming server)
@property (copy, readonly) NSString *currentStreamURL; // the URL of the playing stream or streaming web site (provided by streaming server)
@property (copy, readonly) iTunesTrack *currentTrack; // the current targeted track
@property (copy) iTunesVisual *currentVisual; // the currently selected visual plug-in
@property BOOL EQEnabled; // is the equalizer enabled?
@property BOOL fixedIndexing; // true if all AppleScript track indices should be independent of the play order of the owning playlist.
@property BOOL frontmost; // is iTunes the frontmost application?
@property BOOL fullScreen; // are visuals displayed using the entire screen?
@property (copy, readonly) NSString *name; // the name of the application
@property BOOL mute; // has the sound output been muted?
@property NSInteger playerPosition; // the players position within the currently playing track in seconds.
@property (readonly) iTunesEPlS playerState; // is iTunes stopped, paused, or playing?
@property (copy, readonly) SBObject *selection; // the selection visible to the user
@property NSInteger soundVolume; // the sound output volume (0 = minimum, 100 = maximum)
@property (copy, readonly) NSString *version; // the version of iTunes
@property BOOL visualsEnabled; // are visuals currently being displayed?
@property iTunesEVSz visualSize; // the size of the displayed visual
- (void) printPrintDialog:(BOOL)printDialog withProperties:(iTunesPrintSettings *)withProperties kind:(iTunesEKnd)kind theme:(NSString *)theme; // Print the specified object(s)
- (void) run; // run iTunes
- (void) quit; // quit iTunes
- (iTunesTrack *) add:(NSArray *)x to:(SBObject *)to; // add one or more files to a playlist
- (void) backTrack; // reposition to beginning of current track or go to previous track if already at start of current track
- (iTunesTrack *) convert:(NSArray *)x; // convert one or more files or tracks
- (void) fastForward; // skip forward in a playing track
- (void) nextTrack; // advance to the next track in the current playlist
- (void) pause; // pause playback
- (void) playOnce:(BOOL)once; // play the current track or the specified track or file.
- (void) playpause; // toggle the playing/paused state of the current track
- (void) previousTrack; // return to the previous track in the current playlist
- (void) resume; // disable fast forward/rewind and resume playback, if playing.
- (void) rewind; // skip backwards in a playing track
- (void) stop; // stop playback
- (void) update; // update the specified iPod
- (void) eject; // eject the specified iPod
- (void) subscribe:(NSString *)x; // subscribe to a podcast feed
- (void) updateAllPodcasts; // update all subscribed podcast feeds
- (void) updatePodcast; // update podcast feed
- (void) openLocation:(NSString *)x; // Opens a Music Store or audio stream URL
@end
// an item
@interface iTunesItem : SBObject
@property (copy, readonly) SBObject *container; // the container of the item
- (NSInteger) id; // the id of the item
@property (readonly) NSInteger index; // The index of the item in internal application order.
@property (copy) NSString *name; // the name of the item
@property (copy, readonly) NSString *persistentID; // the id of the item as a hexidecimal string. This id does not change over time.
- (void) printPrintDialog:(BOOL)printDialog withProperties:(iTunesPrintSettings *)withProperties kind:(iTunesEKnd)kind theme:(NSString *)theme; // Print the specified object(s)
- (void) close; // Close an object
- (void) delete; // Delete an element from an object
- (SBObject *) duplicateTo:(SBObject *)to; // Duplicate one or more object(s)
- (BOOL) exists; // Verify if an object exists
- (void) open; // open the specified object(s)
- (void) playOnce:(BOOL)once; // play the current track or the specified track or file.
- (void) reveal; // reveal and select a track or playlist
@end
// a piece of art within a track
@interface iTunesArtwork : iTunesItem
@property (copy) NSImage *data; // data for this artwork, in the form of a picture
@property (copy) NSString *objectDescription; // description of artwork as a string
@property (readonly) BOOL downloaded; // was this artwork downloaded by iTunes?
@property (copy, readonly) NSNumber *format; // the data format for this piece of artwork
@property NSInteger kind; // kind or purpose of this piece of artwork
@property (copy) NSData *rawData; // data for this artwork, in original format
@end
// converts a track to a specific file format
@interface iTunesEncoder : iTunesItem
@property (copy, readonly) NSString *format; // the data format created by the encoder
@end
// equalizer preset configuration
@interface iTunesEQPreset : iTunesItem
@property double band1; // the equalizer 32 Hz band level (-12.0 dB to +12.0 dB)
@property double band2; // the equalizer 64 Hz band level (-12.0 dB to +12.0 dB)
@property double band3; // the equalizer 125 Hz band level (-12.0 dB to +12.0 dB)
@property double band4; // the equalizer 250 Hz band level (-12.0 dB to +12.0 dB)
@property double band5; // the equalizer 500 Hz band level (-12.0 dB to +12.0 dB)
@property double band6; // the equalizer 1 kHz band level (-12.0 dB to +12.0 dB)
@property double band7; // the equalizer 2 kHz band level (-12.0 dB to +12.0 dB)
@property double band8; // the equalizer 4 kHz band level (-12.0 dB to +12.0 dB)
@property double band9; // the equalizer 8 kHz band level (-12.0 dB to +12.0 dB)
@property double band10; // the equalizer 16 kHz band level (-12.0 dB to +12.0 dB)
@property (readonly) BOOL modifiable; // can this preset be modified?
@property double preamp; // the equalizer preamp level (-12.0 dB to +12.0 dB)
@property BOOL updateTracks; // should tracks which refer to this preset be updated when the preset is renamed or deleted?
@end
// a list of songs/streams
@interface iTunesPlaylist : iTunesItem
- (SBElementArray *) tracks;
@property (readonly) NSInteger duration; // the total length of all songs (in seconds)
@property (copy) NSString *name; // the name of the playlist
@property (copy, readonly) iTunesPlaylist *parent; // folder which contains this playlist (if any)
@property BOOL shuffle; // play the songs in this playlist in random order?
@property (readonly) long long size; // the total size of all songs (in bytes)
@property iTunesERpt songRepeat; // playback repeat mode
@property (readonly) iTunesESpK specialKind; // special playlist kind
@property (copy, readonly) NSString *time; // the length of all songs in MM:SS format
@property (readonly) BOOL visible; // is this playlist visible in the Source list?
- (void) moveTo:(SBObject *)to; // Move playlist(s) to a new location
- (iTunesTrack *) searchFor:(NSString *)for_ only:(iTunesESrA)only; // search a playlist for tracks matching the search string. Identical to entering search text in the Search field in iTunes.
@end
// a playlist representing an audio CD
@interface iTunesAudioCDPlaylist : iTunesPlaylist
- (SBElementArray *) audioCDTracks;
@property (copy) NSString *artist; // the artist of the CD
@property BOOL compilation; // is this CD a compilation album?
@property (copy) NSString *composer; // the composer of the CD
@property NSInteger discCount; // the total number of discs in this CDs album
@property NSInteger discNumber; // the index of this CD disc in the source album
@property (copy) NSString *genre; // the genre of the CD
@property NSInteger year; // the year the album was recorded/released
@end
// a playlist representing the contents of a portable device
@interface iTunesDevicePlaylist : iTunesPlaylist
- (SBElementArray *) deviceTracks;
@end
// the master music library playlist
@interface iTunesLibraryPlaylist : iTunesPlaylist
- (SBElementArray *) fileTracks;
- (SBElementArray *) URLTracks;
- (SBElementArray *) sharedTracks;
@end
// the radio tuner playlist
@interface iTunesRadioTunerPlaylist : iTunesPlaylist
- (SBElementArray *) URLTracks;
@end
// a music source (music library, CD, device, etc.)
@interface iTunesSource : iTunesItem
- (SBElementArray *) audioCDPlaylists;
- (SBElementArray *) devicePlaylists;
- (SBElementArray *) libraryPlaylists;
- (SBElementArray *) playlists;
- (SBElementArray *) radioTunerPlaylists;
- (SBElementArray *) userPlaylists;
@property (readonly) long long capacity; // the total size of the source if it has a fixed size
@property (readonly) long long freeSpace; // the free space on the source if it has a fixed size
@property (readonly) iTunesESrc kind;
- (void) update; // update the specified iPod
- (void) eject; // eject the specified iPod
@end
// playable audio source
@interface iTunesTrack : iTunesItem
- (SBElementArray *) artworks;
@property (copy) NSString *album; // the album name of the track
@property (copy) NSString *albumArtist; // the album artist of the track
@property NSInteger albumRating; // the rating of the album for this track (0 to 100)
@property (readonly) iTunesERtK albumRatingKind; // the rating kind of the album rating for this track
@property (copy) NSString *artist; // the artist/source of the track
@property (readonly) NSInteger bitRate; // the bit rate of the track (in kbps)
@property double bookmark; // the bookmark time of the track in seconds
@property BOOL bookmarkable; // is the playback position for this track remembered?
@property NSInteger bpm; // the tempo of this track in beats per minute
@property (copy) NSString *category; // the category of the track
@property (copy) NSString *comment; // freeform notes about the track
@property BOOL compilation; // is this track from a compilation album?
@property (copy) NSString *composer; // the composer of the track
@property (readonly) NSInteger databaseID; // the common, unique ID for this track. If two tracks in different playlists have the same database ID, they are sharing the same data.
@property (copy, readonly) NSDate *dateAdded; // the date the track was added to the playlist
@property (copy) NSString *objectDescription; // the description of the track
@property NSInteger discCount; // the total number of discs in the source album
@property NSInteger discNumber; // the index of the disc containing this track on the source album
@property (readonly) double duration; // the length of the track in seconds
@property BOOL enabled; // is this track checked for playback?
@property (copy) NSString *episodeID; // the episode ID of the track
@property NSInteger episodeNumber; // the episode number of the track
@property (copy) NSString *EQ; // the name of the EQ preset of the track
@property double finish; // the stop time of the track in seconds
@property BOOL gapless; // is this track from a gapless album?
@property (copy) NSString *genre; // the music/audio genre (category) of the track
@property (copy) NSString *grouping; // the grouping (piece) of the track. Generally used to denote movements within a classical work.
@property (copy, readonly) NSString *kind; // a text description of the track
@property (copy) NSString *longDescription;
@property (copy) NSString *lyrics; // the lyrics of the track
@property (copy, readonly) NSDate *modificationDate; // the modification date of the content of this track
@property NSInteger playedCount; // number of times this track has been played
@property (copy) NSDate *playedDate; // the date and time this track was last played
@property (readonly) BOOL podcast; // is this track a podcast episode?
@property NSInteger rating; // the rating of this track (0 to 100)
@property (readonly) iTunesERtK ratingKind; // the rating kind of this track
@property (copy, readonly) NSDate *releaseDate; // the release date of this track
@property (readonly) NSInteger sampleRate; // the sample rate of the track (in Hz)
@property NSInteger seasonNumber; // the season number of the track
@property BOOL shufflable; // is this track included when shuffling?
@property NSInteger skippedCount; // number of times this track has been skipped
@property (copy) NSDate *skippedDate; // the date and time this track was last skipped
@property (copy) NSString *show; // the show name of the track
@property (copy) NSString *sortAlbum; // override string to use for the track when sorting by album
@property (copy) NSString *sortArtist; // override string to use for the track when sorting by artist
@property (copy) NSString *sortAlbumArtist; // override string to use for the track when sorting by album artist
@property (copy) NSString *sortName; // override string to use for the track when sorting by name
@property (copy) NSString *sortComposer; // override string to use for the track when sorting by composer
@property (copy) NSString *sortShow; // override string to use for the track when sorting by show name
@property (readonly) NSInteger size; // the size of the track (in bytes)
@property double start; // the start time of the track in seconds
@property (copy, readonly) NSString *time; // the length of the track in MM:SS format
@property NSInteger trackCount; // the total number of tracks on the source album
@property NSInteger trackNumber; // the index of the track on the source album
@property BOOL unplayed; // is this track unplayed?
@property iTunesEVdK videoKind; // kind of video track
@property NSInteger volumeAdjustment; // relative volume adjustment of the track (-100% to 100%)
@property NSInteger year; // the year the track was recorded/released
@end
// a track on an audio CD
@interface iTunesAudioCDTrack : iTunesTrack
@property (copy, readonly) NSURL *location; // the location of the file represented by this track
@end
// a track residing on a portable music player
@interface iTunesDeviceTrack : iTunesTrack
@end
// a track representing an audio file (MP3, AIFF, etc.)
@interface iTunesFileTrack : iTunesTrack
@property (copy) NSURL *location; // the location of the file represented by this track
- (void) refresh; // update file track information from the current information in the tracks file
@end
// a track residing in a shared library
@interface iTunesSharedTrack : iTunesTrack
@end
// a track representing a network stream
@interface iTunesURLTrack : iTunesTrack
@property (copy) NSString *address; // the URL for this track
- (void) download; // download podcast episode
@end
// custom playlists created by the user
@interface iTunesUserPlaylist : iTunesPlaylist
- (SBElementArray *) fileTracks;
- (SBElementArray *) URLTracks;
- (SBElementArray *) sharedTracks;
@property BOOL shared; // is this playlist shared?
@property (readonly) BOOL smart; // is this a Smart Playlist?
@end
// a folder that contains other playlists
@interface iTunesFolderPlaylist : iTunesUserPlaylist
@end
// a visual plug-in
@interface iTunesVisual : iTunesItem
@end
// any window
@interface iTunesWindow : iTunesItem
@property NSRect bounds; // the boundary rectangle for the window
@property (readonly) BOOL closeable; // does the window have a close box?
@property (readonly) BOOL collapseable; // does the window have a collapse (windowshade) box?
@property BOOL collapsed; // is the window collapsed?
@property NSPoint position; // the upper left position of the window
@property (readonly) BOOL resizable; // is the window resizable?
@property BOOL visible; // is the window visible?
@property (readonly) BOOL zoomable; // is the window zoomable?
@property BOOL zoomed; // is the window zoomed?
@end
// the main iTunes window
@interface iTunesBrowserWindow : iTunesWindow
@property BOOL minimized; // is the small player visible?
@property (copy, readonly) SBObject *selection; // the selected songs
@property (copy) iTunesPlaylist *view; // the playlist currently displayed in the window
@end
// the iTunes equalizer window
@interface iTunesEQWindow : iTunesWindow
@property BOOL minimized; // is the small EQ window visible?
@end
// a sub-window showing a single playlist
@interface iTunesPlaylistWindow : iTunesWindow
@property (copy, readonly) SBObject *selection; // the selected songs
@property (copy, readonly) iTunesPlaylist *view; // the playlist displayed in the window
@end

BIN
iTunes-icon.icns Normal file

Binary file not shown.