-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathDoubanMusic.src
184 lines (151 loc) · 3.54 KB
/
DoubanMusic.src
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
# Mp3tag Tag Source for Douban Music API V2.5 (yoyicue)
#
# Search by ALBUM
#
# This file needs to be stored in Mp3tag's tag sources directory.
# %APPDATA%\Mp3tag\data\sources
#
# #####################################################################
#
#
[Name]=Douban Music
[BasedOn]=https://api.douban.com/
[IndexUrl]=https://api.douban.com/v2/music/search?count=100&start=0&q=
[AlbumUrl]=
[WordSeperator]=+
[IndexFormat]=%_url%|%_preview%|%Rating%|%Album%|%Artist%|%Year%|%Version%|%Format%|%Publisher%
[SearchBy]=Album||$regexp(%album%,'[+!(){}\[\]^"~*?:\\]',)||%s
[UserAgent]=1
[Encoding]=url-utf-8
#
[ParserScriptIndex]=...
# ###################################################################
# I N D E X
# ###################################################################
replace "|" "$verticalBar()"
json "ON" "current"
# First, check if we've found anything
json_select "total"
# Then iterate over all releases
ifnot "0"
json_foreach "musics"
# URL
say "https://api.douban.com/v2/music/"
json_select "id"
sayrest
say "|"
# Preview
json_select "alt"
sayrest
say "|"
# Rating
json_select_object "rating"
json_select "average"
sayrest
say "|"
json_unselect_object
# Album
json_select "title"
sayrest
say "|"
# Artist
json_select_many "author" "name" ","
sayrest
say "|"
# Year
json_select_object "attrs"
json_select_object "pubdate"
json_select_array "pubdate" 1
saynchars 4
say "|"
# Version
json_select_object "version"
json_select_array "version" 1
sayrest
say "|"
# Format
json_select_object "media"
json_select_array "media" 1
sayrest
say "|"
# Publisher
json_select_object "publisher"
json_select_array "publisher" 1
sayrest
json_unselect_object
saynewline
json_foreach_end
endif
[ParserScriptAlbum]=...
# ###################################################################
# A L B U M
# ###################################################################
replace "|" "$verticalBar()"
json "ON" "current"
# Album
outputto "ALBUM"
json_select "title"
sayrest
# Artist
outputto "Artist"
json_select_many "author" "name" ","
sayrest
# Publisher
outputto "PUBLISHER"
json_select_object "attrs"
json_select_object "publisher"
json_select_array "publisher" 1
sayrest
json_unselect_object
# Douban_ID
outputto "Douban_ID"
json_select "id"
sayrest
# Douban_Rate
outputto "Douban_Rate"
json_select_object "rating"
json_select "average"
sayrest
json_unselect_object
# Www
outputto "WWW"
json_select "alt"
sayrest
# Coverurl
outputto "Coverurl"
json_select "image"
replace "/s/" "/l/"
sayrest
# Year
outputto "Year"
json_select_object "attrs"
json_select_object "pubdate"
json_select_array "pubdate" 1
saynchars 4
json_unselect_object
# Format
outputto "MEDIATYPE"
json_select_object "attrs"
json_select_object "media"
json_select_array "media" 1
sayrest
json_unselect_object
# Comment
outputto "Comment"
json_foreach "tags"
json_select "name"
sayrest
say ","
json_foreach_end
sayrest
# Tracks
outputto "Tracks"
json_select_object "attrs"
json_select_object "tracks"
json_select_array "tracks" 1
regexpreplace "(•( *)|•)" ""
regexpreplace "\\n" "|"
regexpreplace "^[0-1]{1,2}(.( *)|( *)|.)" ""
regexpreplace "\|[0-9]{1,2}(.( *)|( *)|.)" "|"
sayrest
json_unselect_object