mirror of
https://github.com/Neocky/pluGET.git
synced 2024-04-29 16:12:30 +00:00
Added initial files
Added: - consoleouput.py - plugin_downloader.py
This commit is contained in:
parent
a2bd1d0a7b
commit
34e53f4861
4
.vscode/settings.json
vendored
Normal file
4
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"python.linting.pylintEnabled": true,
|
||||||
|
"python.linting.enabled": true
|
||||||
|
}
|
36
consoleoutput.py
Normal file
36
consoleoutput.py
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
# Handles the console output
|
||||||
|
from os import system
|
||||||
|
from os import name
|
||||||
|
|
||||||
|
def consoleTitle():
|
||||||
|
system("title " + "🧱 pluGET by Neocky")
|
||||||
|
|
||||||
|
|
||||||
|
def clearConsole():
|
||||||
|
system('cls' if name=='nt' else 'clear')
|
||||||
|
|
||||||
|
|
||||||
|
def printLogo():
|
||||||
|
print()
|
||||||
|
print(r" ___ ___ ___ ___ ___ ___ ")
|
||||||
|
print(r" /\ \ /\__\ /\__\ /\ \ /\ \ /\ "'\\ ')
|
||||||
|
print(r" /::\ \ /:/ / /:/ / /::\ \ /::\ \ \:\ "'\\ ')
|
||||||
|
print(r" /:/\:\ \ /:/ / /:/ / /:/\:\ \ /:/\:\ \ \:\ "'\\ ')
|
||||||
|
print(r" /::\~\:\ \ /:/ / /:/ / ___ /:/ \:\ \ /::\~\:\ \ /::\ "'\\')
|
||||||
|
print(r" /:/\:\ \:\__\ /:/__/ /:/__/ /\__\ /:/__/_\:\__\ /:/\:\ \:\__\ /:/\:\__\ ")
|
||||||
|
print(r" \/__\:\/:/ / \:\ \ \:\ \ /:/ / \:\ /\ \/__/ \:\~\:\ \/__/ /:/ \/__/")
|
||||||
|
print(r" \::/ / \:\ \ \:\ /:/ / \:\ \:\__\ \:\ \:\__\ /:/ / ")
|
||||||
|
print(r" \/__/ \:\ \ \:\/:/ / \:\/:/ / \:\ \/__/ \/__/ ")
|
||||||
|
print(r" \:\__\ \::/ / \::/ / \:\__\ ")
|
||||||
|
print(r" \/__/ \/__/ \/__/ \/__/ ")
|
||||||
|
print()
|
||||||
|
print()
|
||||||
|
print(" by Neocky ")
|
||||||
|
print()
|
||||||
|
|
||||||
|
def printMainMenu():
|
||||||
|
printLogo()
|
||||||
|
print(" ─────────────────────────────────────────────────────────────────────────────────")
|
||||||
|
print(" [1] Download a specific package")
|
||||||
|
print(" [2] Get update info of package")
|
||||||
|
print()
|
59
plugin_downloader.py
Normal file
59
plugin_downloader.py
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
import urllib.request
|
||||||
|
from urllib.request import urlopen
|
||||||
|
from urllib.request import urlretrieve
|
||||||
|
import cgi
|
||||||
|
from consoleoutput import consoleTitle, clearConsole, printMainMenu
|
||||||
|
import time
|
||||||
|
|
||||||
|
|
||||||
|
def calculateFileSize(downloadFileSize):
|
||||||
|
fileSizeDownload = int(downloadFileSize)
|
||||||
|
fileSizeMb = fileSizeDownload / 1024 / 1024
|
||||||
|
roundedFileSize = round(fileSizeMb, 2)
|
||||||
|
return roundedFileSize
|
||||||
|
|
||||||
|
consoleTitle()
|
||||||
|
|
||||||
|
print("if you see this clearConsole dont work")
|
||||||
|
clearConsole()
|
||||||
|
printMainMenu()
|
||||||
|
choice = input("pluGET >> ")
|
||||||
|
if choice == "1":
|
||||||
|
ressourceId = input("SpigotMC Ressource ID: ")
|
||||||
|
|
||||||
|
# 28140 for Luckperms (Testing only)
|
||||||
|
url = "https://api.spiget.org/v2/resources/" + ressourceId + "/download"
|
||||||
|
print(url)
|
||||||
|
|
||||||
|
# getting original filename
|
||||||
|
remotefile = urlopen(url)
|
||||||
|
filecontent = remotefile.info()['Content-Disposition']
|
||||||
|
filesize = remotefile.info()['Content-Length']
|
||||||
|
value, params = cgi.parse_header(filecontent)
|
||||||
|
filename = params["filename"]
|
||||||
|
|
||||||
|
# creating file path
|
||||||
|
path = r"C:\\Users\USERNAME\Desktop\\"
|
||||||
|
ppath = path + filename
|
||||||
|
|
||||||
|
# download file
|
||||||
|
urllib.request.urlretrieve(url, ppath)
|
||||||
|
|
||||||
|
filesizeData = calculateFileSize(filesize)
|
||||||
|
print(filesizeData)
|
||||||
|
|
||||||
|
#print(format(filesizeinmb, '.2f'))
|
||||||
|
|
||||||
|
print("Hello world")
|
||||||
|
print("Waiting still seconds: 5", end='\r')
|
||||||
|
time.sleep(1)
|
||||||
|
print("Waiting still seconds: 4", end='\r')
|
||||||
|
time.sleep(1)
|
||||||
|
print("Waiting still seconds: 3", end='\r')
|
||||||
|
time.sleep(1)
|
||||||
|
print("Waiting still seconds: 2", end='\r')
|
||||||
|
time.sleep(1)
|
||||||
|
print("Waiting still seconds: 1", end='\r')
|
||||||
|
time.sleep(1)
|
||||||
|
print("Done ✅")
|
||||||
|
input("Taste drücken zum Beenden...")
|
Loading…
Reference in New Issue
Block a user