summaryrefslogtreecommitdiff
path: root/core/multimedia/opieplayer/om3u.cpp
authorllornkcor <llornkcor>2003-06-11 22:11:38 (UTC)
committer llornkcor <llornkcor>2003-06-11 22:11:38 (UTC)
commit24097a2790fd7bb241a0a8da24ef2996e4f4ad15 (patch) (unidiff)
tree142e0fb758067bc9a601b3bd2dabdff27675c0f3 /core/multimedia/opieplayer/om3u.cpp
parent188319af82322c84f02e1abb848d908ca8f9e26c (diff)
downloadopie-24097a2790fd7bb241a0a8da24ef2996e4f4ad15.zip
opie-24097a2790fd7bb241a0a8da24ef2996e4f4ad15.tar.gz
opie-24097a2790fd7bb241a0a8da24ef2996e4f4ad15.tar.bz2
fix setDoc for playlists and others. remove qDebugs
Diffstat (limited to 'core/multimedia/opieplayer/om3u.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/multimedia/opieplayer/om3u.cpp60
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
@@ -39,69 +39,69 @@
39#include <qpe/global.h> 39#include <qpe/global.h>
40#include <qpe/resource.h> 40#include <qpe/resource.h>
41 41
42#include <qdir.h> 42#include <qdir.h>
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
49static inline QString fullBaseName ( const QFileInfo &fi ) 49static 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
58Om3u::Om3u( const QString &filePath, int mode) 58Om3u::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
65Om3u::~Om3u(){} 65Om3u::~Om3u(){}
66 66
67void Om3u::readM3u() { 67void 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
98void Om3u::readPls() { //it's a pls file 98void 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" ) {
104 s = s.right( s.length() - 6 ); 104 s = s.right( s.length() - 6 );
105 s.replace( QRegExp( "%20" )," "); 105 s.replace( QRegExp( "%20" )," ");
106// qDebug( "adding " + s + " to playlist" ); 106// qDebug( "adding " + s + " to playlist" );
107 // numberofentries=2 107 // numberofentries=2
@@ -126,25 +126,25 @@ void Om3u::readPls() { //it's a pls file
126 s += "/"; 126 s += "/";
127 } 127 }
128 append(s); 128 append(s);
129 } 129 }
130 } 130 }
131 } 131 }
132} 132}
133 133
134void Om3u::write() { //writes list to m3u file 134void 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
146void Om3u::add(const QString &filePath) { //adds to m3u file 146void Om3u::add(const QString &filePath) { //adds to m3u file
147 append(filePath); 147 append(filePath);
148} 148}
149 149
150void Om3u::remove(const QString &filePath) { //removes from m3u list 150void Om3u::remove(const QString &filePath) { //removes from m3u list