git.ithinksw.org
/
MenuTunes.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
c1c078a
)
Added some more debug loggins to Audioscrobbler method. Improved it so it should...
author
Kent Sutherland
<ksuther@ithinksw.com>
Sun, 25 Dec 2005 07:38:08 +0000
(07:38 +0000)
committer
Kent Sutherland
<ksuther@ithinksw.com>
Sun, 25 Dec 2005 07:38:08 +0000
(07:38 +0000)
MainController.m
patch
|
blob
|
history
diff --git
a/MainController.m
b/MainController.m
index
b39d34d
..
20f4381
100755
(executable)
--- a/
MainController.m
+++ b/
MainController.m
@@
-633,9
+633,10
@@
static MainController *sharedController;
[timer invalidate];
if ([df boolForKey:@"audioscrobblerEnabled"]) {
NS_DURING
[timer invalidate];
if ([df boolForKey:@"audioscrobblerEnabled"]) {
NS_DURING
- int elapsed = [[self currentRemote] currentSongPlayed];
- if ((abs(elapsed -
_audioscrobbler
Interval) < 5) && ([[self currentRemote] playerPlayingState] == ITMTRemotePlayerPlaying)) {
+ int elapsed = [[self currentRemote] currentSongPlayed]
, length = [[self currentRemote] currentSongDuration], requiredInterval = ((length / 2 < 240) ? length / 2 : 240)
;
+ if ((abs(elapsed -
required
Interval) < 5) && ([[self currentRemote] playerPlayingState] == ITMTRemotePlayerPlaying)) {
NSString *title = [[self currentRemote] currentSongTitle], *artist = [[self currentRemote] currentSongArtist];
NSString *title = [[self currentRemote] currentSongTitle], *artist = [[self currentRemote] currentSongArtist];
+ NSLog(@"Audioscrobbler: Submitting");
if (title && artist) {
ITDebugLog(@"Audioscrobbler: Submitting current track");
[[AudioscrobblerController sharedController] submitTrack:title
if (title && artist) {
ITDebugLog(@"Audioscrobbler: Submitting current track");
[[AudioscrobblerController sharedController] submitTrack:title
@@
-643,12
+644,15
@@
static MainController *sharedController;
album:[[self currentRemote] currentSongAlbum]
length:[[self currentRemote] currentSongDuration]];
}
album:[[self currentRemote] currentSongAlbum]
length:[[self currentRemote] currentSongDuration]];
}
- } else if (_audioscrobblerInterval - elapsed > 0) {
- ITDebugLog(@"Audioscrobbler: Creating a new timer that will run in %i seconds", _audioscrobblerInterval - elapsed);
- _audioscrobblerInterval -= elapsed;
+ } else if (requiredInterval - elapsed > 0) {
+ _audioscrobblerInterval = requiredInterval - elapsed;
[_audioscrobblerTimer release];
[_audioscrobblerTimer release];
- _audioscrobblerTimer = [[NSTimer alloc] initWithFireDate:[NSDate dateWithTimeIntervalSinceNow:_audioscrobblerInterval] interval:nil target:self selector:@selector(submitAudioscrobblerTrack:) userInfo:nil repeats:NO];
+ NSLog(@"Audioscrobbler: Creating a new timer that will run in %i seconds", _audioscrobblerInterval);
+ ITDebugLog(@"Audioscrobbler: Creating a new timer that will run in %i seconds", _audioscrobblerInterval);
+ _audioscrobblerTimer = [[NSTimer alloc] initWithFireDate:[NSDate dateWithTimeIntervalSinceNow:_audioscrobblerInterval] interval:1.0 target:self selector:@selector(submitAudioscrobblerTrack:) userInfo:nil repeats:NO];
[[NSRunLoop currentRunLoop] addTimer:_audioscrobblerTimer forMode:NSDefaultRunLoopMode];
[[NSRunLoop currentRunLoop] addTimer:_audioscrobblerTimer forMode:NSDefaultRunLoopMode];
+ } else {
+ NSLog(@"Audioscrobbler: Skipping submission. %i, %i", requiredInterval, elapsed);
}
NS_HANDLER
[self networkError:localException];
}
NS_HANDLER
[self networkError:localException];