Merge pull request #185 from plastikman/develop-nolicense-fixcoverart
Cherry picked https://sourceforge.net/p/subsonic/code/4587/master
commit
8d28f2ab87
@ -0,0 +1,69 @@ |
|||||||
|
/* |
||||||
|
* This file is part of Libresonic. |
||||||
|
* |
||||||
|
* Libresonic is free software: you can redistribute it and/or modify |
||||||
|
* it under the terms of the GNU General Public License as published by |
||||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||||
|
* (at your option) any later version. |
||||||
|
* |
||||||
|
* Libresonic is distributed in the hope that it will be useful, |
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
* GNU General Public License for more details. |
||||||
|
* |
||||||
|
* You should have received a copy of the GNU General Public License |
||||||
|
* along with Libresonic. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* |
||||||
|
* Copyright 2016 (C) Libresonic Authors |
||||||
|
* Based upon Subsonic, Copyright 2009 (C) Sindre Mehus |
||||||
|
*/ |
||||||
|
|
||||||
|
package org.libresonic.player.domain; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author Sindre Mehus |
||||||
|
* @version $Id$ |
||||||
|
*/ |
||||||
|
public class AlbumNotes { |
||||||
|
|
||||||
|
private final String notes; |
||||||
|
private final String musicBrainzId; |
||||||
|
private final String lastFmUrl; |
||||||
|
private final String smallImageUrl; |
||||||
|
private final String mediumImageUrl; |
||||||
|
private final String largeImageUrl; |
||||||
|
|
||||||
|
public AlbumNotes(String notes, String musicBrainzId, String lastFmUrl, String smallImageUrl, |
||||||
|
String mediumImageUrl, String largeImageUrl) { |
||||||
|
this.notes = notes; |
||||||
|
this.musicBrainzId = musicBrainzId; |
||||||
|
this.lastFmUrl = lastFmUrl; |
||||||
|
this.smallImageUrl = smallImageUrl; |
||||||
|
this.mediumImageUrl = mediumImageUrl; |
||||||
|
this.largeImageUrl = largeImageUrl; |
||||||
|
} |
||||||
|
|
||||||
|
public String getNotes() { |
||||||
|
return notes; |
||||||
|
} |
||||||
|
|
||||||
|
public String getMusicBrainzId() { |
||||||
|
return musicBrainzId; |
||||||
|
} |
||||||
|
|
||||||
|
public String getLastFmUrl() { |
||||||
|
return lastFmUrl; |
||||||
|
} |
||||||
|
|
||||||
|
public String getSmallImageUrl() { |
||||||
|
return smallImageUrl; |
||||||
|
} |
||||||
|
|
||||||
|
public String getMediumImageUrl() { |
||||||
|
return mediumImageUrl; |
||||||
|
} |
||||||
|
|
||||||
|
public String getLargeImageUrl() { |
||||||
|
return largeImageUrl; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,50 @@ |
|||||||
|
/* |
||||||
|
* This file is part of Libresonic. |
||||||
|
* |
||||||
|
* Libresonic is free software: you can redistribute it and/or modify |
||||||
|
* it under the terms of the GNU General Public License as published by |
||||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||||
|
* (at your option) any later version. |
||||||
|
* |
||||||
|
* Libresonic is distributed in the hope that it will be useful, |
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
* GNU General Public License for more details. |
||||||
|
* |
||||||
|
* You should have received a copy of the GNU General Public License |
||||||
|
* along with Libresonic. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* |
||||||
|
* Copyright 2014 (C) Sindre Mehus |
||||||
|
*/ |
||||||
|
|
||||||
|
package org.libresonic.player.domain; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author Sindre Mehus |
||||||
|
* @version $Id$ |
||||||
|
*/ |
||||||
|
public class LastFmCoverArt { |
||||||
|
|
||||||
|
private final String imageUrl; |
||||||
|
private final String artist; |
||||||
|
private final String album; |
||||||
|
|
||||||
|
public LastFmCoverArt(String imageUrl, String artist, String album) { |
||||||
|
this.imageUrl = imageUrl; |
||||||
|
this.artist = artist; |
||||||
|
this.album = album; |
||||||
|
} |
||||||
|
|
||||||
|
public String getImageUrl() { |
||||||
|
return imageUrl; |
||||||
|
} |
||||||
|
|
||||||
|
public String getArtist() { |
||||||
|
return artist; |
||||||
|
} |
||||||
|
|
||||||
|
public String getAlbum() { |
||||||
|
return album; |
||||||
|
} |
||||||
|
} |
||||||
|
|
@ -0,0 +1,49 @@ |
|||||||
|
/** |
||||||
|
* This file is part of Libresonic. |
||||||
|
* |
||||||
|
* Libresonic is free software: you can redistribute it and/or modify |
||||||
|
* it under the terms of the GNU General Public License as published by |
||||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||||
|
* (at your option) any later version. |
||||||
|
* |
||||||
|
* Libresonic is distributed in the hope that it will be useful, |
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
* GNU General Public License for more details. |
||||||
|
* |
||||||
|
* You should have received a copy of the GNU General Public License |
||||||
|
* along with Libresonic. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* |
||||||
|
* Copyright 2014 (C) Sindre Mehus |
||||||
|
*/ |
||||||
|
|
||||||
|
package org.libresonic.player.service; |
||||||
|
|
||||||
|
import java.util.LinkedHashMap; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
import de.umass.lastfm.cache.ExpirationPolicy; |
||||||
|
|
||||||
|
/** |
||||||
|
* Artist and album info is cached permanently. Everything else is cached one year. |
||||||
|
* |
||||||
|
* @author Sindre Mehus |
||||||
|
* @version $Id$ |
||||||
|
*/ |
||||||
|
public class LastFmExpirationPolicy implements ExpirationPolicy { |
||||||
|
|
||||||
|
private final static long ONE_YEAR = 12 * 30 * 24 * 3600 * 1000L; |
||||||
|
|
||||||
|
private final Map<String, Long> methodToExpirationTime = new LinkedHashMap<String, Long>() {{ |
||||||
|
put("artist.getInfo", Long.MAX_VALUE); // Cache forever
|
||||||
|
put("album.getInfo", Long.MAX_VALUE); // Cache forever
|
||||||
|
put("album.search", -1L); // Don't cache
|
||||||
|
}}; |
||||||
|
|
||||||
|
@Override |
||||||
|
public long getExpirationTime(String method, Map<String, String> params) { |
||||||
|
Long expirationTime = methodToExpirationTime.get(method); |
||||||
|
return expirationTime == null ? ONE_YEAR : expirationTime; |
||||||
|
} |
||||||
|
} |
||||||
|
|
After Width: | Height: | Size: 1.7 KiB |
Loading…
Reference in new issue