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 000000000..e7e68044f Binary files /dev/null and b/Images/missingArt.png differ 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