Skip to content

Commit

Permalink
resolved conflicts and prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
KelvinDiasMoreira committed Feb 2, 2025
2 parents f162444 + 3247fcd commit bc31a28
Show file tree
Hide file tree
Showing 208 changed files with 4,274 additions and 3,917 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ aria2/

# Sentry Config File
.env.sentry-build-plugin

*storybook.log
7 changes: 7 additions & 0 deletions electron.vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ export default defineConfig(({ mode }) => {
build: {
sourcemap: true,
},
css: {
preprocessorOptions: {
scss: {
api: "modern",
},
},
},
resolve: {
alias: {
"@renderer": resolve("src/renderer/src"),
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"auto-launch": "^5.0.6",
"axios": "^1.7.9",
"better-sqlite3": "^11.7.0",
"classic-level": "^2.0.0",
"classnames": "^2.5.1",
"color": "^4.2.3",
"color.js": "^1.2.0",
Expand Down Expand Up @@ -74,7 +75,6 @@
"sound-play": "^1.1.0",
"sudo-prompt": "^9.2.1",
"tar": "^7.4.3",
"typeorm": "^0.3.20",
"user-agents": "^1.1.387",
"yaml": "^2.6.1",
"yup": "^1.5.0",
Expand Down
5 changes: 3 additions & 2 deletions python_rpc/http_downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@ def __init__(self):
)
)

def start_download(self, url: str, save_path: str, header: str):
def start_download(self, url: str, save_path: str, header: str, out: str = None):
if self.download:
self.aria2.resume([self.download])
else:
downloads = self.aria2.add(url, options={"header": header, "dir": save_path})
downloads = self.aria2.add(url, options={"header": header, "dir": save_path, "out": out})

self.download = downloads[0]

def pause_download(self):
Expand Down
18 changes: 9 additions & 9 deletions python_rpc/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@
torrent_downloader = TorrentDownloader(torrent_session)
downloads[initial_download['game_id']] = torrent_downloader
try:
torrent_downloader.start_download(initial_download['url'], initial_download['save_path'], "")
torrent_downloader.start_download(initial_download['url'], initial_download['save_path'])
except Exception as e:
print("Error starting torrent download", e)
else:
http_downloader = HttpDownloader()
downloads[initial_download['game_id']] = http_downloader
try:
http_downloader.start_download(initial_download['url'], initial_download['save_path'], initial_download.get('header'))
http_downloader.start_download(initial_download['url'], initial_download['save_path'], initial_download.get('header'), initial_download.get("out"))
except Exception as e:
print("Error starting http download", e)

Expand All @@ -45,7 +45,7 @@
torrent_downloader = TorrentDownloader(torrent_session, lt.torrent_flags.upload_mode)
downloads[seed['game_id']] = torrent_downloader
try:
torrent_downloader.start_download(seed['url'], seed['save_path'], "")
torrent_downloader.start_download(seed['url'], seed['save_path'])
except Exception as e:
print("Error starting seeding", e)

Expand Down Expand Up @@ -94,7 +94,7 @@ def seed_status():

@app.route("/healthcheck", methods=["GET"])
def healthcheck():
return "", 200
return "ok", 200

@app.route("/process-list", methods=["GET"])
def process_list():
Expand Down Expand Up @@ -140,18 +140,18 @@ def action():

if url.startswith('magnet'):
if existing_downloader and isinstance(existing_downloader, TorrentDownloader):
existing_downloader.start_download(url, data['save_path'], "")
existing_downloader.start_download(url, data['save_path'])
else:
torrent_downloader = TorrentDownloader(torrent_session)
downloads[game_id] = torrent_downloader
torrent_downloader.start_download(url, data['save_path'], "")
torrent_downloader.start_download(url, data['save_path'])
else:
if existing_downloader and isinstance(existing_downloader, HttpDownloader):
existing_downloader.start_download(url, data['save_path'], data.get('header'))
existing_downloader.start_download(url, data['save_path'], data.get('header'), data.get('out'))
else:
http_downloader = HttpDownloader()
downloads[game_id] = http_downloader
http_downloader.start_download(url, data['save_path'], data.get('header'))
http_downloader.start_download(url, data['save_path'], data.get('header'), data.get('out'))

downloading_game_id = game_id

Expand All @@ -167,7 +167,7 @@ def action():
elif action == 'resume_seeding':
torrent_downloader = TorrentDownloader(torrent_session, lt.torrent_flags.upload_mode)
downloads[game_id] = torrent_downloader
torrent_downloader.start_download(data['url'], data['save_path'], "")
torrent_downloader.start_download(data['url'], data['save_path'])
elif action == 'pause_seeding':
downloader = downloads.get(game_id)
if downloader:
Expand Down
2 changes: 1 addition & 1 deletion python_rpc/torrent_downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def __init__(self, torrent_session, flags = lt.torrent_flags.auto_managed):
"http://bvarf.tracker.sh:2086/announce",
]

def start_download(self, magnet: str, save_path: str, header: str):
def start_download(self, magnet: str, save_path: str):
params = {'url': magnet, 'save_path': save_path, 'trackers': self.trackers, 'flags': self.flags}
self.torrent_handle = self.session.add_torrent(params)
self.torrent_handle.resume()
Expand Down
Loading

0 comments on commit bc31a28

Please sign in to comment.