This commit is contained in:
afkarxyz committed 2025-11-18 13:38:16 +07:00
1 parent f2a3810c8c
commit df0de054c8
27 files changed
+4460 -8030

No files matched your search

+7
View File
@@ -0,0 +1,7 @@
from ui.mainWindow import TwitterXMediaBatchDownloaderGUI
from ui.dialogs import UpdateDialog
__all__ = [
'TwitterXMediaBatchDownloaderGUI',
'UpdateDialog'
]
+33
View File
@@ -0,0 +1,33 @@
from PyQt6.QtWidgets import (
QDialog, QVBoxLayout, QLabel, QPushButton, QDialogButtonBox
)
from PyQt6.QtCore import Qt
class UpdateDialog(QDialog):
def __init__(self, current_version, new_version, parent=None):
super().__init__(parent)
self.setWindowTitle("Update Now")
self.setFixedWidth(400)
self.setModal(True)
layout = QVBoxLayout()
message = QLabel(f"Twitter/X Media Batch Downloader v{new_version} Available!")
message.setWordWrap(True)
layout.addWidget(message)
button_box = QDialogButtonBox()
self.update_button = QPushButton("Check")
self.update_button.setCursor(Qt.CursorShape.PointingHandCursor)
self.cancel_button = QPushButton("Later")
self.cancel_button.setCursor(Qt.CursorShape.PointingHandCursor)
button_box.addButton(self.update_button, QDialogButtonBox.ButtonRole.AcceptRole)
button_box.addButton(self.cancel_button, QDialogButtonBox.ButtonRole.RejectRole)
layout.addWidget(button_box)
self.setLayout(layout)
self.update_button.clicked.connect(self.accept)
self.cancel_button.clicked.connect(self.reject)
+1
View File
@@ -0,0 +1 @@
<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>

After

Width:  |  Height:  |  Size: 396 B

+1
View File
@@ -0,0 +1 @@
<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>

After

Width:  |  Height:  |  Size: 616 B

+1
View File
@@ -0,0 +1 @@
<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>

After

Width:  |  Height:  |  Size: 610 B

+1
View File
@@ -0,0 +1 @@
<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>

After

Width:  |  Height:  |  Size: 479 B

+1
View File
@@ -0,0 +1 @@
<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>

After

Width:  |  Height:  |  Size: 423 B

+1
View File
@@ -0,0 +1 @@
<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>

After

Width:  |  Height:  |  Size: 480 B

Binary file not shown.
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 173 KiB

+11
View File
@@ -0,0 +1,11 @@
<?xml version="1.0" ?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1"
id="Layer_1" width="512px" height="512px" viewBox="0 0 24 24" style="enable-background:new 0 0 24 24;"
xml:space="preserve">
<g fill="#1da0f1">
<polygon
points="12.153992,10.729553 8.088684,5.041199 5.92041,5.041199 10.956299,12.087097 11.59021,12.97345 15.900635,19.009583 18.068909,19.009583 12.785217,11.615906 " />
<path
d="M21.15979,1H2.84021C1.823853,1,1,1.823853,1,2.84021v18.31958C1,22.176147,1.823853,23,2.84021,23h18.31958 C22.176147,23,23,22.176147,23,21.15979V2.84021C23,1.823853,22.176147,1,21.15979,1z M15.235352,20l-4.362549-6.213013 L5.411438,20H4l6.246887-7.104675L4,4h4.764648l4.130127,5.881958L18.06958,4h1.411377l-5.95697,6.775635L20,20H15.235352z" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 865 B

+1
View File
@@ -0,0 +1 @@
<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>

After

Width:  |  Height:  |  Size: 493 B

+1
View File
@@ -0,0 +1 @@
<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>

After

Width:  |  Height:  |  Size: 338 B

+1
View File
@@ -0,0 +1 @@
<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>

After

Width:  |  Height:  |  Size: 423 B

+1
View File
@@ -0,0 +1 @@
<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>

After

Width:  |  Height:  |  Size: 495 B

+3168
View File
File diff suppressed because it is too large. Load diff
+267
View File
@@ -0,0 +1,267 @@
import os
from PyQt6.QtWidgets import QApplication, QLabel
from PyQt6.QtCore import Qt, QSize, QEvent
from PyQt6.QtGui import QIcon, QPalette, QColor
from ui.mainWindow import TwitterXMediaBatchDownloaderGUI
class TwitterXMediaBatchDownloaderGUI_Unix(TwitterXMediaBatchDownloaderGUI):
def __init__(self):
super().__init__()
self.setup_unix_specific()
QApplication.instance().installEventFilter(self)
def eventFilter(self, obj, event):
if event.type() == QEvent.Type.ApplicationPaletteChange:
self.update_button_icons_unix()
self.update_ui_colors()
return super().eventFilter(obj, event)
def update_ui_colors(self):
from PyQt6.QtWidgets import QLineEdit, QTextEdit, QComboBox, QCheckBox, QPushButton, QProgressBar, QDateEdit, QListWidget, QTabWidget
new_palette = QApplication.palette()
self.account_list.setStyleSheet("""
QListWidget {
background-color: palette(base);
padding: 4px;
outline: none;
}
QListWidget::item {
padding: 3px 6px;
margin: 0px 0px;
border: none;
outline: none;
}
QListWidget::item:selected {
background-color: palette(highlight);
border: none;
outline: none;
}
QListWidget::item:focus {
border: none;
outline: none;
}
QListWidget::item:hover {
background-color: palette(highlight);
}
""")
widget_types = [QLabel, QLineEdit, QTextEdit, QComboBox, QCheckBox, QPushButton, QProgressBar, QDateEdit, QListWidget, QTabWidget]
for widget_type in widget_types:
for widget in self.findChildren(widget_type):
widget.setPalette(new_palette)
widget.update()
for i in range(self.account_list.count()):
item = self.account_list.item(i)
if item:
self.account_list.update(self.account_list.indexFromItem(item))
self.setPalette(new_palette)
self.update()
def setup_unix_specific(self):
self.setFixedWidth(670)
if hasattr(self, 'fetch_btn'):
self.fetch_btn.setFixedWidth(100)
if hasattr(self, 'start_date_edit'):
self.start_date_edit.setMinimumWidth(130)
if hasattr(self, 'end_date_edit'):
self.end_date_edit.setMinimumWidth(130)
if hasattr(self, 'output_browse'):
self.output_browse.setFixedWidth(100)
self.account_list.setStyleSheet("""
QListWidget {
background-color: palette(base);
padding: 4px;
outline: none;
}
QListWidget::item {
padding: 3px 6px;
margin: 0px 0px;
border: none;
outline: none;
}
QListWidget::item:selected {
background-color: palette(highlight);
border: none;
outline: none;
}
QListWidget::item:focus {
border: none;
outline: none;
}
QListWidget::item:hover {
background-color: palette(highlight);
}
""")
self.update_button_icons_unix()
def create_colored_icon(self, icon_path, color=None):
if not os.path.exists(icon_path):
return QIcon()
palette = QApplication.palette()
text_color = palette.color(QPalette.ColorRole.Text)
color_hex = text_color.name()
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):
self.update_button_icons_unix()
def update_button_icons_unix_dashboard(self):
if not hasattr(self, 'import_btn'):
return
icon_dir = os.path.join(os.path.dirname(__file__), 'icons')
self.import_btn.setIcon(self.create_colored_icon(os.path.join(icon_dir, 'database-import.svg')))
self.export_btn.setIcon(self.create_colored_icon(os.path.join(icon_dir, 'database-export.svg')))
self.download_selected_btn.setIcon(self.create_colored_icon(os.path.join(icon_dir, 'download.svg')))
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):
self.update_button_icons_unix_dashboard()
icon_dir = os.path.join(os.path.dirname(__file__), 'icons')
if hasattr(self, 'stop_btn'):
self.stop_btn.setIcon(self.create_colored_icon(os.path.join(icon_dir, 'cancel.svg')))
if hasattr(self, 'pause_resume_btn'):
if self.pause_resume_btn.text() == ' Resume':
self.pause_resume_btn.setIcon(self.create_colored_icon(os.path.join(icon_dir, 'player-play.svg')))
else:
self.pause_resume_btn.setIcon(self.create_colored_icon(os.path.join(icon_dir, 'player-pause.svg')))
if hasattr(self, 'stop_fetch_btn'):
self.stop_fetch_btn.setIcon(self.create_colored_icon(os.path.join(icon_dir, 'cancel.svg')))
if hasattr(self, 'pause_fetch_btn'):
if self.pause_fetch_btn.text() == ' Resume':
self.pause_fetch_btn.setIcon(self.create_colored_icon(os.path.join(icon_dir, 'player-play.svg')))
else:
self.pause_fetch_btn.setIcon(self.create_colored_icon(os.path.join(icon_dir, 'player-pause.svg')))
def setup_theme_tab(self):
pass
def change_theme_color(self, color, clicked_btn=None):
pass
def toggle_pause_resume(self):
if hasattr(self, 'worker'):
icon_dir = os.path.join(os.path.dirname(__file__), 'icons')
if self.worker.is_paused:
self.worker.resume()
self.pause_resume_btn.setText(' Pause')
self.pause_resume_btn.setIcon(self.create_colored_icon(os.path.join(icon_dir, 'player-pause.svg')))
self.timer.start(1000)
else:
self.worker.pause()
self.pause_resume_btn.setText(' Resume')
self.pause_resume_btn.setIcon(self.create_colored_icon(os.path.join(icon_dir, 'player-play.svg')))
def pause_batch_fetch(self):
self.is_auto_fetching = False
if hasattr(self, 'metadata_worker') and self.metadata_worker.isRunning():
self.metadata_worker.terminate()
self.metadata_worker.wait()
icon_dir = os.path.join(os.path.dirname(__file__), 'icons')
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.clicked.disconnect()
self.pause_fetch_btn.clicked.connect(self.resume_batch_fetch)
self.log_output.append('Batch fetching paused.')
def resume_batch_fetch(self):
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.setIcon(self.create_colored_icon(os.path.join(icon_dir, 'player-pause.svg')))
self.pause_fetch_btn.clicked.disconnect()
self.pause_fetch_btn.clicked.connect(self.pause_batch_fetch)
self.log_output.append('Resuming batch fetching...')
if hasattr(self, 'is_multiple_user_mode') and self.is_multiple_user_mode:
self.fetch_next_account_in_batch()
else:
self.fetch_next_batch_internal()
def stop_batch_fetch(self):
self.is_auto_fetching = False
self.pause_fetch_btn.hide()
self.stop_fetch_btn.hide()
if hasattr(self, 'metadata_worker') and self.metadata_worker.isRunning():
self.metadata_worker.terminate()
self.metadata_worker.wait()
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.setIcon(self.create_colored_icon(os.path.join(icon_dir, 'player-pause.svg')))
self.pause_fetch_btn.clicked.disconnect()
self.pause_fetch_btn.clicked.connect(self.pause_batch_fetch)
if hasattr(self, 'is_multiple_user_mode') and self.is_multiple_user_mode:
self.log_output.append('Batch processing stopped.')
self.is_multiple_user_mode = False
if hasattr(self, 'accounts_to_fetch'):
del self.accounts_to_fetch
else:
self.log_output.append('Auto batch mode stopped.')
self.enable_batch_buttons()
def reset_ui(self):
super().reset_ui()
icon_dir = os.path.join(os.path.dirname(__file__), 'icons')
if hasattr(self, 'pause_resume_btn'):
self.pause_resume_btn.setIcon(self.create_colored_icon(os.path.join(icon_dir, 'player-pause.svg')))
def on_download_finished(self, success, message):
self.progress_bar.hide()
self.stop_btn.hide()
self.pause_resume_btn.hide()
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(os.path.join(icon_dir, 'player-pause.svg')))
self.stop_timer()
self.download_selected_btn.setEnabled(True)
self.update_selected_btn.setEnabled(True)
self.pause_fetch_btn.hide()
self.stop_fetch_btn.hide()
if success:
self.log_output.append(f"\nStatus: {message}")
else:
self.log_output.append(f"Error: {message}")
self.tab_widget.setCurrentWidget(self.process_tab)