Exemplo n.º 1
0
void CPlayCenter::AddSongToList(CSongInfo spSong,unsigned int u_listIndex)
{
	auto it = m_spSongListMap.find(u_listIndex);
	if (it!=m_spSongListMap.end())
	{
		it->second.push_back(spSong);
		m_songIdArray.push_back(spSong.GetLocalId());
	}
}
void CSecureDownloadMgr::display(CSongInfoList *songList)
{
	int n = songList->length();
	CSongInfo *pSong;
	CSecureSongInfo *pSecure;
	encryptionType encryption;
	transferType transfer;
	CSongInfoList sortList;

	cout << "***** CSecureDownloadMgr Output *****" << endl;
	for (int i=0; i<n; i=i+1)
	{
		pSong = songList->get(i);
		transfer = pSong->getTransfer();
		if (pSong->getType() == SONG_SECURE)
		{
			pSecure = (CSecureSongInfo *)songList->get(i);
			encryption = pSecure->getEncryption();
			if ((encryption == SECURE_2) || (encryption == SECURE_3))
			{
				if ((transfer == TRANSFER_DOWNLOADABLE) || (transfer == TRANSFER_BOTH))
				{
					sortList.add(pSecure);
				}
			}
		}
	}

	n = sortList.length();
	for (i=0; i<n-1; i=i+1)
	{
		for (int j=i+1; j < n; j=j+1)
		{
			CSongInfo *pSongI = sortList.get(i);
			CSongInfo *pSongJ = sortList.get(j);
			if (pSongJ->getFileSize() < pSongI->getFileSize())
			{
				CSongInfo *pSongTmp = pSongI;
				sortList.set(i, pSongJ);
				sortList.set(j, pSongTmp);
			}
		}
	}

	for (i=0; i<n; i=i+1)
	{
		pSecure = (CSecureSongInfo *)sortList.get(i);
		pSecure->displaySecureInfo();
		cout << endl;
	}

	cout << endl;
}
Exemplo n.º 3
0
spSongInfoT CPlayCenter::ParaseFromPath(CString sPath)
{
	CSongInfo spSong;
	TStreamFormat tf = GetFileFormat(sPath);
	if (tf==TStreamFormat::sfUnknown)
	{
//		byte bb[128]={0};
//		YTing::CMp3FileInfo::Mp3Info mp3 = YTing::CMp3FileInfo::getMp3Info(sPath,bb);
	}
	
	TID3InfoExW tid3;
	ZeroMemory(&tid3,sizeof(tid3));
	spSong.SetLocalPath(sPath);
	spSong.SetLocal(true);
	spSong.SetAddTime(mci::now_time());
	spSong.SetFileSize(mci::get_file_size(sPath));
	spSong.SetFileStartPos(0);
	if(LoadFileInfo2(sPath,&tid3))
	{	
		spSong.SetArtistName((tid3.Artist));
		spSong.SetSongName(tid3.Title);
		spSong.SetAblumName(tid3.Album);
		spSong.SetFileExt(mci::rip_file_ext(sPath,true));
		spSong.SetRealArtistName(tid3.AlbumArtist);		
		spSong.SetEnable(true);		
	}
	spSongInfoT spSongInfo = spSongInfoT(new CSongInfo(spSong));
	CheckSong(spSongInfo);
	return spSongInfo;
}
Exemplo n.º 4
0
void  CPlayCenter::GetAllPlayList() 
{
	RemoveAllList();

	if (theRuntimeState->GetLogUserInfo())
	{
		theDbMgr->SetCurrentUser(theRuntimeState->GetLogUserInfo());
	}
	{
		std::vector<spPlayListInfoT> PlayList;
		theDbMgr->GetUserDB()->GetAllPlayLists(PlayList);
		for (auto it=PlayList.begin();it!=PlayList.end();++it)
		{
			CPlayListInfo playList;
			playList.SetComment((*it)->GetComment());
			playList.SetFlag((*it)->GetFlag());
			playList.SetId((*it)->GetId());
			playList.SetListType((*it)->GetListType());
			playList.SetLocalId((*it)->GetLocalId());
			playList.SetName((*it)->GetName());
			playList.SetShow((*it)->IsShow());
			playList.SetTag((*it)->GetTag());

			AddPlayList(playList);
			std::vector<spSongInfoT> SongList;
			theDbMgr->GetUserDB()->GetPlayListSongs(SongList,(*it)->GetLocalId());
			for (auto it2=SongList.begin();it2!=SongList.end();++it2)
			{
				CSongInfo songInfo;
				songInfo.SetAblumName((*it2)->GetAlbumName());
				songInfo.SetAddTime((*it2)->GetAddTime());
				songInfo.SetAlbumId((*it2)->GetAlbumId());
				songInfo.SetArtistId((*it2)->GetArtistId());
				songInfo.SetArtistName((*it2)->GetArtistName());
				songInfo.SetAudioLength((*it2)->GetAudioLength());
				songInfo.SetCoverLocalPath((*it2)->GetCoverLocalPath());
				songInfo.SetCoverUrl((*it2)->GetCoverUrl());
				songInfo.SetEnable((*it2)->IsEnable());
				songInfo.SetFileExt((*it2)->GetFileExt());
				songInfo.SetFileSize((*it2)->GetFileSize());
				songInfo.SetFileStartPos((*it2)->GetFileStartPos());
				songInfo.SetFileType((*it2)->GetFileType());
				songInfo.SetFlag((*it2)->GetFlag());
				songInfo.SetLastModifyTime((*it2)->GetLastModifyTime());
				songInfo.SetLastPlayTime((*it2)->GetLastPlayTime());
				songInfo.SetListenFileUrl((*it2)->GetListenFileUrl());
				songInfo.SetLocal((*it2)->IsLocal());
				songInfo.SetLocalId((*it2)->GetLocalId());
				songInfo.SetLocalPath((*it2)->GetLocalPath());
				songInfo.SetLrcLocalPath((*it2)->GetLrcLocalPath());
				songInfo.SetLrcUrl((*it2)->GetLrcUrl());
				songInfo.SetMD5((*it2)->GetMD5());
				songInfo.SetPlayCount((*it2)->GetPlayCount());
				songInfo.SetRealArtistName((*it2)->GetRealArtistName());
				songInfo.SetResourceID((*it2)->GetResourceId());
				songInfo.SetSongId((*it2)->GetSongId());
				songInfo.SetSongName((*it2)->GetSongName());
				songInfo.SetTag((*it2)->GetTag());
				AddSongToList(songInfo,(*it)->GetLocalId());
			}
		}
		
	}
}
void CMoodMgr::editSong()
{
	int i;
	int length = songList.length();

	if (length == 0) {
		displayMessage("The song list is empty.");
		return;
	}
	
	getInputInt("Enter song number you wish to edit: ", &i);
	if ((i < 1) || (i > length)) { // Note: first song is displayed as #1
		displayMessage("You must enter a song number from 1 to ", true, length);
		cout << endl;
		return;
	}

	i = i - 1;  // adjustment, see above

	int fileSize=0, transfer, encryption, id, numDays, popularity;
	char songName[128], albumName[128], artistName[128], date[128], webLink[128];
	double duration, price;

	CSongInfo *pSong;
	CSecureSongInfo *pSecure;
	CPromoSongInfo *pPromo;

	pSong = songList.get(i);
	int type = pSong->getType();

	if (type == SONG_SECURE) {
		pSecure = (CSecureSongInfo *)songList.get(i);

		getInputString("Song Name: ", songName, true, pSecure->getSongName());
		getInputString("Album Name: ", albumName, true, pSecure->getAlbumName());
		getInputString("Artist Name: ", artistName, true, pSecure->getArtistName());
		getInputInt("File Size: ", &fileSize, true, pSecure->getFileSize());
		getInputInt("Transfer (1=Streamable, 2=Downloadable, 3=Both: ", &transfer, true, pSecure->getTransfer());
		getInputString("Date: ", date, true, pSecure->getDate());
		getInputInt("Popularity (0=Lowest to 100=Highest) : ", &popularity, true, pSecure->getPopularity());
		getInputDouble("Duration: ", &duration, true, pSecure->getDuration());
		getInputInt("Encryption (1=SECURE_1, 2=SECURE_2, 3=SECURE_3): ", &encryption, true, pSecure->getEncryption());
		getInputInt("ID: ", &id, true, pSecure->getId());

		pSecure->setSongName(songName);	
		pSecure->setAlbumName(albumName);
		pSecure->setArtistName(artistName);
		pSecure->setFileSize(fileSize);
		pSecure->setTransfer(transfer);
		pSecure->setDate(date);
		pSecure->setPopularity(popularity);
		pSecure->setDuration(duration);
		pSecure->setEncryption(encryption);
		pSecure->setId(id);
	}
	else if (type == SONG_PROMO) {
		pPromo = (CPromoSongInfo *)songList.get(i);

		getInputString("Song Name: ", songName, true, pPromo->getSongName());
		getInputString("Album Name: ", albumName, true, pPromo->getAlbumName());
		getInputString("Artist Name: ", artistName, true, pPromo->getArtistName());
		getInputInt("File Size: ", &fileSize, true, pPromo->getFileSize());
		getInputInt("Transfer (1=Streamable, 2=Downloadable, 3=Both: ", &transfer, true, pPromo->getTransfer());
		getInputString("Date: ", date, true, pPromo->getDate());
		getInputInt("Popularity (0=Lowest to 100=Highest) : ", &popularity, true, pPromo->getPopularity());
		getInputDouble("Price: ", &price, true, pPromo->getPrice());
		getInputString("WebLink: ", webLink, true, pPromo->getWebLink());
		getInputInt("Promotion Length: ", &numDays, true, pPromo->getNumDays());

		pPromo->setSongName(songName);
		pPromo->setAlbumName(albumName);
		pPromo->setArtistName(artistName);
		pPromo->setFileSize(fileSize);
		pPromo->setTransfer(transfer);
		pPromo->setDate(date);
		pPromo->setPopularity(popularity);
		pPromo->setPrice(price);
		pPromo->setWebLink(webLink);
		pPromo->setNumDays(numDays);
	}
	
	cout << endl;
}
Exemplo n.º 6
0
spSongInfoT PlayListMgr::PraseFromPath(LPCTSTR path)
{
	ASSERT(path);
	spSongInfoT spSong;
	CSongInfo song;
	AudioTagInfo * ptagInfo = new AudioTagInfo;
	ptagInfo->init(mci::unicode_2_ansi(path));

	song.SetSongName(mci::ansi_2_CString(ptagInfo->title().c_str()));
	if (song.GetSongName().IsEmpty())
	{
		song.SetSongName(mci::rip_file_name(path,false));
	}
	song.SetAblumName(mci::ansi_2_CString(ptagInfo->album().c_str()));
	song.SetArtistName(mci::ansi_2_CString(ptagInfo->artist().c_str()));
	song.SetLocalPath(path);
	song.SetLocal(true);
	song.SetAddTime(mci::now_time());
	song.SetFileSize(mci::get_file_size(path));
	song.SetFileStartPos(0);
	song.SetFileExt(mci::rip_file_ext(path,true));
	song.SetRealArtistName(mci::ansi_2_CString(ptagInfo->artist().c_str()));		
	song.SetEnable(true);

	spSong = spSongInfoT(new CSongInfo(song));

	delete ptagInfo;

	return spSong;
}
Exemplo n.º 7
0
void PlayListMgr::AddSongToList(spSongInfoT spSong,unsigned int u_listId)
{
	ASSERT(spSong);
	CSongInfo songInfo;
	songInfo.SetAblumName(spSong->GetAlbumName());
	songInfo.SetAddTime(spSong->GetAddTime());
	songInfo.SetAlbumId(spSong->GetAlbumId());
	songInfo.SetArtistId(spSong->GetArtistId());
	songInfo.SetArtistName(spSong->GetArtistName());
	songInfo.SetAudioLength(spSong->GetAudioLength());
	songInfo.SetCoverLocalPath(spSong->GetCoverLocalPath());
	songInfo.SetCoverUrl(spSong->GetCoverUrl());
	songInfo.SetEnable(spSong->IsEnable());
	songInfo.SetFileExt(spSong->GetFileExt());
	songInfo.SetFileSize(spSong->GetFileSize());
	songInfo.SetFileStartPos(spSong->GetFileStartPos());
	songInfo.SetFileType(spSong->GetFileType());
	songInfo.SetFlag(spSong->GetFlag());
	songInfo.SetLastModifyTime(spSong->GetLastModifyTime());
	songInfo.SetLastPlayTime(spSong->GetLastPlayTime());
	songInfo.SetListenFileUrl(spSong->GetListenFileUrl());
	songInfo.SetLocal(spSong->IsLocal());
	songInfo.SetLocalId(spSong->GetLocalId());
	songInfo.SetLocalPath(spSong->GetLocalPath());
	songInfo.SetLrcLocalPath(spSong->GetLrcLocalPath());
	songInfo.SetLrcUrl(spSong->GetLrcUrl());
	songInfo.SetMD5(spSong->GetMD5());
	songInfo.SetPlayCount(spSong->GetPlayCount());
	songInfo.SetRealArtistName(spSong->GetRealArtistName());
	songInfo.SetResourceID(spSong->GetResourceId());
	songInfo.SetSongId(spSong->GetSongId());
	songInfo.SetSongName(spSong->GetSongName());
	songInfo.SetTag(spSong->GetTag());

	AddSongToList(songInfo,u_listId);
}