Skip to content

Commit

Permalink
feat(tmdb): 已整理媒体名称可自由选择是否跟随TMDB信息变化
Browse files Browse the repository at this point in the history
  • Loading branch information
xuyanling committed Sep 5, 2023
1 parent 1a5f7b7 commit d5bb989
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
7 changes: 6 additions & 1 deletion app/subscribe.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from app.utils.commons import singleton
from app.utils.types import MediaType, SearchType, EventType, SystemConfigKey, RssType
from web.backend.web_utils import WebUtils
from config import Config

lock = Lock()

Expand Down Expand Up @@ -578,6 +579,10 @@ def refresh_rss_metainfo(self):
"""
# 更新电影
log.info("【Subscribe】开始刷新订阅TMDB信息...")
name_follow_tmdb_changed = True
media = Config().get_config('media')
if media:
name_follow_tmdb_changed = media.get("name_follow_tmdb_changed", True) or True
rss_movies = self.get_subscribe_movies(state='R')
for rid, rss_info in rss_movies.items():
# 跳过模糊匹配的
Expand All @@ -593,7 +598,7 @@ def refresh_rss_metainfo(self):
year=year,
mtype=MediaType.MOVIE,
cache=False)
if media_info and media_info.tmdb_id and media_info.title != name:
if media_info and media_info.tmdb_id and media_info.title != name and name_follow_tmdb_changed:
log.info(f"【Subscribe】检测到TMDB信息变化,更新电影订阅 {name}{media_info.title}")
# 更新订阅信息
self.dbhelper.update_rss_movie_tmdb(rid=rssid,
Expand Down
2 changes: 2 additions & 0 deletions config/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ media:
filename_prefer_barre: false
# 【获取视频元数据】:如开启,视频文件名不包含视频元数据的情况,则会通过ffmpeg获取,将会大幅增加转移时间,低配置机器不建议开启
ffmpeg_video_meta: false
# 【已整理媒体名称跟随TMDB变化】:开启则会一直与TMDB同步但是会创建多个文件夹;关闭后将会保持与TMDB信息改变之前的名称一致,不会再创建新文件夹
name_follow_tmdb_changed: true

# 配置Emby服务器信息
emby:
Expand Down
12 changes: 9 additions & 3 deletions web/templates/setting/basic.html
Original file line number Diff line number Diff line change
Expand Up @@ -444,9 +444,15 @@ <h3 class="card-title"><strong>媒体</strong></h3>
</div>
</div>
<div class="col-lg">
<div class="mb-3" style="display:none;">
<h1>占位元素 </h1>
</div>
<div class="mb-3">
<label class="form-check form-switch">
<input class="form-check-input" type="checkbox" id="media.name_follow_tmdb_changed"
{% if Config.media.name_follow_tmdb_changed %}checked{% endif %}>
<span class="form-check-label">已整理媒体名称跟随TMDB变化 <span class="form-help"
title="开启则会一直与TMDB同步但是会创建多个文件夹;关闭后将会保持与TMDB信息改变之前的名称一致,不会再创建新文件夹"
data-bs-toggle="tooltip">?</span></span>
</label>
</div>
</div>
</div>
</div>
Expand Down

0 comments on commit d5bb989

Please sign in to comment.