Skip to content

Commit 0cf3944

Browse files
committed
Fixes to^Cavnum code for autoplay -a
1 parent 5b1cf2a commit 0cf3944

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

ziptuner.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ First get a list to choose from. (old API)
5757
http://www.radio-browser.info/webservice/v2/m3u/url/nnnnn
5858
*/
5959

60+
// Some compile options to consider.
6061
//#define OLD_API
6162
//#define DEBUG
6263

@@ -505,7 +506,7 @@ int do_curl(char *url)
505506
curl_easy_setopt(curl_handle, CURLOPT_URL, url);
506507
curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, WriteMemoryCallback);
507508
curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, (void *)&chunk);
508-
curl_easy_setopt(curl_handle, CURLOPT_USERAGENT, "ziptuner/0.3");
509+
curl_easy_setopt(curl_handle, CURLOPT_USERAGENT, "ziptuner/0.4");
509510
#ifndef OLD_API
510511
// Tell libcurl to not verify the peer (this works for old puppy linux, and IZ2S)
511512
// That should be a command line option -k (for all ziptuners, not just IZ2S)
@@ -1159,7 +1160,7 @@ void get_favs()
11591160
//printf("After srch, dest[%d] = <%s>\n", j, destfile);
11601161

11611162
previtem = 0; // Do NOT use a previtem from the "search" menus.
1162-
if (favnum >= 0) {// Now play the station if requested on cmdline.
1163+
if ((favnum > 0) && (favnum <= n)) {// Now play the station if requested on cmdline.
11631164
previtem = favnum;
11641165
playit(files[previtem-1], NULL);
11651166
nowplaying = i;
@@ -1206,9 +1207,6 @@ void get_favs()
12061207
//printf("\n\n%s\n",stop);exit(0);
12071208
nowplaying = -1;
12081209
rerun = 1;
1209-
// Forget saved favorite.
1210-
// Use stop from main menu (or other) to retain favorite.
1211-
unlink("ziptuner.fav");
12121210
continue;
12131211
}
12141212
if (choice == 0x100) {
@@ -1231,7 +1229,7 @@ void get_favs()
12311229
unlink("ziptuner.fav");
12321230
rename("/tmp/ziptuner.tmp", "ziptuner.fav");
12331231

1234-
#if 0
1232+
#ifdef DEBUG
12351233
if (fp = fopen("zipplay.tmp", "w")) {
12361234
fprintf(fp,"item = %d\n",i-1);
12371235
fprintf(fp,"Name <%s>\n", names[i-1]);
@@ -1531,8 +1529,7 @@ int main(int argc, char **argv){
15311529
get_favs();
15321530
strcpy(buff, "file://.");
15331531
strcpy(srch_str,"");
1534-
if (-1 != access("ziptuner.item", F_OK))
1535-
unlink("ziptuner.item");
1532+
// favs use ziptuner.fav, so no need to unlink("ziptuner.item");
15361533
goto retry;
15371534
}
15381535
else if (-1 != access("ziptuner.item", F_OK))

0 commit comments

Comments
 (0)