Search code examples
pythoncouchdb

play audio from CouchDB with Python


Task:

  1. connect to CouchDB/my_db_name/doc_id/song_title.mp3

  2. Using Python GUI play this file Steps Done:

  3. with help of CouchDB.view I can: song = db.view('GET http://localhost:5984/music_box/62d7197138e555dac43a73048401f4ac/Busta Rhymes - Dangerous.mp3') and respond of this is: <class 'couchdb.client.ViewResults'>

  4. using PyGame(https://www.pygame.org/docs/ref/music.html) I am able to play .mp3 from a dir.

Question:

how to fetch this mp3 file into a new dir, from where I am able to play it

or maybe do this directly from CouchDB ?

enter image description here


Solution

  • After a while, I was able to store the result as a .mp3 file using the curl command:

    curl -X GET http://localhost:5984/music_box/doc_id/file_name.mp3>~/Documents/test.mp3
    

    and it worked.

    from CouchDB fetch audio file to a local directory