File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -322,10 +322,22 @@ def get_new_lyrics(artist, title):
322322 return
323323 for i , line in enumerate (lyr .lt ):
324324 m = re .match (r"\[(.*)\](.*)" , line )
325+ if not m :
326+ continue
327+ # convert time from min:sec into sec
325328 timing = m .group (1 )
326329 timing2 = timing .split (":" )
327- assert len (timing2 ) == 2
330+ if len (timing2 ) != 2 :
331+ logger .debug (f"ERROR: timing2={ timing2 } is not of length 2" )
332+ continue
333+ if not timing2 [0 ].isnumeric ():
334+ logger .debug (f"ERROR: timing2[0]={ timing2 [0 ]} is not numeric" )
335+ continue
336+ if not timing2 [1 ].isnumeric ():
337+ logger .debug (f"ERROR: timing2[1]={ timing2 [1 ]} is not numeric" )
338+ continue
328339 secs = int (timing2 [0 ]) * 60.0 + float (timing2 [1 ])
340+ # get lyrics text
329341 text = m .group (2 ).strip ()
330342 if text == "" :
331343 text = "[INTERMISSION]"
You can’t perform that action at this time.
0 commit comments