Skip to content

Commit 18b3191

Browse files
committed
feat: add a new lyrics provider Musixmatch
1 parent b4a0438 commit 18b3191

File tree

6 files changed

+730
-1
lines changed

6 files changed

+730
-1
lines changed
Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
/// This structure represents the full response from the Musixmatch "track.search" API endpoint:
2+
/// https://apic-desktop.musixmatch.com/ws/1.1/track.search
3+
struct MusixmatchResponseSearchResult: Decodable {
4+
struct Message: Decodable {
5+
struct Body: Decodable {
6+
struct TrackContainer: Decodable {
7+
let track: Track
8+
}
9+
10+
let trackList: [TrackContainer]?
11+
12+
enum CodingKeys: String, CodingKey {
13+
case trackList = "track_list"
14+
}
15+
}
16+
17+
struct Header: Decodable {
18+
// let available: Int?
19+
// let executeTime: Double?
20+
let hint: String?
21+
let statusCode: Int
22+
23+
enum CodingKeys: String, CodingKey {
24+
// case available
25+
// case executeTime = "execute_time"
26+
case hint
27+
case statusCode = "status_code"
28+
}
29+
}
30+
31+
let body: Body?
32+
let header: Header
33+
}
34+
35+
let message: Message
36+
37+
struct Track: Decodable {
38+
let albumCoverart100x100: String
39+
// let albumCoverart350x350: String?
40+
// let albumCoverart500x500: String?
41+
// let albumCoverart800x800: String?
42+
// let albumId: Int?
43+
let albumName: String
44+
// let albumVanityId: String?
45+
// let artistId: Int?
46+
// let artistMbid: String?
47+
let artistName: String
48+
// let commontrack7digitalIds: [Int]?
49+
// let commontrackId: Int?
50+
// let commontrackIsrcs: [[String]]?
51+
// let commontrackItunesIds: [String]?
52+
// let commontrackSpotifyIds: [String]?
53+
// let commontrackVanityId: String?
54+
// let explicit: Int?
55+
// let firstReleaseDate: String?
56+
// let hasLyrics: Int?
57+
// let hasLyricsCrowd: Int?
58+
// let hasRichsync: Int?
59+
let hasSubtitles: Int
60+
// let hasTrackStructure: Int?
61+
let instrumental: Int
62+
// let lyricsId: Int?
63+
// let numFavourite: Int?
64+
// let primaryGenres: PrimaryGenres?
65+
// let restricted: Int?
66+
// let secondaryGenres: PrimaryGenres?
67+
// let subtitleId: Int?
68+
// let trackEditUrl: String?
69+
let trackId: Int
70+
// let trackIsrc: String?
71+
let trackLength: Int
72+
// let trackLyricsTranslationStatus: [TranslationStatus]?
73+
// let trackMbid: String?
74+
let trackName: String
75+
// let trackNameTranslationList: [String]?
76+
// let trackRating: Int?
77+
// let trackShareUrl: String?
78+
// let trackSoundcloudId: Int?
79+
let trackSpotifyId: String
80+
// let trackXboxmusicId: String?
81+
// let updatedTime: String?
82+
83+
enum CodingKeys: String, CodingKey {
84+
case albumCoverart100x100 = "album_coverart_100x100"
85+
// case albumCoverart350x350 = "album_coverart_350x350"
86+
// case albumCoverart500x500 = "album_coverart_500x500"
87+
// case albumCoverart800x800 = "album_coverart_800x800"
88+
// case albumId = "album_id"
89+
case albumName = "album_name"
90+
// case albumVanityId = "album_vanity_id"
91+
// case artistId = "artist_id"
92+
// case artistMbid = "artist_mbid"
93+
case artistName = "artist_name"
94+
// case commontrack7digitalIds = "commontrack_7digital_ids"
95+
// case commontrackId = "commontrack_id"
96+
// case commontrackIsrcs = "commontrack_isrcs"
97+
// case commontrackItunesIds = "commontrack_itunes_ids"
98+
// case commontrackSpotifyIds = "commontrack_spotify_ids"
99+
// case commontrackVanityId = "commontrack_vanity_id"
100+
// case explicit
101+
// case firstReleaseDate = "first_release_date"
102+
// case hasLyrics = "has_lyrics"
103+
// case hasLyricsCrowd = "has_lyrics_crowd"
104+
// case hasRichsync = "has_richsync"
105+
case hasSubtitles = "has_subtitles"
106+
// case hasTrackStructure = "has_track_structure"
107+
case instrumental
108+
// case lyricsId = "lyrics_id"
109+
// case numFavourite = "num_favourite"
110+
// case primaryGenres = "primary_genres"
111+
// case restricted
112+
// case secondaryGenres = "secondary_genres"
113+
// case subtitleId = "subtitle_id"
114+
// case trackEditUrl = "track_edit_url"
115+
case trackId = "track_id"
116+
// case trackIsrc = "track_isrc"
117+
case trackLength = "track_length"
118+
// case trackLyricsTranslationStatus = "track_lyrics_translation_status"
119+
// case trackMbid = "track_mbid"
120+
case trackName = "track_name"
121+
// case trackNameTranslationList = "track_name_translation_list"
122+
// case trackRating = "track_rating"
123+
// case trackShareUrl = "track_share_url"
124+
// case trackSoundcloudId = "track_soundcloud_id"
125+
case trackSpotifyId = "track_spotify_id"
126+
// case trackXboxmusicId = "track_xboxmusic_id"
127+
// case updatedTime = "updated_time"
128+
}
129+
}
130+
131+
// struct PrimaryGenres: Decodable {
132+
// struct MusicGenreContainer: Decodable {
133+
// struct MusicGenre: Decodable {
134+
// let musicGenreId: Int?
135+
// let musicGenreName: String?
136+
// let musicGenreNameExtended: String?
137+
// let musicGenreParentId: Int?
138+
// let musicGenreVanity: String?
139+
140+
// enum CodingKeys: String, CodingKey {
141+
// case musicGenreId = "music_genre_id"
142+
// case musicGenreName = "music_genre_name"
143+
// case musicGenreNameExtended = "music_genre_name_extended"
144+
// case musicGenreParentId = "music_genre_parent_id"
145+
// case musicGenreVanity = "music_genre_vanity"
146+
// }
147+
// }
148+
149+
// let musicGenre: MusicGenre?
150+
151+
// enum CodingKeys: String, CodingKey {
152+
// case musicGenre = "music_genre"
153+
// }
154+
// }
155+
156+
// let musicGenreList: [MusicGenreContainer]?
157+
158+
// enum CodingKeys: String, CodingKey {
159+
// case musicGenreList = "music_genre_list"
160+
// }
161+
// }
162+
163+
// struct TranslationStatus: Decodable {
164+
// let from: String?
165+
// let perc: Int?
166+
// let to: String?
167+
// }
168+
}

0 commit comments

Comments
 (0)