Exception when reading SYLT tag with newline

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: Normal
    • 3.0.0b7
    • Affects Version/s: 3.0.0b5
    • Component/s: Tags & Metadata
    • None

      When reading SYLT tags and the SYLT tag contains an entry that consists only of a single newline the below exception is thrown:

      E: 23:32:16,838 util/thread.run:100: Traceback (most recent call last):
        File "/home/phw/devel/musicbrainz/picard/picard/util/thread.py", line 97, in run
          result = self.func()
        File "/home/phw/devel/musicbrainz/picard/picard/file.py", line 360, in _load_check
          return self._load(filename)
                 ~~~~~~~~~~^^^^^^^^^^
        File "/home/phw/devel/musicbrainz/picard/picard/formats/id3.py", line 316, in _load
          self._process_frame(frame, metadata, config_params)
          ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/home/phw/devel/musicbrainz/picard/picard/formats/id3.py", line 331, in _process_frame
          processor(frame, metadata, config_params)
          ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/home/phw/devel/musicbrainz/picard/picard/formats/id3.py", line 473, in _load_sylt_frame
          lrc_lyrics = self._parse_sylt_text(frame.text, config_params['file_length'])
        File "/home/phw/devel/musicbrainz/picard/picard/formats/id3.py", line 696, in _parse_sylt_text
          distribution = (milliseconds[i + 1] - milliseconds[i]) / len(lyrics.replace('\n', ''))
                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      ZeroDivisionError: division by zero
       

      The affected file contained this lyrics snippet

       

      [
          (' And the feeding hand\n', 54940),
          ('\n', 60000),
          (' Tell me how much\n', 119680),
      ]

       

            Assignee:
            Philipp Wolfer
            Reporter:
            Philipp Wolfer
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:

                Version Package
                3.0.0b7