@@ -149,8 +149,8 @@ fn audio_thread(rx: Receiver<AudioCommand>, app: AppHandle) {
149149 && play_count_state. track_id . is_some ( ) {
150150 let ratio = progress. position_ms as f64 / progress. duration_ms as f64 ;
151151
152- if ratio >= 0.75 {
153- if let Some ( track_id) = play_count_state. track_id {
152+ if ratio >= 0.75
153+ && let Some ( track_id) = play_count_state. track_id {
154154 // Spawn async task to avoid blocking audio thread
155155 let app_handle = app. clone ( ) ;
156156 std:: thread:: spawn ( move || {
@@ -165,7 +165,6 @@ fn audio_thread(rx: Receiver<AudioCommand>, app: AppHandle) {
165165 } ) ;
166166 play_count_state. threshold_reached = true ;
167167 }
168- }
169168 }
170169
171170 // Check scrobble threshold (90% default, configurable)
@@ -174,8 +173,8 @@ fn audio_thread(rx: Receiver<AudioCommand>, app: AppHandle) {
174173 && scrobble_state. track_id . is_some ( ) {
175174 let ratio = progress. position_ms as f64 / progress. duration_ms as f64 ;
176175
177- if ratio >= scrobble_state. threshold_percent {
178- if let Some ( track_id) = scrobble_state. track_id {
176+ if ratio >= scrobble_state. threshold_percent
177+ && let Some ( track_id) = scrobble_state. track_id {
179178 // Spawn async task to avoid blocking audio thread
180179 let app_handle = app. clone ( ) ;
181180 std:: thread:: spawn ( move || {
@@ -193,7 +192,6 @@ fn audio_thread(rx: Receiver<AudioCommand>, app: AppHandle) {
193192 } ) ;
194193 scrobble_state. threshold_reached = true ;
195194 }
196- }
197195 }
198196 }
199197
0 commit comments