Skip to content

Commit

Permalink
v2024.2.29-2
Browse files Browse the repository at this point in the history
  • Loading branch information
giantpinkrobots committed Mar 3, 2024
1 parent 4398ba4 commit cde9c74
Show file tree
Hide file tree
Showing 8 changed files with 88 additions and 33 deletions.
17 changes: 16 additions & 1 deletion data/io.github.giantpinkrobots.varia.metainfo.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,21 @@
<url type="vcs-browser">https://github.com/giantpinkrobots/varia</url>
<url type="translate">https://github.com/giantpinkrobots/varia/tree/main/po</url>

<languages>
<lang>en_US</lang>
<lang>de_DE</lang>
<lang>it_IT</lang>
<lang>nl_NL</lang>
<lang>oc_FR</lang>
<lang>pt_BR</lang>
<lang>ru_RU</lang>
<lang>tr_TR</lang>
<lang>uk_UA</lang>
<lang>fr_FR</lang>
<lang>zh_TW</lang>
<lang>nb_NO</lang>
</languages>

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

<releases>
<release version="v2024.2.29-1" date="2024-03-01">
<release version="v2024.2.29-2" date="2024-03-03">
<description translatable="yes">
<p>- Support for Firefox and Chromium extension.</p>
<p>- Initial torrenting support.</p>
Expand Down
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
@@ -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', ],
)
Expand Down
33 changes: 19 additions & 14 deletions src/download/actionrow.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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()
Expand All @@ -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
Expand Down
12 changes: 7 additions & 5 deletions src/download/listen.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
20 changes: 12 additions & 8 deletions src/download/thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/initiate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
19 changes: 16 additions & 3 deletions src/variamain.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
variaVersion = "v2024.2.29-1"
variaVersion = "v2024.2.29-2"

import gi
import sys
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -312,14 +315,24 @@ 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',
'download_speed_limit': '0',
'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://',
Expand Down
16 changes: 16 additions & 0 deletions src/window/sidebar.py
Original file line number Diff line number Diff line change
Expand Up @@ -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('''<p>v2024.2.29:</p>
<ul><li>Support for Firefox and Chromium extension.</li>
<li>Initial torrenting support.</li>
<li>Remote mode that allows connection to a remote aria2 instance.</li>
<li>Background mode that allows the window to be hidden while still downloading.</li>
<li>Bug fixes and adjustments.</li></ul>
<p>v2024.2.29-1:</p>
<ul><li>Hotfix: an error that prevented the app from running in the Flathub release.</li>
<li>German translation updates.</li>
<li>Dutch translation updates.</li></ul>
<p>v2024.2.29-2:</p>
<ul><li>Hotfix: an error in the browser extension integration.</li>
<li>Tiny UI adjustments.</li>
<li>Russian translation updates.</li>
<li>New Norwegian (Bokmål) translation.</li></ul>''')
dialog.show()

def open_downloads_folder(self, app, variaapp, appconf):
Expand Down

0 comments on commit cde9c74

Please sign in to comment.