From a38a1cbc57230ed55ee3324e252a75492450d18c Mon Sep 17 00:00:00 2001 From: Casey Chu Date: Wed, 24 Dec 2014 02:01:19 -0800 Subject: [PATCH] Prompt for file name if it's missing --- spotify-backup.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/spotify-backup.py b/spotify-backup.py index 5cf672f..406b63e 100644 --- a/spotify-backup.py +++ b/spotify-backup.py @@ -115,9 +115,14 @@ def main(): parser.add_argument('--token', metavar='OAUTH_TOKEN', help='use a Spotify OAuth token (requires the ' + '`playlist-read-private` permission)') parser.add_argument('--format', default='txt', choices=['json', 'txt'], help='output format (default: txt)') - parser.add_argument('file', help='output filename') + parser.add_argument('file', help='output filename', nargs='?') args = parser.parse_args() + # If they didn't give a filename, then just prompt them. (They probably just double-clicked.) + if not args.file: + print "Enter a file name (e.g. playlists.txt):", + args.file = raw_input() + # Log into the Spotify API. if args.token: spotify = SpotifyAPI(args.token)