Skip to content

Commit

Permalink
3.9
Browse files Browse the repository at this point in the history
  • Loading branch information
moyy996 committed Mar 16, 2020
1 parent 416cc1d commit 578f6ae
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
25 changes: 12 additions & 13 deletions AVDC_Main.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ def Load_Config(self):
self.Ui.lineEdit_local_name.setText(config['Name_Rule']['naming_file'])
self.Ui.lineEdit_emby_url.setText(config['emby']['emby_url'])
self.Ui.lineEdit_api_key.setText(config['emby']['api_key'])
self.Ui.lineEdit_movie_path.setText(config['media']['media_path'])
self.Ui.lineEdit_movie_path.setText(str(config['media']['media_path']).replace('\\', '/'))
self.Ui.lineEdit_movie_type.setText(config['media']['media_type'])

# ========================================================================显示版本号
Expand Down Expand Up @@ -1093,7 +1093,7 @@ def creatFolder(self, success_folder, json_data, config):
if len(path) > 100: # 文件夹名过长 取标题前70个字符
self.add_text_main('[-]Error in Length of Path! Cut title!')
path = path.replace(title, title[0:70])
path = self.Ui.lineEdit_movie_path.text() + '/' + success_folder + '/' + path
path = success_folder + '/' + path
path = path.replace('//', '/').replace('--', '-').strip('-')
if not os.path.exists(path):
path = escapePath(path, config)
Expand Down Expand Up @@ -1158,7 +1158,7 @@ def Core_Main(self, file_path, number_th, mode, count):
elif self.Ui.radioButton_sort.isChecked():
program_mode = 2
movie_path = self.Ui.lineEdit_movie_path.text()
success_folder = self.Ui.lineEdit_success.text() # 成功输出目录
success_folder = movie_path + '/' + self.Ui.lineEdit_success.text() # 成功输出目录
failed_folder = movie_path + '/' + self.Ui.lineEdit_fail.text() # 失败输出目录
# =======================================================================获取json_data
json_data = self.get_json_data(mode, number, Config)
Expand Down Expand Up @@ -1251,28 +1251,27 @@ def CreatFailedFolder(self, failed_folder):
if self.Ui.radioButton_fail_move_on.isChecked() and not os.path.exists(failed_folder + '/'):
try:
os.makedirs(failed_folder + '/')
self.add_text_main('[+]Created folder named' + failed_folder + '!')
self.add_text_main('[+]Created folder named ' + failed_folder + '!')
except Exception as error_info:
self.add_text_main('[-]Error in CreatFailedFolder: ' + str(error_info))

# ========================================================================删除空目录
def CEF(self, path):
if os.path.exists(path):
dirs = os.listdir(path) # 获取路径下的子文件(夹)列表
for dir in dirs:
try:
os.removedirs(path + '/' + dir) # 删除这个空文件夹
self.add_text_main('[+]Deleting empty folder ' + path + '/' + dir)
except:
delete_empty_folder_failed = ''
for root, dirs, files in os.walk(path):
for dir in dirs:
try:
os.removedirs(root.replace('\\', '/') + '/' + dir) # 删除这个空文件夹
self.add_text_main('[+]Deleting empty folder ' + root.replace('\\', '/') + '/' + dir)
except:
delete_empty_folder_failed = ''

def AVDC_Main(self):
# =======================================================================初始化所需变量
config_file = 'config.ini'
config = ConfigParser()
config.read(config_file, encoding='UTF-8')
movie_path = self.Ui.lineEdit_movie_path.text()
success_folder = self.Ui.lineEdit_success.text()
failed_folder = movie_path + '/' + self.Ui.lineEdit_fail.text() # 失败输出目录
escape_folder = self.Ui.lineEdit_escape_dir.text() # 多级目录刮削需要排除的目录
mode = self.Ui.comboBox_website_all.currentIndex() + 1
Expand Down Expand Up @@ -1332,7 +1331,7 @@ def AVDC_Main(self):
self.add_text_main("[*]======================================================")
self.progressBarValue.emit(int(value))
self.Ui.pushButton_start_cap.setEnabled(True)
self.CEF(success_folder)
self.CEF(movie_path)
self.add_text_main("[+]All finished!!!")
self.add_text_main("[*]======================================================")

Expand Down
2 changes: 1 addition & 1 deletion config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ save_log = 1

[media]
media_type = .mp4|.avi|.rmvb|.wmv|.mov|.mkv|.flv|.ts|.webm|.MP4|.AVI|.RMVB|.WMV|.MOV|.MKV|.FLV|.TS|.WEBM
media_path = C:\Users\mo_yy\Desktop\文档\AVDC\AVDC-3.81-New
media_path = D:\Downoad\Movie
media_warehouse = emby
# emby or plex or kodi ,emby = jellyfin

Expand Down

0 comments on commit 578f6ae

Please sign in to comment.