diff --git a/doc/icecast2.chm b/doc/icecast2.chm index 10fbf4b2..8f6c635e 100644 Binary files a/doc/icecast2.chm and b/doc/icecast2.chm differ diff --git a/win32/Icecast2winDlg.cpp b/win32/Icecast2winDlg.cpp index 63d6fdc0..5d5c957a 100644 --- a/win32/Icecast2winDlg.cpp +++ b/win32/Icecast2winDlg.cpp @@ -40,7 +40,6 @@ CEdit *g_errorControl; CIcecast2winDlg *g_mainDialog; bool g_tailAccess = false; bool g_tailError = false; -void CollectStats(stats_event_t *event); CString gConfigurationSave; char gTitleSource[1024] = ""; @@ -465,88 +464,64 @@ void CIcecast2winDlg::DisableControl(UINT control) } - -void CollectStats(stats_event_t *event) +void AddUpdateStatistic(int sourceIndex, char *name, char *value) { - Element tempElement; - char tempSource[1024] = ""; - - tempElement.name = ""; - tempElement.value = ""; - - if (event->name != NULL) { - tempElement.name = event->name; - } - if (event->value != NULL) { - tempElement.value = event->value; - } - if (event->source != NULL) { - strcpy(tempSource, event->source); - - } - if (strlen(tempSource) == 0) { - strcpy(tempSource, "Global Stat"); - } - - int foundit = 0; - for (int i=0;iname != NULL) { - if (!strcmp(event->name, "listeners")) { - if (event->value == NULL) { - // source has disconnected... - for (int i=0;istatsTab.m_SourceListCtrl.DeleteAllItems(); - g_mainDialog->statsTab.m_StatsListCtrl.DeleteAllItems(); - break; - } - } - } - } - } - g_mainDialog->UpdateStatsLists(); + int numStats = gStats[sourceIndex].numStats; + /* If we get here, we haven't found the stat, so add it */ + gStats[sourceIndex].stats[numStats].name = name; + gStats[sourceIndex].stats[numStats].value = value; + gStats[sourceIndex].numStats++; } +int GetSourceIndex(char *sourceName) +{ + if (sourceName == NULL) { + return 0; + } + for (int i=1;ixmlChildrenNode; + while (children != NULL) { + if (!strcmp((char *)children->name, "listeners")) { + listenerInd = 1; + } + ls_xmlContentPtr = (char *)xmlNodeListGetString(doc, children->xmlChildrenNode, 1); + AddUpdateStatistic(sourceIndex, (char *)children->name, ls_xmlContentPtr); + xmlFree(ls_xmlContentPtr); + children = children->next; + } + if (!listenerInd) { + /* If no listeners, then the source has been disconnected */ + gStats[sourceIndex].populated = 0; + gStats[sourceIndex].numStats = 0; + g_mainDialog->statsTab.m_SourceListCtrl.DeleteAllItems(); + g_mainDialog->statsTab.m_StatsListCtrl.DeleteAllItems(); + } +} + bool g_collectingStats = false; void StartStats(void *dummy) @@ -560,7 +535,43 @@ void StartStats(void *dummy) gStats[j].numStats = 0; } numMainStats = 0; - stats_callback(CollectStats); + + xmlDocPtr doc; + + stats_get_xml(&doc); + + xmlNodePtr cur; + cur = xmlDocGetRootElement(doc); + + if (cur == NULL) { + MessageBox(NULL, "empty XML document", "Error", MB_OK); + xmlFreeDoc(doc); + return; + } + + cur = cur->xmlChildrenNode; + char* ls_xmlContentPtr2 = NULL; + + while (cur != NULL) { + if ((!xmlStrcmp(cur->name, (const xmlChar *)"source"))) { + ls_xmlContentPtr2 = (char *)xmlGetProp(cur, (unsigned char *)"mount"); + UpdateSourceData(doc, cur, ls_xmlContentPtr2); + } + else { + /* A Global stat */ + ls_xmlContentPtr2 = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); + AddUpdateStatistic(0, (char *)cur->name, ls_xmlContentPtr2); + } + if (ls_xmlContentPtr2) { + xmlFree(ls_xmlContentPtr2); + } + + cur = cur->next; + } + xmlFreeDoc(doc); + xmlCleanupParser(); + g_mainDialog->UpdateStatsLists(); + Sleep(5000); } if (global.running != ICE_RUNNING) { _endthread(); @@ -665,7 +676,7 @@ void CIcecast2winDlg::OnFileStartserver() LoadConfig(); SetTimer(0, 500, NULL); _beginthread(StartServer, 0, (void *)(LPCSTR)myApp->m_configFile); - _beginthread(StartStats, 0, (void *)CollectStats); + _beginthread(StartStats, 0, (void *)NULL); } } @@ -704,7 +715,7 @@ void CIcecast2winDlg::OnStart() else { SetTimer(0, 500, NULL); _beginthread(StartServer, 0, (void *)(LPCSTR)myApp->m_configFile); - _beginthread(StartStats, 0, (void *)CollectStats); + _beginthread(StartStats, 0, (void *)NULL); } } @@ -714,7 +725,57 @@ void CIcecast2winDlg::UpdateStatsLists() char item[1024] = ""; int l = 0; - for (int i=0;iSetTIP((LPSTR)(LPCSTR)windowTitle); + } + } + } + + for (int i=1;iSetTIP((LPSTR)(LPCSTR)windowTitle); - } - - } - } } } } diff --git a/win32/icecast.dsp b/win32/icecast.dsp index f813aeed..d6643adc 100644 --- a/win32/icecast.dsp +++ b/win32/icecast.dsp @@ -41,7 +41,7 @@ RSC=rc.exe # PROP Intermediate_Dir "Releaseicecast" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /I "../../curl/include" /I "..\src" /I "..\src/httpp" /I "..\src/thread" /I "..\src/log" /I "..\src/avl" /I "..\src/net" /I "..\src/timings" /I "../" /I "../../libxslt/include" /I "../../iconv/include" /I "../../libxml2/include" /I "../../pthreads" /I "../../oggvorbis-win32sdk-1.0.1/include" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /D "HAVE_CURL" /D "USE_YP" /D "HAVE_SYS_STAT_H" /D PACKAGE_VERSION=\"2.0-beta-1\" /YX /FD /c +# ADD CPP /nologo /MT /W3 /GX /O2 /I "../../curl/include" /I "..\src" /I "..\src/httpp" /I "..\src/thread" /I "..\src/log" /I "..\src/avl" /I "..\src/net" /I "..\src/timings" /I "../" /I "../../libxslt/include" /I "../../iconv/include" /I "../../libxml2/include" /I "../../pthreads" /I "../../oggvorbis-win32sdk-1.0.1/include" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /D "HAVE_CURL" /D "USE_YP" /D "HAVE_SYS_STAT_H" /YX /FD /D PACKAGE_VERSION=\"2.0-beta-2\" /c # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe @@ -64,7 +64,7 @@ LIB32=link.exe -lib # PROP Intermediate_Dir "Debugicecast" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "../../curl/include" /I "..\src" /I "..\src/httpp" /I "..\src/thread" /I "..\src/log" /I "..\src/avl" /I "..\src/net" /I "..\src/timings" /I "../" /I "../../libxslt/include" /I "../../iconv/include" /I "../../libxml2/include" /I "../../pthreads" /I "../../oggvorbis-win32sdk-1.0.1/include" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /D "_WIN32" /D "HAVE_CURL" /D "USE_YP" /D "HAVE_SYS_STAT_H" /D PACKAGE_VERSION=\"2.0-beta-1\" /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "../../curl/include" /I "..\src" /I "..\src/httpp" /I "..\src/thread" /I "..\src/log" /I "..\src/avl" /I "..\src/net" /I "..\src/timings" /I "../" /I "../../libxslt/include" /I "../../iconv/include" /I "../../libxml2/include" /I "../../pthreads" /I "../../oggvorbis-win32sdk-1.0.1/include" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /D "_WIN32" /D "HAVE_CURL" /D "USE_YP" /D "HAVE_SYS_STAT_H" /FD /D /GZ PACKAGE_VERSION=\"2.0-beta-2\" /c # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" BSC32=bscmake.exe diff --git a/win32/icecast2.iss b/win32/icecast2.iss index b9c0c162..7a2886c6 100644 --- a/win32/icecast2.iss +++ b/win32/icecast2.iss @@ -3,7 +3,7 @@ [Setup] AppName=Icecast2 Win32 -AppVerName=Icecast v2.0 beta 1 +AppVerName=Icecast v2.0 beta 2 AppPublisherURL=http://www.icecast.org AppSupportURL=http://www.icecast.org AppUpdatesURL=http://www.icecast.org @@ -13,7 +13,7 @@ AllowNoIcons=yes LicenseFile=..\COPYING InfoAfterFile=..\README OutputDir=. -OutputBaseFilename=icecast2_win32_2.0_beta1_setup +OutputBaseFilename=icecast2_win32_2.0_beta2_setup WizardImageFile=icecast2logo2.bmp ; uncomment the following line if you want your installation to run on NT 3.51 too. ; MinVersion=4,3.51