Diffstat (limited to 'noncore/multimedia/opieplayer2/om3u.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/om3u.cpp | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/noncore/multimedia/opieplayer2/om3u.cpp b/noncore/multimedia/opieplayer2/om3u.cpp index c947033..0be727b 100644 --- a/noncore/multimedia/opieplayer2/om3u.cpp +++ b/noncore/multimedia/opieplayer2/om3u.cpp @@ -64,5 +64,5 @@ Om3u::Om3u( const QString &filePath, int mode) Om3u::~Om3u(){} -void Om3u::readM3u() { //it's m3u +void Om3u::readM3u() { // qDebug("<<<<<<reading m3u "+f.name()); QTextStream t(&f); @@ -70,5 +70,5 @@ void Om3u::readM3u() { //it's m3u while ( !t.atEnd() ) { s=t.readLine(); - // qDebug(s); + qDebug(s); if( s.find( "#", 0, TRUE) == -1 ) { if( s.left(2) == "E:" || s.left(2) == "P:" ) { @@ -83,9 +83,9 @@ void Om3u::readM3u() { //it's m3u s.replace( QRegExp( "%20" )," " ); QString name; - if( name.left( 4 ) == "http" ) { - name = s.right( s.length() - 7 ); - } else { +// if( name.left( 4 ) == "http" ) { +// name = s.right( s.length() - 7 ); +// } else { name = s; - } +// } append(name); // qDebug(name); @@ -138,5 +138,5 @@ void Om3u::write() { //writes list to m3u file } f.writeBlock( list, list.length() ); - f.close(); +// f.close(); } @@ -146,8 +146,19 @@ void Om3u::add(const QString &filePath) { //adds to m3u file void Om3u::remove(const QString &filePath) { //removes from m3u list + QString list, currentFile; + for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) { + currentFile=*it; +// qDebug(*it); + + if( filePath != currentFile) + list += currentFile+"\n"; + } + f.writeBlock( list, list.length() ); } void Om3u::deleteFile(const QString &filePath) {//deletes m3u file + f.close(); + f.remove(); } |