xray.lua 869 B

1234567891011121314151617181920212223242526272829303132
  1. -- X-Ray Dog
  2. -- WARNING: Untested.
  3. -- Remove all default tags.
  4. tags = {}
  5. tags.artist = 'X-Ray Dog'
  6. -- Albums actually have years, but is it relevent since they have a code?
  7. tags.date = ''
  8. -- Genre could be Soundtrack, or Trailer Music. We choose '' for now.
  9. tags.genre = ''
  10. -- Extract album code, assuming parent folder is 'XRCD## - $album'.
  11. XRCD = output.filename:match('/[^/]*(XRCD\d*)[^/]*/[^/]*$')
  12. -- Append the album code to the constants array, other it will be capitalized.
  13. constants [XRCD:upper()] = XRCD
  14. tags.album = not empty (o.album) and o.album:gsub ('XRCD - (\d+)', 'XRCD$1 - ') or 'Unknown album'
  15. tags.title = o.title
  16. if empty(tags.title) then
  17. tags.title = output.filename:match('[^/]+$'):gsub('\..+$', ''):gsub('X-Ray Dog[\s*?]*', '')
  18. end
  19. tags.track = o.track
  20. if empty(tags.track) then
  21. tags.track = o.title:match('\d+')
  22. end
  23. output.tags = tags