vbs_

Discogs Tagger modified front cover

Dec 22nd, 2020
253
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Option Explicit
  2. '
  3. ' Discogs Tagger Script for MediaMonkey ( Let & eepman & crap_inhuman )
  4. '
  5. Const 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
  547. Dim WebBrowser
  548.  
  549. ' decoded json object representing currently selected release
  550. Dim CurrentRelease, QueryPage
  551.  
  552. Dim UI
  553.  
  554. Dim Results, ResultsReleaseID, NewResult
  555. Dim CurrentReleaseId, CurrentResultId
  556. Dim ini
  557.  
  558. Dim CheckAlbum, CheckArtist, CheckAlbumArtist, CheckAlbumArtistFirst, CheckLabel, CheckDate, CheckOrigDate, CheckGenre
  559. Dim CheckCountry, CheckCover, CheckSmallCover, SmallCover, CheckStyle, CheckCatalog, CheckRelease, CheckInvolved, CheckLyricist, CheckGrouping
  560. Dim CheckComposer, CheckConductor, CheckProducer, CheckDiscNum, CheckTrackNum, CheckFormat, CheckUseAnv, CheckYearOnlyDate, CheckReplaceAccentChar
  561. Dim CheckForceNumeric, CheckSidesToDisc, CheckForceDisc, CheckNoDisc, CheckLeadingZero, CheckLeadingZeroDisc, CheckVarious, TxtVarious
  562. Dim CheckTitleFeaturing, CheckComment, CheckFeaturingName, TxtFeaturingName, CheckOriginalDiscogsTrack, CheckSaveImage, CheckLimitReleases
  563. Dim CheckStyleField, CheckTurnOffSubTrack, CheckInvolvedPeopleSingleLine, CheckDontFillEmptyFields, CheckTheBehindArtist, CheckNewMatchingEngine
  564. Dim CheckDiscogsCollectionOff, CheckDeleteDuplicatedEntry, StoreDate, OriginalDateRead, ReleaseDateRead
  565. Dim CheckIgnoreFeatArtist, CheckShowQtyFormat, SubTrackSeparator, trackRefresh, DiffNumberTracks
  566. REM Dim CheckUserCollection
  567. Dim DiscogsUsername, GUID
  568. Dim SubTrackNameSelection
  569. Dim CountryFilterList, MediaTypeFilterList, MediaFormatFilterList, YearFilterList
  570. Dim LyricistKeywords, ConductorKeywords, ProducerKeywords, ComposerKeywords, FeaturingKeywords, UnwantedKeywords
  571.  
  572. Dim SavedReleaseId
  573. Dim NewSearchTerm, NewSearchArtist, NewSearchAlbum, NewSearchTrack
  574. Dim SavedSearchArtist, SavedSearchAlbum
  575. Dim SavedMasterID, SavedArtistID, SavedLabelID
  576.  
  577. Dim FilterMediaType, FilterCountry, FilterYear, FilterMediaFormat, CurrentLoadType
  578. Dim NewGenre, GenresList, GenresSelect
  579. Dim MediaTypeList, MediaFormatList, CountryList, CountryCode, YearList, AlternativeList, LoadList, RelationAttrList
  580. Dim FormatSeparator, ArtistSeparator, ArtistLastSeparator, LimitReleases, Grouping
  581.  
  582. Dim FirstTrack, Errormessage
  583. Dim AlbumArtURL, AlbumArtThumbNail
  584. Dim iMaxTracks
  585. Dim iAutoTrackNumber, iAutoDiscNumber, iAutoDiscFormat
  586. Dim LastDisc
  587. Dim SelectAll
  588. Dim UnselectedTracks(1000)
  589. Dim UnselectedTrackNames(1000)
  590. Dim CheckNewVersion, LastCheck
  591. Dim DiscTrackOrder1()
  592. Dim DiscTrackOrder2()
  593. Dim DiscTrackOrder3()
  594. Dim NewTrackOrder()
  595. Dim NewTrackOrder2()
  596. Dim NewTrackOrder3()
  597.  
  598. Dim ReleaseTag, CountryTag, CatalogTag, FormatTag
  599. Dim OriginalDate, Separator
  600. Dim OptionsChanged, UserAgent
  601. Dim AccessToken, AccessTokenSecret
  602.  
  603. Dim fso, loc, logf
  604.  
  605. REM QueryPage = "Discogs"
  606. REM QueryPage = "MusicBrainz"
  607. REM QueryPage = "MetalArchives"
  608.  
  609. REM SearchFor = 1 = Artist
  610. REM SearchFor = 2 = Album
  611. REM SearchFor = 3 = Release
  612.  
  613. '----------------------------------DiscogsImages----------------------------------------
  614. Dim SaveImageType, SaveImage, CoverStorage, CoverStorageName
  615. Dim FileNameList, ImageTypeList, ImageList, ImageLocal
  616. Dim list
  617. Dim ImagesCount
  618. Dim SaveMoreImages
  619. Dim WebBrowser3
  620. Dim SelectedSongsGlobal
  621.  
  622. Set ImageTypeList = SDB.NewStringList
  623.  
  624. ImageTypeList.Add SDB.Localize("Not specified")     '0
  625. ImageTypeList.Add SDB.Localize("Cover (front)")     '3
  626. ImageTypeList.Add SDB.Localize("Cover (back)")      '4
  627. ImageTypeList.Add SDB.Localize("Leaflet Page")
  628. ImageTypeList.Add SDB.Localize("Media Label")
  629. ImageTypeList.Add SDB.Localize("Lead Artist")
  630. ImageTypeList.Add SDB.Localize("Artist")
  631. ImageTypeList.Add SDB.Localize("Conductor")
  632. ImageTypeList.Add SDB.Localize("Band")
  633. ImageTypeList.Add SDB.Localize("Composer")
  634. ImageTypeList.Add SDB.Localize("Lyricist")
  635. ImageTypeList.Add SDB.Localize("Recording Location")
  636. ImageTypeList.Add SDB.Localize("During Recording")
  637. ImageTypeList.Add SDB.Localize("During Performance")
  638. ImageTypeList.Add SDB.Localize("Video Screen Capture")
  639. ImageTypeList.Add SDB.Localize("Illustration")
  640. ImageTypeList.Add SDB.Localize("Band Logotype")
  641. ImageTypeList.Add SDB.Localize("Publisher Logotype")        '20
  642. '----------------------------------DiscogsImages----------------------------------------
  643.  
  644. ' Easier access of SDB.UI
  645. Set UI = SDB.UI
  646. Dim sTemp
  647. sTemp = SDB.TemporaryFolder
  648.  
  649. ' MediaMonkey calls this method whenever a search is started using this script
  650. Sub 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.  
  1890. End Sub
  1891.  
  1892.  
  1893. Sub 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.  
  2156. End Sub
  2157.  
  2158. Sub 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.  
  2245. End Sub
  2246.  
  2247.  
  2248. Sub 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.  
  2278. End Sub
  2279.  
  2280.  
  2281. Sub 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.  
  2310. End Sub
  2311.  
  2312.  
  2313. Sub 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.  
  2342. End Sub
  2343.  
  2344.  
  2345. 'For reloading results
  2346. Sub 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.  
  4747. End Sub
  4748.  
  4749.  
  4750. Function 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.  
  4800. End Function
  4801.  
  4802.  
  4803. Function 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.  
  4851. End Function
  4852.  
  4853.  
  4854.  
  4855. Function 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.  
  5248. End Function
  5249.  
  5250.  
  5251. Function 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.  
  5328. End Function
  5329.  
  5330. Function 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.  
  5369. End Function
  5370.  
  5371.  
  5372. Function 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.  
  5382. End Function
  5383.  
  5384.  
  5385. Function 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.  
  5404. End Function
  5405.  
  5406.  
  5407. Sub 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.  
  5456. End Sub
  5457.  
  5458. Function 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.  
  5480. End Function
  5481.  
  5482.  
  5483. Sub 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.  
  5511. End 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
  5516. Sub 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.         &n