init
This commit is contained in:
2
common/__init__.py
Normal file
2
common/__init__.py
Normal file
@ -0,0 +1,2 @@
|
||||
from .get_content import get_content
|
||||
from .same_name_alert import same_name_alert
|
13
common/get_content.py
Normal file
13
common/get_content.py
Normal file
@ -0,0 +1,13 @@
|
||||
import os
|
||||
|
||||
|
||||
def get_content(source):
|
||||
files = []
|
||||
folders = []
|
||||
|
||||
for f in os.listdir(source):
|
||||
if os.path.isfile(os.path.join(source, f)):
|
||||
files.append(f)
|
||||
else:
|
||||
folders.append(f)
|
||||
return files, folders
|
24
common/same_name_alert.py
Normal file
24
common/same_name_alert.py
Normal file
@ -0,0 +1,24 @@
|
||||
import os
|
||||
|
||||
|
||||
def same_name_alert(oldfile, newfile):
|
||||
print("Old: {}".format(oldfile))
|
||||
print("New: {}".format(newfile))
|
||||
print("File existed, overwrite?")
|
||||
print("'y' for yes")
|
||||
print("'m' to view more data")
|
||||
print("'l' to listen to two song")
|
||||
while True:
|
||||
ans = input("Answer: ")
|
||||
if ans == 'y':
|
||||
os.rename(oldfile, newfile)
|
||||
break
|
||||
elif ans == 'm':
|
||||
print("Old file data:")
|
||||
print("New file data:")
|
||||
elif ans == 'l':
|
||||
print("Listen to song 1")
|
||||
print("Listen to song 2")
|
||||
else:
|
||||
break
|
||||
return
|
Reference in New Issue
Block a user