From 7491fd3bf06fba8b173d8e83080d0d719b5d0023 Mon Sep 17 00:00:00 2001 From: vspader Date: Sun, 8 Mar 2009 13:04:09 -0700 Subject: [PATCH] Support for album art metadata. --- Cog.xcodeproj/project.pbxproj | 10 ++ English.lproj/InfoInspector.xib | 151 +++++++++++++----- .../TagLib/TagLib.xcodeproj/project.pbxproj | 20 +-- Images/missingArt.png | Bin 0 -> 6597 bytes InfoInspector/InfoWindowController.m | 9 +- InfoInspector/MissingAlbumArtTransformer.h | 16 ++ InfoInspector/MissingAlbumArtTransformer.m | 26 +++ Playlist/PlaylistEntry.h | 2 + Playlist/PlaylistEntry.m | 2 + Plugins/TagLib/TagLibMetadataReader.m | 88 ++++++---- 10 files changed, 249 insertions(+), 75 deletions(-) create mode 100644 Images/missingArt.png create mode 100644 InfoInspector/MissingAlbumArtTransformer.h create mode 100644 InfoInspector/MissingAlbumArtTransformer.m diff --git a/Cog.xcodeproj/project.pbxproj b/Cog.xcodeproj/project.pbxproj index d0268f465..c615f2d26 100644 --- a/Cog.xcodeproj/project.pbxproj +++ b/Cog.xcodeproj/project.pbxproj @@ -40,6 +40,8 @@ 1766C8990B912FB4004A7AE4 /* shuffle_on.png in Resources */ = {isa = PBXBuildFile; fileRef = 1766C8910B912FB4004A7AE4 /* shuffle_on.png */; }; 1770429C0B8BC53600B86321 /* AppController.m in Sources */ = {isa = PBXBuildFile; fileRef = 177042980B8BC53600B86321 /* AppController.m */; }; 1770429E0B8BC53600B86321 /* PlaybackController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1770429A0B8BC53600B86321 /* PlaybackController.m */; }; + 1778D3B00F645A190037E7A0 /* missingArt.png in Resources */ = {isa = PBXBuildFile; fileRef = 1778D3AF0F645A190037E7A0 /* missingArt.png */; }; + 1778D3CA0F645BF00037E7A0 /* MissingAlbumArtTransformer.m in Sources */ = {isa = PBXBuildFile; fileRef = 1778D3C90F645BF00037E7A0 /* MissingAlbumArtTransformer.m */; }; 177EBFA20B8BC2A70000BC8C /* AppleRemote.m in Sources */ = {isa = PBXBuildFile; fileRef = 177EBF7F0B8BC2A70000BC8C /* AppleRemote.m */; }; 177EBFA70B8BC2A70000BC8C /* ImageTextCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 177EBF870B8BC2A70000BC8C /* ImageTextCell.m */; }; 177EBFAB0B8BC2A70000BC8C /* NDHotKeyControl.m in Sources */ = {isa = PBXBuildFile; fileRef = 177EBF8D0B8BC2A70000BC8C /* NDHotKeyControl.m */; }; @@ -576,6 +578,9 @@ 177042980B8BC53600B86321 /* AppController.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = AppController.m; sourceTree = ""; }; 177042990B8BC53600B86321 /* PlaybackController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = PlaybackController.h; sourceTree = ""; }; 1770429A0B8BC53600B86321 /* PlaybackController.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = PlaybackController.m; sourceTree = ""; }; + 1778D3AF0F645A190037E7A0 /* missingArt.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = missingArt.png; path = Images/missingArt.png; sourceTree = ""; }; + 1778D3C80F645BF00037E7A0 /* MissingAlbumArtTransformer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MissingAlbumArtTransformer.h; path = InfoInspector/MissingAlbumArtTransformer.h; sourceTree = ""; }; + 1778D3C90F645BF00037E7A0 /* MissingAlbumArtTransformer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MissingAlbumArtTransformer.m; path = InfoInspector/MissingAlbumArtTransformer.m; sourceTree = ""; }; 177EBF7F0B8BC2A70000BC8C /* AppleRemote.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = AppleRemote.m; sourceTree = ""; }; 177EBF860B8BC2A70000BC8C /* ImageTextCell.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ImageTextCell.h; sourceTree = ""; }; 177EBF870B8BC2A70000BC8C /* ImageTextCell.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = ImageTextCell.m; sourceTree = ""; }; @@ -937,6 +942,7 @@ 177EC02D0B8BC2E60000BC8C /* Images */ = { isa = PBXGroup; children = ( + 1778D3AF0F645A190037E7A0 /* missingArt.png */, 17B7CF590F5A05EE00A47027 /* pauseBadge.png */, 17B7CF5A0F5A05EE00A47027 /* playBadge.png */, 17B7CF5B0F5A05EE00A47027 /* stopBadge.png */, @@ -1134,6 +1140,8 @@ children = ( 17D1B0FF0F63255200694C57 /* InfoWindowController.h */, 17D1B1000F63255200694C57 /* InfoWindowController.m */, + 1778D3C80F645BF00037E7A0 /* MissingAlbumArtTransformer.h */, + 1778D3C90F645BF00037E7A0 /* MissingAlbumArtTransformer.m */, ); name = InfoInspector; sourceTree = ""; @@ -1831,6 +1839,7 @@ 178456C30F6320B5007E8021 /* SpotlightPanel.xib in Resources */, 17D1B0D20F6320EA00694C57 /* InfoInspector.xib in Resources */, 17D1B1DC0F6330D400694C57 /* Feedback.xib in Resources */, + 1778D3B00F645A190037E7A0 /* missingArt.png in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1916,6 +1925,7 @@ 17D1B16A0F632ABB00694C57 /* SecondsFormatter.m in Sources */, 17D1B25D0F633A4F00694C57 /* PreferencePluginController.m in Sources */, 171CB3DC0F63670D0047EF0A /* PreferencesWindow.m in Sources */, + 1778D3CA0F645BF00037E7A0 /* MissingAlbumArtTransformer.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/English.lproj/InfoInspector.xib b/English.lproj/InfoInspector.xib index a0441a9bf..89b3db356 100644 --- a/English.lproj/InfoInspector.xib +++ b/English.lproj/InfoInspector.xib @@ -38,13 +38,13 @@ 8215 2 - {{246, 262}, {351, 296}} + {{246, 60}, {351, 498}} -1543502848 Info Inspector NSPanel - {351, 296} - {351, 296} + {351, 498} + {351, 498} 256 @@ -53,7 +53,7 @@ 268 - {{69, 262}, {37, 14}} + {{69, 464}, {37, 14}} YES @@ -84,7 +84,7 @@ 268 - {{63, 240}, {43, 14}} + {{63, 442}, {43, 14}} YES @@ -100,7 +100,7 @@ 268 - {{68, 196}, {38, 14}} + {{68, 398}, {38, 14}} YES @@ -116,7 +116,7 @@ 268 - {{61, 174}, {45, 14}} + {{61, 376}, {45, 14}} YES @@ -132,7 +132,7 @@ 268 - {{74, 152}, {32, 14}} + {{74, 354}, {32, 14}} YES @@ -148,7 +148,7 @@ 268 - {{66, 130}, {40, 14}} + {{66, 332}, {40, 14}} YES @@ -164,7 +164,7 @@ 268 - {{33, 86}, {73, 14}} + {{33, 288}, {73, 14}} YES @@ -180,7 +180,7 @@ 268 - {{49, 64}, {57, 14}} + {{49, 266}, {57, 14}} YES @@ -196,7 +196,7 @@ 268 - {{64, 42}, {42, 14}} + {{64, 244}, {42, 14}} YES @@ -212,7 +212,7 @@ 268 - {{17, 20}, {89, 14}} + {{17, 222}, {89, 14}} YES @@ -228,7 +228,7 @@ 268 - {{74, 218}, {32, 14}} + {{74, 420}, {32, 14}} YES @@ -244,7 +244,7 @@ 266 - {{113, 262}, {221, 14}} + {{113, 464}, {221, 14}} YES @@ -260,7 +260,7 @@ 266 - {{113, 240}, {221, 14}} + {{113, 442}, {221, 14}} YES @@ -276,7 +276,7 @@ 266 - {{113, 218}, {221, 14}} + {{113, 420}, {221, 14}} YES @@ -292,7 +292,7 @@ 266 - {{113, 196}, {221, 14}} + {{113, 398}, {221, 14}} YES @@ -308,7 +308,7 @@ 266 - {{113, 174}, {221, 14}} + {{113, 376}, {221, 14}} YES @@ -324,7 +324,7 @@ 266 - {{113, 152}, {221, 14}} + {{113, 354}, {221, 14}} YES @@ -340,7 +340,7 @@ 266 - {{113, 130}, {221, 14}} + {{113, 332}, {221, 14}} YES @@ -356,7 +356,7 @@ 266 - {{113, 86}, {221, 14}} + {{113, 288}, {221, 14}} YES @@ -372,7 +372,7 @@ 266 - {{113, 64}, {221, 14}} + {{113, 266}, {221, 14}} YES @@ -388,7 +388,7 @@ 266 - {{113, 42}, {221, 14}} + {{113, 244}, {221, 14}} YES @@ -404,7 +404,7 @@ 266 - {{113, 20}, {221, 14}} + {{113, 222}, {221, 14}} YES @@ -420,7 +420,7 @@ 268 - {{50, 108}, {56, 14}} + {{50, 310}, {56, 14}} YES @@ -436,7 +436,7 @@ 266 - {{113, 108}, {221, 14}} + {{113, 310}, {221, 14}} YES @@ -449,13 +449,42 @@ + + + 274 + + YES + + YES + Apple PDF pasteboard type + Apple PICT pasteboard type + Apple PNG pasteboard type + NSFilenamesPboardType + NeXT Encapsulated PostScript v1.2 pasteboard type + NeXT TIFF v4.0 pasteboard type + + + {{17, 17}, {317, 186}} + + YES + + 67239424 + 33685504 + + 0 + 0 + 0 + NO + + YES + - {351, 296} + {351, 498} {{0, 0}, {1680, 1028}} - {351, 315} - {351, 315} + {351, 517} + {351, 517} InfoInspector @@ -687,6 +716,37 @@ 89 + + + value: playlistSelectionController.selection.albumArt + + + + + + value: playlistSelectionController.selection.albumArt + value + playlistSelectionController.selection.albumArt + + YES + + YES + NSAllowsEditingMultipleValuesSelection + NSConditionallySetsEnabled + NSValueTransformerName + + + YES + + + MissingAlbumArtTransformer + + + 2 + + + 106 + @@ -755,6 +815,7 @@ + @@ -1109,6 +1170,20 @@ + + 95 + + + YES + + + + + + 96 + + + @@ -1177,20 +1252,24 @@ 86.IBPluginDependency 87.IBPluginDependency 9.IBPluginDependency + 95.IBPluginDependency + 96.IBPluginDependency YES com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilderKit com.apple.InterfaceBuilderKit - {{246, 262}, {351, 296}} + {{395, 420}, {351, 498}} com.apple.InterfaceBuilder.CocoaPlugin - {{246, 262}, {351, 296}} - + {{395, 420}, {351, 498}} + - {351, 296} - {351, 296} + {351, 498} + {351, 498} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -1264,7 +1343,7 @@ - 94 + 106 diff --git a/Frameworks/TagLib/TagLib.xcodeproj/project.pbxproj b/Frameworks/TagLib/TagLib.xcodeproj/project.pbxproj index 6d3b4c3f7..e8d416bac 100644 --- a/Frameworks/TagLib/TagLib.xcodeproj/project.pbxproj +++ b/Frameworks/TagLib/TagLib.xcodeproj/project.pbxproj @@ -26,13 +26,13 @@ 174C79C90F4FD40B00E18B0F /* mpcfile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 174C79470F4FD40B00E18B0F /* mpcfile.cpp */; }; 174C79CA0F4FD40B00E18B0F /* mpcfile.h in Headers */ = {isa = PBXBuildFile; fileRef = 174C79480F4FD40B00E18B0F /* mpcfile.h */; }; 174C79CB0F4FD40B00E18B0F /* mpcproperties.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 174C79490F4FD40B00E18B0F /* mpcproperties.cpp */; }; - 174C79CC0F4FD40B00E18B0F /* mpcproperties.h in Headers */ = {isa = PBXBuildFile; fileRef = 174C794A0F4FD40B00E18B0F /* mpcproperties.h */; }; + 174C79CC0F4FD40B00E18B0F /* mpcproperties.h in Headers */ = {isa = PBXBuildFile; fileRef = 174C794A0F4FD40B00E18B0F /* mpcproperties.h */; settings = {ATTRIBUTES = (); }; }; 174C79CD0F4FD40B00E18B0F /* id3v1genres.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 174C794D0F4FD40B00E18B0F /* id3v1genres.cpp */; }; 174C79CE0F4FD40B00E18B0F /* id3v1genres.h in Headers */ = {isa = PBXBuildFile; fileRef = 174C794E0F4FD40B00E18B0F /* id3v1genres.h */; }; 174C79CF0F4FD40B00E18B0F /* id3v1tag.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 174C794F0F4FD40B00E18B0F /* id3v1tag.cpp */; }; 174C79D00F4FD40B00E18B0F /* id3v1tag.h in Headers */ = {isa = PBXBuildFile; fileRef = 174C79500F4FD40B00E18B0F /* id3v1tag.h */; }; 174C79D10F4FD40B00E18B0F /* attachedpictureframe.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 174C79530F4FD40B00E18B0F /* attachedpictureframe.cpp */; }; - 174C79D20F4FD40B00E18B0F /* attachedpictureframe.h in Headers */ = {isa = PBXBuildFile; fileRef = 174C79540F4FD40B00E18B0F /* attachedpictureframe.h */; }; + 174C79D20F4FD40B00E18B0F /* attachedpictureframe.h in Headers */ = {isa = PBXBuildFile; fileRef = 174C79540F4FD40B00E18B0F /* attachedpictureframe.h */; settings = {ATTRIBUTES = (Public, ); }; }; 174C79D30F4FD40B00E18B0F /* commentsframe.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 174C79550F4FD40B00E18B0F /* commentsframe.cpp */; }; 174C79D40F4FD40B00E18B0F /* commentsframe.h in Headers */ = {isa = PBXBuildFile; fileRef = 174C79560F4FD40B00E18B0F /* commentsframe.h */; }; 174C79D50F4FD40B00E18B0F /* generalencapsulatedobjectframe.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 174C79570F4FD40B00E18B0F /* generalencapsulatedobjectframe.cpp */; }; @@ -58,21 +58,21 @@ 174C79E90F4FD40B00E18B0F /* id3v2footer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 174C796B0F4FD40B00E18B0F /* id3v2footer.cpp */; }; 174C79EA0F4FD40B00E18B0F /* id3v2footer.h in Headers */ = {isa = PBXBuildFile; fileRef = 174C796C0F4FD40B00E18B0F /* id3v2footer.h */; }; 174C79EB0F4FD40B00E18B0F /* id3v2frame.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 174C796D0F4FD40B00E18B0F /* id3v2frame.cpp */; }; - 174C79EC0F4FD40B00E18B0F /* id3v2frame.h in Headers */ = {isa = PBXBuildFile; fileRef = 174C796E0F4FD40B00E18B0F /* id3v2frame.h */; }; + 174C79EC0F4FD40B00E18B0F /* id3v2frame.h in Headers */ = {isa = PBXBuildFile; fileRef = 174C796E0F4FD40B00E18B0F /* id3v2frame.h */; settings = {ATTRIBUTES = (Public, ); }; }; 174C79ED0F4FD40B00E18B0F /* id3v2framefactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 174C796F0F4FD40B00E18B0F /* id3v2framefactory.cpp */; }; - 174C79EE0F4FD40B00E18B0F /* id3v2framefactory.h in Headers */ = {isa = PBXBuildFile; fileRef = 174C79700F4FD40B00E18B0F /* id3v2framefactory.h */; }; + 174C79EE0F4FD40B00E18B0F /* id3v2framefactory.h in Headers */ = {isa = PBXBuildFile; fileRef = 174C79700F4FD40B00E18B0F /* id3v2framefactory.h */; settings = {ATTRIBUTES = (Public, ); }; }; 174C79EF0F4FD40B00E18B0F /* id3v2header.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 174C79710F4FD40B00E18B0F /* id3v2header.cpp */; }; - 174C79F00F4FD40B00E18B0F /* id3v2header.h in Headers */ = {isa = PBXBuildFile; fileRef = 174C79720F4FD40B00E18B0F /* id3v2header.h */; }; + 174C79F00F4FD40B00E18B0F /* id3v2header.h in Headers */ = {isa = PBXBuildFile; fileRef = 174C79720F4FD40B00E18B0F /* id3v2header.h */; settings = {ATTRIBUTES = (Public, ); }; }; 174C79F10F4FD40B00E18B0F /* id3v2synchdata.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 174C79730F4FD40B00E18B0F /* id3v2synchdata.cpp */; }; 174C79F20F4FD40B00E18B0F /* id3v2synchdata.h in Headers */ = {isa = PBXBuildFile; fileRef = 174C79740F4FD40B00E18B0F /* id3v2synchdata.h */; }; 174C79F30F4FD40B00E18B0F /* id3v2tag.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 174C79750F4FD40B00E18B0F /* id3v2tag.cpp */; }; - 174C79F40F4FD40B00E18B0F /* id3v2tag.h in Headers */ = {isa = PBXBuildFile; fileRef = 174C79760F4FD40B00E18B0F /* id3v2tag.h */; }; + 174C79F40F4FD40B00E18B0F /* id3v2tag.h in Headers */ = {isa = PBXBuildFile; fileRef = 174C79760F4FD40B00E18B0F /* id3v2tag.h */; settings = {ATTRIBUTES = (Public, ); }; }; 174C79F50F4FD40B00E18B0F /* mpegfile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 174C79770F4FD40B00E18B0F /* mpegfile.cpp */; }; - 174C79F60F4FD40B00E18B0F /* mpegfile.h in Headers */ = {isa = PBXBuildFile; fileRef = 174C79780F4FD40B00E18B0F /* mpegfile.h */; }; + 174C79F60F4FD40B00E18B0F /* mpegfile.h in Headers */ = {isa = PBXBuildFile; fileRef = 174C79780F4FD40B00E18B0F /* mpegfile.h */; settings = {ATTRIBUTES = (Public, ); }; }; 174C79F70F4FD40B00E18B0F /* mpegheader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 174C79790F4FD40B00E18B0F /* mpegheader.cpp */; }; - 174C79F80F4FD40B00E18B0F /* mpegheader.h in Headers */ = {isa = PBXBuildFile; fileRef = 174C797A0F4FD40B00E18B0F /* mpegheader.h */; }; + 174C79F80F4FD40B00E18B0F /* mpegheader.h in Headers */ = {isa = PBXBuildFile; fileRef = 174C797A0F4FD40B00E18B0F /* mpegheader.h */; settings = {ATTRIBUTES = (Public, ); }; }; 174C79F90F4FD40B00E18B0F /* mpegproperties.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 174C797B0F4FD40B00E18B0F /* mpegproperties.cpp */; }; - 174C79FA0F4FD40B00E18B0F /* mpegproperties.h in Headers */ = {isa = PBXBuildFile; fileRef = 174C797C0F4FD40B00E18B0F /* mpegproperties.h */; }; + 174C79FA0F4FD40B00E18B0F /* mpegproperties.h in Headers */ = {isa = PBXBuildFile; fileRef = 174C797C0F4FD40B00E18B0F /* mpegproperties.h */; settings = {ATTRIBUTES = (Public, ); }; }; 174C79FB0F4FD40B00E18B0F /* xingheader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 174C797D0F4FD40B00E18B0F /* xingheader.cpp */; }; 174C79FC0F4FD40B00E18B0F /* xingheader.h in Headers */ = {isa = PBXBuildFile; fileRef = 174C797E0F4FD40B00E18B0F /* xingheader.h */; }; 174C79FD0F4FD40B00E18B0F /* oggflacfile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 174C79810F4FD40B00E18B0F /* oggflacfile.cpp */; }; @@ -109,7 +109,7 @@ 174C7A1C0F4FD40B00E18B0F /* tfile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 174C79A30F4FD40B00E18B0F /* tfile.cpp */; }; 174C7A1D0F4FD40B00E18B0F /* tfile.h in Headers */ = {isa = PBXBuildFile; fileRef = 174C79A40F4FD40B00E18B0F /* tfile.h */; settings = {ATTRIBUTES = (Public, ); }; }; 174C7A1E0F4FD40B00E18B0F /* tlist.h in Headers */ = {isa = PBXBuildFile; fileRef = 174C79A50F4FD40B00E18B0F /* tlist.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 174C7A200F4FD40B00E18B0F /* tmap.h in Headers */ = {isa = PBXBuildFile; fileRef = 174C79A70F4FD40B00E18B0F /* tmap.h */; }; + 174C7A200F4FD40B00E18B0F /* tmap.h in Headers */ = {isa = PBXBuildFile; fileRef = 174C79A70F4FD40B00E18B0F /* tmap.h */; settings = {ATTRIBUTES = (Public, ); }; }; 174C7A220F4FD40B00E18B0F /* tstring.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 174C79A90F4FD40B00E18B0F /* tstring.cpp */; }; 174C7A230F4FD40B00E18B0F /* tstring.h in Headers */ = {isa = PBXBuildFile; fileRef = 174C79AA0F4FD40B00E18B0F /* tstring.h */; settings = {ATTRIBUTES = (Public, ); }; }; 174C7A240F4FD40B00E18B0F /* tstringlist.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 174C79AB0F4FD40B00E18B0F /* tstringlist.cpp */; }; diff --git a/Images/missingArt.png b/Images/missingArt.png new file mode 100644 index 0000000000000000000000000000000000000000..e7e68044f3baec7beb4742350ace57aa9ba9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j}4ND&uXN8p9;3i8mcoWz_G1NyQ*-mvS>TX|N zI*w0zV4ts()t!S%S(Zm;ga5)2P&sFw=u2MfTVJrqzP=clM%Y?fP~7j`084`1dG51| zTtF)JQdX#zM}z~={7We?4J5_#SYtY(oIn8jZlhnB--;~J)XjIE$NiJDhz*t|k1YYH z{>&34FbH=a5!u;fA&Gxretw5$RhJS0bZZqQv`Gk`djd_jRsaY@0<)>93D>E;f*^I; zFU0$s#`qkfUyS`rD{>DcoS@&C*%w8bgb4(D0;ra&@&Yb#E8xMu_Po;_5xcO`(o)ZR zbL&AlU401JvH|=Zg z1+G*>S!@1+gpP9ElDgNU{`c!1`eN%`wXvCU4ZO>{Lnkz?9ddPVc}mY5bJngK`pek> z5QfIk=7rkP%nGY_{KF3}IDfO*=u1BDGg=P_5ADs6a(c5CTnZzIfn)|bCl9%0*c_8R zJ?<_SF7XEzVU%JP~Fo?V%psq5U1{ab0B%kV#911@P;<9~y%+V*cmCAcom5@Sm&x|8F-C j|7$X{hHPjIHuZ`87|{H7W%b%51#%Pgt*U! literal 0 HcmV?d00001 diff --git a/InfoInspector/InfoWindowController.m b/InfoInspector/InfoWindowController.m index 4f54da2c2..f5a815510 100644 --- a/InfoInspector/InfoWindowController.m +++ b/InfoInspector/InfoWindowController.m @@ -7,12 +7,19 @@ // #import "InfoWindowController.h" - +#import "MissingAlbumArtTransformer.h" @implementation InfoWindowController @synthesize playlistSelectionController; ++ (void)initialize +{ + NSValueTransformer *missingAlbumArtTransformer = [[[MissingAlbumArtTransformer alloc] init] autorelease]; + [NSValueTransformer setValueTransformer:missingAlbumArtTransformer + forName:@"MissingAlbumArtTransformer"]; +} + - (id)init { return [super initWithWindowNibName:@"InfoInspector"]; diff --git a/InfoInspector/MissingAlbumArtTransformer.h b/InfoInspector/MissingAlbumArtTransformer.h new file mode 100644 index 000000000..88a1d94b0 --- /dev/null +++ b/InfoInspector/MissingAlbumArtTransformer.h @@ -0,0 +1,16 @@ +// +// MissingAlbumArtTransformer.h +// Cog +// +// Created by Vincent Spader on 3/8/09. +// Copyright 2009 __MyCompanyName__. All rights reserved. +// + +#import + + +@interface MissingAlbumArtTransformer : NSObject { + +} + +@end diff --git a/InfoInspector/MissingAlbumArtTransformer.m b/InfoInspector/MissingAlbumArtTransformer.m new file mode 100644 index 000000000..81964cb33 --- /dev/null +++ b/InfoInspector/MissingAlbumArtTransformer.m @@ -0,0 +1,26 @@ +// +// MissingAlbumArtTransformer.m +// Cog +// +// Created by Vincent Spader on 3/8/09. +// Copyright 2009 __MyCompanyName__. All rights reserved. +// + +#import "MissingAlbumArtTransformer.h" + + +@implementation MissingAlbumArtTransformer + ++ (Class)transformedValueClass { return [NSImage class]; } ++ (BOOL)allowsReverseTransformation { return NO; } + +// Convert from NSImage to NSImage +- (id)transformedValue:(id)value { + if (value == nil) { + return [NSImage imageNamed:@"missingArt"]; + } + + return value; +} + +@end diff --git a/Playlist/PlaylistEntry.h b/Playlist/PlaylistEntry.h index 4b9fb6d46..179f2bdb7 100644 --- a/Playlist/PlaylistEntry.h +++ b/Playlist/PlaylistEntry.h @@ -31,6 +31,7 @@ NSString *genre; NSNumber *year; NSNumber *track; + NSImage *albumArt; long long totalFrames; int bitrate; @@ -82,6 +83,7 @@ @property(retain) NSString *genre; @property(retain) NSNumber *year; @property(retain) NSNumber *track; +@property(retain) NSImage *albumArt; @property long long totalFrames; @property int bitrate; diff --git a/Playlist/PlaylistEntry.m b/Playlist/PlaylistEntry.m index f9c3b42bf..d105ce81a 100644 --- a/Playlist/PlaylistEntry.m +++ b/Playlist/PlaylistEntry.m @@ -31,6 +31,7 @@ @synthesize genre; @synthesize year; @synthesize track; +@synthesize albumArt; @synthesize totalFrames; @synthesize bitrate; @@ -93,6 +94,7 @@ self.genre = nil; self.year = nil; self.track = nil; + self.albumArt = nil; self.endian = nil; diff --git a/Plugins/TagLib/TagLibMetadataReader.m b/Plugins/TagLib/TagLibMetadataReader.m index cd8e838cb..4a49b5a16 100644 --- a/Plugins/TagLib/TagLibMetadataReader.m +++ b/Plugins/TagLib/TagLibMetadataReader.m @@ -9,15 +9,19 @@ #import "TagLibMetadataReader.h" #import #import +#import +#import +#import @implementation TagLibMetadataReader + (NSDictionary *)metadataForURL:(NSURL *)url { - + if (![url isFileURL]) { + return [NSDictionary dictionary]; + } - NSString *lArtist = @"", *lTitle = @"", *lAlbum = @"", *lGenre = @""; - int lYear = 0, lTrack = 0; + NSMutableDictionary *dict = [[NSMutableDictionary alloc] init]; TagLib::FileRef f((const char *)[[url path] UTF8String], false); if (!f.isNull()) @@ -26,39 +30,67 @@ if (tag) { - TagLib::String pArtist, pTitle, pAlbum, pGenre, pComment; + TagLib::String artist, title, album, genre, comment; + int year, track; - pArtist = tag->artist(); - pTitle = tag->title();; - pAlbum = tag->album(); - pGenre = tag->genre(); - pComment = tag->comment(); + artist = tag->artist(); + title = tag->title();; + album = tag->album(); + genre = tag->genre(); + comment = tag->comment(); - lYear = tag->year(); - lTrack = tag->track(); + year = tag->year(); + [dict setObject:[NSNumber numberWithInt:year] forKey:@"year"]; - if (!pArtist.isNull()) - lArtist = [NSString stringWithUTF8String:pArtist.toCString(true)]; + track = tag->track(); + [dict setObject:[NSNumber numberWithInt:track] forKey:@"track"]; + + if (!artist.isNull()) + [dict setObject:[NSString stringWithUTF8String:artist.toCString(true)] forKey:@"artist"]; - if (!pAlbum.isNull()) - lAlbum = [NSString stringWithUTF8String:pAlbum.toCString(true)]; + if (!album.isNull()) + [dict setObject:[NSString stringWithUTF8String:album.toCString(true)] forKey:@"album"]; - if (!pTitle.isNull()) - lTitle = [NSString stringWithUTF8String:pTitle.toCString(true)]; + if (!title.isNull()) + [dict setObject:[NSString stringWithUTF8String:title.toCString(true)] forKey:@"title"]; - if (!pGenre.isNull()) - lGenre = [NSString stringWithUTF8String:pGenre.toCString(true)]; + if (!genre.isNull()) + [dict setObject:[NSString stringWithUTF8String:genre.toCString(true)] forKey:@"genre"]; + } + + NSString *imageCacheTag = [NSString stringWithFormat:@"%@-%@-%@-%@", [dict objectForKey:@"album"], [dict objectForKey:@"artist"], [dict objectForKey:@"genre"], [dict objectForKey:@"year"]]; + NSImage *image = [NSImage imageNamed:imageCacheTag]; + + if (nil == image) { + // Try to load the image. + + // WARNING: HACK + TagLib::MPEG::File *mf = dynamic_cast(f.file()); + if (mf) { + TagLib::ID3v2::Tag *tag = mf->ID3v2Tag(); + if (tag) { + TagLib::ID3v2::FrameList pictures = mf->ID3v2Tag()->frameListMap()["APIC"]; + if (!pictures.isEmpty()) { + TagLib::ID3v2::AttachedPictureFrame *pic = static_cast(pictures.front()); + + NSData *data = [[NSData alloc] initWithBytes:pic->picture().data() length:pic->picture().size()]; + image = [[[NSImage alloc] initWithData:data] autorelease]; + [data release]; + } + } + } + + if (nil != image) { + [image setName:imageCacheTag]; + } + } + + if (nil != image) { + [dict setObject:image forKey:@"albumArt"]; } } - - return [NSDictionary dictionaryWithObjectsAndKeys: - lArtist, @"artist", - lTitle, @"title", - lAlbum, @"album", - lGenre, @"genre", - [NSNumber numberWithInt: lYear], @"year", - [NSNumber numberWithInt: lTrack], @"track", - nil]; + + return [dict autorelease]; } + (NSArray *)fileTypes