mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-03-20 03:57:30 +08:00
问题:订阅中添加的自定义识别词(特别是集数偏移)在下载时正常生效, 但在下载完成整理时没有生效。 根因:下载历史中未保存识别词,整理时 MetaInfoPath 未接收 custom_words 参数。 修复: - 在 DownloadHistory 模型中添加 custom_words 字段 - 下载时从 meta.apply_words 获取并保存识别词到下载历史 - MetaInfoPath 函数添加 custom_words 参数支持 - 整理时从下载历史获取 custom_words 并传递给 MetaInfoPath - 添加 Alembic 迁移脚本 (2.2.3) - 添加相关单元测试
31 lines
814 B
Python
31 lines
814 B
Python
"""2.2.3
|
|
添加 downloadhistory.custom_words 字段,用于整理时应用订阅识别词
|
|
|
|
Revision ID: 58edfac72c32
|
|
Revises: 41ef1dd7467c
|
|
Create Date: 2026-01-19
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = "58edfac72c32"
|
|
down_revision = "41ef1dd7467c"
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
conn = op.get_bind()
|
|
inspector = sa.inspect(conn)
|
|
|
|
# 检查并添加 downloadhistory.custom_words
|
|
dh_columns = inspector.get_columns('downloadhistory')
|
|
if not any(c['name'] == 'custom_words' for c in dh_columns):
|
|
op.add_column('downloadhistory', sa.Column('custom_words', sa.String, nullable=True))
|
|
|
|
|
|
def downgrade() -> None:
|
|
# 降级时删除字段
|
|
op.drop_column('downloadhistory', 'custom_words')
|