1
0
mirror of https://github.com/Melon-Bread/RetroUFO synced 2024-11-25 00:38:33 -05:00

Added some useless comments 📝

This commit is contained in:
Rain Clark 2018-10-15 23:21:33 -04:00
parent 886b739897
commit a2dbf60288

View File

@ -32,13 +32,16 @@ def download_cores():
cores = [] cores = []
# Makes core directory to store archives if needed
if not os.path.isdir('cores'): if not os.path.isdir('cores'):
os.makedirs("cores") os.makedirs("cores")
# Downloads a list of all the cores available
urlretrieve('{}/{}/latest/.index-extended'.format(URL, PLATFORM), urlretrieve('{}/{}/latest/.index-extended'.format(URL, PLATFORM),
'cores/index') 'cores/index')
print('Obtained core index!') print('Obtained core index!')
# Adds all the core's file names to a list
core_index = open('cores/index') core_index = open('cores/index')
for line in core_index: for line in core_index:
@ -47,17 +50,20 @@ def download_cores():
core_index.close() core_index.close()
cores.sort() cores.sort()
# Downloads each core from the list
for core in cores: for core in cores:
urlretrieve('{}/{}/latest/{}'.format(URL, PLATFORM, core), urlretrieve('{}/{}/latest/{}'.format(URL, PLATFORM, core),
'cores/{}'.format(core)) 'cores/{}'.format(core))
print('Downloaded {} ...'.format(core)) print('Downloaded {} ...'.format(core))
# Removes index file for easier extraction
os.remove('cores/index') os.remove('cores/index')
def extract_cores(): def extract_cores():
""" Extracts each downloaded core to the RA core directory """ """ Extracts each downloaded core to the RA core directory """
print('Extracting all cores to: {}'.format(CORE_LOCATION)) print('Extracting all cores to: {}'.format(CORE_LOCATION))
for file in os.listdir('cores'): for file in os.listdir('cores'):
archive = zipfile.ZipFile('cores/{}'.format(file)) archive = zipfile.ZipFile('cores/{}'.format(file))
archive.extractall(CORE_LOCATION) archive.extractall(CORE_LOCATION)