forked from qmx/ScrobblePod
-
Notifications
You must be signed in to change notification settings - Fork 0
/
BGLastFmSong.m
74 lines (63 loc) · 1.71 KB
/
BGLastFmSong.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
//
// BGLastFmSong.m
// LastFmProtocolTester
//
// Created by Ben Gummer on 28/07/07.
// Copyright 2007 Ben Gummer. All rights reserved.
//
#import "BGLastFmSong.h"
@implementation BGLastFmSong
-(id)initWithTitle:(NSString *)aTitle artist:(NSString *)anArtist album:(NSString *)anAlbum {
self = [super init];
if (self != nil) {
self.title = aTitle;
self.artist = anArtist;
self.album = anAlbum;
self.isExtra = NO;
}
return self;
}
- (void) dealloc {
[title release];
[artist release];
[album release];
[comment release];
[genre release];
[lastPlayed release];
[uniqueIdentifier release];
[persistentIdentifier release];
[super dealloc];
}
-(NSString *)description {
return [NSString stringWithFormat:@"'%@'%@ at %@", self.title, (self.isExtra ? @" (EXTRA)" : @""),self.lastPlayed];
}
- (id)copyWithZone:(NSZone *)zone {
BGLastFmSong *copy = [[[self class] allocWithZone: zone] initWithTitle:self.title
artist:self.artist
album:self.album];
copy.lastPlayed = self.lastPlayed;
copy.uniqueIdentifier = self.uniqueIdentifier;
copy.persistentIdentifier = self.persistentIdentifier;
copy.length = self.length;
copy.genre = self.genre;
copy.extraPlays = self.extraPlays;
copy.playCount = self.playCount;
copy.isExtra = self.isExtra;
return copy;
}
-(int)unixPlayedDate { // this probably isnt stringly the unix method, but whatever ;)
return [self.lastPlayed timeIntervalSinceReferenceDate];
}
@synthesize title;
@synthesize artist;
@synthesize album;
@synthesize comment;
@synthesize genre;
@synthesize lastPlayed;
@synthesize length;
@synthesize extraPlays;
@synthesize playCount;
@synthesize uniqueIdentifier;
@synthesize persistentIdentifier;
@synthesize isExtra;
@end