Skip to content

Commit fdc6755

Browse files
committed
Remove CombineX transfer to Swift Concurrency, enhance Kugou, NetEase provider sources.
1 parent c7f68a4 commit fdc6755

File tree

14 files changed

+928
-584
lines changed

14 files changed

+928
-584
lines changed

Package.swift

Lines changed: 6 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,15 @@ let package = Package(
1414
),
1515
],
1616
dependencies: [
17-
.package(url: "https://github.com/MxIris-LyricsX-Project/CXShim", branch: "master"),
18-
.package(url: "https://github.com/MxIris-LyricsX-Project/CXExtensions", branch: "master"),
1917
.package(url: "https://github.com/ddddxxx/Regex", from: "1.0.1"),
2018
.package(url: "https://github.com/MxIris-Library-Forks/SwiftCF", branch: "master"),
2119
.package(url: "https://github.com/1024jp/GzipSwift", from: "5.0.0"),
2220
.package(url: "https://github.com/kishikawakatsumi/KeychainAccess", .upToNextMajor(from: "4.0.0")),
2321
.package(url: "https://github.com/MxIris-Library-Forks/Schedule", branch: "master"),
2422
.package(url: "https://github.com/lachlanbell/SwiftOTP", from: "3.0.2"),
23+
.package(url: "https://github.com/apple/swift-async-algorithms", from: "1.0.0"),
24+
.package(url: "https://github.com/attaswift/BigInt", from: "5.6.0"),
25+
.package(url: "https://github.com/krzyzanowskim/CryptoSwift", from: "1.9.0"),
2526
],
2627
targets: [
2728
.target(
@@ -43,10 +44,11 @@ let package = Package(
4344
name: "LyricsService",
4445
dependencies: [
4546
"LyricsCore",
46-
.product(name: "CXShim", package: "CXShim"),
47-
.product(name: "CXExtensions", package: "CXExtensions"),
4847
.product(name: "Regex", package: "Regex"),
4948
.product(name: "Gzip", package: "GzipSwift"),
49+
.product(name: "AsyncAlgorithms", package: "swift-async-algorithms"),
50+
.product(name: "BigInt", package: "BigInt"),
51+
.product(name: "CryptoSwift", package: "CryptoSwift"),
5052
]
5153
),
5254
.target(
@@ -68,35 +70,3 @@ let package = Package(
6870
),
6971
]
7072
)
71-
72-
enum CombineImplementation {
73-
case combine
74-
case combineX
75-
case openCombine
76-
77-
static var `default`: CombineImplementation {
78-
return .combineX
79-
}
80-
81-
init?(_ description: String) {
82-
let desc = description.lowercased().filter(\.isLetter)
83-
switch desc {
84-
case "combine": self = .combine
85-
case "combinex": self = .combineX
86-
case "opencombine": self = .openCombine
87-
default: return nil
88-
}
89-
}
90-
}
91-
92-
extension ProcessInfo {
93-
var combineImplementation: CombineImplementation {
94-
return environment["CX_COMBINE_IMPLEMENTATION"].flatMap(CombineImplementation.init) ?? .default
95-
}
96-
}
97-
98-
import Foundation
99-
100-
if ProcessInfo.processInfo.combineImplementation == .combine {
101-
package.platforms = [.macOS(.v10_15), .iOS(.v13), .tvOS(.v13), .watchOS(.v6)]
102-
}

Sources/LyricsService/JSONModel/Kugou/KugouResponseSearchResult.swift

Lines changed: 0 additions & 47 deletions
This file was deleted.
Lines changed: 259 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,259 @@
1+
//
2+
// KugouResponseSearchResult.swift
3+
// LyricsX - https://github.com/ddddxxx/LyricsX
4+
//
5+
// This Source Code Form is subject to the terms of the Mozilla Public
6+
// License, v. 2.0. If a copy of the MPL was not distributed with this
7+
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
8+
//
9+
10+
import Foundation
11+
12+
struct KugouResponseSearchResultCandidates: Decodable {
13+
let candidates: [Item]
14+
15+
/*
16+
let info: String
17+
let status: Int
18+
let proposal: String
19+
let keyword: String
20+
*/
21+
22+
struct Item: Decodable {
23+
let id: String
24+
let accesskey: String
25+
let song: String
26+
let singer: String
27+
let duration: Int // in msec
28+
29+
/*
30+
let adjust: Int
31+
let hitlayer: Int
32+
let krctype: Int
33+
let language: String
34+
let nickname: String
35+
let originame: String
36+
let origiuid: String
37+
let score: Int
38+
let soundname: String
39+
let sounduid: String
40+
let transname: String
41+
let transuid: String
42+
let uid: String
43+
*/
44+
45+
// let parinfo: [Any]
46+
}
47+
}
48+
import Foundation
49+
50+
struct KugouResponseSearchResult: Codable {
51+
struct Data: Codable {
52+
struct Info: Codable {
53+
struct TransParam: Codable {
54+
struct Classmap: Codable {
55+
let attr0: Int
56+
}
57+
58+
struct Qualitymap: Codable {
59+
let attr0: Date
60+
let attr1: Int
61+
}
62+
63+
struct Ipmap: Codable {
64+
let attr0: Date
65+
}
66+
67+
struct HashOffset: Codable {
68+
let clipHash: String
69+
let startByte: Int
70+
let endMs: Int
71+
let endByte: Int
72+
let fileType: Int
73+
let startMs: Int
74+
let offsetHash: String
75+
76+
private enum CodingKeys: String, CodingKey {
77+
case clipHash = "clip_hash"
78+
case startByte = "start_byte"
79+
case endMs = "end_ms"
80+
case endByte = "end_byte"
81+
case fileType = "file_type"
82+
case startMs = "start_ms"
83+
case offsetHash = "offset_hash"
84+
}
85+
}
86+
87+
let cpyGrade: Int?
88+
let classmap: Classmap
89+
let language: String
90+
let cpyAttr0: Int
91+
let musicpackAdvance: Int
92+
let ogg128Filesize: Int?
93+
let displayRate: Int
94+
let ogg320Filesize: Int?
95+
let qualitymap: Qualitymap
96+
let unionCover: URL?
97+
let ogg128Hash: String?
98+
let cid: Int
99+
let ogg320Hash: String?
100+
let display: Int
101+
let ipmap: Ipmap
102+
let hashOffset: HashOffset?
103+
let hashMultitrack: String?
104+
let payBlockTpl: Int
105+
let cpyLevel: Int?
106+
let songnameSuffix: String?
107+
let allQualityFree: Int?
108+
let freeForAd: Int?
109+
110+
private enum CodingKeys: String, CodingKey {
111+
case cpyGrade = "cpy_grade"
112+
case classmap
113+
case language
114+
case cpyAttr0 = "cpy_attr0"
115+
case musicpackAdvance = "musicpack_advance"
116+
case ogg128Filesize = "ogg_128_filesize"
117+
case displayRate = "display_rate"
118+
case ogg320Filesize = "ogg_320_filesize"
119+
case qualitymap
120+
case unionCover = "union_cover"
121+
case ogg128Hash = "ogg_128_hash"
122+
case cid
123+
case ogg320Hash = "ogg_320_hash"
124+
case display
125+
case ipmap
126+
case hashOffset = "hash_offset"
127+
case hashMultitrack = "hash_multitrack"
128+
case payBlockTpl = "pay_block_tpl"
129+
case cpyLevel = "cpy_level"
130+
case songnameSuffix = "songname_suffix"
131+
case allQualityFree = "all_quality_free"
132+
case freeForAd = "free_for_ad"
133+
}
134+
}
135+
136+
let hash: String
137+
let sqfilesize: Int
138+
let sourceid: Int
139+
let payTypeSq: Int
140+
let bitrate: Int
141+
let ownercount: Int
142+
let pkgPriceSq: Int
143+
let songname: String
144+
let albumName: String
145+
let songnameOriginal: String
146+
let accompany: Int
147+
let sqhash: String
148+
let failProcess: Int
149+
let payType: Int
150+
let rpType: String
151+
let albumID: String
152+
let othernameOriginal: String
153+
let mvhash: String
154+
let extname: String
155+
let price320: Int
156+
let _320hash: String
157+
let topic: String
158+
let othername: String
159+
let isnew: Int
160+
let foldType: Int
161+
let oldCpy: Int
162+
let srctype: Int
163+
let singername: String
164+
let albumAudioID: Int
165+
let duration: Int
166+
let _320filesize: Int
167+
let pkgPrice320: Int
168+
let audioID: Int
169+
let feetype: Int
170+
let price: Int
171+
let filename: String
172+
let source: String
173+
let priceSq: Int
174+
let failProcess320: Int
175+
let transParam: TransParam
176+
let pkgPrice: Int
177+
let payType320: Int
178+
let topicURL: String
179+
let m4afilesize: Int
180+
let rpPublish: Int
181+
let privilege: Int
182+
let filesize: Int
183+
let isoriginal: Int
184+
let _320privilege: Int
185+
let sqprivilege: Int
186+
let failProcessSq: Int
187+
188+
private enum CodingKeys: String, CodingKey {
189+
case hash
190+
case sqfilesize
191+
case sourceid
192+
case payTypeSq = "pay_type_sq"
193+
case bitrate
194+
case ownercount
195+
case pkgPriceSq = "pkg_price_sq"
196+
case songname
197+
case albumName = "album_name"
198+
case songnameOriginal = "songname_original"
199+
case accompany = "Accompany"
200+
case sqhash
201+
case failProcess = "fail_process"
202+
case payType = "pay_type"
203+
case rpType = "rp_type"
204+
case albumID = "album_id"
205+
case othernameOriginal = "othername_original"
206+
case mvhash
207+
case extname
208+
case price320 = "price_320"
209+
case _320hash = "320hash"
210+
case topic
211+
case othername
212+
case isnew
213+
case foldType = "fold_type"
214+
case oldCpy = "old_cpy"
215+
case srctype
216+
case singername
217+
case albumAudioID = "album_audio_id"
218+
case duration
219+
case _320filesize = "320filesize"
220+
case pkgPrice320 = "pkg_price_320"
221+
case audioID = "audio_id"
222+
case feetype
223+
case price
224+
case filename
225+
case source
226+
case priceSq = "price_sq"
227+
case failProcess320 = "fail_process_320"
228+
case transParam = "trans_param"
229+
case pkgPrice = "pkg_price"
230+
case payType320 = "pay_type_320"
231+
case topicURL = "topic_url"
232+
case m4afilesize
233+
case rpPublish = "rp_publish"
234+
case privilege
235+
case filesize
236+
case isoriginal
237+
case _320privilege = "320privilege"
238+
case sqprivilege
239+
case failProcessSq = "fail_process_sq"
240+
}
241+
}
242+
243+
let timestamp: Date
244+
let tab: String
245+
let forcecorrection: Int
246+
let correctiontype: Int
247+
let total: Int
248+
let istag: Int
249+
let allowerr: Int
250+
let info: [Info]
251+
let correctiontip: String
252+
let istagresult: Int
253+
}
254+
255+
let status: Int
256+
let errcode: Int
257+
let data: Data
258+
let error: String
259+
}

0 commit comments

Comments
 (0)