Upload files to "/"
This commit is contained in:
parent
f6917e2f1f
commit
e0023b5c1c
2 changed files with 191 additions and 217 deletions
40
main.py
40
main.py
|
@ -1,4 +1,6 @@
|
|||
import os, requests, json
|
||||
import os
|
||||
|
||||
os.system('git pull')
|
||||
|
||||
filelist = os.listdir()
|
||||
jsonfile = open("songs.json", "w", encoding="utf-8")
|
||||
|
@ -15,39 +17,3 @@ for file in filelist:
|
|||
jsonfile.write(",")
|
||||
jsonfile.write("\n")
|
||||
jsonfile.write(' ]\n}')
|
||||
|
||||
|
||||
url = 'https://git.merith.xyz/patrlim/musicshite/raw/branch/main/songs.json'
|
||||
response = requests.get(url)
|
||||
if response.status_code == 200:
|
||||
file_content = response.content
|
||||
|
||||
with open('oldsongs.json', 'wb') as f:
|
||||
f.write(file_content)
|
||||
|
||||
else:
|
||||
quit(-1)
|
||||
|
||||
cloudjson = open("oldsongs.json", "r", encoding="utf-8")
|
||||
oldjson = ""
|
||||
for line in cloudjson:
|
||||
oldjson += line
|
||||
|
||||
cloudjsondict = json.loads(oldjson)
|
||||
newfiles = []
|
||||
cloudjson.close()
|
||||
|
||||
os.remove("oldsongs.json")
|
||||
|
||||
for file in filelist:
|
||||
found = False
|
||||
for song in cloudjsondict['songs']:
|
||||
if file == song['name']+".ogg":
|
||||
found = True
|
||||
continue
|
||||
if not found:
|
||||
if file[0] == ".":
|
||||
continue
|
||||
os.system('git add "' + file + '"')
|
||||
|
||||
os.system('git commit -m "Automated Commit From Python For ResoMusic"')
|
|
@ -52,6 +52,10 @@
|
|||
"name":"Caravan Palace - Rock It For Me",
|
||||
"url":"https://github.com/patrlim/musicshite/raw/main/Caravan%20Palace%20-%20Rock%20It%20For%20Me.ogg"
|
||||
},
|
||||
{
|
||||
"name":"Daft Punk - Around the World",
|
||||
"url":"https://github.com/patrlim/musicshite/raw/main/Daft%20Punk%20-%20Around%20the%20World.ogg"
|
||||
},
|
||||
{
|
||||
"name":"Daft Punk - Get Lucky",
|
||||
"url":"https://github.com/patrlim/musicshite/raw/main/Daft%20Punk%20-%20Get%20Lucky.ogg"
|
||||
|
@ -60,6 +64,10 @@
|
|||
"name":"Daft Punk - Harder, Better, Faster, Stronger",
|
||||
"url":"https://github.com/patrlim/musicshite/raw/main/Daft%20Punk%20-%20Harder,%20Better,%20Faster,%20Stronger.ogg"
|
||||
},
|
||||
{
|
||||
"name":"Dying Light OST - Horizon",
|
||||
"url":"https://github.com/patrlim/musicshite/raw/main/Dying%20Light%20OST%20-%20Horizon.ogg"
|
||||
},
|
||||
{
|
||||
"name":"Fall Out Boy - Centuries",
|
||||
"url":"https://github.com/patrlim/musicshite/raw/main/Fall%20Out%20Boy%20-%20Centuries.ogg"
|
||||
|
|
Loading…
Reference in a new issue