Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add AliyunpanFile duration fix #64 #65

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions Sources/AliyunpanSDK/AliyunpanScope/Vip/GetBuyToken.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//
// GetBuyToken.swift
// Pods
//
// Created by BM on 2024/8/5.
//

extension AliyunpanVIPScope {
/// 开始试用付费功能
public class GetBuyToken: AliyunpanCommand {
public var httpMethod: HTTPMethod { .post }
public var uri: String {
"/business/v1/openUser/getBuyToken"
}

public struct Request: Codable {
public init() {}
}

public struct Response: Codable {
/// 充值用户的身份标记
public let token: String
}

public let request: Request?
public init(_ request: Request) {
self.request = request
}
}
}
18 changes: 15 additions & 3 deletions Sources/AliyunpanSDK/Model/AliyunpanFile.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,20 @@ public struct AliyunpanFile: Codable {
public let url: URL?
public let created_at: Date?
public let updated_at: Date?

public let local_created_at: Date?
/// 播放进度
public let play_cursor: String?
/// 视频时长
public let duration: String?
/// 图片信息
public let image_media_metadata: MediaMetadata?
/// 视频信息
public let video_media_metadata: MediaMetadata?
/// 视频预览信息
public let video_preview_metadata: AudioMetaData?

init(drive_id: String, file_id: String, parent_file_id: String, name: String, size: Int64?, file_extension: String?, content_hash: String?, category: FileCategory? = nil, type: FileType?, mime_type: String?, thumbnail: URL?, url: URL?, created_at: Date?, updated_at: Date?, play_cursor: String?, image_media_metadata: MediaMetadata?, video_media_metadata: MediaMetadata?, video_preview_metadata: AudioMetaData? = nil) {
init(drive_id: String, file_id: String, parent_file_id: String, name: String, size: Int64?, file_extension: String?, content_hash: String?, category: FileCategory? = nil, type: FileType?, mime_type: String?, thumbnail: URL?, url: URL?, created_at: Date?, updated_at: Date?, play_cursor: String?,duration: String?, image_media_metadata: MediaMetadata?, video_media_metadata: MediaMetadata?, video_preview_metadata: AudioMetaData? = nil, local_created_at: Date? = nil) {
self.drive_id = drive_id
self.file_id = file_id
self.parent_file_id = parent_file_id
Expand All @@ -52,9 +56,11 @@ public struct AliyunpanFile: Codable {
self.created_at = created_at
self.updated_at = updated_at
self.play_cursor = play_cursor
self.duration = duration
self.image_media_metadata = image_media_metadata
self.video_media_metadata = video_media_metadata
self.video_preview_metadata = video_preview_metadata
self.local_created_at = local_created_at
}

public init(from decoder: Decoder) throws {
Expand All @@ -73,7 +79,9 @@ public struct AliyunpanFile: Codable {
self.url = try? container.decodeIfPresent(URL.self, forKey: .url)
self.created_at = try? container.decodeIfPresent(Date.self, forKey: .created_at)
self.updated_at = try? container.decodeIfPresent(Date.self, forKey: .updated_at)
self.local_created_at = try? container.decodeIfPresent(Date.self, forKey: .local_created_at)
self.play_cursor = try container.decodeIfPresent(String.self, forKey: .play_cursor)
self.duration = try container.decodeIfPresent(String.self, forKey: .duration)
self.image_media_metadata = try? container.decodeIfPresent(AliyunpanFile.MediaMetadata.self, forKey: .image_media_metadata)
self.video_media_metadata = try? container.decodeIfPresent(AliyunpanFile.MediaMetadata.self, forKey: .video_media_metadata)
self.video_preview_metadata = try? container.decodeIfPresent(AliyunpanFile.AudioMetaData.self, forKey: .video_preview_metadata)
Expand Down Expand Up @@ -284,15 +292,19 @@ extension AliyunpanFile {
public let keep_original_resolution: Bool?
public let stage: String?
public let status: Status
public let url: URL?
public var url: String?
public var urlValue: URL? {
URL(string: url ?? "")
}
}

public struct LiveTranscodingSubtitleTask: Codable {
/// chi | eng
public let language: String
public let language: String?
public let status: Status
public let url: URL?
}
public let meta: Meta?

/// live_transcoding
public let category: String
Expand Down
1 change: 1 addition & 0 deletions Tests/AliyunpanSDKTests/DownloaderTaskTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ let file = AliyunpanFile(
created_at: nil,
updated_at: nil,
play_cursor: nil,
duration: nil,
image_media_metadata: nil,
video_media_metadata: nil)

Expand Down
1 change: 1 addition & 0 deletions Tests/AliyunpanSDKTests/DownloaderTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class DownloaderTests: XCTestCase {
created_at: nil,
updated_at: nil,
play_cursor: nil,
duration: nil,
image_media_metadata: nil,
video_media_metadata: nil)

Expand Down