void xmms() { if (syscall_UI_Argc() == 1) { orig_syscall(UI_PRINT, "^nXMMS Control\n"); orig_syscall(UI_PRINT, "^nusage: " ETH_CMD_PREFIX "xmmsctrl [command]\n"); orig_syscall(UI_PRINT, "^nPossible Commands:\n"); orig_syscall(UI_PRINT, "^flaunch ^n- launches XMMS\n"); orig_syscall(UI_PRINT, "^fspam ^n- spam with xmms infos \n"); orig_syscall(UI_PRINT, "^fnext ^n- play next song\n"); orig_syscall(UI_PRINT, "^fplay ^n- play next song\n"); orig_syscall(UI_PRINT, "^fpause ^n- pause the current playing song\n"); orig_syscall(UI_PRINT, "^fplay_pause ^n- this is thought for binding. If playing it will pause - if paused it will play.\n"); orig_syscall(UI_PRINT, "^fstop ^n- stop the current playing song\n"); orig_syscall(UI_PRINT, "^fprev ^n- play previous song\n"); orig_syscall(UI_PRINT, "^ftrack [number] ^n- set current title to specified track\n"); orig_syscall(UI_PRINT, "^fremove ^n- deletes the current playing song from the playlist\n"); orig_syscall(UI_PRINT, "^frepeat ^n- toggles repeat.\n"); orig_syscall(UI_PRINT, "^fshuffle ^n- toggles shuffle.\n"); orig_syscall(UI_PRINT, "^fvol [+|-]percent ^n- sets the volume to the specified percent. Increase with +n. Decrease with -n\n"); orig_syscall(UI_PRINT, "^fpos ^n- Trackinfos\n"); orig_syscall(UI_PRINT, "^fquit ^n- quits xmms\n"); return; } if (syscall_UI_Argc() > 1){ const char *cmd = syscall_UI_Argv(1); //int volume; if( !strcmp(cmd,"launch") ){ system("xmmsctrl launch"); //ET loses focus if windowed! //if ET quits XMMS will quit too after song is finished! } else if( !strcmp(cmd,"next") ){ system("xmmsctrl next"); } else if( !strcmp(cmd,"pause") ){ system("xmmsctrl pause"); } else if( !strcmp(cmd,"play") ){ system("xmmsctrl play"); } else if( !strcmp(cmd,"stop") ){ system("xmmsctrl stop"); } else if( !strcmp(cmd,"prev") ){ system("xmmsctrl previous"); //With previous he will jump to last if at start of playlist and the other way round } else if( !strcmp(cmd,"play_pause") ) { system("sh -c \"if xmmsctrl playing; then xmmsctrl pause; else xmmsctrl play; fi\""); } else if( !strcmp(cmd,"track") ){ system("xmmsctrl track"); // if (sscanf(cmd, "track %i", &trackNumber) == 1){ // system(va("xmmsctrl track %i", trackNumber)); /* char *position = strdup(getOutputSystemCommand("xmmsctrl print %P")); char *title = strdup(getOutputSystemCommand("xmmsctrl print %T")); orig_syscall(UI_CMD_EXECUTETEXT, EXEC_APPEND, va("echo \"^3Current Track: ^0[^n%s^0] [^n%s^0]"" \n", position, title)); free(position); free(title); return; */ } else if( !strcmp(cmd,"remove") ){ system("xmmsctrl remove"); } else if( !strcmp(cmd,"repeat") ){ system("xmmsctrl repeat"); //Need method to see if on/off } else if( !strcmp(cmd,"shuffle") ){ system("xmmsctrl shuffle"); //Need method to see if on/off //} else if( !strcmp(cmd,"vol") ){ // system("xmmsctrl vol"); // Howto read a number? // Return volume value if nothing specified - I know how to do that } else if( !strcmp(cmd,"quit") ){ system("xmmsctrl quit"); } else if( !strcmp(cmd,"pos") ){ char *filename = strdup(getOutputSystemCommand("xmmsctrl print %F")); char *title = strdup(getOutputSystemCommand("xmmsctrl print %T")); char *currentTime = strdup(getOutputSystemCommand("xmmsctrl print %m")); char *totalTime = strdup(getOutputSystemCommand("xmmsctrl print %M")); char *position = strdup(getOutputSystemCommand("xmmsctrl print %P")); //Returns Playlist-Position if (!strlen(filename)) { orig_syscall(UI_PRINT, "^nXMMS: Nothing to display\n"); return; } orig_syscall(UI_CMD_EXECUTETEXT, EXEC_APPEND, va("echo \"^3Filename: ^0[^n%s^0]"" \n", filename)); orig_syscall(UI_CMD_EXECUTETEXT, EXEC_APPEND, va("echo \"^3Title: ^0[^n%s^0] [^n%s^0] [^n%s^0/^n%s^0] "" \n", position, title, currentTime, totalTime)); free(filename); free(title); free(currentTime); free(totalTime); free(position); } else if ( !strcmp(cmd,"spam") ){ //Original ETH XMMS Spam: char *title = strdup(getOutputSystemCommand("xmmsctrl print %T")); char *currentTime = strdup(getOutputSystemCommand("xmmsctrl print %m")); char *totalTime = strdup(getOutputSystemCommand("xmmsctrl print %M")); if (!strlen(title)) { orig_syscall(UI_PRINT, "^nXMMS: Nothing to display\n"); return; } orig_syscall(UI_CMD_EXECUTETEXT, EXEC_APPEND, va("say \"^3Playing: ^0[^n%s^0]^*-^0[^n%s/%s^0] "" \n", title, currentTime, totalTime)); free(title); free(currentTime); free(totalTime); } else { orig_syscall(UI_PRINT, "^nUnknown option, aborting\n"); return; } } }