Forum » Development Discussion

[LastFmLib.Net]Web services 1.0/2.0 and Scrobbler 1.2.1 for .Net

 
    • tburny schrieb...
    • Forum Moderator
    • 22. Jul. 2009, 21:05
    a bug with Settings.DefaultCacheDirectory occurs under windows 7
    Click
    will see what I can do

    also the ? after types(instead of Nullable(Of [Type])) cannot be interpreted in mono :(
    will get fixed when i got the time to do so

    Combo.fm: Combine your favourite radio stations! | My Blog | scala-lastfmapi
    P.S.: Do not click here
    throw new PokemonException(); //Gotta catch 'em all
    My forum post reflects my personal opinion :)
    • tburny schrieb...
    • Forum Moderator
    • 9. Sep. 2009, 20:56
    seems I got a bit of work to do: http://www.last.fm/forum/21717/_/564826
    the *.getInfo methods now can receive a username param for including listening stats of that user

    Combo.fm: Combine your favourite radio stations! | My Blog | scala-lastfmapi
    P.S.: Do not click here
    throw new PokemonException(); //Gotta catch 'em all
    My forum post reflects my personal opinion :)
    • crXitz schrieb...
    • Benutzer
    • 24. Jan. 2010, 19:29
    Hi,
    can you please post a *working* example to scrobble a track? I don't get it. I used your sample project (current version from svn: 249) and tried this but it didn't work too, although the program produced the message
    ---> ScrobblerHTTP: Successfully posted data (status code: 200)
    ---> Scrobbler: Successfully scrobbled 1 tracks for user crXitz.
    no title was added to my list of recent played songs

    Much at loss,
    Steffan

    • tburny schrieb...
    • Forum Moderator
    • 24. Jan. 2010, 20:52
    a 200 or an OK does not mean all data were correct, too bad. Maybe you should check if you put all fields correctly on last.fm/api/submissions , Section 3.3 :)
    OK
    This indicates that the submission request was accepted for processing. It does not mean that the submission was valid, but only that the authentication and the form of the submission was validated. The client should remove the submitted track(s) from its queue.

    Combo.fm: Combine your favourite radio stations! | My Blog | scala-lastfmapi
    P.S.: Do not click here
    throw new PokemonException(); //Gotta catch 'em all
    My forum post reflects my personal opinion :)
    • crXitz schrieb...
    • Benutzer
    • 2. Feb. 2010, 12:35
    Hi,

    I finally managed to scrobble a track. With the help of your examples I wrote this code:

    Public Const API_KEY As String = "[API-Key]"
    Public Const API_SEC As String = "[API-Secret]"
    Dim key As New MD5Hash(API_KEY)
    Dim secret As New MD5Hash(API_SEC)
    Dim myAuth As New Types.AuthData(key, secret)

    Private Sub testScrobble()
    scrobbleTrack("Aliens Exist", "Blink-182", 3, 193, "Enema Of State")
    End Sub

    Private Sub scrobbleTrack(ByVal sTrack As String, _
    ByVal sArtist As String, _
    ByVal iNumber As Integer, _
    ByVal iDur As Long, _
    Optional ByVal sAlbum As String = "")

    Dim s As Session = General.Managers.AuthUtil.AuthUserBySimplePermissionGrantingDialog
    Dim m As New Scrobbler.ScrobblerManager()
    Dim init As New Scrobbler.ScrobblerInit(myAuth)

    Dim ti As New Tracks.TrackGetInfo(sArtist, sTrack)
    ti.Start()

    Dim myTrack As New LastFmLib.Scrobbler.ScrobblerTrack(ti.Result)
    myTrack.Source = LastFmLib.Scrobbler.TrackSource.UserSource
    myTrack.Timestamp = New UnixTime(UnixTime.GetUnixTime(), UnixTime.UnixTimeFormat.Seconds)
    myTrack.Album = sAlbum
    myTrack.Duration = iDur
    myTrack.TrackNumber = iNumber
    myTrack.Rating = LastFmLib.Scrobbler.TrackRating.None

    init.Version = My.Application.Info.Version.ToString()
    m.Handshake(init)
    m.Scrobble("crXitz", myTrack)
    End Sub

    By using this code, I always have to grant access for my application. Is there a way to store this information? Hope you can help me.

    Another thing:
    I found out that the properties ArtistImage.VotesBad and ArtistImage.VotesGood return always 0. I solved this problem by adding the following code to the Function
    LastFmLib>API20>Types>ArtistImage.vb>New(ByVal elem As Xml.XmlElement):
    m_votesBad = Util.GetSubElementValue(elem, "votes/thumbsdown")
    m_votesGood = Util.GetSubElementValue(elem, "votes/thumbsup")

    Not it works!

    Thanks in advance for your help,
    Steffan

    • tburny schrieb...
    • Forum Moderator
    • 2. Feb. 2010, 13:28
    There is a SessionManager class, which is accessible by Settings20 class. You can use it to store and retreive Sessions from disk/memory. With this session key you should be able to scrobble without authenticating over and over again.

    Combo.fm: Combine your favourite radio stations! | My Blog | scala-lastfmapi
    P.S.: Do not click here
    throw new PokemonException(); //Gotta catch 'em all
    My forum post reflects my personal opinion :)
    • tburny schrieb...
    • Forum Moderator
    • 2. Feb. 2010, 13:28
    Need someone who helps me to set up the MediaWiki on Sourceforge for Documentation! :)

    Combo.fm: Combine your favourite radio stations! | My Blog | scala-lastfmapi
    P.S.: Do not click here
    throw new PokemonException(); //Gotta catch 'em all
    My forum post reflects my personal opinion :)
    • tburny schrieb...
    • Forum Moderator
    • 2. Feb. 2010, 14:32

    PLEASE READ!!!

    Dear users of LastFmLib.net,
    please read http://www.lastfm.de/group/LastFmLib/forum/85004/_/599376 carefully and leave your opionion.

    Thanks :-)

    Combo.fm: Combine your favourite radio stations! | My Blog | scala-lastfmapi
    P.S.: Do not click here
    throw new PokemonException(); //Gotta catch 'em all
    My forum post reflects my personal opinion :)
    • pblose schrieb...
    • Benutzer
    • 5. Feb. 2010, 21:59

    VS 2010 (beta 2)

    Hey tburny,
    First, thanks for putting the effort in to do this! It's thankless work and can swallow up gobs of time. Know that it is appreciated by at least one geek/music addict.

    I've been playing with the lib and sample project the last week or so. It's given me a chance to kick the tires of VS2010. Wanted to let you know I was able to port to windows7/vs2010 without too much trouble. The biggest thing was removing all of the brackets around keywords (like [Of]). So far, I've been able to pull my recent tracks and such. My next step will be scrobbling from Rhapsody through the rss interface.

    Keep up the good work!

    You can't roller skate in a buffalo heard.
    • tburny schrieb...
    • Forum Moderator
    • 7. Feb. 2010, 16:11
    I'm using VS 2010, too :) Problem is I cannot switch the project to later than .net 3.5 and VS 2008, because other people are still using it with this configuration. Maybe Version 2.0 (long time to go...)

    And thanks for the great feedback(keeps me motivated working on :) )!

    Combo.fm: Combine your favourite radio stations! | My Blog | scala-lastfmapi
    P.S.: Do not click here
    throw new PokemonException(); //Gotta catch 'em all
    My forum post reflects my personal opinion :)
  • To keep both 2008 and 2010 versions of VS compatible you could use two sets of csproj and sln files.

    What I've done on one of my projects to do that is:
    - Make a copy of the sln and all csproj files
    - Rename the copies to xx_VS2010.xxx
    - Change the referenced projects in the sln file (text file) to the copied ones
    - Open the copied sln in VS 2010 and update the project

    As long as the code base for both VS versions are identical this should work like a charm.

    Want to listen to your playlists on last.fm? Have a look at TagBar
    • iliyang schrieb...
    • Benutzer
    • 24. Feb. 2010, 23:45

    Demo application throws an exception upon start

    Hi,

    I was extremely excited when I googled for ".net last.fm library" and it found a real result! Awesome to have a .net library that abstracts the nasty details away!

    Unfortunately, I cannot run the demo application. It throws an exception upon startup. I'm using VS2008 on Win7 x64. For some reason I cannot debug it. At least I dont know how precisely - it's been some years since I've used VS for .NET apps :)

    Anyway, here's the exception dump:

    System.InvalidOperationException was unhandled
    Message="An error occurred creating the form. See Exception.InnerException for details. The error is: The type initializer for 'SampleProject.frmMain' threw an exception."
    Source="SampleProject"
    StackTrace:
    at SampleProject.My.MyProject.MyForms.Create__Instance__[T](T Instance) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 190
    at SampleProject.My.MyProject.MyForms.get_frmMain()
    at SampleProject.My.MyApplication.OnCreateMainForm() in D:\Projects\Misc\lastfmlibnet\lastfmlibnet1\trunk\SampleProject\My Project\Application.Designer.vb:line 35
    at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
    at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
    at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
    at SampleProject.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
    at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
    at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
    at System.Threading.ThreadHelper.ThreadStart()
    InnerException: System.TypeInitializationException
    Message="The type initializer for 'SampleProject.frmMain' threw an exception."
    TypeName="SampleProject.frmMain"
    InnerException: System.FormatException
    Message="MD5-Hash must be 32 chars long!"
    Source="LastFmLibNet"
    StackTrace:
    at LastFmLib.General.MD5Hash..ctor(String s, Boolean isAlreadyHashed, Encoding enc) in D:\Projects\Misc\lastfmlibnet\lastfmlibnet1\trunk\LastFmLib\General\Types\MD5Hash.vb:line 49
    at SampleProject.frmMain..cctor() in D:\Projects\Misc\lastfmlibnet\lastfmlibnet1\trunk\SampleProject\frmMain.vb:line 10
    InnerException:

    • tburny schrieb...
    • Forum Moderator
    • 27. Feb. 2010, 10:00
    Message="The type initializer for 'SampleProject.frmMain' threw an exception."
    TypeName="SampleProject.frmMain"
    InnerException: System.FormatException
    Message="MD5-Hash must be 32 chars long!"
    Source="LastFmLibNet"

    Did you put your api key/secret in the correct place? afaik there should be some resource file or sth like "put your key/secret here" in the main form (cannot remember atm)? :)

    Combo.fm: Combine your favourite radio stations! | My Blog | scala-lastfmapi
    P.S.: Do not click here
    throw new PokemonException(); //Gotta catch 'em all
    My forum post reflects my personal opinion :)
  • Hi!
    Just want to say thank you very much for an awesome Last.fm api interface library for .Net!
    Been playing around with it for the past few days and it is really great.
    Seems there are some problems with scrobbling from the cache though?
    I'm still looking into it but will let you know what I find!
    Kind Regards
    Ralph

    • tburny schrieb...
    • Forum Moderator
    • 27. Mai. 2010, 12:46
    are you using windows 7?

    Combo.fm: Combine your favourite radio stations! | My Blog | scala-lastfmapi
    P.S.: Do not click here
    throw new PokemonException(); //Gotta catch 'em all
    My forum post reflects my personal opinion :)
  • Yes I am.
    It stores the tracks in the username_submissions.xml file, but when you reload it and then try to scrobble that the tracks never get to last.fm.
    I always submit the tracks to the cache and if you scrobble the cache directly after you add a file to it, it is fine. It's just doesn't seem to want to scrobble older tracks that were saved to disk and then loaded.

    • tburny schrieb...
    • Forum Moderator
    • 27. Mai. 2010, 22:57
    if you scrobble older tracks after you scrobbled a more recent one, all older tracks won't be counted by last.fm although OK is returned.
    This is a somewhat general last.fm issue :) might that be related or is it an issue with the cache itself?

    Combo.fm: Combine your favourite radio stations! | My Blog | scala-lastfmapi
    P.S.: Do not click here
    throw new PokemonException(); //Gotta catch 'em all
    My forum post reflects my personal opinion :)
  • Ah ok, thanks. :D
    I think it is the general issue as the cache itself seems to be working fine.
    Thank you very much for the assistance (and the great library) really appreciate it. :D

  • I am pleased to say that I have resolved the cache problem!

    The first error is related to the username that gets stored in the xml file, when you save it it get saved as "user", but when you read it from the file you asked for "username", and thus it gets set as blank by the scrobblerCache.

    m_username = Util.GetAttrValue(xmldoc.DocumentElement, "user")

    The second problem is related to the audio source setting.
    It does get saved as UserSource (1 in the file), but when it is reloaded it is somehow changed to unknown (0 in the file), this is obvious if you inspect the xml file after it has been loaded and then saved again.

    I am not sure how to fix the second one in your code (I am too lazy to go through all of it tonight :P), but it can be easily fixed by setting its source to the correct one (in my own code) before the tracks get scrobbled.

    • tburny schrieb...
    • Forum Moderator
    • 29. Mai. 2010, 14:49
    hey thanks for pointing that out.
    I'll try to fix it next weekend, got some nasty physics test for university on monday...

    Btw, scrobbling api 2.0 beta is out: http://users.last.fm/~tims/Scrobbling2_0_beta_docs.html
    So I'll have to touch Scrobbling either way :)

    Combo.fm: Combine your favourite radio stations! | My Blog | scala-lastfmapi
    P.S.: Do not click here
    throw new PokemonException(); //Gotta catch 'em all
    My forum post reflects my personal opinion :)
  • No problem. :D
    Scrobbling 2.0 looks rather nice, would be awesome to have.
    Good luck with the physics test!

    • tburny schrieb...
    • Forum Moderator
    • 7. Jun. 2010, 15:27
    I got VS 2010 installed now, will take care of Scrobbling 2.0 in the next days :)

    Combo.fm: Combine your favourite radio stations! | My Blog | scala-lastfmapi
    P.S.: Do not click here
    throw new PokemonException(); //Gotta catch 'em all
    My forum post reflects my personal opinion :)
  • Awesome! I can't wait! :D

    • tburny schrieb...
    • Forum Moderator
    • 5. Jul. 2010, 12:36
    I fixed a minor bug in the ArtistInfo class which affected Track.getInfo e.g. for artist="Mohit Chauhan" track="Pee Loon" and plus Scrobbler cache loading, scrobble source, ArtistImage good/bad votes and a few other bugs, you can get the fixes from SVN :)

    Combo.fm: Combine your favourite radio stations! | My Blog | scala-lastfmapi
    P.S.: Do not click here
    throw new PokemonException(); //Gotta catch 'em all
    My forum post reflects my personal opinion :)
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.