mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
add a folder for useful scripts
This commit is contained in:
parent
33ed166ec9
commit
ac435adda3
3 changed files with 115 additions and 0 deletions
34
scripts/scrm.py
Normal file
34
scripts/scrm.py
Normal file
|
@ -0,0 +1,34 @@
|
|||
import sys
|
||||
import os
|
||||
import json
|
||||
|
||||
# load text file containing unused keys
|
||||
# remove the keys from all string files
|
||||
|
||||
cwd = os.getcwd()
|
||||
langdir = cwd + '/../src/strings'
|
||||
langlst = os.listdir(langdir)
|
||||
|
||||
keys = []
|
||||
|
||||
with open('scout.txt', 'r') as f:
|
||||
for line in f:
|
||||
keys.append(line.strip('\n'))
|
||||
|
||||
for lang in langlst:
|
||||
with open(langdir + '/' + lang, 'r') as f:
|
||||
inde = 2
|
||||
if '\n \"' in f.read():
|
||||
inde = 4
|
||||
f.close()
|
||||
with open(langdir + '/' + lang, 'r+') as f:
|
||||
langjson = json.load(f)
|
||||
for key in keys:
|
||||
langjson.pop(key, None)
|
||||
f.seek(0)
|
||||
f.write(json.dumps(langjson, indent=inde, sort_keys=False, ensure_ascii=False))
|
||||
f.write('\n')
|
||||
f.truncate()
|
||||
f.close()
|
||||
|
||||
print('DONE')
|
Loading…
Add table
Add a link
Reference in a new issue