📄 lyrics_audacious.c
字号:
#include <stdio.h>#include <stdlib.h>#include <unistd.h>#include <string.h>#include <audacious/beepctrl.h> /* provided by audacious */void set_time(int session, int time){ gint ptime = time * 1000; gint pos = xmms_remote_get_playlist_pos( session ); gint length = xmms_remote_get_playlist_time( session, pos ); /* check bounds */ if ( ptime < 0 ) { ptime = 0; } else if ( ptime > length ) { ptime = length; } xmms_remote_jump_to_time( session, ptime );}/* * launch a new xmms and return the session number * exit if error */int launch(void){ gint session; unsigned int tries; switch( fork() ) { case -1: exit(-1); case 0: execlp("audacious", "audacious", NULL); exit(1); default: for( tries = 0 ; tries < 10 ; tries++ ) { usleep( 500000 ); /* in usec */ for( session = 0 ; session < 16 ; session++ ) if ( xmms_remote_is_running( session ) ) return session; } exit(-2); /* if no session found, abort */ }}int is_on(){ gint session; for(session=0; session<16; session++) { if(xmms_remote_is_running( session )) return session; } return -1;}int get_time(int session){ return xmms_remote_get_output_time(session)/1000 ;}char* get_song(int session){ char *song; int posi; posi = xmms_remote_get_playlist_pos( session ); song = xmms_remote_get_playlist_file(session,posi); return song;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -