-rw-r--r-- | core/multimedia/opieplayer/om3u.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/core/multimedia/opieplayer/om3u.cpp b/core/multimedia/opieplayer/om3u.cpp index 48aa47e..68ea015 100644 --- a/core/multimedia/opieplayer/om3u.cpp +++ b/core/multimedia/opieplayer/om3u.cpp | |||
@@ -18,65 +18,66 @@ | |||
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 | ..}^=.= = ; Library General Public License for more | 20 | ..}^=.= = ; Library 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 | -_. . . )=. = Library General Public License along with | 24 | -_. . . )=. = Library 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 | #include "om3u.h" | 31 | #include "om3u.h" |
32 | 32 | ||
33 | /* OPIE */ | 33 | /* OPIE */ |
34 | #include <opie2/odebug.h> | 34 | #include <opie2/odebug.h> |
35 | 35 | ||
36 | 36 | ||
37 | static inline QString fullBaseName ( const QFileInfo &fi ) | 37 | static inline QString fullBaseName ( const QFileInfo &fi ) |
38 | { | 38 | { |
39 | QString str = fi. fileName ( ); | 39 | QString str = fi. fileName ( ); |
40 | return str. left ( str. findRev ( '.' )); | 40 | return str. left ( str. findRev ( '.' )); |
41 | } | 41 | } |
42 | 42 | ||
43 | 43 | ||
44 | //extern PlayListWidget *playList; | 44 | //extern PlayListWidget *playList; |
45 | 45 | ||
46 | Om3u::Om3u( const QString &filePath, int mode) | 46 | Om3u::Om3u( const QString &filePath, int mode) |
47 | : QStringList (){ | 47 | : QStringList (){ |
48 | //odebug << "<<<<<<<new m3u "+filePath << oendl; | 48 | //odebug << "<<<<<<<new m3u "+filePath << oendl; |
49 | f.setName(filePath); | 49 | f.setName(filePath); |
50 | f.open(mode); | 50 | if ( !f.open(mode) ) |
51 | owarn << "Failed to open file " << f.name() << oendl; | ||
51 | } | 52 | } |
52 | 53 | ||
53 | Om3u::~Om3u(){} | 54 | Om3u::~Om3u(){} |
54 | 55 | ||
55 | void Om3u::readM3u() { | 56 | void Om3u::readM3u() { |
56 | // odebug << "<<<<<<reading m3u "+f.name() << oendl; | 57 | // odebug << "<<<<<<reading m3u "+f.name() << oendl; |
57 | QTextStream t(&f); | 58 | QTextStream t(&f); |
58 | t.setEncoding(QTextStream::UnicodeUTF8); | 59 | t.setEncoding(QTextStream::UnicodeUTF8); |
59 | QString s; | 60 | QString s; |
60 | while ( !t.atEnd() ) { | 61 | while ( !t.atEnd() ) { |
61 | s=t.readLine(); | 62 | s=t.readLine(); |
62 | // odebug << s << oendl; | 63 | // odebug << s << oendl; |
63 | if( s.find( "#", 0, TRUE) == -1 ) { | 64 | if( s.find( "#", 0, TRUE) == -1 ) { |
64 | if( s.left(2) == "E:" || s.left(2) == "P:" ) { | 65 | if( s.left(2) == "E:" || s.left(2) == "P:" ) { |
65 | s = s.right( s.length() -2 ); | 66 | s = s.right( s.length() -2 ); |
66 | QFileInfo f( s ); | 67 | QFileInfo f( s ); |
67 | QString name = fullBaseName ( f ); | 68 | QString name = fullBaseName ( f ); |
68 | name = name.right( name.length() - name.findRev( "\\", -1, TRUE ) -1 ); | 69 | name = name.right( name.length() - name.findRev( "\\", -1, TRUE ) -1 ); |
69 | s=s.replace( QRegExp( "\\" ), "/" ); | 70 | s=s.replace( QRegExp( "\\" ), "/" ); |
70 | append(s); | 71 | append(s); |
71 | // odebug << s << oendl; | 72 | // odebug << s << oendl; |
72 | } else { // is url | 73 | } else { // is url |
73 | s.replace( QRegExp( "%20" )," " ); | 74 | s.replace( QRegExp( "%20" )," " ); |
74 | QString name; | 75 | QString name; |
75 | // if( name.left( 4 ) == "http" ) { | 76 | // if( name.left( 4 ) == "http" ) { |
76 | // name = s.right( s.length() - 7 ); | 77 | // name = s.right( s.length() - 7 ); |
77 | // } else { | 78 | // } else { |
78 | name = s; | 79 | name = s; |
79 | // } | 80 | // } |
80 | append(name); | 81 | append(name); |
81 | // odebug << name << oendl; | 82 | // odebug << name << oendl; |
82 | } | 83 | } |