Last.fm integration

Dirk
2008-07-26
2013-05-30
1 2 3 > >> (Page 1 of 3)
  • Dirk

    Dirk - 2008-07-26

    Hi, I have written a c++ library that allows you to submit your songinfo to Last.fm.
    The interface methods that matter look like this:

    void startedPlaying(const SubmissionInfo& info);
    void pausePlaying(bool paused);
    void finishedPlaying();

    Where SubmissionInfo contains the song information(artist, title, ...).

    For testing I want to build a version of mediatomb with last.fm support. Since I'm not familiar with the code, what would be the right place to add these calls? It needs to be in place where I know songs are being started/stopped/paused and I need access to the songs Id3Info.

    Regards,
    Dirk

     
    • Mark Gillespie

      Mark Gillespie - 2008-07-26

      If you get something working, I would be more than happy to give it a fly...  Last.FM is very interesting to me...  I love the concept, but 95% of my music is played via DLNA streaming, so my profile is not representitive of what I actually listen to.  This would fix that!

       
    • Dirk

      Dirk - 2008-08-02

      Small update.

      First steps have been made for Last.fm integration. I'm currently listening to an album through mediatomb and it's being scrobbled to Last.fm :-)

      I still need to fix a number of loose ends though, I'm currently hooked somewhere in the open method in the file_request_handler class, I don't know if this is the best place to do it, but it's the best place I could find. The problem is that this method is also called for files when they need to be shown (i guess for cover art).

      Currently cleaning up my own lastfm library for release.

       
    • Mark Gillespie

      Mark Gillespie - 2008-08-31

      Any news on this?  This is number one in my personal wishlist, and may be the reason I move to MediaTomb as my primary Linux mediaserver....

       
    • Jin

      Jin - 2008-09-02

      Sorry for the late repsonse, I guess I simply missed this post.

      I think that file request handler would indeed be the right place, allthough I'd have to have another look how that would work out with transcoded stuff.

      So how far is your library, did you release it already?

      Kind regards,
      Jin

       
      • Dirk

        Dirk - 2008-09-03

        Well the library is ready, but before I can release it I need to receive an Id from Last.fm so they can recognize my lib and can ban it if it behaves incorrectly. I mailed them for info but haven't got a response yet. I will trigger them again.

         
    • Dirk

      Dirk - 2008-09-07

      I just released the initial version of lastfmlib. It can be downlaoded from this website: http://code.google.com/p/lastfmlib/ . It requires curl to build.

      I added a mediatomb patch to the repository which can be found here:
      http://lastfmlib.googlecode.com/svn/trunk/mediatomb.patch
      Configure should automatically enable lastfmlib support if it is installed correctly.

      I tested the patch against the current trunk (revision 1877) using mp3s. I did not test transcoding.
      You also need to add the folowing to the config section of your mediatom config file:
      <lastfm enabled="yes">
          <username>yourUsername</username>
          <password>yourPassword</password>
      </lastfm>

      Let me know if it works.

       
    • B4tm4n

      B4tm4n - 2008-09-07

      I get an error when trying to compile lastfmlib under Tiger running on a MacBook.

      utils/condition.cpp: In member function 'bool utils::Condition::wait(utils::Mutex&, int)':
      utils/condition.cpp:35: error: 'CLOCK_REALTIME' was not declared in this scope
      utils/condition.cpp:35: error: 'clock_gettime' was not declared in this scope
      make[2]: *** [liblastfm_la-condition.lo] Error 1
      make[1]: *** [all-recursive] Error 1
      make: *** [all-recursive] Error 1

       
      • Dirk

        Dirk - 2008-09-07

        On my system CLOCK_REALTIME is defined in bits/time.h which gets included by time.h.

        You could try defining __USE_POSIX199309 before including the time.h file in condition.cpp

        Like this:

        #define __USE_POSIX199309 1
        #include <sys/time.h>

         
    • B4tm4n

      B4tm4n - 2008-09-07

      No that didn't work.
      I've uploaded my config output and make output, incase that helps.

      http://www.divshare.com/download/5324219-872

      http://www.divshare.com/download/5324220-5c2

      Cheers.

       
      • Dirk

        Dirk - 2008-09-07

        Can you post this bug here http://code.google.com/p/lastfmlib/issues/list to avoid polluting the mediatomb forums :-)

         
    • B4tm4n

      B4tm4n - 2008-09-07

      No problem.

       
    • Jin

      Jin - 2008-09-07

      Dirk, please be careful when using clock_gettime(), I had some real headache with it.

      The problem is that some embedded NAS devices do not have a realtime clock. We made the mistake of not checking the return value of clock_gettime(), as the result our timer implementation was badly misbehaving on such systems.

      After those findings we switched to gettimeofday() which seems to work reliably on all systems. So please have another look at that.

      I now got back from holidays so I will have a look at the patch this week, if all works out I'll integrate it for the next release.

      Thanks!

      Kind regards,
      Jin

       
      • Dirk

        Dirk - 2008-09-07

        Indeed, I discovered that as well today. Currently rewriting it to use gettimeofday.

         
    • B4tm4n

      B4tm4n - 2008-09-07

      I applied the patch with  patch -p0 <mediatomb.patch

      Configured and compiled as usuall and added the extra lines to my config

      <?xml version="1.0" encoding="UTF-8"?>
      <config version="1" xmlns="http://mediatomb.cc/config/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://mediatomb.cc/config/1 http://mediatomb.cc/config/1.xsd">
        <server>

          <port>49152</port>
          <ip>192.168.0.11</ip>

          <lastfm enabled="yes">

          <username>NAME</username>

          <password>PASSWORD</password>

          </lastfm>

          <ui enabled="yes" show-tooltips="yes">
            <accounts enabled="no" session-timeout="30">
              <account user="mediatomb" password="mediatomb"/>
            </accounts>
          </ui>

      But it does seem to be working.

       
    • B4tm4n

      B4tm4n - 2008-09-07

      Ignore that last post I don't think I've managed to compile MediaTomb with LastFmlib.

       
      • Dirk

        Dirk - 2008-09-07

        In the summary of ./configure it should say whether lastfm is enabled or not, also the lastm tag needs to be directly under config and under server like it seems to be in your case.

         
    • B4tm4n

      B4tm4n - 2008-09-07

      Can't compile Mediatomb with Lastfm support.

      part of the configure output

      checking for clock_gettime in -lrt... no
      checking for clock_gettime in -lrt... no
      checking for clock_gettime... no
      ....
      checking lastfmlib/lastfmscrobbler.h usability... no
      checking lastfmlib/lastfmscrobbler.h presence... no
      checking for lastfmlib/lastfmscrobbler.h... no
      checking /opt/local/include/lastfmlib/lastfmscrobbler.h usability... no
      checking /opt/local/include/lastfmlib/lastfmscrobbler.h presence... no
      checking for /opt/local/include/lastfmlib/lastfmscrobbler.h... no
      .......
      CONFIGURATION SUMMARY ----

      sqlite3               : yes
      mysql                 : disabled
      libjs                 : yes
      libmagic              : yes
      inotify               : missing
      libexif               : yes
      id3lib                : disabled
      taglib                : yes
      libmp4v2              : yes
      ffmpeg                : yes
      ffmpegthumbnailer     : yes
      external transcoding  : yes
      curl                  : yes
      YouTube               : yes
      SopCast               : disabled
      libextractor          : disabled
      db-autocreate         : yes
      lastfm                : missing

      I've checked and lastfmscrobbler.h has installed in opt/local/include/lastfmlib/

      Cheers

       
      • Dirk

        Dirk - 2008-09-07

        try configuring lastfmlib like this ./configure --prefix=/usr (assuming all your other inlcudes are located in /usr/include)

         
      • Mark Gillespie

        Mark Gillespie - 2008-09-08

        I'm running Gentoo, and using the lastfmlib "make install".  It's put everything here:

        /usr/local/lib/pkgconfig/lastfmlib.pc
        /usr/local/lib/liblastfm.la
        /usr/local/lib/liblastfm.so
        /usr/local/lib/liblastfm.a
        /usr/local/lib/liblastfm.so.1.0.0
        /usr/local/lib/liblastfm.so.1
        /usr/local/include/lastfmlib
        /usr/local/include/lastfmlib/urlclient.h
        /usr/local/include/lastfmlib/log.h
        /usr/local/include/lastfmlib/lastfmclient.h
        /usr/local/include/lastfmlib/mutex.h
        /usr/local/include/lastfmlib/condition.h
        /usr/local/include/lastfmlib/submissioninfo.h
        /usr/local/include/lastfmlib/submissioninfocollection.h
        /usr/local/include/lastfmlib/lastfmexceptions.h
        /usr/local/include/lastfmlib/lastfmscrobbler.h
        /usr/local/include/lastfmlib/thread.h
        /usr/local/include/lastfmlib/scopedlock.h
        /usr/local/include/lastfmlib/nowplayinginfo.h

         
        • Mark Gillespie

          Mark Gillespie - 2008-09-08

          Having the same problem.  Lastfmlib built and installed correctly, but Mediatomb ./configure script cannot find it :-(

          CONFIGURATION SUMMARY ----

          sqlite3               : yes
          mysql                 : yes
          libjs                 : yes
          libmagic              : yes
          inotify               : yes
          libexif               : yes
          id3lib                : disabled
          taglib                : yes
          libmp4v2              : yes
          ffmpeg                : yes
          ffmpegthumbnailer     : missing
          external transcoding  : yes
          curl                  : yes
          YouTube               : yes
          SopCast               : disabled
          libextractor          : disabled
          db-autocreate         : yes
          lastfm                : missing

           
          • Dirk

            Dirk - 2008-09-08

            I'm also running gentoo. I don't know what I did but it just works over here. This evening I'll try to remove all existing files and start from scratch and see what happens.

             
    • B4tm4n

      B4tm4n - 2008-09-07

      I tried that first and then --prefix=/sw and then --prefix=/opt/local, they're the three locations of my includes.

       
    • B4tm4n

      B4tm4n - 2008-09-07

      I've tried using --with-lastfmlib-libs= --with-lastfmlib-h= pointing to the libs and headers, but no luck.
      How do I know lastfmlib compiled correctly ? Can I test it somehow ?

       
      • Dirk

        Dirk - 2008-09-07

        you can compile lastfmlib with the unittests enabled ./conifgure --enable-unittests (this requires unitest++)

        then you can type make check and run the testrunner in the lastfmlib/unittest directory. There is still a small threading issue in the asynchronous tests, but they should pass most of the time.

         
1 2 3 > >> (Page 1 of 3)

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks