diff options
author | Berke Viktor <bviktor@hexchat.org> | 2012-10-30 08:42:48 +0100 |
---|---|---|
committer | Berke Viktor <bviktor@hexchat.org> | 2012-10-30 08:42:48 +0100 |
commit | e681eafa78262d0c177832d67900687f2c938081 (patch) | |
tree | 5668476e046c505b9f3fcc8c53b6e0971c146978 /plugins/mpcinfo | |
parent | 97dc13fde70810abf07985f45ac459560eae6e96 (diff) |
Rebranding for the rest of plugin*
Diffstat (limited to 'plugins/mpcinfo')
-rw-r--r-- | plugins/mpcinfo/functions.c | 2 | ||||
-rw-r--r-- | plugins/mpcinfo/mp3Info.c | 46 | ||||
-rw-r--r-- | plugins/mpcinfo/mpcInfo.c | 40 | ||||
-rw-r--r-- | plugins/mpcinfo/mpcinfo.def | 4 | ||||
-rw-r--r-- | plugins/mpcinfo/oggInfo.c | 2 | ||||
-rw-r--r-- | plugins/mpcinfo/theme.c | 22 |
6 files changed, 58 insertions, 58 deletions
diff --git a/plugins/mpcinfo/functions.c b/plugins/mpcinfo/functions.c index ed0632d4..ba6ba519 100644 --- a/plugins/mpcinfo/functions.c +++ b/plugins/mpcinfo/functions.c @@ -117,7 +117,7 @@ char *readLine(FILE *f){ else buffer[pos]=(char)cc;pos++; } } - if (buffer[pos]==EOF) xchat_printf(ph,"EOF: %i\n",pos); + if (buffer[pos]==EOF) hexchat_printf(ph,"EOF: %i\n",pos); return buffer; } diff --git a/plugins/mpcinfo/mp3Info.c b/plugins/mpcinfo/mp3Info.c index f75ba9c4..c08e9663 100644 --- a/plugins/mpcinfo/mp3Info.c +++ b/plugins/mpcinfo/mp3Info.c @@ -81,12 +81,12 @@ int str2int(char *text){ int ret=0; for (i=1;i<=strlen(text);i++){ if ((text[strlen(text)-i]>57)||(text[strlen(text)-i]<48)){ - xchat_printf(ph,"invalid char in string: %i",text[strlen(text)-i]); + hexchat_printf(ph,"invalid char in string: %i",text[strlen(text)-i]); return 255; } ret+=((int)text[strlen(text)-i]-48)*iPow(10,i-1); } - //xchat_printf(ph, "str2int(%s)=%i",text,ret); + //hexchat_printf(ph, "str2int(%s)=%i",text,ret); //if (DEBUG==1) putlog("int converted"); return ret; } @@ -135,7 +135,7 @@ static char *tagExtract(char *tag, int tagLen, char* info){ //if (DEBUG==1) putlog("extracting tag"); int pos, len, i; pos=inStr(tag,tagLen,info); -//xchat_printf(ph,"pos=%i",pos); +//hexchat_printf(ph,"pos=%i",pos); if (pos==-1) return "";//NULL; //printf("position of %s = %i\n",info,pos); len=0; @@ -163,7 +163,7 @@ struct tagInfo readID3V1(char *file){ ret.artist=NULL; f=fopen(file,"rb"); if (f==NULL){ - xchat_print(ph,"file not found while trying to read id3v1"); + hexchat_print(ph,"file not found while trying to read id3v1"); //if (DEBUG==1) putlog("file not found while trying to read id3v1"); return ret; } @@ -174,14 +174,14 @@ struct tagInfo readID3V1(char *file){ //printf("position= %li\n",pos); for (i=0;i<128;i++) { c=fgetc(f); - if (c==EOF) {xchat_printf(ph,"read ID3V1 failed\n");fclose(f);return ret;} + if (c==EOF) {hexchat_printf(ph,"read ID3V1 failed\n");fclose(f);return ret;} tag[i]=(char)c; } fclose(f); //printf("tag readed: \n"); id=substring(tag,0,3); //printf("header: %s\n",id); - if (strcmp(id,"TAG")!=0){xchat_printf(ph,"no id3 v1 found\n");return ret;} + if (strcmp(id,"TAG")!=0){hexchat_printf(ph,"no id3 v1 found\n");return ret;} ret.title=subString(tag,3,30,1); ret.artist=subString(tag,33,30,1); ret.album=subString(tag,63,30,1); @@ -191,15 +191,15 @@ struct tagInfo readID3V1(char *file){ val=(int)tmp[0]; if (val<0)val+=256; - //xchat_printf(ph, "tmp[0]=%i (%i)",val,tmp[0]); + //hexchat_printf(ph, "tmp[0]=%i (%i)",val,tmp[0]); if ((val<148)&&(val>=0)) ret.genre=GENRES[val];//#############changed else { ret.genre="unknown"; - //xchat_printf(ph, "tmp[0]=%i (%i)",val,tmp[0]); + //hexchat_printf(ph, "tmp[0]=%i (%i)",val,tmp[0]); } - //xchat_printf(ph, "tmp: \"%s\" -> %i",tmp,tmp[0]); - //xchat_printf(ph,"genre \"%s\"",ret.genre); + //hexchat_printf(ph, "tmp: \"%s\" -> %i",tmp,tmp[0]); + //hexchat_printf(ph,"genre \"%s\"",ret.genre); //if (DEBUG==1) putlog("id3v1 extracted"); return ret; } @@ -214,7 +214,7 @@ char *extractID3Genre(char *tag){ } else{ int i; - //xchat_print(ph, "Using 2 criteria"); + //hexchat_print(ph, "Using 2 criteria"); for (i=0;i<strlen(tag);i++){ if (tag[i]==')'){ tag=&tag[i]+1;return tag;} //return tag; @@ -232,10 +232,10 @@ struct tagInfo readID3V2(char *file){ struct tagInfo ret; f = fopen(file,"rb"); - //xchat_printf(ph,"file :%s",file); + //hexchat_printf(ph,"file :%s",file); if (f==NULL) { - xchat_print(ph,"file not found whilt trying to read ID3V2"); + hexchat_print(ph,"file not found whilt trying to read ID3V2"); //if (DEBUG==1)putlog("file not found while trying to read ID3V2"); return ret; } @@ -250,29 +250,29 @@ struct tagInfo readID3V2(char *file){ header[i]=(char)c; } if (strstr(header,"ID3")==header){ - //xchat_printf(ph,"found id3v2\n"); + //hexchat_printf(ph,"found id3v2\n"); len=0; for (i=6;i<10;i++) len+=(int)header[i]*iPow(256,9-i); //char *tag=(char*)malloc(sizeof(char)*len); tag=(char*) calloc(len,sizeof(char)); //malloc(sizeof(char)*len); for (i=0;i<len;i++){c=fgetc(f);tag[i]=(char)c;} -//xchat_printf(ph,"tag length: %i\n",len); -//xchat_printf(ph,"tag: %s\n",tag); +//hexchat_printf(ph,"tag length: %i\n",len); +//hexchat_printf(ph,"tag: %s\n",tag); fclose(f); ret.comment=tagExtract(tag,len,"COMM"); -//xchat_printf(ph,"Comment: %s\n",ret.comment); +//hexchat_printf(ph,"Comment: %s\n",ret.comment); ret.genre=tagExtract(tag,len,"TCON"); //if (strcmp(ret.genre,"(127)")==0) ret.genre="unknown"; -//xchat_printf(ph, "ret.genre = %s",ret.genre); +//hexchat_printf(ph, "ret.genre = %s",ret.genre); if ((ret.genre!=NULL)&&(ret.genre[0]=='(')) ret.genre=extractID3Genre(ret.genre); -//xchat_printf(ph,"genre: %s\n",ret.genre); +//hexchat_printf(ph,"genre: %s\n",ret.genre); ret.title=tagExtract(tag,len,"TIT2"); -//xchat_printf(ph,"Title: %s\n",ret.title); +//hexchat_printf(ph,"Title: %s\n",ret.title); ret.album=tagExtract(tag,len,"TALB"); -//xchat_printf(ph,"Album: %s\n",ret.album); +//hexchat_printf(ph,"Album: %s\n",ret.album); ret.artist=tagExtract(tag,len,"TPE1"); -//xchat_printf(ph,"Artist: %s\n",ret.artist); +//hexchat_printf(ph,"Artist: %s\n",ret.artist); } else{fclose(f);printf("no id3v2 tag found\n"); return ret;} //printf("id2v2 done\n"); @@ -294,7 +294,7 @@ struct tagInfo readHeader(char *file){ f = fopen(file,"rb"); if (f==NULL) { - xchat_print(ph,"file not found while trying to read mp3 header"); + hexchat_print(ph,"file not found while trying to read mp3 header"); //if (DEBUG==1) putlog("file not found while trying to read mp3 header"); return info; } diff --git a/plugins/mpcinfo/mpcInfo.c b/plugins/mpcinfo/mpcInfo.c index f0909766..be2fe74f 100644 --- a/plugins/mpcinfo/mpcInfo.c +++ b/plugins/mpcinfo/mpcInfo.c @@ -24,7 +24,7 @@ static char *VERSION="0.0.6"; #include <ctype.h> #include <math.h> #include "hexchat-plugin.h" -static xchat_plugin *ph; +static hexchat_plugin *ph; #include "functions.c" #include "mp3Info.c" @@ -46,23 +46,23 @@ static int mpc_tell(char *word[], char *word_eol[], void *userdata){ char *tTitle, *zero, *oggLine, *line; struct tagInfo info; HWND hwnd = FindWindow("MediaPlayerClassicW",NULL); - if (hwnd==0) {xchat_command(ph, randomLine(notRunTheme));return HEXCHAT_EAT_ALL;} + if (hwnd==0) {hexchat_command(ph, randomLine(notRunTheme));return HEXCHAT_EAT_ALL;} tTitle=(char*)malloc(sizeof(char)*1024); GetWindowText(hwnd, tTitle, 1024); zero=strstr(tTitle," - Media Player Classic"); if (zero!=NULL) zero[0]=0; - else xchat_print(ph,"pattern not found"); + else hexchat_print(ph,"pattern not found"); if ((tTitle[1]==':')&&(tTitle[2]=='\\')){ - //xchat_print(ph,"seams to be full path"); + //hexchat_print(ph,"seams to be full path"); if (endsWith(tTitle,".mp3")==1){ - //xchat_print(ph,"seams to be a mp3 file"); + //hexchat_print(ph,"seams to be a mp3 file"); info = readHeader(tTitle); if ((info.artist!=NULL)&&(strcmp(info.artist,"")!=0)){ char *mode=MODES[info.mode]; - //xchat_printf(ph,"mode: %s\n",mode); + //hexchat_printf(ph,"mode: %s\n",mode); char *mp3Line=randomLine(mp3Theme); mp3Line=replace(mp3Line,"%art",info.artist); mp3Line=replace(mp3Line,"%tit",info.title); @@ -82,19 +82,19 @@ static int mpc_tell(char *word[], char *word_eol[], void *userdata){ //mp3Line=intReplace(mp3Line,"%perc",perc); //mp3Line=replace(mp3Line,"%plTitle",title); mp3Line=replace(mp3Line,"%file",tTitle); - xchat_command(ph, mp3Line); + hexchat_command(ph, mp3Line); return HEXCHAT_EAT_ALL; } } if (endsWith(tTitle,".ogg")==1){ - xchat_printf(ph,"Ogg detected\n"); + hexchat_printf(ph,"Ogg detected\n"); info = getOggHeader(tTitle); if (info.artist!=NULL){ char *cbr; if (info.cbr==1) cbr="CBR"; else cbr="VBR"; oggLine=randomLine(oggTheme); //if (cue==1) oggLine=cueLine; - //xchat_printf(ph,"ogg-line: %s\n",oggLine); + //hexchat_printf(ph,"ogg-line: %s\n",oggLine); oggLine=replace(oggLine,"%art",info.artist); oggLine=replace(oggLine,"%tit",info.title); oggLine=replace(oggLine,"%alb",info.album); @@ -111,39 +111,39 @@ static int mpc_tell(char *word[], char *word_eol[], void *userdata){ //oggLine=intReplace(oggLine,"%perc",perc); //oggLine=replace(oggLine,"%plTitle",title); oggLine=replace(oggLine,"%file",tTitle); - xchat_command(ph, oggLine); + hexchat_command(ph, oggLine); return HEXCHAT_EAT_ALL; } } } line=randomLine(titleTheme); line=replace(line,"%title", tTitle); - xchat_command(ph,line); + hexchat_command(ph,line); return HEXCHAT_EAT_ALL; } -int xchat_plugin_init(xchat_plugin *plugin_handle, char **plugin_name, char **plugin_desc, char **plugin_version, char *arg){ +int hexchat_plugin_init(hexchat_plugin *plugin_handle, char **plugin_name, char **plugin_desc, char **plugin_version, char *arg){ ph = plugin_handle; *plugin_name = "mpcInfo"; *plugin_desc = "Information-Script for Media Player Classic"; *plugin_version=VERSION; - xchat_hook_command(ph, "mpc", HEXCHAT_PRI_NORM, mpc_tell,"no help text", 0); - xchat_hook_command(ph, "mpc_themes", HEXCHAT_PRI_NORM, print_themes,"no help text", 0); - xchat_hook_command(ph, "mpc_reloadthemes", HEXCHAT_PRI_NORM, mpc_themeReload,"no help text", 0); - xchat_command (ph, "MENU -ietc\\music.png ADD \"Window/Display Current Song (MPC)\" \"MPC\""); + hexchat_hook_command(ph, "mpc", HEXCHAT_PRI_NORM, mpc_tell,"no help text", 0); + hexchat_hook_command(ph, "mpc_themes", HEXCHAT_PRI_NORM, print_themes,"no help text", 0); + hexchat_hook_command(ph, "mpc_reloadthemes", HEXCHAT_PRI_NORM, mpc_themeReload,"no help text", 0); + hexchat_command (ph, "MENU -ietc\\music.png ADD \"Window/Display Current Song (MPC)\" \"MPC\""); themeInit(); loadThemes(); - xchat_printf(ph, "%s %s plugin loaded\n",*plugin_name, VERSION); + hexchat_printf(ph, "%s %s plugin loaded\n",*plugin_name, VERSION); return 1; } int -xchat_plugin_deinit (void) +hexchat_plugin_deinit (void) { - xchat_command (ph, "MENU DEL \"Window/Display Current Song (MPC)\""); - xchat_print (ph, "mpcInfo plugin unloaded\n"); + hexchat_command (ph, "MENU DEL \"Window/Display Current Song (MPC)\""); + hexchat_print (ph, "mpcInfo plugin unloaded\n"); return 1; } diff --git a/plugins/mpcinfo/mpcinfo.def b/plugins/mpcinfo/mpcinfo.def index 77670bf2..e560f50f 100644 --- a/plugins/mpcinfo/mpcinfo.def +++ b/plugins/mpcinfo/mpcinfo.def @@ -1,3 +1,3 @@ EXPORTS -xchat_plugin_init -xchat_plugin_deinit +hexchat_plugin_init +hexchat_plugin_deinit diff --git a/plugins/mpcinfo/oggInfo.c b/plugins/mpcinfo/oggInfo.c index 83c2beb5..64c9c512 100644 --- a/plugins/mpcinfo/oggInfo.c +++ b/plugins/mpcinfo/oggInfo.c @@ -51,7 +51,7 @@ struct tagInfo getOggHeader(char *file){ info.artist=NULL; f = fopen(file,"rb"); if (f==NULL){ - xchat_print(ph,"file not found while trying to read ogg header"); + hexchat_print(ph,"file not found while trying to read ogg header"); //if (DEBUG==1) putlog("file not found while trying to read ogg header"); return info; } diff --git a/plugins/mpcinfo/theme.c b/plugins/mpcinfo/theme.c index 000c00b1..fc218267 100644 --- a/plugins/mpcinfo/theme.c +++ b/plugins/mpcinfo/theme.c @@ -39,14 +39,14 @@ void themeInit(){ void printTheme(struct theme data){ int i; - for (i=0;i<data.size;i++) xchat_printf(ph,"line[%i]=%s\n",i,data.line[i]); + for (i=0;i<data.size;i++) hexchat_printf(ph,"line[%i]=%s\n",i,data.line[i]); } void printThemes(){ - xchat_printf(ph,"\nNotRun-Theme:\n");printTheme(notRunTheme); - xchat_printf(ph,"\nMP3-Theme:\n");printTheme(mp3Theme); - xchat_printf(ph,"\nOGG-Theme:\n");printTheme(oggTheme); - xchat_printf(ph,"\nTitle-Theme:\n");printTheme(titleTheme); + hexchat_printf(ph,"\nNotRun-Theme:\n");printTheme(notRunTheme); + hexchat_printf(ph,"\nMP3-Theme:\n");printTheme(mp3Theme); + hexchat_printf(ph,"\nOGG-Theme:\n");printTheme(oggTheme); + hexchat_printf(ph,"\nTitle-Theme:\n");printTheme(titleTheme); } void cbFix(char *line){ @@ -85,18 +85,18 @@ struct theme themeAdd(struct theme data, char *info){ void loadThemes(){ char *hDir, *hFile, *line, *val; FILE *f; - xchat_print(ph,"loading themes\n"); + hexchat_print(ph,"loading themes\n"); hDir=(char*)calloc(1024,sizeof(char)); - strcpy(hDir,xchat_get_info(ph,"xchatdirfs")); + strcpy(hDir,hexchat_get_info(ph,"xchatdirfs")); hFile=str3cat(hDir,"\\","mpcInfo.theme.txt"); f = fopen(hFile,"r"); if(f==NULL) { - xchat_print(ph,"no theme in homedir, checking global theme"); + hexchat_print(ph,"no theme in homedir, checking global theme"); f=fopen("mpcInfo.theme.txt","r"); } - //xchat_printf(ph,"file_desc: %p\n",f); - if (f==NULL) xchat_print(ph, "no theme found, using hardcoded\n"); + //hexchat_printf(ph,"file_desc: %p\n",f); + if (f==NULL) hexchat_print(ph, "no theme found, using hardcoded\n"); else { if (f > 0) { @@ -118,7 +118,7 @@ void loadThemes(){ if (strcmp(toUpper(line),"OGG_LINE")==0) mp3Theme=themeAdd(oggTheme,val); } fclose(f); - xchat_print(ph, "theme loaded successfull\n"); + hexchat_print(ph, "theme loaded successfull\n"); } if (notRunTheme.size==0) notRunTheme=themeAdd(notRunTheme,"say Media Player Classic not running"); if (titleTheme.size==0) titleTheme=themeAdd(titleTheme,"say Playing %title in Media Player Classic"); |