Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - How to get the song info(songname ,artist,etc) from the nowplayinglibrary?: (5 Items)
   
How to get the song info(songname ,artist,etc) from the nowplayinglibrary?  
Hi all!
     I want to get the song info(songname ,artist,etc) from the nowplayinglibrary.Now,I have to parse the mp3 file by 
open it .Does the mme provide the API function? or do I need config the mme.cofg?I am looking forward your reply.

Thanks!
Re: How to get the song info(songname ,artist,etc) from the nowplayinglibrary?  
Your request is a little unclear to me, but I'll do my best to answer. 
If I've mistook some information let me know.

When a song is being played by the MME the metadata is in the nowplaying 
table in the database.  You do not need to open the file to get the 
metadata yourself; this has already been done.  You do have to make a 
connection to the database (look at the qdb API to see how this is done) 
and run a query like "SELECT artist, title FROM nowplaying;".

If the file is not playing than how you get the metadata will depend on 
how you've configured, and how you use the MME.

-- 
Ryan J. Allen
QNX Software Systems
Re: How to get the song info(songname ,artist,etc) from the nowplayinglibrary?  
thanks  for your reply,Allen!
     the problems are as follow:
     The main code is:


 ----------
if( -1 == mme_play( mme, 0) ) {
			perror( "mme_play()" );
		} else {
			printf( "mme_play(): success\n" );
		
		}	
		
		mme_trksessionview_update(mme);
		mme_play_get_info(mme,&info) ;
		

		if( -1==qdb_statement(qdb,"SELECT filename, artist, album, genre, composer"
				" FROM nowplaying"))
		perror( "qdb_statement()");
		else {

			printf( "qdb_statement(): success\n" );		}

		
	

		res = qdb_getresult(qdb);
		columns=qdb_columns(res);
		rows=qdb_rows(res);
		printf( "\n" );
		printf( "rows is %d",rows );
		printf( "\n" );
		printf( "columns is %d",columns );
		printf( "\n" );
		strcpy(file_name,qdb_cell(res, 0, 0));
		//strcpy(album,qdb_cell(res, 0, 1));
		strcpy(artist,qdb_cell(res,0,1));
		qdb_freeresult( res );
#ifdef DEBUG
		printf("The file name is %s\n",file_name);
		printf("The  artist is %s\n",artist);
		//	printf("The album is %s\n",album);
#endif 



When I run the application,the result of print is :


mme_device /dev/mme/default
Connected to '/dev/mme/default'
trk session created: id = 11
mme_setrandom( MME_RANDOM_OFF )
Normal mme_play(): success
qdb_statement(): success

rows is 1
columns is 5
The file name is Can You Feel the Love Tonight.mp3
The  artist is Unknown Artist


I can not get the artist from the nowplaying,please give me the idle,thanks!
Re: How to get the song info(songname ,artist,etc) from the nowplayinglibrary?  
It sounds like you haven't run 2nd pass sync first (this is where all of the metadata is pulled from the songs and put 
into the library DB table). Try this on the command line:

mmecli resync_mediastore M 3 (where M is the msid)

Then, try again. BTW, you could also just do this on the command line for quick debugging:

qdbc -dmme "select * from nowplaying"

Re: How to get the song info(songname ,artist,etc) from the nowplayinglibrary?  
thanks for your reply roy!
I debug mme as you said ,but the song Info haven't been parsed.
The result is as follow,please give me instruction,thanks!


# mmecli resync_mediastore 1 2
(rc=0,errno=0) Starting a resync of msid=1, folderid=0, passmask=0x0002..  Execu
tion Time=0.007
# mmecli play 5
(rc=0,errno=0) Playing from tracksession fid/bid = 5.  Execution Time=0.559
# mmecli resync_mediastore 1 2
(rc=0,errno=0) Starting a resync of msid=1, folderid=0, passmask=0x0002..  Execu
tion Time=0.007
# qdbc -dmme "select * from nowplaying"
Rows: 1  Cols: 26
Names:  +ccid+playing+fid+msid+ftype+copyright+year+bitrate+samplerate+num_chann
els+size+discnum+tracknum+copied_fid+filename+artist+title+album+genre+composer+
conductor+soloist+ensemble+opus+category+description+
00000:  |1|0|5|1|1|0|0|0|0|0|3244728|0|0|0|Big Big World.mp3|Unknown Artist|[NUL
L]|Unknown Album|Unknown Genre|Unknown Composer|||||Unknown Category||