Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

genre reciept #40

Merged
merged 2 commits into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions receiptifyv1/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,13 +258,7 @@ async function processFile(filePath, sessionID, col) {
});
const users = [];
var newDB = "";
var first = true;
for await (const line of rl) {
if(first){
newDB += line + "\n";
first = false;
continue;
}
const row = line.split(',');
if (row[2] == sessionID) {
users.push(row[col]);
Expand Down Expand Up @@ -297,6 +291,9 @@ app.get('/callback', function (req, res) {
if (req.cookies[sessionIDString] != null){
sessionID = req.cookies[sessionIDString];
}

//res.sendFile(__dirname + '/public/join.html');


var code = req.query.code || null;
var state = req.query.state || null;
Expand Down
22 changes: 19 additions & 3 deletions receiptifyv1/public/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -620,9 +620,18 @@ function getTopGenres(artists) {
genreArr.sort(function (first, second) {
return second.duration_ms - first.duration_ms;
});
let totalTime = 0;
for(let i = 0; i < 10; i++){
console.log("helloe");
totalTime += genreArr[i].duration_ms;
}
for(let i = 0; i < 10; i++){
genreArr[i].duration_ms = genreArr[i].duration_ms * (100 / totalTime);
}
return genreArr.slice(0, 10);
}


const removeTrack = (i) => {
console.log(i);
if (i >= 0 && i < customReceipt.length) {
Expand Down Expand Up @@ -1068,9 +1077,13 @@ function retrieveItems(stats, state) {
const selectedType = type === 'genres' ? 'artists' : type;
const timeRangeSlug = getPeriod();
const limit = num;


let numPerPerson = [];
if ( type === 'artists' || type === 'genres') {



if ( type === 'artists') {
const promises = [];
let combined = [];
if (users_checkbox[0].token == null || users_checkbox[0].user == null) {
Expand Down Expand Up @@ -1121,7 +1134,7 @@ function retrieveItems(stats, state) {
console.error('Errors:', errors); // Handle any errors
});
}

/*
if (type === 'genres') {
$.ajax({
url: `${SPOTIFY_ROOT}/me/top/artists?limit=49&time_range=${timeRangeSlug}`,
Expand All @@ -1146,7 +1159,10 @@ function retrieveItems(stats, state) {
}
},
});
}

//console.log(item);
}*/
//} //else { // shows tracks

if (type === 'tracks'){
const promises = [];
Expand Down
8 changes: 5 additions & 3 deletions receiptifyv1/users.csv
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@

✧ jizzica ✧,BQBgPzh3R_Kro573KV7alDS0O74nCpx4WW8Xgj18Hp1AQE_ijZFkXsAneOIMF08SuHgfc2Ml_KrfykOjZ9Vxw_n8wc1wTwaqEGd358S21EXMo07-4WdlX3EPDyGqWoFQBcerzJ1hIyKBYb5HqH92WyaAi_laxxZSxkWaOTcgxVulWxVly-4XMvaI9VV3KuHt_JIZjbS8ontGZ3G35PDOLiFB6q5TawNbuTsBR48,261818,1713808836632,
✧ jizzica ✧,BQCrWoS_r3XRI3QaFaZ8lu-zR8W5RRxhLTlnNNJSVuYTyyc_LfZ1GfXqznB7iLb2sEhMr2TH28fcFW7R_pwas8147CwjxJcN5DYOdM41Pf2pazAlLUd1sls0trEuThcC9u8mJIb01RvAOFtVJFhHpB-DfCORDUVZykLrwwSs-V_yQ-9uDbo8vdjBlfLZnQo98BVvRvfc1yQOTMPbhqsbzSRW89tciuY-4LF6dW0,261818,1713808847899,


✧ jizzica ✧,BQBgPzh3R_Kro573KV7alDS0O74nCpx4WW8Xgj18Hp1AQE_ijZFkXsAneOIMF08SuHgfc2Ml_KrfykOjZ9Vxw_n8wc1wTwaqEGd358S21EXMo07-4WdlX3EPDyGqWoFQBcerzJ1hIyKBYb5HqH92WyaAi_laxxZSxkWaOTcgxVulWxVly-4XMvaI9VV3KuHt_JIZjbS8ontGZ3G35PDOLiFB6q5TawNbuTsBR48,261818,1713808836632,
✧ jizzica ✧,BQCrWoS_r3XRI3QaFaZ8lu-zR8W5RRxhLTlnNNJSVuYTyyc_LfZ1GfXqznB7iLb2sEhMr2TH28fcFW7R_pwas8147CwjxJcN5DYOdM41Pf2pazAlLUd1sls0trEuThcC9u8mJIb01RvAOFtVJFhHpB-DfCORDUVZykLrwwSs-V_yQ-9uDbo8vdjBlfLZnQo98BVvRvfc1yQOTMPbhqsbzSRW89tciuY-4LF6dW0,261818,1713808847899,

Loading