Fixed some waveform/cdn stuff

This commit is contained in:
Fergal Moran
2015-07-29 16:48:31 +01:00
parent 4d3353e396
commit 671ec9bf3d
5 changed files with 33 additions and 22 deletions

View File

@@ -15,31 +15,27 @@ from dss import settings
@task(time_limit=3600)
def create_waveform_task(in_file, uid):
out_file = os.path.join(settings.MEDIA_ROOT, 'waveforms/%s.png' % uid)
out_file = os.path.join(settings.CACHE_ROOT, 'waveforms/%s.png' % uid)
print "Creating waveform \n\tIn: %s\n\tOut: %s" % (in_file, out_file)
generate_waveform(in_file, out_file)
if os.path.isfile(out_file):
print "Waveform generated successfully"
out_file, extension = os.path.splitext(in_file)
new_file = os.path.join(settings.MEDIA_ROOT, "mixes", "%s%s" % (uid, extension))
print "Moving cache audio clip from %s to %s" % (in_file, new_file)
shutil.move(in_file, new_file)
print "Uid: %s" % uid
waveform_generated_signal.send(sender=None, uid=uid)
return new_file
return out_file
else:
print "Outfile is missing"
@task(time_limit=3600)
def archive_mix_task(in_file, filetype, uid):
@task(timse_limit=3600)
def upload_to_cdn_task(in_file, filetype, uid, container_name):
source_file = os.path.join(settings.CACHE_ROOT, '{0}/{1}.{2}'.format(container_name, uid, filetype))
print "Sending {0} to azure".format(uid)
try:
upload_to_azure(in_file, filetype, uid)
upload_to_azure(source_file, filetype, uid, container_name)
return source_file
except Exception, ex:
print "Unable to upload: {0}".format(ex.message)
@task
def update_geo_info_task(ip_address, profile_id):
try: