summaryrefslogtreecommitdiff
path: root/noncore/multimedia/opieplayer2/om3u.cpp
Unidiff
Diffstat (limited to 'noncore/multimedia/opieplayer2/om3u.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/om3u.cpp17
1 files changed, 5 insertions, 12 deletions
diff --git a/noncore/multimedia/opieplayer2/om3u.cpp b/noncore/multimedia/opieplayer2/om3u.cpp
index 790fa09..f2a01d3 100644
--- a/noncore/multimedia/opieplayer2/om3u.cpp
+++ b/noncore/multimedia/opieplayer2/om3u.cpp
@@ -35,16 +35,19 @@
35#include <opie2/odebug.h> 35#include <opie2/odebug.h>
36using namespace Opie::Core; 36using namespace Opie::Core;
37 37
38//extern PlayListWidget *playList; 38//extern PlayListWidget *playList;
39 39
40Om3u::Om3u( const QString &filePath, int mode) 40Om3u::Om3u( const QString &filePath, int mode)
41 : QStringList (){ 41 : QStringList ()
42{
42odebug << "<<<<<<<new m3u "+filePath << oendl; 43odebug << "<<<<<<<new m3u "+filePath << oendl;
43 f.setName(filePath); 44 f.setName(filePath);
44 f.open(mode); 45 if (!f.open(mode)) {
46 owarn << "Unable to open file " << f.name() << oendl;
47 }
45} 48}
46 49
47Om3u::~Om3u(){} 50Om3u::~Om3u(){}
48 51
49void Om3u::readM3u() { 52void Om3u::readM3u() {
50// odebug << "<<<<<<reading m3u "+f.name() << oendl; 53// odebug << "<<<<<<reading m3u "+f.name() << oendl;
@@ -80,33 +83,24 @@ void Om3u::readPls() { //it's a pls file
80 s = t.readLine(); 83 s = t.readLine();
81 if( s.left(4) == "File" ) { 84 if( s.left(4) == "File" ) {
82 s = s.right( s.length() - s.find("=",0,true)-1 ); 85 s = s.right( s.length() - s.find("=",0,true)-1 );
83 s = s.stripWhiteSpace(); 86 s = s.stripWhiteSpace();
84 s.replace( QRegExp( "%20" )," "); 87 s.replace( QRegExp( "%20" )," ");
85// odebug << "adding " + s + " to playlist" << oendl; 88// odebug << "adding " + s + " to playlist" << oendl;
86 // numberofentries=2
87 // File1=http
88 // Title
89 // Length
90 // Version
91 // File2=http
92 s = s.replace( QRegExp( "\\" ), "/" ); 89 s = s.replace( QRegExp( "\\" ), "/" );
93 QFileInfo f( s ); 90 QFileInfo f( s );
94 QString name = f.baseName(); 91 QString name = f.baseName();
95 if( name.left( 4 ) == "http" ) { 92 if( name.left( 4 ) == "http" ) {
96 name = s.right( s.length() - 7); 93 name = s.right( s.length() - 7);
97 } else { 94 } else {
98 name = s; 95 name = s;
99 } 96 }
100 name = name.right( name.length() - name.findRev( "\\", -1, TRUE) - 1 ); 97 name = name.right( name.length() - name.findRev( "\\", -1, TRUE) - 1 );
101 if( s.at( s.length() - 4) == '.') // if this is probably a file 98 if( s.at( s.length() - 4) == '.') // if this is probably a file
102 append(s); 99 append(s);
103 else { //if its a url 100 else { //if its a url
104// if( name.right( 1 ).find( '/' ) == -1) {
105// s += "/";
106// }
107 append(s); 101 append(s);
108 } 102 }
109 } 103 }
110 } 104 }
111} 105}
112 106
@@ -117,13 +111,12 @@ void Om3u::write() { //writes list to m3u file
117 if(count()>0) { 111 if(count()>0) {
118 for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) { 112 for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) {
119// odebug << *it << oendl; 113// odebug << *it << oendl;
120 t << *it << "\n"; 114 t << *it << "\n";
121 } 115 }
122 } 116 }
123// f.close();
124} 117}
125 118
126void Om3u::add(const QString &filePath) { //adds to m3u file 119void Om3u::add(const QString &filePath) { //adds to m3u file
127 append(filePath); 120 append(filePath);
128} 121}
129 122