Diffstat (limited to 'core/multimedia/opieplayer/playlistwidget.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.cpp | 332 |
1 files changed, 231 insertions, 101 deletions
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp index c0a0029..146dbb6 100644 --- a/core/multimedia/opieplayer/playlistwidget.cpp +++ b/core/multimedia/opieplayer/playlistwidget.cpp | |||
@@ -17,25 +17,30 @@ | |||
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | // code added by L. J. Potter Sat 03-02-2002 06:17:54 | 20 | // code added by L. J. Potter Sat 03-02-2002 06:17:54 |
21 | #define QTOPIA_INTERNAL_FSLP | 21 | #define QTOPIA_INTERNAL_FSLP |
22 | 22 | ||
23 | #include "playlistselection.h" | 23 | #include "playlistselection.h" |
24 | #include "playlistwidget.h" | 24 | #include "playlistwidget.h" |
25 | #include "mediaplayerstate.h" | 25 | #include "mediaplayerstate.h" |
26 | #include "inputDialog.h" | 26 | #include "inputDialog.h" |
27 | #include "audiowidget.h" | 27 | #include "audiowidget.h" |
28 | #include "videowidget.h" | 28 | #include "videowidget.h" |
29 | #include "rssparser.h" | ||
29 | 30 | ||
31 | #include <qpe/process.h> | ||
32 | |||
33 | #include <qvector.h> | ||
34 | #include <qxml.h> | ||
30 | /* OPIE */ | 35 | /* OPIE */ |
31 | #include <qpe/qpeapplication.h> | 36 | #include <qpe/qpeapplication.h> |
32 | #include <qpe/qpemenubar.h> | 37 | #include <qpe/qpemenubar.h> |
33 | #include <qpe/lnkproperties.h> | 38 | #include <qpe/lnkproperties.h> |
34 | #include <opie2/odebug.h> | 39 | #include <opie2/odebug.h> |
35 | #include <opie2/oresource.h> | 40 | #include <opie2/oresource.h> |
36 | 41 | ||
37 | /* QT */ | 42 | /* QT */ |
38 | #include <qtoolbar.h> | 43 | #include <qtoolbar.h> |
39 | #include <qaction.h> | 44 | #include <qaction.h> |
40 | #include <qlayout.h> | 45 | #include <qlayout.h> |
41 | #include <qmessagebox.h> | 46 | #include <qmessagebox.h> |
@@ -481,25 +486,25 @@ void PlayListWidget::addAllVideoToList() { | |||
481 | writeCurrentM3u(); | 486 | writeCurrentM3u(); |
482 | d->selectedFiles->first(); | 487 | d->selectedFiles->first(); |
483 | } | 488 | } |
484 | 489 | ||
485 | 490 | ||
486 | void PlayListWidget::setDocument(const QString& fileref) { | 491 | void PlayListWidget::setDocument(const QString& fileref) { |
487 | fromSetDocument = true; | 492 | fromSetDocument = true; |
488 | d->setDocumentUsed = TRUE; | 493 | d->setDocumentUsed = TRUE; |
489 | setDocumentEx(fileref); | 494 | setDocumentEx(fileref); |
490 | } | 495 | } |
491 | 496 | ||
492 | void PlayListWidget::setDocumentEx(const QString& fileref) { | 497 | void PlayListWidget::setDocumentEx(const QString& fileref) { |
493 | odebug << "opieplayer receive "+fileref << oendl; | 498 | owarn << "opieplayer receive "+fileref << oendl; |
494 | clearList(); | 499 | clearList(); |
495 | DocLnk lnk; | 500 | DocLnk lnk; |
496 | QFileInfo fileInfo(fileref); | 501 | QFileInfo fileInfo(fileref); |
497 | if ( !fileInfo.exists() ) { | 502 | if ( !fileInfo.exists() ) { |
498 | QMessageBox::critical( 0, tr( "Invalid File" ), | 503 | QMessageBox::critical( 0, tr( "Invalid File" ), |
499 | tr( "There was a problem in getting the file." ) ); | 504 | tr( "There was a problem in getting the file." ) ); |
500 | return; | 505 | return; |
501 | } | 506 | } |
502 | // odebug << "<<<<<<<<<<<<<<<<<<<<<<setDocument "+fileref << oendl; | 507 | // odebug << "<<<<<<<<<<<<<<<<<<<<<<setDocument "+fileref << oendl; |
503 | QString extension = fileInfo.extension(false); | 508 | QString extension = fileInfo.extension(false); |
504 | if( extension.find( "m3u", 0, false) != -1) { //is m3u | 509 | if( extension.find( "m3u", 0, false) != -1) { //is m3u |
505 | readm3u( fileref); | 510 | readm3u( fileref); |
@@ -1054,151 +1059,62 @@ void PlayListWidget::openFile() { | |||
1054 | 1059 | ||
1055 | QString m3uFile; | 1060 | QString m3uFile; |
1056 | m3uFile = filename; | 1061 | m3uFile = filename; |
1057 | if(filename.left(4) == "http") { | 1062 | if(filename.left(4) == "http") { |
1058 | if(filename.find(":",8,TRUE) != -1) { //found a port | 1063 | if(filename.find(":",8,TRUE) != -1) { //found a port |
1059 | 1064 | ||
1060 | m3uFile = filename; | 1065 | m3uFile = filename; |
1061 | if( m3uFile.right( 1 ).find( '/' ) == -1) { | 1066 | if( m3uFile.right( 1 ).find( '/' ) == -1) { |
1062 | m3uFile += "/"; | 1067 | m3uFile += "/"; |
1063 | } | 1068 | } |
1064 | filename = m3uFile; | 1069 | filename = m3uFile; |
1065 | } | 1070 | } |
1071 | if( filename.right(3) == "xml" || | ||
1072 | filename.find("rss" ) !=-1) | ||
1073 | { | ||
1074 | // readpodcast(filename ); | ||
1075 | downloadPodcast(filename); | ||
1076 | } else { | ||
1066 | lnk.setName( m3uFile ); //sets name | 1077 | lnk.setName( m3uFile ); //sets name |
1067 | lnk.setFile( filename ); //sets file name | 1078 | lnk.setFile( filename ); //sets file name |
1068 | lnk.setIcon("opieplayer2/musicfile"); | 1079 | lnk.setIcon("opieplayer2/musicfile"); |
1069 | d->selectedFiles->addToSelection( lnk ); | 1080 | d->selectedFiles->addToSelection( lnk ); |
1070 | writeCurrentM3u(); | 1081 | writeCurrentM3u(); |
1071 | } | 1082 | } |
1083 | } | ||
1072 | else if( filename.right( 3) == "m3u" ) { | 1084 | else if( filename.right( 3) == "m3u" ) { |
1073 | readm3u( filename ); | 1085 | readm3u( filename ); |
1074 | 1086 | ||
1075 | } else if( filename.right(3) == "pls" ) { | 1087 | } else if( filename.right(3) == "pls" ) { |
1076 | readPls( filename ); | 1088 | readPls( filename ); |
1089 | } else if( filename.right(3) == "xml" || | ||
1090 | filename.find("rss" ) !=-1 | ||
1091 | ) { | ||
1092 | readpodcast( filename ); | ||
1077 | } else { | 1093 | } else { |
1078 | lnk.setName( fullBaseName ( QFileInfo(filename)) ); //sets name | 1094 | lnk.setName( fullBaseName ( QFileInfo(filename)) ); //sets name |
1079 | lnk.setFile( filename ); //sets file name | 1095 | lnk.setFile( filename ); //sets file name |
1080 | d->selectedFiles->addToSelection( lnk); | 1096 | d->selectedFiles->addToSelection( lnk); |
1081 | lnk.removeLinkFile(); | 1097 | lnk.removeLinkFile(); |
1082 | writeCurrentM3u(); | 1098 | writeCurrentM3u(); |
1083 | } | 1099 | } |
1084 | } | 1100 | } |
1085 | 1101 | ||
1086 | if( fileDlg ) { | 1102 | if( fileDlg ) { |
1087 | delete fileDlg; | 1103 | delete fileDlg; |
1088 | } | 1104 | } |
1089 | } | 1105 | } |
1090 | 1106 | ||
1091 | 1107 | ||
1092 | /* | 1108 | /* |
1093 | reads m3u and shows files/urls to playlist widget */ | ||
1094 | void PlayListWidget::readm3u( const QString &filename ) { | ||
1095 | // odebug << "read m3u filename " + filename << oendl; | ||
1096 | |||
1097 | Om3u *m3uList; | ||
1098 | QString s, name; | ||
1099 | m3uList = new Om3u( filename, IO_ReadOnly ); | ||
1100 | m3uList->readM3u(); | ||
1101 | DocLnk lnk; | ||
1102 | for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { | ||
1103 | s = *it; | ||
1104 | // odebug << "reading "+ s << oendl; | ||
1105 | if(s.left(4)=="http") { | ||
1106 | lnk.setName( s ); //sets file name | ||
1107 | lnk.setIcon("opieplayer2/musicfile"); | ||
1108 | |||
1109 | // if(s.right(4) != '.' || s.right(5) != '.') | ||
1110 | if(s.right(4) != '.' || s.right(5) != '.' ) | ||
1111 | if( s.right(1) != "/") | ||
1112 | lnk.setFile( s+"/"); //if url with no extension | ||
1113 | else | ||
1114 | lnk.setFile( s ); //sets file name | ||
1115 | |||
1116 | } else { | ||
1117 | // if( QFileInfo( s ).exists() ) { | ||
1118 | lnk.setName( fullBaseName ( QFileInfo(s))); | ||
1119 | // if(s.right(4) == '.') {//if regular file | ||
1120 | if(s.left(1) != "/") { | ||
1121 | // odebug << "set link "+QFileInfo(filename).dirPath()+"/"+s << oendl; | ||
1122 | lnk.setFile( QFileInfo(filename).dirPath()+"/"+s); | ||
1123 | lnk.setIcon("SoundPlayer"); | ||
1124 | } else { | ||
1125 | // odebug << "set link2 "+s << oendl; | ||
1126 | lnk.setFile( s); | ||
1127 | lnk.setIcon("SoundPlayer"); | ||
1128 | } | ||
1129 | } | ||
1130 | d->selectedFiles->addToSelection( lnk ); | ||
1131 | } | ||
1132 | Config config( "OpiePlayer" ); | ||
1133 | config.setGroup( "PlayList" ); | ||
1134 | |||
1135 | config.writeEntry("CurrentPlaylist",filename); | ||
1136 | config.write(); | ||
1137 | currentPlayList=filename; | ||
1138 | |||
1139 | // m3uList->write(); | ||
1140 | m3uList->close(); | ||
1141 | if(m3uList) delete m3uList; | ||
1142 | |||
1143 | d->selectedFiles->setSelectedItem( s); | ||
1144 | setCaption(tr("OpiePlayer: ")+ fullBaseName ( QFileInfo(filename))); | ||
1145 | |||
1146 | } | ||
1147 | |||
1148 | /* | ||
1149 | reads pls and adds files/urls to playlist */ | ||
1150 | void PlayListWidget::readPls( const QString &filename ) { | ||
1151 | |||
1152 | // odebug << "pls filename is " + filename << oendl; | ||
1153 | Om3u *m3uList; | ||
1154 | QString s, name; | ||
1155 | m3uList = new Om3u( filename, IO_ReadOnly ); | ||
1156 | m3uList->readPls(); | ||
1157 | |||
1158 | for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { | ||
1159 | s = *it; | ||
1160 | // s.replace( QRegExp( "%20" )," " ); | ||
1161 | DocLnk lnk( s ); | ||
1162 | QFileInfo f( s ); | ||
1163 | QString name = fullBaseName ( f); | ||
1164 | |||
1165 | if( name.left( 4 ) == "http" ) { | ||
1166 | name = s.right( s.length() - 7); | ||
1167 | } else { | ||
1168 | name = s; | ||
1169 | } | ||
1170 | |||
1171 | name = name.right( name.length() - name.findRev( "\\", -1, TRUE) - 1 ); | ||
1172 | |||
1173 | lnk.setName( name ); | ||
1174 | if( s.at( s.length() - 4) == '.') {// if this is probably a file | ||
1175 | lnk.setFile( s ); | ||
1176 | } else { //if its a url | ||
1177 | if( name.right( 1 ).find( '/' ) == -1) { | ||
1178 | s += "/"; | ||
1179 | } | ||
1180 | lnk.setFile( s ); | ||
1181 | } | ||
1182 | lnk.setType( "audio/x-mpegurl" ); | ||
1183 | |||
1184 | lnk.writeLink(); | ||
1185 | d->selectedFiles->addToSelection( lnk ); | ||
1186 | } | ||
1187 | |||
1188 | m3uList->close(); | ||
1189 | if(m3uList) delete m3uList; | ||
1190 | } | ||
1191 | |||
1192 | /* | ||
1193 | writes current playlist to current m3u file */ | 1109 | writes current playlist to current m3u file */ |
1194 | void PlayListWidget::writeCurrentM3u() { | 1110 | void PlayListWidget::writeCurrentM3u() { |
1195 | // odebug << "writing to current m3u" << oendl; | 1111 | // odebug << "writing to current m3u" << oendl; |
1196 | Config cfg( "OpiePlayer" ); | 1112 | Config cfg( "OpiePlayer" ); |
1197 | cfg.setGroup("PlayList"); | 1113 | cfg.setGroup("PlayList"); |
1198 | currentPlayList = cfg.readEntry("CurrentPlaylist",""); | 1114 | currentPlayList = cfg.readEntry("CurrentPlaylist",""); |
1199 | Om3u *m3uList; | 1115 | Om3u *m3uList; |
1200 | m3uList = new Om3u( currentPlayList, IO_ReadWrite | IO_Truncate ); | 1116 | m3uList = new Om3u( currentPlayList, IO_ReadWrite | IO_Truncate ); |
1201 | 1117 | ||
1202 | if( d->selectedFiles->first()) { | 1118 | if( d->selectedFiles->first()) { |
1203 | do { | 1119 | do { |
1204 | // odebug << "writeCurrentM3u " +d->selectedFiles->current()->file() << oendl; | 1120 | // odebug << "writeCurrentM3u " +d->selectedFiles->current()->file() << oendl; |
@@ -1453,12 +1369,226 @@ void PlayListWidget::qcopReceive(const QCString &msg, const QByteArray &data) { | |||
1453 | QFileInfo fileInfo(file); | 1369 | QFileInfo fileInfo(file); |
1454 | DocLnk lnk; | 1370 | DocLnk lnk; |
1455 | lnk.setName( fileInfo.baseName() ); //sets name | 1371 | lnk.setName( fileInfo.baseName() ); //sets name |
1456 | lnk.setFile( file ); //sets file name | 1372 | lnk.setFile( file ); //sets file name |
1457 | addToSelection( lnk ); | 1373 | addToSelection( lnk ); |
1458 | } else if ( msg == "rem(QString)" ) { //remove from playlist | 1374 | } else if ( msg == "rem(QString)" ) { //remove from playlist |
1459 | QString file; | 1375 | QString file; |
1460 | stream >> file; | 1376 | stream >> file; |
1461 | } else if ( msg == "setDocument(QString)" ) { //loop or not loop | 1377 | } else if ( msg == "setDocument(QString)" ) { //loop or not loop |
1462 | QCopEnvelope h("QPE/Application/opieplayer", "raise()"); | 1378 | QCopEnvelope h("QPE/Application/opieplayer", "raise()"); |
1463 | } | 1379 | } |
1464 | } | 1380 | } |
1381 | |||
1382 | /* | ||
1383 | reads m3u and shows files/urls to playlist widget */ | ||
1384 | void PlayListWidget::readm3u( const QString &filename ) { | ||
1385 | // odebug << "read m3u filename " + filename << oendl; | ||
1386 | |||
1387 | Om3u *m3uList; | ||
1388 | QString s, name; | ||
1389 | m3uList = new Om3u( filename, IO_ReadOnly ); | ||
1390 | m3uList->readM3u(); | ||
1391 | DocLnk lnk; | ||
1392 | for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { | ||
1393 | s = *it; | ||
1394 | // odebug << "reading "+ s << oendl; | ||
1395 | if(s.left(4)=="http") { | ||
1396 | lnk.setName( s ); //sets file name | ||
1397 | lnk.setIcon("opieplayer2/musicfile"); | ||
1398 | |||
1399 | // if(s.right(4) != '.' || s.right(5) != '.') | ||
1400 | if(s.right(4) != '.' || s.right(5) != '.' ) | ||
1401 | if( s.right(1) != "/") | ||
1402 | lnk.setFile( s+"/"); //if url with no extension | ||
1403 | else | ||
1404 | lnk.setFile( s ); //sets file name | ||
1405 | |||
1406 | } else { | ||
1407 | // if( QFileInfo( s ).exists() ) { | ||
1408 | lnk.setName( fullBaseName ( QFileInfo(s))); | ||
1409 | // if(s.right(4) == '.') {//if regular file | ||
1410 | if(s.left(1) != "/") { | ||
1411 | // odebug << "set link "+QFileInfo(filename).dirPath()+"/"+s << oendl; | ||
1412 | lnk.setFile( QFileInfo(filename).dirPath()+"/"+s); | ||
1413 | lnk.setIcon("SoundPlayer"); | ||
1414 | } else { | ||
1415 | // odebug << "set link2 "+s << oendl; | ||
1416 | lnk.setFile( s); | ||
1417 | lnk.setIcon("SoundPlayer"); | ||
1418 | } | ||
1419 | } | ||
1420 | d->selectedFiles->addToSelection( lnk ); | ||
1421 | } | ||
1422 | Config config( "OpiePlayer" ); | ||
1423 | config.setGroup( "PlayList" ); | ||
1424 | |||
1425 | config.writeEntry("CurrentPlaylist",filename); | ||
1426 | config.write(); | ||
1427 | currentPlayList=filename; | ||
1428 | |||
1429 | // m3uList->write(); | ||
1430 | m3uList->close(); | ||
1431 | if(m3uList) delete m3uList; | ||
1432 | |||
1433 | d->selectedFiles->setSelectedItem( s); | ||
1434 | setCaption(tr("OpiePlayer: ")+ fullBaseName ( QFileInfo(filename))); | ||
1435 | |||
1436 | } | ||
1437 | |||
1438 | /* | ||
1439 | reads pls and adds files/urls to playlist */ | ||
1440 | void PlayListWidget::readPls( const QString &filename ) | ||
1441 | { | ||
1442 | // odebug << "pls filename is " + filename << oendl; | ||
1443 | Om3u *m3uList; | ||
1444 | QString s, name; | ||
1445 | m3uList = new Om3u( filename, IO_ReadOnly ); | ||
1446 | m3uList->readPls(); | ||
1447 | |||
1448 | for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { | ||
1449 | s = *it; | ||
1450 | // s.replace( QRegExp( "%20" )," " ); | ||
1451 | DocLnk lnk( s ); | ||
1452 | QFileInfo f( s ); | ||
1453 | QString name = fullBaseName ( f); | ||
1454 | |||
1455 | if( name.left( 4 ) == "http" ) { | ||
1456 | name = s.right( s.length() - 7); | ||
1457 | } else { | ||
1458 | name = s; | ||
1459 | } | ||
1460 | |||
1461 | name = name.right( name.length() - name.findRev( "\\", -1, TRUE) - 1 ); | ||
1462 | |||
1463 | lnk.setName( name ); | ||
1464 | if( s.at( s.length() - 4) == '.') {// if this is probably a file | ||
1465 | lnk.setFile( s ); | ||
1466 | } else { //if its a url | ||
1467 | if( name.right( 1 ).find( '/' ) == -1) { | ||
1468 | s += "/"; | ||
1469 | } | ||
1470 | lnk.setFile( s ); | ||
1471 | } | ||
1472 | lnk.setType( "audio/x-mpegurl" ); | ||
1473 | |||
1474 | lnk.writeLink(); | ||
1475 | d->selectedFiles->addToSelection( lnk ); | ||
1476 | } | ||
1477 | |||
1478 | m3uList->close(); | ||
1479 | if(m3uList) delete m3uList; | ||
1480 | } | ||
1481 | |||
1482 | bool PlayListWidget::readpodcast( const QString &filename ) | ||
1483 | { | ||
1484 | QStringList latestPodCast; | ||
1485 | //download url | ||
1486 | qWarning("podcast "+filename); | ||
1487 | QFileInfo info(filename); | ||
1488 | if (info.size() > 0) { | ||
1489 | bool result = false; | ||
1490 | // qWarning("parseDoc " + feedFile.name() ); | ||
1491 | QFile file(filename); | ||
1492 | QXmlInputSource source( file); | ||
1493 | QXmlSimpleReader reader; | ||
1494 | // reader.setFeature("http://xml.org/sax/features/namespaces", true); | ||
1495 | // reader.setFeature("http://xml.org/sax/features/namespace-prefixes", true); | ||
1496 | // reader.setFeature("http://trolltech.com/xml/features/report-whitespace-only-CharData", false); | ||
1497 | |||
1498 | reader.setContentHandler( &rssHandler); | ||
1499 | reader.setErrorHandler( &rssHandler); | ||
1500 | result = reader.parse( source); | ||
1501 | if (!result) { | ||
1502 | QMessageBox::critical(0, "Error", tr("<p>Error unable to parse file.</p>")); | ||
1503 | // qWarning("Error unable to parse file\n%s", handler.errorMessage.local8Bit().data()); | ||
1504 | return false; | ||
1505 | } else { | ||
1506 | int size = rssHandler.getItems().size(); | ||
1507 | qWarning( rssHandler.getChannelInfo().join("\n")); | ||
1508 | |||
1509 | for(int i = 0; i < size; i++) { | ||
1510 | QList<QStringList> attributesList = rssHandler.getItems().at(i)->attributes; | ||
1511 | QStringList *sList; | ||
1512 | QStringList attList; | ||
1513 | for(sList = attributesList.first(); sList !=0; sList = attributesList.next()) { | ||
1514 | for( QStringList::Iterator it = sList->begin(); it != sList->end(); ++it ) { | ||
1515 | attList << (*it); | ||
1516 | } | ||
1517 | if(i == 0) { //this assumes that the latest is the first | ||
1518 | latestPodCast << attList[2]; //this is our mp3 url | ||
1519 | latestPodCast << rssHandler.getItems().at(i)->title; | ||
1520 | latestPodCast << rssHandler.getItems().at(i)->description; | ||
1521 | latestPodCast << rssHandler.getItems().at(i)->pubdate; | ||
1522 | } | ||
1523 | } | ||
1524 | } | ||
1525 | QString s = latestPodCast[0]; //this is our mp3 url | ||
1526 | |||
1527 | // http://www.davesipaq.com/podcast.xml | ||
1528 | DocLnk lnk( s ); | ||
1529 | QFileInfo f( s ); | ||
1530 | QString name = fullBaseName ( f); | ||
1531 | |||
1532 | if( name.left( 4 ) == "http" ) { | ||
1533 | name = s.right( s.length() - 7); | ||
1534 | } else { | ||
1535 | name = s; | ||
1536 | } | ||
1537 | |||
1538 | name = name.right( name.length() - name.findRev( "\\", -1, TRUE) - 1 ); | ||
1539 | |||
1540 | lnk.setName( name ); | ||
1541 | if( s.at( s.length() - 4) == '.') {// if this is probably a file | ||
1542 | lnk.setFile( s ); | ||
1543 | } else { //if its a url | ||
1544 | if( name.right( 1 ).find( '/' ) == -1) { | ||
1545 | s += "/"; | ||
1546 | } | ||
1547 | lnk.setFile( s ); | ||
1548 | } | ||
1549 | lnk.setType( "audio/x-mpegurl" ); | ||
1550 | |||
1551 | lnk.writeLink(); | ||
1552 | d->selectedFiles->addToSelection( lnk ); | ||
1553 | |||
1554 | } | ||
1555 | } else { | ||
1556 | QMessageBox::critical( 0, "Qtopia Rss", tr("<p>Sorry, could not find the requested document.</p>")); | ||
1557 | return false; | ||
1558 | } | ||
1559 | |||
1560 | qWarning( latestPodCast.join("\n")); | ||
1561 | |||
1562 | return true; | ||
1563 | } | ||
1564 | |||
1565 | bool PlayListWidget::downloadPodcast(const QString &url) | ||
1566 | { | ||
1567 | qWarning("download "+url); | ||
1568 | QString localFile; | ||
1569 | localFile = url; | ||
1570 | localFile = localFile.mid(7, localFile.length()-7); | ||
1571 | |||
1572 | localFile = localFile.replace(QRegExp("/"), "_"); | ||
1573 | localFile = localFile.replace(QRegExp("&"), "_"); | ||
1574 | localFile = localFile.replace(QRegExp("="), "_"); | ||
1575 | localFile = localFile.replace(QRegExp("\\?"), "_"); | ||
1576 | localFile = localFile.replace(QRegExp("@"), "_"); | ||
1577 | localFile = QDir::homeDirPath()+"/Settings/"+localFile; | ||
1578 | |||
1579 | #warning FIXME | ||
1580 | QString cmd; | ||
1581 | cmd = "wget "; | ||
1582 | cmd +=" -O "; | ||
1583 | cmd += localFile + " " + url; | ||
1584 | qWarning(cmd); | ||
1585 | system(cmd.latin1()); | ||
1586 | // Process ipkg_status(QStringList()<< "wget" <<"-O" << localFile << url ); | ||
1587 | // QString out; | ||
1588 | // bool r = ipkg_status.exec("",out); | ||
1589 | // if(r) | ||
1590 | // qWarning(out); | ||
1591 | readpodcast(localFile); | ||
1592 | return true; | ||
1593 | } | ||
1594 | |||