Skip to content

Commit

Permalink
Init repository
Browse files Browse the repository at this point in the history
  • Loading branch information
kostya-main committed Feb 21, 2024
1 parent ceecef0 commit 7bac54a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
# parser-libraries
# Parser libraries
Программа для помощи высчитывания хеш и относительного пути файлов

Формат вывода данных специально был сделан для [AuroraLauncher](https://github.com/AuroraTeam/AuroraLauncher) и удобной добавления библиотек в профиль клиента.
21 changes: 21 additions & 0 deletions parser-libraries.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import os
import fnmatch
import hashlib
import json


for path,dirs,files in os.walk('.'):
for file in files:
if fnmatch.fnmatch(file,'*.jar'):
fullname = os.path.join(path,file)
newPath = fullname.replace(os.sep, '/').lstrip('./')
sha1 = hashlib.sha1(open(fullname,'rb').read()).hexdigest()
data = {
"path": newPath,
"sha1": sha1,
"type": "library"
}
with open("libraries.json", "a") as f:
f.write(f'{json.dumps(data, indent=4, skipkeys=True)},\n')
print(newPath)
print(sha1)

0 comments on commit 7bac54a

Please sign in to comment.