Diffstat (limited to 'core/multimedia/opieplayer/om3u.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/multimedia/opieplayer/om3u.cpp | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/core/multimedia/opieplayer/om3u.cpp b/core/multimedia/opieplayer/om3u.cpp index 3541e5f..8b92a8c 100644 --- a/core/multimedia/opieplayer/om3u.cpp +++ b/core/multimedia/opieplayer/om3u.cpp | |||
@@ -43,61 +43,61 @@ | |||
43 | #include <qregexp.h> | 43 | #include <qregexp.h> |
44 | #include <qstring.h> | 44 | #include <qstring.h> |
45 | #include <qtextstream.h> | 45 | #include <qtextstream.h> |
46 | #include <qstringlist.h> | 46 | #include <qstringlist.h> |
47 | #include <qcstring.h> | 47 | #include <qcstring.h> |
48 | 48 | ||
49 | static inline QString fullBaseName ( const QFileInfo &fi ) | 49 | static inline QString fullBaseName ( const QFileInfo &fi ) |
50 | { | 50 | { |
51 | QString str = fi. fileName ( ); | 51 | QString str = fi. fileName ( ); |
52 | return str. left ( str. findRev ( '.' )); | 52 | return str. left ( str. findRev ( '.' )); |
53 | } | 53 | } |
54 | 54 | ||
55 | 55 | ||
56 | //extern PlayListWidget *playList; | 56 | //extern PlayListWidget *playList; |
57 | 57 | ||
58 | Om3u::Om3u( const QString &filePath, int mode) | 58 | Om3u::Om3u( const QString &filePath, int mode) |
59 | : QStringList (){ | 59 | : QStringList (){ |
60 | //qDebug("<<<<<<<new m3u "+filePath); | 60 | //qDebug("<<<<<<<new m3u "+filePath); |
61 | f.setName(filePath); | 61 | f.setName(filePath); |
62 | f.open(mode); | 62 | f.open(mode); |
63 | } | 63 | } |
64 | 64 | ||
65 | Om3u::~Om3u(){} | 65 | Om3u::~Om3u(){} |
66 | 66 | ||
67 | void Om3u::readM3u() { | 67 | void Om3u::readM3u() { |
68 | // qDebug("<<<<<<reading m3u "+f.name()); | 68 | // qDebug("<<<<<<reading m3u "+f.name()); |
69 | QTextStream t(&f); | 69 | QTextStream t(&f); |
70 | QString s; | 70 | QString s; |
71 | while ( !t.atEnd() ) { | 71 | while ( !t.atEnd() ) { |
72 | s=t.readLine(); | 72 | s=t.readLine(); |
73 | qDebug(s); | 73 | // qDebug(s); |
74 | if( s.find( "#", 0, TRUE) == -1 ) { | 74 | if( s.find( "#", 0, TRUE) == -1 ) { |
75 | if( s.left(2) == "E:" || s.left(2) == "P:" ) { | 75 | if( s.left(2) == "E:" || s.left(2) == "P:" ) { |
76 | s = s.right( s.length() -2 ); | 76 | s = s.right( s.length() -2 ); |
77 | QFileInfo f( s ); | 77 | QFileInfo f( s ); |
78 | QString name = fullBaseName ( f ); | 78 | QString name = fullBaseName ( f ); |
79 | name = name.right( name.length() - name.findRev( "\\", -1, TRUE ) -1 ); | 79 | name = name.right( name.length() - name.findRev( "\\", -1, TRUE ) -1 ); |
80 | s=s.replace( QRegExp( "\\" ), "/" ); | 80 | s=s.replace( QRegExp( "\\" ), "/" ); |
81 | append(s); | 81 | append(s); |
82 | // qDebug(s); | 82 | // qDebug(s); |
83 | } else { // is url | 83 | } else { // is url |
84 | s.replace( QRegExp( "%20" )," " ); | 84 | s.replace( QRegExp( "%20" )," " ); |
85 | QString name; | 85 | QString name; |
86 | // if( name.left( 4 ) == "http" ) { | 86 | // if( name.left( 4 ) == "http" ) { |
87 | // name = s.right( s.length() - 7 ); | 87 | // name = s.right( s.length() - 7 ); |
88 | // } else { | 88 | // } else { |
89 | name = s; | 89 | name = s; |
90 | // } | 90 | // } |
91 | append(name); | 91 | append(name); |
92 | // qDebug(name); | 92 | // qDebug(name); |
93 | } | 93 | } |
94 | } | 94 | } |
95 | } | 95 | } |
96 | } | 96 | } |
97 | 97 | ||
98 | void Om3u::readPls() { //it's a pls file | 98 | void Om3u::readPls() { //it's a pls file |
99 | QTextStream t( &f ); | 99 | QTextStream t( &f ); |
100 | QString s; | 100 | QString s; |
101 | while ( !t.atEnd() ) { | 101 | while ( !t.atEnd() ) { |
102 | s = t.readLine(); | 102 | s = t.readLine(); |
103 | if( s.left(4) == "File" ) { | 103 | if( s.left(4) == "File" ) { |
@@ -130,17 +130,17 @@ void Om3u::readPls() { //it's a pls file | |||
130 | } | 130 | } |
131 | } | 131 | } |
132 | } | 132 | } |
133 | 133 | ||
134 | void Om3u::write() { //writes list to m3u file | 134 | void Om3u::write() { //writes list to m3u file |
135 | QString list; | 135 | QString list; |
136 | if(count()>0) { | 136 | if(count()>0) { |
137 | for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) { | 137 | for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) { |
138 | qDebug(*it); | 138 | // qDebug(*it); |
139 | list += *it+"\n"; | 139 | list += *it+"\n"; |
140 | } | 140 | } |
141 | f.writeBlock( list, list.length() ); | 141 | f.writeBlock( list, list.length() ); |
142 | } | 142 | } |
143 | // f.close(); | 143 | // f.close(); |
144 | } | 144 | } |
145 | 145 | ||
146 | void Om3u::add(const QString &filePath) { //adds to m3u file | 146 | void Om3u::add(const QString &filePath) { //adds to m3u file |