summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/multimedia/opieplayer/om3u.cpp7
-rw-r--r--noncore/multimedia/opieplayer2/lib.cpp2
-rw-r--r--noncore/multimedia/opieplayer2/om3u.cpp7
3 files changed, 11 insertions, 5 deletions
diff --git a/core/multimedia/opieplayer/om3u.cpp b/core/multimedia/opieplayer/om3u.cpp
index 8b92a8c..778eb22 100644
--- a/core/multimedia/opieplayer/om3u.cpp
+++ b/core/multimedia/opieplayer/om3u.cpp
@@ -58,24 +58,25 @@ static inline QString fullBaseName ( const QFileInfo &fi )
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 t.setEncoding(QTextStream::UnicodeUTF8);
70 QString s; 71 QString s;
71 while ( !t.atEnd() ) { 72 while ( !t.atEnd() ) {
72 s=t.readLine(); 73 s=t.readLine();
73 // qDebug(s); 74 // qDebug(s);
74 if( s.find( "#", 0, TRUE) == -1 ) { 75 if( s.find( "#", 0, TRUE) == -1 ) {
75 if( s.left(2) == "E:" || s.left(2) == "P:" ) { 76 if( s.left(2) == "E:" || s.left(2) == "P:" ) {
76 s = s.right( s.length() -2 ); 77 s = s.right( s.length() -2 );
77 QFileInfo f( s ); 78 QFileInfo f( s );
78 QString name = fullBaseName ( f ); 79 QString name = fullBaseName ( f );
79 name = name.right( name.length() - name.findRev( "\\", -1, TRUE ) -1 ); 80 name = name.right( name.length() - name.findRev( "\\", -1, TRUE ) -1 );
80 s=s.replace( QRegExp( "\\" ), "/" ); 81 s=s.replace( QRegExp( "\\" ), "/" );
81 append(s); 82 append(s);
@@ -88,24 +89,25 @@ void Om3u::readM3u() {
88 // } else { 89 // } else {
89 name = s; 90 name = s;
90 // } 91 // }
91 append(name); 92 append(name);
92 // qDebug(name); 93 // qDebug(name);
93 } 94 }
94 } 95 }
95 } 96 }
96} 97}
97 98
98void Om3u::readPls() { //it's a pls file 99void Om3u::readPls() { //it's a pls file
99 QTextStream t( &f ); 100 QTextStream t( &f );
101 t.setEncoding(QTextStream::UnicodeUTF8);
100 QString s; 102 QString s;
101 while ( !t.atEnd() ) { 103 while ( !t.atEnd() ) {
102 s = t.readLine(); 104 s = t.readLine();
103 if( s.left(4) == "File" ) { 105 if( s.left(4) == "File" ) {
104 s = s.right( s.length() - 6 ); 106 s = s.right( s.length() - 6 );
105 s.replace( QRegExp( "%20" )," "); 107 s.replace( QRegExp( "%20" )," ");
106// qDebug( "adding " + s + " to playlist" ); 108// qDebug( "adding " + s + " to playlist" );
107 // numberofentries=2 109 // numberofentries=2
108 // File1=http 110 // File1=http
109 // Title 111 // Title
110 // Length 112 // Length
111 // Version 113 // Version
@@ -124,30 +126,31 @@ void Om3u::readPls() { //it's a pls file
124 else { //if its a url 126 else { //if its a url
125 if( name.right( 1 ).find( '/' ) == -1) { 127 if( name.right( 1 ).find( '/' ) == -1) {
126 s += "/"; 128 s += "/";
127 } 129 }
128 append(s); 130 append(s);
129 } 131 }
130 } 132 }
131 } 133 }
132} 134}
133 135
134void Om3u::write() { //writes list to m3u file 136void Om3u::write() { //writes list to m3u file
135 QString list; 137 QString list;
138 QTextStream t(&f);
139 t.setEncoding(QTextStream::UnicodeUTF8);
136 if(count()>0) { 140 if(count()>0) {
137 for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) { 141 for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) {
138 // qDebug(*it); 142 // qDebug(*it);
139 list += *it+"\n"; 143 t << *it << "\n";
140 } 144 }
141 f.writeBlock( list, list.length() );
142 } 145 }
143// f.close(); 146// f.close();
144} 147}
145 148
146void Om3u::add(const QString &filePath) { //adds to m3u file 149void Om3u::add(const QString &filePath) { //adds to m3u file
147 append(filePath); 150 append(filePath);
148} 151}
149 152
150void Om3u::remove(const QString &filePath) { //removes from m3u list 153void Om3u::remove(const QString &filePath) { //removes from m3u list
151 QString list, currentFile; 154 QString list, currentFile;
152 if(count()>0) { 155 if(count()>0) {
153 for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) { 156 for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) {
diff --git a/noncore/multimedia/opieplayer2/lib.cpp b/noncore/multimedia/opieplayer2/lib.cpp
index 00cfa33..664ec65 100644
--- a/noncore/multimedia/opieplayer2/lib.cpp
+++ b/noncore/multimedia/opieplayer2/lib.cpp
@@ -198,25 +198,25 @@ int Lib::subVersion() {
198int Lib::play( const QString& fileName, int startPos, int start_time ) { 198int Lib::play( const QString& fileName, int startPos, int start_time ) {
199 assert( m_initialized ); 199 assert( m_initialized );
200 // FIXME actually a hack imho. Should not be needed to dispose the whole stream 200 // FIXME actually a hack imho. Should not be needed to dispose the whole stream
201 // but without we get wrong media length reads from libxine for the second media 201 // but without we get wrong media length reads from libxine for the second media
202 //xine_dispose ( m_stream ); 202 //xine_dispose ( m_stream );
203 203
204 QString str = fileName.stripWhiteSpace(); 204 QString str = fileName.stripWhiteSpace();
205 205
206 //m_stream = xine_stream_new (m_xine, m_audioOutput, m_videoOutput ); 206 //m_stream = xine_stream_new (m_xine, m_audioOutput, m_videoOutput );
207 //m_queue = xine_event_new_queue (m_stream); 207 //m_queue = xine_event_new_queue (m_stream);
208 //xine_event_create_listener_thread (m_queue, xine_event_handler, this); 208 //xine_event_create_listener_thread (m_queue, xine_event_handler, this);
209 209
210 if ( !xine_open( m_stream, QFile::encodeName(str.utf8() ).data() ) ) { 210 if ( !xine_open( m_stream, str.utf8().data() ) ) {
211 return 0; 211 return 0;
212 } 212 }
213 return xine_play( m_stream, startPos, start_time); 213 return xine_play( m_stream, startPos, start_time);
214} 214}
215 215
216void Lib::stop() { 216void Lib::stop() {
217 assert( m_initialized ); 217 assert( m_initialized );
218 218
219 qDebug("<<<<<<<< STOP IN LIB TRIGGERED >>>>>>>"); 219 qDebug("<<<<<<<< STOP IN LIB TRIGGERED >>>>>>>");
220 xine_stop( m_stream ); 220 xine_stop( m_stream );
221} 221}
222 222
diff --git a/noncore/multimedia/opieplayer2/om3u.cpp b/noncore/multimedia/opieplayer2/om3u.cpp
index 7183fb4..69e87e7 100644
--- a/noncore/multimedia/opieplayer2/om3u.cpp
+++ b/noncore/multimedia/opieplayer2/om3u.cpp
@@ -51,48 +51,50 @@
51Om3u::Om3u( const QString &filePath, int mode) 51Om3u::Om3u( const QString &filePath, int mode)
52 : QStringList (){ 52 : QStringList (){
53qDebug("<<<<<<<new m3u "+filePath); 53qDebug("<<<<<<<new m3u "+filePath);
54 f.setName(filePath); 54 f.setName(filePath);
55 f.open(mode); 55 f.open(mode);
56} 56}
57 57
58Om3u::~Om3u(){} 58Om3u::~Om3u(){}
59 59
60void Om3u::readM3u() { 60void Om3u::readM3u() {
61// qDebug("<<<<<<reading m3u "+f.name()); 61// qDebug("<<<<<<reading m3u "+f.name());
62 QTextStream t(&f); 62 QTextStream t(&f);
63 t.setEncoding(QTextStream::UnicodeUTF8);
63 QString s; 64 QString s;
64 while ( !t.atEnd() ) { 65 while ( !t.atEnd() ) {
65 s=t.readLine(); 66 s=t.readLine();
66// qDebug(s); 67// qDebug(s);
67 if( s.find( "#", 0, TRUE) == -1 ) { 68 if( s.find( "#", 0, TRUE) == -1 ) {
68 if( s.left(2) == "E:" || s.left(2) == "P:" ) { 69 if( s.left(2) == "E:" || s.left(2) == "P:" ) {
69 s = s.right( s.length() -2 ); 70 s = s.right( s.length() -2 );
70 QFileInfo f( s ); 71 QFileInfo f( s );
71 QString name = f.baseName(); 72 QString name = f.baseName();
72 name = name.right( name.length() - name.findRev( "\\", -1, TRUE ) -1 ); 73 name = name.right( name.length() - name.findRev( "\\", -1, TRUE ) -1 );
73 s=s.replace( QRegExp( "\\" ), "/" ); 74 s=s.replace( QRegExp( "\\" ), "/" );
74 append(s); 75 append(s);
75// qDebug(s); 76// qDebug(s);
76 } else { // is url 77 } else { // is url
77 QString name; 78 QString name;
78 name = s; 79 name = s;
79 append(name); 80 append(name);
80 } 81 }
81 } 82 }
82 } 83 }
83} 84}
84 85
85void Om3u::readPls() { //it's a pls file 86void Om3u::readPls() { //it's a pls file
86 QTextStream t( &f ); 87 QTextStream t( &f );
88 t.setEncoding(QTextStream::UnicodeUTF8);
87 QString s; 89 QString s;
88 while ( !t.atEnd() ) { 90 while ( !t.atEnd() ) {
89 s = t.readLine(); 91 s = t.readLine();
90 if( s.left(4) == "File" ) { 92 if( s.left(4) == "File" ) {
91 s = s.right( s.length() - s.find("=",0,true)-1 ); 93 s = s.right( s.length() - s.find("=",0,true)-1 );
92 s = s.stripWhiteSpace(); 94 s = s.stripWhiteSpace();
93 s.replace( QRegExp( "%20" )," "); 95 s.replace( QRegExp( "%20" )," ");
94// qDebug( "adding " + s + " to playlist" ); 96// qDebug( "adding " + s + " to playlist" );
95 // numberofentries=2 97 // numberofentries=2
96 // File1=http 98 // File1=http
97 // Title 99 // Title
98 // Length 100 // Length
@@ -112,30 +114,31 @@ void Om3u::readPls() { //it's a pls file
112 else { //if its a url 114 else { //if its a url
113// if( name.right( 1 ).find( '/' ) == -1) { 115// if( name.right( 1 ).find( '/' ) == -1) {
114// s += "/"; 116// s += "/";
115// } 117// }
116 append(s); 118 append(s);
117 } 119 }
118 } 120 }
119 } 121 }
120} 122}
121 123
122void Om3u::write() { //writes list to m3u file 124void Om3u::write() { //writes list to m3u file
123 QString list; 125 QString list;
126 QTextStream t(&f);
127 t.setEncoding(QTextStream::UnicodeUTF8);
124 if(count()>0) { 128 if(count()>0) {
125 for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) { 129 for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) {
126// qDebug(*it); 130// qDebug(*it);
127 list += *it+"\n"; 131 t << *it << "\n";
128 } 132 }
129 f.writeBlock( list, list.length() );
130 } 133 }
131// f.close(); 134// f.close();
132} 135}
133 136
134void Om3u::add(const QString &filePath) { //adds to m3u file 137void Om3u::add(const QString &filePath) { //adds to m3u file
135 append(filePath); 138 append(filePath);
136} 139}
137 140
138void Om3u::remove(const QString &filePath) { //removes from m3u list 141void Om3u::remove(const QString &filePath) { //removes from m3u list
139 QString list, currentFile; 142 QString list, currentFile;
140 if(count()>0) { 143 if(count()>0) {
141 for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) { 144 for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) {