come again?

a long time ago, when i still used to use xmms, there was this nice plugin called Repeat It! that let you say, “repeat this song between this and this times forever.”

i found myself missing that feature today… unfortunately, i don’t have xmms installed and don’t want it installed because i now like the gtk2 based mp3 players, like beep for example.

but because beep is being rewritten as bmpx, i figure rather than porting the plugin, i can just write a much simpler command line version based on the existing plugin that works with beep.

note however that this is really bad… it does very little error checking, and the sleep solution isn’t really the best solution… but its a pretty good solution for my limited uses :)

and in 25 lines, here it is:

#include <stdio.h>
#include <signal.h>
#include <bmp/beepctrl.h>

void got_signal(int x){
	printf("Exiting!\n"); exit(1);

int main(int argc, char** argv){
   int startpos, endpos;
   if (!xmms_remote_is_running(0))
      return (0*printf("\033[1mbmp is not running.\033[0m\n"))-1;

   if (argc != 3)
      return (0*printf("usage: %s start end\n", argv[0]));

   startpos = atoi(argv[1]);
   endpos = atoi(argv[2]);

   signal(SIGINT, got_signal);
   if (!xmms_remote_is_playing(0)){ xmms_remote_play(0); }

   while (1){
      xmms_remote_jump_to_time(0, startpos * 1000);
      sleep(endpos - startpos);

to compile it, just do:

gcc `beep-config --cflags --libs` loopsegment.c -o loop

then just run beep, load up the file you want to play, and run the script passing in start and end seconds.

comments powered by Disqus