From cde9c74b642b28d70fcbf601662504e812be9934 Mon Sep 17 00:00:00 2001 From: Giant Pink Robots! Date: Sun, 3 Mar 2024 11:38:55 +0300 Subject: [PATCH] v2024.2.29-2 --- ...thub.giantpinkrobots.varia.metainfo.xml.in | 17 +++++++++- meson.build | 2 +- src/download/actionrow.py | 33 +++++++++++-------- src/download/listen.py | 12 ++++--- src/download/thread.py | 20 ++++++----- src/initiate.py | 2 +- src/variamain.py | 19 +++++++++-- src/window/sidebar.py | 16 +++++++++ 8 files changed, 88 insertions(+), 33 deletions(-) diff --git a/data/io.github.giantpinkrobots.varia.metainfo.xml.in b/data/io.github.giantpinkrobots.varia.metainfo.xml.in index 68ca1de..88bb9b7 100644 --- a/data/io.github.giantpinkrobots.varia.metainfo.xml.in +++ b/data/io.github.giantpinkrobots.varia.metainfo.xml.in @@ -14,6 +14,21 @@ https://github.com/giantpinkrobots/varia https://github.com/giantpinkrobots/varia/tree/main/po + +en_US +de_DE +it_IT +nl_NL +oc_FR +pt_BR +ru_RU +tr_TR +uk_UA +fr_FR +zh_TW +nb_NO + +

Varia is a download manager for all your download needs. It can download multiple files at once very quickly with aria2. @@ -38,7 +53,7 @@ Varia utilizes GTK4 and Libadwaita to provide a easy to use interface that integ - +

- Support for Firefox and Chromium extension.

- Initial torrenting support.

diff --git a/meson.build b/meson.build index 2196f77..012b278 100644 --- a/meson.build +++ b/meson.build @@ -1,5 +1,5 @@ project('varia', - version: 'v2024.2.29-1', + version: 'v2024.2.29-2', meson_version: '>= 0.62.0', default_options: [ 'warning_level=2', 'werror=false', ], ) diff --git a/src/download/actionrow.py b/src/download/actionrow.py index 43e1359..06af5e6 100644 --- a/src/download/actionrow.py +++ b/src/download/actionrow.py @@ -47,11 +47,15 @@ def create_actionrow(self, filename): button_box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=5) - self.pause_buttons.append(Gtk.Button.new_from_icon_name("media-playback-pause-symbolic")) - self.pause_buttons[len(self.pause_buttons)-1].connect("clicked", on_pause_clicked, self, self.pause_buttons[len(self.pause_buttons)-1], download_item) - button_box.append(self.pause_buttons[len(self.pause_buttons)-1]) + pause_button = Gtk.Button.new_from_icon_name("media-playback-pause-symbolic") + pause_button.set_valign(Gtk.Align.CENTER) + pause_button.connect("clicked", on_pause_clicked, self, pause_button, download_item) + + self.pause_buttons.append(pause_button) + button_box.append(pause_button) stop_button = Gtk.Button.new_from_icon_name("process-stop-symbolic") + stop_button.set_valign(Gtk.Align.CENTER) stop_button.connect("clicked", on_stop_clicked, self, download_item) button_box.append(stop_button) @@ -71,7 +75,6 @@ def create_actionrow(self, filename): return [progress_bar, speed_label, self.pause_buttons[len(self.pause_buttons)-1], download_item, filename_label] def on_pause_clicked(button, self, pause_button, download_item): - self.all_paused = False download_thread = self.downloads[download_item.index] if download_thread.download.is_paused: download_thread.resume() @@ -89,16 +92,18 @@ def on_pause_clicked(button, self, pause_button, download_item): pause_button.set_child(image) download_thread.save_state() - all_paused = True - for download_thread in self.downloads: - if (download_thread.download): - if (download_thread.download.is_paused) == False: - all_paused = False - if (all_paused == True): - self.all_paused = True - self.header_pause_content.set_icon_name("media-playback-start-symbolic") - self.header_pause_content.set_label(_("Resume All")) - self.header_pause_button.set_sensitive(True) + all_paused = True + + for download_thread in self.downloads: + if (download_thread.download): + if (download_thread.download.is_paused) == False: + all_paused = False + + if (all_paused == True): + self.all_paused = True + self.header_pause_content.set_icon_name("media-playback-start-symbolic") + self.header_pause_content.set_label(_("Resume All")) + self.header_pause_button.set_sensitive(True) def on_stop_clicked(button, self, download_item): index = download_item.index diff --git a/src/download/listen.py b/src/download/listen.py index b610bb0..b34f03d 100644 --- a/src/download/listen.py +++ b/src/download/listen.py @@ -17,10 +17,9 @@ def listen_to_aria2(self): self.downloads.remove(frontend_download_item) try: - aria2_total_downloads = self.api.get_downloads() - downloads_in_frontend = set(download.download.gid for download in self.downloads) - for download_item_to_be_added in aria2_total_downloads: - if (download_item_to_be_added.gid not in downloads_in_frontend) and (download_item_to_be_added.is_metadata == False) and (download_item_to_be_added.is_complete == False): + downloads_in_frontend = set(download_item.download.info_hash for download_item in self.downloads.copy()) + for download_item_to_be_added in self.api.get_downloads(): + if ((download_item_to_be_added.info_hash not in downloads_in_frontend) and (download_item_to_be_added.is_metadata == False) and (download_item_to_be_added.is_complete == False)): if not download_item_to_be_added.is_torrent: print('Download added directly to aria2c, adding it to the UI: ' + download_item_to_be_added.files[0].uris[0]["uri"]) add_download_to_ui(self, download_item_to_be_added) @@ -30,7 +29,10 @@ def listen_to_aria2(self): GLib.timeout_add(2000, listen_to_aria2, self) def add_download_to_ui(self, download_item_to_be_added): - download_item_url = "magnet:?xt=urn:btih:" + download_item_to_be_added.info_hash if download_item_to_be_added.is_torrent else download_item_to_be_added.files[0].uris[0]["uri"].split("?")[0] + if download_item_to_be_added.is_torrent: + download_item_url = "magnet:?xt=urn:btih:" + download_item_to_be_added.info_hash + else: + download_item_url = download_item_to_be_added.files[0].uris[0]["uri"].split("?")[0] objectlist = create_actionrow(self, download_item_url) download_thread = DownloadThread(self, download_item_url, *objectlist, download_item_to_be_added, None) diff --git a/src/download/thread.py b/src/download/thread.py index f1b0ebe..01a9d4a 100644 --- a/src/download/thread.py +++ b/src/download/thread.py @@ -70,14 +70,15 @@ def run(self): self.url = self.auth_username + ":" + self.auth_password + "@" + self.url print ("Authentication enabled.") + try: + if (self.downloadname == None): + self.download = self.api.add_uris([self.url]) + else: + self.download = self.api.add_uris([self.url], options={"out": self.downloadname}) + except: + pass + print(self.downloadname) - try: - if (self.downloadname == None): - self.download = self.api.add_uris([self.url]) - else: - self.download = self.api.add_uris([self.url], options={"out": self.downloadname}) - except: - pass except: pass @@ -105,7 +106,10 @@ def run(self): time.sleep(1) def set_filename_label(self): - self.filename_label.set_text(self.download.name[:40]) + filename_shortened = self.download.name[:40] + if (self.download.name != filename_shortened): + filename_shortened = filename_shortened + "..." + self.filename_label.set_text(filename_shortened) def update_header_pause_button(self): self.app.all_paused = False diff --git a/src/initiate.py b/src/initiate.py index cbe011a..32d62f1 100644 --- a/src/initiate.py +++ b/src/initiate.py @@ -10,7 +10,7 @@ from gettext import gettext as _ def initiate(self): - self.downloaddir = GLib.get_user_special_dir(GLib.USER_DIRECTORY_DOWNLOAD) + self.downloaddir = self.appconf["download_directory"] self.applied_filter = "show_all" diff --git a/src/variamain.py b/src/variamain.py index 7a9d6df..bb0bab3 100644 --- a/src/variamain.py +++ b/src/variamain.py @@ -1,4 +1,4 @@ -variaVersion = "v2024.2.29-1" +variaVersion = "v2024.2.29-2" import gi import sys @@ -44,7 +44,10 @@ def __init__(self, variaapp, appdir, appconf, aria2c_subprocess, *args, **kwargs # Check if the download path still exists: if not (os.path.exists(self.appconf["download_directory"])): - self.appconf["download_directory"] = GLib.get_user_special_dir(GLib.USER_DIRECTORY_DOWNLOAD) + if (os.path.exists(GLib.get_user_special_dir(GLib.USER_DIRECTORY_DOWNLOAD))): + self.appconf["download_directory"] = GLib.get_user_special_dir(GLib.USER_DIRECTORY_DOWNLOAD) + else: + self.appconf["download_directory"] = GLib.get_user_special_dir(GLib.USER_DIRECTORY_HOME) self.save_appconf() # Set download speed limit from appconf: @@ -312,6 +315,16 @@ def main(version, aria2cexec): appdir = os.path.join(os.path.expanduser('~'), '.varia') if not os.path.exists(appdir): os.makedirs(appdir) + + download_directory = '' + + try: + if (os.path.exists(GLib.get_user_special_dir(GLib.USER_DIRECTORY_DOWNLOAD))): + download_directory = GLib.get_user_special_dir(GLib.USER_DIRECTORY_DOWNLOAD) + else: + download_directory = GLib.get_user_special_dir(GLib.USER_DIRECTORY_HOME) + except: + download_directory = GLib.get_user_special_dir(GLib.USER_DIRECTORY_HOME) appconf = { 'download_speed_limit_enabled': '0', @@ -319,7 +332,7 @@ def main(version, aria2cexec): 'auth': '0', 'auth_username': '', 'auth_password': '', - 'download_directory': GLib.get_user_special_dir(GLib.USER_DIRECTORY_DOWNLOAD), + 'download_directory': download_directory, 'download_simultaneous_amount': '5', 'remote': '0', 'remote_protocol': 'https://', diff --git a/src/window/sidebar.py b/src/window/sidebar.py index e14fb24..1cd9519 100644 --- a/src/window/sidebar.py +++ b/src/window/sidebar.py @@ -156,6 +156,22 @@ def show_about(app, variaapp, self, variaVersion): dialog.set_application_icon("io.github.giantpinkrobots.varia") dialog.set_translator_credits(_("translator-credits")) dialog.set_artists(["Jakub Steiner"]) + dialog.set_release_notes_version("v2024.2.29-2") + dialog.set_release_notes('''

v2024.2.29:

+ +

v2024.2.29-1:

+ +

v2024.2.29-2:

+ ''') dialog.show() def open_downloads_folder(self, app, variaapp, appconf):