-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
193 additions
and
193 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,4 @@ | |
background-repeat: no-repeat; | ||
background-attachment: fixed; | ||
background-position: center center; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -88,4 +88,4 @@ export default function Banner({ loggedIn = false, onSelect = f => f }) { | |
</Navbar> | ||
</> | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,4 @@ | |
width: 100%; | ||
text-align: center; | ||
opacity: 0.7 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,4 +58,4 @@ export default function Footer() { | |
</Row> | ||
</> | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,25 @@ | ||
export default async function GeneratePlaylist(playlist, size = 10, creativity = 0.5, noise = 0) { | ||
try { | ||
const waypoints = playlist.track_ids | ||
const response = await fetch(process.env.REACT_APP_API_URL + '/playlist', { | ||
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/json' | ||
}, | ||
body: JSON.stringify({ | ||
'track_ids': waypoints, | ||
'size': size, | ||
'creativity': creativity, | ||
'noise': noise | ||
}) | ||
}); | ||
const json = await response.json(); | ||
const new_playlist = { | ||
'name': 'Deej-A.I.', | ||
'track_ids': json.track_ids, | ||
'tracks': json.tracks, | ||
'waypoints': waypoints, | ||
'av_rating': 0, | ||
'num_ratings': 0 | ||
}; | ||
return new_playlist; | ||
} catch (error) { | ||
console.error('Error:', error); | ||
const waypoints = playlist.track_ids | ||
const response = await fetch(process.env.REACT_APP_API_URL + '/playlist', { | ||
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/json' | ||
}, | ||
body: JSON.stringify({ | ||
'track_ids': waypoints, | ||
'size': size, | ||
'creativity': creativity, | ||
'noise': noise | ||
}) | ||
}); | ||
const json = await response.json(); | ||
const new_playlist = { | ||
'name': 'Deej-A.I.', | ||
'track_ids': json.track_ids, | ||
'tracks': json.tracks, | ||
'waypoints': waypoints, | ||
'av_rating': 0, | ||
'num_ratings': 0 | ||
}; | ||
} | ||
return new_playlist; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,75 +1,59 @@ | ||
export default async function SavePlaylist(playlist) { | ||
const now = new Date(); | ||
|
||
try { | ||
const response = await fetch(process.env.REACT_APP_API_URL + '/create_playlist', { | ||
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/json' | ||
}, | ||
body: JSON.stringify({ | ||
'created': now.toISOString(), | ||
'track_ids': JSON.stringify(playlist.track_ids), | ||
'tracks': JSON.stringify(playlist.tracks), | ||
'waypoints': JSON.stringify(playlist.waypoints) | ||
}) | ||
}); | ||
const db_item = await response.json(); | ||
return db_item.id; | ||
} catch (error) { | ||
console.error('Error:', error); | ||
}; | ||
const response = await fetch(process.env.REACT_APP_API_URL + '/create_playlist', { | ||
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/json' | ||
}, | ||
body: JSON.stringify({ | ||
'created': now.toISOString(), | ||
'track_ids': JSON.stringify(playlist.track_ids), | ||
'tracks': JSON.stringify(playlist.tracks), | ||
'waypoints': JSON.stringify(playlist.waypoints) | ||
}) | ||
}); | ||
const db_item = await response.json(); | ||
return db_item.id; | ||
} | ||
|
||
export async function UpdatePlaylistName(id, name) { | ||
try { | ||
fetch(process.env.REACT_APP_API_URL + '/update_playlist_name', { | ||
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/json' | ||
}, | ||
body: JSON.stringify({ | ||
'id': id, | ||
'name': name | ||
}) | ||
}); | ||
} catch (error) { | ||
console.error('Error:', error); | ||
}; | ||
fetch(process.env.REACT_APP_API_URL + '/update_playlist_name', { | ||
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/json' | ||
}, | ||
body: JSON.stringify({ | ||
'id': id, | ||
'name': name | ||
}) | ||
}); | ||
} | ||
|
||
export async function UpdatePlaylistRating(id, av_rating, num_ratings) { | ||
try { | ||
fetch(process.env.REACT_APP_API_URL + '/update_playlist_rating', { | ||
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/json' | ||
}, | ||
body: JSON.stringify({ | ||
'id': id, | ||
'av_rating': av_rating, | ||
'num_ratings': num_ratings | ||
}) | ||
}); | ||
} catch (error) { | ||
console.error('Error:', error); | ||
}; | ||
fetch(process.env.REACT_APP_API_URL + '/update_playlist_rating', { | ||
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/json' | ||
}, | ||
body: JSON.stringify({ | ||
'id': id, | ||
'av_rating': av_rating, | ||
'num_ratings': num_ratings | ||
}) | ||
}); | ||
} | ||
|
||
export async function UpdatePlaylistId(id, user_id, playlist_id) { | ||
try { | ||
fetch(process.env.REACT_APP_API_URL + '/update_playlist_id', { | ||
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/json' | ||
}, | ||
body: JSON.stringify({ | ||
'id': id, | ||
'user_id': user_id, | ||
'playlist_id': playlist_id | ||
}) | ||
}); | ||
} catch (error) { | ||
console.error('Error:', error); | ||
}; | ||
} | ||
fetch(process.env.REACT_APP_API_URL + '/update_playlist_id', { | ||
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/json' | ||
}, | ||
body: JSON.stringify({ | ||
'id': id, | ||
'user_id': user_id, | ||
'playlist_id': playlist_id | ||
}) | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -72,4 +72,4 @@ export default function Settings({ size, creativity, noise, onChange = f => f, o | |
<Footer /> | ||
</> | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.