Skip to content

Commit

Permalink
Update 1.4
Browse files Browse the repository at this point in the history
  • Loading branch information
mvdctop authored Nov 4, 2019
1 parent 7beeee2 commit 71d44bf
Show file tree
Hide file tree
Showing 4 changed files with 766 additions and 631 deletions.
26 changes: 18 additions & 8 deletions ADC_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,15 @@
except:
print('[-]Config.ini read failed! Please use the offical file!')
else:
print('[+]config.ini: not found, creating...')
print('[+]config.ini: not found, creating...',end='')
with open("config.ini", "wt", encoding='UTF-8') as code:
print("[common]", file=code)
print("main_mode = 1", file=code)
print("failed_output_folder = failed", file=code)
print("success_output_folder = JAV_output", file=code)
print("", file=code)
print("[proxy]",file=code)
print("proxy=127.0.0.1:1080",file=code)
print("proxy=127.0.0.1:1081",file=code)
print("timeout=10", file=code)
print("retry=3", file=code)
print("", file=code)
Expand All @@ -33,16 +38,21 @@
print("", file=code)
print("[media]", file=code)
print("media_warehouse=emby", file=code)
print("#emby or plex", file=code)
print("#plex only test!", file=code)
print("#emby plex kodi", file=code)
print("", file=code)
print("[escape]", file=code)
print("literals=\\", file=code)
print("", file=code)
print("[directory_capture]", file=code)
print("switch=0", file=code)
print("directory=", file=code)
print("[movie_location]", file=code)
print("path=", file=code)
print("", file=code)
print("everyone switch:1=on, 0=off", file=code)
print('.',end='')
time.sleep(2)
print('.')
print('[+]config.ini: created!')
print('[+]Please restart the program!')
time.sleep(4)
os._exit(0)
try:
config.read(config_file, encoding='UTF-8')
except:
Expand Down
36 changes: 11 additions & 25 deletions AV_Data_Capture.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import glob
Expand All @@ -9,23 +9,24 @@
from ADC_function import *
import json
import shutil
from configparser import ConfigParser
import fnmatch
from configparser import ConfigParser
os.chdir(os.getcwd())

# ============global var===========

version='1.3'
version='1.4'

config = ConfigParser()
config.read(config_file, encoding='UTF-8')
fromPath=config['movie']['path']

Platform = sys.platform

# ==========global var end=========

def moveMovies(fromPath):
def moveMovies():
movieFiles = []
fromPath = config['movie_location']['path']
if Platform == 'win32':
movieFormat = ["avi", "rmvb", "wmv", "mov", "mp4", "mkv", "flv", "ts"]
else:
Expand All @@ -34,13 +35,10 @@ def moveMovies(fromPath):
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:
movieName = movie.split('/')[-1]
print("Move file " + movieName)
if (os.path.exists(os.path.curdir + '/' + movieName)):
print(movieName + "exists, skip.")
else:
shutil.move(movie, os.path.curdir)
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')
Expand All @@ -56,24 +54,12 @@ def UpdateCheck():
def movie_lists():
global exclude_directory_1
global exclude_directory_2
directory = config['directory_capture']['directory']
total=[]
file_type = ['mp4','avi','rmvb','wmv','mov','mkv','flv','ts']
exclude_directory_1 = config['common']['failed_output_folder']
exclude_directory_2 = config['common']['success_output_folder']
if directory=='*':
remove_total = []
for o in file_type:
remove_total += glob.glob(r"./" + exclude_directory_1 + "/*." + o)
remove_total += glob.glob(r"./" + exclude_directory_2 + "/*." + o)
for i in os.listdir(os.getcwd()):
for a in file_type:
total += glob.glob(r"./" + i + "/*." + a)
for b in remove_total:
total.remove(b)
return total
for a in file_type:
total += glob.glob(r"./" + directory + "/*." + a)
total += glob.glob(r"./*." + a)
return total
def CreatFailedFolder():
if not os.path.exists('failed/'): # 新建failed文件夹
Expand Down Expand Up @@ -146,7 +132,7 @@ def RunCore():
print('[*]=====================================')
CreatFailedFolder()
UpdateCheck()
moveMovies(fromPath)
moveMovies()
os.chdir(os.getcwd())

count = 0
Expand Down
Loading

0 comments on commit 71d44bf

Please sign in to comment.