Skip to content

Commit

Permalink
Minor cosmetic change to song list, and expand compatibility for host…
Browse files Browse the repository at this point in the history
… matching regex
  • Loading branch information
ironman5366 committed Apr 22, 2019
1 parent 320ecab commit 0848813
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
2 changes: 2 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ <h1>Currently On</h1>
<div class="col-md-12">
<div class="row">
<h1>Songs</h1>
</div>
<div class="row">
<div id="songs">
</div>
<div>
Expand Down
18 changes: 13 additions & 5 deletions page.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const spotify_api = require('./spotify_api.json');
// The RegEx to resolve student images from the directory
const DIR_REG = new RegExp('(<div class="email"><span class="icon">' +
'\\n{0,1}<\\/span>(\\w+)&nbsp;)|<span class="icon"><\\/span><a href="mailto:(\\w+)@carleton.edu">');
const HOST_REG = new RegExp('(\\S+) (\\S+ ){0,1}(\\S+) \'(\\d\\d)');
const HOST_REG = new RegExp('(\\S+) ([^\\s\\d]+ )+(\'(\\d\\d)?|)|(\\S+) (\\S+)');
let curr_songs = [];
let spotify_auth = null;
let song_queries = {
Expand All @@ -26,10 +26,18 @@ let auth_missed = 0;
*/
function get_host_widget(host_str){
let parsed_host_str = HOST_REG.exec(host_str);
console.log("Parsed");
let first_name = parsed_host_str[1];
let last_name = parsed_host_str[3];
let class_year = "20"+parsed_host_str[3];
let first_name = null;
let last_name = null;
let class_year = null;
try{
first_name = parsed_host_str[1];
last_name = parsed_host_str[2];
class_year = "20"+parsed_host_str[3];
}
catch (error) {
first_name = parsed_host_str[5];
last_name = parsed_host_str[6];
}
let username= null;
let data = $.get({
url: 'https://apps.carleton.edu/campus/directory/?first_name='+first_name+'&last_name='+last_name+'' +
Expand Down

0 comments on commit 0848813

Please sign in to comment.