summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-06-16 19:23:12 (UTC)
committer llornkcor <llornkcor>2002-06-16 19:23:12 (UTC)
commit1eca76c99326afc111efeb2bf55a306a4f37eb1e (patch) (side-by-side diff)
treea46c4c7d373688300cafc254a1e0ca9de508609e
parentb1d106338eca0c28573e2fc83c63c8ed3c76a239 (diff)
downloadopie-1eca76c99326afc111efeb2bf55a306a4f37eb1e.zip
opie-1eca76c99326afc111efeb2bf55a306a4f37eb1e.tar.gz
opie-1eca76c99326afc111efeb2bf55a306a4f37eb1e.tar.bz2
lame attempt to deal with illegal urls
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/multimedia/opieplayer/playlistwidget.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp
index d7447b7..200ec16 100644
--- a/core/multimedia/opieplayer/playlistwidget.cpp
+++ b/core/multimedia/opieplayer/playlistwidget.cpp
@@ -1047,25 +1047,27 @@ void PlayListWidget::populateVideoView() {
}
}
void PlayListWidget::openFile() {
QString filename, name;
InputDialog *fileDlg;
fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0);
fileDlg->exec();
if( fileDlg->result() == 1 ) {
filename = fileDlg->LineEdit1->text();
// http://205.188.234.129:8030
// http://66.28.68.70:8000
- qDebug("Selected filename is "+filename);
+ filename.replace(QRegExp("%20")," ");
+
+ qDebug("Selected filename is "+filename);
if(filename.right(3) == "m3u")
readm3u( filename);
else if(filename.right(3) == "pls")
readPls( filename);
else {
DocLnk lnk;
lnk.setName(filename); //sets file name
if(filename.right(1) != "/" && filename.right(3) != "mp3" && filename.right(3) != "MP3")
filename += "/";
lnk.setFile(filename); //sets File property
@@ -1197,24 +1199,25 @@ void PlayListWidget::readm3u(const QString &filename) {
s=s.right(s.length()-2);
DocLnk lnk( s );
QFileInfo f(s);
QString name = f.baseName();
name = name.right(name.length()-name.findRev("\\",-1,TRUE)-1);
lnk.setName( name);
s=s.replace( QRegExp("\\"),"/");
lnk.setFile( s);
// lnk.setIcon(opieplayer/MPEGPlayer);
qDebug("add "+name);
d->selectedFiles->addToSelection( lnk);
} else { // is url
+ s.replace(QRegExp("%20")," ");
DocLnk lnk( s);
QString name = s.right( s.length() - 7);
// name = name.right(name.length()-name.findRev("\\",-1,TRUE)-1);
lnk.setName(name);
lnk.setFile( s+"/");
// lnk.setFile( filename);
// lnk.setComment( s+"/");
lnk.setType("audio/x-mpegurl");
// lnk.setIcon( "opieplayer/MPEGPlayer");
// qDebug("add "+s);
d->selectedFiles->addToSelection( lnk);
}
@@ -1233,24 +1236,25 @@ void PlayListWidget::readPls(const QString &filename) {
qDebug("pls filename is "+filename);
QFile f(filename);
if(f.open(IO_ReadOnly)) {
QTextStream t(&f);
QString s;//, first, second;
int i=0;
while ( !t.atEnd()) {
s=t.readLine();
if(s.left(4) == "File") {
s=s.right(s.length() - 6);
+ s.replace(QRegExp("%20")," ");
qDebug("adding "+s+" to playlist");
// numberofentries=2
// File1=http
// Title
// Length
// Version
// File2=http
s=s.replace( QRegExp("\\"),"/");
// Lview->insertLine(t.readLine(),-1);
// s=t.readLine();
// s=s.right(s.length()-2);