diff options
| author | lvw <lvw@e10066b5-e1e2-0310-b819-94efdf66514b> | 2004-10-26 23:02:30 +0000 |
|---|---|---|
| committer | lvw <lvw@e10066b5-e1e2-0310-b819-94efdf66514b> | 2004-10-26 23:02:30 +0000 |
| commit | 88d9de082450481ab2a4e93e40f29b918995e82a (patch) | |
| tree | 7adf46668bc12229dee165afdaccce43b6b98038 | |
| parent | fb3cae2da67d2e12d676997af9b59eb72ab5c6ac (diff) | |
| download | vdr-plugin-muggle-88d9de082450481ab2a4e93e40f29b918995e82a.tar.gz vdr-plugin-muggle-88d9de082450481ab2a4e93e40f29b918995e82a.tar.bz2 | |
Store and restore last playlist
git-svn-id: https://vdr-muggle.svn.sourceforge.net/svnroot/vdr-muggle/trunk/muggle-plugin@252 e10066b5-e1e2-0310-b819-94efdf66514b
| -rw-r--r-- | gd_content_interface.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/gd_content_interface.c b/gd_content_interface.c index a7d5bac..890f2b6 100644 --- a/gd_content_interface.c +++ b/gd_content_interface.c @@ -769,13 +769,17 @@ bool GdPlaylist::storeAs( std::string name ) int id; MYSQL_ROW row; MYSQL_RES *result; + + mgDebug( 1, "GdPlaylist::storeAs" ); result = mgSqlReadQuery( &m_db, - "SELECT id FROM playlist WHERE title=\"current\"" ); + "SELECT id FROM playlist WHERE title=\"%s\"", + name.c_str() ); if( mysql_num_rows(result) ) { row = mysql_fetch_row( result ); + mgDebug( 1, "GdPlaylist::storeAs: found playlist" ); } else { @@ -786,9 +790,11 @@ bool GdPlaylist::storeAs( std::string name ) // now read the new list to get the id result = mgSqlReadQuery( &m_db, - "SELECT id,author FROM playlist where title=\"current\""); + "SELECT id,author FROM playlist where title=\"%s\"", + name.c_str() ); row = mysql_fetch_row(result); + mgDebug( 1, "GdPlaylist::storeAs: created playlist" ); } if( sscanf( row [0], "%d", &id ) !=1 ) @@ -811,10 +817,11 @@ bool GdPlaylist::storeAs( std::string name ) iter != m_list.end(); iter++, num++) { + mgDebug( 1, "GdPlaylist::storeAs: inserting track" ); mgSqlWriteQuery(&m_db, "INSERT into playlistitem " "SET tracknumber=\"%d\", trackid=\"%d\", playlist=%d", - num, (*iter)->getId(), m_sqlId); + num, (*iter)->getId(), id ); } } return true; |
