From b4898e32a56d0f75f55d0c70af74bf1b6a7c507a Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Wed, 23 Jan 2019 20:23:30 +0800 Subject: [PATCH] Update qbittorrent_worker.py --- .../qbittorrent/workers/qbittorrent_worker.py | 28 +++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/plugins/qbittorrent/workers/qbittorrent_worker.py b/plugins/qbittorrent/workers/qbittorrent_worker.py index 5b223647c..354a26533 100755 --- a/plugins/qbittorrent/workers/qbittorrent_worker.py +++ b/plugins/qbittorrent/workers/qbittorrent_worker.py @@ -117,8 +117,32 @@ class downloadBT(Thread): print cmd print self.execShell(cmd) - def video_do(self, dir): - + def file_arr(self, path, filters=['.DS_Store']): + file_list = [] + flist = os.listdir(path) + # print flist + for i in range(len(flist)): + file_path = os.path.join(path, flist[i]) + if flist[i] in filters: + continue + if os.path.isdir(file_path): + tmp = self.file_arr(file_path, filters) + file_list.extend(tmp) + else: + file_list.append(file_path) + return file_list + + def file_video(self.path, has=['.mp4']): + flist = self.file_arr(path) + video = [] + for i in range(len(flist)): + t = os.path.splitext(flist[i]) + if t[1] in has: + video.append(flist[i]) + return video + + def video_do(self, path): + print self.file_video(path) # self.ffmpeg('/Users/midoks/Desktop/www/btplayer/public/video/test.mp4') return ''