Merge branch 'origin/pr/1365'
This commit is contained in:
@@ -311,17 +311,7 @@ public class PlayQueue {
|
|||||||
* @param index The playlist index.
|
* @param index The playlist index.
|
||||||
*/
|
*/
|
||||||
public synchronized void moveUp(int index) {
|
public synchronized void moveUp(int index) {
|
||||||
makeBackup();
|
moveDown(index - 1);
|
||||||
if (index <= 0 || index >= size()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Collections.swap(files, index, index - 1);
|
|
||||||
|
|
||||||
if (this.index == index) {
|
|
||||||
this.index--;
|
|
||||||
} else if (this.index == index - 1) {
|
|
||||||
this.index++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+12
-38
@@ -219,42 +219,27 @@ public class JaudiotaggerParser extends MetaDataParser {
|
|||||||
* track numbers on the form "4/12".
|
* track numbers on the form "4/12".
|
||||||
*/
|
*/
|
||||||
private Integer parseTrackNumber(String trackNumber) {
|
private Integer parseTrackNumber(String trackNumber) {
|
||||||
if (trackNumber == null) {
|
return parseIntegerPattern(trackNumber, TRACK_NUMBER_PATTERN);
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
Integer result = null;
|
|
||||||
|
|
||||||
try {
|
|
||||||
result = Integer.valueOf(trackNumber);
|
|
||||||
} catch (NumberFormatException x) {
|
|
||||||
Matcher matcher = TRACK_NUMBER_PATTERN.matcher(trackNumber);
|
|
||||||
if (matcher.matches()) {
|
|
||||||
try {
|
|
||||||
result = Integer.valueOf(matcher.group(1));
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Integer.valueOf(0).equals(result)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Integer parseYear(String year) {
|
private Integer parseYear(String year) {
|
||||||
if (year == null) {
|
return parseIntegerPattern(year, YEAR_NUMBER_PATTERN);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Integer parseIntegerPattern(String str, Pattern pattern) {
|
||||||
|
if (str == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
Integer result = null;
|
Integer result = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
result = Integer.valueOf(year);
|
result = Integer.valueOf(str);
|
||||||
} catch (NumberFormatException x) {
|
} catch (NumberFormatException x) {
|
||||||
Matcher matcher = YEAR_NUMBER_PATTERN.matcher(year);
|
if (pattern == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
Matcher matcher = pattern.matcher(str);
|
||||||
if (matcher.matches()) {
|
if (matcher.matches()) {
|
||||||
try {
|
try {
|
||||||
result = Integer.valueOf(matcher.group(1));
|
result = Integer.valueOf(matcher.group(1));
|
||||||
@@ -272,18 +257,7 @@ public class JaudiotaggerParser extends MetaDataParser {
|
|||||||
|
|
||||||
private Integer parseInteger(String s) {
|
private Integer parseInteger(String s) {
|
||||||
s = StringUtils.trimToNull(s);
|
s = StringUtils.trimToNull(s);
|
||||||
if (s == null) {
|
return parseIntegerPattern(s, null);
|
||||||
return null;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
Integer result = Integer.valueOf(s);
|
|
||||||
if (Integer.valueOf(0).equals(result)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
} catch (NumberFormatException x) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+3
-3
@@ -138,7 +138,7 @@ public class SearchServiceUtilities {
|
|||||||
|
|
||||||
public final boolean addIgnoreNull(Collection<?> collection, IndexType indexType,
|
public final boolean addIgnoreNull(Collection<?> collection, IndexType indexType,
|
||||||
int subjectId) {
|
int subjectId) {
|
||||||
if (indexType == IndexType.ALBUM | indexType == IndexType.SONG) {
|
if (indexType == IndexType.ALBUM || indexType == IndexType.SONG) {
|
||||||
return addIgnoreNull(collection, mediaFileService.getMediaFile(subjectId));
|
return addIgnoreNull(collection, mediaFileService.getMediaFile(subjectId));
|
||||||
} else if (indexType == IndexType.ALBUM_ID3) {
|
} else if (indexType == IndexType.ALBUM_ID3) {
|
||||||
return addIgnoreNull(collection, albumDao.getAlbum(subjectId));
|
return addIgnoreNull(collection, albumDao.getAlbum(subjectId));
|
||||||
@@ -163,8 +163,8 @@ public class SearchServiceUtilities {
|
|||||||
public final void addIfAnyMatch(SearchResult dist, IndexType subjectIndexType,
|
public final void addIfAnyMatch(SearchResult dist, IndexType subjectIndexType,
|
||||||
Document subject) {
|
Document subject) {
|
||||||
int documentId = getId.apply(subject);
|
int documentId = getId.apply(subject);
|
||||||
if (subjectIndexType == IndexType.ARTIST | subjectIndexType == IndexType.ALBUM
|
if (subjectIndexType == IndexType.ARTIST || subjectIndexType == IndexType.ALBUM
|
||||||
| subjectIndexType == IndexType.SONG) {
|
|| subjectIndexType == IndexType.SONG) {
|
||||||
addMediaFileIfAnyMatch.accept(dist.getMediaFiles(), documentId);
|
addMediaFileIfAnyMatch.accept(dist.getMediaFiles(), documentId);
|
||||||
} else if (subjectIndexType == IndexType.ARTIST_ID3) {
|
} else if (subjectIndexType == IndexType.ARTIST_ID3) {
|
||||||
addArtistId3IfAnyMatch.accept(dist.getArtists(), documentId);
|
addArtistId3IfAnyMatch.accept(dist.getArtists(), documentId);
|
||||||
|
|||||||
+2
-3
@@ -59,14 +59,13 @@ public class RegisterPrecompiledJSPInitializer implements ServletContextInitiali
|
|||||||
precompiledJspWebXml),
|
precompiledJspWebXml),
|
||||||
IOUtils.toInputStream("</web-app>", Charset.defaultCharset()));
|
IOUtils.toInputStream("</web-app>", Charset.defaultCharset()));
|
||||||
|
|
||||||
JAXBContext jaxbContext;
|
|
||||||
try {
|
try {
|
||||||
jaxbContext = new JAXBDataBinding(WebApp.class).getContext();
|
JAXBContext jaxbContext = new JAXBDataBinding(WebApp.class).getContext();
|
||||||
Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
|
Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
|
||||||
WebApp webapp = (WebApp) unmarshaller.unmarshal(webXmlIS);
|
WebApp webapp = (WebApp) unmarshaller.unmarshal(webXmlIS);
|
||||||
try {
|
try {
|
||||||
webXmlIS.close();
|
webXmlIS.close();
|
||||||
} catch (java.io.IOException e) {}
|
} catch (java.io.IOException ignored) {}
|
||||||
return webapp;
|
return webapp;
|
||||||
} catch (JAXBException e) {
|
} catch (JAXBException e) {
|
||||||
throw new RuntimeException("Could not parse precompiled-jsp-web.xml", e);
|
throw new RuntimeException("Could not parse precompiled-jsp-web.xml", e);
|
||||||
|
|||||||
Reference in New Issue
Block a user