Merge branch 'dev' of https://github.com/nixolas1/Zoff into dev

This commit is contained in:
Kasper Rynning-Tønnesen
2015-04-30 17:07:27 +02:00
5 changed files with 32 additions and 5 deletions

View File

@@ -1,12 +1,10 @@
<?php <?php
$guid=substr(base64_encode(crc32($_SERVER['HTTP_USER_AGENT'].$_SERVER['REMOTE_ADDR'].$_SERVER['HTTP_ACCEPT_LANGUAGE'])), 0, 8); $guid=substr(base64_encode(crc32($_SERVER['HTTP_USER_AGENT'].$_SERVER['REMOTE_ADDR'].$_SERVER['HTTP_ACCEPT_LANGUAGE'])), 0, 8);
if(isset($_GET['chan'])) {header('Location: '.$_GET['chan']); exit;} if(isset($_GET['chan'])) {header('Location: '.$_GET['chan']); exit;}
$list = explode("/", htmlspecialchars(strtolower($_SERVER["REQUEST_URI"]))); $list = explode("/", htmlspecialchars(strtolower($_SERVER["REQUEST_URI"])));
if($list[1]==""||!isset($list[1])||count($list)<=1){$list="";include('php/nochan.php');die();} if($list[1]==""||!isset($list[1])||count($list)<=1){$list="";include('php/nochan.php');die();}
else $list=$list[1]; else $list=$list[1];
?> ?>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://ogp.me/ns/fb#"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://ogp.me/ns/fb#">
<head> <head>

View File

@@ -124,6 +124,32 @@ function skip(){
return true; return true;
} }
function importOldList(chan){
playlist_url = "lists/"+chan+".json";
list = $.ajax({
type: "GET",
url: playlist_url,
async: false
}).responseText;
list = $.parseJSON(list);
var ids="";
var num=0;
$.each(list.songs, function(i,data)
{
ids+=data.id+",";
if(num>45){
addVideos(ids);
ids="";
num=0;
}
num++;
});
addVideos(ids);
document.getElementById("search").value = "";
}
function refresh_scroll() function refresh_scroll()
{ {
myScroll.refresh(); myScroll.refresh();

View File

@@ -14,10 +14,9 @@ function getCookie(cname) {
function populate_channels(lists) function populate_channels(lists)
{ {
var output = ""; var output = "";
var num = 0;
lists.sort(sortFunction); lists.sort(sortFunction);
pre_card = $(list_html); pre_card = $(list_html);
for(x in lists) for(x in lists)
@@ -45,6 +44,8 @@ function populate_channels(lists)
console.log(chan); console.log(chan);
output+="<option value='"+chan+"'> "; output+="<option value='"+chan+"'> ";
num++;
if(num>19)break;
} }
document.getElementById("searches").innerHTML = output; document.getElementById("searches").innerHTML = output;
} }

View File

@@ -222,11 +222,12 @@ function submitAndClose(id,title,duration){
} }
function addVideos(ids){ function addVideos(ids){
console.log(ids)
var request_url="https://www.googleapis.com/youtube/v3/videos?part=contentDetails,snippet,id&key=***REMOVED***&id="; var request_url="https://www.googleapis.com/youtube/v3/videos?part=contentDetails,snippet,id&key=***REMOVED***&id=";
request_url += ids; request_url += ids;
$.ajax({ $.ajax({
type: "GET", type: "POST",
url: request_url, url: request_url,
dataType:"jsonp", dataType:"jsonp",
success: function(response){ success: function(response){

View File

@@ -50,6 +50,7 @@ socket.on(chan.toLowerCase()+",np", function(obj)
if(obj[0].length == 0){ if(obj[0].length == 0){
console.log("Empty list"); console.log("Empty list");
document.getElementById('song-title').innerHTML = "Empty channel. Add some songs!" document.getElementById('song-title').innerHTML = "Empty channel. Add some songs!"
importOldList(chan.toLowerCase());
} }
else{ else{
console.log("gotten new song"); console.log("gotten new song");