From ded378d22ec862d5a48ffb9b75ca8222cb66a2cf Mon Sep 17 00:00:00 2001 From: patrlim Date: Sat, 29 Jun 2024 23:22:44 +0200 Subject: [PATCH] Automated Commit From Python For ResoMusic --- main.py | 55 +++++++++++++--- songs.json | 188 ----------------------------------------------------- 2 files changed, 46 insertions(+), 197 deletions(-) diff --git a/main.py b/main.py index 14d4024..ba6c1fe 100644 --- a/main.py +++ b/main.py @@ -1,16 +1,53 @@ -import os +import os, requests, json -json = open("songs.json", "w", encoding="utf-8") -json.write('{\n "songs":[\n') +filelist = os.listdir() +jsonfile = open("songs.json", "w", encoding="utf-8") +jsonfile.write('{\n "songs":[\n') i = 0 -for file in os.listdir(): +for file in filelist: i += 1 if file[-4:] != ".ogg": continue - json.write(" {\n" + ' "name":' + '"' + file.replace(".ogg","") + '",' + "\n") - json.write(' "url":' + '"' + 'https://github.com/patrlim/musicshite/raw/main/' + file.replace(" ","%20") + '"' + "\n }") + jsonfile.write(" {\n" + ' "name":' + '"' + file.replace(".ogg","") + '",' + "\n") + jsonfile.write(' "url":' + '"' + 'https://github.com/patrlim/musicshite/raw/main/' + file.replace(" ","%20") + '"' + "\n }") if i != len(os.listdir()): - json.write(",") - json.write("\n") -json.write(' ]\n}') \ No newline at end of file + 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"') \ No newline at end of file diff --git a/songs.json b/songs.json index dd5c899..e69de29 100644 --- a/songs.json +++ b/songs.json @@ -1,188 +0,0 @@ -{ - "songs":[ - { - "name":"3kliksphilip - Atomic Amnesia", - "url":"https://github.com/patrlim/musicshite/raw/main/3kliksphilip%20-%20Atomic%20Amnesia.ogg" - }, - { - "name":"ABBA - Gimme! Gimme! Gimme! (A Man After Midnight)", - "url":"https://github.com/patrlim/musicshite/raw/main/ABBA%20-%20Gimme!%20Gimme!%20Gimme!%20(A%20Man%20After%20Midnight).ogg" - }, - { - "name":"Alan Walker - Running Out Of Roses", - "url":"https://github.com/patrlim/musicshite/raw/main/Alan%20Walker%20-%20Running%20Out%20Of%20Roses.ogg" - }, - { - "name":"Bon Jovi - It's My Life", - "url":"https://github.com/patrlim/musicshite/raw/main/Bon%20Jovi%20-%20It's%20My%20Life.ogg" - }, - { - "name":"Bon Jovi - Livin On A Prayer", - "url":"https://github.com/patrlim/musicshite/raw/main/Bon%20Jovi%20-%20Livin%20On%20A%20Prayer.ogg" - }, - { - "name":"Bon Jovi - You Give Love A Bad Name", - "url":"https://github.com/patrlim/musicshite/raw/main/Bon%20Jovi%20-%20You%20Give%20Love%20A%20Bad%20Name.ogg" - }, - { - "name":"Boney M - Daddy Cool", - "url":"https://github.com/patrlim/musicshite/raw/main/Boney%20M%20-%20Daddy%20Cool.ogg" - }, - { - "name":"Boney M - Rasputin", - "url":"https://github.com/patrlim/musicshite/raw/main/Boney%20M%20-%20Rasputin.ogg" - }, - { - "name":"Bring Me The Horizon - YOUtopia", - "url":"https://github.com/patrlim/musicshite/raw/main/Bring%20Me%20The%20Horizon%20-%20YOUtopia.ogg" - }, - { - "name":"Caravan Palace - Dragons", - "url":"https://github.com/patrlim/musicshite/raw/main/Caravan%20Palace%20-%20Dragons.ogg" - }, - { - "name":"Caravan Palace - Jolie Coquine", - "url":"https://github.com/patrlim/musicshite/raw/main/Caravan%20Palace%20-%20Jolie%20Coquine.ogg" - }, - { - "name":"Caravan Palace - Reverse", - "url":"https://github.com/patrlim/musicshite/raw/main/Caravan%20Palace%20-%20Reverse.ogg" - }, - { - "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" - }, - { - "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" - }, - { - "name":"Gibbs - Stan", - "url":"https://github.com/patrlim/musicshite/raw/main/Gibbs%20-%20Stan.ogg" - }, - { - "name":"Half Life OST - Credits Closing Theme", - "url":"https://github.com/patrlim/musicshite/raw/main/Half%20Life%20OST%20-%20Credits%20Closing%20Theme.ogg" - }, - { - "name":"Half-Life 2 Episode Two OST - Vortal Combat", - "url":"https://github.com/patrlim/musicshite/raw/main/Half-Life%202%20Episode%20Two%20OST%20-%20Vortal%20Combat.ogg" - }, - { - "name":"James Shimoji - Pepsi Man Theme Song", - "url":"https://github.com/patrlim/musicshite/raw/main/James%20Shimoji%20-%20Pepsi%20Man%20Theme%20Song.ogg" - }, - { - "name":"Jamie Berry ft. Octavia Rose - Lost In The Rhythm", - "url":"https://github.com/patrlim/musicshite/raw/main/Jamie%20Berry%20ft.%20Octavia%20Rose%20-%20Lost%20In%20The%20Rhythm.ogg" - }, - { - "name":"Jamie Berry, Octavia Rose - Light up the Night", - "url":"https://github.com/patrlim/musicshite/raw/main/Jamie%20Berry,%20Octavia%20Rose%20-%20Light%20up%20the%20Night.ogg" - }, - { - "name":"Jamie Berry, Octavia Rose - Lost In The Rhythm", - "url":"https://github.com/patrlim/musicshite/raw/main/Jamie%20Berry,%20Octavia%20Rose%20-%20Lost%20In%20The%20Rhythm.ogg" - }, - { - "name":"Ken Ashcorp - Absolute Territory", - "url":"https://github.com/patrlim/musicshite/raw/main/Ken%20Ashcorp%20-%20Absolute%20Territory.ogg" - }, - { - "name":"Kombii - Pokolenie", - "url":"https://github.com/patrlim/musicshite/raw/main/Kombii%20-%20Pokolenie.ogg" - }, - { - "name":"Linkin Park - In The End", - "url":"https://github.com/patrlim/musicshite/raw/main/Linkin%20Park%20-%20In%20The%20End.ogg" - }, - { - "name":"Linkin Park - Numb", - "url":"https://github.com/patrlim/musicshite/raw/main/Linkin%20Park%20-%20Numb.ogg" - }, - { - "name":"Michael Wyckoff - Tactical Trial (Boneworks OST)", - "url":"https://github.com/patrlim/musicshite/raw/main/Michael%20Wyckoff%20-%20Tactical%20Trial%20(Boneworks%20OST).ogg" - }, - { - "name":"Minecraft OST - Otherside", - "url":"https://github.com/patrlim/musicshite/raw/main/Minecraft%20OST%20-%20Otherside.ogg" - }, - { - "name":"Minecraft OST - Pigstep", - "url":"https://github.com/patrlim/musicshite/raw/main/Minecraft%20OST%20-%20Pigstep.ogg" - }, - { - "name":"Nord Horizon - Utopia", - "url":"https://github.com/patrlim/musicshite/raw/main/Nord%20Horizon%20-%20Utopia.ogg" - }, - { - "name":"Odd Chap - Maths", - "url":"https://github.com/patrlim/musicshite/raw/main/Odd%20Chap%20-%20Maths.ogg" - }, - { - "name":"Odd Chap - Out Of My Mind", - "url":"https://github.com/patrlim/musicshite/raw/main/Odd%20Chap%20-%20Out%20Of%20My%20Mind.ogg" - }, - { - "name":"Odd Chap - The Little Man Who Wasnt There", - "url":"https://github.com/patrlim/musicshite/raw/main/Odd%20Chap%20-%20The%20Little%20Man%20Who%20Wasnt%20There.ogg" - }, - { - "name":"Odd Chap, Little Violet - Crazy Out There", - "url":"https://github.com/patrlim/musicshite/raw/main/Odd%20Chap,%20Little%20Violet%20-%20Crazy%20Out%20There.ogg" - }, - { - "name":"Persona 3 Reload OST - It's Going Down Now", - "url":"https://github.com/patrlim/musicshite/raw/main/Persona%203%20Reload%20OST%20-%20It's%20Going%20Down%20Now.ogg" - }, - { - "name":"Persona 5 OST - Beneath the Mask", - "url":"https://github.com/patrlim/musicshite/raw/main/Persona%205%20OST%20-%20Beneath%20the%20Mask.ogg" - }, - { - "name":"Persona 5 OST - Last Surprise", - "url":"https://github.com/patrlim/musicshite/raw/main/Persona%205%20OST%20-%20Last%20Surprise.ogg" - }, - { - "name":"PiSk - Golden Sound", - "url":"https://github.com/patrlim/musicshite/raw/main/PiSk%20-%20Golden%20Sound.ogg" - }, - { - "name":"PiSk - Say What", - "url":"https://github.com/patrlim/musicshite/raw/main/PiSk%20-%20Say%20What.ogg" - }, - { - "name":"T-Bros - Workaholic", - "url":"https://github.com/patrlim/musicshite/raw/main/T-Bros%20-%20Workaholic.ogg" - }, - { - "name":"The Electric Swing Circus - Empires", - "url":"https://github.com/patrlim/musicshite/raw/main/The%20Electric%20Swing%20Circus%20-%20Empires.ogg" - }, - { - "name":"The Swinghoppers - Swinguistics", - "url":"https://github.com/patrlim/musicshite/raw/main/The%20Swinghoppers%20-%20Swinguistics.ogg" - }, - { - "name":"Valve - Portal Radio (Uncompressed)", - "url":"https://github.com/patrlim/musicshite/raw/main/Valve%20-%20Portal%20Radio%20(Uncompressed).ogg" - } - ] -} \ No newline at end of file