mirror of
https://github.com/antebudimir/tempus.git
synced 2026-01-01 01:53:31 +00:00
feat: implemented new API getLyricsBySongId for retrieving (synced) song lyrics based on song ID
This commit is contained in:
parent
b9462d7374
commit
54be869081
11 changed files with 197 additions and 0 deletions
|
|
@ -0,0 +1,41 @@
|
|||
package com.cappielloantonio.tempo.util;
|
||||
|
||||
import com.cappielloantonio.tempo.subsonic.models.OpenSubsonicExtension;
|
||||
import com.google.common.reflect.TypeToken;
|
||||
import com.google.gson.Gson;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class OpenSubsonicExtensionsUtil {
|
||||
private static List<OpenSubsonicExtension> getOpenSubsonicExtensions() {
|
||||
List<OpenSubsonicExtension> extensions = null;
|
||||
|
||||
if (Preferences.isOpenSubsonic() && Preferences.getOpenSubsonicExtensions() != null) {
|
||||
extensions = new Gson().fromJson(
|
||||
Preferences.getOpenSubsonicExtensions(),
|
||||
new TypeToken<List<OpenSubsonicExtension>>() {
|
||||
}.getType()
|
||||
);
|
||||
}
|
||||
|
||||
return extensions;
|
||||
}
|
||||
|
||||
private static OpenSubsonicExtension getOpenSubsonicExtension(String extensionName) {
|
||||
if (getOpenSubsonicExtensions() == null) return null;
|
||||
|
||||
return getOpenSubsonicExtensions().stream().filter(openSubsonicExtension -> openSubsonicExtension.getName().equals(extensionName)).findAny().orElse(null);
|
||||
}
|
||||
|
||||
public static boolean isTranscodeOffsetExtensionAvailable() {
|
||||
return getOpenSubsonicExtension("transcodeOffset") != null;
|
||||
}
|
||||
|
||||
public static boolean isFormPostExtensionAvailable() {
|
||||
return getOpenSubsonicExtension("formPost") != null;
|
||||
}
|
||||
|
||||
public static boolean isSongLyricsExtensionAvailable() {
|
||||
return getOpenSubsonicExtension("songLyrics") != null;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue