mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-10-26 19:01:39 -04:00
* Videos are marked as validated so they will not be tried again. All previous bulk methods are combined into one. * Passing json to fixture factory to avoid writing the files in every test. * Adding log to explain if refresh is slow. * Generating video poster if one cannot be found. * Generating video poster if no poster can be found. * Videos without a video file (yet to be downloaded) are not validated. * Video title is extracted from the video file name as a last resort. * Keeping existing view count because it may be from the channel, which will be more recent. * Downloads should only be downloaded after they are due, not the same day. * Setting manager on new downloads. * Checking if downloading is disabled in loop. * Adding log when refresh is complete. * Not generating posters by default. This is to avoid deleting files. * Not converting posters unless channel has that enabled. * Not logging on valid because all posters will be checked. * Validating videos in upsert. * Using video name parser in upsert. * Using validate_video in upsert so that data is only read once from disk. * Attaching manager in download_manager.get_download. * Adding 22 to preferred video format for odd 720p resolution. Signed-off-by: Roland <roland@learningselfreliance.com>
35 lines
1 KiB
Python
35 lines
1 KiB
Python
"""Video validated.
|
|
|
|
Revision ID: 3c33b1dae069
|
|
Revises: f2c6326cad29
|
|
Create Date: 2022-01-13 16:14:23.409242
|
|
|
|
"""
|
|
import os
|
|
|
|
from alembic import op
|
|
from sqlalchemy.orm import Session
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = '3c33b1dae069'
|
|
down_revision = 'f2c6326cad29'
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
DOCKERIZED = True if os.environ.get('DOCKER', '').lower().startswith('t') else False
|
|
|
|
|
|
def upgrade():
|
|
bind = op.get_bind()
|
|
session = Session(bind=bind)
|
|
session.execute('ALTER TABLE video ADD COLUMN validated BOOLEAN DEFAULT FALSE')
|
|
session.execute('ALTER TABLE video DROP COLUMN IF EXISTS validated_poster')
|
|
# Generating posters is slow, and may delete files.
|
|
session.execute('ALTER TABLE channel ALTER COLUMN generate_posters SET DEFAULT false')
|
|
|
|
|
|
def downgrade():
|
|
bind = op.get_bind()
|
|
session = Session(bind=bind)
|
|
session.execute('ALTER TABLE video DROP COLUMN IF EXISTS validated')
|
|
session.execute('ALTER TABLE video ADD COLUMN validated_poster BOOLEAN DEFAULT FALSE')
|