Linux » Diskussionen

yet another mtp scrobbler

 
  • yet another mtp scrobbler

    I've created a small py-GTK app to scrobble tracks from mtp devices (such as the Creative Zen, or the Zune) to last.fm. If you use an mtp device, please check it out and let me know how it goes. You can Love/Ban tracks before scrobbling, and also use the ratings from your device if you wish (5 stars for love, 1 star for banning).

    I'm aware delas has already created something like this, but hopefully someone finds it useful. This was mainly just a way for me to learn programming with python and gtk.

    github repository
    If you use Ubuntu, you can add my PPA

    Edit: Updated PPA link

    Bearbeitet von woodenbrick am 16. Apr. 2009, 9:10
    • it_desh schrieb...
    • Benutzer
    • 21. Mär. 2009, 10:35
    it seems to work with my ZEN, ubuntu 8.10

    thanks!

    jmD
    • kisaro schrieb...
    • Benutzer
    • 24. Mär. 2009, 15:50

    Geeez, that's SOOO cool!

    ...and worked rightouttabox. Thanksalot!
    Ooops, now King's X takes over the lead in my profile...

  • Glad it's working out for you guys, let me know if any problems occur.

    • Holzhaus schrieb...
    • Benutzer
    • 25. Mär. 2009, 21:14
    Works great, thanks a lot. But maybe you use more threading in the next version, because the GUI freezes occasionally, when the program is working. That's not really a bug and I won't start complaining about it, but if you're bored and don't know what to do with your free time, that could be an issue which is worth to focus on. :-)

    I didn't look into your code, so I'm not sure if you're familiar with threads (you mentioned, you're still learning python at the moment). If not, take a look at this.

    »When I give food to the poor, they call me a saint. When I ask why the poor have no food, they call me a communist.« — Dom Hélder Câmara
  • Funny you mention it, I started working on threading yesterday for the reasons you mentioned. Mostly its done, I'm just figuring out how to cancel a http request if last.fm isn't giving a response within a reasonable amount of time. I'll be releasing a threaded version once I'm comfortable its working correctly.
    Thanks for your feedback!

    • [Gelöschter Benutzer] schrieb...
    • Benutzer
    • 6. Apr. 2009, 13:24

    Thanks!

    Thanks a lot! This was first mtp scrobbler for linux, which worked for me without any problems. So running well on Arch Linux and with Creative Zen.

  • New Release 0.81

    I've released a new version today which includes support for tagging (accessible from the right click menu)
    If you use the PPA, please update to the new one

    • Holzhaus schrieb...
    • Benutzer
    • 19. Apr. 2009, 16:21
    I updated to the new version, but unfortunately, it seems to be broken.

    I'm always getting:
    Connecting to MTP device
    libmtp seems to be having trouble closing the session with your device and may need to be reset manually.
    Device not found.


    What exactly means »reset manually«?

    Amarok 2.1 Beta 1 has no problems with MTP and my libmtp version didn't change since I installed mtp-lastfm the first time.

    Using OpenSuSE 11.1 (x86_64), libmtp8 0.3.4-2.1 and python 2.6.0-2.21.1.

    PS: Great work anyway, thanks a lot!

    »When I give food to the poor, they call me a saint. When I ask why the poor have no food, they call me a communist.« — Dom Hélder Câmara
  • Hmm ok, poor design on my part. I was having problems with libmtp sometimes refusing to disconnect my device (creative zen), making my program freeze until it was disconnected, and also requiring me to do a hard reset on my device. So set a 15 second time limit on this, perhaps this was too low and your device takes quite a bit longer to check?

    The main problem is that the python mtp bindings are broken, and so I am using a bit of a workaround, the side effect of this is that I'm just guessing that something has gone wrong, rather than actually knowing.

    Could you try editing mtplastfm.py, line 140, change 15 to a higher value, perhaps 30? Let me know if this helps

    Edit: By the way, this is woodenbrick, I am logged into my testing account accidentally.

    • Holzhaus schrieb...
    • Benutzer
    • 20. Apr. 2009, 12:33
    Thanks for the answer.

    I changed the file:
    jan@homer:/opt/mtp-lastfm> sed -ne '139,141p' mtplastfm.py
    gtk.main_iteration()
    if time.time() - start_time > 30:
    self.write_info(_("libmtp seems to be having trouble closing the session with your device and may need to be reset manually."))


    But unfortunately, it still doesn't work. This is, what the tools prints out on the console:
    jan@homer:/opt/mtp-lastfm> ./mtp-lastfm
    /opt/mtp-lastfm/mtplastfm.py:21: DeprecationWarning: the md5 module is deprecated; use hashlib instead
    import md5
    /opt/mtp-lastfm/mtplastfm.py:76: GtkWarning: GModule (/usr/lib64/gtk-2.0/2.10.0/engines/libqtcurve.so) initialization check failed: Gtk+ version too old (micro mismatch)
    self.tree = gtk.glade.XML(self.GLADE['gui'])
    PTP: Opening session


    Then, the error message appears.
    If I now click the »Connect«-Button again, I get this:
    usb_claim_interface(): Device or resource busy
    LIBMTP PANIC: Unable to initialize device
    mtp-tracks: There has been an error connecting. Exit

    »When I give food to the poor, they call me a saint. When I ask why the poor have no food, they call me a communist.« — Dom Hélder Câmara
  • Apart from the depreciation warnings, the problem looks like it might be caused by another connection? Make sure your device has been disconnected in amarok, since only one connection is allowed at a time apparently.

    • Holzhaus schrieb...
    • Benutzer
    • 20. Apr. 2009, 13:38
    I already noticed that, so I always close amarok before I start mtp-lastfm, because Amarok 2 automatically »mounts« (?) MTP-devices.

    But I (or rather You) found the error: My MTP-device is actually a SonyEricsson Walkman Phone. The USB-speed of phones is usually very slow and this one is no exception, so - in combination with 8 GB of music - it needs a considerably higher amount of time to get the playcounts via MTP.
    I've changed
    if time.time() - start_time > 30:
    to
    if time.time() - start_time > 120:
    and now it works fine, so your first guess was correct. Thanks a lot!

    »When I give food to the poor, they call me a saint. When I ask why the poor have no food, they call me a communist.« — Dom Hélder Câmara
  • Hopefully sometime in the near future the python mtp bindings will be fixed so this connection isn't such a hackjob. Good that it works now, but I'll have to think of a way to improve this.

    • nash_ schrieb...
    • Benutzer
    • 26. Mai. 2009, 18:54

    yp-p2

    Hello, I have Samsung YP-P2, mtp-lastfm recognize my player and gets my played tracks well. I can ban and love tracks, etc. But when i'm going to scrobb tracks, then i have msg like this: Connecting to MTP device Done.
    It is now safe to remove your device. Cross checking song data with local database...
    794 tracks checked
    23 items were not added to your song database.
    Scrobbling started 0.0 hours ago
    Preparing 2 tracks for scrobbling
    Sending tracks, waiting for reply... OK
    Scrobbled 2 tracks
    , but i don't have this tracks on my last-fm site, what is wrong?
    version of mtp-lastfm is 0.81.3.

  • It's possible that last.fm accepts the scrobbled songs then rejects them silently for some reason, ie. if the submission time is before a previously submitted song. This may happen if you are listening to music at the same time as submitting with MTP-Lastfm.

    If this isn't the problem could you email more info? Check your ~/.mtp-lastfm directory send me mtp-dump_nash_ and errors.log if its not empty.

    email: wodemoneke@gmail.com

    • Ipeacocks schrieb...
    • Benutzer
    • 2. Jun. 2009, 17:12
    Thanks. This program is useful for me. =)

  • Thanks a ton woodenbrick, I use Ubuntu and installing and using this program was a breeze!!

    Now I am able to scrobble tracks from my Meizu M6 player successfully.

    You can as well change the title of this post to : yet another mtp scrobbler...that just works :D

  • Works for me

    Yeh. Ubuntu 9.04 include a crappy GNOME feature which forces you to unmount any mtp devices to deal with them (because they're automatically mounted with some camera related user feature deal-which did not work out quite well.)

    But after unmounting it works fine. Coolio.

    • piszi schrieb...
    • Benutzer
    • 3. Okt. 2009, 15:24

    Is it only for Linux and Ubuntu?

    Does it work on Vista? :]

  • Yes sorry, it works on Linux only because libmtp doesn't work on windows (as far as I'm aware.)

  • Can you write models of players thats work with this scrobbler , whats mean "mtp" ?
    and players with flash memory work too or only with hard drive ?

  • MTP stands for Music Transfer Protocol. You can see a list of players at the link provided. The software works with most of these but I kind of rely on people reporting to me if it doesn't work. These players definitely don't work:
    Requires authentication
    * Zune
    Doesn't track playcount
    * iRiver Clix2
    * Sony Ericsson W910i

    Everything ese you would just need to try it and see.

    • bezgubov schrieb...
    • Benutzer
    • 21. Dez. 2009, 16:14
    i have cowon iaudio7. after conect i have message Device found, but an error occurred. Please make sure it is not mounted by another program (eg. music player, desktop). but player unmounted
    what's the problem?

  • Can I ask what distro/version of linux you are running? I've been told that Ubuntu 9.10 automounts the device and keeps it mounted even after you click unmount. Try running the program in the terminal also, and post me the results.

    Edit. this is woodenbrick by the way.

    Can you also confirm for me that you are able to transfer songs to your device using a linux media player (Amarok/Rhythmbox etc.)

Anonyme Benutzer dürfen keine Beiträge schreiben. Bitte log dich ein oder registriere dich, um Beiträge in den Foren schreiben zu können.