/
picard-renaming-script
347 lines (285 loc) · 14.6 KB
/
picard-renaming-script
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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
$noop(★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★)
$noop(★ MBP Magic-Script - v0.4.2 ★)
$noop(★ ★)
$noop(★ Here is a script for music renaming in MusicBrainz Picard ★)
$noop(★ ★)
$noop(★ Features : ★)
$noop(★ - Organize root music folder with last.fm category OR artist initial ★)
$noop(★ - Can use custom subfolder for each main type [Album/Single/EP...] ★)
$noop(★ - Can use custom subfolder for compilation [!various] ★)
$noop(★ - Exclude type album from using subfolder ★)
$noop(★ - Custom folder for soundtrack/various ★)
$noop(★ - Alphabetize artist without leading "The" ★)
$noop(★ - Improve tag displaying on some device ★)
$noop(★ - Filtered character for files & folders naming ★)
$noop(★ - Include media type in folder name [when it's not CD] ★)
$noop(★ - Subfolder for multi-disc [setting to disable subfolder] ★)
$noop(★ - Custom folder tag for multi-disc CD/Vinyl [CD1/Disc1 by default] ★)
$noop(★ - Put multi-CD release in same folder [naming become 101/102/201...] ★)
$noop(★ - Vinyl can use musicbrainz style for track [A1/A2/B1...] ★)
$noop(★ - Custom settings ★)
$noop(★ ★)
$noop(★ Needed : ★)
$noop(★ - Last.fm.ng plugin [for category trending] ★)
$noop(★ -> https://github.com/fdemmer/Picard-Last.fm.ng-Plugin ★)
$noop(★ ★)
$noop(★ Happy tagging!!! ★)
$noop(★ ★)
$noop(★----------------------------------------------------------------------★)
$noop(★ ★ By Ski-lleR ★ ★)
$noop(★----------------------------------------------------------------------★)
$noop(★ ★)
$noop(★ Thanks to ★)
$noop(★ ★)
$noop(★ avibrazil for his filter ★)
$noop(★ > https://github.com/avibrazil/picard-scripting ★)
$noop(★ ★)
$noop(★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★)
$noop(######################### SETTINGS #########################)
$noop(★ GLOBAL ★)
$set(_separateByTypeInArtistFolder,1)
$set(_separateAlbum,0)
$set(_useMusicBrainzStyleForVinylTrack,1)
$noop(★ Multi-Disc ★)
$set(_useSubDiscFolder,1)
$set(_mergeDiscWhenNotUsingSubfolder,0)
$set(_showDiscSubtitle,1)
$set(_nameForTypeCD,CD)
$set(_nameForTypeVinyl,Disc)
$noop(★ orderTypeForRoot ★)
$noop(★ 1: Category [Last.fm.ng] ★)
$noop(★ 2: Artist first letter ★)
$set(_orderTypeForRoot,1)
$noop(★ orderTypeForArtist ★)
$noop(★ 1: First letter of first name ★)
$noop(★ 2: First letter of last name ★)
$set(_orderTypeForArtist,2)
$noop(★ CUSTOM SUBFOLDER BY TYPE ★)
$set(_albumSubFolder,Albums/)
$set(_liveSubFolder,Lives/)
$set(_singlesSubFolder,Singles/)
$set(_epSubFolder,EP/)
$set(_broadcastSubFolder,Broadcast/)
$set(_otherSubFolder,Others/)
$noop(★ COMPILATION FOLDER [NO VARIOUS] ★)
$set(_compilationsSubFolder,Compilations/)
$noop(★ SOUNDTRACK/VARIOUS FOLDER ★)
$set(_soundTracksFolder,SoundTracks/)
$set(_variousArtistsFolder,Various/)
$noop(####################### END SETTINGS #######################)
$noop(########## PATH SAMPLE [with defaults settings] ############)
$noop(★ 1st level ★)
$noop(~/Music/SoundTracks)
$noop(~/Music/Various)
$noop(~/Music/Category)
$noop(★ 2nd level ★)
$noop(~/Music/SoundTracks/Album name - 2016 [Vinyl])
$noop(~/Music/Various/Album name - 2016 [Vinyl])
$noop(~/Music/Category/Artist, The)
$noop(★ 3rd level ★)
$noop(~/Music/SoundTracks/Album name - 2016 [Vinyl]/CD1~subtitle)
$noop(~/Music/Various/Album name - 2016 [Vinyl]/CD1~subtitle)
$noop(~/Music/Category/Artist, The/Compilations)
$noop(~/Music/Category/Artist, The/Singles)
$noop(~/Music/Category/Artist, The/EP)
$noop(~/Music/Category/Artist, The/Album name - 2016 [Vinyl])
$noop(★ 4th level ★)
$noop(~/Music/SoundTracks/Album name - 2016 [Vinyl]/CD1~subtitle/01. Track.flac)
$noop(~/Music/Various/Album name - 2016 [Vinyl]/CD1~subtitle/01. Track.flac)
$noop(~/Music/Category/Artist, The/Compilations/Album name - 2016 [Vinyl])
$noop(~/Music/Category/Artist, The/Singles/Album name - 2016 [Vinyl])
$noop(~/Music/Category/Artist, The/EP/Album name - 2016 [Vinyl])
$noop(~/Music/Category/Artist, The/Album name - 2016 [Vinyl]/CD1~subtitle)
$noop(★ 5eme level ★)
$noop(~/Music/Category/Artist, The/Compilations/Album name - 2016 [Vinyl]/CD1~subtitle)
$noop(~/Music/Category/Artist, The/Singles/Album name - 2016 [Vinyl]/CD1~subtitle)
$noop(~/Music/Category/Artist, The/EP/Album name - 2016 [Vinyl]/CD1~subtitle)
$noop(~/Music/Category/Artist, The/Album name - 2016 [Vinyl]/CD1~subtitle/01. Track.flac)
$noop(★ 6eme level ★)
$noop(~/Music/Category/Artist, The/Compilations/Album name - 2016 [Vinyl]/CD1~subtitle/01. Track.flac)
$noop(~/Music/Category/Artist, The/Singles/Album name - 2016 [Vinyl]/CD1~subtitle/01. Track.flac)
$noop(~/Music/Category/Artist, The/EP/Album name - 2016 [Vinyl]/CD1~subtitle/01. Track.flac)
$noop(########## DETECT MUSIC TYPE ###############################)
$noop(★ Detect Album ★)
$if($in(%releasetype%,album),
$set(_isAlbum,1)
)
$noop(★ Detect Single ★)
$if($in(%releasetype%,single),
$set(_isSingle,1)
)
$noop(★ Detect EP ★)
$if($in(%releasetype%,ep),
$set(_isEP,1)
)
$noop(★ Detect Broadcast ★)
$if($in(%releasetype%,broadcast),
$set(_isBroadcast,1)
)
$noop(★ Detect Other ★)
$if($in(%releasetype%,other),
$set(_isOther,1)
)
$noop(★ Detect Artist Compilation ★)
$if($in(%releasetype%,compilation),
$set(_isArtistCompil,1)
)
$noop(★ Detect Live ★)
$if($in(%releasetype%,live),
$set(_isLive,1)
)
$noop(★ Detect Soundtrack ★)
$if($in(%releasetype%,soundtrack),
$set(_isSoundTrack,1)
)
$noop(★ Detect Various Artist ★)
$if($eq(%albumartist%,Various Artists),
$set(_isVarious,1)
)
$noop(★ Re-detect Compilation ★)
$if($eq(%compilation%,1),
$set(_isGlobalCompil,1)
)
$noop(########## TAG MANAGE ######################################)
$noop(★ Organize artist by alphabetical folders excluding leading The ★)
$set(albumartist,$if($eq($left(%albumartist%,4),The ),%albumartistsort%,%albumartist%))
$noop(########## TAG CLEANUP ####################################)
$noop(★ Typography for tags: changes will affect tags on media ★)
$noop(★ ... ➡ …)
$set(album,$replace(%album%,...,…))
$set(title,$replace(%title%,...,…))
$set(discsubtitle,$replace(%discsubtitle%,...,…))
$noop(★ No. ➡ №)
$set(album,$replace(%album%, [Nn]o.\\s*\(\\d\), №\\1))
$set(title,$rreplace(%title%, [Nn]o.\\s*\(\\d\), №\\1))
$set(discsubtitle,$replace(%discsubtitle%, [Nn]o.\\s*\(\\d\), №\\1))
$noop(★ [digit]" ➡ [digit]″)
$set(album,$rreplace(%album%,\(\\d\)",\\1″))
$set(discsubtitle,$rreplace(%discsubtitle%,\(\\d\)",\\1″))
$noop(★ "something" ➡ “something”)
$set(albumartist,$rreplace(%albumartist%,"\(.*?\)",“\\1”))
$set(artist,$rreplace(%artist%,"\(.*?\)",“\\1”))
$set(albumartistsort,$rreplace(%albumartistsort%,"\(.*?\)",“\\1”))
$set(artistsort,$rreplace(%artistsort%,"\(.*?\)",“\\1”))
$set(album,$rreplace(%album%,"\(.*?\)",“\\1”))
$set(title,$rreplace(%title%,"\(.*?\)",“\\1”))
$set(discsubtitle,$rreplace(%discsubtitle%,"\(.*?\)",“\\1”))
$noop(★ Typography on file naming only ★)
$set(_titleForFilename,%title%)
$set(_albumForFilename,%album%)
$set(_discsubtitleForFilename,%discsubtitle%)
$set(_albumartistForFilename,%albumartist%)
$set(_artistForFilename,%artist%)
$set(_albumartistsortForFilename,%albumartistsort%)
$set(_artistsortForFilename,%artistsort%)
$noop(★ # ➡ ♯)
$set(_titleForFilename,$replace(%_titleForFilename%,#,♯))
$set(_albumForFilename,$replace(%_albumForFilename%,#,♯))
$set(_discsubtitleForFilename,$replace(%_discsubtitleForFilename%,#,♯))
$noop(★ : ➡ ∶)
$set(_titleForFilename,$replace(%_titleForFilename%,:,∶))
$set(_albumForFilename,$replace(%_albumForFilename%,:,∶))
$set(_discsubtitleForFilename,$replace(%_discsubtitleForFilename%,:,∶))
$set(_artistForFilename,$replace(%_artistForFilename%,:,∶))
$set(_albumartistForFilename,$replace(%_albumartistForFilename%,:,∶))
$set(_artistsortForFilename,$replace(%_artistsortForFilename%,:,∶))
$set(_albumartistsortForFilename,$replace(%_albumartistsortForFilename%,:,∶))
$noop(★ ? ➡ ⁇)
$set(_titleForFilename,$replace(%_titleForFilename%,?,⁇))
$set(_albumForFilename,$replace(%_albumForFilename%,?,⁇))
$set(_discsubtitleForFilename,$replace(%_discsubtitleForFilename%,?,⁇))
$set(_artistForFilename,$replace(%_artistForFilename%,?,⁇))
$set(_artistsortForFilename,$replace(%_artistsortForFilename%,?,⁇))
$set(_titleForFilename,$replace(%_titleForFilename%,|,│))
$set(_albumForFilename,$replace(%_albumForFilename%,|,│))
$set(_discsubtitleForFilename,$replace(%_discsubtitleForFilename%,|,│))
$set(_titleForFilename,$replace(%_titleForFilename%,>,>))
$set(_albumForFilename,$replace(%_albumForFilename%,>,>))
$set(_discsubtitleForFilename,$replace(%_discsubtitleForFilename%,>,>))
$set(_titleForFilename,$replace(%_titleForFilename%,<,<))
$set(_albumForFilename,$replace(%_albumForFilename%,<,<))
$set(_discsubtitleForFilename,$replace(%_discsubtitleForFilename%,<,<))
$set(_titleForFilename,$replace(%_titleForFilename%,*,✱))
$set(_albumForFilename,$replace(%_albumForFilename%,*,✱))
$set(_discsubtitleForFilename,$replace(%_discsubtitleForFilename%,*,✱))
$set(_artistForFilename,$replace(%_artistForFilename%,*,✱))
$set(_albumartistForFilename,$replace(%_albumartistForFilename%,*,✱))
$set(_artistsortForFilename,$replace(%_artistsortForFilename%,*,✱))
$set(_albumartistsortForFilename,$replace(%_albumartistsortForFilename%,*,✱))
$set(_titleForFilename,$replace(%_titleForFilename%,&,&))
$set(_albumForFilename,$replace(%_albumForFilename%,&,&))
$set(_discsubtitleForFilename,$replace(%_discsubtitleForFilename%,&,&))
$set(_artistForFilename,$replace(%_artistForFilename%,&,&))
$set(_albumartistForFilename,$replace(%_albumartistForFilename%,&,&))
$set(_artistsortForFilename,$replace(%_artistsortForFilename%,&,&))
$set(_albumartistsortForFilename,$replace(%_albumartistsortForFilename%,&,&))
$noop(########## RENAMER CORE ####################################)
$noop(★ Soundtrack in custom directory ★)
$if(%_isSoundTrack%,%_soundTracksFolder%,
$noop(★ Various in custom directory ★)
$if(%_isVarious%,%_variousArtistsFolder%,
$noop(★ Order root by category ★)
$if($eq(%_orderTypeForRoot%,1),
$if2(%albumgrouping%,Unknown)
)/
$noop(★ Order root by artist ★)
$if($eq(%_orderTypeForRoot%,2),
$if($eq(%_orderTypeForArtist%,1),
$upper($firstalphachar($if2(%_albumartistForFilename%, %_artistForFilename%),#)),
$if($eq(%_orderTypeForArtist%,2),
$upper($firstalphachar($if2(%_albumartistsortForFilename%, %_artistsortForFilename%),#))
))
)/
$noop(★ Artist with first letter of first name ★)
$if($eq(%_orderTypeForArtist%,1),
$if2(%_albumartistForFilename%,%_artistForFilename%)
)/
$noop(★ Artist with first letter of last name ★)
$if($eq(%_orderTypeForArtist%,2),
$if2(%_albumartistsortForFilename%,%_artistsortForFilename%)
)/
$noop(★ Organize by type ★)
$if($eq(%_separateByTypeInArtistFolder%,1),
$if($or(%_isArtistCompil%,%_isGlobalCompil%),%_compilationsSubFolder%,
$if($eq(%_isLive%,1),%_liveSubFolder%,
$if($eq(%_isAlbum%,1),
$if($eq(%_separateAlbum%,1),%_albumSubFolder%)
)
$if($eq(%_isSingle%,1),%_singlesSubFolder%)
$if($eq(%_isEP%,1),%_epSubFolder%)
$if($eq(%_isBroadcast%,1),%_broadcastSubFolder%)
$if($eq(%_isOther%,1),%_otherSubFolder%)
)
)
)
)
)
$noop(★ Album - YEAR [Media-Type][CDx~subtitle]/ or /CDx~subtitle/ ★)
%_albumForFilename% -
$if($if2(%date%,%originalyear%,%originaldate%),$left($if2(%date%,%originalyear%,%originaldate%),4),0000)
$if($ne(%media%,CD), $if(%media%,[%media%]))
$if($gt(%totaldiscs%,1),$noop(
)$if($lt(%totaldiscs%,10),$set(_discnumber,%discnumber%),$set(_discnumber,$num(%discnumber%,2)))$noop(
)$if($in(%media%,Vinyl),$noop(
)$set(_nameForDiscFolder,@OSLASH@@OBRACKET@%_nameForTypeVinyl%%_discnumber%@CBRACKET@),$noop(
)$set(_nameForDiscFolder,@OSLASH@@OBRACKET@%_nameForTypeCD%%_discnumber%@CBRACKET@))$noop(
)$if($and(%_discsubtitleForFilename%,$eq(%_showDiscSubtitle%,1)),$set(_nameForDiscFolder,%_nameForDiscFolder%~%_discsubtitleForFilename%))$noop(
)$if($eq(%_useSubDiscFolder%,1),$noop(
)$set(_nameForDiscFolder,$replace(%_nameForDiscFolder%,@OSLASH@@OBRACKET@,/))$noop(
)$set(_nameForDiscFolder,$replace(%_nameForDiscFolder%,@CBRACKET@,)),$noop(
)$if($eq(%_mergeDiscWhenNotUsingSubfolder%,1),$noop(
)$unset(_nameForDiscFolder),$noop(
)$set(_nameForDiscFolder,$replace(%_nameForDiscFolder%,@OSLASH@@OBRACKET@,[))$noop(
)$set(_nameForDiscFolder,$replace(%_nameForDiscFolder%,@CBRACKET@,]))$noop(
))$noop(
))$noop(
)$if(%_nameForDiscFolder%, %_nameForDiscFolder%)
)/
$noop(★ Track. Title ★)
$if($in(%media%,Vinyl),$noop(
)$if($eq(%_useMusicBrainzStyleForVinylTrack%,1),$noop(
)$if(%_musicbrainz_tracknumber%,%_musicbrainz_tracknumber%. )$noop(
)),$noop(
)$if(%tracknumber%,$if($gt(%totaldiscs%,1),$if($and($eq(%_useSubDiscFolder%,0),$eq(%_mergeDiscWhenNotUsingSubfolder%,1)),%discnumber%))$num(%tracknumber%,2). )
)
%_titleForFilename%