Hi, I needed up-to-date/second information for a script watching as moc is playing.
I'm quite sure it's not really the proper way to do this, but unless someone comes up with a better idea, here's the patch for it.
What it does:
Add's the options -I and --infoloop as well as the required code to main.c for a looping --info.
Comments are welcome ;-)
moc-2.3.2-infoloop.patch
--- main.c 2005-09-25 09:59:15.000000000 +0200
+++ main.c 2005-10-25 00:39:48.000000000 +0200
@@ -55,6 +55,7 @@
int next;
int previous;
int get_file_info;
+ int loop_file_info;
int toggle_pause;
int recursively;
int playit;
@@ -289,6 +290,17 @@
interface_cmdline_play_first (server_sock);
if (params->get_file_info)
interface_cmdline_file_info (server_sock);
+ while (params->loop_file_info) {
+ printf("\nINFO COMPLETE\n\n");
+ if (fflush(stdout)) {
+ options_free ();
+ decoder_cleanup ();
+ compat_cleanup ();
+ exit; // error
+ }
+ sleep(2);
+ interface_cmdline_file_info (server_sock);
+ }
send_int (server_sock, CMD_DISCONNECT);
}
else if (params->only_server)
@@ -374,6 +386,7 @@
"-n --nosync Don't synchronize the playlist with other clients.\n"
"-A --ascii Use ASCII characters to draw lines.\n"
"-i --info Print the information about the currently played file.\n"
+"-I --infoloop Print the information about the currently played file in a loop.\n"
"-e --recursively Make a playlist from the content of the directory given\n"
" at the command line.\n"
, prg_name);
@@ -476,6 +489,7 @@
{ "nosync", 0, NULL, 'n' },
{ "ascii", 0, NULL, 'A' },
{ "info", 0, NULL, 'i' },
+ { "infoloop", 0, NULL, 'I' },
{ "recursively", 0, NULL, 'e' },
{ 0, 0, 0, 0 }
};
@@ -486,7 +500,7 @@
memset (¶ms, 0, sizeof(params));
options_init ();
- while ((ret = getopt_long(argc, argv, "VhDSFR:macpsxT:C:M:PUynArfiGel",
+ while ((ret = getopt_long(argc, argv, "VhDSFR:macpsxT:C:M:PUynArfiIGel",
long_options, &opt_index)) != -1) {
switch (ret) {
case 'V':
@@ -528,6 +542,11 @@
params.get_file_info = 1;
params.dont_run_iface = 1;
break;
+ case 'I':
+ params.get_file_info = 1;
+ params.dont_run_iface = 1;
+ params.loop_file_info = 1;
+ break;
case 'p':
params.play = 1;
params.dont_run_iface = 1;
BTW: is it possible to attach files somehow?