The actual thread that gets spawned to process AudioScrobbler submission. Definition at line 470 of file scrobbler.c. 00471 { 00472 unsigned int amount, interval; 00473 char key[32] = ""; 00474 char *poststr, *msg, *url = NULL; 00475 00476 gui_input_sigmask(); 00477 00478 for(;;) { 00479 interval = 60; 00480 00481 if (key[0] == '\0') { 00482 /* No key yet */ 00483 if (scrobbler_send_handshake(key, &url) != 0) { 00484 /* Connection problems */ 00485 gui_msgbar_warn(_("Failed to authorize " 00486 "at AudioScrobbler.")); 00487 } else if (key[0] == '\0') { 00488 /* We got BADAUTH */ 00489 gui_msgbar_warn(_("Invalid AudioScrobbler " 00490 "username/password.")); 00491 } else { 00492 /* We've got a key */ 00493 interval = 1; 00494 gui_msgbar_warn(_("Successfully " 00495 "authorized at AudioScrobbler.")); 00496 } 00497 } else { 00498 /* 00499 * We are authorized. Send some tracks. 00500 */ 00501 amount = scrobbler_queue_fetch(key, &poststr); 00502 00503 if (scrobbler_send_tracks(key, url, poststr) == 0) { 00504 /* Done. Remove them from the queue. */ 00505 interval = 1; 00506 scrobbler_queue_remove(amount); 00507 00508 /* Print a message on the GUI */ 00509 if (amount == 1) { 00510 msg = g_strdup_printf( 00511 _("Successfully sent 1 song " 00512 "to AudioScrobbler.")); 00513 } else { 00514 msg = g_strdup_printf( 00515 _("Successfully sent %d songs " 00516 "to AudioScrobbler."), amount); 00517 } 00518 gui_msgbar_warn(msg); 00519 g_free(msg); 00520 } else { 00521 gui_msgbar_warn(_("Failed to submit songs " 00522 "to AudioScrobbler.")); 00523 } 00524 00525 g_free(poststr); 00526 } 00527 00528 /* Make sure we don't transmit too fast */ 00529 g_usleep(interval * 1000000); 00530 } 00531 00532 g_assert_not_reached(); 00533 return (NULL); 00534 }
Here is the call graph for this function:
![]()
Here is the caller graph for this function:
![]() |
1.6.3