Ungrave
Well-known member
- Joined
- Jan 1, 2019
- Messages
- 14
- Points
- 68
for folder in os.listdir(source_folder):
iteration = 0
for file in os.listdir((source_folder+'\\'+folder)):
targetfile = ''
if (file[-4:].lower() == '.osu'):
current_path = source_folder+'\\'+folder+'\\'+file
temp = open_osu_file(current_path)
if '.mp3' in temp.lower():
target_file = temp[temp.find('AudioFilename:')+15:temp.lower().find('.mp3')+4]
filetype = '.mp3'
elif '.ogg' in temp.lower():
target_file = temp[temp.find('AudioFilename:')+15:temp.lower().find('.ogg')+4]
filetype = '.ogg'
else:
print("Filetype not supported", target_file)
break
title = get_title(temp).replace(':', '፥').replace('<', '[').replace('>', ']' \
).replace('/', '/').replace('*', '°').replace('?', '⸮').replace('"','\''\
)
artist = get_artist(temp)
source_path = source_folder+'\\'+folder+'\\'+target_file
target_path = output_folder+'\\'+title+filetype
print(target_path)
print("Attempting to move",source_path,'to', target_path)
try:
copyfile(source_path, target_path)
except:
print("failed to move",source_path,'to', target_path)
break
iteration = iteration + 1
iteration = 0
for file in os.listdir((source_folder+'\\'+folder)):
targetfile = ''
if (file[-4:].lower() == '.osu'):
current_path = source_folder+'\\'+folder+'\\'+file
temp = open_osu_file(current_path)
if '.mp3' in temp.lower():
target_file = temp[temp.find('AudioFilename:')+15:temp.lower().find('.mp3')+4]
filetype = '.mp3'
elif '.ogg' in temp.lower():
target_file = temp[temp.find('AudioFilename:')+15:temp.lower().find('.ogg')+4]
filetype = '.ogg'
else:
print("Filetype not supported", target_file)
break
title = get_title(temp).replace(':', '፥').replace('<', '[').replace('>', ']' \
).replace('/', '/').replace('*', '°').replace('?', '⸮').replace('"','\''\
)
artist = get_artist(temp)
source_path = source_folder+'\\'+folder+'\\'+target_file
target_path = output_folder+'\\'+title+filetype
print(target_path)
print("Attempting to move",source_path,'to', target_path)
try:
copyfile(source_path, target_path)
except:
print("failed to move",source_path,'to', target_path)
break
iteration = iteration + 1