Permalink
Browse files

Normalize line endings

The git recommendation is that line endings in repositories be LF, which
work natively on Mac and Unix. On Windows, users can configure git to
convert line endings to CRLF on checkout and back to LF on commit.

I've normalized this repo to LF following the recommendations on this
page:
https://help.github.com/articles/dealing-with-line-endings#platform-mac

If you're on Windows, set git to automatically handle line ending
conversion for you by running:
git config --global core.autocrlf true

Git will then convert to and from CRLF behind the scenes and you
shouldn't need to worry about it ever again.
  • Loading branch information...
Pieter Muller
Pieter Muller committed Dec 18, 2013
1 parent 03f804d commit ba655372370b3d4873062c269a9e0efa9f807a05
Showing with 8,811 additions and 8,811 deletions.
  1. +266 −266 changes.txt
  2. +321 −321 src/main/java/de/umass/lastfm/Album.java
  3. +465 −465 src/main/java/de/umass/lastfm/Artist.java
  4. +116 −116 src/main/java/de/umass/lastfm/Authenticator.java
  5. +127 −127 src/main/java/de/umass/lastfm/BuyLink.java
  6. +48 −48 src/main/java/de/umass/lastfm/CallException.java
  7. +386 −386 src/main/java/de/umass/lastfm/Caller.java
  8. +305 −305 src/main/java/de/umass/lastfm/Chart.java
  9. +326 −326 src/main/java/de/umass/lastfm/Event.java
  10. +328 −328 src/main/java/de/umass/lastfm/Geo.java
  11. +121 −121 src/main/java/de/umass/lastfm/Group.java
  12. +130 −130 src/main/java/de/umass/lastfm/Image.java
  13. +79 −79 src/main/java/de/umass/lastfm/ImageHolder.java
  14. +43 −43 src/main/java/de/umass/lastfm/ImageSize.java
  15. +49 −49 src/main/java/de/umass/lastfm/ItemFactory.java
  16. +80 −80 src/main/java/de/umass/lastfm/ItemFactoryBuilder.java
  17. +331 −331 src/main/java/de/umass/lastfm/Library.java
  18. +248 −248 src/main/java/de/umass/lastfm/MusicEntry.java
  19. +91 −91 src/main/java/de/umass/lastfm/PaginatedResult.java
  20. +50 −50 src/main/java/de/umass/lastfm/Period.java
  21. +203 −203 src/main/java/de/umass/lastfm/Playlist.java
  22. +271 −271 src/main/java/de/umass/lastfm/Radio.java
  23. +122 −122 src/main/java/de/umass/lastfm/ResponseBuilder.java
  24. +118 −118 src/main/java/de/umass/lastfm/Result.java
  25. +121 −121 src/main/java/de/umass/lastfm/Session.java
  26. +75 −75 src/main/java/de/umass/lastfm/Shout.java
  27. +285 −285 src/main/java/de/umass/lastfm/Tag.java
  28. +111 −111 src/main/java/de/umass/lastfm/Tasteometer.java
  29. +738 −738 src/main/java/de/umass/lastfm/Track.java
  30. +645 −645 src/main/java/de/umass/lastfm/User.java
  31. +226 −226 src/main/java/de/umass/lastfm/Venue.java
  32. +180 −180 src/main/java/de/umass/lastfm/cache/Cache.java
  33. +190 −190 src/main/java/de/umass/lastfm/cache/DatabaseCache.java
  34. +104 −104 src/main/java/de/umass/lastfm/cache/DefaultExpirationPolicy.java
  35. +48 −48 src/main/java/de/umass/lastfm/cache/ExpirationPolicy.java
  36. +254 −254 src/main/java/de/umass/lastfm/cache/FileSystemCache.java
  37. +97 −97 src/main/java/de/umass/lastfm/cache/MemoryCache.java
  38. +81 −81 src/main/java/de/umass/lastfm/cache/ScrobbleCache.java
  39. +67 −67 src/main/java/de/umass/lastfm/scrobble/Rating.java
  40. +103 −103 src/main/java/de/umass/lastfm/scrobble/ResponseStatus.java
  41. +284 −284 src/main/java/de/umass/lastfm/scrobble/Scrobbler.java
  42. +80 −80 src/main/java/de/umass/lastfm/scrobble/Source.java
  43. +142 −142 src/main/java/de/umass/lastfm/scrobble/SubmissionData.java
  44. +189 −189 src/main/java/de/umass/util/StringUtilities.java
  45. +167 −167 src/main/java/de/umass/xml/DomElement.java
View

Large diffs are not rendered by default.

Oops, something went wrong.

Large diffs are not rendered by default.

Oops, something went wrong.

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -1,116 +1,116 @@
/*
* Copyright (c) 2012, the Last.fm Java Project and Committers
* All rights reserved.
*
* Redistribution and use of this software in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above
* copyright notice, this list of conditions and the
* following disclaimer.
*
* - Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the
* following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package de.umass.lastfm;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.TreeMap;
import de.umass.xml.DomElement;
import static de.umass.util.StringUtilities.isMD5;
import static de.umass.util.StringUtilities.map;
import static de.umass.util.StringUtilities.md5;
/**
* Provides bindings for the authentication methods of the last.fm API.
* See <a href="http://www.last.fm/api/authentication">http://www.last.fm/api/authentication</a> for
* authentication methods.
*
* @author Janni Kovacs
* @see Session
*/
public class Authenticator {
private Authenticator() {
}
/**
* Create a web service session for a user. Used for authenticating a user when the password can be inputted by the user.
*
* @param username last.fm username
* @param password last.fm password in cleartext or 32-char md5 string
* @param apiKey The API key
* @param secret Your last.fm API secret
* @return a Session instance
* @see Session
*/
public static Session getMobileSession(String username, String password, String apiKey, String secret) {
if (!isMD5(password))
password = md5(password);
String authToken = md5(username + password);
Map<String, String> params = map("api_key", apiKey, "username", username, "authToken", authToken);
String sig = createSignature("auth.getMobileSession", params, secret);
Result result = Caller.getInstance()
.call("auth.getMobileSession", apiKey, "username", username, "authToken", authToken, "api_sig", sig);
DomElement element = result.getContentElement();
return Session.sessionFromElement(element, apiKey, secret);
}
/**
* Fetch an unathorized request token for an API account.
*
* @param apiKey A last.fm API key.
* @return a token
*/
public static String getToken(String apiKey) {
Result result = Caller.getInstance().call("auth.getToken", apiKey);
return result.getContentElement().getText();
}
/**
* Fetch a session key for a user.
*
* @param token A token returned by {@link #getToken(String)}
* @param apiKey A last.fm API key
* @param secret Your last.fm API secret
* @return a Session instance
* @see Session
*/
public static Session getSession(String token, String apiKey, String secret) {
String m = "auth.getSession";
Map<String, String> params = new HashMap<String, String>();
params.put("api_key", apiKey);
params.put("token", token);
params.put("api_sig", createSignature(m, params, secret));
Result result = Caller.getInstance().call(m, apiKey, params);
return Session.sessionFromElement(result.getContentElement(), apiKey, secret);
}
static String createSignature(String method, Map<String, String> params, String secret) {
params = new TreeMap<String, String>(params);
params.put("method", method);
StringBuilder b = new StringBuilder(100);
for (Entry<String, String> entry : params.entrySet()) {
b.append(entry.getKey());
b.append(entry.getValue());
}
b.append(secret);
return md5(b.toString());
}
}
/*
* Copyright (c) 2012, the Last.fm Java Project and Committers
* All rights reserved.
*
* Redistribution and use of this software in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above
* copyright notice, this list of conditions and the
* following disclaimer.
*
* - Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the
* following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package de.umass.lastfm;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.TreeMap;
import de.umass.xml.DomElement;
import static de.umass.util.StringUtilities.isMD5;
import static de.umass.util.StringUtilities.map;
import static de.umass.util.StringUtilities.md5;
/**
* Provides bindings for the authentication methods of the last.fm API.
* See <a href="http://www.last.fm/api/authentication">http://www.last.fm/api/authentication</a> for
* authentication methods.
*
* @author Janni Kovacs
* @see Session
*/
public class Authenticator {
private Authenticator() {
}
/**
* Create a web service session for a user. Used for authenticating a user when the password can be inputted by the user.
*
* @param username last.fm username
* @param password last.fm password in cleartext or 32-char md5 string
* @param apiKey The API key
* @param secret Your last.fm API secret
* @return a Session instance
* @see Session
*/
public static Session getMobileSession(String username, String password, String apiKey, String secret) {
if (!isMD5(password))
password = md5(password);
String authToken = md5(username + password);
Map<String, String> params = map("api_key", apiKey, "username", username, "authToken", authToken);
String sig = createSignature("auth.getMobileSession", params, secret);
Result result = Caller.getInstance()
.call("auth.getMobileSession", apiKey, "username", username, "authToken", authToken, "api_sig", sig);
DomElement element = result.getContentElement();
return Session.sessionFromElement(element, apiKey, secret);
}
/**
* Fetch an unathorized request token for an API account.
*
* @param apiKey A last.fm API key.
* @return a token
*/
public static String getToken(String apiKey) {
Result result = Caller.getInstance().call("auth.getToken", apiKey);
return result.getContentElement().getText();
}
/**
* Fetch a session key for a user.
*
* @param token A token returned by {@link #getToken(String)}
* @param apiKey A last.fm API key
* @param secret Your last.fm API secret
* @return a Session instance
* @see Session
*/
public static Session getSession(String token, String apiKey, String secret) {
String m = "auth.getSession";
Map<String, String> params = new HashMap<String, String>();
params.put("api_key", apiKey);
params.put("token", token);
params.put("api_sig", createSignature(m, params, secret));
Result result = Caller.getInstance().call(m, apiKey, params);
return Session.sessionFromElement(result.getContentElement(), apiKey, secret);
}
static String createSignature(String method, Map<String, String> params, String secret) {
params = new TreeMap<String, String>(params);
params.put("method", method);
StringBuilder b = new StringBuilder(100);
for (Entry<String, String> entry : params.entrySet()) {
b.append(entry.getKey());
b.append(entry.getValue());
}
b.append(secret);
return md5(b.toString());
}
}
Oops, something went wrong.

0 comments on commit ba65537

Please sign in to comment.