· 4 years ago · Dec 22, 2020, 11:06 PM
1Option Explicit
2'
3' Discogs Tagger Script for MediaMonkey ( Let & eepman & crap_inhuman )
4'
5Const VersionStr = "v5.77"
6
7'Changes from 5.76 to 5.77 by crap_inhuman in 10.2020
8' Added option to show the qty of release format in format tag (i.e. 2 x CD)
9
10
11'Changes from 5.75 to 5.76 by crap_inhuman in 09.2020
12' Bug with additional images while tagging one track removed
13' Option to choose matching engine added
14
15
16'Changes from 5.74 to 5.75 by crap_inhuman in 05.2020
17' Some changes made in matching method
18
19
20'Changes from 5.73 to 5.74 by crap_inhuman in 04.2020
21' The following chars ´ , ` , ’ , ‘ , ” , “ are replaced by '
22' Fixed tracknumber bug
23' Changed the matching method (Thanks to DJ Samhein)
24
25
26'Changes from 5.72 to 5.73 by crap_inhuman in 04.2020
27' Fixed trackname-bug
28' A ’ will now replaced by ' , too
29
30
31'Changes from 5.71 to 5.72 by crap_inhuman in 04.2020
32' Added option to replace a ´ and ` with a '
33' Added option to search at Metal-Archives.com
34' Removed issues with multi-disc albums, need MediaMonkey Version 4.1.28.1905 or above
35
36
37'Changes from 5.70 to 5.71 by crap_inhuman in 09.2019
38' Small bugfix from new release yesterday
39
40
41'Changes from 5.69 to 5.70 by crap_inhuman in 09.2019
42' Bug removed: Track-numbering didn't work with more than one char in rare cases
43
44
45'Changes from 5.68 to 5.69 by crap_inhuman in 07.2019
46' Added 'Video' to the CD tag list
47
48
49'Changes from 5.67 to 5.68 by crap_inhuman in 05.2019
50' Now the track-numbering start with the Disc-numbering
51
52
53'Changes from 5.66 to 5.67 by crap_inhuman in 05.2019
54' Changed the Side to Disc function (2 Vinyl sides are one disc)
55' Added a "Deselect all" button
56
57
58'Changes from 5.65 to 5.66 by crap_inhuman in 04.2019
59' Changed the Authorize links to work with Windows 10
60
61
62'Changes from 5.64 to 5.65 by crap_inhuman in 04.2019
63' Added option to change media format separator
64
65
66'Changes from 5.63 to 5.64 by crap_inhuman in 11.2018
67' Bug removed with mixed media format
68' Select Grouping (not ready yet)
69' Add Start/Stop button for track refresh
70
71
72'Changes from 5.62 to 5.63 by crap_inhuman in 09.2018
73' Musicbrainz: New Bug in Label subroutine removed
74
75
76'Changes from 5.61 to 5.62 by crap_inhuman in 09.2018
77' Musicbrainz: Bug removed: Label with no name stop the script
78
79
80'Changes from 5.60 to 5.61 by crap_inhuman in 07.2018
81' Bug removed: Format checkbox didn't work
82
83
84'Changes from 5.59 to 5.60 by crap_inhuman in 06.2018
85' Added new option to store the name of grouped tracks into the grouping tag
86' Added changeable separator for sub-tracks
87
88
89'Changes from 5.58 to 5.59 by crap_inhuman in 04.2018
90' The script now use secure channel (https) while fetching data
91' Workaround for Discogs date of master release bug: date is now empty instead number 0
92
93
94'Changes from 5.57 to 5.58 by crap_inhuman in 02.2018
95' Repaired the artist tagging
96
97
98'Changes from 5.56 to 5.57 by crap_inhuman in 02.2018
99' Choose artist for tagging back to his old place
100' Choose Track# and Disc# for tagging back on the main window
101
102
103'Changes from 5.55 to 5.56 by crap_inhuman in 02.2018
104' Changed some visual things to be more user-friendly
105' Authorize the Discogs Tagger should now be more user-friendly
106' Every individual genre and style can now selected
107' Bug removed: if last track is a sub-track, it didn't recognized as sub-track
108' Updating the track titles can now be turned off
109
110
111'Changes from 5.54 to 5.55 by crap_inhuman in 01.2018
112' Now choose your favourite tagger (Discogs or MusicBrainz) from options in the right upper corner
113' Bug removed: a slash (/) in folder-names will not stop the script anymore
114
115
116'Changes from 5.53 to 5.54 by crap_inhuman in 12.2017
117' Discogs Tagger use the title-name of the first selected track for search at Discogs, if no album name was found
118
119
120'Changes from 5.52 to 5.53 by crap_inhuman in 12.2017
121' Improved identification of Release/Master/Label/Artist Discogs Numbers e.g. [r12345], [m12345], [l12345], [a12345]
122' Fixed identification of master url
123
124
125'Changes from 5.51 to 5.52 by crap_inhuman in 09.2017
126' Now check status-code while image download
127' Return to 'MSXML2.ServerXMLHTTP.6.0' for MusicBrainz search
128' Improved some code
129
130
131'Changes from 5.50 to 5.51 by crap_inhuman in 09.2017
132' Secure channel error: Replaced all 'MSXML2.ServerXMLHTTP.6.0' with 'MSXML2.XMLHTTP.6.0'
133
134
135'Changes from 5.49 to 5.50 by crap_inhuman in 09.2017
136' Secure channel error: Replaced 'MSXML2.ServerXMLHTTP.6.0' with 'MSXML2.XMLHTTP.6.0' for image download
137' Added third option for date field
138
139
140'Changes from 5.48 to 5.49 by crap_inhuman in 08.2017
141' Changed the 'where to store date' option
142
143
144'Changes from 5.47 to 5.48 by crap_inhuman in 06.2017
145' Added forgotten blank
146' Added "Ignore featuring artist" option
147
148
149'Changes from 5.46 to 5.47 by crap_inhuman in 06.2017
150' Added the feature "Add leading zero (Disc#)"
151
152
153'Changes from 5.45 to 5.46 by crap_inhuman in 05.2017
154' Skip Extra-Artists without artistname in musicbrainz-tagger
155' Changed Musicbrainz logo
156' "Feat."-Function repaired
157' Searching at Musicbrainz should now be better
158
159
160'Changes from 5.44 to 5.45 by crap_inhuman in 11.2016
161' Bug with leading zero removed
162' Added option for limiting releases
163
164
165'Changes from 5.43 to 5.44 by crap_inhuman in 11.2016
166' Bug with Release Date / Original Date removed
167' In Advanced Search hitting enter will trigger search
168' Changed error message if no release found
169
170
171'Changes from 5.42 to 5.43 by crap_inhuman in 11.2016
172' Leading/Trailing spaces will now detected and deleted in album-name, too.
173' Changing the release will reset the selected tracks
174' Added option for choosing where to store Release Date/Original Date
175
176
177'Changes from 5.41 to 5.42 by crap_inhuman in 10.2016
178' Leading/Trailing spaces will now detected and deleted in track-names and the release number
179' will be send to mysql db, a busy bee will then fix it at Discogs (Hopefully) ;)
180
181
182'Changes from 5.40 to 5.41 by crap_inhuman in 10.2016
183' Small bugfixes
184
185
186'Changes from 5.39 to 5.40 by crap_inhuman in 06.2016
187' Discogs: Removed bug with featuring artist in the albumartist
188' Musicbrainz: Removed one of the two blank character in featuring artist
189' Trackname removed from first search
190
191
192'Changes from 5.38 to 5.39 by crap_inhuman in 04.2016
193' The check if it's already in Discogs Collection can be turned off
194' Added option to delete duplicated entries in tags
195
196
197'Changes from 5.37 to 5.38 by crap_inhuman in 03.2016
198' Redirected back to my webspace
199' Added new feature: Add the selected album to your Discogs Collection
200
201
202'Changes from 5.36a to 5.37 by crap_inhuman in 03.2016
203' Changed the authorize script
204
205
206'Changes from 5.36 to 5.36a by crap_inhuman in 03.2016
207' Changed from HTTP to HTTPS - using free webspace discogstagger.hol.es
208
209
210'Changes from 5.35 to 5.36 by crap_inhuman in 01.2016
211' Bug with empty Label removed
212
213
214'Changes from 5.34 to 5.35 by crap_inhuman in 01.2016
215' Changed feat. Artist function: Now you can use ";" for separator
216' Fixed some Artist-Separator bugs
217
218
219'Changes from 5.33 to 5.34 by crap_inhuman in 01.2016
220' Artist search now use discogs artist-id
221
222
223'Changes from 5.32 to 5.33 by crap_inhuman in 12.2015
224' Added advanced search button
225' Added option: Move The in artist name to the end
226
227
228'Changes from 5.31 to 5.32 by crap_inhuman in 12.2015
229' Search improved for more accurate results
230
231
232'Changes from 5.30 to 5.31 by crap_inhuman in 11.2015
233' Choose what kind of search after entering search string
234
235
236'Changes from 5.29 to 5.30 by crap_inhuman in 11.2015
237' Fixed new bug with ampersand
238
239
240'Changes from 5.28 to 5.29 by crap_inhuman in 10.2015
241' Added Relationship-Attributes for Musicbrainz Credits
242' Fixed bug with additional musicbrainz images
243' Added support for foreign characters
244' Fixed bug with ampersand in artistname
245
246
247'Changes from 5.27 to 5.28 by crap_inhuman in 07.2015
248' Removed bug with unselecting tracks
249
250
251'Changes from 5.26 to 5.27 by crap_inhuman in 07.2015
252' Removed bug with joint artists
253
254
255'Changes from 5.25 to 5.26 by crap_inhuman in 07.2015
256' Comma removed after artist
257
258
259'Changes from 5.24 to 5.25 by crap_inhuman in 06.2015
260' Comment Tag added to the Release info
261' Back to original Cover-Image saving-routine
262' Easier Discogs authorization
263
264
265'Changes from 5.23 to 5.24 by crap_inhuman in 04.2015
266' Added check for image before try download it.
267' Image-Proxy removed
268
269
270'Changes from 5.22 to 5.23 by crap_inhuman in 03.2015
271' Again a saving cover-image bug removed
272
273
274'Changes from 5.21 to 5.22 by crap_inhuman in 03.2015
275' Bug removed: mm hangs while downloading covers
276' Bug removed: the tags will be written, while cover is saving
277' The common filename masks are implemented (Title, Artist, AlbumArtist,…)
278
279
280'Changes from 5.20 to 5.21 by crap_inhuman in 03.2015
281' Saving cover-image bug removed
282
283
284'Changes from 5.19 to 5.20 by crap_inhuman in 03.2015
285' Removed CheckImmedSaveImage, the image(s) will now saved immediately
286' Changed Cover-Image saving-routine to store the images in the cache
287
288
289'Changes from 5.18 to 5.19 by crap_inhuman in 03.2015
290' Changed Image download due to recent changes on accessing images at discogs
291' Added check for new version once a day
292
293
294'Changes from 5.17 to 5.18 by crap_inhuman in 02.2015
295' Removed bug with Catalog/Release tag
296' Removed bug with featuring artist
297
298
299'Changes from 5.16 to 5.17 by crap_inhuman in 01.2015
300' Choosing "Master-Release" shows the Master-Release. Yes, really. ;)
301' Choosing "Versions of Master" shows all Versions (Releases) of the selected Master-Release.
302' If you selected a Release, the corresponding Master of this Release will choosen.
303' Added ISRC to CatalogTag
304
305
306'Changes from 5.15 to 5.16 by crap_inhuman in 01.2015
307' Removed bug with Extra-Artists
308
309
310'Changes from 5.14 to 5.15 by crap_inhuman in 01.2015
311' MusicBrainz: Tags with no value will no longer crash the script
312' MusicBrainz: The manual search now works
313' MusicBrainz: Some options which are not necessary are now hidden
314' Some small bugfixes
315
316
317'Changes from 5.13 to 5.14 by crap_inhuman in 11.2014
318' The Tagger now detect OAuth authentication error
319
320
321'Changes from 5.12 to 5.13 by crap_inhuman in 11.2014
322' More than one space between track positions doesn't stop the script anymore ;)
323' Changed subtrack error detection
324
325
326'Changes from 5.11 to 5.12 by crap_inhuman in 10.2014
327' Removed a bug with empty keyword fields in the options menu
328' Now only the search requests use oauth
329
330
331'Changes from 5.10 to 5.11 by crap_inhuman in 10.2014
332' New option "Save selected 'more images' after closing popup" fixed
333' New option "Don't copy empty values to non-empty fields" now works for genres/styles too
334' More Debug Output to Logfile
335
336
337'Changes from 5.01 to 5.10 by crap_inhuman in 10.2014
338' Changed unclear text
339' Change order in dropdown list of the search result, put label at the end
340' Added option to enter unwanted tags in involved people
341' Added option to save selected "More images" after closing the popup
342' Added option "Don't copy empty values to non-empty fields"
343' Now show the TrackCount of every release in the search result (only with musicbrainz)
344' Some small changes to the layout
345
346
347'Changes from 5.0 to 5.01 by crap_inhuman in 09.2014
348' Removed bug with search result
349' Removed bug if no release found
350
351
352'Changes from 4.52 to 5.0 by crap_inhuman in 09.2014
353' Changed OAuth Authorization procedure (now wait 30 seconds for authorize)
354' Added MusicBrainz for searching
355' Removed some small bugs
356
357
358'Changes from 4.51 to 4.52 by crap_inhuman in 08.2014
359' Changed OAuth Authorization procedure
360
361
362'Changes from 4.50 to 4.51 by crap_inhuman in 07.2014
363' Removed bug with & character in searchstring
364' Small bugfixes
365' Removed bug with empty results
366
367
368'Changes from 4.48 to 4.50 by crap_inhuman in 07.2014
369' Bug removed with utf-8 characters in searchstring (with big help from tillmanj !!)
370
371
372'Changes from 4.47 to 4.48 by crap_inhuman in 07.2014
373' In the options menu you can now enter the access token manually
374' Bug removed in Keywords routine
375
376
377'Changes from 4.46 to 4.47 by crap_inhuman in 07.2014
378' Changed the Delay - Function, WScript.sleep didn't work on all windows plattforms.
379
380
381'Changes from 4.45 to 4.46 by crap_inhuman in 07.2014
382' The default settings for saving the Cover Images can now be changed in the options menu
383' Bug removed: Empty format-tag produced an error
384' Bug removed: Parsing wrong Artist Roles if a comma is between box bracket
385' Added OAuth authentication
386' Added option: Using Metal-Archives for release search (BETA)
387' Now it's possible to use * as wildcard in the Keywords
388' Added option: Print every involved people in a single line
389
390
391'Changes from 4.44 to 4.45 by crap_inhuman in 05.2014
392' Bug removed: Didn't display the additional Image
393' Adjust the script for fetching the small album art
394' Adjust the script for removing leading and trailing spaces in Extra Artists
395' Add option to turn off subtrack detection
396
397
398'Changes from 4.43 to 4.44 by crap_inhuman in 04.2014
399' Added simple routine to check and remove point in track positions (1. , 2. , 3. )
400' Bug removed: track position part
401' Max count for releases is set to 250
402
403
404'Changes from 4.42 to 4.43 by crap_inhuman in 04.2014
405' Bug removed: Filter now work correctly
406' There's no max count for release results
407' Bug removed: Artist releases and Label releases work again
408
409
410'Changes from 4.41 to 4.42 by crap_inhuman in 03.2014
411' Bug removed: Sub-Track do not select(set) the song
412' Added the option for switching the last artist separator ("&" or "chosen separator")
413
414
415'Changes from 4.40 to 4.41 by crap_inhuman in 03.2014
416' Removed bug with more than one artist for a title
417' Added Artist separator to options menu
418' Added simple routine to check for false position separators
419
420
421'Changes from 4.39 to 4.40 by crap_inhuman in 03.2014
422' featuring Keywords are now not case sensitive
423
424
425'Changes from 4.38 to 4.39 by crap_inhuman in 03.2014
426' Keywords are now not case sensitive
427' Added Set Locale for supporting more countries
428
429
430'Changes from 4.37 to 4.38 by crap_inhuman in 02.2014
431' Added the Featuring Keywords
432' Fixed a bug with the new submission form of discogs
433
434
435'Changes from 4.36 to 4.37 by crap_inhuman in 02.2014
436' Changed the image access method
437
438
439'Changes from 4.35 to 4.36 by crap_inhuman in 11.2013
440' The script now shows the filtered total and the matched total
441
442
443'Changes from 4.34 to 4.35 by crap_inhuman in 11.2013
444' Raise the max count of release results to 100
445' Display the number of matched releases and which one you are viewing in the search bar
446
447
448'Changes from 4.33 to 4.34 by crap_inhuman in 11.2013
449' Now it's possible to change the search string in the top bar
450
451
452'Changes from 4.32 to 4.33 by crap_inhuman in 10.2013
453' Fixed a bug with the Separator
454
455
456'Changes from 4.31 to 4.32 by crap_inhuman in 10.2013
457' Removed bug in extra artist assignment
458' Added 'Don't save' and 4 more fields for saving release-number
459
460
461'Changes from 4.30 to 4.31 by crap_inhuman in 09.2013
462' Removed bug: Sub track name will not recognized if it is the last track
463' Removed bug: Script-Error occurred after closing the script-window, when no release found
464' Background of filter dropdown menu change to red if filter is selected (For better recognition)
465
466
467'Changes from 4.00 to 4.30 by crap_inhuman in 07-09.2013
468' Added Sub tracks option.
469' Added option 'Unselect tracks without track-number'
470' Some albums at discogs have 'Index-Tracks'.
471' These tracks aren't song-tracks (e.g. Track-Name: 'Bonus track' or 'Live side')
472' This option unselect these tracks automatically
473' -------------------------------------------------------
474' Show a warning if the number of songs are different
475' For the catalog-number, release-country and media-format you can choose "Don't save" in the option menu, if you don't need it.
476' You can edit the keywords for linking the composer, producer, conductor,... tags with discogs
477' included DiscogsImages: you can choose more than one image for an album
478' New Option: Check 'Save Image' Checkbox only if release have no image
479' New Option: Choose another field for saving Style
480
481
482'Changes from 3.65 to 4.00 by crap_inhuman in 07.2013
483' Bug removed with releases having leading zero in track-position
484' Added option for "Force NO Disc Usage". Helpful if a release have tracks with varying track-numbers (e.g. http://www.discogs.com/release/2942314 )
485' Without the option the script translate the varying track position to disc sides
486' Added option to show the original discogs track position
487' Moved the options to the left side for more place for the tracklisting
488' Moving the mouse-pointer over a checkbox now show more information about the usage
489' Now the chosen filters will be saved with the options
490' Choose one MediaType, MediaFormat, Country or Year from the drop-down list and save the options
491' or press one of the "Set ... Filter" button to select more than one Mediatype, MediaFormat, Country or Year
492' Choosing "Use ... Filter" in the drop-down list uses the custom filter-settings
493' Choosing "No ... Filter" from the drop-down list stop filtering the result
494' The Filter settings will only be saved if you press the "Save Options" button
495' The Custom Tags for saving the release, catalog, country and format will now be chosen in the options -> Discogs Tagger or during script installation
496' Showing the Data Quality of the Discogs release
497
498'Changes from 3.64 to 3.65 by crap_inhuman in 07.2013
499' Bug removed: bug with additional artists removed, which only occur in rare cases
500
501'Changes from 3.63 to 3.64 by crap_inhuman in 06.2013
502' Bug removed: selecting "Sides To Disc" and "Add Leading Zero", zero is dropped from track number and is displayed as a single digit
503
504'Changes from 3.62 to 3.63 by crap_inhuman in 02.2013 (not released)
505' Bug removed: no search result -> no output
506
507'Changes from 3.61 to 3.62 by crap_inhuman in 02.2013
508' Insert code for supporting french language machines
509' Comments will now be saved
510' Delete some unused but declared variables
511' Name for "feat." can be edit
512' Some small bugfixes
513
514'Changes from 3.6 to 3.61 by crap_inhuman in 02.2013
515' Removed a bug in the option 'Featuring Artist behind title'
516' Better implementation of the option 'Featuring Artist behind title'
517' Inserting Master and Release URLs now work in the Search-Panel
518
519'Changes from 3.5 to 3.6 by crap_inhuman in 02.2013
520' Implementation of eepman's JSON-Parser
521' Now read the user-specific Separator characters and use it for separating
522' Label / Artist / Master Search now using the JSON Parser too
523' Some bugfixes
524
525'Changes from 3.3 to 3.5 by crap_inhuman in 01.2013
526' Now you can choose which Custom Tag will be used for the Tags: ReleaseID, Catalog, Country and Format
527' The "Credits for ExtraArtists in tracks" will now saved in MediaMonkey !
528' Added option for "Add Leading zero to Tracknumbers"
529' Added option for "Include Producer"
530' Added JSON Parser for the new Discogs-API
531
532' Some bugfixes (Filter now working correct)
533' Added the option to choose the place for Featuring Artist (Artist or Title)
534' e.g. Aaliyah - We Need a Resolution (ft. Timbaland) -or- Aaliyah (ft. Timbaland) - We Need a Resolution
535' Changeable Name for "Various" Artists (Various Artists)
536' Added option for "Adding comment"
537' Get OriginalDate from Master-Release if available
538' The Script now reads the saved Discogs Release-ID from the chosen Release-Tag
539
540' ToDo: Add more tooltips to the html
541' Mediamonkey Bug: Erster und letzter Buchstabe in SearchArtist fehlt (wenn nächster Buchstabe blank ist e.g. "3 doors down", "Miss may i")
542' Wrong Publisher, Producer, etc. in Subtracks. The script only take the info from the first subtrack..
543' Adding Artist-Alias in Musicbrainz search
544
545
546' WebBrowser is visible browser object with display of discogs album info
547Dim WebBrowser
548
549' decoded json object representing currently selected release
550Dim CurrentRelease, QueryPage
551
552Dim UI
553
554Dim Results, ResultsReleaseID, NewResult
555Dim CurrentReleaseId, CurrentResultId
556Dim ini
557
558Dim CheckAlbum, CheckArtist, CheckAlbumArtist, CheckAlbumArtistFirst, CheckLabel, CheckDate, CheckOrigDate, CheckGenre
559Dim CheckCountry, CheckCover, CheckSmallCover, SmallCover, CheckStyle, CheckCatalog, CheckRelease, CheckInvolved, CheckLyricist, CheckGrouping
560Dim CheckComposer, CheckConductor, CheckProducer, CheckDiscNum, CheckTrackNum, CheckFormat, CheckUseAnv, CheckYearOnlyDate, CheckReplaceAccentChar
561Dim CheckForceNumeric, CheckSidesToDisc, CheckForceDisc, CheckNoDisc, CheckLeadingZero, CheckLeadingZeroDisc, CheckVarious, TxtVarious
562Dim CheckTitleFeaturing, CheckComment, CheckFeaturingName, TxtFeaturingName, CheckOriginalDiscogsTrack, CheckSaveImage, CheckLimitReleases
563Dim CheckStyleField, CheckTurnOffSubTrack, CheckInvolvedPeopleSingleLine, CheckDontFillEmptyFields, CheckTheBehindArtist, CheckNewMatchingEngine
564Dim CheckDiscogsCollectionOff, CheckDeleteDuplicatedEntry, StoreDate, OriginalDateRead, ReleaseDateRead
565Dim CheckIgnoreFeatArtist, CheckShowQtyFormat, SubTrackSeparator, trackRefresh, DiffNumberTracks
566REM Dim CheckUserCollection
567Dim DiscogsUsername, GUID
568Dim SubTrackNameSelection
569Dim CountryFilterList, MediaTypeFilterList, MediaFormatFilterList, YearFilterList
570Dim LyricistKeywords, ConductorKeywords, ProducerKeywords, ComposerKeywords, FeaturingKeywords, UnwantedKeywords
571
572Dim SavedReleaseId
573Dim NewSearchTerm, NewSearchArtist, NewSearchAlbum, NewSearchTrack
574Dim SavedSearchArtist, SavedSearchAlbum
575Dim SavedMasterID, SavedArtistID, SavedLabelID
576
577Dim FilterMediaType, FilterCountry, FilterYear, FilterMediaFormat, CurrentLoadType
578Dim NewGenre, GenresList, GenresSelect
579Dim MediaTypeList, MediaFormatList, CountryList, CountryCode, YearList, AlternativeList, LoadList, RelationAttrList
580Dim FormatSeparator, ArtistSeparator, ArtistLastSeparator, LimitReleases, Grouping
581
582Dim FirstTrack, Errormessage
583Dim AlbumArtURL, AlbumArtThumbNail
584Dim iMaxTracks
585Dim iAutoTrackNumber, iAutoDiscNumber, iAutoDiscFormat
586Dim LastDisc
587Dim SelectAll
588Dim UnselectedTracks(1000)
589Dim UnselectedTrackNames(1000)
590Dim CheckNewVersion, LastCheck
591Dim DiscTrackOrder1()
592Dim DiscTrackOrder2()
593Dim DiscTrackOrder3()
594Dim NewTrackOrder()
595Dim NewTrackOrder2()
596Dim NewTrackOrder3()
597
598Dim ReleaseTag, CountryTag, CatalogTag, FormatTag
599Dim OriginalDate, Separator
600Dim OptionsChanged, UserAgent
601Dim AccessToken, AccessTokenSecret
602
603Dim fso, loc, logf
604
605REM QueryPage = "Discogs"
606REM QueryPage = "MusicBrainz"
607REM QueryPage = "MetalArchives"
608
609REM SearchFor = 1 = Artist
610REM SearchFor = 2 = Album
611REM SearchFor = 3 = Release
612
613'----------------------------------DiscogsImages----------------------------------------
614Dim SaveImageType, SaveImage, CoverStorage, CoverStorageName
615Dim FileNameList, ImageTypeList, ImageList, ImageLocal
616Dim list
617Dim ImagesCount
618Dim SaveMoreImages
619Dim WebBrowser3
620Dim SelectedSongsGlobal
621
622Set ImageTypeList = SDB.NewStringList
623
624ImageTypeList.Add SDB.Localize("Not specified") '0
625ImageTypeList.Add SDB.Localize("Cover (front)") '3
626ImageTypeList.Add SDB.Localize("Cover (back)") '4
627ImageTypeList.Add SDB.Localize("Leaflet Page")
628ImageTypeList.Add SDB.Localize("Media Label")
629ImageTypeList.Add SDB.Localize("Lead Artist")
630ImageTypeList.Add SDB.Localize("Artist")
631ImageTypeList.Add SDB.Localize("Conductor")
632ImageTypeList.Add SDB.Localize("Band")
633ImageTypeList.Add SDB.Localize("Composer")
634ImageTypeList.Add SDB.Localize("Lyricist")
635ImageTypeList.Add SDB.Localize("Recording Location")
636ImageTypeList.Add SDB.Localize("During Recording")
637ImageTypeList.Add SDB.Localize("During Performance")
638ImageTypeList.Add SDB.Localize("Video Screen Capture")
639ImageTypeList.Add SDB.Localize("Illustration")
640ImageTypeList.Add SDB.Localize("Band Logotype")
641ImageTypeList.Add SDB.Localize("Publisher Logotype") '20
642'----------------------------------DiscogsImages----------------------------------------
643
644' Easier access of SDB.UI
645Set UI = SDB.UI
646Dim sTemp
647sTemp = SDB.TemporaryFolder
648
649' MediaMonkey calls this method whenever a search is started using this script
650Sub StartSearchType(Panel, SearchTerm, SearchArtist, SearchAlbum, SearchType)
651
652 Dim tmpCountry, tmpCountry2, tmpMediaType, tmpMediaType2, tmpMediaFormat, tmpMediaFormat2, tmpYear, tmpYear2
653 Dim i, a, tmp, ret
654 Set CountryFilterList = SDB.NewStringList
655 Set MediaTypeFilterList = SDB.NewStringList
656 Set MediaFormatFilterList = SDB.NewStringList
657 Set YearFilterList = SDB.NewStringList
658
659 OptionsChanged = False
660 NewResult = True
661
662 If SearchType = 1 Then QueryPage = "Discogs"
663 If SearchType = 2 Then QueryPage = "MusicBrainz"
664 If SearchType = 3 Then QueryPage = "MetalArchives"
665
666 '*FilterList.Item(0) = "0" -> No Filter
667 '*FilterList.Item(0) = "1" -> Custom Filter
668 '*FilterList.Item(0) = "2" -> Selected Country/MediaType/MediaFormat/Year
669
670 Set ini = SDB.IniFile
671 If Not (ini Is Nothing) Then
672 'We init default settings only if they do not exist in ini file yet
673 If ini.StringValue("DiscogsAutoTagWeb","CheckAlbum") = "" Then
674 ini.BoolValue("DiscogsAutoTagWeb","CheckAlbum") = True
675 End If
676 If ini.StringValue("DiscogsAutoTagWeb","CheckArtist") = "" Then
677 ini.BoolValue("DiscogsAutoTagWeb","CheckArtist") = True
678 End If
679 If ini.StringValue("DiscogsAutoTagWeb","CheckAlbumArtist") = "" Then
680 ini.BoolValue("DiscogsAutoTagWeb","CheckAlbumArtist") = True
681 End If
682 If ini.StringValue("DiscogsAutoTagWeb","CheckAlbumArtistFirst") = "" Then
683 ini.BoolValue("DiscogsAutoTagWeb","CheckAlbumArtistFirst") = False
684 End If
685 If ini.StringValue("DiscogsAutoTagWeb","CheckLabel") = "" Then
686 ini.BoolValue("DiscogsAutoTagWeb","CheckLabel") = True
687 End If
688 If ini.StringValue("DiscogsAutoTagWeb","CheckDate") = "" Then
689 ini.BoolValue("DiscogsAutoTagWeb","CheckDate") = True
690 End If
691 If ini.StringValue("DiscogsAutoTagWeb","CheckOrigDate") = "" Then
692 ini.BoolValue("DiscogsAutoTagWeb","CheckOrigDate") = False
693 End If
694 If ini.StringValue("DiscogsAutoTagWeb","CheckGenre") = "" Then
695 ini.BoolValue("DiscogsAutoTagWeb","CheckGenre") = False
696 End If
697 If ini.StringValue("DiscogsAutoTagWeb","CheckStyle") = "" Then
698 ini.BoolValue("DiscogsAutoTagWeb","CheckStyle") = True
699 End If
700 If ini.StringValue("DiscogsAutoTagWeb","CheckCountry") = "" Then
701 ini.BoolValue("DiscogsAutoTagWeb","CheckCountry") = True
702 End If
703 If ini.StringValue("DiscogsAutoTagWeb","CheckSaveImage") = "" Then
704 ini.StringValue("DiscogsAutoTagWeb","CheckSaveImage") = 1
705 End If
706 If ini.StringValue("DiscogsAutoTagWeb","CheckSmallCover") = "" Then
707 ini.BoolValue("DiscogsAutoTagWeb","CheckSmallCover") = False
708 End If
709 If ini.StringValue("DiscogsAutoTagWeb","CheckCatalog") = "" Then
710 ini.BoolValue("DiscogsAutoTagWeb","CheckCatalog") = True
711 End If
712 If ini.StringValue("DiscogsAutoTagWeb","CheckRelease") = "" Then
713 ini.BoolValue("DiscogsAutoTagWeb","CheckRelease") = True
714 End If
715 If ini.StringValue("DiscogsAutoTagWeb","CheckInvolved") = "" Then
716 ini.BoolValue("DiscogsAutoTagWeb","CheckInvolved") = False
717 End If
718 If ini.StringValue("DiscogsAutoTagWeb","CheckGrouping") = "" Then
719 ini.BoolValue("DiscogsAutoTagWeb","CheckGrouping") = False
720 End If
721 If ini.StringValue("DiscogsAutoTagWeb","CheckLyricist") = "" Then
722 ini.BoolValue("DiscogsAutoTagWeb","CheckLyricist") = False
723 End If
724 If ini.StringValue("DiscogsAutoTagWeb","CheckComposer") = "" Then
725 ini.BoolValue("DiscogsAutoTagWeb","CheckComposer") = False
726 End If
727 If ini.StringValue("DiscogsAutoTagWeb","CheckConductor") = "" Then
728 ini.BoolValue("DiscogsAutoTagWeb","CheckConductor") = False
729 End If
730 If ini.StringValue("DiscogsAutoTagWeb","CheckProducer") = "" Then
731 ini.BoolValue("DiscogsAutoTagWeb","CheckProducer") = False
732 End If
733 If ini.StringValue("DiscogsAutoTagWeb","CheckDiscNum") = "" Then
734 ini.BoolValue("DiscogsAutoTagWeb","CheckDiscNum") = True
735 End If
736 If ini.StringValue("DiscogsAutoTagWeb","CheckTrackNum") = "" Then
737 ini.BoolValue("DiscogsAutoTagWeb","CheckTrackNum") = True
738 End If
739 If ini.StringValue("DiscogsAutoTagWeb","CheckFormat") = "" Then
740 ini.BoolValue("DiscogsAutoTagWeb","CheckFormat") = True
741 End If
742 If ini.StringValue("DiscogsAutoTagWeb","CheckUseAnv") = "" Then
743 ini.BoolValue("DiscogsAutoTagWeb","CheckUseAnv") = False
744 End If
745 If ini.StringValue("DiscogsAutoTagWeb","CheckYearOnlyDate") = "" Then
746 ini.BoolValue("DiscogsAutoTagWeb","CheckYearOnlyDate") = False
747 End If
748 If ini.StringValue("DiscogsAutoTagWeb","CheckForceNumeric") = "" Then
749 ini.BoolValue("DiscogsAutoTagWeb","CheckForceNumeric") = False
750 End If
751 If ini.StringValue("DiscogsAutoTagWeb","CheckSidesToDisc") = "" Then
752 ini.BoolValue("DiscogsAutoTagWeb","CheckSidesToDisc") = False
753 End If
754 If ini.StringValue("DiscogsAutoTagWeb","CheckForceDisc") = "" Then
755 ini.BoolValue("DiscogsAutoTagWeb","CheckForceDisc") = False
756 End If
757 If ini.StringValue("DiscogsAutoTagWeb","CheckNoDisc") = "" Then
758 ini.BoolValue("DiscogsAutoTagWeb","CheckNoDisc") = False
759 End If
760 If ini.StringValue("DiscogsAutoTagWeb","CheckOriginalDiscogsTrack") = "" Then
761 ini.BoolValue("DiscogsAutoTagWeb","CheckOriginalDiscogsTrack") = False
762 End If
763 REM If ini.StringValue("DiscogsAutoTagWeb","CheckUserCollection") = "" Then
764 REM ini.BoolValue("DiscogsAutoTagWeb","CheckUserCollection") = False
765 REM End If
766 If ini.StringValue("DiscogsAutoTagWeb","ReleaseTag") = "" Then
767 ini.StringValue("DiscogsAutoTagWeb","ReleaseTag") = "Custom2"
768 End If
769 If ini.StringValue("DiscogsAutoTagWeb","CatalogTag") = "" Then
770 ini.StringValue("DiscogsAutoTagWeb","CatalogTag") = "Custom3"
771 End If
772 If ini.StringValue("DiscogsAutoTagWeb","CountryTag") = "" Then
773 ini.StringValue("DiscogsAutoTagWeb","CountryTag") = "Custom4"
774 End If
775 If ini.StringValue("DiscogsAutoTagWeb","FormatTag") = "" Then
776 ini.StringValue("DiscogsAutoTagWeb","FormatTag") = "Custom5"
777 End If
778 If ini.StringValue("DiscogsAutoTagWeb","CheckLeadingZero") = "" Then
779 ini.BoolValue("DiscogsAutoTagWeb","CheckLeadingZero") = True
780 End If
781 If ini.StringValue("DiscogsAutoTagWeb","CheckLeadingZeroDisc") = "" Then
782 ini.BoolValue("DiscogsAutoTagWeb","CheckLeadingZeroDisc") = False
783 End If
784 If ini.StringValue("DiscogsAutoTagWeb","CheckVarious") = "" Then
785 ini.BoolValue("DiscogsAutoTagWeb","CheckVarious") = False
786 End If
787 If ini.StringValue("DiscogsAutoTagWeb","TxtVarious") = "" Then
788 ini.StringValue("DiscogsAutoTagWeb","TxtVarious") = "Various Artists"
789 End If
790 If ini.StringValue("DiscogsAutoTagWeb","CheckTitleFeaturing") = "" Then
791 ini.BoolValue("DiscogsAutoTagWeb","CheckTitleFeaturing") = True
792 End If
793 If ini.StringValue("DiscogsAutoTagWeb","CheckFeaturingName") = "" Then
794 ini.BoolValue("DiscogsAutoTagWeb","CheckFeaturingName") = True
795 End If
796 If ini.StringValue("DiscogsAutoTagWeb","TxtFeaturingName") = "" Then
797 ini.StringValue("DiscogsAutoTagWeb","TxtFeaturingName") = "feat."
798 End If
799 If ini.StringValue("DiscogsAutoTagWeb","CheckComment") = "" Then
800 ini.BoolValue("DiscogsAutoTagWeb","CheckComment") = True
801 End If
802 If ini.StringValue("DiscogsAutoTagWeb","SubTrackNameSelection") = "" Then
803 ini.BoolValue("DiscogsAutoTagWeb","SubTrackNameSelection") = False
804 End If
805 If ini.StringValue("DiscogsAutoTagWeb","CurrentCountryFilter") = "" Then
806 tmp = "0"
807 For a = 1 To 262
808 tmp = tmp & ",0"
809 Next
810 ini.StringValue("DiscogsAutoTagWeb","CurrentCountryFilter") = tmp
811 End If
812
813 If ini.StringValue("DiscogsAutoTagWeb","CurrentMediaTypeFilter") = "" Then
814 tmp = "0"
815 For a = 1 To 38
816 tmp = tmp & ",0"
817 Next
818 ini.StringValue("DiscogsAutoTagWeb","CurrentMediaTypeFilter") = tmp
819 End If
820
821 If ini.StringValue("DiscogsAutoTagWeb","CurrentMediaFormatFilter") = "" Then
822 tmp = "0"
823 For a = 1 To 48
824 tmp = tmp & ",0"
825 Next
826 ini.StringValue("DiscogsAutoTagWeb","CurrentMediaFormatFilter") = tmp
827 End If
828
829 If ini.StringValue("DiscogsAutoTagWeb","CurrentYearFilter") = "" Then
830 tmp = "0"
831 For a = Year(Date) To 1900 Step -1
832 tmp = tmp & ",0"
833 Next
834 ini.StringValue("DiscogsAutoTagWeb","CurrentYearFilter") = tmp
835 End If
836
837 If ini.StringValue("DiscogsAutoTagWeb","LyricistKeywords") = "" Then
838 ini.StringValue("DiscogsAutoTagWeb","LyricistKeywords") = "Lyrics By,Words By"
839 End If
840 If ini.StringValue("DiscogsAutoTagWeb","ConductorKeywords") = "" Then
841 ini.StringValue("DiscogsAutoTagWeb","ConductorKeywords") = "Conductor"
842 End If
843 If ini.StringValue("DiscogsAutoTagWeb","ProducerKeywords") = "" Then
844 ini.StringValue("DiscogsAutoTagWeb","ProducerKeywords") = "Producer,Arranged By,Recorded By"
845 End If
846 If ini.StringValue("DiscogsAutoTagWeb","ComposerKeywords") = "" Then
847 ini.StringValue("DiscogsAutoTagWeb","ComposerKeywords") = "Composed By,Score,Written-By,Written By,Music By,Programmed By,Songwriter"
848 End If
849 If ini.StringValue("DiscogsAutoTagWeb","FeaturingKeywords") = "" Then
850 ini.StringValue("DiscogsAutoTagWeb","FeaturingKeywords") = "featuring,feat.,ft.,ft ,feat ,Rap,Rap [Featuring],Vocals [Featuring]"
851 End If
852 If ini.StringValue("DiscogsAutoTagWeb","UnwantedKeywords") = "" Then
853 ini.StringValue("DiscogsAutoTagWeb","UnwantedKeywords") = ""
854 End If
855 If ini.StringValue("DiscogsAutoTagWeb","CheckStyleField") = "" Then
856 ini.StringValue("DiscogsAutoTagWeb","CheckStyleField") = "Default (stored with Genre)"
857 End If
858 If ini.StringValue("DiscogsAutoTagWeb","ArtistSeparator") = "" Then
859 ini.StringValue("DiscogsAutoTagWeb","ArtistSeparator") = ", "
860 End If
861 If ini.StringValue("DiscogsAutoTagWeb","ArtistLastSeparator") = "" Then
862 ini.BoolValue("DiscogsAutoTagWeb","ArtistLastSeparator") = True
863 End If
864 If ini.StringValue("DiscogsAutoTagWeb","FormatSeparator") = "" Then
865 ini.StringValue("DiscogsAutoTagWeb","FormatSeparator") = ", "
866 End If
867 If ini.StringValue("DiscogsAutoTagWeb","CheckTurnOffSubTrack") = "" Then
868 ini.BoolValue("DiscogsAutoTagWeb","CheckTurnOffSubTrack") = False
869 End If
870
871 If ini.ValueExists("DiscogsAutoTagWeb","CheckNotAlwaysSaveimage") Then
872 ini.DeleteKey "DiscogsAutoTagWeb","CheckNotAlwaysSaveimage"
873 End If
874 If ini.StringValue("DiscogsAutoTagWeb","AccessToken") = "" Then
875 ini.StringValue("DiscogsAutoTagWeb","AccessToken") = ""
876 End If
877 If ini.StringValue("DiscogsAutoTagWeb","AccessTokenSecret") = "" Then
878 ini.StringValue("DiscogsAutoTagWeb","AccessTokenSecret") = ""
879 End If
880 REM If ini.StringValue("DiscogsAutoTagWeb","QueryPage") = "" Then
881 REM ini.StringValue("DiscogsAutoTagWeb","QueryPage") = "Discogs"
882 REM End If
883 If ini.StringValue("DiscogsAutoTagWeb","CheckInvolvedPeopleSingleLine") = "" Then
884 ini.BoolValue("DiscogsAutoTagWeb","CheckInvolvedPeopleSingleLine") = False
885 End If
886 If ini.StringValue("DiscogsAutoTagWeb","CheckDontFillEmptyFields") = "" Then
887 ini.BoolValue("DiscogsAutoTagWeb","CheckDontFillEmptyFields") = True
888 End If
889 If ini.StringValue("DiscogsAutoTagWeb","CheckNewVersion") = "" Then
890 ini.BoolValue("DiscogsAutoTagWeb","CheckNewVersion") = True
891 End If
892 If ini.StringValue("DiscogsAutoTagWeb","LastCheck") = "" Then
893 ini.StringValue("DiscogsAutoTagWeb","LastCheck") = "1"
894 End If
895 If ini.StringValue("DiscogsAutoTagWeb","CheckTheBehindArtist") = "" Then
896 ini.BoolValue("DiscogsAutoTagWeb","CheckTheBehindArtist") = False
897 End If
898 If ini.StringValue("DiscogsAutoTagWeb","DiscogsUsername") = "" Then
899 ini.StringValue("DiscogsAutoTagWeb","DiscogsUsername") = ""
900 End If
901 If ini.StringValue("DiscogsAutoTagWeb","CheckDiscogsCollectionOff") = "" Then
902 ini.BoolValue("DiscogsAutoTagWeb","CheckDiscogsCollectionOff") = True
903 End If
904 If ini.StringValue("DiscogsAutoTagWeb","CheckDeleteDuplicatedEntry") = "" Then
905 ini.BoolValue("DiscogsAutoTagWeb","CheckDeleteDuplicatedEntry") = False
906 End If
907 If ini.StringValue("DiscogsAutoTagWeb","StoreDate") = "" Then
908 ini.StringValue("DiscogsAutoTagWeb","StoreDate") = 0
909 End If
910 If ini.ValueExists("DiscogsAutoTagWeb","StoreOrgDate") Then
911 ini.DeleteKey "DiscogsAutoTagWeb","StoreOrgDate"
912 End If
913 If ini.StringValue("DiscogsAutoTagWeb","LimitReleases") = "" Then
914 ini.StringValue("DiscogsAutoTagWeb","LimitReleases") = 0
915 End If
916 If ini.StringValue("DiscogsAutoTagWeb","CheckIgnoreFeatArtist") = "" Then
917 ini.BoolValue("DiscogsAutoTagWeb","CheckIgnoreFeatArtist") = False
918 End If
919 If ini.StringValue("DiscogsAutoTagWeb","SubTrackSeparator") = "" Then
920 ini.StringValue("DiscogsAutoTagWeb","SubTrackSeparator") = ", "
921 End If
922 If ini.StringValue("DiscogsAutoTagWeb","CheckReplaceAccentChar") = "" Then
923 ini.BoolValue("DiscogsAutoTagWeb","CheckReplaceAccentChar") = False
924 End If
925 If ini.StringValue("DiscogsAutoTagWeb","CheckNewMatchingEngine") = "" Then
926 ini.BoolValue("DiscogsAutoTagWeb","CheckNewMatchingEngine") = True
927 End If
928 If ini.StringValue("DiscogsAutoTagWeb","CheckShowQtyFormat") = "" Then
929 ini.BoolValue("DiscogsAutoTagWeb","CheckShowQtyFormat") = False
930 End If
931
932
933
934
935 '----------------------------------DiscogsImages----------------------------------------
936 CoverStorage = ini.StringValue("PreviewSettings","DefaultCoverStorage")
937 'Coverstorage = 0 -> Save image to tag (if possible) otherwise save to file folder
938 'Coverstorage = 1 -> Save image to file folder
939 'Coverstorage = 2 -> Save image to cover folder (is deprecated and will not be supported !!)
940 'Coverstorage = 3 -> Save image to tag (if possible) and to file folder
941 If CoverStorage = 2 Then
942 Call SDB.MessageBox("Discogs Images: Your Cover Storage is not supported by DiscogsImages !",mtError,Array(mbOk))
943 Exit Sub
944 End If
945 CoverStorageName = ini.StringValue("AAMasks","Mask1")
946
947 '----------------------------------DiscogsImages----------------------------------------
948
949 End If
950
951 CheckAlbum = ini.BoolValue("DiscogsAutoTagWeb","CheckAlbum")
952 CheckArtist = ini.BoolValue("DiscogsAutoTagWeb","CheckArtist")
953 CheckAlbumArtist = ini.BoolValue("DiscogsAutoTagWeb","CheckAlbumArtist")
954 CheckAlbumArtistFirst = ini.BoolValue("DiscogsAutoTagWeb","CheckAlbumArtistFirst")
955 CheckLabel = ini.BoolValue("DiscogsAutoTagWeb","CheckLabel")
956 CheckDate = ini.BoolValue("DiscogsAutoTagWeb","CheckDate")
957 CheckOrigDate = ini.BoolValue("DiscogsAutoTagWeb","CheckOrigDate")
958 CheckGenre = ini.BoolValue("DiscogsAutoTagWeb","CheckGenre")
959 CheckStyle = ini.BoolValue("DiscogsAutoTagWeb","CheckStyle")
960 CheckCountry = ini.BoolValue("DiscogsAutoTagWeb","CheckCountry")
961 CheckSaveImage = ini.StringValue("DiscogsAutoTagWeb","CheckSaveImage")
962 CheckSmallCover = ini.BoolValue("DiscogsAutoTagWeb","CheckSmallCover")
963 CheckCatalog = ini.BoolValue("DiscogsAutoTagWeb","CheckCatalog")
964 CheckRelease = ini.BoolValue("DiscogsAutoTagWeb","CheckRelease")
965 CheckInvolved = ini.BoolValue("DiscogsAutoTagWeb","CheckInvolved")
966 CheckGrouping = ini.BoolValue("DiscogsAutoTagWeb","CheckGrouping")
967 CheckLyricist = ini.BoolValue("DiscogsAutoTagWeb","CheckLyricist")
968 CheckComposer = ini.BoolValue("DiscogsAutoTagWeb","CheckComposer")
969 CheckConductor = ini.BoolValue("DiscogsAutoTagWeb","CheckConductor")
970 CheckProducer = ini.BoolValue("DiscogsAutoTagWeb","CheckProducer")
971 CheckDiscNum = ini.BoolValue("DiscogsAutoTagWeb","CheckDiscNum")
972 CheckTrackNum = ini.BoolValue("DiscogsAutoTagWeb","CheckTrackNum")
973 CheckFormat = ini.BoolValue("DiscogsAutoTagWeb","CheckFormat")
974 CheckUseAnv = ini.BoolValue("DiscogsAutoTagWeb","CheckUseAnv")
975 CheckYearOnlyDate = ini.BoolValue("DiscogsAutoTagWeb","CheckYearOnlyDate")
976 CheckForceNumeric = ini.BoolValue("DiscogsAutoTagWeb","CheckForceNumeric")
977 CheckSidesToDisc = ini.BoolValue("DiscogsAutoTagWeb","CheckSidesToDisc")
978 CheckForceDisc = ini.BoolValue("DiscogsAutoTagWeb","CheckForceDisc")
979 CheckOriginalDiscogsTrack = ini.BoolValue("DiscogsAutoTagWeb","CheckOriginalDiscogsTrack")
980 CheckNoDisc = ini.BoolValue("DiscogsAutoTagWeb","CheckNoDisc")
981 REM CheckUserCollection = ini.BoolValue("DiscogsAutoTagWeb","CheckUserCollection")
982 DiscogsUsername = ini.StringValue("DiscogsAutoTagWeb","DiscogsUsername")
983 ReleaseTag = ini.StringValue("DiscogsAutoTagWeb","ReleaseTag")
984 CatalogTag = ini.StringValue("DiscogsAutoTagWeb","CatalogTag")
985 CountryTag = ini.StringValue("DiscogsAutoTagWeb","CountryTag")
986 FormatTag = ini.StringValue("DiscogsAutoTagWeb","FormatTag")
987 CheckLeadingZero = ini.BoolValue("DiscogsAutoTagWeb","CheckLeadingZero")
988 CheckLeadingZeroDisc = ini.BoolValue("DiscogsAutoTagWeb","CheckLeadingZeroDisc")
989 CheckVarious = ini.BoolValue("DiscogsAutoTagWeb","CheckVarious")
990 TxtVarious = ini.StringValue("DiscogsAutoTagWeb","TxtVarious")
991 CheckTitleFeaturing = ini.BoolValue("DiscogsAutoTagWeb","CheckTitleFeaturing")
992 CheckFeaturingName = ini.boolValue("DiscogsAutoTagWeb","CheckFeaturingName")
993 TxtFeaturingName = ini.StringValue("DiscogsAutoTagWeb","TxtFeaturingName")
994 CheckComment = ini.BoolValue("DiscogsAutoTagWeb","CheckComment")
995 SubTrackNameSelection = ini.BoolValue("DiscogsAutoTagWeb","SubTrackNameSelection")
996 Separator = ini.StringValue("Appearance","MultiStringSeparator")
997 tmpCountry = ini.StringValue("DiscogsAutoTagWeb","CurrentCountryFilter")
998 tmpCountry2 = Split(tmpCountry, ",")
999 If UBound(tmpCountry2) < 262 Then
1000 tmp = "0"
1001 For a = 1 To 263
1002 tmp = tmp & ",0"
1003 Next
1004 ini.StringValue("DiscogsAutoTagWeb","CurrentCountryFilter") = tmp
1005 tmpCountry2 = Split(tmp, ",")
1006 SDB.MessageBox "Country Filter was cleared", mtInformation, Array(mbOk)
1007 End If
1008 tmpMediaType = ini.StringValue("DiscogsAutoTagWeb","CurrentMediaTypeFilter")
1009 tmpMediaType2 = Split(tmpMediaType, ",")
1010 tmpMediaFormat = ini.StringValue("DiscogsAutoTagWeb","CurrentMediaFormatFilter")
1011 tmpMediaFormat2 = Split(tmpMediaFormat, ",")
1012 tmpYear = ini.StringValue("DiscogsAutoTagWeb","CurrentYearFilter")
1013 tmpYear2 = Split(tmpYear, ",")
1014 LyricistKeywords = ini.StringValue("DiscogsAutoTagWeb","LyricistKeywords")
1015 ConductorKeywords = ini.StringValue("DiscogsAutoTagWeb","ConductorKeywords")
1016 ProducerKeywords = ini.StringValue("DiscogsAutoTagWeb","ProducerKeywords")
1017 ComposerKeywords = ini.StringValue("DiscogsAutoTagWeb","ComposerKeywords")
1018 FeaturingKeywords = ini.StringValue("DiscogsAutoTagWeb","FeaturingKeywords")
1019 UnwantedKeywords = ini.StringValue("DiscogsAutoTagWeb","UnwantedKeywords")
1020 CheckStyleField = ini.StringValue("DiscogsAutoTagWeb","CheckStyleField")
1021 ArtistSeparator = ini.StringValue("DiscogsAutoTagWeb","ArtistSeparator")
1022 FormatSeparator = ini.StringValue("DiscogsAutoTagWeb","FormatSeparator")
1023 ArtistLastSeparator = ini.BoolValue("DiscogsAutoTagWeb","ArtistLastSeparator")
1024 CheckTurnOffSubTrack = ini.BoolValue("DiscogsAutoTagWeb","CheckTurnOffSubTrack")
1025 AccessToken = ini.StringValue("DiscogsAutoTagWeb","AccessToken")
1026 AccessTokenSecret = ini.StringValue("DiscogsAutoTagWeb","AccessTokenSecret")
1027 REM QueryPage = ini.StringValue("DiscogsAutoTagWeb","QueryPage")
1028 CheckInvolvedPeopleSingleLine = ini.BoolValue("DiscogsAutoTagWeb","CheckInvolvedPeopleSingleLine")
1029 CheckDontFillEmptyFields = ini.BoolValue("DiscogsAutoTagWeb","CheckDontFillEmptyFields")
1030 CheckNewVersion = ini.BoolValue("DiscogsAutoTagWeb","CheckNewVersion")
1031 LastCheck = ini.StringValue("DiscogsAutoTagWeb","LastCheck")
1032 CheckTheBehindArtist = ini.BoolValue("DiscogsAutoTagWeb","CheckTheBehindArtist")
1033 CheckDiscogsCollectionOff = ini.BoolValue("DiscogsAutoTagWeb","CheckDiscogsCollectionOff")
1034 CheckDeleteDuplicatedEntry = ini.BoolValue("DiscogsAutoTagWeb","CheckDeleteDuplicatedEntry")
1035 StoreDate = ini.StringValue("DiscogsAutoTagWeb","StoreDate")
1036 CheckLimitReleases = ini.StringValue("DiscogsAutoTagWeb","LimitReleases")
1037 CheckIgnoreFeatArtist = ini.BoolValue("DiscogsAutoTagWeb","CheckIgnoreFeatArtist")
1038 SubTrackSeparator = ini.StringValue("DiscogsAutoTagWeb","SubTrackSeparator")
1039 CheckReplaceAccentChar = ini.BoolValue("DiscogsAutoTagWeb","CheckReplaceAccentChar")
1040 CheckNewMatchingEngine = ini.BoolValue("DiscogsAutoTagWeb","CheckNewMatchingEngine")
1041 CheckShowQtyFormat = ini.BoolValue("DiscogsAutoTagWeb","CheckShowQtyFormat")
1042
1043 Separator = Left(Separator, Len(Separator)-1)
1044 Separator = Right(Separator, Len(Separator)-1)
1045
1046 CheckAlbumArtistFirst = False
1047
1048 SelectAll = True
1049
1050 Set MediaTypeList = SDB.NewStringList
1051 Set MediaFormatList = SDB.NewStringList
1052 Set CountryList = SDB.NewStringList
1053 Set CountryCode = SDB.NewStringList
1054 Set YearList = SDB.NewStringList
1055 Set AlternativeList = SDB.NewStringList
1056 Set LoadList = SDB.NewStringList
1057 Set RelationAttrList = SDB.NewStringList
1058
1059 If CheckLimitReleases = 0 Then
1060 LimitReleases = 50
1061 ElseIf CheckLimitReleases = 1 Then
1062 LimitReleases = 100
1063 ElseIf CheckLimitReleases = 2 Then
1064 LimitReleases = 200
1065 ElseIf CheckLimitReleases = 3 Then
1066 LimitReleases = 400
1067 End If
1068
1069 RelationAttrList.Add "Additional"
1070 RelationAttrList.Add "Assistant"
1071 RelationAttrList.Add "Associate"
1072 RelationAttrList.Add "Bonus"
1073 RelationAttrList.Add "Co"
1074 RelationAttrList.Add "Cover"
1075 RelationAttrList.Add "Executive"
1076 RelationAttrList.Add "Founder"
1077 RelationAttrList.Add "Guest"
1078 RelationAttrList.Add "Instrumental"
1079 RelationAttrList.Add "Live"
1080 RelationAttrList.Add "Medley"
1081 RelationAttrList.Add "Solo"
1082
1083 LoadList.Add "Search Results"
1084 LoadList.Add "Master Release"
1085 LoadList.Add "Versions of Master"
1086 LoadList.Add "Releases of Artist"
1087 LoadList.Add "Releases of Label"
1088
1089 MediaTypeList.Add "None"
1090 MediaTypeList.Add "Vinyl"
1091 MediaTypeList.Add "CD"
1092 MediaTypeList.Add "DVD"
1093 MediaTypeList.Add "Blu-Ray"
1094 MediaTypeList.Add "Cassette"
1095 MediaTypeList.Add "DAT"
1096 MediaTypeList.Add "Minidisc"
1097 MediaTypeList.Add "File"
1098 MediaTypeList.Add "Acetate"
1099 MediaTypeList.Add "Flexi-disc"
1100 MediaTypeList.Add "Lathe Cut"
1101 MediaTypeList.Add "Shellac"
1102 MediaTypeList.Add "Pathé Disc"
1103 MediaTypeList.Add "Edison Disc"
1104 MediaTypeList.Add "Cylinder"
1105 MediaTypeList.Add "CDr"
1106 MediaTypeList.Add "CDV"
1107 MediaTypeList.Add "DVDr"
1108 MediaTypeList.Add "HD DVD"
1109 MediaTypeList.Add "HD DVD-R"
1110 MediaTypeList.Add "Blue-ray-R"
1111 MediaTypeList.Add "4-Track Cartridge"
1112 MediaTypeList.Add "8-Track Cartridge"
1113 MediaTypeList.Add "DCC"
1114 MediaTypeList.Add "Microcassette"
1115 MediaTypeList.Add "Reel-To-Reel"
1116 MediaTypeList.Add "Betamax"
1117 MediaTypeList.Add "VHS"
1118 MediaTypeList.Add "Video 2000"
1119 MediaTypeList.Add "Laserdisc"
1120 MediaTypeList.Add "SelectaVision"
1121 MediaTypeList.Add "VHD"
1122 MediaTypeList.Add "MVD"
1123 MediaTypeList.Add "UMD"
1124 MediaTypeList.Add "Floppy Disk"
1125 MediaTypeList.Add "Memory Stick"
1126 MediaTypeList.Add "Hybrid"
1127 MediaTypeList.Add "Box Set"
1128
1129 MediaFormatList.Add "None"
1130 MediaFormatList.Add "Album"
1131 MediaFormatList.Add "Mini-Album"
1132 MediaFormatList.Add "Compilation"
1133 MediaFormatList.Add "Single"
1134 MediaFormatList.Add "Maxi-Single"
1135 MediaFormatList.Add "7"""
1136 MediaFormatList.Add "12"""
1137 MediaFormatList.Add "LP"
1138 MediaFormatList.Add "EP"
1139 MediaFormatList.Add "Single Sided"
1140 MediaFormatList.Add "Enhanced"
1141 MediaFormatList.Add "Limited Edition"
1142 MediaFormatList.Add "Reissue"
1143 MediaFormatList.Add "Remastered"
1144 MediaFormatList.Add "Repress"
1145 MediaFormatList.Add "Test Pressing"
1146 MediaFormatList.Add "Unofficial"
1147 MediaFormatList.Add "Promo"
1148 MediaFormatList.Add "White Label"
1149 MediaFormatList.Add "Mixed"
1150 MediaFormatList.Add "Sampler"
1151 MediaFormatList.Add "MP3"
1152 MediaFormatList.Add "FLAC"
1153 MediaFormatList.Add "16"""
1154 MediaFormatList.Add "11"""
1155 MediaFormatList.Add "10"""
1156 MediaFormatList.Add "9"""
1157 MediaFormatList.Add "8"""
1158 MediaFormatList.Add "6"""
1159 MediaFormatList.Add "5"""
1160 MediaFormatList.Add "4"""
1161 MediaFormatList.Add "3"""
1162 MediaFormatList.Add "45 RPM"
1163 MediaFormatList.Add "78 RPM"
1164 MediaFormatList.Add "Shape"
1165 MediaFormatList.Add "Card Backed"
1166 MediaFormatList.Add "Etched"
1167 MediaFormatList.Add "Picture Disc"
1168 MediaFormatList.Add "Stereo"
1169 MediaFormatList.Add "Mono"
1170 MediaFormatList.Add "Quadraphonic"
1171 MediaFormatList.Add "Ambisonic"
1172 MediaFormatList.Add "Mispress"
1173 MediaFormatList.Add "Misprint"
1174 MediaFormatList.Add "Partially Mixed"
1175 MediaFormatList.Add "Unofficial Release"
1176 MediaFormatList.Add "Partially Unofficial"
1177 MediaFormatList.Add "Copy Protected"
1178
1179 CountryList.Add "None"
1180 CountryList.Add "Australia"
1181 CountryList.Add "Belgium"
1182 CountryList.Add "Brazil"
1183 CountryList.Add "Canada"
1184 CountryList.Add "China"
1185 CountryList.Add "Cuba"
1186 CountryList.Add "France"
1187 CountryList.Add "Germany"
1188 CountryList.Add "Italy"
1189 CountryList.Add "Ireland"
1190 CountryList.Add "India"
1191 CountryList.Add "Jamaica"
1192 CountryList.Add "Japan"
1193 CountryList.Add "Mexico"
1194 CountryList.Add "Netherlands"
1195 CountryList.Add "New Zealand"
1196 CountryList.Add "Spain"
1197 CountryList.Add "Sweden"
1198 CountryList.Add "Switzerland"
1199 CountryList.Add "UK"
1200 CountryList.Add "US"
1201 CountryList.Add "=========="
1202 CountryList.Add "Worldwide"
1203 CountryList.Add "Africa"
1204 CountryList.Add "Asia"
1205 CountryList.Add "Australasia"
1206 CountryList.Add "Benelux"
1207 CountryList.Add "Central America"
1208 CountryList.Add "Europe"
1209 CountryList.Add "Gulf Cooperation Council"
1210 CountryList.Add "North America"
1211 CountryList.Add "Scandinavia"
1212 CountryList.Add "South America"
1213 CountryList.Add "==========="
1214 CountryList.Add "Afghanistan"
1215 CountryList.Add "Albania"
1216 CountryList.Add "Algeria"
1217 CountryList.Add "American Samoa"
1218 CountryList.Add "Andorra"
1219 CountryList.Add "Angola"
1220 CountryList.Add "Anguilla"
1221 CountryList.Add "Antarctica"
1222 CountryList.Add "Antigua and Barbuda"
1223 CountryList.Add "Argentina"
1224 CountryList.Add "Armenia"
1225 CountryList.Add "Aruba"
1226 CountryList.Add "Austria"
1227 CountryList.Add "Azerbaijan"
1228 CountryList.Add "Bahamas"
1229 CountryList.Add "Bahrain"
1230 CountryList.Add "Bangladesh"
1231 CountryList.Add "Barbados"
1232 CountryList.Add "Belarus"
1233 CountryList.Add "Belize"
1234 CountryList.Add "Benin"
1235 CountryList.Add "Bermuda"
1236 CountryList.Add "Bhutan"
1237 CountryList.Add "Bolivia, Plurinational State of"
1238 CountryList.Add "Bonaire, Sint Eustatius and Saba"
1239 CountryList.Add "Bosnia and Herzegovina"
1240 CountryList.Add "Botswana"
1241 CountryList.Add "Bouvet Island"
1242 CountryList.Add "British Indian Ocean Territory"
1243 CountryList.Add "Brunei Darussalam"
1244 CountryList.Add "Bulgaria"
1245 CountryList.Add "Burkina Faso"
1246 CountryList.Add "Burundi"
1247 CountryList.Add "Cabo Verde"
1248 CountryList.Add "Cambodia"
1249 CountryList.Add "Cameroon"
1250 CountryList.Add "Cayman Islands"
1251 CountryList.Add "Central African Republic"
1252 CountryList.Add "Chad"
1253 CountryList.Add "Chile"
1254 CountryList.Add "Christmas Island"
1255 CountryList.Add "Cocos (Keeling) Islands"
1256 CountryList.Add "Colombia"
1257 CountryList.Add "Comoros"
1258 CountryList.Add "Congo"
1259 CountryList.Add "Congo (the Democratic Republic of the)"
1260 CountryList.Add "Cook Islands"
1261 CountryList.Add "Costa Rica"
1262 CountryList.Add "Côte d'Ivoire"
1263 CountryList.Add "Croatia"
1264 CountryList.Add "Curaçao"
1265 CountryList.Add "Cyprus"
1266 CountryList.Add "Czech Republic"
1267 CountryList.Add "Czechoslovakia"
1268 CountryList.Add "Denmark"
1269 CountryList.Add "Djibouti"
1270 CountryList.Add "Dominica"
1271 CountryList.Add "Dominican Republic"
1272 CountryList.Add "Ecuador"
1273 CountryList.Add "Egypt"
1274 CountryList.Add "El Salvador"
1275 CountryList.Add "Equatorial Guinea"
1276 CountryList.Add "Eritrea"
1277 CountryList.Add "Estonia"
1278 CountryList.Add "Ethiopia"
1279 CountryList.Add "Falkland Islands [Malvinas]"
1280 CountryList.Add "Faroe Islands"
1281 CountryList.Add "Fiji"
1282 CountryList.Add "Finland"
1283 CountryList.Add "French Guiana"
1284 CountryList.Add "French Polynesia"
1285 CountryList.Add "French Southern Territories"
1286 CountryList.Add "Gabon"
1287 CountryList.Add "Gambia"
1288 CountryList.Add "Georgia"
1289 CountryList.Add "Ghana"
1290 CountryList.Add "Gibraltar"
1291 CountryList.Add "Greece"
1292 CountryList.Add "Greenland"
1293 CountryList.Add "Grenada"
1294 CountryList.Add "Guadeloupe"
1295 CountryList.Add "Guam"
1296 CountryList.Add "Guatemala"
1297 CountryList.Add "Guernsey"
1298 CountryList.Add "Guinea"
1299 CountryList.Add "Guinea-Bissau"
1300 CountryList.Add "Guyana"
1301 CountryList.Add "Haiti"
1302 CountryList.Add "Heard Island and McDonald Islands"
1303 CountryList.Add "Holy See [Vatican City State]"
1304 CountryList.Add "Honduras"
1305 CountryList.Add "Hong Kong"
1306 CountryList.Add "Hungary"
1307 CountryList.Add "Iceland"
1308 CountryList.Add "Indonesia"
1309 CountryList.Add "Iran (the Islamic Republic of)"
1310 CountryList.Add "Iraq"
1311 CountryList.Add "Isle of Man"
1312 CountryList.Add "Israel"
1313 CountryList.Add "Jersey"
1314 CountryList.Add "Jordan"
1315 CountryList.Add "Kazakhstan"
1316 CountryList.Add "Kenya"
1317 CountryList.Add "Kiribati"
1318 CountryList.Add "Korea (the Democratic People's Republic of)"
1319 CountryList.Add "Korea (the Republic of)"
1320 CountryList.Add "Kuwait"
1321 CountryList.Add "Kyrgyzstan"
1322 CountryList.Add "Lao People's Democratic Republic"
1323 CountryList.Add "Latvia"
1324 CountryList.Add "Lebanon"
1325 CountryList.Add "Lesotho"
1326 CountryList.Add "Liberia"
1327 CountryList.Add "Libya"
1328 CountryList.Add "Liechtenstein"
1329 CountryList.Add "Lithuania"
1330 CountryList.Add "Luxembourg"
1331 CountryList.Add "Macao"
1332 CountryList.Add "Macedonia (the former Yugoslav Republic of)"
1333 CountryList.Add "Madagascar"
1334 CountryList.Add "Malawi"
1335 CountryList.Add "Malaysia"
1336 CountryList.Add "Maldives"
1337 CountryList.Add "Mali"
1338 CountryList.Add "Malta"
1339 CountryList.Add "Marshall Islands"
1340 CountryList.Add "Martinique"
1341 CountryList.Add "Mauritania"
1342 CountryList.Add "Mauritius"
1343 CountryList.Add "Mayotte"
1344 CountryList.Add "Micronesia (the Federated States of)"
1345 CountryList.Add "Moldova (the Republic of)"
1346 CountryList.Add "Monaco"
1347 CountryList.Add "Mongolia"
1348 CountryList.Add "Montenegro"
1349 CountryList.Add "Montserrat"
1350 CountryList.Add "Morocco"
1351 CountryList.Add "Mozambique"
1352 CountryList.Add "Myanmar"
1353 CountryList.Add "Namibia"
1354 CountryList.Add "Nauru"
1355 CountryList.Add "Nepal"
1356 CountryList.Add "New Caledonia"
1357 CountryList.Add "Nicaragua"
1358 CountryList.Add "Niger"
1359 CountryList.Add "Nigeria"
1360 CountryList.Add "Niue"
1361 CountryList.Add "Norfolk Island"
1362 CountryList.Add "Northern Mariana Islands"
1363 CountryList.Add "Norway"
1364 CountryList.Add "Oman"
1365 CountryList.Add "Pakistan"
1366 CountryList.Add "Palau"
1367 CountryList.Add "Palestine, State of"
1368 CountryList.Add "Panama"
1369 CountryList.Add "Papua New Guinea"
1370 CountryList.Add "Paraguay"
1371 CountryList.Add "Peru"
1372 CountryList.Add "Philippines"
1373 CountryList.Add "Pitcairn"
1374 CountryList.Add "Poland"
1375 CountryList.Add "Portugal"
1376 CountryList.Add "Puerto Rico"
1377 CountryList.Add "Qatar"
1378 CountryList.Add "Réunion"
1379 CountryList.Add "Romania"
1380 CountryList.Add "Russian Federation"
1381 CountryList.Add "Rwanda"
1382 CountryList.Add "Saint Barthélemy"
1383 CountryList.Add "Saint Helena, Ascension and Tristan da Cunha"
1384 CountryList.Add "Saint Kitts and Nevis"
1385 CountryList.Add "Saint Lucia"
1386 CountryList.Add "Saint Martin (French part)"
1387 CountryList.Add "Saint Pierre and Miquelon"
1388 CountryList.Add "Saint Vincent and the Grenadines"
1389 CountryList.Add "Samoa"
1390 CountryList.Add "San Marino"
1391 CountryList.Add "Sao Tome and Principe"
1392 CountryList.Add "Saudi Arabia"
1393 CountryList.Add "Senegal"
1394 CountryList.Add "Serbia"
1395 CountryList.Add "Seychelles"
1396 CountryList.Add "Sierra Leone"
1397 CountryList.Add "Singapore"
1398 CountryList.Add "Sint Maarten (Dutch part)"
1399 CountryList.Add "Slovakia"
1400 CountryList.Add "Slovenia"
1401 CountryList.Add "Solomon Islands"
1402 CountryList.Add "Somalia"
1403 CountryList.Add "South Africa"
1404 CountryList.Add "South Georgia and the South Sandwich Islands"
1405 CountryList.Add "South Sudan "
1406 CountryList.Add "Sri Lanka"
1407 CountryList.Add "Sudan"
1408 CountryList.Add "Suriname"
1409 CountryList.Add "Svalbard and Jan Mayen"
1410 CountryList.Add "Swaziland"
1411 CountryList.Add "Syrian Arab Republic"
1412 CountryList.Add "Taiwan (Province of China)"
1413 CountryList.Add "Tajikistan"
1414 CountryList.Add "Tanzania, United Republic of"
1415 CountryList.Add "Thailand"
1416 CountryList.Add "Timor-Leste"
1417 CountryList.Add "Togo"
1418 CountryList.Add "Tokelau"
1419 CountryList.Add "Tonga"
1420 CountryList.Add "Trinidad and Tobago"
1421 CountryList.Add "Tunisia"
1422 CountryList.Add "Turkey"
1423 CountryList.Add "Turkmenistan"
1424 CountryList.Add "Turks and Caicos Islands"
1425 CountryList.Add "Tuvalu"
1426 CountryList.Add "Uganda"
1427 CountryList.Add "Ukraine"
1428 CountryList.Add "United Arab Emirates"
1429 CountryList.Add "United States Minor Outlying Islands"
1430 CountryList.Add "Uruguay"
1431 CountryList.Add "Uzbekistan"
1432 CountryList.Add "Vanuatu"
1433 CountryList.Add "Venezuela, Bolivarian Republic of "
1434 CountryList.Add "Viet Nam"
1435 CountryList.Add "Virgin Islands (British)"
1436 CountryList.Add "Virgin Islands (U.S.)"
1437 CountryList.Add "Wallis and Futuna"
1438 CountryList.Add "Western Sahara"
1439 CountryList.Add "Yemen"
1440 CountryList.Add "Zambia"
1441 CountryList.Add "Zimbabwe"
1442
1443 CountryCode.Add ""
1444 CountryCode.Add "AU"
1445 CountryCode.Add "BE"
1446 CountryCode.Add "BR"
1447 CountryCode.Add "CA"
1448 CountryCode.Add "CN"
1449 CountryCode.Add "CU"
1450 CountryCode.Add "FR"
1451 CountryCode.Add "DE"
1452 CountryCode.Add "IT"
1453 CountryCode.Add "IE"
1454 CountryCode.Add "IN"
1455 CountryCode.Add "JM"
1456 CountryCode.Add "JP"
1457 CountryCode.Add "MX"
1458 CountryCode.Add "NL"
1459 CountryCode.Add "NZ"
1460 CountryCode.Add "ES"
1461 CountryCode.Add "SE"
1462 CountryCode.Add "CH"
1463 CountryCode.Add "GB"
1464 CountryCode.Add "US"
1465 CountryCode.Add ""
1466 CountryCode.Add "XW"
1467 CountryCode.Add ""
1468 CountryCode.Add ""
1469 CountryCode.Add ""
1470 CountryCode.Add ""
1471 CountryCode.Add ""
1472 CountryCode.Add "XE"
1473 CountryCode.Add ""
1474 CountryCode.Add ""
1475 CountryCode.Add ""
1476 CountryCode.Add ""
1477 CountryCode.Add ""
1478 CountryCode.Add "AF"
1479 CountryCode.Add "AL"
1480 CountryCode.Add "DZ"
1481 CountryCode.Add "AS"
1482 CountryCode.Add "AD"
1483 CountryCode.Add "AO"
1484 CountryCode.Add "AI"
1485 CountryCode.Add "AQ"
1486 CountryCode.Add "AG"
1487 CountryCode.Add "AR"
1488 CountryCode.Add "AM"
1489 CountryCode.Add "AW"
1490 CountryCode.Add "AT"
1491 CountryCode.Add "AZ"
1492 CountryCode.Add "BS"
1493 CountryCode.Add "BH"
1494 CountryCode.Add "BD"
1495 CountryCode.Add "BB"
1496 CountryCode.Add "BY"
1497 CountryCode.Add "BZ"
1498 CountryCode.Add "BJ"
1499 CountryCode.Add "BM"
1500 CountryCode.Add "BT"
1501 CountryCode.Add "BO"
1502 CountryCode.Add "BQ"
1503 CountryCode.Add "BA"
1504 CountryCode.Add "BW"
1505 CountryCode.Add "BV"
1506 CountryCode.Add "IO"
1507 CountryCode.Add "BN"
1508 CountryCode.Add "BG"
1509 CountryCode.Add "BF"
1510 CountryCode.Add "BI"
1511 CountryCode.Add "CV"
1512 CountryCode.Add "KH"
1513 CountryCode.Add "CM"
1514 CountryCode.Add "KY"
1515 CountryCode.Add "CF"
1516 CountryCode.Add "TD"
1517 CountryCode.Add "CL"
1518 CountryCode.Add "CX"
1519 CountryCode.Add "CC"
1520 CountryCode.Add "CO"
1521 CountryCode.Add "KM"
1522 CountryCode.Add "CG"
1523 CountryCode.Add "CD"
1524 CountryCode.Add "CK"
1525 CountryCode.Add "CR"
1526 CountryCode.Add "CI"
1527 CountryCode.Add "HR"
1528 CountryCode.Add "CW"
1529 CountryCode.Add "CY"
1530 CountryCode.Add "CZ"
1531 CountryCode.Add "XC"
1532 CountryCode.Add "DK"
1533 CountryCode.Add "DJ"
1534 CountryCode.Add "DM"
1535 CountryCode.Add "DO"
1536 CountryCode.Add "EC"
1537 CountryCode.Add "EG"
1538 CountryCode.Add "SV"
1539 CountryCode.Add "GQ"
1540 CountryCode.Add "ER"
1541 CountryCode.Add "EE"
1542 CountryCode.Add "ET"
1543 CountryCode.Add "FK"
1544 CountryCode.Add "FO"
1545 CountryCode.Add "FJ"
1546 CountryCode.Add "FI"
1547 CountryCode.Add "GF"
1548 CountryCode.Add "PF"
1549 CountryCode.Add "TF"
1550 CountryCode.Add "GA"
1551 CountryCode.Add "GM"
1552 CountryCode.Add "GE"
1553 CountryCode.Add "GH"
1554 CountryCode.Add "GI"
1555 CountryCode.Add "GR"
1556 CountryCode.Add "GL"
1557 CountryCode.Add "GD"
1558 CountryCode.Add "GP"
1559 CountryCode.Add "GU"
1560 CountryCode.Add "GT"
1561 CountryCode.Add "GG"
1562 CountryCode.Add "GN"
1563 CountryCode.Add "GW"
1564 CountryCode.Add "GY"
1565 CountryCode.Add "HT"
1566 CountryCode.Add "HM"
1567 CountryCode.Add "VA"
1568 CountryCode.Add "HN"
1569 CountryCode.Add "HK"
1570 CountryCode.Add "HU"
1571 CountryCode.Add "IS"
1572 CountryCode.Add "ID"
1573 CountryCode.Add "IR"
1574 CountryCode.Add "IQ"
1575 CountryCode.Add "IM"
1576 CountryCode.Add "IL"
1577 CountryCode.Add "JE"
1578 CountryCode.Add "JO"
1579 CountryCode.Add "KZ"
1580 CountryCode.Add "KE"
1581 CountryCode.Add "KI"
1582 CountryCode.Add "KP"
1583 CountryCode.Add "KR"
1584 CountryCode.Add "KW"
1585 CountryCode.Add "KG"
1586 CountryCode.Add "LA"
1587 CountryCode.Add "LV"
1588 CountryCode.Add "LB"
1589 CountryCode.Add "LS"
1590 CountryCode.Add "LR"
1591 CountryCode.Add "LY"
1592 CountryCode.Add "LI"
1593 CountryCode.Add "LT"
1594 CountryCode.Add "LU"
1595 CountryCode.Add "MO"
1596 CountryCode.Add "MK"
1597 CountryCode.Add "MG"
1598 CountryCode.Add "MW"
1599 CountryCode.Add "MY"
1600 CountryCode.Add "MV"
1601 CountryCode.Add "ML"
1602 CountryCode.Add "MT"
1603 CountryCode.Add "MH"
1604 CountryCode.Add "MQ"
1605 CountryCode.Add "MR"
1606 CountryCode.Add "MU"
1607 CountryCode.Add "YT"
1608 CountryCode.Add "FM"
1609 CountryCode.Add "MD"
1610 CountryCode.Add "MC"
1611 CountryCode.Add "MN"
1612 CountryCode.Add "ME"
1613 CountryCode.Add "MS"
1614 CountryCode.Add "MA"
1615 CountryCode.Add "MZ"
1616 CountryCode.Add "MM"
1617 CountryCode.Add "NA"
1618 CountryCode.Add "NR"
1619 CountryCode.Add "NP"
1620 CountryCode.Add "NC"
1621 CountryCode.Add "NI"
1622 CountryCode.Add "NE"
1623 CountryCode.Add "NG"
1624 CountryCode.Add "NU"
1625 CountryCode.Add "NF"
1626 CountryCode.Add "MP"
1627 CountryCode.Add "NO"
1628 CountryCode.Add "OM"
1629 CountryCode.Add "PK"
1630 CountryCode.Add "PW"
1631 CountryCode.Add "PS"
1632 CountryCode.Add "PA"
1633 CountryCode.Add "PG"
1634 CountryCode.Add "PY"
1635 CountryCode.Add "PE"
1636 CountryCode.Add "PH"
1637 CountryCode.Add "PN"
1638 CountryCode.Add "PL"
1639 CountryCode.Add "PT"
1640 CountryCode.Add "PR"
1641 CountryCode.Add "QA"
1642 CountryCode.Add "RE"
1643 CountryCode.Add "RO"
1644 CountryCode.Add "RU"
1645 CountryCode.Add "RW"
1646 CountryCode.Add "BL"
1647 CountryCode.Add "SH"
1648 CountryCode.Add "KN"
1649 CountryCode.Add "LC"
1650 CountryCode.Add "MF"
1651 CountryCode.Add "PM"
1652 CountryCode.Add "VC"
1653 CountryCode.Add "WS"
1654 CountryCode.Add "SM"
1655 CountryCode.Add "ST"
1656 CountryCode.Add "SA"
1657 CountryCode.Add "SN"
1658 CountryCode.Add "RS"
1659 CountryCode.Add "SC"
1660 CountryCode.Add "SL"
1661 CountryCode.Add "SG"
1662 CountryCode.Add "SX"
1663 CountryCode.Add "SK"
1664 CountryCode.Add "SI"
1665 CountryCode.Add "SB"
1666 CountryCode.Add "SO"
1667 CountryCode.Add "ZA"
1668 CountryCode.Add "GS"
1669 CountryCode.Add "SS"
1670 CountryCode.Add "LK"
1671 CountryCode.Add "SD"
1672 CountryCode.Add "SR"
1673 CountryCode.Add "SJ"
1674 CountryCode.Add "SZ"
1675 CountryCode.Add "SY"
1676 CountryCode.Add "TW"
1677 CountryCode.Add "TJ"
1678 CountryCode.Add "TZ"
1679 CountryCode.Add "TH"
1680 CountryCode.Add "TL"
1681 CountryCode.Add "TG"
1682 CountryCode.Add "TK"
1683 CountryCode.Add "TO"
1684 CountryCode.Add "TT"
1685 CountryCode.Add "TN"
1686 CountryCode.Add "TR"
1687 CountryCode.Add "TM"
1688 CountryCode.Add "TC"
1689 CountryCode.Add "TV"
1690 CountryCode.Add "UG"
1691 CountryCode.Add "UA"
1692 CountryCode.Add "AE"
1693 CountryCode.Add "UM"
1694 CountryCode.Add "UY"
1695 CountryCode.Add "UZ"
1696 CountryCode.Add "VU"
1697 CountryCode.Add "VE"
1698 CountryCode.Add "VN"
1699 CountryCode.Add "VG"
1700 CountryCode.Add "VI"
1701 CountryCode.Add "WF"
1702 CountryCode.Add "EH"
1703 CountryCode.Add "YE"
1704 CountryCode.Add "ZM"
1705 CountryCode.Add "ZW"
1706
1707
1708
1709 YearList.Add "None"
1710 For i=Year(Date) To 1900 Step -1
1711 YearList.Add i
1712 Next
1713
1714 If UBound(tmpYear2) <> YearList.Count -1 Then
1715 tmpYear = tmpYear & ",1"
1716 ini.StringValue("DiscogsAutoTagWeb","CurrentYearFilter") = tmpYear
1717 tmpYear2 = Split(tmpYear, ",")
1718 End If
1719
1720 For a = 0 To CountryList.Count - 1
1721 CountryFilterList.Add tmpCountry2(a)
1722 Next
1723
1724 For a = 0 To MediaTypeList.Count - 1
1725 MediaTypeFilterList.Add tmpMediaType2(a)
1726 Next
1727
1728 For a = 0 To MediaFormatList.Count - 1
1729 MediaFormatFilterList.Add tmpMediaFormat2(a)
1730 Next
1731
1732 For a = 0 To YearList.Count - 1
1733 YearFilterList.Add tmpYear2(a)
1734 Next
1735
1736 For i = 0 to 999
1737 UnselectedTracks(i) = ""
1738 UnselectedTrackNames(i) = ""
1739 Next
1740
1741 trackrefresh = True
1742
1743
1744 SearchTerm = Trim(SearchTerm)
1745
1746 WriteLogInit
1747 WriteLog " "
1748 WriteLog "SearchTerm=" & SearchTerm
1749 WriteLog "SearchArtist=" & SearchArtist
1750 WriteLog "SearchAlbum=" & SearchAlbum
1751 WriteLog " "
1752
1753 If SearchArtist <> "" And SearchAlbum <> "" Then
1754 tmp = SDB.Tools.WebSearch.NewTracks.Item(0).AlbumArtistName
1755 If tmp = "Various" or tmp = "Various Artists" or tmp = TxtVarious Then
1756 AddAlternative TxtVarious & " - " & SearchAlbum
1757 SearchTerm = "Various " & SearchAlbum
1758 SearchArtist = "Various"
1759 WriteLog "SearchTerm changed to: " & SearchTerm
1760 WriteLog "SearchArtist changed to: Various"
1761 Else
1762 AddAlternative SearchTerm
1763 AddAlternative SearchArtist
1764 AddAlternative SearchAlbum
1765 End If
1766 End If
1767
1768 NewSearchTerm = SearchTerm
1769
1770 For i = 0 To SDB.Tools.WebSearch.NewTracks.Count - 1
1771 AddAlternatives SDB.Tools.WebSearch.NewTracks.item(i)
1772 Next
1773
1774
1775 If MediaTypeFilterList.Item(0) = "0" Then
1776 FilterMediaType = "None"
1777 ElseIf MediaTypeFilterList.Item(0) = "1" Then
1778 FilterMediaType = "Use MediaType Filter"
1779 Else
1780 FilterMediaType = MediaTypeFilterList.Item(0)
1781 End If
1782
1783 If MediaFormatFilterList.Item(0) = "0" Then
1784 FilterMediaFormat = "None"
1785 ElseIf MediaFormatFilterList.Item(0) = "1" Then
1786 FilterMediaFormat = "Use MediaFormat Filter"
1787 Else
1788 FilterMediaFormat = MediaFormatFilterList.Item(0)
1789 End If
1790
1791 If CountryFilterList.Item(0) = "0" Then
1792 FilterCountry = "None"
1793 ElseIf CountryFilterList.Item(0) = "1" Then
1794 FilterCountry = "Use Country Filter"
1795 Else
1796 FilterCountry = CountryFilterList.Item(0)
1797 End If
1798
1799 If YearFilterList.Item(0) = "0" Then
1800 FilterYear = "None"
1801 ElseIf YearFilterList.Item(0) = "1" Then
1802 FilterYear = "Use Year Filter"
1803 Else
1804 FilterYear = YearFilterList.Item(0)
1805 End If
1806
1807 CurrentLoadType = "Search Results"
1808
1809 If SDB.Tools.WebSearch.NewTracks.Count > 0 Then
1810 Set FirstTrack = SDB.Tools.WebSearch.NewTracks.item(0)
1811 SavedReleaseId = get_release_ID(FirstTrack) 'get saved Release_ID from User-Defined Custom-Tag
1812 SavedSearchArtist = SearchArtist
1813 SavedSearchAlbum = SearchAlbum
1814 NewSearchArtist = SearchArtist
1815 NewSearchAlbum = SearchAlbum
1816 End If
1817
1818 UserAgent = "MediaMonkeyDiscogsAutoTagWeb/" & Mid(VersionStr, 2) & " +http://www.mediamonkey.com"
1819
1820 If CheckNewVersion = True Then
1821 Dim iDate, Version, colNodes, objNode
1822 iDate = CDate(Now())
1823 If Int(LastCheck) <> Int(DatePart("d",iDate)) Then
1824 Dim xmlDoc
1825 Set xmlDoc = CreateObject("Microsoft.XMLDOM")
1826
1827 xmlDoc.Async = "False"
1828 xmlDoc.Load("https://www.germanc64.de/mm/DiscogsAutoTagWeb.xml")
1829
1830 Set colNodes = xmlDoc.selectNodes("//SoftwareVersion/VersionMajor")
1831 For Each objNode in colNodes
1832 Version = "v" & objNode.Text
1833 Next
1834 Set colNodes = xmlDoc.selectNodes("//SoftwareVersion/VersionMinor")
1835 For Each objNode in colNodes
1836 Version = Version & "." & objNode.Text
1837 Next
1838 Set colNodes = xmlDoc.selectNodes("//SoftwareVersion/VersionRelease")
1839 For Each objNode in colNodes
1840 Version = Version & objNode.Text
1841 Next
1842 ini.StringValue("DiscogsAutoTagWeb","LastCheck") = DatePart("d",iDate)
1843
1844 If Version <> VersionStr Then
1845 SDB.MessageBox "A new version " & Version & " is released. Please download it via Tools->Extensions", mtInformation, Array(mbOk)
1846 End If
1847 End If
1848 End If
1849
1850 Dim AlbumArt
1851 CheckCover = False
1852 SmallCover = False
1853 Set AlbumArt = FirstTrack.AlbumArt
1854 If CheckSaveImage = 0 Or CheckSaveImage = 1 Then
1855 If (AlbumArt.Count = 0 And CheckSaveImage = 1) Or CheckSaveImage = 0 Then
1856 If CheckSmallCover = True Then
1857 SmallCover = True
1858 End If
1859 CheckCover = True
1860 End If
1861 End If
1862
1863 Dim itmAlbum
1864 For a = 0 To SDB.Tools.WebSearch.NewTracks.Count - 1
1865 Set tmp = SDB.Tools.WebSearch.NewTracks.item(a)
1866 Set itmAlbum = tmp.Album
1867 WriteLog "Disc=" & tmp.DiscNumberStr & " / Track=" & tmp.TrackOrderStr & " / AlbumID=" & itmAlbum.ID & " / Artist=" & tmp.ArtistName & " / Album=" & tmp.AlbumName & " / Title=" & tmp.Title
1868 If a = 0 Then NewSearchTrack = tmp.Title
1869 Next
1870 WriteLog " "
1871
1872 ' This is a web browser that we use to present results to the user
1873 Set WebBrowser = UI.NewActiveX(Panel, "Shell.Explorer")
1874 WebBrowser.Common.Align = 5
1875 WebBrowser.Common.ControlName = "WebBrowser"
1876 WebBrowser.Common.Top = 0
1877 WebBrowser.Common.Left = 0
1878 SDB.Objects("WebBrowser") = WebBrowser
1879 WebBrowser.Interf.Visible = true
1880 WebBrowser.Common.BringToFront
1881
1882 If QueryPage = "Discogs" Then
1883 ret = authorize_script(False)
1884 End If
1885
1886 If ret = True Or QueryPage <> "Discogs" Then
1887 FindResults NewSearchTerm, QueryPage
1888 End If
1889
1890End Sub
1891
1892
1893Sub FindResults(SearchTerm, QueryPage)
1894
1895 SearchTerm = LTrim(SearchTerm)
1896 WriteLog "+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-"
1897 WriteLog "Start FindResults"
1898 WriteLog "SearchTerm=" & SearchTerm
1899 WriteLog "NewSearchArtist=" & NewSearchArtist
1900 WriteLog "NewSearchAlbum=" & NewSearchAlbum
1901 WriteLog "NewSearchTrack=" & NewSearchTrack
1902
1903 Dim FilterFound, a, searchURL, searchURL_F, searchURL_L, SearchFor
1904 Dim SendArtist, SendAlbum, SendTrack, SendType, SendDBSearch, SendPerPage
1905
1906 Set Results = SDB.NewStringList
1907 Set ResultsReleaseID = SDB.NewStringList
1908 ErrorMessage = ""
1909
1910 SDB.Tools.WebSearch.ClearTracksData
1911 Set FirstTrack = SDB.Tools.WebSearch.NewTracks.item(0)
1912
1913 If (InStr(SearchTerm," - [search by release id]") > 0) Then
1914 SearchTerm = Left(SearchTerm,InStrRev(SearchTerm," - [search by release id]")-1)
1915 End If
1916
1917 If (InStr(SearchTerm," - [search by release url]") > 0) Then
1918 SearchTerm = Left(SearchTerm,InStrRev(SearchTerm," - [search by release url]")-1)
1919 End If
1920
1921 If (InStr(SearchTerm," - [currently tagged with this release]") > 0) Then
1922 SearchTerm = Left(SearchTerm,InStrRev(SearchTerm," - [currently tagged with this release]")-1)
1923 End If
1924
1925 If (InStr(SearchTerm," - [search returned no results]") > 0) Then
1926 SearchTerm = Left(SearchTerm,InStrRev(SearchTerm," - [search returned no results]")-1)
1927 End If
1928
1929 If (InStr(SearchTerm," - [search that yielded error]") > 0) Then
1930 SearchTerm = Left(SearchTerm,InStrRev(SearchTerm," - [search that yielded error]")-1)
1931 End If
1932
1933 ' Handle direct urls
1934
1935 If (InStr(SearchTerm,"/master/") > 0) Then
1936 CurrentLoadType = "Master Release"
1937 LoadMasterResults Mid(SearchTerm,InStrRev(SearchTerm,"/")+1)
1938 Exit Sub
1939 End If
1940
1941 If (InStr(SearchTerm,"/artist/") > 0) Then
1942 CurrentLoadType = "Releases of Artist"
1943 tmp = Mid(SearchTerm,InStrRev(SearchTerm,"/")+1)
1944 tmp = Left(tmp, InStr(tmp,"-")-1)
1945 LoadArtistResults tmp
1946 Exit Sub
1947 End If
1948
1949 If (InStr(SearchTerm,"/label/") > 0) Then
1950 CurrentLoadType = "Releases of Label"
1951 tmp = Mid(SearchTerm,InStrRev(SearchTerm,"/")+1)
1952 tmp = Left(tmp, InStr(tmp,"-")-1)
1953 LoadLabelResults tmp
1954 Exit Sub
1955 End If
1956
1957 If Left(SearchTerm, 2) = "[m" Then
1958 CurrentLoadType = "Master Release"
1959 LoadMasterResults Mid(SearchTerm, 3, Len(SearchTerm)-3)
1960 Exit Sub
1961 End If
1962
1963 If Left(SearchTerm, 2) = "[a" Then
1964 CurrentLoadType = "Releases of Artist"
1965 LoadArtistResults Mid(SearchTerm, 3, Len(SearchTerm)-3)
1966 Exit Sub
1967 End If
1968
1969 If Left(SearchTerm, 2) = "[l" Then
1970 CurrentLoadType = "Releases of Label"
1971 LoadLabelResults Mid(SearchTerm, 3, Len(SearchTerm)-3)
1972 Exit Sub
1973 End If
1974
1975 If Left(SearchTerm, 2) = "[r" Then
1976 CurrentLoadType = "Search Results"
1977 SearchTerm = Mid(SearchTerm, 3, Len(SearchTerm)-3)
1978 End If
1979
1980 SDB.ProcessMessages
1981
1982 If SearchTerm = "" and NewSearchArtist = "" And NewSearchAlbum = "" And NewSearchTrack = "" Then
1983 ErrorMessage = "No search term"
1984 WriteLog "No search term"
1985 ElseIf IsNumeric(SearchTerm) Then
1986 Results.Add SearchTerm & " - [search by release id]"
1987 ResultsReleaseID.Add SearchTerm
1988 REM QueryPage = "Discogs"
1989 ElseIf Len(SearchTerm) = 36 And Mid(SearchTerm, 9, 1) = "-" And Mid(SearchTerm, 14, 1) = "-" Then
1990 Results.Add SearchTerm & " - [search by release id]"
1991 ResultsReleaseID.Add SearchTerm
1992 REM QueryPage = "MusicBrainz"
1993 '6c3d0635-4fac-4085-b85b-79b6a7b13c21
1994 ElseIf (InStr(SearchTerm,"/release/") > 0) Then
1995 Results.Add SearchTerm & " - [search by release url]"
1996 ResultsReleaseID.Add Mid(SearchTerm,InStrRev(SearchTerm,"/")+1)
1997 REM QueryPage = "Discogs"
1998 Else
1999
2000 If QueryPage = "MetalArchives" Then
2001 'searchURL = "http://www.metal-archives.com/search/ajax-advanced/searching/albums?bandName=" & URLEncodeUTF8(CleanSearchString(SavedSearchArtist)) & "&exactBandMatch=1&releaseTitle=" & URLEncodeUTF8(CleanSearchString(SavedSearchAlbum)) & "&exactReleaseMatch=1&releaseYearFrom=&releaseMonthFrom=&releaseYearTo=&releaseMonthTo=&country=&location=&releaseLabelName=&genre=#albums"
2002 searchURL = "https://www.metal-archives.com/search/ajax-advanced/searching/albums/?bandName=" & URLEncodeUTF8(CleanSearchString(NewSearchArtist)) & "&exactBandMatch=1&releaseTitle=" & URLEncodeUTF8(CleanSearchString(NewSearchAlbum)) & "&exactReleaseMatch=1&releaseYearFrom=&releaseMonthFrom=&releaseYearTo=&releaseMonthTo=&country=&location=&releaseLabelName=&genre="
2003 JSONParser_find_result searchURL, "", "", "", "", "", "", "", "MetalArchives", False
2004 End If
2005
2006 If QueryPage = "Discogs" Then
2007 If IsNumeric(SavedReleaseId) Then
2008 Results.Add FirstTrack.AlbumArtistName & " - " & FirstTrack.Album.Name & " - [currently tagged with this release]"
2009 ResultsReleaseID.Add SavedReleaseId
2010 End If
2011
2012 SendType = "release"
2013 SendPerPage = "100"
2014
2015 If SearchTerm <> "" And NewSearchArtist = "" And NewSearchAlbum = "" Then
2016 REM Search from user-typed input
2017 WriteLog "Search from user-typed input"
2018 SendDBSearch = URLEncodeUTF8(CleanSearchString(SearchTerm))
2019 ElseIf NewSearchArtist <> "" Or NewSearchAlbum <> "" Or NewSearchTrack <> "" Then
2020 SendArtist = URLEncodeUTF8(CleanSearchString(NewSearchArtist))
2021 SendAlbum = URLEncodeUTF8(CleanSearchString(NewSearchAlbum))
2022 If SendAlbum = "" Then
2023 SendTrack = URLEncodeUTF8(CleanSearchString(NewSearchTrack))
2024 End If
2025 Else
2026 ErrorMessage = "No SearchTerm found"
2027 WriteLog "No SearchTerm found"
2028 End If
2029
2030 If ErrorMessage = "" Then
2031 JSONParser_find_result "", "results", SendArtist, SendAlbum, SendTrack, SendType, SendDBSearch, SendPerPage, QueryPage, True
2032 End If
2033 End If
2034
2035 If QueryPage = "MusicBrainz" Then
2036 If Len(SavedReleaseId) = 36 Then
2037 Results.Add FirstTrack.AlbumArtistName & " - " & FirstTrack.Album.Name & " - [currently tagged with this release]"
2038 ResultsReleaseID.Add SavedReleaseId
2039 End If
2040 WriteLog "searchTerm=" & SearchTerm
2041 WriteLog "newsearchTerm=" & NewSearchTerm
2042 If SearchTerm <> "" And NewSearchArtist = "" And NewSearchAlbum = "" Then
2043 REM Search from user-typed input
2044 WriteLog "Search from user-typed input"
2045 SearchFor = ShowSearchFor()
2046 If SearchFor = 1 Then
2047 searchURL = "http://musicbrainz.org/ws/2/release?query=artist:" & Chr(34) & CleanSearchString(URLEncodeUTF8(SearchTerm)) & Chr(34) & "&limit=50&offset=0&fmt=json"
2048 ElseIf SearchFor = 2 Then
2049 searchURL = "http://musicbrainz.org/ws/2/release?query=release:" & Chr(34) & CleanSearchString(URLEncodeUTF8(SearchTerm)) & Chr(34) & "&limit=50&offset=0&fmt=json"
2050 ElseIf SearchFor = 3 Then
2051 a = Split(SearchTerm, " - ")
2052 If UBound(a) = 1 Then
2053 searchURL = "http://musicbrainz.org/ws/2/release?query=artist:" & Chr(34) & CleanSearchString(URLEncodeUTF8(a(0))) & Chr(34) & " AND release:" & Chr(34) & URLEncodeUTF8(CleanSearchString(a(1))) & Chr(34) & "&limit=50&offset=0&fmt=json"
2054 Else
2055 SDB.MessageBox "Please use this format: Artist - Album", mtInformation, Array(mbOk)
2056 End If
2057 End If
2058 WriteLog "SearchFor= " & SearchFor
2059 ElseIf (NewSearchArtist <> "" And NewSearchAlbum = "") Or (SearchTerm <> "" And SearchTerm = NewSearchArtist) Then
2060 searchURL = "http://musicbrainz.org/ws/2/release?query=artist:" & Chr(34) & CleanSearchString(URLEncodeUTF8(NewSearchArtist)) & Chr(34) & "&limit=50&offset=0&fmt=json"
2061 ElseIf NewSearchArtist <> "" And NewSearchAlbum <> "" Then
2062 searchURL = "http://musicbrainz.org/ws/2/release?query=artist:" & Chr(34) & CleanSearchString(URLEncodeUTF8(NewSearchArtist)) & Chr(34) & " AND release:" & Chr(34) & URLEncodeUTF8(CleanSearchString(NewSearchAlbum)) & Chr(34) & "&limit=50&offset=0&fmt=json"
2063 ElseIf NewSearchArtist = "" And NewSearchAlbum <> "" Then
2064 searchURL = "http://musicbrainz.org/ws/2/release?query=release:" & Chr(34) & CleanSearchString(URLEncodeUTF8(NewSearchAlbum)) & Chr(34) & "&limit=50&offset=0&fmt=json"
2065 End If
2066
2067 If searchURL <> "" Then
2068 WriteLog "searchURL=" & searchURL
2069 JSONParser_find_result searchURL, "releases", "", "", "", "", "", "", "MusicBrainz", False
2070 End If
2071 End If
2072
2073 If ResultsReleaseID.Count = 0 And ErrorMessage = "" Then
2074 WriteLog "ResultsReleaseID=0"
2075 FilterFound = False
2076 If FilterCountry = "Use Country Filter" Then
2077 For a = 1 To CountryList.Count - 1
2078 If CountryFilterList.Item(a) = "1" Then
2079 FilterFound = True
2080 Exit For
2081 End If
2082 Next
2083 If FilterFound = False Then
2084 ErrorMessage = "No Country Filter set !"
2085 Else
2086 ErrorMessage = "Search returned no results"
2087 End If
2088 End If
2089 FilterFound = False
2090 If FilterMediaType = "Use MediaType Filter" Then
2091 For a = 1 To MediaTypeList.Count - 1
2092 If MediaTypeFilterList.Item(a) = "1" Then
2093 FilterFound = True
2094 Exit For
2095 End If
2096 Next
2097 If FilterFound = False Then
2098 If ErrorMessage = "" Then
2099 ErrorMessage = "No MediaType Filter set !"
2100 Else
2101 ErrorMessage = ErrorMessage & vbCrLf & "No MediaType Filter set !"
2102 End If
2103 End If
2104 End If
2105 FilterFound = False
2106 If FilterMediaFormat = "Use MediaFormat Filter" Then
2107 For a = 1 To MediaFormatList.Count - 1
2108 If MediaFormatFilterList.Item(a) = "1" Then
2109 FilterFound = True
2110 Exit For
2111 End If
2112 Next
2113 If FilterFound = False Then
2114 If ErrorMessage = "" Then
2115 ErrorMessage = "No MediaFormat Filter set !"
2116 Else
2117 ErrorMessage = ErrorMessage & vbCrLf & "No MediaFormat Filter set !"
2118 End If
2119 End If
2120 End If
2121 FilterFound = False
2122 If FilterYear = "Use Year Filter" Then
2123 For a = 1 To YearList.Count - 1
2124 If YearFilterList.Item(a) = "1" Then
2125 FilterFound = True
2126 Exit For
2127 End If
2128 Next
2129 If FilterFound = False Then
2130 If ErrorMessage = "" Then
2131 ErrorMessage = "No Year Filter set !"
2132 Else
2133 ErrorMessage = ErrorMessage & vbCrLf & "No Year Filter set !"
2134 End If
2135 End If
2136 End If
2137
2138 If ErrorMessage = "" Then
2139 ErrorMessage = "Search returned no results"
2140 End If
2141
2142 Results.Add SearchTerm & " - [search returned no results]"
2143 ResultsReleaseID.Add ""
2144 End If
2145
2146 End If
2147
2148 SDB.ProcessMessages
2149 SDB.Tools.WebSearch.SetSearchResults Results
2150 SDB.Tools.WebSearch.ResultIndex = 0
2151
2152 If ErrorMessage <> "" Then
2153 FormatErrorMessage ErrorMessage
2154 End If
2155
2156End Sub
2157
2158Sub LoadMasterResults(MasterID)
2159
2160 Dim searchURL
2161 Dim oXMLHTTP
2162 Dim json
2163 Set json = New VbsJson
2164
2165 Dim title, v_year, artist, artistName, main_release, ReleaseDesc, currentArtist, AlbumArtistTitle, tmp
2166
2167 WriteLog " "
2168 WriteLog "+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+"
2169
2170 Set oXMLHTTP = CreateObject("MSXML2.XMLHTTP.6.0")
2171
2172 WriteLog "Load MasterResult"
2173 ErrorMessage = ""
2174
2175 If MasterID = "" Then
2176 ErrorMessage = "Cannot load empty master release"
2177 Else
2178 If QueryPage = "MusicBrainz" Then
2179 ErrorMessage = "Cannot load master release from MusicBrainz"
2180
2181 ElseIf QueryPage = "Discogs" Then
2182 searchURL = "https://api.discogs.com/masters/" & MasterID
2183 WriteLog "searchURL=" & searchURL
2184
2185 Set oXMLHTTP = CreateObject("MSXML2.XMLHTTP.6.0")
2186 oXMLHTTP.open "GET", searchURL, false
2187 oXMLHTTP.setRequestHeader "Content-Type","application/json"
2188 oXMLHTTP.setRequestHeader "User-Agent",UserAgent
2189 oXMLHTTP.send()
2190
2191 If oXMLHTTP.Status = 200 Then
2192 WriteLog "responseText=" & oXMLHTTP.responseText
2193
2194 If InStr(oXMLHTTP.responseText, "OAuth client error") <> 0 Then
2195 ErrorMessage = oXMLHTTP.responseText
2196 Else
2197 Set currentRelease = json.Decode(oXMLHTTP.responseText)
2198
2199 Set Results = SDB.NewStringList
2200 Set ResultsReleaseID = SDB.NewStringList
2201
2202 title = ""
2203 v_year = ""
2204 artist = ""
2205 main_release = ""
2206
2207 SDB.ProcessMessages
2208
2209 title = CurrentRelease("title")
2210 tmp = getArtistsName(CurrentRelease, "artists", QueryPage)
2211 AlbumArtistTitle = tmp(0)
2212
2213 If CurrentRelease.Exists("main_release") Then
2214 main_release = CurrentRelease("main_release")
2215 End If
2216 If CurrentRelease.Exists("year") Then
2217 v_year = CurrentRelease("year")
2218 End If
2219
2220 If AlbumArtistTitle <> "" Then ReleaseDesc = AlbumArtistTitle End If
2221 If AlbumArtistTitle <> "" and title <> "" Then ReleaseDesc = ReleaseDesc & " -" End If
2222 If title <> "" Then ReleaseDesc = ReleaseDesc & " " & title End If
2223 If v_year <> "" Then ReleaseDesc = ReleaseDesc & " (" & v_year & ")" End If
2224 ReleaseDesc = ReleaseDesc & " (Master)"
2225
2226 Results.Add ReleaseDesc
2227 ResultsReleaseID.Add CurrentRelease("id")
2228
2229 SDB.Tools.WebSearch.SetSearchResults Results
2230 SDB.Tools.WebSearch.ResultIndex = 0
2231
2232 ReloadResults
2233 End If
2234 Else
2235 ErrorMessage = "Try loading Master returns ErrorCode: " & oXMLHTTP.Status
2236 WriteLog "Try loading Master returns ErrorCode: " & oXMLHTTP.Status
2237 End If
2238 End If
2239 End If
2240
2241 If ErrorMessage <> "" Then
2242 FormatErrorMessage ErrorMessage
2243 End If
2244
2245End Sub
2246
2247
2248Sub LoadVersionResults(MasterID)
2249
2250 WriteLog "VersionResult"
2251
2252 Set Results = SDB.NewStringList
2253 Set ResultsReleaseID = SDB.NewStringList
2254 ErrorMessage = ""
2255
2256 If MasterID = "" Then
2257 ErrorMessage = "Cannot load empty master release"
2258 Else
2259 If IsNumeric(SavedReleaseId) Then
2260 Set FirstTrack = SDB.Tools.WebSearch.NewTracks.item(0)
2261 Results.Add FirstTrack.AlbumArtistName & " - " & FirstTrack.Album.Name & " - [currently tagged with this release]"
2262 ResultsReleaseID.Add SavedReleaseId
2263 End If
2264 If QueryPage = "Discogs" Then
2265 JSONParser_find_result "https://api.discogs.com/masters/" & MasterID & "/versions?per_page=100", "versions", "", "", "", "", "", "", "Discogs", False
2266 Else
2267 ErrorMessage = "Cannot load master release from MusicBrainz"
2268 End If
2269 End If
2270
2271 SDB.Tools.WebSearch.SetSearchResults Results
2272 SDB.Tools.WebSearch.ResultIndex = 0
2273
2274 If ErrorMessage <> "" Then
2275 FormatErrorMessage ErrorMessage
2276 End If
2277
2278End Sub
2279
2280
2281Sub LoadArtistResults(ArtistId)
2282
2283 Set Results = SDB.NewStringList
2284 Set ResultsReleaseID = SDB.NewStringList
2285 ErrorMessage = ""
2286
2287 If ArtistId = "" Then
2288 ErrorMessage = "Cannot load empty artist"
2289 Else
2290 If IsNumeric(SavedReleaseId) Then
2291 Set FirstTrack = SDB.Tools.WebSearch.NewTracks.item(0)
2292 Results.Add FirstTrack.AlbumArtistName & " - " & FirstTrack.Album.Name & " - [currently tagged with this release]"
2293 ResultsReleaseID.Add SavedReleaseId
2294 End If
2295
2296 If QueryPage = "Discogs" Then
2297 JSONParser_find_result "https://api.discogs.com/artists/" & ArtistId & "/releases?per_page=100", "releases", "", "", "", "", "", "", "Discogs", False
2298 ElseIf QueryPage = "MusicBrainz" Then
2299 JSONParser_find_result "http://musicbrainz.org/ws/2/release?artist=" & ArtistId & "&inc=artist-credits+release-groups+media&fmt=json&limit=100", "Artist", "", "", "", "", "", "", "MusicBrainz", False
2300 End If
2301 End If
2302
2303 SDB.Tools.WebSearch.SetSearchResults Results
2304 SDB.Tools.WebSearch.ResultIndex = 0
2305
2306 If ErrorMessage <> "" Then
2307 FormatErrorMessage ErrorMessage
2308 End If
2309
2310End Sub
2311
2312
2313Sub LoadLabelResults(LabelId)
2314
2315 Set Results = SDB.NewStringList
2316 Set ResultsReleaseID = SDB.NewStringList
2317 ErrorMessage = ""
2318
2319 If LabelId = "" Then
2320 ErrorMessage = "Cannot load empty label"
2321 Else
2322 If IsNumeric(SavedReleaseId) Then
2323 Set FirstTrack = SDB.Tools.WebSearch.NewTracks.item(0)
2324 Results.Add FirstTrack.AlbumArtistName & " - " & FirstTrack.Album.Name & " - [currently tagged with this release]"
2325 ResultsReleaseID.Add SavedReleaseId
2326 End If
2327
2328 If QueryPage = "Discogs" Then
2329 JSONParser_find_result "https://api.discogs.com/labels/" & LabelId & "/releases?per_page=100", "releases", "", "", "", "", "", "", "Discogs", False
2330 ElseIf QueryPage = "MusicBrainz" Then
2331 JSONParser_find_result "http://musicbrainz.org/ws/2/release?label=" & LabelId & "&inc=artist-credits+media&fmt=json&limit=100", "Label", "", "", "", "", "", "", "MusicBrainz", False
2332 End If
2333 End If
2334
2335 SDB.Tools.WebSearch.SetSearchResults Results
2336 SDB.Tools.WebSearch.ResultIndex = 0
2337
2338 If ErrorMessage <> "" Then
2339 FormatErrorMessage ErrorMessage
2340 End If
2341
2342End Sub
2343
2344
2345'For reloading results
2346Sub ReloadResults
2347
2348 Dim Tracks, TracksNum, DiscogsTracksNum, TracksCD, ArtistTitles, InvolvedArtists, Lyricists, Composers, Conductors, Producers, Durations
2349 Dim AlbumArtist, AlbumArtistTitle, AlbumLyricist, AlbumComposer, AlbumConductor, AlbumProducer, AlbumInvolved, AlbumFeaturing, AlbumTitle
2350 Dim track, currentTrack, position, artist, currentArtist, artistName, extraArtist, extra
2351 Dim currentImage, currentLabel, currentFormat, theMaster, i, g, l, s, f, d, currentMedia, m, t, x
2352 Dim ReleaseDate, ReleaseSplit, theLabels, theCatalogs, theCountry, theFormat
2353 Dim rTrackPosition, rSubPosition
2354 Dim oXMLHTTP, searchURL
2355 Dim tmpArt, image
2356 Dim Genres, Styles, Comment, DataQuality
2357 Dim NoSubTrackUsing, oldSubTrackNumber
2358 Set Tracks = SDB.NewStringList
2359 Set TracksNum = SDB.NewStringList
2360 Set DiscogsTracksNum = SDB.NewStringList
2361 Set TracksCD = SDB.NewStringList
2362 Set ArtistTitles = SDB.NewStringList
2363 Set InvolvedArtists = SDB.NewStringList
2364 Set Lyricists = SDB.NewStringList
2365 Set Composers = SDB.NewStringList
2366 Set Conductors = SDB.NewStringList
2367 Set Producers = SDB.NewStringList
2368 Set Durations = SDB.NewStringList
2369 Set rTrackPosition = SDB.NewStringList
2370 Set rSubPosition = SDB.NewStringList
2371 Set GenresList = SDB.NewStringList
2372 REM Set GenresSelect = SDB.NewStringList
2373
2374 '----------------------------------DiscogsImages----------------------------------------
2375 Set SaveImage = SDB.NewStringList
2376 Set SaveImageType = SDB.NewStringList
2377 Set FileNameList = SDB.NewStringList
2378 ImagesCount = 0
2379 '----------------------------------DiscogsImages----------------------------------------
2380
2381
2382 If OptionsChanged = True Then
2383 OptionsChanged = False
2384 WriteOptions()
2385 End If
2386
2387 If not isnull(CurrentRelease) Then
2388
2389 AlbumArtist = ""
2390 AlbumArtistTitle = ""
2391 AlbumLyricist = ""
2392 AlbumComposer = ""
2393 AlbumConductor = ""
2394 AlbumProducer = ""
2395 AlbumInvolved = ""
2396 AlbumArtURL = ""
2397 AlbumArtThumbNail = ""
2398 AlbumFeaturing = ""
2399 LastDisc = ""
2400
2401 Dim iTrackNum, cSubTrack, subTrackTitle, aSubtrack
2402 Dim trackName, pos
2403 Dim role, role2, rolea, currentRole, NoSplit, zahl, zahltemp, zahl2, zahltemp2
2404 Dim CharSeparatorSubTrack
2405 ReDim Involved_R(0)
2406 Dim tmp, tmp2, tmp3, tmp4, tmp5, tmpResponse
2407 Dim rTrack
2408 Dim ret, ResponseHTML, TXTBegin, TXTEnd, Title
2409 Dim LeadingZeroTrackPosition
2410 Dim FormatCnt
2411 ReDim TrackRoles(0)
2412 ReDim TrackArtist2(0)
2413 ReDim TrackPos(0)
2414 ReDim Title_Position(0)
2415 ReDim TitleList(0)
2416 ReDim ArtistsList(0)
2417 ReDim Grouping(0)
2418 SavedArtistID = ""
2419 SavedLabelID = ""
2420 LeadingZeroTrackPosition = False
2421 Dim involvedArtist, involvedTemp, involvedRole, subTrack
2422 Dim TrackInvolvedPeople, TrackComposers, TrackConductors, TrackProducers, TrackLyricists, TrackFeaturing, currentHeading, currentCD
2423 Dim TrackArtist, artistList, min, sec, length
2424
2425 WriteLog "Start ReloadResults"
2426 WriteLog "QueryPage=" & QueryPage
2427 SDB.Tools.WebSearch.ClearTracksData
2428
2429
2430
2431
2432 ' +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2433 If QueryPage = "MetalArchives" Then
2434 ResponseHTML = CurrentRelease
2435 ' Get Album art URL
2436 TXTBegin = InStr(ResponseHTML, "album_img")
2437 ResponseHTML = Mid(ResponseHTML, TXTBegin)
2438 TXTBegin = InStr(ResponseHTML, "href=")
2439 ResponseHTML = Mid(ResponseHTML, TXTBegin + 6)
2440 TXTEnd = InStr(ResponseHTML, Chr(34) & "><")
2441 AlbumArtURL = Left(ResponseHTML, TXTEnd - 1)
2442 AlbumArtThumbNail = Left(ResponseHTML, TXTEnd - 1)
2443 If AlbumArtThumbNail <> "" Then
2444 ret = getimages(AlbumArtThumbNail, sTemp & "cover.jpg")
2445 AlbumArtThumbNail = sTemp & "cover.jpg"
2446 End If
2447
2448 ' Get album title
2449 TXTBegin = InStr(ResponseHTML, "album_name")
2450 ResponseHTML = Mid(ResponseHTML, TXTBegin + 14)
2451 TXTBegin = InStr(ResponseHTML, Chr(34) & ">")
2452 ResponseHTML = Mid(ResponseHTML, TXTBegin + 2)
2453 TXTEnd = InStr(ResponseHTML, "</a>")
2454 AlbumTitle = PackSpaces(Left(ResponseHTML, TXTEnd - 1), False)
2455 WriteLog "AlbumTitle=" & AlbumTitle
2456
2457 ' Get artist title
2458 TXTBegin = InStr(ResponseHTML, "<a href")
2459 ResponseHTML = Mid(ResponseHTML, TXTBegin)
2460 TXTBegin = InStr(ResponseHTML, Chr(34) & ">")
2461 ResponseHTML = Mid(ResponseHTML, TXTBegin + 2)
2462 TXTEnd = InStr(ResponseHTML, "</a>")
2463 AlbumArtist = Left(ResponseHTML, TXTEnd - 1)
2464 AlbumArtistTitle = AlbumArtist
2465
2466 If (Not CheckAlbumArtistFirst) Then
2467 AlbumArtist = AlbumArtistTitle
2468 End If
2469
2470 If AlbumArtist = "Various" And CheckVarious Then
2471 AlbumArtist = TxtVarious
2472 End If
2473 If AlbumArtistTitle = "Various" And CheckVarious Then
2474 AlbumArtistTitle = TxtVarious
2475 End If
2476 Writelog "AlbumArtist=" & AlbumArtist
2477 Writelog "AlbumArtistTitle=" & AlbumArtistTitle
2478
2479 ' Get release year/date
2480 TXTBegin = InStr(ResponseHTML, "Release date:")
2481 ResponseHTML = Mid(ResponseHTML, TXTBegin)
2482 TXTBegin = InStr(ResponseHTML, "<dd>")
2483 ResponseHTML = Mid(ResponseHTML, TXTBegin + 4)
2484 TXTEnd = InStr(ResponseHTML, "</dd>")
2485 ReleaseDate = Left(ResponseHTML, TXTEnd -1)
2486 If Len(ReleaseDate) > 4 Then
2487 If CheckYearOnlyDate Then
2488 ReleaseDate = Right(ReleaseDate, 4)
2489 End If
2490 End If
2491 WriteLog "ReleaseDate=" & ReleaseDate
2492
2493 'Get catalog nr.
2494 TXTBegin = InStr(ResponseHTML, "Catalog ID:")
2495 ResponseHTML = Mid(ResponseHTML, TXTBegin)
2496 TXTBegin = InStr(ResponseHTML, "<dd>")
2497 ResponseHTML = Mid(ResponseHTML, TXTBegin + 4)
2498 TXTEnd = InStr(ResponseHTML, "</dd>")
2499 theCatalogs = Left(ResponseHTML, TXTEnd -1)
2500 WriteLog "theCatalogs=" & theCatalogs
2501
2502 'Get label
2503 TXTBegin = InStr(ResponseHTML, "Label:")
2504 ResponseHTML = Mid(ResponseHTML, TXTBegin)
2505 TXTBegin = InStr(ResponseHTML, Chr(34) & ">")
2506 ResponseHTML = Mid(ResponseHTML, TXTBegin + 2)
2507 TXTEnd = InStr(ResponseHTML, "</a>")
2508 theLabels = Left(ResponseHTML, TXTEnd -1)
2509 WriteLog "theLabels=" & theLabels
2510
2511 'Get format
2512 TXTBegin = InStr(ResponseHTML, "Format:")
2513 ResponseHTML = Mid(ResponseHTML, TXTBegin)
2514 TXTBegin = InStr(ResponseHTML, "<dd>")
2515 ResponseHTML = Mid(ResponseHTML, TXTBegin + 4)
2516 TXTEnd = InStr(ResponseHTML, "</dd>")
2517 theFormat = Left(ResponseHTML, TXTEnd -1)
2518 WriteLog "theFormat=" & theFormat
2519
2520 TXTBegin = InStr(ResponseHTML, "tbody")
2521 TXTEnd = InStr(ResponseHTML, "/tbody")
2522 ResponseHTML = Mid(ResponseHTML, TXTBegin, TXTEnd - TXTBegin - 1)
2523
2524 currentHeading = ""
2525 currentCD = ""
2526 iTrackNum = 0
2527 iAutoTrackNumber = 1
2528 iAutoDiscNumber = 1
2529 If CheckForceDisc = True Then
2530 If currentCD = "" Then currentCD = iAutoDiscNumber
2531 End If
2532 If CheckNoDisc = True Then
2533 If currentCD <> "" Then currentCD = ""
2534 End If
2535 WriteLog "currentCD=" & currentCD
2536
2537 Do While InStr(ResponseHTML, "wrapWords") > 0
2538 If InStr(ResponseHTML, "<tr class=" & Chr(34) & "discRow" & Chr(34) & ">") < InStr(ResponseHTML, "class=" & Chr(34) & "anchor" & Chr(34) & ">") And InStr(ResponseHTML, "<tr class=" & Chr(34) & "discRow" & Chr(34) & ">") <> 0 Then
2539 WriteLog "Neue CD erkannt"
2540 TXTBegin = InStr(ResponseHTML, "<tr class=" & Chr(34) & "discRow" & Chr(34) & ">")
2541 tmpResponse = Mid(ResponseHTML, TXTBegin + 22)
2542 TXTBegin = InStr(tmpResponse, ">")
2543 TXTEnd = InStr(tmpResponse, "<")
2544 tmpResponse = Mid(tmpResponse, TXTBegin + 2, TXTEnd - TXTBegin - 2)
2545 tmp = Split(tmpResponse, Chr(10))
2546 If Ubound(tmp) = 2 Then
2547 currentHeading = PackSpaces(Mid(tmp(2), 3), False)
2548 currentCD = tmp(1)
2549 End If
2550 If Ubound(tmp) = 1 Then
2551 currentCD = tmp(1)
2552 End If
2553 iAutoTrackNumber = 1
2554 iAutoDiscNumber = iAutoDiscNumber + 1
2555 If CheckForceDisc = True Then
2556 If currentCD = "" Then currentCD = iAutoDiscNumber
2557 End If
2558 If CheckNoDisc = True Then
2559 If currentCD <> "" Then currentCD = ""
2560 End If
2561 End If
2562
2563 ' TXTBegin = InStr(ResponseHTML, "<td class=" & Chr(34) & "wrapWords")
2564 TXTBegin = InStr(ResponseHTML, "class=" & Chr(34) & "anchor" & Chr(34) & ">")
2565 If TXTBegin = 0 Then Exit Do
2566 ResponseHTML = Mid(ResponseHTML, TXTBegin + 14)
2567 TXTBegin = InStr(ResponseHTML, "</a>")
2568 If TXTBegin = 0 Then Exit Do
2569 ResponseHTML = Mid(ResponseHTML, TXTBegin + 4)
2570
2571 TXTEnd = InStr(ResponseHTML, "</td>")
2572 position = Left(ResponseHTML, TXTEnd -2)
2573 Title_Position(UBound(Title_Position)) = position
2574 ReDim Preserve Title_Position(UBound(Title_Position)+1)
2575 DiscogsTracksNum.Add position
2576 WriteLog "position=" & position
2577
2578 TXTBegin = InStr(ResponseHTML, Chr(34) & ">")
2579 ResponseHTML = Mid(ResponseHTML, TXTBegin + 2)
2580 TXTEnd = InStr(ResponseHTML, "</td>")
2581 Title = Left(ResponseHTML, TXTEnd - 1)
2582 Title = Replace(Title, Chr(10), "")
2583 Title = Trim(Replace(Title, Chr(9), " "))
2584 WriteLog "Title=" & Title & chr(34)
2585 TitleList(UBound(TitleList)) = Title
2586 Tracks.Add Title
2587 ReDim Preserve TitleList(UBound(TitleList)+1)
2588
2589 TXTBegin = InStr(ResponseHTML, "<td align=" & Chr(34) & "right" & Chr(34) & ">")
2590 ResponseHTML = Mid(ResponseHTML, TXTBegin + 18)
2591 TXTEnd = InStr(ResponseHTML, "</td>")
2592 Durations.Add Left(ResponseHTML, TXTEnd - 1)
2593 WriteLog "Duration=" & Left(ResponseHTML, TXTEnd - 1)
2594
2595
2596 ArtistsList(UBound(ArtistsList)) = AlbumArtist
2597 ReDim Preserve ArtistsList(UBound(ArtistsList)+1)
2598 ArtistTitles.Add AlbumArtist
2599
2600 If UnselectedTracks(iTrackNum) <> "x" Then
2601 If CheckLeadingZero = True And iAutoTrackNumber < 10 Then
2602 tracksNum.Add "0" & iAutoTrackNumber
2603 tracksCD.Add LeadingZeroDisc(currentCD)
2604 WriteLog "Tracknumber=0" & iAutoTrackNumber
2605 WriteLog "currentCD=" & currentCD
2606 Else
2607 tracksNum.Add iAutoTrackNumber
2608 tracksCD.Add LeadingZeroDisc(currentCD)
2609 WriteLog "Tracknumber=" & iAutoTrackNumber
2610 WriteLog "currentCD=" & currentCD
2611 End If
2612 iAutoTrackNumber = iAutoTrackNumber + 1
2613 Lyricists.Add ""
2614 Composers.Add ""
2615 Conductors.Add ""
2616 Producers.Add ""
2617 InvolvedArtists.Add ""
2618 Grouping(UBound(Grouping)) = currentHeading
2619 ReDim Preserve Grouping(UBound(Grouping)+1)
2620 WriteLog "Grouping=" & currentHeading
2621 Else
2622 tracksNum.Add ""
2623 tracksCD.Add ""
2624 WriteLog "Tracknumber=Nothing"
2625 End If
2626 iTrackNum = iTrackNum + 1
2627 Loop
2628
2629 ' Get Comment
2630 ' album_notes
2631 ' If CurrentRelease.Exists("notes") Then
2632 ' Comment = CurrentRelease("notes")
2633 ' Else
2634 ' Comment = ""
2635 ' End If
2636 ' WriteLog "Comment=" & Comment
2637
2638 End If
2639
2640
2641
2642
2643 If QueryPage = "Discogs" Then
2644 'Get Track-List
2645 For Each track In CurrentRelease("tracklist")
2646 'track start at 0
2647 Set currentTrack = CurrentRelease("tracklist")(track)
2648 position = currentTrack("position")
2649 DiscogsTracksNum.Add position
2650 position = exchange_roman_numbers(position)
2651 Title_Position(UBound(Title_Position)) = position
2652 ReDim Preserve Title_Position(UBound(Title_Position)+1)
2653 TitleList(UBound(TitleList)) = currentTrack("title")
2654 ReDim Preserve TitleList(UBound(TitleList)+1)
2655 tmp = getArtistsName(currentTrack, "artists", QueryPage)
2656 ArtistsList(UBound(ArtistsList)) = tmp(0)
2657 ReDim Preserve ArtistsList(UBound(ArtistsList)+1)
2658 WriteLog "Track=" & track
2659 rTrackPosition.Add track
2660 If currentTrack("type_") = "heading" Then
2661 WriteLog "Heading Track found"
2662 currentHeading = PackSpaces(DecodeHtmlChars(currentTrack("title")), False)
2663 Grouping(UBound(Grouping)) = "|Heading|"
2664 ReDim Preserve Grouping(UBound(Grouping)+1)
2665 Else
2666 If currentHeading <> "" Then
2667 Grouping(UBound(Grouping)) = currentHeading
2668 ReDim Preserve Grouping(UBound(Grouping)+1)
2669 Else
2670 Grouping(UBound(Grouping)) = ""
2671 ReDim Preserve Grouping(UBound(Grouping)+1)
2672 End If
2673 End If
2674
2675 If currentTrack.Exists("sub_tracks") Then
2676 WriteLog "SubTrack(s) found"
2677 rSubPosition.Add "NewSubTrack"
2678 For Each subtrack in currentTrack("sub_tracks")
2679 WriteLog "subTrack=" & subTrack
2680 Set aSubtrack = currentTrack("sub_tracks")(subtrack)
2681 position = aSubtrack("position")
2682 DiscogsTracksNum.Add position
2683 position = exchange_roman_numbers(position)
2684 Title_Position(UBound(Title_Position)) = position
2685 ReDim Preserve Title_Position(UBound(Title_Position)+1)
2686 rTrackPosition.Add track
2687 rSubPosition.Add subtrack
2688 TitleList(UBound(TitleList)) = aSubtrack("title")
2689 ReDim Preserve TitleList(UBound(TitleList)+1)
2690 tmp = getArtistsName(aSubtrack, "artists", QueryPage)
2691 ArtistsList(UBound(ArtistsList)) = tmp(0)
2692 ReDim Preserve ArtistsList(UBound(ArtistsList)+1)
2693 If aSubtrack("type_") = "heading" Then
2694 WriteLog "Heading SubTrack found"
2695 currentHeading = PackSpaces(DecodeHtmlChars(aSubtrack("title")), False)
2696 Grouping(UBound(Grouping)) = currentHeading
2697 ReDim Preserve Grouping(UBound(Grouping)+1)
2698 Else
2699 If currentHeading <> "" Then
2700 Grouping(UBound(Grouping)) = currentHeading
2701 ReDim Preserve Grouping(UBound(Grouping)+1)
2702 Else
2703 Grouping(UBound(Grouping)) = ""
2704 ReDim Preserve Grouping(UBound(Grouping)+1)
2705 End If
2706 End If
2707 Next
2708 Else
2709 rSubPosition.Add ""
2710 End If
2711 SDB.ProcessMessages
2712 Next
2713 WriteLog "rTrackPosition.Count=" & rTrackPosition.Count
2714
2715 For i = 0 To UBound(TitleList)-1
2716 WriteLog i & " " & ArtistsList(i) & " - " & TitleList(i)
2717 Next
2718
2719 REM For i = 0 To rSubPosition.count-1
2720 REM WriteLog i & " " & rSubPosition.item(i)
2721 REM Next
2722
2723 'Check for leading zero in track-position
2724 For i = 0 to UBound(Title_Position)-1
2725 If Title_Position(i) <> "" Then
2726 LeadingZeroTrackPosition = CheckLeadingZeroTrackPosition(Title_Position(i))
2727 Exit For
2728 End If
2729 Next
2730 WriteLog "LeadingZeroTrackPosition = " & LeadingZeroTrackPosition
2731
2732 ' Get artist title
2733 tmp = getArtistsName(CurrentRelease, "artists", QueryPage)
2734
2735 AlbumArtist = tmp(2)
2736 If tmp(1) <> "" Then
2737 AlbumArtistTitle = tmp(0) & " " & tmp(1)
2738 Else
2739 AlbumArtistTitle = tmp(0)
2740 End If
2741 Writelog "AlbumArtistTitle=" & AlbumArtistTitle
2742
2743 If (Not CheckAlbumArtistFirst) Then
2744 AlbumArtist = AlbumArtistTitle
2745 End If
2746
2747 If AlbumArtist = "Various" And CheckVarious Then
2748 AlbumArtist = TxtVarious
2749 End If
2750 If AlbumArtistTitle = "Various" And CheckVarious Then
2751 AlbumArtistTitle = TxtVarious
2752 End If
2753
2754 If CurrentRelease.Exists("format_quantity") Then
2755 FormatCnt = CurrentRelease("format_quantity")
2756 Else
2757 FormatCnt = 0
2758 End If
2759
2760 WriteLog " "
2761 WriteLog "ExtraArtists"
2762 If currentRelease.Exists("extraartists") Then
2763 For Each extraArtist In CurrentRelease("extraartists")
2764 WriteLog " "
2765 Set currentArtist = CurrentRelease("extraartists")(extraArtist)
2766 If currentArtist("tracks") = "" Then
2767 If (currentArtist("anv") <> "") And Not CheckUseAnv Then
2768 artistName = CleanArtistName(currentArtist("anv"))
2769 Else
2770 artistName = CleanArtistName(currentArtist("name"))
2771 End If
2772 WriteLog "ArtistName=" & artistName
2773 WriteLog "Without Track Info"
2774 role = currentArtist("role")
2775 NoSplit = False
2776 If InStr(role, ",") = 0 Then
2777 currentRole = Trim(role)
2778 zahl = 1
2779 NoSplit = True
2780 Else
2781 rolea = CheckSpecialRole(role)
2782 zahl = UBound(rolea)
2783 End If
2784
2785 WriteLog "Role count=" & zahl
2786 For zahltemp = 1 To zahl
2787 If NoSplit = False Then
2788 currentRole = Trim(rolea(zahltemp))
2789 End If
2790 WriteLog "currentRole=" & currentRole
2791 If LookForFeaturing(currentRole) And CheckIgnoreFeatArtist = False Then
2792 WriteLog "Featuring found"
2793 If InStr(AlbumFeaturing, artistName) = 0 Then
2794 If AlbumFeaturing = "" Then
2795 If CheckFeaturingName Then
2796 AlbumFeaturing = TxtFeaturingName & " " & artistName
2797 Else
2798 AlbumFeaturing = currentRole & " " & artistName
2799 End If
2800 Else
2801 AlbumFeaturing = AlbumFeaturing & ArtistSeparator & artistName
2802 End If
2803 End If
2804 Else
2805 Do
2806 tmp = searchKeyword(LyricistKeywords, currentRole, AlbumLyricist, artistName)
2807 If tmp <> "" And tmp <> "ALREADY_INSIDE_ROLE" Then
2808 AlbumLyricist = tmp
2809 WriteLog "AlbumLyricist=" & AlbumLyricist
2810 Exit Do
2811 ElseIf tmp = "ALREADY_INSIDE_ROLE" Then
2812 WriteLog "ALREADY_INSIDE_ROLE"
2813 Exit Do
2814 End If
2815 tmp = searchKeyword(ConductorKeywords, currentRole, AlbumConductor, artistName)
2816 If tmp <> "" And tmp <> "ALREADY_INSIDE_ROLE" Then
2817 AlbumConductor = tmp
2818 WriteLog "AlbumConductor=" & AlbumConductor
2819 Exit Do
2820 ElseIf tmp = "ALREADY_INSIDE_ROLE" Then
2821 WriteLog "ALREADY_INSIDE_ROLE"
2822 Exit Do
2823 End If
2824 tmp = searchKeyword(ProducerKeywords, currentRole, AlbumProducer, artistName)
2825 If tmp <> "" And tmp <> "ALREADY_INSIDE_ROLE" Then
2826 AlbumProducer = tmp
2827 WriteLog "AlbumProducer=" & AlbumProducer
2828 Exit Do
2829 ElseIf tmp = "ALREADY_INSIDE_ROLE" Then
2830 WriteLog "ALREADY_INSIDE_ROLE"
2831 Exit Do
2832 End If
2833 tmp = searchKeyword(ComposerKeywords, currentRole, AlbumComposer, artistName)
2834 If tmp <> "" And tmp <> "ALREADY_INSIDE_ROLE" Then
2835 AlbumComposer = tmp
2836 WriteLog "AlbumComposer=" & AlbumComposer
2837 Exit Do
2838 ElseIf tmp = "ALREADY_INSIDE_ROLE" Then
2839 WriteLog "ALREADY_INSIDE_ROLE"
2840 Exit Do
2841 End If
2842 tmp2 = search_involved(Involved_R, currentRole)
2843 If tmp2 = -2 Then
2844 WriteLog "Ignore Role: '" & currentRole & "' (Unwanted tag)"
2845 ElseIf tmp2 = -1 Then
2846 ReDim Preserve Involved_R(UBound(Involved_R)+1)
2847 Involved_R(UBound(Involved_R)) = currentRole & ": " & artistName
2848 WriteLog "New Role: " & currentRole & ": " & artistName
2849 Else
2850 If InStr(Involved_R(tmp2), artistName) = 0 Then
2851 Involved_R(tmp2) = Involved_R(tmp2) & ArtistSeparator & artistName
2852 WriteLog "Role updated: " & Involved_R(tmp2)
2853 Else
2854 WriteLog "artist already inside role"
2855 End If
2856 End If
2857 Exit Do
2858 Loop While True
2859 End If
2860 Next
2861 Else
2862 If Not CheckUseAnv And currentArtist("anv") <> "" Then
2863 artistName = CleanArtistName(currentArtist("anv"))
2864 Else
2865 artistName = CleanArtistName(currentArtist("name"))
2866 End If
2867 WriteLog "ArtistName=" & artistName
2868 role = currentArtist("role")
2869 rTrack = currentArtist("tracks")
2870 If Left(rTrack, 7) = "tracks:" Then
2871 rTrack = Trim(Mid(rTrack, 8))
2872 End If
2873 WriteLog "Track(s)=" & rTrack
2874 WriteLog "Role(s)=" & role
2875 NoSplit = False
2876 If InStr(role, ",") <> 0 Then
2877 rolea = CheckSpecialRole(role)
2878 zahl = UBound(rolea)
2879 ElseIf InStr(role, " & ") <> 0 Then
2880 rolea = Split(role, "&")
2881 zahl = UBound(rolea)
2882 Else
2883 involvedRole = Trim(role)
2884 zahl = 1
2885 NoSplit = True
2886 End If
2887 For zahltemp = 1 To zahl
2888 If NoSplit = False Then
2889 involvedRole = Trim(rolea(zahltemp))
2890 End If
2891 WriteLog "involvedRole=" & involvedRole
2892 If InStr(rTrack, ",") = 0 And InStr(rTrack, " to ") = 0 And InStr(rTrack, " & ") = 0 Then
2893 currentTrack = rTrack
2894 Add_Track_Role currentTrack, artistName, involvedRole, TrackRoles, TrackArtist2, TrackPos, LeadingZeroTrackPosition
2895 End If
2896 If InStr(rTrack, ",") <> 0 Then
2897 tmp = Split(rTrack, ",")
2898 zahl2 = UBound(tmp)
2899 For zahltemp2 = 0 To zahl2
2900 currentTrack = Trim(tmp(zahltemp2))
2901 If InStr(currentTrack, " to ") <> 0 Then
2902 Track_from_to currentTrack, artistName, involvedRole, Title_Position, TrackRoles, TrackArtist2, TrackPos, LeadingZeroTrackPosition
2903 Else
2904 Add_Track_Role currentTrack, artistName, involvedRole, TrackRoles, TrackArtist2, TrackPos, LeadingZeroTrackPosition
2905 End If
2906 Next
2907 ElseIf InStr(rTrack, " to ") <> 0 Then
2908 currentTrack = Trim(rTrack)
2909 Track_from_to currentTrack, artistName, involvedRole, Title_Position, TrackRoles, TrackArtist2, TrackPos, LeadingZeroTrackPosition
2910 ElseIf InStr(rTrack, " & ") <> 0 Then
2911 tmp = Split(rTrack, " & ")
2912 zahl2 = UBound(tmp)
2913 For zahltemp2 = 0 To zahl2
2914 currentTrack = Trim(tmp(zahltemp2))
2915 Add_Track_Role currentTrack, artistName, involvedRole, TrackRoles, TrackArtist2, TrackPos, LeadingZeroTrackPosition
2916 Next
2917 End If
2918 Next
2919 End If
2920 Next
2921 End If
2922 ' Get track titles and track artists
2923
2924 WriteLog " "
2925 WriteLog "--------------------------------------------------------------"
2926 iAutoTrackNumber = 1
2927 iAutoDiscNumber = 1
2928 iAutoDiscFormat = ""
2929 iTrackNum = 0
2930 cSubTrack = -1
2931 subTrackTitle = ""
2932 CharSeparatorSubTrack = 0
2933 Rem CharSeparatorSubTrack: 0 = nothing 1 = "." 2 = a-z
2934 Rem subTrackStart = 1 '0 = Song -1 1 = First Song
2935
2936 'Workaround for using "." as separator at discogs -----------------------------------------------------------------------------------------------------------
2937 tmp = 0 : tmp2 = 0
2938 NoSubTrackUsing = False
2939 For t = 0 To UBound(Title_Position)-1
2940 If Title_Position(t) <> "" Then
2941 tmp2 = tmp2 + 1
2942 End If
2943 If InStr(Title_Position(t), ".") <> 0 Then tmp = tmp + 1
2944 Next
2945 If tmp = tmp2 And tmp <> 0 Then NoSubTrackUsing = True 'all tracks have "." in position tag, this can't be a subtrack
2946 WriteLog "NoSubTrackUsing = " & NoSubTrackUsing
2947 'Workaround for using "." as separator at discogs -----------------------------------------------------------------------------------------------------------
2948
2949 WriteLog "Track count from Title_position=" & UBound(Title_Position)
2950
2951 Dim NewSubTrackFound, cNewSubTrack
2952 NewSubTrackFound = False
2953
2954 For t = 0 To UBound(Title_Position)-1
2955 WriteLog " "
2956 WriteLog "Process next track"
2957 WriteLog "Track=" & t
2958 WriteLog "Title_position=" & Title_Position(t)
2959 SDB.ProcessMessages
2960 If rSubPosition.Item(t) <> "" And rSubPosition.Item(t) <> "NewSubTrack" Then
2961 WriteLog "Processing Subtrack"
2962 Set currentTrack = CurrentRelease("tracklist")(CInt(rTrackPosition.Item(t)))("sub_tracks")(cInt(rSubPosition.Item(t)))
2963 Else
2964 Set currentTrack = CurrentRelease("tracklist")(CInt(rTrackPosition.Item(t)))
2965 End If
2966
2967 position = currentTrack("position")
2968 If Right(position, 1) = "." Then position = Left(position, Len(position)-1)
2969 If NoSubTrackUsing = True Then position = Replace(position, ".", "-")
2970 trackname = PackSpaces(DecodeHtmlChars(TitleList(t)), True)
2971 WriteLog "Trackname=" & trackname
2972 WriteLog "Position=" & position
2973 ' WriteLog "t=" & t
2974 WriteLog "rSubPosition(t)=" & rSubPosition.item(t)
2975 Durations.Add currentTrack("duration")
2976 position = exchange_roman_numbers(position)
2977
2978 If rSubPosition.Item(t) <> "" And rSubPosition.Item(t) <> "NewSubTrack" Then
2979 If NewSubTrackFound = False Then
2980 cNewSubTrack = t - 1
2981 If ArtistsList(t) <> "" then
2982 subTrackTitle = ArtistsList(t) & " - " & trackName
2983 Else
2984 subTrackTitle = trackName
2985 End If
2986 If NewResult = True Then
2987 UnselectedTracks(iTrackNum) = "x"
2988 UnselectedTrackNames(iTrackNum) = "x"
2989 End If
2990 NewSubTrackFound = True
2991 WriteLog "New Subtrack"
2992 Else
2993 If ArtistsList(t) <> "" then
2994 subTrackTitle = subTrackTitle & SubTrackSeparator & ArtistsList(t) & " - " & trackName
2995 Else
2996 subTrackTitle = subTrackTitle & SubTrackSeparator & trackName
2997 End If
2998 If NewResult = True Then
2999 UnselectedTracks(iTrackNum) = "x"
3000 UnselectedTrackNames(iTrackNum) = "x"
3001 End If
3002 WriteLog "More Subtrack"
3003 End If
3004 If t = (UBound(Title_Position) - 1) Then 'if last track and subtrack then add to subtrack songlist
3005 If SubTrackNameSelection = False Then
3006 Tracks.Item(cNewSubTrack) = Tracks.Item(cNewSubTrack) & " (" & subTrackTitle & ")"
3007 Else
3008 Tracks.Item(cNewSubTrack) = subTrackTitle
3009 End If
3010 End If
3011 Else
3012 If NewSubTrackFound = True Then
3013 If SubTrackNameSelection = False Then
3014 Tracks.Item(cNewSubTrack) = Tracks.Item(cNewSubTrack) & " (" & subTrackTitle & ")"
3015 Else
3016 Tracks.Item(cNewSubTrack) = subTrackTitle
3017 End If
3018 If NewResult = True Then
3019 UnselectedTracks(cNewSubTrack) = ""
3020 UnselectedTrackNames(cNewSubTrack) = ""
3021 End If
3022 NewSubTrackFound = False
3023 cNewSubTrack = -1
3024 WriteLog "Subtrack end"
3025 End If
3026 End If
3027
3028 pos = 0
3029 If InStr(LCase(position), "-") > 0 And position <> "-" Then
3030 pos = InStr(LCase(position), "-")
3031 End If
3032 ' Here comes the new track/disc numbering methods
3033 If position <> "" And rSubPosition.Item(t) = "" Then
3034 If CheckTurnOffSubTrack = False Then
3035 If (cSubTrack <> -1 And InStr(LCase(position), ".") = 0 And CharSeparatorSubTrack = 1) Or (cSubTrack <> -1 And IsNumeric(Right(position, 1)) And CharSeparatorSubTrack = 2) Or position = "-" Then
3036 WriteLog "End of Subtrack found"
3037 If SubTrackNameSelection = False Then
3038 Tracks.Item(cSubTrack) = Tracks.Item(cSubTrack) & " (" & subTrackTitle & ")"
3039 Else
3040 Tracks.Item(cSubTrack) = subTrackTitle
3041 End If
3042 cSubTrack = -1
3043 subTrackTitle = ""
3044 CharSeparatorSubTrack = 0
3045 End If
3046
3047 If NoSubTrackUsing = False Then
3048 WriteLog "Calling Subtrack Function"
3049 CharSeparatorSubTrack = 0
3050 'SubTrack Function ---------------------------------------------------------
3051 If InStr(LCase(position), ".") > 0 Then
3052 CharSeparatorSubTrack = 1
3053 ElseIf Not IsNumeric(Right(position, 1)) And Len(position) > 1 And position <> "Video" Then
3054 CharSeparatorSubTrack = 2
3055 End If
3056 WriteLog "CharSeparatorSubTrack = " & CharSeparatorSubTrack
3057 If CharSeparatorSubTrack <> 0 Then
3058 If cSubTrack <> -1 Then 'more subtrack
3059 WriteLog "More Subtrack"
3060 If CharSeparatorSubTrack = 1 Then
3061 tmp = Split(position, ".")
3062 If oldSubTrackNumber <> tmp(0) Then
3063 If SubTrackNameSelection = False Then
3064 Tracks.Item(cSubTrack) = Tracks.Item(cSubTrack) & " (" & subTrackTitle & ")"
3065 Else
3066 Tracks.Item(cSubTrack) = subTrackTitle
3067 End If
3068 cSubTrack = -1
3069 subTrackTitle = ""
3070 End If
3071 ElseIf CharSeparatorSubTrack = 2 Then
3072 tmp2 = FindSubTrackSplit(position)
3073 If oldSubTrackNumber <> tmp2 Then
3074 If SubTrackNameSelection = False Then
3075 Tracks.Item(cSubTrack) = Tracks.Item(cSubTrack) & " (" & subTrackTitle & ")"
3076 Else
3077 Tracks.Item(cSubTrack) = subTrackTitle
3078 End If
3079 cSubTrack = -1
3080 subTrackTitle = ""
3081 End If
3082 End If
3083 Else 'new subtrack
3084 WriteLog "New SubTrack found"
3085 If SubTrackNameSelection = False And iTrackNum > 0 Then
3086 cSubTrack = iTrackNum - 1
3087 Else
3088 cSubTrack = iTrackNum
3089 End If
3090 If CharSeparatorSubTrack = 1 Then
3091 tmp = Split(position, ".")
3092 oldSubTrackNumber = tmp(0)
3093 ElseIf CharSeparatorSubTrack = 2 Then
3094 oldSubTrackNumber = FindSubTrackSplit(position)
3095 If oldSubTrackNumber = "" Then oldSubTrackNumber = position
3096 End If
3097 WriteLog "oldSubTrackNumber=" & oldSubTrackNumber
3098 End If
3099
3100 If subTrackTitle = "" Then
3101 If ArtistsList(t) <> "" Then
3102 subTrackTitle = ArtistsList(t) & " - " & trackName
3103 Else
3104 subTrackTitle = trackName
3105 End If
3106 If SubTrackNameSelection = False Then
3107 If iTrackNum > 0 Then
3108 If NewResult = True Then
3109 UnselectedTracks(iTrackNum-1) = ""
3110 UnselectedTracks(iTrackNum) = "x"
3111 UnselectedTrackNames(iTrackNum-1) = ""
3112 UnselectedTrackNames(iTrackNum) = "x"
3113 End If
3114 Else
3115 If NewResult = True Then
3116 UnselectedTracks(iTrackNum) = ""
3117 UnselectedTrackNames(iTrackNum) = ""
3118 End If
3119 End If
3120 Else
3121 If NewResult = True Then
3122 UnselectedTracks(iTrackNum) = ""
3123 UnselectedTrackNames(iTrackNum) = ""
3124 End If
3125 End If
3126 Else
3127 If ArtistsList(t) <> "" Then
3128 subTrackTitle = subTrackTitle & SubTrackSeparator & ArtistsList(t) & " - " & trackName
3129 Else
3130 subTrackTitle = subTrackTitle & SubTrackSeparator & trackName
3131 End If
3132 If NewResult = True Then
3133 UnselectedTracks(iTrackNum) = "x"
3134 UnselectedTrackNames(iTrackNum) = "x"
3135 End If
3136 End If
3137
3138 'SubTrack Function ---------------------------------------------------------
3139 End If
3140 End If
3141 End If
3142
3143 trackNumbering pos, position, TracksNum, TracksCD, iTrackNum, FormatCnt
3144
3145 ElseIf (trackName = "-" And rSubPosition.Item(t) <> "NewSubTrack") Then
3146 tracksNum.Add ""
3147 tracksCD.Add ""
3148 If NewResult = True Then
3149 UnselectedTracks(iTrackNum) = "x"
3150 UnselectedTrackNames(iTrackNum) = "x"
3151 End If
3152 ElseIf currentTrack("type_") = "heading" Then
3153 WriteLog "Heading-Track erkannt"
3154 If NewResult = True Or UnselectedTracks(iTrackNum) = "x" Then
3155 UnselectedTracks(iTrackNum) = "x"
3156 UnselectedTrackNames(iTrackNum) = "x"
3157 tracksNum.Add ""
3158 tracksCD.Add ""
3159 End If
3160 If UnselectedTracks(iTrackNum) = "" Then
3161 trackNumbering pos, position, TracksNum, TracksCD, iTrackNum, FormatCnt
3162 End If
3163 Else ' Nothing specified
3164 trackNumbering pos, position, TracksNum, TracksCD, iTrackNum, FormatCnt
3165 End If
3166
3167 ReDim Involved_R_T(0)
3168
3169 TrackInvolvedPeople = ""
3170 TrackComposers = ""
3171 TrackConductors = ""
3172 TrackProducers = ""
3173 TrackLyricists = ""
3174 TrackFeaturing = AlbumFeaturing
3175
3176 If UBound(Involved_R) > 0 Then
3177 For tmp = 1 To UBound(Involved_R)
3178 ReDim Preserve Involved_R_T(tmp)
3179 Involved_R_T(tmp) = Involved_R(tmp)
3180 Next
3181 End If
3182
3183 For tmp = 1 To UBound(TrackPos)
3184 If TrackPos(tmp) = position And position <> "" Then
3185 WriteLog "trackpos(" & tmp & ")=" & trackpos(tmp)
3186 involvedRole = TrackRoles(tmp)
3187 involvedArtist = TrackArtist2(tmp)
3188
3189 If LookForFeaturing(involvedRole) And CheckIgnoreFeatArtist = False Then
3190 If InStr(TrackFeaturing, involvedArtist) = 0 Then
3191 If TrackFeaturing = "" Then
3192 If CheckFeaturingName Then
3193 TrackFeaturing = TxtFeaturingName & " " & involvedArtist
3194 Else
3195 TrackFeaturing = involvedRole & " " & involvedArtist
3196 End If
3197 Else
3198 TrackFeaturing = TrackFeaturing & ArtistSeparator & involvedArtist
3199 End If
3200 End If
3201 WriteLog "TrackFeaturing=" & TrackFeaturing
3202 Else
3203 Do
3204 ret = searchKeyword(LyricistKeywords, involvedRole, TrackLyricists, involvedArtist)
3205 If ret <> "" And ret <> "ALREADY_INSIDE_ROLE" Then
3206 TrackLyricists = ret
3207 WriteLog "TrackLyricists=" & TrackLyricists
3208 Exit Do
3209 ElseIf ret = "ALREADY_INSIDE_ROLE" Then
3210 WriteLog "ALREADY_INSIDE_ROLE"
3211 Exit Do
3212 End If
3213 ret = searchKeyword(ConductorKeywords, involvedRole, TrackConductors, involvedArtist)
3214 If ret <> "" And ret <> "ALREADY_INSIDE_ROLE" Then
3215 TrackConductors = ret
3216 WriteLog "TrackConductors=" & TrackConductors
3217 Exit Do
3218 ElseIf ret = "ALREADY_INSIDE_ROLE" Then
3219 WriteLog "ALREADY_INSIDE_ROLE"
3220 Exit Do
3221 End If
3222 ret = searchKeyword(ProducerKeywords, involvedRole, TrackProducers, involvedArtist)
3223 If ret <> "" And ret <> "ALREADY_INSIDE_ROLE" Then
3224 TrackProducers = ret
3225 WriteLog "TrackProducers=" & TrackProducers
3226 Exit Do
3227 ElseIf ret = "ALREADY_INSIDE_ROLE" Then
3228 WriteLog "ALREADY_INSIDE_ROLE"
3229 Exit Do
3230 End If
3231 ret = searchKeyword(ComposerKeywords, involvedRole, TrackComposers, involvedArtist)
3232 If ret <> "" And ret <> "ALREADY_INSIDE_ROLE" Then
3233 TrackComposers = ret
3234 WriteLog "TrackComposers=" & TrackComposers
3235 Exit Do
3236 ElseIf ret = "ALREADY_INSIDE_ROLE" Then
3237 WriteLog "ALREADY_INSIDE_ROLE"
3238 Exit Do
3239 End If
3240 tmp2 = search_involved(Involved_R_T, involvedRole)
3241 If tmp2 = -2 Then
3242 WriteLog "Ignore Role: '" & currentRole & "' (Unwanted tag)"
3243 ElseIf tmp2 = -1 Then
3244 ReDim Preserve Involved_R_T(UBound(Involved_R_T)+1)
3245 Involved_R_T(UBound(Involved_R_T)) = involvedRole & ": " & TrackArtist2(tmp)
3246 WriteLog "New Role: " & involvedRole & ": " & TrackArtist2(tmp)
3247 Else
3248 If InStr(Involved_R_T(tmp2), TrackArtist2(tmp)) = 0 Then
3249 Involved_R_T(tmp2) = Involved_R_T(tmp2) & ArtistSeparator & TrackArtist2(tmp)
3250 WriteLog "Role updated: " & Involved_R_T(tmp2)
3251 Else
3252 WriteLog "artist already inside role"
3253 End If
3254 End If
3255 Exit Do
3256 Loop While True
3257 End If
3258 End If
3259 SDB.ProcessMessages
3260 Next
3261
3262 artistList = ""
3263
3264 WriteLog " "
3265 WriteLog "Search for TrackArtist"
3266 If currentTrack.Exists("artists") Then
3267 tmp = getArtistsName(CurrentTrack, "artists", QueryPage)
3268 artistList = tmp(0)
3269 TrackFeaturing = tmp(1)
3270 End If
3271 If artistList = "" Then artistList = AlbumArtistTitle
3272
3273 WriteLog "artistlist=" & artistlist
3274 WriteLog "rTrack=" & rTrackPosition.Item(t)
3275 REM WriteLog "ubound=" & UBound($currentTrack)
3276
3277 If currentTrack.Exists("extraartists") Then
3278 WriteLog " "
3279 WriteLog "ExtraArtist found"
3280 For Each extra In currentTrack("extraartists")
3281 Set currentArtist = CurrentTrack("extraartists")(extra)
3282 If (currentArtist("anv") <> "") And Not CheckUseAnv Then
3283 involvedArtist = CleanArtistName(currentArtist("anv"))
3284 Else
3285 involvedArtist = CleanArtistName(currentArtist("name"))
3286 End If
3287 WriteLog "involvedArtist=" & involvedArtist
3288 If involvedArtist <> "" Then
3289 role = currentArtist("role")
3290 NoSplit = False
3291 If InStr(role, ",") = 0 Then
3292 involvedRole = Trim(role)
3293 zahl = 1
3294 NoSplit = True
3295 Else
3296 rolea = CheckSpecialRole(role)
3297 zahl = UBound(rolea)
3298 End If
3299 For zahltemp = 1 To zahl
3300 If NoSplit = False Then
3301 involvedRole = Trim(rolea(zahltemp))
3302 End If
3303
3304 If LookForFeaturing(involvedRole) And CheckIgnoreFeatArtist = False Then
3305 If InStr(artistList, involvedArtist) = 0 Then
3306 If TrackFeaturing = "" Then
3307 If CheckFeaturingName Then
3308 TrackFeaturing = TxtFeaturingName & " " & involvedArtist
3309 Else
3310 TrackFeaturing = involvedRole & " " & involvedArtist
3311 End If
3312 Else
3313 If InStr(TrackFeaturing, involvedArtist) = 0 Then
3314 TrackFeaturing = TrackFeaturing & ArtistSeparator & involvedArtist
3315 End If
3316 End If
3317 End If
3318 Else
3319 Do
3320 tmp = searchKeyword(LyricistKeywords, involvedRole, TrackLyricists, involvedArtist)
3321 If tmp <> "" And tmp <> "ALREADY_INSIDE_ROLE" Then
3322 TrackLyricists = tmp
3323 WriteLog "TrackLyricists=" & TrackLyricists
3324 Exit Do
3325 ElseIf tmp = "ALREADY_INSIDE_ROLE" Then
3326 WriteLog "ALREADY_INSIDE_ROLE"
3327 Exit Do
3328 End If
3329 tmp = searchKeyword(ConductorKeywords, involvedRole, TrackConductors, involvedArtist)
3330 If tmp <> "" And tmp <> "ALREADY_INSIDE_ROLE" Then
3331 TrackConductors = tmp
3332 WriteLog "TrackConductors=" & TrackConductors
3333 Exit Do
3334 ElseIf tmp = "ALREADY_INSIDE_ROLE" Then
3335 WriteLog "ALREADY_INSIDE_ROLE"
3336 Exit Do
3337 End If
3338 tmp = searchKeyword(ProducerKeywords, involvedRole, TrackProducers, involvedArtist)
3339 If tmp <> "" And tmp <> "ALREADY_INSIDE_ROLE" Then
3340 TrackProducers = tmp
3341 WriteLog "TrackProducers=" & TrackProducers
3342 Exit Do
3343 ElseIf tmp = "ALREADY_INSIDE_ROLE" Then
3344 WriteLog "ALREADY_INSIDE_ROLE"
3345 Exit Do
3346 End If
3347 tmp = searchKeyword(ComposerKeywords, involvedRole, TrackComposers, involvedArtist)
3348 If tmp <> "" And tmp <> "ALREADY_INSIDE_ROLE" Then
3349 TrackComposers = tmp
3350 WriteLog "TrackComposers=" & TrackComposers
3351 Exit Do
3352 ElseIf tmp = "ALREADY_INSIDE_ROLE" Then
3353 WriteLog "ALREADY_INSIDE_ROLE"
3354 Exit Do
3355 End If
3356 tmp2 = search_involved(Involved_R_T, involvedRole)
3357 If tmp2 = -2 Then
3358 WriteLog "Ignore Role: '" & currentRole & "' (Unwanted tag)"
3359 ElseIf tmp2 = -1 Then
3360 ReDim Preserve Involved_R_T(UBound(Involved_R_T)+1)
3361 Involved_R_T(UBound(Involved_R_T)) = involvedRole & ": " & involvedArtist
3362 WriteLog "New Role: " & involvedRole & ": " & involvedArtist
3363 Else
3364 If InStr(Involved_R_T(tmp2), involvedArtist) = 0 Then
3365 Involved_R_T(tmp2) = Involved_R_T(tmp2) & ArtistSeparator & involvedArtist
3366 WriteLog "Role updated: " & Involved_R_T(tmp2)
3367 Else
3368 WriteLog "artist already inside role"
3369 End If
3370 End If
3371 Exit Do
3372 Loop While True
3373 End If
3374 Next
3375 End If
3376 SDB.ProcessMessages
3377 Next
3378 WriteLog "ExtraArtist end"
3379 End If
3380
3381 If TrackFeaturing <> "" And CheckIgnoreFeatArtist = False Then
3382 If CheckTitleFeaturing = True Then
3383 tmp = InStrRev(TrackFeaturing, ArtistSeparator)
3384 If tmp = 0 Or ArtistLastSeparator = False Then
3385 trackName = trackName & " (" & TrackFeaturing & ")"
3386 Else
3387 trackName = trackName & " (" & Left(TrackFeaturing, tmp-1) & " & " & Mid(TrackFeaturing, tmp+Len(ArtistSeparator)) & ")"
3388 End If
3389 Else
3390 tmp = InStrRev(TrackFeaturing, ArtistSeparator)
3391 If tmp = 0 Or ArtistLastSeparator = False Then
3392 If Left(TrackFeaturing, 1) = "," Or Left(TrackFeaturing, 1) = ";" Then
3393 artistList = artistList & TrackFeaturing
3394 Else
3395 artistList = artistList & " " & TrackFeaturing
3396 End If
3397 Else
3398 artistList = artistList & " " & Left(TrackFeaturing, tmp-1) & " & " & Mid(TrackFeaturing, tmp+Len(ArtistSeparator))
3399 End If
3400 End If
3401 End If
3402
3403 ArtistTitles.Add artistList
3404
3405 If position <> "" Then
3406 TrackLyricists = FindArtist(TrackLyricists, AlbumLyricist)
3407 If AlbumLyricist <> "" and TrackLyricists <> "" Then
3408 Lyricists.Add AlbumLyricist & Separator & TrackLyricists
3409 Else
3410 Lyricists.Add AlbumLyricist & TrackLyricists
3411 End If
3412 TrackComposers = FindArtist(TrackComposers, AlbumComposer)
3413 If AlbumComposer <> "" and TrackComposers <> "" Then
3414 Composers.Add AlbumComposer & Separator & TrackComposers
3415 Else
3416 Composers.Add AlbumComposer & TrackComposers
3417 End If
3418 TrackConductors = FindArtist(TrackConductors, AlbumConductor)
3419 If AlbumConductor <> "" and TrackConductors <> "" Then
3420 Conductors.Add AlbumConductor & Separator & TrackConductors
3421 Else
3422 Conductors.Add AlbumConductor & TrackConductors
3423 End If
3424
3425 TrackProducers = FindArtist(TrackProducers, AlbumProducer)
3426 If AlbumProducer <> "" and TrackProducers <> "" Then
3427 Producers.Add AlbumProducer & Separator & TrackProducers
3428 Else
3429 Producers.Add AlbumProducer & TrackProducers
3430 End If
3431
3432 If UBound(Involved_R_T) > 0 Then
3433 For tmp = 1 To UBound(involved_R_T)
3434 TrackInvolvedPeople = TrackInvolvedPeople & Involved_R_T(tmp) & Separator
3435 Next
3436 TrackInvolvedPeople = Left(TrackInvolvedPeople, Len(TrackInvolvedPeople)-Len(Separator))
3437 Else
3438 TrackInvolvedPeople = ""
3439 End If
3440
3441 InvolvedArtists.Add TrackInvolvedPeople
3442 If CheckReplaceAccentChar = True Then
3443 trackName = Replace(trackName, ChrW(8245), "'")
3444 trackName = Replace(trackName, ChrW(8246), "'")
3445 trackName = Replace(trackName, ChrW(8242), "'")
3446 trackName = Replace(trackName, ChrW(8243), "'")
3447 trackName = Replace(trackName, Chr(145), "'")
3448 trackName = Replace(trackName, Chr(146), "'")
3449 trackName = Replace(trackName, Chr(147), "'")
3450 trackName = Replace(trackName, Chr(148), "'")
3451 End If
3452 Tracks.Add trackName
3453 Else
3454 Lyricists.Add ""
3455 Composers.Add ""
3456 Conductors.Add ""
3457 Producers.Add ""
3458 InvolvedArtists.Add ""
3459 If CheckReplaceAccentChar = True Then
3460 trackName = Replace(trackName, ChrW(8245), "'")
3461 trackName = Replace(trackName, ChrW(8246), "'")
3462 trackName = Replace(trackName, ChrW(8242), "'")
3463 trackName = Replace(trackName, ChrW(8243), "'")
3464 trackName = Replace(trackName, Chr(145), "'")
3465 trackName = Replace(trackName, Chr(146), "'")
3466 trackName = Replace(trackName, Chr(147), "'")
3467 trackName = Replace(trackName, Chr(148), "'")
3468 End If
3469 Tracks.Add trackName
3470 End If
3471 iTrackNum = iTrackNum + 1
3472 Next
3473
3474
3475 If cSubTrack <> -1 Then
3476 If CheckReplaceAccentChar = True Then
3477 subTrackTitle = Replace(subTrackTitle, ChrW(8245), "'")
3478 subTrackTitle = Replace(subTrackTitle, ChrW(8246), "'")
3479 subTrackTitle = Replace(subTrackTitle, ChrW(8242), "'")
3480 subTrackTitle = Replace(subTrackTitle, ChrW(8243), "'")
3481 subTrackTitle = Replace(subTrackTitle, Chr(145), "'")
3482 subTrackTitle = Replace(subTrackTitle, Chr(146), "'")
3483 subTrackTitle = Replace(subTrackTitle, Chr(147), "'")
3484 subTrackTitle = Replace(subTrackTitle, Chr(148), "'")
3485 End If
3486 If SubTrackNameSelection = False Then
3487 Tracks.Item(cSubTrack) = Tracks.Item(cSubTrack) & " (" & subTrackTitle & ")"
3488 Else
3489 Tracks.Item(cSubTrack) = subTrackTitle
3490 End If
3491 cSubTrack = -1
3492 subTrackTitle = ""
3493 CharSeparatorSubTrack = 0
3494 End If
3495
3496 ' Get album title
3497 AlbumTitle = PackSpaces(currentRelease("title"), True)
3498
3499 ' Get Album art URL
3500 If CurrentRelease.Exists("images") Then
3501 For Each i In CurrentRelease("images")
3502 Set currentImage = CurrentRelease("images")(i)
3503
3504 If currentImage("type") = "primary" Or AlbumArtURL = "" Then
3505 AlbumArtURL = currentImage("resource_url")
3506 WriteLog "AlbumArtURL2=" & AlbumArtURL
3507 AlbumArtThumbNail = currentImage("uri150")
3508 WriteLog "AlbumArtThumbNail2=" & AlbumArtThumbNail
3509 End If
3510 Next
3511 End If
3512 If AlbumArtThumbNail <> "" Then
3513 ret = getimages(AlbumArtThumbNail, sTemp & "cover.jpg")
3514 AlbumArtThumbNail = sTemp & "cover.jpg"
3515 End If
3516
3517 '----------------------------------DiscogsImages----------------------------------------
3518 Set ImageList = SDB.NewStringList
3519 Set SaveImageType = SDB.NewStringList
3520 Set SaveImage = SDB.NewStringList
3521 ImagesCount = 0
3522
3523 If CurrentRelease.Exists("images") Then
3524 ImagesCount = CurrentRelease("images").Count
3525 WriteLog "ImagesCount=" & ImagesCount
3526 If ImagesCount > 1 Then
3527 For Each i In CurrentRelease("images")
3528 Set currentImage = CurrentRelease("images")(i)
3529 tmpArt = currentImage("resource_url")
3530 WriteLog tmpArt
3531 If AlbumArtURL <> tmpArt Then
3532 ImageList.add tmpArt
3533 SaveImageType.add "other"
3534 SaveImage.add "0"
3535 End If
3536 Next
3537 End If
3538 End If
3539 '----------------------------------DiscogsImages----------------------------------------
3540
3541 ' Get Master ID
3542 If CurrentRelease.Exists("master_id") Then
3543 theMaster = currentRelease("master_id")
3544 If SavedMasterID <> theMaster Then
3545 OriginalDateRead = ReloadMaster(theMaster)
3546 SavedMasterID = theMaster
3547 End If
3548 ElseIf CurrentRelease.Exists("main_release") Then 'Master
3549 If CurrentRelease.Exists("year") Then
3550 OriginalDateRead = CurrentRelease("year")
3551 End If
3552 SavedMasterID = currentRelease("id")
3553 Else
3554 theMaster = ""
3555 SavedMasterID = theMaster
3556 OriginalDateRead = ""
3557 End If
3558
3559 ' Get release year/date
3560 If CurrentRelease.Exists("released") Then
3561 ReleaseDateRead = CurrentRelease("released")
3562 If Len(ReleaseDateRead) > 4 Then
3563 ReleaseSplit = Split(ReleaseDateRead,"-")
3564 If ReleaseSplit(2) = "00" Then
3565 ReleaseDateRead = Left(ReleaseDateRead, 4)
3566 Else
3567 ReleaseDateRead = ReleaseSplit(2) & "-" & ReleaseSplit(1) & "-" & ReleaseSplit(0)
3568 End If
3569 If CheckYearOnlyDate Then
3570 ReleaseDateRead = Right(ReleaseDateRead, 4)
3571 End If
3572 End If
3573 Else
3574 ReleaseDateRead = ""
3575 End If
3576 WriteLog "ReleaseDateRead=" & ReleaseDateRead
3577
3578 'Set OriginalDate
3579 If OriginalDateRead <> "" Then
3580 If Len(OriginalDateRead) > 4 Then
3581 ReleaseSplit = Split(OriginalDateRead,"-")
3582 If ReleaseSplit(2) = "00" Then
3583 OriginalDateRead = Left(OriginalDateRead, 4)
3584 Else
3585 OriginalDateRead = ReleaseSplit(2) & "-" & ReleaseSplit(1) & "-" & ReleaseSplit(0)
3586 End If
3587 If CheckYearOnlyDate Then
3588 OriginalDateRead = Right(OriginalDateRead, 4)
3589 End If
3590 End If
3591 End If
3592 WriteLog "OriginalDateRead=" & OriginalDateRead
3593
3594 'Choose Date field saving
3595 If StoreDate = 0 Then
3596 ReleaseDate = ReleaseDateRead
3597 OriginalDate = OriginalDateRead
3598 WriteLog "Use StoreDate=Default"
3599 ElseIf StoreDate = 1 Then
3600 ReleaseDate = ReleaseDateRead
3601 OriginalDate = ReleaseDateRead
3602 WriteLog "Use release date for both date fields"
3603 ElseIf StoreDate = 2 Then
3604 ReleaseDate = OriginalDateRead
3605 OriginalDate = OriginalDateRead
3606 WriteLog "Use original date for both date fields"
3607 End If
3608
3609 WriteLog "ReleaseDate=" & ReleaseDate
3610 WriteLog "OriginalDate=" & OriginalDate
3611
3612 ' Get genres
3613 If GenresSelect.Count > 0 Then
3614 tmp2 = true
3615 Else
3616 tmp2 = false
3617 End If
3618 For Each g In CurrentRelease("genres")
3619 REM AddToField Genres, CurrentRelease("genres")(g)
3620 tmp = false
3621 If GenresList.Count > 0 Then
3622 For x = 0 to GenresList.Count -1
3623 If LCase(GenresList.Item(x)) = LCase(CurrentRelease("genres")(g)) Then tmp = true
3624 Next
3625 End If
3626 If tmp = false Then
3627 GenresList.Add CurrentRelease("genres")(g)
3628 If tmp2 = false Then
3629 GenresSelect.Add True
3630 End If
3631 End If
3632 Next
3633
3634 ' Get styles/moods/themes
3635 If CurrentRelease.Exists("styles") Then
3636 For Each s In CurrentRelease("styles")
3637 REM AddToField Styles, CurrentRelease("styles")(s)
3638 tmp = false
3639 If GenresList.Count > 0 Then
3640 For x = 0 to GenresList.Count -1
3641 If LCase(GenresList.Item(x)) = LCase(CurrentRelease("styles")(s)) Then tmp = true
3642 Next
3643 End If
3644 If tmp = false Then
3645 GenresList.Add CurrentRelease("styles")(s)
3646 If tmp2 = false Then
3647 GenresSelect.Add True
3648 End If
3649 End If
3650 Next
3651 End If
3652
3653
3654 ' Get Label
3655 If CurrentRelease.Exists("labels") Then
3656 For Each l in CurrentRelease("labels")
3657 Set currentLabel = CurrentRelease("labels")(l)
3658 If SavedLabelID = "" Then
3659 If currentLabel.Exists("id") Then
3660 SavedLabelID = currentLabel("id")
3661 End If
3662 End If
3663 If CheckDeleteDuplicatedEntry = True Then
3664 AddToFieldWD theLabels, CleanArtistName(currentLabel("name"))
3665 AddToFieldWD theCatalogs, currentLabel("catno")
3666 Else
3667 AddToField theLabels, CleanArtistName(currentLabel("name"))
3668 AddToField theCatalogs, currentLabel("catno")
3669 End If
3670 Next
3671 Else
3672 theLabels = ""
3673 theCatalogs = ""
3674 End If
3675 WriteLog "theLabels=" & theLabels
3676 WriteLog "theCatalogs=" & theCatalogs
3677
3678 ' Get Country
3679 If CurrentRelease.Exists("country") Then
3680 theCountry = CurrentRelease("country")
3681 Else
3682 theCountry = ""
3683 End If
3684 WriteLog "country=" & theCountry
3685
3686 ' Get Format
3687 If CurrentRelease.Exists("formats") Then
3688 For Each f in CurrentRelease("formats")
3689 Set currentFormat = CurrentRelease("formats")(f)
3690 If currentFormat("qty") > 1 And CheckShowQtyFormat = True Then
3691 AddToField theFormat, currentFormat("qty") & " x " & currentFormat("name")
3692 Else
3693 AddToField theFormat, currentFormat("name")
3694 End If
3695 If currentFormat.Exists("descriptions") Then
3696 For Each d in currentFormat("descriptions")
3697 theFormat = theFormat & FormatSeparator & currentFormat("descriptions")(d)
3698 Next
3699 End If
3700 Next
3701 Else
3702 theFormat = ""
3703 End If
3704 WriteLog "theformat=" & theFormat
3705
3706 ' Get Comment
3707 If CurrentRelease.Exists("notes") Then
3708 Comment = CurrentRelease("notes")
3709 Else
3710 Comment = ""
3711 End If
3712 WriteLog "Comment=" & Comment
3713
3714 ' Get data_quality
3715 If CurrentRelease.Exists("data_quality") Then
3716 DataQuality = CurrentRelease("data_quality")
3717 Else
3718 DataQuality = ""
3719 End If
3720 WriteLog "DataQuality=" & DataQuality
3721 End If
3722
3723'-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
3724 If QueryPage = "MusicBrainz" Then
3725
3726 For Each m In CurrentRelease("media")
3727 Set currentMedia = CurrentRelease("media")(m)
3728 For Each track In CurrentMedia("tracks")
3729 Set currentTrack = CurrentMedia("tracks")(track)
3730 position = currentTrack("number")
3731 DiscogsTracksNum.Add position
3732 position = exchange_roman_numbers(position)
3733 ReDim Preserve Title_Position(UBound(Title_Position)+1)
3734 Title_Position(UBound(Title_Position)) = position
3735 ReDim Preserve Grouping(UBound(Grouping)+1)
3736 Grouping(UBound(Grouping)) = ""
3737 Next
3738 Next
3739
3740
3741 'Check for leading zero in track-position
3742 'LeadingZeroTrackPosition = CheckLeadingZeroTrackPosition(Title_Position(1))
3743
3744
3745 ' Get release artist
3746 tmp = getArtistsName(CurrentRelease, "artist-credit", QueryPage)
3747 If tmp(1) <> "" Then
3748 AlbumArtistTitle = tmp(0) & " " & tmp(1)
3749 Else
3750 AlbumArtistTitle = tmp(0)
3751 End If
3752 AlbumArtist = tmp(2)
3753
3754 Writelog "AlbumArtistTitle=" & AlbumArtistTitle
3755
3756 If (Not CheckAlbumArtistFirst) Then
3757 AlbumArtist = AlbumArtistTitle
3758 End If
3759
3760 If AlbumArtist = "Various Artists" And CheckVarious Then
3761 AlbumArtist = TxtVarious
3762 End If
3763 If AlbumArtistTitle = "Various Artists" And CheckVarious Then
3764 AlbumArtistTitle = TxtVarious
3765 End If
3766
3767
3768 WriteLog " "
3769 WriteLog "ExtraArtists for Release"
3770 If currentRelease.Exists("relations") Then
3771 If currentRelease("relations").Count > 0 Then
3772 For Each extraArtist In CurrentRelease("relations")
3773 WriteLog " "
3774 Set currentArtist = CurrentRelease("relations")(extraArtist)
3775 artistName = CleanArtistName(currentArtist("artist")("name"))
3776 WriteLog "ArtistName=" & artistName
3777 ret = RelationshipTypes(currentArtist)
3778 If ret(0) > 0 Then
3779 For i = 1 to ret(0)
3780 currentRole = ret(i)
3781 Do
3782 tmp = searchKeyword(LyricistKeywords, currentRole, AlbumLyricist, artistName)
3783 If tmp <> "" And tmp <> "ALREADY_INSIDE_ROLE" Then
3784 AlbumLyricist = tmp
3785 WriteLog "AlbumLyricist=" & AlbumLyricist
3786 Exit Do
3787 ElseIf tmp = "ALREADY_INSIDE_ROLE" Then
3788 WriteLog "ALREADY_INSIDE_ROLE"
3789 Exit Do
3790 End If
3791 tmp = searchKeyword(ConductorKeywords, currentRole, AlbumConductor, artistName)
3792 If tmp <> "" And tmp <> "ALREADY_INSIDE_ROLE" Then
3793 AlbumConductor = tmp
3794 WriteLog "AlbumConductor=" & AlbumConductor
3795 Exit Do
3796 ElseIf tmp = "ALREADY_INSIDE_ROLE" Then
3797 WriteLog "ALREADY_INSIDE_ROLE"
3798 Exit Do
3799 End If
3800 tmp = searchKeyword(ProducerKeywords, currentRole, AlbumProducer, artistName)
3801 If tmp <> "" And tmp <> "ALREADY_INSIDE_ROLE" Then
3802 AlbumProducer = tmp
3803 WriteLog "AlbumProducer=" & AlbumProducer
3804 Exit Do
3805 ElseIf tmp = "ALREADY_INSIDE_ROLE" Then
3806 WriteLog "ALREADY_INSIDE_ROLE"
3807 Exit Do
3808 End If
3809 tmp = searchKeyword(ComposerKeywords, currentRole, AlbumComposer, artistName)
3810 If tmp <> "" And tmp <> "ALREADY_INSIDE_ROLE" Then
3811 AlbumComposer = tmp
3812 WriteLog "AlbumComposer=" & AlbumComposer
3813 Exit Do
3814 ElseIf tmp = "ALREADY_INSIDE_ROLE" Then
3815 WriteLog "ALREADY_INSIDE_ROLE"
3816 Exit Do
3817 End If
3818 tmp2 = search_involved(Involved_R, currentRole)
3819 If tmp2 = -2 Then
3820 WriteLog "Ignore Role: '" & currentRole & "' (Unwanted tag)"
3821 ElseIf tmp2 = -1 Then
3822 ReDim Preserve Involved_R(UBound(Involved_R)+1)
3823 Involved_R(UBound(Involved_R)) = currentRole & ": " & artistName
3824 WriteLog "New Role: " & currentRole & ": " & artistName
3825 Else
3826 If InStr(Involved_R(tmp2), artistName) = 0 Then
3827 Involved_R(tmp2) = Involved_R(tmp2) & ArtistSeparator & artistName
3828 WriteLog "Role updated: " & Involved_R(tmp2)
3829 Else
3830 WriteLog "artist already inside role"
3831 End If
3832 End If
3833 Exit Do
3834 Loop While True
3835 Next
3836 End If
3837 Next
3838 End If
3839 End If
3840 ' Get track titles and track artists
3841
3842 WriteLog "End"
3843 iAutoTrackNumber = 1
3844 iAutoDiscNumber = 1
3845 iTrackNum = 0
3846
3847 For Each m In CurrentRelease("media")
3848 Set currentMedia = CurrentRelease("media")(m)
3849 If CheckNoDisc = False Then
3850 iAutoTrackNumber = 1
3851 End If
3852 For Each t In CurrentMedia("tracks")
3853 Set currentTrack = currentMedia("tracks")(t)
3854 position = currentTrack("number")
3855 trackName = PackSpaces(DecodeHtmlChars(currentTrack("title")), False)
3856 length = currentTrack("length")
3857 If length <> "" And IsNumeric(length) Then
3858 min = Int(length / 60000)
3859 tmp = (length / 60000) - Int(length / 60000)
3860 If tmp <> 0 Then
3861 sec = Round(tmp * 60, 0)
3862 End If
3863 If sec < 10 Then
3864 length = CStr(min & ":" & "0" & sec)
3865 Else
3866 length = CStr(min & ":" & sec)
3867 End If
3868 Durations.Add length
3869 Else
3870 Durations.Add ""
3871 End If
3872
3873 WriteLog " "
3874 WriteLog " "
3875 WriteLog "Position=" & position
3876 WriteLog "TrackName=" & trackname
3877 WriteLog "Duration=" & length
3878
3879 ' Here comes the new track/disc numbering methods
3880 If position <> "" Then
3881 If CurrentRelease("media").Count > 1 Then ' More than 1 CD
3882 If CheckNoDisc = True Then
3883 TracksCD.Add ""
3884 Else
3885 TracksCD.Add LeadingZeroDisc(CurrentMedia("position"))
3886 End If
3887 Else
3888 If CheckForceDisc = True Then
3889 TracksCD.Add LeadingZeroDisc("1")
3890 Else
3891 TracksCD.Add ""
3892 End If
3893 End If
3894 If UnselectedTracks(iTrackNum) <> "x" Then
3895 If CheckLeadingZero = True And iAutoTrackNumber < 10 Then
3896 tracksNum.Add "0" & iAutoTrackNumber
3897 WriteLog "Tracknumber=" & iAutoTrackNumber
3898 Else
3899 tracksNum.Add iAutoTrackNumber
3900 WriteLog "Tracknumber=" & iAutoTrackNumber
3901 End If
3902 iAutoTrackNumber = iAutoTrackNumber + 1
3903 Else
3904 tracksNum.Add ""
3905 End If
3906
3907 ElseIf currentTrack("length") = "" And currentTrack("title") = "-" Then
3908 tracksNum.Add ""
3909 tracksCD.Add ""
3910 UnselectedTracks(iTrackNum) = "x"
3911 UnselectedTrackNames(iTrackNum) = "x"
3912 Else ' Nothing specified
3913 If CheckForceNumeric And UnselectedTracks(iTrackNum) <> "x" Then
3914 If CheckLeadingZero = True And iAutoTrackNumber < 10 Then
3915 tracksNum.Add "0" & iAutoTrackNumber
3916 WriteLog "Tracknumber=" & iAutoTrackNumber
3917 Else
3918 tracksNum.Add iAutoTrackNumber
3919 WriteLog "Tracknumber=" & iAutoTrackNumber
3920 End If
3921 iAutoTrackNumber = iAutoTrackNumber + 1
3922 Else
3923 tracksNum.Add ""
3924 End If
3925 If CheckForceDisc Then
3926 tracksCD.Add LeadingZeroDisc(iAutoDiscNumber)
3927 Else
3928 tracksCD.Add ""
3929 End If
3930 End If
3931
3932 ReDim Involved_R_T(0)
3933
3934 TrackInvolvedPeople = ""
3935 TrackComposers = ""
3936 TrackConductors = ""
3937 TrackProducers = ""
3938 TrackLyricists = ""
3939 TrackFeaturing = AlbumFeaturing
3940
3941 If UBound(Involved_R) > 0 Then
3942 For tmp = 1 To UBound(Involved_R)
3943 ReDim Preserve Involved_R_T(tmp)
3944 Involved_R_T(tmp) = Involved_R(tmp)
3945 Next
3946 End If
3947
3948 For tmp = 1 To UBound(TrackPos)
3949 If TrackPos(tmp) = position Then
3950 WriteLog "trackpos(" & tmp & ")=" & trackpos(tmp)
3951 involvedRole = TrackRoles(tmp)
3952 involvedArtist = TrackArtist2(tmp)
3953
3954 If LookForFeaturing(involvedRole) And CheckIgnoreFeatArtist = False Then
3955 If InStr(TrackFeaturing, involvedArtist) = 0 Then
3956 If TrackFeaturing = "" Then
3957 If CheckFeaturingName Then
3958 TrackFeaturing = TxtFeaturingName & " " & involvedArtist
3959 Else
3960 TrackFeaturing = involvedRole & " " & involvedArtist
3961 End If
3962 Else
3963 TrackFeaturing = TrackFeaturing & ArtistSeparator & involvedArtist
3964 End If
3965 End If
3966 WriteLog "TrackFeaturing=" & TrackFeaturing
3967 Else
3968 Do
3969 ret = searchKeyword(LyricistKeywords, involvedRole, TrackLyricists, involvedArtist)
3970 If ret <> "" And ret <> "ALREADY_INSIDE_ROLE" Then
3971 TrackLyricists = ret
3972 WriteLog "TrackLyricists=" & TrackLyricists
3973 Exit Do
3974 ElseIf ret = "ALREADY_INSIDE_ROLE" Then
3975 WriteLog "ALREADY_INSIDE_ROLE"
3976 Exit Do
3977 End If
3978 ret = searchKeyword(ConductorKeywords, involvedRole, TrackConductors, involvedArtist)
3979 If ret <> "" And ret <> "ALREADY_INSIDE_ROLE" Then
3980 TrackConductors = ret
3981 WriteLog "TrackConductors=" & TrackConductors
3982 Exit Do
3983 ElseIf ret = "ALREADY_INSIDE_ROLE" Then
3984 WriteLog "ALREADY_INSIDE_ROLE"
3985 Exit Do
3986 End If
3987 ret = searchKeyword(ProducerKeywords, involvedRole, TrackProducers, involvedArtist)
3988 If ret <> "" And ret <> "ALREADY_INSIDE_ROLE" Then
3989 TrackProducers = ret
3990 WriteLog "TrackProducers=" & TrackProducers
3991 Exit Do
3992 ElseIf ret = "ALREADY_INSIDE_ROLE" Then
3993 WriteLog "ALREADY_INSIDE_ROLE"
3994 Exit Do
3995 End If
3996 ret = searchKeyword(ComposerKeywords, involvedRole, TrackComposers, involvedArtist)
3997 If ret <> "" And ret <> "ALREADY_INSIDE_ROLE" Then
3998 TrackComposers = ret
3999 WriteLog "TrackComposers=" & TrackComposers
4000 Exit Do
4001 ElseIf ret = "ALREADY_INSIDE_ROLE" Then
4002 WriteLog "ALREADY_INSIDE_ROLE"
4003 Exit Do
4004 End If
4005 tmp2 = search_involved(Involved_R_T, involvedRole)
4006 If tmp2 = -2 Then
4007 WriteLog "Ignore Role: '" & currentRole & "' (Unwanted tag)"
4008 ElseIf tmp2 = -1 Then
4009 ReDim Preserve Involved_R_T(UBound(Involved_R_T)+1)
4010 Involved_R_T(UBound(Involved_R_T)) = involvedRole & ": " & TrackArtist2(tmp)
4011 WriteLog "New Role: " & involvedRole & ": " & TrackArtist2(tmp)
4012 Else
4013 If InStr(Involved_R_T(tmp2), TrackArtist2(tmp)) = 0 Then
4014 Involved_R_T(tmp2) = Involved_R_T(tmp2) & ArtistSeparator & TrackArtist2(tmp)
4015 WriteLog "Role updated: " & Involved_R_T(tmp2)
4016 Else
4017 WriteLog "artist already inside role"
4018 End If
4019 End If
4020 Exit Do
4021 Loop While True
4022 End If
4023 End If
4024 Next
4025
4026 artistList = ""
4027
4028 WriteLog " "
4029 WriteLog "Search for TrackArtist <> Release Artist"
4030
4031 If currentTrack.Exists("artist-credit") Then
4032 tmp = getArtistsName(CurrentTrack, "artist-credit", QueryPage)
4033 artistList = tmp(0)
4034 TrackFeaturing = Trim(tmp(1))
4035 End If
4036 If artistList = "" Then artistList = AlbumArtistTitle
4037
4038 WriteLog "artistlist=" & artistlist
4039
4040 Set tmp = currentTrack("recording")
4041 If tmp.Exists("relations") Then
4042 If tmp("relations").Count > 0 Then
4043 For Each tmp2 in tmp("relations")
4044 WriteLog " "
4045 involvedArtist = ""
4046 Set tmp3 = tmp("relations")(tmp2)
4047 If tmp3.Exists("work") And tmp3("type") <> "other version" Then
4048 Set tmp3 = tmp("relations")(tmp2)("work")
4049 For Each tmp4 In tmp3("relations")
4050 If tmp3("relations")(tmp4).Exists("artist") Then
4051 involvedArtist = CleanArtistName(tmp3("relations")(tmp4)("artist")("name"))
4052 Else
4053 involvedArtist = ""
4054 End If
4055 involvedRole = ""
4056 Set tmp5 = tmp3("relations")(tmp4)
4057 If tmp5.Exists("attributes") Then
4058 ret = RelationshipTypes(tmp5)
4059 If ret(0) > 0 Then
4060 For i = 1 to ret(0)
4061 If involvedArtist <> "" Then getinvolvedRole involvedArtist, ret(i), artistList, TrackFeaturing, Involved_R_T, TrackComposers, TrackConductors, TrackProducers, TrackLyricists
4062 Next
4063 End If
4064 End If
4065 Next
4066 Else
4067 If tmp3.Exists("artist") Then
4068 involvedArtist = CleanArtistName(tmp3("artist")("name"))
4069 Else
4070 involvedArtist = ""
4071 End If
4072 ret = RelationshipTypes(tmp3)
4073 If ret(0) > 0 Then
4074 For i = 1 to ret(0)
4075 If involvedArtist <> "" Then getinvolvedRole involvedArtist, ret(i), artistList, TrackFeaturing, Involved_R_T, TrackComposers, TrackConductors, TrackProducers, TrackLyricists
4076 Next
4077 End If
4078 End If
4079 Next
4080 End If
4081 End If
4082 WriteLog "TrackArtist end"
4083
4084 If TrackFeaturing <> "" And CheckIgnoreFeatArtist = False Then
4085 If CheckTitleFeaturing = True Then
4086 tmp = InStrRev(TrackFeaturing, ArtistSeparator)
4087 If tmp = 0 Or ArtistLastSeparator = False Then
4088 trackName = trackName & " (" & TrackFeaturing & ")"
4089 Else
4090 trackName = trackName & " (" & Left(TrackFeaturing, tmp-1) & " & " & Mid(TrackFeaturing, tmp+Len(ArtistSeparator)) & ")"
4091 End If
4092 Else
4093 tmp = InStrRev(TrackFeaturing, ArtistSeparator)
4094 If tmp = 0 Or ArtistLastSeparator = False Then
4095 If Left(TrackFeaturing, 1) = "," Or Left(TrackFeaturing, 1) = ";" Then
4096 artistList = artistList & TrackFeaturing
4097 Else
4098 artistList = artistList & " " & TrackFeaturing
4099 End If
4100 Else
4101 artistList = artistList & " " & Left(TrackFeaturing, tmp-1) & " & " & Mid(TrackFeaturing, tmp+Len(ArtistSeparator))
4102 End If
4103 End If
4104 End If
4105
4106 ArtistTitles.Add artistList
4107
4108 TrackLyricists = FindArtist(TrackLyricists, AlbumLyricist)
4109 If AlbumLyricist <> "" and TrackLyricists <> "" Then
4110 Lyricists.Add AlbumLyricist & Separator & TrackLyricists
4111 Else
4112 Lyricists.Add AlbumLyricist & TrackLyricists
4113 End If
4114 TrackComposers = FindArtist(TrackComposers, AlbumComposer)
4115 If AlbumComposer <> "" and TrackComposers <> "" Then
4116 Composers.Add AlbumComposer & Separator & TrackComposers
4117 Else
4118 Composers.Add AlbumComposer & TrackComposers
4119 End If
4120 TrackConductors = FindArtist(TrackConductors, AlbumConductor)
4121 If AlbumConductor <> "" and TrackConductors <> "" Then
4122 Conductors.Add AlbumConductor & Separator & TrackConductors
4123 Else
4124 Conductors.Add AlbumConductor & TrackConductors
4125 End If
4126 TrackProducers = FindArtist(TrackProducers, AlbumProducer)
4127 If AlbumProducer <> "" and TrackProducers <> "" Then
4128 Producers.Add AlbumProducer & Separator & TrackProducers
4129 Else
4130 Producers.Add AlbumProducer & TrackProducers
4131 End If
4132
4133 If UBound(Involved_R_T) > 0 Then
4134 For tmp = 1 To UBound(involved_R_T)
4135 TrackInvolvedPeople = TrackInvolvedPeople & Involved_R_T(tmp) & Separator
4136 Next
4137 TrackInvolvedPeople = Left(TrackInvolvedPeople, Len(TrackInvolvedPeople)- Len(Separator))
4138 Else
4139 TrackInvolvedPeople = ""
4140 End If
4141
4142 InvolvedArtists.Add TrackInvolvedPeople
4143 Tracks.Add trackName
4144 iTrackNum = iTrackNum + 1
4145 Next
4146 Next
4147
4148
4149 ' Get album title
4150 AlbumTitle = PackSpaces(currentRelease("title"), False)
4151 Dim json
4152 Set json = New VbsJson
4153 ' Get Album art URL
4154 WriteLog " "
4155 WriteLog "Search for cover"
4156 If CurrentRelease.Exists("cover-art-archive") Then
4157 WriteLog CurrentRelease("cover-art-archive")("count") & " Images on CoverArtArchive found"
4158 If CurrentRelease("cover-art-archive")("count") > 0 And CurrentRelease("cover-art-archive")("front") = True Then
4159 searchURL = "http://coverartarchive.org/release/" & CurrentReleaseId
4160 WriteLog searchURL
4161 Set oXMLHTTP = CreateObject("MSXML2.ServerXMLHTTP.6.0")
4162 oXMLHTTP.Open "GET", searchURL, False
4163 oXMLHTTP.setRequestHeader "Content-Type", "application/json"
4164 oXMLHTTP.setRequestHeader "User-Agent",UserAgent
4165 oXMLHTTP.send ()
4166
4167 If oXMLHTTP.Status = 200 Then
4168 Set currentImage = json.Decode(oXMLHTTP.responseText)
4169 For Each image In currentImage("images")
4170 Set tmp = currentImage("images")(image)
4171 If tmp("front") = True Then
4172 AlbumArtURL = tmp("image")
4173 AlbumArtThumbNail = tmp("thumbnails")("small")
4174 Exit For
4175 End If
4176 Next
4177 End If
4178 End If
4179 End If
4180
4181 '----------------------------------CoverArtArchive Images----------------------------------------
4182 Set ImageList = SDB.NewStringList
4183 Set SaveImageType = SDB.NewStringList
4184 Set SaveImage = SDB.NewStringList
4185 ImagesCount = 0
4186
4187 If CurrentRelease.Exists("cover-art-archive") And CurrentRelease("cover-art-archive")("count") <> "" Then
4188 If CurrentRelease("cover-art-archive")("count") > 1 Then
4189 searchURL = "http://coverartarchive.org/release/" & CurrentRelease("id")
4190 WriteLog searchURL
4191 ImagesCount = CurrentRelease("cover-art-archive")("count")
4192 Set oXMLHTTP = CreateObject("MSXML2.ServerXMLHTTP.6.0")
4193 oXMLHTTP.Open "GET", searchURL, False
4194 oXMLHTTP.setRequestHeader "Content-Type", "application/json"
4195 oXMLHTTP.setRequestHeader "User-Agent",UserAgent
4196 oXMLHTTP.send ()
4197
4198 If oXMLHTTP.Status = 200 Then
4199 Set currentImage = json.Decode(oXMLHTTP.responseText)
4200 For Each image In currentImage("images")
4201 Set tmp = currentImage("images")(image)
4202 If tmp("image") <> AlbumArtURL Then
4203 ImageList.add tmp("thumbnails")("small")
4204 SaveImageType.add "other"
4205 SaveImage.add "0"
4206 End If
4207 Next
4208 End If
4209 End If
4210 End If
4211 '----------------------------------CoverArtArchive Images----------------------------------------
4212
4213 ' Get release year/date
4214 If CurrentRelease.Exists("date") And CurrentRelease("date") <> "" Then
4215 ReleaseDate = CurrentRelease("date")
4216 If Len(ReleaseDate) = 10 Then
4217 ReleaseSplit = Split(ReleaseDate,"-")
4218 ReleaseDate = ReleaseSplit(2) & "-" & ReleaseSplit(1) & "-" & ReleaseSplit(0)
4219 ElseIf Len(ReleaseDate) = 7 Then
4220 ReleaseSplit = Split(ReleaseDate,"-")
4221 ReleaseDate = "00-" & ReleaseSplit(1) & "-" & ReleaseSplit(0)
4222 End If
4223 If CheckYearOnlyDate Then
4224 ReleaseDate = Right(ReleaseDate, 4)
4225 End If
4226 Else
4227 ReleaseDate = ""
4228 End If
4229 WriteLog "ReleaseDate=" & ReleaseDate
4230
4231 'Set OriginalDate
4232 set tmp = CurrentRelease("release-group")
4233 If tmp.Exists("first-release-date") And CurrentRelease("release-group")("first-release-date") <> "" Then
4234 OriginalDate = CurrentRelease("release-group")("first-release-date")
4235 If Len(OriginalDate) = 10 Then
4236 ReleaseSplit = Split(OriginalDate,"-")
4237 OriginalDate = ReleaseSplit(2) & "-" & ReleaseSplit(1) & "-" & ReleaseSplit(0)
4238 ElseIf Len(OriginalDate) = 7 Then
4239 ReleaseSplit = Split(OriginalDate,"-")
4240 OriginalDate = "00-" & ReleaseSplit(1) & "-" & ReleaseSplit(0)
4241 End If
4242 If CheckYearOnlyDate Then
4243 OriginalDate = Right(OriginalDate, 4)
4244 End If
4245 Else
4246 OriginalDate = ""
4247 End If
4248 WriteLog "OriginalDate=" & OriginalDate
4249
4250 ' Get Label
4251 If CurrentRelease.Exists("label-info") Then
4252 For Each l In CurrentRelease("label-info")
4253 Set currentLabel = CurrentRelease("label-info")(l)
4254 If SavedLabelID = "" And Not IsNull(currentLabel("label")) Then
4255 set tmp = currentLabel("label")
4256 If tmp.Exists("id") Then
4257 SavedLabelID = tmp("id")
4258 End If
4259 If Not IsNull(currentLabel("label")("name")) Then
4260 AddToField theLabels, CleanArtistName(currentLabel("label")("name"))
4261 End If
4262 End If
4263 If IsNull(currentLabel("catalog-number")) Then
4264 theCatalogs = ""
4265 Else
4266 AddToField theCatalogs, currentLabel("catalog-number")
4267 End If
4268 Next
4269 Else
4270 theLabels = ""
4271 theCatalogs = ""
4272 End If
4273 WriteLog "theLabels=" & theLabels
4274 WriteLog "theCatalogs=" & theCatalogs
4275
4276 ' Get Country
4277 If CurrentRelease.Exists("country") And CurrentRelease("country") <> "" Then
4278 theCountry = CurrentRelease("country")
4279 For f = 1 To CountryCode.Count
4280 If theCountry = CountryCode.Item(f) Then
4281 theCountry = CountryList.Item(f)
4282 Exit For
4283 End If
4284 Next
4285 Else
4286 theCountry = ""
4287 End If
4288 WriteLog "country=" & theCountry
4289
4290 ' Get Format
4291 If CurrentRelease.Exists("media") Then
4292 For Each f In CurrentRelease("media")
4293 Set currentFormat = CurrentRelease("media")(f)
4294 If currentFormat("format") <> "" And theFormat <> currentFormat("format") Then
4295 AddToField theFormat, currentFormat("format")
4296 End If
4297 Next
4298 WriteLog "theformat=" & theformat
4299 End If
4300 tmp = ""
4301 If CurrentRelease.Exists("release-group") Then
4302 tmp = CurrentRelease("release-group")("primary-type")
4303 If theFormat <> "" Then
4304 theFormat = theFormat & FormatSeparator & tmp
4305 Else
4306 theFormat = tmp
4307 End If
4308 Set tmp = CurrentRelease("release-group")
4309 If tmp.Exists("secondary-types") Then
4310 For Each f In tmp("secondary-types")
4311 If CurrentRelease("release-group")("secondary-types")(f) <> "" Then
4312 theFormat = theFormat & FormatSeparator & CurrentRelease("release-group")("secondary-types")(f)
4313 End If
4314 Next
4315 End If
4316 End If
4317 WriteLog "theformat=" & theFormat
4318 End If
4319 End If
4320
4321 FormatSearchResultsViewer Tracks, TracksNum, TracksCD, Durations, AlbumArtist, AlbumArtistTitle, ArtistTitles, AlbumTitle, ReleaseDate, OriginalDate, GenresList, theLabels, theCountry, AlbumArtThumbNail, CurrentReleaseId, theCatalogs, Lyricists, Composers, Conductors, Producers, InvolvedArtists, theFormat, theMaster, comment, DiscogsTracksNum, DataQuality, Grouping
4322
4323 Dim SelectedTracks, j, k, SelTracksCount, StartCount
4324 Set SelectedTracks = SDB.NewStringList
4325 Set SelectedSongsGlobal = SDB.NewSongList
4326 'Tracks = Stringliste mit den Songnamen
4327 WriteLog "-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+"
4328
4329
4330 WriteLog "DiffNumberTracks=" & DiffNumberTracks
4331
4332
4333 If CheckNewMatchingEngine = False Then
4334 For i = 0 To Tracks.Count - 1
4335 If UnselectedTracks(i) = "" Then
4336 If UnselectedTrackNames(i) = "" Then
4337 SelectedTracks.Add Tracks.Item(i)
4338 Else
4339 If SDB.Tools.WebSearch.NewTracks.Count - 1 < i Then
4340 SelectedTracks.Add Tracks.Item(i)
4341 Else
4342 SelectedTracks.Add SDB.Tools.WebSearch.NewTracks.Item(i).Title
4343 End If
4344 End If
4345 End If
4346 Next
4347 For i = 0 To SDB.Tools.WebSearch.NewTracks.Count -1
4348 SelectedSongsGlobal.Add SDB.Tools.WebSearch.NewTracks.Item(i)
4349 Next
4350
4351 SDB.Tools.WebSearch.SmartUpdateTracks SelectedTracks
4352
4353 For i = 0 To SDB.Tools.WebSearch.NewTracks.Count - 1
4354 If CheckArtist Then SDB.Tools.WebSearch.NewTracks.Item(i).ArtistName = AlbumArtistTitle
4355 For j = 0 To Tracks.Count - 1
4356 If Tracks.Item(j) = SDB.Tools.WebSearch.NewTracks.Item(i).Title Then
4357 If UnselectedTracks(j) = "" Then
4358 If UnselectedTrackNames(j) = "" Then
4359 SDB.Tools.WebSearch.NewTracks.Item(i).Title = Tracks.Item(j)
4360 Else
4361 SDB.Tools.WebSearch.NewTracks.Item(i).Title = SDB.Tools.WebSearch.NewTracks.Item(i).Title
4362 End If
4363 If CheckArtist And ((CheckDontFillEmptyFields = True And ArtistTitles.Item(j) <> "") Or CheckDontFillEmptyFields = False) Then SDB.Tools.WebSearch.NewTracks.Item(i).ArtistName = ArtistTitles.Item(j)
4364 If CheckTrackNum And ((CheckDontFillEmptyFields = True And TracksNum.Item(j) <> "") Or CheckDontFillEmptyFields = False) Then SDB.Tools.WebSearch.NewTracks.Item(i).TrackOrderStr = TracksNum.Item(j)
4365 If CheckDiscNum And ((CheckDontFillEmptyFields = True And TracksCD.Item(j) <> "") Or CheckDontFillEmptyFields = False) Then SDB.Tools.WebSearch.NewTracks.Item(i).DiscNumberStr = TracksCD.Item(j)
4366 If CheckInvolved And ((CheckDontFillEmptyFields = True And InvolvedArtists.Item(j) <> "") Or CheckDontFillEmptyFields = False) Then SDB.Tools.WebSearch.NewTracks.Item(i).InvolvedPeople = InvolvedArtists.Item(j)
4367 If CheckGrouping And ((CheckDontFillEmptyFields = True And Grouping(j) <> "") Or CheckDontFillEmptyFields = False) Then SDB.Tools.WebSearch.NewTracks.Item(i).Grouping = Grouping(j)
4368 If CheckLyricist And ((CheckDontFillEmptyFields = True And Lyricists.Item(j) <> "") Or CheckDontFillEmptyFields = False) Then SDB.Tools.WebSearch.NewTracks.Item(i).Lyricist = Lyricists.Item(j)
4369 If CheckComposer And ((CheckDontFillEmptyFields = True And Composers.Item(j) <> "") Or CheckDontFillEmptyFields = False) Then SDB.Tools.WebSearch.NewTracks.Item(i).Author = Composers.Item(j)
4370 If CheckConductor And ((CheckDontFillEmptyFields = True And Conductors.Item(j) <> "") Or CheckDontFillEmptyFields = False) Then SDB.Tools.WebSearch.NewTracks.Item(i).Conductor = Conductors.Item(j)
4371 If CheckProducer And ((CheckDontFillEmptyFields = True And Producers.Item(j) <> "") Or CheckDontFillEmptyFields = False) Then SDB.Tools.WebSearch.NewTracks.Item(i).Producer = Producers.Item(j)
4372
4373 End If
4374 End If
4375 Next
4376 If CheckAlbumArtist And ((CheckDontFillEmptyFields = True And AlbumArtist <> "") Or CheckDontFillEmptyFields = False) Then SDB.Tools.WebSearch.NewTracks.Item(i).AlbumArtistName = AlbumArtist
4377 If CheckAlbum And ((CheckDontFillEmptyFields = True And AlbumTitle <> "") Or CheckDontFillEmptyFields = False) Then SDB.Tools.WebSearch.NewTracks.Item(i).AlbumName = AlbumTitle
4378
4379 If CheckDate Then
4380 If Len(ReleaseDate) > 4 Then
4381 SDB.Tools.WebSearch.NewTracks.Item(i).Year = Mid(ReleaseDate,7,4)
4382 SDB.Tools.WebSearch.NewTracks.Item(i).Month = Mid(ReleaseDate,4,2)
4383 SDB.Tools.WebSearch.NewTracks.Item(i).Day = Mid(ReleaseDate,1,2)
4384 ElseIf IsNumeric(ReleaseDate) Then
4385 SDB.Tools.WebSearch.NewTracks.Item(i).Year = ReleaseDate
4386 ElseIf ReleaseDate = "" Then
4387 If CheckDontFillEmptyFields = False Then
4388 SDB.Tools.WebSearch.NewTracks.Item(i).Year = -1
4389 End If
4390 End If
4391 End If
4392 If CheckOrigDate Then
4393 If Len(OriginalDate) > 4 Then
4394 SDB.Tools.WebSearch.NewTracks.Item(i).OriginalYear = Mid(OriginalDate,7,4)
4395 SDB.Tools.WebSearch.NewTracks.Item(i).OriginalMonth = Mid(OriginalDate,4,2)
4396 SDB.Tools.WebSearch.NewTracks.Item(i).OriginalDay = Mid(OriginalDate,1,2)
4397 ElseIf IsNumeric(OriginalDate) Then
4398 SDB.Tools.WebSearch.NewTracks.Item(i).OriginalYear = OriginalDate
4399 ElseIf OriginalDate = "" Then
4400 If CheckDontFillEmptyFields = False Then
4401 SDB.Tools.WebSearch.NewTracks.Item(i).OriginalYear = -1
4402 End If
4403 End If
4404 End If
4405
4406 If CheckStyleField = "Default (stored with Genre)" Then
4407 If CheckGenre Then
4408 If Not(NewGenre = "" And CheckDontFillEmptyFields = True) Then
4409 SDB.Tools.WebSearch.NewTracks.Item(i).Genre = NewGenre
4410 End If
4411 End If
4412 End If
4413 If CheckLabel And ((CheckDontFillEmptyFields = True And theLabels <> "") Or CheckDontFillEmptyFields = False) Then SDB.Tools.WebSearch.NewTracks.Item(i).Publisher = theLabels
4414
4415 If CheckComment And ((CheckDontFillEmptyFields = True And comment <> "") Or CheckDontFillEmptyFields = False) Then SDB.Tools.WebSearch.NewTracks.Item(i).Comment = comment
4416
4417 If CheckRelease And ((CheckDontFillEmptyFields = True And CurrentReleaseId <> "") Or CheckDontFillEmptyFields = False) Then
4418 If ReleaseTag = "Custom1" Then SDB.Tools.WebSearch.NewTracks.Item(i).Custom1 = CurrentReleaseId
4419 If ReleaseTag = "Custom2" Then SDB.Tools.WebSearch.NewTracks.Item(i).Custom2 = CurrentReleaseId
4420 If ReleaseTag = "Custom3" Then SDB.Tools.WebSearch.NewTracks.Item(i).Custom3 = CurrentReleaseId
4421 If ReleaseTag = "Custom4" Then SDB.Tools.WebSearch.NewTracks.Item(i).Custom4 = CurrentReleaseId
4422 If ReleaseTag = "Custom5" Then SDB.Tools.WebSearch.NewTracks.Item(i).Custom5 = CurrentReleaseId
4423 If ReleaseTag = "Grouping" Then SDB.Tools.WebSearch.NewTracks.Item(i).Grouping = CurrentReleaseId
4424 If ReleaseTag = "ISRC" Then SDB.Tools.WebSearch.NewTracks.Item(i).ISRC = CurrentReleaseId
4425 If ReleaseTag = "Encoder" Then SDB.Tools.WebSearch.NewTracks.Item(i).Encoder = CurrentReleaseId
4426 If ReleaseTag = "Copyright" Then SDB.Tools.WebSearch.NewTracks.Item(i).Copyright = CurrentReleaseId
4427 End If
4428
4429 If CheckCatalog And ((CheckDontFillEmptyFields = True And theCatalogs <> "") Or CheckDontFillEmptyFields = False) Then
4430 If CatalogTag = "Custom1" Then SDB.Tools.WebSearch.NewTracks.Item(i).Custom1 = theCatalogs
4431 If CatalogTag = "Custom2" Then SDB.Tools.WebSearch.NewTracks.Item(i).Custom2 = theCatalogs
4432 If CatalogTag = "Custom3" Then SDB.Tools.WebSearch.NewTracks.Item(i).Custom3 = theCatalogs
4433 If CatalogTag = "Custom4" Then SDB.Tools.WebSearch.NewTracks.Item(i).Custom4 = theCatalogs
4434 If CatalogTag = "Custom5" Then SDB.Tools.WebSearch.NewTracks.Item(i).Custom5 = theCatalogs
4435 If CatalogTag = "ISRC" Then SDB.Tools.WebSearch.NewTracks.Item(i).ISRC = theCatalogs
4436 End If
4437
4438 If CheckCountry And ((CheckDontFillEmptyFields = True And theCountry <> "") Or CheckDontFillEmptyFields = False) Then
4439 If CountryTag = "Custom1" Then SDB.Tools.WebSearch.NewTracks.Item(i).Custom1 = theCountry
4440 If CountryTag = "Custom2" Then SDB.Tools.WebSearch.NewTracks.Item(i).Custom2 = theCountry
4441 If CountryTag = "Custom3" Then SDB.Tools.WebSearch.NewTracks.Item(i).Custom3 = theCountry
4442 If CountryTag = "Custom4" Then SDB.Tools.WebSearch.NewTracks.Item(i).Custom4 = theCountry
4443 If CountryTag = "Custom5" Then SDB.Tools.WebSearch.NewTracks.Item(i).Custom5 = theCountry
4444 End If
4445
4446 If CheckFormat And ((CheckDontFillEmptyFields = True And theFormat <> "") Or CheckDontFillEmptyFields = False) Then
4447 If FormatTag = "Custom1" Then SDB.Tools.WebSearch.NewTracks.Item(i).Custom1 = theFormat
4448 If FormatTag = "Custom2" Then SDB.Tools.WebSearch.NewTracks.Item(i).Custom2 = theFormat
4449 If FormatTag = "Custom3" Then SDB.Tools.WebSearch.NewTracks.Item(i).Custom3 = theFormat
4450 If FormatTag = "Custom4" Then SDB.Tools.WebSearch.NewTracks.Item(i).Custom4 = theFormat
4451 If FormatTag = "Custom5" Then SDB.Tools.WebSearch.NewTracks.Item(i).Custom5 = theFormat
4452 End If
4453 Next
4454 Else
4455
4456 If SDB.Tools.WebSearch.NewTracks.Count = 1 Then
4457 WriteLog "Only one track for tagging selected"
4458 SelectedTracks.Add SDB.Tools.WebSearch.NewTracks.Item(0).Title
4459 SDB.Tools.WebSearch.SmartUpdateTracks SelectedTracks
4460 For i = 0 To SDB.Tools.WebSearch.NewTracks.Count - 1
4461 SelectedSongsGlobal.Add SDB.Tools.WebSearch.NewTracks.Item(i)
4462 Next
4463 i = 0
4464 For j = 0 To Tracks.Count - 1
4465 If Tracks.Item(j) = SDB.Tools.WebSearch.NewTracks.Item(i).Title Then
4466 If UnselectedTracks(j) = "" Then
4467 If UnselectedTrackNames(j) = "" Then
4468 SDB.Tools.WebSearch.NewTracks.Item(i).Title = Tracks.Item(j)
4469 Else
4470 SDB.Tools.WebSearch.NewTracks.Item(i).Title = SDB.Tools.WebSearch.NewTracks.Item(i).Title
4471 End If
4472 If CheckArtist And ((CheckDontFillEmptyFields = True And ArtistTitles.Item(j) <> "") Or CheckDontFillEmptyFields = False) Then SDB.Tools.WebSearch.NewTracks.Item(i).ArtistName = ArtistTitles.Item(j)
4473 If CheckTrackNum And ((CheckDontFillEmptyFields = True And TracksNum.Item(j) <> "") Or CheckDontFillEmptyFields = False) Then SDB.Tools.WebSearch.NewTracks.Item(i).TrackOrderStr = TracksNum.Item(j)
4474 If CheckDiscNum And ((CheckDontFillEmptyFields = True And TracksCD.Item(j) <> "") Or CheckDontFillEmptyFields = False) Then SDB.Tools.WebSearch.NewTracks.Item(i).DiscNumberStr = TracksCD.Item(j)
4475 If CheckInvolved And ((CheckDontFillEmptyFields = True And InvolvedArtists.Item(j) <> "") Or CheckDontFillEmptyFields = False) Then SDB.Tools.WebSearch.NewTracks.Item(i).InvolvedPeople = InvolvedArtists.Item(j)
4476 If CheckGrouping And ((CheckDontFillEmptyFields = True And Grouping(j) <> "") Or CheckDontFillEmptyFields = False) Then SDB.Tools.WebSearch.NewTracks.Item(i).Grouping = Grouping(j)
4477 If CheckLyricist And ((CheckDontFillEmptyFields = True And Lyricists.Item(j) <> "") Or CheckDontFillEmptyFields = False) Then SDB.Tools.WebSearch.NewTracks.Item(i).Lyricist = Lyricists.Item(j)
4478 If CheckComposer And ((CheckDontFillEmptyFields = True And Composers.Item(j) <> "") Or CheckDontFillEmptyFields = False) Then SDB.Tools.WebSearch.NewTracks.Item(i).Author = Composers.Item(j)
4479 If CheckConductor And ((CheckDontFillEmptyFields = True And Conductors.Item(j) <> "") Or CheckDontFillEmptyFields = False) Then SDB.Tools.WebSearch.NewTracks.Item(i).Conductor = Conductors.Item(j)
4480 If CheckProducer And ((CheckDontFillEmptyFields = True And Producers.Item(j) <> "") Or CheckDontFillEmptyFields = False) Then SDB.Tools.WebSearch.NewTracks.Item(i).Producer = Producers.Item(j)
4481 Exit For
4482 End If
4483 End If
4484 Next
4485 If CheckAlbumArtist And ((CheckDontFillEmptyFields = True And AlbumArtist <> "") Or CheckDontFillEmptyFields = False) Then SDB.Tools.WebSearch.NewTracks.Item(i).AlbumArtistName = AlbumArtist
4486 If CheckAlbum And ((CheckDontFillEmptyFields = True And AlbumTitle <> "") Or CheckDontFillEmptyFields = False) Then SDB.Tools.WebSearch.NewTracks.Item(i).AlbumName = AlbumTitle
4487
4488 If CheckDate Then
4489 If Len(ReleaseDate) > 4 Then
4490 If QueryPage = "MetalArchives" Then
4491 ReleaseDate = convert_date(ReleaseDate)
4492 End If
4493 SDB.Tools.WebSearch.NewTracks.Item(i).Year = Mid(ReleaseDate,7,4)
4494 SDB.Tools.WebSearch.NewTracks.Item(i).Month = Mid(ReleaseDate,4,2)
4495 SDB.Tools.WebSearch.NewTracks.Item(i).Day = Mid(ReleaseDate,1,2)
4496 ElseIf IsNumeric(ReleaseDate) Then
4497 SDB.Tools.WebSearch.NewTracks.Item(i).Year = ReleaseDate
4498 ElseIf ReleaseDate = "" Then
4499 If CheckDontFillEmptyFields = False Then
4500 SDB.Tools.WebSearch.NewTracks.Item(i).Year = -1
4501 End If
4502 End If
4503 End If
4504 If CheckOrigDate And QueryPage <> "MetalArchives" Then
4505 If Len(OriginalDate) > 4 Then
4506 SDB.Tools.WebSearch.NewTracks.Item(i).OriginalYear = Mid(OriginalDate,7,4)
4507 SDB.Tools.WebSearch.NewTracks.Item(i).OriginalMonth = Mid(OriginalDate,4,2)
4508 SDB.Tools.WebSearch.NewTracks.Item(i).OriginalDay = Mid(OriginalDate,1,2)
4509 ElseIf IsNumeric(OriginalDate) Then
4510 SDB.Tools.WebSearch.NewTracks.Item(i).OriginalYear = OriginalDate
4511 ElseIf OriginalDate = "" Then
4512 If CheckDontFillEmptyFields = False Then
4513 SDB.Tools.WebSearch.NewTracks.Item(i).OriginalYear = -1
4514 End If
4515 End If
4516 End If
4517
4518 If CheckStyleField = "Default (stored with Genre)" Then
4519 If CheckGenre Then
4520 If Not(NewGenre = "" And CheckDontFillEmptyFields = True) Then
4521 SDB.Tools.WebSearch.NewTracks.Item(i).Genre = NewGenre
4522 End If
4523 End If
4524 End If
4525 If CheckLabel And ((CheckDontFillEmptyFields = True And theLabels <> "") Or CheckDontFillEmptyFields = False) Then SDB.Tools.WebSearch.NewTracks.Item(i).Publisher = theLabels
4526
4527 If CheckComment And ((CheckDontFillEmptyFields = True And comment <> "") Or CheckDontFillEmptyFields = False) Then SDB.Tools.WebSearch.NewTracks.Item(i).Comment = comment
4528
4529 If CheckRelease And ((CheckDontFillEmptyFields = True And CurrentReleaseId <> "") Or CheckDontFillEmptyFields = False) Then
4530 If ReleaseTag = "Custom1" Then SDB.Tools.WebSearch.NewTracks.Item(i).Custom1 = CurrentReleaseId
4531 If ReleaseTag = "Custom2" Then SDB.Tools.WebSearch.NewTracks.Item(i).Custom2 = CurrentReleaseId
4532 If ReleaseTag = "Custom3" Then SDB.Tools.WebSearch.NewTracks.Item(i).Custom3 = CurrentReleaseId
4533 If ReleaseTag = "Custom4" Then SDB.Tools.WebSearch.NewTracks.Item(i).Custom4 = CurrentReleaseId
4534 If ReleaseTag = "Custom5" Then SDB.Tools.WebSearch.NewTracks.Item(i).Custom5 = CurrentReleaseId
4535 If ReleaseTag = "Grouping" Then SDB.Tools.WebSearch.NewTracks.Item(i).Grouping = CurrentReleaseId
4536 If ReleaseTag = "ISRC" Then SDB.Tools.WebSearch.NewTracks.Item(i).ISRC = CurrentReleaseId
4537 If ReleaseTag = "Encoder" Then SDB.Tools.WebSearch.NewTracks.Item(i).Encoder = CurrentReleaseId
4538 If ReleaseTag = "Copyright" Then SDB.Tools.WebSearch.NewTracks.Item(i).Copyright = CurrentReleaseId
4539 End If
4540
4541 If CheckCatalog And ((CheckDontFillEmptyFields = True And theCatalogs <> "") Or CheckDontFillEmptyFields = False) Then
4542 If CatalogTag = "Custom1" Then SDB.Tools.WebSearch.NewTracks.Item(i).Custom1 = theCatalogs
4543 If CatalogTag = "Custom2" Then SDB.Tools.WebSearch.NewTracks.Item(i).Custom2 = theCatalogs
4544 If CatalogTag = "Custom3" Then SDB.Tools.WebSearch.NewTracks.Item(i).Custom3 = theCatalogs
4545 If CatalogTag = "Custom4" Then SDB.Tools.WebSearch.NewTracks.Item(i).Custom4 = theCatalogs
4546 If CatalogTag = "Custom5" Then SDB.Tools.WebSearch.NewTracks.Item(i).Custom5 = theCatalogs
4547 If CatalogTag = "ISRC" Then SDB.Tools.WebSearch.NewTracks.Item(i).ISRC = theCatalogs
4548 End If
4549
4550 If CheckCountry And ((CheckDontFillEmptyFields = True And theCountry <> "") Or CheckDontFillEmptyFields = False) Then
4551 If CountryTag = "Custom1" Then SDB.Tools.WebSearch.NewTracks.Item(i).Custom1 = theCountry
4552 If CountryTag = "Custom2" Then SDB.Tools.WebSearch.NewTracks.Item(i).Custom2 = theCountry
4553 If CountryTag = "Custom3" Then SDB.Tools.WebSearch.NewTracks.Item(i).Custom3 = theCountry
4554 If CountryTag = "Custom4" Then SDB.Tools.WebSearch.NewTracks.Item(i).Custom4 = theCountry
4555 If CountryTag = "Custom5" Then SDB.Tools.WebSearch.NewTracks.Item(i).Custom5 = theCountry
4556 End If
4557
4558 If CheckFormat And ((CheckDontFillEmptyFields = True And theFormat <> "") Or CheckDontFillEmptyFields = False) Then
4559 If FormatTag = "Custom1" Then SDB.Tools.WebSearch.NewTracks.Item(i).Custom1 = theFormat
4560 If FormatTag = "Custom2" Then SDB.Tools.WebSearch.NewTracks.Item(i).Custom2 = theFormat
4561 If FormatTag = "Custom3" Then SDB.Tools.WebSearch.NewTracks.Item(i).Custom3 = theFormat
4562 If FormatTag = "Custom4" Then SDB.Tools.WebSearch.NewTracks.Item(i).Custom4 = theFormat
4563 If FormatTag = "Custom5" Then SDB.Tools.WebSearch.NewTracks.Item(i).Custom5 = theFormat
4564 End If
4565 Else
4566 WriteLog SDB.Tools.WebSearch.NewTracks.Count & " tracks for tagging selected"
4567 For i = 0 To SDB.Tools.WebSearch.NewTracks.Count - 1
4568 WriteLog "SDB.Tools.WebSearch.NewTracks.Item(i).Title=" & SDB.Tools.WebSearch.NewTracks.Item(i).Title
4569 Next
4570 WriteLog ""
4571 For i = 0 To Tracks.Count - 1
4572 WriteLog "Tracks.Item(i)=" & Tracks.Item(i)
4573 Next
4574 WriteLog ""
4575 SelTracksCount = 0
4576 For i = 0 To Tracks.Count - 1
4577 If UnselectedTracks(i) = "" Then
4578 If UnselectedTrackNames(i) = "" Then
4579 SelTracksCount = SelTracksCount + 1
4580 Else
4581 SelTracksCount = SelTracksCount + 1
4582 End If
4583 If SDB.Tools.WebSearch.NewTracks.Count = SelTracksCount Then
4584 Exit For
4585 End If
4586 End If
4587 Next
4588 StartCount = 0
4589 If SelTracksCount < SDB.Tools.WebSearch.NewTracks.Count Then
4590 StartCount = SDB.Tools.WebSearch.NewTracks.Count - SelTracksCount
4591 End If
4592 WriteLog "StartCount=" & StartCount
4593 SelTracksCount = 0
4594
4595 For i = 0 To Tracks.Count - 1
4596 If UnselectedTracks(i) = "" Then
4597 If UnselectedTrackNames(i) = "" Then
4598 SelectedTracks.Add Tracks.Item(i)
4599 SelTracksCount = SelTracksCount + 1
4600 StartCount = StartCount + 1
4601 Else
4602 SelectedTracks.Add SDB.Tools.WebSearch.NewTracks.Item(StartCount).Title
4603 SelTracksCount = SelTracksCount + 1
4604 StartCount = StartCount + 1
4605 WriteLog "SelTracksCount=" & SelTracksCount
4606 WriteLog "SDB.Tools.WebSearch.NewTracks.Count=" & SDB.Tools.WebSearch.NewTracks.Count
4607 End If
4608 If SDB.Tools.WebSearch.NewTracks.Count = SelTracksCount Then
4609 Exit For
4610 End If
4611 End If
4612 Next
4613 For i = 0 To SDB.Tools.WebSearch.NewTracks.Count - 1
4614 SelectedSongsGlobal.Add SDB.Tools.WebSearch.NewTracks.Item(i)
4615 Next
4616 For i = 0 to SelTracksCount-1
4617 WriteLog "SelectedTracks=" & SelectedTracks.Item(i)
4618 Next
4619
4620 SDB.Tools.WebSearch.SmartUpdateTracks SelectedTracks
4621
4622 StartCount = 0
4623 If SelTracksCount < SDB.Tools.WebSearch.NewTracks.Count Then
4624 StartCount = SDB.Tools.WebSearch.NewTracks.Count - SelTracksCount
4625 End If
4626 WriteLog "StartCount=" & StartCount
4627 SelTracksCount = 0
4628
4629 For i = StartCount To SDB.Tools.WebSearch.NewTracks.Count - 1
4630 For j = SelTracksCount To Tracks.Count - 1
4631 WriteLog "SelTracksCount=" & SelTracksCount
4632 WriteLog "j=" & j
4633 If UnselectedTracks(j) = "" Then
4634 If UnselectedTrackNames(j) = "" Then
4635 WriteLog "SDB.Tools.WebSearch.NewTracks.Item(i).Title=" & SDB.Tools.WebSearch.NewTracks.Item(i).Title
4636 SDB.Tools.WebSearch.NewTracks.Item(i).Title = Tracks.Item(j)
4637 WriteLog "Tracks.Item(j)=" & Tracks.Item(j) & " - j=" & j
4638 Else
4639 WriteLog "Trackname nicht gewählt=" & SDB.Tools.WebSearch.NewTracks.Item(i).Title
4640 SDB.Tools.WebSearch.NewTracks.Item(i).Title = SDB.Tools.WebSearch.NewTracks.Item(i).Title
4641 End If
4642 If CheckArtist And ((CheckDontFillEmptyFields = True And ArtistTitles.Item(j) <> "") Or CheckDontFillEmptyFields = False) Then SDB.Tools.WebSearch.NewTracks.Item(i).ArtistName = ArtistTitles.Item(j)
4643 If CheckTrackNum And ((CheckDontFillEmptyFields = True And TracksNum.Item(j) <> "") Or CheckDontFillEmptyFields = False) Then SDB.Tools.WebSearch.NewTracks.Item(i).TrackOrderStr = TracksNum.Item(j)
4644 If CheckDiscNum And ((CheckDontFillEmptyFields = True And TracksCD.Item(j) <> "") Or CheckDontFillEmptyFields = False) Then SDB.Tools.WebSearch.NewTracks.Item(i).DiscNumberStr = TracksCD.Item(j)
4645 If CheckInvolved And ((CheckDontFillEmptyFields = True And InvolvedArtists.Item(j) <> "") Or CheckDontFillEmptyFields = False) Then SDB.Tools.WebSearch.NewTracks.Item(i).InvolvedPeople = InvolvedArtists.Item(j)
4646 If CheckGrouping And ((CheckDontFillEmptyFields = True And Grouping(j) <> "") Or CheckDontFillEmptyFields = False) Then SDB.Tools.WebSearch.NewTracks.Item(i).Grouping = Grouping(j)
4647 If CheckLyricist And ((CheckDontFillEmptyFields = True And Lyricists.Item(j) <> "") Or CheckDontFillEmptyFields = False) Then SDB.Tools.WebSearch.NewTracks.Item(i).Lyricist = Lyricists.Item(j)
4648 If CheckComposer And ((CheckDontFillEmptyFields = True And Composers.Item(j) <> "") Or CheckDontFillEmptyFields = False) Then SDB.Tools.WebSearch.NewTracks.Item(i).Author = Composers.Item(j)
4649 If CheckConductor And ((CheckDontFillEmptyFields = True And Conductors.Item(j) <> "") Or CheckDontFillEmptyFields = False) Then SDB.Tools.WebSearch.NewTracks.Item(i).Conductor = Conductors.Item(j)
4650 If CheckProducer And ((CheckDontFillEmptyFields = True And Producers.Item(j) <> "") Or CheckDontFillEmptyFields = False) Then SDB.Tools.WebSearch.NewTracks.Item(i).Producer = Producers.Item(j)
4651 SelTracksCount = SelTracksCount + 1
4652 Exit For
4653 End If
4654 SelTracksCount = SelTracksCount + 1
4655 Next
4656
4657 If CheckAlbumArtist And ((CheckDontFillEmptyFields = True And AlbumArtist <> "") Or CheckDontFillEmptyFields = False) Then SDB.Tools.WebSearch.NewTracks.Item(i).AlbumArtistName = AlbumArtist
4658 If CheckAlbum And ((CheckDontFillEmptyFields = True And AlbumTitle <> "") Or CheckDontFillEmptyFields = False) Then SDB.Tools.WebSearch.NewTracks.Item(i).AlbumName = AlbumTitle
4659
4660 If CheckDate Then
4661 If Len(ReleaseDate) > 4 Then
4662 If QueryPage = "MetalArchives" Then
4663 ReleaseDate = convert_date(ReleaseDate)
4664 End If
4665 SDB.Tools.WebSearch.NewTracks.Item(i).Year = Mid(ReleaseDate,7,4)
4666 SDB.Tools.WebSearch.NewTracks.Item(i).Month = Mid(ReleaseDate,4,2)
4667 SDB.Tools.WebSearch.NewTracks.Item(i).Day = Mid(ReleaseDate,1,2)
4668 ElseIf IsNumeric(ReleaseDate) Then
4669 SDB.Tools.WebSearch.NewTracks.Item(i).Year = ReleaseDate
4670 ElseIf ReleaseDate = "" Then
4671 If CheckDontFillEmptyFields = False Then
4672 SDB.Tools.WebSearch.NewTracks.Item(i).Year = -1
4673 End If
4674 End If
4675 End If
4676 If CheckOrigDate And QueryPage <> "MetalArchives" Then
4677 If Len(OriginalDate) > 4 Then
4678 SDB.Tools.WebSearch.NewTracks.Item(i).OriginalYear = Mid(OriginalDate,7,4)
4679 SDB.Tools.WebSearch.NewTracks.Item(i).OriginalMonth = Mid(OriginalDate,4,2)
4680 SDB.Tools.WebSearch.NewTracks.Item(i).OriginalDay = Mid(OriginalDate,1,2)
4681 ElseIf IsNumeric(OriginalDate) Then
4682 SDB.Tools.WebSearch.NewTracks.Item(i).OriginalYear = OriginalDate
4683 ElseIf OriginalDate = "" Then
4684 If CheckDontFillEmptyFields = False Then
4685 SDB.Tools.WebSearch.NewTracks.Item(i).OriginalYear = -1
4686 End If
4687 End If
4688 End If
4689
4690 If CheckStyleField = "Default (stored with Genre)" Then
4691 If CheckGenre And QueryPage <> "MetalArchives" Then
4692 If Not(NewGenre = "" And CheckDontFillEmptyFields = True) Then
4693 SDB.Tools.WebSearch.NewTracks.Item(i).Genre = NewGenre
4694 End If
4695 End If
4696 End If
4697 If CheckLabel And ((CheckDontFillEmptyFields = True And theLabels <> "") Or CheckDontFillEmptyFields = False) Then SDB.Tools.WebSearch.NewTracks.Item(i).Publisher = theLabels
4698
4699 If CheckComment And ((CheckDontFillEmptyFields = True And comment <> "") Or CheckDontFillEmptyFields = False) Then SDB.Tools.WebSearch.NewTracks.Item(i).Comment = comment
4700
4701 If CheckRelease And QueryPage <> "MetalArchives" And ((CheckDontFillEmptyFields = True And CurrentReleaseId <> "") Or CheckDontFillEmptyFields = False) Then
4702 If ReleaseTag = "Custom1" Then SDB.Tools.WebSearch.NewTracks.Item(i).Custom1 = CurrentReleaseId
4703 If ReleaseTag = "Custom2" Then SDB.Tools.WebSearch.NewTracks.Item(i).Custom2 = CurrentReleaseId
4704 If ReleaseTag = "Custom3" Then SDB.Tools.WebSearch.NewTracks.Item(i).Custom3 = CurrentReleaseId
4705 If ReleaseTag = "Custom4" Then SDB.Tools.WebSearch.NewTracks.Item(i).Custom4 = CurrentReleaseId
4706 If ReleaseTag = "Custom5" Then SDB.Tools.WebSearch.NewTracks.Item(i).Custom5 = CurrentReleaseId
4707 If ReleaseTag = "Grouping" Then SDB.Tools.WebSearch.NewTracks.Item(i).Grouping = CurrentReleaseId
4708 If ReleaseTag = "ISRC" Then SDB.Tools.WebSearch.NewTracks.Item(i).ISRC = CurrentReleaseId
4709 If ReleaseTag = "Encoder" Then SDB.Tools.WebSearch.NewTracks.Item(i).Encoder = CurrentReleaseId
4710 If ReleaseTag = "Copyright" Then SDB.Tools.WebSearch.NewTracks.Item(i).Copyright = CurrentReleaseId
4711 End If
4712
4713 If CheckCatalog And ((CheckDontFillEmptyFields = True And theCatalogs <> "") Or CheckDontFillEmptyFields = False) Then
4714 If CatalogTag = "Custom1" Then SDB.Tools.WebSearch.NewTracks.Item(i).Custom1 = theCatalogs
4715 If CatalogTag = "Custom2" Then SDB.Tools.WebSearch.NewTracks.Item(i).Custom2 = theCatalogs
4716 If CatalogTag = "Custom3" Then SDB.Tools.WebSearch.NewTracks.Item(i).Custom3 = theCatalogs
4717 If CatalogTag = "Custom4" Then SDB.Tools.WebSearch.NewTracks.Item(i).Custom4 = theCatalogs
4718 If CatalogTag = "Custom5" Then SDB.Tools.WebSearch.NewTracks.Item(i).Custom5 = theCatalogs
4719 If CatalogTag = "ISRC" Then SDB.Tools.WebSearch.NewTracks.Item(i).ISRC = theCatalogs
4720 End If
4721
4722 If CheckCountry And QueryPage <> "MetalArchives" And ((CheckDontFillEmptyFields = True And theCountry <> "") Or CheckDontFillEmptyFields = False) Then
4723 If CountryTag = "Custom1" Then SDB.Tools.WebSearch.NewTracks.Item(i).Custom1 = theCountry
4724 If CountryTag = "Custom2" Then SDB.Tools.WebSearch.NewTracks.Item(i).Custom2 = theCountry
4725 If CountryTag = "Custom3" Then SDB.Tools.WebSearch.NewTracks.Item(i).Custom3 = theCountry
4726 If CountryTag = "Custom4" Then SDB.Tools.WebSearch.NewTracks.Item(i).Custom4 = theCountry
4727 If CountryTag = "Custom5" Then SDB.Tools.WebSearch.NewTracks.Item(i).Custom5 = theCountry
4728 End If
4729
4730 If CheckFormat And ((CheckDontFillEmptyFields = True And theFormat <> "") Or CheckDontFillEmptyFields = False) Then
4731 If FormatTag = "Custom1" Then SDB.Tools.WebSearch.NewTracks.Item(i).Custom1 = theFormat
4732 If FormatTag = "Custom2" Then SDB.Tools.WebSearch.NewTracks.Item(i).Custom2 = theFormat
4733 If FormatTag = "Custom3" Then SDB.Tools.WebSearch.NewTracks.Item(i).Custom3 = theFormat
4734 If FormatTag = "Custom4" Then SDB.Tools.WebSearch.NewTracks.Item(i).Custom4 = theFormat
4735 If FormatTag = "Custom5" Then SDB.Tools.WebSearch.NewTracks.Item(i).Custom5 = theFormat
4736 End If
4737 Next
4738 End If
4739 End If
4740
4741 NewResult = False
4742
4743 SDB.Tools.WebSearch.RefreshViews
4744 WriteLog " "
4745 WriteLog "Stop ReloadResults"
4746
4747End Sub
4748
4749
4750Function convert_date(ReleaseDate)
4751
4752 Dim Day, Mon, Year, tmp, tmp2
4753 Day = ""
4754 Mon = ""
4755 Year = ""
4756 If ReleaseDate = "Unknown" Then
4757 ReleaseDate = ""
4758 Else
4759 If InStr(ReleaseDate, ",") = 0 And InStr(ReleaseDate, " ") > 0 Then
4760 tmp = InStr(ReleaseDate, " ")
4761 Mon = Left(ReleaseDate, tmp - 1)
4762 Year = Mid(ReleaseDate, tmp + 1)
4763 ElseIf InStr(ReleaseDate, ",") > 0 Then
4764 tmp = InStr(ReleaseDate, ",")
4765 Year = Mid(ReleaseDate, tmp + 2)
4766 tmp2 = Left(ReleaseDate, tmp -1)
4767 tmp = InStr(tmp2, " ")
4768 Mon = Left(tmp2, tmp - 1)
4769 Day = Mid(tmp2, tmp + 1)
4770 End If
4771 If Mon = "January" Then Mon = "01"
4772 If Mon = "February" Then Mon = "02"
4773 If Mon = "March" Then Mon = "03"
4774 If Mon = "April" Then Mon = "04"
4775 If Mon = "May" Then Mon = "05"
4776 If Mon = "June" Then Mon = "06"
4777 If Mon = "July" Then Mon = "07"
4778 If Mon = "August" Then Mon = "08"
4779 If Mon = "September" Then Mon = "09"
4780 If Mon = "October" Then Mon = "10"
4781 If Mon = "November" Then Mon = "11"
4782 If Mon = "December" Then Mon = "12"
4783
4784 If Day <> "" Then
4785 tmp = Len(Day)
4786 Day = Left(Day, tmp - 2)
4787 If Int(Day) < 10 Then
4788 Day = "0" & Day
4789 End If
4790 End If
4791 If Year <> "" And Mon <> "" And Day <> "" Then
4792 ReleaseDate = Day & "." & Mon & "." & Year
4793 ElseIf Year <> "" And Mon <> "" And Day = "" Then
4794 ReleaseDate = "00." & Mon & "." & Year
4795 End If
4796 End If
4797
4798 convert_date = ReleaseDate
4799
4800End Function
4801
4802
4803Function RelationshipTypes(JSONArray)
4804
4805 Dim rType, i, a, nType, found, instrument, cInstr
4806 ReDim role(0)
4807 WriteLog "Start RelTypes"
4808 SDB.ProcessMessages
4809 rType = JSONArray("type")
4810 nType = ""
4811 cInstr = 0
4812
4813 If rType <> "other version" Then
4814 If JSONArray("attributes").Count > 0 Then
4815 For a = 0 to JSONArray("attributes").Count -1
4816 found = false
4817 For i = 0 to RelationAttrList.Count -1
4818 If LCase(RelationAttrList.Item(i)) = JSONArray("attributes")(a) Then
4819 nType = nType & RelationAttrList.Item(i) & " "
4820 WriteLog "Attribute found: " & RelationAttrList.Item(i)
4821 found = true
4822 End If
4823 Next
4824 If found = false Then
4825 If rType = "instrument" Then
4826 cInstr = cInstr + 1
4827 ReDim Preserve role(cInstr+1)
4828 role(0) = cInstr
4829 role(cInstr) = nType & UCase(Left(JSONArray("attributes")(a), 1)) & Mid(JSONArray("attributes")(a), 2)
4830 WriteLog cInstr & ". Instrument: " & role(cInstr)
4831 End If
4832 End If
4833 Next
4834 End If
4835 If rType <> "instrument" Then
4836 If rType = "vocal" Then rType = "vocals"
4837 ReDim role(2)
4838 role(0) = 1
4839 role(1) = nType & UCase(Left(rType, 1)) & Mid(rType, 2)
4840 WriteLog "Found Role=" & role(1)
4841 End If
4842 Else
4843 WriteLog "other Version found!!"
4844 REM SDB.MessageBox "other Version found!!", mtInformation, Array(mbOk)
4845 ReDim role(1)
4846 role(0) = 0
4847 End If
4848 RelationshipTypes = role
4849 WriteLog "Stop RelTypes"
4850
4851End Function
4852
4853
4854
4855Function trackNumbering(ByRef pos, byRef position, byRef TracksNum, byRef TracksCD, byRef iTrackNum, FormatCnt)
4856
4857 WriteLog "start trackNumbering"
4858 Dim TrackPosition
4859
4860 If pos > 1 And CheckNoDisc = False And FormatCnt > 1 Then ' Disc Number Included
4861 WriteLog "Disc Number Included"
4862 If CheckForceNumeric Then
4863 If Left(position,2) = "CD" Then
4864 If iAutoDiscFormat <> "CD" Then
4865 iAutoDiscFormat = "CD"
4866 iAutoTrackNumber = 1
4867 iAutoDiscNumber = 1
4868 End If
4869 If Mid(position,3,1) = "-" Then
4870 iAutoDiscNumber = 1
4871 Else
4872 If iAutoDiscNumber <> Mid(position,3,1) Then
4873 iAutoTrackNumber = 1
4874 End If
4875 End If
4876 End If
4877
4878 If Left(position,3) = "DVD" Then
4879 If iAutoDiscFormat <> "DVD" Then
4880 iAutoDiscFormat = "DVD"
4881 iAutoDiscNumber = 1
4882 iAutoTrackNumber = 1
4883 End If
4884 If Mid(position,4,1) = "-" Then
4885 iAutoDiscNumber = 1
4886 Else
4887 If iAutoDiscNumber <> Mid(position,4,1) Then
4888 iAutoTrackNumber = 1
4889 End If
4890 End If
4891 End If
4892
4893 If Left(position,3) = "VHS" Then
4894 If iAutoDiscFormat <> "VHS" Then
4895 iAutoDiscFormat = "VHS"
4896 iAutoTrackNumber = 1
4897 iAutoDiscNumber = 1
4898 End If
4899 If Mid(position,4,1) = "-" Then
4900 iAutoDiscNumber = 1
4901 Else
4902 If iAutoDiscNumber <> Mid(position,4,1) Then
4903 iAutoTrackNumber = 1
4904 End If
4905 End If
4906 End If
4907
4908 If Left(position,5) = "Video" Then
4909 If iAutoDiscFormat <> "Video" Then
4910 iAutoDiscFormat = "Video"
4911 iAutoTrackNumber = 1
4912 iAutoDiscNumber = 1
4913 End If
4914 If Mid(position,6,1) = "-" Then
4915 iAutoDiscNumber = 1
4916 Else
4917 If iAutoDiscNumber <> Mid(position,6,1) Then
4918 iAutoTrackNumber = 1
4919 End If
4920 End If
4921 End If
4922
4923 If Left(position,2) <> "CD" And Left(position,3) <> "DVD" And Left(position,3) <> "VHS" And Left(position,5) <> "Video" And IsInteger(Left(position,pos-1)) Then
4924 If Int(iAutoDiscNumber) <> Int(Left(position,pos-1)) Then
4925 iAutoTrackNumber = 1
4926 End If
4927 End If
4928
4929 If UnselectedTracks(iTrackNum) <> "x" Then
4930 If CheckLeadingZero = True And iAutoTrackNumber < 10 Then
4931 tracksNum.Add "0" & iAutoTrackNumber
4932 WriteLog "Tracknumber=0" & iAutoTrackNumber
4933 Else
4934 tracksNum.Add iAutoTrackNumber
4935 WriteLog "Tracknumber=" & iAutoTrackNumber
4936 End If
4937 iAutoTrackNumber = iAutoTrackNumber + 1
4938 Else
4939 tracksNum.Add ""
4940 WriteLog "Tracknumber=Nothing"
4941 End If
4942 Else
4943 If pos > 0 Then
4944 TrackPosition = Mid(position, pos+1)
4945 If Len(TrackPosition) > 1 Then 'minimum 2 Char after - (1-1a, 1-II, 1-12)
4946 If IsInteger(Left(TrackPosition, 1)) And Not IsInteger(Right(Trackposition, 1)) Then 'Minimum first is a Number, Char at the end (1-1a, 1-1b, 1-1c,...) = maybe Sub-Track !
4947 tracksNum.Add TrackPosition
4948 WriteLog "Tracknumber=" & TrackPosition
4949 ElseIf IsInteger(TrackPosition) Then 'no char at all (1-01, 1-02, 1-12)
4950 If CheckLeadingZero = True And Int(TrackPosition) < 10 Then
4951 tracksNum.Add "0" & Int(TrackPosition)
4952 WriteLog "Tracknumber=0" & Int(TrackPosition)
4953 Else
4954 tracksNum.Add TrackPosition
4955 WriteLog "Tracknumber=" & TrackPosition
4956 End If
4957 Else
4958 tracksNum.Add TrackPosition
4959 End If
4960 ElseIf Len(TrackPosition) = 1 Then '1 Char after - (1-1, 1-I, 1-2)
4961 If IsInteger(TrackPosition) Then
4962 If CheckLeadingZero = True And TrackPosition < 10 Then
4963 tracksNum.Add "0" & TrackPosition
4964 WriteLog "Tracknumber=0" & TrackPosition
4965 Else
4966 tracksNum.Add TrackPosition
4967 WriteLog "Tracknumber=" & TrackPosition
4968 End If
4969 Else
4970 tracksNum.Add TrackPosition
4971 WriteLog "Tracknumber=" & TrackPosition
4972 End If
4973 End If
4974 End If
4975 If UnselectedTracks(iTrackNum) <> "x" Then
4976 If IsInteger(TrackPosition) Then
4977 iAutoTrackNumber = TrackPosition + 1
4978 Else
4979 iAutoTrackNumber = iAutoTrackNumber + 1
4980 End If
4981 End If
4982 End If
4983 If Left(position,2) = "CD" Then
4984 If iAutoDiscFormat <> "CD" Then
4985 iAutoDiscFormat = "CD"
4986 iAutoTrackNumber = 1
4987 iAutoDiscNumber = 1
4988 End If
4989 If Mid(position,3,1) = "-" Then
4990 'Or Mid(position,3,1) = "." Then
4991 iAutoDiscNumber = 1
4992 Else
4993 iAutoDiscNumber = Mid(position,3,1)
4994 End If
4995 End If
4996 If Left(position,3) = "DVD" Then
4997 If iAutoDiscFormat <> "DVD" Then
4998 iAutoDiscFormat = "DVD"
4999 iAutoTrackNumber = 1
5000 iAutoDiscNumber = 1
5001 End If
5002 If Mid(position,4,1) = "-" Then
5003 'Or Mid(position,3,1) = "." Then
5004 iAutoDiscNumber = 1
5005 Else
5006 iAutoDiscNumber = Mid(position,4,1)
5007 End If
5008 End If
5009 If Left(position,3) = "VHS" Then
5010 If iAutoDiscFormat <> "VHS" Then
5011 iAutoDiscFormat = "VHS"
5012 iAutoTrackNumber = 1
5013 iAutoDiscNumber = 1
5014 End If
5015 If Mid(position,4,1) = "-" Then
5016 'Or Mid(position,3,1) = "." Then
5017 iAutoDiscNumber = 1
5018 Else
5019 iAutoDiscNumber = Mid(position,4,1)
5020 End If
5021 End If
5022 If Left(position,5) = "Video" Then
5023 If iAutoDiscFormat <> "Video" Then
5024 iAutoDiscFormat = "Video"
5025 iAutoTrackNumber = 1
5026 iAutoDiscNumber = 1
5027 End If
5028 If Mid(position,6,1) = "-" Then
5029 'Or Mid(position,3,1) = "." Then
5030 iAutoDiscNumber = 1
5031 Else
5032 iAutoDiscNumber = Mid(position,6,1)
5033 End If
5034 End If
5035 If Left(position,2) <> "CD" And Left(position,3) <> "DVD" And Left(position,3) <> "VHS" And Left(position,5) <> "Video" Then iAutoDiscNumber = Left(position,pos-1)
5036 tracksCD.Add LeadingZeroDisc(iAutoDiscNumber)
5037 Else ' Apply Track Numbering Schemes
5038 WriteLog "Track Numbering Schemes"
5039 If Not CheckSidesToDisc Or IsInteger(Left(position,1)) Then
5040 WriteLog "Standard track numbering"
5041 If CheckForceNumeric Then
5042 If UnselectedTracks(iTrackNum) <> "x" Then
5043 If CheckLeadingZero = True And iAutoTrackNumber < 10 Then
5044 tracksNum.Add "0" & iAutoTrackNumber
5045 WriteLog "Tracknumber=0" & iAutoTrackNumber
5046 Else
5047 tracksNum.Add iAutoTrackNumber
5048 WriteLog "Tracknumber=" & iAutoTrackNumber
5049 End If
5050 iAutoTrackNumber = iAutoTrackNumber + 1
5051 Else
5052 tracksNum.Add ""
5053 WriteLog "Tracknumber=Nothing"
5054 End If
5055 Else
5056 If CheckLeadingZero = True And IsNumeric(position) Then
5057 If position < 10 And position > 0 Then
5058 tracksNum.Add "0" & position
5059 WriteLog "Tracknumber=0" & position
5060 Else
5061 tracksNum.Add position
5062 WriteLog "Tracknumber=" & position
5063 End If
5064 Else
5065 tracksNum.Add position
5066 WriteLog "Tracknumber=" & position
5067 End If
5068 If UnselectedTracks(iTrackNum) <> "x" Then
5069 If IsNumeric(position) Then
5070 iAutoTrackNumber = position + 1
5071 Else
5072 iAutoTrackNumber = iAutoTrackNumber + 1
5073 End If
5074 End If
5075 End If
5076 If CheckForceDisc Then
5077 tracksCD.Add LeadingZeroDisc(iAutoDiscNumber)
5078 Else
5079 tracksCD.Add ""
5080 End If
5081 Else
5082 If Len(position) = 1 Then ' Only side is specified
5083 WriteLog "Only side is specified"
5084 If CheckLeadingZero = True Then
5085 tracksNum.Add "01"
5086 WriteLog "Tracknumber=01"
5087 Else
5088 tracksNum.Add "1"
5089 WriteLog "Tracknumber=1"
5090 End If
5091 If LastDisc <> position Then
5092 If LastDisc <> "" Then
5093 iAutoDiscNumber = iAutoDiscNumber + 1
5094 End If
5095 LastDisc = position
5096 End If
5097 If CheckForceNumeric Then
5098 tracksCD.Add LeadingZeroDisc(iAutoDiscNumber)
5099 Else
5100 tracksCD.Add LeadingZeroDisc(position)
5101 End If
5102 ElseIf Len(position) = 2 Then
5103 If IsInteger(Mid(position,2,1)) And Not IsInteger(Mid(position,1,1)) Then
5104 WriteLog "First is Side Second is Track"
5105 ' First is Side Second is Track
5106 ' WriteLog iAutoDiscNumber
5107 ' WriteLog iAutoTrackNumber
5108 If LastDisc <> Left(position,1) Then
5109 If LastDisc <> "" And (LastDisc = "B" Or LastDisc = "D" Or LastDisc = "F" Or LastDisc = "H" Or LastDisc = "J") Then
5110 If IsInteger(iAutoDiscNumber) Then
5111 iAutoDiscNumber = iAutoDiscNumber + 1
5112 End If
5113 iAutoTrackNumber = 1
5114 End If
5115 LastDisc = Left(position,1)
5116 End If
5117 If UnselectedTracks(iTrackNum) <> "x" Then
5118 ' If CheckLeadingZero = True And Mid(position,2) < 10 Then
5119 If CheckLeadingZero = True And iAutoTrackNumber < 10 Then
5120 ' tracksNum.Add "0" & Mid(position,2)
5121 tracksNum.Add "0" & iAutoTrackNumber
5122 WriteLog "Tracknumber=0" & iAutoTrackNumber
5123 iAutoTrackNumber = iAutoTrackNumber + 1
5124 Else
5125 ' tracksNum.Add Mid(position,2)
5126 tracksNum.Add iAutoTrackNumber
5127 WriteLog "Tracknumber=" & iAutoTrackNumber
5128 iAutoTrackNumber = iAutoTrackNumber + 1
5129 End If
5130 Else
5131 tracksNum.Add ""
5132 WriteLog "Tracknumber=Nothing"
5133 End If
5134 If CheckForceNumeric Then
5135 tracksCD.Add LeadingZeroDisc(iAutoDiscNumber)
5136 Else
5137 tracksCD.Add LeadingZeroDisc(Left(position,1))
5138 End If
5139 Else ' Two byte side
5140 WriteLog "Two byte side"
5141 tracksNum.Add "1"
5142 WriteLog "Tracknumber=1"
5143 If LastDisc <> position Then
5144 If LastDisc <> "" Then
5145 iAutoDiscNumber = iAutoDiscNumber + 1
5146 End If
5147 LastDisc = position
5148 End If
5149 If CheckForceNumeric Then
5150 tracksCD.Add LeadingZeroDisc(iAutoDiscNumber)
5151 Else
5152 tracksCD.Add LeadingZeroDisc(position)
5153 End If
5154 End If
5155 Else ' More than 2 bytes
5156 If IsInteger(Mid(position,2)) And CheckNoDisc = False Then
5157 WriteLog "First is Side Latter is Track"
5158 'First is Side Latter is Track
5159 If UnselectedTracks(iTrackNum) <> "x" Then
5160 tracksNum.Add Mid(position,2)
5161 WriteLog "Tracknumber=" & Mid(position,2)
5162 Else
5163 tracksNum.Add ""
5164 WriteLog "Tracknumber=Nothing"
5165 End If
5166 If LastDisc <> Left(position,1) Then
5167 If LastDisc <> "" Then
5168 iAutoDiscNumber = iAutoDiscNumber + 1
5169 End If
5170 LastDisc = Left(position,1)
5171 End If
5172 If CheckForceNumeric Then
5173 tracksCD.Add LeadingZeroDisc(iAutoDiscNumber)
5174 Else
5175 tracksCD.Add LeadingZeroDisc(Left(position,1))
5176 End If
5177 ElseIf IsInteger(Mid(position,3)) And CheckNoDisc = False Then
5178 WriteLog "Two Byte Side, Latter is Track"
5179 ' Two Byte Side, Latter is Track
5180 If UnselectedTracks(iTrackNum) <> "x" Then
5181 tracksNum.Add Mid(position,3)
5182 WriteLog "Tracknumber=" & Mid(position,3)
5183 Else
5184 tracksNum.Add ""
5185 WriteLog "Tracknumber=Nothing"
5186 End If
5187 If LastDisc <> Left(position,2) Then
5188 If LastDisc <> "" Then
5189 iAutoDiscNumber = iAutoDiscNumber + 1
5190 End If
5191 LastDisc = Left(position,2)
5192 End If
5193 If CheckForceNumeric Then
5194 tracksCD.Add LeadingZeroDisc(iAutoDiscNumber)
5195 Else
5196 tracksCD.Add LeadingZeroDisc(Left(position,2))
5197 End If
5198 Else ' More than two non numeric bytes!
5199 WriteLog "More than two non numeric bytes!"
5200 If CheckNoDisc = False Then
5201 If UnselectedTracks(iTrackNum) <> "x" Then
5202 tracksNum.Add position
5203 WriteLog "Tracknumber=" & position
5204 tracksCD.Add ""
5205 Else
5206 tracksNum.Add ""
5207 WriteLog "Tracknumber=Nothing"
5208 tracksCD.Add ""
5209 End If
5210 Else
5211 If CheckForceNumeric Then
5212 If UnselectedTracks(iTrackNum) <> "x" Then
5213 If CheckLeadingZero = True And iAutoTrackNumber < 10 Then
5214 tracksNum.Add "0" & iAutoTrackNumber
5215 WriteLog "Tracknumber=0" & iAutoTrackNumber
5216 Else
5217 tracksNum.Add iAutoTrackNumber
5218 WriteLog "Tracknumber=" & iAutoTrackNumber
5219 End If
5220 iAutoTrackNumber = iAutoTrackNumber + 1
5221 Else
5222 tracksNum.Add ""
5223 WriteLog "Tracknumber=Nothing"
5224 End If
5225 Else
5226 If UnselectedTracks(iTrackNum) <> "x" Then
5227 If IsInteger(position) Then
5228 tracksNum.Add iAutoTrackNumber
5229 WriteLog "Tracknumber=" & iAutoTrackNumber
5230 iAutoTrackNumber = position + 1
5231 Else
5232 tracksNum.Add iAutoTrackNumber
5233 WriteLog "Tracknumber=" & iAutoTrackNumber
5234 iAutoTrackNumber = iAutoTrackNumber + 1
5235 End If
5236 End If
5237 End If
5238 tracksCD.Add ""
5239 End If
5240 End If
5241 End If
5242 End If
5243 End If
5244 ' WriteLog "iAutoTrackNumber=" & iAutoTrackNumber
5245 ' WriteLog "iTrackNum=" & iTrackNum
5246 ' WriteLog "tracksnum.item(iTrackNum)=" & tracksnum.item(iTrackNum)
5247
5248End Function
5249
5250
5251Function getinvolvedRole(involvedArtist, involvedRole, byRef artistList, byRef TrackFeaturing, byRef Involved_R_T, byRef TrackComposers, byRef TrackConductors, byRef TrackProducers, byRef TrackLyricists)
5252
5253 WriteLog "Start getinvolvedRole"
5254 Dim tmp, tmp2
5255 If LookForFeaturing(involvedRole) Then
5256 If InStr(artistList, involvedArtist) = 0 Then
5257 If TrackFeaturing = "" Then
5258 If CheckFeaturingName Then
5259 TrackFeaturing = TxtFeaturingName & " " & involvedArtist
5260 Else
5261 TrackFeaturing = involvedRole & " " & involvedArtist
5262 End If
5263 Else
5264 If InStr(TrackFeaturing, involvedArtist) = 0 Then
5265 TrackFeaturing = TrackFeaturing & ArtistSeparator & involvedArtist
5266 End If
5267 End If
5268 End If
5269 WriteLog "TrackFeaturing=" & TrackFeaturing
5270 Else
5271 Do
5272 tmp = searchKeyword(LyricistKeywords, involvedRole, TrackLyricists, involvedArtist)
5273 If tmp <> "" And tmp <> "ALREADY_INSIDE_ROLE" Then
5274 TrackLyricists = tmp
5275 WriteLog "TrackLyricists=" & TrackLyricists
5276 Exit Do
5277 ElseIf tmp = "ALREADY_INSIDE_ROLE" Then
5278 WriteLog "ALREADY_INSIDE_ROLE"
5279 Exit Do
5280 End If
5281 tmp = searchKeyword(ConductorKeywords, involvedRole, TrackConductors, involvedArtist)
5282 If tmp <> "" And tmp <> "ALREADY_INSIDE_ROLE" Then
5283 TrackConductors = tmp
5284 WriteLog "TrackConductors=" & TrackConductors
5285 Exit Do
5286 ElseIf tmp = "ALREADY_INSIDE_ROLE" Then
5287 WriteLog "ALREADY_INSIDE_ROLE"
5288 Exit Do
5289 End If
5290 tmp = searchKeyword(ProducerKeywords, involvedRole, TrackProducers, involvedArtist)
5291 If tmp <> "" And tmp <> "ALREADY_INSIDE_ROLE" Then
5292 TrackProducers = tmp
5293 WriteLog "TrackProducers=" & TrackProducers
5294 Exit Do
5295 ElseIf tmp = "ALREADY_INSIDE_ROLE" Then
5296 WriteLog "ALREADY_INSIDE_ROLE"
5297 Exit Do
5298 End If
5299 tmp = searchKeyword(ComposerKeywords, involvedRole, TrackComposers, involvedArtist)
5300 If tmp <> "" And tmp <> "ALREADY_INSIDE_ROLE" Then
5301 TrackComposers = tmp
5302 WriteLog "TrackComposers=" & TrackComposers
5303 Exit Do
5304 ElseIf tmp = "ALREADY_INSIDE_ROLE" Then
5305 WriteLog "ALREADY_INSIDE_ROLE"
5306 Exit Do
5307 End If
5308 tmp2 = search_involved(Involved_R_T, involvedRole)
5309 If tmp2 = -2 Then
5310 WriteLog "Ignore Role: '" & currentRole & "' (Unwanted tag)"
5311 ElseIf tmp2 = -1 Then
5312 ReDim Preserve Involved_R_T(UBound(Involved_R_T)+1)
5313 Involved_R_T(UBound(Involved_R_T)) = involvedRole & ": " & involvedArtist
5314 WriteLog "New Role: " & involvedRole & ": " & involvedArtist
5315 Else
5316 If InStr(Involved_R_T(tmp2), involvedArtist) = 0 Then
5317 Involved_R_T(tmp2) = Involved_R_T(tmp2) & ArtistSeparator & involvedArtist
5318 WriteLog "Role updated: " & Involved_R_T(tmp2)
5319 Else
5320 WriteLog "artist already inside role"
5321 End If
5322 End If
5323 Exit Do
5324 Loop While True
5325 End If
5326 WriteLog "Stop getinvolvedRole"
5327
5328End Function
5329
5330Function CheckSpecialRole(Role)
5331
5332 Dim tmp, tmp2, tmp3
5333 WriteLog "Start CheckSpecialRole"
5334 ReDim SingleRole(0)
5335 Do While 1 = 1
5336 tmp = InStr(Role, ",")
5337 tmp2 = InStr(Role, "[")
5338 tmp3 = InStr(Role, "]")
5339 If tmp = 0 Then
5340 ReDim Preserve SingleRole(UBound(SingleRole)+1)
5341 SingleRole(UBound(SingleRole)) = Role
5342 Exit Do
5343 End If
5344 If tmp < tmp2 Then
5345 ReDim Preserve SingleRole(UBound(SingleRole)+1)
5346 SingleRole(UBound(SingleRole)) = Left(Role, tmp-1)
5347 Role = LTrim(Mid(Role, tmp+1))
5348 End If
5349 If tmp > tmp2 And tmp > tmp3 Then
5350 ReDim Preserve SingleRole(UBound(SingleRole)+1)
5351 SingleRole(UBound(SingleRole)) = Left(Role, tmp-1)
5352 Role = LTrim(Mid(Role, tmp+1))
5353 End If
5354 If tmp > tmp2 And tmp < tmp3 Then
5355 tmp = InStr(tmp3, Role, ",", 0)
5356 ReDim Preserve SingleRole(UBound(SingleRole)+1)
5357 If tmp <> 0 Then
5358 SingleRole(UBound(SingleRole)) = Left(Role, tmp-1)
5359 Role = LTrim(Mid(Role, tmp+1))
5360 Else
5361 SingleRole(UBound(SingleRole)) = Role
5362 Exit Do
5363 End If
5364 End If
5365 Loop
5366 WriteLog "End CheckSpecialRole"
5367 CheckSpecialRole = SingleRole
5368
5369End Function
5370
5371
5372Function FindSubTrackSplit(position)
5373
5374 Dim tmp
5375 For tmp = 2 To Len(position)
5376 If Not IsNumeric(Mid(position, tmp, 1)) Then
5377 FindSubTrackSplit = Left(position, tmp-1)
5378 Exit For
5379 End If
5380 Next
5381
5382End Function
5383
5384
5385Function FindArtist(ArtistList1, ArtistList2)
5386
5387 Dim tmpArtist, i
5388 ReDim newArtistList1(0)
5389 tmpArtist = Split(ArtistList1, ArtistSeparator)
5390 For i = 0 To UBound(tmpArtist)
5391 If InStr(ArtistList2,tmpArtist(i)) = 0 Then
5392 ReDim Preserve newArtistList1(UBound(newArtistList1)+1)
5393 newArtistList1(UBound(newArtistList1)) = tmpArtist(i)
5394 End If
5395 Next
5396 For i = 0 To UBound(newArtistList1)
5397 If FindArtist = "" Then
5398 FindArtist = newArtistList1(i)
5399 Else
5400 FindArtist = FindArtist & ArtistSeparator & newArtistList1(i)
5401 End If
5402 Next
5403
5404End Function
5405
5406
5407Sub Track_from_to (currentTrack, currentArtist, involvedRole, Title_Position, TrackRoles, TrackArtist2, TrackPos, LeadingZeroTrackPosition)
5408
5409 WriteLog "Start Track_from_to"
5410 Dim tmp, tmp4, cnt, ret
5411 Dim StartTrack, EndTrack
5412 WriteLog "currentTrack=" & currentTrack
5413 If InStr(currentTrack, " ") <> 0 Then
5414 WriteLog "Warning: More than one space between the track positions !!!"
5415 Do
5416 If InStr(currentTrack, " ") = 0 Then Exit Do
5417 currentTrack = Replace(currentTrack, " ", " ")
5418 Loop While True
5419 End If
5420 tmp = Split(currentTrack, " to ")
5421
5422 StartTrack = Trim(tmp(0))
5423 EndTrack = trim(tmp(1))
5424 WriteLog "StartTrack=" & StartTrack
5425 WriteLog "EndTrack=" & EndTrack
5426
5427 tmp4 = False
5428
5429 For cnt = 0 To UBound(Title_Position)-1
5430 If Title_Position(cnt) = StartTrack Then
5431 tmp4 = True
5432 End If
5433 If Title_Position(cnt) = EndTrack Then
5434 ReDim Preserve TrackRoles(UBound(TrackRoles)+1)
5435 ReDim Preserve TrackArtist2(UBound(TrackArtist2)+1)
5436 ReDim Preserve TrackPos(UBound(TrackPos)+1)
5437 TrackArtist2(UBound(TrackArtist2)) = currentArtist
5438 TrackRoles(UBound(TrackRoles)) = involvedRole
5439 TrackPos(UBound(TrackPos)) = Title_Position(cnt)
5440 WriteLog "Pos: " & Title_Position(cnt) & " " & currentArtist & " - " & involvedRole
5441 Exit For
5442 End If
5443 If tmp4 = True Then
5444 ReDim Preserve TrackRoles(UBound(TrackRoles)+1)
5445 ReDim Preserve TrackArtist2(UBound(TrackArtist2)+1)
5446 ReDim Preserve TrackPos(UBound(TrackPos)+1)
5447 TrackArtist2(UBound(TrackArtist2)) = currentArtist
5448 TrackRoles(UBound(TrackRoles)) = involvedRole
5449 TrackPos(UBound(TrackPos)) = Title_Position(cnt)
5450 WriteLog "Pos: " & Title_Position(cnt) & " " & currentArtist & " - " & involvedRole
5451 End If
5452 Next
5453
5454 WriteLog "Stop Track_from_to"
5455
5456End Sub
5457
5458Function Remove_CD(TrackPos)
5459
5460 If Left(TrackPos, 2) = "CD" Then
5461 TrackPos = Mid(TrackPos, 3)
5462 End If
5463 If Left(TrackPos, 3) = "DVD" Then
5464 TrackPos = Mid(TrackPos, 4)
5465 End If
5466 If UCase(Left(TrackPos, 6)) = "VIDEO " Then
5467 TrackPos = Mid(TrackPos, 7)
5468 End If
5469 If UCase(Left(TrackPos, 5)) = "VIDEO" Then
5470 TrackPos = Mid(TrackPos, 6)
5471 End If
5472 If UCase(Left(TrackPos, 3)) = "VHS" Then
5473 TrackPos = Mid(TrackPos, 4)
5474 End If
5475 If UCase(Left(TrackPos, 5)) = "VIDEO" Then
5476 TrackPos = Mid(TrackPos, 6)
5477 End If
5478 Return TrackPos
5479
5480End Function
5481
5482
5483Sub Add_Track_Role(currentTrack, currentArtist, involvedRole, TrackRoles, TrackArtist2, TrackPos, LeadingZeroTrackPosition)
5484
5485 Dim tmp4
5486 If InStr(currentTrack, "-") <> 0 Then
5487 tmp4 = Split(currentTrack, "-")
5488 If IsNumeric(tmp4(1)) = True Then
5489 If LeadingZeroTrackPosition = True And tmp4(1) < 10 And Left(tmp4(1), 1) <> "0" Then
5490 currentTrack = tmp4(0) & "-0" & tmp4(1)
5491 End If
5492 End If
5493 End If
5494 If InStr(currentTrack, ".") <> 0 Then
5495 tmp4 = Split(currentTrack, ".")
5496 If IsNumeric(tmp4(1)) = True Then
5497 If LeadingZeroTrackPosition = True And tmp4(1) < 10 And Left(tmp4(1), 1) <> "0" Then
5498 currentTrack = tmp4(0) & ".0" & tmp4(1)
5499 End If
5500 End If
5501 End If
5502 WriteLog "currentTrack=" & currentTrack
5503 currentTrack = exchange_roman_numbers(currentTrack)
5504 ReDim Preserve TrackRoles(UBound(TrackRoles)+1)
5505 ReDim Preserve TrackArtist2(UBound(TrackArtist2)+1)
5506 ReDim Preserve TrackPos(UBound(TrackPos)+1)
5507 TrackArtist2(UBound(TrackArtist2)) = currentArtist
5508 TrackRoles(UBound(TrackRoles)) = involvedRole
5509 TrackPos(UBound(TrackPos)) = currentTrack
5510
5511End Sub
5512
5513
5514' ShowResult is called every time the search result is changed from the drop
5515' down at the top of the window
5516Sub ShowResult(ResultID)
5517
5518 Dim ReleaseID, searchURL, oXMLHTTP, ResponseHTML, Title, SelectedTracks, searchURL_F, searchURL_L, i
5519 For i = 0 to 999
5520 UnselectedTracks(i) = ""
5521 UnselectedTrackNames(i) = ""
5522 Next
5523 SDB.Tools.WebSearch.ClearTracksData
5524 NewResult = True
5525 WebBrowser.SetHTMLDocument "" ' Deletes visible search result
5526 If ResultsReleaseID.Item(ResultID) = "" Then Exit Sub
5527 Dim json
5528 Set json = New VbsJson
5529 CurrentResultId = ResultID
5530
5531 If QueryPage = "MetalArchives" Then
5532 searchURL = ResultsReleaseID.Item(ResultID)
5533 Set oXMLHTTP = CreateObject("MSXML2.XMLHTTP.6.0")
5534 Call oXMLHTTP.open("GET", searchURL, False)
5535 Call oXMLHTTP.send()
5536 If oXMLHTTP.Status = 200 Then
5537 CurrentRelease = oXMLHTTP.responseText
5538 ReloadResults
5539 End If
5540 End If
5541
5542
5543 ' http://musicbrainz.org/ws/2/release/e3b950f4-cc3b-3f84-b80f-2c254ffd956f?inc=recordings+recording-level-rels+work-rels+work-level-rels+artist-rels+artist-credits+media+release-group-rels+release-groups+labels&fmt=json
5544 If QueryPage = "MusicBrainz" Then
5545
5546 WriteLog "+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-"
5547 WriteLog "Start ShowResult MusicBrainz"
5548 ReleaseID = ResultsReleaseID.Item(ResultID)
5549 WriteLog "ReleaseID=" & ReleaseID
5550 If InStr(Results.Item(ResultID), "No Release found") = 0 Then
5551 searchURL = "http://musicbrainz.org/ws/2/release/" & ReleaseID & "?inc=recordings+recording-level-rels+work-rels+work-level-rels+artist-rels+artist-credits+media+release-group-rels+release-groups+labels&fmt=json"
5552 WriteLog "searchURL=" & searchURL
5553
5554 Set oXMLHTTP = CreateObject("MSXML2.ServerXMLHTTP.6.0")
5555 oXMLHTTP.Open "GET", searchURL, False
5556 oXMLHTTP.setRequestHeader "Content-Type", "application/json"
5557 oXMLHTTP.setRequestHeader "User-Agent",UserAgent
5558 oXMLHTTP.send ()
5559
5560 If oXMLHTTP.Status = 200 Then
5561 WriteLog "responseText=" & oXMLHTTP.responseText
5562 Set CurrentRelease = json.Decode(oXMLHTTP.responseText)
5563 CurrentReleaseId = ReleaseID
5564 ReloadResults
5565 ElseIf oXMLHTTP.Status = 503 Then
5566 ErrorMessage = "Status:" & oXMLHTTP.Status & " - The number of requests exceeds the limit. Please try again later"
5567 WriteLog "Status=" & oXMLHTTP.Status
5568 FormatErrorMessage ErrorMessage
5569 Else
5570 ErrorMessage = "Status:" & oXMLHTTP.Status & " - Please try again later"
5571 WriteLog "Status=" & oXMLHTTP.Status
5572 FormatErrorMessage ErrorMessage
5573 End If
5574 Else
5575 ErrorMessage = "Search returned no results / No Release found"
5576 FormatErrorMessage ErrorMessage
5577 End If
5578 End If
5579
5580
5581
5582 If QueryPage = "Discogs" Then
5583
5584 WriteLog "+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-"
5585 WriteLog "Start ShowResult Discogs"
5586 ReleaseID = ResultsReleaseID.Item(ResultID)
5587 WriteLog "ReleaseID=" & ReleaseID
5588
5589 Set GenresSelect = SDB.NewStringList
5590
5591 If InStr(Results.Item(ResultID), "search returned no results") = 0 And InStr(Results.Item(ResultID), "No Release found") = 0 Then
5592 If InStr(Results.Item(ResultID), " * ") <> 0 Or Right(Results.Item(ResultID), 8) = "(Master)" Then 'Master-Release
5593 searchURL_F = "https://api.discogs.com/masters/"
5594 WriteLog "Show Master-Release"
5595 Else
5596 searchURL_F = "https://api.discogs.com/releases/"
5597 End If
5598 searchURL = ReleaseID
5599 searchURL_L = ""
5600
5601 Set oXMLHTTP = CreateObject("MSXML2.XMLHTTP.6.0")
5602 oXMLHTTP.open "POST", "https://www.germanc64.de/mm/oauth/check_new.php", False
5603 oXMLHTTP.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
5604 oXMLHTTP.setRequestHeader "User-Agent",UserAgent
5605 WriteLog "Sending Post at=" & AccessToken & "&ats=" & AccessTokenSecret & "&searchURL=" & searchURL & "&searchURL_F=" & searchURL_F & "&searchURL_L=" & searchURL_L & "&version=" & VersionStr
5606 oXMLHTTP.send("at=" & AccessToken & "&ats=" & AccessTokenSecret & "&searchURL=" & searchURL & "&searchURL_F=" & searchURL_F & "&searchURL_L=" & searchURL_L & "&version=" & VersionStr)
5607
5608 If oXMLHTTP.Status = 200 Then
5609 WriteLog "responseText=" & oXMLHTTP.responseText
5610 If InStr(oXMLHTTP.responseText, "OAuth client error") <> 0 Then
5611 ErrorMessage = oXMLHTTP.responseText
5612 FormatErrorMessage ErrorMessage
5613 Else
5614 Set CurrentRelease = json.Decode(oXMLHTTP.responseText)
5615 CurrentReleaseId = ReleaseID
5616 Set oXMLHTTP = Nothing
5617 ReloadResults
5618 End If
5619 End If
5620 Else
5621 ErrorMessage = "Search returned no results / No Release found"
5622 FormatErrorMessage ErrorMessage
5623 End If
5624 End If
5625
5626End Sub
5627
5628
5629' This does the final clean up, so that our script doesn't leave any unwanted traces
5630Sub FinishSearch(Panel)
5631
5632 If isObject(WebBrowser) Then
5633 WebBrowser.Common.DestroyControl ' Destroy the external control
5634 Set WebBrowser = Nothing ' Release global variable
5635 SDB.Objects("WebBrowser") = Nothing
5636 End If
5637
5638 Set ini = Nothing
5639 If isObject(ResultsReleaseID) Then
5640 Set ResultsReleaseID = Nothing
5641 End If
5642 Script.UnregisterAllEvents
5643
5644End Sub
5645
5646
5647Sub SaveMoreImagesSub()
5648
5649 Dim ret, res, RndFileName, i, itm, path, j, k, ImageSelected, SongList
5650 If ImageList.Count > 0 Then
5651 ImageSelected = False
5652 For i = 0 to ImageList.Count - 1
5653 If SaveImage.Item(i) = 1 Then ImageSelected = True
5654 Next
5655 If ImageSelected = True Then
5656 For i = 0 to ImageList.Count - 1
5657 res = 0
5658 If SaveImage.Item(i) = 1 Then
5659 Set itm = SelectedSongsGlobal.item(0)
5660 path = Mid(itm.Path,1,InStrRev(itm.Path,"\")-1)
5661 If CoverStorage = 1 Or CoverStorage = 3 Then
5662 If SDB.Tools.FileSystem.FileExists(path & "\" & FileNameList.Item(i)) = True Then
5663 res = SDB.MessageBox("The file " & FileNameList.Item(i) & " already exist. Overwrite it ?", mtConfirmation, Array(mbYes, mbNo))
5664 If res = 6 Then
5665 SDB.Tools.FileSystem.DeleteFile(path & "\" & FileNameList.Item(i))
5666 ret = SDB.Tools.FileSystem.MoveFile(ImageLocal.Item(i), path & "\" & FileNameList.Item(i))
5667 If ret = False Then
5668 WriteLog "ERROR:Image could not moved to : " & path & "\" & FileNameList.Item(i)
5669 SDB.MessageBox "ERROR:Image could not moved !", mtError, Array(mbOk)
5670 End If
5671 End If
5672 Else
5673 ret = SDB.Tools.FileSystem.MoveFile(ImageLocal.Item(i), path & "\" & FileNameList.Item(i))
5674 If ret = False Then
5675 WriteLog "ERROR:Image could not moved to : " & path & "\" & FileNameList.Item(i)
5676 SDB.MessageBox "ERROR:Image could not moved !", mtError, Array(mbOk)
5677 End If
5678 End If
5679 End If
5680
5681 If res <> 7 Then 'don't overwrite file
5682 Set SongList = SDB.SelectedSongList
5683 For j = 0 To SongList.Count - 1
5684 Set itm = SongList.item(j)
5685 Dim pics : Set pics = itm.AlbumArt
5686 If pics Is Nothing Then
5687 Exit Sub
5688 End If
5689 Dim img
5690 Set img = pics.AddNew
5691 img.Description = ""
5692
5693 If CoverStorage = 1 Or CoverStorage = 3 Then
5694 img.PicturePath = path & "\" & FileNameList.Item(i)
5695 img.ItemStorage = 1
5696 Else
5697 img.PicturePath = ImageLocal.Item(i)
5698 img.ItemStorage = 0
5699 End If
5700 For k = 0 to ImageTypeList.Count - 1
5701 If SaveImageType.Item(i) = ImageTypeList.Item(k) Then
5702 If k = 0 Then k = -2
5703 If k > 14 Then k = k + 1
5704 img.ItemType = k + 2
5705 pics.UpdateDB
5706 Exit For
5707 End If
5708 Next
5709
5710 If CoverStorage = 3 Then
5711 Set pics = itm.AlbumArt
5712 Set img = pics.AddNew
5713 img.Description = ""
5714 img.PicturePath = path & "\" & FileNameList.Item(i)
5715 img.ItemStorage = 0
5716 For k = 0 to ImageTypeList.Count - 1
5717 If SaveImageType.Item(i) = ImageTypeList.Item(k) Then
5718 If k = 0 Then k = -2
5719 If k > 14 Then k = k + 1
5720 img.ItemType = k + 2
5721 Exit For
5722 End If
5723 Next
5724 End If
5725 Next
5726 End If
5727 If CoverStorage = 0 Then
5728 SDB.Tools.FileSystem.DeleteFile(ImageLocal.Item(i))
5729 End If
5730 End If
5731 Next
5732 End If
5733 End If
5734
5735End Sub
5736
5737
5738Function GetHeader()
5739
5740 Dim templateHTML, i, QueryPageList(3)
5741 templateHTML = "<HTML>"
5742 templateHTML = templateHTML & "<HEAD>"
5743 templateHTML = templateHTML & "<style type=""text/css"" media=""screen"">"
5744 templateHTML = templateHTML & ".tabletext { font-family: Arial, Helvetica, sans-serif; font-size: 8pt;}"
5745 templateHTML = templateHTML & "option.tabletext{background-color:#3E7CBB;}"
5746
5747 templateHTML = templateHTML & "</style>"
5748 templateHTML = templateHTML & "</HEAD>"
5749 templateHTML = templateHTML & "<body bgcolor=""#FFFFFF"">"
5750 templateHTML = templateHTML & "<table border=0 width=100% cellspacing=0 cellpadding=1 class=tabletext>"
5751 templateHTML = templateHTML & "<tr>"
5752 If QueryPage = "Discogs" Then
5753 templateHTML = templateHTML & "<td align=left><a href=""https://www.discogs.com"" target=""_blank""><img src=""https://www.germanc64.de/mm/i-love-discogs.png"" width=""100"" height=""60"" border=""0"" alt=""Discogs Homepage""></a><b>" & VersionStr & "</b></td>"
5754 End If
5755 If QueryPage = "MusicBrainz" Then
5756 templateHTML = templateHTML & "<td align=left><a href=""https://www.musicbrainz.org"" target=""_blank""><img src=""https://wiki.musicbrainz.org/-/images/e/e4/MusicBrainz_Logo_White.png"" width=""100"" height=""70"" border=""0""/ alt=""MusicBrainz Homepage""></a><b>" & VersionStr & "</b></td>"
5757 End If
5758 If QueryPage = "MetalArchives" Then
5759 templateHTML = templateHTML & "<td align=left><a href=""https://www.metal-archives.com"" target=""_blank""><img src=""https://www.metal-archives.com/css/default/images/smallerlogo.jpg"" width=""200"" height=""60"" border=""0""/ alt=""MusicBrainz Homepage""></a><b>" & VersionStr & "</b></td>"
5760 End If
5761
5762 templateHTML = templateHTML & "<td colspan=3 align=right valign=top>"
5763
5764 templateHTML = templateHTML & "<table border=0 cellspacing=0 cellpadding=2 class=tabletext>"
5765 REM templateHTML = templateHTML & "<tr><td colspan=5></td><td><b>Filter Results: </b></td><td colspan=3> </td></tr>"
5766 If QueryPage = "MetalArchives" Then
5767 templateHTML = templateHTML & "<tr><td colspan=4></td><td><button type=button class=tabletext id=""showadvancedsearch"">Manual Search</button></td><td colspan=2><b>Filter Results: Filter aren't working with MetalArchives!</b></td><td colspan=2> </td>"
5768 Else
5769 templateHTML = templateHTML & "<tr><td colspan=3></td><td align=center><img src=""" & SDB.ScriptsPath & "question-mark.png"" alt=""Click here for Help !"" id=""picture""></td><td><button type=button class=tabletext id=""showadvancedsearch"">Manual Search</button></td><td><b>Filter Results: </b></td><td colspan=3> </td>"
5770 End If
5771 REM <td align=right><img src=""" & SDB.ScriptsPath & "question-mark.png"" alt=""Click here for Help !"" id=""picture""></td></tr>"
5772 REM templateHTML = templateHTML & "<tr><td colspan=3></td><td colspan=2>Search for:<input type=radio id=""searchartist"" name=""SearchFor"" title=""Enter search string in upper dropdown-field and choose what to search for"" value=""Artist"">Artist<input type=radio id=""searchalbum"" name=""SearchFor"" title=""Enter search string in upper dropdown-field and choose what to search for"" value=""Album"">Album<input type=radio id=""searchrelease"" name=""SearchFor"" title=""Enter search string in upper drop-down field and choose what to search for"" value=""Release"">Release</td><td><b>Filter Results: </b></td><td colspan=3> </td></tr>"
5773 templateHTML = templateHTML & "<tr>"
5774 templateHTML = templateHTML & "<td><b></b></td>"
5775 templateHTML = templateHTML & "<td><b> </b></td>"
5776 templateHTML = templateHTML & "<td><b> </b></td>"
5777 templateHTML = templateHTML & "<td><b>Load:</b></td>"
5778 If QueryPage <> "MetalArchives" Then
5779 templateHTML = templateHTML & "<td><b>Quick Search:</b></td>"
5780 Else
5781 templateHTML = templateHTML & "<td></td>"
5782 End If
5783 templateHTML = templateHTML & "<td align=left><button type=button class=tabletext id=""showmediatypefilter"">Set Type Filter</button></td>"
5784 templateHTML = templateHTML & "<td align=left><button type=button class=tabletext id=""showmediaformatfilter"">Set Format Filter</button></td>"
5785 templateHTML = templateHTML & "<td align=left><button type=button class=tabletext id=""showyearfilter"">Set Year Filter</button></td>"
5786 templateHTML = templateHTML & "<td align=left><button type=button class=tabletext id=""showcountryfilter"">Set Country Filter</button></td>"
5787 templateHTML = templateHTML & "</tr>"
5788 templateHTML = templateHTML & "<tr>"
5789 templateHTML = templateHTML & "<td>"
5790 REM templateHTML = templateHTML & "<select id=""searchpage"" class=tabletext >"
5791
5792 QueryPageList(0) = "Search at Discogs"
5793 QueryPageList(1) = "Search at MusicBrainz"
5794 Rem QueryPageList(2) = "Search at MetalArchives"
5795
5796 REM For i = 0 To 1
5797 REM If QueryPage <> Mid(QueryPageList(i), 11) Then
5798 REM templateHTML = templateHTML & "<option value=""" & QueryPageList(i) & """>" & QueryPageList(i) & "</option>"
5799 REM Else
5800 REM templateHTML = templateHTML & "<option value=""" & QueryPageList(i) & """ selected>" & QueryPageList(i) & "</option>"
5801 REM End If
5802 REM Next
5803 REM templateHTML = templateHTML & "</select>"
5804 templateHTML = templateHTML & "</td>"
5805 templateHTML = templateHTML & "<td> </td>"
5806 templateHTML = templateHTML & "<td> </td>"
5807 templateHTML = templateHTML & "<td>"
5808 templateHTML = templateHTML & "<select id=""load"" class=tabletext title=""Search Result=Search with Artist and Album Title" & vbCrLf & "Master Release=Show master of selected release" & vbCrLf & "Versions of Master=Show all releases of selected master" & vbCrLf & "Releases of Artist=Show all releases of selected artist" & vbCrLf & "Releases of Label=Show all releases of selected label"">"
5809
5810 For i = 0 To LoadList.Count - 1
5811 If LoadList.Item(i) <> CurrentLoadType Then
5812 templateHTML = templateHTML & "<option value=""" & EncodeHtmlChars(LoadList.Item(i)) & """>" & LoadList.Item(i) & "</option>"
5813 Else
5814 templateHTML = templateHTML & "<option value=""" & EncodeHtmlChars(LoadList.Item(i)) & """ selected>" & LoadList.Item(i) & "</option>"
5815 End If
5816 Next
5817 templateHTML = templateHTML & "</select>"
5818 templateHTML = templateHTML & "</td>"
5819 'Alternative Searches Begin
5820 If QueryPage <> "MetalArchives" Then
5821 templateHTML = templateHTML & "<td>"
5822 templateHTML = templateHTML & "<select id=""alternative"" class=tabletext>"
5823 For i = 0 To AlternativeList.Count - 1
5824 If AlternativeList.Item(i) <> NewSearchTerm Then
5825 templateHTML = templateHTML & "<option value=""" & EncodeHtmlChars(AlternativeList.Item(i)) & """>" & AlternativeList.Item(i) & "</option>"
5826 Else
5827 templateHTML = templateHTML & "<option value=""" & EncodeHtmlChars(AlternativeList.Item(i)) & """ selected>" & AlternativeList.Item(i) & "</option>"
5828 End If
5829 Next
5830 templateHTML = templateHTML & "</select>"
5831 templateHTML = templateHTML & "</td>"
5832 Else
5833 templateHTML = templateHTML & "<td>"
5834 templateHTML = templateHTML & "</td>"
5835 End If
5836 'Alternative Searches End
5837 'Filters Begin
5838 templateHTML = templateHTML & "<td>"
5839 templateHTML = templateHTML & "<select id=""filtermediatype"" class=tabletext>"
5840
5841 If FilterMediaType = "None" Then
5842 templateHTML = templateHTML & "<option value=""None"">No MediaType Filter</option>"
5843 templateHTML = templateHTML & "<option style=""background-color:#F4113F;"" value=""Use MediaType Filter"">Use MediaType Filter</option>"
5844 ElseIf FilterMediaType = "Use MediaType Filter" Then
5845 templateHTML = templateHTML & "<option style=""background-color:#F4113F;"" value=""Use MediaType Filter"">Use MediaType Filter</option>"
5846 templateHTML = templateHTML & "<option value=""None"">No MediaType Filter</option>"
5847 End If
5848 If FilterMediaType <> "None" And FilterMediaType <> "Use MediaType Filter" Then
5849 templateHTML = templateHTML & "<option value=""None"">No MediaType Filter</option>"
5850 templateHTML = templateHTML & "<option value=""Use MediaType Filter"">Use MediaType Filter</option>"
5851 End If
5852 For i = 1 To MediaTypeList.Count - 1
5853 If FilterMediaType <> MediaTypeList.Item(i) Or FilterMediaType = "None" Or FilterMediaType = "Use MediaType Filter" Then
5854 templateHTML = templateHTML & "<option value=""" & EncodeHtmlChars(MediaTypeList.Item(i)) & """>" & MediaTypeList.Item(i) & "</option>"
5855 Else
5856 templateHTML = templateHTML & "<option value=""" & EncodeHtmlChars(MediaTypeList.Item(i)) & """ selected>" & MediaTypeList.Item(i) & "</option>"
5857 End If
5858 Next
5859 templateHTML = templateHTML & "</select>"
5860 templateHTML = templateHTML & "</td>"
5861
5862 templateHTML = templateHTML & "<td>"
5863 templateHTML = templateHTML & "<select id=""filtermediaformat"" class=tabletext>"
5864
5865 If FilterMediaFormat = "None" Then
5866 templateHTML = templateHTML & "<option value=""None"">No MediaFormat Filter</option>"
5867 templateHTML = templateHTML & "<option style=""background-color:#F4113F;"" value=""Use MediaFormat Filter"">Use MediaFormat Filter</option>"
5868 ElseIf FilterMediaFormat = "Use MediaFormat Filter" Then
5869 templateHTML = templateHTML & "<option style=""background-color:#F4113F;"" value=""Use MediaFormat Filter"">Use MediaFormat Filter</option>"
5870 templateHTML = templateHTML & "<option value=""None"">No MediaFormat Filter</option>"
5871 End If
5872 If FilterMediaFormat <> "None" And FilterMediaFormat <> "Use MediaFormat Filter" Then
5873 templateHTML = templateHTML & "<option value=""None"">No MediaFormat Filter</option>"
5874 templateHTML = templateHTML & "<option value=""Use MediaFormat Filter"">Use MediaFormat Filter</option>"
5875 End If
5876 For i = 1 To MediaFormatList.Count - 1
5877 If FilterMediaFormat <> MediaFormatList.Item(i) Or FilterMediaFormat = "None" Or FilterMediaFormat = "Use MediaFormat Filter" Then
5878 templateHTML = templateHTML & "<option value=""" & EncodeHtmlChars(MediaFormatList.Item(i)) & """>" & MediaFormatList.Item(i) & "</option>"
5879 Else
5880 templateHTML = templateHTML & "<option value=""" & EncodeHtmlChars(MediaFormatList.Item(i)) & """ selected>" & MediaFormatList.Item(i) & "</option>"
5881 End If
5882 Next
5883 templateHTML = templateHTML & "</select>"
5884 templateHTML = templateHTML & "</td>"
5885
5886 templateHTML = templateHTML & "<td>"
5887 templateHTML = templateHTML & "<select id=""filteryear"" class=tabletext>"
5888
5889 If FilterYear = "None" Then
5890 templateHTML = templateHTML & "<option value=""None"" selected>No Year Filter</option>"
5891 templateHTML = templateHTML & "<option style=""background-color:#F4113F;"" value=""Use Year Filter"">Use Year Filter</option>"
5892 ElseIf FilterYear = "Use Year Filter" Then
5893 templateHTML = templateHTML & "<option style=""background-color:#F4113F;"" value=""Use Year Filter"" selected>Use Year Filter</option>"
5894 templateHTML = templateHTML & "<option value=""None"">No Year Filter</option>"
5895 End If
5896 If FilterYear <> "None" And FilterYear <> "Use Year Filter" Then
5897 templateHTML = templateHTML & "<option value=""None"">No Year Filter</option>"
5898 templateHTML = templateHTML & "<option value=""Use Year Filter"">Use Year Filter</option>"
5899 End If
5900 For i = 1 To YearList.Count - 1
5901 If FilterYear <> YearList.Item(i) Or FilterYear = "None" Or FilterYear = "Use Year Filter" Then
5902 templateHTML = templateHTML & "<option value=""" & EncodeHtmlChars(YearList.Item(i)) & """>" & YearList.Item(i) & "</option>"
5903 Else
5904 templateHTML = templateHTML & "<option value=""" & EncodeHtmlChars(YearList.Item(i)) & """ selected>" & YearList.Item(i) & "</option>"
5905 End If
5906 Next
5907
5908 templateHTML = templateHTML & "</select>"
5909 templateHTML = templateHTML & "</td>"
5910
5911 templateHTML = templateHTML & "<td>"
5912 templateHTML = templateHTML & "<select id=""filtercountry"" class=tabletext>"
5913
5914 If FilterCountry = "None" Then
5915 templateHTML = templateHTML & "<option value=""None"">No Country Filter</option>"
5916 templateHTML = templateHTML & "<option style=""background-color:#F4113F;"" value=""Use Country Filter"">Use Country Filter</option>"
5917 ElseIf FilterCountry = "Use Country Filter" Then
5918 templateHTML = templateHTML & "<option style=""background-color:#F4113F;"" value=""Use Country Filter"">Use Country Filter</option>"
5919 templateHTML = templateHTML & "<option value=""None"">No Country Filter</option>"
5920 End If
5921 If FilterCountry <> "None" And FilterCountry <> "Use Country Filter" Then
5922 templateHTML = templateHTML & "<option value=""None"">No Country Filter</option>"
5923 templateHTML = templateHTML & "<option value=""Use Country Filter"">Use Country Filter</option>"
5924 End If
5925 For i = 1 To CountryList.Count - 1
5926 If FilterCountry <> CountryList.Item(i) Or FilterCountry = "None" Or FilterCountry = "Use Country Filter" Then
5927 templateHTML = templateHTML & "<option value=""" & EncodeHtmlChars(CountryList.Item(i)) & """>" & CountryList.Item(i) & "</option>"
5928 Else
5929 templateHTML = templateHTML & "<option value=""" & EncodeHtmlChars(CountryList.Item(i)) & """ selected=""selected"">" & CountryList.Item(i) & "</option>"
5930 End If
5931 Next
5932
5933 templateHTML = templateHTML & "</select>"
5934 templateHTML = templateHTML & "</td>"
5935 'Filters End
5936 templateHTML = templateHTML & "</tr>"
5937 templateHTML = templateHTML & "</table>"
5938 templateHTML = templateHTML & "</td>"
5939 templateHTML = templateHTML & "</tr>"
5940
5941 GetHeader = templateHTML
5942
5943End Function
5944
5945
5946Function GetFooter()
5947
5948 Dim templateHTML
5949 templateHTML = templateHTML & "</table>"
5950 templateHTML = templateHTML & "</body>"
5951 templateHTML = templateHTML & "</HTML>"
5952
5953 GetFooter = templateHTML
5954
5955End Function
5956
5957
5958
5959' We use this procedure to reformat results as soon as they are downloaded
5960Sub FormatSearchResultsViewer(Tracks, TracksNum, TracksCD, Durations, AlbumArtist, AlbumArtistTitle, ArtistTitles, AlbumTitle, ReleaseDate, OriginalDate, GenresList, theLabels, theCountry, AlbumArtThumbNail, releaseID, Catalog, Lyricists, Composers, Conductors, Producers, InvolvedArtists, theFormat, theMaster, comment, DiscogsTracksNum, DataQuality, Grouping)
5961
5962 Dim templateHTML, checkBox, radio, text, listBox, submitButton, tmp
5963 Dim SelectedTracksCount, UnSelectedTracksCount
5964 Dim SubTrackFlag
5965 Dim i, theGenres
5966 templateHTML = ""
5967 templateHTML = templateHTML & GetHeader()
5968
5969 ' Titles Begin
5970 templateHTML = templateHTML & "<tr>"
5971 templateHTML = templateHTML & "<td align=left bgcolor=""#CCCCCC""><b>Album Art:</b></td>"
5972 templateHTML = templateHTML & "<td align=left bgcolor=""#CCCCCC""><b>Release Information:</b></td>"
5973 templateHTML = templateHTML & "<td align=left bgcolor=""#CCCCCC""><b>Tracklisting:</b></td>"
5974 templateHTML = templateHTML & "</tr>"
5975 ' Titles End
5976 templateHTML = templateHTML & "<tr>"
5977 ' Release Cover Begin
5978 templateHTML = templateHTML & "<td align=left valign=top>"
5979 templateHTML = templateHTML & "<table border=0 cellspacing=0 cellpadding=1 class=tabletext>"
5980 If AlbumArtThumbNail <> "" Then
5981 If QueryPage = "Discogs" Then
5982 templateHTML = templateHTML & "<tr><td colspan=2><a href=""https://www.discogs.com/viewimages?release=<!RELEASEID!>"" target=""_blank""><img src=""<!COVER!>"" border=""0""/></a></td></tr>"
5983 ElseIf QueryPage = "MusicBrainz" Then
5984 templateHTML = templateHTML & "<tr><td colspan=2><img src=""<!COVER!>"" alt="""" border=""0""></a></td></tr>"
5985 ElseIf QueryPage = "MetalArchives" Then
5986 templateHTML = templateHTML & "<tr><td colspan=2><img src=""<!COVER!>"" alt="""" border=""0"" width=""200"" height=""200""></a></td></tr>"
5987 End If
5988 Else
5989 templateHTML = templateHTML & "<tr><td colspan=2><table width=150 height=150 border=1><tr><td><center>No Image<br>Available</center></td></tr></table></td></tr>"
5990 End If
5991 templateHTML = templateHTML & "<tr><td colspan=2 align=center><button type=button class=tabletext id=""applyfrontcover"" title=""Store the image in the files"">Apply Front Cover</button></td></tr>"
5992 'templateHTML = templateHTML & "<tr><td colspan=2 align=left><input type=checkbox id=""checkcover"" >Save Cover</td></tr>"
5993 If ImagesCount > 1 Then
5994 templateHTML = templateHTML & "<tr><td colspan=2 align=center><button type=button class=tabletext id=""moreimages"" title=""Use this button if you like to store more images (leaflet page, media label)"">More Images</button></td></tr>"
5995 End If
5996 templateHTML = templateHTML & "<tr><td colspan=2 align=center><br></td></tr>"
5997 ' Release Cover End
5998
5999 ' Options Begin
6000 templateHTML = templateHTML & "<tr><td colspan=2 align=center><button type=button class=tabletext id=""saveoptions"" title=""Use this button to save the options you set"" >Save Options</button></td></tr>"
6001
6002 templateHTML = templateHTML & "<tr><td colspan=2 align=center><button type=button class=tabletext id=""optionsform"" title=""Use this button to set tagging options"" >Tagging Options</button></td></tr>"
6003
6004 templateHTML = templateHTML & "<tr><td align=center colspan=2><b>Options:</b></td></tr>"
6005
6006 REM templateHTML = templateHTML & "<tr><td colspan=2 align=left><input type=checkbox id=""usercollection"" title=""If checked the tagged album will be added to the User Collection at Discogs"" >Add album to User Collection</td></tr>"
6007 If QueryPage = "Discogs" Then
6008 templateHTML = templateHTML & "<tr><td colspan=2 align=center><button type=button class=tabletext id=""usercollection"" title=""Use this button to add the selected album to your collection at Discogs"">Add to User Collection</button></td></tr>"
6009 End If
6010 If QueryPage <> "MetalArchives" Then
6011 templateHTML = templateHTML & "<tr><td colspan=2 align=left><input type=checkbox id=""lyricist"" title=""If a lyricist was named in the release, it will be written into the lyricist tag"" >Save Lyricist</td></tr>"
6012 templateHTML = templateHTML & "<tr><td colspan=2 align=left><input type=checkbox id=""composer"" title=""If a composer was named in the release, it will be written into the composer tag"" >Save Composer</td></tr>"
6013 templateHTML = templateHTML & "<tr><td colspan=2 align=left><input type=checkbox id=""conductor"" title=""If a conductor was named in the release, it will be written into the conductor tag"" >Save Conductor</td></tr>"
6014 templateHTML = templateHTML & "<tr><td colspan=2 align=left><input type=checkbox id=""producer"" title=""If a producer was named in the release, it will be written into the producer tag"" >Save Producer</td></tr>"
6015 templateHTML = templateHTML & "<tr><td colspan=2 align=left><input type=checkbox id=""involved"" title=""If other involved people were named in the release, their will be written into the involved people tag"" >Save Involved People</td></tr>"
6016 End If
6017 templateHTML = templateHTML & "<tr><td colspan=2 align=left><input type=checkbox id=""grouping"" title=""If tracks are grouped together with heading tracks, the name of it will be add to the grouping tag"" >Save grouping info</td></tr>"
6018 If trackRefresh = True Then
6019 templateHTML = templateHTML & "<tr><td colspan=2 align=center><button type=button class=tabletext id=""refresh"" title=""Use this button to start/stop refreshing the track list after de-/select a track. Use it to de-select some tracks without waiting for refresh"">Stop track refresh</button></td></tr>"
6020 Else
6021 templateHTML = templateHTML & "<tr><td colspan=2 align=center><button type=button class=tabletext id=""refresh"" title=""Use this button to start/stop refreshing the track list after de-/select a track. Use it to de-select some tracks without waiting for refresh"">Start track refresh</button></td></tr>"
6022 End If
6023 templateHTML = templateHTML & "<tr><td colspan=2 align=center><button type=button class=tabletext id=""deselectall"" title=""Use this button to deselect all"">Deselect all</button></td></tr>"
6024
6025 templateHTML = templateHTML & "<tr><td colspan=2 align=center><br></td></tr>"
6026
6027 templateHTML = templateHTML & "</table>"
6028 templateHTML = templateHTML & "</td>"
6029 ' Options End
6030
6031 ' Release Information Begin
6032 templateHTML = templateHTML & "<td align=left valign=top>"
6033 templateHTML = templateHTML & "<table border=0 cellspacing=0 cellpadding=1 class=tabletext>"
6034
6035 iMaxTracks = Tracks.Count
6036 If TracksCD.Count < iMaxTracks Then
6037 iMaxTracks = TracksCD.Count
6038 End If
6039
6040 'Check for different Track number
6041 SelectedTracksCount = 0
6042 UnSelectedTracksCount = 0
6043 SubTrackFlag = False
6044 For i = 0 To iMaxTracks - 1
6045 If (UnselectedTracks(i) = "") Then
6046 If instr(DiscogsTracksNum.Item(i), ".") <> 0 Then
6047 If SubTrackFlag = False Then
6048 SubTrackFlag = True
6049 SelectedTracksCount = SelectedTracksCount + 1
6050 End If
6051 Else
6052 If SubTrackFlag = True Then SubTrackFlag = False
6053 SelectedTracksCount = SelectedTracksCount + 1
6054 End If
6055 Else
6056 UnSelectedTracksCount = UnSelectedTracksCount + 1
6057 End If
6058 Next
6059 If (iMaxTracks - UnSelectedTracksCount) <> SDB.Tools.WebSearch.NewTracks.Count Then
6060 DiffNumberTracks = True
6061 templateHTML = templateHTML & "<tr><td colspan=3 align=center><b><span style=""color:#FF0000"">There are different numbers of tracks !</span></b></td></tr>"
6062 templateHTML = templateHTML & "<tr><td colspan=3 align=center><br></td></tr>"
6063 Else
6064 DiffNumberTracks = False
6065 End If
6066
6067 templateHTML = templateHTML & "<tr>"
6068 If QueryPage <> "MetalArchives" Then
6069 templateHTML = templateHTML & "<td><input type=checkbox id=""releaseid"" title=""if set, the release number will be written in a custom tag. You can change the target tag in Tools->Options->Discogs Tagger. If Release-Number saved, the Tagger automatically load next time this release from discogs for the selected files"" ></td>"
6070 templateHTML = templateHTML & "<td>Release:</td>"
6071 Else
6072 templateHTML = templateHTML & "<td></td>"
6073 templateHTML = templateHTML & "<td></td>"
6074 End If
6075 If InStr(Results.Item(CurrentResultId), " * ") <> 0 Or Right(Results.Item(CurrentResultId), 8) = "(Master)" Then
6076 templateHTML = templateHTML & "<td>N/A</a> (Master: <a href=""https://www.discogs.com/master/<!RELEASEID!>"" target=""_blank""><!RELEASEID!></a>)</td>"
6077 ElseIf (theMaster <> "") Then
6078 templateHTML = templateHTML & "<td><a href=""https://www.discogs.com/release/<!RELEASEID!>"" target=""_blank""><!RELEASEID!></a> (Master: <a href=""https://www.discogs.com/master/<!MASTERID!>"" target=""_blank""><!MASTERID!></a>)</td>"
6079 Else
6080 If QueryPage = "Discogs" Then
6081 templateHTML = templateHTML & "<td><a href=""https://www.discogs.com/release/<!RELEASEID!>"" target=""_blank""><!RELEASEID!></a> (Master: N/A)</td>"
6082 ElseIf QueryPage = "MusicBrainz" Then
6083 templateHTML = templateHTML & "<td><a href=""http://www.musicbrainz.org/release/<!RELEASEID!>"" target=""_blank""><!RELEASEID!></a> (Master: N/A)</td>"
6084 End If
6085 End If
6086 templateHTML = templateHTML & "</tr>"
6087 templateHTML = templateHTML & "<tr>"
6088 templateHTML = templateHTML & "<td><input type=checkbox id=""artist"" ></td>"
6089 templateHTML = templateHTML & "<td>Artist:</td>"
6090 If QueryPage = "Discogs" Then
6091 templateHTML = templateHTML & "<td><a href=""https://www.discogs.com/artist/" & SavedArtistID & """ target=""_blank""><!ARTIST!></a></td>"
6092 ElseIf QueryPage = "MusicBrainz" Then
6093 templateHTML = templateHTML & "<td><a href=""http://www.musicbrainz.org/artist/" & SavedArtistID & """ target=""_blank""><!ARTIST!></a></td>"
6094 ElseIf QueryPage = "MetalArchives" Then
6095 templateHTML = templateHTML & "<td><!ARTIST!></td>"
6096 End If
6097 templateHTML = templateHTML & "</tr>"
6098 templateHTML = templateHTML & "<tr>"
6099 templateHTML = templateHTML & "<td><input type=checkbox id=""album"" title=""Store the album name in the album-tag"" ></td>"
6100 templateHTML = templateHTML & "<td>Album:</td>"
6101 If QueryPage = "Discogs" Then
6102 templateHTML = templateHTML & "<td><a href=""https://www.discogs.com/release/<!RELEASEID!>"" target=""_blank""><!ALBUMTITLE!></a></td>"
6103 ElseIf QueryPage = "MusicBrainz" Then
6104 templateHTML = templateHTML & "<td><a href=""http://www.musicbrainz.org/release/<!RELEASEID!>"" target=""_blank""><!ALBUMTITLE!></a></td>"
6105 ElseIf QueryPage = "MetalArchives" Then
6106 templateHTML = templateHTML & "<td><!ALBUMTITLE!></td>"
6107 End If
6108 templateHTML = templateHTML & "</tr>"
6109 templateHTML = templateHTML & "<tr>"
6110 templateHTML = templateHTML & "<td><input type=checkbox id=""albumartist"" title=""Store the name of the albumartist in the albumartist-tag""></td>"
6111 REM <input type=checkbox title=""If option set, only the name of the first artist will be assumed"" id=""albumartistfirst"" ></td>"
6112 templateHTML = templateHTML & "<td>Album Artist:</td>"
6113 If QueryPage = "Discogs" Then
6114 templateHTML = templateHTML & "<td><a href=""https://www.discogs.com/artist/" & SavedArtistID & """ target=""_blank""><!ALBUMARTIST!></a></td>"
6115 ElseIf QueryPage = "MusicBrainz" Then
6116 templateHTML = templateHTML & "<td><a href=""http://www.musicbrainz.org/artist/" & SavedArtistID & """ target=""_blank""><!ALBUMARTIST!></a></td>"
6117 ElseIf QueryPage = "MetalArchives" Then
6118 templateHTML = templateHTML & "<td><!ALBUMARTIST!></td>"
6119 End If
6120 templateHTML = templateHTML & "</tr>"
6121 templateHTML = templateHTML & "<tr>"
6122 templateHTML = templateHTML & "<td><input type=checkbox id=""label"" title=""Store the name of the label in the label-tag"" ></td>"
6123 templateHTML = templateHTML & "<td>Label:</td>"
6124 If QueryPage = "Discogs" Then
6125 templateHTML = templateHTML & "<td><a href=""https://www.discogs.com/label/" & SavedLabelID & """ target=""_blank""><!LABEL!></a></td>"
6126 ElseIf QueryPage = "MusicBrainz" Then
6127 templateHTML = templateHTML & "<td><a href=""http://www.musicbrainz.org/label/" & SavedLabelID & """ target=""_blank""><!LABEL!></a></td>"
6128 ElseIf QueryPage = "MetalArchives" Then
6129 templateHTML = templateHTML & "<td><!LABEL!></td>"
6130 End If
6131 templateHTML = templateHTML & "</tr>"
6132 templateHTML = templateHTML & "<tr>"
6133 templateHTML = templateHTML & "<td><input type=checkbox id=""catalog"" title=""if set, the catalog number will be written in a custom tag. You can change the target tag in Tools->Options->Discogs Tagger.""></td>"
6134 templateHTML = templateHTML & "<td>Catalog#:</td>"
6135 templateHTML = templateHTML & "<td><!CATALOG!></td>"
6136 templateHTML = templateHTML & "</tr>"
6137 templateHTML = templateHTML & "<tr>"
6138 templateHTML = templateHTML & "<td><input type=checkbox id=""format"" title=""if set, the format will be written in a custom tag. You can change the target tag in Tools->Options->Discogs Tagger.""></td>"
6139 templateHTML = templateHTML & "<td>Format:</td>"
6140 templateHTML = templateHTML & "<td><!FORMAT!></td>"
6141 templateHTML = templateHTML & "</tr>"
6142 If QueryPage <> "MetalArchives" Then
6143 templateHTML = templateHTML & "<tr>"
6144 templateHTML = templateHTML & "<td><input type=checkbox id=""country"" title=""if set, the country will be written in a custom tag. You can change the target tag in Tools->Options->Discogs Tagger.""></td>"
6145 templateHTML = templateHTML & "<td>Country:</td>"
6146 templateHTML = templateHTML & "<td><!COUNTRY!></td>"
6147 templateHTML = templateHTML & "</tr>"
6148 End If
6149 templateHTML = templateHTML & "<tr>"
6150 templateHTML = templateHTML & "<td><input type=checkbox title=""If option set, the release date of this Discogs release will be saved in the date tag"" id=""date"" ></td>"
6151 templateHTML = templateHTML & "<td>Date:</td>"
6152 templateHTML = templateHTML & "<td><!RELEASEDATE!></td>"
6153 templateHTML = templateHTML & "</tr>"
6154 If QueryPage <> "MetalArchives" Then
6155 templateHTML = templateHTML & "<tr>"
6156 templateHTML = templateHTML & "<td><input type=checkbox title=""If option set, the release date of the Discogs master release will be saved in the original date tag"" id=""origdate"" ></td>"
6157 templateHTML = templateHTML & "<td>Original Date:</td>"
6158 templateHTML = templateHTML & "<td><!ORIGDATE!></td>"
6159 templateHTML = templateHTML & "</tr>"
6160 End If
6161 If QueryPage = "Discogs" Then
6162 templateHTML = templateHTML & "<tr>"
6163 templateHTML = templateHTML & "<td><input type=checkbox id=""genre"" title=""If set, the selected genres will be written in the genre-tag""></td>"
6164 templateHTML = templateHTML & "<td>Genre:</td>"
6165 If GenresList.Count > 0 Then
6166 templateHTML = templateHTML & "<td><input type=checkbox id=""genre0"" >" & GenresList.Item(0) & "</td>"
6167 templateHTML = templateHTML & "</tr>"
6168 End If
6169 If GenresList.Count > 1 Then
6170 For i = 1 To GenresList.Count-1
6171 templateHTML = templateHTML & "<tr><td></td><td></td>"
6172 templateHTML = templateHTML & "<td><input type=checkbox id=""genre" & i & """ >" & GenresList.Item(i) & "</td>"
6173 templateHTML = templateHTML & "</tr>"
6174 Next
6175 End If
6176 templateHTML = templateHTML & "<tr>"
6177 templateHTML = templateHTML & "<td><input type=checkbox id=""comments"" title=""Store the comment in the comment-tag"" ></td>"
6178 templateHTML = templateHTML & "<td>Comment:</td>"
6179 templateHTML = templateHTML & "<td style=""width: 250px"">" & Comment & "</td>"
6180 templateHTML = templateHTML & "</tr>"
6181
6182 templateHTML = templateHTML & "<tr>"
6183 templateHTML = templateHTML & "<td colspan=2>Release Data Quality:</td>"
6184 templateHTML = templateHTML & "<td><!DATAQUALITY!></td>"
6185 templateHTML = templateHTML & "</tr>"
6186 End If
6187
6188
6189 templateHTML = templateHTML & "</table>"
6190 templateHTML = templateHTML & "</td>"
6191 ' Release Information End
6192 ' Tracklisting Begin
6193 templateHTML = templateHTML & "<td align=left valign=top>"
6194 templateHTML = templateHTML & "<table border=0 cellspacing=0 cellpadding=1 class=tabletext>"
6195 templateHTML = templateHTML & "<tr>"
6196
6197 If CheckOriginalDiscogsTrack Then
6198 If QueryPage = "Discogs" Then
6199 templateHTML = templateHTML & "<td align=left><b>Discogs</b></td>"
6200 ElseIf QueryPage = "MusicBrainz" Then
6201 templateHTML = templateHTML & "<td align=left><b>MusicBrainz</b></td>"
6202 End If
6203 Else
6204 templateHTML = templateHTML & "<td> </td>"
6205 End If
6206
6207 templateHTML = templateHTML & "<td><input type=checkbox id=""selectall"" title=""Select/Deselect all tracks""></td>"
6208 REM templateHTML = templateHTML & "<td align=center><input type=checkbox id=""discnum""></td>"
6209 templateHTML = templateHTML & "<td><input type=checkbox id=""discnum""><b>Disc#</b></td>"
6210 REM templateHTML = templateHTML & "<td><b>Disc#</b></td>"
6211 REM templateHTML = templateHTML & "<td align=center><input type=checkbox id=""tracknum"" title=""If option NOT set, track numbers will not set automatically (useful when you didn't select all tracks from a release""></td>"
6212 templateHTML = templateHTML & "<td><input type=checkbox id=""tracknum"" title=""If option NOT set, track numbers will not set automatically (useful when you didn't select all tracks from a release""><b>Track#</b></td>"
6213 templateHTML = templateHTML & "<td align=right><b>Artist</b></td>"
6214 templateHTML = templateHTML & "<td> </td>"
6215 templateHTML = templateHTML & "<td align=left><b>Title</b></td>"
6216 templateHTML = templateHTML & "<td align=right><b>Duration</b></td>"
6217 templateHTML = templateHTML & "</tr>"
6218
6219 For i=0 To iMaxTracks - 1
6220 templateHTML = templateHTML & "<tr>"
6221 If Grouping(i) = "|Heading|" Then
6222 templateHTML = templateHTML & "</tr><tr> </tr>"
6223 templateHTML = templateHTML & "<tr> </tr>"
6224 End If
6225 If CheckOriginalDiscogsTrack Then
6226 templateHTML = templateHTML & "<td align=center>" & DiscogsTracksNum.Item(i) & "</td>"
6227 Else
6228 templateHTML = templateHTML & "<td> </td>"
6229 End If
6230 If Grouping(i) = "|Heading|" Then
6231 REM If(UnselectedTracks(i) = "") Then
6232 REM templateHTML = templateHTML & "<td><input type=checkbox title=""Select/Deselect all tracks according to the heading"" id=""unselected["&i&"]"" checked></td>"
6233 templateHTML = templateHTML & "<td></td>"
6234 REM Else
6235 REM templateHTML = templateHTML & "<td><input type=checkbox title=""Select/Deselect all tracks according to the heading"" id=""unselected["&i&"]""></td>"
6236 REM End If
6237 Else
6238 If(UnselectedTracks(i) = "") Then
6239 templateHTML = templateHTML & "<td><input type=checkbox title=""if set, the track will be used for tagging"" id=""unselected["&i&"]"" checked></td>"
6240 Else
6241 templateHTML = templateHTML & "<td><input type=checkbox title=""if set, the track will be used for tagging"" id=""unselected["&i&"]""></td>"
6242 End If
6243 End If
6244 If Grouping(i) = "|Heading|" Then
6245 templateHTML = templateHTML & "<td align=center></td><td align=center></td><td align=right></td>"
6246 templateHTML = templateHTML & "<td align=center></td>"
6247 templateHTML = templateHTML & "<td align=left><b>Heading: " & Tracks.Item(i) & "</b></td><td align=right></td>"
6248 Else
6249 templateHTML = templateHTML & "<td align=center>" & TracksCD.Item(i) & "</td>"
6250 templateHTML = templateHTML & "<td align=center>" & TracksNum.Item(i) & "</td>"
6251 templateHTML = templateHTML & "<td align=right>" & ArtistTitles.Item(i) & "</td>"
6252 templateHTML = templateHTML & "<td align=center><b>-</b></td>"
6253 templateHTML = templateHTML & "<td align=left>"
6254 If(UnselectedTrackNames(i) = "") Then
6255 templateHTML = templateHTML & "<input type=checkbox title=""if set, the track title will be updated"" id=""unselectedtrackname["&i&"]"" checked>" & Tracks.Item(i) & "</td>"
6256 Else
6257 templateHTML = templateHTML & "<input type=checkbox title=""if set, the track title will be updated"" id=""unselectedtrackname["&i&"]"">" & Tracks.Item(i) & "</td>"
6258 End If
6259 templateHTML = templateHTML & "<td align=right>" & Durations.Item(i) & "</td>"
6260 End If
6261 templateHTML = templateHTML & "</tr>"
6262
6263 REM If Grouping(i) = "|Heading|" Then
6264 REM templateHTML = templateHTML & "<tr></tr><tr></tr>"
6265 REM Else
6266 If(CheckLyricist and Lyricists.Item(i) <> "") Then templateHTML = templateHTML & "<tr><td colspan=6></td><td colspan=2 align=left>Lyrics: "& Lyricists.Item(i) &"</td></tr>"
6267 If(CheckComposer and Composers.Item(i) <> "") Then templateHTML = templateHTML & "<tr><td colspan=6></td><td colspan=2 align=left>Composer: "& Composers.Item(i) &"</td></tr>"
6268 If(CheckConductor and Conductors.Item(i) <> "") Then templateHTML = templateHTML & "<tr><td colspan=6></td><td colspan=2 align=left>Conductor: "& Conductors.Item(i) &"</td></tr>"
6269 If(CheckProducer and Producers.Item(i) <> "") Then templateHTML = templateHTML & "<tr><td colspan=6></td><td colspan=2 align=left>Producer: "& Producers.Item(i) &"</td></tr>"
6270 If(CheckGrouping and Grouping(i) <> "" and Grouping(i) <> "|Heading|") Then templateHTML = templateHTML & "<tr><td colspan=6></td><td colspan=2 align=left>Grouping: "& Grouping(i) &"</td></tr>"
6271
6272 If(CheckInvolved and InvolvedArtists.Item(i) <> "") Then
6273 templateHTML = templateHTML & "<tr><td colspan=6></td><td colspan=2 align=left><b>Involved People:</b></td></tr>"
6274 'SDB.Localize("Involved People")
6275 If CheckInvolvedPeopleSingleLine = True And InStr(InvolvedArtists.Item(i), Separator) <> 0 Then
6276 Dim x
6277 tmp = Split(InvolvedArtists.Item(i), Separator)
6278 For each x in tmp
6279 templateHTML = templateHTML & "<tr><td colspan=6></td><td colspan=2 align=left>"& x &"</td></tr>"
6280 Next
6281 Else
6282 templateHTML = templateHTML & "<tr><td colspan=6></td><td colspan=2 align=left>"& InvolvedArtists.Item(i) &"</td></tr>"
6283 End If
6284 End If
6285 REM End If
6286 Next
6287
6288 templateHTML = templateHTML & "</table>"
6289 templateHTML = templateHTML & "</td>"
6290 ' Tracklisting End
6291
6292 templateHTML = templateHTML & GetFooter()
6293
6294 templateHTML = Replace(templateHTML, "<!RELEASEID!>", releaseID)
6295 templateHTML = Replace(templateHTML, "<!MASTERID!>", theMaster)
6296 templateHTML = Replace(templateHTML, "<!ARTIST!>", AlbumArtistTitle)
6297 templateHTML = Replace(templateHTML, "<!ALBUMARTIST!>", AlbumArtist)
6298 templateHTML = Replace(templateHTML, "<!ALBUMTITLE!>", AlbumTitle)
6299 templateHTML = Replace(templateHTML, "<!RELEASEDATE!>", ReleaseDate)
6300 templateHTML = Replace(templateHTML, "<!ORIGDATE!>", OriginalDate)
6301 templateHTML = Replace(templateHTML, "<!LABEL!>", theLabels)
6302 templateHTML = Replace(templateHTML, "<!COUNTRY!>", theCountry)
6303 templateHTML = Replace(templateHTML, "<!COVER!>", AlbumArtThumbNail)
6304 templateHTML = Replace(templateHTML, "<!CATALOG!>", Catalog)
6305 templateHTML = Replace(templateHTML, "<!FORMAT!>", theFormat)
6306
6307 If QueryPage = "Discogs" Then
6308 templateHTML = Replace(templateHTML, "<!DATAQUALITY!>", DataQuality)
6309 End If
6310
6311
6312 Rem Dim filesys, filetxt, logdatei
6313 Rem 'Const ForReading = 1, ForWriting = 2, ForAppending = 8
6314 REM logdatei = SDB.ScriptsPath & "HTML.htm"
6315 Rem Set filesys = CreateObject("Scripting.FileSystemObject")
6316 Rem Set filetxt = filesys.OpenTextFile(logdatei, 2, True)
6317 REM filetxt.WriteLine(templateHTML)
6318 REM filetxt.Close
6319
6320 WebBrowser.SetHTMLDocument templateHTML
6321
6322 Dim templateHTMLDoc
6323 Set templateHTMLDoc = WebBrowser.Interf.Document
6324
6325 Set checkBox = templateHTMLDoc.getElementById("album")
6326 checkBox.Checked = CheckAlbum
6327 Script.RegisterEvent checkBox, "onclick", "Update"
6328 Set checkBox = templateHTMLDoc.getElementById("artist")
6329 checkBox.Checked = CheckArtist
6330 Script.RegisterEvent checkBox, "onclick", "Update"
6331 Set checkBox = templateHTMLDoc.getElementById("albumartist")
6332 checkBox.Checked = CheckAlbumArtist
6333 Script.RegisterEvent checkBox, "onclick", "Update"
6334 REM Set checkBox = templateHTMLDoc.getElementById("albumartistfirst")
6335 REM checkBox.Checked = CheckAlbumArtistFirst
6336 REM Script.RegisterEvent checkBox, "onclick", "Update"
6337 Set checkBox = templateHTMLDoc.getElementById("date")
6338 checkBox.Checked = CheckDate
6339 Script.RegisterEvent checkBox, "onclick", "Update"
6340 If QueryPage <> "MetalArchives" Then
6341 Set checkBox = templateHTMLDoc.getElementById("origdate")
6342 checkBox.Checked = CheckOrigDate
6343 Script.RegisterEvent checkBox, "onclick", "Update"
6344 Set checkBox = templateHTMLDoc.getElementById("country")
6345 checkBox.Checked = CheckCountry
6346 Script.RegisterEvent checkBox, "onclick", "Update"
6347 End If
6348 Set checkBox = templateHTMLDoc.getElementById("label")
6349 checkBox.Checked = CheckLabel
6350 Script.RegisterEvent checkBox, "onclick", "Update"
6351 Set checkBox = templateHTMLDoc.getElementById("picture")
6352 Script.RegisterEvent checkBox, "onclick", "ShowHelp"
6353 If QueryPage = "Discogs" Then
6354 Set checkBox = templateHTMLDoc.getElementById("genre")
6355 checkBox.Checked = CheckGenre
6356 Script.RegisterEvent checkBox, "onclick", "Update"
6357 REM Set checkBox = templateHTMLDoc.getElementById("style")
6358 REM checkBox.Checked = CheckStyle
6359 REM Script.RegisterEvent checkBox, "onclick", "Update"
6360 NewGenre = ""
6361 If GenresList.Count > 0 Then
6362 For i = 0 To GenresList.Count-1
6363 Set checkBox = templateHTMLDoc.getElementById("genre" & i)
6364 checkBox.Checked = GenresSelect.Item(i)
6365 Script.RegisterEvent checkBox, "onclick", "Update"
6366 If GenresSelect.Item(i) = "True" Then
6367 AddToField NewGenre, GenresList.Item(i)
6368 End If
6369 Next
6370 End If
6371 End If
6372 Script.RegisterEvent checkBox, "onclick", "Update"
6373 Set checkBox = templateHTMLDoc.getElementById("catalog")
6374 checkBox.Checked = CheckCatalog
6375 Script.RegisterEvent checkBox, "onclick", "Update"
6376 If QueryPage <> "MetalArchives" Then
6377 Set checkBox = templateHTMLDoc.getElementById("releaseid")
6378 checkBox.Checked = CheckRelease
6379 Script.RegisterEvent checkBox, "onclick", "Update"
6380 Set checkBox = templateHTMLDoc.getElementById("involved")
6381 checkBox.Checked = CheckInvolved
6382 Script.RegisterEvent checkBox, "onclick", "Update"
6383 Set checkBox = templateHTMLDoc.getElementById("lyricist")
6384 checkBox.Checked = CheckLyricist
6385 Script.RegisterEvent checkBox, "onclick", "Update"
6386 Set checkBox = templateHTMLDoc.getElementById("composer")
6387 checkBox.Checked = CheckComposer
6388 Script.RegisterEvent checkBox, "onclick", "Update"
6389 Set checkBox = templateHTMLDoc.getElementById("conductor")
6390 checkBox.Checked = CheckConductor
6391 Script.RegisterEvent checkBox, "onclick", "Update"
6392 Set checkBox = templateHTMLDoc.getElementById("producer")
6393 checkBox.Checked = CheckProducer
6394 Script.RegisterEvent checkBox, "onclick", "Update"
6395 End If
6396 Set checkBox = templateHTMLDoc.getElementById("grouping")
6397 checkBox.Checked = CheckGrouping
6398 Script.RegisterEvent checkBox, "onclick", "Update"
6399 Set submitButton = templateHTMLDoc.getElementById("refresh")
6400 Script.RegisterEvent submitButton, "onclick", "trackrefreshing"
6401 Set submitButton = templateHTMLDoc.getElementById("deselectall")
6402 Script.RegisterEvent submitButton, "onclick", "deselectall"
6403 REM Set checkBox = templateHTMLDoc.getElementById("usercollection")
6404 REM checkBox.Checked = CheckUserCollection
6405 REM Script.RegisterEvent checkBox, "onclick", "Update"
6406
6407 Set checkBox = templateHTMLDoc.getElementById("discnum")
6408 checkBox.Checked = CheckDiscNum
6409 Script.RegisterEvent checkBox, "onclick", "Update"
6410 Set checkBox = templateHTMLDoc.getElementById("tracknum")
6411 checkBox.Checked = CheckTrackNum
6412 Script.RegisterEvent checkBox, "onclick", "Update"
6413 Set checkBox = templateHTMLDoc.getElementById("format")
6414 checkBox.Checked = CheckFormat
6415 Script.RegisterEvent checkBox, "onclick", "Update"
6416
6417 If QueryPage = "Discogs" Then
6418 Set checkBox = templateHTMLDoc.getElementById("comments")
6419 checkBox.Checked = CheckComment
6420 Script.RegisterEvent checkBox, "onclick", "Update"
6421 End If
6422
6423 Set listBox = templateHTMLDoc.getElementById("filtermediatype")
6424 Script.RegisterEvent listBox, "onchange", "Filter"
6425 Set listBox = templateHTMLDoc.getElementById("filtermediaformat")
6426 Script.RegisterEvent listBox, "onchange", "Filter"
6427 Set listBox = templateHTMLDoc.getElementById("filtercountry")
6428 Script.RegisterEvent listBox, "onchange", "Filter"
6429 Set listBox = templateHTMLDoc.getElementById("filteryear")
6430 Script.RegisterEvent listBox, "onchange", "Filter"
6431 Set listBox = templateHTMLDoc.getElementById("load")
6432 Script.RegisterEvent listBox, "onchange", "Filter"
6433
6434 If trackRefresh = True Then
6435 For i=0 To iMaxTracks - 1
6436 Set checkBox = templateHTMLDoc.getElementById("unselected["&i&"]")
6437 Script.RegisterEvent checkBox, "onclick", "Unselect"
6438 Set checkBox = templateHTMLDoc.getElementById("unselectedtrackname["&i&"]")
6439 Script.RegisterEvent checkBox, "onclick", "Unselect"
6440 Next
6441 End If
6442
6443 Set checkBox = templateHTMLDoc.getElementById("selectall")
6444 checkBox.Checked = SelectAll
6445 Script.RegisterEvent checkBox, "onclick", "SwitchAll"
6446
6447 If QueryPage <> "MetalArchives" Then
6448 Set listBox = templateHTMLDoc.getElementById("alternative")
6449 Script.RegisterEvent listBox, "onchange", "Alternative"
6450
6451 Set submitButton = templateHTMLDoc.getElementById("showcountryfilter")
6452 Script.RegisterEvent submitButton, "onclick", "ShowCountryFilter"
6453
6454 Set submitButton = templateHTMLDoc.getElementById("showmediatypefilter")
6455 Script.RegisterEvent submitButton, "onclick", "ShowMediaTypeFilter"
6456
6457 Set submitButton = templateHTMLDoc.getElementById("showmediaformatfilter")
6458 Script.RegisterEvent submitButton, "onclick", "ShowMediaFormatFilter"
6459
6460 Set submitButton = templateHTMLDoc.getElementById("showyearfilter")
6461 Script.RegisterEvent submitButton, "onclick", "ShowYearFilter"
6462 End If
6463
6464 Set submitButton = templateHTMLDoc.getElementById("saveoptions")
6465 Script.RegisterEvent submitButton, "onclick", "SaveOptions"
6466
6467 Set submitButton = templateHTMLDoc.getElementById("optionsform")
6468 Script.RegisterEvent submitButton, "onclick", "ShowOptions"
6469
6470
6471
6472 Set submitButton = templateHTMLDoc.getElementById("moreimages")
6473 Script.RegisterEvent submitButton, "onclick", "MoreImages"
6474
6475 Set submitButton = templateHTMLDoc.getElementById("applyfrontcover")
6476 Script.RegisterEvent submitButton, "onclick", "ApplyFrontCover"
6477
6478 REM Set listBox = templateHTMLDoc.getElementById("searchpage")
6479 REM Script.RegisterEvent listBox, "onchange", "Filter"
6480
6481 Set submitButton = templateHTMLDoc.getElementById("showadvancedsearch")
6482 Script.RegisterEvent submitButton, "onclick", "ShowAdvancedSearch"
6483
6484 Set submitButton = templateHTMLDoc.getElementById("usercollection")
6485 Script.RegisterEvent submitButton, "onclick", "UserCollection"
6486
6487
6488End Sub
6489
6490
6491Sub ShowHelp()
6492
6493 Dim res
6494 res = SDB.MessageBox("Short Help MessageBox" & vbCrLf & vbCrLf & "Hoving with the mouse over a checkbox will show a short help." & vbCrLf & "You find some more configuration settings for Discogs Tagger in MediaMonkey menu ->Tools->Options" & vbCrLf & vbCrLf & "If you want more help or information, or if you want to ask for a new feature," & vbCrLf & "please visit the Discogs Tagger on the Mediamonkey forum, we wanna try to help you" & vbCrLf & vbCrLf & "http://www.mediamonkey.com/forum/viewtopic.php?f=2&t=72637", mtInformation, Array(mbOk))
6495
6496
6497End Sub
6498
6499
6500
6501Sub trackRefreshing()
6502
6503 If trackRefresh = True then
6504 trackRefresh = False
6505 Unselect
6506 Else
6507 trackRefresh = True
6508 UnSelect
6509 End If
6510
6511End Sub
6512
6513
6514Sub deselectall()
6515
6516 Dim checkbox, templateHTMLDoc
6517 Set WebBrowser = SDB.Objects("WebBrowser")
6518 Set templateHTMLDoc = WebBrowser.Interf.Document
6519
6520 Set checkBox = templateHTMLDoc.getElementById("album")
6521 CheckAlbum = False
6522 checkBox.Checked = False
6523 Set checkBox = templateHTMLDoc.getElementById("artist")
6524 CheckArtist = False
6525 checkBox.Checked = False
6526 Set checkBox = templateHTMLDoc.getElementById("albumartist")
6527 CheckAlbumArtist = False
6528 checkBox.Checked = False
6529 Set checkBox = templateHTMLDoc.getElementById("date")
6530 CheckDate = False
6531 checkBox.Checked = False
6532 Set checkBox = templateHTMLDoc.getElementById("origdate")
6533 CheckOrigDate = False
6534 checkBox.Checked = False
6535 Set checkBox = templateHTMLDoc.getElementById("label")
6536 CheckLabel = False
6537 checkBox.Checked = False
6538 If QueryPage = "Discogs" Then
6539 Set checkBox = templateHTMLDoc.getElementById("genre")
6540 CheckGenre = False
6541 checkBox.Checked = False
6542 End If
6543 Set checkBox = templateHTMLDoc.getElementById("format")
6544 CheckFormat = False
6545 checkBox.Checked = False
6546 Set checkBox = templateHTMLDoc.getElementById("country")
6547 CheckCountry = False
6548 checkBox.Checked = False
6549 Set checkBox = templateHTMLDoc.getElementById("checkcover")
6550 CheckCover = False
6551 checkBox.Checked = False
6552 Set checkBox = templateHTMLDoc.getElementById("catalog")
6553 CheckCatalog = False
6554 checkBox.Checked = False
6555 Set checkBox = templateHTMLDoc.getElementById("releaseid")
6556 CheckRelease = False
6557 checkBox.Checked = False
6558 Set checkBox = templateHTMLDoc.getElementById("involved")
6559 CheckInvolved = False
6560 checkBox.Checked = False
6561 Set checkBox = templateHTMLDoc.getElementById("grouping")
6562 CheckGrouping = False
6563 checkBox.Checked = False
6564 Set checkBox = templateHTMLDoc.getElementById("lyricist")
6565 CheckLyricist = False
6566 checkBox.Checked = False
6567 Set checkBox = templateHTMLDoc.getElementById("composer")
6568 CheckComposer = False
6569 checkBox.Checked = False
6570 Set checkBox = templateHTMLDoc.getElementById("conductor")
6571 CheckConductor = False
6572 checkBox.Checked = False
6573 Set checkBox = templateHTMLDoc.getElementById("producer")
6574 CheckProducer = False
6575 checkBox.Checked = False
6576 Set checkBox = templateHTMLDoc.getElementById("discnum")
6577 CheckDiscNum = False
6578 checkBox.Checked = False
6579 Set checkBox = templateHTMLDoc.getElementById("tracknum")
6580 CheckTrackNum = False
6581 checkBox.Checked = False
6582 If QueryPage = "Discogs" Then
6583 Set checkBox = templateHTMLDoc.getElementById("comments")
6584 CheckComment = False
6585 checkBox.Checked = False
6586 End If
6587
6588 OptionsChanged = True
6589
6590 SDB.ProcessMessages
6591 ReloadResults
6592
6593End Sub
6594
6595
6596
6597Sub Update()
6598
6599 Dim templateHTMLDoc, checkBox, text, radio, i
6600 Set WebBrowser = SDB.Objects("WebBrowser")
6601 Set templateHTMLDoc = WebBrowser.Interf.Document
6602
6603 Set checkBox = templateHTMLDoc.getElementById("album")
6604 CheckAlbum = checkBox.Checked
6605 Set checkBox = templateHTMLDoc.getElementById("artist")
6606 CheckArtist = checkBox.Checked
6607 Set checkBox = templateHTMLDoc.getElementById("albumartist")
6608 CheckAlbumArtist = checkBox.Checked
6609 REM Set checkBox = templateHTMLDoc.getElementById("albumartistfirst")
6610 REM CheckAlbumArtistFirst = checkBox.Checked
6611 If QueryPage <> "MetalArchives" Then
6612 Set checkBox = templateHTMLDoc.getElementById("origdate")
6613 CheckOrigDate = checkBox.Checked
6614 Set checkBox = templateHTMLDoc.getElementById("country")
6615 CheckCountry = checkBox.Checked
6616 Set checkBox = templateHTMLDoc.getElementById("releaseid")
6617 CheckRelease = checkBox.Checked
6618 Set checkBox = templateHTMLDoc.getElementById("involved")
6619 CheckInvolved = checkBox.Checked
6620 Set checkBox = templateHTMLDoc.getElementById("lyricist")
6621 CheckLyricist = checkBox.Checked
6622 Set checkBox = templateHTMLDoc.getElementById("composer")
6623 CheckComposer = checkBox.Checked
6624 Set checkBox = templateHTMLDoc.getElementById("conductor")
6625 CheckConductor = checkBox.Checked
6626 Set checkBox = templateHTMLDoc.getElementById("producer")
6627 CheckProducer = checkBox.Checked
6628 End If
6629 Set checkBox = templateHTMLDoc.getElementById("date")
6630 CheckDate = checkBox.Checked
6631 Set checkBox = templateHTMLDoc.getElementById("label")
6632 CheckLabel = checkBox.Checked
6633 If QueryPage = "Discogs" Then
6634 Set checkBox = templateHTMLDoc.getElementById("genre")
6635 CheckGenre = checkBox.Checked
6636 REM Set checkBox = templateHTMLDoc.getElementById("style")
6637 REM CheckStyle = checkBox.Checked
6638 If GenresList.Count > 0 Then
6639 For i = 0 To GenresList.Count-1
6640 Set checkBox = templateHTMLDoc.getElementById("genre" & i)
6641 GenresSelect.Item(i) = checkBox.Checked
6642 Next
6643 End If
6644 End If
6645 Set checkBox = templateHTMLDoc.getElementById("format")
6646 CheckFormat = checkBox.Checked
6647 Set checkBox = templateHTMLDoc.getElementById("checkcover")
6648 CheckCover = checkBox.Checked
6649 Set checkBox = templateHTMLDoc.getElementById("catalog")
6650 CheckCatalog = checkBox.Checked
6651 Set checkBox = templateHTMLDoc.getElementById("grouping")
6652 CheckGrouping = checkBox.Checked
6653 REM Set checkBox = templateHTMLDoc.getElementById("usercollection")
6654 REM CheckUserCollection = checkBox.Checked
6655 Set checkBox = templateHTMLDoc.getElementById("discnum")
6656 CheckDiscNum = checkBox.Checked
6657 Set checkBox = templateHTMLDoc.getElementById("tracknum")
6658 CheckTrackNum = checkBox.Checked
6659 If QueryPage = "Discogs" Then
6660 Set checkBox = templateHTMLDoc.getElementById("comments")
6661 CheckComment = checkBox.Checked
6662 End If
6663
6664 OptionsChanged = True
6665
6666 SDB.ProcessMessages
6667 ReloadResults
6668
6669End Sub
6670
6671
6672Sub Filter()
6673
6674 Dim templateHTMLDoc, listBox, ret
6675 Set WebBrowser = SDB.Objects("WebBrowser")
6676 Set templateHTMLDoc = WebBrowser.Interf.Document
6677
6678 Set listBox = templateHTMLDoc.getElementById("filtermediatype")
6679 FilterMediaType = listBox.Value
6680 If FilterMediaType = "None" Then
6681 MediaTypeFilterList.Item(0) = "0"
6682 ElseIf FilterMediaType = "Use MediaType Filter" Then
6683 MediaTypeFilterList.Item(0) = "1"
6684 Else
6685 MediaTypeFilterList.Item(0) = FilterMediaType
6686 End If
6687 Set listBox = templateHTMLDoc.getElementById("filtermediaformat")
6688 FilterMediaFormat = listBox.Value
6689 If FilterMediaFormat = "None" Then
6690 MediaFormatFilterList.Item(0) = "0"
6691 ElseIf FilterMediaFormat = "Use MediaFormat Filter" Then
6692 MediaFormatFilterList.Item(0) = "1"
6693 Else
6694 MediaFormatFilterList.Item(0) = FilterMediaFormat
6695 End If
6696 Set listBox = templateHTMLDoc.getElementById("filtercountry")
6697 FilterCountry = listBox.Value
6698 If FilterCountry = "None" Then
6699 CountryFilterList.Item(0) = "0"
6700 ElseIf FilterCountry = "Use Country Filter" Then
6701 CountryFilterList.Item(0) = "1"
6702 Else
6703 CountryFilterList.Item(0) = FilterCountry
6704 End If
6705 Set listBox = templateHTMLDoc.getElementById("filteryear")
6706 FilterYear = listBox.Value
6707 If FilterYear = "None" Then
6708 YearFilterList.Item(0) = "0"
6709 ElseIf FilterYear = "Use Year Filter" Then
6710 YearFilterList.Item(0) = "1"
6711 Else
6712 YearFilterList.Item(0) = FilterYear
6713 End If
6714
6715 REM Set listBox = templateHTMLDoc.getElementById("searchpage")
6716 REM If QueryPage <> Mid(listBox.Value, 11) Then
6717 REM If Mid(listBox.Value, 11) = "Discogs" Then
6718 REM If authorize_script = False Then
6719 REM Exit Sub
6720 REM End If
6721 REM End If
6722 REM QueryPage = Mid(listBox.Value, 11)
6723 REM Set listBox = templateHTMLDoc.getElementById("load")
6724 REM listBox.Item(0).Selected = True
6725 REM ini.StringValue("DiscogsAutoTagWeb","QueryPage") = QueryPage
6726 REM End If
6727
6728 Set listBox = templateHTMLDoc.getElementById("load")
6729 CurrentLoadType = listBox.Value
6730
6731 If(CurrentLoadType = "Master Release") Then
6732 LoadMasterResults(SavedMasterID)
6733 ElseIf(CurrentLoadType = "Versions of Master") Then
6734 LoadVersionResults(SavedMasterID)
6735 ElseIf(CurrentLoadType = "Releases of Artist") Then
6736 LoadArtistResults(SavedArtistID)
6737 ElseIf(CurrentLoadType = "Releases of Label") Then
6738 LoadLabelResults(SavedLabelID)
6739 Else
6740 SDB.ProcessMessages
6741 NewSearchArtist = SavedSearchArtist
6742 NewSearchAlbum = SavedSearchAlbum
6743 FindResults NewSearchTerm, QueryPage
6744 End If
6745
6746End Sub
6747
6748
6749Sub Alternative()
6750
6751 Dim templateHTMLDoc
6752 Set WebBrowser = SDB.Objects("WebBrowser")
6753 Set templateHTMLDoc = WebBrowser.Interf.Document
6754 CurrentLoadType = "Search Results"
6755 NewSearchTerm = templateHTMLDoc.getElementById("alternative").Value
6756 NewSearchArtist = ""
6757 NewSearchAlbum = ""
6758 FindResults templateHTMLDoc.getElementById("alternative").Value, QueryPage
6759
6760End Sub
6761
6762
6763Sub SaveOptions()
6764
6765 Dim a, tmp
6766 ' save options if ini exists
6767 If Not (ini Is Nothing) Then
6768 ini.BoolValue("DiscogsAutoTagWeb","CheckAlbum") = CheckAlbum
6769 ini.BoolValue("DiscogsAutoTagWeb","CheckArtist") = CheckArtist
6770 ini.BoolValue("DiscogsAutoTagWeb","CheckAlbumArtist") = CheckAlbumArtist
6771 ini.BoolValue("DiscogsAutoTagWeb","CheckAlbumArtistFirst") = CheckAlbumArtistFirst
6772 ini.BoolValue("DiscogsAutoTagWeb","CheckLabel") = CheckLabel
6773 ini.BoolValue("DiscogsAutoTagWeb","CheckDate") = CheckDate
6774 ini.BoolValue("DiscogsAutoTagWeb","CheckOrigDate") = CheckOrigDate
6775 ini.BoolValue("DiscogsAutoTagWeb","CheckGenre") = CheckGenre
6776 ini.BoolValue("DiscogsAutoTagWeb","CheckStyle") = CheckStyle
6777 ini.BoolValue("DiscogsAutoTagWeb","CheckCountry") = CheckCountry
6778 ini.BoolValue("DiscogsAutoTagWeb","CheckCatalog") = CheckCatalog
6779 ini.BoolValue("DiscogsAutoTagWeb","CheckRelease") = CheckRelease
6780 ini.BoolValue("DiscogsAutoTagWeb","CheckInvolved") = CheckInvolved
6781 ini.BoolValue("DiscogsAutoTagWeb","CheckGrouping") = CheckGrouping
6782 ini.BoolValue("DiscogsAutoTagWeb","CheckLyricist") = CheckLyricist
6783 ini.BoolValue("DiscogsAutoTagWeb","CheckComposer") = CheckComposer
6784 ini.BoolValue("DiscogsAutoTagWeb","CheckConductor") = CheckConductor
6785 ini.BoolValue("DiscogsAutoTagWeb","CheckProducer") = CheckProducer
6786 ini.BoolValue("DiscogsAutoTagWeb","CheckDiscNum") = CheckDiscNum
6787 ini.BoolValue("DiscogsAutoTagWeb","CheckTrackNum") = CheckTrackNum
6788 ini.BoolValue("DiscogsAutoTagWeb","CheckFormat") = CheckFormat
6789 ini.BoolValue("DiscogsAutoTagWeb","CheckUseAnv") = CheckUseAnv
6790 ini.BoolValue("DiscogsAutoTagWeb","CheckYearOnlyDate") = CheckYearOnlyDate
6791 ini.BoolValue("DiscogsAutoTagWeb","CheckForceNumeric") = CheckForceNumeric
6792 ini.BoolValue("DiscogsAutoTagWeb","CheckSidesToDisc") = CheckSidesToDisc
6793 ini.BoolValue("DiscogsAutoTagWeb","CheckForceDisc") = CheckForceDisc
6794 ini.BoolValue("DiscogsAutoTagWeb","CheckNoDisc") = CheckNoDisc
6795 ini.BoolValue("DiscogsAutoTagWeb","CheckLeadingZero") = CheckLeadingZero
6796 ini.BoolValue("DiscogsAutoTagWeb","CheckLeadingZeroDisc") = CheckLeadingZeroDisc
6797 REM ini.BoolValue("DiscogsAutoTagWeb","CheckUserCollection") = CheckUserCollection
6798 ini.StringValue("DiscogsAutoTagWeb","DiscogsUsername") = DiscogsUsername
6799 ini.StringValue("DiscogsAutoTagWeb","ReleaseTag") = ReleaseTag
6800 ini.StringValue("DiscogsAutoTagWeb","CatalogTag") = CatalogTag
6801 ini.StringValue("DiscogsAutoTagWeb","CountryTag") = CountryTag
6802 ini.StringValue("DiscogsAutoTagWeb","FormatTag") = FormatTag
6803 ini.BoolValue("DiscogsAutoTagWeb","CheckVarious") = CheckVarious
6804 ini.StringValue("DiscogsAutoTagWeb","TxtVarious") = TxtVarious
6805 ini.BoolValue("DiscogsAutoTagWeb","CheckTitleFeaturing") = CheckTitleFeaturing
6806 ini.BoolValue("DiscogsAutoTagWeb","CheckDeleteDuplicatedEntry") = CheckDeleteDuplicatedEntry
6807 ini.StringValue("DiscogsAutoTagWeb","TxtFeaturingName") = TxtFeaturingName
6808 ini.BoolValue("DiscogsAutoTagWeb","CheckFeaturingName") = CheckFeaturingName
6809 ini.BoolValue("DiscogsAutoTagWeb","CheckComment") = CheckComment
6810 ini.BoolValue("DiscogsAutoTagWeb","SubTrackNameSelection") = SubTrackNameSelection
6811 ini.StringValue("DiscogsAutoTagWeb","ArtistSeparator") = ArtistSeparator
6812 ini.StringValue("DiscogsAutoTagWeb","FormatSeparator") = FormatSeparator
6813 ini.BoolValue("DiscogsAutoTagWeb","CheckTurnOffSubTrack") = CheckTurnOffSubTrack
6814 ini.BoolValue("DiscogsAutoTagWeb","CheckInvolvedPeopleSingleLine") = CheckInvolvedPeopleSingleLine
6815 REM ini.StringValue("DiscogsAutoTagWeb","QueryPage") = QueryPage
6816 ini.BoolValue("DiscogsAutoTagWeb","CheckTheBehindArtist") = CheckTheBehindArtist
6817 ini.BoolValue("DiscogsAutoTagWeb","CheckIgnoreFeatArtist") = CheckIgnoreFeatArtist
6818 ini.StringValue("DiscogsAutoTagWeb","SubTrackSeparator") = SubTrackSeparator
6819 ini.BoolValue("DiscogsAutoTagWeb","CheckNewMatchingEngine") = CheckNewMatchingEngine
6820 ini.BoolValue("DiscogsAutoTagWeb","CheckShowQtyFormat") = CheckShowQtyFormat
6821
6822 tmp = CountryFilterList.Item(0)
6823 For a = 1 To CountryList.Count - 1
6824 tmp = tmp & "," & CountryFilterList.Item(a)
6825 Next
6826 ini.StringValue("DiscogsAutoTagWeb","CurrentCountryFilter") = tmp
6827 tmp = MediaTypeFilterList.Item(0)
6828 For a = 1 To MediaTypeList.Count - 1
6829 tmp = tmp & "," & MediaTypeFilterList.Item(a)
6830 Next
6831 ini.StringValue("DiscogsAutoTagWeb","CurrentMediaTypeFilter") = tmp
6832 tmp = MediaFormatFilterList.Item(0)
6833 For a = 1 To MediaFormatList.Count - 1
6834 tmp = tmp & "," & MediaFormatFilterList.Item(a)
6835 Next
6836 ini.StringValue("DiscogsAutoTagWeb","CurrentMediaFormatFilter") = tmp
6837 tmp = YearFilterList.Item(0)
6838 For a = 1 To YearList.Count - 1
6839 tmp = tmp & "," & YearFilterList.Item(a)
6840 Next
6841 ini.StringValue("DiscogsAutoTagWeb","CurrentYearFilter") = tmp
6842 End If
6843
6844End Sub
6845
6846' Format Error Message
6847Sub FormatErrorMessage(ErrorMessage)
6848
6849 Dim templateHTML, listBox, templateHTMLDoc, submitButton, res, ret, tmp
6850
6851 WriteLog "Show ErrorMessage"
6852
6853 If InStr(ErrorMessage, "{") > 0 Then
6854 tmp = InStr(ErrorMessage, "{")
6855 ErrorMessage = Mid(ErrorMessage, tmp + 28)
6856 tmp = InStr(ErrorMessage, "}")
6857 ErrorMessage = Left(ErrorMessage, tmp - 7)
6858 End If
6859 WriteLog "Errormessage=" & ErrorMessage
6860
6861 templateHTML = ""
6862 templateHTML = templateHTML & GetHeader()
6863 templateHTML = templateHTML & "<tr></tr>"
6864 templateHTML = templateHTML & "<tr></tr>"
6865 templateHTML = templateHTML & "<tr>"
6866 templateHTML = templateHTML & "<td colspan=4 align=center><p><b>" & ErrorMessage & "</b></p></td>"
6867 templateHTML = templateHTML & "</tr>"
6868 templateHTML = templateHTML & GetFooter()
6869
6870 Set WebBrowser = SDB.Objects("WebBrowser")
6871 WebBrowser.SetHTMLDocument templateHTML
6872
6873 Set templateHTMLDoc = WebBrowser.Interf.Document
6874 WebBrowser.Interf.Visible = true
6875 WebBrowser.Common.BringToFront
6876
6877 REM Set listBox = templateHTMLDoc.getElementById("searchpage")
6878 REM Script.RegisterEvent listBox, "onchange", "Filter"
6879
6880 Set listBox = templateHTMLDoc.getElementById("alternative")
6881 Script.RegisterEvent listBox, "onchange", "Alternative"
6882
6883 Set listBox = templateHTMLDoc.getElementById("filtermediatype")
6884 Script.RegisterEvent listBox, "onchange", "Filter"
6885 Set listBox = templateHTMLDoc.getElementById("filtermediaformat")
6886 Script.RegisterEvent listBox, "onchange", "Filter"
6887 Set listBox = templateHTMLDoc.getElementById("filtercountry")
6888 Script.RegisterEvent listBox, "onchange", "Filter"
6889 Set listBox = templateHTMLDoc.getElementById("filteryear")
6890 Script.RegisterEvent listBox, "onchange", "Filter"
6891 Set listBox = templateHTMLDoc.getElementById("load")
6892 Script.RegisterEvent listBox, "onchange", "Filter"
6893 Set submitButton = templateHTMLDoc.getElementById("showcountryfilter")
6894 Script.RegisterEvent submitButton, "onclick", "ShowCountryFilter"
6895 Set submitButton = templateHTMLDoc.getElementById("showmediatypefilter")
6896 Script.RegisterEvent submitButton, "onclick", "ShowMediaTypeFilter"
6897 Set submitButton = templateHTMLDoc.getElementById("showmediaformatfilter")
6898 Script.RegisterEvent submitButton, "onclick", "ShowMediaFormatFilter"
6899 Set submitButton = templateHTMLDoc.getElementById("showyearfilter")
6900 Script.RegisterEvent submitButton, "onclick", "ShowYearFilter"
6901 Set submitButton = templateHTMLDoc.getElementById("showadvancedsearch")
6902 Script.RegisterEvent submitButton, "onclick", "ShowAdvancedSearch"
6903
6904 SDB.Tools.WebSearch.ClearTracksData
6905
6906 If InStr(ErrorMessage, "You must authenticate to access this resource") > 0 Then
6907 res = SDB.MessageBox("OAuth Client Authentication Error. Do you want to re-authenticate Discogs Tagger ?", mtConfirmation, Array(mbYes, mbNo))
6908 If res = 6 Then
6909 AccessToken = ""
6910 AccessTokenSecret = ""
6911 ret = authorize_script(True)
6912 If ret = True Then
6913 FindResults NewSearchTerm, QueryPage
6914 End If
6915 End If
6916 End If
6917
6918End Sub
6919
6920
6921Function JSONParser_find_result(searchURL, ArrayName, SendArtist, SendAlbum, SendTrack, SendType, SendDBSearch, SendPerPage, QueryPage, useOAuth)
6922
6923 'useOAuth = True -> OAuth needed
6924 Dim oXMLHTTP, r, f, a, currentArtist, media, l
6925 Dim json
6926 Set json = New VbsJson
6927
6928 Dim response
6929 Dim format, title, country, v_year, label, artist, Rtype, catNo, main_release, tmp, ReleaseDesc, FilterFound, SongCount, SongCountMax, isRelease, listCount
6930 Dim Page, SongPages, trackCount, currentLabel
6931
6932 WriteLog " "
6933 WriteLog "+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+"
6934 WriteLog "Start JSONParser_find_result"
6935 WriteLog "Arrayname=" & ArrayName
6936 WriteLog "QueryPage=" & QueryPage
6937 WriteLog "searchURL=" & searchURL
6938 ErrorMessage = ""
6939
6940
6941 Set oXMLHTTP = CreateObject("MSXML2.XMLHTTP.6.0")
6942
6943 If QueryPage = "MetalArchives" Then
6944
6945 Dim MAReleases, MARelease, MABand, MAFormat, MALabel, MACatalogID, MADesc, MAReleasenumber, MADate, ctmp, MAURL
6946 Dim TXTBegin, TXTEnd, ResponseHTML, i
6947
6948 Set Results = SDB.NewStringList
6949 Set ResultsReleaseID = SDB.NewStringList
6950 ErrorMessage = ""
6951 ' searchURL = "https://www.metal-archives.com/search/ajax-advanced/searching/albums/?bandName=" & URLEncodeUTF8(CleanSearchString(NewSearchArtist)) & "&exactBandMatch=1&releaseTitle=" & URLEncodeUTF8(CleanSearchString(NewSearchAlbum)) & "&exactReleaseMatch=1&releaseYearFrom=&releaseMonthFrom=&releaseYearTo=&releaseMonthTo=&country=&location=&releaseLabelName=&genre="
6952 WriteLog searchURL
6953 oXMLHTTP.open "GET", searchURL, false
6954 oXMLHTTP.send()
6955 if oXMLHTTP.Status = 200 Then
6956 ResponseHTML = oXMLHTTP.responseText
6957 ' Dim fso : Set fso = CreateObject("Scripting.FileSystemObject")
6958 ' Dim f
6959 ' Set f = fso.OpenTextFile(SDB.ScriptsPath&"test.log", 2, true, -1)
6960 ' f.WriteLine ResponseHTML
6961 ' f.Close
6962 TXTBegin = InStr(ResponseHTML, "iTotalDisplayRecords")
6963 If TXTBegin > 1 Then
6964 ResponseHTML = Mid(ResponseHTML, TXTBegin + 23)
6965 TXTEnd = InStr(ResponseHTML, ",")
6966 MAReleases = Left(ResponseHTML, TXTEnd -1)
6967 WriteLog "Anzahl=" & MAReleases
6968 If MAReleases = 1 Then
6969 TXTBegin = InStr(ResponseHTML, "\" & Chr(34) & ">")
6970 If TXTBegin > 1 Then
6971 ResponseHTML = Mid(ResponseHTML, TXTBegin + 3)
6972 TXTEnd = InStr(responseHTML, "</a>")
6973 WriteLog "Band=" & Left(ResponseHTML, TXTEnd - 1)
6974 MABand = Left(ResponseHTML, TXTEnd - 1)
6975
6976 TXTBegin = InStr(ResponseHTML, "href=\")
6977 ResponseHTML = Mid(ResponseHTML, TXTBegin + 7)
6978 TXTEnd = InStr(ResponseHTML, "\" & Chr(34) & ">")
6979 WriteLog "Album-URL=" & Left(ResponseHTML, TXTEnd - 1)
6980 tmp = Left(ResponseHTML, TXTEnd - 1)
6981 ctmp = InStrRev(tmp, "/")
6982 MAReleasenumber = Mid(tmp, ctmp+1)
6983 WriteLog "ReleaseNumber=" & MAReleasenumber
6984
6985 TXTBegin = TXTEnd + 3
6986 ResponseHTML = Mid(ResponseHTML, TXTBegin)
6987 TXTEnd = InStr(responseHTML, "</a>")
6988 WriteLog "Album=" & Left(ResponseHTML, TXTEnd - 1)
6989 MARelease = Left(ResponseHTML, TXTEnd - 1)
6990
6991 ResponseHTML = Mid(ResponseHTML, TXTEnd)
6992 TXTBegin = InStr(ResponseHTML, ",")
6993 ResponseHTML = Mid(ResponseHTML, TXTBegin)
6994 TXTBegin = InStr(ResponseHTML, Chr(34))
6995 ResponseHTML = Mid(ResponseHTML, TXTBegin + 1)
6996 TXTEnd = InStr(responseHTML, Chr(34))
6997 WriteLog "Type=" & Left(ResponseHTML, TXTEnd - 1)
6998
6999 searchURL = "https://www.metal-archives.com/release/ajax-versions/current/" & MAReleasenumber & "/parent/" & MAReleasenumber
7000 WriteLog searchURL
7001 oXMLHTTP.open "GET", searchURL, false
7002 oXMLHTTP.send()
7003 if oXMLHTTP.Status = 200 Then
7004 ResponseHTML = oXMLHTTP.responseText
7005 Do
7006 TXTBegin = InStr(ResponseHTML, "<td>")
7007 ResponseHTML = Mid(ResponseHTML, TXTBegin + 4)
7008 TXTBegin = InStr(ResponseHTML, "href=")
7009 ResponseHTML = Mid(ResponseHTML, TXTBegin + 6)
7010 TXTEnd = InStr(ResponseHTML, Chr(34) & ">")
7011 WriteLog "Album-URL=" & Left(ResponseHTML, TXTEnd - 1)
7012 MAURL = Left(ResponseHTML, TXTEnd - 1)
7013 ResponseHTML = Mid(ResponseHTML, TXTEnd + 2)
7014 TXTEnd = InStr(ResponseHTML, "</a>")
7015 MADate = Left(ResponseHTML, TXTEnd -1)
7016 WriteLog "Date=" & MADate
7017
7018 ResponseHTML = Mid(ResponseHTML, TXTEnd + 4)
7019 TXTBegin = InStr(ResponseHTML, "<td>")
7020 ResponseHTML = Mid(ResponseHTML, TXTBegin + 4)
7021 TXTEnd = InStr(ResponseHTML, "</td>")
7022 MALabel = Left(ResponseHTML, TXTEnd - 1)
7023 WriteLog "Label=" & MALabel
7024
7025 ResponseHTML = Mid(ResponseHTML, TXTEnd)
7026 TXTBegin = InStr(ResponseHTML, "<td>")
7027 ResponseHTML = Mid(ResponseHTML, TXTBegin + 4)
7028 TXTEnd = InStr(ResponseHTML, "</td>")
7029 If TXTEnd > 1 Then
7030 MACatalogID = Left(ResponseHTML, TXTEnd - 1)
7031 Else
7032 MACatalogID = ""
7033 End If
7034 WriteLog "Catalog ID=" & MACatalogID
7035
7036 ResponseHTML = Mid(ResponseHTML, TXTEnd)
7037 TXTBegin = InStr(ResponseHTML, "<td>")
7038 ResponseHTML = Mid(ResponseHTML, TXTBegin + 4)
7039 TXTEnd = InStr(ResponseHTML, "</td>")
7040 MAFormat = Left(ResponseHTML, TXTEnd - 1)
7041 WriteLog "Format=" & MAFormat
7042
7043 ResponseHTML = Mid(ResponseHTML, TXTEnd)
7044 TXTBegin = InStr(ResponseHTML, "<td>")
7045 ResponseHTML = Mid(ResponseHTML, TXTBegin + 4)
7046 TXTEnd = InStr(ResponseHTML, "</td>")
7047 If TXTEnd > 1 Then
7048 MADesc = Left(ResponseHTML, TXTEnd - 1)
7049 Else
7050 MADesc = ""
7051 End If
7052 WriteLog "Description=" & MADesc
7053 ResponseHTML = Mid(ResponseHTML, TXTEnd)
7054
7055 Results.Add MABand & " - " & MARelease & " (" & MADate & ") " & MALabel & " / " & MAFormat & " / " & MACatalogID
7056 ResultsReleaseID.Add MAURL
7057
7058 Loop While InStr(ResponseHTML, "<td>") > 0
7059 End If
7060 End If
7061 Else
7062 For i = 1 to MAReleases
7063 TXTBegin = InStr(ResponseHTML, "\" & Chr(34) & ">")
7064 If TXTBegin > 1 Then
7065 ResponseHTML = Mid(ResponseHTML, TXTBegin + 3)
7066 TXTEnd = InStr(responseHTML, "</a>")
7067
7068 WriteLog "Band=" & Left(ResponseHTML, TXTEnd - 1)
7069 ReleaseDesc = Left(ResponseHTML, TXTEnd - 1)
7070
7071 TXTBegin = InStr(ResponseHTML, "href=\")
7072 ResponseHTML = Mid(ResponseHTML, TXTBegin + 7)
7073 TXTEnd = InStr(ResponseHTML, "\" & Chr(34) & ">")
7074 WriteLog "Album-URL=" & Left(ResponseHTML, TXTEnd - 1)
7075 ResultsReleaseID.Add Left(ResponseHTML, TXTEnd - 1)
7076
7077 TXTBegin = TXTEnd + 3
7078 ResponseHTML = Mid(ResponseHTML, TXTBegin)
7079 TXTEnd = InStr(responseHTML, "</a>")
7080 WriteLog "Album=" & Left(ResponseHTML, TXTEnd - 1)
7081 ReleaseDesc = ReleaseDesc & " / " & Left(ResponseHTML, TXTEnd - 1)
7082
7083 ResponseHTML = Mid(ResponseHTML, TXTEnd)
7084 TXTBegin = InStr(ResponseHTML, ",")
7085 ResponseHTML = Mid(ResponseHTML, TXTBegin)
7086 TXTBegin = InStr(ResponseHTML, Chr(34))
7087 ResponseHTML = Mid(ResponseHTML, TXTBegin + 1)
7088 TXTEnd = InStr(responseHTML, Chr(34))
7089 WriteLog "Type=" & Left(ResponseHTML, TXTEnd - 1)
7090 ReleaseDesc = ReleaseDesc & " / " & Left(ResponseHTML, TXTEnd - 1)
7091 Results.Add ReleaseDesc
7092 End If
7093 Next
7094 End If
7095 End If
7096 End If
7097 End If
7098
7099
7100
7101 If QueryPage = "MusicBrainz" Then
7102
7103 oXMLHTTP.Open "GET", searchURL, False
7104 oXMLHTTP.setRequestHeader "Content-Type", "application/json"
7105 oXMLHTTP.setRequestHeader "User-Agent",UserAgent
7106 oXMLHTTP.send ()
7107
7108 If oXMLHTTP.Status = 200 Then
7109 WriteLog "Musicbrainz"
7110 WriteLog "responseText=" & oXMLHTTP.responseText
7111 Set response = json.Decode(oXMLHTTP.responseText)
7112 If ArrayName = "Artist" Or ArrayName = "Label" Then
7113 ArrayName = "releases"
7114 SongCountMax = response("release-count")
7115 Else
7116 SongCountMax = response("count")
7117 End If
7118 'check if any results
7119 'and add titles to drop down
7120 'msgbox response(ArrayName)(0)("title")
7121
7122 SongCount = 0
7123
7124 WriteLog "SongCountMax=" & SongCountMax
7125 If Int(SongCountMax) = 0 Then
7126 WriteLog "No Release found at MusicBrainz"
7127 Results.Add "No Release found at MusicBrainz !! Please change the search parameter."
7128 ResultsReleaseID.Add 0
7129 Else
7130
7131 isRelease = False
7132 If Results.Count = 1 Then isRelease = True
7133 For Each r In response(ArrayName) 'releases
7134 format = ""
7135 title = ""
7136 country = ""
7137 v_year = ""
7138 artist = ""
7139 label = ""
7140 catNo = ""
7141 main_release = ""
7142 media = ""
7143
7144 SDB.ProcessMessages
7145
7146 WriteLog "Release Nr." & SongCount
7147 title = response(ArrayName)(r)("title")
7148 WriteLog "title=" & title
7149 Set CurrentRelease = response(ArrayName)(r)
7150 If CurrentRelease.Exists("artist-credit") Then
7151 Set currentArtist = response(ArrayName)(r)("artist-credit")
7152 For Each f In currentArtist
7153 artist = artist & currentArtist(f)("artist")("name") & ", "
7154 Next
7155 If Len(artist) <> 0 Then artist = Left(artist, Len(artist)-2)
7156 WriteLog "artist=" & artist
7157 End If
7158
7159 If CurrentRelease.Exists("media") Then
7160 For Each f In response(ArrayName)(r)("media")
7161 If response(ArrayName)(r)("media")(f)("format") <> "" Then
7162 If format = "" Then
7163 format = response(ArrayName)(r)("media")(f)("format")
7164 media = format
7165 Else
7166 If media <> response(ArrayName)(r)("media")(f)("format") Then
7167 format = format & " & " & response(ArrayName)(r)("media")(f)("format")
7168 End If
7169 End If
7170 End If
7171 Next
7172 REM If Len(format) <> 0 Then format = Left(format, Len(format)-2)
7173 WriteLog "format=" & format
7174 End If
7175 tmp = ""
7176 If CurrentRelease.Exists("release-group") Then
7177 tmp = CurrentRelease("release-group")("primary-type")
7178 If format <> "" Then
7179 format = format & ", " & tmp
7180 Else
7181 format = tmp
7182 End If
7183 Set tmp = CurrentRelease("release-group")
7184 If tmp.Exists("secondary-types") Then
7185 For Each f In tmp("secondary-types")
7186 If CurrentRelease("release-group")("secondary-types")(f) <> "" Then
7187 format = format & ", " & CurrentRelease("release-group")("secondary-types")(f)
7188 End If
7189 Next
7190 WriteLog "format=" & format
7191 End If
7192 End If
7193
7194 If CurrentRelease.Exists("country") And Not IsNull(CurrentRelease("country")) Then
7195 country = CurrentRelease("country")
7196 For f = 1 To CountryCode.Count
7197 If country = CountryCode.Item(f) Then
7198 country = CountryList.Item(f)
7199 Exit For
7200 End If
7201 Next
7202 WriteLog "country=" & country
7203 End If
7204 If CurrentRelease.Exists("date") Then
7205 v_year = response(ArrayName)(r)("date")
7206 If Len(v_year) > 4 Then v_year = Left(v_year, 4)
7207 WriteLog "year=" & v_year
7208 End If
7209
7210 If CurrentRelease.Exists("label-info") Then
7211 For Each l In CurrentRelease("label-info")
7212 Set currentLabel = CurrentRelease("label-info")(l)
7213 If currentLabel.Exists("label") Then
7214 If Not IsNull(currentLabel("label")("name")) Then
7215 If label <> "" Then
7216 If Left(label, Len(label)-2) <> CleanArtistName(currentLabel("label")("name")) Then
7217 label = label & CleanArtistName(currentLabel("label")("name")) & ", "
7218 End If
7219 Else
7220 label = CleanArtistName(currentLabel("label")("name")) & ", "
7221 End If
7222 End If
7223 End If
7224 If Not IsNull(currentLabel("catalog-number")) Then
7225 catNo = currentLabel("catalog-number")
7226 WriteLog "catNo=" & catNo
7227 End If
7228 Next
7229 If Len(label) <> 0 Then label = Left(label, Len(label)-2)
7230 WriteLog "label=" & label
7231 End If
7232
7233 If CurrentRelease.Exists("track-count") And Not IsNull(CurrentRelease("track-count")) Then
7234 trackCount = CurrentRelease("track-count")
7235 Else
7236 trackCount = ""
7237 End If
7238
7239 ReleaseDesc = ""
7240 Do
7241 If FilterMediaType = "Use MediaType Filter" And Format <> "" Then
7242 FilterFound = False
7243 For a = 1 To MediaTypeList.Count - 1
7244 If InStr(Format, MediaTypeList.Item(a)) <> 0 And MediaTypeFilterList.Item(a) = "1" Then FilterFound = True
7245 Next
7246 If FilterFound = False Then Exit Do
7247 End If
7248 If(FilterMediaType <> "None" And FilterMediaType <> "Use MediaType Filter" And InStr(format, FilterMediaType) = 0 And format <> "") Then Exit Do
7249
7250 If FilterMediaFormat = "Use MediaFormat Filter" And format <> "" Then
7251 FilterFound = False
7252 For a = 1 To MediaFormatList.Count - 1
7253 If InStr(format, MediaFormatList.Item(a)) <> 0 And MediaFormatFilterList.Item(a) = "1" Then FilterFound = True
7254 Next
7255 If FilterFound = False Then Exit Do
7256 End If
7257 If(FilterMediaFormat <> "None" And FilterMediaFormat <> "Use MediaFormat Filter" And InStr(format, FilterMediaFormat) = 0 And Format <> "") Then Exit Do
7258
7259 If FilterCountry = "Use Country Filter" And country <> "" Then
7260 FilterFound = False
7261 For a = 1 To CountryList.Count - 1
7262 If InStr(country, CountryList.Item(a)) <> 0 And CountryFilterList.Item(a) = "1" Then FilterFound = True
7263 Next
7264 If FilterFound = False Then Exit Do
7265 End If
7266 If(FilterCountry <> "None" And FilterCountry <> "Use Country Filter" And InStr(country, FilterCountry) = 0 And country <> "") Then Exit Do
7267
7268 If FilterYear = "Use Year Filter" And v_year <> "" Then
7269 FilterFound = False
7270 For a = 1 To YearList.Count - 1
7271 If InStr(v_year, YearList.Item(a)) <> 0 And YearFilterList.Item(a) = "1" Then FilterFound = True
7272 Next
7273 If FilterFound = False Then Exit Do
7274 End If
7275 If(FilterYear <> "None" And FilterYear <> "Use Year Filter" And InStr(v_year, FilterYear) = 0 And v_year <> "") Then Exit Do
7276
7277 If Rtype = "master" Then ReleaseDesc = ReleaseDesc & "* " End If
7278 If artist <> "" Then ReleaseDesc = ReleaseDesc & " " & artist End If
7279 If artist <> "" and title <> "" Then ReleaseDesc = ReleaseDesc & " -" End If
7280 If title <> "" Then ReleaseDesc = ReleaseDesc & " " & title End If
7281 If trackCount <> "" Then ReleaseDesc = ReleaseDesc & ", TrackCount: " & trackCount End If
7282 If format <> "" Then ReleaseDesc = ReleaseDesc & " [" & format & "]" End If
7283 If country <> "" Then ReleaseDesc = ReleaseDesc & " " & country End If
7284 If v_year <> "" Then ReleaseDesc = ReleaseDesc & " (" & v_year & ")" End If
7285 If catNo <> "" Then ReleaseDesc = ReleaseDesc & " catNo:" & catNo End If
7286 If ArrayName <> "Label" Then
7287 If label <> "" Then ReleaseDesc = ReleaseDesc & " / " & label End If
7288 End If
7289
7290 Results.Add ReleaseDesc
7291 ResultsReleaseID.Add response(ArrayName)(r)("id")
7292 Loop While False
7293
7294 SongCount = SongCount + 1
7295 Next
7296 ListCount = 1
7297 For r = 1 to Results.Count
7298 If r= 1 and isRelease = True Then
7299 Results.Item(0) = "(" & SongCountMax & ") " & Results.Item(0)
7300 Else
7301 If SongCount <> SongCountMax Then
7302 Results.Item(r-1) = "(" & ListCount & "/" & SongCount & "/" & SongCountMax & ") " & Results.Item(r-1)
7303 Else
7304 Results.Item(r-1) = "(" & ListCount & "/" & SongCountMax & ") " & Results.Item(r-1)
7305 End If
7306 ListCount = ListCount + 1
7307 End If
7308 Next
7309 End If
7310 ElseIf oXMLHTTP.Status = 503 Then
7311 ErrorMessage = "Status:" & oXMLHTTP.Status & " - The number of requests exceeds the limit. Please try again later"
7312 WriteLog "Status=" & oXMLHTTP.Status
7313 Else
7314 ErrorMessage = "Status:" & oXMLHTTP.Status & " - Please try again later"
7315 WriteLog "Status=" & oXMLHTTP.Status
7316 End If
7317
7318 End If
7319
7320 If QueryPage = "Discogs" Then
7321
7322 ' use json api with vbsjson class at start of file now
7323
7324 If useOAuth = True Then
7325 oXMLHTTP.Open "POST", "https://www.germanc64.de/mm/oauth/check_new_v2.php", False
7326 oXMLHTTP.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
7327 oXMLHTTP.setRequestHeader "User-Agent",UserAgent
7328 If LimitReleases = 50 Then SendPerPage = 50
7329 WriteLog "Sending Post at=" & AccessToken & "&ats=" & AccessTokenSecret & "&artist=" & SendArtist & "&album=" & SendAlbum & "&track=" & SendTrack & "&type=" & SendType & "&dbsearch=" & SendDBSearch & "&perpage=" & SendPerPage & "&querypage=" & QueryPage & "&page=1" & "&version=" & VersionStr
7330 oXMLHTTP.send ("at=" & AccessToken & "&ats=" & AccessTokenSecret & "&artist=" & SendArtist & "&album=" & SendAlbum & "&track=" & SendTrack & "&type=" & SendType & "&dbsearch=" & SendDBSearch & "&perpage=" & SendPerPage & "&querypage=" & QueryPage & "&page=1" & "&version=" & VersionStr)
7331
7332 If oXMLHTTP.Status = 200 Then
7333 If InStr(oXMLHTTP.responseText, "OAuth client error") <> 0 Then
7334 WriteLog "responseText=" & oXMLHTTP.responseText
7335 ErrorMessage = oXMLHTTP.responseText
7336 Exit Function
7337 Else
7338 WriteLog "responseText=" & oXMLHTTP.responseText
7339 Set response = json.Decode(oXMLHTTP.responseText)
7340 End If
7341 Else
7342 WriteLog "Error in JSONParser_find_result"
7343 WriteLog "Returned StatusCode=" & oXMLHTTP.Status
7344 ErrorMessage = "Problem with fetching data from Discogs - StatusCode=" & oXMLHTTP.Status
7345 End If
7346 Else
7347
7348 oXMLHTTP.Open "GET", searchURL, False
7349 oXMLHTTP.setRequestHeader "Content-Type","application/json"
7350 oXMLHTTP.setRequestHeader "User-Agent",UserAgent
7351 oXMLHTTP.send()
7352
7353 If oXMLHTTP.Status = 200 Then
7354 WriteLog "responseText=" & oXMLHTTP.responseText
7355 Set response = json.Decode(oXMLHTTP.responseText)
7356 Else
7357 WriteLog "Error in JSONParser_find_result"
7358 WriteLog "Returned StatusCode=" & oXMLHTTP.Status
7359 ErrorMessage = "Problem with fetching data from Discogs - StatusCode=" & oXMLHTTP.Status
7360 End If
7361 End If
7362
7363 If ErrorMessage = "" Then
7364 SongCount = 0
7365 SongCountMax = response("pagination")("items")
7366
7367 WriteLog "SongCountMax=" & SongCountMax
7368
7369 If Int(SongCountMax) = 0 Then
7370 WriteLog "No Release found at Discogs !!"
7371 Results.Add "No Release found at Discogs !! Please change the search parameter in 'Manual search'."
7372 ResultsReleaseID.Add 0
7373 Else
7374 isRelease = False
7375 If Results.Count = 1 Then isRelease = True
7376 SongPages = response("pagination")("pages")
7377 WriteLog "SongPages=" & SongPages
7378 For Page = 1 to SongPages
7379 If Page <> 1 Then
7380 oXMLHTTP.Open "POST", "https://www.germanc64.de/mm/oauth/check_new_v2.php", False
7381 oXMLHTTP.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
7382 oXMLHTTP.setRequestHeader "User-Agent",UserAgent
7383 WriteLog "Sending Post at=" & AccessToken & "&ats=" & AccessTokenSecret & "&artist=" & SendArtist & "&album=" & SendAlbum & "&track=" & SendTrack & "&type=" & SendType & "&dbsearch=" & SendDBSearch & "&perpage=" & SendPerPage & "&querypage=" & QueryPage & "&page=" & Page & "&version=" & VersionStr
7384 oXMLHTTP.send ("at=" & AccessToken & "&ats=" & AccessTokenSecret & "&artist=" & SendArtist & "&album=" & SendAlbum & "&track=" & SendTrack & "&type=" & SendType & "&dbsearch=" & SendDBSearch & "&perpage=" & SendPerPage & "&querypage=" & QueryPage & "&page=" & Page & "&version=" & VersionStr)
7385 If oXMLHTTP.Status = 200 Then
7386 If InStr(oXMLHTTP.responseText, "OAuth client error") <> 0 Then
7387 WriteLog "responseText=" & oXMLHTTP.responseText
7388 ErrorMessage = oXMLHTTP.responseText
7389 Exit Function
7390 Else
7391 Set response = json.Decode(oXMLHTTP.responseText)
7392 End If
7393 Else
7394 WriteLog "Error in JSONParser_find_result"
7395 ErrorMessage = "Error in JSONParser_find_result"
7396 Exit For
7397 End If
7398 End If
7399
7400 For Each r In response(ArrayName)
7401 format = ""
7402 title = ""
7403 country = ""
7404 v_year = ""
7405 artist = ""
7406 label = ""
7407 Rtype = ""
7408 catNo = ""
7409 main_release = ""
7410
7411 SDB.ProcessMessages
7412
7413 title = response(ArrayName)(r)("title")
7414 Set tmp = response(ArrayName)(r)
7415 If tmp.Exists("artist") Then
7416 artist = tmp("artist")
7417 End If
7418 If tmp.Exists("main_release") Then
7419 main_release = tmp("main_release")
7420 End If
7421 If ArrayName = "results" Then
7422 If tmp.Exists("format") Then
7423 For Each f In response(ArrayName)(r)("format")
7424 AddToFieldWD format, response(ArrayName)(r)("format")(f)
7425 ' format = format & response(ArrayName)(r)("format")(f) & ", "
7426 Next
7427 ' If Len(format) <> 0 Then format = Left(format, Len(format)-2)
7428 End If
7429 Else
7430 If tmp.Exists("format") Then
7431 format = response(ArrayName)(r)("format")
7432 End If
7433 End If
7434
7435 If tmp.Exists("country") Then
7436 country = response(ArrayName)(r)("country")
7437 End If
7438 If ArrayName = "versions" Then
7439 If tmp.Exists("released") Then
7440 v_year = response(ArrayName)(r)("released")
7441 End If
7442 Else
7443 If tmp.Exists("year") Then
7444 v_year = response(ArrayName)(r)("year")
7445 End If
7446 End If
7447 If tmp.Exists("catno") Then
7448 catNo = response(ArrayName)(r)("catno")
7449 End If
7450 If tmp.Exists("type") Then
7451 Rtype = response(ArrayName)(r)("type")
7452 End If
7453 If ArrayName = "results" Then
7454 If tmp.Exists("label") Then
7455 For Each f In response(ArrayName)(r)("label")
7456 ' If label <> "" Then
7457 ' If Left(label, Len(label)-2) <> response(ArrayName)(r)("label")(f) Then
7458 ' label = label & response(ArrayName)(r)("label")(f) & ", "
7459 ' End If
7460 ' Else
7461 ' label = response(ArrayName)(r)("label")(f) & ", "
7462 ' End If
7463 AddToFieldWD label, CleanArtistName(response(ArrayName)(r)("label")(f))
7464 Next
7465 ' If Len(label) <> 0 Then label = Left(label, Len(label)-2)
7466 End If
7467 Else
7468 If tmp.Exists("label") Then label = response(ArrayName)(r)("label")
7469 End If
7470 ReleaseDesc = ""
7471 Do
7472 If FilterMediaType = "Use MediaType Filter" And Format <> "" Then
7473 FilterFound = False
7474 For a = 1 To MediaTypeList.Count - 1
7475 If InStr(Format, MediaTypeList.Item(a)) <> 0 And MediaTypeFilterList.Item(a) = "1" Then FilterFound = True
7476 Next
7477 If FilterFound = False Then Exit Do
7478 End If
7479 If(FilterMediaType <> "None" And FilterMediaType <> "Use MediaType Filter" And InStr(format, FilterMediaType) = 0 And format <> "") Then Exit Do
7480
7481 If FilterMediaFormat = "Use MediaFormat Filter" And format <> "" Then
7482 FilterFound = False
7483 For a = 1 To MediaFormatList.Count - 1
7484 If InStr(format, MediaFormatList.Item(a)) <> 0 And MediaFormatFilterList.Item(a) = "1" Then FilterFound = True
7485 Next
7486 If FilterFound = False Then Exit Do
7487 End If
7488 If(FilterMediaFormat <> "None" And FilterMediaFormat <> "Use MediaFormat Filter" And InStr(format, FilterMediaFormat) = 0 And Format <> "") Then Exit Do
7489
7490 If FilterCountry = "Use Country Filter" And country <> "" Then
7491 FilterFound = False
7492 For a = 1 To CountryList.Count - 1
7493 If InStr(country, CountryList.Item(a)) <> 0 And CountryFilterList.Item(a) = "1" Then FilterFound = True
7494 Next
7495 If FilterFound = False Then Exit Do
7496 End If
7497 If(FilterCountry <> "None" And FilterCountry <> "Use Country Filter" And InStr(country, FilterCountry) = 0 And country <> "") Then Exit Do
7498
7499 If FilterYear = "Use Year Filter" And v_year <> "" Then
7500 FilterFound = False
7501 For a = 1 To YearList.Count - 1
7502 If InStr(v_year, YearList.Item(a)) <> 0 And YearFilterList.Item(a) = "1" Then FilterFound = True
7503 Next
7504 If FilterFound = False Then Exit Do
7505 End If
7506 If(FilterYear <> "None" And FilterYear <> "Use Year Filter" And InStr(v_year, FilterYear) = 0 And v_year <> "") Then Exit Do
7507
7508 If Rtype = "master" Then ReleaseDesc = ReleaseDesc & "* " End If
7509 If artist <> "" Then ReleaseDesc = ReleaseDesc & " " & artist End If
7510 If artist <> "" and title <> "" Then ReleaseDesc = ReleaseDesc & " -" End If
7511 If title <> "" Then ReleaseDesc = ReleaseDesc & " " & title End If
7512 If format <> "" Then ReleaseDesc = ReleaseDesc & " [" & format & "]" End If
7513 If country <> "" Then ReleaseDesc = ReleaseDesc & " " & country End If
7514 If v_year <> "" Then ReleaseDesc = ReleaseDesc & " (" & v_year & ")" End If
7515 If catNo <> "" Then ReleaseDesc = ReleaseDesc & " catNo:" & catNo End If
7516 If label <> "" Then ReleaseDesc = ReleaseDesc & " / " & label End If
7517
7518 Results.Add ReleaseDesc
7519 ResultsReleaseID.Add response(ArrayName)(r)("id")
7520 Loop While False
7521 SongCount = SongCount + 1
7522 If SongCount = LimitReleases Then Exit For
7523 Next
7524 If SongCount = LimitReleases Then Exit For
7525 Next
7526 ListCount = 1
7527 For r = 1 to Results.Count
7528 If r= 1 and isRelease = True Then
7529 Results.Item(0) = "(" & SongCountMax & ") " & Results.Item(0)
7530 Else
7531 If SongCount <> SongCountMax Then
7532 Results.Item(r-1) = "(" & ListCount & "/" & SongCount & "/" & SongCountMax & ") " & Results.Item(r-1)
7533 Else
7534 Results.Item(r-1) = "(" & ListCount & "/" & SongCountMax & ") " & Results.Item(r-1)
7535 End IF
7536 ListCount = ListCount + 1
7537 End If
7538 Next
7539 End If
7540 End If
7541 End If
7542 Set oXMLHTTP = Nothing
7543 WriteLog "End JSONParser_find_result"
7544
7545End Function
7546
7547
7548Function ReloadMaster(SavedMasterID)
7549
7550 WriteLog "Start ReloadMaster"
7551 Dim oXMLHTTP, masterURL
7552 masterURL = "https://api.discogs.com/masters/" & SavedMasterID
7553 Set oXMLHTTP = CreateObject("MSXML2.XMLHTTP.6.0")
7554
7555 Dim json
7556 Set json = New VbsJson
7557 Dim response
7558
7559 oXMLHTTP.open "GET", masterURL, false
7560 oXMLHTTP.setRequestHeader "Content-Type","application/json"
7561 oXMLHTTP.setRequestHeader "User-Agent",UserAgent
7562 oXMLHTTP.send()
7563
7564 If oXMLHTTP.Status = 200 Then
7565 WriteLog "responseText=" & oXMLHTTP.responseText
7566 If InStr(oXMLHTTP.responseText, "OAuth client error") <> 0 Then
7567 ErrorMessage = oXMLHTTP.responseText
7568 Exit Function
7569 Else
7570 Set response = json.Decode(oXMLHTTP.responseText)
7571 If response.Exists("year") Then
7572 OriginalDate = response("year")
7573 Else
7574 OriginalDate = ""
7575 End If
7576 If OriginalDate = 0 Then OriginalDate = ""
7577 End If
7578 End If
7579 Set oXMLHTTP = Nothing
7580 ReloadMaster = OriginalDate
7581 WriteLog "Stop ReloadMaster"
7582
7583End Function
7584
7585
7586
7587Function get_release_ID(FirstTrack)
7588
7589 CurrentReleaseId = ""
7590 If ReleaseTag = "Custom1" Then CurrentReleaseId = FirstTrack.Custom1
7591 If ReleaseTag = "Custom2" Then CurrentReleaseId = FirstTrack.Custom2
7592 If ReleaseTag = "Custom3" Then CurrentReleaseId = FirstTrack.Custom3
7593 If ReleaseTag = "Custom4" Then CurrentReleaseId = FirstTrack.Custom4
7594 If ReleaseTag = "Custom5" Then CurrentReleaseId = FirstTrack.Custom5
7595 If ReleaseTag = "Grouping" Then CurrentReleaseId = FirstTrack.Grouping
7596 If ReleaseTag = "ISRC" Then CurrentReleaseId = FirstTrack.ISRC
7597 If ReleaseTag = "Encoder" Then CurrentReleaseId = FirstTrack.Encoder
7598 If ReleaseTag = "Copyright" Then CurrentReleaseId = FirstTrack.Copyright
7599
7600 get_release_ID = CurrentReleaseId
7601
7602End Function
7603
7604
7605
7606Sub Unselect()
7607
7608 Dim templateHTMLDoc, i, checkBox
7609
7610 Set WebBrowser = SDB.Objects("WebBrowser")
7611 Set templateHTMLDoc = WebBrowser.Interf.Document
7612
7613 For i=0 To iMaxTracks - 1
7614 If Grouping(i) <> "|Heading|" Then
7615 Set checkBox = templateHTMLDoc.getElementById("unselected["&i&"]")
7616 If checkBox.Checked Then
7617 UnselectedTracks(i) = ""
7618 Else
7619 UnselectedTracks(i) = "x"
7620 End If
7621 Set checkBox = templateHTMLDoc.getElementById("unselectedtrackname["&i&"]")
7622 If checkBox.Checked Then
7623 UnselectedTrackNames(i) = ""
7624 Else
7625 UnselectedTrackNames(i) = "x"
7626 End If
7627 End If
7628 Next
7629
7630 ReloadResults
7631
7632End Sub
7633
7634
7635Sub ShowCountryFilter
7636
7637 Dim Form, iWidth, CountColumn, filterHTML, filterHTMLDoc, WebBrowser2, countrybutton, FilterFound
7638 Dim i, a
7639 Set Form = UI.NewForm
7640 Form.Common.Width = 875
7641 Form.Common.Height = 600
7642 Form.FormPosition = 4
7643 Form.Caption = "Choose the country's to search for"
7644 Form.BorderStyle = 3
7645 Form.StayOnTop = True
7646 SDB.Objects("FilterForm") = Form
7647 SDB.Objects("Filter") = CountryList
7648 CountColumn = (CountryList.Count - 1) / 65
7649 iWidth = Round((CountryList.Count - 1) / 65 * 200)
7650 If Round(CountColumn) < CountColumn Then
7651 CountColumn = Round(CountColumn) + 1
7652 Else
7653 CountColumn = Round(CountColumn)
7654 End If
7655 filterHTML = GetFilterHTML(iWidth, 64, CountColumn)
7656
7657 Dim Foot : Set Foot = SDB.UI.NewPanel(Form)
7658 Foot.Common.Align = 2
7659 Foot.Common.Height = 35
7660
7661 Dim Btn : Set Btn = SDB.UI.NewButton(Foot)
7662 Btn.Caption = SDB.Localize("Cancel")
7663 Btn.Common.Width = 85
7664 Btn.Common.Height = 25
7665 Btn.Common.Left = Form.Common.Width - Btn.Common.Width - 30
7666 Btn.Common.Top = 6
7667 Btn.Common.Anchors = 2+4
7668 Btn.UseScript = Script.ScriptPath
7669 Btn.ModalResult = 2
7670 Btn.Cancel = True
7671
7672 Dim Btn2 : Set Btn2 = SDB.UI.NewButton(Foot)
7673 Btn2.Caption = SDB.Localize("Ok")
7674 Btn2.Common.Width = 85
7675 Btn2.Common.Height = 25
7676 Btn2.Common.Left = Btn.Common.Left - Btn2.Common.Width - 5
7677 Btn2.Common.Top = 6
7678 Btn2.Common.Anchors = 2+4
7679 Btn2.UseScript = Script.ScriptPath
7680 Btn2.ModalResult = 1
7681 Btn2.Default = True
7682
7683 Dim Btn3 : Set Btn3 = SDB.UI.NewButton(Foot)
7684 Btn3.Caption = SDB.Localize("&Check All")
7685 Btn3.Common.Width = 85
7686 Btn3.Common.Height = 25
7687 Btn3.Common.Left = 15
7688 Btn3.Common.Top = 6
7689 Btn3.Common.Anchors = 2+4
7690 Script.RegisterEvent Btn3, "OnClick", "Btn3Click"
7691
7692 Dim Btn4 : Set Btn4 = SDB.UI.NewButton(Foot)
7693 Btn4.Caption = SDB.Localize("&Uncheck all")
7694 Btn4.Common.Width = 85
7695 Btn4.Common.Height = 25
7696 Btn4.Common.Left = Btn3.Common.Left + Btn4.Common.Width + 5
7697 Btn4.Common.Top = 6
7698 Btn4.Common.Anchors = 2+4
7699 Script.RegisterEvent Btn4, "OnClick", "Btn4Click"
7700
7701 Set WebBrowser2 = UI.NewActiveX(Form, "Shell.Explorer")
7702 WebBrowser2.Common.Align = 5
7703 WebBrowser2.Common.ControlName = "WebBrowser2"
7704 WebBrowser2.Common.Top = 100
7705 WebBrowser2.Common.Left = 100
7706
7707 SDB.Objects("WebBrowser2") = WebBrowser2
7708 WebBrowser2.Interf.Visible = True
7709 WebBrowser2.Common.BringToFront
7710
7711 WebBrowser2.SetHTMLDocument filterHTML
7712 Set filterHTMLDoc = WebBrowser2.Interf.Document
7713
7714 For i = 1 To CountryList.Count - 1
7715 Set countrybutton = filterHTMLDoc.getElementById("Filter" & i)
7716 If CountryFilterList.Item(i) = "1" Then
7717 countrybutton.checked = True
7718 End If
7719 Next
7720
7721 If Form.ShowModal = 1 Then
7722 FilterFound = False
7723 For a = 1 To CountryList.Count - 1
7724 Set countrybutton = filterHTMLDoc.getElementById("Filter" & a)
7725 If countrybutton.checked = True Then
7726 CountryFilterList.Item(a) = "1"
7727 FilterFound = True
7728 Else
7729 CountryFilterList.Item(a) = "0"
7730 End If
7731 Next
7732 If FilterFound = False Then
7733 FilterCountry = "None"
7734 CountryFilterList.Item(0) = "0"
7735 Else
7736 FilterCountry = "Use Country Filter"
7737 CountryFilterList.Item(0) = "1"
7738 End If
7739 SDB.Objects("WebBrowser2") = Nothing
7740 SDB.Objects("FilterForm") = Nothing
7741 SDB.Objects("Filter") = Nothing
7742 FindResults NewSearchTerm, QueryPage
7743 Else
7744 SDB.Objects("WebBrowser2") = Nothing
7745 SDB.Objects("FilterForm") = Nothing
7746 SDB.Objects("Filter") = Nothing
7747 End If
7748
7749End Sub
7750
7751
7752Sub ShowMediaFormatFilter
7753
7754 Dim Form, iWidth, CountColumn, filterHTML, filterHTMLDoc, WebBrowser2, MediaFormatButton, FilterFound
7755 Dim i, a
7756 Set Form = UI.NewForm
7757 Form.Common.Width = 380
7758 Form.Common.Height = 700
7759 Form.FormPosition = 4
7760 Form.Caption = "Choose the MediaFormat to search for"
7761 Form.BorderStyle = 3
7762 Form.StayOnTop = True
7763 SDB.Objects("FilterForm") = Form
7764 SDB.Objects("Filter") = MediaFormatList
7765 iWidth = (MediaFormatList.Count - 1) / 24 * 150
7766 CountColumn = (MediaFormatList.Count - 1) / 24
7767
7768 filterHTML = GetFilterHTML(iWidth, 23, CountColumn)
7769
7770 Dim Foot : Set Foot = SDB.UI.NewPanel(Form)
7771 Foot.Common.Align = 2
7772 Foot.Common.Height = 35
7773
7774 Dim Btn : Set Btn = SDB.UI.NewButton(Foot)
7775 Btn.Caption = SDB.Localize("Cancel")
7776 Btn.Common.Width = 85
7777 Btn.Common.Height = 25
7778 Btn.Common.Left = Form.Common.Width - Btn.Common.Width - 20
7779 Btn.Common.Top = 6
7780 Btn.Common.Anchors = 2+4
7781 Btn.UseScript = Script.ScriptPath
7782 Btn.ModalResult = 2
7783 Btn.Cancel = True
7784
7785 Dim Btn2 : Set Btn2 = SDB.UI.NewButton(Foot)
7786 Btn2.Caption = SDB.Localize("Ok")
7787 Btn2.Common.Width = 85
7788 Btn2.Common.Height = 25
7789 Btn2.Common.Left = Btn.Common.Left - Btn2.Common.Width - 5
7790 Btn2.Common.Top = 6
7791 Btn2.Common.Anchors = 2+4
7792 Btn2.UseScript = Script.ScriptPath
7793 Btn2.ModalResult = 1
7794 Btn2.Default = True
7795
7796 Dim Btn3 : Set Btn3 = SDB.UI.NewButton(Foot)
7797 Btn3.Caption = SDB.Localize("&Check All")
7798 Btn3.Common.Width = 85
7799 Btn3.Common.Height = 25
7800 Btn3.Common.Left = 5
7801 Btn3.Common.Top = 6
7802 Btn3.Common.Anchors = 2+4
7803 Script.RegisterEvent Btn3, "OnClick", "Btn3Click"
7804
7805 Dim Btn4 : Set Btn4 = SDB.UI.NewButton(Foot)
7806 Btn4.Caption = SDB.Localize("&Uncheck all")
7807 Btn4.Common.Width = 85
7808 Btn4.Common.Height = 25
7809 Btn4.Common.Left = Btn3.Common.Left + Btn4.Common.Width + 5
7810 Btn4.Common.Top = 6
7811 Btn4.Common.Anchors = 2+4
7812 Script.RegisterEvent Btn4, "OnClick", "Btn4Click"
7813
7814 Set WebBrowser2 = UI.NewActiveX(Form, "Shell.Explorer")
7815 WebBrowser2.Common.Align = 5
7816 WebBrowser2.Common.ControlName = "WebBrowser2"
7817 WebBrowser2.Common.Top = 100
7818 WebBrowser2.Common.Left = 100
7819
7820 SDB.Objects("WebBrowser2") = WebBrowser2
7821 WebBrowser2.Interf.Visible = True
7822 WebBrowser2.Common.BringToFront
7823
7824 WebBrowser2.SetHTMLDocument filterHTML
7825 Set filterHTMLDoc = WebBrowser2.Interf.Document
7826
7827 For i = 1 To MediaFormatList.Count - 1
7828 Set MediaFormatButton = filterHTMLDoc.getElementById("Filter" & i)
7829 If MediaFormatFilterList.Item(i) = "1" Then
7830 MediaFormatButton.checked = True
7831 End If
7832 Next
7833
7834 If Form.ShowModal = 1 Then
7835 FilterFound = False
7836 For a = 1 To MediaFormatList.Count - 1
7837 Set MediaFormatButton = filterHTMLDoc.getElementById("Filter" & a)
7838 If MediaFormatButton.checked = True Then
7839 MediaFormatFilterList.Item(a) = "1"
7840 FilterFound = True
7841 Else
7842 MediaFormatFilterList.Item(a) = "0"
7843 End If
7844 Next
7845 If FilterFound = False Then
7846 FilterMediaFormat = "None"
7847 MediaFormatFilterList.Item(0) = "0"
7848 Else
7849 FilterMediaFormat = "Use MediaFormat Filter"
7850 MediaFormatFilterList.Item(0) = "1"
7851 End If
7852 SDB.Objects("WebBrowser2") = Nothing
7853 SDB.Objects("FilterForm") = Nothing
7854 SDB.Objects("Filter") = Nothing
7855 FindResults NewSearchTerm, QueryPage
7856 Else
7857 SDB.Objects("WebBrowser2") = Nothing
7858 SDB.Objects("FilterForm") = Nothing
7859 SDB.Objects("Filter") = Nothing
7860 End If
7861
7862End Sub
7863
7864
7865Sub ShowMediaTypeFilter
7866
7867 Dim Form, iWidth, CountColumn, filterHTML, filterHTMLDoc, WebBrowser2, MediaTypeButton, FilterFound
7868 Dim i, a
7869 Set Form = UI.NewForm
7870 Form.Common.Width = 420
7871 Form.Common.Height = 600
7872 Form.FormPosition = 4
7873 Form.Caption = "Choose the MediaType to search for"
7874 Form.BorderStyle = 3
7875 Form.StayOnTop = True
7876 SDB.Objects("FilterForm") = Form
7877 SDB.Objects("Filter") = MediaTypeList
7878 iWidth = (MediaTypeList.Count - 1) / 19 * 175
7879 CountColumn = (MediaTypeList.Count - 1) / 19
7880
7881 filterHTML = GetFilterHTML(iWidth, 18, CountColumn)
7882
7883 Dim Foot : Set Foot = SDB.UI.NewPanel(Form)
7884 Foot.Common.Align = 2
7885 Foot.Common.Height = 35
7886
7887 Dim Btn : Set Btn = SDB.UI.NewButton(Foot)
7888 Btn.Caption = SDB.Localize("Cancel")
7889 Btn.Common.Width = 85
7890 Btn.Common.Height = 25
7891 Btn.Common.Left = Form.Common.Width - Btn.Common.Width - 30
7892 Btn.Common.Top = 6
7893 Btn.Common.Anchors = 2+4
7894 Btn.UseScript = Script.ScriptPath
7895 Btn.ModalResult = 2
7896 Btn.Cancel = True
7897
7898 Dim Btn2 : Set Btn2 = SDB.UI.NewButton(Foot)
7899 Btn2.Caption = SDB.Localize("Ok")
7900 Btn2.Common.Width = 85
7901 Btn2.Common.Height = 25
7902 Btn2.Common.Left = Btn.Common.Left - Btn2.Common.Width - 5
7903 Btn2.Common.Top = 6
7904 Btn2.Common.Anchors = 2+4
7905 Btn2.UseScript = Script.ScriptPath
7906 Btn2.ModalResult = 1
7907 Btn2.Default = True
7908
7909 Dim Btn3 : Set Btn3 = SDB.UI.NewButton(Foot)
7910 Btn3.Caption = SDB.Localize("&Check All")
7911 Btn3.Common.Width = 85
7912 Btn3.Common.Height = 25
7913 Btn3.Common.Left = 15
7914 Btn3.Common.Top = 6
7915 Btn3.Common.Anchors = 2+4
7916 Script.RegisterEvent Btn3, "OnClick", "Btn3Click"
7917
7918 Dim Btn4 : Set Btn4 = SDB.UI.NewButton(Foot)
7919 Btn4.Caption = SDB.Localize("&Uncheck all")
7920 Btn4.Common.Width = 85
7921 Btn4.Common.Height = 25
7922 Btn4.Common.Left = Btn3.Common.Left + Btn4.Common.Width + 5
7923 Btn4.Common.Top = 6
7924 Btn4.Common.Anchors = 2+4
7925 Script.RegisterEvent Btn4, "OnClick", "Btn4Click"
7926
7927 Set WebBrowser2 = UI.NewActiveX(Form, "Shell.Explorer")
7928 WebBrowser2.Common.Align = 5
7929 WebBrowser2.Common.ControlName = "WebBrowser2"
7930 WebBrowser2.Common.Top = 100
7931 WebBrowser2.Common.Left = 100
7932
7933 SDB.Objects("WebBrowser2") = WebBrowser2
7934 WebBrowser2.Interf.Visible = True
7935 WebBrowser2.Common.BringToFront
7936
7937 WebBrowser2.SetHTMLDocument filterHTML
7938 Set filterHTMLDoc = WebBrowser2.Interf.Document
7939
7940 For i = 1 To MediaTypeList.Count - 1
7941 Set MediaTypeButton = filterHTMLDoc.getElementById("Filter" & i)
7942 If MediaTypeFilterList.Item(i) = "1" Then
7943 MediaTypeButton.checked = True
7944 End If
7945 Next
7946
7947 If Form.ShowModal = 1 Then
7948 FilterFound = False
7949 For a = 1 To MediaTypeList.Count - 1
7950 Set MediaTypeButton = filterHTMLDoc.getElementById("Filter" & a)
7951 If MediaTypeButton.checked = True Then
7952 MediaTypeFilterList.Item(a) = "1"
7953 FilterFound = True
7954 Else
7955 MediaTypeFilterList.Item(a) = "0"
7956 End If
7957 Next
7958 If FilterFound = False Then
7959 FilterMediaType = "None"
7960 MediaTypeFilterList.Item(0) = "0"
7961 Else
7962 FilterMediaType = "Use MediaType Filter"
7963 MediaTypeFilterList.Item(0) = "1"
7964 End If
7965 SDB.Objects("WebBrowser2") = Nothing
7966 SDB.Objects("FilterForm") = Nothing
7967 SDB.Objects("Filter") = Nothing
7968 FindResults NewSearchTerm, QueryPage
7969 Else
7970 SDB.Objects("WebBrowser2") = Nothing
7971 SDB.Objects("FilterForm") = Nothing
7972 SDB.Objects("Filter") = Nothing
7973 End If
7974
7975End Sub
7976
7977
7978Sub ShowYearFilter
7979
7980 Dim Form, iWidth, CountColumn, filterHTML, filterHTMLDoc, WebBrowser2, YearButton, FilterFound
7981 Dim i, a, row
7982 Set Form = UI.NewForm
7983 Form.Common.Width = 550
7984 Form.Common.Height = 550
7985 Form.FormPosition = 4
7986 Form.Caption = "Choose the Year to search for"
7987 Form.BorderStyle = 3
7988 Form.StayOnTop = True
7989 SDB.Objects("FilterForm") = Form
7990 SDB.Objects("Filter") = YearList
7991 'CountColumn = 6
7992 If ((YearList.Count - 1) / 6) = Int((YearList.Count - 1) / 6) Then
7993 iWidth = (YearList.Count - 1) / 6 * 25
7994 row = Int((YearList.Count - 1) / 6)
7995 CountColumn = 6
7996 Else
7997 row = Int((YearList.Count - 1) / 6) + 1
7998 iWidth = (YearList.Count - 1) / 6 * 25
7999 CountColumn = 6
8000 End If
8001
8002 filterHTML = GetFilterHTML(iWidth, row-1, CountColumn)
8003
8004 Dim Foot : Set Foot = SDB.UI.NewPanel(Form)
8005 Foot.Common.Align = 2
8006 Foot.Common.Height = 35
8007
8008 Dim Btn : Set Btn = SDB.UI.NewButton(Foot)
8009 Btn.Caption = SDB.Localize("Cancel")
8010 Btn.Common.Width = 85
8011 Btn.Common.Height = 25
8012 Btn.Common.Left = Form.Common.Width - Btn.Common.Width - 30
8013 Btn.Common.Top = 6
8014 Btn.Common.Anchors = 2+4
8015 Btn.UseScript = Script.ScriptPath
8016 Btn.ModalResult = 2
8017 Btn.Cancel = True
8018
8019 Dim Btn2 : Set Btn2 = SDB.UI.NewButton(Foot)
8020 Btn2.Caption = SDB.Localize("Ok")
8021 Btn2.Common.Width = 85
8022 Btn2.Common.Height = 25
8023 Btn2.Common.Left = Btn.Common.Left - Btn2.Common.Width - 5
8024 Btn2.Common.Top = 6
8025 Btn2.Common.Anchors = 2+4
8026 Btn2.UseScript = Script.ScriptPath
8027 Btn2.ModalResult = 1
8028 Btn2.Default = True
8029
8030 Dim Btn3 : Set Btn3 = SDB.UI.NewButton(Foot)
8031 Btn3.Caption = SDB.Localize("&Check All")
8032 Btn3.Common.Width = 85
8033 Btn3.Common.Height = 25
8034 Btn3.Common.Left = 15
8035 Btn3.Common.Top = 6
8036 Btn3.Common.Anchors = 2+4
8037 Script.RegisterEvent Btn3, "OnClick", "Btn3Click"
8038
8039 Dim Btn4 : Set Btn4 = SDB.UI.NewButton(Foot)
8040 Btn4.Caption = SDB.Localize("&Uncheck all")
8041 Btn4.Common.Width = 85
8042 Btn4.Common.Height = 25
8043 Btn4.Common.Left = Btn3.Common.Left + Btn4.Common.Width + 5
8044 Btn4.Common.Top = 6
8045 Btn4.Common.Anchors = 2+4
8046 Script.RegisterEvent Btn4, "OnClick", "Btn4Click"
8047
8048 Set WebBrowser2 = UI.NewActiveX(Form, "Shell.Explorer")
8049 WebBrowser2.Common.Align = 5
8050 WebBrowser2.Common.ControlName = "WebBrowser2"
8051 WebBrowser2.Common.Top = 100
8052 WebBrowser2.Common.Left = 100
8053
8054 SDB.Objects("WebBrowser2") = WebBrowser2
8055 WebBrowser2.Interf.Visible = True
8056 WebBrowser2.Common.BringToFront
8057
8058 WebBrowser2.SetHTMLDocument filterHTML
8059 Set filterHTMLDoc = WebBrowser2.Interf.Document
8060
8061 For i = 1 To YearList.Count - 1
8062 Set Yearbutton = filterHTMLDoc.getElementById("Filter" & i)
8063 If YearFilterList.Item(i) = "1" Then
8064 Yearbutton.checked = True
8065 End If
8066 Next
8067
8068 If Form.ShowModal = 1 Then
8069 FilterFound = False
8070 For a = 1 To YearList.Count - 1
8071 Set Yearbutton = filterHTMLDoc.getElementById("Filter" & a)
8072 If Yearbutton.checked = True Then
8073 YearFilterList.Item(a) = "1"
8074 FilterFound = True
8075 Else
8076 YearFilterList.Item(a) = "0"
8077 End If
8078 Next
8079 If FilterFound = False Then
8080 FilterYear = "None"
8081 YearFilterList.Item(0) = "0"
8082 Else
8083 FilterYear = "Use Year Filter"
8084 YearFilterList.Item(0) = "1"
8085 End If
8086 SDB.Objects("WebBrowser2") = Nothing
8087 SDB.Objects("FilterForm") = Nothing
8088 SDB.Objects("Filter") = Nothing
8089 FindResults NewSearchTerm, QueryPage
8090 Else
8091 SDB.Objects("WebBrowser2") = Nothing
8092 SDB.Objects("FilterForm") = Nothing
8093 SDB.Objects("Filter") = Nothing
8094 End If
8095
8096End Sub
8097
8098
8099Sub Btn3Click
8100
8101 Dim WebBrowser2, FilterList, filterHTMLDoc, a, filterbutton
8102 Set WebBrowser2 = SDB.Objects("WebBrowser2")
8103 Set FilterList = SDB.Objects("Filter")
8104 Set filterHTMLDoc = WebBrowser2.Interf.Document
8105 For a = 1 To FilterList.Count - 1
8106 Set filterbutton = filterHTMLDoc.getElementById("Filter" & a)
8107 filterbutton.checked = True
8108 Next
8109
8110End Sub
8111
8112
8113Sub Btn4Click
8114
8115 Dim WebBrowser2, FilterList, filterHTMLDoc, a, filterbutton
8116 Set WebBrowser2 = SDB.Objects("WebBrowser2")
8117 Set FilterList = SDB.Objects("Filter")
8118 Set filterHTMLDoc = WebBrowser2.Interf.Document
8119 For a = 1 To FilterList.Count - 1
8120 Set filterbutton = filterHTMLDoc.getElementById("Filter" & a)
8121 filterbutton.checked = False
8122 Next
8123
8124End Sub
8125
8126
8127Function GetFilterHTML(Width, Row, CountColumn)
8128
8129 Dim FilterList, filterHTML, i, a
8130 Set FilterList = SDB.Objects("Filter")
8131 filterHTML = "<HTML>"
8132 filterHTML = filterHTML & "<HEAD>"
8133 filterHTML = filterHTML & "<style type=""text/css"" media=""screen"">"
8134 filterHTML = filterHTML & ".tabletext { font-family: Arial, Helvetica, sans-serif; font-size: 8pt;}"
8135 filterHTML = filterHTML & "</style>"
8136 filterHTML = filterHTML & "</HEAD>"
8137 filterHTML = filterHTML & "<table border=0 width=" & Width & " cellspacing=0 cellpadding=1 class=tabletext>"
8138
8139 For i = 0 To Row
8140 filterHTML = filterHTML & "<tr>"
8141 For a = 1 To CountColumn
8142 If FilterList.Count <= a + (i * CountColumn) Then Exit For
8143 filterHTML = filterHTML & "<td><input type=checkbox id=""Filter" & a + (i * CountColumn) & """ >" & FilterList.Item(a + (i * CountColumn))
8144 filterHTML = filterHTML & "</td>"
8145 Next
8146 filterHTML = filterHTML & "</tr>"
8147 Next
8148 filterHTML = filterHTML & "</table>"
8149 filterHTML = filterHTML & "</body>"
8150 filterHTML = filterHTML & "</HTML>"
8151 GetFilterHTML = filterHTML
8152
8153End Function
8154
8155
8156Sub ApplyFrontCover()
8157 Dim FrontCoverURL, ret, j
8158
8159 FrontCoverURL = ""
8160 If CheckCover Then
8161 FrontCoverURL = AlbumArtURL
8162 ElseIf SmallCover Then
8163 FrontCoverURL = AlbumArtThumbNail
8164 End If
8165
8166 if Len(FrontCoverURL) > 0 Then
8167 Dim SongList
8168 Set SongList = SDB.SelectedSongList
8169 FrontCoverLocal = sTemp & "cover_full.jpg"
8170 ret = getimages(FrontCoverURL, FrontCoverLocal)
8171
8172 Dim FrontCoverLocal
8173 For j = 0 To SongList.Count - 1
8174 Dim itm
8175 Set itm = SongList.item(j)
8176 Dim pics : Set pics = itm.AlbumArt
8177 Dim img
8178 Set img = pics.AddNew
8179 img.Description = ""
8180
8181 img.PicturePath = FrontCoverLocal
8182 img.ItemStorage = 0
8183 img.ItemType = 3 ' 3 -> front cover
8184 pics.UpdateDB
8185 Next
8186 End If
8187 SDB.Tools.FileSystem.DeleteFile(FrontCoverLocal)
8188End Sub
8189
8190Sub MoreImages()
8191
8192 Dim iWidth, imageHTML, imageHTMLDoc, i, j, RndFileName, ret
8193 imageHTML = "<HTML>"
8194 imageHTML = imageHTML & "<HEAD>"
8195 imageHTML = imageHTML & "<style type=""text/css"" media=""screen"">"
8196 imageHTML = imageHTML & ".tabletext { font-family: Arial, Helvetica, sans-serif; font-size: 8pt;}"
8197 imageHTML = imageHTML & "</style>"
8198 imageHTML = imageHTML & "</HEAD>"
8199 imageHTML = imageHTML & "<body bgcolor=""#FFFFFF"">"
8200 iWidth = (ImageList.Count - 1) * 200
8201 imageHTML = imageHTML & "<table border=0 width=" & iWidth & " cellspacing=0 cellpadding=1 class=tabletext>"
8202 imageHTML = imageHTML & "<tr>"
8203
8204 Dim max, min
8205 Set ImageLocal = SDB.NewStringList
8206 For i = 0 To ImageList.Count - 1
8207 max=100000
8208 min=10000
8209 Randomize
8210 RndFileName = Int((max-min+1)*Rnd+min) & ".jpg"
8211 ret = getimages(ImageList.Item(i), sTemp & RndFileName)
8212 ImageLocal.Add sTemp & RndFileName
8213 WriteLog "Random-File = " & sTemp & RndFileName
8214 imageHTML = imageHTML & "<td><img border=""0"" src=""" & sTemp & RndFileName & """ width=""180"" height=""180""></td>"
8215 Next
8216 imageHTML = imageHTML & "</tr><tr>"
8217 For i = 0 To ImageList.Count - 1
8218 imageHTML = imageHTML & "<td>"
8219 imageHTML = imageHTML & "<select id=""ImageType" & i & """ class=tabletext>"
8220 For j = 0 To ImageTypeList.Count - 1
8221 If SaveImageType.Item(i) <> ImageTypeList.Item(j) Then
8222 imageHTML = imageHTML & "<option value=""" & ImageTypeList.Item(j) & """>" & ImageTypeList.Item(j) & "</option>"
8223 Else
8224 imageHTML = imageHTML & "<option value=""" & ImageTypeList.Item(j) & """ selected>" & ImageTypeList.Item(j) & "</option>"
8225 End If
8226 Next
8227 imageHTML = imageHTML & "</select></td>"
8228 Next
8229
8230 imageHTML = imageHTML & "</tr><tr>"
8231 For i = 0 To ImageList.Count - 1
8232 imageHTML = imageHTML & "<td><input type=checkbox id=""SaveImage" & i & """ >Save Image"
8233 imageHTML = imageHTML & "</td>"
8234 Next
8235
8236 imageHTML = imageHTML & "</tr><tr>"
8237 For i = 0 To ImageList.Count - 1
8238 If CoverStorage = 1 Or CoverStorage = 3 Then
8239 imageHTML = imageHTML & "<td><input type=text id=""FileName" & i & """ >"
8240 Else
8241 imageHTML = imageHTML & "<td>Store in tag"
8242 End If
8243 imageHTML = imageHTML & "</td>"
8244 Next
8245
8246 imageHTML = imageHTML & "</tr>"
8247
8248 imageHTML = imageHTML & "</table>"
8249 imageHTML = imageHTML & "</body>"
8250 imageHTML = imageHTML & "</HTML>"
8251
8252
8253
8254 Dim Form
8255 Set Form = UI.NewForm
8256 Form.Common.ClientWidth = 800
8257 Form.Common.ClientHeight = 400
8258 Form.FormPosition = 4
8259 Form.Caption = "Choose additional Images for the Release"
8260 Form.BorderStyle = 3
8261 Form.StayOnTop = True
8262 SDB.Objects("ImageForm") = Form
8263
8264 Dim Foot : Set Foot = SDB.UI.NewPanel(Form)
8265 Foot.Common.Align = 2
8266 Foot.Common.Height = 35
8267
8268 Dim Btn : Set Btn = SDB.UI.NewButton(Foot)
8269 Btn.Caption = SDB.Localize("Cancel")
8270 Btn.Common.Width = 85
8271 Btn.Common.Height = 25
8272 Btn.Common.Left = Form.Common.Width - Btn.Common.Width -30
8273 Btn.Common.Top = 6
8274 Btn.Common.Anchors = 2+4
8275 Btn.UseScript = Script.ScriptPath
8276 Btn.ModalResult = 2
8277 Btn.Cancel = True
8278
8279 Dim Btn2 : Set Btn2 = SDB.UI.NewButton(Foot)
8280 Btn2.Caption = SDB.Localize("Ok")
8281 Btn2.Common.Width = 85
8282 Btn2.Common.Height = 25
8283 Btn2.Common.Left = Btn.Common.Left - Btn2.Common.Width -5
8284 Btn2.Common.Top = 6
8285 Btn2.Common.Anchors = 2+4
8286 Btn2.UseScript = Script.ScriptPath
8287 Btn2.ModalResult = 1
8288 Btn2.Default = True
8289
8290 Set WebBrowser3 = UI.NewActiveX(Form, "Shell.Explorer")
8291 WebBrowser3.Common.Align = 5 ' Fill whole client rectangle
8292 WebBrowser3.Common.ControlName = "WebBrowser3"
8293 WebBrowser3.Common.Top = 100
8294 WebBrowser3.Common.Left = 100
8295
8296 SDB.Objects("WebBrowser3") = WebBrowser3
8297 WebBrowser3.Interf.Visible = True
8298 WebBrowser3.Common.BringToFront
8299
8300 WebBrowser3.SetHTMLDocument imageHTML
8301 Set imageHTMLDoc = WebBrowser3.Interf.Document
8302
8303 Dim saveimagebutton, text
8304 For i = 0 To ImageList.Count - 1
8305 Set saveimagebutton = imageHTMLDoc.getElementById("SaveImage" & i)
8306 If SaveImage.Item(i) = 1 Then
8307 saveimagebutton.checked = 1
8308 End If
8309 If CoverStorage = 1 Or CoverStorage = 3 Then
8310 Set text = imageHTMLDoc.getElementById("FileName" & i)
8311 text.value = "folder" & i & ".jpg"
8312 End If
8313 Next
8314
8315 If Form.ShowModal = 1 Then
8316 SetSaveImages()
8317 End If
8318
8319 WebBrowser3.SetHTMLDocument ""
8320 SDB.Objects("ImageForm") = Nothing
8321 WebBrowser3.Common.DestroyControl ' Destroy the external control
8322 Set WebBrowser3 = Nothing ' Release global variable
8323 SDB.Objects("WebBrowser3") = Nothing
8324
8325End Sub
8326
8327
8328Sub SetSaveImages()
8329
8330 Dim imageHTMLDoc, i, checkbox, listbox, text
8331
8332 Set SaveImage = SDB.NewStringList
8333 Set SaveImageType = SDB.NewStringList
8334 Set FileNameList = SDB.NewStringList
8335
8336 Set imageHTMLDoc = WebBrowser3.Interf.Document
8337 For i = 0 To ImageList.Count - 1
8338 Set checkBox = imageHTMLDoc.getElementById("SaveImage" & i)
8339 If checkBox.Checked Then
8340 SaveImage.Add "1"
8341 Set listBox = imageHTMLDoc.getElementById("ImageType" & i)
8342 SaveImageType.Add listBox.Value
8343 If CoverStorage = 1 Or CoverStorage = 3 Then
8344 Set text = imageHTMLDoc.getElementById("FileName" & i)
8345 FileNameList.Add text.Value
8346 Else
8347 FileNameList.Add "nothing"
8348 End If
8349 Else
8350 SaveImage.Add "0"
8351 SaveImageType.Add "other"
8352 FileNameList.Add "nothing"
8353 End If
8354 Next
8355
8356 SaveMoreImagesSub()
8357
8358End Sub
8359
8360
8361Function getimages(DownloadDest, LocalFile)
8362
8363 Dim oXMLHTTP, objStream
8364 Set oXMLHTTP = CreateObject("MSXML2.XMLHTTP.6.0")
8365 SDB.ProcessMessages
8366 WriteLog "Start getimages"
8367 WriteLog "LocalFile=" & LocalFile
8368 WriteLog "User-Agent=" & UserAgent
8369 oXMLHTTP.open "GET", DownloadDest, False
8370 oXMLHTTP.setRequestHeader "Accept", "*/*"
8371 oXMLHTTP.setRequestHeader "User-Agent", UserAgent
8372 oXMLHTTP.setRequestHeader "Host", "img.discogs.com"
8373 oXMLHTTP.send()
8374 If oXMLHTTP.Status = 200 Then
8375 Set objStream = CreateObject("ADODB.Stream")
8376 objStream.Type = 1
8377 objStream.Open
8378 objStream.Write oXMLHTTP.ResponseBody
8379 objStream.SavetoFile LocalFile, 2
8380 objStream.Close
8381 Set objStream = Nothing
8382 Set oXMLHTTP = Nothing
8383 getimages = LocalFile
8384 Else
8385 WriteLog "Status=" & oXMLHTTP.Status
8386 SDB.MessageBox "Getting cover image failed - Status-Code = " & oXMLHTTP.Status, mtInformation, Array(mbOk)
8387 Set oXMLHTTP = Nothing
8388 getimages = ""
8389 End If
8390
8391End function
8392
8393
8394Sub WriteOptions()
8395
8396 WriteLog " "
8397 WriteLog "Options:"
8398 WriteLog "CheckAlbum=" & CheckAlbum
8399 WriteLog "CheckArtist=" & CheckArtist
8400 WriteLog "CheckAlbumArtist=" & CheckAlbumArtist
8401 WriteLog "CheckAlbumArtistFirst=" & CheckAlbumArtistFirst
8402 WriteLog "CheckLabel=" & CheckLabel
8403 WriteLog "CheckDate=" & CheckDate
8404 WriteLog "CheckOrigDate=" & CheckOrigDate
8405 WriteLog "CheckGenre=" & CheckGenre
8406 WriteLog "CheckStyle=" & CheckStyle
8407 WriteLog "CheckCountry=" & CheckCountry
8408 WriteLog "CheckSaveImage=" & CheckSaveImage
8409 WriteLog "CheckSmallCover=" & CheckSmallCover
8410 WriteLog "CheckCatalog=" & CheckCatalog
8411 WriteLog "CheckRelease=" & CheckRelease
8412 WriteLog "CheckInvolved=" & CheckInvolved
8413 WriteLog "CheckGrouping=" & CheckGrouping
8414 WriteLog "CheckLyricist=" & CheckLyricist
8415 WriteLog "CheckComposer=" & CheckComposer
8416 WriteLog "CheckConductor=" & CheckConductor
8417 WriteLog "CheckProducer=" & CheckProducer
8418 WriteLog "CheckDiscNum=" & CheckDiscNum
8419 WriteLog "CheckTrackNum=" & CheckTrackNum
8420 WriteLog "CheckFormat=" & CheckFormat
8421 WriteLog "CheckUseAnv=" & CheckUseAnv
8422 WriteLog "CheckYearOnlyDate=" & CheckYearOnlyDate
8423 WriteLog "CheckForceNumeric=" & CheckForceNumeric
8424 WriteLog "CheckSidesToDisc=" & CheckSidesToDisc
8425 WriteLog "CheckForceDisc=" & CheckForceDisc
8426 WriteLog "CheckOriginalDiscogsTrack=" & CheckOriginalDiscogsTrack
8427 WriteLog "CheckNoDisc=" & CheckNoDisc
8428 REM WriteLog "CheckUserCollection=" & CheckUserCollection
8429 WriteLog "DiscogsUsername=" & DiscogsUsername
8430 WriteLog "ReleaseTag=" & ReleaseTag
8431 WriteLog "CatalogTag=" & CatalogTag
8432 WriteLog "CountryTag=" & CountryTag
8433 WriteLog "FormatTag=" & FormatTag
8434 WriteLog "CheckLeadingZero=" & CheckLeadingZero
8435 WriteLog "CheckLeadingZeroDisc=" & CheckLeadingZeroDisc
8436 WriteLog "CheckVarious=" & CheckVarious
8437 WriteLog "TxtVarious=" & TxtVarious
8438 WriteLog "CheckTitleFeaturing=" & CheckTitleFeaturing
8439 WriteLog "CheckFeaturingName=" & CheckFeaturingName
8440 WriteLog "TxtFeaturingName=" & TxtFeaturingName
8441 WriteLog "CheckComment=" & CheckComment
8442 WriteLog "SubTrackNameSelection=" & SubTrackNameSelection
8443 WriteLog "Separator=" & Separator
8444 Set ini = SDB.IniFile
8445 WriteLog "CurrentCountryFilter=" & ini.StringValue("DiscogsAutoTagWeb","CurrentCountryFilter")
8446 WriteLog "CurrentMediaTypeFilter=" & ini.StringValue("DiscogsAutoTagWeb","CurrentMediaTypeFilter")
8447 WriteLog "CurrentMediaFormatFilter=" & ini.StringValue("DiscogsAutoTagWeb","CurrentMediaFormatFilter")
8448 WriteLog "CurrentYearFilter=" & ini.StringValue("DiscogsAutoTagWeb","CurrentYearFilter")
8449 WriteLog "LyricistKeywords=" & LyricistKeywords
8450 WriteLog "ConductorKeywords=" & ConductorKeywords
8451 WriteLog "ProducerKeywords=" & ProducerKeywords
8452 WriteLog "ComposerKeywords=" & ComposerKeywords
8453 WriteLog "FeaturingKeywords=" & FeaturingKeywords
8454 WriteLog "UnwantedKeywords=" & UnwantedKeywords
8455 WriteLog "CheckStyleField=" & CheckStyleField
8456 WriteLog "ArtistSeparator=" & ArtistSeparator
8457 WriteLog "ArtistLastSeparator=" & ArtistLastSeparator
8458 WriteLog "FormatSeparator=" & FormatSeparator
8459 WriteLog "CheckTurnOffSubTrack=" & CheckTurnOffSubTrack
8460 WriteLog "AccessToken=" & AccessToken
8461 WriteLog "AccessTokenSecret=" & AccessTokenSecret
8462 WriteLog "QueryPage=" & QueryPage
8463 WriteLog "CheckInvolvedPeopleSingleLine=" & CheckInvolvedPeopleSingleLine
8464 WriteLog "CheckDontFillEmptyFields=" & CheckDontFillEmptyFields
8465 WriteLog "CheckNewVersion=" & CheckNewVersion
8466 WriteLog "LastCheck=" & LastCheck
8467 WriteLog "CheckTheBehindArtist=" & CheckTheBehindArtist
8468 WriteLog "CheckDiscogsCollectionOff=" & CheckDiscogsCollectionOff
8469 WriteLog "CheckDeleteDuplicatedEntry=" & CheckDeleteDuplicatedEntry
8470 WriteLog "StoreDate=" & StoreDate
8471 WriteLog "CheckLimitReleases=" & LimitReleases
8472 WriteLog "CheckIgnoreFeatArtist=" & CheckIgnoreFeatArtist
8473 WriteLog "SubTrackSeparator=" & SubTrackSeparator
8474 WriteLog "CheckNewMatchingEngine=" & CheckNewMatchingEngine
8475 WriteLog "CheckShowQtyFormat=" & CheckShowQtyFormat
8476 WriteLog "-+-+-+-+--+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-"
8477
8478End Sub
8479
8480
8481Sub WriteLogInit
8482
8483 Dim logdatei
8484 logdatei = SDB.ScriptsPath & "Discogs_Script.log"
8485 If SDB.Tools.FileSystem.FileExists(logdatei) = True Then
8486 SDB.Tools.FileSystem.DeleteFile(logdatei)
8487 End If
8488 WriteLog "Start DiscogsTagger " & VersionStr
8489 WriteOptions()
8490
8491End Sub
8492
8493
8494Sub WriteLog(Text)
8495
8496 Dim filesys, filetxt, logdatei, tmpText
8497 'Const ForReading = 1, ForWriting = 2, ForAppending = 8
8498 logdatei = SDB.ScriptsPath & "Discogs_Script.log"
8499 Set filesys = CreateObject("Scripting.FileSystemObject")
8500 Set filetxt = filesys.OpenTextFile(logdatei, 8, True)
8501 tmpText = Time & Chr(9) & SDB.ToAscii(Text)
8502 filetxt.WriteLine(tmpText)
8503 filetxt.Close
8504
8505End Sub
8506
8507
8508
8509'+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
8510
8511
8512Function searchKeyword(Keywords, Role, AlbumRole, artistName)
8513
8514 Dim tmp, x, RE, searchPattern
8515 tmp = Split(Keywords, ",")
8516 Set RE = New RegExp
8517 RE.IgnoreCase = True
8518 For Each searchPattern In tmp
8519 If InStr(searchPattern, "*") <> 0 Then
8520 searchPattern = Replace(searchPattern, "*", ".*")
8521 RE.Pattern = "^" & searchPattern & "$"
8522 If RE.Test(Role) Then
8523 If InStr(AlbumRole, artistName) = 0 Then
8524 If AlbumRole = "" Then
8525 AlbumRole = artistName
8526 Else
8527 AlbumRole = AlbumRole & Separator & artistName
8528 End If
8529 searchKeyword = AlbumRole
8530 Else
8531 searchKeyword = "ALREADY_INSIDE_ROLE"
8532 End If
8533 WriteLog "searchPattern=" & searchPattern
8534 Exit For
8535 End If
8536 Else
8537 If Trim(LCase(Role)) = Trim(LCase(searchPattern)) Then
8538 If InStr(AlbumRole, artistName) = 0 Then
8539 If AlbumRole = "" Then
8540 AlbumRole = artistName
8541 Else
8542 AlbumRole = AlbumRole & Separator & artistName
8543 End If
8544 searchKeyword = AlbumRole
8545 Else
8546 searchKeyword = "ALREADY_INSIDE_ROLE"
8547 End If
8548 Exit For
8549 End If
8550 End If
8551 Next
8552
8553End Function
8554
8555Class VbsJson
8556 'Author: Demon
8557 'Date: 2012/5/3
8558 'Website: http://demon.tw
8559 Private Whitespace, NumberRegex, StringChunk
8560 Private b, f, r, n, t
8561
8562 Private Sub Class_Initialize
8563 Whitespace = " " & vbTab & vbCr & vbLf
8564 b = ChrW(8)
8565 f = vbFormFeed
8566 r = vbCr
8567 n = vbLf
8568 t = vbTab
8569
8570 Set NumberRegex = New RegExp
8571 NumberRegex.Pattern = "(-?(?:0|[1-9]\d*))(\.\d+)?([eE][-+]?\d+)?"
8572 NumberRegex.Global = False
8573 NumberRegex.MultiLine = True
8574 NumberRegex.IgnoreCase = True
8575
8576 Set StringChunk = New RegExp
8577 StringChunk.Pattern = "([\s\S]*?)([""\\\x00-\x1f])"
8578 StringChunk.Global = False
8579 StringChunk.MultiLine = True
8580 StringChunk.IgnoreCase = True
8581 End Sub
8582
8583 'Return a JSON string representation of a VBScript data structure
8584 'Supports the following objects and types
8585 '+-------------------+---------------+
8586 '| VBScript | JSON |
8587 '+===================+===============+
8588 '| Dictionary | object |
8589 '+-------------------+---------------+
8590 '| Array | array |
8591 '+-------------------+---------------+
8592 '| String | string |
8593 '+-------------------+---------------+
8594 '| Number | number |
8595 '+-------------------+---------------+
8596 '| True | true |
8597 '+-------------------+---------------+
8598 '| False | false |
8599 '+-------------------+---------------+
8600 '| Null | null |
8601 '+-------------------+---------------+
8602 Public Function Encode(ByRef obj)
8603 Dim buf, i, c, g
8604 Set buf = CreateObject("Scripting.Dictionary")
8605 Select Case VarType(obj)
8606 Case vbNull
8607 buf.Add buf.Count, "null"
8608 Case vbBoolean
8609 If obj Then
8610 buf.Add buf.Count, "true"
8611 Else
8612 buf.Add buf.Count, "false"
8613 End If
8614 Case vbInteger, vbLong, vbSingle, vbDouble
8615 buf.Add buf.Count, obj
8616 Case vbString
8617 buf.Add buf.Count, """"
8618 For i = 1 To Len(obj)
8619 c = Mid(obj, i, 1)
8620 Select Case c
8621 Case """" buf.Add buf.Count, "\"""
8622 Case "\" buf.Add buf.Count, "\\"
8623 Case "/" buf.Add buf.Count, "/"
8624 Case b buf.Add buf.Count, "\b"
8625 Case f buf.Add buf.Count, "\f"
8626 Case r buf.Add buf.Count, "\r"
8627 Case n buf.Add buf.Count, "\n"
8628 Case t buf.Add buf.Count, "\t"
8629 Case Else
8630 If AscW(c) >= 0 And AscW(c) <= 31 Then
8631 c = Right("0" & Hex(AscW(c)), 2)
8632 buf.Add buf.Count, "\u00" & c
8633 Else
8634 buf.Add buf.Count, c
8635 End If
8636 End Select
8637 Next
8638 buf.Add buf.Count, """"
8639 Case vbArray + vbVariant
8640 g = True
8641 buf.Add buf.Count, "["
8642 For Each i In obj
8643 If g Then g = False Else buf.Add buf.Count, ","
8644 buf.Add buf.Count, Encode(i)
8645 Next
8646 buf.Add buf.Count, "]"
8647 Case vbObject
8648 If TypeName(obj) = "Dictionary" Then
8649 g = True
8650 buf.Add buf.Count, "{"
8651 For Each i In obj
8652 If g Then g = False Else buf.Add buf.Count, ","
8653 buf.Add buf.Count, """" & i & """" & ":" & Encode(obj(i))
8654 Next
8655 buf.Add buf.Count, "}"
8656 Else
8657 Err.Raise 8732,,"None dictionary object"
8658 End If
8659 Case Else
8660 buf.Add buf.Count, """" & CStr(obj) & """"
8661 End Select
8662 Encode = Join(buf.Items, "")
8663 End Function
8664
8665 'Return the VBScript representation of ``str(``
8666 'Performs the following translations in decoding
8667 '+---------------+-------------------+
8668 '| JSON | VBScript |
8669 '+===============+===================+
8670 '| object | Dictionary |
8671 '+---------------+-------------------+
8672 '| array | Array |
8673 '+---------------+-------------------+
8674 '| string | String |
8675 '+---------------+-------------------+
8676 '| number | Double |
8677 '+---------------+-------------------+
8678 '| true | True |
8679 '+---------------+-------------------+
8680 '| false | False |
8681 '+---------------+-------------------+
8682 '| null | Null |
8683 '+---------------+-------------------+
8684 Public Function Decode(ByRef str)
8685 'return base object
8686 Set Decode = ParseObject(str, 1)
8687 End Function
8688
8689 Private Function ParseValue(ByRef str, ByRef idx)
8690 Dim c, ms
8691
8692 idx = NextToken(str, idx)
8693 c = Mid(str, idx, 1)
8694
8695 If c = "{" Then
8696 Set ParseValue = ParseObject(str, idx)
8697 Exit Function
8698 ElseIf c = "[" Then
8699 Set ParseValue = ParseArray(str, idx)
8700 Exit Function
8701 ElseIf c = """" Then
8702 idx = idx + 1
8703 ParseValue = ParseString(str, idx)
8704 Exit Function
8705 ElseIf c = "n" And StrComp("null", Mid(str, idx, 4)) = 0 Then
8706 idx = idx + 4
8707 ParseValue = Null
8708 Exit Function
8709 ElseIf c = "t" And StrComp("true", Mid(str, idx, 4)) = 0 Then
8710 idx = idx + 4
8711 ParseValue = True
8712 Exit Function
8713 ElseIf c = "f" And StrComp("false", Mid(str, idx, 5)) = 0 Then
8714 idx = idx + 5
8715 ParseValue = False
8716 Exit Function
8717 Else
8718 Set ms = NumberRegex.Execute(Mid(str, idx))
8719 If ms.Count = 1 Then
8720 idx = idx + ms(0).Length
8721 SetLocale "en-US"
8722 ParseValue = CDbl(ms(0))
8723 SetLocale 0
8724 Exit Function
8725 End If
8726 End If
8727
8728 Err.Raise 8732,,"No JSON object could be ParseValued"
8729 End Function
8730
8731 Private Function ParseObject(ByRef str, ByRef idx)
8732 Dim c, key, value
8733 Set ParseObject = CreateObject("Scripting.Dictionary")
8734
8735 idx = NextToken(str, idx)
8736
8737 c = Mid(str, idx, 1)
8738
8739 If c = "{" Then
8740 idx = NextToken(str,idx+1)
8741 Else
8742 Err.Raise 8732,,"Expected { to begin Object"
8743 End If
8744
8745 c = Mid(str, idx, 1)
8746
8747 Do
8748 If c <> """" And c <> "}" Then
8749
8750 Err.Raise 8732,,"Expecting property name or } near: " & Mid(str,idx)
8751
8752 ElseIf c = """" Then
8753
8754 idx = idx + 1
8755 key = ParseString(str, idx)
8756
8757 idx = NextToken(str, idx)
8758 If Mid(str, idx, 1) <> ":" Then
8759 Err.Raise 8732,,"Expecting : delimiter near: " & Mid(str,idx)
8760 End If
8761
8762 ' skip : and whitespace after key
8763 idx = NextToken(str, idx + 1)
8764
8765 ' check for object or array value
8766 If Mid(str,idx,1) = "{" Or Mid(str,idx,1) = "[" Then
8767 Set value = ParseValue(str, idx)
8768 Else
8769 value = ParseValue(str,idx)
8770 End If
8771
8772 ParseObject.Add key, value
8773 End If
8774
8775 c = Mid(str,idx,1)
8776
8777 If c = "}" Then
8778 idx = NextToken(str,idx+1)
8779 Exit Function
8780 End If
8781
8782 If c <> "," Then
8783
8784 Err.Raise 8732,,"Expecting , delimiter near: " & Mid(str,idx)
8785
8786 End If
8787
8788 'skip , and whitespace after value
8789 idx = NextToken(str, idx + 1)
8790 c = Mid(str, idx, 1)
8791 If c <> """" Then
8792 Err.Raise 8732,,"Expecting property name"
8793 End If
8794 Loop
8795 End Function
8796
8797 Private Function ParseArray(ByRef str, ByRef idx)
8798 Dim c, values, value
8799 Set ParseArray = CreateObject("Scripting.Dictionary")
8800
8801 idx = NextToken(str, idx)
8802 c = Mid(str, idx, 1)
8803
8804 If c = "[" Then
8805 idx = NextToken(str,idx+1)
8806 Else
8807 Err.Raise 8732,,"Expected [ to begin Array"
8808 End If
8809
8810 Do
8811 c = Mid(str, idx, 1)
8812
8813 If c = "]" Then
8814 idx = NextToken(str,idx+1)
8815 Exit Function
8816 End If
8817
8818 ParseArray.Add ParseArray.Count, ParseValue(str, idx)
8819
8820 c = Mid(str, idx, 1)
8821
8822 If c = "]" Then
8823 idx = NextToken(str, idx+1)
8824 Exit Function
8825 End If
8826
8827 If c <> "," Then
8828 Err.Raise 8732,,"Expecting , delimiter near: " & Mid(str,idx)
8829 End If
8830
8831 idx = NextToken(str,idx+1)
8832
8833 Loop
8834 End Function
8835
8836 Private Function ParseString(ByRef str, ByRef idx)
8837 Dim chunks, content, terminator, ms, esc, char
8838 Set chunks = CreateObject("Scripting.Dictionary")
8839
8840 Do
8841 Set ms = StringChunk.Execute(Mid(str, idx))
8842 If ms.Count = 0 Then
8843 Err.Raise 8732,,"Unterminated string starting"
8844 End If
8845
8846 content = ms(0).Submatches(0)
8847 terminator = ms(0).Submatches(1)
8848 If Len(content) > 0 Then
8849 chunks.Add chunks.Count, content
8850 End If
8851
8852 idx = idx + ms(0).Length
8853
8854 If terminator = """" Then
8855 Exit Do
8856 ElseIf terminator <> "\" Then
8857 Err.Raise 8732,,"Invalid control character"
8858 End If
8859
8860 esc = Mid(str, idx, 1)
8861
8862 If esc <> "u" Then
8863 Select Case esc
8864 Case """" char = """"
8865 Case "\" char = "\"
8866 Case "/" char = "/"
8867 Case "b" char = b
8868 Case "f" char = f
8869 Case "n" char = n
8870 Case "r" char = r
8871 Case "t" char = t
8872 Case Else Err.Raise 8732,,"Invalid escape"
8873 End Select
8874 idx = idx + 1
8875 Else
8876 char = ChrW("&H" & Mid(str, idx + 1, 4))
8877 idx = idx + 5
8878 End If
8879
8880 chunks.Add chunks.Count, char
8881 Loop
8882
8883 ParseString = Join(chunks.Items, "")
8884 End Function
8885
8886 Private Function NextToken(ByRef str, ByVal idx)
8887 Do While idx <= Len(str) And InStr(Whitespace, Mid(str, idx, 1)) > 0
8888 idx = idx + 1
8889 Loop
8890 NextToken = idx
8891 End Function
8892
8893End Class
8894
8895Function AddToField(ByRef field, ByVal ftext)
8896
8897 ' for adding data to multi-valued fields
8898 If field = "" Then
8899 field = ftext
8900 Else
8901 field = field & Separator & ftext
8902 End If
8903
8904End Function
8905
8906
8907Function AddToFieldWD(ByRef field, ByVal ftext)
8908
8909 ' for adding data to multi-valued fields without duplicated entries
8910 Dim tmp, x
8911 If field = "" Then
8912 field = ftext
8913 Else
8914 tmp = Split(field, Separator)
8915 For each x in tmp
8916 If LCase(ftext) = LCase(x) Then
8917 Exit Function
8918 End If
8919 Next
8920 field = field & Separator & ftext
8921 End If
8922
8923End Function
8924
8925
8926Function LookForFeaturing(Text)
8927
8928 Dim tmp, x
8929 tmp = Split(FeaturingKeywords, ",")
8930 For each x in tmp
8931 If LCase(Text) = LCase(x) Then
8932 LookForFeaturing = true
8933 Exit Function
8934 End If
8935 Next
8936 LookForFeaturing = false
8937
8938End Function
8939
8940
8941Function CheckLeadingZeroTrackPosition(TrackPosition)
8942
8943 Dim tmpSplit, tmpTrack, tmpPos
8944 If InStr(TrackPosition, "-") <> 0 Then
8945 tmpSplit = Split(TrackPosition, "-")
8946 tmpPos = tmpSplit(1)
8947 End If
8948 If InStr(TrackPosition, ".") <> 0 Then
8949 tmpSplit = Split(TrackPosition, ".")
8950 tmpPos = tmpSplit(1)
8951 End If
8952 If Left(tmpPos, 1) = "0" Then
8953 CheckLeadingZeroTrackPosition = True
8954 Else
8955 CheckLeadingZeroTrackPosition = False
8956 End If
8957
8958End Function
8959
8960
8961
8962Function exchange_roman_numbers(Text)
8963
8964 If Text = "I" Then Text = 1
8965 If Text = "II" Then Text = 2
8966 If Text = "III" Then Text = 3
8967 If Text = "IV" Then Text = 4
8968 If Text = "V" Then Text = 5
8969 If Text = "VI" Then Text = 6
8970 If Text = "VII" Then Text = 7
8971 If Text = "VIII" Then Text = 8
8972 If Text = "IX" Then Text = 9
8973 If Text = "X" Then Text = 10
8974 If Text = "XI" Then Text = 11
8975 If Text = "XII" Then Text = 12
8976 If Text = "XIII" Then Text = 13
8977 If Text = "XIV" Then Text = 14
8978 If Text = "XV" Then Text = 15
8979 If Text = "XVI" Then Text = 16
8980 If Text = "XVII" Then Text = 17
8981 If Text = "XVIII" Then Text = 18
8982 If Text = "XIX" Then Text = 19
8983 If Text = "XX" Then Text = 20
8984 exchange_roman_numbers = Text
8985
8986End Function
8987
8988Function DecodeHtmlChars(Text)
8989
8990 DecodeHtmlChars = Text
8991 DecodeHtmlChars = Replace(DecodeHtmlChars,""", """")
8992 DecodeHtmlChars = Replace(DecodeHtmlChars,"<", "<")
8993 DecodeHtmlChars = Replace(DecodeHtmlChars,">", ">")
8994 DecodeHtmlChars = Replace(DecodeHtmlChars,"&", "&")
8995
8996End Function
8997
8998
8999Function EncodeHtmlChars(Text)
9000
9001 EncodeHtmlChars= Text
9002 EncodeHtmlChars= Replace(EncodeHtmlChars, "&", "&")
9003 EncodeHtmlChars= Replace(EncodeHtmlChars,"""", """)
9004 EncodeHtmlChars= Replace(EncodeHtmlChars,"<", "<")
9005 EncodeHtmlChars= Replace(EncodeHtmlChars, ">", ">")
9006
9007End Function
9008
9009
9010Function CleanSearchString(Text)
9011
9012 CleanSearchString = Text
9013 CleanSearchString = Replace(CleanSearchString,")", " ")
9014 CleanSearchString = Replace(CleanSearchString,"(", " ")
9015 CleanSearchString = Replace(CleanSearchString,"[", " ")
9016 CleanSearchString = Replace(CleanSearchString,"]", " ")
9017 CleanSearchString = Replace(CleanSearchString,"@", " ")
9018 CleanSearchString = Replace(CleanSearchString,"_", " ")
9019 CleanSearchString = Replace(CleanSearchString,"?", " ")
9020 CleanSearchString = PackSpaces(CleanSearchString, False)
9021
9022End Function
9023
9024
9025Function CleanArtistName(artistname)
9026
9027 CleanArtistName = DecodeHtmlChars(artistname)
9028 If InStr(CleanArtistName, " (") > 0 Then CleanArtistName = Left(CleanArtistName, InStrRev(CleanArtistName, " (") - 1)
9029 If InStr(CleanArtistName, ", The") > 0 Then CleanArtistName = "The " & Left(CleanArtistName, InStrRev(CleanArtistName, ", The") - 1)
9030 CleanArtistName = PackSpaces(CleanArtistName, False)
9031
9032End Function
9033
9034
9035Function AddAlternative(Alternative)
9036
9037 Dim i
9038 Alternative = Trim(Alternative)
9039 If Alternative <> "" Then
9040 If Len(Alternative) > 50 Then Alternative = Left(Alternative, 50)
9041 For i = 0 To AlternativeList.Count - 1
9042 If AlternativeList.Item(i) = Alternative Then
9043 Exit Function
9044 End If
9045 Next
9046 AlternativeList.Add Alternative
9047 End If
9048
9049End Function
9050
9051
9052Function AddAlternatives(Song)
9053
9054 Dim SavedArtist, SavedTitle, SavedAlbum, SavedAlbumArtist, SavedFolderName, SavedFileName, Custom
9055 SavedArtist = Song.ArtistName
9056 SavedTitle = Song.Title
9057 SavedAlbum = Song.AlbumName
9058 SavedAlbumArtist = Song.AlbumArtistName
9059 WriteLog("Song.Path=" & Song.Path)
9060 If InStr(Song.Path, "\") > 0 Then
9061 SavedFolderName = Mid(Song.Path, 1, InStrRev(Song.Path,"\")-1)
9062 SavedFolderName = Mid(SavedFolderName, InStrRev(SavedFolderName,"\")+1)
9063 SavedFileName = Mid(Song.Path, 1, InStrRev(Song.Path,".")-1)
9064 SavedFileName = Mid(SavedFileName, InStrRev(SavedFileName,"\")+1)
9065 ElseIf InStr(Song.Path, "/") > 0 Then
9066 SavedFolderName = Mid(Song.Path, 1, InStrRev(Song.Path,"/")-1)
9067 SavedFolderName = Mid(SavedFolderName, InStrRev(SavedFolderName,"/")+1)
9068 SavedFileName = Mid(Song.Path, 1, InStrRev(Song.Path,".")-1)
9069 SavedFileName = Mid(SavedFileName, InStrRev(SavedFileName,"/")+1)
9070 End If
9071 If SavedFileName = "" Then SavedFileName = Song.Path
9072 If SavedFolderName = "" Then SavedFolderName = Song.Path
9073
9074 AddAlternative SavedFolderName
9075 If(InStr(SavedFolderName,"(") > 0) Then
9076 Custom = Mid(SavedFolderName,1,InStr(SavedFolderName,"(")-1)
9077 AddAlternative Custom
9078 End If
9079 If(InStr(SavedFolderName,"[") > 0) Then
9080 Custom = Mid(SavedFolderName,1,InStr(SavedFolderName,"[")-1)
9081 AddAlternative Custom
9082 End If
9083 AddAlternative SavedFileName
9084 If(InStr(SavedFileName,"(") > 0) Then
9085 Custom = Mid(SavedFileName,1,InStr(SavedFileName,"(")-1)
9086 AddAlternative Custom
9087 End If
9088 If(InStr(SavedFileName,"[") > 0) Then
9089 Custom = Mid(SavedFileName,1,InStr(SavedFileName,"[")-1)
9090 AddAlternative Custom
9091 End If
9092 AddAlternative Custom
9093 AddAlternative SavedArtist
9094 AddAlternative SavedTitle
9095 AddAlternative SavedAlbum
9096 If SavedAlbumArtist <> "Various" And SavedAlbumArtist <> "Various Artists" And SavedAlbumArtist <> TxtVarious Then
9097 AddAlternative SavedAlbumArtist
9098 End If
9099 If(InStr(SavedTitle,"(") > 0) Then
9100 Custom = Mid(SavedTitle,1,InStr(SavedTitle,"(")-1)
9101 AddAlternative Custom
9102 End If
9103 If(InStr(SavedTitle,"[") > 0) Then
9104 Custom = Mid(SavedTitle,1,InStr(SavedTitle,"[")-1)
9105 AddAlternative Custom
9106 End If
9107 AddAlternative SavedArtist & " " & SavedAlbum
9108 AddAlternative SavedAlbumArtist & " " & SavedAlbum
9109 AddAlternative SavedArtist & " " & SavedTitle
9110 AddAlternative SavedAlbumArtist & " " & SavedTitle
9111
9112End Function
9113
9114
9115Function IsInteger(Str)
9116
9117 Dim i, d
9118 IsInteger = True
9119 For i = 1 To Len(str)
9120 d = Mid(str, i, 1)
9121 If Asc(d) < 48 Or Asc(d) > 57 Then
9122 IsInteger = False
9123 Exit For
9124 End If
9125 Next
9126
9127End Function
9128
9129
9130Function PackSpaces(Text, Report)
9131
9132 PackSpaces = Text
9133 PackSpaces = Replace(PackSpaces," ", " ") 'pack spaces
9134 PackSpaces = Replace(PackSpaces," ", " ") 'pack spaces left
9135 If (Left(PackSpaces, 1) = " " Or Right(PackSpaces, 1) = " ") And Report = True Then
9136 ReportRelease()
9137 End If
9138 PackSpaces = Trim(PackSpaces) 'delete leading/trailing spaces
9139
9140End Function
9141
9142
9143Function search_involved(Text, SearchText)
9144
9145 WriteLog " "
9146 WriteLog "Start Search_involved"
9147 Dim tmp, x, RE, searchPattern
9148 Dim i
9149 tmp = Split(UnwantedKeywords, ",")
9150 Set RE = New RegExp
9151 RE.IgnoreCase = True
9152 For Each searchPattern In tmp
9153 If InStr(searchPattern, "*") <> 0 Then
9154 searchPattern = Replace(searchPattern, "*", ".*")
9155 RE.Pattern = "^" & searchPattern & "$"
9156 If RE.Test(SearchText) Then
9157 search_involved = -2
9158 Exit Function
9159 End If
9160 Else
9161 If Trim(LCase(SearchText)) = Trim(LCase(searchPattern)) Then
9162 search_involved = -2
9163 Exit Function
9164 End If
9165 End If
9166 Next
9167
9168 For i = 1 To UBound(Text)
9169 If Left(Text(i), InStr(Text(i), ":")-1) = SearchText Then
9170 WriteLog "Text=" & Text(i)
9171 search_involved = i
9172 Exit Function
9173 End If
9174 Next
9175 search_involved = -1
9176
9177End Function
9178
9179
9180Function search_involved_track(Text, SearchText)
9181
9182 Dim i
9183 For i = 0 To UBound(Text)-1
9184 If Left(Text(i), Len(SearchText)) = SearchText Then
9185 search_involved_track = i
9186 Exit Function
9187 End If
9188 Next
9189 search_involved_track = -1
9190
9191End Function
9192
9193
9194Function URLEncodeUTF8(ByRef input)
9195
9196 ' urlencode a string with UTF8 encoding - yes, it is cryptic but it works!
9197 Dim i, result, CurrentChar
9198 Dim FirstByte, SecondByte, ThirdByte
9199
9200 result = ""
9201 For i = 1 To Len(input)
9202 CurrentChar = Mid(input, i, 1)
9203 CurrentChar = AscW(CurrentChar)
9204
9205 If (CurrentChar < 0) Then
9206 CurrentChar = CurrentChar + 65536
9207 End If
9208
9209 If (CurrentChar >= 0) And (CurrentChar < 128) Then
9210 ' 1 byte
9211 If(CurrentChar = 32) Then
9212 ' replace space with "+"
9213 result = result & "+"
9214 Else
9215 ' replace punctuation chars with "%hex"
9216 result = result & Escape(Chr(CurrentChar))
9217 End If
9218 End If
9219
9220 If (CurrentChar >= 128) And (CurrentChar < 2048) Then
9221 ' 2 bytes
9222 FirstByte = &HC0 Xor ((CurrentChar And &HFFFFFFC0) \ &H40&)
9223 SecondByte = &H80 Xor (CurrentChar And &H3F)
9224 result = result & "%" & Hex(FirstByte) & "%" & Hex(SecondByte)
9225 End If
9226
9227 If (CurrentChar >= 2048) And (CurrentChar < 65536) Then
9228 ' 3 bytes
9229 FirstByte = &HE0 Xor (((CurrentChar And &HFFFFF000) \ &H1000&) And &HF)
9230 SecondByte = &H80 Xor (((CurrentChar And &HFFFFFFC0) \ &H40&) And &H3F)
9231 ThirdByte = &H80 Xor (CurrentChar And &H3F)
9232 result = result & "%" & Hex(FirstByte) & "%" & Hex(SecondByte) & "%" & Hex(ThirdByte)
9233 End If
9234 Next
9235 URLEncodeUTF8 = result
9236
9237End Function
9238
9239
9240Sub SwitchAll()
9241
9242 Dim templateHTMLDoc, i, checkBox
9243 Set WebBrowser = SDB.Objects("WebBrowser")
9244 Set templateHTMLDoc = WebBrowser.Interf.Document
9245 Set checkBox = templateHTMLDoc.getElementById("selectall")
9246 SelectAll = checkBox.Checked
9247
9248 For i = 0 To iMaxTracks - 1
9249 If SelectAll Then
9250 UnselectedTracks(i) = ""
9251 Else
9252 UnselectedTracks(i) = "x"
9253 End If
9254 Next
9255
9256 ReloadResults
9257
9258End Sub
9259
9260
9261Function getArtistsName(Current, Role, QueryPage)
9262
9263 REM Current = CurrentReleae
9264 REM Role = "artists" or "artist-credit"
9265
9266 REM Current = CurrentTrack
9267 REM Role = "artists" or "artist-credit"
9268 REM Artists(0) = All Artists without Featuring
9269 REM Artists(1) = Featuring Artist
9270 REM Artists(2) = Only first Artist
9271
9272 REM WriteLog "Start getArtistsName"
9273 Dim artist, currentArtist, artistName, tmpArtistSeparator, tmp
9274 Dim FoundFeaturing
9275
9276 Dim Artists(2)
9277
9278 REM SavedArtistID = ""
9279 FoundFeaturing = False
9280
9281 If current.Exists(Role) Then
9282 For Each artist in Current(Role)
9283 Set currentArtist = Current(Role)(artist)
9284 If QueryPage = "Discogs" Then
9285 If Not CheckUseAnv And currentArtist("anv") <> "" Then
9286 artistName = CleanArtistName(currentArtist("anv"))
9287 Else
9288 artistName = CleanArtistName(currentArtist("name"))
9289 End If
9290 If CheckTheBehindArtist And Left(artistName, 4) = "The " Then artistName = Mid(artistName, 5) & ", The"
9291 If SavedArtistID = "" Then
9292 SavedArtistID = currentArtist("id")
9293 WriteLog "SavedArtistID=" & SavedArtistID
9294 End If
9295 Else
9296 artistName = CleanArtistName(currentArtist("name"))
9297 If CheckTheBehindArtist And Left(artistName, 4) = "The " Then artistName = Mid(artistName, 5) & ", The"
9298 If SavedArtistID = "" Then
9299 SavedArtistID = currentArtist("artist")("id")
9300 WriteLog "SavedArtistID=" & SavedArtistID
9301 End If
9302 End If
9303 WriteLog "Artist found=" & artistName
9304
9305 If Artists(0) = "" Then
9306 Artists(0) = artistName
9307 Artists(2) = artistName
9308 Else
9309 If FoundFeaturing = False Then
9310 Artists(0) = Artists(0) & tmpArtistSeparator & artistName
9311 Else
9312 If CheckIgnoreFeatArtist = False Then
9313 If Artists(1) = "" Then
9314 Artists(1) = tmpArtistSeparator & artistName
9315 Else
9316 Artists(1) = Artists(1) & ArtistSeparator & artistName
9317 End If
9318 End If
9319 End If
9320 End If
9321
9322 tmp = ""
9323 If QueryPage = "Discogs" Then
9324 If currentArtist("join") <> "" Then
9325 tmp = Trim(currentArtist("join"))
9326 End If
9327 Else
9328 If currentArtist("joinphrase") <> "" Then
9329 tmp = Trim(currentArtist("joinphrase"))
9330 End If
9331 End If
9332 WriteLog "Featuring found=" & tmp
9333
9334 If tmp = "," Then
9335 tmpArtistSeparator = ArtistSeparator
9336 Else
9337 If tmp <> "" Then
9338 If LookForFeaturing(tmp) = False Then
9339 tmpArtistSeparator = " " & tmp & " "
9340 End If
9341 If LookForFeaturing(tmp) = True And CheckIgnoreFeatArtist = False Then
9342 If CheckFeaturingName Then
9343 tmpArtistSeparator = TxtFeaturingName & " "
9344 Else
9345 tmpArtistSeparator = " " & tmp & " "
9346 End If
9347 End If
9348 If LookForFeaturing(tmp) = True Then
9349 FoundFeaturing = True
9350 WriteLog "FoundFeaturing=" & FoundFeaturing
9351 End If
9352 Else
9353 tmpArtistSeparator = ""
9354 End If
9355 End If
9356 Next
9357
9358 If Right(Artists(0), Len(ArtistSeparator)) = ArtistSeparator Then Artists(0) = Left(Artists(0), Len(Artists(0))-Len(ArtistSeparator))
9359 Artists(0) = Trim(Artists(0))
9360 getArtistsName = Artists
9361 WriteLog "Artists(0)=" & Artists(0)
9362 WriteLog "Artists(1)=" & Artists(1)
9363 WriteLog "Artists(2)=" & Artists(2)
9364 WriteLog ""
9365 Else
9366 Artists(0) = ""
9367 getArtistsName = Artists
9368 WriteLog "No ExtraArtist found"
9369 WriteLog ""
9370 End If
9371
9372End Function
9373
9374
9375Function ShowSearchFor
9376
9377 Dim Form
9378 Set Form = UI.NewForm
9379 Form.Common.Width = 360
9380 Form.Common.Height = 90
9381 Form.FormPosition = 4
9382 Form.Caption = "What are you searching for"
9383 Form.BorderStyle = 3
9384 Form.StayOnTop = True
9385 SDB.Objects("ShowSearchForForm") = Form
9386
9387 Dim Btn
9388 Set Btn = SDB.UI.NewButton(Form)
9389 Btn.Caption = SDB.Localize("Artist")
9390 Btn.Common.Width = 95
9391 Btn.Common.Height = 25
9392 Btn.Common.Left = 15
9393 Btn.Common.Top = 15
9394 Btn.Common.Anchors = 2+4
9395 Btn.ModalResult = 1
9396
9397 Dim Btn2
9398 Set Btn2 = SDB.UI.NewButton(Form)
9399 Btn2.Caption = SDB.Localize("Album")
9400 Btn2.Common.Width = 95
9401 Btn2.Common.Height = 25
9402 Btn2.Common.Left = 125
9403 Btn2.Common.Top = 15
9404 Btn2.Common.Anchors = 2+4
9405 Btn2.ModalResult = 2
9406
9407 Dim Btn3
9408 Set Btn3 = SDB.UI.NewButton(Form)
9409 If QueryPage = "Discogs" Then
9410 Btn3.Caption = SDB.Localize("Artist/Title/Album")
9411 Else
9412 Btn3.Caption = SDB.Localize("Artist - Album")
9413 End If
9414 Btn3.Common.Width = 95
9415 Btn3.Common.Height = 25
9416 Btn3.Common.Left = 235
9417 Btn3.Common.Top = 15
9418 Btn3.Common.Anchors = 2+4
9419 Btn3.ModalResult = 3
9420
9421 ShowSearchFor = Form.ShowModal
9422 SDB.Objects("ShowSearchForForm") = Nothing
9423 SDB.ProcessMessages
9424
9425End Function
9426
9427
9428Function ShowAdvancedSearch()
9429
9430 WriteLog "Start AdvancedSearch"
9431 Dim Form, Label, At, Btn, Btn2, edt, searchURL
9432 Dim SendArtist, SendAlbum, SendTrack, SendType, SendPerPage
9433
9434 Set Form = UI.NewForm
9435 Form.Common.Width = 320
9436 Form.Common.Height = 240
9437 Form.FormPosition = 4
9438 Form.Caption = "Advanced Search"
9439 Form.BorderStyle = 3
9440 Form.StayOnTop = True
9441 SDB.Objects("ShowAdvancedSearchForm") = Form
9442
9443 Set Label = UI.NewLabel(Form)
9444 Label.Common.SetRect 10, 10, 80, 25
9445 Label.Caption = "Please enter at least one field"
9446
9447 Set Label = UI.NewLabel(Form)
9448 Label.Common.SetRect 10, 45, 60, 25
9449 Label.Caption = SDB.Localize("Artist")
9450
9451 Set At = UI.NewEdit(Form)
9452 At.Common.SetRect 80, 40, 175, 35
9453 At.Common.ControlName = "Artist"
9454 At.Text = NewSearchArtist
9455
9456 Set Label = UI.NewLabel(Form)
9457 Label.Common.SetRect 10, 80, 60, 25
9458 Label.Caption = SDB.Localize("Album")
9459
9460 Set At = UI.NewEdit(Form)
9461 At.Common.SetRect 80, 75, 175, 35
9462 At.Common.ControlName = "Album"
9463 At.Text = NewSearchAlbum
9464
9465 Set Label = UI.NewLabel(Form)
9466 Label.Common.SetRect 10, 120, 60, 25
9467 Label.Caption = SDB.Localize("Title")
9468
9469 Set At = UI.NewEdit(Form)
9470 At.Common.SetRect 80, 115, 175, 35
9471 At.Common.ControlName = "Title"
9472 At.Text = NewSearchTrack
9473
9474 Set Btn = SDB.UI.NewButton(Form)
9475 Btn.Caption = SDB.Localize("Search")
9476 Btn.Default = True
9477 Btn.Common.Width = 95
9478 Btn.Common.Height = 25
9479 Btn.Common.Left = 30
9480 Btn.Common.Top = 160
9481 Btn.Common.Anchors = 2+4
9482 Btn.ModalResult = 1
9483
9484 Set Btn2 = SDB.UI.NewButton(Form)
9485 Btn2.Caption = SDB.Localize("Cancel")
9486 Btn2.Common.Width = 95
9487 Btn2.Common.Height = 25
9488 Btn2.Common.Left = 140
9489 Btn2.Common.Top = 160
9490 Btn2.Common.Anchors = 2+4
9491 Btn2.ModalResult = 2
9492
9493 WriteLog "ShowForm"
9494
9495 If Form.ShowModal = 1 Then
9496 Set edt = Form.Common.ChildControl("Artist")
9497 NewSearchArtist = edt.Text
9498 Set edt = Form.Common.ChildControl("Album")
9499 NewSearchAlbum = edt.Text
9500 Set edt = Form.Common.ChildControl("Title")
9501 NewSearchTrack = edt.Text
9502
9503 WriteLog "NewSearchArtist=" & NewSearchArtist
9504 WriteLog "NewSearchAlbum=" & NewSearchAlbum
9505 WriteLog "NewSearchTrack=" & NewSearchTrack
9506
9507 SDB.Objects("ShowAdvancedSearchForm") = Nothing
9508 SDB.ProcessMessages
9509
9510
9511 If NewSearchArtist <> "" Or NewSearchAlbum <> "" Or NewSearchTrack <> "" Then
9512
9513 Set Results = SDB.NewStringList
9514 Set ResultsReleaseID = SDB.NewStringList
9515
9516 SDB.Tools.WebSearch.ClearTracksData
9517
9518 If QueryPage = "Discogs" Then
9519 SendType = "release"
9520 SendPerPage = "100"
9521 SendArtist = URLEncodeUTF8(CleanSearchString(NewSearchArtist))
9522 SendAlbum = URLEncodeUTF8(CleanSearchString(NewSearchAlbum))
9523 SendTrack = URLEncodeUTF8(CleanSearchString(NewSearchTrack))
9524 JSONParser_find_result "", "results", SendArtist, SendAlbum, SendTrack, SendType, "", SendPerPage, QueryPage, True
9525 End If
9526
9527 If QueryPage = "MusicBrainz" Then
9528 searchURL = "http://musicbrainz.org/ws/2/release?query=artist:" & Chr(34) & CleanSearchString(URLEncodeUTF8(NewSearchArtist)) & Chr(34) & " AND release:" & Chr(34) & URLEncodeUTF8(CleanSearchString(NewSearchAlbum)) & Chr(34) & "&limit=50&offset=0&fmt=json"
9529 JSONParser_find_result searchURL, "releases", "", "", "", "", "", "", "MusicBrainz", False
9530 End If
9531 If QueryPage = "MetalArchives" Then
9532 searchURL = "https://www.metal-archives.com/search/ajax-advanced/searching/albums/?bandName=" & URLEncodeUTF8(CleanSearchString(NewSearchArtist)) & "&exactBandMatch=1&releaseTitle=" & URLEncodeUTF8(CleanSearchString(NewSearchAlbum)) & "&exactReleaseMatch=1&releaseYearFrom=&releaseMonthFrom=&releaseYearTo=&releaseMonthTo=&country=&location=&releaseLabelName=&genre="
9533 JSONParser_find_result searchURL, "", "", "", "", "", "", "", "MetalArchives", False
9534 End If
9535
9536 SDB.Tools.WebSearch.SetSearchResults Results
9537 SDB.Tools.WebSearch.ResultIndex = 0
9538 End If
9539 Else
9540 SDB.Objects("ShowAdvancedSearchForm") = Nothing
9541 WriteLog "Advanced Search canceled"
9542 End If
9543
9544End Function
9545
9546
9547Function UserCollection()
9548
9549 WriteLog "Start UserCollection"
9550 Dim oXMLHTTP, response
9551 Dim json
9552 Set json = New VbsJson
9553 Dim Page, ReleaseCountMax, ReleasePages, r, id, ReleaseFound, ErrorFound
9554 Set oXMLHTTP = CreateObject("MSXML2.XMLHTTP.6.0")
9555 If DiscogsUsername = "" Then
9556 oXMLHTTP.Open "POST", "https://www.germanc64.de/mm/oauth/identity.php", False
9557 oXMLHTTP.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
9558 oXMLHTTP.setRequestHeader "User-Agent",UserAgent
9559 WriteLog "Sending Post at=" & AccessToken & "&ats=" & AccessTokenSecret
9560 oXMLHTTP.send ("at=" & AccessToken & "&ats=" & AccessTokenSecret)
9561
9562 If oXMLHTTP.Status = 200 Then
9563 If InStr(oXMLHTTP.responseText, "OAuth client error") <> 0 Then
9564 WriteLog "responseText=" & oXMLHTTP.responseText
9565 ErrorMessage = oXMLHTTP.responseText
9566 Exit Function
9567 Else
9568 WriteLog "responseText=" & oXMLHTTP.responseText
9569 Set response = json.Decode(oXMLHTTP.responseText)
9570 DiscogsUsername = response("username")
9571 ini.StringValue("DiscogsAutoTagWeb", "DiscogsUsername") = DiscogsUsername
9572 End If
9573 End If
9574 End If
9575
9576 If CheckDiscogsCollectionOff = False Then
9577 oXMLHTTP.Open "POST", "https://www.germanc64.de/mm/oauth/get_release.php", False
9578 oXMLHTTP.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
9579 oXMLHTTP.setRequestHeader "User-Agent", UserAgent
9580 WriteLog "Sending Post at=" & AccessToken & "&ats=" & AccessTokenSecret & "&username=" & DiscogsUsername & "&page=1"
9581 oXMLHTTP.send("at=" & AccessToken & "&ats=" & AccessTokenSecret & "&username=" & DiscogsUsername & "&page=1")
9582 If oXMLHTTP.Status = 200 Then
9583 If InStr(oXMLHTTP.responseText, "OAuth client error") = 0 Then
9584 WriteLog "Response=" & oXMLHTTP.responseText
9585 WriteLog "User Collection received"
9586 Set response = json.Decode(oXMLHTTP.responseText)
9587 ReleaseCountMax = response("pagination")("items")
9588 WriteLog "ReleaseCountMax=" & ReleaseCountMax
9589 If Int(ReleaseCountMax) > 0 Then
9590 ReleaseFound = False
9591 ErrorFound = False
9592 ReleasePages = response("pagination")("pages")
9593 WriteLog "ReleasePages=" & ReleasePages
9594 For Page = 1 To ReleasePages
9595 If Page <> 1 Then
9596 oXMLHTTP.Open "POST", "https://www.germanc64.de/mm/oauth/get_release.php", False
9597 oXMLHTTP.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
9598 oXMLHTTP.setRequestHeader "User-Agent", UserAgent
9599 WriteLog "Sending Post at=" & AccessToken & "&ats=" & AccessTokenSecret & "&username=" & DiscogsUsername & "&page=" & Page
9600 oXMLHTTP.send("at=" & AccessToken & "&ats=" & AccessTokenSecret & "&username=" & DiscogsUsername & "&page=" & Page)
9601 If oXMLHTTP.Status = 200 Then
9602 If InStr(oXMLHTTP.responseText, "OAuth client error") <> 0 Then
9603 ErrorFound = True
9604 Exit For
9605 End If
9606 WriteLog "responseText=" & oXMLHTTP.responseText
9607 Set response = json.Decode(oXMLHTTP.responseText)
9608 Else
9609 Exit For
9610 End If
9611 End If
9612 For Each r In response("releases")
9613 id = response("releases")(r)("id")
9614 REM WriteLog "ID gelesen=" & id
9615 If Int(CurrentReleaseID) = Int(id) Then
9616 ReleaseFound = True
9617 Exit For
9618 End If
9619 Next
9620 If ReleaseFound = True Then Exit For
9621 Next
9622
9623 If ReleaseFound = False And ErrorFound = False Then
9624
9625 oXMLHTTP.Open "POST", "https://www.germanc64.de/mm/oauth/add_release.php", False
9626 oXMLHTTP.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
9627 oXMLHTTP.setRequestHeader "User-Agent", UserAgent
9628 WriteLog "Sending Post at=" & AccessToken & "&ats=" & AccessTokenSecret & "&username=" & DiscogsUsername & "&release=" & CurrentReleaseID
9629 oXMLHTTP.send("at=" & AccessToken & "&ats=" & AccessTokenSecret & "&username=" & DiscogsUsername & "&release=" & CurrentReleaseID)
9630 If oXMLHTTP.Status = 200 Then
9631 If InStr(oXMLHTTP.responseText, "OAuth client error") = 0 Then
9632 WriteLog "Response=" & oXMLHTTP.responseText
9633 WriteLog "Release added to User Collection"
9634 SDB.MessageBox "Release added to your User Collection", mtInformation, Array(mbOk)
9635 End If
9636 End If
9637 End If
9638 If ReleaseFound = True Then
9639 WriteLog "Release already exists"
9640 SDB.MessageBox "Release already exists in User Collection", mtInformation, Array(mbOk)
9641 End If
9642 End If
9643 Else
9644 WriteLog "responseText=" & oXMLHTTP.responseText
9645 WriteLog "Error"
9646 End If
9647 End If
9648 Else
9649 oXMLHTTP.Open "POST", "https://www.germanc64.de/mm/oauth/add_release.php", False
9650 oXMLHTTP.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
9651 oXMLHTTP.setRequestHeader "User-Agent", UserAgent
9652 WriteLog "Sending Post at=" & AccessToken & "&ats=" & AccessTokenSecret & "&username=" & DiscogsUsername & "&release=" & CurrentReleaseID
9653 oXMLHTTP.send("at=" & AccessToken & "&ats=" & AccessTokenSecret & "&username=" & DiscogsUsername & "&release=" & CurrentReleaseID)
9654 If oXMLHTTP.Status = 200 Then
9655 If InStr(oXMLHTTP.responseText, "OAuth client error") = 0 Then
9656 WriteLog "Response=" & oXMLHTTP.responseText
9657 WriteLog "Release added to User Collection"
9658 SDB.MessageBox "Release added to your User Collection", mtInformation, Array(mbOk)
9659 End If
9660 End If
9661 End If
9662
9663End Function
9664
9665
9666Sub ReportRelease()
9667
9668 'If Trackname has leading and/or trailing spaces the release-id will be stored in database to fix the entry at discogs
9669 Dim oXMLHTTP
9670 Set oXMLHTTP = CreateObject("MSXML2.XMLHTTP.6.0")
9671 oXMLHTTP.Open "POST", "https://www.germanc64.de/mm/oauth/report_release.php", False
9672 oXMLHTTP.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
9673 oXMLHTTP.setRequestHeader "User-Agent", UserAgent
9674 WriteLog "Sending release=" & CurrentReleaseID
9675 oXMLHTTP.send("release=" & CurrentReleaseID)
9676 Set oXMLHTTP = Nothing
9677
9678End Sub
9679
9680
9681Function LeadingZeroDisc(TestNumber)
9682
9683 If CheckLeadingZeroDisc = False Then
9684 LeadingZeroDisc = TestNumber
9685 Else
9686 If IsInteger(TestNumber) Then
9687 If Left(cStr(TestNumber), 1) <> "0" And TestNumber < 10 Then
9688 LeadingZeroDisc = "0" & TestNumber
9689 Else
9690 LeadingZeroDisc = TestNumber
9691 End If
9692 Else
9693 LeadingZeroDisc = TestNumber
9694 End If
9695 End If
9696
9697End Function
9698
9699
9700Function bubblesort(Trackorder_org, byRef SortedTrackList)
9701
9702 Dim TempValue, i, j, TempDisc, start, TempValue2, found
9703 ' Set TrackOrderTable = SDB.NewStringList
9704
9705 found = True
9706 For i = 0 to Trackorder_org.Count - 1
9707 SortedTrackList.add i
9708 If Trackorder_org.item(i).DiscNumberStr = "" Or Not IsNumeric(Trackorder_org.item(i).DiscNumberStr) Then found = False
9709 Next
9710 If found = True Then
9711 For i = 0 to Trackorder_org.Count - 1
9712 For j = 0 to Trackorder_org.Count - 2
9713 If j <> Int(Trackorder_org.Count) - 2 Then
9714 If Int(Trackorder_org.item(j).DiscNumberStr) > Int(Trackorder_org.item(j+1).DiscNumberStr) Then
9715 TempValue = Trackorder_org.item(j+1).DiscNumberStr
9716 Trackorder_org.item(j+1).DiscNumberStr = Trackorder_org.item(j).DiscNumberStr
9717 Trackorder_org.item(j).DiscNumberStr = TempValue
9718 TempValue2 = SortedTrackList.item(j+1)
9719 SortedTrackList.item(j+1) = SortedTrackList.item(j)
9720 SortedTrackList.item(j) = TempValue2
9721 End If
9722 End If
9723 Next
9724 Next
9725 For i = 0 to SortedTrackList.Count - 1
9726 WriteLog "disc=" & Trackorder_org.item(SortedTrackList.item(i)).DiscNumberStr & " track=" & Trackorder_org.item(SortedTrackList.item(i)).TrackOrderStr
9727 Next
9728 End If
9729 start = 0
9730 Do While start < Int(Trackorder_org.Count)
9731 If found = True Then
9732 TempDisc = Trackorder_org.item(start).DiscNumberStr
9733 For i = start to Int(Trackorder_org.Count) - 1
9734 If Int(TempDisc) <> Int(Trackorder_org.item(i).DiscNumberStr) Then
9735 start = i
9736 WriteLog "TempDisc=" & TempDisc & " New:" & Trackorder_org.item(i).DiscNumberStr & " i=" & i
9737 Exit For
9738 End If
9739 For j = start to Int(Trackorder_org.Count) - 2
9740 If j <> Int(Trackorder_org.Count) - 2 Then
9741 If Int(TempDisc) <> Int(Trackorder_org.item(j+1).DiscNumberStr) Then
9742 WriteLog "2. TempDisc=" & TempDisc & " New:" & Trackorder_org.item(j+1).DiscNumberStr & " j=" & j
9743 Exit For
9744 End If
9745 If Int(Trackorder_org.item(j).TrackOrderStr) > Int(Trackorder_org.item(j+1).TrackOrderStr) Then
9746 TempValue = Trackorder_org.item(j+1).TrackOrderStr
9747 Trackorder_org.item(j+1).TrackOrderStr = Trackorder_org.item(j).TrackOrderStr
9748 Trackorder_org.item(j).TrackOrderStr = TempValue
9749 TempValue2 = SortedTrackList.item(j+1)
9750 SortedTrackList.item(j+1) = SortedTrackList.item(j)
9751 SortedTrackList.item(j) = TempValue2
9752 End If
9753 End If
9754 Next
9755 Next
9756 Else
9757 For i = 0 to Int(Trackorder_org.Count) - 1
9758 For j = 0 to Int(Trackorder_org.Count) - 2
9759 If j <> Int(Trackorder_org.Count) - 2 Then
9760 If Trackorder_org.item(j).TrackOrderStr > Trackorder_org.item(j+1).TrackOrderStr Then
9761 TempValue = Trackorder_org.item(j+1).TrackOrderStr
9762 Trackorder_org.item(j+1).TrackOrderStr = Trackorder_org.item(j).TrackOrderStr
9763 Trackorder_org.item(j).TrackOrderStr = TempValue
9764 TempValue2 = SortedTrackList.item(j+1)
9765 SortedTrackList.item(j+1) = SortedTrackList.item(j)
9766 SortedTrackList.item(j) = TempValue2
9767 End If
9768 End If
9769 Next
9770 Next
9771 End If
9772 If i = Int(Trackorder_org.Count) Then Exit Do
9773 Loop
9774 For i = 0 to SortedTrackList.Count - 1
9775 WriteLog "SortedTrackList=" & SortedTrackList.Item(i)
9776 Next
9777 For i = 0 to SortedTrackList.Count - 1
9778 WriteLog "disc=" & Trackorder_org.item(SortedTrackList.item(i)).DiscNumberStr & " track=" & Trackorder_org.item(SortedTrackList.item(i)).TrackOrderStr
9779 Next
9780
9781End Function
9782
9783
9784Function authorize_script(AuthFailed)
9785
9786 WriteLog "Start Authorize Function"
9787
9788 Dim authHTML, TypeLib
9789 Dim IEobj, oXMLHTTP
9790 Dim retIE, retryCnt, start, a
9791 Dim Form, WebBrowser2, Btn1, Lbl1, Btn2, Btn4
9792
9793 If AuthFailed = False And AccessToken <> "" And AccessTokenSecret <> "" Then
9794 authorize_script = True
9795 Exit Function
9796 End If
9797
9798 If AuthFailed = True Then
9799 SDB.MessageBox "Authorize failed (Err=1)! You have to authorize Discogs Tagger with your Discogs account !", mtError, Array(mbOk)
9800 End If
9801
9802 Set Form = UI.NewForm
9803 Form.Common.Width = 300
9804 Form.Common.Height = 280
9805 Form.FormPosition = 4
9806 Form.Caption = "Authorize Discogs Tagger"
9807 Form.BorderStyle = 3
9808 Form.StayOnTop = True
9809
9810 Set Lbl1 = UI.NewLabel(Form)
9811 Lbl1.Common.ControlName = "Lbl1"
9812 Lbl1.Common.SetRect 10, 10, 100, 16
9813 Lbl1.Caption = "In order to use the Discogs Tagger, you must"
9814
9815 Set Btn1 = UI.NewButton(Form)
9816 Btn1.Common.ControlName = "Btn1"
9817 Btn1.Common.SetRect 10, 40, 250, 25
9818 Btn1.Caption = "1. Create an account on the Discogs website"
9819 Script.RegisterEvent Btn1, "OnClick", "Btn1Click"
9820
9821 Set Btn2 = UI.NewButton(Form)
9822 Btn2.Common.ControlName = "Btn2"
9823 Btn2.Common.SetRect 10, 80, 250, 25
9824 Btn2.Caption = "2. Authorize the Discogs Tagger"
9825 Script.RegisterEvent Btn2, "OnClick", "Btn2Click"
9826
9827 Set Lbl1 = UI.NewLabel(Form)
9828 Lbl1.Common.ControlName = "Lbl1"
9829 Lbl1.Common.SetRect 10, 120, 100, 16
9830 Lbl1.Caption = "to use your newly-created account."
9831
9832 Set Btn4 = UI.NewButton(Form)
9833 Btn4.Common.ControlName = "Btn4"
9834 Btn4.Common.SetRect 10, 160, 250, 25
9835 Btn4.Caption = "Read this PDF if you need help"
9836 Script.RegisterEvent Btn4, "OnClick", "Btn4Click"
9837
9838 Set Lbl1 = UI.NewLabel(Form)
9839 Lbl1.Common.ControlName = "Lbl1"
9840 Lbl1.Common.SetRect 10, 200, 100, 16
9841 Lbl1.Caption = "Press 'OK', once you've authorized the Discogs Tagger."
9842
9843 Set TypeLib = CreateObject("Scriptlet.TypeLib")
9844
9845 GUID = Mid(TypeLib.Guid, 2, 36)
9846 WriteLog "GUID=" & GUID
9847
9848 Dim Foot : Set Foot = SDB.UI.NewPanel(Form)
9849 Foot.Common.Align = 2
9850 Foot.Common.Height = 35
9851
9852 Dim Btn3 : Set Btn3 = SDB.UI.NewButton(Foot)
9853 Btn3.Caption = SDB.Localize("Ok")
9854 Btn3.Common.Width = 75
9855 Btn3.Common.Height = 25
9856 Btn3.Common.Left = 110
9857 Btn3.Common.Top = 6
9858 Btn3.Common.Anchors = 2+4
9859 Btn3.UseScript = Script.ScriptPath
9860 Btn3.ModalResult = 1
9861 Btn3.Default = True
9862
9863 If Form.ShowModal = 1 Then
9864 Set oXMLHTTP = CreateObject("MSXML2.XMLHTTP.6.0")
9865 oXMLHTTP.open "GET", "https://www.germanc64.de/mm/oauth/get_oauth_guid.php?f=" & GUID, false
9866 oXMLHTTP.send()
9867 If oXMLHTTP.Status = 200 Then
9868 retIE = oXMLHTTP.responseText
9869
9870 If InStr(retIE, "AccessToken=") <> 0 Then
9871 start = InStr(retIE, "AccessToken=")
9872 retIE = Mid(retIE, start + 12)
9873 AccessToken = Left(retIE, 40)
9874 ini.StringValue("DiscogsAutoTagWeb","AccessToken") = AccessToken
9875 WriteLog "AccessToken=" & AccessToken
9876 start = InStr(retIE, "AccessTokenSecret=")
9877 retIE = Mid(retIE, start + 18)
9878 AccessTokenSecret = Left(retIE, 40)
9879 ini.StringValue("DiscogsAutoTagWeb","AccessTokenSecret") = AccessTokenSecret
9880 WriteLog "AccessTokenSecret=" & AccessTokenSecret
9881 SDB.MessageBox "Congratulations! You can now use Discogs Tagger!", mtInformation, Array(mbOk)
9882 authorize_script = True
9883 End If
9884 Else
9885 WriteLog "Authorize failed (Err=1)!"
9886 Set oXMLHTTP = Nothing
9887 authorize_script(False)
9888 End If
9889
9890 Set oXMLHTTP = Nothing
9891 Else
9892 WriteLog "AccessToken found in ini = " & AccessToken
9893 WriteLog "AccessTokenSecret found in ini = " & AccessTokenSecret
9894 authorize_script = True
9895 End If
9896 WriteLog "End Authorize Function"
9897
9898
9899End Function
9900
9901
9902Sub Btn1Click
9903
9904 Dim objShell
9905 Set objShell = CreateObject("Shell.Application")
9906 objShell.ShellExecute "explorer.exe", "https://www.discogs.com"
9907
9908End Sub
9909
9910Sub Btn2Click
9911
9912 Dim objShell, link
9913 Set objShell = CreateObject("Shell.Application")
9914 link = chr(34) & "https://www.germanc64.de/mm/oauth/oauth_guid.php?f=" & GUID & chr(34)
9915 objShell.ShellExecute "explorer.exe", link
9916
9917End Sub
9918
9919Sub Btn4Click
9920
9921 Dim objShell, link
9922 Set objShell = CreateObject("Shell.Application")
9923 link = chr(34) & "https://www.germanc64.de/mm/oauth/HowTo_authorize_with_discogs.pdf" & chr(34)
9924 objShell.ShellExecute "explorer.exe", link
9925
9926End Sub
9927
9928Sub showOptions()
9929
9930 WriteLog "Start OptionsForm"
9931
9932 Dim Form, WebBrowser2, optionsHTML, optionsHTMLDoc, checkbox, text
9933 Dim i, a
9934 Set Form = UI.NewForm
9935 Form.Common.Width = 275
9936 Form.Common.Height = 620
9937 Form.FormPosition = 4
9938 Form.Caption = "Tagging Options"
9939 Form.BorderStyle = 2
9940 Form.StayOnTop = True
9941
9942 Dim Foot : Set Foot = SDB.UI.NewPanel(Form)
9943 Foot.Common.Align = 2
9944 Foot.Common.Height = 35
9945
9946 Dim Btn : Set Btn = SDB.UI.NewButton(Foot)
9947 Btn.Caption = SDB.Localize("Cancel")
9948 Btn.Common.Width = 85
9949 Btn.Common.Height = 25
9950 Btn.Common.Left = 170
9951 Btn.Common.Top = 6
9952 Btn.Common.Anchors = 2+4
9953 Btn.UseScript = Script.ScriptPath
9954 Btn.ModalResult = 2
9955 Btn.Cancel = True
9956
9957 Dim Btn2 : Set Btn2 = SDB.UI.NewButton(Foot)
9958 Btn2.Caption = SDB.Localize("Ok")
9959 Btn2.Common.Width = 85
9960 Btn2.Common.Height = 25
9961 Btn2.Common.Left = 15
9962 Btn2.Common.Top = 6
9963 Btn2.Common.Anchors = 2+4
9964 Btn2.UseScript = Script.ScriptPath
9965 Btn2.ModalResult = 1
9966 Btn2.Default = True
9967
9968 optionsHTML = "<HTML>"
9969 optionsHTML = optionsHTML & "<HEAD>"
9970 optionsHTML = optionsHTML & "<style type=""text/css"" media=""screen"">"
9971 optionsHTML = optionsHTML & ".tabletext { font-family: Arial, Helvetica, sans-serif; font-size: 8pt;}"
9972 optionsHTML = optionsHTML & "option.tabletext{background-color:#3E7CBB;}"
9973
9974 optionsHTML = optionsHTML & "</style>"
9975 optionsHTML = optionsHTML & "</HEAD>"
9976 optionsHTML = optionsHTML & "<table border=0 cellspacing=0 cellpadding=1 class=tabletext>"
9977
9978 optionsHTML = optionsHTML & "<tr><td align=center><b>Tagging options:</b></td></tr>"
9979 If QueryPage = "Discogs" Then
9980 optionsHTML = optionsHTML & "<tr><td colspan=2 align=left><input type=checkbox id=""useanv"" title=""Artist Name Variation - Using no name variation (e.g. nickname)"" >Don't Use ANV's</td></tr>"
9981 End If
9982 optionsHTML = optionsHTML & "<tr><td align=left><input type=checkbox id=""yearonlydate"" title=""If checked only the Year will be saved (e.g. 14.01.1982 -> 1982)"" >Only Year Of Date</td></tr>"
9983 optionsHTML = optionsHTML & "<tr><td align=left><input type=checkbox id=""deleteduplicatedentry"" title=""If checked the duplicated entries in the label-tag or the catalog-tag will be deleted (e.g. Label-tag: Roadrunner Records; Roadrunner Records -> Roadrunner Records"" >Delete duplicated Entries</td></tr>"
9984 optionsHTML = optionsHTML & "<tr><td align=left><input type=checkbox id=""titlefeaturing"" title=""If checked the feat. artist appears in the title tag (e.g. Aaliyah ft. Timbaland - We Need a Resolution -> Aaliyah - We Need a Resolution (ft. Timbaland) )"" >feat. Artist behind Title</td></tr>"
9985 optionsHTML = optionsHTML & "<tr><td align=left><input type=checkbox id=""ignorefeaturing"" title=""If checked the feat. artist will be ignored"" >Ignore feat. artist</td></tr>"
9986 optionsHTML = optionsHTML & "<tr><td align=left><input type=checkbox id=""TheBehindArtist"" title=""If checked the ArtistName will be 'Beatles, The' instead of 'The Beatles'"" >Move 'The' in Artist to the end</td></tr>"
9987
9988 optionsHTML = optionsHTML & "<tr><td align=left><input type=checkbox id=""FeaturingName"" title=""Rename 'feat.' to the given word"" >Rename 'feat.' to:</td></tr>"
9989 optionsHTML = optionsHTML & "<tr><td align=left><input type=text id=""TxtFeaturingName"" ></td></tr>"
9990
9991 optionsHTML = optionsHTML & "<tr><td align=left><input type=checkbox id=""various"" title=""Rename 'Various' Artist to the given word"" >Rename 'Various' Artist to:</td></tr>"
9992 optionsHTML = optionsHTML & "<tr><td align=left><input type=text id=""txtvarious"" ></td></tr>"
9993
9994 optionsHTML = optionsHTML & "<tr><td align=left><input type=checkbox id=""involvedpeoplesingle"" title=""Print every involved people on individual lines"" >Involved people on individual lines</td></tr>"
9995 optionsHTML = optionsHTML & "<tr><td align=left><input type=checkbox id=""showqtyformat"" title=""Show qty of format in format tag, if there is more than one"" >Show quantity of the format (i.e. 2 x CD)</td></tr>"
9996
9997 optionsHTML = optionsHTML & "<tr><td align=center><br></td></tr>"
9998 optionsHTML = optionsHTML & "<tr><td align=center><b>Disc/Track Numbering:</b></td></tr>"
9999
10000 optionsHTML = optionsHTML & "<tr><td align=left><input type=checkbox id=""TurnOffSubTrack"" title=""If checked the Sub-Track detection is turned off"" >No Sub-Track detection</td></tr>"
10001 optionsHTML = optionsHTML & "<tr><td align=left><input type=checkbox id=""SubTrackNameSelection"" title=""If checked the sub-track will be named like 'Sub-Track 1, Sub-Track 2, Sub Track 3' if not checked the Sub-Tracks will be named like 'Track Name (Sub-Track 1, Sub-Track 2, Sub Track 3)'"" >Other Sub-Track Naming</td></tr>"
10002 optionsHTML = optionsHTML & "<tr><td align=left><input type=text id=""SubTrackSeparator"" title=""Choose the separator used for sub-tracks"" size=""5""> Separator for sub-tracks</td></tr>"
10003
10004 If QueryPage = "Discogs" Then
10005 optionsHTML = optionsHTML & "<tr><td align=left><input type=checkbox id=""forcenumeric"" title=""Always use numbers instead of letters (Vinyl-releases use A1, A2,..., B1, B2 as track numbering)"" >Force To Numeric</td></tr>"
10006 optionsHTML = optionsHTML & "<tr><td align=left><input type=checkbox id=""sidestodisc"" title=""Save the Vinyl sides to the disc tag"" >Sides To Disc</td></tr>"
10007 End If
10008 optionsHTML = optionsHTML & "<tr><td align=left><input type=checkbox id=""forcedisc"" title=""Always add a disc-number"" >Force Disc Usage</td></tr>"
10009 optionsHTML = optionsHTML & "<tr><td align=left><input type=checkbox id=""nodisc"" title=""Prevent the script from interpret sub tracks as disc-numbers"" >Force NO Disc Usage</td></tr>"
10010 optionsHTML = optionsHTML & "<tr><td align=left><input type=checkbox id=""leadingzero"" title=""Track Position: 1 -> 01 2 -> 02 ..."" >Add Leading Zero (Track#)</td></tr>"
10011 optionsHTML = optionsHTML & "<tr><td align=left><input type=checkbox id=""leadingzeroDisc"" title=""Disc-number: 1 -> 01 2 -> 02 ..."" >Add Leading Zero (Disc#)</td></tr>"
10012 optionsHTML = optionsHTML & "<tr><td align=left><input type=checkbox id=""NewMatchingEngine"" title=""If you use the Discogs Tagger for tagging complete albums, use the new Matching Engine. Uncheck this if you only tagging single tracks"" >Use new Matching Engine</td></tr>"
10013
10014 optionsHTML = optionsHTML & "</table>"
10015
10016 optionsHTML = optionsHTML & "</body>"
10017 optionsHTML = optionsHTML & "</HTML>"
10018
10019
10020 Set WebBrowser2 = UI.NewActiveX(Form, "Shell.Explorer")
10021 WebBrowser2.Common.Align = 5
10022 WebBrowser2.Common.ControlName = "WebBrowser2"
10023 WebBrowser2.Common.Top = 100
10024 WebBrowser2.Common.Left = 100
10025
10026 SDB.Objects("WebBrowser2") = WebBrowser2
10027 WebBrowser2.Interf.Visible = True
10028 WebBrowser2.Common.BringToFront
10029
10030 WebBrowser2.SetHTMLDocument optionsHTML
10031 Set optionsHTMLDoc = WebBrowser2.Interf.Document
10032
10033 If QueryPage = "Discogs" Then
10034 Set checkBox = optionsHTMLDoc.getElementById("useanv")
10035 checkBox.Checked = CheckUseAnv
10036 End If
10037 Set checkBox = optionsHTMLDoc.getElementById("yearonlydate")
10038 checkBox.Checked = CheckYearOnlyDate
10039 If QueryPage = "Discogs" Then
10040 Set checkBox = optionsHTMLDoc.getElementById("forcenumeric")
10041 checkBox.Checked = CheckForceNumeric
10042 Set checkBox = optionsHTMLDoc.getElementById("sidestodisc")
10043 checkBox.Checked = CheckSidesToDisc
10044 End If
10045 Set checkBox = optionsHTMLDoc.getElementById("forcedisc")
10046 checkBox.Checked = CheckForceDisc
10047 Set checkBox = optionsHTMLDoc.getElementById("nodisc")
10048 checkBox.Checked = CheckNoDisc
10049 Set checkBox = optionsHTMLDoc.getElementById("leadingzero")
10050 checkBox.Checked = CheckLeadingZero
10051 Set checkBox = optionsHTMLDoc.getElementById("leadingzeroDisc")
10052 checkBox.Checked = CheckLeadingZeroDisc
10053 Set checkBox = optionsHTMLDoc.getElementById("titlefeaturing")
10054 checkBox.Checked = CheckTitleFeaturing
10055 Set checkBox = optionsHTMLDoc.getElementById("deleteduplicatedentry")
10056 checkBox.Checked = CheckDeleteDuplicatedEntry
10057 Set text = optionsHTMLDoc.getElementById("TxtFeaturingName")
10058 text.value = TxtFeaturingName
10059 Set checkbox = optionsHTMLDoc.getElementById("FeaturingName")
10060 checkBox.Checked = CheckFeaturingName
10061 Set checkbox = optionsHTMLDoc.getElementById("NewMatchingEngine")
10062 checkBox.Checked = CheckNewMatchingEngine
10063
10064 Set text = optionsHTMLDoc.getElementById("txtvarious")
10065 text.value = TxtVarious
10066 Set checkBox = optionsHTMLDoc.getElementById("various")
10067 checkBox.Checked = CheckVarious
10068 Set checkBox = optionsHTMLDoc.getElementById("SubTrackNameSelection")
10069 checkBox.Checked = SubTrackNameSelection
10070 Set checkBox = optionsHTMLDoc.getElementById("TurnOffSubTrack")
10071 checkBox.Checked = CheckTurnOffSubTrack
10072 Set checkBox = optionsHTMLDoc.getElementById("involvedpeoplesingle")
10073 checkBox.Checked = CheckInvolvedPeopleSingleLine
10074 Set checkBox = optionsHTMLDoc.getElementById("showqtyformat")
10075 checkBox.Checked = CheckShowQtyFormat
10076 Set checkBox = optionsHTMLDoc.getElementById("TheBehindArtist")
10077 checkBox.Checked = CheckTheBehindArtist
10078 Set text = optionsHTMLDoc.getElementById("SubTrackSeparator")
10079 text.value = SubTrackSeparator
10080
10081
10082 If Form.ShowModal = 1 Then
10083
10084 If QueryPage = "Discogs" Then
10085 Set checkBox = optionsHTMLDoc.getElementById("useanv")
10086 CheckUseAnv = checkBox.Checked
10087 End If
10088 Set checkBox = optionsHTMLDoc.getElementById("yearonlydate")
10089 CheckYearOnlyDate = checkBox.Checked
10090 If QueryPage = "Discogs" Then
10091 Set checkBox = optionsHTMLDoc.getElementById("forcenumeric")
10092 CheckForceNumeric = checkBox.Checked
10093 Set checkBox = optionsHTMLDoc.getElementById("sidestodisc")
10094 CheckSidesToDisc = checkBox.Checked
10095 End If
10096 Set checkBox = optionsHTMLDoc.getElementById("forcedisc")
10097 If Not CheckForceDisc And checkBox.Checked Then
10098 CheckNoDisc = False
10099 CheckForceDisc = checkBox.Checked
10100 Else
10101 CheckForceDisc = checkBox.Checked
10102 Set checkBox = optionsHTMLDoc.getElementById("nodisc")
10103 If Not CheckNoDisc And checkBox.Checked Then
10104 CheckForceDisc = False
10105 End If
10106 CheckNoDisc = checkBox.Checked
10107 End If
10108 Set checkBox = optionsHTMLDoc.getElementById("leadingzero")
10109 CheckLeadingZero = checkBox.Checked
10110 Set checkBox = optionsHTMLDoc.getElementById("leadingzeroDisc")
10111 CheckLeadingZeroDisc = checkBox.Checked
10112 Set checkBox = optionsHTMLDoc.getElementById("titlefeaturing")
10113 CheckTitleFeaturing = checkBox.Checked
10114 Set checkBox = optionsHTMLDoc.getElementById("deleteduplicatedentry")
10115 CheckDeleteDuplicatedEntry = checkBox.Checked
10116 Set checkBox = optionsHTMLDoc.getElementById("FeaturingName")
10117 CheckFeaturingName = checkBox.Checked
10118 Set text = optionsHTMLDoc.getElementById("TxtFeaturingName")
10119 TxtFeaturingName = text.Value
10120
10121 Set checkBox = optionsHTMLDoc.getElementById("various")
10122 CheckVarious = checkBox.Checked
10123 Set text = optionsHTMLDoc.getElementById("txtvarious")
10124 TxtVarious = text.Value
10125 Set checkBox = optionsHTMLDoc.getElementById("SubTrackNameSelection")
10126 SubTrackNameSelection = checkBox.Checked
10127 Set checkBox = optionsHTMLDoc.getElementById("TurnOffSubTrack")
10128 CheckTurnOffSubTrack = checkBox.Checked
10129 Set checkBox = optionsHTMLDoc.getElementById("involvedpeoplesingle")
10130 CheckInvolvedPeopleSingleLine = checkBox.Checked
10131 Set checkBox = optionsHTMLDoc.getElementById("showqtyformat")
10132 CheckShowQtyFormat = checkBox.Checked
10133 Set checkBox = optionsHTMLDoc.getElementById("TheBehindArtist")
10134 CheckTheBehindArtist = checkBox.Checked
10135 Set checkBox = optionsHTMLDoc.getElementById("ignorefeaturing")
10136 CheckIgnoreFeatArtist = checkBox.Checked
10137 Set text = optionsHTMLDoc.getElementById("SubTrackSeparator")
10138 SubTrackSeparator = text.Value
10139 Set checkbox = optionsHTMLDoc.getElementById("NewMatchingEngine")
10140 CheckNewMatchingEngine = checkBox.Checked
10141
10142
10143 SDB.Objects("WebBrowser2") = Nothing
10144 ReloadResults
10145 Else
10146 SDB.Objects("WebBrowser2") = Nothing
10147 End If
10148
10149
10150End Sub
10151