fix: finally solved our caching dilemna
This commit is contained in:
@@ -9,8 +9,7 @@
|
|||||||
"--share=ipc",
|
"--share=ipc",
|
||||||
"--socket=fallback-x11",
|
"--socket=fallback-x11",
|
||||||
"--device=dri",
|
"--device=dri",
|
||||||
"--socket=wayland",
|
"--socket=wayland"
|
||||||
"--filesystem=home"
|
|
||||||
],
|
],
|
||||||
"cleanup" : [
|
"cleanup" : [
|
||||||
"/include",
|
"/include",
|
||||||
|
@@ -4,6 +4,7 @@ import json
|
|||||||
import requests
|
import requests
|
||||||
import urllib.request
|
import urllib.request
|
||||||
import http
|
import http
|
||||||
|
import os
|
||||||
|
|
||||||
gi.require_version("Gtk", "4.0")
|
gi.require_version("Gtk", "4.0")
|
||||||
gi.require_version("Adw", "1")
|
gi.require_version("Adw", "1")
|
||||||
@@ -84,12 +85,15 @@ class LemonadeWindow(Gtk.ApplicationWindow):
|
|||||||
|
|
||||||
if "icon" in community["community"]:
|
if "icon" in community["community"]:
|
||||||
try:
|
try:
|
||||||
|
print(f"Downloading icon for {community['community']['title']}")
|
||||||
name = community["community"]["icon"].split("/")[-1]
|
name = community["community"]["icon"].split("/")[-1]
|
||||||
urllib.request.urlretrieve(community["community"]["icon"], f"~/.cache/{name}")
|
urllib.request.urlretrieve(community["community"]["icon"], f"{os.environ['XDG_RUNTIME_DIR']}/app/{os.environ['FLATPAK_ID']}/cache/{name}")
|
||||||
avatar.set_custom_image(Gdk.Texture.new_from_file(Gio.File.new_for_path(f"~/.cache/{name}")))
|
avatar.set_custom_image(Gdk.Texture.new_from_file(Gio.File.new_for_path(f"{os.environ['XDG_RUNTIME_DIR']}/app/{os.environ['FLATPAK_ID']}/cache/{name}")))
|
||||||
except:
|
except:
|
||||||
|
print(f"Error getting icon for {community['community']['title']}")
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
|
print(f"No icon found for {community['community']['title']}, skipping")
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if not "description" in community["community"]:
|
if not "description" in community["community"]:
|
||||||
|
Reference in New Issue
Block a user