cleanup, fix lint
This commit is contained in:
parent
6ed2308f99
commit
0b60377e19
File diff suppressed because it is too large
Load Diff
|
@ -8,7 +8,6 @@ from home.src.download.subscriptions import (
|
||||||
ChannelSubscription,
|
ChannelSubscription,
|
||||||
PlaylistSubscription,
|
PlaylistSubscription,
|
||||||
)
|
)
|
||||||
from home.src.frontend.watched import WatchState
|
|
||||||
from home.src.index.playlist import YoutubePlaylist
|
from home.src.index.playlist import YoutubePlaylist
|
||||||
from home.src.ta.helper import UrlListParser
|
from home.src.ta.helper import UrlListParser
|
||||||
from home.src.ta.ta_redis import RedisArchivist, RedisQueue
|
from home.src.ta.ta_redis import RedisArchivist, RedisQueue
|
||||||
|
@ -47,8 +46,6 @@ class PostData:
|
||||||
def exec_map(self):
|
def exec_map(self):
|
||||||
"""map dict key and return function to execute"""
|
"""map dict key and return function to execute"""
|
||||||
exec_map = {
|
exec_map = {
|
||||||
"watched": self._watched,
|
|
||||||
"un_watched": self._un_watched,
|
|
||||||
"change_view": self._change_view,
|
"change_view": self._change_view,
|
||||||
"change_grid": self._change_grid,
|
"change_grid": self._change_grid,
|
||||||
"rescan_pending": self._rescan_pending,
|
"rescan_pending": self._rescan_pending,
|
||||||
|
@ -72,16 +69,6 @@ class PostData:
|
||||||
|
|
||||||
return exec_map[self.to_exec]
|
return exec_map[self.to_exec]
|
||||||
|
|
||||||
def _watched(self):
|
|
||||||
"""mark as watched"""
|
|
||||||
WatchState(self.exec_val, is_watched=True).change()
|
|
||||||
return {"success": True}
|
|
||||||
|
|
||||||
def _un_watched(self):
|
|
||||||
"""mark as unwatched"""
|
|
||||||
WatchState(self.exec_val, is_watched=False).change()
|
|
||||||
return {"success": True}
|
|
||||||
|
|
||||||
def _change_view(self):
|
def _change_view(self):
|
||||||
"""process view changes in home, channel, and downloads"""
|
"""process view changes in home, channel, and downloads"""
|
||||||
origin, new_view = self.exec_val.split(":")
|
origin, new_view = self.exec_val.split(":")
|
||||||
|
|
|
@ -23,14 +23,14 @@ function updateVideoWatchStatus(input1, videoCurrentWatchStatus) {
|
||||||
postVideoProgress(videoId, 0); // Reset video progress on watched/unwatched;
|
postVideoProgress(videoId, 0); // Reset video progress on watched/unwatched;
|
||||||
removeProgressBar(videoId);
|
removeProgressBar(videoId);
|
||||||
|
|
||||||
let watchStatusIndicator, payload;
|
let watchStatusIndicator;
|
||||||
let apiEndpoint = '/api/watched/'
|
let apiEndpoint = '/api/watched/';
|
||||||
if (videoCurrentWatchStatus === 'watched') {
|
if (videoCurrentWatchStatus === 'watched') {
|
||||||
watchStatusIndicator = createWatchStatusIndicator(videoId, 'unwatched');
|
watchStatusIndicator = createWatchStatusIndicator(videoId, 'unwatched');
|
||||||
apiRequest(apiEndpoint, 'POST', {id: videoId, "is_watched": false})
|
apiRequest(apiEndpoint, 'POST', { id: videoId, is_watched: false });
|
||||||
} else if (videoCurrentWatchStatus === 'unwatched') {
|
} else if (videoCurrentWatchStatus === 'unwatched') {
|
||||||
watchStatusIndicator = createWatchStatusIndicator(videoId, 'watched');
|
watchStatusIndicator = createWatchStatusIndicator(videoId, 'watched');
|
||||||
apiRequest(apiEndpoint, 'POST', {id: videoId, "is_watched": true})
|
apiRequest(apiEndpoint, 'POST', { id: videoId, is_watched: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
let watchButtons = document.getElementsByClassName('watch-button');
|
let watchButtons = document.getElementsByClassName('watch-button');
|
||||||
|
@ -76,7 +76,7 @@ function removeProgressBar(videoId) {
|
||||||
function isWatchedButton(button) {
|
function isWatchedButton(button) {
|
||||||
let youtube_id = button.getAttribute('data-id');
|
let youtube_id = button.getAttribute('data-id');
|
||||||
let apiEndpoint = '/api/watched/';
|
let apiEndpoint = '/api/watched/';
|
||||||
let data = {id: youtube_id, is_watched: true}
|
let data = { id: youtube_id, is_watched: true };
|
||||||
button.remove();
|
button.remove();
|
||||||
apiRequest(apiEndpoint, 'POST', data);
|
apiRequest(apiEndpoint, 'POST', data);
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
|
@ -211,7 +211,7 @@ function forgetIgnore(button) {
|
||||||
function addSingle(button) {
|
function addSingle(button) {
|
||||||
let youtube_id = button.getAttribute('data-id');
|
let youtube_id = button.getAttribute('data-id');
|
||||||
let apiEndpoint = '/api/download/' + youtube_id + '/';
|
let apiEndpoint = '/api/download/' + youtube_id + '/';
|
||||||
apiRequest(apiEndpoint, 'POST', {status: 'pending'})
|
apiRequest(apiEndpoint, 'POST', { status: 'pending' });
|
||||||
document.getElementById('dl-' + youtube_id).remove();
|
document.getElementById('dl-' + youtube_id).remove();
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
checkMessages();
|
checkMessages();
|
||||||
|
|
Loading…
Reference in New Issue