From 8776f64eab8901bdc24d43b00f9488ee3c227411 Mon Sep 17 00:00:00 2001 From: Karthik Nishanth Date: Tue, 2 Oct 2018 13:16:51 +0530 Subject: [PATCH] Refactor create_playlist to remove unnecessary branch --- mps_youtube/commands/generate_playlist.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/mps_youtube/commands/generate_playlist.py b/mps_youtube/commands/generate_playlist.py index 8281e6af..5819033d 100644 --- a/mps_youtube/commands/generate_playlist.py +++ b/mps_youtube/commands/generate_playlist.py @@ -49,17 +49,13 @@ def check_sourcefile(filename): return path.isfile(filename) and path.getsize(filename) > 0 -def create_playlist(queries, title=None): +def create_playlist(queries, title=''): """Add a new playlist Create playlist with a random name, get the first match for each title in queries and append it to the playlist """ - plname = None - if (title is not None): - plname=title.replace(" ", "-") - else: - plname=random_plname() + plname = title.replace(" ", "-") or random_plname() if not g.userpl.get(plname): g.userpl[plname] = Playlist(plname) for query in queries: