mirror of
https://github.com/yattee/yattee.git
synced 2025-08-06 10:44:06 +00:00
Allow to add videos only to user created playlists
This commit is contained in:
@@ -634,10 +634,12 @@ final class InvidiousAPI: Service, ObservableObject, VideosAPI {
|
||||
}
|
||||
|
||||
private func extractPlaylist(from content: JSON) -> Playlist {
|
||||
.init(
|
||||
id: content["playlistId"].stringValue,
|
||||
let id = content["playlistId"].stringValue
|
||||
return Playlist(
|
||||
id: id,
|
||||
title: content["title"].stringValue,
|
||||
visibility: content["isListed"].boolValue ? .public : .private,
|
||||
editable: id.starts(with: "IV"),
|
||||
updated: content["updated"].doubleValue,
|
||||
videos: content["videos"].arrayValue.map { extractVideo(from: $0) }
|
||||
)
|
||||
|
@@ -17,15 +17,17 @@ struct Playlist: Identifiable, Equatable, Hashable {
|
||||
let id: String
|
||||
var title: String
|
||||
var visibility: Visibility
|
||||
var editable = true
|
||||
|
||||
var updated: TimeInterval?
|
||||
|
||||
var videos = [Video]()
|
||||
|
||||
init(id: String, title: String, visibility: Visibility, updated: TimeInterval? = nil, videos: [Video] = []) {
|
||||
init(id: String, title: String, visibility: Visibility, editable: Bool = true, updated: TimeInterval? = nil, videos: [Video] = []) {
|
||||
self.id = id
|
||||
self.title = title
|
||||
self.visibility = visibility
|
||||
self.editable = editable
|
||||
self.updated = updated
|
||||
self.videos = videos
|
||||
}
|
||||
|
Reference in New Issue
Block a user