mirror of
https://github.com/Alvin-Zilverstand/Twitter-X-Media-Batch-Downloader.git
synced 2026-11-26 08:13:08 +01:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
befe838e79 | ||
|
|
b534bc278e | ||
|
|
2e882635eb | ||
|
|
5d5b778c8e | ||
|
|
7cf134f681 | ||
|
|
7d90eb7cb2 | ||
|
|
3d1fd7d1fb | ||
|
|
c0885b1812 | ||
|
|
1ca5c613ae | ||
|
|
596ba9bb3c | ||
|
|
a1cbb04402 | ||
|
|
ddf6439893 | ||
|
|
fed2bf7b0c | ||
|
|
241884de89 | ||
|
|
77b443ace0 | ||
|
|
cd48b6f9bc | ||
|
|
6f45b48047 | ||
|
|
7083c56c8b | ||
|
|
60cb3cbabd | ||
|
|
b38bff238a | ||
|
|
d4d216ed6b | ||
|
|
129c007f6f | ||
|
|
d78ad32c09 | ||
|
|
3975e5dd0e | ||
|
|
37f1d910cb | ||
|
|
74ed38cc31 | ||
|
|
2e326c39a0 | ||
|
|
39c37d4776 | ||
|
|
5709d76ceb | ||
|
|
75b3549653 | ||
|
|
ebe739e612 | ||
|
|
d423f20bad | ||
|
|
fba8a8ac45 | ||
|
|
a36c7613d2 | ||
|
|
c7615ed2f6 | ||
|
|
0c17f1b419 | ||
|
|
dd38880366 | ||
|
|
306d2c3c95 | ||
|
|
1caa59bbcf | ||
|
|
4d0021092c |
No files matched your search
@@ -0,0 +1,4 @@
|
|||||||
|
dist/
|
||||||
|
build/
|
||||||
|
*.spec
|
||||||
|
.venv/
|
||||||
Binary file not shown.
@@ -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 |
@@ -8,24 +8,123 @@
|
|||||||
|
|
||||||
## 📥 Download
|
## 📥 Download
|
||||||
|
|
||||||
- Download the latest version of [TwitterXMediaBatchDownloader](https://github.com/afkarxyz/Twitter-X-Media-Batch-Downloader/releases/download/v2.9/TwitterXMediaBatchDownloader.exe)
|
- [**Windows**](https://github.com/afkarxyz/Twitter-X-Media-Batch-Downloader/releases/download/v3.3/TwitterXMediaBatchDownloader_Windows.exe)
|
||||||
- If you're familiar with **userscripts**, please install it [here](https://greasyfork.org/en/scripts/523157)
|
- [**Linux**](https://github.com/afkarxyz/Twitter-X-Media-Batch-Downloader/releases/download/v3.3/TwitterXMediaBatchDownloader_Linux)
|
||||||
|
- [**Mac**](https://github.com/afkarxyz/Twitter-X-Media-Batch-Downloader/releases/download/v3.3/TwitterXMediaBatchDownloader_Mac.app.zip)
|
||||||
|
- If you're familiar with **userscripts**, please install it [**here**](https://greasyfork.org/en/scripts/523157)
|
||||||
|
|
||||||
|
### The downloaded application won't run❓
|
||||||
|
|
||||||
|
🐧 **Solution (Ubuntu/Linux)**: Open your terminal and run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
chmod +x TwitterXMediaBatchDownloader_Linux
|
||||||
|
```
|
||||||
|
|
||||||
|
https://github.com/user-attachments/assets/ab65e53f-2986-4386-9e09-e4c8e33ec90b
|
||||||
|
|
||||||
|
🍎 **Solution (macOS)**: Open your terminal and run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
xattr -rd com.apple.quarantine ~/Downloads/TwitterXMediaBatchDownloader_Mac.app
|
||||||
|
```
|
||||||
|
|
||||||
|
https://github.com/user-attachments/assets/5f9a1cf6-a7a8-4943-ad71-d2831b406137
|
||||||
|
|
||||||
## ✨ Features
|
## ✨ Features
|
||||||
|
|
||||||
- Powered by `gallery-dl`, similar to `yt-dlp`
|
- Powered by `gallery-dl`, similar to `yt-dlp`
|
||||||
- **Bulk download**: Download multiple items at once
|
- **Bulk download**: Download multiple accounts at once
|
||||||
- Media-type selection: All (Images + GIFs + Videos) or specific (Images / GIFs / Videos)
|
- Media-type selection: All (Images + GIFs + Videos) or specific (Images / GIFs / Videos)
|
||||||
- **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
|
## 🖼️ Screenshots
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||

|

|
||||||
|
|
||||||

|
## 🐧 Build Yourself (Ubuntu/Linux)
|
||||||
|
|
||||||
|
### 1. Install Required Packages
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo apt install git python3-pip python3-venv
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. Clone the Repository
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git clone https://github.com/afkarxyz/Twitter-X-Media-Batch-Downloader.git
|
||||||
|
cd Twitter-X-Media-Batch-Downloader
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. Create and Activate a Virtual Environment
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python3 -m venv .venv
|
||||||
|
source .venv/bin/activate
|
||||||
|
```
|
||||||
|
|
||||||
|
### 4. Install Python Dependencies
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pip install -r requirements.txt
|
||||||
|
pip install pyinstaller
|
||||||
|
```
|
||||||
|
|
||||||
|
### 5. Build the Application
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pyinstaller --onefile --windowed TwitterXMediaBatchDownloader_Linux.py
|
||||||
|
```
|
||||||
|
|
||||||
|
The compiled binary will be located in the `dist/` folder.
|
||||||
|
|
||||||
|
## 🍎 Build Yourself (macOS)
|
||||||
|
|
||||||
|
### 1. Install Homebrew (if not already installed)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. Install Git and Python
|
||||||
|
|
||||||
|
```bash
|
||||||
|
brew install git python
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. Go to Downloads and Clone the Repository
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd ~/Downloads
|
||||||
|
git clone https://github.com/afkarxyz/Twitter-X-Media-Batch-Downloader.git
|
||||||
|
cd Twitter-X-Media-Batch-Downloader
|
||||||
|
```
|
||||||
|
|
||||||
|
### 4. Create and Activate a Virtual Environment
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python3 -m venv .venv
|
||||||
|
source .venv/bin/activate
|
||||||
|
```
|
||||||
|
|
||||||
|
### 5. Install Python Dependencies
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pip install -r requirements.txt
|
||||||
|
pip install pyinstaller
|
||||||
|
```
|
||||||
|
|
||||||
|
### 6. Build the Application
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pyinstaller --onefile --windowed --icon=Archived/icon.icns TwitterXMediaBatchDownloader_Mac.py
|
||||||
|
```
|
||||||
|
|
||||||
|
The `.app` bundle will be generated inside the `dist/` folder.
|
||||||
|
|
||||||
## 🔑 How to Obtain Auth Token
|
## 🔑 How to Obtain Auth Token
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ from packaging import version
|
|||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
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, QSpacerItem, QSizePolicy, QProgressBar, QCheckBox, QDialog,
|
QLabel, QFileDialog, QListWidget, QTextEdit, QTabWidget, QAbstractItemView, QProgressBar, QCheckBox, QDialog,
|
||||||
QDialogButtonBox, QComboBox, QListWidgetItem
|
QDialogButtonBox, QComboBox, QListWidgetItem
|
||||||
)
|
)
|
||||||
from PyQt6.QtCore import Qt, QThread, pyqtSignal, QUrl, QTimer, QTime, QSettings, QSize
|
from PyQt6.QtCore import Qt, QThread, pyqtSignal, QUrl, QTimer, QTime, QSettings, QSize
|
||||||
@@ -31,6 +31,8 @@ class Account:
|
|||||||
media_type: str
|
media_type: str
|
||||||
profile_image: str = None
|
profile_image: str = None
|
||||||
media_list: list = None
|
media_list: list = None
|
||||||
|
fetch_mode: str = 'all'
|
||||||
|
fetch_timestamp: str = None
|
||||||
|
|
||||||
class MetadataFetchWorker(QThread):
|
class MetadataFetchWorker(QThread):
|
||||||
finished = pyqtSignal(dict)
|
finished = pyqtSignal(dict)
|
||||||
@@ -191,7 +193,7 @@ class DownloadWorker(QThread):
|
|||||||
|
|
||||||
progress_percent = int((completed + failed) / total * 100)
|
progress_percent = int((completed + failed) / total * 100)
|
||||||
media_type_display = account.media_type if account.media_type != 'all' else 'media'
|
media_type_display = account.media_type if account.media_type != 'all' else 'media'
|
||||||
self.download_progress.emit(f"Downloading {account.username}'s {media_type_display}: {completed + failed}/{total}", progress_percent)
|
self.download_progress.emit(f"Downloading {account.username}'s {media_type_display}: {completed + failed:,}/{total:,}", progress_percent)
|
||||||
|
|
||||||
await asyncio.sleep(0.1)
|
await asyncio.sleep(0.1)
|
||||||
|
|
||||||
@@ -220,7 +222,7 @@ class DownloadWorker(QThread):
|
|||||||
overall_completed += completed
|
overall_completed += completed
|
||||||
overall_skipped += skipped
|
overall_skipped += skipped
|
||||||
overall_failed += failed
|
overall_failed += failed
|
||||||
self.progress.emit(f"Account {account.username} ({media_type_display}): {completed} downloaded, {skipped} skipped, {failed} failed",
|
self.progress.emit(f"Account {account.username} ({media_type_display}): {completed:,} downloaded, {skipped:,} skipped, {failed:,} failed",
|
||||||
int((i + 1) / total_accounts * 100))
|
int((i + 1) / total_accounts * 100))
|
||||||
|
|
||||||
if not self.is_stopped:
|
if not self.is_stopped:
|
||||||
@@ -231,11 +233,34 @@ class DownloadWorker(QThread):
|
|||||||
total_gifs = len(gif_items)
|
total_gifs = len(gif_items)
|
||||||
if total_gifs > 0:
|
if total_gifs > 0:
|
||||||
creationflags = subprocess.CREATE_NO_WINDOW if sys.platform == 'win32' else 0
|
creationflags = subprocess.CREATE_NO_WINDOW if sys.platform == 'win32' else 0
|
||||||
|
converted_count = 0
|
||||||
|
skipped_count = 0
|
||||||
self.progress.emit("Starting GIF conversion...", 0)
|
self.progress.emit("Starting GIF conversion...", 0)
|
||||||
|
|
||||||
for idx, (item, fp) in enumerate(gif_items, start=1):
|
for idx, (item, fp) in enumerate(gif_items, start=1):
|
||||||
if self.is_stopped:
|
if self.is_stopped:
|
||||||
break
|
break
|
||||||
|
|
||||||
|
while self.is_paused:
|
||||||
|
if self.is_stopped:
|
||||||
|
break
|
||||||
|
self.msleep(100)
|
||||||
|
|
||||||
|
if self.is_stopped:
|
||||||
|
break
|
||||||
|
|
||||||
gif_fp = fp.rsplit('.', 1)[0] + '.gif'
|
gif_fp = fp.rsplit('.', 1)[0] + '.gif'
|
||||||
|
|
||||||
|
if os.path.exists(gif_fp):
|
||||||
|
try:
|
||||||
|
os.remove(fp)
|
||||||
|
skipped_count += 1
|
||||||
|
conv_progress = int((idx / total_gifs) * 100)
|
||||||
|
self.conversion_progress.emit(f"Converting GIF {idx:,}/{total_gifs:,} ({self.gif_resolution}) - Skipped (exists)", conv_progress)
|
||||||
|
continue
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
|
||||||
if self.gif_resolution == 'high':
|
if self.gif_resolution == 'high':
|
||||||
ffmpeg_args = [ffmpeg_exe, '-i', fp, '-vf', 'scale=800:-1:flags=lanczos', '-r', '15', gif_fp]
|
ffmpeg_args = [ffmpeg_exe, '-i', fp, '-vf', 'scale=800:-1:flags=lanczos', '-r', '15', gif_fp]
|
||||||
elif self.gif_resolution == 'medium':
|
elif self.gif_resolution == 'medium':
|
||||||
@@ -249,19 +274,29 @@ class DownloadWorker(QThread):
|
|||||||
if result.returncode == 0 and os.path.exists(gif_fp):
|
if result.returncode == 0 and os.path.exists(gif_fp):
|
||||||
try:
|
try:
|
||||||
os.remove(fp)
|
os.remove(fp)
|
||||||
|
converted_count += 1
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
else:
|
||||||
|
pass
|
||||||
|
|
||||||
conv_progress = int((idx / total_gifs) * 100)
|
conv_progress = int((idx / total_gifs) * 100)
|
||||||
self.conversion_progress.emit(f"Converting GIF {idx}/{total_gifs} ({self.gif_resolution})", conv_progress)
|
self.conversion_progress.emit(f"Converting GIF {idx:,}/{total_gifs:,} ({self.gif_resolution})", conv_progress)
|
||||||
|
if converted_count > 0 or skipped_count > 0:
|
||||||
|
completion_msg = f"GIF conversion completed: {converted_count:,} converted"
|
||||||
|
if skipped_count > 0:
|
||||||
|
completion_msg += f", {skipped_count:,} skipped (already exists)"
|
||||||
|
self.progress.emit(completion_msg, 100)
|
||||||
|
else:
|
||||||
self.progress.emit("GIF conversion completed", 100)
|
self.progress.emit("GIF conversion completed", 100)
|
||||||
except Exception as conv_e:
|
except Exception as conv_e:
|
||||||
self.progress.emit(f"GIF conversion error: {conv_e}", 0)
|
self.progress.emit(f"GIF conversion error: {conv_e}", 0)
|
||||||
|
|
||||||
success_message = f"Download completed! {overall_completed} files downloaded"
|
success_message = f"Download completed! {overall_completed:,} files downloaded"
|
||||||
if overall_skipped > 0:
|
if overall_skipped > 0:
|
||||||
success_message += f", {overall_skipped} skipped"
|
success_message += f", {overall_skipped:,} skipped"
|
||||||
if overall_failed > 0:
|
if overall_failed > 0:
|
||||||
success_message += f", {overall_failed} failed"
|
success_message += f", {overall_failed:,} failed"
|
||||||
self.finished.emit(True, success_message)
|
self.finished.emit(True, success_message)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@@ -280,26 +315,20 @@ class DownloadWorker(QThread):
|
|||||||
class UpdateDialog(QDialog):
|
class UpdateDialog(QDialog):
|
||||||
def __init__(self, current_version, new_version, parent=None):
|
def __init__(self, current_version, new_version, parent=None):
|
||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
self.setWindowTitle("Update Available")
|
self.setWindowTitle("Update Now")
|
||||||
self.setFixedWidth(400)
|
self.setFixedWidth(400)
|
||||||
self.setModal(True)
|
self.setModal(True)
|
||||||
|
|
||||||
layout = QVBoxLayout()
|
layout = QVBoxLayout()
|
||||||
|
|
||||||
message = QLabel(f"A new version of Twitter/X Media Batch Downloader is available!\n\n"
|
message = QLabel(f"Twitter/X Media Batch Downloader v{new_version} Available!")
|
||||||
f"Current version: v{current_version}\n"
|
|
||||||
f"New version: v{new_version}")
|
|
||||||
message.setWordWrap(True)
|
message.setWordWrap(True)
|
||||||
layout.addWidget(message)
|
layout.addWidget(message)
|
||||||
|
|
||||||
self.disable_check = QCheckBox("Turn off update checking")
|
|
||||||
self.disable_check.setCursor(Qt.CursorShape.PointingHandCursor)
|
|
||||||
layout.addWidget(self.disable_check)
|
|
||||||
|
|
||||||
button_box = QDialogButtonBox()
|
button_box = QDialogButtonBox()
|
||||||
self.update_button = QPushButton("Update")
|
self.update_button = QPushButton("Check")
|
||||||
self.update_button.setCursor(Qt.CursorShape.PointingHandCursor)
|
self.update_button.setCursor(Qt.CursorShape.PointingHandCursor)
|
||||||
self.cancel_button = QPushButton("Cancel")
|
self.cancel_button = QPushButton("Later")
|
||||||
self.cancel_button.setCursor(Qt.CursorShape.PointingHandCursor)
|
self.cancel_button.setCursor(Qt.CursorShape.PointingHandCursor)
|
||||||
|
|
||||||
button_box.addButton(self.update_button, QDialogButtonBox.ButtonRole.AcceptRole)
|
button_box.addButton(self.update_button, QDialogButtonBox.ButtonRole.AcceptRole)
|
||||||
@@ -315,7 +344,7 @@ class UpdateDialog(QDialog):
|
|||||||
class TwitterMediaDownloaderGUI(QWidget):
|
class TwitterMediaDownloaderGUI(QWidget):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.current_version = "3.0"
|
self.current_version = "3.4"
|
||||||
self.accounts = []
|
self.accounts = []
|
||||||
self.temp_dir = os.path.join(tempfile.gettempdir(), "twitterxmediabatchdownloader")
|
self.temp_dir = os.path.join(tempfile.gettempdir(), "twitterxmediabatchdownloader")
|
||||||
os.makedirs(self.temp_dir, exist_ok=True)
|
os.makedirs(self.temp_dir, exist_ok=True)
|
||||||
@@ -338,6 +367,11 @@ class TwitterMediaDownloaderGUI(QWidget):
|
|||||||
self.current_page = 0
|
self.current_page = 0
|
||||||
self.media_info = None
|
self.media_info = None
|
||||||
|
|
||||||
|
self.is_auto_fetching = False
|
||||||
|
self.current_fetch_username = None
|
||||||
|
self.current_fetch_media_type = None
|
||||||
|
self.current_fetch_metadata = None
|
||||||
|
|
||||||
self.profile_image_cache = {}
|
self.profile_image_cache = {}
|
||||||
self.pending_downloads = {}
|
self.pending_downloads = {}
|
||||||
self.network_manager = QNetworkAccessManager()
|
self.network_manager = QNetworkAccessManager()
|
||||||
@@ -352,6 +386,42 @@ class TwitterMediaDownloaderGUI(QWidget):
|
|||||||
if self.check_for_updates:
|
if self.check_for_updates:
|
||||||
QTimer.singleShot(0, self.check_updates)
|
QTimer.singleShot(0, self.check_updates)
|
||||||
|
|
||||||
|
def get_time_ago(self, timestamp_str):
|
||||||
|
if not timestamp_str:
|
||||||
|
return "Unknown"
|
||||||
|
|
||||||
|
try:
|
||||||
|
fetch_time = datetime.fromisoformat(timestamp_str.replace('Z', '+00:00'))
|
||||||
|
now = datetime.now(fetch_time.tzinfo) if fetch_time.tzinfo else datetime.now()
|
||||||
|
|
||||||
|
diff = now - fetch_time
|
||||||
|
days = diff.days
|
||||||
|
hours = diff.seconds // 3600
|
||||||
|
minutes = (diff.seconds % 3600) // 60
|
||||||
|
|
||||||
|
if days > 0:
|
||||||
|
return f"{days} day{'s' if days != 1 else ''} ago"
|
||||||
|
elif hours > 0:
|
||||||
|
return f"{hours} hour{'s' if hours != 1 else ''} ago"
|
||||||
|
elif minutes > 0:
|
||||||
|
return f"{minutes} minute{'s' if minutes != 1 else ''} ago"
|
||||||
|
else:
|
||||||
|
return "Just now"
|
||||||
|
except:
|
||||||
|
return "Unknown"
|
||||||
|
|
||||||
|
def format_fetch_info(self, timestamp_str):
|
||||||
|
if not timestamp_str:
|
||||||
|
return "Fetched: Unknown"
|
||||||
|
|
||||||
|
try:
|
||||||
|
fetch_time = datetime.fromisoformat(timestamp_str.replace('Z', '+00:00'))
|
||||||
|
formatted_datetime = fetch_time.strftime("%Y/%m/%d • %H:%M")
|
||||||
|
age = self.get_time_ago(timestamp_str)
|
||||||
|
return f"Fetched: {formatted_datetime} ({age})"
|
||||||
|
except:
|
||||||
|
return "Fetched: Unknown"
|
||||||
|
|
||||||
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://raw.githubusercontent.com/afkarxyz/Twitter-X-Media-Batch-Downloader/refs/heads/main/version.json")
|
||||||
@@ -363,15 +433,11 @@ class TwitterMediaDownloaderGUI(QWidget):
|
|||||||
dialog = UpdateDialog(self.current_version, new_version, self)
|
dialog = UpdateDialog(self.current_version, new_version, self)
|
||||||
result = dialog.exec()
|
result = dialog.exec()
|
||||||
|
|
||||||
if dialog.disable_check.isChecked():
|
|
||||||
self.settings.setValue('check_for_updates', False)
|
|
||||||
self.check_for_updates = False
|
|
||||||
|
|
||||||
if result == QDialog.DialogCode.Accepted:
|
if result == QDialog.DialogCode.Accepted:
|
||||||
QDesktopServices.openUrl(QUrl("https://github.com/afkarxyz/Twitter-X-Media-Batch-Downloader/releases"))
|
QDesktopServices.openUrl(QUrl("https://github.com/afkarxyz/Twitter-X-Media-Batch-Downloader/releases"))
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"Error checking for updates: {e}")
|
pass
|
||||||
|
|
||||||
def reset_state(self):
|
def reset_state(self):
|
||||||
self.accounts.clear()
|
self.accounts.clear()
|
||||||
@@ -384,12 +450,17 @@ class TwitterMediaDownloaderGUI(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')
|
||||||
|
self.next_batch_btn.hide()
|
||||||
|
self.auto_batch_btn.hide()
|
||||||
|
self.stop_fetch_btn.hide()
|
||||||
|
self.is_auto_fetching = False
|
||||||
|
self.enable_batch_buttons()
|
||||||
self.hide_account_buttons()
|
self.hide_account_buttons()
|
||||||
|
|
||||||
def initUI(self):
|
def initUI(self):
|
||||||
self.setWindowTitle('Twitter/X Media Batch Downloader')
|
self.setWindowTitle('Twitter/X Media Batch Downloader')
|
||||||
self.setFixedWidth(650)
|
self.setMinimumWidth(670)
|
||||||
self.setFixedHeight(350)
|
self.setMinimumHeight(350)
|
||||||
|
|
||||||
icon_path = os.path.join(os.path.dirname(__file__), "icon.svg")
|
icon_path = os.path.join(os.path.dirname(__file__), "icon.svg")
|
||||||
if os.path.exists(icon_path):
|
if os.path.exists(icon_path):
|
||||||
@@ -438,20 +509,18 @@ class TwitterMediaDownloaderGUI(QWidget):
|
|||||||
self.account_list = QListWidget()
|
self.account_list = QListWidget()
|
||||||
self.account_list.setSelectionMode(QAbstractItemView.SelectionMode.ExtendedSelection)
|
self.account_list.setSelectionMode(QAbstractItemView.SelectionMode.ExtendedSelection)
|
||||||
self.account_list.itemSelectionChanged.connect(self.update_button_states)
|
self.account_list.itemSelectionChanged.connect(self.update_button_states)
|
||||||
self.account_list.setIconSize(QSize(36, 36))
|
self.account_list.setIconSize(QSize(48, 48))
|
||||||
|
self.account_list.setWordWrap(True)
|
||||||
self.account_list.setStyleSheet("""
|
self.account_list.setStyleSheet("""
|
||||||
QListWidget {
|
QListWidget {
|
||||||
background-color: palette(base);
|
background-color: palette(base);
|
||||||
border: 1px solid palette(mid);
|
padding: 4px;
|
||||||
border-radius: 4px;
|
|
||||||
padding: 0px;
|
|
||||||
outline: none;
|
outline: none;
|
||||||
}
|
}
|
||||||
QListWidget::item {
|
QListWidget::item {
|
||||||
padding: 8px 12px;
|
padding: 3px 6px;
|
||||||
margin: 2px 0px;
|
margin: 0px 0px;
|
||||||
border: none;
|
border: none;
|
||||||
border-radius: 4px;
|
|
||||||
outline: none;
|
outline: none;
|
||||||
}
|
}
|
||||||
QListWidget::item:selected {
|
QListWidget::item:selected {
|
||||||
@@ -464,7 +533,7 @@ class TwitterMediaDownloaderGUI(QWidget):
|
|||||||
outline: none;
|
outline: none;
|
||||||
}
|
}
|
||||||
QListWidget::item:hover {
|
QListWidget::item:hover {
|
||||||
background-color: palette(midlight);
|
background-color: palette(highlight);
|
||||||
}
|
}
|
||||||
""")
|
""")
|
||||||
|
|
||||||
@@ -480,22 +549,22 @@ class TwitterMediaDownloaderGUI(QWidget):
|
|||||||
def setup_account_buttons(self):
|
def setup_account_buttons(self):
|
||||||
self.btn_layout = QHBoxLayout()
|
self.btn_layout = QHBoxLayout()
|
||||||
self.download_selected_btn = QPushButton('Download Selected')
|
self.download_selected_btn = QPushButton('Download Selected')
|
||||||
self.download_all_btn = QPushButton('Download All')
|
self.update_selected_btn = QPushButton('Update Selected')
|
||||||
self.remove_btn = QPushButton('Remove Selected')
|
self.remove_btn = QPushButton('Remove Selected')
|
||||||
self.clear_btn = QPushButton('Clear')
|
self.clear_btn = QPushButton('Clear')
|
||||||
|
|
||||||
for btn in [self.download_selected_btn, self.download_all_btn, self.remove_btn, self.clear_btn]:
|
for btn in [self.download_selected_btn, self.update_selected_btn, self.remove_btn, self.clear_btn]:
|
||||||
btn.setFixedWidth(150)
|
btn.setMinimumWidth(120)
|
||||||
btn.setCursor(Qt.CursorShape.PointingHandCursor)
|
btn.setCursor(Qt.CursorShape.PointingHandCursor)
|
||||||
|
|
||||||
self.download_selected_btn.clicked.connect(self.download_selected)
|
self.download_selected_btn.clicked.connect(self.download_selected)
|
||||||
self.download_all_btn.clicked.connect(self.download_all)
|
self.update_selected_btn.clicked.connect(self.update_selected)
|
||||||
self.remove_btn.clicked.connect(self.remove_selected_accounts)
|
self.remove_btn.clicked.connect(self.remove_selected_accounts)
|
||||||
self.clear_btn.clicked.connect(self.clear_accounts)
|
self.clear_btn.clicked.connect(self.clear_accounts)
|
||||||
|
|
||||||
self.btn_layout.addStretch()
|
self.btn_layout.addStretch()
|
||||||
for btn in [self.download_selected_btn, self.download_all_btn, self.remove_btn, self.clear_btn]:
|
for btn in [self.download_selected_btn, self.update_selected_btn, self.remove_btn, self.clear_btn]:
|
||||||
self.btn_layout.addWidget(btn)
|
self.btn_layout.addWidget(btn, 1)
|
||||||
self.btn_layout.addStretch()
|
self.btn_layout.addStretch()
|
||||||
|
|
||||||
def setup_process_tab(self):
|
def setup_process_tab(self):
|
||||||
@@ -519,18 +588,47 @@ class TwitterMediaDownloaderGUI(QWidget):
|
|||||||
|
|
||||||
process_layout.addLayout(progress_time_layout)
|
process_layout.addLayout(progress_time_layout)
|
||||||
|
|
||||||
control_layout = QHBoxLayout()
|
download_control_layout = QHBoxLayout()
|
||||||
self.stop_btn = QPushButton('Stop')
|
self.stop_btn = QPushButton('Stop')
|
||||||
self.pause_resume_btn = QPushButton('Pause')
|
self.pause_resume_btn = QPushButton('Pause')
|
||||||
|
|
||||||
|
self.stop_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.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)
|
||||||
control_layout.addWidget(self.stop_btn)
|
|
||||||
control_layout.addWidget(self.pause_resume_btn)
|
download_control_layout.addStretch()
|
||||||
process_layout.addLayout(control_layout)
|
download_control_layout.addWidget(self.stop_btn)
|
||||||
|
download_control_layout.addWidget(self.pause_resume_btn)
|
||||||
|
download_control_layout.addStretch()
|
||||||
|
process_layout.addLayout(download_control_layout)
|
||||||
|
|
||||||
|
batch_control_layout = QHBoxLayout()
|
||||||
|
self.next_batch_btn = QPushButton('Next Batch')
|
||||||
|
self.auto_batch_btn = QPushButton('Auto Batch')
|
||||||
|
self.stop_fetch_btn = QPushButton('Stop Fetch')
|
||||||
|
|
||||||
|
for btn in [self.next_batch_btn, self.auto_batch_btn, self.stop_fetch_btn]:
|
||||||
|
btn.setFixedWidth(120)
|
||||||
|
btn.setCursor(Qt.CursorShape.PointingHandCursor)
|
||||||
|
|
||||||
|
self.next_batch_btn.setToolTip("Fetch next batch manually")
|
||||||
|
self.auto_batch_btn.setToolTip("Start automatic batch fetching")
|
||||||
|
self.stop_fetch_btn.setToolTip("Stop automatic batch fetching")
|
||||||
|
|
||||||
|
self.next_batch_btn.clicked.connect(self.fetch_next_batch)
|
||||||
|
self.auto_batch_btn.clicked.connect(self.start_auto_batch)
|
||||||
|
self.stop_fetch_btn.clicked.connect(self.stop_auto_fetch)
|
||||||
|
|
||||||
|
batch_control_layout.addStretch()
|
||||||
|
batch_control_layout.addWidget(self.next_batch_btn)
|
||||||
|
batch_control_layout.addWidget(self.auto_batch_btn)
|
||||||
|
batch_control_layout.addWidget(self.stop_fetch_btn)
|
||||||
|
batch_control_layout.addStretch()
|
||||||
|
process_layout.addLayout(batch_control_layout)
|
||||||
|
|
||||||
self.process_tab.setLayout(process_layout)
|
self.process_tab.setLayout(process_layout)
|
||||||
|
|
||||||
@@ -540,6 +638,9 @@ class TwitterMediaDownloaderGUI(QWidget):
|
|||||||
self.time_label.hide()
|
self.time_label.hide()
|
||||||
self.stop_btn.hide()
|
self.stop_btn.hide()
|
||||||
self.pause_resume_btn.hide()
|
self.pause_resume_btn.hide()
|
||||||
|
self.next_batch_btn.hide()
|
||||||
|
self.auto_batch_btn.hide()
|
||||||
|
self.stop_fetch_btn.hide()
|
||||||
|
|
||||||
def setup_settings_tab(self):
|
def setup_settings_tab(self):
|
||||||
settings_tab = QWidget()
|
settings_tab = QWidget()
|
||||||
@@ -560,6 +661,7 @@ class TwitterMediaDownloaderGUI(QWidget):
|
|||||||
self.output_dir.setText(self.last_output_path)
|
self.output_dir.setText(self.last_output_path)
|
||||||
self.output_dir.textChanged.connect(self.save_settings)
|
self.output_dir.textChanged.connect(self.save_settings)
|
||||||
self.output_browse = QPushButton('Browse')
|
self.output_browse = QPushButton('Browse')
|
||||||
|
self.output_browse.setFixedWidth(100)
|
||||||
self.output_browse.setCursor(Qt.CursorShape.PointingHandCursor)
|
self.output_browse.setCursor(Qt.CursorShape.PointingHandCursor)
|
||||||
self.output_browse.clicked.connect(self.browse_output)
|
self.output_browse.clicked.connect(self.browse_output)
|
||||||
|
|
||||||
@@ -581,7 +683,7 @@ class TwitterMediaDownloaderGUI(QWidget):
|
|||||||
auth_token_label = QLabel('Auth Token:')
|
auth_token_label = QLabel('Auth Token:')
|
||||||
|
|
||||||
self.auth_token_input = QLineEdit()
|
self.auth_token_input = QLineEdit()
|
||||||
self.auth_token_input.setPlaceholderText("Enter your Twitter/X auth_token")
|
self.auth_token_input.setPlaceholderText("Enter Auth Token")
|
||||||
self.auth_token_input.setText(self.last_auth_token)
|
self.auth_token_input.setText(self.last_auth_token)
|
||||||
self.auth_token_input.textChanged.connect(self.save_settings)
|
self.auth_token_input.textChanged.connect(self.save_settings)
|
||||||
self.auth_token_input.setClearButtonEnabled(True)
|
self.auth_token_input.setClearButtonEnabled(True)
|
||||||
@@ -603,7 +705,7 @@ class TwitterMediaDownloaderGUI(QWidget):
|
|||||||
first_row_layout = QHBoxLayout()
|
first_row_layout = QHBoxLayout()
|
||||||
first_row_layout.setSpacing(5)
|
first_row_layout.setSpacing(5)
|
||||||
|
|
||||||
self.batch_checkbox = QCheckBox("Batch")
|
self.batch_checkbox = QCheckBox("Fetch Batch")
|
||||||
self.batch_checkbox.setCursor(Qt.CursorShape.PointingHandCursor)
|
self.batch_checkbox.setCursor(Qt.CursorShape.PointingHandCursor)
|
||||||
self.batch_checkbox.setToolTip("Enable for accounts with thousands of media")
|
self.batch_checkbox.setToolTip("Enable for accounts with thousands of media")
|
||||||
self.batch_checkbox.stateChanged.connect(self.handle_batch_checkbox)
|
self.batch_checkbox.stateChanged.connect(self.handle_batch_checkbox)
|
||||||
@@ -669,7 +771,7 @@ class TwitterMediaDownloaderGUI(QWidget):
|
|||||||
download_layout.addWidget(download_label)
|
download_layout.addWidget(download_label)
|
||||||
|
|
||||||
batch_layout = QHBoxLayout()
|
batch_layout = QHBoxLayout()
|
||||||
batch_label = QLabel('Batch Size:')
|
batch_label = QLabel('Concurrent Downloads:')
|
||||||
|
|
||||||
self.download_batch_combo = QComboBox()
|
self.download_batch_combo = QComboBox()
|
||||||
self.download_batch_combo.setCursor(Qt.CursorShape.PointingHandCursor)
|
self.download_batch_combo.setCursor(Qt.CursorShape.PointingHandCursor)
|
||||||
@@ -688,7 +790,7 @@ class TwitterMediaDownloaderGUI(QWidget):
|
|||||||
batch_layout.addWidget(self.download_batch_combo)
|
batch_layout.addWidget(self.download_batch_combo)
|
||||||
batch_layout.addWidget(self.convert_gif_checkbox)
|
batch_layout.addWidget(self.convert_gif_checkbox)
|
||||||
|
|
||||||
self.gif_resolution_label = QLabel("GIF Quality:")
|
self.gif_resolution_label = QLabel("Converted GIF Quality:")
|
||||||
self.gif_resolution_combo = QComboBox()
|
self.gif_resolution_combo = QComboBox()
|
||||||
self.gif_resolution_combo.setCursor(Qt.CursorShape.PointingHandCursor)
|
self.gif_resolution_combo.setCursor(Qt.CursorShape.PointingHandCursor)
|
||||||
self.gif_resolution_combo.setFixedWidth(85)
|
self.gif_resolution_combo.setFixedWidth(85)
|
||||||
@@ -721,53 +823,36 @@ class TwitterMediaDownloaderGUI(QWidget):
|
|||||||
about_tab = QWidget()
|
about_tab = QWidget()
|
||||||
about_layout = QVBoxLayout()
|
about_layout = QVBoxLayout()
|
||||||
about_layout.setAlignment(Qt.AlignmentFlag.AlignCenter)
|
about_layout.setAlignment(Qt.AlignmentFlag.AlignCenter)
|
||||||
about_layout.setSpacing(3)
|
about_layout.setSpacing(15)
|
||||||
|
|
||||||
sections = [
|
sections = [
|
||||||
("Check for Updates", "https://github.com/afkarxyz/Twitter-X-Media-Batch-Downloader/releases"),
|
("Check for Updates", "Check", "https://github.com/afkarxyz/Twitter-X-Media-Batch-Downloader/releases"),
|
||||||
("Report an Issue", "https://github.com/afkarxyz/Twitter-X-Media-Batch-Downloader/issues"),
|
("Report an Issue", "Report", "https://github.com/afkarxyz/Twitter-X-Media-Batch-Downloader/issues"),
|
||||||
("gallery-dl Repository", "https://github.com/mikf/gallery-dl")
|
("gallery-dl Repository", "Visit", "https://github.com/mikf/gallery-dl")
|
||||||
]
|
]
|
||||||
|
|
||||||
for title, url in sections:
|
for title, button_text, url in sections:
|
||||||
section_widget = QWidget()
|
section_widget = QWidget()
|
||||||
section_layout = QVBoxLayout(section_widget)
|
section_layout = QVBoxLayout(section_widget)
|
||||||
section_layout.setSpacing(10)
|
section_layout.setSpacing(10)
|
||||||
section_layout.setContentsMargins(0, 0, 0, 0)
|
section_layout.setContentsMargins(0, 0, 0, 0)
|
||||||
|
|
||||||
label = QLabel(title)
|
label = QLabel(title)
|
||||||
label.setStyleSheet("color: palette(text); font-weight: bold;")
|
label.setStyleSheet("font-weight: bold;")
|
||||||
label.setAlignment(Qt.AlignmentFlag.AlignCenter)
|
label.setAlignment(Qt.AlignmentFlag.AlignCenter)
|
||||||
section_layout.addWidget(label)
|
section_layout.addWidget(label)
|
||||||
|
|
||||||
button = QPushButton("Click Here!")
|
button = QPushButton(button_text)
|
||||||
button.setFixedWidth(150)
|
button.setFixedSize(100, 25)
|
||||||
button.setStyleSheet("""
|
|
||||||
QPushButton {
|
|
||||||
background-color: palette(button);
|
|
||||||
color: palette(button-text);
|
|
||||||
border: 1px solid palette(mid);
|
|
||||||
padding: 6px;
|
|
||||||
border-radius: 15px;
|
|
||||||
}
|
|
||||||
QPushButton:hover {
|
|
||||||
background-color: palette(light);
|
|
||||||
}
|
|
||||||
QPushButton:pressed {
|
|
||||||
background-color: palette(midlight);
|
|
||||||
}
|
|
||||||
""")
|
|
||||||
button.setCursor(Qt.CursorShape.PointingHandCursor)
|
button.setCursor(Qt.CursorShape.PointingHandCursor)
|
||||||
button.clicked.connect(lambda _, url=url: QDesktopServices.openUrl(QUrl(url if url.startswith(('http://', 'https://')) else f'https://{url}')))
|
button.clicked.connect(lambda _, url=url: QDesktopServices.openUrl(QUrl(url if url.startswith(('http://', 'https://')) else f'https://{url}')))
|
||||||
section_layout.addWidget(button, alignment=Qt.AlignmentFlag.AlignCenter)
|
section_layout.addWidget(button, alignment=Qt.AlignmentFlag.AlignCenter)
|
||||||
about_layout.addWidget(section_widget)
|
|
||||||
if sections.index((title, url)) < len(sections) - 1:
|
|
||||||
spacer = QSpacerItem(20, 6, QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Fixed)
|
|
||||||
about_layout.addItem(spacer)
|
|
||||||
|
|
||||||
footer_label = QLabel("v3.0 | gallery-dl v1.30.0 | July 2025")
|
about_layout.addWidget(section_widget)
|
||||||
footer_label.setStyleSheet("font-size: 12px; margin-top: 10px;")
|
|
||||||
|
footer_label = QLabel(f"v{self.current_version} | gallery-dl v1.30.2 | August 2025")
|
||||||
about_layout.addWidget(footer_label, alignment=Qt.AlignmentFlag.AlignCenter)
|
about_layout.addWidget(footer_label, alignment=Qt.AlignmentFlag.AlignCenter)
|
||||||
|
|
||||||
about_tab.setLayout(about_layout)
|
about_tab.setLayout(about_layout)
|
||||||
self.tab_widget.addTab(about_tab, "About")
|
self.tab_widget.addTab(about_tab, "About")
|
||||||
|
|
||||||
@@ -860,7 +945,7 @@ class TwitterMediaDownloaderGUI(QWidget):
|
|||||||
self.twitter_url.setText(last_username_url)
|
self.twitter_url.setText(last_username_url)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"Error loading settings: {e}")
|
pass
|
||||||
|
|
||||||
def handle_batch_checkbox(self, state):
|
def handle_batch_checkbox(self, state):
|
||||||
if not hasattr(self, 'size_label') or not hasattr(self, 'batch_size_combo'):
|
if not hasattr(self, 'size_label') or not hasattr(self, 'batch_size_combo'):
|
||||||
@@ -978,7 +1063,9 @@ class TwitterMediaDownloaderGUI(QWidget):
|
|||||||
posts=posts,
|
posts=posts,
|
||||||
media_type=media_type,
|
media_type=media_type,
|
||||||
profile_image=profile_image_url,
|
profile_image=profile_image_url,
|
||||||
media_list=timeline
|
media_list=timeline,
|
||||||
|
fetch_mode='batch' if cached_data.get('is_batch', False) else 'all',
|
||||||
|
fetch_timestamp=cached_data.get('fetch_timestamp')
|
||||||
)
|
)
|
||||||
|
|
||||||
self.accounts.append(account)
|
self.accounts.append(account)
|
||||||
@@ -1015,11 +1102,28 @@ class TwitterMediaDownloaderGUI(QWidget):
|
|||||||
|
|
||||||
media_type = self.media_type_combo.currentData()
|
media_type = self.media_type_combo.currentData()
|
||||||
|
|
||||||
|
existing_account = None
|
||||||
for account in self.accounts:
|
for account in self.accounts:
|
||||||
if account.username == username and account.media_type == media_type:
|
if account.username == username and account.media_type == media_type:
|
||||||
self.log_output.append(f'Account {username} with {media_type} media type already in list.')
|
existing_account = account
|
||||||
return
|
break
|
||||||
|
|
||||||
|
if existing_account:
|
||||||
|
self.accounts.remove(existing_account)
|
||||||
|
|
||||||
|
for is_batch in [True, False]:
|
||||||
|
cache_file = self.get_cache_file_path(username, media_type, is_batch=is_batch)
|
||||||
|
try:
|
||||||
|
if os.path.exists(cache_file):
|
||||||
|
os.remove(cache_file)
|
||||||
|
self.log_output.append(f'Removed existing cache: {os.path.basename(cache_file)}')
|
||||||
|
except Exception as e:
|
||||||
|
self.log_output.append(f'Warning: Could not remove cache {os.path.basename(cache_file)}: {str(e)}')
|
||||||
|
|
||||||
|
self.log_output.append(f'Preparing new batch for {username} ({media_type}) - cache cleared')
|
||||||
|
self.update_account_list()
|
||||||
|
|
||||||
|
if not existing_account:
|
||||||
cached_data = self.load_cached_data(username, media_type, is_batch=self.batch_mode)
|
cached_data = self.load_cached_data(username, media_type, is_batch=self.batch_mode)
|
||||||
if cached_data:
|
if cached_data:
|
||||||
try:
|
try:
|
||||||
@@ -1038,7 +1142,9 @@ class TwitterMediaDownloaderGUI(QWidget):
|
|||||||
following=following,
|
following=following,
|
||||||
posts=posts,
|
posts=posts,
|
||||||
media_type=media_type,
|
media_type=media_type,
|
||||||
media_list=timeline
|
media_list=timeline,
|
||||||
|
fetch_mode='batch' if cached_data.get('is_batch', False) else 'all',
|
||||||
|
fetch_timestamp=cached_data.get('fetch_timestamp')
|
||||||
)
|
)
|
||||||
|
|
||||||
self.accounts.append(account)
|
self.accounts.append(account)
|
||||||
@@ -1052,6 +1158,12 @@ class TwitterMediaDownloaderGUI(QWidget):
|
|||||||
try:
|
try:
|
||||||
self.reset_ui()
|
self.reset_ui()
|
||||||
|
|
||||||
|
self.is_auto_fetching = False
|
||||||
|
self.current_fetch_username = username
|
||||||
|
self.current_fetch_media_type = media_type
|
||||||
|
|
||||||
|
self.disable_batch_buttons()
|
||||||
|
|
||||||
self.log_output.append(f'Fetching metadata for {username}...')
|
self.log_output.append(f'Fetching metadata for {username}...')
|
||||||
self.tab_widget.setCurrentWidget(self.process_tab)
|
self.tab_widget.setCurrentWidget(self.process_tab)
|
||||||
|
|
||||||
@@ -1081,8 +1193,14 @@ class TwitterMediaDownloaderGUI(QWidget):
|
|||||||
account_info = data.get('account_info', {})
|
account_info = data.get('account_info', {})
|
||||||
timeline = data.get('timeline', [])
|
timeline = data.get('timeline', [])
|
||||||
metadata = data.get('metadata', {})
|
metadata = data.get('metadata', {})
|
||||||
if not account_info or not timeline:
|
if not account_info:
|
||||||
self.log_output.append('Error: Invalid data received')
|
self.log_output.append('Error: Invalid account data received')
|
||||||
|
self.update_account_list()
|
||||||
|
return
|
||||||
|
|
||||||
|
if not timeline:
|
||||||
|
media_type_display = media_type if media_type != 'all' else 'media'
|
||||||
|
self.log_output.append(f'Error: No {media_type_display} found for account {username}')
|
||||||
self.update_account_list()
|
self.update_account_list()
|
||||||
return
|
return
|
||||||
existing_account = None
|
existing_account = None
|
||||||
@@ -1111,7 +1229,9 @@ class TwitterMediaDownloaderGUI(QWidget):
|
|||||||
posts=posts,
|
posts=posts,
|
||||||
media_type=media_type,
|
media_type=media_type,
|
||||||
profile_image=profile_image_url,
|
profile_image=profile_image_url,
|
||||||
media_list=timeline
|
media_list=timeline,
|
||||||
|
fetch_mode='batch' if self.batch_mode else 'all',
|
||||||
|
fetch_timestamp=datetime.now().isoformat()
|
||||||
)
|
)
|
||||||
|
|
||||||
self.accounts.append(account)
|
self.accounts.append(account)
|
||||||
@@ -1121,34 +1241,51 @@ class TwitterMediaDownloaderGUI(QWidget):
|
|||||||
updated_data = {
|
updated_data = {
|
||||||
'account_info': account_info,
|
'account_info': account_info,
|
||||||
'timeline': existing_account.media_list,
|
'timeline': existing_account.media_list,
|
||||||
'metadata': metadata
|
'metadata': metadata,
|
||||||
|
'is_batch': self.batch_mode,
|
||||||
|
'fetch_timestamp': existing_account.fetch_timestamp
|
||||||
}
|
}
|
||||||
self.save_cached_data(username, media_type, updated_data, is_batch=self.batch_mode)
|
self.save_cached_data(username, media_type, updated_data, is_batch=self.batch_mode)
|
||||||
|
|
||||||
self.update_account_list()
|
self.update_account_list()
|
||||||
|
|
||||||
|
self.current_fetch_username = username
|
||||||
|
self.current_fetch_media_type = media_type
|
||||||
|
self.current_fetch_metadata = metadata
|
||||||
|
|
||||||
if self.batch_mode and metadata.get('has_more', False):
|
if self.batch_mode and metadata.get('has_more', False):
|
||||||
current_page = metadata.get('page', 0)
|
current_page = metadata.get('page', 0)
|
||||||
next_page = current_page + 1
|
next_page = current_page + 1
|
||||||
|
self.log_output.append(f'Batch {current_page + 1} completed. Next batch ({next_page + 1}) available.')
|
||||||
|
|
||||||
self.log_output.append(f'Auto-fetching batch {next_page + 1} for {username}...')
|
if self.is_auto_fetching:
|
||||||
|
self.next_batch_btn.hide()
|
||||||
self.metadata_worker = MetadataFetchWorker(
|
self.auto_batch_btn.hide()
|
||||||
username,
|
self.stop_fetch_btn.show()
|
||||||
media_type,
|
self.fetch_next_batch_internal()
|
||||||
batch_mode=True,
|
|
||||||
batch_size=self.batch_size,
|
|
||||||
page=next_page
|
|
||||||
)
|
|
||||||
self.metadata_worker.auth_token = self.auth_token_input.text().strip()
|
|
||||||
self.metadata_worker.finished.connect(lambda data: self.on_metadata_fetched(data, username, media_type))
|
|
||||||
self.metadata_worker.error.connect(self.on_metadata_error)
|
|
||||||
self.metadata_worker.start()
|
|
||||||
else:
|
else:
|
||||||
|
self.next_batch_btn.show()
|
||||||
|
self.auto_batch_btn.show()
|
||||||
|
self.stop_fetch_btn.hide()
|
||||||
|
self.enable_batch_buttons()
|
||||||
|
self.log_output.append('Use "Next Batch" for manual fetch or "Auto Batch" for automatic fetching.')
|
||||||
|
else:
|
||||||
|
self.next_batch_btn.hide()
|
||||||
|
self.auto_batch_btn.hide()
|
||||||
|
self.stop_fetch_btn.hide()
|
||||||
|
self.is_auto_fetching = False
|
||||||
|
self.enable_batch_buttons()
|
||||||
|
|
||||||
if self.batch_mode:
|
if self.batch_mode:
|
||||||
total_items = len(existing_account.media_list)
|
total_items = len(existing_account.media_list)
|
||||||
self.log_output.append(f'Auto-fetch complete! Total: {total_items:,} media items for {username}')
|
self.log_output.append(f'All batches complete! Total: {total_items:,} media items for {username}')
|
||||||
|
|
||||||
self.twitter_url.clear()
|
self.twitter_url.clear()
|
||||||
|
|
||||||
|
if hasattr(self, 'accounts_to_update') and hasattr(self, 'current_update_index'):
|
||||||
|
self.current_update_index += 1
|
||||||
|
self.update_next_account()
|
||||||
|
else:
|
||||||
self.tab_widget.setCurrentIndex(0)
|
self.tab_widget.setCurrentIndex(0)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.log_output.append(f'Error: {str(e)}')
|
self.log_output.append(f'Error: {str(e)}')
|
||||||
@@ -1157,6 +1294,19 @@ class TwitterMediaDownloaderGUI(QWidget):
|
|||||||
def on_metadata_error(self, error_message):
|
def on_metadata_error(self, error_message):
|
||||||
self.log_output.append(f'Error: {error_message}')
|
self.log_output.append(f'Error: {error_message}')
|
||||||
|
|
||||||
|
if self.is_auto_fetching:
|
||||||
|
self.stop_auto_fetch()
|
||||||
|
|
||||||
|
self.next_batch_btn.hide()
|
||||||
|
self.auto_batch_btn.hide()
|
||||||
|
self.stop_fetch_btn.hide()
|
||||||
|
|
||||||
|
self.enable_batch_buttons()
|
||||||
|
|
||||||
|
if hasattr(self, 'accounts_to_update') and hasattr(self, 'current_update_index'):
|
||||||
|
self.current_update_index += 1
|
||||||
|
self.update_next_account()
|
||||||
|
|
||||||
self.update_account_list()
|
self.update_account_list()
|
||||||
|
|
||||||
def update_account_list(self):
|
def update_account_list(self):
|
||||||
@@ -1167,21 +1317,22 @@ class TwitterMediaDownloaderGUI(QWidget):
|
|||||||
|
|
||||||
line1 = f"{i}. {account.username} ({account.nick})"
|
line1 = f"{i}. {account.username} ({account.nick})"
|
||||||
line2 = f"Followers: {account.followers:,} • Following: {account.following:,} • Posts: {account.posts:,} • {media_type_display}: {media_count:,}"
|
line2 = f"Followers: {account.followers:,} • Following: {account.following:,} • Posts: {account.posts:,} • {media_type_display}: {media_count:,}"
|
||||||
display_text = f"{line1}\n{line2}"
|
line3 = self.format_fetch_info(account.fetch_timestamp)
|
||||||
|
display_text = f"{line1}\n{line2}\n{line3}"
|
||||||
item = QListWidgetItem()
|
item = QListWidgetItem()
|
||||||
item.setText(display_text)
|
item.setText(display_text)
|
||||||
item.setSizeHint(QSize(0, 52))
|
item.setSizeHint(QSize(0, 70))
|
||||||
|
|
||||||
if account.profile_image:
|
if account.profile_image:
|
||||||
if account.profile_image in self.profile_image_cache:
|
if account.profile_image in self.profile_image_cache:
|
||||||
item.setIcon(QIcon(self.profile_image_cache[account.profile_image]))
|
item.setIcon(QIcon(self.profile_image_cache[account.profile_image]))
|
||||||
else:
|
else:
|
||||||
self.download_profile_image(account.profile_image)
|
self.download_profile_image(account.profile_image)
|
||||||
placeholder = self.create_placeholder_icon(52)
|
placeholder = self.create_placeholder_icon(48)
|
||||||
if placeholder:
|
if placeholder:
|
||||||
item.setIcon(QIcon(placeholder))
|
item.setIcon(QIcon(placeholder))
|
||||||
else:
|
else:
|
||||||
placeholder = self.create_placeholder_icon(52)
|
placeholder = self.create_placeholder_icon(48)
|
||||||
if placeholder:
|
if placeholder:
|
||||||
item.setIcon(QIcon(placeholder))
|
item.setIcon(QIcon(placeholder))
|
||||||
|
|
||||||
@@ -1189,7 +1340,7 @@ class TwitterMediaDownloaderGUI(QWidget):
|
|||||||
|
|
||||||
self.update_button_states()
|
self.update_button_states()
|
||||||
|
|
||||||
def create_placeholder_icon(self, size=36):
|
def create_placeholder_icon(self, size=48):
|
||||||
pixmap = QPixmap(size, size)
|
pixmap = QPixmap(size, size)
|
||||||
pixmap.fill(Qt.GlobalColor.transparent)
|
pixmap.fill(Qt.GlobalColor.transparent)
|
||||||
|
|
||||||
@@ -1208,7 +1359,7 @@ class TwitterMediaDownloaderGUI(QWidget):
|
|||||||
painter.end()
|
painter.end()
|
||||||
return pixmap
|
return pixmap
|
||||||
|
|
||||||
def create_square_pixmap(self, original_pixmap, size=36):
|
def create_square_pixmap(self, original_pixmap, size=48):
|
||||||
if original_pixmap.isNull():
|
if original_pixmap.isNull():
|
||||||
return self.create_placeholder_icon(size)
|
return self.create_placeholder_icon(size)
|
||||||
|
|
||||||
@@ -1248,7 +1399,7 @@ class TwitterMediaDownloaderGUI(QWidget):
|
|||||||
self.pending_downloads[url] = reply
|
self.pending_downloads[url] = reply
|
||||||
reply.finished.connect(lambda: self.on_profile_image_downloaded(reply, url))
|
reply.finished.connect(lambda: self.on_profile_image_downloaded(reply, url))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"Error downloading profile image: {e}")
|
pass
|
||||||
|
|
||||||
def on_profile_image_downloaded(self, reply, image_url):
|
def on_profile_image_downloaded(self, reply, image_url):
|
||||||
try:
|
try:
|
||||||
@@ -1256,7 +1407,7 @@ class TwitterMediaDownloaderGUI(QWidget):
|
|||||||
data = reply.readAll()
|
data = reply.readAll()
|
||||||
pixmap = QPixmap()
|
pixmap = QPixmap()
|
||||||
if pixmap.loadFromData(data):
|
if pixmap.loadFromData(data):
|
||||||
square_pixmap = self.create_square_pixmap(pixmap, 52)
|
square_pixmap = self.create_square_pixmap(pixmap, 48)
|
||||||
self.profile_image_cache[image_url] = square_pixmap
|
self.profile_image_cache[image_url] = square_pixmap
|
||||||
|
|
||||||
self.update_account_list()
|
self.update_account_list()
|
||||||
@@ -1265,21 +1416,23 @@ class TwitterMediaDownloaderGUI(QWidget):
|
|||||||
del self.pending_downloads[image_url]
|
del self.pending_downloads[image_url]
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"Error processing profile image: {e}")
|
pass
|
||||||
finally:
|
finally:
|
||||||
reply.deleteLater()
|
reply.deleteLater()
|
||||||
|
|
||||||
def update_button_states(self):
|
def update_button_states(self):
|
||||||
has_accounts = len(self.accounts) > 0
|
has_accounts = len(self.accounts) > 0
|
||||||
|
|
||||||
self.download_selected_btn.setEnabled(has_accounts)
|
has_selected = len(self.account_list.selectedItems()) > 0
|
||||||
self.download_all_btn.setEnabled(has_accounts)
|
|
||||||
self.remove_btn.setEnabled(has_accounts)
|
self.download_selected_btn.setEnabled(has_accounts and has_selected)
|
||||||
|
self.update_selected_btn.setEnabled(has_accounts and has_selected)
|
||||||
|
self.remove_btn.setEnabled(has_accounts and has_selected)
|
||||||
self.clear_btn.setEnabled(has_accounts)
|
self.clear_btn.setEnabled(has_accounts)
|
||||||
|
|
||||||
if has_accounts:
|
if has_accounts:
|
||||||
self.download_selected_btn.show()
|
self.download_selected_btn.show()
|
||||||
self.download_all_btn.show()
|
self.update_selected_btn.show()
|
||||||
self.remove_btn.show()
|
self.remove_btn.show()
|
||||||
self.clear_btn.show()
|
self.clear_btn.show()
|
||||||
else:
|
else:
|
||||||
@@ -1288,7 +1441,7 @@ class TwitterMediaDownloaderGUI(QWidget):
|
|||||||
def hide_account_buttons(self):
|
def hide_account_buttons(self):
|
||||||
buttons = [
|
buttons = [
|
||||||
self.download_selected_btn,
|
self.download_selected_btn,
|
||||||
self.download_all_btn,
|
self.update_selected_btn,
|
||||||
self.remove_btn,
|
self.remove_btn,
|
||||||
self.clear_btn
|
self.clear_btn
|
||||||
]
|
]
|
||||||
@@ -1305,6 +1458,113 @@ class TwitterMediaDownloaderGUI(QWidget):
|
|||||||
def download_all(self):
|
def download_all(self):
|
||||||
self.download_accounts(range(len(self.accounts)))
|
self.download_accounts(range(len(self.accounts)))
|
||||||
|
|
||||||
|
def update_selected(self):
|
||||||
|
selected_items = self.account_list.selectedItems()
|
||||||
|
if not selected_items:
|
||||||
|
self.log_output.append('Warning: Please select accounts to update.')
|
||||||
|
return
|
||||||
|
|
||||||
|
selected_accounts = []
|
||||||
|
for item in selected_items:
|
||||||
|
index = self.account_list.row(item)
|
||||||
|
if index < len(self.accounts):
|
||||||
|
selected_accounts.append(self.accounts[index])
|
||||||
|
|
||||||
|
if not selected_accounts:
|
||||||
|
return
|
||||||
|
|
||||||
|
self.tab_widget.setCurrentIndex(1)
|
||||||
|
|
||||||
|
self.log_output.clear()
|
||||||
|
self.log_output.append(f'Starting update for {len(selected_accounts)} account(s)...')
|
||||||
|
|
||||||
|
self.accounts_to_update = selected_accounts.copy()
|
||||||
|
self.current_update_index = 0
|
||||||
|
|
||||||
|
self.update_next_account()
|
||||||
|
|
||||||
|
def update_next_account(self):
|
||||||
|
if not hasattr(self, 'accounts_to_update') or self.current_update_index >= len(self.accounts_to_update):
|
||||||
|
self.log_output.append('All selected accounts have been updated!')
|
||||||
|
if hasattr(self, 'accounts_to_update'):
|
||||||
|
delattr(self, 'accounts_to_update')
|
||||||
|
if hasattr(self, 'current_update_index'):
|
||||||
|
delattr(self, 'current_update_index')
|
||||||
|
return
|
||||||
|
|
||||||
|
account = self.accounts_to_update[self.current_update_index]
|
||||||
|
self.log_output.append(f'Updating account {self.current_update_index + 1}/{len(self.accounts_to_update)}: {account.username} ({account.media_type})')
|
||||||
|
self.update_account(account)
|
||||||
|
|
||||||
|
def update_account(self, account):
|
||||||
|
original_batch_mode = self.batch_mode
|
||||||
|
original_batch_size = self.batch_size
|
||||||
|
original_media_type = self.media_type_combo.currentData()
|
||||||
|
|
||||||
|
self.batch_mode = (account.fetch_mode == 'batch')
|
||||||
|
if self.batch_mode:
|
||||||
|
self.batch_size = self.settings.value('batch_size', 100, type=int)
|
||||||
|
|
||||||
|
for i in range(self.media_type_combo.count()):
|
||||||
|
if self.media_type_combo.itemData(i) == account.media_type:
|
||||||
|
self.media_type_combo.setCurrentIndex(i)
|
||||||
|
break
|
||||||
|
|
||||||
|
self.twitter_url.setText(account.username)
|
||||||
|
|
||||||
|
self.tab_widget.setCurrentIndex(1)
|
||||||
|
|
||||||
|
self.log_output.append(f'Updating {account.username} ({account.media_type}) using {account.fetch_mode} mode...')
|
||||||
|
|
||||||
|
username = account.username
|
||||||
|
media_type = account.media_type
|
||||||
|
|
||||||
|
for is_batch in [True, False]:
|
||||||
|
cache_file = self.get_cache_file_path(username, media_type, is_batch=is_batch)
|
||||||
|
try:
|
||||||
|
if os.path.exists(cache_file):
|
||||||
|
os.remove(cache_file)
|
||||||
|
self.log_output.append(f'Removed existing cache: {os.path.basename(cache_file)}')
|
||||||
|
except Exception as e:
|
||||||
|
self.log_output.append(f'Warning: Could not remove cache {os.path.basename(cache_file)}: {str(e)}')
|
||||||
|
|
||||||
|
for i, existing_account in enumerate(self.accounts):
|
||||||
|
if existing_account.username == account.username and existing_account.media_type == account.media_type:
|
||||||
|
self.accounts.pop(i)
|
||||||
|
break
|
||||||
|
|
||||||
|
self.update_account_list()
|
||||||
|
|
||||||
|
self.start_fetch_process(username, media_type)
|
||||||
|
|
||||||
|
self.batch_mode = original_batch_mode
|
||||||
|
self.batch_size = original_batch_size
|
||||||
|
|
||||||
|
for i in range(self.media_type_combo.count()):
|
||||||
|
if self.media_type_combo.itemData(i) == original_media_type:
|
||||||
|
self.media_type_combo.setCurrentIndex(i)
|
||||||
|
break
|
||||||
|
|
||||||
|
def start_fetch_process(self, username, media_type):
|
||||||
|
if not self.auth_token_input.text().strip():
|
||||||
|
self.log_output.append("Error: Please enter your auth token")
|
||||||
|
return
|
||||||
|
|
||||||
|
self.current_page = 0
|
||||||
|
self.disable_batch_buttons()
|
||||||
|
|
||||||
|
self.worker = MetadataFetchWorker(
|
||||||
|
username,
|
||||||
|
media_type,
|
||||||
|
batch_mode=self.batch_mode,
|
||||||
|
batch_size=self.batch_size if self.batch_mode else 0,
|
||||||
|
page=0
|
||||||
|
)
|
||||||
|
self.worker.auth_token = self.auth_token_input.text().strip()
|
||||||
|
self.worker.finished.connect(lambda data: self.on_metadata_fetched(data, username, media_type))
|
||||||
|
self.worker.error.connect(self.on_metadata_error)
|
||||||
|
self.worker.start()
|
||||||
|
|
||||||
def download_accounts(self, indices):
|
def download_accounts(self, indices):
|
||||||
self.log_output.clear()
|
self.log_output.clear()
|
||||||
outpath = self.output_dir.text()
|
outpath = self.output_dir.text()
|
||||||
@@ -1343,10 +1603,14 @@ class TwitterMediaDownloaderGUI(QWidget):
|
|||||||
|
|
||||||
def update_ui_for_download_start(self, account_count):
|
def update_ui_for_download_start(self, account_count):
|
||||||
self.download_selected_btn.setEnabled(False)
|
self.download_selected_btn.setEnabled(False)
|
||||||
self.download_all_btn.setEnabled(False)
|
self.update_selected_btn.setEnabled(False)
|
||||||
self.stop_btn.show()
|
self.stop_btn.show()
|
||||||
self.pause_resume_btn.show()
|
self.pause_resume_btn.show()
|
||||||
|
|
||||||
|
self.next_batch_btn.hide()
|
||||||
|
self.auto_batch_btn.hide()
|
||||||
|
self.stop_fetch_btn.hide()
|
||||||
|
|
||||||
self.progress_bar.show()
|
self.progress_bar.show()
|
||||||
self.progress_bar.setValue(0)
|
self.progress_bar.setValue(0)
|
||||||
|
|
||||||
@@ -1423,7 +1687,13 @@ class TwitterMediaDownloaderGUI(QWidget):
|
|||||||
self.stop_timer()
|
self.stop_timer()
|
||||||
|
|
||||||
self.download_selected_btn.setEnabled(True)
|
self.download_selected_btn.setEnabled(True)
|
||||||
self.download_all_btn.setEnabled(True)
|
self.update_selected_btn.setEnabled(True)
|
||||||
|
|
||||||
|
if (self.batch_mode and self.current_fetch_metadata and
|
||||||
|
self.current_fetch_metadata.get('has_more', False) and not self.is_auto_fetching):
|
||||||
|
self.next_batch_btn.show()
|
||||||
|
self.auto_batch_btn.show()
|
||||||
|
self.enable_batch_buttons()
|
||||||
|
|
||||||
if success:
|
if success:
|
||||||
self.log_output.append(f"\nStatus: {message}")
|
self.log_output.append(f"\nStatus: {message}")
|
||||||
@@ -1483,6 +1753,8 @@ class TwitterMediaDownloaderGUI(QWidget):
|
|||||||
self.reset_ui()
|
self.reset_ui()
|
||||||
self.tab_widget.setCurrentIndex(0)
|
self.tab_widget.setCurrentIndex(0)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def update_timer(self):
|
def update_timer(self):
|
||||||
self.elapsed_time = self.elapsed_time.addSecs(1)
|
self.elapsed_time = self.elapsed_time.addSecs(1)
|
||||||
self.time_label.setText(self.elapsed_time.toString("hh:mm:ss"))
|
self.time_label.setText(self.elapsed_time.toString("hh:mm:ss"))
|
||||||
@@ -1497,9 +1769,72 @@ class TwitterMediaDownloaderGUI(QWidget):
|
|||||||
self.timer.stop()
|
self.timer.stop()
|
||||||
self.time_label.hide()
|
self.time_label.hide()
|
||||||
|
|
||||||
|
def fetch_next_batch(self):
|
||||||
|
if not self.current_fetch_metadata or not self.current_fetch_metadata.get('has_more', False):
|
||||||
|
self.log_output.append('No more batches available.')
|
||||||
|
return
|
||||||
|
|
||||||
|
self.disable_batch_buttons()
|
||||||
|
self.fetch_next_batch_internal()
|
||||||
|
|
||||||
|
def start_auto_batch(self):
|
||||||
|
if not self.current_fetch_metadata or not self.current_fetch_metadata.get('has_more', False):
|
||||||
|
self.log_output.append('No more batches available.')
|
||||||
|
return
|
||||||
|
|
||||||
|
self.is_auto_fetching = True
|
||||||
|
self.auto_batch_btn.hide()
|
||||||
|
self.next_batch_btn.hide()
|
||||||
|
self.stop_fetch_btn.show()
|
||||||
|
|
||||||
|
self.log_output.append('Auto batch mode enabled. Fetching will continue automatically...')
|
||||||
|
self.fetch_next_batch_internal()
|
||||||
|
|
||||||
|
def stop_auto_fetch(self):
|
||||||
|
self.is_auto_fetching = False
|
||||||
|
self.stop_fetch_btn.hide()
|
||||||
|
|
||||||
|
if self.current_fetch_metadata and self.current_fetch_metadata.get('has_more', False):
|
||||||
|
self.next_batch_btn.show()
|
||||||
|
self.auto_batch_btn.show()
|
||||||
|
self.log_output.append('Auto batch mode stopped. Use "Next Batch" or "Auto Batch" to continue.')
|
||||||
|
else:
|
||||||
|
self.log_output.append('Auto batch mode stopped.')
|
||||||
|
|
||||||
|
def disable_batch_buttons(self):
|
||||||
|
self.next_batch_btn.setEnabled(False)
|
||||||
|
self.auto_batch_btn.setEnabled(False)
|
||||||
|
|
||||||
|
def enable_batch_buttons(self):
|
||||||
|
self.next_batch_btn.setEnabled(True)
|
||||||
|
self.auto_batch_btn.setEnabled(True)
|
||||||
|
|
||||||
|
def fetch_next_batch_internal(self):
|
||||||
|
if not self.current_fetch_username or not self.current_fetch_media_type or not self.current_fetch_metadata:
|
||||||
|
return
|
||||||
|
|
||||||
|
self.disable_batch_buttons()
|
||||||
|
|
||||||
|
current_page = self.current_fetch_metadata.get('page', 0)
|
||||||
|
next_page = current_page + 1
|
||||||
|
|
||||||
|
self.log_output.append(f'Fetching batch {next_page + 1} for {self.current_fetch_username}...')
|
||||||
|
|
||||||
|
self.metadata_worker = MetadataFetchWorker(
|
||||||
|
self.current_fetch_username,
|
||||||
|
self.current_fetch_media_type,
|
||||||
|
batch_mode=True,
|
||||||
|
batch_size=self.batch_size,
|
||||||
|
page=next_page
|
||||||
|
)
|
||||||
|
self.metadata_worker.auth_token = self.auth_token_input.text().strip()
|
||||||
|
self.metadata_worker.finished.connect(lambda data: self.on_metadata_fetched(data, self.current_fetch_username, self.current_fetch_media_type))
|
||||||
|
self.metadata_worker.error.connect(self.on_metadata_error)
|
||||||
|
self.metadata_worker.start()
|
||||||
|
|
||||||
def show_account_buttons(self):
|
def show_account_buttons(self):
|
||||||
self.download_selected_btn.show()
|
self.download_selected_btn.show()
|
||||||
self.download_all_btn.show()
|
self.update_selected_btn.show()
|
||||||
self.remove_btn.show()
|
self.remove_btn.show()
|
||||||
self.clear_btn.show()
|
self.clear_btn.show()
|
||||||
|
|
||||||
@@ -1508,6 +1843,7 @@ def main():
|
|||||||
os.chdir(os.path.dirname(sys.executable))
|
os.chdir(os.path.dirname(sys.executable))
|
||||||
|
|
||||||
app = QApplication(sys.argv)
|
app = QApplication(sys.argv)
|
||||||
|
app.setStyle('fusion')
|
||||||
window = TwitterMediaDownloaderGUI()
|
window = TwitterMediaDownloaderGUI()
|
||||||
window.show()
|
window.show()
|
||||||
sys.exit(app.exec())
|
sys.exit(app.exec())
|
||||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,6 @@
|
|||||||
|
PyQt6
|
||||||
|
requests
|
||||||
|
aiohttp
|
||||||
|
imageio-ffmpeg
|
||||||
|
packaging
|
||||||
|
gallery-dl
|
||||||
+1
-1
@@ -1,3 +1,3 @@
|
|||||||
{
|
{
|
||||||
"version": "2.9"
|
"version": "3.3"
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user