Rename the calculate_checksums function

parent 94d001f9
Pipeline #8259857 failed with stage
in 45 seconds
......@@ -4,4 +4,4 @@ __author__ = 'Stavros Korokithakis'
__email__ = 'hi@stavros.io'
__version__ = '0.0.5'
from .functions import look_up_track, read_pls, write_upl # noqa
from .functions import look_up_track, read_pls, write_upl, calculate_checksums # noqa
......@@ -10,7 +10,7 @@ except ImportError:
import mutagen
def _calculate_checksums(filename):
def calculate_checksums(filename):
"""Calculate checksums for a given filename."""
algs = {
"md5": hashlib.md5(),
......@@ -50,7 +50,7 @@ def _get_tag_value(tags, keys):
return "Unknown"
def look_up_track(filename):
def look_up_track(filename, checksums=True):
"""Look up a track and return a UPL-compatible dict of information."""
if not os.path.exists(filename):
# Preserve files we can't find.
......@@ -61,7 +61,9 @@ def look_up_track(filename):
}
tags = mutagen.File(filename)
ids = _calculate_checksums(filename)
ids = {}
if checksums:
ids.update(calculate_checksums(filename))
ids["filepath"] = filename
info = (
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment