Compare commits
3 commits
cf2027d95b
...
6f4765ca9b
| Author | SHA1 | Date | |
|---|---|---|---|
| 6f4765ca9b | |||
| 587c8e4976 | |||
| 80236e7a2b |
4 changed files with 19 additions and 9 deletions
|
|
@ -150,16 +150,11 @@ def ignore_shorts_thread(rate):
|
|||
with ycdldb.transaction:
|
||||
for video in videos:
|
||||
try:
|
||||
is_shorts = ycdl.ytapi.video_is_shorts(video.id)
|
||||
if video.check_is_shorts():
|
||||
video.mark_state('ignored')
|
||||
except Exception as exc:
|
||||
log.warning(traceback.format_exc())
|
||||
continue
|
||||
video.is_shorts = is_shorts
|
||||
pairs = {'id': video.id, 'is_shorts': int(is_shorts)}
|
||||
if is_shorts:
|
||||
pairs['state'] = 'ignored'
|
||||
video.state = 'ignored'
|
||||
ycdldb.update(table=ycdl.objects.Video, pairs=pairs, where_key='id')
|
||||
time.sleep(rate)
|
||||
|
||||
def start_refresher_thread(rate):
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ function register_hotkey(hotkey, action, description)
|
|||
}
|
||||
|
||||
const key = hotkey.pop();
|
||||
modifiers = hotkey.map(word => word.toLocaleLowerCase());
|
||||
const modifiers = hotkey.map(word => word.toLocaleLowerCase());
|
||||
const ctrlKey = modifiers.includes("control") || modifiers.includes("ctrl");
|
||||
const shiftKey = modifiers.includes("shift");
|
||||
const altKey = modifiers.includes("alt");
|
||||
|
|
@ -96,7 +96,7 @@ function hotkeys_listener(event)
|
|||
return;
|
||||
}
|
||||
|
||||
identifier = hotkeys.hotkey_identifier(event.key, event.ctrlKey, event.shiftKey, event.altKey);
|
||||
const identifier = hotkeys.hotkey_identifier(event.key, event.ctrlKey, event.shiftKey, event.altKey);
|
||||
//console.log(identifier);
|
||||
if (identifier in hotkeys.HOTKEYS)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ log = vlogging.getLogger(__name__)
|
|||
|
||||
from . import constants
|
||||
from . import exceptions
|
||||
from . import ytapi
|
||||
from . import ytrss
|
||||
|
||||
class ObjectBase(worms.Object):
|
||||
|
|
@ -369,6 +370,14 @@ class Video(ObjectBase):
|
|||
except exceptions.NoSuchChannel:
|
||||
return None
|
||||
|
||||
@worms.atomic
|
||||
def check_is_shorts(self):
|
||||
is_shorts = ytapi.video_is_shorts(self.id)
|
||||
self.is_shorts = is_shorts
|
||||
pairs = {'id': self.id, 'is_shorts': int(is_shorts)}
|
||||
self.ycdldb.update(table=Video, pairs=pairs, where_key='id')
|
||||
return is_shorts
|
||||
|
||||
@worms.atomic
|
||||
def delete(self):
|
||||
log.info('Deleting %s.', self)
|
||||
|
|
|
|||
|
|
@ -359,6 +359,12 @@ class YCDLDBVideoMixin:
|
|||
video.id,
|
||||
video.live_broadcast,
|
||||
)
|
||||
# We are not setting the video to ignored, but we'll wait for
|
||||
# the next refresh to see if this livestream has ended and
|
||||
# download it then.
|
||||
return status
|
||||
if author.ignore_shorts and video.check_is_shorts():
|
||||
video.mark_state('ignored')
|
||||
return status
|
||||
# download_video contains a call to mark_state.
|
||||
self.download_video(video.id)
|
||||
|
|
|
|||
Loading…
Reference in a new issue