Bug 121983 - ability to play SMIL playlists
Summary: ability to play SMIL playlists
Status: RESOLVED DUPLICATE of bug 133762
Alias: None
Product: amarok
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Debian testing Linux
: NOR wishlist
Target Milestone: ---
Assignee: Amarok Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-02-14 23:25 UTC by Matej Cepl
Modified: 2006-12-27 21:05 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
Lame attempt for the patch resolving the issue (3.05 KB, patch)
2006-02-19 04:27 UTC, Matej Cepl
Details
output of amarok 2>&1 | tee wgbh-jazz-log.txt (4.80 KB, text/plain)
2006-03-14 03:08 UTC, Matej Cepl
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Matej Cepl 2006-02-14 23:25:35 UTC
Version:            (using KDE KDE 3.5.1)
Installed from:    Debian testing/unstable Packages

I know, why RealPlayer should be hated, but unfortunately there are still too many servers which provide just that (like my beloved WGBH; I can rip out rpt:// stream out their main stream, but they have also specialized streams, which are changing daily, like http://streams.wgbh.org/blues/).

Kaffeine can do it, so I hope that it would just mean ripping off particular code from there.
Comment 1 Matej Cepl 2006-02-19 04:27:43 UTC
Created attachment 14766 [details]
Lame attempt for the patch resolving the issue

Thread for this patch is
http://comments.gmane.org/gmane.comp.kde.amarok.devel/5080
Comment 2 Matej Cepl 2006-02-27 03:13:08 UTC
Actually, the original stream is http://streams.wgbh.org/blues/blues.ram which really leads to http://streams.wgbh.org/blues/blues.smil?mode="compact"
Comment 3 Seb Ruiz 2006-03-13 14:17:39 UTC
SVN commit 518214 by seb:

Support for SMIL playlists. Needs testing.
Matej: before submitting a patch, please test that it works.
BUG: 121983


 M  +1 -0      ChangeLog  
 M  +55 -1     src/playlistloader.cpp  
 M  +3 -1      src/playlistloader.h  


--- trunk/extragear/multimedia/amarok/ChangeLog #518213:518214
@@ -5,6 +5,7 @@
 
 VERSION 1.4-beta3:
   FEATURES:
+    * Support for SMIL playlists. (BR 121983)
     * Support for WAX playlists. (BR 120980)
     * Handle the Year tag when playing AudioCDs. Patch by Markus Kaufhold
       <M.Kaufhold@gmx.de>. (BR 123428)
--- trunk/extragear/multimedia/amarok/src/playlistloader.cpp #518213:518214
@@ -3,6 +3,7 @@
 // .ram file support from Kaffeine 0.5, Copyright (C) 2004 by Jürgen Kofler (GPL 2 or later)
 // .asx file support added by Michael Seiwert Copyright (C) 2006
 // .asx file support from Kaffeine, Copyright (C) 2004-2005 by Jürgen Kofler (GPL 2 or later)
+// .smil file support from Kaffeine 0.7
 // .pls parser (C) Copyright 2005 by Michael Buesch <mbuesch@freenet.de>
 // Copyright: See COPYING file that comes with this distribution
 //
@@ -539,6 +540,7 @@
         return;
     case RAM: loadRealAudioRam( stream ); break;
     case ASX: loadASX( stream ); break;
+    case SMIL: loadSMIL( stream ); break;
     default:
         m_error = i18n( "amaroK does not support this playlist format." );
         return;
@@ -759,7 +761,7 @@
     stream.setEncoding( QTextStream::UnicodeUTF8 );
     if (!doc.setContent(stream.read(), &errorMsg, &errorLine, &errorColumn))
     {
-	kdError() << "[PLAYLISTLOADER]: Error loading xml file: " "(" << errorMsg << ")"
+        debug() << "[PLAYLISTLOADER]: Error loading xml file: " "(" << errorMsg << ")"
                 << " at line " << errorLine << ", column " << errorColumn << endl;
         return false;
     }
@@ -840,6 +842,58 @@
      return true;
 }
 
+bool
+PlaylistFile::loadSMIL( QTextStream &stream )
+{
+	// adapted from Kaffeine 0.7
+	QDomDocument doc;
+    if( !doc.setContent( stream.read() ) )
+    {
+        debug() << "Could now read smil playlist" << endl;
+        return false;
+    }   
+	QDomElement root = doc.documentElement();
+	stream.setEncoding ( QTextStream::UnicodeUTF8 );
+
+	if( root.nodeName().lower() != "smil" )
+       return false;
+
+	KURL kurl;
+	QString url;
+	QDomNodeList nodeList;
+	QDomNode node;
+	QDomElement element;
+
+	//audio sources...
+	nodeList = doc.elementsByTagName( "audio" );
+	for( uint i = 0; i < nodeList.count(); i++ )
+	{
+        MetaBundle b;   
+		node = nodeList.item(i);
+		url = QString::null;
+		if( (node.nodeName().lower() == "audio") && (node.isElement()) )
+		{
+			element = node.toElement();
+			if( element.hasAttribute("src") )
+				url = element.attribute("src");
+                
+			else if( element.hasAttribute("Src") )
+				url = element.attribute("Src");
+                
+			else if( element.hasAttribute("SRC") )
+				url = element.attribute("SRC");
+		}
+		if( !url.isNull() )
+		{
+			b.setUrl( url );
+			m_bundles += b;
+		}
+	}
+
+	return true;
+}
+
+
 /// @class RemotePlaylistFetcher
 
 #include <ktempfile.h>
--- trunk/extragear/multimedia/amarok/src/playlistloader.h #518213:518214
@@ -38,7 +38,7 @@
 public:
     PlaylistFile( const QString &path );
 
-    enum Format { M3U, PLS, XML, RAM, ASX, Unknown, NotPlaylist = Unknown };
+    enum Format { M3U, PLS, XML, RAM, SMIL, ASX, Unknown, NotPlaylist = Unknown };
 
     /// the bundles from this playlist, they only contain
     /// the information that can be extracted from the playlists
@@ -63,6 +63,7 @@
     unsigned int loadPls_extractIndex( const QString &str ) const;
     bool loadRealAudioRam( QTextStream& ); 
     bool loadASX( QTextStream& );
+    bool loadSMIL( QTextStream& );
     QString m_path;
     QString m_error;
     BundleList m_bundles;
@@ -76,6 +77,7 @@
     if( ext == "m3u" ) return M3U;
     if( ext == "pls" ) return PLS;
     if( ext == "ram" ) return RAM;
+    if( ext == "smil") return SMIL;
     if( ext == "asx" || ext == "wax" ) return ASX;
     if( ext == "xml" ) return XML;
 
Comment 4 Matej Cepl 2006-03-14 03:07:58 UTC
This doesn't work (see output of stderr when trying to open http://streams.wgbh.org/scripts/smil.php?showName=jazz).
Comment 5 Matej Cepl 2006-03-14 03:08:44 UTC
Created attachment 15100 [details]
output of amarok 2>&1 | tee wgbh-jazz-log.txt
Comment 6 Mark Kretschmann 2006-03-25 09:21:54 UTC
What's up with this report, can we close it? I thought SMIL support was implemented.
Comment 7 Matej Cepl 2006-03-25 16:57:50 UTC
As I see it, Sub tried to implement my patch (comment #3), but it didn't work (comments #5 and #6), so IMHO this bug is still alive and kicking (as my fellow Bostonian speak about lobsters :-)).
Comment 8 Matej Cepl 2006-05-03 02:55:32 UTC
Checking amarok 1.4-beta3 and this stream http://streams.wgbh.org/scripts/smil.php?showName=jazz leads to "No demux plugin available: check your installation".
Comment 9 Alexandre Oliveira 2006-12-27 21:05:12 UTC
There's nothing wrong with the smil handling code, the problem is that amarok doesn't recognize this as a playlist, a different matter.

*** This bug has been marked as a duplicate of 133762 ***