mirror of https://github.com/calzoneman/sync.git
Add links to playlist entries and the index page
This commit is contained in:
parent
161c8517b2
commit
3af35cb268
2
api.js
2
api.js
|
@ -117,7 +117,7 @@ function handleChannelData(params, req, res) {
|
||||||
|
|
||||||
if(d.loaded) {
|
if(d.loaded) {
|
||||||
var chan = Server.channels[cname];
|
var chan = Server.channels[cname];
|
||||||
d.title = chan.media ? chan.media.title : "-";
|
d.media = chan.media ? chan.media.pack() : {};
|
||||||
d.usercount = chan.users.length;
|
d.usercount = chan.users.length;
|
||||||
d.users = [];
|
d.users = [];
|
||||||
for(var i = 0; i < chan.users.length; i++) {
|
for(var i = 0; i < chan.users.length; i++) {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"author": "Calvin Montgomery",
|
"author": "Calvin Montgomery",
|
||||||
"name": "CyTube",
|
"name": "CyTube",
|
||||||
"description": "Online media synchronizer and chat",
|
"description": "Online media synchronizer and chat",
|
||||||
"version": "1.6.3",
|
"version": "1.6.4",
|
||||||
"repository": {
|
"repository": {
|
||||||
"url": "http://github.com/calzoneman/sync"
|
"url": "http://github.com/calzoneman/sync"
|
||||||
},
|
},
|
||||||
|
|
|
@ -9,7 +9,7 @@ The above copyright notice and this permission notice shall be included in all c
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const VERSION = "1.6.3";
|
const VERSION = "1.6.4";
|
||||||
|
|
||||||
var fs = require("fs");
|
var fs = require("fs");
|
||||||
var Logger = require("./logger.js");
|
var Logger = require("./logger.js");
|
||||||
|
|
|
@ -322,32 +322,7 @@ $("#getplaylist").click(function() {
|
||||||
socket.listeners("playlist").indexOf(callback));
|
socket.listeners("playlist").indexOf(callback));
|
||||||
var list = [];
|
var list = [];
|
||||||
for(var i = 0; i < data.pl.length; i++) {
|
for(var i = 0; i < data.pl.length; i++) {
|
||||||
var entry;
|
var entry = idToURL(data.pl[i]);
|
||||||
switch(data.pl[i].type) {
|
|
||||||
case "yt":
|
|
||||||
entry = "http://youtube.com/watch?v="+data.pl[i].id;
|
|
||||||
break;
|
|
||||||
case "vi":
|
|
||||||
entry = "http://vimeo.com/"+data.pl[i].id;
|
|
||||||
break;
|
|
||||||
case "dm":
|
|
||||||
entry = "http://dailymotion.com/video/"+data.pl[i].id;
|
|
||||||
break;
|
|
||||||
case "sc":
|
|
||||||
entry = data.pl[i].id;
|
|
||||||
break;
|
|
||||||
case "li":
|
|
||||||
entry = "http://livestream.com/"+data.pl[i].id;
|
|
||||||
break;
|
|
||||||
case "tw":
|
|
||||||
entry = "http://twitch.tv/"+data.pl[i].id;
|
|
||||||
break;
|
|
||||||
case "rt":
|
|
||||||
entry = data.pl[i].id;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
list.push(entry);
|
list.push(entry);
|
||||||
}
|
}
|
||||||
var urls = list.join(",");
|
var urls = list.join(",");
|
||||||
|
|
|
@ -246,8 +246,10 @@ function makeQueueEntry(video) {
|
||||||
.css("clear", "both")
|
.css("clear", "both")
|
||||||
.appendTo(li);
|
.appendTo(li);
|
||||||
}
|
}
|
||||||
var title = $("<span />").addClass("qe_title").appendTo(li);
|
var title = $("<a/>").addClass("qe_title").appendTo(li)
|
||||||
title.text(video.title);
|
.text(video.title)
|
||||||
|
.attr("href", idToURL(video))
|
||||||
|
.attr("target", "_blank");
|
||||||
var time = $("<span />").addClass("qe_time").appendTo(li);
|
var time = $("<span />").addClass("qe_time").appendTo(li);
|
||||||
time.text(video.duration);
|
time.text(video.duration);
|
||||||
var clear = $("<div />").addClass("qe_clear").appendTo(li);
|
var clear = $("<div />").addClass("qe_clear").appendTo(li);
|
||||||
|
@ -941,3 +943,34 @@ function applyOpts() {
|
||||||
$("#videodiv").remove();
|
$("#videodiv").remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function idToURL(data) {
|
||||||
|
var entry = "";
|
||||||
|
switch(data.type) {
|
||||||
|
case "yt":
|
||||||
|
entry = "http://youtube.com/watch?v="+data.id;
|
||||||
|
break;
|
||||||
|
case "vi":
|
||||||
|
entry = "http://vimeo.com/"+data.id;
|
||||||
|
break;
|
||||||
|
case "dm":
|
||||||
|
entry = "http://dailymotion.com/video/"+data.id;
|
||||||
|
break;
|
||||||
|
case "sc":
|
||||||
|
entry = data.id;
|
||||||
|
break;
|
||||||
|
case "li":
|
||||||
|
entry = "http://livestream.com/"+data.id;
|
||||||
|
break;
|
||||||
|
case "tw":
|
||||||
|
entry = "http://twitch.tv/"+data.id;
|
||||||
|
break;
|
||||||
|
case "rt":
|
||||||
|
case "jw":
|
||||||
|
entry = data.id;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return entry;
|
||||||
|
}
|
||||||
|
|
|
@ -73,11 +73,40 @@
|
||||||
p = "name=" + uname + "&session=" + session;
|
p = "name=" + uname + "&session=" + session;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
refresh();
|
refresh();
|
||||||
setInterval(refresh, 5000);
|
setInterval(refresh, 5000);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function idToURL(data) {
|
||||||
|
var entry = "";
|
||||||
|
switch(data.type) {
|
||||||
|
case "yt":
|
||||||
|
entry = "http://youtube.com/watch?v="+data.id;
|
||||||
|
break;
|
||||||
|
case "vi":
|
||||||
|
entry = "http://vimeo.com/"+data.id;
|
||||||
|
break;
|
||||||
|
case "dm":
|
||||||
|
entry = "http://dailymotion.com/video/"+data.id;
|
||||||
|
break;
|
||||||
|
case "sc":
|
||||||
|
entry = data.id;
|
||||||
|
break;
|
||||||
|
case "li":
|
||||||
|
entry = "http://livestream.com/"+data.id;
|
||||||
|
break;
|
||||||
|
case "tw":
|
||||||
|
entry = "http://twitch.tv/"+data.id;
|
||||||
|
break;
|
||||||
|
case "rt":
|
||||||
|
case "jw":
|
||||||
|
entry = data.id;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return entry;
|
||||||
|
}
|
||||||
function refresh() {
|
function refresh() {
|
||||||
$.getJSON(IO_URL+"/api/json/listloaded?"+p+"&callback=?", function(data) {
|
$.getJSON(IO_URL+"/api/json/listloaded?"+p+"&callback=?", function(data) {
|
||||||
var host = document.location + "";
|
var host = document.location + "";
|
||||||
|
@ -107,8 +136,17 @@
|
||||||
.text(d.name)
|
.text(d.name)
|
||||||
.appendTo(name);
|
.appendTo(name);
|
||||||
$("<td/>").text(d.usercount || 0).appendTo(tr);
|
$("<td/>").text(d.usercount || 0).appendTo(tr);
|
||||||
|
var title = $("<td/>").appendTo(tr);
|
||||||
|
if(d.media.id) {
|
||||||
|
$("<a/>").appendTo(title)
|
||||||
|
.text(d.media.title)
|
||||||
|
.attr("href", idToURL(d.media))
|
||||||
|
.attr("target", "_blank");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
title.text("-");
|
||||||
|
}
|
||||||
total += (d.usercount || 0);
|
total += (d.usercount || 0);
|
||||||
$("<td/>").text(d.title || "-").appendTo(tr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var tr = $("<tr/>").appendTo($("#channeldata"));
|
var tr = $("<tr/>").appendTo($("#channeldata"));
|
||||||
|
|
|
@ -94,6 +94,36 @@
|
||||||
host = "http://" + host;
|
host = "http://" + host;
|
||||||
setInterval(refresh, 10000);
|
setInterval(refresh, 10000);
|
||||||
refresh();
|
refresh();
|
||||||
|
function idToURL(data) {
|
||||||
|
var entry = "";
|
||||||
|
switch(data.type) {
|
||||||
|
case "yt":
|
||||||
|
entry = "http://youtube.com/watch?v="+data.id;
|
||||||
|
break;
|
||||||
|
case "vi":
|
||||||
|
entry = "http://vimeo.com/"+data.id;
|
||||||
|
break;
|
||||||
|
case "dm":
|
||||||
|
entry = "http://dailymotion.com/video/"+data.id;
|
||||||
|
break;
|
||||||
|
case "sc":
|
||||||
|
entry = data.id;
|
||||||
|
break;
|
||||||
|
case "li":
|
||||||
|
entry = "http://livestream.com/"+data.id;
|
||||||
|
break;
|
||||||
|
case "tw":
|
||||||
|
entry = "http://twitch.tv/"+data.id;
|
||||||
|
break;
|
||||||
|
case "rt":
|
||||||
|
case "jw":
|
||||||
|
entry = data.id;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return entry;
|
||||||
|
}
|
||||||
function refresh() {
|
function refresh() {
|
||||||
$.getJSON(IO_URL+"/api/json/listloaded?filter=public&callback=?", function(data) {
|
$.getJSON(IO_URL+"/api/json/listloaded?filter=public&callback=?", function(data) {
|
||||||
$("#channeldata").find("tbody").remove();
|
$("#channeldata").find("tbody").remove();
|
||||||
|
@ -115,7 +145,16 @@
|
||||||
.text(d.name)
|
.text(d.name)
|
||||||
.appendTo(name);
|
.appendTo(name);
|
||||||
$("<td/>").text(d.usercount || 0).appendTo(tr);
|
$("<td/>").text(d.usercount || 0).appendTo(tr);
|
||||||
$("<td/>").text(d.title || "-").appendTo(tr);
|
var title = $("<td/>").appendTo(tr);
|
||||||
|
if(d.media.id) {
|
||||||
|
$("<a/>").appendTo(title)
|
||||||
|
.text(d.media.title)
|
||||||
|
.attr("href", idToURL(d.media))
|
||||||
|
.attr("target", "_blank");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
title.text("-");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue