mirror of
https://github.com/fergalmoran/dss.git
synced 2025-12-22 17:48:51 +00:00
Change to SOX
This commit is contained in:
@@ -4,13 +4,21 @@ import uuid
|
||||
import os
|
||||
from dss import settings
|
||||
|
||||
|
||||
def generate_waveform(input_file, output_file):
|
||||
print "Generating waveform"
|
||||
try:
|
||||
working_file = "%s%s.wav" % (settings.DSS_TEMP_PATH, uuid.uuid1())
|
||||
try:
|
||||
print "Starting decode : %s\nInput File: %s\nOutput File: %s" % (settings.DSS_LAME_PATH, input_file, working_file)
|
||||
p = subprocess.call([settings.DSS_LAME_PATH, "--decode", input_file, working_file])
|
||||
print "Starting decode : %s\nInput File: %s\nOutput File: %s" % \
|
||||
(settings.DSS_LAME_PATH, input_file, working_file)
|
||||
#sox f679a81a-ea14-4385-a677-c663559d1e4b.mp3 -c 1 -t wav -
|
||||
#| /srv/dss/bin/wav2png -w 800 -h 120 -o song.png /dev/stdin
|
||||
convert = subprocess.Popen("%s %s -c 1 -t wav" % (settings.DSS_LAME_PATH, input_file),
|
||||
shell=True, stdout=subprocess.PIPE)
|
||||
|
||||
waveform = subprocess.Popen("%s -w 800 -h 120 -o %s" % (settings.DSS_WAVE_PATH, working_file),
|
||||
shell=True, stdout=subprocess.PIPE)
|
||||
print "Finished decode"
|
||||
if os.path.exists(working_file):
|
||||
print "Starting waveform generation"
|
||||
|
||||
@@ -3,7 +3,7 @@ import os
|
||||
DEBUG = True
|
||||
if os.name == 'posix':
|
||||
DSS_TEMP_PATH = "/tmp/"
|
||||
DSS_LAME_PATH = "lame"
|
||||
DSS_LAME_PATH = "sox"
|
||||
DSS_WAVE_PATH = "wav2png"
|
||||
else:
|
||||
DSS_TEMP_PATH = "d:\\temp\\"
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
import os
|
||||
from django.core.files.storage import FileSystemStorage
|
||||
from django.core.management.base import NoArgsCommand
|
||||
from dss import settings
|
||||
|
||||
from spa.models.mix import Mix
|
||||
from core.tasks import create_waveform_task
|
||||
@@ -17,11 +15,13 @@ class Command(NoArgsCommand):
|
||||
if not os.path.isfile(processed_file):
|
||||
cached_file = mix.get_cache_path()
|
||||
if not os.path.isfile(cached_file):
|
||||
print "File for [%s] not found tried\n\t%s\n\t%s" % (mix.title, processed_file, cached_file)
|
||||
print "File for [%s] not found tried\n\t%s\n\t%s" % \
|
||||
(mix.title, processed_file, cached_file)
|
||||
return
|
||||
|
||||
else:
|
||||
print "File found, starting waveform task (%s)" % mix.uid
|
||||
create_waveform_task.delay(in_file=cached_file, uid=mix.uid)
|
||||
create_waveform_task.delay(
|
||||
in_file=cached_file, uid=mix.uid)
|
||||
print "Task submitted"
|
||||
|
||||
except Exception, ex:
|
||||
|
||||
Reference in New Issue
Block a user