|
5 | 5 | #
|
6 | 6 | # This is the main client for git message
|
7 | 7 |
|
| 8 | + |
| 9 | +import subprocess |
8 | 10 | import requests
|
9 | 11 | import os
|
| 12 | +import base64 |
10 | 13 | from bs4 import BeautifulSoup
|
11 | 14 |
|
| 15 | +from contextlib import contextmanager |
| 16 | +import sys, os |
| 17 | + |
| 18 | +#Starting Messages |
| 19 | +#print(" o8o . ooo ooooo ") |
| 20 | +#print(" `' .o8 `88. .888' ") |
| 21 | +#print(" .oooooooo oooo .o888oo 888b d'888 .ooooo. .oooo.o .oooo.o .oooo. .oooooooo .ooooo. ") |
| 22 | +#print("888' `88b `888 888 8 Y88. .P 888 d88' `88b d88( '8 d88( '8 `P )88b 888' `88b d88' `88b ") |
| 23 | +#print("888 888 888 888 8 `888' 888 888ooo888 `'Y88b. `'Y88b. .oP'888 888 888 888ooo888 ") |
| 24 | +#print("`88bod8P' 888 888 . 8 Y 888 888 .o o. )88b o. )88b d8( 888 `88bod8P' 888 .o ") |
| 25 | +#print("`8oooooo. o888o '888' o8o o888o `Y8bod8P' 8""888P' 8""888P' `Y888""8o `8oooooo.`Y8bod8P' ") |
| 26 | +#print("d' YD d' YD ") |
| 27 | +#print("'Y88888P' 'Y88888P' ") |
| 28 | +os.system("cls") |
| 29 | +print("") |
| 30 | +print(" ▄████ ██▓▄▄▄█████▓ ███▄ ▄███▓▓█████ ██████ ██████ ▄▄▄ ▄████ ▓█████") |
| 31 | +print(" ██▒ ▀█▒▓██▒▓ ██▒ ▓▒▓██▒▀█▀ ██▒▓█ ▀ ▒██ ▒ ▒██ ▒ ▒████▄ ██▒ ▀█▒▓█ ▀ ") |
| 32 | +print("▒██░▄▄▄░▒██▒▒ ▓██░ ▒░▓██ ▓██░▒███ ░ ▓██▄ ░ ▓██▄ ▒██ ▀█▄ ▒██░▄▄▄░▒███ ") |
| 33 | +print("░▓█ ██▓░██░░ ▓██▓ ░ ▒██ ▒██ ▒▓█ ▄ ▒ ██▒ ▒ ██▒░██▄▄▄▄██ ░▓█ ██▓▒▓█ ▄ ") |
| 34 | +print("░▒▓███▀▒░██░ ▒██▒ ░ ▒██▒ ░██▒░▒████▒▒██████▒▒▒██████▒▒ ▓█ ▓██▒░▒▓███▀▒░▒████▒") |
| 35 | +print(" ░▒ ▒ ░▓ ▒ ░░ ░ ▒░ ░ ░░░ ▒░ ░▒ ▒▓▒ ▒ ░▒ ▒▓▒ ▒ ░ ▒▒ ▓▒█░ ░▒ ▒ ░░ ▒░ ░") |
| 36 | +print(" ░ ░ ▒ ░ ░ ░ ░ ░ ░ ░ ░░ ░▒ ░ ░░ ░▒ ░ ░ ▒ ▒▒ ░ ░ ░ ░ ░ ░") |
| 37 | +print("░ ░ ░ ▒ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ▒ ░ ░ ░ ░ ") |
| 38 | +print(" ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░") |
| 39 | +print("") |
| 40 | +print("'I don't want my name on this project' - Henry Samuelson 2019") |
| 41 | +print("") |
| 42 | +print("Connect to Sever (git repo):") |
| 43 | + |
| 44 | + |
| 45 | +@contextmanager |
| 46 | +def suppress_stdout(): |
| 47 | + with open(os.devnull, "w") as devnull: |
| 48 | + old_stdout = sys.stdout |
| 49 | + sys.stdout = devnull |
| 50 | + try: |
| 51 | + yield |
| 52 | + finally: |
| 53 | + sys.stdout = old_stdout |
| 54 | + |
| 55 | + |
| 56 | + |
| 57 | + |
12 | 58 | noServer = True
|
13 | 59 | client = requests.session()
|
14 | 60 | ServerPath = ""
|
|
24 | 70 | noServer = False
|
25 | 71 |
|
26 | 72 | #clone repo
|
27 |
| - command = "git clone" + ServerPath |
| 73 | + #with open(os.devnull, 'wb') as devnull: |
| 74 | + # subprocess.check_call(['git clone ' + ServerPath], stdout=devnull, stderr=subprocess.STDOUT) |
| 75 | + command = "git clone " + ServerPath |
28 | 76 | os.system(command)
|
29 | 77 |
|
30 | 78 | print("Connected To Server")
|
|
34 | 82 |
|
35 | 83 | messageClient = True
|
36 | 84 | prompt = "(" + REPOPATH + ")>"
|
37 |
| -chatPath = str(ServerPath + "chat.txt") |
38 |
| - |
| 85 | +os.chdir(REPOPATH.split("/")[1]) |
| 86 | +url = "https://api.github.com/repos/" + REPOPATH + "/contents/chat.txt" |
39 | 87 |
|
40 | 88 | while messageClient:
|
41 |
| - client.get(chatPath) |
| 89 | + print("chat file") |
| 90 | + |
| 91 | + # load chat file |
| 92 | + #print(client.get(chatPath).text) |
| 93 | + a = requests.get(url).json() |
| 94 | + b = base64.b64decode(a['content']) |
| 95 | + c = bytes(str(b), "utf-8").decode("unicode_escape") |
| 96 | + os.system("cls") |
| 97 | + print(c) |
42 | 98 | msg = str(input(prompt))
|
| 99 | + if msg != "": |
| 100 | + # save message to chat file |
| 101 | + with open("chat.txt", "a") as myfile: |
| 102 | + myfile.write(str(msg + " \n")) |
43 | 103 |
|
44 |
| - # save message to chat file |
45 |
| - with open("chat.txt", "a") as myfile: |
46 |
| - myfile.write(msg) |
47 |
| - |
48 |
| - #commit message to git |
49 |
| - os.system("git pull") |
50 |
| - os.system("git commit *") |
51 |
| - os.system("git push") |
| 104 | + #commit message to git |
| 105 | + |
52 | 106 |
|
| 107 | + os.system("git pull ") |
| 108 | + os.system("git commit * -m 'msg' ") |
| 109 | + os.system("git push") |
53 | 110 |
|
| 111 | + else: |
| 112 | + os.system("git pull") |
0 commit comments