Git Product home page Git Product logo

javascript-last.fm-api's People

Contributors

alnorth avatar antstorm avatar boutboulman avatar clifff avatar feross avatar fxb avatar olf avatar pomle avatar venkatagiri avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

javascript-last.fm-api's Issues

small bug in getApiSignature (with fix)

Hey!

Thanks for the very useful code, it's great. I found a small bug.

In getApiSignature at line 832 you're using for(var index in keys). This was causing the functions in my array prototype to be added to the string that is used to build the MD5 hash. Switching it to this (below) fixed it right up. I'd commit a patch or something but I'm no good at git.

for(var i=0; i<keys.length; i++){
var key = keys[i];
string += key + params[key];
}

Caching does not work

The object for caching is initialized wrong. An object needs to be used instead of an array.

For example in line 53 ff of lasfm.cache.js:

  localStorage.setObject(name, []);

use an object initializer:

  localStorage.setObject(name, {});

The same problem is within the clear() method.

Explanation:
See the store() method:

    /* Store data in this cache with a given expiration time. */
    this.store = function(hash, data, expiration){
        var object = localStorage.getObject(name);
        var time   = Math.round(new Date().getTime() / 1000);

        object[hash] = {
            data       : data,
            expiration : time + expiration
        };

        localStorage.setObject(name, object);
    };

First, the object is de-serialized into an Array of length 0, thus

object=[]
Then the property "hash" is set. This works because the type Array inherits Object.
The resulting object would look similar to this:


object:Array
- length: 0
- "abc123123...a1234a": {.....}

where "abc123123...a1234a" is the value of the hash variable.
During serialization, the hash property is lost as object is of type array and the length is 0, resulting in lastfm=[] in localStorage.

This is why lastfm={} should be stored in localStorage, making lastfm a json object with the hash values as keys.

"album.getTopTags" method

Hi,

Is there a way to retrieve top tags from an album? I didn't find any method in the library 😞

playlist.fetch unusable? Can you provide any explanation?

I'm having trouble getting playlist.fetch to work, and the documentation on LastFM is scarce. I keep receiving error code 7 "invalid resource", but I can't figure out the correct params because there is no documentation on lastFM API docs. Do you have any example by any chance?

POST charset

Lastfm accepts only utf-8 charset.
So replace:
doc.write('<form method="post" action="' + apiUrl + '" id="form">');
to
doc.write('<form method="post" action="' + apiUrl + '" id="form" accept-charset="UTF-8"><input name="iehack" type="hidden" value="&#9760;" />');

thx!

Documentation

Hi,

Great lib! However, the documentation is lacking a bit (maybe a needed update)... I've checked the source and in fact you have implemented several things that require auth, including scrobbling. But the README doesn't reflect this. Also, a small guide and formal documentation would be nice to have, too :)

Cheers,
Rui

Looking for a maintainer?

Hi @fxb, thanks for the great work with this library! There are numerous open PRs that would be great to merge. In particular, I want to support CommonJS (module.exports) and publish this to npm so the new generation of front-end devs (using browserify and others) can use your library.

I can send a PR for just this issue or you can add me as a maintainer I'll take care of giving this library some much-needed love <3.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.