Eagleget For Linux < ESSENTIAL 2025 >
def columnCount(self, parent=QModelIndex()): return len(self.headers)
def pause_download(self, task_id: str): if task_id in self.active_downloads: self.active_downloads[task_id].pause() self.tasks[task_id].status = DownloadStatus.PAUSED self.save_task(self.tasks[task_id])
def headerData(self, section, orientation, role=Qt.DisplayRole): if orientation == Qt.Horizontal and role == Qt.DisplayRole: return self.headers[section] return None
def init_database(self): conn = sqlite3.connect(self.db_path) cursor = conn.cursor() cursor.execute(''' CREATE TABLE IF NOT EXISTS downloads ( id TEXT PRIMARY KEY, url TEXT, filename TEXT, save_path TEXT, total_size INTEGER, downloaded_size INTEGER, status TEXT, threads INTEGER, speed REAL, created_at TEXT, completed_at TEXT, md5 TEXT ) ''') conn.commit() conn.close() eagleget for linux
import socket import json import threading from http.server import HTTPServer, BaseHTTPRequestHandler class DownloadHandler(BaseHTTPRequestHandler): def do_POST(self): if self.path == '/download': content_length = int(self.headers['Content-Length']) post_data = self.rfile.read(content_length) data = json.loads(post_data.decode('utf-8'))
window = MainWindow() window.show()
@dataclass class DownloadTask: id: str url: str filename: str save_path: str total_size: int downloaded_size: int status: DownloadStatus threads: int speed: float created_at: datetime completed_at: Optional[datetime] md5: Optional[str] def columnCount(self, parent=QModelIndex()): return len(self
from setuptools import setup, find_packages setup( name="eagleget-linux", version="1.0.0", packages=find_packages(), install_requires=[ 'requests>=2.25.0', 'PyQt5>=5.15.0', 'pyperclip>=1.8.0', 'python-magic>=0.4.0', ], entry_points= 'console_scripts': [ 'eagleget=src.main:main', ], , author="Your Name", description="EagleGet Download Manager for Linux", classifiers=[ 'Development Status :: 4 - Beta', 'Intended Audience :: End Users/Desktop', 'License :: OSI Approved :: MIT License', 'Programming Language :: Python :: 3', ], )
sys.exit(app.exec_()) if == ' main ': main() Desktop Integration eagleget.desktop
def refresh(self): self.layoutChanged.emit() class MainWindow(QMainWindow): def (self): super(). init () self.manager = DownloadManager() self.init_ui() self.timer = QTimer() self.timer.timeout.connect(self.update_progress) self.timer.start(1000) find_packages setup( name="eagleget-linux"
def start_download(self): selection = self.table_view.selectionModel() if selection.hasSelection(): index = selection.selectedRows()[0] task = self.model.data(index, Qt.UserRole) if task.status in [DownloadStatus.PAUSED, DownloadStatus.PENDING]: self.manager.start_download(task.id)
class DownloadThread(threading.Thread): def (self, task: DownloadTask): super(). init () self.task = task self.chunks: List[DownloadChunk] = [] self.paused = False self.stopped = False self.lock = threading.Lock() self.start_time = None self.last_update = None self.last_downloaded = 0
def stop(self): self.stopped = True
def update_progress(self): self.model.refresh() stats = self.manager.get_statistics() self.status_label.setText( f"Total: stats['total'] | " f"Downloading: stats['downloading'] | " f"Completed: stats['completed'] | " f"Size: self.format_size(stats['downloaded_size']) / self.format_size(stats['total_size'])" )
def save_task(self, task: DownloadTask): conn = sqlite3.connect(self.db_path) cursor = conn.cursor() cursor.execute(''' INSERT OR REPLACE INTO downloads (id, url, filename, save_path, total_size, downloaded_size, status, threads, speed, created_at, completed_at, md5) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ''', ( task.id, task.url, task.filename, task.save_path, task.total_size, task.downloaded_size, task.status.value, task.threads, task.speed, task.created_at.isoformat(), task.completed_at.isoformat() if task.completed_at else None, task.md5 )) conn.commit() conn.close()