Add more filters to the shuffle page

master
François-Xavier Thomas 8 years ago
parent 705a3d80b7
commit 8ff762ed0f
No known key found for this signature in database
GPG Key ID: 64337406D2DD45CE
  1. 80
      libresonic-main/src/main/java/org/libresonic/player/domain/RandomSearchCriteria.java
  2. 24
      libresonic-main/src/main/resources/org/libresonic/player/i18n/ResourceBundle_en.properties
  3. 71
      libresonic-main/src/main/webapp/WEB-INF/jsp/more.jsp

@ -19,6 +19,7 @@
*/ */
package org.libresonic.player.domain; package org.libresonic.player.domain;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
@ -34,6 +35,13 @@ public class RandomSearchCriteria {
private final Integer fromYear; private final Integer fromYear;
private final Integer toYear; private final Integer toYear;
private final List<MusicFolder> musicFolders; private final List<MusicFolder> musicFolders;
private final Date minLastPlayedDate;
private final Date maxLastPlayedDate;
private final Integer minAlbumRating;
private final Integer maxAlbumRating;
private final boolean showStarredSongs;
private final boolean showUnstarredSongs;
private final String format;
/** /**
* Creates a new instance. * Creates a new instance.
@ -45,11 +53,55 @@ public class RandomSearchCriteria {
* @param musicFolders Only return songs from these music folder. May NOT be <code>null</code>. * @param musicFolders Only return songs from these music folder. May NOT be <code>null</code>.
*/ */
public RandomSearchCriteria(int count, String genre, Integer fromYear, Integer toYear, List<MusicFolder> musicFolders) { public RandomSearchCriteria(int count, String genre, Integer fromYear, Integer toYear, List<MusicFolder> musicFolders) {
this(
count, genre, fromYear, toYear, musicFolders,
null, null, null, null, true, true, null
);
}
/**
* Creates a new instance.
*
* @param count Maximum number of songs to return.
* @param genre Only return songs of the given genre. May be <code>null</code>.
* @param fromYear Only return songs released after (or in) this year. May be <code>null</code>.
* @param toYear Only return songs released before (or in) this year. May be <code>null</code>.
* @param musicFolders Only return songs from these music folder. May NOT be <code>null</code>.
* @param minLastPlayedDate Only return songs last played after this date. May be <code>null</code>.
* @param maxLastPlayedDate Only return songs last played before this date. May be <code>null</code>.
* @param minAlbumRating Only return songs rated more or equalt to this value. May be <code>null</code>.
* @param maxAlbumRating Only return songs rated less or equal to this value. May be <code>null</code>.
* @param showStarredSongs Show starred songs. May NOT be <code>null</code>.
* @param showUnstarredSongs Show unstarred songs. May NOT be <code>null</code>.
* @param format Only return songs whose file format is equal to this value. May be <code>null</code>.
*/
public RandomSearchCriteria(
int count,
String genre,
Integer fromYear,
Integer toYear,
List<MusicFolder> musicFolders,
Date minLastPlayedDate,
Date maxLastPlayedDate,
Integer minAlbumRating,
Integer maxAlbumRating,
boolean showStarredSongs,
boolean showUnstarredSongs,
String format
) {
this.count = count; this.count = count;
this.genre = genre; this.genre = genre;
this.fromYear = fromYear; this.fromYear = fromYear;
this.toYear = toYear; this.toYear = toYear;
this.musicFolders = musicFolders; this.musicFolders = musicFolders;
this.minLastPlayedDate = minLastPlayedDate;
this.maxLastPlayedDate = maxLastPlayedDate;
this.minAlbumRating = minAlbumRating;
this.maxAlbumRating = maxAlbumRating;
this.showStarredSongs = showStarredSongs;
this.showUnstarredSongs = showUnstarredSongs;
this.format = format;
} }
public int getCount() { public int getCount() {
@ -71,4 +123,32 @@ public class RandomSearchCriteria {
public List<MusicFolder> getMusicFolders() { public List<MusicFolder> getMusicFolders() {
return musicFolders; return musicFolders;
} }
public Date getMinLastPlayedDate() {
return minLastPlayedDate;
}
public Date getMaxLastPlayedDate() {
return maxLastPlayedDate;
}
public Integer getMinAlbumRating() {
return minAlbumRating;
}
public Integer getMaxAlbumRating() {
return maxAlbumRating;
}
public boolean isShowStarredSongs() {
return showStarredSongs;
}
public boolean isShowUnstarredSongs() {
return showUnstarredSongs;
}
public String getFormat() {
return format;
}
} }

@ -233,12 +233,30 @@ more.random.text = Shuffle play
more.random.songs = {0} songs more.random.songs = {0} songs
more.random.auto = Play more random songs when end of play queue is reached. more.random.auto = Play more random songs when end of play queue is reached.
more.random.ok = OK more.random.ok = OK
more.random.genre = from genre more.random.add = Add
more.random.any = Any
more.random.format = Format
more.random.before = Before
more.random.after = After
more.random.genre = Genre
more.random.anygenre = Any more.random.anygenre = Any
more.random.year = and year more.random.year = Year
more.random.anyyear = Any more.random.anyyear = Any
more.random.folder = in folder more.random.folder = Folder
more.random.anyfolder = Any more.random.anyfolder = Any
more.random.star = star
more.random.stars = stars
more.random.starred = Starred
more.random.unstarred = Unstarred
more.random.songrating = Song rating
more.random.albumrating = Album rating
more.random.lastplayed = Last played
more.random.1day = 1 day ago
more.random.1week = 1 week ago
more.random.1month = 1 month ago
more.random.3months = 3 months ago
more.random.6months = 6 months ago
more.random.1year = 1 year ago
more.apps.title = Libresonic Apps more.apps.title = Libresonic Apps
more.apps.text = <p>Check out the steadily growing list of <a href="http://libresonic.org/pages/apps.jsp" target="_blank">Libresonic apps</a>. \ more.apps.text = <p>Check out the steadily growing list of <a href="http://libresonic.org/pages/apps.jsp" target="_blank">Libresonic apps</a>. \
These provide fun and alternative ways to enjoy your media collection - no matter where you are. \ These provide fun and alternative ways to enjoy your media collection - no matter where you are. \

@ -63,8 +63,11 @@
<option value="30"><fmt:message key="more.random.songs"><fmt:param value="30"/></fmt:message></option> <option value="30"><fmt:message key="more.random.songs"><fmt:param value="30"/></fmt:message></option>
<option value="40"><fmt:message key="more.random.songs"><fmt:param value="40"/></fmt:message></option> <option value="40"><fmt:message key="more.random.songs"><fmt:param value="40"/></fmt:message></option>
<option value="50"><fmt:message key="more.random.songs"><fmt:param value="50"/></fmt:message></option> <option value="50"><fmt:message key="more.random.songs"><fmt:param value="50"/></fmt:message></option>
<option value="100"><fmt:message key="more.random.songs"><fmt:param value="100"/></fmt:message></option>
</select> </select>
</td> </td>
</tr>
<tr>
<td><fmt:message key="more.random.genre"/></td> <td><fmt:message key="more.random.genre"/></td>
<td> <td>
<select name="genre"> <select name="genre">
@ -74,6 +77,8 @@
</c:forEach> </c:forEach>
</select> </select>
</td> </td>
</tr>
<tr>
<td><fmt:message key="more.random.year"/></td> <td><fmt:message key="more.random.year"/></td>
<td> <td>
<select name="year"> <select name="year">
@ -95,6 +100,67 @@
<option value="0 1949">&lt; 1950</option> <option value="0 1949">&lt; 1950</option>
</select> </select>
</td> </td>
</tr>
<tr>
<td><fmt:message key="more.random.songrating"/></td>
<td>
<select name="songRating">
<option value="any" selected="selected"><fmt:message key="more.random.any"/></option>
<option value="starred"><fmt:message key="more.random.starred"/></option>
<option value="unstarred"><fmt:message key="more.random.unstarred"/></option>
</select>
</td>
</tr>
<tr>
<td><fmt:message key="more.random.albumrating"/></td>
<td>
<select name="albumRatingComp">
<option value="lt">&lt;</option>
<option value="le">&le;</option>
<option value="eq">=</option>
<option value="ge" selected="selected">&ge;</option>
<option value="gt">&gt;</option>
</select>
<select name="albumRatingValue">
<option value="any" selected="selected"><fmt:message key="more.random.any"/></option>
<option value="0">0 <fmt:message key="more.random.stars"/></option>
<option value="1">1 <fmt:message key="more.random.star"/></option>
<option value="2">2 <fmt:message key="more.random.stars"/></option>
<option value="3">3 <fmt:message key="more.random.stars"/></option>
<option value="4">4 <fmt:message key="more.random.stars"/></option>
<option value="5">5 <fmt:message key="more.random.stars"/></option>
</select>
</td>
</tr>
<tr>
<td><fmt:message key="more.random.lastplayed"/></td>
<td>
<select name="lastPlayedComp">
<option value="lt" selected="selected"><fmt:message key="more.random.before"/></option>
<option value="gt"><fmt:message key="more.random.after"/></option>
</select>
<select name="lastPlayedValue">
<option value="any" selected="selected"><fmt:message key="more.random.any"/></option>
<option value="1day"><fmt:message key="more.random.1day"/></option>
<option value="1week"><fmt:message key="more.random.1week"/></option>
<option value="1month"><fmt:message key="more.random.1month"/></option>
<option value="3months"><fmt:message key="more.random.3months"/></option>
<option value="6months"><fmt:message key="more.random.6months"/></option>
<option value="1year"><fmt:message key="more.random.1year"/></option>
</select>
</td>
</tr>
<tr>
<td><fmt:message key="more.random.format"/></td>
<td>
<select name="format">
<option value="any" selected="selected"><fmt:message key="more.random.any"/></option>
<option value="flac">FLAC</option>
<option value="mp3">MP3</option>
</select>
</td>
</tr>
<tr>
<td><fmt:message key="more.random.folder"/></td> <td><fmt:message key="more.random.folder"/></td>
<td> <td>
<select name="musicFolderId"> <select name="musicFolderId">
@ -104,8 +170,11 @@
</c:forEach> </c:forEach>
</select> </select>
</td> </td>
</tr>
<tr>
<td> <td>
<input type="submit" value="<fmt:message key="more.random.ok"/>"> <input type="submit" name="actionOk" value="<fmt:message key="more.random.ok"/>">
<input type="submit" name="actionAdd" value="<fmt:message key="more.random.add"/>">
</td> </td>
</tr> </tr>
<c:if test="${not model.clientSidePlaylist}"> <c:if test="${not model.clientSidePlaylist}">

Loading…
Cancel
Save