File tree Expand file tree Collapse file tree 4 files changed +18
-8
lines changed Expand file tree Collapse file tree 4 files changed +18
-8
lines changed Original file line number Diff line number Diff line change 11## CHANGELOG
22
33### Unrelaesed
4- - Remove spaces from login
4+
5+ #### Added
56- Send "Now playing" request to last.fm
67
8+ #### Fixed
9+ - Remove spaces from login
10+ - Fix bug where toggling "Enabled" on and off was needed to scrobble songs
11+
712### 1.3.0 (2021/11/23)
813
914- Scrobble with album name [ issue #37 ] ( https://github.com/ShazamScrobbler/shazamscrobbler-macos/issues/37 )
Original file line number Diff line number Diff line change @@ -34,9 +34,14 @@ + (void)init {
3434 [LastFm sharedInstance ].apiSecret = SECRET;
3535 [LastFm sharedInstance ].session = [prefs valueForKey: @" session" ];
3636 [LastFm sharedInstance ].username = [prefs valueForKey: @" username" ];
37-
37+
38+ // Initialize operation queue
3839 operationQueue = [[NSOperationQueue alloc ] init ];
3940 [operationQueue setMaxConcurrentOperationCount: 1 ];
41+
42+ // Ensure scrobbling state is properly initialized
43+ MenuController *menu = ((AppDelegate *)[NSApplication sharedApplication ].delegate ).menu ;
44+ [menu.scrobblingItem setEnabled: ([prefs stringForKey: @" session" ] != nil )];
4045}
4146
4247+ (bool )login : (NSString *)username withPassword : (NSString *)password {
Original file line number Diff line number Diff line change @@ -205,13 +205,13 @@ - (IBAction)negateScrobbling:(id)sender
205205 NSInteger scrobbling = [[NSUserDefaults standardUserDefaults ] integerForKey: @" scrobbling" ];
206206 NSInteger state = scrobbling ? NSOffState : NSOnState ;
207207 [[NSUserDefaults standardUserDefaults ] setInteger: state forKey: @" scrobbling" ];
208-
208+ [[NSUserDefaults standardUserDefaults ] synchronize ]; // Ensure settings are saved
209+
209210 [_scrobblingItem setState: state];
210- [_scrobblingItem setEnabled: state];
211211 [_main itemChanged: _scrobblingItem];
212- if (state == NSOnState ) {
213- [ShazamController findNewTags ];
214- }
212+
213+ // Always try to find new tags when toggling scrobbling
214+ [ShazamController findNewTags ];
215215}
216216
217217- (void )updateScrobblingItemWith : (NSInteger )itemsToScrobble
Original file line number Diff line number Diff line change @@ -126,7 +126,7 @@ + (void)watch:(NSString*) path {
126126+ (void )findNewTags {
127127 // Initialize previous session information
128128 NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults ];
129-
129+
130130 // Connection to the DB
131131 FMDatabase *database = [FMDatabase databaseWithPath: [ShazamConstants getSqlitePath ]];
132132
You can’t perform that action at this time.
0 commit comments