Diffstat (limited to 'noncore/multimedia/opieplayer2/om3u.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/om3u.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/noncore/multimedia/opieplayer2/om3u.cpp b/noncore/multimedia/opieplayer2/om3u.cpp index d378145..c947033 100644 --- a/noncore/multimedia/opieplayer2/om3u.cpp +++ b/noncore/multimedia/opieplayer2/om3u.cpp | |||
@@ -39,66 +39,66 @@ | |||
39 | #include <qpe/global.h> | 39 | #include <qpe/global.h> |
40 | #include <qpe/resource.h> | 40 | #include <qpe/resource.h> |
41 | 41 | ||
42 | #include <qdir.h> | 42 | #include <qdir.h> |
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 | ||
49 | //extern PlayListWidget *playList; | 49 | //extern PlayListWidget *playList; |
50 | 50 | ||
51 | Om3u::Om3u( const QString &filePath) | 51 | Om3u::Om3u( const QString &filePath, int mode) |
52 | : QStringList (){ | 52 | : QStringList (){ |
53 | //filePath is path name to m3u | 53 | //filePath is path name to m3u |
54 | //qDebug("<<<<<<<new m3u "+filePath); | 54 | //qDebug("<<<<<<<new m3u "+filePath); |
55 | f.setName(filePath); | 55 | f.setName(filePath); |
56 | if(f.exists()) | 56 | // if(f.exists()) |
57 | f.open( IO_ReadWrite ); | 57 | // f.open( IO_ReadWrite); |
58 | else | 58 | // else |
59 | f.open( IO_ReadWrite | IO_Truncate); | 59 | // f.open( IO_ReadWrite | IO_Truncate); |
60 | f.open(mode); | ||
61 | |||
60 | } | 62 | } |
61 | 63 | ||
62 | Om3u::~Om3u(){} | 64 | Om3u::~Om3u(){} |
63 | 65 | ||
64 | void Om3u::readM3u() { //it's m3u | 66 | void Om3u::readM3u() { //it's m3u |
65 | // qDebug("<<<<<<reading m3u "+f.name()); | 67 | // qDebug("<<<<<<reading m3u "+f.name()); |
66 | QTextStream t(&f); | 68 | QTextStream t(&f); |
67 | QString s; | 69 | QString s; |
68 | while ( !t.atEnd() ) { | 70 | while ( !t.atEnd() ) { |
69 | s=t.readLine(); | 71 | s=t.readLine(); |
70 | 72 | // qDebug(s); | |
71 | if( s.find( "#", 0, TRUE) == -1 ) { | 73 | if( s.find( "#", 0, TRUE) == -1 ) { |
72 | if( s.find( " ", 0, TRUE) == -1 ) { | ||
73 | if( s.left(2) == "E:" || s.left(2) == "P:" ) { | 74 | if( s.left(2) == "E:" || s.left(2) == "P:" ) { |
74 | s = s.right( s.length() -2 ); | 75 | s = s.right( s.length() -2 ); |
75 | QFileInfo f( s ); | 76 | QFileInfo f( s ); |
76 | QString name = f.baseName(); | 77 | QString name = f.baseName(); |
77 | name = name.right( name.length() - name.findRev( "\\", -1, TRUE ) -1 ); | 78 | name = name.right( name.length() - name.findRev( "\\", -1, TRUE ) -1 ); |
78 | s=s.replace( QRegExp( "\\" ), "/" ); | 79 | s=s.replace( QRegExp( "\\" ), "/" ); |
79 | append(s); | 80 | append(s); |
80 | // qDebug(s); | 81 | // qDebug(s); |
81 | } else { // is url | 82 | } else { // is url |
82 | s.replace( QRegExp( "%20" )," " ); | 83 | s.replace( QRegExp( "%20" )," " ); |
83 | QString name; | 84 | QString name; |
84 | if( name.left( 4 ) == "http" ) { | 85 | if( name.left( 4 ) == "http" ) { |
85 | name = s.right( s.length() - 7 ); | 86 | name = s.right( s.length() - 7 ); |
86 | } else { | 87 | } else { |
87 | name = s; | 88 | name = s; |
88 | } | 89 | } |
89 | append(name); | 90 | append(name); |
90 | // qDebug(name); | 91 | // qDebug(name); |
91 | } | 92 | } |
92 | } | ||
93 | } | 93 | } |
94 | } | 94 | } |
95 | } | 95 | } |
96 | 96 | ||
97 | void Om3u::readPls() { //it's a pls file | 97 | void Om3u::readPls() { //it's a pls file |
98 | QTextStream t( &f ); | 98 | QTextStream t( &f ); |
99 | QString s; | 99 | QString s; |
100 | while ( !t.atEnd() ) { | 100 | while ( !t.atEnd() ) { |
101 | s = t.readLine(); | 101 | s = t.readLine(); |
102 | if( s.left(4) == "File" ) { | 102 | if( s.left(4) == "File" ) { |
103 | s = s.right( s.length() - 6 ); | 103 | s = s.right( s.length() - 6 ); |
104 | s.replace( QRegExp( "%20" )," "); | 104 | s.replace( QRegExp( "%20" )," "); |