Skip to content

Commit

Permalink
* Artist Sort field can be edited
Browse files Browse the repository at this point in the history
  • Loading branch information
Bilalh committed Dec 28, 2011
1 parent d900ace commit 47b88fd
Show file tree
Hide file tree
Showing 13 changed files with 770 additions and 130 deletions.
4 changes: 2 additions & 2 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Version 1.5
* Spreadsheet View.
* Swapping first and last name menuitem for artist and other fields
* Go menu icons.
* Artist Sort field can be edited

### Improvements ###
* Handles missing data from vgmdb.
Expand All @@ -18,8 +19,7 @@ Version 1.5
* Comparing number where one of the number might be null

### Bug Fixes ###
* Mp3 cover art.
* Spelling.
* MP3 cover art.

Version 1.4.3 (Sun 27 Nov 2011 05:33:51 +0000)
-------------
Expand Down
8 changes: 8 additions & 0 deletions Classes/IO/FileSystemNodeCollection.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@
NSNumber *labelIndex;
BOOL writeToAll;
BOOL empty;

// Tags -- sort by
NSString *artistSort;

}

/// @name General
Expand Down Expand Up @@ -129,4 +133,8 @@
// The album cover of the file
@property (assign) NSImage *cover;

/// @name Finding Sort by Metadata

@property (assign) NSString *artistSort;

@end
26 changes: 15 additions & 11 deletions Classes/IO/FileSystemNodeCollection.m
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ @implementation FileSystemNodeCollection
@synthesize title, artist, album, comment, genre, year, track, length;
@synthesize albumArtist, composer, grouping, bpm, totalTracks, disc, totalDiscs, compilation, url, cover;
@dynamic urls;
@synthesize artistSort;


#pragma mark -
#pragma mark Init
Expand All @@ -43,6 +45,7 @@ + (void)initialize
@"compilation", @"year",
@"composer", @"bpm",
@"comment", @"cover", @"url",
@"artistSort",
nil];
fieldNames = [[NSArray alloc] initWithObjects:
@"labelColor", @"labelIndex",
Expand Down Expand Up @@ -250,27 +253,28 @@ - (void)setTagsArray:(NSArray *)newArray
n.tags.field = newValue; \
}

- (void)setAlbum:(NSString *)newValue { SETTER_METHOD_FSN(album, newValue );}
- (void)setTitle:(NSString *)newValue { SETTER_METHOD_FSN(title, newValue );}
- (void)setArtist:(NSString *)newValue { SETTER_METHOD_FSN(artist, newValue );}
- (void)setComment:(NSString *)newValue{ SETTER_METHOD_FSN(comment, newValue );}
- (void)setGenre:(NSString *)newValue { SETTER_METHOD_FSN(genre, newValue );}
- (void)setAlbum: (NSString*)newValue { SETTER_METHOD_FSN(album, newValue );}
- (void)setTitle: (NSString*)newValue { SETTER_METHOD_FSN(title, newValue );}
- (void)setArtist: (NSString*)newValue { SETTER_METHOD_FSN(artist, newValue );}
- (void)setComment:(NSString*)newValue { SETTER_METHOD_FSN(comment, newValue );}
- (void)setGenre: (NSString*)newValue { SETTER_METHOD_FSN(genre, newValue );}

- (void)setYear:(NSNumber*)newValue { SETTER_METHOD_FSN(year, newValue );}
- (void)setTrack:(NSNumber*)newValue { SETTER_METHOD_FSN(track, newValue );}
- (void)setBpm:(NSNumber *)newValue { SETTER_METHOD_FSN(bpm, newValue );}
- (void)setDisc:(NSNumber *)newValue { SETTER_METHOD_FSN(disc, newValue );}
- (void)setCover:(NSImage *)newValue { SETTER_METHOD_FSN(cover, newValue );}
- (void)setYear: (NSNumber*)newValue { SETTER_METHOD_FSN(year, newValue );}
- (void)setTrack:(NSNumber*)newValue { SETTER_METHOD_FSN(track, newValue );}
- (void)setBpm: (NSNumber*)newValue { SETTER_METHOD_FSN(bpm, newValue );}
- (void)setDisc: (NSNumber*)newValue { SETTER_METHOD_FSN(disc, newValue );}
- (void)setCover:(NSImage *)newValue { SETTER_METHOD_FSN(cover, newValue );}


- (void)setAlbumArtist:(NSString *)newValue { SETTER_METHOD_FSN(albumArtist, newValue );}
- (void)setComposer:(NSString *)newValue { SETTER_METHOD_FSN(composer, newValue );}
- (void)setGrouping:(NSString *)newValue { SETTER_METHOD_FSN(grouping, newValue );}

- (void)setTotalTracks:(NSNumber *)newValue { SETTER_METHOD_FSN(totalTracks, newValue );}
- (void)setTotalDiscs:(NSNumber *)newValue { SETTER_METHOD_FSN(totalDiscs, newValue );}
- (void)setTotalDiscs: (NSNumber *)newValue { SETTER_METHOD_FSN(totalDiscs, newValue );}
- (void)setCompilation:(NSNumber *)newValue { SETTER_METHOD_FSN(compilation, newValue );}

- (void)setArtistSort:(NSString *)newValue { SETTER_METHOD_FSN(artistSort, newValue );}

@end

677 changes: 614 additions & 63 deletions Classes/Main/MainMenu.xib

Large diffs are not rendered by default.

61 changes: 45 additions & 16 deletions Classes/Taglib/Fields.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,53 @@
#define FIELDS_HEADERR

#include <tstring.h>
/// Contains fields for directory accessing fields
namespace MP4Fields {
using TagLib::String;
String const ALBUM_ARTIST = "aART";
String const COMPOSER = "\251wrt";
String const GROUPING = "\251grp";

String const COMPILATION = "cpil";
String const BPM = "tmpo";

// Contains the identifier for the fields of each mediatype
namespace Fields {

String const TRACK_NUMBER = "trkn";
String const TOTAL_TRACKS = "trkn";
String const DISK_NUMBER = "disk";
String const TOTAL_DISKS = "disk";
namespace MP4 {
using TagLib::String;
String const ALBUM_ARTIST = "aART";
String const COMPOSER = "\251wrt";
String const GROUPING = "\251grp";

String const COMPILATION = "cpil";
String const BPM = "tmpo";

String const TRACK_NUMBER = "trkn";
String const TOTAL_TRACKS = "trkn";
String const DISK_NUMBER = "disk";
String const TOTAL_DISKS = "disk";

String const ENCODER = "\251too";
String const COVER = "covr";
String const URL = "----:com.apple.iTunes:URL_OFFICIAL_RELEASE_SITE";

const String ARTIST_SORT = "soar";
}

String const ENCODER = "\251too";
String const COVER = "covr";
String const URL = "----:com.apple.iTunes:URL_OFFICIAL_RELEASE_SITE";
namespace MPEG {
extern const char *ALBUM_ARTIST;
extern const char *COMPOSER ;
extern const char *GROUPING ;

extern const char *COMPILATION ;
extern const char *BPM ;

extern const char *TRACK_NUMBER;
extern const char *TOTAL_TRACKS;
extern const char *DISK_NUMBER ;
extern const char *TOTAL_DISKS ;

extern const char *ENCODER ;
extern const char *COVER ;
extern const char *COMMENT ;
extern const char *URL ;

extern const char* ARTIST_SORT;

}
}


#endif
2 changes: 1 addition & 1 deletion Classes/Taglib/MP4Tags.mm
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ - (bool) setFieldWithString:(TagLib::String)field
@end

using namespace TagLib;
using namespace MP4Fields;
using namespace Fields::MP4;
using namespace std;
@implementation MP4Tags

Expand Down
66 changes: 31 additions & 35 deletions Classes/Taglib/MPEGTags.mm
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#import "NSString+Convert.h"
#import "NSImage+bitmapData.h"
#include "TagPrivate.h"
#include "Fields.h"

#include <mpegfile.h>
#include <id3v2tag.h>
Expand All @@ -22,24 +23,6 @@
#import "Logging.h"
LOG_LEVEL(LOG_LEVEL_ERROR);

namespace MPEGFields { // can not be put in the header for some reason
const char *ALBUM_ARTIST = "TPE2";
const char *COMPOSER = "TCOM";
const char *GROUPING = "TIT1";

const char *COMPILATION = "TCMP";
const char *BPM = "TBPM";

const char *TRACK_NUMBER = "TRCK";
const char *TOTAL_TRACKS = "TRCK";
const char *DISK_NUMBER = "TPOS";
const char *TOTAL_DISKS = "TPOS";

const char *ENCODER = "TENC";
const char *COVER = "APIC";
const char *URL = "WXXX";
const char *COMMENT = "COMM";
}

@interface MPEGTags()
- (NSString*) getFieldWithString:(const char*)field;
Expand All @@ -53,7 +36,7 @@ - (void) initCover;
@end

using namespace TagLib;
using namespace MPEGFields;
using namespace Fields::MPEG;
@implementation MPEGTags

#pragma mark -
Expand Down Expand Up @@ -116,6 +99,11 @@ -(void) initFields
}

url = [self getFieldWithString:URL];


// Sort by
artistSort = [self getFieldWithString:ARTIST_SORT];

[self initCover];
}

Expand Down Expand Up @@ -253,7 +241,30 @@ - (void) setUrl:(NSString *)newValue
[self setFieldWithString:URL data:newValue];
}

// need fixing?
- (void) setArtistSort:(NSString *)newValue
{
TAG_SETTER_START(artistSort);
[self setFieldWithString:ARTIST_SORT data:newValue];
}

- (void) setComment:(NSString *)newValue
{
TAG_SETTER_START(comment);
(TagLib::ID3v2::FrameFactory::instance())->setDefaultTextEncoding(TagLib::String::UTF8);
ID3v2::Tag *tag = data->f->mpeg->ID3v2Tag();
tag->removeFrames("COMM");
if(nil != newValue) {
ID3v2::CommentsFrame *frame = new ID3v2::CommentsFrame();
frame->setText([newValue tagLibString]);
frame->setLanguage("eng");
tag->addFrame(frame);
}
data->file->save();
}

#pragma mark - Cover

// need fixing for vbr?
- (void) setCover:(NSImage *)newValue
{
TAG_SETTER_START(cover);
Expand Down Expand Up @@ -325,19 +336,4 @@ - (BOOL) removeAllImagesMP3:(TagLib::ID3v2::Tag*) tag
}


- (void) setComment:(NSString *)newValue
{
TAG_SETTER_START(comment);
(TagLib::ID3v2::FrameFactory::instance())->setDefaultTextEncoding(TagLib::String::UTF8);
ID3v2::Tag *tag = data->f->mpeg->ID3v2Tag();
tag->removeFrames("COMM");
if(nil != newValue) {
ID3v2::CommentsFrame *frame = new ID3v2::CommentsFrame();
frame->setText([newValue tagLibString]);
frame->setLanguage("eng");
tag->addFrame(frame);
}
data->file->save();
}

@end
11 changes: 10 additions & 1 deletion Classes/Taglib/Tags.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,13 @@ struct FileData;

// Tracks may be handed by the subclass
NSNumber *track;
// MP3 comment need to be handled the subclass
// MP3 comment need to be handled by the subclass
NSString *comment;

// Sort by

NSString *artistSort;

}

/// @name Initializing an Tags Object
Expand Down Expand Up @@ -128,4 +133,8 @@ struct FileData;
// The album cover of the file
@property (assign) NSImage *cover;

/// @name Finding Sort by Metadata

@property (assign) NSString *artistSort;

@end
4 changes: 4 additions & 0 deletions Classes/Taglib/Tags.mm
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ @implementation Tags
@synthesize title, artist, album, comment, genre, year, track;
@synthesize albumArtist, composer, grouping, bpm, totalTracks, disc, totalDiscs, compilation, url, cover;
@synthesize length, bitrate, channels, sampleRate, kind;
@synthesize artistSort;

#pragma mark -
#pragma mark Init
Expand Down Expand Up @@ -164,6 +165,9 @@ -(void) setCompilation:(NSNumber *)newValue{}
-(void) setUrl:(NSString *)newText{}
-(void) setCover:(NSImage*)newValue{}

-(void) setArtistSort:(NSString*)newValue{}


- (void) removeAllTags { DDLogInfo(@"removing tags");}

-(NSString*)formatKey:(NSString*)key
Expand Down
32 changes: 32 additions & 0 deletions Classes/Taglib/fields.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
//
// fields.cpp
// Tagger
//
// Created by Bilal Syed Hussain on 28/12/2011.
// Copyright 2011 St. Andrews KY16 9XW. All rights reserved.
//

#include "fields.h"

namespace Fields {
namespace MPEG{
const char *ALBUM_ARTIST = "TPE2";
const char *COMPOSER = "TCOM";
const char *GROUPING = "TIT1";

const char *COMPILATION = "TCMP";
const char *BPM = "TBPM";

const char *TRACK_NUMBER = "TRCK";
const char *TOTAL_TRACKS = "TRCK";
const char *DISK_NUMBER = "TPOS";
const char *TOTAL_DISKS = "TPOS";

const char *ENCODER = "TENC";
const char *COVER = "APIC";
const char *URL = "WXXX";
const char *COMMENT = "COMM";

const char* ARTIST_SORT = "TSOP";
}
}
2 changes: 1 addition & 1 deletion Other Sources/VGTagger-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
<key>CFBundleURLTypes</key>
<array/>
<key>CFBundleVersion</key>
<string>1.4.3-22-g29bc776</string>
<string>1.4.3-25-gd900ace</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.music</string>
<key>LSMinimumSystemVersion</key>
Expand Down
3 changes: 3 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ To replace a mp3 cover art a second time use `refresh`(⌘R) then `Parent Folder

* Bug in malformed m4a files sometimes when *replacing* (not adding) artwork, means the file can't be played in iTunes.

Infomation
----------
* Write 2.3/2.4 id3 tags.

Libraries Used
--------------
Expand Down
Loading

0 comments on commit 47b88fd

Please sign in to comment.