sergree / matchering

🎚️ Open Source Audio Matching and Mastering
https://pypi.org/project/matchering/
GNU General Public License v3.0
1.33k stars 156 forks source link

CAN'T SAVE TO A DIFFERENT FOLDER in DJANGO #8

Closed GoodnessEzeokafor closed 4 years ago

GoodnessEzeokafor commented 4 years ago
Request Method: GET

http://127.0.0.1:8000/dashboard/track/8/master 3.0.2 RuntimeError Error opening './media/goody/mastered/my_song_master_16bit.wav': System error. /home/goodness/.local/share/virtualenvs/MeshakProj--GI6wqXg/lib/python3.6/site-packages/soundfile.py in _error_check, line 1357 /home/goodness/.local/share/virtualenvs/MeshakProj--GI6wqXg/bin/python 3.6.9 ['/home/goodness/Documents/django_dev/MeshakProj', '/home/goodness/.local/share/virtualenvs/MeshakProj--GI6wqXg/lib/python36.zip', '/home/goodness/.local/share/virtualenvs/MeshakProj--GI6wqXg/lib/python3.6', '/home/goodness/.local/share/virtualenvs/MeshakProj--GI6wqXg/lib/python3.6/lib-dynload', '/usr/lib/python3.6', '/home/goodness/.local/share/virtualenvs/MeshakProj--GI6wqXg/lib/python3.6/site-packages'] Thu, 30 Jan 2020 10:52:20 +0100

GoodnessEzeokafor commented 4 years ago

def master(request,pk): track = get_object_or_404(Mastering, pk=pk) print("TARGET TRACK PATH:",track.target_track.path) print("TARGET REFERENCE PATH:",track.reference_track.path) mastered = mg.process( target=track.target_track.path, reference=track.reference_track.path, results=[

mg.pcm16('my_song_master_16bit.wav'),

        # mg.pcm24('my_song_master_24bit.wav')
        mg.pcm16(f'{settings.MEDIA_URL}{track.user.username}/mastered/my_song_master_16bit.wav'),
        mg.pcm24(f'{settings.MEDIA_URL}{track.user.username}/mastered/my_song_master_24bit.wav'),
    ],
)

return HttpResponse("MASTER")
sergree commented 4 years ago

https://github.com/bastibe/SoundFile/issues/227

It seems PySoundFile can't write to this directory.

GoodnessEzeokafor commented 4 years ago

Sory Doesn't the result argument creates and writes to the directory????

sergree commented 4 years ago

Here's how PySoundFile library works. https://pysoundfile.readthedocs.io/en/latest/#soundfile.write It doesn't create a directory if it doesn't exist and have no args to change this behaviour. Your app need to prepare these dirs on its own.

GoodnessEzeokafor commented 4 years ago

ok thanks alot will definetely try this

GoodnessEzeokafor commented 4 years ago

@sergree any script on how to download the mastered tracks in django ?????

sergree commented 4 years ago

Soon, this month

GoodnessEzeokafor commented 4 years ago

lols, i did a little hack just added the file path to my context context = { 'mastered1':f'/media/mastered/{track.user.id}/{track.name_of_track}/my_song_master_16bit.wav', 'mastered2':f'/media/mastered/{track.user.id}/{track.name_of_track}/my_song_master_24bit.wav' } in my html file `

Download Mastered Track 1

Download Mastered Track 2

      `