Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
968920e7f3 |
@@ -19,8 +19,8 @@ android {
|
|||||||
applicationId = "de.fojadrachi.playtube"
|
applicationId = "de.fojadrachi.playtube"
|
||||||
minSdk = 26
|
minSdk = 26
|
||||||
targetSdk = 36
|
targetSdk = 36
|
||||||
versionCode = 4
|
versionCode = 5
|
||||||
versionName = "1.2.0"
|
versionName = "1.2.1"
|
||||||
|
|
||||||
// Update-Quelle: eigener Gitea-Server (kein GitHub/Google Play).
|
// Update-Quelle: eigener Gitea-Server (kein GitHub/Google Play).
|
||||||
buildConfigField("String", "UPDATE_SERVER", "\"https://git.fojadrachi.de\"")
|
buildConfigField("String", "UPDATE_SERVER", "\"https://git.fojadrachi.de\"")
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ object PcRemote {
|
|||||||
visibleTab = state.optString("visibleTab", activeTab),
|
visibleTab = state.optString("visibleTab", activeTab),
|
||||||
title = tab.text("title"),
|
title = tab.text("title"),
|
||||||
subtitle = tab.text("subtitle"),
|
subtitle = tab.text("subtitle"),
|
||||||
thumbnail = tab.text("thumbnail").takeIf { it.startsWith("https://") }.orEmpty(),
|
thumbnail = largeCover(tab.text("thumbnail").takeIf { it.startsWith("https://") }.orEmpty()),
|
||||||
playing = tab?.optBoolean("playing") ?: false,
|
playing = tab?.optBoolean("playing") ?: false,
|
||||||
position = tab?.optDouble("currentTime")?.takeIf { it.isFinite() } ?: 0.0,
|
position = tab?.optDouble("currentTime")?.takeIf { it.isFinite() } ?: 0.0,
|
||||||
duration = tab?.optDouble("duration")?.takeIf { it.isFinite() } ?: 0.0,
|
duration = tab?.optDouble("duration")?.takeIf { it.isFinite() } ?: 0.0,
|
||||||
@@ -76,6 +76,20 @@ object PcRemote {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private val GOOGLE_IMAGE_SIZE = Regex("=(w\\d+-h\\d+|s\\d+)[^/=]*$")
|
||||||
|
private val YTIMG_SMALL = Regex("/(default|mqdefault)\\.jpg$")
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Das Cover aus der YouTube-Music-Player-Leiste ist nur 60x60 Pixel gross ("=w60-h60-l90-rj") -
|
||||||
|
* fuer die Fernbedienung in 544x544 anfordern; kleine YouTube-Vorschaubilder durch hqdefault ersetzen.
|
||||||
|
*/
|
||||||
|
fun largeCover(url: String): String = when {
|
||||||
|
url.contains("googleusercontent.com") || url.contains("ggpht.com") ->
|
||||||
|
url.replace(GOOGLE_IMAGE_SIZE, "=w544-h544-l90-rj")
|
||||||
|
url.contains("ytimg.com") -> url.replace(YTIMG_SMALL, "/hqdefault.jpg")
|
||||||
|
else -> url
|
||||||
|
}
|
||||||
|
|
||||||
/** Textfeld ohne JSON-null ("null" als Text waere sonst sichtbar). */
|
/** Textfeld ohne JSON-null ("null" als Text waere sonst sichtbar). */
|
||||||
private fun JSONObject?.text(key: String): String =
|
private fun JSONObject?.text(key: String): String =
|
||||||
if (this == null || isNull(key)) "" else optString(key)
|
if (this == null || isNull(key)) "" else optString(key)
|
||||||
|
|||||||
@@ -71,6 +71,21 @@ class PcRemoteTest {
|
|||||||
assertNull(PcRemote.parseState(JSONObject("""{"ok": true}""")))
|
assertNull(PcRemote.parseState(JSONObject("""{"ok": true}""")))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun requestsLargeCovers() {
|
||||||
|
assertEquals(
|
||||||
|
"https://lh3.googleusercontent.com/abc=w544-h544-l90-rj",
|
||||||
|
PcRemote.largeCover("https://lh3.googleusercontent.com/abc=w60-h60-l90-rj"),
|
||||||
|
)
|
||||||
|
assertEquals(
|
||||||
|
"https://yt3.ggpht.com/xyz=w544-h544-l90-rj",
|
||||||
|
PcRemote.largeCover("https://yt3.ggpht.com/xyz=s88-c-k-c0x00ffffff-no-rj"),
|
||||||
|
)
|
||||||
|
assertEquals("https://i.ytimg.com/vi/id/hqdefault.jpg", PcRemote.largeCover("https://i.ytimg.com/vi/id/default.jpg"))
|
||||||
|
assertEquals("https://i.ytimg.com/vi/id/hqdefault.jpg", PcRemote.largeCover("https://i.ytimg.com/vi/id/hqdefault.jpg"))
|
||||||
|
assertEquals("https://example.com/a.png", PcRemote.largeCover("https://example.com/a.png"))
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun formatsTimes() {
|
fun formatsTimes() {
|
||||||
assertEquals("0:00", PcRemote.formatTime(-5.0))
|
assertEquals("0:00", PcRemote.formatTime(-5.0))
|
||||||
|
|||||||
@@ -1,13 +1,11 @@
|
|||||||
## Playtube für Android 1.2.0
|
## Playtube für Android 1.2.1
|
||||||
|
|
||||||
- **Neu: PC steuern** (wie Spotify Connect): Playtube auf dem PC im selben WLAN fernbedienen – Titel
|
- **Korrektur „PC steuern“:** Cover werden jetzt scharf angezeigt. Bisher kam bei YouTube Music oft nur
|
||||||
und Cover sehen, Play/Pause, Vor/Zurück, Spulen, Lautstärke, Like und Wechsel zwischen YouTube und
|
das 60×60-Pixel-Vorschaubild aus der Player-Leiste an und wirkte stark verpixelt.
|
||||||
YouTube Music. Erreichbar über den runden Knopf am rechten Rand oder durch langes Drücken aufs
|
|
||||||
App-Icon („PC steuern“).
|
Neu seit 1.2.0: **PC steuern** (wie Spotify Connect) – Playtube auf dem PC im selben WLAN fernbedienen.
|
||||||
- Einrichtung: am PC Playtube **2.0.0 oder neuer** öffnen, unter *Einstellungen › Steuerung vom
|
Am PC Playtube 2.0.0 oder neuer unter *Einstellungen › Steuerung vom Handy* einschalten, speichern,
|
||||||
Handy* einschalten, speichern und „Handy koppeln“ wählen; den angezeigten 6-stelligen Code in der
|
„Handy koppeln“ wählen und den Code in der App eingeben.
|
||||||
App eingeben. Danach verbindet sich das Handy ohne Code.
|
|
||||||
|
|
||||||
Alles Weitere wie bisher: nur YouTube Music, Hintergrundwiedergabe, Sperrbildschirm-Steuerung,
|
Alles Weitere wie bisher: nur YouTube Music, Hintergrundwiedergabe, Sperrbildschirm-Steuerung,
|
||||||
Discord Rich Presence, Updates über diese Releases. Ein vorhandenes Playtube wird beim Installieren
|
Discord Rich Presence, Updates über diese Releases. Voraussetzung: Android 8.0 oder neuer.
|
||||||
aktualisiert. Voraussetzung: Android 8.0 oder neuer.
|
|
||||||
|
|||||||
Reference in New Issue
Block a user