diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..35410ca
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,8 @@
+# 默认忽略的文件
+/shelf/
+/workspace.xml
+# 基于编辑器的 HTTP 客户端请求
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
new file mode 100644
index 0000000..22cdf9b
--- /dev/null
+++ b/.idea/inspectionProfiles/Project_Default.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml
new file mode 100644
index 0000000..105ce2d
--- /dev/null
+++ b/.idea/inspectionProfiles/profiles_settings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..db8786c
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..4eb1f8c
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/plex_localization_zhcn.iml b/.idea/plex_localization_zhcn.iml
new file mode 100644
index 0000000..7b40359
--- /dev/null
+++ b/.idea/plex_localization_zhcn.iml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..35eb1dd
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/plex_localization_zhcn.py b/plex_localization_zhcn.py
index f8516db..0522a78 100644
--- a/plex_localization_zhcn.py
+++ b/plex_localization_zhcn.py
@@ -127,7 +127,15 @@ def select_library(self, index=None):
echo = [f"{library[0]}> {library[2]} <{library[3]}>" for library in libraries.values()]
- index = index if index else int(input("\n" + "\n".join(echo) + "\n请选择库:"))
+ if index:
+ pass
+ else:
+ while True:
+ try:
+ index = int(input("\n" + "\n".join(echo) + "\n请选择库:"))
+ break
+ except ValueError:
+ print("格式不正确,需要输入整数数字。")
action_key, action_type = index, libraries[index][1]
@@ -211,9 +219,16 @@ def operate_item(self, rating_key):
def loop_all(self, library_id: int = None, thread_count: int = None):
"""选择媒体库并遍历其中的每一个媒体。"""
- if not thread_count:
- thread_count = input("\n请输入运行的线程数(输入整数数字,默认为2):")
- thread_count = int(thread_count if thread_count else 2)
+
+ if thread_count:
+ pass
+ else:
+ while True:
+ try:
+ thread_count = int(input("\n请输入运行的线程数(输入整数数字,默认为2):"))
+ break
+ except ValueError:
+ print("格式不正确,需要输入整数数字。")
if library_id == 999:
libraries = self.list_libraries().values()
diff --git a/requirements.txt b/requirements.txt
new file mode 100644
index 0000000..2eb2a7e
--- /dev/null
+++ b/requirements.txt
@@ -0,0 +1,2 @@
+pypinyin>=0.50.0
+requests>=2.31.0
\ No newline at end of file