mirror of
https://github.com/KevinMidboe/zoff.git
synced 2026-01-10 11:35:34 +00:00
Added gui for importing youtube playlists
This commit is contained in:
@@ -122,3 +122,25 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
<li class="no-padding remote-panel">
|
||||||
|
<ul class="collapsible collapsible-accordion">
|
||||||
|
<li>
|
||||||
|
<a class="collapsible-header bold waves-effect">Import Playlist
|
||||||
|
<i class="mdi-communication-import-export"></i>
|
||||||
|
</a>
|
||||||
|
<div class="collapsible-body">
|
||||||
|
<ul>
|
||||||
|
<li class="white-bg">
|
||||||
|
<div class="input-field field-settings">
|
||||||
|
<form action="#" id="listImport" onsubmit="return false;">
|
||||||
|
<i class="mdi-av-playlist-add import-icon"></i>
|
||||||
|
<input title="Only works with 49 or less songs.." placeholder="Enter YouTube-list ID" id="import" type="text" class="validate" />
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
|||||||
@@ -68,7 +68,18 @@ input[type=text]:focus:not([readonly]) + label, input[type=password]:focus:not([
|
|||||||
color: rgb(68,68,68);
|
color: rgb(68,68,68);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.import-icon{
|
||||||
|
position: absolute;
|
||||||
|
}
|
||||||
|
|
||||||
|
#import{
|
||||||
|
width:65%;
|
||||||
|
margin-left:10px;
|
||||||
|
color:rgb(68,68,68);
|
||||||
|
}
|
||||||
|
|
||||||
#password{
|
#password{
|
||||||
|
width:70%;
|
||||||
margin-left:10px;
|
margin-left:10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
4
static/dist/main-min.js
vendored
4
static/dist/main-min.js
vendored
File diff suppressed because one or more lines are too long
@@ -149,28 +149,6 @@ $(document).ready(function()
|
|||||||
i = 0;
|
i = 0;
|
||||||
timer=100;
|
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();
|
Admin.save();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#listImport').on("submit", function(){
|
||||||
|
Search.importPlaylist(document.getElementById("import").value);
|
||||||
|
});
|
||||||
|
|
||||||
$(window).focus(function(){
|
$(window).focus(function(){
|
||||||
if(unseen)
|
if(unseen)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -113,6 +113,25 @@ var Search = {
|
|||||||
$(".main").removeClass("clickthrough");
|
$(".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){
|
addVideos: function(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;
|
||||||
|
|||||||
Reference in New Issue
Block a user