Changeset 19 for lib/mpdconnection.cpp


Ignore:
Timestamp:
12/31/07 11:58:35 (4 years ago)
Author:
sander
Message:

Adding songs to playlist works

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/mpdconnection.cpp

    r17 r19  
    185185 */ 
    186186 
     187void MPDConnection::add(const QStringList &files) 
     188{ 
     189    QByteArray send = "command_list_begin\n"; 
     190 
     191    for(qint32 i = 0; i < files.size(); i++) { 
     192        send += "add \""; 
     193        send += files.at(i); 
     194        send += "\"\n"; 
     195    } 
     196 
     197    send += "command_list_end"; 
     198 
     199    sendCommand(send); 
     200 
     201    if(!commandOk()) 
     202        qDebug("Couldn't add song(s) to playlist"); 
     203} 
     204 
    187205void MPDConnection::removeSongs(const QList<qint32> &items) 
    188206{ 
     
    199217    sendCommand(send); 
    200218 
    201     if(!commandOk()) { 
     219    if(!commandOk()) 
    202220        qDebug("Couldn't remove songs from playlist"); 
    203     } 
    204221} 
    205222 
     
    243260    sendCommand("next"); 
    244261 
    245     if(!commandOk()) { 
     262    if(!commandOk()) 
    246263        qDebug("Couldn't go to next track"); 
    247     } 
    248264} 
    249265 
     
    258274    sendCommand(data); 
    259275 
    260     if(!commandOk()) { 
     276    if(!commandOk()) 
    261277        qDebug("Couldn't set pause"); 
    262     } 
    263278} 
    264279 
     
    269284    sendCommand(data); 
    270285 
    271     if(!commandOk()) { 
     286    if(!commandOk()) 
    272287        qDebug("Couldn't start playing song"); 
    273     } 
    274288} 
    275289 
     
    280294    sendCommand(data); 
    281295 
    282     if(!commandOk()) { 
     296    if(!commandOk()) 
    283297        qDebug("Couldn't start playing song id"); 
    284     } 
    285298} 
    286299 
     
    289302    sendCommand("previous"); 
    290303 
    291     if(!commandOk()) { 
     304    if(!commandOk()) 
    292305        qDebug("Couldn't go to previous track"); 
    293     } 
    294306} 
    295307 
     
    304316    sendCommand(data); 
    305317 
    306     if(!commandOk()) { 
     318    if(!commandOk()) 
    307319        qDebug("Couldn't toggle random"); 
    308     } 
    309320} 
    310321 
     
    319330    sendCommand(data); 
    320331 
    321     if(!commandOk()) { 
     332    if(!commandOk()) 
    322333        qDebug("Couldn't toggle repeat"); 
    323     } 
    324334} 
    325335 
     
    348358    sendCommand(data); 
    349359 
    350     if(!commandOk()) { 
     360    if(!commandOk()) 
    351361        qDebug("Couldn't set volume"); 
    352     } 
    353362} 
    354363 
     
    357366    sendCommand("stop"); 
    358367 
    359     if(!commandOk()) { 
     368    if(!commandOk()) 
    360369        qDebug("Couldn't stop playing"); 
    361     } 
    362370} 
    363371 
Note: See TracChangeset for help on using the changeset viewer.