From c87492cd6679658285cfb470ffeaf25e14b81bff Mon Sep 17 00:00:00 2001 From: fkDead Date: Fri, 6 Nov 2026 08:32:51 +0100 Subject: [PATCH] feat(fws-music-dl): add legal disclaimer on startup Shows a dismissable notice at first launch (and from the menu) stating that the software is Swiss, that downloads are only allowed for strictly personal use under art. 19 LDA, and that it is illegal in countries without an equivalent exception. Bumps the package to 1.1.0. Co-Authored-By: Claude Opus 5.5 --- README.md | 2 +- fws-music-dl/PKGBUILD | 2 +- fws-music-dl/fws-music-dl | 51 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 53 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 42ed73e..1210a74 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Un paquet = un dossier contenant son `PKGBUILD` et ses fichiers. | Paquet | Version | Description | |---|---|---| -| `fws-music-dl` | 1.0.0 | Téléchargeur YouTube / YouTube Music : recherche, MP3/M4A/Opus/FLAC ou vidéo MP4 | +| `fws-music-dl` | 1.1.0 | Téléchargeur YouTube / YouTube Music : recherche, MP3/M4A/Opus/FLAC ou vidéo MP4 | ## Construire un paquet diff --git a/fws-music-dl/PKGBUILD b/fws-music-dl/PKGBUILD index 3891ca4..b6ee0dc 100644 --- a/fws-music-dl/PKGBUILD +++ b/fws-music-dl/PKGBUILD @@ -11,7 +11,7 @@ # (ou pkgrel pour un simple correctif), puis makepkg. # ============================================================================ pkgname=fws-music-dl -pkgver=1.0.0 +pkgver=1.1.0 pkgrel=1 pkgdesc="Téléchargeur YouTube / YouTube Music de FWS : recherche, MP3/M4A/Opus/FLAC ou vidéo MP4, pochettes et tags" arch=('any') diff --git a/fws-music-dl/fws-music-dl b/fws-music-dl/fws-music-dl index e25b16a..28e2931 100755 --- a/fws-music-dl/fws-music-dl +++ b/fws-music-dl/fws-music-dl @@ -32,6 +32,24 @@ from gi.repository import Adw, Gdk, Gio, GLib, Gtk # noqa: E402 APP_ID = "org.fws.MusicDownloader" DEPS = ["yt-dlp", "yt-dlp-ejs", "deno", "ffmpeg", "python-mutagen"] LOG_PATH = os.path.join(GLib.get_user_cache_dir(), "fws", "music-dl.log") +# Présent = l'utilisateur a coché « Ne plus afficher » sous l'avertissement. +DISCLAIMER_FLAG = os.path.join(GLib.get_user_config_dir(), "fws", "music-dl-disclaimer-accepted") + +DISCLAIMER = ( + "Logiciel suisse — usage strictement personnel\n\n" + "Ce logiciel est conçu en Suisse. Le droit suisse (art. 19 de la loi sur le " + "droit d'auteur, LDA) autorise la copie d'œuvres pour un usage strictement " + "personnel ou dans le cercle de personnes étroitement liées (parents, amis " + "proches).\n\n" + "Sont en revanche interdits, y compris en Suisse : partager, publier, " + "revendre ou mettre à disposition les fichiers téléchargés.\n\n" + "Hors de Suisse, dans un pays dont la loi ne prévoit pas la même " + "exception, télécharger des œuvres protégées sans l'autorisation des ayants " + "droit est illégal. Les conditions d'utilisation de YouTube peuvent en " + "outre l'interdire.\n\n" + "En utilisant ce logiciel, tu es seul responsable du respect des lois de ton " + "pays. Ce texte est une information, pas un conseil juridique." +) # (libellé, args yt-dlp, vidéo ?). # Opus et M4A sont les flux d'ORIGINE de YouTube : pas de réencodage, donc pas @@ -116,6 +134,7 @@ class Window(Adw.ApplicationWindow): menu = Gio.Menu() menu.append("Réparer / mettre à jour les outils", "app.repair") menu.append("Ouvrir le journal", "app.log") + menu.append("Avertissement légal", "app.disclaimer") mbtn = Gtk.MenuButton(icon_name="open-menu-symbolic", menu_model=menu) header.pack_end(mbtn) @@ -227,6 +246,34 @@ class Window(Adw.ApplicationWindow): with open(LOG_PATH, "a", encoding="utf-8") as f: f.write(line.rstrip("\n") + "\n") + # --- Avertissement légal --- + # forced=True : réaffiché depuis le menu, même après « Ne plus afficher ». + def show_disclaimer(self, forced=False): + if not forced and os.path.exists(DISCLAIMER_FLAG): + return + dlg = Adw.AlertDialog(heading="Avertissement", body=DISCLAIMER, body_use_markup=True) + check = Gtk.CheckButton(label="J'ai compris, ne plus afficher ce message", + active=os.path.exists(DISCLAIMER_FLAG)) + dlg.set_extra_child(check) + if not forced: + dlg.add_response("quit", "Quitter") + dlg.add_response("ok", "J'ai compris") + dlg.set_response_appearance("ok", Adw.ResponseAppearance.SUGGESTED) + dlg.set_default_response("ok") + dlg.set_close_response("quit" if not forced else "ok") + + def resp(_d, r): + if r == "quit": + self.get_application().quit() + return + if check.get_active(): + os.makedirs(os.path.dirname(DISCLAIMER_FLAG), exist_ok=True) + open(DISCLAIMER_FLAG, "w").close() + elif os.path.exists(DISCLAIMER_FLAG): + os.remove(DISCLAIMER_FLAG) + dlg.connect("response", resp) + dlg.present(self) + def refresh_deps(self): miss = missing_deps() self.deps_banner.set_revealed(bool(miss)) @@ -502,6 +549,9 @@ class App(Adw.Application): a = Gio.SimpleAction.new("repair", None) a.connect("activate", lambda *_: self.win.install_deps(reinstall=True)) self.add_action(a) + a = Gio.SimpleAction.new("disclaimer", None) + a.connect("activate", lambda *_: self.win.show_disclaimer(forced=True)) + self.add_action(a) a = Gio.SimpleAction.new("log", None) a.connect("activate", self.open_log) self.add_action(a) @@ -515,6 +565,7 @@ class App(Adw.Application): if not self.win: self.win = Window(self) self.win.present() + self.win.show_disclaimer() if __name__ == "__main__":