Beispiel #1
0
void MusicPlayer::playSong(char *songName)
{
  Flag_toPlay = 1;
  if(addToPlaylist(songName))
  {
    playList();
  }
}
Beispiel #2
0
int PlayListRecord::coverIndex()
{
    if (m_coverIndex == PlayListRecord::EMPTY_COVER_INDEX) {
        PlayList *pl = playList();
        for (int i = 0; i < pl->count(); ++i) {
            if (pl->at(i)->thumbnailPath() == m_coverPath) {
                m_coverIndex = i;
                break;
            }
        }
    }

    return m_coverIndex;
}
Beispiel #3
0
void CPlayerView::OnPlaylistSave() 
{
	static TCHAR BASED_CODE szFilter[] = _T( "M3U PlayList (*.m3u)|*.m3u|PLS Playlist (*.pls)|*.pls||" );

	CFileDialog dlg(	FALSE, _T( "m3u" ), _T( "playlist"),
						OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
						szFilter );


	if ( IDOK == dlg.DoModal() )
	{
		unsigned int i = 0;
		CString strFileName = dlg.GetPathName();

		// delete old file
		FILE* pFile = CDexOpenFile( CUString( strFileName ), _W( "w" ) );
		fclose( pFile );

		// strip exentention
		strFileName = strFileName.Left( strFileName.GetLength() - 4 );

        CUString cuFileName( strFileName ); 
        PlayList playList( cuFileName );

        CString strExt( dlg.GetFileExt() );

		strExt.MakeLower();

		BOOL bIsPls =  strExt == _T( "pls" );


		for ( i = 0; i< m_vFileNames.size() ; i++ )
		{
			CString strEntry = m_vFileNames[ i ];
			if ( bIsPls )
			{
                playList.AddPLSEntry( CUString( strEntry ) );
			}
			else
			{
                playList.AddM3UEntry( CUString( strEntry ) );
			}
		}



	}
}