mirror of
https://github.com/KeksPirates/SoftwareManager.git
synced 2026-08-04 09:59:41 +02:00
INCOMPLETE, DONT PUSH:
refactor: reorganize state management and update import paths across modules and start changing json parsing
This commit is contained in:
@@ -2,7 +2,7 @@ import requests
|
||||
from bs4 import BeautifulSoup
|
||||
from core.network.aria2_wrapper import start_client
|
||||
from core.network.aria2_wrapper import add_magnet
|
||||
from core.utils.state import state
|
||||
from core.utils.data.state import state
|
||||
|
||||
|
||||
|
||||
@@ -39,4 +39,5 @@ def get_magnet_link(post_url, debug):
|
||||
except requests.RequestException as e:
|
||||
if debug:
|
||||
print(f"Failed to fetch {post_url}: {e}")
|
||||
return None
|
||||
return None
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
from core.utils.data.state import state
|
||||
from core.utils.data.tracker import get_item_index
|
||||
from core.utils.wrappers import run_thread
|
||||
import threading
|
||||
|
||||
|
||||
def download_selected(item, ):
|
||||
if item is not None:
|
||||
if state.debug:
|
||||
print(f"network {item.text()}")
|
||||
run_thread(threading.Thread(target=get_item_index, args=(item.text(), self.postnames, self.postlinks, state.debug)))
|
||||
else:
|
||||
if state.debug:
|
||||
print("No item selected for download.")
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
def split_data(data):
|
||||
json = json.loads(data)
|
||||
|
||||
count = json["count"]
|
||||
posts = json["data"]
|
||||
query = json["query"]
|
||||
success = json["success"]
|
||||
|
||||
return count, posts, query, success
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from core.utils.state import state
|
||||
from core.utils.data.state import state
|
||||
|
||||
|
||||
def restart_aria2c():
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
def run_thread(thread):
|
||||
thread.start()
|
||||
Reference in New Issue
Block a user