- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <time.h>
char a[150],c[150];
int main(int argc, char **argv) {
FILE * tmp;
while(1) {
int b=0,b1=0;
bool A=0;
tmp=fopen(".tmp.txt","r");
fgets(c,150,tmp);
fclose(tmp);
system("rm .tmp.txt");
system("xwininfo -tree -root | grep -i '\\- deadbeef-0.5.1' > .tmp.txt");
tmp=fopen(".tmp.txt","r");
fgets(a,150,tmp);
fclose(tmp);
for(int i=16;i<149;i++) {
c[i-16]=c[i];
a[i-16]=a[i];
if(a[i-16]=='-')
b++;
if(c[i-16]=='-')
b1++;
if(b==2)
a[i-16]=0;
if(b1==2)
c[i-16]=0;
}
for(int j=0;j<(int)strlen(c);j++) {
if (a[j]!=c[j]) A=true;
}
if (A) {
char lamp[]="/usr/bin/purple-remote \"setstatus?status=available&message=";
strcat(lamp,a);
strcat(lamp,"\"");
system(lamp);
}
sleep(5);
}
return 0;
}