Bug 111983

Summary: Integrated support for last.fm streams
Product: [Applications] amarok Reporter: Sebastian Ley <ley>
Component: generalAssignee: Amarok Developers <amarok-bugs-dist>
Status: RESOLVED FIXED    
Severity: wishlist CC: felix, josx, mdhowe, neric, sadwings, von_epp
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Debian testing   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Console log from running Amarok

Description Sebastian Ley 2005-09-03 15:12:19 UTC
Version:            (using KDE KDE 3.4.1)
Installed from:    Debian testing/unstable Packages
OS:                Linux

It would be great if amarok had some integrated last.fm support to play last.fm streams and display the corresponding metadata. IIRC the webservice interface to last.fm is freely available and would make a great addition to amarok.

I don't know if such a feature is "too special" to be integrated into the main player. Maybe such usages could be added by plugins (But then, I don't know if amarok has a plugin API which is capable of realizing such a feature).
Comment 1 Alexandre Oliveira 2005-09-06 12:56:51 UTC
*** Bug 112114 has been marked as a duplicate of this bug. ***
Comment 2 Joost Yervante Damad 2005-09-18 10:21:38 UTC
*** This bug has been confirmed by popular vote. ***
Comment 3 Erlend Hamberg 2005-10-09 15:07:49 UTC
I agree. It would be really cool if one could add "Neighbour radio", "Similar to [artist] radio" and similar to the playlist.
Comment 4 Isaiah Damron 2005-12-06 01:13:19 UTC
related to bug 108364, but I see this one being implemented first.
Comment 5 Alexandre Oliveira 2006-02-09 21:12:18 UTC
*** Bug 121595 has been marked as a duplicate of this bug. ***
Comment 6 Christopher Leaver 2006-02-25 10:02:56 UTC
Created attachment 14863 [details]
Console log from running Amarok
Comment 7 Christopher Leaver 2006-02-25 10:03:45 UTC
Amaork crashes when I use the "Use external player" from last.fm radio. 
The player sets up a local server and tells you to connect to
 http://localhost:32214 (or whatever) I can add this a radio stream, no problem, add it to the playlist, but when I click play... connecting to stream source... then boom! Complete crash.

Here's the backtrace:
(gdb) bt
#0  0xb6e0e46f in QSocket::connectToHost ()
   from /usr/qt/3/lib/libqt-mt.so.3
#1  0x08191912 in KProcess::metaObject ()
#2  0x08192efe in KProcess::metaObject ()
#3  0xb6c25639 in QObject::activate_signal ()
   from /usr/qt/3/lib/libqt-mt.so.3
#4  0xb7349c1d in KNetwork::KResolver::finished ()
   from /usr/kde/3.5/lib/libkdecore.so.4
#5  0xb73481bb in KNetwork::KResolver::emitFinished ()
   from /usr/kde/3.5/lib/libkdecore.so.4
#6  0xb7348148 in KNetwork::KResolver::event ()
   from /usr/kde/3.5/lib/libkdecore.so.4
#7  0xb6bcd73c in QApplication::internalNotify ()
   from /usr/qt/3/lib/libqt-mt.so.3
#8  0xb6bccaf2 in QApplication::notify ()
---Type <return> to continue, or q <return> to quit---
   from /usr/qt/3/lib/libqt-mt.so.3
#9  0xb7213506 in KApplication::notify ()
   from /usr/kde/3.5/lib/libkdecore.so.4
#10 0xb6bce573 in QApplication::sendPostedEvents ()
   from /usr/qt/3/lib/libqt-mt.so.3
#11 0xb6bce40a in QApplication::sendPostedEvents ()
   from /usr/qt/3/lib/libqt-mt.so.3
#12 0xb6b7b52e in QEventLoop::processEvents ()
   from /usr/qt/3/lib/libqt-mt.so.3
#13 0xb6bdedf0 in QEventLoop::enterLoop ()
   from /usr/qt/3/lib/libqt-mt.so.3
#14 0xb6bdecb2 in QEventLoop::exec ()
   from /usr/qt/3/lib/libqt-mt.so.3
#15 0xb6bcd947 in QApplication::exec ()
   from /usr/qt/3/lib/libqt-mt.so.3
---Type <return> to continue, or q <return> to quit---
#16 0x081bc755 in QWizard::setFinish ()
#17 0xb627651d in __libc_start_main ()
   from /lib/libc.so.6
#18 0x0808bce1 in ?? ()
Comment 8 Mitja Kleider 2006-03-07 20:40:32 UTC
maybe this python code is helpful: 
http://vidar.gimp.org/lastfmproxy/
Comment 9 Alexandre Oliveira 2006-04-05 19:35:54 UTC
*** Bug 124968 has been marked as a duplicate of this bug. ***
Comment 10 Beau Piccart 2006-04-28 17:12:01 UTC
Hi,
It would be nice if this feature got integrated with this request:
http://bugs.kde.org/show_bug.cgi?id=84051
Comment 11 Alexandre Oliveira 2006-05-09 02:49:35 UTC
*** Bug 126970 has been marked as a duplicate of this bug. ***
Comment 12 Krisztian Vida 2006-06-18 11:13:01 UTC
Maybe the whole integration of last.fm player into amarok could be solved - with searching tags/artists etc.
Comment 13 Mitja Kleider 2006-06-19 17:24:44 UTC
here is another GPL project written in C that is handling last.fm: http://lizer.syslinx.org/shell-fm/

The sourcecode of the official player (also GPL) is available via SVN:
svn://svn.audioscrobbler.net/player/trunk

I hope this is helpful!
Comment 14 Ian Monroe 2006-06-19 18:44:30 UTC
I'm working on this right now.
Comment 15 Tenshu 2006-06-19 23:42:37 UTC
Ian this is one of the greatest news i red so far =)

If you want some beta testers please ask =)
Comment 16 Krisztian Vida 2006-06-22 00:05:19 UTC
You sure know about this 'feature', but the lastfmproxy - which is used by the lastamarok script - creates a stream http://localhost:1882/lastfm.mp3 . I've just checked http://localhost:1882/ with a web browser. It contains all the information of the track currently played, including the album cover for the track - a feature not yet solved in amarok&last.fm relationship :(
Comment 17 Seb Ruiz 2006-06-25 11:42:08 UTC
Lastfm streams are now natively handled by Amarok.

grab yourself a copy of svn to help us test!
Comment 18 Divided By 0 2006-06-25 18:00:42 UTC
So how do I use this? I tried putting it as a new radio stream but it wouldn't handle it?
Comment 19 Juan Ignacio Pumarino 2006-06-29 16:54:06 UTC
When trying to load the stream, Amarok aborts and displays two messages:

----------------------------------------------------
Error Loading Media
No suitable input plugin.
http://localhost:41612/theBeard.mp3
----------------------------------------------------
Access was denied for the URL: 
xine parameters: http://localhost:50841/theBeard.mp3
----------------------------------------------------

I tried deleting all amarok config files and had no luck. I also tried running amarok as root and is the same. My ruby scripts run OK. If I run amarok_proxy.rb from the command line I get 

AMAROK_PROXY: startup

and it waits there.

http://pastebin.ca/74254 shows a log from an amarok session. I started it, tried to play a lastfm stream and then quit (please ignore the X Error messages, I already solved it).
Comment 20 V Leher 2006-06-29 17:53:25 UTC
I added  streams with lastfm protocol (eg : lastfm://globaltags/pop) and
it seems to play well with no problems. 
Comment 21 Rafa Kortes 2006-06-30 20:29:52 UTC
With revision 556569 I have the same problem as the comment #19 from Juan Ignacio Pumarino but the filesong is lastfm.mp3.

Engine:     xine-engine
Build date: Jun 30 2006
CC version: 4.0.3 (Ubuntu 4.0.3-1ubuntu5)
KDElibs:    3.5.3
Qt:         3.3.6
TagLib:     1.4.0
Ruby:       1.9.0 (2006-04-21) [x86_64-linux]

Compiled from svn with --enable-debug=full I put the log in http://pastebin.ca/75868

I don't know if is necessary open a new bug report ¿?

Sorry for my bad English
Comment 22 Rafa Kortes 2006-07-01 17:14:45 UTC
With las revision of amarok_proxy.rb run fine, thanks for this great feature and for amarok ;)
Comment 23 Juan Ignacio Pumarino 2006-07-03 04:29:44 UTC
Still not working today (svn after 1.4.1 release)
Comment 24 Tom Chance 2006-07-22 16:19:42 UTC
I get a similar error message, using the Kubuntu packages mixed in with Dapper main:

Error Loading Media
No suitable input plugin.
http://localhost:38387/lastfm.mp3

It comes up when I try to play any of the lastfm streams :(
Comment 25 Felix Eckhofer 2006-07-22 18:04:23 UTC
You are probably trying to use last.fm with a proxy - and that won't work (bug #131137).
Comment 26 simon 2006-07-26 23:44:58 UTC
hi, 
the context menu should be restricted when playing lastfm streams to reflect the actual capabilities of amarok and keep in sync with the main navigation bar (means to grey out: pause, repeat and manage files) and maybe add skip, love, ban

greets
Comment 27 Martin Aumueller 2006-07-27 02:01:36 UTC
SVN commit 566764 by aumuell:

love, skip & ban for last.fm streams in playlist right-click menu
CCBUG: 111983


 M  +2 -0      ChangeLog  
 M  +13 -2     src/playlist.cpp  


--- trunk/extragear/multimedia/amarok/ChangeLog #566763:566764
@@ -29,6 +29,8 @@
       to iTunes, Firefly Media Server etc. (BR 100513)
 
   CHANGES:
+    * Include Skip, Love and Ban in playlist right-click menu for last.fm
+      streams.
     * Optionally finish transferring all queued tracks to media device after
       pressing disconnect button. (BR 129716)
     * It's now possible to edit scores and ratings for multiple tracks in
--- trunk/extragear/multimedia/amarok/src/playlist.cpp #566763:566764
@@ -3772,6 +3772,7 @@
     const bool isCurrent   = (item == m_currentTrack);
     const bool isPlaying   = EngineController::engine()->state() == Engine::Playing;
     const bool trackColumn = col == PlaylistItem::Track;
+    const bool isLastFm    = item->url().protocol() == "lastfm";
     const QString tagName  = columnText( col );
     const QString tag      = item->text( col );
 
@@ -3786,6 +3787,15 @@
 //     else
 //         popup.insertTitle(i18n("1 Track", "%n Selected Tracks", itemCount));
 
+    if( isLastFm )
+    {
+        KActionCollection *ac = amaroK::actionCollection();
+        if( ac->action( "ban" ) ) ac->action( "ban" )->plug( &popup );
+        if( ac->action( "love" ) ) ac->action( "love" )->plug( &popup );
+        if( ac->action( "skip" ) ) ac->action( "skip" )->plug( &popup );
+        popup.insertSeparator();
+    }
+
     popup.insertItem( SmallIconSet( amaroK::icon( "play" ) ), isCurrent && isPlaying
             ? i18n( "&Restart" )
             : i18n( "&Play" ), PLAY );
@@ -3822,8 +3832,8 @@
     }
     // End queue entry logic
 
-    if( isCurrent )
-       amaroK::actionCollection()->action( "pause" )->plug( &popup );
+    if( isCurrent && !isLastFm )
+        amaroK::actionCollection()->action( "pause" )->plug( &popup );
 
     bool afterCurrent = false;
     if(  !m_nextTracks.isEmpty() ? m_nextTracks.getLast() : m_currentTrack  )
@@ -3910,6 +3920,7 @@
     popup.setItemEnabled( BURN_MENU, item->url().isLocalFile() && K3bExporter::isAvailable() );
     popup.setItemEnabled( REMOVE, !isLocked() ); // can't remove things when playlist is locked,
     popup.setItemEnabled( DELETE, !isLocked() && item->url().isLocalFile() );
+    popup.setItemEnabled( ORGANIZE, !isLocked() && !isLastFm );
     popup.setItemEnabled( VIEW, item->url().isLocalFile() || itemCount == 1 ); // disable for CDAudio multiselection
 
     if( m_customSubmenuItem.count() > 0 )
Comment 28 Krisztian Vida 2006-07-27 07:21:57 UTC
IMHO Ctrl+K is a really bad choice as 'skip track' in last.fm support - think of Kile/Kate/etc delete line function with the same combination...
Comment 29 Martin Aumueller 2006-07-27 09:35:02 UTC
#28: Agreed: in addition this conflicts with the search playlist text input.