Add Linkki broadcast image
Build custom container images / build (map[base_image:php:8-fpm-alpine build_args:PHP_VERSION=8
context:php8-pgsql fingerprint_command:{ apk info -v | LC_ALL=C sort; find /usr/local/lib/php/extensions /usr/local/etc/php/conf.d -type f -exec sha256sum {} + | LC_ALL=C sort; }
name:ph… (push) Successful in 48s
Build custom container images / build (map[base_image:postgres:18 build_args:PG_VERSION=18
POSTGIS_VERSION=3
VCHORD_VERSION=0.5.3
context:postgres fingerprint_command:{ dpkg-query -W -f='${binary:Package}=${Version}\n' | LC_ALL=C sort; find /usr/lib/postgresql -type f -exec sha256su… (push) Successful in 55s
Build custom container images / build (map[base_image:python:3 build_args:PYTHON_VERSION=3
context:python-tools fingerprint_command:{ dpkg-query -W -f='${binary:Package}=${Version}\n' | LC_ALL=C sort; pip freeze | LC_ALL=C sort; }
name:python-tools oci_labels:org.opencontainers.ima… (push) Successful in 54s
Build custom container images / build (map[base_image:python:3.12-slim build_args:PYTHON_VERSION=3.12-slim
context:linkki-tiedotus fingerprint_command:{ dpkg-query -W -f='${binary:Package}=${Version}\n' | LC_ALL=C sort; pip freeze | LC_ALL=C sort; }
name:linkki-tiedotus oci_labels:… (push) Successful in 39s
Build custom container images / build (map[base_image:php:8-fpm-alpine build_args:PHP_VERSION=8
context:php8-pgsql fingerprint_command:{ apk info -v | LC_ALL=C sort; find /usr/local/lib/php/extensions /usr/local/etc/php/conf.d -type f -exec sha256sum {} + | LC_ALL=C sort; }
name:ph… (push) Successful in 48s
Build custom container images / build (map[base_image:postgres:18 build_args:PG_VERSION=18
POSTGIS_VERSION=3
VCHORD_VERSION=0.5.3
context:postgres fingerprint_command:{ dpkg-query -W -f='${binary:Package}=${Version}\n' | LC_ALL=C sort; find /usr/lib/postgresql -type f -exec sha256su… (push) Successful in 55s
Build custom container images / build (map[base_image:python:3 build_args:PYTHON_VERSION=3
context:python-tools fingerprint_command:{ dpkg-query -W -f='${binary:Package}=${Version}\n' | LC_ALL=C sort; pip freeze | LC_ALL=C sort; }
name:python-tools oci_labels:org.opencontainers.ima… (push) Successful in 54s
Build custom container images / build (map[base_image:python:3.12-slim build_args:PYTHON_VERSION=3.12-slim
context:linkki-tiedotus fingerprint_command:{ dpkg-query -W -f='${binary:Package}=${Version}\n' | LC_ALL=C sort; pip freeze | LC_ALL=C sort; }
name:linkki-tiedotus oci_labels:… (push) Successful in 39s
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
import argparse
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
from linkki_poster.broadcast_ops import delete_binding_from_telegram, update_texts
|
||||
from linkki_poster.models import Config, Language
|
||||
from linkki_poster.progress import ProgressDisplay
|
||||
from webapp.storage import get_binding, load_metadata
|
||||
|
||||
|
||||
def main() -> None:
|
||||
parser = argparse.ArgumentParser(description="Advanced broadcast management helper.")
|
||||
parser.add_argument("directory", help="Broadcast directory")
|
||||
parser.add_argument("action", choices=["update-texts", "delete-telegram"])
|
||||
parser.add_argument("--languages", default="fi,sv,en", help="Comma-separated languages for update-texts")
|
||||
parser.add_argument("--config", default="telegram_config.json", help="Path to Telegram config JSON")
|
||||
args = parser.parse_args()
|
||||
|
||||
config = load_config(Path(args.config))
|
||||
post_dir = Path(args.directory).resolve()
|
||||
metadata = load_metadata(post_dir)
|
||||
binding = get_binding(metadata)
|
||||
if binding is None:
|
||||
raise ValueError("Broadcast is not linked to Telegram.")
|
||||
|
||||
progress = ProgressDisplay()
|
||||
if args.action == "delete-telegram":
|
||||
delete_binding_from_telegram(config, binding, progress)
|
||||
return
|
||||
|
||||
changed_languages = {
|
||||
Language(language.strip())
|
||||
for language in args.languages.split(",")
|
||||
if language.strip()
|
||||
}
|
||||
update_texts(post_dir, config, binding, changed_languages, progress)
|
||||
|
||||
|
||||
def load_config(config_path: Path) -> Config:
|
||||
payload = json.loads(config_path.read_text(encoding="utf-8"))
|
||||
return Config(
|
||||
bot_token=str(payload["bot_token"]).strip(),
|
||||
chat_id=str(payload["chat_id"]).strip(),
|
||||
channel_username=str(payload.get("channel_username", "")).strip(),
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user