Пример #1
0
LRESULT CALLBACK HookWinampWnd(HWND hwnd, UINT umsg, WPARAM wp, LPARAM lp)
{
	FILE * outFile;
	static char* filename;
	char *returnVal = NULL;
	static char oldfilename[255];
	int currTime;

	if(lp == IPC_CB_MISC && wp == IPC_CB_MISC_STATUS)
	{
		currTime = SendMessage(hwnd,WM_WA_IPC,0,IPC_GETOUTPUTTIME);
		if(SendMessage(hwnd,WM_WA_IPC,0,IPC_ISPLAYING) == 1 && currTime == 0)
		{
			filename = (char*)SendMessage(hwnd,WM_WA_IPC,SendMessage(hwnd,WM_WA_IPC,0,IPC_GETLISTPOS),IPC_GETPLAYLISTFILE);
			// only output if a valid file was found
			if(filename && strcmp(filename,oldfilename))
			{
				strcpy(oldfilename,filename);
			//	MessageBox(hwnd,file,"starting",0);

				outFile = fopen("c:\\zonica.txt","at");

				fprintf(outFile,"\nCurrently Playing song: %s\n\n", filename);
				fprintf(outFile,"Artist: %s\n", GetMetaInfo("Artist", returnVal, hwnd));
				fprintf(outFile,"Title: %s\n", GetMetaInfo("Title", returnVal, hwnd));
				fprintf(outFile,"Album: %s\n", GetMetaInfo("Album", returnVal, hwnd));
				fprintf(outFile,"Year: %s\n", GetMetaInfo("Year", returnVal, hwnd));

				fclose(outFile);

				sendData("127.0.0.1",4242,filename);

				// or do something else that you need to do
			}
		}
	}

	return CallWindowProc(WinampProc, hwnd, umsg, wp, lp);
}
Пример #2
0
int main(int argc, char* argv[])
{
	char *returnVal;
	char *returnValOld;
	char outFileName[255];
	FILE *outFile;
	int length;

	returnVal = (char *)malloc(MAX_PATH*sizeof(char));
	returnValOld = (char *)malloc(MAX_PATH*sizeof(char));

	strcpy(outFileName,"zonicaOut.txt");

	hwndWinamp = FindWindowA("Winamp v1.x",NULL);
	if(hwndWinamp == NULL)
	{
		printf("Winamp not running.\n");
		return 0;
	}

	while(1)
	{
		ReadWinampToLocal((char *)SendMessage(hwndWinamp, WM_WA_IPC, GetPlayingTrack(), IPC_GETPLAYLISTFILE), returnVal, MAX_PATH);

		if(strcmp(returnVal,returnValOld)) //if track has changed
		{
			strcpy(returnValOld,returnVal);

			

			
			printf("\nCurrently Playing song: %s\n\n", returnVal);
			printf("Artist: %s\n", GetMetaInfo("Artist", returnVal));
			printf("Title: %s\n", GetMetaInfo("Title", returnVal));
			printf("Album: %s\n", GetMetaInfo("Album", returnVal));
			printf("Year: %s\n", GetMetaInfo("Year", returnVal));
			printf("Bitrate: %s kbps\n", GetMetaInfo("Bitrate", returnVal));
			outFile = fopen(outFileName,"at");

			fprintf(outFile,"\nCurrently Playing song: %s\n\n", returnVal);
			fprintf(outFile,"Artist: %s\n", GetMetaInfo("Artist", returnVal));
			fprintf(outFile,"Title: %s\n", GetMetaInfo("Title", returnVal));
			fprintf(outFile,"Album: %s\n", GetMetaInfo("Album", returnVal));
			fprintf(outFile,"Year: %s\n", GetMetaInfo("Year", returnVal));
			fprintf(outFile,"Bitrate: %s kbps\n", GetMetaInfo("Bitrate", returnVal));

			fclose(outFile);

			// in milliseconds
			length = atoi(GetMetaInfo("Length", returnVal));
			printf("Length: %d:%02d\n", length/(1000*60), (length/1000)%60);

			//free(returnVal);
		}
	}

	return 0;
}
	void Plugin::checkDates ()
	{
		if (!XmlSettingsManager::Instance ().property ("NotifyEnabled").toBool ())
			return;

		const auto& ranges = XmlSettingsManager::Instance ()
				.property ("NotificationDays").toString ().split (',', QString::SkipEmptyParts);

		QList<int> allowedDays;
		Q_FOREACH (const auto& range, ranges)
		{
			if (!range.contains ('-'))
			{
				bool ok = false;
				const int day = range.toInt (&ok);
				if (ok)
					allowedDays << day;
				continue;
			}

			const auto& ends = range.split ('-', QString::SkipEmptyParts);
			if (ends.size () != 2)
				continue;

			bool bOk = false, eOk = false;
			const int begin = ends.at (0).toInt (&bOk);
			const int end = ends.at (1).toInt (&eOk);
			if (!bOk || !eOk)
				continue;

			for (int i = begin; i <= end; ++i)
				allowedDays << i;
		}

		const auto& today = QDate::currentDate ();

		auto accs = AzothProxy_->GetAllAccounts ();
		Q_FOREACH (auto accObj, AzothProxy_->GetAllAccounts ())
		{
			auto acc = qobject_cast<IAccount*> (accObj);
			auto extSelf = qobject_cast<IExtSelfInfoAccount*> (accObj);
			Q_FOREACH (auto entryObj, acc->GetCLEntries ())
			{
				auto entry = qobject_cast<ICLEntry*> (entryObj);
				if (!entry || entry->GetEntryType () != ICLEntry::ETChat)
					continue;

				if (extSelf && extSelf->GetSelfContact () == entryObj)
					continue;

				auto meta = qobject_cast<IMetaInfoEntry*> (entryObj);
				if (!meta)
					continue;

				auto dt = meta->GetMetaInfo (IMetaInfoEntry::DataField::BirthDate).toDate ();
				if (!dt.isValid ())
					continue;

				dt.setDate (today.year (), dt.month (), dt.day ());
				if (!dt.isValid ())
					continue;

				int days = today.daysTo (dt);
				if (days < 0)
				{
					dt.setDate (today.year () + 1, dt.month (), dt.day ());
					if (!dt.isValid ())
						continue;
					days = today.daysTo (dt);
				}

				if (allowedDays.contains (days))
					NotifyBirthday (entry, days);
			}
		}
	}
Пример #4
0
GNC::GCS::Ptr<GIL::DICOM::TipoMetaInfo> GNC::GCS::IStudyContext::GetMetaInfoActiveImage()
{
        return GetMetaInfo(ActiveFileIndex);
}