Diffstat (limited to 'core/multimedia/opieplayer/playlistwidget.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp index 0332237..4926287 100644 --- a/core/multimedia/opieplayer/playlistwidget.cpp +++ b/core/multimedia/opieplayer/playlistwidget.cpp | |||
@@ -1293,60 +1293,65 @@ void PlayListWidget::writem3u() { | |||
1293 | filename=filename+".m3u"; | 1293 | filename=filename+".m3u"; |
1294 | 1294 | ||
1295 | QFile f(filename); | 1295 | QFile f(filename); |
1296 | f.open(IO_WriteOnly); | 1296 | f.open(IO_WriteOnly); |
1297 | f.writeBlock(list, list.length()); | 1297 | f.writeBlock(list, list.length()); |
1298 | f.close(); | 1298 | f.close(); |
1299 | } | 1299 | } |
1300 | if(fileDlg) delete fileDlg; | 1300 | if(fileDlg) delete fileDlg; |
1301 | } | 1301 | } |
1302 | 1302 | ||
1303 | void PlayListWidget::readPls(const QString &filename) { | 1303 | void PlayListWidget::readPls(const QString &filename) { |
1304 | 1304 | ||
1305 | qDebug("pls filename is "+filename); | 1305 | qDebug("pls filename is "+filename); |
1306 | QFile f(filename); | 1306 | QFile f(filename); |
1307 | 1307 | ||
1308 | if(f.open(IO_ReadOnly)) { | 1308 | if(f.open(IO_ReadOnly)) { |
1309 | QTextStream t(&f); | 1309 | QTextStream t(&f); |
1310 | QString s;//, first, second; | 1310 | QString s;//, first, second; |
1311 | int i=0; | 1311 | int i=0; |
1312 | while ( !t.atEnd()) { | 1312 | while ( !t.atEnd()) { |
1313 | s=t.readLine(); | 1313 | s=t.readLine(); |
1314 | if(s.left(4) == "File") { | 1314 | if(s.left(4) == "File") { |
1315 | s=s.right(s.length() - 6); | 1315 | s=s.right(s.length() - 6); |
1316 | s.replace(QRegExp("%20")," "); | 1316 | s.replace(QRegExp("%20")," "); |
1317 | qDebug("adding "+s+" to playlist"); | 1317 | qDebug("adding "+s+" to playlist"); |
1318 | // numberofentries=2 | 1318 | // numberofentries=2 |
1319 | // File1=http | 1319 | // File1=http |
1320 | // Title | 1320 | // Title |
1321 | // Length | 1321 | // Length |
1322 | // Version | 1322 | // Version |
1323 | // File2=http | 1323 | // File2=http |
1324 | 1324 | ||
1325 | s=s.replace( QRegExp("\\"),"/"); | 1325 | s=s.replace( QRegExp("\\"),"/"); |
1326 | DocLnk lnk( s ); | 1326 | DocLnk lnk( s ); |
1327 | QFileInfo f(s); | 1327 | QFileInfo f(s); |
1328 | QString name = f.baseName(); | 1328 | QString name = f.baseName(); |
1329 | if(name.left(4)=="http") | 1329 | if(name.left(4)=="http") |
1330 | name = s.right( s.length() - 7); | 1330 | name = s.right( s.length() - 7); |
1331 | else | 1331 | else |
1332 | name=s; | 1332 | name=s; |
1333 | name = name.right(name.length()-name.findRev("\\",-1,TRUE)-1); | 1333 | name = name.right(name.length()-name.findRev("\\",-1,TRUE)-1); |
1334 | // QFileInfo f(s); | 1334 | // QFileInfo f(s); |
1335 | // QString name = f.baseName(); | 1335 | // QString name = f.baseName(); |
1336 | // name = name.left(name.length()-4); | 1336 | // name = name.left(name.length()-4); |
1337 | // name = name.right(name.findRev("/",0,TRUE)); | 1337 | // name = name.right(name.findRev("/",0,TRUE)); |
1338 | lnk.setName( name); | 1338 | lnk.setName( name); |
1339 | if(s.at(s.length()-4) == '.') | 1339 | if(s.at(s.length()-4) == '.') |
1340 | lnk.setFile( s); | 1340 | lnk.setFile( s); |
1341 | else | 1341 | else { |
1342 | lnk.setFile( s+"/"); | 1342 | if( name.right(1).find('/') == -1) |
1343 | s+="/"; | ||
1344 | // if(s.right(1) != '/') | ||
1345 | lnk.setFile( s); | ||
1346 | |||
1347 | } | ||
1343 | lnk.setType("audio/x-mpegurl"); | 1348 | lnk.setType("audio/x-mpegurl"); |
1344 | 1349 | ||
1345 | qDebug("DocLnk add "+name); | 1350 | qDebug("DocLnk add "+name); |
1346 | d->selectedFiles->addToSelection( lnk); | 1351 | d->selectedFiles->addToSelection( lnk); |
1347 | } | 1352 | } |
1348 | } | 1353 | } |
1349 | i++; | 1354 | i++; |
1350 | } | 1355 | } |
1351 | } | 1356 | } |
1352 | 1357 | ||