Compare commits

...
3 Commits
Author SHA1 Message Date
afkarxyz 312b6b2c50 v3.9 2025-11-29 06:46:11 +07:00
afkarxyz 671209714b v3.8
v3.8
2025-11-18 14:17:00 +07:00
afkarxyz bc450ff204 v3.8 2025-11-18 13:55:25 +07:00
15 changed files with 95 additions and 163 deletions

No files matched your search

+1 -3
View File
@@ -23,12 +23,10 @@
- **MP4 → GIF conversion:** Convert downloaded MP4 videos into GIF format - **MP4 → GIF conversion:** Convert downloaded MP4 videos into GIF format
- Downloads at original quality - Downloads at original quality
## 🖼️ Screenshots ## 🖼️ Screenshot
![Image](https://github.com/user-attachments/assets/80b9f665-5fb4-4d17-bd40-56960029688d) ![Image](https://github.com/user-attachments/assets/80b9f665-5fb4-4d17-bd40-56960029688d)
![Image](https://github.com/user-attachments/assets/8bcb02e7-d7da-45da-ab5d-4d94a91b30b1)
### The downloaded application won't run❓ ### The downloaded application won't run❓
🐧 **Solution (Ubuntu/Linux)**: Open your terminal and run: 🐧 **Solution (Ubuntu/Linux)**: Open your terminal and run:
+1 -1
View File
@@ -5,4 +5,4 @@ imageio-ffmpeg
packaging packaging
gallery-dl gallery-dl
pyqtdarktheme pyqtdarktheme
pyinstaller qtawesome
-1
View File
@@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-cancel"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M3 12a9 9 0 1 0 18 0a9 9 0 1 0 -18 0" /><path d="M18.364 5.636l-12.728 12.728" /></svg>

Before

Width:  |  Height:  |  Size: 396 B

-1
View File
@@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-database-export"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M4 6c0 1.657 3.582 3 8 3s8 -1.343 8 -3s-3.582 -3 -8 -3s-8 1.343 -8 3" /><path d="M4 6v6c0 1.657 3.582 3 8 3c1.118 0 2.183 -.086 3.15 -.241" /><path d="M20 12v-6" /><path d="M4 12v6c0 1.657 3.582 3 8 3c.157 0 .312 -.002 .466 -.005" /><path d="M16 19h6" /><path d="M19 16l3 3l-3 3" /></svg>

Before

Width:  |  Height:  |  Size: 616 B

-1
View File
@@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-database-import"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M4 6c0 1.657 3.582 3 8 3s8 -1.343 8 -3s-3.582 -3 -8 -3s-8 1.343 -8 3" /><path d="M4 6v6c0 1.657 3.582 3 8 3c.856 0 1.68 -.05 2.454 -.144m5.546 -2.856v-6" /><path d="M4 12v6c0 1.657 3.582 3 8 3c.171 0 .341 -.002 .51 -.006" /><path d="M19 22v-6" /><path d="M22 19l-3 -3l-3 3" /></svg>

Before

Width:  |  Height:  |  Size: 610 B

-1
View File
@@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-device-floppy"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M6 4h10l4 4v10a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2v-12a2 2 0 0 1 2 -2" /><path d="M12 14m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0" /><path d="M14 4l0 4l-6 0l0 -4" /></svg>

Before

Width:  |  Height:  |  Size: 479 B

-1
View File
@@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-download"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2" /><path d="M7 11l5 5l5 -5" /><path d="M12 4l0 12" /></svg>

Before

Width:  |  Height:  |  Size: 423 B

-1
View File
@@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-edit"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M7 7h-1a2 2 0 0 0 -2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2 -2v-1" /><path d="M20.385 6.585a2.1 2.1 0 0 0 -2.97 -2.97l-8.415 8.385v3h3l8.385 -8.415z" /><path d="M16 5l3 3" /></svg>

Before

Width:  |  Height:  |  Size: 480 B

-1
View File
@@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-player-pause"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M6 5m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v12a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z" /><path d="M14 5m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v12a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z" /></svg>

Before

Width:  |  Height:  |  Size: 493 B

-1
View File
@@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-player-play"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M7 4v16l13 -8z" /></svg>

Before

Width:  |  Height:  |  Size: 338 B

-1
View File
@@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-reload"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M19.933 13.041a8 8 0 1 1 -9.925 -8.788c3.899 -1 7.935 1.007 9.425 4.747" /><path d="M20 4v5h-5" /></svg>

Before

Width:  |  Height:  |  Size: 423 B

-1
View File
@@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-trash"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M4 7l16 0" /><path d="M10 11l0 6" /><path d="M14 11l0 6" /><path d="M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12" /><path d="M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3" /></svg>

Before

Width:  |  Height:  |  Size: 495 B

+70 -99
View File
@@ -6,6 +6,7 @@ from datetime import datetime
from pathlib import Path from pathlib import Path
from packaging import version from packaging import version
import qdarktheme import qdarktheme
import qtawesome as qta
from PyQt6.QtWidgets import ( from PyQt6.QtWidgets import (
QApplication, QWidget, QVBoxLayout, QHBoxLayout, QPushButton, QLineEdit, QApplication, QWidget, QVBoxLayout, QHBoxLayout, QPushButton, QLineEdit,
QLabel, QFileDialog, QListWidget, QTextEdit, QTabWidget, QAbstractItemView, QProgressBar, QCheckBox, QDialog, QLabel, QFileDialog, QListWidget, QTextEdit, QTabWidget, QAbstractItemView, QProgressBar, QCheckBox, QDialog,
@@ -14,7 +15,6 @@ from PyQt6.QtWidgets import (
from PyQt6.QtCore import Qt, QThread, pyqtSignal, QUrl, QTimer, QTime, QSettings, QSize, QDate from PyQt6.QtCore import Qt, QThread, pyqtSignal, QUrl, QTimer, QTime, QSettings, QSize, QDate
from PyQt6.QtNetwork import QNetworkAccessManager, QNetworkRequest from PyQt6.QtNetwork import QNetworkAccessManager, QNetworkRequest
from PyQt6.QtGui import QIcon, QTextCursor, QDesktopServices, QPixmap, QPainter, QPainterPath from PyQt6.QtGui import QIcon, QTextCursor, QDesktopServices, QPixmap, QPainter, QPainterPath
from PyQt6.QtSvg import QSvgRenderer
from core.databaseManager import DatabaseManager from core.databaseManager import DatabaseManager
from core.metadataWorker import MetadataFetchWorker from core.metadataWorker import MetadataFetchWorker
@@ -27,7 +27,7 @@ ICON_DIR = os.path.join(os.path.dirname(__file__), 'icons')
class TwitterXMediaBatchDownloaderGUI(QWidget): class TwitterXMediaBatchDownloaderGUI(QWidget):
def __init__(self): def __init__(self):
super().__init__() super().__init__()
self.current_version = "3.8" self.current_version = "3.9"
self.accounts = [] self.accounts = []
self.temp_dir = os.path.join(Path.home(), ".twitterxmediabatchdownloader") self.temp_dir = os.path.join(Path.home(), ".twitterxmediabatchdownloader")
os.makedirs(self.temp_dir, exist_ok=True) os.makedirs(self.temp_dir, exist_ok=True)
@@ -118,10 +118,11 @@ class TwitterXMediaBatchDownloaderGUI(QWidget):
def check_updates(self): def check_updates(self):
try: try:
response = requests.get("https://raw.githubusercontent.com/afkarxyz/Twitter-X-Media-Batch-Downloader/refs/heads/main/version.json") response = requests.get("https://api.github.com/repos/afkarxyz/Twitter-X-Media-Batch-Downloader/releases/latest")
if response.status_code == 200: if response.status_code == 200:
data = response.json() data = response.json()
new_version = data.get("version") tag_name = data.get("tag_name", "")
new_version = tag_name.lstrip("v")
if new_version and version.parse(new_version) > version.parse(self.current_version): if new_version and version.parse(new_version) > version.parse(self.current_version):
dialog = UpdateDialog(self.current_version, new_version, self) dialog = UpdateDialog(self.current_version, new_version, self)
@@ -144,8 +145,7 @@ class TwitterXMediaBatchDownloaderGUI(QWidget):
self.stop_btn.hide() self.stop_btn.hide()
self.pause_resume_btn.hide() self.pause_resume_btn.hide()
self.pause_resume_btn.setText(' Pause') self.pause_resume_btn.setText(' Pause')
icon_dir = ICON_DIR self.pause_resume_btn.setIcon(self.create_colored_icon('fa6s.pause', self.current_theme_color))
self.pause_resume_btn.setIcon(self.create_colored_icon(os.path.join(icon_dir, 'player-pause.svg'), self.current_theme_color))
self.pause_fetch_btn.hide() self.pause_fetch_btn.hide()
self.stop_fetch_btn.hide() self.stop_fetch_btn.hide()
self.is_auto_fetching = False self.is_auto_fetching = False
@@ -319,20 +319,19 @@ class TwitterXMediaBatchDownloaderGUI(QWidget):
self.update_selected_btn = QPushButton(' Update') self.update_selected_btn = QPushButton(' Update')
self.delete_btn = QPushButton(' Delete') self.delete_btn = QPushButton(' Delete')
icon_dir = ICON_DIR
accent_color = self.current_theme_color accent_color = self.current_theme_color
self.import_btn.setIcon(self.create_colored_icon(os.path.join(icon_dir, 'database-import.svg'), accent_color)) self.import_btn.setIcon(self.create_colored_icon('fa6s.file-import', accent_color))
self.export_btn.setIcon(self.create_colored_icon(os.path.join(icon_dir, 'database-export.svg'), accent_color)) self.export_btn.setIcon(self.create_colored_icon('fa6s.file-export', accent_color))
self.download_selected_btn.setIcon(self.create_colored_icon(os.path.join(icon_dir, 'download.svg'), accent_color)) self.download_selected_btn.setIcon(self.create_colored_icon('fa6s.download', accent_color))
self.update_selected_btn.setIcon(self.create_colored_icon(os.path.join(icon_dir, 'reload.svg'), accent_color)) self.update_selected_btn.setIcon(self.create_colored_icon('fa6s.arrows-rotate', accent_color))
self.delete_btn.setIcon(self.create_colored_icon(os.path.join(icon_dir, 'trash.svg'), accent_color)) self.delete_btn.setIcon(self.create_colored_icon('fa6s.trash', accent_color))
for btn in [self.import_btn, self.export_btn, self.download_selected_btn, for btn in [self.import_btn, self.export_btn, self.download_selected_btn,
self.update_selected_btn, self.delete_btn]: self.update_selected_btn, self.delete_btn]:
btn.setMinimumWidth(100) btn.setMinimumWidth(100)
btn.setCursor(Qt.CursorShape.PointingHandCursor) btn.setCursor(Qt.CursorShape.PointingHandCursor)
btn.setIconSize(QSize(18, 18)) btn.setIconSize(QSize(16, 16))
self.import_btn.clicked.connect(self.import_accounts) self.import_btn.clicked.connect(self.import_accounts)
self.export_btn.clicked.connect(self.export_accounts) self.export_btn.clicked.connect(self.export_accounts)
@@ -350,38 +349,37 @@ class TwitterXMediaBatchDownloaderGUI(QWidget):
if not hasattr(self, 'import_btn'): if not hasattr(self, 'import_btn'):
return return
icon_dir = ICON_DIR
accent_color = self.current_theme_color accent_color = self.current_theme_color
self.import_btn.setIcon(self.create_colored_icon(os.path.join(icon_dir, 'database-import.svg'), accent_color)) self.import_btn.setIcon(self.create_colored_icon('fa6s.file-import', accent_color))
self.export_btn.setIcon(self.create_colored_icon(os.path.join(icon_dir, 'database-export.svg'), accent_color)) self.export_btn.setIcon(self.create_colored_icon('fa6s.file-export', accent_color))
self.download_selected_btn.setIcon(self.create_colored_icon(os.path.join(icon_dir, 'download.svg'), accent_color)) self.download_selected_btn.setIcon(self.create_colored_icon('fa6s.download', accent_color))
self.update_selected_btn.setIcon(self.create_colored_icon(os.path.join(icon_dir, 'reload.svg'), accent_color)) self.update_selected_btn.setIcon(self.create_colored_icon('fa6s.arrows-rotate', accent_color))
self.delete_btn.setIcon(self.create_colored_icon(os.path.join(icon_dir, 'trash.svg'), accent_color)) self.delete_btn.setIcon(self.create_colored_icon('fa6s.trash', accent_color))
if hasattr(self, 'rename_group_btn'): if hasattr(self, 'rename_group_btn'):
self.rename_group_btn.setIcon(self.create_colored_icon(os.path.join(icon_dir, 'edit.svg'), accent_color)) self.rename_group_btn.setIcon(self.create_colored_icon('fa6s.pen-to-square', accent_color))
if hasattr(self, 'delete_group_btn'): if hasattr(self, 'delete_group_btn'):
self.delete_group_btn.setIcon(self.create_colored_icon(os.path.join(icon_dir, 'trash.svg'), accent_color)) self.delete_group_btn.setIcon(self.create_colored_icon('fa6s.trash', accent_color))
if hasattr(self, 'assign_to_group_btn'): if hasattr(self, 'assign_to_group_btn'):
self.assign_to_group_btn.setIcon(self.create_colored_icon(os.path.join(icon_dir, 'category-plus.svg'), accent_color)) self.assign_to_group_btn.setIcon(self.create_colored_icon('fa6s.folder-plus', accent_color))
if hasattr(self, 'save_assignment_btn'): if hasattr(self, 'save_assignment_btn'):
self.save_assignment_btn.setIcon(self.create_colored_icon(os.path.join(icon_dir, 'device-floppy.svg'), accent_color)) self.save_assignment_btn.setIcon(self.create_colored_icon('fa6s.floppy-disk', accent_color))
if hasattr(self, 'stop_btn'): if hasattr(self, 'stop_btn'):
self.stop_btn.setIcon(self.create_colored_icon(os.path.join(icon_dir, 'cancel.svg'), accent_color)) self.stop_btn.setIcon(self.create_colored_icon('fa6s.circle-xmark', accent_color))
if hasattr(self, 'pause_resume_btn'): if hasattr(self, 'pause_resume_btn'):
if self.pause_resume_btn.text() == ' Resume': if self.pause_resume_btn.text() == ' Resume':
self.pause_resume_btn.setIcon(self.create_colored_icon(os.path.join(icon_dir, 'player-play.svg'), accent_color)) self.pause_resume_btn.setIcon(self.create_colored_icon('fa6s.play', accent_color))
else: else:
self.pause_resume_btn.setIcon(self.create_colored_icon(os.path.join(icon_dir, 'player-pause.svg'), accent_color)) self.pause_resume_btn.setIcon(self.create_colored_icon('fa6s.pause', accent_color))
if hasattr(self, 'stop_fetch_btn'): if hasattr(self, 'stop_fetch_btn'):
self.stop_fetch_btn.setIcon(self.create_colored_icon(os.path.join(icon_dir, 'cancel.svg'), accent_color)) self.stop_fetch_btn.setIcon(self.create_colored_icon('fa6s.circle-xmark', accent_color))
if hasattr(self, 'pause_fetch_btn'): if hasattr(self, 'pause_fetch_btn'):
if self.pause_fetch_btn.text() == ' Resume': if self.pause_fetch_btn.text() == ' Resume':
self.pause_fetch_btn.setIcon(self.create_colored_icon(os.path.join(icon_dir, 'player-play.svg'), accent_color)) self.pause_fetch_btn.setIcon(self.create_colored_icon('fa6s.play', accent_color))
else: else:
self.pause_fetch_btn.setIcon(self.create_colored_icon(os.path.join(icon_dir, 'player-pause.svg'), accent_color)) self.pause_fetch_btn.setIcon(self.create_colored_icon('fa6s.pause', accent_color))
def setup_group_tab(self): def setup_group_tab(self):
group_tab = QWidget() group_tab = QWidget()
@@ -420,15 +418,14 @@ class TwitterXMediaBatchDownloaderGUI(QWidget):
self.rename_group_btn = QPushButton(" Rename") self.rename_group_btn = QPushButton(" Rename")
self.delete_group_btn = QPushButton(" Delete") self.delete_group_btn = QPushButton(" Delete")
icon_dir = ICON_DIR
accent_color = self.current_theme_color accent_color = self.current_theme_color
self.rename_group_btn.setIcon(self.create_colored_icon(os.path.join(icon_dir, 'edit.svg'), accent_color)) self.rename_group_btn.setIcon(self.create_colored_icon('fa6s.pen-to-square', accent_color))
self.delete_group_btn.setIcon(self.create_colored_icon(os.path.join(icon_dir, 'trash.svg'), accent_color)) self.delete_group_btn.setIcon(self.create_colored_icon('fa6s.trash', accent_color))
for btn in [self.rename_group_btn, self.delete_group_btn]: for btn in [self.rename_group_btn, self.delete_group_btn]:
btn.setCursor(Qt.CursorShape.PointingHandCursor) btn.setCursor(Qt.CursorShape.PointingHandCursor)
btn.setIconSize(QSize(18, 18)) btn.setIconSize(QSize(16, 16))
btn.setEnabled(False) btn.setEnabled(False)
self.rename_group_btn.clicked.connect(self.rename_group) self.rename_group_btn.clicked.connect(self.rename_group)
@@ -465,9 +462,8 @@ class TwitterXMediaBatchDownloaderGUI(QWidget):
self.save_assignment_btn.setEnabled(False) self.save_assignment_btn.setEnabled(False)
self.save_assignment_btn.clicked.connect(self.save_account_assignment) self.save_assignment_btn.clicked.connect(self.save_account_assignment)
icon_dir = ICON_DIR self.save_assignment_btn.setIcon(self.create_colored_icon('fa6s.floppy-disk', accent_color))
self.save_assignment_btn.setIcon(self.create_colored_icon(os.path.join(icon_dir, 'device-floppy.svg'), accent_color)) self.save_assignment_btn.setIconSize(QSize(16, 16))
self.save_assignment_btn.setIconSize(QSize(18, 18))
assign_btn_layout.addStretch() assign_btn_layout.addStretch()
assign_btn_layout.addWidget(self.save_assignment_btn) assign_btn_layout.addWidget(self.save_assignment_btn)
@@ -508,18 +504,17 @@ class TwitterXMediaBatchDownloaderGUI(QWidget):
self.stop_btn = QPushButton(' Stop') self.stop_btn = QPushButton(' Stop')
self.pause_resume_btn = QPushButton(' Pause') self.pause_resume_btn = QPushButton(' Pause')
icon_dir = ICON_DIR
accent_color = self.current_theme_color accent_color = self.current_theme_color
self.stop_btn.setIcon(self.create_colored_icon(os.path.join(icon_dir, 'cancel.svg'), accent_color)) self.stop_btn.setIcon(self.create_colored_icon('fa6s.circle-xmark', accent_color))
self.pause_resume_btn.setIcon(self.create_colored_icon(os.path.join(icon_dir, 'player-pause.svg'), accent_color)) self.pause_resume_btn.setIcon(self.create_colored_icon('fa6s.pause', accent_color))
self.stop_btn.setFixedWidth(120) self.stop_btn.setFixedWidth(120)
self.pause_resume_btn.setFixedWidth(120) self.pause_resume_btn.setFixedWidth(120)
self.stop_btn.setCursor(Qt.CursorShape.PointingHandCursor) self.stop_btn.setCursor(Qt.CursorShape.PointingHandCursor)
self.pause_resume_btn.setCursor(Qt.CursorShape.PointingHandCursor) self.pause_resume_btn.setCursor(Qt.CursorShape.PointingHandCursor)
self.stop_btn.setIconSize(QSize(18, 18)) self.stop_btn.setIconSize(QSize(16, 16))
self.pause_resume_btn.setIconSize(QSize(18, 18)) self.pause_resume_btn.setIconSize(QSize(16, 16))
self.stop_btn.clicked.connect(self.stop_download) self.stop_btn.clicked.connect(self.stop_download)
self.pause_resume_btn.clicked.connect(self.toggle_pause_resume) self.pause_resume_btn.clicked.connect(self.toggle_pause_resume)
@@ -534,13 +529,13 @@ class TwitterXMediaBatchDownloaderGUI(QWidget):
self.pause_fetch_btn = QPushButton(' Pause') self.pause_fetch_btn = QPushButton(' Pause')
self.stop_fetch_btn = QPushButton(' Stop') self.stop_fetch_btn = QPushButton(' Stop')
self.pause_fetch_btn.setIcon(self.create_colored_icon(os.path.join(icon_dir, 'player-pause.svg'), accent_color)) self.pause_fetch_btn.setIcon(self.create_colored_icon('fa6s.pause', accent_color))
self.stop_fetch_btn.setIcon(self.create_colored_icon(os.path.join(icon_dir, 'cancel.svg'), accent_color)) self.stop_fetch_btn.setIcon(self.create_colored_icon('fa6s.circle-xmark', accent_color))
for btn in [self.pause_fetch_btn, self.stop_fetch_btn]: for btn in [self.pause_fetch_btn, self.stop_fetch_btn]:
btn.setFixedWidth(120) btn.setFixedWidth(120)
btn.setCursor(Qt.CursorShape.PointingHandCursor) btn.setCursor(Qt.CursorShape.PointingHandCursor)
btn.setIconSize(QSize(18, 18)) btn.setIconSize(QSize(16, 16))
self.pause_fetch_btn.setToolTip("Pause batch fetching (can resume)") self.pause_fetch_btn.setToolTip("Pause batch fetching (can resume)")
self.stop_fetch_btn.setToolTip("Stop batch fetching completely") self.stop_fetch_btn.setToolTip("Stop batch fetching completely")
@@ -2005,23 +2000,8 @@ class TwitterXMediaBatchDownloaderGUI(QWidget):
self.update_button_states() self.update_button_states()
def create_colored_icon(self, svg_path, color): def create_colored_icon(self, icon_name, color):
with open(svg_path, 'r', encoding='utf-8') as f: return qta.icon(icon_name, color=color)
svg_content = f.read()
svg_content = svg_content.replace('stroke="currentColor"', f'stroke="{color}"')
svg_content = svg_content.replace('fill="currentColor"', f'fill="{color}"')
pixmap = QPixmap(24, 24)
pixmap.fill(Qt.GlobalColor.transparent)
from PyQt6.QtSvg import QSvgRenderer
renderer = QSvgRenderer(svg_content.encode('utf-8'))
painter = QPainter(pixmap)
renderer.render(painter)
painter.end()
return QIcon(pixmap)
def create_placeholder_icon(self, size=48): def create_placeholder_icon(self, size=48):
pixmap = QPixmap(size, size) pixmap = QPixmap(size, size)
@@ -2457,8 +2437,7 @@ class TwitterXMediaBatchDownloaderGUI(QWidget):
self.stop_btn.hide() self.stop_btn.hide()
self.pause_resume_btn.hide() self.pause_resume_btn.hide()
self.pause_resume_btn.setText(' Pause') self.pause_resume_btn.setText(' Pause')
icon_dir = ICON_DIR self.pause_resume_btn.setIcon(self.create_colored_icon('fa6s.pause', self.current_theme_color))
self.pause_resume_btn.setIcon(self.create_colored_icon(os.path.join(icon_dir, 'player-pause.svg'), self.current_theme_color))
self.stop_timer() self.stop_timer()
self.download_selected_btn.setEnabled(True) self.download_selected_btn.setEnabled(True)
@@ -2476,18 +2455,17 @@ class TwitterXMediaBatchDownloaderGUI(QWidget):
def toggle_pause_resume(self): def toggle_pause_resume(self):
if hasattr(self, 'worker'): if hasattr(self, 'worker'):
icon_dir = ICON_DIR
accent_color = self.current_theme_color accent_color = self.current_theme_color
if self.worker.is_paused: if self.worker.is_paused:
self.worker.resume() self.worker.resume()
self.pause_resume_btn.setText(' Pause') self.pause_resume_btn.setText(' Pause')
self.pause_resume_btn.setIcon(self.create_colored_icon(os.path.join(icon_dir, 'player-pause.svg'), accent_color)) self.pause_resume_btn.setIcon(self.create_colored_icon('fa6s.pause', accent_color))
self.timer.start(1000) self.timer.start(1000)
else: else:
self.worker.pause() self.worker.pause()
self.pause_resume_btn.setText(' Resume') self.pause_resume_btn.setText(' Resume')
self.pause_resume_btn.setIcon(self.create_colored_icon(os.path.join(icon_dir, 'player-play.svg'), accent_color)) self.pause_resume_btn.setIcon(self.create_colored_icon('fa6s.play', accent_color))
def delete_accounts(self): def delete_accounts(self):
selected_items = self.account_list.selectedItems() selected_items = self.account_list.selectedItems()
@@ -2582,54 +2560,50 @@ class TwitterXMediaBatchDownloaderGUI(QWidget):
self.log_output.append('No valid accounts found for export') self.log_output.append('No valid accounts found for export')
return return
now = datetime.now() export_dir = QFileDialog.getExistingDirectory(
date_str = now.strftime("%Y%m%d_%H%M%S")
default_filename = f"twitterxmediabatchdownloader_{date_str}.db"
file_path, _ = QFileDialog.getSaveFileName(
self, self,
"Export Database", "Select Export Directory",
os.path.join(self.last_output_path, default_filename), self.last_output_path
"Database Files (*.db)"
) )
if not file_path: if not export_dir:
self.log_output.append('Export cancelled') self.log_output.append('Export cancelled')
return return
self.log_output.append(f'Starting export of {len(selected_accounts)} account(s) to database...') self.log_output.append(f'Starting export of {len(selected_accounts)} account(s) to JSON...')
try: try:
export_db_manager = DatabaseManager(file_path)
exported_count = 0 exported_count = 0
for account in selected_accounts: for account in selected_accounts:
try: try:
export_db_manager.save_account( account_data = {
username=account.username, 'username': account.username,
nick=account.nick, 'nick': account.nick,
followers=account.followers, 'followers': account.followers,
following=account.following, 'following': account.following,
posts=account.posts, 'posts': account.posts,
media_type=account.media_type, 'media_type': account.media_type,
profile_image=account.profile_image, 'profile_image': account.profile_image,
fetch_mode=account.fetch_mode, 'fetch_mode': account.fetch_mode,
fetch_timestamp=account.fetch_timestamp 'fetch_timestamp': account.fetch_timestamp,
) 'group_id': account.group_id,
'media_list': account.media_list if account.media_list else []
}
if account.media_list: file_path = os.path.join(export_dir, f"{account.username}.json")
export_db_manager.save_media_list(account.username, account.media_list) with open(file_path, 'w', encoding='utf-8') as f:
json.dump(account_data, f, indent=2, ensure_ascii=False)
exported_count += 1 exported_count += 1
media_count = len(account.media_list) if account.media_list else 0 media_count = len(account.media_list) if account.media_list else 0
self.log_output.append(f'Exported: {account.username} ({media_count:,} media)') self.log_output.append(f'Exported: {account.username}.json ({media_count:,} media)')
except Exception as e: except Exception as e:
self.log_output.append(f'Error exporting {account.username}: {str(e)}') self.log_output.append(f'Error exporting {account.username}: {str(e)}')
export_db_manager.close()
self.log_output.append(f'Export completed: {exported_count}/{len(selected_accounts)} account(s) exported') self.log_output.append(f'Export completed: {exported_count}/{len(selected_accounts)} account(s) exported')
self.log_output.append(f'Export location: {file_path}') self.log_output.append(f'Export location: {export_dir}')
except Exception as e: except Exception as e:
self.log_output.append(f'Export error: {str(e)}') self.log_output.append(f'Export error: {str(e)}')
@@ -2868,8 +2842,7 @@ class TwitterXMediaBatchDownloaderGUI(QWidget):
self.metadata_worker.wait() self.metadata_worker.wait()
self.pause_fetch_btn.setText(' Resume') self.pause_fetch_btn.setText(' Resume')
icon_dir = ICON_DIR self.pause_fetch_btn.setIcon(self.create_colored_icon('fa6s.play', self.current_theme_color))
self.pause_fetch_btn.setIcon(self.create_colored_icon(os.path.join(icon_dir, 'player-play.svg'), self.current_theme_color))
self.pause_fetch_btn.clicked.disconnect() self.pause_fetch_btn.clicked.disconnect()
self.pause_fetch_btn.clicked.connect(self.resume_batch_fetch) self.pause_fetch_btn.clicked.connect(self.resume_batch_fetch)
self.log_output.append('Batch fetching paused.') self.log_output.append('Batch fetching paused.')
@@ -2877,8 +2850,7 @@ class TwitterXMediaBatchDownloaderGUI(QWidget):
def resume_batch_fetch(self): def resume_batch_fetch(self):
self.is_auto_fetching = True self.is_auto_fetching = True
self.pause_fetch_btn.setText(' Pause') self.pause_fetch_btn.setText(' Pause')
icon_dir = ICON_DIR self.pause_fetch_btn.setIcon(self.create_colored_icon('fa6s.pause', self.current_theme_color))
self.pause_fetch_btn.setIcon(self.create_colored_icon(os.path.join(icon_dir, 'player-pause.svg'), self.current_theme_color))
self.pause_fetch_btn.clicked.disconnect() self.pause_fetch_btn.clicked.disconnect()
self.pause_fetch_btn.clicked.connect(self.pause_batch_fetch) self.pause_fetch_btn.clicked.connect(self.pause_batch_fetch)
self.log_output.append('Resuming batch fetching...') self.log_output.append('Resuming batch fetching...')
@@ -2900,8 +2872,7 @@ class TwitterXMediaBatchDownloaderGUI(QWidget):
if self.pause_fetch_btn.text() == ' Resume': if self.pause_fetch_btn.text() == ' Resume':
self.pause_fetch_btn.setText(' Pause') self.pause_fetch_btn.setText(' Pause')
icon_dir = ICON_DIR self.pause_fetch_btn.setIcon(self.create_colored_icon('fa6s.pause', self.current_theme_color))
self.pause_fetch_btn.setIcon(self.create_colored_icon(os.path.join(icon_dir, 'player-pause.svg'), self.current_theme_color))
self.pause_fetch_btn.clicked.disconnect() self.pause_fetch_btn.clicked.disconnect()
self.pause_fetch_btn.clicked.connect(self.pause_batch_fetch) self.pause_fetch_btn.clicked.connect(self.pause_batch_fetch)
+22 -49
View File
@@ -1,4 +1,5 @@
import os import os
import qtawesome as qta
from PyQt6.QtWidgets import QApplication, QLabel from PyQt6.QtWidgets import QApplication, QLabel
from PyQt6.QtCore import Qt, QSize, QEvent from PyQt6.QtCore import Qt, QSize, QEvent
from PyQt6.QtGui import QIcon, QPalette, QColor from PyQt6.QtGui import QIcon, QPalette, QColor
@@ -106,28 +107,11 @@ class TwitterXMediaBatchDownloaderGUI_Unix(TwitterXMediaBatchDownloaderGUI):
self.update_button_icons_unix() self.update_button_icons_unix()
def create_colored_icon(self, icon_path, color=None): def create_colored_icon(self, icon_name, color=None):
if not os.path.exists(icon_path):
return QIcon()
palette = QApplication.palette() palette = QApplication.palette()
text_color = palette.color(QPalette.ColorRole.Text) text_color = palette.color(QPalette.ColorRole.Text)
color_hex = text_color.name() color_hex = text_color.name()
return qta.icon(icon_name, color=color_hex)
from PyQt6.QtSvg import QSvgRenderer
from PyQt6.QtGui import QPixmap, QPainter
renderer = QSvgRenderer(icon_path)
pixmap = QPixmap(24, 24)
pixmap.fill(Qt.GlobalColor.transparent)
painter = QPainter(pixmap)
renderer.render(painter)
painter.setCompositionMode(QPainter.CompositionMode.CompositionMode_SourceIn)
painter.fillRect(pixmap.rect(), QColor(color_hex))
painter.end()
return QIcon(pixmap)
def update_button_icons(self): def update_button_icons(self):
self.update_button_icons_unix() self.update_button_icons_unix()
@@ -136,33 +120,29 @@ class TwitterXMediaBatchDownloaderGUI_Unix(TwitterXMediaBatchDownloaderGUI):
if not hasattr(self, 'import_btn'): if not hasattr(self, 'import_btn'):
return return
icon_dir = os.path.join(os.path.dirname(__file__), 'icons') self.import_btn.setIcon(self.create_colored_icon('fa6s.file-import'))
self.export_btn.setIcon(self.create_colored_icon('fa6s.file-export'))
self.import_btn.setIcon(self.create_colored_icon(os.path.join(icon_dir, 'database-import.svg'))) self.download_selected_btn.setIcon(self.create_colored_icon('fa6s.download'))
self.export_btn.setIcon(self.create_colored_icon(os.path.join(icon_dir, 'database-export.svg'))) self.update_selected_btn.setIcon(self.create_colored_icon('fa6s.arrows-rotate'))
self.download_selected_btn.setIcon(self.create_colored_icon(os.path.join(icon_dir, 'download.svg'))) self.delete_btn.setIcon(self.create_colored_icon('fa6s.trash'))
self.update_selected_btn.setIcon(self.create_colored_icon(os.path.join(icon_dir, 'reload.svg')))
self.delete_btn.setIcon(self.create_colored_icon(os.path.join(icon_dir, 'trash.svg')))
def update_button_icons_unix(self): def update_button_icons_unix(self):
self.update_button_icons_unix_dashboard() self.update_button_icons_unix_dashboard()
icon_dir = os.path.join(os.path.dirname(__file__), 'icons')
if hasattr(self, 'stop_btn'): if hasattr(self, 'stop_btn'):
self.stop_btn.setIcon(self.create_colored_icon(os.path.join(icon_dir, 'cancel.svg'))) self.stop_btn.setIcon(self.create_colored_icon('fa6s.circle-xmark'))
if hasattr(self, 'pause_resume_btn'): if hasattr(self, 'pause_resume_btn'):
if self.pause_resume_btn.text() == ' Resume': if self.pause_resume_btn.text() == ' Resume':
self.pause_resume_btn.setIcon(self.create_colored_icon(os.path.join(icon_dir, 'player-play.svg'))) self.pause_resume_btn.setIcon(self.create_colored_icon('fa6s.play'))
else: else:
self.pause_resume_btn.setIcon(self.create_colored_icon(os.path.join(icon_dir, 'player-pause.svg'))) self.pause_resume_btn.setIcon(self.create_colored_icon('fa6s.pause'))
if hasattr(self, 'stop_fetch_btn'): if hasattr(self, 'stop_fetch_btn'):
self.stop_fetch_btn.setIcon(self.create_colored_icon(os.path.join(icon_dir, 'cancel.svg'))) self.stop_fetch_btn.setIcon(self.create_colored_icon('fa6s.circle-xmark'))
if hasattr(self, 'pause_fetch_btn'): if hasattr(self, 'pause_fetch_btn'):
if self.pause_fetch_btn.text() == ' Resume': if self.pause_fetch_btn.text() == ' Resume':
self.pause_fetch_btn.setIcon(self.create_colored_icon(os.path.join(icon_dir, 'player-play.svg'))) self.pause_fetch_btn.setIcon(self.create_colored_icon('fa6s.play'))
else: else:
self.pause_fetch_btn.setIcon(self.create_colored_icon(os.path.join(icon_dir, 'player-pause.svg'))) self.pause_fetch_btn.setIcon(self.create_colored_icon('fa6s.pause'))
def setup_theme_tab(self): def setup_theme_tab(self):
pass pass
@@ -172,17 +152,15 @@ class TwitterXMediaBatchDownloaderGUI_Unix(TwitterXMediaBatchDownloaderGUI):
def toggle_pause_resume(self): def toggle_pause_resume(self):
if hasattr(self, 'worker'): if hasattr(self, 'worker'):
icon_dir = os.path.join(os.path.dirname(__file__), 'icons')
if self.worker.is_paused: if self.worker.is_paused:
self.worker.resume() self.worker.resume()
self.pause_resume_btn.setText(' Pause') self.pause_resume_btn.setText(' Pause')
self.pause_resume_btn.setIcon(self.create_colored_icon(os.path.join(icon_dir, 'player-pause.svg'))) self.pause_resume_btn.setIcon(self.create_colored_icon('fa6s.pause'))
self.timer.start(1000) self.timer.start(1000)
else: else:
self.worker.pause() self.worker.pause()
self.pause_resume_btn.setText(' Resume') self.pause_resume_btn.setText(' Resume')
self.pause_resume_btn.setIcon(self.create_colored_icon(os.path.join(icon_dir, 'player-play.svg'))) self.pause_resume_btn.setIcon(self.create_colored_icon('fa6s.play'))
def pause_batch_fetch(self): def pause_batch_fetch(self):
self.is_auto_fetching = False self.is_auto_fetching = False
@@ -191,18 +169,16 @@ class TwitterXMediaBatchDownloaderGUI_Unix(TwitterXMediaBatchDownloaderGUI):
self.metadata_worker.terminate() self.metadata_worker.terminate()
self.metadata_worker.wait() self.metadata_worker.wait()
icon_dir = os.path.join(os.path.dirname(__file__), 'icons')
self.pause_fetch_btn.setText(' Resume') self.pause_fetch_btn.setText(' Resume')
self.pause_fetch_btn.setIcon(self.create_colored_icon(os.path.join(icon_dir, 'player-play.svg'))) self.pause_fetch_btn.setIcon(self.create_colored_icon('fa6s.play'))
self.pause_fetch_btn.clicked.disconnect() self.pause_fetch_btn.clicked.disconnect()
self.pause_fetch_btn.clicked.connect(self.resume_batch_fetch) self.pause_fetch_btn.clicked.connect(self.resume_batch_fetch)
self.log_output.append('Batch fetching paused.') self.log_output.append('Batch fetching paused.')
def resume_batch_fetch(self): def resume_batch_fetch(self):
self.is_auto_fetching = True self.is_auto_fetching = True
icon_dir = os.path.join(os.path.dirname(__file__), 'icons')
self.pause_fetch_btn.setText(' Pause') self.pause_fetch_btn.setText(' Pause')
self.pause_fetch_btn.setIcon(self.create_colored_icon(os.path.join(icon_dir, 'player-pause.svg'))) self.pause_fetch_btn.setIcon(self.create_colored_icon('fa6s.pause'))
self.pause_fetch_btn.clicked.disconnect() self.pause_fetch_btn.clicked.disconnect()
self.pause_fetch_btn.clicked.connect(self.pause_batch_fetch) self.pause_fetch_btn.clicked.connect(self.pause_batch_fetch)
self.log_output.append('Resuming batch fetching...') self.log_output.append('Resuming batch fetching...')
@@ -222,9 +198,8 @@ class TwitterXMediaBatchDownloaderGUI_Unix(TwitterXMediaBatchDownloaderGUI):
self.metadata_worker.wait() self.metadata_worker.wait()
if self.pause_fetch_btn.text() == ' Resume': if self.pause_fetch_btn.text() == ' Resume':
icon_dir = os.path.join(os.path.dirname(__file__), 'icons')
self.pause_fetch_btn.setText(' Pause') self.pause_fetch_btn.setText(' Pause')
self.pause_fetch_btn.setIcon(self.create_colored_icon(os.path.join(icon_dir, 'player-pause.svg'))) self.pause_fetch_btn.setIcon(self.create_colored_icon('fa6s.pause'))
self.pause_fetch_btn.clicked.disconnect() self.pause_fetch_btn.clicked.disconnect()
self.pause_fetch_btn.clicked.connect(self.pause_batch_fetch) self.pause_fetch_btn.clicked.connect(self.pause_batch_fetch)
@@ -240,17 +215,15 @@ class TwitterXMediaBatchDownloaderGUI_Unix(TwitterXMediaBatchDownloaderGUI):
def reset_ui(self): def reset_ui(self):
super().reset_ui() super().reset_ui()
icon_dir = os.path.join(os.path.dirname(__file__), 'icons')
if hasattr(self, 'pause_resume_btn'): if hasattr(self, 'pause_resume_btn'):
self.pause_resume_btn.setIcon(self.create_colored_icon(os.path.join(icon_dir, 'player-pause.svg'))) self.pause_resume_btn.setIcon(self.create_colored_icon('fa6s.pause'))
def on_download_finished(self, success, message): def on_download_finished(self, success, message):
self.progress_bar.hide() self.progress_bar.hide()
self.stop_btn.hide() self.stop_btn.hide()
self.pause_resume_btn.hide() self.pause_resume_btn.hide()
self.pause_resume_btn.setText(' Pause') self.pause_resume_btn.setText(' Pause')
icon_dir = os.path.join(os.path.dirname(__file__), 'icons') self.pause_resume_btn.setIcon(self.create_colored_icon('fa6s.pause'))
self.pause_resume_btn.setIcon(self.create_colored_icon(os.path.join(icon_dir, 'player-pause.svg')))
self.stop_timer() self.stop_timer()
self.download_selected_btn.setEnabled(True) self.download_selected_btn.setEnabled(True)
@@ -264,4 +237,4 @@ class TwitterXMediaBatchDownloaderGUI_Unix(TwitterXMediaBatchDownloaderGUI):
else: else:
self.log_output.append(f"Error: {message}") self.log_output.append(f"Error: {message}")
self.tab_widget.setCurrentWidget(self.process_tab) self.tab_widget.setCurrentWidget(self.process_tab)
+1 -1
View File
@@ -1,3 +1,3 @@
{ {
"version": "3.7" "version": "3.8"
} }