Skip to content

Commit

Permalink
Refactor create_playlist to remove unnecessary branch
Browse files Browse the repository at this point in the history
  • Loading branch information
nishanthkarthik committed Oct 2, 2018
1 parent ed812e7 commit 8776f64
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions mps_youtube/commands/generate_playlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 8776f64

Please sign in to comment.