mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-11-22 07:56:18 -05:00
Creating Channel.info_json_path property to avoid redefining channel's info json path.
This commit is contained in:
parent
808f46be5b
commit
e49ffc8a6c
3 changed files with 27 additions and 1 deletions
|
|
@ -556,6 +556,15 @@ class Channel(ModelHelper, Base):
|
|||
def location(self) -> str:
|
||||
return f'/videos/channel/{self.id}/video'
|
||||
|
||||
@property
|
||||
def info_json_path(self) -> pathlib.Path:
|
||||
if self.directory:
|
||||
if not self.directory.exists():
|
||||
self.directory.mkdir(parents=True)
|
||||
return self.directory / f'{self.name}.info.json'
|
||||
|
||||
raise FileNotFoundError(f'Cannot create Channel info json because directory is not defined: {self}')
|
||||
|
||||
def delete_with_videos(self):
|
||||
"""Delete all Video records (but not video files) related to this Channel. Then delete the Channel."""
|
||||
session = Session.object_session(self)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue