app package

Subpackages

Submodules

app.config module

class app.config.Settings(_case_sensitive: bool | None = None, _env_prefix: str | None = None, _env_file: DotenvType | None = WindowsPath('.'), _env_file_encoding: str | None = None, _env_ignore_empty: bool | None = None, _env_nested_delimiter: str | None = None, _env_parse_none_str: str | None = None, _secrets_dir: str | Path | None = None, *, app_host: str = 'localhost', app_port: int = 9091, storage_path: str = '/mnt/volume', video_download_path: str = '/videos', thumbnail_download_path: str = '/videos/thumbnail', db_host: str = 'localhost', db_port: int = 5432, db_name: str = 'peer_tube', db_schema: str = 'youtube', db_username: str = 'postgres', db_password: str = 'postgres', youtube_api_key: str = 'youtube_key', youtube_secret_json: str = '')[source]

Bases: BaseSettings

class Config[source]

Bases: object

env_file = '.env'
env_file_encoding = 'utf-8'
app_host: str
app_port: int
property database_url: str
db_host: str
db_name: str
db_password: str
db_port: int
db_schema: str
db_username: str
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[SettingsConfigDict] = {'arbitrary_types_allowed': True, 'case_sensitive': False, 'env_file': '.env', 'env_file_encoding': 'utf-8', 'env_ignore_empty': False, 'env_nested_delimiter': None, 'env_parse_none_str': None, 'env_prefix': '', 'extra': 'forbid', 'json_file': None, 'json_file_encoding': None, 'protected_namespaces': ('model_', 'settings_'), 'secrets_dir': None, 'toml_file': None, 'validate_default': True, 'yaml_file': None, 'yaml_file_encoding': None}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'app_host': FieldInfo(annotation=str, required=False, default='localhost'), 'app_port': FieldInfo(annotation=int, required=False, default=9091), 'db_host': FieldInfo(annotation=str, required=False, default='localhost'), 'db_name': FieldInfo(annotation=str, required=False, default='peer_tube'), 'db_password': FieldInfo(annotation=str, required=False, default='postgres'), 'db_port': FieldInfo(annotation=int, required=False, default=5432), 'db_schema': FieldInfo(annotation=str, required=False, default='youtube'), 'db_username': FieldInfo(annotation=str, required=False, default='postgres'), 'storage_path': FieldInfo(annotation=str, required=False, default='/mnt/volume'), 'thumbnail_download_path': FieldInfo(annotation=str, required=False, default='/videos/thumbnail'), 'video_download_path': FieldInfo(annotation=str, required=False, default='/videos'), 'youtube_api_key': FieldInfo(annotation=str, required=False, default='youtube_key'), 'youtube_secret_json': FieldInfo(annotation=str, required=False, default='')}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

storage_path: str
thumbnail_download_path: str
video_download_path: str
youtube_api_key: str
youtube_secret_json: str
app.config.get_settings() Settings[source]

app.const module

app.schema module

class app.schema.ChannelAPIInfoSchema(*, id: str, title: str, description: str | None, customUrl: str | None, published_at: datetime, country: str | None, viewCount: int | None, subscriberCount: int | None, hiddenSubscriberCount: bool | None, videoCount: int | None, topicIds: List[str] | None, topicCategories: List[str] | None, privacyStatus: str | None, isLinked: bool | None, longUploadsStatus: str | None, madeForKids: bool | None, selfDeclaredMadeForKids: bool | None)[source]

Bases: BaseModel

country: str | None
customUrl: str | None
description: str | None
classmethod from_api_response(data: dict)[source]
hiddenSubscriberCount: bool | None
id: str
isLinked: bool | None
longUploadsStatus: str | None
madeForKids: bool | None
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'country': FieldInfo(annotation=Union[str, NoneType], required=True), 'customUrl': FieldInfo(annotation=Union[str, NoneType], required=True), 'description': FieldInfo(annotation=Union[str, NoneType], required=True), 'hiddenSubscriberCount': FieldInfo(annotation=Union[bool, NoneType], required=True), 'id': FieldInfo(annotation=str, required=True), 'isLinked': FieldInfo(annotation=Union[bool, NoneType], required=True), 'longUploadsStatus': FieldInfo(annotation=Union[str, NoneType], required=True), 'madeForKids': FieldInfo(annotation=Union[bool, NoneType], required=True), 'privacyStatus': FieldInfo(annotation=Union[str, NoneType], required=True), 'published_at': FieldInfo(annotation=datetime, required=True), 'selfDeclaredMadeForKids': FieldInfo(annotation=Union[bool, NoneType], required=True), 'subscriberCount': FieldInfo(annotation=Union[int, NoneType], required=True), 'title': FieldInfo(annotation=str, required=True), 'topicCategories': FieldInfo(annotation=Union[List[str], NoneType], required=True), 'topicIds': FieldInfo(annotation=Union[List[str], NoneType], required=True), 'videoCount': FieldInfo(annotation=Union[int, NoneType], required=True), 'viewCount': FieldInfo(annotation=Union[int, NoneType], required=True)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

privacyStatus: str | None
published_at: datetime
selfDeclaredMadeForKids: bool | None
subscriberCount: int | None
title: str
topicCategories: List[str] | None
topicIds: List[str] | None
videoCount: int | None
viewCount: int | None
class app.schema.ChannelInfoSchema(*, id: str, channel: str, channel_id: str, title: str, availability: str | None = None, channel_follower_count: int | None = None, description: str | None = None, tags: list[str], thumbnails: list[ThumbnailSchema], uploader_id: str, uploader_url: str, modified_date: str | None = None, view_count: int | None = None, playlist_count: int | None = None, uploader: str, channel_url: str, entries: list[VideoSchema], extractor_key: str, extractor: str, webpage_url: str, original_url: str | None = None, webpage_url_basename: str | None = None, webpage_url_domain: str | None = None, release_year: int | None = None)[source]

Bases: BaseModel

availability: str | None
channel: str
channel_follower_count: int | None
channel_id: str
channel_url: str
description: str | None
entries: list[VideoSchema]
extractor: str
extractor_key: str
id: str
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'availability': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'channel': FieldInfo(annotation=str, required=True), 'channel_follower_count': FieldInfo(annotation=Union[int, NoneType], required=False, default=None), 'channel_id': FieldInfo(annotation=str, required=True), 'channel_url': FieldInfo(annotation=str, required=True), 'description': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'entries': FieldInfo(annotation=list[VideoSchema], required=True), 'extractor': FieldInfo(annotation=str, required=True), 'extractor_key': FieldInfo(annotation=str, required=True), 'id': FieldInfo(annotation=str, required=True), 'modified_date': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'original_url': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'playlist_count': FieldInfo(annotation=Union[int, NoneType], required=False, default=None), 'release_year': FieldInfo(annotation=Union[int, NoneType], required=False, default=None), 'tags': FieldInfo(annotation=list[str], required=True), 'thumbnails': FieldInfo(annotation=list[ThumbnailSchema], required=True), 'title': FieldInfo(annotation=str, required=True), 'uploader': FieldInfo(annotation=str, required=True), 'uploader_id': FieldInfo(annotation=str, required=True), 'uploader_url': FieldInfo(annotation=str, required=True), 'view_count': FieldInfo(annotation=Union[int, NoneType], required=False, default=None), 'webpage_url': FieldInfo(annotation=str, required=True), 'webpage_url_basename': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'webpage_url_domain': FieldInfo(annotation=Union[str, NoneType], required=False, default=None)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

model_post_init(__context: Any) None

This function is meant to behave like a BaseModel method to initialise private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Parameters:
  • self – The BaseModel instance.

  • __context – The context.

modified_date: str | None
original_url: str | None
playlist_count: int | None
release_year: int | None
tags: list[str]
thumbnails: list[ThumbnailSchema]
title: str
uploader: str
uploader_id: str
uploader_url: str
view_count: int | None
webpage_url: str
webpage_url_basename: str | None
webpage_url_domain: str | None
class app.schema.ThumbnailSchema(*, url: str, height: int | None = 0, width: int | None = 0, preference: int | None = None, id: str | None = '', resolution: str | None = None)[source]

Bases: BaseModel

height: int | None
id: str | None
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'height': FieldInfo(annotation=Union[int, NoneType], required=False, default=0), 'id': FieldInfo(annotation=Union[str, NoneType], required=False, default=''), 'preference': FieldInfo(annotation=Union[int, NoneType], required=False, default=None), 'resolution': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'url': FieldInfo(annotation=str, required=True), 'width': FieldInfo(annotation=Union[int, NoneType], required=False, default=0)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

preference: int | None
resolution: str | None
url: str
width: int | None
class app.schema.VideoSchema(*, ie_key: str | None = '', id: str, url: str | None = None, title: str, tags: list[str] = [], description: str | None = None, duration: int | None = None, thumbnails: list[ThumbnailSchema] = [], view_count: int | None = None, commentCount: int | None = None, timestamp: int | None = None, release_timestamp: int | None = None, availability: str | None = None, live_status: str | None = None, channel_is_verified: bool | None = None, defaultAudioLanguage: str | None = None)[source]

Bases: BaseModel

class Config[source]

Bases: object

arbitrary_types_allowed = True
availability: str | None
channel_is_verified: bool | None
commentCount: int | None
defaultAudioLanguage: str | None
description: str | None
duration: int | None
id: str
ie_key: str | None
live_status: str | None
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'availability': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'channel_is_verified': FieldInfo(annotation=Union[bool, NoneType], required=False, default=None), 'commentCount': FieldInfo(annotation=Union[int, NoneType], required=False, default=None), 'defaultAudioLanguage': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'description': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'duration': FieldInfo(annotation=Union[int, NoneType], required=False, default=None), 'id': FieldInfo(annotation=str, required=True), 'ie_key': FieldInfo(annotation=Union[str, NoneType], required=False, default=''), 'live_status': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'release_timestamp': FieldInfo(annotation=Union[int, NoneType], required=False, default=None), 'tags': FieldInfo(annotation=list[str], required=False, default=[]), 'thumbnails': FieldInfo(annotation=list[ThumbnailSchema], required=False, default=[]), 'timestamp': FieldInfo(annotation=Union[int, NoneType], required=False, default=None), 'title': FieldInfo(annotation=str, required=True), 'url': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'view_count': FieldInfo(annotation=Union[int, NoneType], required=False, default=None)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

model_post_init(__context: Any) None

This function is meant to behave like a BaseModel method to initialise private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Parameters:
  • self – The BaseModel instance.

  • __context – The context.

release_timestamp: int | None
tags: list[str]
thumbnails: list[ThumbnailSchema]
timestamp: int | None
title: str
url: str | None
view_count: int | None
class app.schema.YTFormatSchema(*, format_id: str, ext: str, resolution: str, fps: float | None = None, audio_channels: int | None = None, filesize: int | None = None, tbr: float | None = None, protocol: str | None = None, vcodec: str | None = None, acodec: str | None = None, asr: int | None = None, format: str | None = None, format_note: str | None = None, width: int | None = None, height: int | None = None, aspect_ratio: float | None = None, dynamic_range: str | None = None, language: str | None = None, quality: int | None = 0, has_drm: bool | None = False, filesize_approx: int | None = None)[source]

Bases: BaseModel

acodec: str | None
aspect_ratio: float | None
asr: int | None
audio_channels: int | None
dynamic_range: str | None
ext: str
filesize: int | None
filesize_approx: int | None
format: str | None
format_id: str
format_note: str | None
fps: float | None
has_drm: bool | None
height: int | None
language: str | None
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'acodec': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'aspect_ratio': FieldInfo(annotation=Union[float, NoneType], required=False, default=None), 'asr': FieldInfo(annotation=Union[int, NoneType], required=False, default=None), 'audio_channels': FieldInfo(annotation=Union[int, NoneType], required=False, default=None), 'dynamic_range': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'ext': FieldInfo(annotation=str, required=True), 'filesize': FieldInfo(annotation=Union[int, NoneType], required=False, default=None), 'filesize_approx': FieldInfo(annotation=Union[int, NoneType], required=False, default=None), 'format': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'format_id': FieldInfo(annotation=str, required=True), 'format_note': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'fps': FieldInfo(annotation=Union[float, NoneType], required=False, default=None), 'has_drm': FieldInfo(annotation=Union[bool, NoneType], required=False, default=False), 'height': FieldInfo(annotation=Union[int, NoneType], required=False, default=None), 'language': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'protocol': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'quality': FieldInfo(annotation=Union[int, NoneType], required=False, default=0), 'resolution': FieldInfo(annotation=str, required=True), 'tbr': FieldInfo(annotation=Union[float, NoneType], required=False, default=None), 'vcodec': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'width': FieldInfo(annotation=Union[int, NoneType], required=False, default=None)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

protocol: str | None
quality: int | None
resolution: str
tbr: float | None
vcodec: str | None
width: int | None

Module contents