Use mark_state instead of direct sql so that object state updates.
This commit is contained in:
parent
4de461dbf1
commit
b46dc1feb1
3 changed files with 3 additions and 4 deletions
|
@ -151,10 +151,7 @@ def ignore_shorts_thread(rate):
|
|||
is_shorts = ycdl.ytapi.video_is_shorts(video.id)
|
||||
except Exception as exc:
|
||||
log.warning(traceback.format_exc())
|
||||
pairs = {'id': video.id, 'is_shorts': int(is_shorts)}
|
||||
if is_shorts:
|
||||
pairs['state'] = 'ignored'
|
||||
ycdldb.update(table=ycdl.objects.Video, pairs=pairs, where_key='id')
|
||||
video.mark_state('ignored')
|
||||
time.sleep(rate)
|
||||
|
||||
def start_refresher_thread(rate):
|
||||
|
|
|
@ -195,6 +195,7 @@ https://stackoverflow.com/a/35153397
|
|||
<a class="video_title" href="https://www.youtube.com/watch?v={{video.id}}">{{video.published_string}} - {{video.title}}</a>
|
||||
<span>({{video.duration | seconds_to_hms}})</span>
|
||||
<span>({{video.views}})</span>
|
||||
{% if video.is_shorts %}<span>(shorts)</span>{% endif %}
|
||||
{% if channel is none %}
|
||||
<a href="/channel/{{video.author_id}}">({{video.author.name if video.author else video.author_id}})</a> <a href="/channel/{{video.author_id}}/pending">(p)</a>
|
||||
{% endif %}
|
||||
|
|
|
@ -357,6 +357,7 @@ class Video(ObjectBase):
|
|||
self.thumbnail = db_row['thumbnail']
|
||||
self.live_broadcast = db_row['live_broadcast']
|
||||
self.state = db_row['state']
|
||||
self.is_shorts = None if db_row['is_shorts'] is None else bool(db_row['is_shorts'])
|
||||
|
||||
def __repr__(self):
|
||||
return f'Video:{self.id}'
|
||||
|
|
Loading…
Reference in a new issue