diff --git a/.htaccess~ b/.htaccess~ new file mode 100755 index 00000000..9a9ef505 --- /dev/null +++ b/.htaccess~ @@ -0,0 +1,22 @@ +Options +FollowSymLinks +RewriteEngine on +RewriteBase / +RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] +RewriteRule ^(.*)$ http://%1/$1 [R=301,L] + +#Comment out the two folling lines when running server locally to fix issues with localhost +#RewriteCond %{HTTPS} !=on +#RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L] + + +RewriteRule (?i)^remote/(.*) php/controller.php?id=$1 [L] +RewriteRule (?i)^remote php/controller.php [L] + +RewriteCond %{REQUEST_URI} !(/$|\.) +RewriteRule (.*) %{REQUEST_URI}/ [R=301,L] + +RewriteCond %{REQUEST_FILENAME} !-f +RewriteCond %{REQUEST_FILENAME} !-d +RewriteRule /(.*)$ /$1 [L] + +Options -Indexes diff --git a/static/js/suggestions.js b/static/js/suggestions.js new file mode 100644 index 00000000..7eda9352 --- /dev/null +++ b/static/js/suggestions.js @@ -0,0 +1,57 @@ +var Suggestions = { + + catchUserSuggests: function(suggested){ + + }, + + fetchYoutubeSuggests: function(id){ + + var get_url = "https://www.googleapis.com/youtube/v3/search?part=snippet&relatedToVideoId="+id+"&type=video&key="+api_key; + var video_urls = "https://www.googleapis.com/youtube/v3/videos?part=contentDetails,snippet,id&key="+api_key+"&id="; + + $.ajax({ + type: "GET", + url: get_url, + dataType:"jsonp", + success: function(response) + { + $.each(response.items.slice(0,5), function(i,data){ + video_urls += data.id.videoId+","; + }); + + $.ajax({ + type: "GET", + url: video_urls, + dataType: "jsonp", + success: function(response) + { + $("#suggest-song-html").empty(); + + $.each(response.items, function(i,song) + { + var duration = song.contentDetails.duration; + var secs = Search.durationToSeconds(duration); + var video_id = song.id; + var video_title = song.snippet.title; + var suggest_song = $("