mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-10-29 18:00:23 +00:00
Added gui for importing youtube playlists
This commit is contained in:
@@ -149,28 +149,6 @@ $(document).ready(function()
|
||||
i = 0;
|
||||
timer=100;
|
||||
}
|
||||
}else if(event.keyCode == 13)
|
||||
{
|
||||
pId = search_input.split("list=");
|
||||
if(pId.length > 1)
|
||||
{
|
||||
playlist_url = "https://www.googleapis.com/youtube/v3/playlistItems?part=contentDetails&maxResults=40&key="+api_key+"&playlistId="+pId[1];
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: playlist_url,
|
||||
dataType:"jsonp",
|
||||
success: function(response)
|
||||
{
|
||||
var ids="";
|
||||
$.each(response.items, function(i,data)
|
||||
{
|
||||
ids+=data.contentDetails.videoId+",";
|
||||
});
|
||||
addVideos(ids);
|
||||
document.getElementById("search").value = "";
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -236,6 +214,10 @@ $('input[class=conf]').change(function()
|
||||
Admin.save();
|
||||
});
|
||||
|
||||
$('#listImport').on("submit", function(){
|
||||
Search.importPlaylist(document.getElementById("import").value);
|
||||
});
|
||||
|
||||
$(window).focus(function(){
|
||||
if(unseen)
|
||||
{
|
||||
|
||||
@@ -113,6 +113,25 @@ var Search = {
|
||||
$(".main").removeClass("clickthrough");
|
||||
},
|
||||
|
||||
importPlaylist: function(pId){
|
||||
playlist_url = "https://www.googleapis.com/youtube/v3/playlistItems?part=contentDetails&maxResults=49&key="+api_key+"&playlistId="+pId;
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: playlist_url,
|
||||
dataType:"jsonp",
|
||||
success: function(response)
|
||||
{
|
||||
var ids="";
|
||||
$.each(response.items, function(i,data)
|
||||
{
|
||||
ids+=data.contentDetails.videoId+",";
|
||||
});
|
||||
Search.addVideos(ids);
|
||||
document.getElementById("import").value = "";
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
addVideos: function(ids){
|
||||
var request_url="https://www.googleapis.com/youtube/v3/videos?part=contentDetails,snippet,id&key=***REMOVED***&id=";
|
||||
request_url += ids;
|
||||
|
||||
Reference in New Issue
Block a user