Skip to content

Commit 4d8054f

Browse files
Send now playing, resolves #43 (#44)
1 parent 52a04cf commit 4d8054f

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
### Unrelaesed
44
- Remove spaces from login
5+
- Send "Now playing" request to last.fm
56

67
### 1.3.0 (2021/11/23)
78

ShazamScrobbler/LastFmController.m

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,12 @@ + (void)nowPlaying:(Song*)song withTag:(NSInteger)tag {
115115
}];
116116
[operationQueue addOperation:operation];
117117
[menu setNowPlaying:true];
118+
[[LastFm sharedInstance] sendNowPlayingTrack:song.song byArtist:song.artist onAlbum:song.album withDuration:PLAYTIME successHandler:nil failureHandler:^(NSError *error) {
119+
NSLog(@"sendNowPlayingTrack error: %@", error);
120+
}];
118121
};
119122
} failureHandler:^(NSError *error) {
120-
NSLog(@"Now playing error: %@", error);
123+
NSLog(@"getRecentTracksForUserOrNil error: %@", error);
121124
}];
122125
} else {
123126
// This item was not in the not-to-scrobble list and could be scrobbled
@@ -133,7 +136,7 @@ + (void)scrobble:(Song *)song withTag:(NSInteger)tag {
133136

134137
if (seconds <= 0) {
135138
// Scrobble a track
136-
[[LastFm sharedInstance] sendScrobbledTrack:song.song byArtist:song.artist onAlbum:song.album withDuration:30 atTimestamp:(int)[song.date timeIntervalSince1970] successHandler:^(NSDictionary *result) {
139+
[[LastFm sharedInstance] sendScrobbledTrack:song.song byArtist:song.artist onAlbum:song.album withDuration:PLAYTIME atTimestamp:(int)[song.date timeIntervalSince1970] successHandler:^(NSDictionary *result) {
137140

138141
// We need to re-check if the user is connected and the scrobbling is enabled
139142
// in case the configuration changed during the last 30 seconds

0 commit comments

Comments
 (0)