A few taglib fixes. Reads id3v2 before ape for mp3 files. Added AutoReleasePool to backgrounded method.
parent
cf46d16a56
commit
9af41d7542
|
@ -22,7 +22,7 @@
|
|||
#ifndef TAGLIB_FILEREF_H
|
||||
#define TAGLIB_FILEREF_H
|
||||
|
||||
#include <tstringlist.h>
|
||||
#include "tstringlist.h"
|
||||
|
||||
#include "taglib_export.h"
|
||||
#include "audioproperties.h"
|
||||
|
|
|
@ -44,12 +44,12 @@ namespace TagLib {
|
|||
|
||||
virtual String title() const
|
||||
{
|
||||
if (file->APETag() && !file->APETag()->title().isEmpty())
|
||||
return file->APETag()->title();
|
||||
|
||||
if(file->ID3v2Tag() && !file->ID3v2Tag()->title().isEmpty())
|
||||
return file->ID3v2Tag()->title();
|
||||
|
||||
if (file->APETag() && !file->APETag()->title().isEmpty())
|
||||
return file->APETag()->title();
|
||||
|
||||
if(file->ID3v1Tag())
|
||||
return file->ID3v1Tag()->title();
|
||||
|
||||
|
@ -58,12 +58,12 @@ namespace TagLib {
|
|||
|
||||
virtual String artist() const
|
||||
{
|
||||
if (file->APETag() && !file->APETag()->artist().isEmpty())
|
||||
return file->APETag()->artist();
|
||||
|
||||
if(file->ID3v2Tag() && !file->ID3v2Tag()->artist().isEmpty())
|
||||
return file->ID3v2Tag()->artist();
|
||||
|
||||
if (file->APETag() && !file->APETag()->artist().isEmpty())
|
||||
return file->APETag()->artist();
|
||||
|
||||
if(file->ID3v1Tag())
|
||||
return file->ID3v1Tag()->artist();
|
||||
|
||||
|
@ -72,12 +72,12 @@ namespace TagLib {
|
|||
|
||||
virtual String album() const
|
||||
{
|
||||
if (file->APETag() && !file->APETag()->album().isEmpty())
|
||||
return file->APETag()->album();
|
||||
|
||||
if(file->ID3v2Tag() && !file->ID3v2Tag()->album().isEmpty())
|
||||
return file->ID3v2Tag()->album();
|
||||
|
||||
if (file->APETag() && !file->APETag()->album().isEmpty())
|
||||
return file->APETag()->album();
|
||||
|
||||
if(file->ID3v1Tag())
|
||||
return file->ID3v1Tag()->album();
|
||||
|
||||
|
@ -86,12 +86,12 @@ namespace TagLib {
|
|||
|
||||
virtual String comment() const
|
||||
{
|
||||
if (file->APETag() && !file->APETag()->comment().isEmpty())
|
||||
return file->APETag()->comment();
|
||||
|
||||
if(file->ID3v2Tag() && !file->ID3v2Tag()->comment().isEmpty())
|
||||
return file->ID3v2Tag()->comment();
|
||||
|
||||
if (file->APETag() && !file->APETag()->comment().isEmpty())
|
||||
return file->APETag()->comment();
|
||||
|
||||
if(file->ID3v1Tag())
|
||||
return file->ID3v1Tag()->comment();
|
||||
|
||||
|
@ -100,12 +100,12 @@ namespace TagLib {
|
|||
|
||||
virtual String genre() const
|
||||
{
|
||||
if (file->APETag() && !file->APETag()->genre().isEmpty())
|
||||
return file->APETag()->genre();
|
||||
|
||||
if(file->ID3v2Tag() && !file->ID3v2Tag()->genre().isEmpty())
|
||||
return file->ID3v2Tag()->genre();
|
||||
|
||||
if (file->APETag() && !file->APETag()->genre().isEmpty())
|
||||
return file->APETag()->genre();
|
||||
|
||||
if(file->ID3v1Tag())
|
||||
return file->ID3v1Tag()->genre();
|
||||
|
||||
|
@ -114,12 +114,12 @@ namespace TagLib {
|
|||
|
||||
virtual uint year() const
|
||||
{
|
||||
if (file->APETag() && !file->APETag()->year() > 0)
|
||||
return file->APETag()->year();
|
||||
|
||||
if(file->ID3v2Tag() && file->ID3v2Tag()->year() > 0)
|
||||
return file->ID3v2Tag()->year();
|
||||
|
||||
if (file->APETag() && !file->APETag()->year() > 0)
|
||||
return file->APETag()->year();
|
||||
|
||||
if(file->ID3v1Tag())
|
||||
return file->ID3v1Tag()->year();
|
||||
|
||||
|
@ -128,12 +128,12 @@ namespace TagLib {
|
|||
|
||||
virtual uint track() const
|
||||
{
|
||||
if (file->APETag() && !file->APETag()->track() > 0)
|
||||
return file->APETag()->track();
|
||||
|
||||
if(file->ID3v2Tag() && file->ID3v2Tag()->track() > 0)
|
||||
return file->ID3v2Tag()->track();
|
||||
|
||||
if (file->APETag() && !file->APETag()->track() > 0)
|
||||
return file->APETag()->track();
|
||||
|
||||
if(file->ID3v1Tag())
|
||||
return file->ID3v1Tag()->track();
|
||||
|
||||
|
|
|
@ -272,6 +272,8 @@
|
|||
|
||||
- (void)loadInfoForEntries:(NSArray *)entries
|
||||
{
|
||||
NSAutoreleasePool *pool =[[NSAutoreleasePool alloc] init];
|
||||
|
||||
NSOperationQueue *queue;
|
||||
queue = [[[NSApplication sharedApplication] delegate] sharedOperationQueue];
|
||||
|
||||
|
@ -279,10 +281,10 @@
|
|||
for (PlaylistEntry *pe in entries)
|
||||
{
|
||||
NSInvocationOperation *readEntryInfoOperation;
|
||||
readEntryInfoOperation = [[[NSInvocationOperation alloc]
|
||||
readEntryInfoOperation = [[NSInvocationOperation alloc]
|
||||
initWithTarget:self
|
||||
selector:@selector(readEntryInfo:)
|
||||
object:pe]autorelease];
|
||||
object:pe];
|
||||
if (oldReadEntryInfoOperation)
|
||||
{
|
||||
[readEntryInfoOperation addDependency:oldReadEntryInfoOperation];
|
||||
|
@ -294,12 +296,14 @@
|
|||
context:NULL];
|
||||
[queue addOperation:readEntryInfoOperation];
|
||||
oldReadEntryInfoOperation = [readEntryInfoOperation retain];
|
||||
[readEntryInfoOperation release];
|
||||
}
|
||||
[oldReadEntryInfoOperation release];
|
||||
|
||||
[queue waitUntilAllOperationsAreFinished];
|
||||
|
||||
[playlistController performSelectorOnMainThread:@selector(updateTotalTime) withObject:nil waitUntilDone:NO];
|
||||
[pool release];
|
||||
}
|
||||
|
||||
- (NSDictionary *)readEntryInfo:(PlaylistEntry *)pe
|
||||
|
|
|
@ -35,13 +35,25 @@
|
|||
lYear = tag->year();
|
||||
lTrack = tag->track();
|
||||
|
||||
lArtist = [NSString stringWithUTF8String:pArtist.toCString(true)];
|
||||
if (!pArtist.isNull())
|
||||
lArtist = [NSString stringWithUTF8String:pArtist.toCString(true)];
|
||||
else
|
||||
lArtist = @"";
|
||||
|
||||
lAlbum = [NSString stringWithUTF8String:pAlbum.toCString(true)];
|
||||
if (!pAlbum.isNull())
|
||||
lAlbum = [NSString stringWithUTF8String:pAlbum.toCString(true)];
|
||||
else
|
||||
lAlbum = @"";
|
||||
|
||||
lTitle = [NSString stringWithUTF8String:pTitle.toCString(true)];
|
||||
if (!pTitle.isNull())
|
||||
lTitle = [NSString stringWithUTF8String:pTitle.toCString(true)];
|
||||
else
|
||||
lTitle = @"";
|
||||
|
||||
lGenre = [NSString stringWithUTF8String:pGenre.toCString(true)];
|
||||
if (!pGenre.isNull())
|
||||
lGenre = [NSString stringWithUTF8String:pGenre.toCString(true)];
|
||||
else
|
||||
lGenre = @"";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue