Restore the AudioScrobbler queue from a file. Definition at line 579 of file scrobbler.c. 00580 { 00581 const char *filename; 00582 FILE *fio; 00583 char fbuf[1024], *s1, *s2; 00584 struct scrobbler_entry **nse; 00585 00586 filename = config_getopt("scrobbler.dumpfile"); 00587 if (filename[0] == '\0') 00588 return; 00589 00590 if ((fio = vfs_fopen(filename, "r")) == NULL) 00591 return; 00592 00593 nse = &scrobbler_queue_first; 00594 while (vfs_fgets(fbuf, sizeof fbuf, fio) == 0) { 00595 /* String parsing sucks */ 00596 *nse = g_slice_new(struct scrobbler_entry); 00597 00598 /* Artist */ 00599 if ((s1 = strchr(fbuf, ' ')) == NULL) 00600 goto bad; 00601 (*nse)->artist = g_strndup(fbuf, s1 - fbuf); 00602 /* Title */ 00603 if ((s2 = strchr(++s1, ' ')) == NULL) 00604 goto bad; 00605 (*nse)->title = g_strndup(s1, s2 - s1); 00606 /* Album */ 00607 if ((s1 = strchr(++s2, ' ')) == NULL) 00608 goto bad; 00609 (*nse)->album = g_strndup(s2, s1 - s2); 00610 /* Length and time */ 00611 if ((s2 = strchr(++s1, ' ')) == NULL) 00612 goto bad; 00613 (*nse)->length = strtoul(s1, NULL, 10); 00614 (*nse)->time = strtol(++s2, NULL, 10); 00615 00616 /* Properly fix up the list */ 00617 scrobbler_queue_last = *nse; 00618 nse = &(*nse)->next; 00619 continue; 00620 00621 bad: scrobbler_queue_item_free(*nse); 00622 } 00623 fclose(fio); 00624 00625 /* Terminate our entry list */ 00626 *nse = NULL; 00627 }
Here is the call graph for this function:
![]()
Here is the caller graph for this function:
![]() |
1.6.3