import threading import requests import os import time from typing import List from download_manager import DownloadTask, DownloadStatus class DownloadChunk: def (self, start: int, end: int, thread_id: int): self.start = start self.end = end self.thread_id = thread_id self.downloaded = 0
def verify_md5(self, filepath: str) -> bool: import hashlib md5_hash = hashlib.md5() with open(filepath, 'rb') as f: for chunk in iter(lambda: f.read(4096), b""): md5_hash.update(chunk) computed_md5 = md5_hash.hexdigest() return computed_md5 == self.task.md5 ui/main_window.py eagleget for linux
def remove_download(self): selection = self.table_view.selectionModel() if selection.hasSelection(): index = selection.selectedRows()[0] task = self.model.data(index, Qt.UserRole) reply = QMessageBox.question(self, 'Confirm', f'Remove task.filename?', QMessageBox.Yes | QMessageBox.No) if reply == QMessageBox.Yes: self.manager.remove_download(task.id, delete_file=False) self.model.refresh() import threading import requests import os import time
window = MainWindow() window.show()
def get_data(self): return (self.url_input.text(), self.path_input.text(), self.threads_spin.value()) src/browser_integration.py DownloadStatus class DownloadChunk: def (self
class DownloadTableModel(QAbstractTableModel): def (self, download_manager): super(). init () self.manager = download_manager self.headers = ['Filename', 'Size', 'Progress', 'Speed', 'Status']
def rowCount(self, parent=QModelIndex()): return len(self.manager.tasks)