From 740352ceabf20e948984df918ed3c5e81f7c9b47 Mon Sep 17 00:00:00 2001 From: Patrick Griffis Date: Fri, 9 Mar 2018 19:08:17 +0000 Subject: [PATCH] Remove mpcinfo plugin The code quality of it is terrible, the user experience of using it is terrible, and it should have been removed years ago --- plugins/mpcinfo/functions.c | 156 ----------- plugins/mpcinfo/mp3Info.c | 334 ------------------------ plugins/mpcinfo/mpcInfo.c | 160 ------------ plugins/mpcinfo/mpcinfo.def | 3 - plugins/mpcinfo/mpcinfo.vcxproj | 59 ----- plugins/mpcinfo/mpcinfo.vcxproj.filters | 23 -- plugins/mpcinfo/oggInfo.c | 124 --------- plugins/mpcinfo/theme.c | 148 ----------- src/common/plugin.c | 1 - win32/hexchat.sln | 11 - win32/installer/hexchat.iss.tt | 4 +- 11 files changed, 1 insertion(+), 1022 deletions(-) delete mode 100644 plugins/mpcinfo/functions.c delete mode 100644 plugins/mpcinfo/mp3Info.c delete mode 100644 plugins/mpcinfo/mpcInfo.c delete mode 100644 plugins/mpcinfo/mpcinfo.def delete mode 100644 plugins/mpcinfo/mpcinfo.vcxproj delete mode 100644 plugins/mpcinfo/mpcinfo.vcxproj.filters delete mode 100644 plugins/mpcinfo/oggInfo.c delete mode 100644 plugins/mpcinfo/theme.c diff --git a/plugins/mpcinfo/functions.c b/plugins/mpcinfo/functions.c deleted file mode 100644 index e5993948..00000000 --- a/plugins/mpcinfo/functions.c +++ /dev/null @@ -1,156 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#include - -char *split(char *text, char separator) -{ - int pos = -1; - size_t i; - for (i = 0; i < strlen(text); i++) - { - if (text[i] == separator) { - pos = i; - i = strlen(text) + 1; - } - } - - if (pos == -1) - { - return text; - } - - text[pos] = 0; - return &(text[pos + 1]); -} - -int endsWith(char *text, char *suffix){ - char *tmp=strstr(text,suffix); - if (tmp==NULL) return 0; - if (strlen(tmp)==strlen(suffix)) return 1; - return 0; -} - -int inStr(char *s1, size_t sl1, char *s2) -{ - size_t i; - for (i = 0; i < sl1 - strlen(s2); i++) - { - size_t j; - for (j = 0; j < strlen(s2); j++) - { - if (s1[i + j] != s2[j]) - { - j = strlen(s2) + 2; - } - } - - if (j == strlen(s2)) - { - return i; - } - } - - return -1; -} - -static char *subString(char *text, int first, int length, int spcKill){ -//if (DEBUG==1) putlog("creating substring"); - char *ret = g_new (char, length + 1); - int i; - ret[length]=0; - for (i=0;i=0;i--){ - if (ret[i]==32) ret[i]=0; - else i=-1; - } - } - //if (DEBUG==1) putlog("substring created"); - return ret; -} - -static char *substring(char *text, int first, int length){return subString(text,first,length,0);} - - -char *readLine(FILE *f){ - //if (DEBUG==1) putlog("reading line from file"); - char *buffer = g_new (char, 1024); - int pos=0; - int cc=0; - while((cc!=EOF)&&(pos<1024)&&(cc!=10)){ - cc=fgetc(f); - if ((cc!=10)&&(cc!=13)){ - if (cc==EOF) buffer[pos]=0; - else buffer[pos]=(char)cc;pos++; - } - } - if (buffer[pos]==EOF) hexchat_printf(ph,"EOF: %i\n",pos); - return buffer; -} - -char *toUpper(char *text) -{ - char *ret = (char*) calloc(strlen(text) + 1, sizeof(char)); - - size_t i; - for (i = 0; i < strlen(text); i++) - { - ret[i] = toupper(text[i]); - } - - ret[strlen(text)] = 0; - - return ret; -} - -static char *str3cat(char *s1, char *s2, char *s3){ - //if (DEBUG==1) putlog("cating 3 strings"); - char *ret=(char*)calloc(strlen(s1)+strlen(s2)+strlen(s3)+1,sizeof(char)); - strcpy(ret,s1);strcat(ret,s2);strcat(ret,s3); - ret[strlen(s1)+strlen(s2)+strlen(s3)]=0; - //if (DEBUG==1) putlog("strings cated"); - return ret; -} - -char *replace(char *text, char *from, char *to){ - //if (DEBUG==1) putlog("replacing"); - char *ret=(char*)calloc( strlen(text)+(strlen(to)-strlen(from)),sizeof(char)); - char *left; - char *right; - int pos=inStr(text,strlen(text),from); - if (pos!=-1){ - left=substring(text,0,pos); - right=substring(text,pos+strlen(from),strlen(text)-(pos+strlen(from))); - ret=str3cat(left,to,right); - return replace(ret,from,to); - } - //if (DEBUG==1) putlog("replaced"); - return text; -} - -char *intReplaceF(char *text, char *from, int to, char *form){ - //if (DEBUG==1) putlog("replaceF"); - char *buffer=(char*) calloc(16,sizeof(char)); - sprintf(buffer,form,to); - //if (DEBUG==1) putlog("replaceF done"); - return replace(text,from,buffer); -} - -char *intReplace(char *text, char *from, int to){return intReplaceF(text,from,to,"%i");} diff --git a/plugins/mpcinfo/mp3Info.c b/plugins/mpcinfo/mp3Info.c deleted file mode 100644 index 240b07a6..00000000 --- a/plugins/mpcinfo/mp3Info.c +++ /dev/null @@ -1,334 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - */ - -//#include -#include -//#include "functions.c" - -struct tagInfo{ - int mode; - int cbr; - int bitrate; - unsigned int freq; - char *artist; - char *title; - char *album; - char *comment; - char *genre; - //int genre; - //int track; -}; - -static int RATES[2][3][15]={ - {//mpeg2 - {-1,8,16,24,32,64,80,56,64,128,160,112,128,256,320},//layer3 (V2) - {-1,32,48,56,64,80,96,112,128,160,192,224,256,320,384},//layer2 (V2) - {-1,32,64,96,128,160,192,224,256,288,320,352,384,416,448},//layer1 (V2) - }, - {//mpeg1 - {-1,32,40,48,56,64,80,96,112,128,160,192,224,256,320},//layer3 (V1) - {-1,32,48,56,64,80,96,112,128,160,192,224,256,320,384},//layer2 (V1) - {-1,32,64,96,128,160,192,224,256,288,320,352,384,416,448},//layer1 (V1) - }}; -static int FREQS[2][4]={{22050,24000,16000,-1},{44100,48000,32000,-1}}; -//static double FRATES[]={38.5,32.5,27.8,0.0}; - -static char GENRES[][50]={"Blues","Classic Rock","Country","Dance","Disco","Funk","Grunge","Hip-Hop","Jazz","Metal", -"New Age","Oldies","Other","Pop","R&B","Rap","Reggae","Rock","Techno","Industrial", -"Alternative","Ska","Death Metal","Pranks","Soundtrack","Euro-Techno","Ambient","Trip-Hop","Vocal","Jazz+Funk", -"Fusion","Trance","Classical","Instrumental","Acid","House","Game","Sound Clip","Gospel","Noise", -"AlternRock","Bass","Soul","Punk","Space","Meditative","Instrumental Pop","Instrumental Rock","Ethnic","Gothic", -"Darkwave","Techno-Industrial","Electronic","Pop-Folk","Eurodance","Dream","Southern Rock","Comedy","Cult","Gangsta", -"Top 40","Christian Rap","Pop/Funk","Jungle","Native American","Cabaret","New Wave","Psychadelic","Rave","Showtunes", -"Trailer","Lo-Fi","Tribal","Acid Punk","Acid Jazz","Polka","Retro","Musical","Rock & Roll","Hard Rock", - -//################## END OF OFFICIAL ID3 TAGS, WINAMP TAGS BELOW ######################################## - -"Folk","Folk/Rock","National Folk","Swing","Fast Fusion","Bebob","Latin","Revival","Celtic","Bluegrass", -"Avantgarde","Gothic Rock","Progressive Rock","Psychedelic Rock","Symphonic Rock","Slow Rock","Big Band","Chorus","Easy Listening","Acoustic", -"Humour","Speech","Chanson","Opera","Chamber Music","Sonata","Symphony","Booty Bass","Primus","Porn Groove", -"Satire","Slow Jam","Club","Tango","Samba","Folklore","Ballad","Poweer Ballad","Rhytmic Soul","Freestyle", -"Duet","Punk Rock","Drum Solo","A Capela","Euro-House","Dance Hall", - -//################## FOUND AT http://en.wikipedia.org/wiki/ID3 ########################################### - -"Goa","Drum & Bass","Club-House","Hardcore", -"Terror","Indie","BritPop","Negerpunk","Polsk Punk","Beat","Christian Gangsta Rap","Heavy Metal","Black Metal","Crossover", -"Contemporary Christian","Christian Rock","Merengue","Salsa","Thrash Metal","Anime","JPop","Synthpop" - -}; - -static char MODES [][13]={"Stereo","Joint-Stereo","Dual-Channel","Mono"}; - -int iPow(int x, int y){return (int)(pow((double)x,(double) y));} - -int str2int(char *text) -{ - int ret = 0; - - size_t i; - for (i = 1; i <= strlen(text); i++) - { - if ((text[strlen(text) - i] > 57) || (text[strlen(text) - i] < 48)) - { - hexchat_printf(ph, "invalid char in string: %i", (int) text[strlen(text) - i]); - return 255; - } - - ret += ((int) text[strlen(text) - i] - 48)*iPow(10, i - 1); - } - - return ret; -} - -static char *tagExtract(char *tag, int tagLen, char* info){ -//if (DEBUG==1) putlog("extracting tag"); - int pos, len, i; - pos=inStr(tag,tagLen,info); -//hexchat_printf(ph,"pos=%i",pos); - if (pos==-1) return "";//NULL; - //printf("position of %s = %i\n",info,pos); - len=0; - //for (i=pos;i=0)) - ret.genre=GENRES[val];//#############changed - else { - ret.genre="unknown"; - //hexchat_printf(ph, "tmp[0]=%i (%i)",val,tmp[0]); - } - //hexchat_printf(ph, "tmp: \"%s\" -> %i",tmp,tmp[0]); - //hexchat_printf(ph,"genre \"%s\"",ret.genre); - //if (DEBUG==1) putlog("id3v1 extracted"); - free(tmp); - free(tag); - return ret; -} - -char *extractID3Genre(char *tag) -{ - if (tag[strlen(tag) - 1] == ')') - { - tag[strlen(tag) - 1] = 0; - tag = &tag[1]; - return GENRES[str2int(tag)]; - } - else - { - size_t i; - for (i = 0; i < strlen(tag); i++) - { - if (tag[i] == ')') - { - tag = &tag[i] + 1; - return tag; - } - } - } - - return "[152] failed"; -} - -struct tagInfo readID3V2(char *file){ -//if (DEBUG==1) putlog("reading id3v2"); - FILE *f; - int i, c, len; - char header[10]; - char *tag; - struct tagInfo ret; - - f = fopen(file,"rb"); - //hexchat_printf(ph,"file :%s",file); - if (f==NULL) - { - 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; - } - - ret.artist=NULL; - for (i=0;i<10;i++){ - c=fgetc(f); - if (c==EOF){ - fclose(f); - //putlog("found eof while reading id3v2"); - return ret; - } - header[i]=(char)c; - } - if (strstr(header,"ID3")==header){ - //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>3; - layerB=(header[1]&6)>>1; - bitrateB=(header[2]&240)>>4; //4 - freqB=(header[2]&12)>>2;//2 - modeB=(header[3]&192)>>6;//6 - //printf("Mpeg: %i\nLayer: %i\nBitrate: %i\nFreq: %i\nMode: %i\n",versionB, layerB, bitrateB, freqB, modeB); - //int Bitrate=RATES[versionB][layerB-1][bitrateB]; - //int Freq=FREQS[versionB][freqB]; - info.bitrate=RATES[versionB][layerB-1][bitrateB]; - info.freq=FREQS[versionB][freqB]; - info.mode=modeB; - } - fclose(f); - //if (DEBUG==1) putlog("header readed"); - return info; -} -/* -static void printMp3Info(char *file){ - //printf("\nScanning Mp3-File for Informations: %s\n",file); - //printf("size:\t%10d byte\n",getSize(file)); - struct tagInfo info =readHeader(file); - printf("%s | %10d",file,getSize(file)); - if (info.bitrate>0){ - //printf("Bitrate: %i\nFreq: %i\nMode: %s\n",info.bitrate,info.freq,MODES[info.mode]); - printf(" | %i kbps | %i kHz | %s",info.bitrate,info.freq,MODES[info.mode]); - //if (info.artist!=NULL) printf("\nArtist: %s\nTitle: %s\nAlbum: %s\nComment: %s\nGenre: %s\n",info.artist,info.title,info.album,info.comment,info.genre); - if (info.artist!=NULL) { - printf("| %s | %s | %s | %s | %s",info.artist,info.title,info.album,info.comment,info.genre); - //printf("| %s ",info.title);//,info.title,info.album,info.comment,info.genre - } - } - printf("\n"); - -} -*/ diff --git a/plugins/mpcinfo/mpcInfo.c b/plugins/mpcinfo/mpcInfo.c deleted file mode 100644 index 4ad17689..00000000 --- a/plugins/mpcinfo/mpcInfo.c +++ /dev/null @@ -1,160 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - */ - -//static int DEBUG=0; -static char *VERSION="0.0.6"; - -#include -#include -#include -#include -#include -#include -#include "hexchat-plugin.h" -static hexchat_plugin *ph; - -#include "functions.c" -#include "mp3Info.c" -#include "oggInfo.c" -#include "theme.c" - -static int print_themes (char *word[], char *word_eol[], void *userdata){ - printThemes(); - return HEXCHAT_EAT_ALL; -} - -static int mpc_themeReload(char *word[], char *word_eol[], void *userdata){ - themeInit(); - loadThemes(); - return HEXCHAT_EAT_ALL; -} - -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) {hexchat_print(ph, randomLine(notRunTheme));return HEXCHAT_EAT_ALL;} - - tTitle = g_new(char, 1024); - GetWindowText(hwnd, tTitle, 1024); - zero = strstr (tTitle, " - Media Player Classic"); - if (zero != NULL) - { - zero[0] = 0; - } - else - { - g_free(tTitle); - hexchat_print(ph, "pattern not found"); - return HEXCHAT_EAT_ALL; - } - - if ((tTitle[1]==':')&&(tTitle[2]=='\\')){ - //hexchat_print(ph,"seams to be full path"); - if (endsWith(tTitle,".mp3")==1){ - //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]; - //hexchat_printf(ph,"mode: %s\n",mode); - char *mp3Line=randomLine(mp3Theme); - mp3Line=replace(mp3Line,"%art",info.artist); - mp3Line=replace(mp3Line,"%tit",info.title); - mp3Line=replace(mp3Line,"%alb",info.album); - mp3Line=replace(mp3Line,"%com",info.comment); - mp3Line=replace(mp3Line,"%gen",info.genre); - //mp3Line=replace(mp3Line,"%time",pos); - //mp3Line=replace(mp3Line,"%length",len); - //mp3Line=replace(mp3Line,"%ver",waVers); - //mp3Line=intReplace(mp3Line,"%br",br); - //mp3Line=intReplace(mp3Line,"%frq",frq); - - mp3Line=intReplace(mp3Line,"%br",info.bitrate); - mp3Line=intReplace(mp3Line,"%frq",info.freq); - mp3Line=replace(mp3Line,"%mode",mode); - //mp3Line=replace(mp3Line,"%size",size); - //mp3Line=intReplace(mp3Line,"%perc",perc); - //mp3Line=replace(mp3Line,"%plTitle",title); - mp3Line=replace(mp3Line,"%file",tTitle); - g_free(tTitle); - hexchat_command(ph, mp3Line); - return HEXCHAT_EAT_ALL; - } - } - if (endsWith(tTitle,".ogg")==1){ - 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; - //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); - oggLine=replace(oggLine,"%com",info.comment); - oggLine=replace(oggLine,"%gen",info.genre); - //oggLine=replace(oggLine,"%time",pos); - //oggLine=replace(oggLine,"%length",len); - //oggLine=replace(oggLine,"%ver",waVers); - oggLine=intReplace(oggLine,"%chan",info.mode); - oggLine=replace(oggLine,"%cbr",cbr); - oggLine=intReplace(oggLine,"%br",info.bitrate/1000);//br); - oggLine=intReplace(oggLine,"%frq",info.freq); - //oggLine=replace(oggLine,"%size",size); - //oggLine=intReplace(oggLine,"%perc",perc); - //oggLine=replace(oggLine,"%plTitle",title); - oggLine=replace(oggLine,"%file",tTitle); - g_free(tTitle); - hexchat_command(ph, oggLine); - return HEXCHAT_EAT_ALL; - } - } - } - line=randomLine(titleTheme); - line=replace(line,"%title", tTitle); - g_free(tTitle); - hexchat_command(ph, line); - return HEXCHAT_EAT_ALL; -} - -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; - - 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 -ishare\\music.png ADD \"Window/Display Current Song (MPC)\" \"MPC\""); - - themeInit(); - loadThemes(); - hexchat_printf(ph, "%s plugin loaded\n", *plugin_name); - - return 1; -} - -int -hexchat_plugin_deinit (void) -{ - 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 deleted file mode 100644 index e560f50f..00000000 --- a/plugins/mpcinfo/mpcinfo.def +++ /dev/null @@ -1,3 +0,0 @@ -EXPORTS -hexchat_plugin_init -hexchat_plugin_deinit diff --git a/plugins/mpcinfo/mpcinfo.vcxproj b/plugins/mpcinfo/mpcinfo.vcxproj deleted file mode 100644 index 236cb572..00000000 --- a/plugins/mpcinfo/mpcinfo.vcxproj +++ /dev/null @@ -1,59 +0,0 @@ - - - - v140 - DynamicLibrary - - - - Release - Win32 - - - Release - x64 - - - - {B0E36D93-CA2A-49FE-9EB9-9C96C6016EEC} - Win32Proj - mpcinfo - - - - - - - hcmpcinfo - $(HexChatRel)plugins\ - - - - WIN32;NDEBUG;_WINDOWS;_USRDLL;MPCINFO_EXPORTS;%(PreprocessorDefinitions) - ..\..\src\common;$(Glib);%(AdditionalIncludeDirectories) - - - $(DepsRoot)\lib;%(AdditionalLibraryDirectories) - $(DepLibs);%(AdditionalDependencies) - mpcinfo.def - - - - - WIN32;_WIN64;_AMD64_;NDEBUG;_WINDOWS;_USRDLL;MPCINFO_EXPORTS;%(PreprocessorDefinitions) - ..\..\src\common;$(Glib);%(AdditionalIncludeDirectories) - - - $(DepsRoot)\lib;%(AdditionalLibraryDirectories) - $(DepLibs);%(AdditionalDependencies) - mpcinfo.def - - - - - - - - - - diff --git a/plugins/mpcinfo/mpcinfo.vcxproj.filters b/plugins/mpcinfo/mpcinfo.vcxproj.filters deleted file mode 100644 index 7e22eb30..00000000 --- a/plugins/mpcinfo/mpcinfo.vcxproj.filters +++ /dev/null @@ -1,23 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - Resource Files - - - - - Source Files - - - \ No newline at end of file diff --git a/plugins/mpcinfo/oggInfo.c b/plugins/mpcinfo/oggInfo.c deleted file mode 100644 index 777d2106..00000000 --- a/plugins/mpcinfo/oggInfo.c +++ /dev/null @@ -1,124 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - */ - -static int getOggInt(char *buff, int beg, int bytes){ -//if (DEBUG==1) putlog("getOggInt"); - int ret=0; - int i; - for (i=0;i=0) ret+=buff[i+beg]*iPow(256,i);else ret+=(256+buff[i+beg])*iPow(256,i); - //printf("[%i]=%i\n",i,buff[i+beg]); - } - return ret; -} - -static char *upperStr(char *text) -{ - char *ret = (char*) malloc(sizeof(char)*(strlen(text) + 1)); - - size_t i; - for (i = 0; i < strlen(text); i++) - { - ret[i] = toupper(text[i]); - } - - ret[strlen(text)] = 0; - - return ret; -} - -struct tagInfo getOggHeader(char *file){ -//if (DEBUG==1) putlog("reading ogg header"); - char header[4096]; - int i, c; - int h1pos, h3pos, maxBr, nomBr, minBr, pos, count, tagLen; - char *sub; - char *name; - char *val; - char HEADLOC1[]="_vorbis", HEADLOC3[]="_vorbis", HEADLOC5[]="_vorbis"; - FILE *f; - struct tagInfo info; - - info.artist=NULL; - f = fopen(file,"rb"); - if (f==NULL){ - 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; - } - - for (i=0;i<4095;i++) {c=fgetc(f);header[i]=(char)c;} - fclose(f); - HEADLOC1[0]=1; - HEADLOC3[0]=3; - HEADLOC5[0]=5; - h1pos=inStr(header,4096,HEADLOC1); - h3pos=inStr(header,4096,HEADLOC3); - //int h5pos=inStr(header,4096,HEADLOC5); //not needed - - //printf("loc1: %i\n",h1pos);printf("loc3: %i\n",h3pos);printf("loc5: %i\n",h5pos); - maxBr=getOggInt(header,h1pos+7+9,4); - nomBr=getOggInt(header,h1pos+7+13,4); - minBr=getOggInt(header,h1pos+7+17,4); - info.freq=getOggInt(header,h1pos+7+5,4); - info.mode=header[h1pos+7+4]; - info.bitrate=nomBr; - if (((maxBr==nomBr)&&(nomBr=minBr))||((minBr==0)&&(maxBr==0))||((minBr=-1)&&(maxBr=-1)) )info.cbr=1;else info.cbr=0; - printf("bitrates: %i|%i|%i\n",maxBr,nomBr,minBr); - printf("freq: %u\n",info.freq); - pos=h3pos+7; - pos+=getOggInt(header,pos,4)+4; - count=getOggInt(header,pos,4); - //printf("tags: %i\n",count); - pos+=4; - - info.artist=NULL;info.title=NULL;info.album=NULL;info.comment=NULL;info.genre=NULL; - for (i=0;i - -struct theme{ - int size; - char **line; -}; - -static struct theme notRunTheme; -static struct theme titleTheme; -static struct theme mp3Theme; -static struct theme oggTheme; - - -void themeInit(){ - //if (DEBUG==1) putlog("init theme"); - /*mp3Theme.size=0;oggTheme.size=0;cueTheme.size=0;streamTheme.size=0;etcTheme.size=0; - stopTheme.size=0;pauseTheme.size=0;*/ - - notRunTheme.size=0;titleTheme.size=0; - srand((unsigned int)time((time_t *)NULL)); - //if (DEBUG==1) putlog("theme init done"); -} - -void printTheme(struct theme data){ - int i; - for (i=0;i 0) - { - line=" "; - } else - { - line="\0"; - } - - while (line[0]!=0) - { - line=readLine(f); - val=split(line,'='); - printf("line: %s\n",line); - printf("val: %s\n",val); - lineCap=toUpper(line); - if (strcmp(lineCap,"OFF_LINE")==0) notRunTheme=themeAdd(notRunTheme,val); - if (strcmp(lineCap,"TITLE_LINE")==0) titleTheme=themeAdd(titleTheme,val); - if (strcmp(lineCap,"MP3_LINE")==0) mp3Theme=themeAdd(mp3Theme,val); - if (strcmp(lineCap,"OGG_LINE")==0) mp3Theme=themeAdd(oggTheme,val); - free(lineCap); - } - fclose(f); - hexchat_print(ph, "theme loaded successfull\n"); - } - if (notRunTheme.size==0) notRunTheme=themeAdd(notRunTheme,"Media Player Classic not running"); - if (titleTheme.size==0) titleTheme=themeAdd(titleTheme,"say Playing %title in Media Player Classic"); - if (mp3Theme.size==0) mp3Theme=themeAdd(mp3Theme,"me listens to %art with %tit from %alb [%gen|%br kbps|%frq kHz|%mode] in Media Player Classic "); - if (oggTheme.size==0) oggTheme=themeAdd(oggTheme,"me listens to %art with %tit from %alb [%gen|%br kbps|%frq kHz|%chan channels] in Media Player Classic "); - //mp3Theme=themeAdd(mp3Theme,"me listens to %art with %tit from %alb [%time|%length|%perc%|%br kbps|%frq kHz|%mode] in Media Player Classic "); -} - -int rnd(int max){ - return rand()%max; -} - -char *randomLine(struct theme data){ - return data.line[rnd(data.size)]; -} diff --git a/src/common/plugin.c b/src/common/plugin.c index ea174bed..b99c4403 100644 --- a/src/common/plugin.c +++ b/src/common/plugin.c @@ -457,7 +457,6 @@ plugin_auto_load (session *sess) for_files (lib_dir, "hcexec.dll", plugin_auto_load_cb); for_files (lib_dir, "hcfishlim.dll", plugin_auto_load_cb); for_files(lib_dir, "hclua.dll", plugin_auto_load_cb); - for_files (lib_dir, "hcmpcinfo.dll", plugin_auto_load_cb); for_files (lib_dir, "hcperl.dll", plugin_auto_load_cb); for_files (lib_dir, "hcpython2.dll", plugin_auto_load_cb); for_files (lib_dir, "hcpython3.dll", plugin_auto_load_cb); diff --git a/win32/hexchat.sln b/win32/hexchat.sln index b567203d..8759c59b 100644 --- a/win32/hexchat.sln +++ b/win32/hexchat.sln @@ -41,11 +41,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fishlim", "..\plugins\fishl {87554B59-006C-4D94-9714-897B27067BA3} = {87554B59-006C-4D94-9714-897B27067BA3} EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mpcinfo", "..\plugins\mpcinfo\mpcinfo.vcxproj", "{B0E36D93-CA2A-49FE-9EB9-9C96C6016EEC}" - ProjectSection(ProjectDependencies) = postProject - {87554B59-006C-4D94-9714-897B27067BA3} = {87554B59-006C-4D94-9714-897B27067BA3} - EndProjectSection -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "upd", "..\plugins\upd\upd.vcxproj", "{461DC24A-A410-4171-8C02-CCDBF3702C2A}" ProjectSection(ProjectDependencies) = postProject {87554B59-006C-4D94-9714-897B27067BA3} = {87554B59-006C-4D94-9714-897B27067BA3} @@ -86,7 +81,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "installer", "installer\inst {E93E1255-95D1-4B08-8FDF-B53CC6A21280} = {E93E1255-95D1-4B08-8FDF-B53CC6A21280} {5EF7F47D-D09C-43C4-BF64-B28B11A0FF91} = {5EF7F47D-D09C-43C4-BF64-B28B11A0FF91} {6C0CA980-97C5-427A-BE61-5BCECAFABBDA} = {6C0CA980-97C5-427A-BE61-5BCECAFABBDA} - {B0E36D93-CA2A-49FE-9EB9-9C96C6016EEC} = {B0E36D93-CA2A-49FE-9EB9-9C96C6016EEC} {E78C0D9A-798E-4BF6-B0CC-6FECB8CA2FCE} = {E78C0D9A-798E-4BF6-B0CC-6FECB8CA2FCE} {E4BDB4C8-2335-415A-ACEE-BA88B19BFE82} = {E4BDB4C8-2335-415A-ACEE-BA88B19BFE82} {DE87FFCA-9606-4116-B747-062D88A56A28} = {DE87FFCA-9606-4116-B747-062D88A56A28} @@ -156,10 +150,6 @@ Global {3C4F42FC-292A-420B-B63D-C03DFBDD8E4E}.Release|Win32.Build.0 = Release|Win32 {3C4F42FC-292A-420B-B63D-C03DFBDD8E4E}.Release|x64.ActiveCfg = Release|x64 {3C4F42FC-292A-420B-B63D-C03DFBDD8E4E}.Release|x64.Build.0 = Release|x64 - {B0E36D93-CA2A-49FE-9EB9-9C96C6016EEC}.Release|Win32.ActiveCfg = Release|Win32 - {B0E36D93-CA2A-49FE-9EB9-9C96C6016EEC}.Release|Win32.Build.0 = Release|Win32 - {B0E36D93-CA2A-49FE-9EB9-9C96C6016EEC}.Release|x64.ActiveCfg = Release|x64 - {B0E36D93-CA2A-49FE-9EB9-9C96C6016EEC}.Release|x64.Build.0 = Release|x64 {461DC24A-A410-4171-8C02-CCDBF3702C2A}.Release|Win32.ActiveCfg = Release|Win32 {461DC24A-A410-4171-8C02-CCDBF3702C2A}.Release|Win32.Build.0 = Release|Win32 {461DC24A-A410-4171-8C02-CCDBF3702C2A}.Release|x64.ActiveCfg = Release|x64 @@ -220,7 +210,6 @@ Global {5EF7F47D-D09C-43C4-BF64-B28B11A0FF91} = {561126F4-FA18-45FC-A2BF-8F858F161D6D} {17E4BE39-76F7-4A06-AD21-EFD0C5091F76} = {561126F4-FA18-45FC-A2BF-8F858F161D6D} {3C4F42FC-292A-420B-B63D-C03DFBDD8E4E} = {561126F4-FA18-45FC-A2BF-8F858F161D6D} - {B0E36D93-CA2A-49FE-9EB9-9C96C6016EEC} = {561126F4-FA18-45FC-A2BF-8F858F161D6D} {461DC24A-A410-4171-8C02-CCDBF3702C2A} = {561126F4-FA18-45FC-A2BF-8F858F161D6D} {E78C0D9A-798E-4BF6-B0CC-6FECB8CA2FCE} = {561126F4-FA18-45FC-A2BF-8F858F161D6D} {6C0CA980-97C5-427A-BE61-5BCECAFABBDA} = {561126F4-FA18-45FC-A2BF-8F858F161D6D} diff --git a/win32/installer/hexchat.iss.tt b/win32/installer/hexchat.iss.tt index a9a03dd4..a7cebb6c 100644 --- a/win32/installer/hexchat.iss.tt +++ b/win32/installer/hexchat.iss.tt @@ -66,7 +66,6 @@ Name: "plugins"; Description: "Plugins"; Types: custom; Flags: disablenouninstal Name: "plugins\checksum"; Description: "Checksum"; Types: custom; Flags: disablenouninstallwarning Name: "plugins\exec"; Description: "Exec"; Types: custom; Flags: disablenouninstallwarning Name: "plugins\fishlim"; Description: "FiSHLiM"; Types: custom; Flags: disablenouninstallwarning -Name: "plugins\mpcinfo"; Description: "mpcInfo"; Types: custom; Flags: disablenouninstallwarning Name: "plugins\sysinfo"; Description: "SysInfo"; Types: custom; Flags: disablenouninstallwarning Name: "plugins\upd"; Description: "Update Checker"; Types: normal custom; Flags: disablenouninstallwarning Name: "plugins\winamp"; Description: "Winamp"; Types: custom; Flags: disablenouninstallwarning @@ -167,8 +166,7 @@ Source: "share\lua\lgi\override\*.lua"; DestDir: "{app}\share\lua\lgi\override"; Source: "plugins\hcchecksum.dll"; DestDir: "{app}\plugins"; Flags: ignoreversion; Components: plugins\checksum Source: "plugins\hcexec.dll"; DestDir: "{app}\plugins"; Flags: ignoreversion; Components: plugins\exec Source: "plugins\hcfishlim.dll"; DestDir: "{app}\plugins"; Flags: ignoreversion; Components: plugins\fishlim -Source: "share\music.png"; DestDir: "{app}\share"; Flags: ignoreversion; Components: plugins\winamp or plugins\mpcinfo -Source: "plugins\hcmpcinfo.dll"; DestDir: "{app}\plugins"; Flags: ignoreversion; Components: plugins\mpcinfo +Source: "share\music.png"; DestDir: "{app}\share"; Flags: ignoreversion; Components: plugins\winamp Source: "share\download.png"; DestDir: "{app}\share"; Flags: ignoreversion; Components: plugins\upd Source: "plugins\hcupd.dll"; DestDir: "{app}\plugins"; Flags: ignoreversion; Components: plugins\upd Source: "WinSparkle.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: plugins\upd