-rw-r--r-- | core/multimedia/opieplayer/om3u.cpp | 7 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/lib.cpp | 2 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/om3u.cpp | 13 |
3 files changed, 14 insertions, 8 deletions
diff --git a/core/multimedia/opieplayer/om3u.cpp b/core/multimedia/opieplayer/om3u.cpp index 8b92a8c..778eb22 100644 --- a/core/multimedia/opieplayer/om3u.cpp +++ b/core/multimedia/opieplayer/om3u.cpp @@ -62,16 +62,17 @@ Om3u::Om3u( const QString &filePath, int mode) f.open(mode); } Om3u::~Om3u(){} void Om3u::readM3u() { // qDebug("<<<<<<reading m3u "+f.name()); QTextStream t(&f); + t.setEncoding(QTextStream::UnicodeUTF8); QString s; while ( !t.atEnd() ) { s=t.readLine(); // qDebug(s); if( s.find( "#", 0, TRUE) == -1 ) { if( s.left(2) == "E:" || s.left(2) == "P:" ) { s = s.right( s.length() -2 ); QFileInfo f( s ); @@ -92,16 +93,17 @@ void Om3u::readM3u() { // qDebug(name); } } } } void Om3u::readPls() { //it's a pls file QTextStream t( &f ); + t.setEncoding(QTextStream::UnicodeUTF8); QString s; while ( !t.atEnd() ) { s = t.readLine(); if( s.left(4) == "File" ) { s = s.right( s.length() - 6 ); s.replace( QRegExp( "%20" )," "); // qDebug( "adding " + s + " to playlist" ); // numberofentries=2 @@ -128,22 +130,23 @@ void Om3u::readPls() { //it's a pls file append(s); } } } } void Om3u::write() { //writes list to m3u file QString list; + QTextStream t(&f); + t.setEncoding(QTextStream::UnicodeUTF8); if(count()>0) { for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) { // qDebug(*it); - list += *it+"\n"; + t << *it << "\n"; } - f.writeBlock( list, list.length() ); } // f.close(); } void Om3u::add(const QString &filePath) { //adds to m3u file append(filePath); } diff --git a/noncore/multimedia/opieplayer2/lib.cpp b/noncore/multimedia/opieplayer2/lib.cpp index 00cfa33..664ec65 100644 --- a/noncore/multimedia/opieplayer2/lib.cpp +++ b/noncore/multimedia/opieplayer2/lib.cpp @@ -202,17 +202,17 @@ int Lib::play( const QString& fileName, int startPos, int start_time ) { //xine_dispose ( m_stream ); QString str = fileName.stripWhiteSpace(); //m_stream = xine_stream_new (m_xine, m_audioOutput, m_videoOutput ); //m_queue = xine_event_new_queue (m_stream); //xine_event_create_listener_thread (m_queue, xine_event_handler, this); - if ( !xine_open( m_stream, QFile::encodeName(str.utf8() ).data() ) ) { + if ( !xine_open( m_stream, str.utf8().data() ) ) { return 0; } return xine_play( m_stream, startPos, start_time); } void Lib::stop() { assert( m_initialized ); diff --git a/noncore/multimedia/opieplayer2/om3u.cpp b/noncore/multimedia/opieplayer2/om3u.cpp index 7183fb4..69e87e7 100644 --- a/noncore/multimedia/opieplayer2/om3u.cpp +++ b/noncore/multimedia/opieplayer2/om3u.cpp @@ -55,17 +55,18 @@ qDebug("<<<<<<<new m3u "+filePath); f.open(mode); } Om3u::~Om3u(){} void Om3u::readM3u() { // qDebug("<<<<<<reading m3u "+f.name()); QTextStream t(&f); - QString s; + t.setEncoding(QTextStream::UnicodeUTF8); + QString s; while ( !t.atEnd() ) { s=t.readLine(); // qDebug(s); if( s.find( "#", 0, TRUE) == -1 ) { if( s.left(2) == "E:" || s.left(2) == "P:" ) { s = s.right( s.length() -2 ); QFileInfo f( s ); QString name = f.baseName(); @@ -79,17 +80,18 @@ void Om3u::readM3u() { append(name); } } } } void Om3u::readPls() { //it's a pls file QTextStream t( &f ); - QString s; + t.setEncoding(QTextStream::UnicodeUTF8); + QString s; while ( !t.atEnd() ) { s = t.readLine(); if( s.left(4) == "File" ) { s = s.right( s.length() - s.find("=",0,true)-1 ); s = s.stripWhiteSpace(); s.replace( QRegExp( "%20" )," "); // qDebug( "adding " + s + " to playlist" ); // numberofentries=2 @@ -116,22 +118,23 @@ void Om3u::readPls() { //it's a pls file append(s); } } } } void Om3u::write() { //writes list to m3u file QString list; - if(count()>0) { + QTextStream t(&f); + t.setEncoding(QTextStream::UnicodeUTF8); + if(count()>0) { for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) { // qDebug(*it); - list += *it+"\n"; + t << *it << "\n"; } - f.writeBlock( list, list.length() ); } // f.close(); } void Om3u::add(const QString &filePath) { //adds to m3u file append(filePath); } |