Skip to content

Commit

Permalink
get song details
Browse files Browse the repository at this point in the history
  • Loading branch information
Atemndobs committed Apr 19, 2022
1 parent 4c014fa commit e433bda
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 6 deletions.
Binary file added My_Way.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/ClassifierRequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,3 +159,4 @@ function dd(msg) {
console.log('*+++++++++++++++++++++++++++++++++++++++++++++++++++++++');
return process.exit(0);
}

35 changes: 30 additions & 5 deletions src/app.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class AppService {
let pred = analyzeMp3(checked_path, id)

let originalFile = `./src/audio/${track}`
self.deleteMp3(originalFile)
self.deleteMp3(originalFile, id)

return pred;

Expand Down Expand Up @@ -120,11 +120,11 @@ export class AppService {

}

async deleteMp3(file) {
async deleteMp3(file, id) {

let trackDetails = await createParsedTrack(file)
this.updateSongProperties(trackDetails, id)

console.log({trackDetails})
let rmFile = await fs.unlink(file, (err) => {
if (err) throw err;
});
Expand Down Expand Up @@ -161,8 +161,33 @@ export class AppService {
return rmDir
}

getSongProperties( file : any) : any {
return createParsedTrack(file)
updateSongProperties( file : any, id : bigint) : any {
let data = {
author : file.artist,
image : file.albumArt,
comment : file.extractedTitle

};

// dd(data)

let url = "http://localhost:8899/api/songs/"+id

/* let config = {
method: 'put',
url: url,
headers: {
'accept': 'application/json',
'Content-Type': 'application/json'
},
data: data
};*/

return axios.put(url, {data}).then((res) => {

}).catch((err) => {
console.log(err.message)
})
}
}

Expand Down
1 change: 0 additions & 1 deletion src/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import ffmpeg from 'fluent-ffmpeg'


import * as NodeLame from 'node-lame'
// const Lame = NodeLame.Lame;

import Mp32Wav from 'mp3-to-wav'
import path from 'path'
Expand Down

0 comments on commit e433bda

Please sign in to comment.