author | mickeyl <mickeyl> | 2004-04-04 13:54:40 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-04-04 13:54:40 (UTC) |
commit | 16cf79e90b5217f8d4bfce2a0fa817ae4b73db36 (patch) (unidiff) | |
tree | 0701eae15aa606a0211a2fccfde0eafdac69357c /noncore/multimedia/opieplayer2/om3u.cpp | |
parent | 8d2d2664e5f544b8292806e617deb7a0e4170dc0 (diff) | |
download | opie-16cf79e90b5217f8d4bfce2a0fa817ae4b73db36.zip opie-16cf79e90b5217f8d4bfce2a0fa817ae4b73db36.tar.gz opie-16cf79e90b5217f8d4bfce2a0fa817ae4b73db36.tar.bz2 |
convert to Opie Debugging Framework
Diffstat (limited to 'noncore/multimedia/opieplayer2/om3u.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/om3u.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/noncore/multimedia/opieplayer2/om3u.cpp b/noncore/multimedia/opieplayer2/om3u.cpp index 26d5e15..95dbab5 100644 --- a/noncore/multimedia/opieplayer2/om3u.cpp +++ b/noncore/multimedia/opieplayer2/om3u.cpp | |||
@@ -32,40 +32,40 @@ | |||
32 | #include "om3u.h" | 32 | #include "om3u.h" |
33 | 33 | ||
34 | 34 | ||
35 | 35 | ||
36 | //extern PlayListWidget *playList; | 36 | //extern PlayListWidget *playList; |
37 | 37 | ||
38 | Om3u::Om3u( const QString &filePath, int mode) | 38 | Om3u::Om3u( const QString &filePath, int mode) |
39 | : QStringList (){ | 39 | : QStringList (){ |
40 | qDebug("<<<<<<<new m3u "+filePath); | 40 | odebug << "<<<<<<<new m3u "+filePath << oendl; |
41 | f.setName(filePath); | 41 | f.setName(filePath); |
42 | f.open(mode); | 42 | f.open(mode); |
43 | } | 43 | } |
44 | 44 | ||
45 | Om3u::~Om3u(){} | 45 | Om3u::~Om3u(){} |
46 | 46 | ||
47 | void Om3u::readM3u() { | 47 | void Om3u::readM3u() { |
48 | // qDebug("<<<<<<reading m3u "+f.name()); | 48 | // odebug << "<<<<<<reading m3u "+f.name() << oendl; |
49 | QTextStream t(&f); | 49 | QTextStream t(&f); |
50 | t.setEncoding(QTextStream::UnicodeUTF8); | 50 | t.setEncoding(QTextStream::UnicodeUTF8); |
51 | QString s; | 51 | QString s; |
52 | while ( !t.atEnd() ) { | 52 | while ( !t.atEnd() ) { |
53 | s=t.readLine(); | 53 | s=t.readLine(); |
54 | // qDebug(s); | 54 | // odebug << s << oendl; |
55 | if( s.find( "#", 0, TRUE) == -1 ) { | 55 | if( s.find( "#", 0, TRUE) == -1 ) { |
56 | if( s.left(2) == "E:" || s.left(2) == "P:" ) { | 56 | if( s.left(2) == "E:" || s.left(2) == "P:" ) { |
57 | s = s.right( s.length() -2 ); | 57 | s = s.right( s.length() -2 ); |
58 | QFileInfo f( s ); | 58 | QFileInfo f( s ); |
59 | QString name = f.baseName(); | 59 | QString name = f.baseName(); |
60 | name = name.right( name.length() - name.findRev( "\\", -1, TRUE ) -1 ); | 60 | name = name.right( name.length() - name.findRev( "\\", -1, TRUE ) -1 ); |
61 | s=s.replace( QRegExp( "\\" ), "/" ); | 61 | s=s.replace( QRegExp( "\\" ), "/" ); |
62 | append(s); | 62 | append(s); |
63 | // qDebug(s); | 63 | // odebug << s << oendl; |
64 | } else { // is url | 64 | } else { // is url |
65 | QString name; | 65 | QString name; |
66 | name = s; | 66 | name = s; |
67 | append(name); | 67 | append(name); |
68 | } | 68 | } |
69 | } | 69 | } |
70 | } | 70 | } |
71 | } | 71 | } |
@@ -75,17 +75,17 @@ void Om3u::readPls() { //it's a pls file | |||
75 | t.setEncoding(QTextStream::UnicodeUTF8); | 75 | t.setEncoding(QTextStream::UnicodeUTF8); |
76 | QString s; | 76 | QString s; |
77 | while ( !t.atEnd() ) { | 77 | while ( !t.atEnd() ) { |
78 | s = t.readLine(); | 78 | s = t.readLine(); |
79 | if( s.left(4) == "File" ) { | 79 | if( s.left(4) == "File" ) { |
80 | s = s.right( s.length() - s.find("=",0,true)-1 ); | 80 | s = s.right( s.length() - s.find("=",0,true)-1 ); |
81 | s = s.stripWhiteSpace(); | 81 | s = s.stripWhiteSpace(); |
82 | s.replace( QRegExp( "%20" )," "); | 82 | s.replace( QRegExp( "%20" )," "); |
83 | // qDebug( "adding " + s + " to playlist" ); | 83 | // odebug << "adding " + s + " to playlist" << oendl; |
84 | // numberofentries=2 | 84 | // numberofentries=2 |
85 | // File1=http | 85 | // File1=http |
86 | // Title | 86 | // Title |
87 | // Length | 87 | // Length |
88 | // Version | 88 | // Version |
89 | // File2=http | 89 | // File2=http |
90 | s = s.replace( QRegExp( "\\" ), "/" ); | 90 | s = s.replace( QRegExp( "\\" ), "/" ); |
91 | QFileInfo f( s ); | 91 | QFileInfo f( s ); |
@@ -109,33 +109,33 @@ void Om3u::readPls() { //it's a pls file | |||
109 | } | 109 | } |
110 | 110 | ||
111 | void Om3u::write() { //writes list to m3u file | 111 | void Om3u::write() { //writes list to m3u file |
112 | QString list; | 112 | QString list; |
113 | QTextStream t(&f); | 113 | QTextStream t(&f); |
114 | t.setEncoding(QTextStream::UnicodeUTF8); | 114 | t.setEncoding(QTextStream::UnicodeUTF8); |
115 | if(count()>0) { | 115 | if(count()>0) { |
116 | for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) { | 116 | for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) { |
117 | // qDebug(*it); | 117 | // odebug << *it << oendl; |
118 | t << *it << "\n"; | 118 | t << *it << "\n"; |
119 | } | 119 | } |
120 | } | 120 | } |
121 | // f.close(); | 121 | // f.close(); |
122 | } | 122 | } |
123 | 123 | ||
124 | void Om3u::add(const QString &filePath) { //adds to m3u file | 124 | void Om3u::add(const QString &filePath) { //adds to m3u file |
125 | append(filePath); | 125 | append(filePath); |
126 | } | 126 | } |
127 | 127 | ||
128 | void Om3u::remove(const QString &filePath) { //removes from m3u list | 128 | void Om3u::remove(const QString &filePath) { //removes from m3u list |
129 | QString list, currentFile; | 129 | QString list, currentFile; |
130 | if(count()>0) { | 130 | if(count()>0) { |
131 | for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) { | 131 | for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) { |
132 | currentFile=*it; | 132 | currentFile=*it; |
133 | // qDebug(*it); | 133 | // odebug << *it << oendl; |
134 | 134 | ||
135 | if( filePath != currentFile) | 135 | if( filePath != currentFile) |
136 | list += currentFile+"\n"; | 136 | list += currentFile+"\n"; |
137 | } | 137 | } |
138 | f.writeBlock( list, list.length() ); | 138 | f.writeBlock( list, list.length() ); |
139 | } | 139 | } |
140 | } | 140 | } |
141 | 141 | ||