Diffstat (limited to 'noncore/multimedia/opieplayer2/om3u.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/om3u.cpp | 15 |
1 files changed, 1 insertions, 14 deletions
diff --git a/noncore/multimedia/opieplayer2/om3u.cpp b/noncore/multimedia/opieplayer2/om3u.cpp index 69e87e7..26d5e15 100644 --- a/noncore/multimedia/opieplayer2/om3u.cpp +++ b/noncore/multimedia/opieplayer2/om3u.cpp | |||
@@ -1,95 +1,82 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | 3 | ||
4 | Copyright (c) 2002 L. Potter <ljp@llornkcor.com> | 4 | Copyright (c) 2002 L. Potter <ljp@llornkcor.com> |
5 | =. | 5 | =. |
6 | .=l. | 6 | .=l. |
7 | .>+-= | 7 | .>+-= |
8 | _;:, .> :=|. This program is free software; you can | 8 | _;:, .> :=|. This program is free software; you can |
9 | .> <`_, > . <= redistribute it and/or modify it under | 9 | .> <`_, > . <= redistribute it and/or modify it under |
10 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 10 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
11 | .="- .-=="i, .._ License as published by the Free Software | 11 | .="- .-=="i, .._ License as published by the Free Software |
12 | - . .-<_> .<> Foundation; either version 2 of the License, | 12 | - . .-<_> .<> Foundation; either version 2 of the License, |
13 | ._= =} : or (at your option) any later version. | 13 | ._= =} : or (at your option) any later version. |
14 | .%`+i> _;_. | 14 | .%`+i> _;_. |
15 | .i_,=:_. -<s. This program is distributed in the hope that | 15 | .i_,=:_. -<s. This program is distributed in the hope that |
16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
17 | : .. .:, . . . without even the implied warranty of | 17 | : .. .:, . . . without even the implied warranty of |
18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
20 | ..}^=.= = ; General Public License for more | 20 | ..}^=.= = ; General Public License for more |
21 | ++= -. .` .: details. | 21 | ++= -. .` .: details. |
22 | : = ...= . :.=- | 22 | : = ...= . :.=- |
23 | -. .:....=;==+<; You should have received a copy of the GNU | 23 | -. .:....=;==+<; You should have received a copy of the GNU |
24 | -_. . . )=. = General Public License along with | 24 | -_. . . )=. = General Public License along with |
25 | -- :-=` this library; see the file COPYING.LIB. | 25 | -- :-=` this library; see the file COPYING.LIB. |
26 | If not, write to the Free Software Foundation, | 26 | If not, write to the Free Software Foundation, |
27 | Inc., 59 Temple Place - Suite 330, | 27 | Inc., 59 Temple Place - Suite 330, |
28 | Boston, MA 02111-1307, USA. | 28 | Boston, MA 02111-1307, USA. |
29 | 29 | ||
30 | */ | 30 | */ |
31 | 31 | ||
32 | #include "playlistwidget.h" | ||
33 | #include "om3u.h" | 32 | #include "om3u.h" |
34 | 33 | ||
35 | #include <qpe/applnk.h> | 34 | |
36 | #include <qpe/qpeapplication.h> | ||
37 | #include <qpe/storage.h> | ||
38 | #include <qpe/mimetype.h> | ||
39 | #include <qpe/global.h> | ||
40 | #include <qpe/resource.h> | ||
41 | |||
42 | #include <qdir.h> | ||
43 | #include <qregexp.h> | ||
44 | #include <qstring.h> | ||
45 | #include <qtextstream.h> | ||
46 | #include <qstringlist.h> | ||
47 | #include <qcstring.h> | ||
48 | 35 | ||
49 | //extern PlayListWidget *playList; | 36 | //extern PlayListWidget *playList; |
50 | 37 | ||
51 | Om3u::Om3u( const QString &filePath, int mode) | 38 | Om3u::Om3u( const QString &filePath, int mode) |
52 | : QStringList (){ | 39 | : QStringList (){ |
53 | qDebug("<<<<<<<new m3u "+filePath); | 40 | qDebug("<<<<<<<new m3u "+filePath); |
54 | f.setName(filePath); | 41 | f.setName(filePath); |
55 | f.open(mode); | 42 | f.open(mode); |
56 | } | 43 | } |
57 | 44 | ||
58 | Om3u::~Om3u(){} | 45 | Om3u::~Om3u(){} |
59 | 46 | ||
60 | void Om3u::readM3u() { | 47 | void Om3u::readM3u() { |
61 | // qDebug("<<<<<<reading m3u "+f.name()); | 48 | // qDebug("<<<<<<reading m3u "+f.name()); |
62 | QTextStream t(&f); | 49 | QTextStream t(&f); |
63 | t.setEncoding(QTextStream::UnicodeUTF8); | 50 | t.setEncoding(QTextStream::UnicodeUTF8); |
64 | QString s; | 51 | QString s; |
65 | while ( !t.atEnd() ) { | 52 | while ( !t.atEnd() ) { |
66 | s=t.readLine(); | 53 | s=t.readLine(); |
67 | // qDebug(s); | 54 | // qDebug(s); |
68 | if( s.find( "#", 0, TRUE) == -1 ) { | 55 | if( s.find( "#", 0, TRUE) == -1 ) { |
69 | if( s.left(2) == "E:" || s.left(2) == "P:" ) { | 56 | if( s.left(2) == "E:" || s.left(2) == "P:" ) { |
70 | s = s.right( s.length() -2 ); | 57 | s = s.right( s.length() -2 ); |
71 | QFileInfo f( s ); | 58 | QFileInfo f( s ); |
72 | QString name = f.baseName(); | 59 | QString name = f.baseName(); |
73 | name = name.right( name.length() - name.findRev( "\\", -1, TRUE ) -1 ); | 60 | name = name.right( name.length() - name.findRev( "\\", -1, TRUE ) -1 ); |
74 | s=s.replace( QRegExp( "\\" ), "/" ); | 61 | s=s.replace( QRegExp( "\\" ), "/" ); |
75 | append(s); | 62 | append(s); |
76 | // qDebug(s); | 63 | // qDebug(s); |
77 | } else { // is url | 64 | } else { // is url |
78 | QString name; | 65 | QString name; |
79 | name = s; | 66 | name = s; |
80 | append(name); | 67 | append(name); |
81 | } | 68 | } |
82 | } | 69 | } |
83 | } | 70 | } |
84 | } | 71 | } |
85 | 72 | ||
86 | void Om3u::readPls() { //it's a pls file | 73 | void Om3u::readPls() { //it's a pls file |
87 | QTextStream t( &f ); | 74 | QTextStream t( &f ); |
88 | t.setEncoding(QTextStream::UnicodeUTF8); | 75 | t.setEncoding(QTextStream::UnicodeUTF8); |
89 | QString s; | 76 | QString s; |
90 | while ( !t.atEnd() ) { | 77 | while ( !t.atEnd() ) { |
91 | s = t.readLine(); | 78 | s = t.readLine(); |
92 | if( s.left(4) == "File" ) { | 79 | if( s.left(4) == "File" ) { |
93 | s = s.right( s.length() - s.find("=",0,true)-1 ); | 80 | s = s.right( s.length() - s.find("=",0,true)-1 ); |
94 | s = s.stripWhiteSpace(); | 81 | s = s.stripWhiteSpace(); |
95 | s.replace( QRegExp( "%20" )," "); | 82 | s.replace( QRegExp( "%20" )," "); |