mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-05 07:27:15 +08:00
fix subscribe files
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
import time
|
import time
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from sqlalchemy import Column, Integer, String, Sequence, JSON
|
from sqlalchemy import Column, Integer, String, Sequence, JSON, or_
|
||||||
from sqlalchemy.orm import Session
|
from sqlalchemy.orm import Session
|
||||||
|
|
||||||
from app.db import db_query, db_update, Base
|
from app.db import db_query, db_update, Base
|
||||||
@@ -65,8 +65,8 @@ class DownloadHistory(Base):
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
@db_query
|
@db_query
|
||||||
def get_by_mediaid(db: Session, tmdbid: int, doubanid: str):
|
def get_by_mediaid(db: Session, tmdbid: int, doubanid: str):
|
||||||
return db.query(DownloadHistory).filter(DownloadHistory.tmdbid == tmdbid,
|
return db.query(DownloadHistory).filter(or_(DownloadHistory.tmdbid == tmdbid,
|
||||||
DownloadHistory.doubanid == doubanid).all()
|
DownloadHistory.doubanid == doubanid)).all()
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@db_query
|
@db_query
|
||||||
@@ -81,7 +81,7 @@ class DownloadHistory(Base):
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@db_query
|
@db_query
|
||||||
def get_last_by(db: Session, mtype: Optional[str] = None, title: Optional[str] = None,
|
def get_last_by(db: Session, mtype: Optional[str] = None, title: Optional[str] = None,
|
||||||
year: Optional[str] = None, season: Optional[str] = None,
|
year: Optional[str] = None, season: Optional[str] = None,
|
||||||
episode: Optional[str] = None, tmdbid: Optional[int] = None):
|
episode: Optional[str] = None, tmdbid: Optional[int] = None):
|
||||||
"""
|
"""
|
||||||
@@ -97,18 +97,18 @@ class DownloadHistory(Base):
|
|||||||
DownloadHistory.type == mtype,
|
DownloadHistory.type == mtype,
|
||||||
DownloadHistory.seasons == season,
|
DownloadHistory.seasons == season,
|
||||||
DownloadHistory.episodes == episode).order_by(
|
DownloadHistory.episodes == episode).order_by(
|
||||||
DownloadHistory.id.desc()).all()
|
DownloadHistory.id.desc()).all()
|
||||||
# 电视剧某季
|
# 电视剧某季
|
||||||
elif season:
|
elif season:
|
||||||
result = db.query(DownloadHistory).filter(DownloadHistory.tmdbid == tmdbid,
|
result = db.query(DownloadHistory).filter(DownloadHistory.tmdbid == tmdbid,
|
||||||
DownloadHistory.type == mtype,
|
DownloadHistory.type == mtype,
|
||||||
DownloadHistory.seasons == season).order_by(
|
DownloadHistory.seasons == season).order_by(
|
||||||
DownloadHistory.id.desc()).all()
|
DownloadHistory.id.desc()).all()
|
||||||
else:
|
else:
|
||||||
# 电视剧所有季集/电影
|
# 电视剧所有季集/电影
|
||||||
result = db.query(DownloadHistory).filter(DownloadHistory.tmdbid == tmdbid,
|
result = db.query(DownloadHistory).filter(DownloadHistory.tmdbid == tmdbid,
|
||||||
DownloadHistory.type == mtype).order_by(
|
DownloadHistory.type == mtype).order_by(
|
||||||
DownloadHistory.id.desc()).all()
|
DownloadHistory.id.desc()).all()
|
||||||
# 标题 + 年份
|
# 标题 + 年份
|
||||||
elif title and year:
|
elif title and year:
|
||||||
# 电视剧某季某集
|
# 电视剧某季某集
|
||||||
@@ -117,18 +117,18 @@ class DownloadHistory(Base):
|
|||||||
DownloadHistory.year == year,
|
DownloadHistory.year == year,
|
||||||
DownloadHistory.seasons == season,
|
DownloadHistory.seasons == season,
|
||||||
DownloadHistory.episodes == episode).order_by(
|
DownloadHistory.episodes == episode).order_by(
|
||||||
DownloadHistory.id.desc()).all()
|
DownloadHistory.id.desc()).all()
|
||||||
# 电视剧某季
|
# 电视剧某季
|
||||||
elif season:
|
elif season:
|
||||||
result = db.query(DownloadHistory).filter(DownloadHistory.title == title,
|
result = db.query(DownloadHistory).filter(DownloadHistory.title == title,
|
||||||
DownloadHistory.year == year,
|
DownloadHistory.year == year,
|
||||||
DownloadHistory.seasons == season).order_by(
|
DownloadHistory.seasons == season).order_by(
|
||||||
DownloadHistory.id.desc()).all()
|
DownloadHistory.id.desc()).all()
|
||||||
else:
|
else:
|
||||||
# 电视剧所有季集/电影
|
# 电视剧所有季集/电影
|
||||||
result = db.query(DownloadHistory).filter(DownloadHistory.title == title,
|
result = db.query(DownloadHistory).filter(DownloadHistory.title == title,
|
||||||
DownloadHistory.year == year).order_by(
|
DownloadHistory.year == year).order_by(
|
||||||
DownloadHistory.id.desc()).all()
|
DownloadHistory.id.desc()).all()
|
||||||
|
|
||||||
if result:
|
if result:
|
||||||
return list(result)
|
return list(result)
|
||||||
|
|||||||
@@ -1311,7 +1311,8 @@ class FileManagerModule(_ModuleBase):
|
|||||||
if media_files:
|
if media_files:
|
||||||
for media_file in media_files:
|
for media_file in media_files:
|
||||||
if f".{media_file.extension.lower()}" in settings.RMT_MEDIAEXT:
|
if f".{media_file.extension.lower()}" in settings.RMT_MEDIAEXT:
|
||||||
ret_fileitems.append(media_file)
|
if media_file not in ret_fileitems:
|
||||||
|
ret_fileitems.append(media_file)
|
||||||
return ret_fileitems
|
return ret_fileitems
|
||||||
|
|
||||||
def media_exists(self, mediainfo: MediaInfo, **kwargs) -> Optional[ExistMediaInfo]:
|
def media_exists(self, mediainfo: MediaInfo, **kwargs) -> Optional[ExistMediaInfo]:
|
||||||
|
|||||||
Reference in New Issue
Block a user