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)
|
|
|
|
{
|
2022-10-01 21:30:08 +00:00
|
|
|
return http.post({
|
|
|
|
url: "/add_channel",
|
|
|
|
data: {"channel_id": channel_id},
|
|
|
|
callback: callback,
|
|
|
|
});
|
2020-06-03 20:00:44 +00:00
|
|
|
}
|
|
|
|
|
2020-08-11 01:30:56 +00:00
|
|
|
api.channels.delete_channel =
|
|
|
|
function delete_channel(channel_id, callback)
|
|
|
|
{
|
2022-10-01 21:30:08 +00:00
|
|
|
return http.post({
|
|
|
|
url: `/channel/${channel_id}/delete`,
|
|
|
|
data: {},
|
|
|
|
callback: callback,
|
|
|
|
});
|
2020-08-11 01:30:56 +00:00
|
|
|
}
|
|
|
|
|
2020-06-03 19:59:29 +00:00
|
|
|
api.channels.refresh_channel =
|
|
|
|
function refresh_channel(channel_id, force, callback)
|
|
|
|
{
|
2022-10-01 21:30:08 +00:00
|
|
|
return http.post({
|
|
|
|
url: `/channel/${channel_id}/refresh`,
|
|
|
|
data: {"force": force},
|
|
|
|
callback: callback,
|
|
|
|
});
|
2020-06-03 19:59:29 +00:00
|
|
|
}
|
|
|
|
|
2020-06-03 20:00:16 +00:00
|
|
|
api.channels.refresh_all_channels =
|
|
|
|
function refresh_all_channels(force, callback)
|
|
|
|
{
|
2022-10-01 21:30:08 +00:00
|
|
|
return http.post({
|
|
|
|
url: "/refresh_all_channels",
|
|
|
|
data: {"force": force},
|
|
|
|
callback: callback,
|
|
|
|
});
|
2020-06-03 20:00:16 +00:00
|
|
|
}
|
|
|
|
|
2020-06-03 20:01:28 +00:00
|
|
|
api.channels.set_automark =
|
|
|
|
function set_automark(channel_id, state, callback)
|
|
|
|
{
|
2022-10-01 21:30:08 +00:00
|
|
|
return http.post({
|
|
|
|
url: `/channel/${channel_id}/set_automark`,
|
|
|
|
data: {"state": state},
|
|
|
|
callback: callback,
|
|
|
|
});
|
2020-06-03 20:01:28 +00:00
|
|
|
}
|
|
|
|
|
2021-09-05 08:26:34 +00:00
|
|
|
api.channels.set_autorefresh =
|
|
|
|
function set_autorefresh(channel_id, autorefresh, callback)
|
|
|
|
{
|
2022-10-01 21:30:08 +00:00
|
|
|
return http.post({
|
|
|
|
url: `/channel/${channel_id}/set_autorefresh`,
|
|
|
|
data: {"autorefresh": autorefresh},
|
|
|
|
callback: callback,
|
|
|
|
});
|
2021-09-05 08:26:34 +00:00
|
|
|
}
|
|
|
|
|
2021-09-02 06:37:43 +00:00
|
|
|
api.channels.set_download_directory =
|
|
|
|
function set_download_directory(channel_id, download_directory, callback)
|
|
|
|
{
|
2022-10-01 21:30:08 +00:00
|
|
|
return http.post({
|
|
|
|
url: `/channel/${channel_id}/set_download_directory`,
|
|
|
|
data: {"download_directory": download_directory},
|
|
|
|
callback: callback,
|
|
|
|
});
|
2021-09-02 06:37:43 +00:00
|
|
|
}
|
|
|
|
|
2021-10-26 18:53:49 +00:00
|
|
|
api.channels.set_name =
|
|
|
|
function set_name(channel_id, name, callback)
|
|
|
|
{
|
2022-10-01 21:30:08 +00:00
|
|
|
return http.post({
|
|
|
|
url: `/channel/${channel_id}/set_name`,
|
|
|
|
data: {"name": name},
|
|
|
|
callback: callback,
|
|
|
|
});
|
2021-10-26 18:53:49 +00:00
|
|
|
}
|
|
|
|
|
2020-09-16 17:23:38 +00:00
|
|
|
api.channels.set_queuefile_extension =
|
|
|
|
function set_queuefile_extension(channel_id, extension, callback)
|
|
|
|
{
|
2022-10-01 21:30:08 +00:00
|
|
|
return http.post({
|
|
|
|
url: `/channel/${channel_id}/set_queuefile_extension`,
|
|
|
|
data: {"extension": extension},
|
|
|
|
callback: callback,
|
|
|
|
});
|
2020-09-16 17:23:38 +00:00
|
|
|
}
|
|
|
|
|
2022-03-15 20:53:40 +00:00
|
|
|
api.channels.show_download_directory =
|
|
|
|
function show_download_directory(channel_id, callback)
|
|
|
|
{
|
2022-10-01 21:30:08 +00:00
|
|
|
return http.post({
|
|
|
|
url: `/channel/${channel_id}/show_download_directory`,
|
|
|
|
callback: callback,
|
|
|
|
});
|
2022-03-15 20:53:40 +00:00
|
|
|
}
|
|
|
|
|
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
|
|
|
|
{
|
2020-10-03 02:46:36 +00:00
|
|
|
alert(JSON.stringify(response));
|
2020-08-11 01:30:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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)
|
|
|
|
{
|
2022-10-01 21:30:08 +00:00
|
|
|
return http.post({
|
|
|
|
url: "/mark_video_state",
|
|
|
|
data: {"video_ids": video_ids, "state": state},
|
|
|
|
callback: callback,
|
|
|
|
});
|
2020-06-03 20:01:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
api.videos.start_download =
|
|
|
|
function start_download(video_ids, callback)
|
|
|
|
{
|
2022-10-01 21:30:08 +00:00
|
|
|
return http.post({
|
|
|
|
url: "/start_download",
|
|
|
|
data: {"video_ids": video_ids},
|
|
|
|
callback: callback,
|
|
|
|
});
|
2020-06-03 20:01:53 +00:00
|
|
|
}
|