mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-10-26 19:01:39 -04:00
Not adding video when it was already in the session.
This commit is contained in:
parent
8b9d44df5c
commit
f9a1f736ca
1 changed files with 6 additions and 1 deletions
|
|
@ -5,6 +5,7 @@ from collections import defaultdict
|
|||
from typing import Tuple, Optional
|
||||
from uuid import uuid1
|
||||
|
||||
from sqlalchemy.exc import InvalidRequestError
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from wrolpi.common import logger, chunks, get_config
|
||||
|
|
@ -451,7 +452,11 @@ def upsert_video(session: Session, video_path: pathlib.Path, channel: Channel =
|
|||
# inserted.
|
||||
pass
|
||||
|
||||
session.add(video)
|
||||
try:
|
||||
session.add(video)
|
||||
except InvalidRequestError:
|
||||
# Video is already in a session.
|
||||
pass
|
||||
session.flush()
|
||||
|
||||
return video
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue