Add hiding short videos

This commit is contained in:
Arkadiusz Fal
2023-02-25 16:42:18 +01:00
parent ef401168ec
commit 2b18f0cffa
18 changed files with 163 additions and 20 deletions

View File

@@ -461,6 +461,7 @@ final class InvidiousAPI: Service, ObservableObject, VideosAPI {
}
let description = json["description"].stringValue
let length = json["lengthSeconds"].doubleValue
return Video(
instanceID: account.instanceID,
@@ -470,7 +471,7 @@ final class InvidiousAPI: Service, ObservableObject, VideosAPI {
videoID: videoID,
title: json["title"].stringValue,
author: json["author"].stringValue,
length: json["lengthSeconds"].doubleValue,
length: length,
published: published,
views: json["viewCount"].intValue,
description: description,
@@ -480,6 +481,7 @@ final class InvidiousAPI: Service, ObservableObject, VideosAPI {
indexID: indexID,
live: json["liveNow"].boolValue,
upcoming: json["isUpcoming"].boolValue,
short: length <= Video.shortLength,
publishedAt: publishedAt,
likes: json["likeCount"].int,
dislikes: json["dislikeCount"].int,

View File

@@ -481,6 +481,8 @@ final class PipedAPI: Service, ObservableObject, VideosAPI {
chapters = extractChapters(from: description)
}
let length = details["duration"]?.double ?? 0
return Video(
instanceID: account.instanceID,
app: .piped,
@@ -488,13 +490,14 @@ final class PipedAPI: Service, ObservableObject, VideosAPI {
videoID: extractID(from: content),
title: details["title"]?.string ?? "",
author: author,
length: details["duration"]?.double ?? 0,
length: length,
published: published ?? "",
views: details["views"]?.int ?? 0,
description: description,
channel: Channel(app: .piped, id: channelId, name: author, thumbnailURL: authorThumbnailURL, subscriptionsCount: subscriptionsCount),
thumbnails: thumbnails,
live: live,
short: details["isShort"]?.bool ?? (length <= Video.shortLength),
likes: details["likes"]?.int,
dislikes: details["dislikes"]?.int,
streams: extractStreams(from: content),