summaryrefslogtreecommitdiff
path: root/core/multimedia/opieplayer/om3u.cpp
Unidiff
Diffstat (limited to 'core/multimedia/opieplayer/om3u.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/multimedia/opieplayer/om3u.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/core/multimedia/opieplayer/om3u.cpp b/core/multimedia/opieplayer/om3u.cpp
index 039f3b1..3541e5f 100644
--- a/core/multimedia/opieplayer/om3u.cpp
+++ b/core/multimedia/opieplayer/om3u.cpp
@@ -43,12 +43,19 @@
43#include <qregexp.h> 43#include <qregexp.h>
44#include <qstring.h> 44#include <qstring.h>
45#include <qtextstream.h> 45#include <qtextstream.h>
46#include <qstringlist.h> 46#include <qstringlist.h>
47#include <qcstring.h> 47#include <qcstring.h>
48 48
49static inline QString fullBaseName ( const QFileInfo &fi )
50{
51 QString str = fi. fileName ( );
52 return str. left ( str. findRev ( '.' ));
53}
54
55
49//extern PlayListWidget *playList; 56//extern PlayListWidget *playList;
50 57
51Om3u::Om3u( const QString &filePath, int mode) 58Om3u::Om3u( const QString &filePath, int mode)
52 : QStringList (){ 59 : QStringList (){
53//qDebug("<<<<<<<new m3u "+filePath); 60//qDebug("<<<<<<<new m3u "+filePath);
54 f.setName(filePath); 61 f.setName(filePath);
@@ -65,13 +72,13 @@ void Om3u::readM3u() {
65 s=t.readLine(); 72 s=t.readLine();
66 qDebug(s); 73 qDebug(s);
67 if( s.find( "#", 0, TRUE) == -1 ) { 74 if( s.find( "#", 0, TRUE) == -1 ) {
68 if( s.left(2) == "E:" || s.left(2) == "P:" ) { 75 if( s.left(2) == "E:" || s.left(2) == "P:" ) {
69 s = s.right( s.length() -2 ); 76 s = s.right( s.length() -2 );
70 QFileInfo f( s ); 77 QFileInfo f( s );
71 QString name = f.baseName(); 78 QString name = fullBaseName ( f );
72 name = name.right( name.length() - name.findRev( "\\", -1, TRUE ) -1 ); 79 name = name.right( name.length() - name.findRev( "\\", -1, TRUE ) -1 );
73 s=s.replace( QRegExp( "\\" ), "/" ); 80 s=s.replace( QRegExp( "\\" ), "/" );
74 append(s); 81 append(s);
75// qDebug(s); 82// qDebug(s);
76 } else { // is url 83 } else { // is url
77 s.replace( QRegExp( "%20" )," " ); 84 s.replace( QRegExp( "%20" )," " );
@@ -102,13 +109,13 @@ void Om3u::readPls() { //it's a pls file
102 // Title 109 // Title
103 // Length 110 // Length
104 // Version 111 // Version
105 // File2=http 112 // File2=http
106 s = s.replace( QRegExp( "\\" ), "/" ); 113 s = s.replace( QRegExp( "\\" ), "/" );
107 QFileInfo f( s ); 114 QFileInfo f( s );
108 QString name = f.baseName(); 115 QString name = fullBaseName ( f );
109 if( name.left( 4 ) == "http" ) { 116 if( name.left( 4 ) == "http" ) {
110 name = s.right( s.length() - 7); 117 name = s.right( s.length() - 7);
111 } else { 118 } else {
112 name = s; 119 name = s;
113 } 120 }
114 name = name.right( name.length() - name.findRev( "\\", -1, TRUE) - 1 ); 121 name = name.right( name.length() - name.findRev( "\\", -1, TRUE) - 1 );