1
0
Fork 0
mirror of https://github.com/Findus23/matomo-utils.git synced 2024-09-19 15:13:44 +02:00

improve mass-edit.py

This commit is contained in:
Lukas Winkler 2021-08-31 17:58:11 +02:00
parent 485d3426b5
commit 4b59dd2e1e
Signed by: lukas
GPG key ID: 54DE4D798D244853
3 changed files with 90 additions and 17 deletions

View file

@ -3,6 +3,7 @@ from typing import Dict, List, Tuple
import requests import requests
from config import * from config import *
from priorities import priorities, Priority
s = requests.Session() s = requests.Session()
s.headers.update({"Authorization": "Token " + token}) s.headers.update({"Authorization": "Token " + token})
@ -84,22 +85,33 @@ for slug, comp in phpcomponents.items():
license = comp["license"] license = comp["license"]
if license != "GPL-3.0-or-later": if license != "GPL-3.0-or-later":
print(license) print(license)
# update_setting(comp, { if slug in priorities:
# "check_flags": "php-format,safe-html,ignore-optional-plural", priority = priorities[slug]
# # "license": "proprietary", else:
# "manage_units": False, # Manage strings priority = Priority.medium
# "edit_template": True, update_setting(comp, {
# "enforced_checks": [ "check_flags": "php-format,safe-html,ignore-optional-plural",
# "php_format" # "license": "proprietary",
# ], "manage_units": False, # Manage strings
# }) "edit_template": True,
# create_addon(comp, name="weblate.cleanup.blank", configuration={}) "enforced_checks": [
# create_addon(comp, name="weblate.cleanup.generic", configuration={}) "php_format"
# create_addon(comp, name="weblate.json.customize", configuration={ ],
# "sort_keys": True, "priority": priority.value,
# "indent": 4, "language_code_style": "bcp",
# "style": "spaces" "new_lang": "contact",
# }) "push_on_commit": True,
})
if "weblate.cleanup.blank" not in addon_ids.keys():
create_addon(comp, name="weblate.cleanup.blank", configuration={})
if "weblate.cleanup.generic" not in addon_ids.keys():
create_addon(comp, name="weblate.cleanup.generic", configuration={})
if "weblate.json.customize" not in addon_ids.keys():
create_addon(comp, name="weblate.json.customize", configuration={
"sort_keys": True,
"indent": 4,
"style": "spaces"
})
if "weblate.git.squash" not in addon_ids.keys(): if "weblate.git.squash" not in addon_ids.keys():
print("add addon") print("add addon")
create_addon(comp, name="weblate.git.squash", configuration={ create_addon(comp, name="weblate.git.squash", configuration={

View file

@ -0,0 +1,61 @@
from enum import Enum
# from PRIORITY_CHOICES in weblate/weblate/trans/util.py
class Priority(Enum):
very_high = 60
high = 80
medium = 100
low = 120
very_low = 140
priorities = {
"matomo-base": Priority.very_high,
"plugin-actions": Priority.high,
"plugin-annotations": Priority.high,
"plugin-api": Priority.high,
"plugin-coreadminhome": Priority.very_high,
"plugin-corehome": Priority.very_high,
"plugin-corepluginsadmin": Priority.high,
"plugin-coreupdater": Priority.high,
"plugin-dashboard": Priority.very_high,
"plugin-deviceplugins": Priority.high,
"plugin-devicesdetection": Priority.high,
"plugin-eccommerce": Priority.high,
"plugin-events": Priority.high,
"plugin-feedback": Priority.high,
"plugin-goals": Priority.high,
"plugin-imagegraph": Priority.high,
"plugin-insights": Priority.high,
"plugin-installation": Priority.very_high,
"plugin-languagesmanager": Priority.high,
"plugin-live": Priority.high,
"plugin-login": Priority.high,
"plugin-marketplace": Priority.high,
"plugin-overlay": Priority.high,
"plugin-privacymanager": Priority.high,
"plugin-provider": Priority.high,
"plugin-referrers": Priority.high,
"plugin-resolution": Priority.high,
"plugin-scheduledreports": Priority.high,
"plugin-segmenteditor": Priority.high,
"plugin-seo": Priority.high,
"plugin-sitesmanager": Priority.high,
"plugin-transitions": Priority.high,
"plugin-twofactorauth": Priority.high,
"plugin-usercountry": Priority.high,
"plugin-usercountrymap": Priority.high,
"plugin-userid": Priority.high,
"plugin-userlanguage": Priority.high,
"plugin-usersmanager": Priority.high,
"plugin-visitfrequency": Priority.high,
"plugin-visitorinterest": Priority.high,
"plugin-visitssummary": Priority.high,
"plugin-visittime": Priority.high,
"plugin-websitemeasurable": Priority.high,
"plugin-widgetize": Priority.high,
"plugin-securityinfo": Priority.low,
"ommunityplugin-diagnosticsextended": Priority.low,
}

View file

@ -1,6 +1,6 @@
from pathlib import Path from pathlib import Path
lang_dir = Path("../lang") lang_dir = Path("../../lang")
languages_in_matomo = set(str(dir.stem) for dir in lang_dir.glob("*.json")) languages_in_matomo = set(str(dir.stem) for dir in lang_dir.glob("*.json"))