Compare commits
6
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
341155bc6b | ||
|
|
e0dd61fbb4 | ||
|
|
e3c534c569 | ||
|
|
94485dc326 | ||
|
|
75445d06c5 | ||
|
|
448b4b8edf |
@@ -19,8 +19,8 @@ android {
|
||||
applicationId = "de.fojadrachi.playtube"
|
||||
minSdk = 26
|
||||
targetSdk = 36
|
||||
versionCode = 10
|
||||
versionName = "1.6.0"
|
||||
versionCode = 13
|
||||
versionName = "1.8.0"
|
||||
|
||||
// Update-Quelle: eigener Gitea-Server (kein GitHub/Google Play).
|
||||
buildConfigField("String", "UPDATE_SERVER", "\"https://git.fojadrachi.de\"")
|
||||
|
||||
@@ -20,14 +20,20 @@ object DiagReport {
|
||||
private val EMAIL = Regex("[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}")
|
||||
private val URL_QUERY = Regex("(?i)(https?://[^\\s?#\"']+)[?#][^\\s\"']*")
|
||||
private val WORD = Regex("[A-Za-z0-9_-]+")
|
||||
private val JSON_PRIVATE = Regex("(?i)(\"(?:title|artist|author|album|name|query|q|search)\"\\s*:\\s*)\"(?:[^\"\\\\]|\\\\.)*\"")
|
||||
private val CAMEL = Regex("^([A-Z][a-z]+)+$")
|
||||
private val CONTROL = Regex("[\\u0000-\\u0008\\u000b-\\u001f\\u007f\\u202a-\\u202e\\u2066-\\u2069]")
|
||||
|
||||
/** YouTube-Video-ID: 11 Zeichen, Gross- und Kleinbuchstaben gemischt plus Ziffer, `_` oder `-`. */
|
||||
fun looksLikeVideoId(word: String): Boolean =
|
||||
word.length == 11 &&
|
||||
word.all { it.isLetterOrDigit() && it.code < 128 || it == '_' || it == '-' } &&
|
||||
word.any { it in 'A'..'Z' } && word.any { it in 'a'..'z' } &&
|
||||
word.any { it.isDigit() || it == '_' || it == '-' }
|
||||
/**
|
||||
* YouTube-Video-ID: 11 Zeichen aus `[A-Za-z0-9_-]`, entweder Buchstaben plus Ziffer/`_`/`-` oder
|
||||
* mindestens zwei Grossbuchstaben ohne normale Schreibweise (nicht "Verbindunge", "ServerError").
|
||||
*/
|
||||
fun looksLikeVideoId(word: String): Boolean {
|
||||
if (word.length != 11 || !word.all { it in 'A'..'Z' || it in 'a'..'z' || it in '0'..'9' || it == '_' || it == '-' }) return false
|
||||
val letters = word.any { it.isLetter() }
|
||||
if (word.any { it.isDigit() || it == '_' || it == '-' }) return letters
|
||||
return word.count { it in 'A'..'Z' } >= 2 && word.any { it in 'a'..'z' } && !CAMEL.matches(word)
|
||||
}
|
||||
|
||||
private fun looksLikeSecret(word: String): Boolean =
|
||||
word.length >= 20 && word.any { it.isDigit() } && word.any { it.isLetter() }
|
||||
@@ -39,6 +45,7 @@ object DiagReport {
|
||||
text = SECRET.replace(text) { "${it.groupValues[1]}${it.groupValues[2]}[entfernt]" }
|
||||
text = EMAIL.replace(text, "[e-mail]")
|
||||
text = URL_QUERY.replace(text) { "${it.groupValues[1]}?[…]" }
|
||||
text = JSON_PRIVATE.replace(text) { "${it.groupValues[1]}\"[entfernt]\"" }
|
||||
text = WORD.replace(text) {
|
||||
when {
|
||||
looksLikeVideoId(it.value) -> "[video]"
|
||||
@@ -72,6 +79,13 @@ object DiagReport {
|
||||
return listOf("absturz", "exception", "error", "fehler", "fehlgeschlagen", "failed").any { it in lower }
|
||||
}
|
||||
|
||||
/** Vermerk zum Bericht: manuell gesendet (ggf. ohne neue Einträge) oder leer. */
|
||||
fun note(manual: Boolean, noNewLines: Boolean): String = when {
|
||||
manual && noNewLines -> "manuell gesendet (keine neuen Einträge)"
|
||||
manual -> "manuell gesendet"
|
||||
else -> ""
|
||||
}
|
||||
|
||||
fun build(installId: String, version: String, androidVersion: String, device: String, lines: List<String>, note: String = ""): JSONObject =
|
||||
JSONObject()
|
||||
.put("app", "android")
|
||||
|
||||
@@ -85,17 +85,21 @@ object Diagnostics {
|
||||
if (!isEnabled(context)) return
|
||||
val now = System.currentTimeMillis()
|
||||
if (now - prefs(context).getLong(KEY_LAST_TRY, 0) < INTERVAL_MS) return
|
||||
send(context) { }
|
||||
send(context, manual = false) { }
|
||||
}
|
||||
|
||||
/** Senden; [done] bekommt (null = nichts Neues, true/false = Erfolg) auf dem Hauptthread. */
|
||||
fun send(context: Context, done: (Boolean?) -> Unit) {
|
||||
/**
|
||||
* Senden; [done] bekommt (null = nichts Neues, true/false = Erfolg) auf dem Hauptthread.
|
||||
* [manual] ("Jetzt senden"): geht auch ohne neue Logzeilen raus, dann mit dem Vermerk
|
||||
* "manuell gesendet" (Version, Gerät und Kennung reichen zum Prüfen).
|
||||
*/
|
||||
fun send(context: Context, manual: Boolean, done: (Boolean?) -> Unit) {
|
||||
val ctx = context.applicationContext
|
||||
Thread {
|
||||
val prefs = prefs(ctx)
|
||||
val text = runCatching { logFile(ctx).readText() }.getOrDefault("")
|
||||
val collected = DiagReport.collect(text, prefs.getLong(KEY_LAST_SENT, 0))
|
||||
if (collected.lines.isEmpty()) {
|
||||
if (collected.lines.isEmpty() && !manual) {
|
||||
main.post { done(null) }
|
||||
return@Thread
|
||||
}
|
||||
@@ -106,6 +110,7 @@ object Diagnostics {
|
||||
Build.VERSION.RELEASE ?: "?",
|
||||
"${Build.MANUFACTURER} ${Build.MODEL}".take(80),
|
||||
collected.lines,
|
||||
DiagReport.note(manual, collected.lines.isEmpty()),
|
||||
)
|
||||
val ok = post("${BuildConfig.JAM_SERVER}/api/diag", body.toString())
|
||||
if (ok) prefs.edit().putLong(KEY_LAST_SENT, collected.latest).apply()
|
||||
|
||||
@@ -83,6 +83,11 @@ class JamActivity : AppCompatActivity() {
|
||||
codeInput.setOnEditorActionListener { _, _, _ -> joinJam(codeInput.text.toString()); true }
|
||||
leave.setOnClickListener { JamHub.leave() }
|
||||
findViewById<View>(R.id.jamPlayPause).setOnClickListener { JamHub.playPause() }
|
||||
findViewById<View>(R.id.jamNowLike).setOnClickListener {
|
||||
if (JamHub.state?.current == null) return@setOnClickListener
|
||||
// Herz zaehlt fuer den laufenden Song, der in der WebView spielt - mit deinem Login.
|
||||
PlaybackHub.send(PlayerCommand.Like)
|
||||
}
|
||||
findViewById<View>(R.id.jamNext).setOnClickListener { JamHub.send("skip") }
|
||||
findViewById<View>(R.id.jamPrevious).setOnClickListener { JamHub.send("previous") }
|
||||
addButton.setOnClickListener { add() }
|
||||
@@ -253,6 +258,9 @@ class JamActivity : AppCompatActivity() {
|
||||
val state = JamHub.state ?: return
|
||||
|
||||
val item = state.current
|
||||
val like = findViewById<ImageButton>(R.id.jamNowLike)
|
||||
like.visibility = if (item != null) View.VISIBLE else View.GONE
|
||||
like.setImageResource(if (PlaybackHub.nowPlaying.likeStatus == "like") R.drawable.ic_like else R.drawable.ic_favorite_border)
|
||||
findViewById<TextView>(R.id.jamNowTitle).text = item?.title ?: getString(R.string.jam_nothing)
|
||||
findViewById<TextView>(R.id.jamNowArtist).text = item?.let { subtitle(it) } ?: ""
|
||||
val cover = findViewById<ImageView>(R.id.jamCover)
|
||||
@@ -309,7 +317,18 @@ class JamActivity : AppCompatActivity() {
|
||||
Unit
|
||||
}
|
||||
} else null
|
||||
members.addView(row(name, info, image = null, initial = m.name.take(1).uppercase(), action1 = null, action2 = kick).apply {
|
||||
// Host-Rolle abgeben (nur an jemanden, der gerade verbunden ist).
|
||||
val makeHost = if (state.isHost && m.id != state.you && m.online) {
|
||||
R.drawable.ic_crown to {
|
||||
AlertDialog.Builder(this)
|
||||
.setMessage(getString(R.string.jam_make_host_confirm, m.name))
|
||||
.setPositiveButton(R.string.jam_make_host) { _, _ -> JamHub.send("transfer", "memberId" to m.id) }
|
||||
.setNegativeButton(R.string.pc_cancel, null)
|
||||
.show()
|
||||
Unit
|
||||
}
|
||||
} else null
|
||||
members.addView(row(name, info, image = null, initial = m.name.take(1).uppercase(), action1 = makeHost, action2 = kick).apply {
|
||||
alpha = if (m.online) 1f else 0.5f
|
||||
})
|
||||
}
|
||||
@@ -344,6 +363,10 @@ class JamActivity : AppCompatActivity() {
|
||||
findViewById<TextView>(R.id.jamTime).text = JamSync.formatTime(pos)
|
||||
findViewById<TextView>(R.id.jamDuration).text = JamSync.formatTime(dur)
|
||||
if (!seeking) seek.progress = if (dur > 0) (pos / dur * 1000).toInt() else 0
|
||||
val like = findViewById<ImageButton>(R.id.jamNowLike)
|
||||
if (like.visibility == View.VISIBLE) {
|
||||
like.setImageResource(if (PlaybackHub.nowPlaying.likeStatus == "like") R.drawable.ic_like else R.drawable.ic_favorite_border)
|
||||
}
|
||||
}
|
||||
|
||||
private fun subtitle(item: JamSync.Item): String {
|
||||
|
||||
@@ -17,6 +17,7 @@ import okhttp3.WebSocketListener
|
||||
import org.json.JSONObject
|
||||
import java.io.IOException
|
||||
import java.util.concurrent.TimeUnit
|
||||
import kotlin.math.abs
|
||||
|
||||
/**
|
||||
* Playtube Jam: Verbindung zum Jam-Server und gemeinsamer Zustand fuer [JamActivity] (Anzeige)
|
||||
@@ -275,6 +276,7 @@ object JamHub {
|
||||
"not_allowed" -> str(R.string.jam_error_not_allowed)
|
||||
"queue_full" -> str(R.string.jam_error_queue_full)
|
||||
"bad_video" -> str(R.string.jam_error_bad_video)
|
||||
"offline" -> str(R.string.jam_error_offline)
|
||||
"playlist_not_found" -> str(R.string.jam_error_playlist)
|
||||
"rate_limited" -> str(R.string.jam_error_rate_limited)
|
||||
else -> str(R.string.jam_error_other, error)
|
||||
@@ -361,6 +363,8 @@ object JamHub {
|
||||
*/
|
||||
fun intercept(command: PlayerCommand): Boolean {
|
||||
val s = state ?: return false
|
||||
// Like gilt fuer den laufenden Song in der WebView (eigener Login) - nicht in den Jam umleiten.
|
||||
if (command == PlayerCommand.Like) return false
|
||||
if (!s.canControl) return true
|
||||
when (command) {
|
||||
PlayerCommand.PlayPause -> playPause()
|
||||
@@ -368,6 +372,7 @@ object JamHub {
|
||||
PlayerCommand.Pause -> send("pause")
|
||||
PlayerCommand.Next -> send("skip")
|
||||
PlayerCommand.Previous -> send("previous")
|
||||
PlayerCommand.Like -> return false
|
||||
is PlayerCommand.SeekTo -> send("seek", "pos" to command.positionMs / 1000.0)
|
||||
}
|
||||
return true
|
||||
@@ -382,11 +387,15 @@ object JamHub {
|
||||
fun syncPlayer(probe: JSONObject): Actions {
|
||||
val s = state ?: return Actions(null, emptyList())
|
||||
val now = SystemClock.elapsedRealtime()
|
||||
val want = JamSync.target(s, clock.serverNow(System.currentTimeMillis().toDouble()))
|
||||
// Soll-Position zum Zeitpunkt der Messung in der Seite (nicht erst nach der Antwort).
|
||||
val wall = System.currentTimeMillis().toDouble()
|
||||
val sampled = probe.optDouble("now", wall).takeIf { it.isFinite() && abs(it - wall) < 5000 } ?: wall
|
||||
val want = JamSync.target(s, clock.serverNow(sampled))
|
||||
val local = JamSync.Local(
|
||||
videoId = probe.optString("id").takeIf { it.isNotEmpty() && it != "null" && !probe.isNull("id") },
|
||||
pos = probe.optDouble("t", 0.0),
|
||||
paused = probe.optBoolean("paused", true),
|
||||
rate = probe.optDouble("rate", 1.0).takeIf { it.isFinite() && it > 0 } ?: 1.0,
|
||||
)
|
||||
val duration = probe.optDouble("d", 0.0)
|
||||
val scripts = ArrayList<String>()
|
||||
@@ -477,6 +486,7 @@ object JamHub {
|
||||
expectUntil = now + 3000
|
||||
scripts.add(pause)
|
||||
}
|
||||
is JamSync.Step.Rate -> scripts.add(JamSync.rateScript(step.rate))
|
||||
}
|
||||
}
|
||||
return Actions(load, scripts)
|
||||
|
||||
@@ -13,7 +13,25 @@ import kotlin.math.max
|
||||
* paused ? position : position + (T - ref) / 1000. Negativ heisst "startet gleich".
|
||||
*/
|
||||
object JamSync {
|
||||
const val TOLERANCE_S = 1.5
|
||||
const val TOLERANCE_S = 1.0
|
||||
|
||||
/** Beim Spulen etwas vorhalten: bis das Video an der neuen Stelle spielt, vergeht Zeit. */
|
||||
const val SEEK_LEAD_S = 0.2
|
||||
private const val NUDGE_START_S = 0.08
|
||||
private const val NUDGE_STOP_S = 0.03
|
||||
private const val NUDGE_GAIN = 0.25
|
||||
private const val NUDGE_MAX = 0.08
|
||||
|
||||
/**
|
||||
* Wiedergabetempo, das eine kleine Abweichung [drift] (eigene minus Jam-Position, s) ausgleicht -
|
||||
* unhoerbar, die Tonhoehe bleibt. Einmal angefangen ([current] != 1) bis fast 0 ausgleichen.
|
||||
*/
|
||||
fun nudgeRate(drift: Double, current: Double): Double {
|
||||
val threshold = if (abs(current - 1.0) > 0.001) NUDGE_STOP_S else NUDGE_START_S
|
||||
if (!drift.isFinite() || abs(drift) < threshold) return 1.0
|
||||
val rate = (1.0 - NUDGE_GAIN * drift).coerceIn(1.0 - NUDGE_MAX, 1.0 + NUDGE_MAX)
|
||||
return Math.round(rate * 1000.0) / 1000.0
|
||||
}
|
||||
private const val CODE_ALPHABET = "ABCDEFGHJKMNPQRSTUVWXYZ23456789"
|
||||
private val VIDEO_ID = Regex("^[A-Za-z0-9_-]{11}$")
|
||||
|
||||
@@ -207,13 +225,14 @@ object JamSync {
|
||||
return Target(item.videoId, item.id, positionAt(state.playback, serverNow), state.playback.paused, item.dur)
|
||||
}
|
||||
|
||||
data class Local(val videoId: String?, val pos: Double, val paused: Boolean)
|
||||
data class Local(val videoId: String?, val pos: Double, val paused: Boolean, val rate: Double = 1.0)
|
||||
|
||||
sealed class Step {
|
||||
data class Load(val videoId: String, val pos: Double) : Step()
|
||||
data class Seek(val pos: Double) : Step()
|
||||
data object Play : Step()
|
||||
data object Pause : Step()
|
||||
data class Rate(val rate: Double) : Step()
|
||||
}
|
||||
|
||||
/** Was der eigene Player tun soll, damit er zum Jam passt. */
|
||||
@@ -233,9 +252,14 @@ object JamSync {
|
||||
if (local.pos > 0.5) steps.add(Step.Seek(0.0))
|
||||
return steps
|
||||
}
|
||||
if (abs(local.pos - want.pos) > tolerance && !(nearEnd && local.pos > want.pos)) steps.add(Step.Seek(want.pos))
|
||||
val drift = local.pos - want.pos
|
||||
val seek = abs(drift) > tolerance && !(nearEnd && local.pos > want.pos)
|
||||
if (seek) steps.add(Step.Seek(if (want.paused) want.pos else want.pos + SEEK_LEAD_S))
|
||||
if (want.paused && !local.paused) steps.add(Step.Pause)
|
||||
if (!want.paused && local.paused) steps.add(Step.Play)
|
||||
// Feinabgleich ueber das Tempo, solange beide normal laufen.
|
||||
val desired = if (!seek && !want.paused && !local.paused && !nearEnd) nudgeRate(drift, local.rate) else 1.0
|
||||
if (abs(desired - local.rate) > 0.004) steps.add(Step.Rate(desired))
|
||||
return steps
|
||||
}
|
||||
|
||||
@@ -271,6 +295,8 @@ object JamSync {
|
||||
d: api('getDuration') && player.getDuration() > 0 ? player.getDuration() : ((video && isFinite(video.duration)) ? video.duration : 0),
|
||||
paused: paused,
|
||||
ended: state === 0 || (video ? video.ended : false),
|
||||
rate: video && video.playbackRate > 0 ? video.playbackRate : 1,
|
||||
now: Date.now(),
|
||||
ad: ad,
|
||||
error: error,
|
||||
title: meta && meta.title ? meta.title : null,
|
||||
@@ -288,6 +314,14 @@ object JamSync {
|
||||
"var v=p&&p.querySelector('video')||document.querySelector('video');if(v){v.$prop();}})();"
|
||||
}
|
||||
|
||||
/** Wiedergabetempo des Players (Feinabgleich, Tonhoehe bleibt). */
|
||||
fun rateScript(rate: Double): String {
|
||||
val r = if (rate.isFinite()) rate.coerceIn(0.5, 2.0) else 1.0
|
||||
return "(function(){var p=document.getElementById('movie_player');" +
|
||||
"var v=p&&p.querySelector('video')||document.querySelector('video');" +
|
||||
"if(v){v.preservesPitch=true;v.playbackRate=$r;}})();"
|
||||
}
|
||||
|
||||
fun seekScript(seconds: Double): String {
|
||||
val s = if (seconds.isFinite()) max(0.0, seconds) else 0.0
|
||||
return "(function(){var p=document.getElementById('movie_player');var s=$s;" +
|
||||
|
||||
@@ -276,7 +276,7 @@ class MainActivity : AppCompatActivity() {
|
||||
.setView(content)
|
||||
.setPositiveButton(R.string.diag_done, null)
|
||||
.setNeutralButton(R.string.diag_send_now) { _, _ ->
|
||||
Diagnostics.send(this) { ok ->
|
||||
Diagnostics.send(this, manual = true) { ok ->
|
||||
val text = when (ok) {
|
||||
null -> R.string.diag_nothing
|
||||
true -> R.string.diag_sent
|
||||
|
||||
@@ -62,13 +62,23 @@ object MediaScripts {
|
||||
var sliderOk = isFinite(now) && isFinite(max) && max > 0;
|
||||
var current = sliderOk ? now : (video ? video.currentTime : 0);
|
||||
var duration = sliderOk ? max : ((video && isFinite(video.duration)) ? video.duration : 0);
|
||||
var likeStatus = null;
|
||||
try {
|
||||
var renderer = document.querySelector('ytmusic-player-bar ytmusic-like-button-renderer');
|
||||
likeStatus = renderer ? (renderer.getAttribute('like-status') || '').toLowerCase() : null;
|
||||
if (!likeStatus) {
|
||||
var pressed = document.querySelector('like-button-view-model button[aria-pressed=true], #segmented-like-button button[aria-pressed=true]');
|
||||
if (pressed) likeStatus = 'like';
|
||||
}
|
||||
} catch (e) { likeStatus = null; }
|
||||
return JSON.stringify({
|
||||
title: title || '',
|
||||
artist: artist || '',
|
||||
artwork: artwork,
|
||||
playing: !!video && !video.paused && !video.ended && video.readyState > 2,
|
||||
currentTime: current || 0,
|
||||
duration: duration || 0
|
||||
duration: duration || 0,
|
||||
likeStatus: likeStatus
|
||||
});
|
||||
})();
|
||||
"""
|
||||
@@ -85,6 +95,8 @@ object MediaScripts {
|
||||
action("nexttrack", "['ytmusic-player-bar .next-button','.next-button']")
|
||||
PlayerCommand.Previous ->
|
||||
action("previoustrack", "['ytmusic-player-bar .previous-button','.previous-button']")
|
||||
PlayerCommand.Like ->
|
||||
action("like", "['ytmusic-player-bar ytmusic-like-button-renderer #button-shape-like button','like-button-view-model button','#segmented-like-button button']")
|
||||
is PlayerCommand.SeekTo -> {
|
||||
val seconds = command.positionMs / 1000.0
|
||||
"(function(){var v=document.querySelector('video');if(v){v.currentTime=$seconds;}})();"
|
||||
|
||||
@@ -11,11 +11,12 @@ data class NowPlaying(
|
||||
val playing: Boolean,
|
||||
val positionMs: Long,
|
||||
val durationMs: Long,
|
||||
val likeStatus: String? = null,
|
||||
) {
|
||||
val hasTrack: Boolean get() = title.isNotBlank()
|
||||
|
||||
companion object {
|
||||
val EMPTY = NowPlaying("", "", null, playing = false, positionMs = 0L, durationMs = 0L)
|
||||
val EMPTY = NowPlaying("", "", null, playing = false, positionMs = 0L, durationMs = 0L, likeStatus = null)
|
||||
|
||||
private const val ARTIST_SEPARATOR = " • "
|
||||
|
||||
@@ -34,6 +35,7 @@ data class NowPlaying(
|
||||
playing = json.optBoolean("playing", false),
|
||||
positionMs = seconds(json.optDouble("currentTime", 0.0)),
|
||||
durationMs = seconds(json.optDouble("duration", 0.0)),
|
||||
likeStatus = json.optString("likeStatus").takeIf { it.isNotBlank() && it != "null" },
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ sealed class PlayerCommand {
|
||||
data object Pause : PlayerCommand()
|
||||
data object Next : PlayerCommand()
|
||||
data object Previous : PlayerCommand()
|
||||
data object Like : PlayerCommand()
|
||||
data class SeekTo(val positionMs: Long) : PlayerCommand()
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Krone: "Zum Host machen" in der Teilnehmerliste des Jams -->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#FFAAAAAA"
|
||||
android:pathData="M5,16L3,5l5.5,5L12,4l3.5,6L21,5l-2,11H5zM19,19c0,0.6 -0.4,1 -1,1H6c-0.6,0 -1,-0.4 -1,-1v-1h14v1z" />
|
||||
</vector>
|
||||
@@ -207,6 +207,15 @@
|
||||
android:textColor="@color/text_muted"
|
||||
android:textSize="14sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/jamNowLike"
|
||||
android:layout_width="44dp"
|
||||
android:layout_height="44dp"
|
||||
android:background="?attr/selectableItemBackgroundBorderless"
|
||||
android:contentDescription="@string/jam_like"
|
||||
android:src="@drawable/ic_favorite_border"
|
||||
android:tint="@color/brand_to" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
@@ -383,6 +392,7 @@
|
||||
<TextView
|
||||
android:id="@+id/jamInviteCode"
|
||||
android:layout_width="match_parent"
|
||||
android:gravity="center"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:letterSpacing="0.1"
|
||||
@@ -393,6 +403,7 @@
|
||||
<TextView
|
||||
android:id="@+id/jamInviteLink"
|
||||
android:layout_width="match_parent"
|
||||
android:gravity="center"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/text_muted"
|
||||
android:textIsSelectable="true"
|
||||
|
||||
@@ -96,6 +96,10 @@
|
||||
<string name="jam_client_web">Browser</string>
|
||||
<string name="jam_kick">Entfernen</string>
|
||||
<string name="jam_kick_confirm">%1$s aus dem Jam entfernen?</string>
|
||||
<string name="jam_make_host">Zum Host machen</string>
|
||||
<string name="jam_like">Zu Lieblingssongs</string>
|
||||
<string name="jam_make_host_confirm">%1$s zum Host machen? Du gibst damit die Host-Rechte ab.</string>
|
||||
<string name="jam_error_offline">Diese Person ist gerade nicht verbunden.</string>
|
||||
<string name="jam_play_now">Jetzt spielen</string>
|
||||
<string name="jam_remove">Entfernen</string>
|
||||
<string name="jam_added">Hinzugefügt: %1$s</string>
|
||||
|
||||
@@ -23,6 +23,16 @@ class DiagReportTest {
|
||||
assertEquals("a b", DiagReport.sanitize("a\u0000b"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun removesIdsWithoutDigitsAndJsonTitles() {
|
||||
assertEquals("jam: lade [video]", DiagReport.sanitize("jam: lade JZYXtUJcTws"))
|
||||
assertEquals(
|
||||
"Player: {\"artist\":\"[entfernt]\",\"id\":\"[video]\",\"title\":\"[entfernt]\",\"paused\":true}",
|
||||
DiagReport.sanitize("Player: {\"artist\":\"Band\",\"id\":\"Rlg9P5i1bkQ\",\"title\":\"Mein Song\",\"paused\":true}"),
|
||||
)
|
||||
assertEquals("Verbindunge ServerError PlaytubeApp", DiagReport.sanitize("Verbindunge ServerError PlaytubeApp"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun recognizesVideoIds() {
|
||||
assertTrue(DiagReport.looksLikeVideoId("dQw4w9WgXcQ"))
|
||||
@@ -47,6 +57,16 @@ class DiagReportTest {
|
||||
assertEquals("[701] Zeile 701", lines.first())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun manualReportWithoutLinesHasNote() {
|
||||
assertEquals("manuell gesendet (keine neuen Einträge)", DiagReport.note(manual = true, noNewLines = true))
|
||||
assertEquals("manuell gesendet", DiagReport.note(manual = true, noNewLines = false))
|
||||
assertEquals("", DiagReport.note(manual = false, noNewLines = true))
|
||||
val report = DiagReport.build("abc123abc123", "1.6.1", "15", "Google Pixel 9", emptyList(), DiagReport.note(true, true))
|
||||
assertEquals(0, report.getJSONArray("lines").length())
|
||||
assertTrue(report.getString("note").isNotEmpty()) // sonst lehnt der Server den Bericht als leer ab
|
||||
}
|
||||
|
||||
@Test
|
||||
fun buildsReport() {
|
||||
val lines = listOf("[1] Absturz in main: java.lang.IllegalStateException", "[2] ok")
|
||||
|
||||
@@ -42,6 +42,22 @@ class JamSyncTest {
|
||||
assertNull(JamSync.videoIdFromSharedText("kein Link hier"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `gleicht kleine Abweichungen ueber das Tempo aus`() {
|
||||
val want = JamSync.Target("aaaaaaaaaaa", "i", 30.0, false, 200.0)
|
||||
fun local(pos: Double, rate: Double = 1.0, paused: Boolean = false) = JamSync.Local("aaaaaaaaaaa", pos, paused, rate)
|
||||
assertEquals(listOf(JamSync.Step.Rate(0.92)), JamSync.decide(want, local(30.4)))
|
||||
assertEquals(listOf(JamSync.Step.Rate(1.05)), JamSync.decide(want, local(29.8)))
|
||||
assertEquals(listOf(JamSync.Step.Rate(1.0)), JamSync.decide(want, local(30.01, rate = 1.05)))
|
||||
assertEquals(emptyList<JamSync.Step>(), JamSync.decide(want, local(30.05)))
|
||||
assertEquals(
|
||||
listOf(JamSync.Step.Seek(30.0 + JamSync.SEEK_LEAD_S), JamSync.Step.Rate(1.0)),
|
||||
JamSync.decide(want, local(34.0, rate = 1.08)),
|
||||
)
|
||||
assertEquals(0.988, JamSync.nudgeRate(0.05, 1.02), 1e-9)
|
||||
assertEquals(1.0, JamSync.nudgeRate(0.05, 1.0), 1e-9)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `liest Playlist-Links`() {
|
||||
assertEquals("PLabc_1", JamSync.parsePlaylistId("https://music.youtube.com/playlist?list=PLabc_1"))
|
||||
@@ -110,8 +126,8 @@ class JamSyncTest {
|
||||
@Test
|
||||
fun `spult erst ab der Toleranz`() {
|
||||
val id = "aaaaaaaaaaa"
|
||||
assertTrue(JamSync.decide(want(30.0), local(id, 31.2, false)).isEmpty())
|
||||
assertEquals(listOf(Step.Seek(30.0)), JamSync.decide(want(30.0), local(id, 34.0, false)))
|
||||
assertTrue(JamSync.decide(want(30.0), local(id, 30.05, false)).isEmpty())
|
||||
assertEquals(listOf(Step.Seek(30.0 + JamSync.SEEK_LEAD_S)), JamSync.decide(want(30.0), local(id, 34.0, false)))
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -1,21 +1,15 @@
|
||||
## Playtube für Android 1.6.0
|
||||
## Playtube für Android 1.8.0
|
||||
|
||||
- **Diagnosedaten:** Damit Fehler schneller behoben werden, schickt Playtube Abstürze und Verbindungsfehler
|
||||
(ohne Cookies, Anmeldedaten, Suchanfragen, Songtitel oder Video-IDs) an den Playtube-Server; gespeichert
|
||||
wird 30 Tage. Beim ersten Start erscheint ein Hinweis, abschalten geht jederzeit über das neue
|
||||
**Zahnrad** am rechten Rand. Details: playtube-ppp-eula.pages.dev/playtube/privacy/#diag
|
||||
- **Jam-Song zu deinen Lieblingssongs:** In der Jam-Ansicht hat der laufende Song jetzt ein Herz. Ein Klick legt
|
||||
ihn in deine eigenen YouTube-Music-Lieblingssongs (oder nimmt ihn wieder heraus) – mit deinem Login.
|
||||
|
||||
Alles Weitere wie in 1.5.0 (Playlists und Alben im Jam, Songs laufen automatisch weiter). Voraussetzung:
|
||||
Android 8.0 oder neuer.
|
||||
Alles Weitere wie in 1.7.0. Voraussetzung: Android 8.0 oder neuer.
|
||||
|
||||
---
|
||||
|
||||
## Playtube for Android 1.6.0
|
||||
## Playtube for Android 1.8.0
|
||||
|
||||
- **Diagnostic data:** to fix bugs faster, Playtube sends crashes and connection errors (no cookies, sign-in data,
|
||||
searches, song titles or video IDs) to the Playtube server; reports are kept for 30 days. A notice is shown on
|
||||
first start, and you can turn it off at any time via the new **gear** button on the right edge.
|
||||
Details: playtube-ppp-eula.pages.dev/playtube/privacy/#diag
|
||||
- **Jam song to your liked songs:** in the jam view the current song now has a heart. One tap adds it to your own
|
||||
YouTube Music liked songs (or removes it) – with your login.
|
||||
|
||||
Everything else as in 1.5.0 (playlists and albums in the jam, songs continue automatically). Requires Android
|
||||
8.0 or newer.
|
||||
Everything else as in 1.7.0. Requires Android 8.0 or newer.
|
||||
|
||||
Reference in New Issue
Block a user