alaskavix12 commited on
Commit
5a88c0e
·
1 Parent(s): 103500d

initial commit

Browse files
Files changed (1) hide show
  1. aria.py +9 -17
aria.py CHANGED
@@ -5,15 +5,16 @@ import logging
5
  logging.basicConfig(level=logging.INFO)
6
  logger = logging.getLogger(__name__)
7
 
 
8
  class Aria:
9
- def __init__(self, host="http://localhost", port=6800, secret="", download_dir="/app/download"):
10
- self.aria2 = aria2p.API(
11
- aria2p.Client(
12
- host=host,
13
- port=port,
14
- secret=secret
15
- )
16
- )
17
  self.download_dir = download_dir
18
  self.reported_downloads = set()
19
  logger.info("Aria2 client initialized")
@@ -28,14 +29,5 @@ class Aria:
28
  logger.error(f"Failed to start download: {e}")
29
  return None
30
 
31
- def check_downloads(self):
32
- downloads = self.aria2.get_downloads()
33
- for download in downloads:
34
- if download.is_complete and download.gid not in self.reported_downloads:
35
- self.reported_downloads.add(download.gid)
36
- logger.info(f"Download complete: {download.name}")
37
- return download
38
- return None
39
-
40
  def listen_to_events(self, callback):
41
  self.aria2.listen_to_notifications(callback)
 
5
  logging.basicConfig(level=logging.INFO)
6
  logger = logging.getLogger(__name__)
7
 
8
+
9
  class Aria:
10
+ def __init__(
11
+ self,
12
+ host="http://localhost",
13
+ port=6800,
14
+ secret="",
15
+ download_dir="/app/download",
16
+ ):
17
+ self.aria2 = aria2p.API(aria2p.Client(host=host, port=port, secret=secret))
18
  self.download_dir = download_dir
19
  self.reported_downloads = set()
20
  logger.info("Aria2 client initialized")
 
29
  logger.error(f"Failed to start download: {e}")
30
  return None
31
 
 
 
 
 
 
 
 
 
 
32
  def listen_to_events(self, callback):
33
  self.aria2.listen_to_notifications(callback)