Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Edit Tags: Image subtitle with type, dimensions

  • Loading branch information...
commit aed9b5057fc685608d8b9f0b6dde48d31bf688bf 1 parent 83af073
Brian Wells authored
1  Edit MPEG-4 Metadata Tags/AlbumArt.h
@@ -39,6 +39,7 @@
39 39
40 40 @interface AlbumArt : NSManagedObject <NSPasteboardWriting> {
41 41 NSUInteger imageVersion;
  42 + NSString *imageTitle;
42 43 }
43 44
44 45 @property NSUInteger imageVersion;
41 Edit MPEG-4 Metadata Tags/AlbumArt.m
@@ -41,6 +41,13 @@ @implementation AlbumArt
41 41 @synthesize imageVersion;
42 42 @dynamic primitiveImageRepresentation;
43 43
  44 +- (void) dealloc
  45 +{
  46 + [imageTitle release];
  47 + imageTitle = nil;
  48 + [super dealloc];
  49 +}
  50 +
44 51 - (void)setImageRepresentation:(NSData *)data {
45 52 [self willChangeValueForKey:@"imageRepresentation"];
46 53 [self setPrimitiveImageRepresentation:data];
@@ -56,6 +63,40 @@ - (NSString *)imageUID {
56 63 return [[[self objectID] URIRepresentation] description];
57 64 }
58 65
  66 +- (NSString *)imageSubtitle {
  67 + if (!imageTitle) {
  68 + NSUInteger artwork_type = [[self valueForKey:@"imageType"] unsignedIntegerValue];
  69 + NSString *imageType;
  70 + switch (artwork_type) {
  71 + case MP4_ART_JPEG:
  72 + imageType = @"JPEG";
  73 + break;
  74 + case MP4_ART_PNG:
  75 + imageType = @"PNG";
  76 + break;
  77 + case MP4_ART_BMP:
  78 + imageType = @"BMP";
  79 + break;
  80 + case MP4_ART_GIF:
  81 + imageType = @"GIF";
  82 + break;
  83 + default:
  84 + imageType = @"Image";
  85 + break;
  86 + }
  87 + // get image size
  88 + NSData *imageData = [self valueForKey:@"imageRepresentation"];
  89 + NSImage *image = [[NSImage alloc] initWithData:imageData];
  90 + if (image) {
  91 + NSSize imageSize = [image size];
  92 + imageTitle = [NSString stringWithFormat:@"%@ (%.0f x %.0f)",imageType,imageSize.width,imageSize.height];
  93 + } else {
  94 + imageTitle = [NSString stringWithString:imageType];
  95 + }
  96 + }
  97 + return imageTitle;
  98 +}
  99 +
59 100 - (NSArray *)writableTypesForPasteboard:(NSPasteboard *)pasteboard {
60 101 NSUInteger artwork_type = [[self valueForKey:@"imageType"] unsignedIntegerValue];
61 102 NSString *dataType = nil;
2  Edit MPEG-4 Metadata Tags/English.lproj/main.xib
@@ -1877,7 +1877,7 @@
1877 1877 <string key="NSFrameSize">{466, 98}</string>
1878 1878 <reference key="NSSuperview" ref="342699628"/>
1879 1879 <bool key="constrainsToOriginalSize">NO</bool>
1880   - <bool key="cellsHaveSubtitle">NO</bool>
  1880 + <bool key="cellsHaveSubtitle">YES</bool>
1881 1881 <bool key="cellsHaveTitle">NO</bool>
1882 1882 <bool key="outlinesCells">NO</bool>
1883 1883 <bool key="shadowsCells">YES</bool>

0 comments on commit aed9b50

Please sign in to comment.
Something went wrong with that request. Please try again.