summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp
index 7ada5ee..75c7332 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp
@@ -664,96 +664,98 @@ void PlayListWidget::populateAudioView() {
long size;
if( dit.current()->file().left(4) == "http" )
size=0;
else
size = QFile( dit.current()->file() ).size();
newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(),
QString::number(size ), storage, dit.current()->file());
newItem->setPixmap( 0, Resource::loadPixmap( "opieplayer2/musicfile" ) );
}
}
}
void PlayListWidget::populateVideoView() {
videoView->clear();
StorageInfo storageInfo;
const QList<FileSystem> &fs = storageInfo.fileSystems();
if(!videoScan ) {
scanForVideo();
}
QListIterator<DocLnk> Vdit( vFiles.children() );
QListIterator<FileSystem> it ( fs );
videoView->clear();
QString storage, pathName;
for ( ; Vdit.current(); ++Vdit ) {
for( ; it.current(); ++it ) {
const QString name = (*it)->name();
const QString path = (*it)->path();
if( Vdit.current()->file().find(path) != -1 ) {
storage=name;
pathName=path;
}
}
QListViewItem * newItem;
if ( QFile( Vdit.current()->file() ).exists() ) {
newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(),
QString::number( QFile( Vdit.current()->file() ).size() ),
storage, Vdit.current()->file());
newItem->setPixmap(0, Resource::loadPixmap( "opieplayer2/videofile" ) );
}
}
}
void PlayListWidget::openFile() {
+ // http://66.28.164.33:2080
+ // http://somafm.com/star0242.m3u
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");
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
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 {
d->selectedFiles->addToSelection( DocLnk(filename) );
writeCurrentM3u();
}
}
if( fileDlg ) {
delete fileDlg;
}
}
/*
@@ -814,97 +816,97 @@ reads pls and adds files/urls to playlist */
void PlayListWidget::readPls( const QString &filename ) {
qDebug( "pls filename is " + filename );
Om3u *m3uList;
QString s, name;
m3uList = new Om3u( filename, IO_ReadOnly );
m3uList->readPls();
for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) {
s = *it;
// s.replace( QRegExp( "%20" )," " );
DocLnk lnk( s );
QFileInfo f( s );
QString name = f.baseName();
if( name.left( 4 ) == "http" ) {
name = s.right( s.length() - 7);
} else {
name = s;
}
name = name.right( name.length() - name.findRev( "\\", -1, TRUE) - 1 );
lnk.setName( name );
if( s.at( s.length() - 4) == '.') {// if this is probably a file
lnk.setFile( s );
} else { //if its a url
if( name.right( 1 ).find( '/' ) == -1) {
s += "/";
}
lnk.setFile( s );
}
lnk.setType( "audio/x-mpegurl" );
lnk.writeLink();
d->selectedFiles->addToSelection( lnk );
}
m3uList->close();
if(m3uList) delete m3uList;
}
/*
writes current playlist to current m3u file */
void PlayListWidget::writeCurrentM3u() {
qDebug("writing to current m3u");
Config cfg( "OpiePlayer" );
cfg.setGroup("PlayList");
- QString currentPlaylist = cfg.readEntry("CurrentPlaylist","");
+ QString currentPlaylist = cfg.readEntry("CurrentPlaylist","default");
if( d->selectedFiles->first()) {
Om3u *m3uList;
m3uList = new Om3u( currentPlaylist, IO_ReadWrite | IO_Truncate );
do {
qDebug( "writeCurrentM3u " +d->selectedFiles->current()->file());
m3uList->add( d->selectedFiles->current()->file() );
}
while ( d->selectedFiles->next() );
qDebug( "<<<<<<<<<<<<>>>>>>>>>>>>>>>>>" );
m3uList->write();
m3uList->close();
if(m3uList) delete m3uList;
}
}
/*
writes current playlist to m3u file */
void PlayListWidget::writem3u() {
InputDialog *fileDlg;
fileDlg = new InputDialog( this, tr( "Save m3u Playlist " ), TRUE, 0);
fileDlg->exec();
QString name, filename, list;
Om3u *m3uList;
if( fileDlg->result() == 1 ) {
name = fileDlg->text();
// qDebug( filename );
if( name.left( 1) != "/" ) {
filename = QPEApplication::documentDir() + "/" + name;
}
if( name.right( 3 ) != "m3u" ) {
filename = QPEApplication::documentDir() + "/" +name+".m3u";
}
if( d->selectedFiles->first()) {
m3uList = new Om3u(filename, IO_ReadWrite);
do {
m3uList->add( d->selectedFiles->current()->file());
}
while ( d->selectedFiles->next() );
// qDebug( list );
m3uList->write();