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

Crash when loading release with only zero count tags

XMLWordPrintable

      When loading a release which only contains tags with count zero a division by zero error happens:

      [code]
      Traceback (most recent call last):
      File "./picard/webservice.py", line 299, in _process_reply
      handler(str(reply.readAll()), reply, error)
      File "./picard/coverart/_init_.py", line 113, in _coverart_downloaded
      self.next_in_queue()
      File "./picard/coverart/_init_.py", line 164, in next_in_queue
      self.next_in_queue()
      File "./picard/coverart/_init_.py", line 150, in next_in_queue
      self.next_in_queue()
      File "./picard/coverart/_init_.py", line 154, in next_in_queue
      self.album._finalize_loading(None)
      File "./picard/album.py", line 240, in _finalize_loading
      track = self._finalize_loading_track(track_node, mm, artists, va, absolutetracknumber)
      File "./picard/album.py", line 311, in _finalize_loading_track
      track._customize_metadata()
      File "./picard/track.py", line 153, in _customize_metadata
      self._convert_folksonomy_tags_to_genre()
      File "./picard/track.py", line 178, in _convert_folksonomy_tags_to_genre
      taglist.append((100 * count / maxcount, name))
      ZeroDivisionError: integer division or modulo by zero
      [/code]

      Example release: https://beta.musicbrainz.org/release/1a196112-cbee-4c2d-9956-d7f298161c4e/tags
      (only tag currently is the zero count tag "modern classical" on the RG: https://beta.musicbrainz.org/release-group/e4f4a19e-3e37-4012-81a0-cf781cd12cce/tags

      Before the new tagging system the tags could never get zero, so this issue never happened.

      I have a patch ready to ignore tags with count zero.

            outsidecontext Philipp Wolfer
            outsidecontext Philipp Wolfer
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

                Version Package
                1.4