Afegit ordenat per any
This commit is contained in:
@@ -43,7 +43,9 @@ Exemple de fitxer .env
|
|||||||
|
|
||||||
SHOULD_CLEAR_DESTINATION_PATH=True
|
SHOULD_CLEAR_DESTINATION_PATH=True
|
||||||
SHOULD_SPLIT_MODERN_AND_CLASSIC=True
|
SHOULD_SPLIT_MODERN_AND_CLASSIC=True
|
||||||
|
SHOULD_SORT_BY_YEAR=True
|
||||||
SHOULD_SORT_BY_LETTER=True
|
SHOULD_SORT_BY_LETTER=True
|
||||||
|
|
||||||
WAIT=True
|
WAIT=True
|
||||||
MIN_WAIT=2
|
MIN_WAIT=2
|
||||||
MAX_WAIT=4
|
MAX_WAIT=4
|
||||||
|
|||||||
+7
-2
@@ -138,7 +138,7 @@ WHERE
|
|||||||
ORDER BY
|
ORDER BY
|
||||||
e.title;
|
e.title;
|
||||||
|
|
||||||
-- Consulta 3: ZXNEXT - Devuelve juegos de ZX-Spectrum y solo archivos de cinta o pokes
|
-- Consulta 3: ZXNEXT - Devuelve juegos de ZX-Spectrum y solo archivos de cinta disco o pokes
|
||||||
SELECT DISTINCT
|
SELECT DISTINCT
|
||||||
e.title,
|
e.title,
|
||||||
l.name,
|
l.name,
|
||||||
@@ -175,7 +175,12 @@ WHERE
|
|||||||
OR e.availabletype_id = 'D'
|
OR e.availabletype_id = 'D'
|
||||||
)
|
)
|
||||||
AND (
|
AND (
|
||||||
f.text IN ('Tape image', 'Snapshot image', 'POK pokes file')
|
f.text IN (
|
||||||
|
'Tape image',
|
||||||
|
'Disk image',
|
||||||
|
'Snapshot image',
|
||||||
|
'POK pokes file'
|
||||||
|
)
|
||||||
)
|
)
|
||||||
AND r.release_seq = 0
|
AND r.release_seq = 0
|
||||||
AND (
|
AND (
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ temp_file = os.getenv('TEMP_FILE')
|
|||||||
# Parametros de configuración
|
# Parametros de configuración
|
||||||
should_clear_destination_path = os.getenv('SHOULD_CLEAR_DESTINATION_PATH') == 'True' # Establece si se limpia primero la carpeta de destino
|
should_clear_destination_path = os.getenv('SHOULD_CLEAR_DESTINATION_PATH') == 'True' # Establece si se limpia primero la carpeta de destino
|
||||||
should_split_modern_and_classic = os.getenv('SHOULD_SPLIT_MODERN_AND_CLASSIC') == 'True'# Separa los juegos en dos carpetas a partir de un año especificado
|
should_split_modern_and_classic = os.getenv('SHOULD_SPLIT_MODERN_AND_CLASSIC') == 'True'# Separa los juegos en dos carpetas a partir de un año especificado
|
||||||
|
should_sort_by_year = os.getenv('SHOULD_SORT_BY_YEAR') == 'True' # Separa los juegos por carpetas en función de su año de lanzamiento
|
||||||
should_sort_by_letter = os.getenv('SHOULD_SORT_BY_LETTER') == 'True' # Separa los juegos por carpetas en función de su primera letra
|
should_sort_by_letter = os.getenv('SHOULD_SORT_BY_LETTER') == 'True' # Separa los juegos por carpetas en función de su primera letra
|
||||||
wait = os.getenv('WAIT') == 'True' # Establece una pausa aleatoria entre descargas
|
wait = os.getenv('WAIT') == 'True' # Establece una pausa aleatoria entre descargas
|
||||||
min_wait = int(os.getenv('MIN_WAIT')) # Cantidad de segundos mínima a esperar entre descargas
|
min_wait = int(os.getenv('MIN_WAIT')) # Cantidad de segundos mínima a esperar entre descargas
|
||||||
@@ -201,24 +202,32 @@ def print_status(current_file, total_files, element, total_files_width, status="
|
|||||||
|
|
||||||
# Compone la carpeta de destino en función de varios parámetros
|
# Compone la carpeta de destino en función de varios parámetros
|
||||||
def get_final_destination_folder(year, root_folder):
|
def get_final_destination_folder(year, root_folder):
|
||||||
# Prefijo basado en el año
|
# Carpeta basada en los años de vida comercial del spectrum
|
||||||
prefix1 = ""
|
folder1 = ""
|
||||||
if should_split_modern_and_classic:
|
if should_split_modern_and_classic:
|
||||||
if year == "none" or year is None or year > last_classic_year:
|
if year == "none" or year is None or year > last_classic_year:
|
||||||
prefix1 = "modern"
|
folder1 = "modern"
|
||||||
else:
|
else:
|
||||||
prefix1 = "classics"
|
folder1 = "classics"
|
||||||
|
|
||||||
# Prefijo basado en la primera letra del nombre de la carpeta raíz
|
# Carpeta basada en el año de lanzamiento
|
||||||
prefix2 = ""
|
folder2 = ""
|
||||||
|
if should_sort_by_year:
|
||||||
|
folder2 = str(year) if year not in [None, "none"] else "unknown"
|
||||||
|
|
||||||
|
# Carpeta basada en la primera letra del nombre de la carpeta raíz
|
||||||
|
folder3 = ""
|
||||||
if should_sort_by_letter:
|
if should_sort_by_letter:
|
||||||
if root_folder[0].isdigit():
|
if root_folder[0].isdigit():
|
||||||
prefix2 = "0-9"
|
folder3 = "0-9"
|
||||||
else:
|
else:
|
||||||
prefix2 = root_folder[0].upper()
|
folder3 = root_folder[0].upper()
|
||||||
|
|
||||||
|
# Asegurarse de que root_folder es una cadena
|
||||||
|
root_folder = root_folder or ""
|
||||||
|
|
||||||
# Combina los prefijos y la carpeta raíz para obtener la carpeta de destino final
|
# Combina los prefijos y la carpeta raíz para obtener la carpeta de destino final
|
||||||
return os.path.join(prefix1, prefix2, root_folder)
|
return os.path.join(folder1, folder2, folder3, root_folder)
|
||||||
|
|
||||||
|
|
||||||
# Crea las carpetas de destino y copia o extrae el archivo de la caché
|
# Crea las carpetas de destino y copia o extrae el archivo de la caché
|
||||||
@@ -349,7 +358,7 @@ def print_elements(mode=0):
|
|||||||
def main():
|
def main():
|
||||||
connect(query_index=3)
|
connect(query_index=3)
|
||||||
process_elements()
|
process_elements()
|
||||||
print_elements(mode=1)
|
#print_elements(mode=1)
|
||||||
clear_destination_folder()
|
clear_destination_folder()
|
||||||
get_files()
|
get_files()
|
||||||
remove_empty_directories(destination_path)
|
remove_empty_directories(destination_path)
|
||||||
|
|||||||
Reference in New Issue
Block a user