2020-06-03 19:54:20 +00:00
|
|
|
var api = {};
|
|
|
|
|
|
|
|
/**************************************************************************************************/
|
|
|
|
api.channels = {};
|
|
|
|
|
2020-06-03 20:00:44 +00:00
|
|
|
api.channels.add_channel =
|
|
|
|
function add_channel(channel_id, callback)
|
|
|
|
{
|
|
|
|
var url = "/add_channel";
|
|
|
|
data = new FormData();
|
|
|
|
data.append("channel_id", channel_id);
|
|
|
|
return common.post(url, data, callback);
|
|
|
|
}
|
|
|
|
|
2020-08-11 01:30:56 +00:00
|
|
|
api.channels.delete_channel =
|
|
|
|
function delete_channel(channel_id, callback)
|
|
|
|
{
|
|
|
|
var url = `/channel/${channel_id}/delete`;
|
|
|
|
data = new FormData();
|
|
|
|
return common.post(url, data, callback);
|
|
|
|
}
|
|
|
|
|
2020-06-03 19:59:29 +00:00
|
|
|
api.channels.refresh_channel =
|
|
|
|
function refresh_channel(channel_id, force, callback)
|
|
|
|
{
|
|
|
|
var url = `/channel/${channel_id}/refresh`;
|
|
|
|
data = new FormData();
|
|
|
|
data.append("force", force)
|
|
|
|
return common.post(url, data, callback);
|
|
|
|
}
|
|
|
|
|
2020-06-03 20:00:16 +00:00
|
|
|
api.channels.refresh_all_channels =
|
|
|
|
function refresh_all_channels(force, callback)
|
|
|
|
{
|
|
|
|
var url = "/refresh_all_channels";
|
|
|
|
data = new FormData();
|
|
|
|
data.append("force", force)
|
|
|
|
return common.post(url, data, callback);
|
|
|
|
}
|
|
|
|
|
2020-06-03 20:01:28 +00:00
|
|
|
api.channels.set_automark =
|
|
|
|
function set_automark(channel_id, state, callback)
|
|
|
|
{
|
|
|
|
var url = `/channel/${channel_id}/set_automark`;
|
|
|
|
data = new FormData();
|
|
|
|
data.append("state", state);
|
|
|
|
return common.post(url, data, callback);
|
|
|
|
}
|
|
|
|
|
2020-08-11 01:30:56 +00:00
|
|
|
api.channels.callback_go_to_channels =
|
|
|
|
function callback_go_to_channels(response)
|
|
|
|
{
|
|
|
|
if (response.meta.status === 200)
|
|
|
|
{
|
|
|
|
window.location.href = "/channels";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
console.log(response);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-06-03 19:54:20 +00:00
|
|
|
/**************************************************************************************************/
|
|
|
|
api.videos = {};
|
2020-06-03 20:01:53 +00:00
|
|
|
|
|
|
|
api.videos.mark_state =
|
|
|
|
function mark_state(video_ids, state, callback)
|
|
|
|
{
|
|
|
|
var url = "/mark_video_state";
|
|
|
|
data = new FormData();
|
|
|
|
data.append("video_ids", video_ids);
|
|
|
|
data.append("state", state);
|
|
|
|
return common.post(url, data, callback);
|
|
|
|
}
|
|
|
|
|
|
|
|
api.videos.start_download =
|
|
|
|
function start_download(video_ids, callback)
|
|
|
|
{
|
|
|
|
var url = "/start_download";
|
|
|
|
data = new FormData();
|
|
|
|
data.append("video_ids", video_ids);
|
|
|
|
return common.post(url, data, callback);
|
|
|
|
}
|