summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/multimedia/opieplayer/playlistwidget.cpp34
1 files changed, 22 insertions, 12 deletions
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp
index 299181b..8b295b0 100644
--- a/core/multimedia/opieplayer/playlistwidget.cpp
+++ b/core/multimedia/opieplayer/playlistwidget.cpp
@@ -1051,38 +1051,45 @@ 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->text();
qDebug( "Selected filename is " + filename );
// Om3u *m3uList;
DocLnk lnk;
Config cfg( "OpiePlayer" );
cfg.setGroup("PlayList");
+ QString m3uFile;
+ m3uFile = filename;
if(filename.left(4) == "http") {
- QString m3uFile, m3uFilePath;
if(filename.find(":",8,TRUE) != -1) { //found a port
- m3uFile = filename.left( filename.find( ":",8,TRUE));
- m3uFile = m3uFile.right( 7);
- } else if(filename.left(4) == "http"){
- m3uFile=filename;
- m3uFile = m3uFile.right( m3uFile.length() - 7);
- } else{
- m3uFile=filename;
- }
-// qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"+ m3uFile);
- lnk.setName( filename ); //sets name
+// m3uFile = filename.left( filename.find( ":",8,TRUE));
+ m3uFile = filename;
+ if( m3uFile.right( 1 ).find( '/' ) == -1) {
+ m3uFile += "/";
+ }
+ filename = m3uFile;
+// qDebug("1 "+m3uFile);
+// } else if(filename.left(4) == "http"){
+// m3uFile=filename;
+// m3uFile = m3uFile.right( m3uFile.length() - 7);
+// qDebug("2 "+m3uFile);
+// } else{
+// m3uFile=filename;
+// qDebug("3 "+m3uFile);
+ }
+ lnk.setName( m3uFile ); //sets name
lnk.setFile( filename ); //sets file name
lnk.setIcon("opieplayer2/musicfile");
d->selectedFiles->addToSelection( lnk );
writeCurrentM3u();
}
else if( filename.right( 3) == "m3u" ) {
readm3u( filename );
} else if( filename.right(3) == "pls" ) {
readPls( filename );
} else {
lnk.setName( fullBaseName ( QFileInfo(filename)) ); //sets name
@@ -1105,25 +1112,28 @@ void PlayListWidget::readm3u( const QString &filename ) {
Om3u *m3uList;
QString s, name;
m3uList = new Om3u( filename, IO_ReadOnly );
m3uList->readM3u();
DocLnk lnk;
for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) {
s = *it;
// qDebug("reading "+ s);
if(s.left(4)=="http") {
lnk.setName( s ); //sets file name
lnk.setIcon("opieplayer2/musicfile");
- if(s.right(4) != '.' || s.right(5) != '.')
+
+// if(s.right(4) != '.' || s.right(5) != '.')
+ if(s.right(4) != '.' || s.right(5) != '.' )
+ if( s.right(1) != "/")
lnk.setFile( s+"/"); //if url with no extension
else
lnk.setFile( s ); //sets file name
} else {
// if( QFileInfo( s ).exists() ) {
lnk.setName( fullBaseName ( QFileInfo(s)));
// if(s.right(4) == '.') {//if regular file
if(s.left(1) != "/") {
// qDebug("set link "+QFileInfo(filename).dirPath()+"/"+s);
lnk.setFile( QFileInfo(filename).dirPath()+"/"+s);
lnk.setIcon("SoundPlayer");