mirror of
https://github.com/EstrellaXD/Auto_Bangumi.git
synced 2026-04-25 11:00:53 +08:00
v2.3.5 修复更名不换行的bug
This commit is contained in:
@@ -48,26 +48,24 @@ class SetRule:
|
||||
try:
|
||||
self.qb.rss_remove_item(item_path="Mikan_RSS")
|
||||
except qbittorrentapi.exceptions.Conflict409Error:
|
||||
sys.stdout.write(f"[{EnvInfo.time_show_obj}] No feed exists, starting adding feed." + "\n")
|
||||
print(f"[{EnvInfo.time_show_obj}] No feed exists, starting adding feed.")
|
||||
try:
|
||||
self.qb.rss_add_feed(url=self.rss_link, item_path="Mikan_RSS")
|
||||
sys.stdout.write(f"[{EnvInfo.time_show_obj}] Successes adding RSS Feed." + "\n")
|
||||
print(f"[{EnvInfo.time_show_obj}] Successes adding RSS Feed.")
|
||||
except ConnectionError:
|
||||
sys.stdout.write(f"[{EnvInfo.time_show_obj}] Error with adding RSS Feed." + "\n")
|
||||
print(f"[{EnvInfo.time_show_obj}] Error with adding RSS Feed.")
|
||||
except qbittorrentapi.exceptions.Conflict409Error:
|
||||
sys.stdout.write(f"[{EnvInfo.time_show_obj}] RSS Already exists." + "\n")
|
||||
print(f"[{EnvInfo.time_show_obj}] RSS Already exists.")
|
||||
|
||||
def run(self):
|
||||
sys.stdout.write(f"[{EnvInfo.time_show_obj}] Start adding rules." + "\n")
|
||||
sys.stdout.flush()
|
||||
print(f"[{EnvInfo.time_show_obj}] Start adding rules.")
|
||||
for info in self.bangumi_info:
|
||||
if not info["added"]:
|
||||
self.set_rule(info["title"], info["group"], info["season"])
|
||||
info["added"] = True
|
||||
with open(EnvInfo.info_path, 'w', encoding='utf8') as f:
|
||||
json.dump(self.info, f, indent=4, separators=(',', ': '), ensure_ascii=False)
|
||||
sys.stdout.write(f"[{EnvInfo.time_show_obj}] Finished." + "\n")
|
||||
sys.stdout.flush()
|
||||
print(f"[{EnvInfo.time_show_obj}] Finished.")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
# -*- coding: UTF-8 -*-
|
||||
import os
|
||||
import sys
|
||||
import requests
|
||||
from bs4 import BeautifulSoup
|
||||
@@ -27,7 +28,11 @@ class CollectRSS:
|
||||
except:
|
||||
with open(EnvInfo.rule_path) as r:
|
||||
self.rules = json.load(r)
|
||||
rss = requests.get(EnvInfo.rss_link, 'utf-8')
|
||||
try:
|
||||
rss = requests.get(EnvInfo.rss_link, 'utf-8')
|
||||
except:
|
||||
print(f"[{EnvInfo.time_show_obj}] ERROR with DNS/Connection.")
|
||||
quit()
|
||||
soup = BeautifulSoup(rss.text, 'xml')
|
||||
self.items = soup.find_all('item')
|
||||
with open(EnvInfo.info_path) as i:
|
||||
@@ -79,7 +84,7 @@ class CollectRSS:
|
||||
if exit_flag:
|
||||
break
|
||||
if not exit_flag:
|
||||
sys.stdout.write(f"[{EnvInfo.time_show_obj}] ERROR Not match with {name}")
|
||||
print(f"[{EnvInfo.time_show_obj}] ERROR Not match with {name}")
|
||||
|
||||
def put_info_json(self):
|
||||
had_data = []
|
||||
@@ -107,8 +112,7 @@ class CollectRSS:
|
||||
"added": False
|
||||
})
|
||||
had_data.append(json_title)
|
||||
sys.stdout.write(f"[{EnvInfo.time_show_obj}] add {json_title} {json_season}" + "\n")
|
||||
sys.stdout.flush()
|
||||
print(f"[{EnvInfo.time_show_obj}] add {json_title} {json_season}")
|
||||
with open(EnvInfo.info_path, 'w', encoding='utf8') as f:
|
||||
json.dump(self.info, f, indent=4, separators=(',', ': '), ensure_ascii=False)
|
||||
|
||||
@@ -118,14 +122,14 @@ class CollectRSS:
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
rss = requests.get(EnvInfo.rss_link, 'utf-8')
|
||||
soup = BeautifulSoup(rss.text, 'xml')
|
||||
items = soup.find_all('item')
|
||||
for item in items:
|
||||
name = item.title.string
|
||||
print(BColors.HEADER + name + BColors.OKGREEN)
|
||||
pn = Filter(name).Name
|
||||
print(pn.clean)
|
||||
|
||||
# print(BColors.HEADER + name)
|
||||
# print(BColors.OKGREEN + str(pn.Name.en))
|
||||
# rss = requests.get(EnvInfo.rss_link, 'utf-8')
|
||||
# soup = BeautifulSoup(rss.text, 'xml')
|
||||
# items = soup.find_all('item')
|
||||
# for item in items:
|
||||
# name = item.title.string
|
||||
# pn = Filter(name).Name
|
||||
# print(BColors.HEADER + name)
|
||||
# print(BColors.OKGREEN + str(pn.zh))
|
||||
# print(str(pn.en))
|
||||
print(__file__)
|
||||
print(os.path.dirname(__file__))
|
||||
|
||||
@@ -54,7 +54,7 @@ class qBittorrentRename:
|
||||
def rename(self):
|
||||
if self.path_name != self.new_name:
|
||||
self.qbt_client.torrents_rename_file(torrent_hash=self.hash, old_path=self.path_name, new_path=self.new_name)
|
||||
sys.stdout.write(f"[{time.strftime('%Y-%m-%d %X')}] {self.path_name} >> {self.new_name}" + "\n")
|
||||
print(f"[{time.strftime('%Y-%m-%d %X')}] {self.path_name} >> {self.new_name}")
|
||||
self.count += 1
|
||||
else:
|
||||
return
|
||||
|
||||
11
README.md
11
README.md
@@ -125,5 +125,16 @@ docker run -d \
|
||||
|
||||
4. 安装媒体库软件
|
||||
|
||||
## Roadmap
|
||||
|
||||
***开发中的功能:***
|
||||
- RSS 解析器:AutoBangumi 可以自行解析分析种子无需依赖下载器。
|
||||
- Transmission & Aria2 的支持。
|
||||
- 遗漏番剧下载:中间开始追番可以补全之前的剧集。
|
||||
|
||||
***计划开发的功能:***
|
||||
- Web UI
|
||||
- 更为智能细致的分类预设。
|
||||
|
||||
# 声明
|
||||
本项目的自动改名规则根据 [miracleyoo/anime_renamer](https://github.com/miracleyoo/anime_renamer) 项目
|
||||
|
||||
Reference in New Issue
Block a user