music.zip의 mp3 파일들을 music 폴더에 압축 해제
python -m pip install --upgrade pip
pip install -r requirements.txt
참고: https://wikidocs.net/81041
http://127.0.0.1:5000/
flask run --debug // 에뮬레이터
flask run --host=0.0.0.0 --debug // 외부 접속 허용
GET http://localhost:5000/book?id=1
HTTP/1.1 200 OK
Content-Type: application/json
{
data:
[
{
"cfi": "/6/6!/4/2[pgepubid00003]/4",
"emotion": {"joy": 0.2, "excitement": 0.5, "gratitude": 0.7},
"color": "#0066AA",
"weather": "rain"
},
{
"cfi": "/6/6!/4/2[pgepubid00003]/6",
"emotion": {"joy": 0.2, "excitement": 0.5, "gratitude": 0.7},
"color": "#0066AA",
"weather": "rain"
}
]
}
200: 성공
400: 잘못된 요청
404: 정보 없음 → POST
POST http://localhost:5000/book
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="book"; filename="alice.epub"
< C:/Users/dlals/Downloads/alice.epub
------WebKitFormBoundary7MA4YWxkTrZu0gW--
HTTP/1.1 200 OK
Content-Type: application/json
{
"id": "1"
}
200: 성공 → GET
400: 잘못된 요청
POST http://localhost:5000/music
Content-Type: application/json
{
"cfi": "/6/6!/4/2[pgepubid00003]/4",
"emotion":{ "joy":0.2, "excitement":0.5, "gratitude":0.7 },
"color":"red",
"weather":"rain"
}
HTTP/1.1 200 OK
Content-Type: application/json
{
"id": "1"
}
200: 음악 ID
400: 잘못된 요청
GET http://localhost:5000/music?id=1
→ 음악 스트림
400: 잘못된 요청
404: 파일 없음
GET http://localhost:5000/music_info?id=1
HTTP/1.1 200 OK
Content-Type: application/json
{
"ENG": "The Swan(Le Cygne)",
"KOR": "백조",
"GENRE": "fast swing",
"TEMPO": "빠르게",
"MOOD": "ENERGETIC",
"INSTRUMENT": "콘트라베이스(CONTRABASS)+피아노(PIANO)+드럼(DRUM)"
}
200: 성공
400: 잘못된 요청
404: 파일 없음