mirror of
https://github.com/antebudimir/tempus.git
synced 2026-04-16 00:37:25 +00:00
feat: Implement duration and seeking for transcodes (#358)
Co-authored-by: eddyizm <eddyizm@gmail.com>
This commit is contained in:
parent
e5b7756f96
commit
bde34d3df0
3 changed files with 340 additions and 3 deletions
|
|
@ -31,7 +31,7 @@ public class MusicUtil {
|
|||
private static final Pattern BITRATE_PATTERN = Pattern.compile("&maxBitRate=\\d+");
|
||||
private static final Pattern FORMAT_PATTERN = Pattern.compile("&format=\\w+");
|
||||
|
||||
public static Uri getStreamUri(String id) {
|
||||
public static Uri getStreamUri(String id, int timeOffset) {
|
||||
Map<String, String> params = App.getSubsonicClientInstance(false).getParams();
|
||||
|
||||
StringBuilder uri = new StringBuilder();
|
||||
|
|
@ -58,6 +58,8 @@ public class MusicUtil {
|
|||
uri.append("&format=").append(getTranscodingFormatPreference());
|
||||
if (Preferences.askForEstimateContentLength())
|
||||
uri.append("&estimateContentLength=true");
|
||||
if (timeOffset > 0)
|
||||
uri.append("&timeOffset=").append(timeOffset);
|
||||
|
||||
uri.append("&id=").append(id);
|
||||
|
||||
|
|
@ -66,6 +68,10 @@ public class MusicUtil {
|
|||
return Uri.parse(uri.toString());
|
||||
}
|
||||
|
||||
public static Uri getStreamUri(String id) {
|
||||
return getStreamUri(id, 0);
|
||||
}
|
||||
|
||||
public static Uri updateStreamUri(Uri uri) {
|
||||
String s = uri.toString();
|
||||
Matcher m1 = BITRATE_PATTERN.matcher(s);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue