Playlist delete in long-press menu, empty playlists, Edit Songs moved to ••• (build 62)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
29cc9a03d4
commit
7f4a07d846
5 files changed
+71
-29
No files matched your search
@@ -201,6 +201,16 @@ final class PlexClient: @unchecked Sendable {
|
||||
}
|
||||
|
||||
/// Made on the server of the first song; songs from other servers are left out.
|
||||
/// Servers a new playlist can live on, as (id, name).
|
||||
var playlistServers: [(String, String)] { sources.map { ($0.server.id, $0.server.name) } }
|
||||
|
||||
/// An empty playlist on one server (the only one when [serverId] is nil).
|
||||
func createEmptyPlaylist(_ title: String, serverId: String?) async throws -> Playlist? {
|
||||
let list = sources
|
||||
guard let s = list.first(where: { $0.server.id == serverId }) ?? list.first else { throw NotSignedIn() }
|
||||
return try await s.createPlaylist(title, trackKeys: [])?.tagged(s.server.id)
|
||||
}
|
||||
|
||||
func createPlaylist(_ title: String, trackKeys: [String]) async throws -> Playlist? {
|
||||
guard let first = trackKeys.first else { return nil }
|
||||
let (s, _) = try routed(first)
|
||||
|
||||
@@ -266,7 +266,9 @@ final class PlexServer: MediaSource, @unchecked Sendable {
|
||||
}
|
||||
|
||||
func createPlaylist(_ title: String, trackKeys: [String]) async throws -> Playlist? {
|
||||
let uri = try await libraryUri(trackKeys)
|
||||
// No songs: a bare library uri makes an empty playlist (newer Plex servers allow it).
|
||||
if trackKeys.isEmpty, machine.isEmpty { machine = try await machineId() }
|
||||
let uri = trackKeys.isEmpty ? "server://\(machine)/com.plexapp.plugins.library" : try await libraryUri(trackKeys)
|
||||
return try await send("POST", "/playlists", [("type", "audio"), ("title", title), ("smart", 0), ("uri", uri)])
|
||||
.metadata.first?.toPlaylist()
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user