Returning all urls from a playlist, unless they're already downloaded. Changing all which() calls to contain BIN for clarity.

This commit is contained in:
Roland 2022-06-28 10:09:35 -06:00
parent 01c7f0716b
commit c772b57ddb
No known key found for this signature in database
GPG key ID: 9D6DBD3ACF11AB93
8 changed files with 58 additions and 77 deletions

View file

@ -91,12 +91,12 @@ def split_file_name(path: Path) -> List[str]:
return words
FILE_PATH = which('file', '/usr/bin/file')
FILE_BIN = which('file', '/usr/bin/file')
def get_mimetype(path: Path) -> str:
"""Get the mimetype using the builtin `file` command."""
cmd = (FILE_PATH, '--mime-type', str(path.absolute()))
cmd = (FILE_BIN, '--mime-type', str(path.absolute()))
output = subprocess.check_output(cmd)
output = output.decode()
mimetype = output.split(' ')[-1].strip()