Diffstat (limited to 'core/multimedia/opieplayer/om3u.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/multimedia/opieplayer/om3u.cpp | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/core/multimedia/opieplayer/om3u.cpp b/core/multimedia/opieplayer/om3u.cpp index ae89518..95ed03c 100644 --- a/core/multimedia/opieplayer/om3u.cpp +++ b/core/multimedia/opieplayer/om3u.cpp | |||
@@ -31,6 +31,8 @@ | |||
31 | 31 | ||
32 | #include "om3u.h" | 32 | #include "om3u.h" |
33 | 33 | ||
34 | /* OPIE */ | ||
35 | #include <opie2/odebug.h> | ||
34 | 36 | ||
35 | 37 | ||
36 | static inline QString fullBaseName ( const QFileInfo &fi ) | 38 | static inline QString fullBaseName ( const QFileInfo &fi ) |
@@ -44,7 +46,7 @@ static inline QString fullBaseName ( const QFileInfo &fi ) | |||
44 | 46 | ||
45 | Om3u::Om3u( const QString &filePath, int mode) | 47 | Om3u::Om3u( const QString &filePath, int mode) |
46 | : QStringList (){ | 48 | : QStringList (){ |
47 | //qDebug("<<<<<<<new m3u "+filePath); | 49 | //odebug << "<<<<<<<new m3u "+filePath << oendl; |
48 | f.setName(filePath); | 50 | f.setName(filePath); |
49 | f.open(mode); | 51 | f.open(mode); |
50 | } | 52 | } |
@@ -52,13 +54,13 @@ Om3u::Om3u( const QString &filePath, int mode) | |||
52 | Om3u::~Om3u(){} | 54 | Om3u::~Om3u(){} |
53 | 55 | ||
54 | void Om3u::readM3u() { | 56 | void Om3u::readM3u() { |
55 | // qDebug("<<<<<<reading m3u "+f.name()); | 57 | // odebug << "<<<<<<reading m3u "+f.name() << oendl; |
56 | QTextStream t(&f); | 58 | QTextStream t(&f); |
57 | t.setEncoding(QTextStream::UnicodeUTF8); | 59 | t.setEncoding(QTextStream::UnicodeUTF8); |
58 | QString s; | 60 | QString s; |
59 | while ( !t.atEnd() ) { | 61 | while ( !t.atEnd() ) { |
60 | s=t.readLine(); | 62 | s=t.readLine(); |
61 | // qDebug(s); | 63 | // odebug << s << oendl; |
62 | if( s.find( "#", 0, TRUE) == -1 ) { | 64 | if( s.find( "#", 0, TRUE) == -1 ) { |
63 | if( s.left(2) == "E:" || s.left(2) == "P:" ) { | 65 | if( s.left(2) == "E:" || s.left(2) == "P:" ) { |
64 | s = s.right( s.length() -2 ); | 66 | s = s.right( s.length() -2 ); |
@@ -67,7 +69,7 @@ void Om3u::readM3u() { | |||
67 | name = name.right( name.length() - name.findRev( "\\", -1, TRUE ) -1 ); | 69 | name = name.right( name.length() - name.findRev( "\\", -1, TRUE ) -1 ); |
68 | s=s.replace( QRegExp( "\\" ), "/" ); | 70 | s=s.replace( QRegExp( "\\" ), "/" ); |
69 | append(s); | 71 | append(s); |
70 | // qDebug(s); | 72 | // odebug << s << oendl; |
71 | } else { // is url | 73 | } else { // is url |
72 | s.replace( QRegExp( "%20" )," " ); | 74 | s.replace( QRegExp( "%20" )," " ); |
73 | QString name; | 75 | QString name; |
@@ -77,7 +79,7 @@ void Om3u::readM3u() { | |||
77 | name = s; | 79 | name = s; |
78 | // } | 80 | // } |
79 | append(name); | 81 | append(name); |
80 | // qDebug(name); | 82 | // odebug << name << oendl; |
81 | } | 83 | } |
82 | } | 84 | } |
83 | } | 85 | } |
@@ -85,14 +87,14 @@ void Om3u::readM3u() { | |||
85 | 87 | ||
86 | void Om3u::readPls() { //it's a pls file | 88 | void Om3u::readPls() { //it's a pls file |
87 | QTextStream t( &f ); | 89 | QTextStream t( &f ); |
88 | t.setEncoding(QTextStream::UnicodeUTF8); | 90 | t.setEncoding(QTextStream::UnicodeUTF8); |
89 | QString s; | 91 | QString s; |
90 | while ( !t.atEnd() ) { | 92 | while ( !t.atEnd() ) { |
91 | s = t.readLine(); | 93 | s = t.readLine(); |
92 | if( s.left(4) == "File" ) { | 94 | if( s.left(4) == "File" ) { |
93 | s = s.right( s.length() - 6 ); | 95 | s = s.right( s.length() - 6 ); |
94 | s.replace( QRegExp( "%20" )," "); | 96 | s.replace( QRegExp( "%20" )," "); |
95 | // qDebug( "adding " + s + " to playlist" ); | 97 | // odebug << "adding " + s + " to playlist" << oendl; |
96 | // numberofentries=2 | 98 | // numberofentries=2 |
97 | // File1=http | 99 | // File1=http |
98 | // Title | 100 | // Title |
@@ -122,12 +124,12 @@ void Om3u::readPls() { //it's a pls file | |||
122 | 124 | ||
123 | void Om3u::write() { //writes list to m3u file | 125 | void Om3u::write() { //writes list to m3u file |
124 | QString list; | 126 | QString list; |
125 | QTextStream t(&f); | 127 | QTextStream t(&f); |
126 | t.setEncoding(QTextStream::UnicodeUTF8); | 128 | t.setEncoding(QTextStream::UnicodeUTF8); |
127 | if(count()>0) { | 129 | if(count()>0) { |
128 | for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) { | 130 | for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) { |
129 | // qDebug(*it); | 131 | // odebug << *it << oendl; |
130 | t << *it << "\n"; | 132 | t << *it << "\n"; |
131 | } | 133 | } |
132 | } | 134 | } |
133 | // f.close(); | 135 | // f.close(); |
@@ -142,8 +144,8 @@ void Om3u::remove(const QString &filePath) { //removes from m3u list | |||
142 | if(count()>0) { | 144 | if(count()>0) { |
143 | for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) { | 145 | for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) { |
144 | currentFile=*it; | 146 | currentFile=*it; |
145 | // qDebug(*it); | 147 | // odebug << *it << oendl; |
146 | 148 | ||
147 | if( filePath != currentFile) | 149 | if( filePath != currentFile) |
148 | list += currentFile+"\n"; | 150 | list += currentFile+"\n"; |
149 | } | 151 | } |