Diffstat (limited to 'noncore/multimedia/opieplayer2/om3u.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/om3u.cpp | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/noncore/multimedia/opieplayer2/om3u.cpp b/noncore/multimedia/opieplayer2/om3u.cpp index 841d950..7183fb4 100644 --- a/noncore/multimedia/opieplayer2/om3u.cpp +++ b/noncore/multimedia/opieplayer2/om3u.cpp | |||
@@ -65,33 +65,27 @@ void Om3u::readM3u() { | |||
65 | s=t.readLine(); | 65 | s=t.readLine(); |
66 | // qDebug(s); | 66 | // qDebug(s); |
67 | if( s.find( "#", 0, TRUE) == -1 ) { | 67 | if( s.find( "#", 0, TRUE) == -1 ) { |
68 | if( s.left(2) == "E:" || s.left(2) == "P:" ) { | 68 | if( s.left(2) == "E:" || s.left(2) == "P:" ) { |
69 | s = s.right( s.length() -2 ); | 69 | s = s.right( s.length() -2 ); |
70 | QFileInfo f( s ); | 70 | QFileInfo f( s ); |
71 | QString name = f.baseName(); | 71 | QString name = f.baseName(); |
72 | name = name.right( name.length() - name.findRev( "\\", -1, TRUE ) -1 ); | 72 | name = name.right( name.length() - name.findRev( "\\", -1, TRUE ) -1 ); |
73 | s=s.replace( QRegExp( "\\" ), "/" ); | 73 | s=s.replace( QRegExp( "\\" ), "/" ); |
74 | append(s); | 74 | append(s); |
75 | // qDebug(s); | 75 | // qDebug(s); |
76 | } else { // is url | 76 | } else { // is url |
77 | s.replace( QRegExp( "%20" )," " ); | ||
78 | QString name; | 77 | QString name; |
79 | // if( name.left( 4 ) == "http" ) { | 78 | name = s; |
80 | // name = s.right( s.length() - 7 ); | ||
81 | // } else { | ||
82 | name = s; | ||
83 | // } | ||
84 | append(name); | 79 | append(name); |
85 | // qDebug(name); | ||
86 | } | 80 | } |
87 | } | 81 | } |
88 | } | 82 | } |
89 | } | 83 | } |
90 | 84 | ||
91 | void Om3u::readPls() { //it's a pls file | 85 | void Om3u::readPls() { //it's a pls file |
92 | QTextStream t( &f ); | 86 | QTextStream t( &f ); |
93 | QString s; | 87 | QString s; |
94 | while ( !t.atEnd() ) { | 88 | while ( !t.atEnd() ) { |
95 | s = t.readLine(); | 89 | s = t.readLine(); |
96 | if( s.left(4) == "File" ) { | 90 | if( s.left(4) == "File" ) { |
97 | s = s.right( s.length() - s.find("=",0,true)-1 ); | 91 | s = s.right( s.length() - s.find("=",0,true)-1 ); |
@@ -138,25 +132,25 @@ void Om3u::write() { //writes list to m3u file | |||
138 | } | 132 | } |
139 | 133 | ||
140 | void Om3u::add(const QString &filePath) { //adds to m3u file | 134 | void Om3u::add(const QString &filePath) { //adds to m3u file |
141 | append(filePath); | 135 | append(filePath); |
142 | } | 136 | } |
143 | 137 | ||
144 | void Om3u::remove(const QString &filePath) { //removes from m3u list | 138 | void Om3u::remove(const QString &filePath) { //removes from m3u list |
145 | QString list, currentFile; | 139 | QString list, currentFile; |
146 | if(count()>0) { | 140 | if(count()>0) { |
147 | for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) { | 141 | for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) { |
148 | currentFile=*it; | 142 | currentFile=*it; |
149 | // qDebug(*it); | 143 | // qDebug(*it); |
150 | 144 | ||
151 | if( filePath != currentFile) | 145 | if( filePath != currentFile) |
152 | list += currentFile+"\n"; | 146 | list += currentFile+"\n"; |
153 | } | 147 | } |
154 | f.writeBlock( list, list.length() ); | 148 | f.writeBlock( list, list.length() ); |
155 | } | 149 | } |
156 | } | 150 | } |
157 | 151 | ||
158 | void Om3u::deleteFile(const QString &/*filePath*/) {//deletes m3u file | 152 | void Om3u::deleteFile(const QString &/*filePath*/) {//deletes m3u file |
159 | f.close(); | 153 | f.close(); |
160 | f.remove(); | 154 | f.remove(); |
161 | 155 | ||
162 | } | 156 | } |