diff -rupN moc-2.5.0-alpha4.orig/interface.c moc-2.5.0-alpha4/interface.c --- moc-2.5.0-alpha4.orig/interface.c 2009-09-25 04:53:14.000000000 -0400 +++ moc-2.5.0-alpha4/interface.c 2010-04-25 21:21:02.000000000 -0400 @@ -3999,6 +3999,66 @@ void interface_cmdline_file_info (const plist_free (queue); } + +void interface_cmdline_playlist_info (const int server_sock) +{ + srv_sock = server_sock; /* the interface is not initialized, so set it + here */ + struct plist server_list; + plist_init(&server_list); + + send_int_to_srv (CMD_GET_SERIAL); + plist_set_serial (&server_list, get_data_int()); + + if (!recv_server_plist(&server_list)) { + + if (!getcwd(cwd, sizeof(cwd))) + fatal ("Can't get CWD: %s.", strerror(errno)); + + /* this checks if the file exists */ + if (file_type(create_file_name("playlist.m3u")) + == F_PLAYLIST) + plist_load (&server_list, + create_file_name( + "playlist.m3u"), + cwd, 1); + } + + char time_str[6]; + struct file_tags *tags; + + int i; + for (i = 0; i < server_list.num; i++){ + + tags = plist_get_tags(&server_list,i); + + if (tags->time != -1) { + sec_to_min (time_str, tags->time); + } + + printf("%i: ",i+1); + printf ("%s -- ", tags->title); + printf ("%s ", + tags->artist + ? tags->artist : ""); + printf ("(%s) ", + tags->album + ? tags->album : ""); + printf ("%s\t", time_str); + printf("\n"); + free(tags); + + } + if (server_list.num == 0){ + printf("There is nothing in the playlist\n"); + } + + plist_free (dir_plist); + plist_free (playlist); + plist_free (queue); + plist_free (&server_list); +} + void interface_cmdline_enqueue (int server_sock, char **args, const int arg_num) { diff -rupN moc-2.5.0-alpha4.orig/interface.h moc-2.5.0-alpha4/interface.h --- moc-2.5.0-alpha4.orig/interface.h 2009-09-09 03:46:35.000000000 -0400 +++ moc-2.5.0-alpha4/interface.h 2010-04-25 21:17:47.000000000 -0400 @@ -45,6 +45,7 @@ void interface_cmdline_clear_plist (int void interface_cmdline_append (int server_sock, char **args, const int arg_num); void interface_cmdline_play_first (int server_sock); +void interface_cmdline_playlist_info (const int server_sock); void interface_cmdline_file_info (const int server_sock); void interface_cmdline_playit (int server_sock, char **args, const int arg_num); void interface_cmdline_seek_by (int server_sock, const int seek_by); diff -rupN moc-2.5.0-alpha4.orig/main.c moc-2.5.0-alpha4/main.c --- moc-2.5.0-alpha4.orig/main.c 2009-09-25 04:57:20.000000000 -0400 +++ moc-2.5.0-alpha4/main.c 2010-04-25 21:17:56.000000000 -0400 @@ -69,6 +69,7 @@ struct parameters char *toggle; char *on; char *off; + int playlist; }; @@ -294,6 +295,7 @@ static void show_usage (const char *prg_ "-o --on Turn on a control (shuffle, autonext, repeat).\n" "-u --off Turn off a control (shuffle, autonext, repeat).\n" "-t --toggle Toggle a control (shuffle, autonext, repeat).\n" +"-z --playlist Show current playlist information.\n" , prg_name); } @@ -307,6 +309,8 @@ static void server_command (struct param signal (SIGPIPE, SIG_IGN); if (ping_server(sock)) { + if (params->playlist) + interface_cmdline_playlist_info (sock); if (params->playit) interface_cmdline_playit (sock, args, arg_num); if (params->clear) @@ -438,6 +442,7 @@ int main (int argc, char *argv[]) { "nosync", 0, NULL, 'n' }, { "ascii", 0, NULL, 'A' }, { "info", 0, NULL, 'i' }, + { "playlist", 0, NULL, 'z' }, { "recursively", 0, NULL, 'e' }, { "seek", 1, NULL, 'k' }, { "jump", 1, NULL, 'j' }, @@ -461,7 +466,7 @@ int main (int argc, char *argv[]) logit ("Could not net locate!"); while ((ret = getopt_long(argc, argv, - "VhDSFR:macpsxT:C:M:PUynArfiGelk:j:v:t:o:u:Q:q", + "VhDSFR:macpsxT:C:M:PUynArfizGelk:j:v:t:o:u:Q:q", long_options, &opt_index)) != -1) { switch (ret) { case 'V': @@ -603,6 +608,10 @@ int main (int argc, char *argv[]) params.get_formatted_info = 1; params.dont_run_iface = 1; break; + case 'z': + params.playlist = 1; + params.dont_run_iface = 1; + break; default: show_usage (argv[0]); return 1; diff -rupN moc-2.5.0-alpha4.orig/mocp.1 moc-2.5.0-alpha4/mocp.1 --- moc-2.5.0-alpha4.orig/mocp.1 2009-09-22 11:45:55.000000000 -0400 +++ moc-2.5.0-alpha4/mocp.1 2010-04-25 21:18:01.000000000 -0400 @@ -78,6 +78,10 @@ Request stop playing from the server. Bring down the server. .TP +.I -z --playlist +Output the current playlist. + +.TP .I -P --pause Request pause from the server.