summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/multimedia/opieplayer/playlistwidget.cpp50
1 files changed, 33 insertions, 17 deletions
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp
index 78c2822..930560e 100644
--- a/core/multimedia/opieplayer/playlistwidget.cpp
+++ b/core/multimedia/opieplayer/playlistwidget.cpp
@@ -436,57 +436,55 @@ void PlayListWidget::addAllToList() {
void PlayListWidget::addAllMusicToList() {
QListIterator<DocLnk> dit( files.children() );
for ( ; dit.current(); ++dit )
d->selectedFiles->addToSelection( **dit );
}
void PlayListWidget::addAllVideoToList() {
QListIterator<DocLnk> dit( vFiles.children() );
for ( ; dit.current(); ++dit )
d->selectedFiles->addToSelection( **dit );
}
void PlayListWidget::setDocument(const QString& fileref) {
qDebug(fileref);
fromSetDocument = TRUE;
if ( fileref.isNull() ) {
QMessageBox::critical( 0, tr( "Invalid File" ), tr( "There was a problem in getting the file." ) );
return;
}
// qDebug("setDocument "+fileref);
-// if(fileref.find("m3u",0,TRUE) != -1) { //is m3u
-// clearList();
-// addToSelection( DocLnk( fileref ) );
-// d->setDocumentUsed = TRUE;
-// d->selectedFiles->first();
-// qApp->processEvents();
-// }
-// else
- if(fileref.find("playlist",0,TRUE) != -1) {//is playlist
+ if(fileref.find("m3u",0,TRUE) != -1) { //is m3u
+ readm3u( fileref);
+ }
+ else if(fileref.find("pls",0,TRUE) != -1) { //is pls
+ readPls( fileref);
+ }
+ else if(fileref.find("playlist",0,TRUE) != -1) {//is playlist
clearList();
loadList(DocLnk(fileref));
d->selectedFiles->first();
} else {
clearList();
addToSelection( DocLnk( fileref ) );
d->setDocumentUsed = TRUE;
mediaPlayerState->setPlaying( FALSE );
qApp->processEvents();
mediaPlayerState->setPlaying( TRUE );
qApp->processEvents();
setCaption(tr("OpiePlayer"));
}
}
void PlayListWidget::setActiveWindow() {
// When we get raised we need to ensure that it switches views
char origView = mediaPlayerState->view();
mediaPlayerState->setView( 'l' ); // invalidate
mediaPlayerState->setView( origView ); // now switch back
}
@@ -1165,49 +1163,49 @@ void PlayListWidget::keyPressEvent( QKeyEvent *e)
void PlayListWidget::doBlank() {
qDebug("do blanking");
fd=open("/dev/fb0",O_RDWR);
if (fd != -1) {
ioctl(fd,FBIOBLANK,1);
// close(fd);
}
}
void PlayListWidget::doUnblank() {
// this crashes opieplayer with a segfault
// int fd;
// fd=open("/dev/fb0",O_RDWR);
qDebug("do unblanking");
if (fd != -1) {
ioctl(fd,FBIOBLANK,0);
close(fd);
}
QCopEnvelope h("QPE/System", "setBacklight(int)");
h <<-3;// v[1]; // -3 Force on
}
void PlayListWidget::readm3u(const QString &filename) {
- qDebug("playlist filename is "+filename);
+ qDebug("m3u filename is "+filename);
QFile f(filename);
if(f.open(IO_ReadOnly)) {
QTextStream t(&f);
QString s;//, first, second;
int i=0;
while ( !t.atEnd()) {
// Lview->insertLine(t.readLine(),-1);
s=t.readLine();
if(s.find("#",0,TRUE) == -1) {
if(s.find(" ",0,TRUE) == -1) { // not sure if this is neede since cf uses vfat
if(s.left(2) == "E:" || s.left(2) == "P:") {
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
@@ -1215,49 +1213,67 @@ void PlayListWidget::readm3u(const QString &filename) {
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);
}
i++;
}
}
}
}
}
void PlayListWidget::writem3u(const QString &filename) {
}
void PlayListWidget::readPls(const QString &filename) {
- qDebug("playlist filename is "+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()) {
+ while ( !t.atEnd()) {
+ s=t.readLine();
+ if(s.left(4) == "File") {
+ s=s.right(s.length() - 6);
+ 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);
-// DocLnk lnk( s );
+ DocLnk lnk( s );
+ QFileInfo f(s);
+ QString name = f.baseName();
+ name = name.right(name.length()-name.findRev("\\",-1,TRUE)-1);
// QFileInfo f(s);
// QString name = f.baseName();
// // name = name.left(name.length()-4);
// name = name.right(name.findRev("/",0,TRUE));
-// lnk.setName( name);
-// lnk.setFile( s);
-// qDebug("add "+name);
-// d->selectedFiles->addToSelection( lnk);
+ lnk.setName( name);
+ lnk.setFile( s+"/");
+ lnk.setType("audio/x-mpegurl");
+
+ qDebug("DocLnk add "+name);
+ d->selectedFiles->addToSelection( lnk);
+ }
}
i++;
}
}