diff --git a/mps_youtube/history.py b/mps_youtube/history.py index 88eed094..83c14a3e 100644 --- a/mps_youtube/history.py +++ b/mps_youtube/history.py @@ -28,8 +28,6 @@ def load(): if not os.path.isfile(g.HISTFILE): g.userhist = {} save() - except ValueError as ex: - dbg(c.r + str(ex) + c.w) def save(): diff --git a/mps_youtube/playlists.py b/mps_youtube/playlists.py index d09c591d..57b93292 100644 --- a/mps_youtube/playlists.py +++ b/mps_youtube/playlists.py @@ -69,10 +69,12 @@ def read_m3u(m3u): duration, title = line.replace('#EXTINF:', '').strip().split(',', 1) expect_ytid = True elif not line.startswith('\n') and not line.startswith('#') and expect_ytid: - ytid = pafy.extract_video_id(line).strip() - songs.append(Video(ytid, title, int(duration))) - expect_ytid = False - + try: + expect_ytid = False + ytid = pafy.extract_video_id(line).strip() + songs.append(Video(ytid, title, int(duration))) + except ValueError as ex: + util.dbg(c.r + str(ex) + c.w) # Handles a simple m3u file which should just be a list of urls else: plf.seek(0)