[gpEdit v1.0]
- Refectored code.
This commit is contained in:
+21
-22
@@ -5,42 +5,41 @@ import os.path
|
|||||||
import shutil
|
import shutil
|
||||||
|
|
||||||
media_dir = "//sr3//home//Temp//"
|
media_dir = "//sr3//home//Temp//"
|
||||||
file_remove = "-edited"
|
media_list = []
|
||||||
edited_list = []
|
vanilla_media_list = []
|
||||||
vanilla_list = []
|
|
||||||
|
|
||||||
file_move_cnt = 0
|
file_move_cnt = 0
|
||||||
|
|
||||||
|
|
||||||
def get_list_of_files():
|
def build_media():
|
||||||
global edited_list
|
global media_list
|
||||||
edited_list = glob.glob(media_dir + "*", recursive=True)
|
media_list = glob.glob(media_dir + "*", recursive=True)
|
||||||
|
|
||||||
|
|
||||||
def find_vanilla_files():
|
def build_vanilla_media():
|
||||||
global vanilla_list, edited_list, file_remove
|
global vanilla_media_list, media_list
|
||||||
for x in edited_list:
|
for x in media_list:
|
||||||
c_file = str(x).replace(file_remove, "")
|
c_file = str(x).replace("-edited", "")
|
||||||
if os.path.isfile(c_file):
|
if os.path.isfile(c_file):
|
||||||
if not vanilla_list.__contains__(c_file):
|
if not vanilla_media_list.__contains__(c_file):
|
||||||
vanilla_list.append(c_file)
|
vanilla_media_list.append(c_file)
|
||||||
|
|
||||||
|
|
||||||
def move_vanilla_files():
|
def move_vanilla_media():
|
||||||
global media_dir, vanilla_list, file_move_cnt
|
global media_dir, vanilla_media_list, file_move_cnt
|
||||||
del_dir = media_dir + "ToDelete\\"
|
dest_dir = media_dir + "_VanillaMedia\\"
|
||||||
|
|
||||||
if not os.path.exists(del_dir):
|
if not os.path.exists(dest_dir):
|
||||||
os.mkdir(del_dir)
|
os.mkdir(dest_dir)
|
||||||
|
|
||||||
for x in vanilla_list:
|
for x in vanilla_media_list:
|
||||||
shutil.move(x, del_dir)
|
shutil.move(x, dest_dir)
|
||||||
file_move_cnt += 1
|
file_move_cnt += 1
|
||||||
print("Moving " + str(x))
|
print("Moving " + str(x))
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
get_list_of_files()
|
build_media()
|
||||||
find_vanilla_files()
|
build_vanilla_media()
|
||||||
move_vanilla_files()
|
move_vanilla_media()
|
||||||
print("Finished moving " + str(file_move_cnt) + " file(s).")
|
print("Finished moving " + str(file_move_cnt) + " file(s).")
|
||||||
|
|||||||
Reference in New Issue
Block a user