Last.Fm scrobbling support

Discuss third-party additions, plugins and translations for PS3 Media Server

Last.Fm scrobbling support

Postby abhijeet » Sun Feb 22, 2009 9:12 pm

First of all, I love this software. It has unlocked the potential of my PS3 beyond my wildest dreams.

One feature that would make me abandon every other media player I use would be Last.fm scrobbling support. I really like the sound quality that the PS3 optical output provides. With support for scrobbling, I can stop using other media players altogether.

The server also does a great job of transcoding audio and reading metadata from audio files. My thanks for that too :)
abhijeet
 
Posts: 14
Joined: Sun Feb 15, 2009 5:33 am

Re: Last.Fm scrobbling support

Postby soumis » Sun Feb 22, 2009 10:06 pm

I second that
soumis
 
Posts: 3
Joined: Sun Feb 22, 2009 10:03 pm

Re: Last.Fm scrobbling support

Postby UrbanCoyote » Sun Feb 22, 2009 11:12 pm

It would be nice but only if you could do playlists somehow I think.
UrbanCoyote
 
Posts: 4
Joined: Mon Jan 26, 2009 2:04 am

Re: Last.Fm scrobbling support

Postby abhijeet » Thu Feb 26, 2009 12:01 pm

Using version 1.04, I can see all my m3u playlist files in the menus and they work fine too.
abhijeet
 
Posts: 14
Joined: Sun Feb 15, 2009 5:33 am

Re: Last.Fm scrobbling support

Postby otmanix » Sun Mar 01, 2009 2:26 pm

full agree! scrobbling would be a great feature
I provide NO application support via PM, so please post your question to the forum.
PS3 Media Server related articles on my blog: http://otmanix.de/?cat=11&lang=en
User avatar
otmanix
 
Posts: 528
Joined: Fri Jan 30, 2009 12:40 am
Location: Bavaria, Germany

Re: Last.Fm scrobbling support

Postby Phate666 » Thu Apr 09, 2009 3:25 pm

Hi Everyone!
The last weeks I started to code a experimental last.fm support for pms. I used this library http://code.google.com/p/lastfm-java/, which is pure java, so there were no problems including it.
This is what is working so far:
    -Scrobble all audio files with pms including "Now-Playing" feature
    -View last.fm weekly and overall charts through folders in medialibrary
    -Basic support for playing radio (including scrobble)
    -Basic configuration gui
If any of the devs wants to include this in the pms sourcecode I can send an email with the (patched) "lastfm.java.jar" and the patch to the pms source.
Phate666
 
Posts: 12
Joined: Wed Mar 04, 2009 8:34 pm

Re: Last.Fm scrobbling support

Postby shagrath » Thu Apr 09, 2009 7:51 pm

very interesting :)
how did you proceed ? to plug a module with sound output isn't so easy with the massive doc and comments left in the project (mode irony on ;) )
shagrath
Project Lead
 
Posts: 2668
Joined: Wed Jan 14, 2009 1:39 pm

Re: Last.Fm scrobbling support

Postby Phate666 » Thu Apr 09, 2009 8:27 pm

I didnt write a new module, I just added some code in DLNAResource.java method "public InputStream getInputStream(...)" before
Code: Select all
externalProcess = player.launchTranscode(getSystemName(), media, params);
to "start" the scrobble process (Basicly just saves the time when play starts and the mediainfo of the track). To notice when the track has finished playing I added code to ProcessWrapperImpl.java.


Code: Select all
Index: net/pms/dlna/DLNAResource.java
===================================================================
--- net/pms/dlna/DLNAResource.java   (Revision 325)
+++ net/pms/dlna/DLNAResource.java   (Arbeitskopie)
@@ -40,6 +40,8 @@
 import net.pms.formats.Format;

 import net.pms.io.OutputParams;

 import net.pms.io.ProcessWrapper;

+import net.pms.lastfm.LastFMScrobbler;

+import net.pms.lastfm.TrackInfo;

 import net.pms.network.HTTPResource;

 import net.pms.util.FileUtil;

 import net.pms.util.Iso639;

@@ -786,6 +788,29 @@
          

          if (externalProcess == null || externalProcess.isDestroyed()) {

             PMS.minimal("Starting transcode/remux of " + getName());

+            if(PMS.getConfiguration().getLastFMscrobble()) {

+               try {

+                  if (ext.isAudio()) {

+                     TrackInfo info;

+                     try {

+                        if(LastFMScrobbler.isAudioFile(getName()))   { //Local audiofile

+                           info=TrackInfo.create(media.getFirstAudioTrack(),(int)media.getDurationInSeconds());

+                        }else {   //Last.fm radio stream

+                           String[] infos=getName().split("-");

+                           info=TrackInfo.create(infos[0],"",infos[1],0,LastFMScrobbler.getInstance().getDuration(getName()));

+                        }

+                        PMS.minimal(info.toString());

+                        if(PMS.getConfiguration().getLastFMscrobble())

+                           LastFMScrobbler.getInstance().startPlay(info);

+                     }catch (IllegalArgumentException e) {

+                        PMS.error("TAGs error", e);

+                     }

+                  }

+               }catch(Exception e) {

+                  PMS.error("ERROR", e);

+               }

+            }

+            

             externalProcess = player.launchTranscode(getSystemName(), media, params);

             try {

                Thread.sleep(params.waitbeforestart);




Code: Select all
Index: net/pms/io/ProcessWrapperImpl.java
===================================================================
--- net/pms/io/ProcessWrapperImpl.java   (Revision 325)
+++ net/pms/io/ProcessWrapperImpl.java   (Arbeitskopie)
@@ -26,6 +26,7 @@
 

 import net.pms.PMS;

 import net.pms.encoders.AviDemuxerInputStream;

+import net.pms.lastfm.LastFMScrobbler;

 import net.pms.util.ProcessUtil;

 

 public class ProcessWrapperImpl extends Thread implements ProcessWrapper {

@@ -180,9 +181,14 @@
 

    public void stopProcess() {

       PMS.info("Stopping process: " + this);

+      

       destroyed = true;

       if (process != null) {

          ProcessUtil.destroy(process);

+         if(! "mkfifo".equals(""+this)) {   //Ugly fix

+         PMS.debug("Play STOP");

+         LastFMScrobbler.getInstance().stopPlay();

+         }

       }

       /*if (params != null && params.attachedPipeName != null) {

          File pipe = new File(params.attachedPipeName);
Phate666
 
Posts: 12
Joined: Wed Mar 04, 2009 8:34 pm

Re: Last.Fm scrobbling support

Postby shagrath » Thu Apr 09, 2009 9:19 pm

well, with this, it seems you are playing last.fm on the computer, not the ps3 ?
shagrath
Project Lead
 
Posts: 2668
Joined: Wed Jan 14, 2009 1:39 pm

Re: Last.Fm scrobbling support

Postby Phate666 » Thu Apr 09, 2009 9:27 pm

You can either play audio files from your pc normaly on your ps3 and what you play is sent to http://www.last.fm/, or you can play for example the "Recommends radio" from last.fm, which is a normal mp3-internet-stream.
Phate666
 
Posts: 12
Joined: Wed Mar 04, 2009 8:34 pm

Next

Return to Additions and Plugins

Who is online

Users browsing this forum: No registered users and 9 guests