Skip to content

Liquid Glass and Apple Music touches for the Spotify iOS app. A GPL-3.0 fork of spoti.pw 0.21.1.

C

chore: the phone driver can seek by an amount

My-Name-Is-Jeff17b2bdb3a7a7
diff --git a/scripts/phone.py b/scripts/phone.py
index 41d78081..24e17a76 100755
--- a/scripts/phone.py
+++ b/scripts/phone.py
@@ -13,7 +13,7 @@
scripts/phone.py player.open | player.close | player.more
scripts/phone.py menu.pick "Sleep timer"
scripts/phone.py play | pause | next
- scripts/phone.py seek 42
+ scripts/phone.py seek 42 | seek --by -15 # to a position, or by an amount as Spotify's relative seeks do
scripts/phone.py tab 0 | tab Search
scripts/phone.py settings.open
scripts/phone.py settings.page "Appearance"
diff --git a/tweak/Sources/Diagnostics/Driver.m b/tweak/Sources/Diagnostics/Driver.m
index 6bed4caf..79006874 100644
--- a/tweak/Sources/Diagnostics/Driver.m
+++ b/tweak/Sources/Diagnostics/Driver.m
@@ -801,11 +801,18 @@ static NSDictionary<NSString *, SGCommand> *commands(void) {
});
return touchAt(where, 0.08);
},
+ // `seek 42` goes to 42 s; `seek --by -15` moves by 15 s back, the way Spotify's relative seeks do.
@"seek" : ^NSDictionary *(NSDictionary *p) {
double seconds = [(p[@"seconds"] ?: p[@"arg"]) doubleValue];
+ NSString *by = p[@"by"];
return onMain(^id {
- [requirePlayer() seekTo:seconds];
- return @{@"seconds" : @(seconds)};
+ id player = requirePlayer();
+ SEL relative = NSSelectorFromString(@"seekTo:relative:");
+ if (by && ![player respondsToSelector:relative]) fail(@"this player has no relative seek");
+ // Spotify's `relative`, as measured on 9.1.90: 0 from the start, 1 from the end, 2 from where it plays.
+ if (by) ((id (*)(id, SEL, double, long long))objc_msgSend)(player, relative, by.doubleValue, 2);
+ else [player seekTo:seconds];
+ return by ? @{@"by" : @(by.doubleValue)} : @{@"seconds" : @(seconds)};
});
},
@"play" : ^NSDictionary *(NSDictionary *p) {