diff --git a/1.png b/1.png deleted file mode 100644 index 466e254..0000000 Binary files a/1.png and /dev/null differ diff --git a/AV_Data_Capture.py b/AV_Data_Capture.py index 58003eb..6ce94c1 100755 --- a/AV_Data_Capture.py +++ b/AV_Data_Capture.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python3 +#!/usr/bin/env python3 # -*- coding: utf-8 -*- import glob @@ -10,6 +10,7 @@ from ADC_function import * import json import shutil from configparser import ConfigParser +import fnmatch os.chdir(os.getcwd()) # ============global var=========== @@ -18,11 +19,25 @@ version='1.3' config = ConfigParser() config.read(config_file, encoding='UTF-8') - +fromPath=config['movie']['path'] Platform = sys.platform # ==========global var end========= +def moveMovies(fromPath): + movieFiles = [] + if Platform == 'win32': + movieFormat = ["avi", "rmvb", "wmv", "mov", "mp4", "mkv", "flv", "ts"] + else: + movieFormat = ["AVI", "RMVB", "WMV", "MOV", "MP4", "MKV", "FLV", "TS","avi", "rmvb", "wmv", "mov", "mp4", "mkv", "flv", "ts"] + for fm in movieFormat: + movieFiles = movieFiles + [os.path.join(dirpath, f) + for dirpath, dirnames, files in os.walk(fromPath) + for f in fnmatch.filter(files, '*.' + fm)] + print(movieFiles) + for movie in movieFiles: + print("Move file " + movie) + shutil.move(movie, os.path.curdir) def UpdateCheck(): if UpdateCheckSwitch() == '1': html2 = get_html('https://raw.githubusercontent.com/yoshiko2/AV_Data_Capture/master/update_check.json') @@ -128,6 +143,7 @@ if __name__ =='__main__': print('[*]=====================================') CreatFailedFolder() UpdateCheck() + moveMovies(fromPath) os.chdir(os.getcwd()) count = 0 diff --git a/config.ini b/config.ini index 6e86596..70e9beb 100644 --- a/config.ini +++ b/config.ini @@ -25,3 +25,6 @@ directory= [escape] literals=\() + +[movie] +path=/root/sort/test diff --git a/moveVideos.ps1 b/moveVideos.ps1 deleted file mode 100644 index ec22917..0000000 --- a/moveVideos.ps1 +++ /dev/null @@ -1,29 +0,0 @@ -# The video format you want to move. -$videoFormatLists=("mp4","wmv") -# Source video directory -$fromDir="X:\av" -# Target video directory(path to AVData) -$toDir="X:\AVData" - -function moveVideos ($fromDir, $toDir,$videoFormat) { - $list=@(Get-ChildItem -Path $fromDir -Recurse -File -Include "*.$videoFormat" | ForEach-Object {$_.FullName}) - $list.Length - - # Only one video to move. - if ($list.Length -eq 1) { - Move-Item $list.Replace("`[","``[").Replace("`]","``]") $toDir - # More than one videos to move. - } else { - for($idx=0; $idx -lt $list.Length; $idx++) { - echo "Move file $list[$idx].Replace("`[","``[").Replace("`]","``]") to $toDir" - # escapse [ ] - Move-Item $list[$idx].Replace("`[","``[").Replace("`]","``]") $toDir - } - } -} - -# Move videos -for($idy=0; $idy -lt $videoFormatLists.Length; $idy++) { - moveVideos $fromDir $toDir $videoFormatLists[$idy] -} -