-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.cpp | 34 |
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 | |||
@@ -1047,46 +1047,53 @@ void PlayListWidget::populateVideoView() { | |||
1047 | } | 1047 | } |
1048 | 1048 | ||
1049 | void PlayListWidget::openFile() { | 1049 | void PlayListWidget::openFile() { |
1050 | qDebug("<<<<<<<<<OPEN File"); | 1050 | qDebug("<<<<<<<<<OPEN File"); |
1051 | QString filename, name; | 1051 | QString filename, name; |
1052 | InputDialog *fileDlg; | 1052 | InputDialog *fileDlg; |
1053 | fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); | 1053 | fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); |
1054 | fileDlg->exec(); | 1054 | fileDlg->exec(); |
1055 | if( fileDlg->result() == 1 ) { | 1055 | if( fileDlg->result() == 1 ) { |
1056 | filename = fileDlg->text(); | 1056 | filename = fileDlg->text(); |
1057 | qDebug( "Selected filename is " + filename ); | 1057 | qDebug( "Selected filename is " + filename ); |
1058 | // Om3u *m3uList; | 1058 | // Om3u *m3uList; |
1059 | DocLnk lnk; | 1059 | DocLnk lnk; |
1060 | Config cfg( "OpiePlayer" ); | 1060 | Config cfg( "OpiePlayer" ); |
1061 | cfg.setGroup("PlayList"); | 1061 | cfg.setGroup("PlayList"); |
1062 | 1062 | ||
1063 | QString m3uFile; | ||
1064 | m3uFile = filename; | ||
1063 | if(filename.left(4) == "http") { | 1065 | if(filename.left(4) == "http") { |
1064 | QString m3uFile, m3uFilePath; | ||
1065 | if(filename.find(":",8,TRUE) != -1) { //found a port | 1066 | if(filename.find(":",8,TRUE) != -1) { //found a port |
1066 | m3uFile = filename.left( filename.find( ":",8,TRUE)); | ||
1067 | m3uFile = m3uFile.right( 7); | ||
1068 | } else if(filename.left(4) == "http"){ | ||
1069 | m3uFile=filename; | ||
1070 | m3uFile = m3uFile.right( m3uFile.length() - 7); | ||
1071 | } else{ | ||
1072 | m3uFile=filename; | ||
1073 | } | ||
1074 | 1067 | ||
1075 | // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"+ m3uFile); | 1068 | // m3uFile = filename.left( filename.find( ":",8,TRUE)); |
1076 | lnk.setName( filename ); //sets name | 1069 | m3uFile = filename; |
1070 | if( m3uFile.right( 1 ).find( '/' ) == -1) { | ||
1071 | m3uFile += "/"; | ||
1072 | } | ||
1073 | filename = m3uFile; | ||
1074 | // qDebug("1 "+m3uFile); | ||
1075 | // } else if(filename.left(4) == "http"){ | ||
1076 | // m3uFile=filename; | ||
1077 | // m3uFile = m3uFile.right( m3uFile.length() - 7); | ||
1078 | // qDebug("2 "+m3uFile); | ||
1079 | // } else{ | ||
1080 | // m3uFile=filename; | ||
1081 | // qDebug("3 "+m3uFile); | ||
1082 | } | ||
1083 | lnk.setName( m3uFile ); //sets name | ||
1077 | lnk.setFile( filename ); //sets file name | 1084 | lnk.setFile( filename ); //sets file name |
1078 | lnk.setIcon("opieplayer2/musicfile"); | 1085 | lnk.setIcon("opieplayer2/musicfile"); |
1079 | d->selectedFiles->addToSelection( lnk ); | 1086 | d->selectedFiles->addToSelection( lnk ); |
1080 | writeCurrentM3u(); | 1087 | writeCurrentM3u(); |
1081 | } | 1088 | } |
1082 | else if( filename.right( 3) == "m3u" ) { | 1089 | else if( filename.right( 3) == "m3u" ) { |
1083 | readm3u( filename ); | 1090 | readm3u( filename ); |
1084 | 1091 | ||
1085 | } else if( filename.right(3) == "pls" ) { | 1092 | } else if( filename.right(3) == "pls" ) { |
1086 | readPls( filename ); | 1093 | readPls( filename ); |
1087 | } else { | 1094 | } else { |
1088 | lnk.setName( fullBaseName ( QFileInfo(filename)) ); //sets name | 1095 | lnk.setName( fullBaseName ( QFileInfo(filename)) ); //sets name |
1089 | lnk.setFile( filename ); //sets file name | 1096 | lnk.setFile( filename ); //sets file name |
1090 | d->selectedFiles->addToSelection( lnk); | 1097 | d->selectedFiles->addToSelection( lnk); |
1091 | writeCurrentM3u(); | 1098 | writeCurrentM3u(); |
1092 | } | 1099 | } |
@@ -1101,33 +1108,36 @@ void PlayListWidget::openFile() { | |||
1101 | /* | 1108 | /* |
1102 | reads m3u and shows files/urls to playlist widget */ | 1109 | reads m3u and shows files/urls to playlist widget */ |
1103 | void PlayListWidget::readm3u( const QString &filename ) { | 1110 | void PlayListWidget::readm3u( const QString &filename ) { |
1104 | qDebug( "read m3u filename " + filename ); | 1111 | qDebug( "read m3u filename " + filename ); |
1105 | 1112 | ||
1106 | Om3u *m3uList; | 1113 | Om3u *m3uList; |
1107 | QString s, name; | 1114 | QString s, name; |
1108 | m3uList = new Om3u( filename, IO_ReadOnly ); | 1115 | m3uList = new Om3u( filename, IO_ReadOnly ); |
1109 | m3uList->readM3u(); | 1116 | m3uList->readM3u(); |
1110 | DocLnk lnk; | 1117 | DocLnk lnk; |
1111 | for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { | 1118 | for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { |
1112 | s = *it; | 1119 | s = *it; |
1113 | // qDebug("reading "+ s); | 1120 | // qDebug("reading "+ s); |
1114 | if(s.left(4)=="http") { | 1121 | if(s.left(4)=="http") { |
1115 | lnk.setName( s ); //sets file name | 1122 | lnk.setName( s ); //sets file name |
1116 | lnk.setIcon("opieplayer2/musicfile"); | 1123 | lnk.setIcon("opieplayer2/musicfile"); |
1117 | if(s.right(4) != '.' || s.right(5) != '.') | 1124 | |
1125 | // if(s.right(4) != '.' || s.right(5) != '.') | ||
1126 | if(s.right(4) != '.' || s.right(5) != '.' ) | ||
1127 | if( s.right(1) != "/") | ||
1118 | lnk.setFile( s+"/"); //if url with no extension | 1128 | lnk.setFile( s+"/"); //if url with no extension |
1119 | else | 1129 | else |
1120 | lnk.setFile( s ); //sets file name | 1130 | lnk.setFile( s ); //sets file name |
1121 | 1131 | ||
1122 | } else { | 1132 | } else { |
1123 | // if( QFileInfo( s ).exists() ) { | 1133 | // if( QFileInfo( s ).exists() ) { |
1124 | lnk.setName( fullBaseName ( QFileInfo(s))); | 1134 | lnk.setName( fullBaseName ( QFileInfo(s))); |
1125 | // if(s.right(4) == '.') {//if regular file | 1135 | // if(s.right(4) == '.') {//if regular file |
1126 | if(s.left(1) != "/") { | 1136 | if(s.left(1) != "/") { |
1127 | // qDebug("set link "+QFileInfo(filename).dirPath()+"/"+s); | 1137 | // qDebug("set link "+QFileInfo(filename).dirPath()+"/"+s); |
1128 | lnk.setFile( QFileInfo(filename).dirPath()+"/"+s); | 1138 | lnk.setFile( QFileInfo(filename).dirPath()+"/"+s); |
1129 | lnk.setIcon("SoundPlayer"); | 1139 | lnk.setIcon("SoundPlayer"); |
1130 | } else { | 1140 | } else { |
1131 | // qDebug("set link2 "+s); | 1141 | // qDebug("set link2 "+s); |
1132 | lnk.setFile( s); | 1142 | lnk.setFile( s); |
1133 | lnk.setIcon("SoundPlayer"); | 1143 | lnk.setIcon("SoundPlayer"); |