Uploaded image for project: 'Picard'
  1. Picard
  2. PICARD-240

Save both primary and secondary release types

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: 1.0
    • Fix Version/s: 1.2
    • Component/s: Tags & Metadata
    • Labels:
      None

      Description

      Sorting by release types with tagger scripts doesn't work properly since the introduction of secondary release types in the 2012-05-15 schema change. For example audiobooks should get the release type "other; audiobook" rather than "other".

      I tried to fix this in the following way:

      mbxml.py
      """line 311"""
      def release_group_to_metadata(node, m, config, album=None):
          """Make metadata dict from a XML 'release-group' node taken from inside a 'release' node."""
          if 'type' in node.attribs:
              m['releasetype'] = node.type.lower()
          for name, nodes in node.children.iteritems():
              if not nodes:
                  continue
              if name == 'first_release_date':
                  m['originaldate'] = nodes[0].text
      	"""added these lines"""
      	elif name == 'primary_type':
      	    if m['releasetype'] == '':
      		m['releasetype'] = nodes[0].text.lower()
      	    elif not nodes[0].text.lower() in m['releasetype']:
      		m['releasetype'] = MULTI_VALUED_JOINER.join([nodes[0].text.lower(), m['releasetype']])
      	elif name == 'secondary_type_list':
      	    secondary_str = add_release_types(nodes[0], m)
      	    if m['releasetype'] == '':
      		m['releasetype'] = secondary_str
      	    elif secondary_str != '':
      	    	m['releasetype'] = MULTI_VALUED_JOINER.join([m['releasetype'], secondary_str])
      	"""up to here"""
              elif name == 'tag_list':
                  add_folksonomy_tags(nodes[0], album)
              elif name == 'user_tag_list':
                  add_user_folksonomy_tags(nodes[0], album)
      
      
      """added this function"""
      def add_release_types(node, m):
          secondary_list = []
          for name, nodes in node.children.iteritems():
      	if not nodes:
      	    continue
      	if name == 'secondary_type' and not nodes[0].text.lower() in m['releasetype']:
      	    secondary_list.append(nodes[0].text.lower())
          return MULTI_VALUED_JOINER.join(secondary_list)
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                bitmap Michael Wiencek
                Reporter:
                carstenl carstenl
              • Votes:
                3 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: