author | llornkcor <llornkcor> | 2002-06-11 23:19:17 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-06-11 23:19:17 (UTC) |
commit | 37ab41238538d7c89090c083953b794cfdc29c6a (patch) (unidiff) | |
tree | 3a7db52fd8f8b2510d798fab094d65484e7227d8 /core/multimedia | |
parent | 7bace0e2b8613aaf229acea03107c68159cfa6de (diff) | |
download | opie-37ab41238538d7c89090c083953b794cfdc29c6a.zip opie-37ab41238538d7c89090c083953b794cfdc29c6a.tar.gz opie-37ab41238538d7c89090c083953b794cfdc29c6a.tar.bz2 |
in theory, clicking on a pls, or m3u list will now open them and add the url's to the playlist...
-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.cpp | 50 |
1 files changed, 33 insertions, 17 deletions
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp index 78c2822..930560e 100644 --- a/core/multimedia/opieplayer/playlistwidget.cpp +++ b/core/multimedia/opieplayer/playlistwidget.cpp | |||
@@ -456,17 +456,15 @@ void PlayListWidget::setDocument(const QString& fileref) { | |||
456 | QMessageBox::critical( 0, tr( "Invalid File" ), tr( "There was a problem in getting the file." ) ); | 456 | QMessageBox::critical( 0, tr( "Invalid File" ), tr( "There was a problem in getting the file." ) ); |
457 | return; | 457 | return; |
458 | } | 458 | } |
459 | // qDebug("setDocument "+fileref); | 459 | // qDebug("setDocument "+fileref); |
460 | // if(fileref.find("m3u",0,TRUE) != -1) { //is m3u | 460 | if(fileref.find("m3u",0,TRUE) != -1) { //is m3u |
461 | // clearList(); | 461 | readm3u( fileref); |
462 | // addToSelection( DocLnk( fileref ) ); | 462 | } |
463 | // d->setDocumentUsed = TRUE; | 463 | else if(fileref.find("pls",0,TRUE) != -1) { //is pls |
464 | // d->selectedFiles->first(); | 464 | readPls( fileref); |
465 | // qApp->processEvents(); | 465 | } |
466 | // } | 466 | else if(fileref.find("playlist",0,TRUE) != -1) {//is playlist |
467 | // else | ||
468 | if(fileref.find("playlist",0,TRUE) != -1) {//is playlist | ||
469 | clearList(); | 467 | clearList(); |
470 | loadList(DocLnk(fileref)); | 468 | loadList(DocLnk(fileref)); |
471 | d->selectedFiles->first(); | 469 | d->selectedFiles->first(); |
472 | } else { | 470 | } else { |
@@ -1185,9 +1183,9 @@ void PlayListWidget::doUnblank() { | |||
1185 | } | 1183 | } |
1186 | 1184 | ||
1187 | void PlayListWidget::readm3u(const QString &filename) { | 1185 | void PlayListWidget::readm3u(const QString &filename) { |
1188 | 1186 | ||
1189 | qDebug("playlist filename is "+filename); | 1187 | qDebug("m3u filename is "+filename); |
1190 | QFile f(filename); | 1188 | QFile f(filename); |
1191 | 1189 | ||
1192 | if(f.open(IO_ReadOnly)) { | 1190 | if(f.open(IO_ReadOnly)) { |
1193 | QTextStream t(&f); | 1191 | QTextStream t(&f); |
@@ -1235,28 +1233,46 @@ void PlayListWidget::writem3u(const QString &filename) { | |||
1235 | } | 1233 | } |
1236 | 1234 | ||
1237 | void PlayListWidget::readPls(const QString &filename) { | 1235 | void PlayListWidget::readPls(const QString &filename) { |
1238 | 1236 | ||
1239 | qDebug("playlist filename is "+filename); | 1237 | qDebug("pls filename is "+filename); |
1240 | QFile f(filename); | 1238 | QFile f(filename); |
1241 | 1239 | ||
1242 | if(f.open(IO_ReadOnly)) { | 1240 | if(f.open(IO_ReadOnly)) { |
1243 | QTextStream t(&f); | 1241 | QTextStream t(&f); |
1244 | QString s;//, first, second; | 1242 | QString s;//, first, second; |
1245 | int i=0; | 1243 | int i=0; |
1246 | while ( !t.atEnd()) { | 1244 | while ( !t.atEnd()) { |
1245 | s=t.readLine(); | ||
1246 | if(s.left(4) == "File") { | ||
1247 | s=s.right(s.length() - 6); | ||
1248 | qDebug("adding "+s+" to playlist"); | ||
1249 | // numberofentries=2 | ||
1250 | // File1=http | ||
1251 | // Title | ||
1252 | // Length | ||
1253 | // Version | ||
1254 | // File2=http | ||
1255 | |||
1256 | s=s.replace( QRegExp("\\"),"/"); | ||
1247 | // Lview->insertLine(t.readLine(),-1); | 1257 | // Lview->insertLine(t.readLine(),-1); |
1248 | // s=t.readLine(); | 1258 | // s=t.readLine(); |
1249 | // s=s.right(s.length()-2); | 1259 | // s=s.right(s.length()-2); |
1250 | // DocLnk lnk( s ); | 1260 | DocLnk lnk( s ); |
1261 | QFileInfo f(s); | ||
1262 | QString name = f.baseName(); | ||
1263 | name = name.right(name.length()-name.findRev("\\",-1,TRUE)-1); | ||
1251 | // QFileInfo f(s); | 1264 | // QFileInfo f(s); |
1252 | // QString name = f.baseName(); | 1265 | // QString name = f.baseName(); |
1253 | // // name = name.left(name.length()-4); | 1266 | // // name = name.left(name.length()-4); |
1254 | // name = name.right(name.findRev("/",0,TRUE)); | 1267 | // name = name.right(name.findRev("/",0,TRUE)); |
1255 | // lnk.setName( name); | 1268 | lnk.setName( name); |
1256 | // lnk.setFile( s); | 1269 | lnk.setFile( s+"/"); |
1257 | // qDebug("add "+name); | 1270 | lnk.setType("audio/x-mpegurl"); |
1258 | // d->selectedFiles->addToSelection( lnk); | 1271 | |
1272 | qDebug("DocLnk add "+name); | ||
1273 | d->selectedFiles->addToSelection( lnk); | ||
1274 | } | ||
1259 | } | 1275 | } |
1260 | i++; | 1276 | i++; |
1261 | } | 1277 | } |
1262 | } | 1278 | } |