Skip to content
Snippets Groups Projects
Commit d237117e authored by Anton Sarukhanov's avatar Anton Sarukhanov
Browse files

Use proper filenames

parent 368f3d4e
No related branches found
No related tags found
No related merge requests found
Pipeline #48 passed with stage
in 2 minutes and 9 seconds
...@@ -37,10 +37,9 @@ class DpsoundsAdapter(BaseAdapter): ...@@ -37,10 +37,9 @@ class DpsoundsAdapter(BaseAdapter):
if r['Title']: if r['Title']:
name += " - {}".format(r['Title']) name += " - {}".format(r['Title'])
r['Tags'] = ','.join([t.strip() for t in r['Tags'].split(',')]) r['Tags'] = ','.join([t.strip() for t in r['Tags'].split(',')])
file_url = "{url_base}/{part}-{track:02d}.mp3".format( file_url = "{url_base}/{track}.mp3".format(
url_base=DP_TRACK_URL_BASE, url_base=DP_TRACK_URL_BASE,
part=r['Source Part'], track=r['Track'])
track=int(r['Source Track']))
filehash = hashlib.md5(file_url.encode('utf-8')).hexdigest() filehash = hashlib.md5(file_url.encode('utf-8')).hexdigest()
files = {filehash: {'name': name, 'file': file_url}} files = {filehash: {'name': name, 'file': file_url}}
# TODO: alternative takes # TODO: alternative takes
...@@ -55,10 +54,9 @@ class DpsoundsAdapter(BaseAdapter): ...@@ -55,10 +54,9 @@ class DpsoundsAdapter(BaseAdapter):
} for idx, attr in enumerate(DP_TRACK_ATTRIBUTES)] } for idx, attr in enumerate(DP_TRACK_ATTRIBUTES)]
sample = [{ sample = [{
'name': name, 'name': name,
'path': "{url_base}/sample-{part}-{track:02d}.mp3".format( 'path': "{url_base}/sample-{track}.mp3".format(
url_base=DP_SAMPLE_URL_BASE, url_base=DP_SAMPLE_URL_BASE,
part=r['Source Part'], track=r['Track'])
track=int(r['Source Track']))
}] }]
custom_fields = { custom_fields = {
'_jplayer_sample_file': [ '_jplayer_sample_file': [
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment