Merge pull request #1234 from thsrite/main
This commit is contained in:
commit
995c359f20
@ -82,6 +82,7 @@ def create_subscribe(
|
|||||||
doubanid=subscribe_in.doubanid,
|
doubanid=subscribe_in.doubanid,
|
||||||
username=current_user.name,
|
username=current_user.name,
|
||||||
best_version=subscribe_in.best_version,
|
best_version=subscribe_in.best_version,
|
||||||
|
save_path=subscribe_in.save_path,
|
||||||
exist_ok=True)
|
exist_ok=True)
|
||||||
return schemas.Response(success=True if sid else False, message=message, data={
|
return schemas.Response(success=True if sid else False, message=message, data={
|
||||||
"id": sid
|
"id": sid
|
||||||
|
@ -320,7 +320,8 @@ class SubscribeChain(ChainBase):
|
|||||||
downloads, lefts = self.downloadchain.batch_download(
|
downloads, lefts = self.downloadchain.batch_download(
|
||||||
contexts=matched_contexts,
|
contexts=matched_contexts,
|
||||||
no_exists=no_exists,
|
no_exists=no_exists,
|
||||||
username=subscribe.username
|
username=subscribe.username,
|
||||||
|
save_path=subscribe.save_path
|
||||||
)
|
)
|
||||||
|
|
||||||
# 判断是否应完成订阅
|
# 判断是否应完成订阅
|
||||||
@ -674,8 +675,10 @@ class SubscribeChain(ChainBase):
|
|||||||
|
|
||||||
# 开始批量择优下载
|
# 开始批量择优下载
|
||||||
logger.info(f'{mediainfo.title_year} 匹配完成,共匹配到{len(_match_context)}个资源')
|
logger.info(f'{mediainfo.title_year} 匹配完成,共匹配到{len(_match_context)}个资源')
|
||||||
downloads, lefts = self.downloadchain.batch_download(contexts=_match_context, no_exists=no_exists,
|
downloads, lefts = self.downloadchain.batch_download(contexts=_match_context,
|
||||||
username=subscribe.username)
|
no_exists=no_exists,
|
||||||
|
username=subscribe.username,
|
||||||
|
save_path=subscribe.save_path)
|
||||||
# 判断是否要完成订阅
|
# 判断是否要完成订阅
|
||||||
self.finish_subscribe_or_not(subscribe=subscribe, meta=meta, mediainfo=mediainfo,
|
self.finish_subscribe_or_not(subscribe=subscribe, meta=meta, mediainfo=mediainfo,
|
||||||
downloads=downloads, lefts=lefts)
|
downloads=downloads, lefts=lefts)
|
||||||
|
@ -65,6 +65,8 @@ class Subscribe(Base):
|
|||||||
best_version = Column(Integer, default=0)
|
best_version = Column(Integer, default=0)
|
||||||
# 当前优先级
|
# 当前优先级
|
||||||
current_priority = Column(Integer)
|
current_priority = Column(Integer)
|
||||||
|
# 保存路径
|
||||||
|
save_path = Column(String)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@db_query
|
@db_query
|
||||||
|
@ -57,6 +57,8 @@ class Subscribe(BaseModel):
|
|||||||
best_version: Optional[int] = 0
|
best_version: Optional[int] = 0
|
||||||
# 当前优先级
|
# 当前优先级
|
||||||
current_priority: Optional[int] = None
|
current_priority: Optional[int] = None
|
||||||
|
# 保存路径
|
||||||
|
save_path: Optional[str] = None
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
orm_mode = True
|
orm_mode = True
|
||||||
|
30
database/versions/d71e624f0208_1_0_12.py
Normal file
30
database/versions/d71e624f0208_1_0_12.py
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
"""1_0_12
|
||||||
|
|
||||||
|
Revision ID: d71e624f0208
|
||||||
|
Revises: 06abf3e7090b
|
||||||
|
Create Date: 2023-12-12 13:26:34.039497
|
||||||
|
|
||||||
|
"""
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision = 'd71e624f0208'
|
||||||
|
down_revision = '06abf3e7090b'
|
||||||
|
branch_labels = None
|
||||||
|
depends_on = None
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade() -> None:
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
try:
|
||||||
|
with op.batch_alter_table("subscribe") as batch_op:
|
||||||
|
batch_op.add_column(sa.Column('save_path', sa.String, nullable=True))
|
||||||
|
except Exception as e:
|
||||||
|
pass
|
||||||
|
# ### end Alembic commands ###
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade() -> None:
|
||||||
|
pass
|
Loading…
x
Reference in New Issue
Block a user