-rw-r--r-- | core/multimedia/opieplayer/om3u.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/core/multimedia/opieplayer/om3u.cpp b/core/multimedia/opieplayer/om3u.cpp index 95ed03c..7149a8e 100644 --- a/core/multimedia/opieplayer/om3u.cpp +++ b/core/multimedia/opieplayer/om3u.cpp | |||
@@ -60,105 +60,105 @@ void Om3u::readM3u() { | |||
60 | QString s; | 60 | QString s; |
61 | while ( !t.atEnd() ) { | 61 | while ( !t.atEnd() ) { |
62 | s=t.readLine(); | 62 | s=t.readLine(); |
63 | // odebug << s << oendl; | 63 | // odebug << s << oendl; |
64 | if( s.find( "#", 0, TRUE) == -1 ) { | 64 | if( s.find( "#", 0, TRUE) == -1 ) { |
65 | if( s.left(2) == "E:" || s.left(2) == "P:" ) { | 65 | if( s.left(2) == "E:" || s.left(2) == "P:" ) { |
66 | s = s.right( s.length() -2 ); | 66 | s = s.right( s.length() -2 ); |
67 | QFileInfo f( s ); | 67 | QFileInfo f( s ); |
68 | QString name = fullBaseName ( f ); | 68 | QString name = fullBaseName ( f ); |
69 | name = name.right( name.length() - name.findRev( "\\", -1, TRUE ) -1 ); | 69 | name = name.right( name.length() - name.findRev( "\\", -1, TRUE ) -1 ); |
70 | s=s.replace( QRegExp( "\\" ), "/" ); | 70 | s=s.replace( QRegExp( "\\" ), "/" ); |
71 | append(s); | 71 | append(s); |
72 | // odebug << s << oendl; | 72 | // odebug << s << oendl; |
73 | } else { // is url | 73 | } else { // is url |
74 | s.replace( QRegExp( "%20" )," " ); | 74 | s.replace( QRegExp( "%20" )," " ); |
75 | QString name; | 75 | QString name; |
76 | // if( name.left( 4 ) == "http" ) { | 76 | // if( name.left( 4 ) == "http" ) { |
77 | // name = s.right( s.length() - 7 ); | 77 | // name = s.right( s.length() - 7 ); |
78 | // } else { | 78 | // } else { |
79 | name = s; | 79 | name = s; |
80 | // } | 80 | // } |
81 | append(name); | 81 | append(name); |
82 | // odebug << name << oendl; | 82 | // odebug << name << oendl; |
83 | } | 83 | } |
84 | } | 84 | } |
85 | } | 85 | } |
86 | } | 86 | } |
87 | 87 | ||
88 | void Om3u::readPls() { //it's a pls file | 88 | void Om3u::readPls() { //it's a pls file |
89 | QTextStream t( &f ); | 89 | QTextStream t( &f ); |
90 | t.setEncoding(QTextStream::UnicodeUTF8); | 90 | t.setEncoding(QTextStream::UnicodeUTF8); |
91 | QString s; | 91 | QString s; |
92 | while ( !t.atEnd() ) { | 92 | while ( !t.atEnd() ) { |
93 | s = t.readLine(); | 93 | s = t.readLine(); |
94 | if( s.left(4) == "File" ) { | 94 | if( s.left(4) == "File" ) { |
95 | s = s.right( s.length() - 6 ); | 95 | s = s.right( s.length() - 6 ); |
96 | s.replace( QRegExp( "%20" )," "); | 96 | s.replace( QRegExp( "%20" )," "); |
97 | // odebug << "adding " + s + " to playlist" << oendl; | 97 | // odebug << "adding " + s + " to playlist" << oendl; |
98 | // numberofentries=2 | 98 | // numberofentries=2 |
99 | // File1=http | 99 | // File1=http |
100 | // Title | 100 | // Title |
101 | // Length | 101 | // Length |
102 | // Version | 102 | // Version |
103 | // File2=http | 103 | // File2=http |
104 | s = s.replace( QRegExp( "\\" ), "/" ); | 104 | s = s.replace( QRegExp( "\\" ), "/" ); |
105 | QFileInfo f( s ); | 105 | QFileInfo f( s ); |
106 | QString name = fullBaseName ( f ); | 106 | QString name = fullBaseName ( f ); |
107 | if( name.left( 4 ) == "http" ) { | 107 | if( name.left( 4 ) == "http" ) { |
108 | name = s.right( s.length() - 7); | 108 | name = s.right( s.length() - 7); |
109 | } else { | 109 | } else { |
110 | name = s; | 110 | name = s; |
111 | } | 111 | } |
112 | name = name.right( name.length() - name.findRev( "\\", -1, TRUE) - 1 ); | 112 | name = name.right( name.length() - name.findRev( "\\", -1, TRUE) - 1 ); |
113 | if( s.at( s.length() - 4) == '.') // if this is probably a file | 113 | if( s.at( s.length() - 4) == '.') // if this is probably a file |
114 | append(s); | 114 | append(s); |
115 | else { //if its a url | 115 | else { //if its a url |
116 | if( name.right( 1 ).find( '/' ) == -1) { | 116 | if( name.right( 1 ).find( '/' ) == -1) { |
117 | s += "/"; | 117 | s += "/"; |
118 | } | 118 | } |
119 | append(s); | 119 | append(s); |
120 | } | 120 | } |
121 | } | 121 | } |
122 | } | 122 | } |
123 | } | 123 | } |
124 | 124 | ||
125 | void Om3u::write() { //writes list to m3u file | 125 | void Om3u::write() { //writes list to m3u file |
126 | QString list; | 126 | QString list; |
127 | QTextStream t(&f); | 127 | QTextStream t(&f); |
128 | t.setEncoding(QTextStream::UnicodeUTF8); | 128 | t.setEncoding(QTextStream::UnicodeUTF8); |
129 | if(count()>0) { | 129 | if(count()>0) { |
130 | for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) { | 130 | for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) { |
131 | // odebug << *it << oendl; | 131 | // odebug << *it << oendl; |
132 | t << *it << "\n"; | 132 | t << *it << "\n"; |
133 | } | 133 | } |
134 | } | 134 | } |
135 | // f.close(); | 135 | // f.close(); |
136 | } | 136 | } |
137 | 137 | ||
138 | void Om3u::add(const QString &filePath) { //adds to m3u file | 138 | void Om3u::add(const QString &filePath) { //adds to m3u file |
139 | append(filePath); | 139 | append(filePath); |
140 | } | 140 | } |
141 | 141 | ||
142 | void Om3u::remove(const QString &filePath) { //removes from m3u list | 142 | void Om3u::remove(const QString &filePath) { //removes from m3u list |
143 | QString list, currentFile; | 143 | QString list, currentFile; |
144 | if(count()>0) { | 144 | if(count()>0) { |
145 | for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) { | 145 | for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) { |
146 | currentFile=*it; | 146 | currentFile=*it; |
147 | // odebug << *it << oendl; | 147 | // odebug << *it << oendl; |
148 | 148 | ||
149 | if( filePath != currentFile) | 149 | if( filePath != currentFile) |
150 | list += currentFile+"\n"; | 150 | list += currentFile+"\n"; |
151 | } | 151 | } |
152 | f.writeBlock( list, list.length() ); | 152 | f.writeBlock( list, list.length() ); |
153 | } | 153 | } |
154 | } | 154 | } |
155 | 155 | ||
156 | void Om3u::deleteFile(const QString &filePath) {//deletes m3u file | 156 | void Om3u::deleteFile(const QString &) {//deletes m3u file |
157 | f.close(); | 157 | f.close(); |
158 | f.remove(); | 158 | f.remove(); |
159 | 159 | ||
160 | } | 160 | } |
161 | 161 | ||
162 | void Om3u::close() { //closes m3u file | 162 | void Om3u::close() { //closes m3u file |
163 | f.close(); | 163 | f.close(); |
164 | } | 164 | } |