Advertisement
Guest User

Untitled

a guest
May 13th, 2015
484
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.13 KB | None | 0 0
  1. Alpha prototype of foo_discogs 2.0.
  2.  
  3. Warning: this version is not complete or thoroughly tested. It is not meant to replace the existing public version of foo_discogs. This is a preview release so that "hardcore taggers" who are interested can provide feedback early on and get their request included before the public version.
  4.  
  5. Changes:
  6. - New "edit tag mappings" dialog.
  7. - Tag mappings are now defined by tag formatting strings that can be configured by the user. This allows you to add new tags and gives very fine control over how the tag values are written.
  8. - Writing tags is now async.
  9. - Network traffic can now occur in the "write tags" phase, when necessary to load data required by a tag formatting string. (In the past, all network loading was done in a separate step, but that is no longer possible.)
  10. - Better error reporting.
  11. - New fields such as series, barcode, master release year, etc have been added.
  12. - Updating tags made more reliable, but not backwards compatible.
  13. - Compilation checkmark has (tentatively) been removed. (I'd like to replace it with a better detection of compilations including a config option if necessary).
  14. - Keyboard controls (Del, Cntl+Up, Cntl+Down) added to release dialog track lists.
  15.  
  16.  
  17. *** New "edit tag mappings" dialog. ***
  18.  
  19. The new tag formatting strings are defined via this dialog.
  20.  
  21. Note: the default tags defined may changed. They are currently modeled after the tags available in traditional versions of foo_discogs.
  22.  
  23.  
  24. *** Tag formatting strings ***
  25.  
  26. Tag formatting strings are an extension of foobar2000 titleformatting strings that support multiple-values. At the core of these strings are variables which contain information from Discogs. These variables are transformed via functions to form the final result(s) to be written to a tag. The final result can either be an array (for a multiple-value tag), or a single string value.
  27.  
  28. Some variables exposed from the Discogs database can have multiple values. For example, a release can have multiple artist names. These variables should be written as %<VARIABLE>% to use them as an array. If the triangular braces are omitted, they will be joined into a string separated by commas, giving the same result as $join(%<VARIABLE>%).
  29.  
  30. Using built-in titleformatting functions on arrays is not supported. It will likely result in corrupt strings or unexpected behavior because the built-in functions only work on strings. foo_discogs has to re-define any functions that we want to work on arrays (with a "multi_" prefix before their name). Only a couple have been done so far, but others will be added.
  31.  
  32.  
  33. *** Tag formatting variables ***
  34.  
  35. The data variables at the core of tag formatting strings come from 5 roots:
  36. RELEASE_*
  37. DISC_*
  38. TRACK_* (matched track from the Discogs tracklist)
  39. ARTISTS_* (artist(s) for the track, if applicable, otherwise for the artist(s) for the release)
  40. MASTER_RELEASE_* - (if applicable)
  41.  
  42. Each root exposes a list of fields that can be used.
  43.  
  44. RELEASE_:
  45. ID
  46. TITLE
  47. COUNTRY
  48. DATE
  49. DATE_RAW
  50. YEAR
  51. MONTH
  52. DAY
  53. NOTES
  54. BARCODE
  55. WEIGHT
  56. TOTAL_DISCS
  57. TOTAL_TRACKS
  58. DISCOGS_USERS_HAVE
  59. DISCOGS_USERS_WANT
  60. DISCOGS_AVG_RATING
  61. DISCOGS_RATING_VOTES
  62. DISCOGS_STATUS
  63. DISCOGS_DATA_QUALITY
  64. DISCOGS_SUBMITTED_BY
  65. DISCOGS_TRACKLIST_COUNT
  66. DISCOGS_TOTAL_DISCS
  67. <GENRES>
  68. <STYLES>
  69. <VIDEOS>
  70.  
  71. DISC_:
  72. NUMBER
  73. TOTAL_TRACKS
  74.  
  75. TRACK_:
  76. NUMBER
  77. DISC_TRACK_NUMBER (similar to NUMBER, but starts at 1 for each disc)
  78. DISCOGS_TRACK_NUMBER (original track position in Discogs tracklist. not necessarily a number)
  79. DISCOGS_TRACKLIST_INDEX (used internally for update tags)
  80. TITLE
  81. HEADING
  82. INDEXTRACK_TITLE
  83. SUBTRACK_TITLE
  84. DISCOGS_DURATION_RAW
  85. DISCOGS_DURATION_SECONDS
  86.  
  87. ARTIST_: (ARTISTS_ wraps these an array)
  88. ID
  89. NAME
  90. NAME_VARIATION (name variation used in this track/release)
  91. JOIN ("join" field for multiple artists)
  92. PROFILE
  93. REAL_NAME
  94. <URLS>
  95. <ALIASES>
  96. <ALL_NAME_VARIATIONS>
  97. <MEMBERS>
  98.  
  99. MASTER_RELEASE_:
  100. ID
  101. TITLE
  102. YEAR
  103. MAIN_RELEASE_ID
  104. MAIN_RELEASE_URL
  105. MAIN_RELEASE_API_URL
  106. DISCOGS_DATA_QUALITY
  107. DISCOGS_TRACKLIST_COUNT (used internally for update tags)
  108. <GENRES>
  109. <STYLES>
  110. <VIDEOS>
  111.  
  112. Each of the 5 roots, excluding ARTISTS_*, also expose branches. Branches reference another object or, almost always, array of objects. (Therefore, branches usually return an array and sometimes a multi-dimensional array.) Here are the branches available:
  113.  
  114. RELEASE_:
  115. <TRACKS_*>
  116. <DISCS_*>
  117. <ARTISTS_*>
  118. <LABELS_*>
  119. <SERIES_*>
  120. <FORMATS_*>
  121. <CREDITS_*>
  122.  
  123. DISC_:
  124. <TRACKS_*>
  125. <FORMAT_*>
  126.  
  127. TRACK_:
  128. <ARTISTS_*>
  129. <CREDITS_*>
  130. <HIDDEN_TRACKS_*>
  131.  
  132. MASTER_RELEASE_:
  133. <TRACKS_*>
  134. <DISCS_*>
  135. <ARTISTS_*>
  136.  
  137. Finally, here are the fields exposed from some of the objects that aren't root objects, but only available via branches:
  138.  
  139. LABEL_:
  140. ID
  141. NAME
  142. CATALOG_NUMBER
  143.  
  144. SERIES_:
  145. ID
  146. NAME
  147. CATALOG_NUMBER
  148. NUMBER
  149. API_URL
  150.  
  151. FORMAT_:
  152. QUANTITY
  153. NAME
  154. <DESCRIPTIONS>
  155.  
  156. CREDIT:
  157. ROLES_RAW
  158. <ROLES>
  159. <ARTISTS_*>
  160.  
  161.  
  162. These field names aren't carved in stone and more may be added later. Most of this closely follows the information exposed via the Discogs API.
  163.  
  164.  
  165. *** Tag formatting functions ***
  166.  
  167. The following custom functions defined and available for tag formatting strings:
  168.  
  169. $join(A) - Joins array A with depth N with ", " separator. Returns an array of depth N-1 where the highest dimension is joined into a string, or a string if N=1.
  170. $join(A,B) - Joins array A of depth N with B array or string separator(s). If B is an array, it must have the same depth as A, but can be 1 shorter in width in its highest dimension. Returns an array of depth N-1 where the highest dimension is joined into a string, or a string if N=1.
  171. $zip(A,B,...) - Zips arrays array A with any number of other arrays or strings. Other arrays must have the same dimensions as A. Returns an array with the same dimensions as A.
  172. $split(s,x) - Splits string s into an array using delimiter x. Returns a 1-dimensional array.
  173. $unique(A) - Filters non-unique values out of array A in the first dimension. Returns an array of the same depth as A, but possibly shorter in the first dimension.
  174. //$append(A,B,...) - Appends any number of elements to array A with depth N. Elements must have depth N-1, where depth 0 is a string. Returns array of depth N, but wider than A in the first dimension.
  175. //$extend(A,B,...) - Appends contents of any number of other arrays to array A with depth N. Other arrays must also have depth N. Returns array of depth N, but wider than A in the first dimension.
  176. $multi_first(A) - Where A is an array with depth N, returns first item from A in the first dimension (depth N-1).
  177. $multi_last(A) - Where A is an array with depth N, returns last item from A in the first dimension(depth N-1).
  178. $multi_get(A,N) - Where A is an array with depth N, returns Nth item from A in the first dimension(depth N-1).
  179. //$multi_length(A) - Where A is an array with depth N, returns an array of depth N-1 composed of the widths of elements in the last dimension. For a 1-dimensional array, this is a simple string with the length.
  180. $multi_create(X,N) - Returns a 1-dimensional array composed of value X repeated N times.
  181. $multi_replace(A,B,C) - Replaces all occurrences of B in A with C, where each of B and C are either a string or an array of the same dimensions as A. Returns an array of the same dimensions as A.
  182. $multi_strcmp(A,B) - Compares B with A, where B is either a string or an array of the same dimensions as A. Returns a boolean array of the same dimensions as A.
  183. $multi_strstr(A,B) - Finds B in A, where B is either a string or an array of the same dimensions as A. Returns a boolean array of the same dimensions as A.
  184. $multi_trim(A) - Trims whitespace from elements in array A. Returns an array of the same dimensions as A.
  185. $multi_pad(A,B) - Pads elements in array A with B on both sides, where B is either a string or an array of the same dimensions as A. Returns an array of the same dimensions as A.
  186. $multi_any(A) - Where A is an array with depth N, returns a boolean array with depth N-1 indicating whether "any" values exist in the top dimension of A.
  187. $multi_if(A,B,C) - Returns an array of the same dimensions as A, composed of values B where A was true and C where A was false.
  188. $multi_or(A, B) - Returns a boolean array of the same dimensions as A, where either A or B is true.
  189. $multi_not(A) - Returns a boolean array of the same dimensions as A, with value false where A was true and vice versa.
  190.  
  191. Note: You will get an error popup if these functions are used incorrectly (or, perhaps, if you discover a bug).
  192.  
  193.  
  194. *** Special default tags ***
  195.  
  196. Some of the default tags are greyed out and can't be disabled or edited. These are tags that have a special purpose within foo_discogs. If these tags are disabled or missing, some extra features provided by foo_discogs may not work.
  197.  
  198. DISCOGS_RELEASE_ID - Used to streamline the "find release" dialog when writing tags. Used to update tags. Used to open the release page in browser.
  199. DISCOGS_MASTER_RELEASE_ID - Used to open the master release page in browser.
  200. DISCOGS_ARTIST_ID - Used to update artist art. Used to open the artist page in browser.
  201. DISCOGS_LABEL_ID - Used to open the label page in browser.
  202. DISCOGS_TRACKLIST_INDEX - New! Used when updating tags to match tracks to the Discogs release with greater accuracy.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement