I broke some code here but it's fine, implemented getLatestVersion_by_number

This commit is contained in:
Chloe Fontenot 🏳️‍⚧️ 2022-03-16 19:22:47 -05:00
parent 0463ddc75f
commit 3412152ca3
2 changed files with 18 additions and 2 deletions

18
mcUp.py
View File

@ -7,6 +7,7 @@ import requests
from re import sub from re import sub
import parsers.paperMC import parsers.paperMC
import parsers.modrinth import parsers.modrinth
import parsers.curseforge
import argparse import argparse
import shutil import shutil
import hashlib import hashlib
@ -116,11 +117,26 @@ def modrinth(project, action, subAction):
download(project, parsers.modrinth.getLatestVersion(project)) download(project, parsers.modrinth.getLatestVersion(project))
#print(parsers.modrinth.getForMinecraftVersion(project, args.v)) #print(parsers.modrinth.getForMinecraftVersion(project, args.v))
# CurseForge command functions
def curseforge(project, action, subAction):
import json
if action == "get":
if subAction == "games":
print(parsers.curseforge.get_games())
if subAction == "mod":
print(json.dumps(parsers.curseforge.get_mod(project), indent=4))
if action == "search":
if subAction == "mod":
print(json.dumps(parsers.curseforge.search_mods(project), indent=4))
if action == "download":
if subAction == "latest":
print(parsers.curseforge.download(project))
# Determine which API parser to use: # Determine which API parser to use:
if args.api == "paperMC": if args.api == "paperMC":
paperMC(args.project, args.action, args.subAction) paperMC(args.project, args.action, args.subAction)
elif args.api == "modrinth": elif args.api == "modrinth":
modrinth(args.project, args.action, args.subAction) modrinth(args.project, args.action, args.subAction)
elif args.api == "curseforge":
curseforge(args.project, args.action, args.subAction)
else: else:
print("Error: Unknown API: "+args.api) print("Error: Unknown API: "+args.api)

View File

@ -19,7 +19,7 @@ if debug == True:
requests_log = logging.getLogger("requests.packages.urllib3") requests_log = logging.getLogger("requests.packages.urllib3")
requests_log.setLevel(logging.DEBUG) requests_log.setLevel(logging.DEBUG)
requests_log.propagate = True requests_log.propagate = True
timeoutTime = 1
#Setup re #Setup re
#regex = re.compile(r'*') #regex = re.compile(r'*')
# Setup session, this lets the parser re-use the connection instead of establishing a new connection for EACH request, not only does this cause a HUGE performance boost, it's also nicer to the API. # Setup session, this lets the parser re-use the connection instead of establishing a new connection for EACH request, not only does this cause a HUGE performance boost, it's also nicer to the API.