mirror of
https://github.com/KevinMidboe/spotify-downloader.git
synced 2025-10-29 18:00:15 +00:00
--list flag accepts only text files using mimetypes (#414)
* --list flag accepts only text files using mimetypes * Refactored for consistency * Workaround to make tests pass
This commit is contained in:
committed by
Ritiek Malhotra
parent
be4bb25c96
commit
20b5e44ed4
@@ -5,6 +5,7 @@ from logzero import logger as log
|
||||
import logging
|
||||
import yaml
|
||||
import argparse
|
||||
import mimetypes
|
||||
|
||||
import os
|
||||
import sys
|
||||
@@ -263,6 +264,10 @@ def get_arguments(raw_args=None, to_group=True, to_merge=True):
|
||||
if parsed.config is not None and to_merge:
|
||||
parsed = override_config(parsed.config, parser)
|
||||
|
||||
if to_group and parsed.list and \
|
||||
not mimetypes.MimeTypes().guess_type(parsed.list)[0] == "text/plain":
|
||||
parser.error("{0} is not of a valid argument to --list, argument must be plain text file".format(parsed.list))
|
||||
|
||||
if parsed.write_m3u and not parsed.list:
|
||||
parser.error('--write-m3u can only be used with --list')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user