mirror of
https://github.com/Alvin-Zilverstand/Twitter-X-Media-Batch-Downloader.git
synced 2026-11-24 15:23:11 +01:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
affd36c968 | ||
|
|
281ea82656 | ||
|
|
aa003fab4c | ||
|
|
805fade0fb |
No files matched your search
@@ -8,11 +8,26 @@
|
|||||||
|
|
||||||
## 📥 Download
|
## 📥 Download
|
||||||
|
|
||||||
- [**Windows**](https://github.com/afkarxyz/Twitter-X-Media-Batch-Downloader/releases/download/v3.4/TwitterXMediaBatchDownloader_Windows.exe)
|
- [**Windows**](https://github.com/afkarxyz/Twitter-X-Media-Batch-Downloader/releases/download/v3.5/TwitterXMediaBatchDownloader_Windows.exe)
|
||||||
- [**Linux**](https://github.com/afkarxyz/Twitter-X-Media-Batch-Downloader/releases/download/v3.4/TwitterXMediaBatchDownloader_Linux)
|
- [**Linux**](https://github.com/afkarxyz/Twitter-X-Media-Batch-Downloader/releases/download/v3.5/TwitterXMediaBatchDownloader_Linux)
|
||||||
- [**Mac**](https://github.com/afkarxyz/Twitter-X-Media-Batch-Downloader/releases/download/v3.4/TwitterXMediaBatchDownloader_Mac.app.zip)
|
- [**Mac**](https://github.com/afkarxyz/Twitter-X-Media-Batch-Downloader/releases/download/v3.5/TwitterXMediaBatchDownloader_Mac.app.zip)
|
||||||
- If you're familiar with **userscripts**, please install it [**here**](https://greasyfork.org/en/scripts/523157)
|
- If you're familiar with **userscripts**, please install it [**here**](https://greasyfork.org/en/scripts/523157)
|
||||||
|
|
||||||
|
## ✨ Features
|
||||||
|
|
||||||
|
- Powered by `gallery-dl`, similar to `yt-dlp`
|
||||||
|
- **Bulk fetch**: Fetch multiple accounts at once
|
||||||
|
- **Bulk download**: Download multiple accounts at once
|
||||||
|
- Media-type selection: All (Images + GIFs + Videos) or specific (Images / GIFs / Videos)
|
||||||
|
- **MP4 → GIF conversion:** Convert downloaded MP4 videos into GIF format
|
||||||
|
- Downloads at original quality
|
||||||
|
|
||||||
|
## 🖼️ Screenshots
|
||||||
|
|
||||||
|

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

|
||||||
|
|
||||||
### 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:
|
||||||
@@ -29,101 +44,6 @@ xattr -rd com.apple.quarantine ~/Downloads/TwitterXMediaBatchDownloader_Mac.app
|
|||||||
```
|
```
|
||||||
https://github.com/user-attachments/assets/4b13c0b9-cf3a-48ce-ac35-a19007189ac8
|
https://github.com/user-attachments/assets/4b13c0b9-cf3a-48ce-ac35-a19007189ac8
|
||||||
|
|
||||||
## ✨ Features
|
|
||||||
|
|
||||||
- Powered by `gallery-dl`, similar to `yt-dlp`
|
|
||||||
- **Bulk download**: Download multiple accounts at once
|
|
||||||
- Media-type selection: All (Images + GIFs + Videos) or specific (Images / GIFs / Videos)
|
|
||||||
- **MP4 → GIF conversion:** Convert downloaded MP4 videos into GIF format
|
|
||||||
- Downloads at original quality
|
|
||||||
|
|
||||||
## 🖼️ 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
|
||||||
|
|
||||||
> [!Warning]
|
> [!Warning]
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ class DownloadWorker(QThread):
|
|||||||
download_progress = pyqtSignal(str, int)
|
download_progress = pyqtSignal(str, int)
|
||||||
|
|
||||||
def __init__(self, accounts, outpath, auth_token, filename_format='username_date',
|
def __init__(self, accounts, outpath, auth_token, filename_format='username_date',
|
||||||
download_batch_size=25, convert_gif=False, gif_resolution='original'):
|
download_batch_size=25, convert_gif=False, gif_resolution='original', gif_conversion_mode='better'):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.accounts = accounts
|
self.accounts = accounts
|
||||||
self.outpath = outpath
|
self.outpath = outpath
|
||||||
@@ -93,6 +93,7 @@ class DownloadWorker(QThread):
|
|||||||
self.download_batch_size = download_batch_size
|
self.download_batch_size = download_batch_size
|
||||||
self.convert_gif = convert_gif
|
self.convert_gif = convert_gif
|
||||||
self.gif_resolution = gif_resolution
|
self.gif_resolution = gif_resolution
|
||||||
|
self.gif_conversion_mode = gif_conversion_mode
|
||||||
self.is_paused = False
|
self.is_paused = False
|
||||||
self.is_stopped = False
|
self.is_stopped = False
|
||||||
self.filepath_map = []
|
self.filepath_map = []
|
||||||
@@ -256,19 +257,24 @@ class DownloadWorker(QThread):
|
|||||||
os.remove(fp)
|
os.remove(fp)
|
||||||
skipped_count += 1
|
skipped_count += 1
|
||||||
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}) - Skipped (exists)", conv_progress)
|
quality_display = f"({self.gif_conversion_mode}) - ({self.gif_resolution})"
|
||||||
|
self.conversion_progress.emit(f"Converting GIF {idx:,}/{total_gifs:,} {quality_display} - Skipped (exists)", conv_progress)
|
||||||
continue
|
continue
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if self.gif_resolution == 'high':
|
|
||||||
ffmpeg_args = [ffmpeg_exe, '-i', fp, '-lavfi', 'scale=800:-1:flags=lanczos,palettegen=stats_mode=full[palette];[0:v]scale=800:-1:flags=lanczos[scaled];[scaled][palette]paletteuse=dither=sierra2_4a', '-r', '15', '-y', gif_fp]
|
if self.gif_conversion_mode == 'fast':
|
||||||
elif self.gif_resolution == 'medium':
|
ffmpeg_args = [ffmpeg_exe, '-i', fp, '-y', gif_fp]
|
||||||
ffmpeg_args = [ffmpeg_exe, '-i', fp, '-lavfi', 'scale=600:-1:flags=lanczos,palettegen=stats_mode=full[palette];[0:v]scale=600:-1:flags=lanczos[scaled];[scaled][palette]paletteuse=dither=sierra2_4a', '-r', '10', '-y', gif_fp]
|
|
||||||
elif self.gif_resolution == 'low':
|
|
||||||
ffmpeg_args = [ffmpeg_exe, '-i', fp, '-lavfi', 'scale=400:-1:flags=lanczos,palettegen=stats_mode=full[palette];[0:v]scale=400:-1:flags=lanczos[scaled];[scaled][palette]paletteuse=dither=sierra2_4a', '-r', '8', '-y', gif_fp]
|
|
||||||
else:
|
else:
|
||||||
ffmpeg_args = [ffmpeg_exe, '-i', fp, '-lavfi', 'palettegen=stats_mode=full[palette];[0:v][palette]paletteuse=dither=sierra2_4a', '-y', gif_fp]
|
if self.gif_resolution == 'high':
|
||||||
|
ffmpeg_args = [ffmpeg_exe, '-i', fp, '-lavfi', 'scale=800:-1:flags=lanczos,palettegen=stats_mode=full[palette];[0:v]scale=800:-1:flags=lanczos[scaled];[scaled][palette]paletteuse=dither=sierra2_4a', '-r', '15', '-y', gif_fp]
|
||||||
|
elif self.gif_resolution == 'medium':
|
||||||
|
ffmpeg_args = [ffmpeg_exe, '-i', fp, '-lavfi', 'scale=600:-1:flags=lanczos,palettegen=stats_mode=full[palette];[0:v]scale=600:-1:flags=lanczos[scaled];[scaled][palette]paletteuse=dither=sierra2_4a', '-r', '10', '-y', gif_fp]
|
||||||
|
elif self.gif_resolution == 'low':
|
||||||
|
ffmpeg_args = [ffmpeg_exe, '-i', fp, '-lavfi', 'scale=400:-1:flags=lanczos,palettegen=stats_mode=full[palette];[0:v]scale=400:-1:flags=lanczos[scaled];[scaled][palette]paletteuse=dither=sierra2_4a', '-r', '8', '-y', gif_fp]
|
||||||
|
else:
|
||||||
|
ffmpeg_args = [ffmpeg_exe, '-i', fp, '-lavfi', 'palettegen=stats_mode=full[palette];[0:v][palette]paletteuse=dither=sierra2_4a', '-y', gif_fp]
|
||||||
|
|
||||||
result = subprocess.run(ffmpeg_args, capture_output=True, creationflags=creationflags)
|
result = subprocess.run(ffmpeg_args, capture_output=True, creationflags=creationflags)
|
||||||
if result.returncode == 0 and os.path.exists(gif_fp):
|
if result.returncode == 0 and os.path.exists(gif_fp):
|
||||||
@@ -281,7 +287,8 @@ class DownloadWorker(QThread):
|
|||||||
pass
|
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)
|
quality_display = f"({self.gif_conversion_mode}) - ({self.gif_resolution})"
|
||||||
|
self.conversion_progress.emit(f"Converting GIF {idx:,}/{total_gifs:,} {quality_display}", conv_progress)
|
||||||
if converted_count > 0 or skipped_count > 0:
|
if converted_count > 0 or skipped_count > 0:
|
||||||
completion_msg = f"GIF conversion completed: {converted_count:,} converted"
|
completion_msg = f"GIF conversion completed: {converted_count:,} converted"
|
||||||
if skipped_count > 0:
|
if skipped_count > 0:
|
||||||
@@ -344,7 +351,7 @@ class UpdateDialog(QDialog):
|
|||||||
class TwitterMediaDownloaderGUI(QWidget):
|
class TwitterMediaDownloaderGUI(QWidget):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.current_version = "3.5"
|
self.current_version = "3.6"
|
||||||
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)
|
||||||
@@ -362,6 +369,8 @@ class TwitterMediaDownloaderGUI(QWidget):
|
|||||||
self.media_type = self.settings.value('media_type', 'all')
|
self.media_type = self.settings.value('media_type', 'all')
|
||||||
self.convert_gif = self.settings.value('convert_gif', False, type=bool)
|
self.convert_gif = self.settings.value('convert_gif', False, type=bool)
|
||||||
self.gif_resolution = self.settings.value('gif_resolution', 'original')
|
self.gif_resolution = self.settings.value('gif_resolution', 'original')
|
||||||
|
self.gif_conversion_mode = self.settings.value('gif_conversion_mode', 'better')
|
||||||
|
self.gif_conversion_quality = self.settings.value('gif_conversion_quality', 'original')
|
||||||
self.check_for_updates = self.settings.value('check_for_updates', True, type=bool)
|
self.check_for_updates = self.settings.value('check_for_updates', True, type=bool)
|
||||||
|
|
||||||
self.is_auto_fetching = False
|
self.is_auto_fetching = False
|
||||||
@@ -710,6 +719,37 @@ class TwitterMediaDownloaderGUI(QWidget):
|
|||||||
first_row_layout = QHBoxLayout()
|
first_row_layout = QHBoxLayout()
|
||||||
first_row_layout.setSpacing(5)
|
first_row_layout.setSpacing(5)
|
||||||
|
|
||||||
|
timeline_label = QLabel("Timeline:")
|
||||||
|
self.timeline_type_combo = QComboBox()
|
||||||
|
self.timeline_type_combo.setCursor(Qt.CursorShape.PointingHandCursor)
|
||||||
|
self.timeline_type_combo.setFixedWidth(75)
|
||||||
|
timeline_types = [
|
||||||
|
('media', 'Media'),
|
||||||
|
('timeline', 'Post'),
|
||||||
|
('tweets', 'Tweets'),
|
||||||
|
('with_replies', 'Replies')
|
||||||
|
]
|
||||||
|
for value, display in timeline_types:
|
||||||
|
self.timeline_type_combo.addItem(display, value)
|
||||||
|
self.timeline_type_combo.currentTextChanged.connect(self.save_settings)
|
||||||
|
first_row_layout.addWidget(timeline_label)
|
||||||
|
first_row_layout.addWidget(self.timeline_type_combo)
|
||||||
|
|
||||||
|
first_row_layout.addSpacing(5)
|
||||||
|
|
||||||
|
media_label = QLabel("Media:")
|
||||||
|
self.media_type_combo = QComboBox()
|
||||||
|
self.media_type_combo.setCursor(Qt.CursorShape.PointingHandCursor)
|
||||||
|
self.media_type_combo.setFixedWidth(85)
|
||||||
|
media_types = [('all', 'All'), ('image', 'Image'), ('video', 'Video'), ('gif', 'GIF')]
|
||||||
|
for value, display in media_types:
|
||||||
|
self.media_type_combo.addItem(display, value)
|
||||||
|
self.media_type_combo.currentTextChanged.connect(self.save_settings)
|
||||||
|
first_row_layout.addWidget(media_label)
|
||||||
|
first_row_layout.addWidget(self.media_type_combo)
|
||||||
|
|
||||||
|
first_row_layout.addSpacing(5)
|
||||||
|
|
||||||
self.batch_checkbox = QCheckBox("Fetch 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")
|
||||||
@@ -731,52 +771,41 @@ class TwitterMediaDownloaderGUI(QWidget):
|
|||||||
self.size_label.hide()
|
self.size_label.hide()
|
||||||
self.batch_size_combo.hide()
|
self.batch_size_combo.hide()
|
||||||
|
|
||||||
first_row_layout.addSpacing(5)
|
|
||||||
|
|
||||||
timeline_label = QLabel("Timeline Type:")
|
|
||||||
self.timeline_type_combo = QComboBox()
|
|
||||||
self.timeline_type_combo.setCursor(Qt.CursorShape.PointingHandCursor)
|
|
||||||
self.timeline_type_combo.setFixedWidth(75)
|
|
||||||
timeline_types = [
|
|
||||||
('media', 'Media'),
|
|
||||||
('timeline', 'Post'),
|
|
||||||
('tweets', 'Tweets'),
|
|
||||||
('with_replies', 'Replies')
|
|
||||||
]
|
|
||||||
for value, display in timeline_types:
|
|
||||||
self.timeline_type_combo.addItem(display, value)
|
|
||||||
self.timeline_type_combo.currentTextChanged.connect(self.save_settings)
|
|
||||||
first_row_layout.addWidget(timeline_label)
|
|
||||||
first_row_layout.addWidget(self.timeline_type_combo)
|
|
||||||
|
|
||||||
first_row_layout.addSpacing(5)
|
|
||||||
|
|
||||||
media_type_label = QLabel("Media Type:")
|
|
||||||
self.media_type_combo = QComboBox()
|
|
||||||
self.media_type_combo.setCursor(Qt.CursorShape.PointingHandCursor)
|
|
||||||
self.media_type_combo.setFixedWidth(85)
|
|
||||||
media_types = [('all', 'All'), ('image', 'Image'), ('video', 'Video'), ('gif', 'GIF')]
|
|
||||||
for value, display in media_types:
|
|
||||||
self.media_type_combo.addItem(display, value)
|
|
||||||
self.media_type_combo.currentTextChanged.connect(self.save_settings)
|
|
||||||
first_row_layout.addWidget(media_type_label)
|
|
||||||
first_row_layout.addWidget(self.media_type_combo)
|
|
||||||
|
|
||||||
first_row_layout.addStretch()
|
first_row_layout.addStretch()
|
||||||
gallery_dl_layout.addLayout(first_row_layout)
|
gallery_dl_layout.addLayout(first_row_layout)
|
||||||
|
|
||||||
settings_layout.addWidget(gallery_dl_group)
|
settings_layout.addWidget(gallery_dl_group)
|
||||||
|
|
||||||
download_group = QWidget()
|
download_conversion_group = QWidget()
|
||||||
download_layout = QVBoxLayout(download_group)
|
download_conversion_layout = QVBoxLayout(download_conversion_group)
|
||||||
download_layout.setSpacing(5)
|
download_conversion_layout.setSpacing(5)
|
||||||
|
|
||||||
|
labels_layout = QHBoxLayout()
|
||||||
|
|
||||||
|
download_label_container = QWidget()
|
||||||
|
download_label_layout = QHBoxLayout(download_label_container)
|
||||||
|
download_label_layout.setContentsMargins(0, 0, 0, 0)
|
||||||
download_label = QLabel('Download Settings')
|
download_label = QLabel('Download Settings')
|
||||||
download_label.setStyleSheet("font-weight: bold;")
|
download_label.setStyleSheet("font-weight: bold;")
|
||||||
download_layout.addWidget(download_label)
|
download_label_layout.addWidget(download_label)
|
||||||
|
download_label_layout.addStretch()
|
||||||
|
download_label_container.setFixedWidth(180)
|
||||||
|
labels_layout.addWidget(download_label_container)
|
||||||
|
|
||||||
batch_layout = QHBoxLayout()
|
conversion_label = QLabel('Conversion Settings')
|
||||||
batch_label = QLabel('Concurrent Downloads:')
|
conversion_label.setStyleSheet("font-weight: bold;")
|
||||||
|
labels_layout.addWidget(conversion_label)
|
||||||
|
labels_layout.addStretch()
|
||||||
|
download_conversion_layout.addLayout(labels_layout)
|
||||||
|
|
||||||
|
controls_layout = QHBoxLayout()
|
||||||
|
|
||||||
|
download_controls_container = QWidget()
|
||||||
|
download_controls_layout = QHBoxLayout(download_controls_container)
|
||||||
|
download_controls_layout.setContentsMargins(0, 0, 0, 0)
|
||||||
|
|
||||||
|
batch_label = QLabel('Concurrents:')
|
||||||
|
download_controls_layout.addWidget(batch_label)
|
||||||
|
|
||||||
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)
|
||||||
@@ -785,40 +814,62 @@ class TwitterMediaDownloaderGUI(QWidget):
|
|||||||
self.download_batch_combo.addItem(str(size))
|
self.download_batch_combo.addItem(str(size))
|
||||||
self.download_batch_combo.setCurrentText(str(self.download_batch_size))
|
self.download_batch_combo.setCurrentText(str(self.download_batch_size))
|
||||||
self.download_batch_combo.currentTextChanged.connect(self.save_settings)
|
self.download_batch_combo.currentTextChanged.connect(self.save_settings)
|
||||||
|
download_controls_layout.addWidget(self.download_batch_combo)
|
||||||
|
download_controls_layout.addStretch()
|
||||||
|
|
||||||
|
download_controls_container.setFixedWidth(180)
|
||||||
|
controls_layout.addWidget(download_controls_container)
|
||||||
|
|
||||||
self.convert_gif_checkbox = QCheckBox("Convert GIF")
|
self.convert_gif_checkbox = QCheckBox("Convert GIF")
|
||||||
self.convert_gif_checkbox.setCursor(Qt.CursorShape.PointingHandCursor)
|
self.convert_gif_checkbox.setCursor(Qt.CursorShape.PointingHandCursor)
|
||||||
self.convert_gif_checkbox.setChecked(self.convert_gif)
|
self.convert_gif_checkbox.setChecked(self.convert_gif)
|
||||||
self.convert_gif_checkbox.toggled.connect(self.handle_gif_checkbox)
|
self.convert_gif_checkbox.toggled.connect(self.handle_conversion_checkbox)
|
||||||
|
controls_layout.addWidget(self.convert_gif_checkbox)
|
||||||
|
|
||||||
batch_layout.addWidget(batch_label)
|
controls_layout.addSpacing(5)
|
||||||
batch_layout.addWidget(self.download_batch_combo)
|
|
||||||
batch_layout.addWidget(self.convert_gif_checkbox)
|
|
||||||
|
|
||||||
self.gif_resolution_label = QLabel("Converted GIF Quality:")
|
mode_label = QLabel("Mode:")
|
||||||
self.gif_resolution_combo = QComboBox()
|
self.conversion_mode_combo = QComboBox()
|
||||||
self.gif_resolution_combo.setCursor(Qt.CursorShape.PointingHandCursor)
|
self.conversion_mode_combo.setCursor(Qt.CursorShape.PointingHandCursor)
|
||||||
self.gif_resolution_combo.setFixedWidth(85)
|
self.conversion_mode_combo.setFixedWidth(80)
|
||||||
gif_resolutions = [
|
conversion_modes = [('better', 'Better'), ('fast', 'Fast')]
|
||||||
|
for value, display in conversion_modes:
|
||||||
|
self.conversion_mode_combo.addItem(display, value)
|
||||||
|
self.conversion_mode_combo.currentTextChanged.connect(self.save_settings)
|
||||||
|
controls_layout.addWidget(mode_label)
|
||||||
|
controls_layout.addWidget(self.conversion_mode_combo)
|
||||||
|
|
||||||
|
controls_layout.addSpacing(5)
|
||||||
|
|
||||||
|
quality_label = QLabel("Quality:")
|
||||||
|
self.conversion_quality_combo = QComboBox()
|
||||||
|
self.conversion_quality_combo.setCursor(Qt.CursorShape.PointingHandCursor)
|
||||||
|
self.conversion_quality_combo.setFixedWidth(85)
|
||||||
|
gif_qualities = [
|
||||||
('original', 'Original'),
|
('original', 'Original'),
|
||||||
('high', 'High'),
|
('high', 'High'),
|
||||||
('medium', 'Medium'),
|
('medium', 'Medium'),
|
||||||
('low', 'Low')
|
('low', 'Low')
|
||||||
]
|
]
|
||||||
for value, display in gif_resolutions:
|
for value, display in gif_qualities:
|
||||||
self.gif_resolution_combo.addItem(display, value)
|
self.conversion_quality_combo.addItem(display, value)
|
||||||
self.gif_resolution_combo.currentTextChanged.connect(self.save_settings)
|
self.conversion_quality_combo.currentTextChanged.connect(self.save_settings)
|
||||||
batch_layout.addWidget(self.gif_resolution_label)
|
controls_layout.addWidget(quality_label)
|
||||||
batch_layout.addWidget(self.gif_resolution_combo)
|
controls_layout.addWidget(self.conversion_quality_combo)
|
||||||
|
|
||||||
|
self.mode_label = mode_label
|
||||||
|
self.quality_label = quality_label
|
||||||
|
|
||||||
if not self.convert_gif:
|
if not self.convert_gif:
|
||||||
self.gif_resolution_label.hide()
|
mode_label.hide()
|
||||||
self.gif_resolution_combo.hide()
|
self.conversion_mode_combo.hide()
|
||||||
|
quality_label.hide()
|
||||||
|
self.conversion_quality_combo.hide()
|
||||||
|
|
||||||
batch_layout.addStretch()
|
controls_layout.addStretch()
|
||||||
download_layout.addLayout(batch_layout)
|
download_conversion_layout.addLayout(controls_layout)
|
||||||
|
|
||||||
settings_layout.addWidget(download_group)
|
settings_layout.addWidget(download_conversion_group)
|
||||||
settings_layout.addStretch()
|
settings_layout.addStretch()
|
||||||
|
|
||||||
settings_tab.setLayout(settings_layout)
|
settings_tab.setLayout(settings_layout)
|
||||||
@@ -880,9 +931,13 @@ class TwitterMediaDownloaderGUI(QWidget):
|
|||||||
self.settings.setValue('convert_gif', self.convert_gif_checkbox.isChecked())
|
self.settings.setValue('convert_gif', self.convert_gif_checkbox.isChecked())
|
||||||
self.convert_gif = self.convert_gif_checkbox.isChecked()
|
self.convert_gif = self.convert_gif_checkbox.isChecked()
|
||||||
|
|
||||||
if hasattr(self, 'gif_resolution_combo'):
|
if hasattr(self, 'conversion_mode_combo'):
|
||||||
self.settings.setValue('gif_resolution', self.gif_resolution_combo.currentData())
|
self.settings.setValue('gif_conversion_mode', self.conversion_mode_combo.currentData())
|
||||||
self.gif_resolution = self.gif_resolution_combo.currentData()
|
self.gif_conversion_mode = self.conversion_mode_combo.currentData()
|
||||||
|
|
||||||
|
if hasattr(self, 'conversion_quality_combo'):
|
||||||
|
self.settings.setValue('gif_conversion_quality', self.conversion_quality_combo.currentData())
|
||||||
|
self.gif_conversion_quality = self.conversion_quality_combo.currentData()
|
||||||
|
|
||||||
self.settings.sync()
|
self.settings.sync()
|
||||||
|
|
||||||
@@ -932,17 +987,36 @@ class TwitterMediaDownloaderGUI(QWidget):
|
|||||||
self.convert_gif_checkbox.blockSignals(False)
|
self.convert_gif_checkbox.blockSignals(False)
|
||||||
|
|
||||||
if convert_gif:
|
if convert_gif:
|
||||||
self.gif_resolution_label.show()
|
if hasattr(self, 'mode_label'):
|
||||||
self.gif_resolution_combo.show()
|
self.mode_label.show()
|
||||||
|
if hasattr(self, 'conversion_mode_combo'):
|
||||||
|
self.conversion_mode_combo.show()
|
||||||
|
if hasattr(self, 'quality_label'):
|
||||||
|
self.quality_label.show()
|
||||||
|
if hasattr(self, 'conversion_quality_combo'):
|
||||||
|
self.conversion_quality_combo.show()
|
||||||
else:
|
else:
|
||||||
self.gif_resolution_label.hide()
|
if hasattr(self, 'mode_label'):
|
||||||
self.gif_resolution_combo.hide()
|
self.mode_label.hide()
|
||||||
|
if hasattr(self, 'conversion_mode_combo'):
|
||||||
|
self.conversion_mode_combo.hide()
|
||||||
|
if hasattr(self, 'quality_label'):
|
||||||
|
self.quality_label.hide()
|
||||||
|
if hasattr(self, 'conversion_quality_combo'):
|
||||||
|
self.conversion_quality_combo.hide()
|
||||||
|
|
||||||
gif_resolution = self.settings.value('gif_resolution', 'original')
|
gif_conversion_mode = self.settings.value('gif_conversion_mode', 'better')
|
||||||
if hasattr(self, 'gif_resolution_combo'):
|
if hasattr(self, 'conversion_mode_combo'):
|
||||||
for i in range(self.gif_resolution_combo.count()):
|
for i in range(self.conversion_mode_combo.count()):
|
||||||
if self.gif_resolution_combo.itemData(i) == gif_resolution:
|
if self.conversion_mode_combo.itemData(i) == gif_conversion_mode:
|
||||||
self.gif_resolution_combo.setCurrentIndex(i)
|
self.conversion_mode_combo.setCurrentIndex(i)
|
||||||
|
break
|
||||||
|
|
||||||
|
gif_conversion_quality = self.settings.value('gif_conversion_quality', 'original')
|
||||||
|
if hasattr(self, 'conversion_quality_combo'):
|
||||||
|
for i in range(self.conversion_quality_combo.count()):
|
||||||
|
if self.conversion_quality_combo.itemData(i) == gif_conversion_quality:
|
||||||
|
self.conversion_quality_combo.setCurrentIndex(i)
|
||||||
break
|
break
|
||||||
|
|
||||||
last_username_url = self.settings.value('twitter_url', '')
|
last_username_url = self.settings.value('twitter_url', '')
|
||||||
@@ -969,16 +1043,28 @@ class TwitterMediaDownloaderGUI(QWidget):
|
|||||||
self.fetch_btn.setText('Fetch')
|
self.fetch_btn.setText('Fetch')
|
||||||
self.update_button_states()
|
self.update_button_states()
|
||||||
|
|
||||||
def handle_gif_checkbox(self, checked):
|
def handle_conversion_checkbox(self, checked):
|
||||||
self.convert_gif = checked
|
self.convert_gif = checked
|
||||||
self.save_settings()
|
self.save_settings()
|
||||||
|
|
||||||
if checked:
|
if checked:
|
||||||
self.gif_resolution_label.show()
|
if hasattr(self, 'mode_label'):
|
||||||
self.gif_resolution_combo.show()
|
self.mode_label.show()
|
||||||
|
if hasattr(self, 'conversion_mode_combo'):
|
||||||
|
self.conversion_mode_combo.show()
|
||||||
|
if hasattr(self, 'quality_label'):
|
||||||
|
self.quality_label.show()
|
||||||
|
if hasattr(self, 'conversion_quality_combo'):
|
||||||
|
self.conversion_quality_combo.show()
|
||||||
else:
|
else:
|
||||||
self.gif_resolution_label.hide()
|
if hasattr(self, 'mode_label'):
|
||||||
self.gif_resolution_combo.hide()
|
self.mode_label.hide()
|
||||||
|
if hasattr(self, 'conversion_mode_combo'):
|
||||||
|
self.conversion_mode_combo.hide()
|
||||||
|
if hasattr(self, 'quality_label'):
|
||||||
|
self.quality_label.hide()
|
||||||
|
if hasattr(self, 'conversion_quality_combo'):
|
||||||
|
self.conversion_quality_combo.hide()
|
||||||
|
|
||||||
def browse_output(self):
|
def browse_output(self):
|
||||||
directory = QFileDialog.getExistingDirectory(self, "Select Output Directory")
|
directory = QFileDialog.getExistingDirectory(self, "Select Output Directory")
|
||||||
@@ -1988,7 +2074,8 @@ class TwitterMediaDownloaderGUI(QWidget):
|
|||||||
self.filename_format,
|
self.filename_format,
|
||||||
self.download_batch_size,
|
self.download_batch_size,
|
||||||
self.convert_gif,
|
self.convert_gif,
|
||||||
self.gif_resolution
|
self.gif_conversion_quality,
|
||||||
|
self.gif_conversion_mode
|
||||||
)
|
)
|
||||||
self.worker.finished.connect(self.on_download_finished)
|
self.worker.finished.connect(self.on_download_finished)
|
||||||
self.worker.progress.connect(self.update_progress)
|
self.worker.progress.connect(self.update_progress)
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ class DownloadWorker(QThread):
|
|||||||
download_progress = pyqtSignal(str, int)
|
download_progress = pyqtSignal(str, int)
|
||||||
|
|
||||||
def __init__(self, accounts, outpath, auth_token, filename_format='username_date',
|
def __init__(self, accounts, outpath, auth_token, filename_format='username_date',
|
||||||
download_batch_size=25, convert_gif=False, gif_resolution='original'):
|
download_batch_size=25, convert_gif=False, gif_resolution='original', gif_conversion_mode='better'):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.accounts = accounts
|
self.accounts = accounts
|
||||||
self.outpath = outpath
|
self.outpath = outpath
|
||||||
@@ -93,6 +93,7 @@ class DownloadWorker(QThread):
|
|||||||
self.download_batch_size = download_batch_size
|
self.download_batch_size = download_batch_size
|
||||||
self.convert_gif = convert_gif
|
self.convert_gif = convert_gif
|
||||||
self.gif_resolution = gif_resolution
|
self.gif_resolution = gif_resolution
|
||||||
|
self.gif_conversion_mode = gif_conversion_mode
|
||||||
self.is_paused = False
|
self.is_paused = False
|
||||||
self.is_stopped = False
|
self.is_stopped = False
|
||||||
self.filepath_map = []
|
self.filepath_map = []
|
||||||
@@ -256,19 +257,24 @@ class DownloadWorker(QThread):
|
|||||||
os.remove(fp)
|
os.remove(fp)
|
||||||
skipped_count += 1
|
skipped_count += 1
|
||||||
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}) - Skipped (exists)", conv_progress)
|
quality_display = f"({self.gif_conversion_mode}) - ({self.gif_resolution})"
|
||||||
|
self.conversion_progress.emit(f"Converting GIF {idx:,}/{total_gifs:,} {quality_display} - Skipped (exists)", conv_progress)
|
||||||
continue
|
continue
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if self.gif_resolution == 'high':
|
|
||||||
ffmpeg_args = [ffmpeg_exe, '-i', fp, '-lavfi', 'scale=800:-1:flags=lanczos,palettegen=stats_mode=full[palette];[0:v]scale=800:-1:flags=lanczos[scaled];[scaled][palette]paletteuse=dither=sierra2_4a', '-r', '15', '-y', gif_fp]
|
if self.gif_conversion_mode == 'fast':
|
||||||
elif self.gif_resolution == 'medium':
|
ffmpeg_args = [ffmpeg_exe, '-i', fp, '-y', gif_fp]
|
||||||
ffmpeg_args = [ffmpeg_exe, '-i', fp, '-lavfi', 'scale=600:-1:flags=lanczos,palettegen=stats_mode=full[palette];[0:v]scale=600:-1:flags=lanczos[scaled];[scaled][palette]paletteuse=dither=sierra2_4a', '-r', '10', '-y', gif_fp]
|
|
||||||
elif self.gif_resolution == 'low':
|
|
||||||
ffmpeg_args = [ffmpeg_exe, '-i', fp, '-lavfi', 'scale=400:-1:flags=lanczos,palettegen=stats_mode=full[palette];[0:v]scale=400:-1:flags=lanczos[scaled];[scaled][palette]paletteuse=dither=sierra2_4a', '-r', '8', '-y', gif_fp]
|
|
||||||
else:
|
else:
|
||||||
ffmpeg_args = [ffmpeg_exe, '-i', fp, '-lavfi', 'palettegen=stats_mode=full[palette];[0:v][palette]paletteuse=dither=sierra2_4a', '-y', gif_fp]
|
if self.gif_resolution == 'high':
|
||||||
|
ffmpeg_args = [ffmpeg_exe, '-i', fp, '-lavfi', 'scale=800:-1:flags=lanczos,palettegen=stats_mode=full[palette];[0:v]scale=800:-1:flags=lanczos[scaled];[scaled][palette]paletteuse=dither=sierra2_4a', '-r', '15', '-y', gif_fp]
|
||||||
|
elif self.gif_resolution == 'medium':
|
||||||
|
ffmpeg_args = [ffmpeg_exe, '-i', fp, '-lavfi', 'scale=600:-1:flags=lanczos,palettegen=stats_mode=full[palette];[0:v]scale=600:-1:flags=lanczos[scaled];[scaled][palette]paletteuse=dither=sierra2_4a', '-r', '10', '-y', gif_fp]
|
||||||
|
elif self.gif_resolution == 'low':
|
||||||
|
ffmpeg_args = [ffmpeg_exe, '-i', fp, '-lavfi', 'scale=400:-1:flags=lanczos,palettegen=stats_mode=full[palette];[0:v]scale=400:-1:flags=lanczos[scaled];[scaled][palette]paletteuse=dither=sierra2_4a', '-r', '8', '-y', gif_fp]
|
||||||
|
else:
|
||||||
|
ffmpeg_args = [ffmpeg_exe, '-i', fp, '-lavfi', 'palettegen=stats_mode=full[palette];[0:v][palette]paletteuse=dither=sierra2_4a', '-y', gif_fp]
|
||||||
|
|
||||||
result = subprocess.run(ffmpeg_args, capture_output=True, creationflags=creationflags)
|
result = subprocess.run(ffmpeg_args, capture_output=True, creationflags=creationflags)
|
||||||
if result.returncode == 0 and os.path.exists(gif_fp):
|
if result.returncode == 0 and os.path.exists(gif_fp):
|
||||||
@@ -281,7 +287,8 @@ class DownloadWorker(QThread):
|
|||||||
pass
|
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)
|
quality_display = f"({self.gif_conversion_mode}) - ({self.gif_resolution})"
|
||||||
|
self.conversion_progress.emit(f"Converting GIF {idx:,}/{total_gifs:,} {quality_display}", conv_progress)
|
||||||
if converted_count > 0 or skipped_count > 0:
|
if converted_count > 0 or skipped_count > 0:
|
||||||
completion_msg = f"GIF conversion completed: {converted_count:,} converted"
|
completion_msg = f"GIF conversion completed: {converted_count:,} converted"
|
||||||
if skipped_count > 0:
|
if skipped_count > 0:
|
||||||
@@ -344,7 +351,7 @@ class UpdateDialog(QDialog):
|
|||||||
class TwitterMediaDownloaderGUI(QWidget):
|
class TwitterMediaDownloaderGUI(QWidget):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.current_version = "3.5"
|
self.current_version = "3.6"
|
||||||
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)
|
||||||
@@ -362,6 +369,8 @@ class TwitterMediaDownloaderGUI(QWidget):
|
|||||||
self.media_type = self.settings.value('media_type', 'all')
|
self.media_type = self.settings.value('media_type', 'all')
|
||||||
self.convert_gif = self.settings.value('convert_gif', False, type=bool)
|
self.convert_gif = self.settings.value('convert_gif', False, type=bool)
|
||||||
self.gif_resolution = self.settings.value('gif_resolution', 'original')
|
self.gif_resolution = self.settings.value('gif_resolution', 'original')
|
||||||
|
self.gif_conversion_mode = self.settings.value('gif_conversion_mode', 'better')
|
||||||
|
self.gif_conversion_quality = self.settings.value('gif_conversion_quality', 'original')
|
||||||
self.check_for_updates = self.settings.value('check_for_updates', True, type=bool)
|
self.check_for_updates = self.settings.value('check_for_updates', True, type=bool)
|
||||||
|
|
||||||
self.is_auto_fetching = False
|
self.is_auto_fetching = False
|
||||||
@@ -710,6 +719,37 @@ class TwitterMediaDownloaderGUI(QWidget):
|
|||||||
first_row_layout = QHBoxLayout()
|
first_row_layout = QHBoxLayout()
|
||||||
first_row_layout.setSpacing(5)
|
first_row_layout.setSpacing(5)
|
||||||
|
|
||||||
|
timeline_label = QLabel("Timeline:")
|
||||||
|
self.timeline_type_combo = QComboBox()
|
||||||
|
self.timeline_type_combo.setCursor(Qt.CursorShape.PointingHandCursor)
|
||||||
|
self.timeline_type_combo.setFixedWidth(75)
|
||||||
|
timeline_types = [
|
||||||
|
('media', 'Media'),
|
||||||
|
('timeline', 'Post'),
|
||||||
|
('tweets', 'Tweets'),
|
||||||
|
('with_replies', 'Replies')
|
||||||
|
]
|
||||||
|
for value, display in timeline_types:
|
||||||
|
self.timeline_type_combo.addItem(display, value)
|
||||||
|
self.timeline_type_combo.currentTextChanged.connect(self.save_settings)
|
||||||
|
first_row_layout.addWidget(timeline_label)
|
||||||
|
first_row_layout.addWidget(self.timeline_type_combo)
|
||||||
|
|
||||||
|
first_row_layout.addSpacing(5)
|
||||||
|
|
||||||
|
media_label = QLabel("Media:")
|
||||||
|
self.media_type_combo = QComboBox()
|
||||||
|
self.media_type_combo.setCursor(Qt.CursorShape.PointingHandCursor)
|
||||||
|
self.media_type_combo.setFixedWidth(85)
|
||||||
|
media_types = [('all', 'All'), ('image', 'Image'), ('video', 'Video'), ('gif', 'GIF')]
|
||||||
|
for value, display in media_types:
|
||||||
|
self.media_type_combo.addItem(display, value)
|
||||||
|
self.media_type_combo.currentTextChanged.connect(self.save_settings)
|
||||||
|
first_row_layout.addWidget(media_label)
|
||||||
|
first_row_layout.addWidget(self.media_type_combo)
|
||||||
|
|
||||||
|
first_row_layout.addSpacing(5)
|
||||||
|
|
||||||
self.batch_checkbox = QCheckBox("Fetch 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")
|
||||||
@@ -731,52 +771,41 @@ class TwitterMediaDownloaderGUI(QWidget):
|
|||||||
self.size_label.hide()
|
self.size_label.hide()
|
||||||
self.batch_size_combo.hide()
|
self.batch_size_combo.hide()
|
||||||
|
|
||||||
first_row_layout.addSpacing(5)
|
|
||||||
|
|
||||||
timeline_label = QLabel("Timeline Type:")
|
|
||||||
self.timeline_type_combo = QComboBox()
|
|
||||||
self.timeline_type_combo.setCursor(Qt.CursorShape.PointingHandCursor)
|
|
||||||
self.timeline_type_combo.setFixedWidth(75)
|
|
||||||
timeline_types = [
|
|
||||||
('media', 'Media'),
|
|
||||||
('timeline', 'Post'),
|
|
||||||
('tweets', 'Tweets'),
|
|
||||||
('with_replies', 'Replies')
|
|
||||||
]
|
|
||||||
for value, display in timeline_types:
|
|
||||||
self.timeline_type_combo.addItem(display, value)
|
|
||||||
self.timeline_type_combo.currentTextChanged.connect(self.save_settings)
|
|
||||||
first_row_layout.addWidget(timeline_label)
|
|
||||||
first_row_layout.addWidget(self.timeline_type_combo)
|
|
||||||
|
|
||||||
first_row_layout.addSpacing(5)
|
|
||||||
|
|
||||||
media_type_label = QLabel("Media Type:")
|
|
||||||
self.media_type_combo = QComboBox()
|
|
||||||
self.media_type_combo.setCursor(Qt.CursorShape.PointingHandCursor)
|
|
||||||
self.media_type_combo.setFixedWidth(85)
|
|
||||||
media_types = [('all', 'All'), ('image', 'Image'), ('video', 'Video'), ('gif', 'GIF')]
|
|
||||||
for value, display in media_types:
|
|
||||||
self.media_type_combo.addItem(display, value)
|
|
||||||
self.media_type_combo.currentTextChanged.connect(self.save_settings)
|
|
||||||
first_row_layout.addWidget(media_type_label)
|
|
||||||
first_row_layout.addWidget(self.media_type_combo)
|
|
||||||
|
|
||||||
first_row_layout.addStretch()
|
first_row_layout.addStretch()
|
||||||
gallery_dl_layout.addLayout(first_row_layout)
|
gallery_dl_layout.addLayout(first_row_layout)
|
||||||
|
|
||||||
settings_layout.addWidget(gallery_dl_group)
|
settings_layout.addWidget(gallery_dl_group)
|
||||||
|
|
||||||
download_group = QWidget()
|
download_conversion_group = QWidget()
|
||||||
download_layout = QVBoxLayout(download_group)
|
download_conversion_layout = QVBoxLayout(download_conversion_group)
|
||||||
download_layout.setSpacing(5)
|
download_conversion_layout.setSpacing(5)
|
||||||
|
|
||||||
|
labels_layout = QHBoxLayout()
|
||||||
|
|
||||||
|
download_label_container = QWidget()
|
||||||
|
download_label_layout = QHBoxLayout(download_label_container)
|
||||||
|
download_label_layout.setContentsMargins(0, 0, 0, 0)
|
||||||
download_label = QLabel('Download Settings')
|
download_label = QLabel('Download Settings')
|
||||||
download_label.setStyleSheet("font-weight: bold;")
|
download_label.setStyleSheet("font-weight: bold;")
|
||||||
download_layout.addWidget(download_label)
|
download_label_layout.addWidget(download_label)
|
||||||
|
download_label_layout.addStretch()
|
||||||
|
download_label_container.setFixedWidth(180)
|
||||||
|
labels_layout.addWidget(download_label_container)
|
||||||
|
|
||||||
batch_layout = QHBoxLayout()
|
conversion_label = QLabel('Conversion Settings')
|
||||||
batch_label = QLabel('Concurrent Downloads:')
|
conversion_label.setStyleSheet("font-weight: bold;")
|
||||||
|
labels_layout.addWidget(conversion_label)
|
||||||
|
labels_layout.addStretch()
|
||||||
|
download_conversion_layout.addLayout(labels_layout)
|
||||||
|
|
||||||
|
controls_layout = QHBoxLayout()
|
||||||
|
|
||||||
|
download_controls_container = QWidget()
|
||||||
|
download_controls_layout = QHBoxLayout(download_controls_container)
|
||||||
|
download_controls_layout.setContentsMargins(0, 0, 0, 0)
|
||||||
|
|
||||||
|
batch_label = QLabel('Concurrents:')
|
||||||
|
download_controls_layout.addWidget(batch_label)
|
||||||
|
|
||||||
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)
|
||||||
@@ -785,40 +814,62 @@ class TwitterMediaDownloaderGUI(QWidget):
|
|||||||
self.download_batch_combo.addItem(str(size))
|
self.download_batch_combo.addItem(str(size))
|
||||||
self.download_batch_combo.setCurrentText(str(self.download_batch_size))
|
self.download_batch_combo.setCurrentText(str(self.download_batch_size))
|
||||||
self.download_batch_combo.currentTextChanged.connect(self.save_settings)
|
self.download_batch_combo.currentTextChanged.connect(self.save_settings)
|
||||||
|
download_controls_layout.addWidget(self.download_batch_combo)
|
||||||
|
download_controls_layout.addStretch()
|
||||||
|
|
||||||
|
download_controls_container.setFixedWidth(180)
|
||||||
|
controls_layout.addWidget(download_controls_container)
|
||||||
|
|
||||||
self.convert_gif_checkbox = QCheckBox("Convert GIF")
|
self.convert_gif_checkbox = QCheckBox("Convert GIF")
|
||||||
self.convert_gif_checkbox.setCursor(Qt.CursorShape.PointingHandCursor)
|
self.convert_gif_checkbox.setCursor(Qt.CursorShape.PointingHandCursor)
|
||||||
self.convert_gif_checkbox.setChecked(self.convert_gif)
|
self.convert_gif_checkbox.setChecked(self.convert_gif)
|
||||||
self.convert_gif_checkbox.toggled.connect(self.handle_gif_checkbox)
|
self.convert_gif_checkbox.toggled.connect(self.handle_conversion_checkbox)
|
||||||
|
controls_layout.addWidget(self.convert_gif_checkbox)
|
||||||
|
|
||||||
batch_layout.addWidget(batch_label)
|
controls_layout.addSpacing(5)
|
||||||
batch_layout.addWidget(self.download_batch_combo)
|
|
||||||
batch_layout.addWidget(self.convert_gif_checkbox)
|
|
||||||
|
|
||||||
self.gif_resolution_label = QLabel("Converted GIF Quality:")
|
mode_label = QLabel("Mode:")
|
||||||
self.gif_resolution_combo = QComboBox()
|
self.conversion_mode_combo = QComboBox()
|
||||||
self.gif_resolution_combo.setCursor(Qt.CursorShape.PointingHandCursor)
|
self.conversion_mode_combo.setCursor(Qt.CursorShape.PointingHandCursor)
|
||||||
self.gif_resolution_combo.setFixedWidth(85)
|
self.conversion_mode_combo.setFixedWidth(80)
|
||||||
gif_resolutions = [
|
conversion_modes = [('better', 'Better'), ('fast', 'Fast')]
|
||||||
|
for value, display in conversion_modes:
|
||||||
|
self.conversion_mode_combo.addItem(display, value)
|
||||||
|
self.conversion_mode_combo.currentTextChanged.connect(self.save_settings)
|
||||||
|
controls_layout.addWidget(mode_label)
|
||||||
|
controls_layout.addWidget(self.conversion_mode_combo)
|
||||||
|
|
||||||
|
controls_layout.addSpacing(5)
|
||||||
|
|
||||||
|
quality_label = QLabel("Quality:")
|
||||||
|
self.conversion_quality_combo = QComboBox()
|
||||||
|
self.conversion_quality_combo.setCursor(Qt.CursorShape.PointingHandCursor)
|
||||||
|
self.conversion_quality_combo.setFixedWidth(85)
|
||||||
|
gif_qualities = [
|
||||||
('original', 'Original'),
|
('original', 'Original'),
|
||||||
('high', 'High'),
|
('high', 'High'),
|
||||||
('medium', 'Medium'),
|
('medium', 'Medium'),
|
||||||
('low', 'Low')
|
('low', 'Low')
|
||||||
]
|
]
|
||||||
for value, display in gif_resolutions:
|
for value, display in gif_qualities:
|
||||||
self.gif_resolution_combo.addItem(display, value)
|
self.conversion_quality_combo.addItem(display, value)
|
||||||
self.gif_resolution_combo.currentTextChanged.connect(self.save_settings)
|
self.conversion_quality_combo.currentTextChanged.connect(self.save_settings)
|
||||||
batch_layout.addWidget(self.gif_resolution_label)
|
controls_layout.addWidget(quality_label)
|
||||||
batch_layout.addWidget(self.gif_resolution_combo)
|
controls_layout.addWidget(self.conversion_quality_combo)
|
||||||
|
|
||||||
|
self.mode_label = mode_label
|
||||||
|
self.quality_label = quality_label
|
||||||
|
|
||||||
if not self.convert_gif:
|
if not self.convert_gif:
|
||||||
self.gif_resolution_label.hide()
|
mode_label.hide()
|
||||||
self.gif_resolution_combo.hide()
|
self.conversion_mode_combo.hide()
|
||||||
|
quality_label.hide()
|
||||||
|
self.conversion_quality_combo.hide()
|
||||||
|
|
||||||
batch_layout.addStretch()
|
controls_layout.addStretch()
|
||||||
download_layout.addLayout(batch_layout)
|
download_conversion_layout.addLayout(controls_layout)
|
||||||
|
|
||||||
settings_layout.addWidget(download_group)
|
settings_layout.addWidget(download_conversion_group)
|
||||||
settings_layout.addStretch()
|
settings_layout.addStretch()
|
||||||
|
|
||||||
settings_tab.setLayout(settings_layout)
|
settings_tab.setLayout(settings_layout)
|
||||||
@@ -880,9 +931,13 @@ class TwitterMediaDownloaderGUI(QWidget):
|
|||||||
self.settings.setValue('convert_gif', self.convert_gif_checkbox.isChecked())
|
self.settings.setValue('convert_gif', self.convert_gif_checkbox.isChecked())
|
||||||
self.convert_gif = self.convert_gif_checkbox.isChecked()
|
self.convert_gif = self.convert_gif_checkbox.isChecked()
|
||||||
|
|
||||||
if hasattr(self, 'gif_resolution_combo'):
|
if hasattr(self, 'conversion_mode_combo'):
|
||||||
self.settings.setValue('gif_resolution', self.gif_resolution_combo.currentData())
|
self.settings.setValue('gif_conversion_mode', self.conversion_mode_combo.currentData())
|
||||||
self.gif_resolution = self.gif_resolution_combo.currentData()
|
self.gif_conversion_mode = self.conversion_mode_combo.currentData()
|
||||||
|
|
||||||
|
if hasattr(self, 'conversion_quality_combo'):
|
||||||
|
self.settings.setValue('gif_conversion_quality', self.conversion_quality_combo.currentData())
|
||||||
|
self.gif_conversion_quality = self.conversion_quality_combo.currentData()
|
||||||
|
|
||||||
self.settings.sync()
|
self.settings.sync()
|
||||||
|
|
||||||
@@ -932,17 +987,36 @@ class TwitterMediaDownloaderGUI(QWidget):
|
|||||||
self.convert_gif_checkbox.blockSignals(False)
|
self.convert_gif_checkbox.blockSignals(False)
|
||||||
|
|
||||||
if convert_gif:
|
if convert_gif:
|
||||||
self.gif_resolution_label.show()
|
if hasattr(self, 'mode_label'):
|
||||||
self.gif_resolution_combo.show()
|
self.mode_label.show()
|
||||||
|
if hasattr(self, 'conversion_mode_combo'):
|
||||||
|
self.conversion_mode_combo.show()
|
||||||
|
if hasattr(self, 'quality_label'):
|
||||||
|
self.quality_label.show()
|
||||||
|
if hasattr(self, 'conversion_quality_combo'):
|
||||||
|
self.conversion_quality_combo.show()
|
||||||
else:
|
else:
|
||||||
self.gif_resolution_label.hide()
|
if hasattr(self, 'mode_label'):
|
||||||
self.gif_resolution_combo.hide()
|
self.mode_label.hide()
|
||||||
|
if hasattr(self, 'conversion_mode_combo'):
|
||||||
|
self.conversion_mode_combo.hide()
|
||||||
|
if hasattr(self, 'quality_label'):
|
||||||
|
self.quality_label.hide()
|
||||||
|
if hasattr(self, 'conversion_quality_combo'):
|
||||||
|
self.conversion_quality_combo.hide()
|
||||||
|
|
||||||
gif_resolution = self.settings.value('gif_resolution', 'original')
|
gif_conversion_mode = self.settings.value('gif_conversion_mode', 'better')
|
||||||
if hasattr(self, 'gif_resolution_combo'):
|
if hasattr(self, 'conversion_mode_combo'):
|
||||||
for i in range(self.gif_resolution_combo.count()):
|
for i in range(self.conversion_mode_combo.count()):
|
||||||
if self.gif_resolution_combo.itemData(i) == gif_resolution:
|
if self.conversion_mode_combo.itemData(i) == gif_conversion_mode:
|
||||||
self.gif_resolution_combo.setCurrentIndex(i)
|
self.conversion_mode_combo.setCurrentIndex(i)
|
||||||
|
break
|
||||||
|
|
||||||
|
gif_conversion_quality = self.settings.value('gif_conversion_quality', 'original')
|
||||||
|
if hasattr(self, 'conversion_quality_combo'):
|
||||||
|
for i in range(self.conversion_quality_combo.count()):
|
||||||
|
if self.conversion_quality_combo.itemData(i) == gif_conversion_quality:
|
||||||
|
self.conversion_quality_combo.setCurrentIndex(i)
|
||||||
break
|
break
|
||||||
|
|
||||||
last_username_url = self.settings.value('twitter_url', '')
|
last_username_url = self.settings.value('twitter_url', '')
|
||||||
@@ -969,16 +1043,28 @@ class TwitterMediaDownloaderGUI(QWidget):
|
|||||||
self.fetch_btn.setText('Fetch')
|
self.fetch_btn.setText('Fetch')
|
||||||
self.update_button_states()
|
self.update_button_states()
|
||||||
|
|
||||||
def handle_gif_checkbox(self, checked):
|
def handle_conversion_checkbox(self, checked):
|
||||||
self.convert_gif = checked
|
self.convert_gif = checked
|
||||||
self.save_settings()
|
self.save_settings()
|
||||||
|
|
||||||
if checked:
|
if checked:
|
||||||
self.gif_resolution_label.show()
|
if hasattr(self, 'mode_label'):
|
||||||
self.gif_resolution_combo.show()
|
self.mode_label.show()
|
||||||
|
if hasattr(self, 'conversion_mode_combo'):
|
||||||
|
self.conversion_mode_combo.show()
|
||||||
|
if hasattr(self, 'quality_label'):
|
||||||
|
self.quality_label.show()
|
||||||
|
if hasattr(self, 'conversion_quality_combo'):
|
||||||
|
self.conversion_quality_combo.show()
|
||||||
else:
|
else:
|
||||||
self.gif_resolution_label.hide()
|
if hasattr(self, 'mode_label'):
|
||||||
self.gif_resolution_combo.hide()
|
self.mode_label.hide()
|
||||||
|
if hasattr(self, 'conversion_mode_combo'):
|
||||||
|
self.conversion_mode_combo.hide()
|
||||||
|
if hasattr(self, 'quality_label'):
|
||||||
|
self.quality_label.hide()
|
||||||
|
if hasattr(self, 'conversion_quality_combo'):
|
||||||
|
self.conversion_quality_combo.hide()
|
||||||
|
|
||||||
def browse_output(self):
|
def browse_output(self):
|
||||||
directory = QFileDialog.getExistingDirectory(self, "Select Output Directory")
|
directory = QFileDialog.getExistingDirectory(self, "Select Output Directory")
|
||||||
@@ -1988,7 +2074,8 @@ class TwitterMediaDownloaderGUI(QWidget):
|
|||||||
self.filename_format,
|
self.filename_format,
|
||||||
self.download_batch_size,
|
self.download_batch_size,
|
||||||
self.convert_gif,
|
self.convert_gif,
|
||||||
self.gif_resolution
|
self.gif_conversion_quality,
|
||||||
|
self.gif_conversion_mode
|
||||||
)
|
)
|
||||||
self.worker.finished.connect(self.on_download_finished)
|
self.worker.finished.connect(self.on_download_finished)
|
||||||
self.worker.progress.connect(self.update_progress)
|
self.worker.progress.connect(self.update_progress)
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ class DownloadWorker(QThread):
|
|||||||
download_progress = pyqtSignal(str, int)
|
download_progress = pyqtSignal(str, int)
|
||||||
|
|
||||||
def __init__(self, accounts, outpath, auth_token, filename_format='username_date',
|
def __init__(self, accounts, outpath, auth_token, filename_format='username_date',
|
||||||
download_batch_size=25, convert_gif=False, gif_resolution='original'):
|
download_batch_size=25, convert_gif=False, gif_resolution='original', gif_conversion_mode='better'):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.accounts = accounts
|
self.accounts = accounts
|
||||||
self.outpath = outpath
|
self.outpath = outpath
|
||||||
@@ -94,6 +94,7 @@ class DownloadWorker(QThread):
|
|||||||
self.download_batch_size = download_batch_size
|
self.download_batch_size = download_batch_size
|
||||||
self.convert_gif = convert_gif
|
self.convert_gif = convert_gif
|
||||||
self.gif_resolution = gif_resolution
|
self.gif_resolution = gif_resolution
|
||||||
|
self.gif_conversion_mode = gif_conversion_mode
|
||||||
self.is_paused = False
|
self.is_paused = False
|
||||||
self.is_stopped = False
|
self.is_stopped = False
|
||||||
self.filepath_map = []
|
self.filepath_map = []
|
||||||
@@ -257,20 +258,24 @@ class DownloadWorker(QThread):
|
|||||||
os.remove(fp)
|
os.remove(fp)
|
||||||
skipped_count += 1
|
skipped_count += 1
|
||||||
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}) - Skipped (exists)", conv_progress)
|
quality_display = f"({self.gif_conversion_mode}) - ({self.gif_resolution})"
|
||||||
|
self.conversion_progress.emit(f"Converting GIF {idx:,}/{total_gifs:,} {quality_display} - Skipped (exists)", conv_progress)
|
||||||
continue
|
continue
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
if self.gif_resolution == 'high':
|
if self.gif_conversion_mode == 'fast':
|
||||||
ffmpeg_args = [ffmpeg_exe, '-i', fp, '-lavfi', 'scale=800:-1:flags=lanczos,palettegen=stats_mode=full[palette];[0:v]scale=800:-1:flags=lanczos[scaled];[scaled][palette]paletteuse=dither=sierra2_4a', '-r', '15', '-y', gif_fp]
|
ffmpeg_args = [ffmpeg_exe, '-i', fp, '-y', gif_fp]
|
||||||
elif self.gif_resolution == 'medium':
|
|
||||||
ffmpeg_args = [ffmpeg_exe, '-i', fp, '-lavfi', 'scale=600:-1:flags=lanczos,palettegen=stats_mode=full[palette];[0:v]scale=600:-1:flags=lanczos[scaled];[scaled][palette]paletteuse=dither=sierra2_4a', '-r', '10', '-y', gif_fp]
|
|
||||||
elif self.gif_resolution == 'low':
|
|
||||||
ffmpeg_args = [ffmpeg_exe, '-i', fp, '-lavfi', 'scale=400:-1:flags=lanczos,palettegen=stats_mode=full[palette];[0:v]scale=400:-1:flags=lanczos[scaled];[scaled][palette]paletteuse=dither=sierra2_4a', '-r', '8', '-y', gif_fp]
|
|
||||||
else:
|
else:
|
||||||
ffmpeg_args = [ffmpeg_exe, '-i', fp, '-lavfi', 'palettegen=stats_mode=full[palette];[0:v][palette]paletteuse=dither=sierra2_4a', '-y', gif_fp]
|
if self.gif_resolution == 'high':
|
||||||
|
ffmpeg_args = [ffmpeg_exe, '-i', fp, '-lavfi', 'scale=800:-1:flags=lanczos,palettegen=stats_mode=full[palette];[0:v]scale=800:-1:flags=lanczos[scaled];[scaled][palette]paletteuse=dither=sierra2_4a', '-r', '15', '-y', gif_fp]
|
||||||
|
elif self.gif_resolution == 'medium':
|
||||||
|
ffmpeg_args = [ffmpeg_exe, '-i', fp, '-lavfi', 'scale=600:-1:flags=lanczos,palettegen=stats_mode=full[palette];[0:v]scale=600:-1:flags=lanczos[scaled];[scaled][palette]paletteuse=dither=sierra2_4a', '-r', '10', '-y', gif_fp]
|
||||||
|
elif self.gif_resolution == 'low':
|
||||||
|
ffmpeg_args = [ffmpeg_exe, '-i', fp, '-lavfi', 'scale=400:-1:flags=lanczos,palettegen=stats_mode=full[palette];[0:v]scale=400:-1:flags=lanczos[scaled];[scaled][palette]paletteuse=dither=sierra2_4a', '-r', '8', '-y', gif_fp]
|
||||||
|
else:
|
||||||
|
ffmpeg_args = [ffmpeg_exe, '-i', fp, '-lavfi', 'palettegen=stats_mode=full[palette];[0:v][palette]paletteuse=dither=sierra2_4a', '-y', gif_fp]
|
||||||
|
|
||||||
result = subprocess.run(ffmpeg_args, capture_output=True, creationflags=creationflags)
|
result = subprocess.run(ffmpeg_args, capture_output=True, creationflags=creationflags)
|
||||||
if result.returncode == 0 and os.path.exists(gif_fp):
|
if result.returncode == 0 and os.path.exists(gif_fp):
|
||||||
@@ -281,7 +286,8 @@ class DownloadWorker(QThread):
|
|||||||
pass
|
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)
|
quality_display = f"({self.gif_conversion_mode}) - ({self.gif_resolution})"
|
||||||
|
self.conversion_progress.emit(f"Converting GIF {idx:,}/{total_gifs:,} {quality_display}", conv_progress)
|
||||||
if converted_count > 0 or skipped_count > 0:
|
if converted_count > 0 or skipped_count > 0:
|
||||||
completion_msg = f"GIF conversion completed: {converted_count:,} converted"
|
completion_msg = f"GIF conversion completed: {converted_count:,} converted"
|
||||||
if skipped_count > 0:
|
if skipped_count > 0:
|
||||||
@@ -344,7 +350,7 @@ class UpdateDialog(QDialog):
|
|||||||
class TwitterMediaDownloaderGUI(QWidget):
|
class TwitterMediaDownloaderGUI(QWidget):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.current_version = "3.5"
|
self.current_version = "3.6"
|
||||||
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)
|
||||||
@@ -362,6 +368,8 @@ class TwitterMediaDownloaderGUI(QWidget):
|
|||||||
self.media_type = self.settings.value('media_type', 'all')
|
self.media_type = self.settings.value('media_type', 'all')
|
||||||
self.convert_gif = self.settings.value('convert_gif', False, type=bool)
|
self.convert_gif = self.settings.value('convert_gif', False, type=bool)
|
||||||
self.gif_resolution = self.settings.value('gif_resolution', 'original')
|
self.gif_resolution = self.settings.value('gif_resolution', 'original')
|
||||||
|
self.gif_conversion_mode = self.settings.value('gif_conversion_mode', 'better')
|
||||||
|
self.gif_conversion_quality = self.settings.value('gif_conversion_quality', 'original')
|
||||||
self.check_for_updates = self.settings.value('check_for_updates', True, type=bool)
|
self.check_for_updates = self.settings.value('check_for_updates', True, type=bool)
|
||||||
self.current_theme_color = self.settings.value('theme_color', '#2196F3')
|
self.current_theme_color = self.settings.value('theme_color', '#2196F3')
|
||||||
|
|
||||||
@@ -707,6 +715,37 @@ class TwitterMediaDownloaderGUI(QWidget):
|
|||||||
first_row_layout = QHBoxLayout()
|
first_row_layout = QHBoxLayout()
|
||||||
first_row_layout.setSpacing(5)
|
first_row_layout.setSpacing(5)
|
||||||
|
|
||||||
|
timeline_label = QLabel("Timeline:")
|
||||||
|
self.timeline_type_combo = QComboBox()
|
||||||
|
self.timeline_type_combo.setCursor(Qt.CursorShape.PointingHandCursor)
|
||||||
|
self.timeline_type_combo.setFixedWidth(75)
|
||||||
|
timeline_types = [
|
||||||
|
('media', 'Media'),
|
||||||
|
('timeline', 'Post'),
|
||||||
|
('tweets', 'Tweets'),
|
||||||
|
('with_replies', 'Replies')
|
||||||
|
]
|
||||||
|
for value, display in timeline_types:
|
||||||
|
self.timeline_type_combo.addItem(display, value)
|
||||||
|
self.timeline_type_combo.currentTextChanged.connect(self.save_settings)
|
||||||
|
first_row_layout.addWidget(timeline_label)
|
||||||
|
first_row_layout.addWidget(self.timeline_type_combo)
|
||||||
|
|
||||||
|
first_row_layout.addSpacing(5)
|
||||||
|
|
||||||
|
media_label = QLabel("Media:")
|
||||||
|
self.media_type_combo = QComboBox()
|
||||||
|
self.media_type_combo.setCursor(Qt.CursorShape.PointingHandCursor)
|
||||||
|
self.media_type_combo.setFixedWidth(85)
|
||||||
|
media_types = [('all', 'All'), ('image', 'Image'), ('video', 'Video'), ('gif', 'GIF')]
|
||||||
|
for value, display in media_types:
|
||||||
|
self.media_type_combo.addItem(display, value)
|
||||||
|
self.media_type_combo.currentTextChanged.connect(self.save_settings)
|
||||||
|
first_row_layout.addWidget(media_label)
|
||||||
|
first_row_layout.addWidget(self.media_type_combo)
|
||||||
|
|
||||||
|
first_row_layout.addSpacing(5)
|
||||||
|
|
||||||
self.batch_checkbox = QCheckBox("Fetch 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")
|
||||||
@@ -728,52 +767,41 @@ class TwitterMediaDownloaderGUI(QWidget):
|
|||||||
self.size_label.hide()
|
self.size_label.hide()
|
||||||
self.batch_size_combo.hide()
|
self.batch_size_combo.hide()
|
||||||
|
|
||||||
first_row_layout.addSpacing(5)
|
|
||||||
|
|
||||||
timeline_label = QLabel("Timeline Type:")
|
|
||||||
self.timeline_type_combo = QComboBox()
|
|
||||||
self.timeline_type_combo.setCursor(Qt.CursorShape.PointingHandCursor)
|
|
||||||
self.timeline_type_combo.setFixedWidth(75)
|
|
||||||
timeline_types = [
|
|
||||||
('media', 'Media'),
|
|
||||||
('timeline', 'Post'),
|
|
||||||
('tweets', 'Tweets'),
|
|
||||||
('with_replies', 'Replies')
|
|
||||||
]
|
|
||||||
for value, display in timeline_types:
|
|
||||||
self.timeline_type_combo.addItem(display, value)
|
|
||||||
self.timeline_type_combo.currentTextChanged.connect(self.save_settings)
|
|
||||||
first_row_layout.addWidget(timeline_label)
|
|
||||||
first_row_layout.addWidget(self.timeline_type_combo)
|
|
||||||
|
|
||||||
first_row_layout.addSpacing(5)
|
|
||||||
|
|
||||||
media_type_label = QLabel("Media Type:")
|
|
||||||
self.media_type_combo = QComboBox()
|
|
||||||
self.media_type_combo.setCursor(Qt.CursorShape.PointingHandCursor)
|
|
||||||
self.media_type_combo.setFixedWidth(85)
|
|
||||||
media_types = [('all', 'All'), ('image', 'Image'), ('video', 'Video'), ('gif', 'GIF')]
|
|
||||||
for value, display in media_types:
|
|
||||||
self.media_type_combo.addItem(display, value)
|
|
||||||
self.media_type_combo.currentTextChanged.connect(self.save_settings)
|
|
||||||
first_row_layout.addWidget(media_type_label)
|
|
||||||
first_row_layout.addWidget(self.media_type_combo)
|
|
||||||
|
|
||||||
first_row_layout.addStretch()
|
first_row_layout.addStretch()
|
||||||
gallery_dl_layout.addLayout(first_row_layout)
|
gallery_dl_layout.addLayout(first_row_layout)
|
||||||
|
|
||||||
settings_layout.addWidget(gallery_dl_group)
|
settings_layout.addWidget(gallery_dl_group)
|
||||||
|
|
||||||
download_group = QWidget()
|
download_conversion_group = QWidget()
|
||||||
download_layout = QVBoxLayout(download_group)
|
download_conversion_layout = QVBoxLayout(download_conversion_group)
|
||||||
download_layout.setSpacing(5)
|
download_conversion_layout.setSpacing(5)
|
||||||
|
|
||||||
|
labels_layout = QHBoxLayout()
|
||||||
|
|
||||||
|
download_label_container = QWidget()
|
||||||
|
download_label_layout = QHBoxLayout(download_label_container)
|
||||||
|
download_label_layout.setContentsMargins(0, 0, 0, 0)
|
||||||
download_label = QLabel('Download Settings')
|
download_label = QLabel('Download Settings')
|
||||||
download_label.setStyleSheet("font-weight: bold;")
|
download_label.setStyleSheet("font-weight: bold;")
|
||||||
download_layout.addWidget(download_label)
|
download_label_layout.addWidget(download_label)
|
||||||
|
download_label_layout.addStretch()
|
||||||
|
download_label_container.setFixedWidth(180)
|
||||||
|
labels_layout.addWidget(download_label_container)
|
||||||
|
|
||||||
batch_layout = QHBoxLayout()
|
conversion_label = QLabel('Conversion Settings')
|
||||||
batch_label = QLabel('Concurrent Downloads:')
|
conversion_label.setStyleSheet("font-weight: bold;")
|
||||||
|
labels_layout.addWidget(conversion_label)
|
||||||
|
labels_layout.addStretch()
|
||||||
|
download_conversion_layout.addLayout(labels_layout)
|
||||||
|
|
||||||
|
controls_layout = QHBoxLayout()
|
||||||
|
|
||||||
|
download_controls_container = QWidget()
|
||||||
|
download_controls_layout = QHBoxLayout(download_controls_container)
|
||||||
|
download_controls_layout.setContentsMargins(0, 0, 0, 0)
|
||||||
|
|
||||||
|
batch_label = QLabel('Concurrents:')
|
||||||
|
download_controls_layout.addWidget(batch_label)
|
||||||
|
|
||||||
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)
|
||||||
@@ -782,40 +810,62 @@ class TwitterMediaDownloaderGUI(QWidget):
|
|||||||
self.download_batch_combo.addItem(str(size))
|
self.download_batch_combo.addItem(str(size))
|
||||||
self.download_batch_combo.setCurrentText(str(self.download_batch_size))
|
self.download_batch_combo.setCurrentText(str(self.download_batch_size))
|
||||||
self.download_batch_combo.currentTextChanged.connect(self.save_settings)
|
self.download_batch_combo.currentTextChanged.connect(self.save_settings)
|
||||||
|
download_controls_layout.addWidget(self.download_batch_combo)
|
||||||
|
download_controls_layout.addStretch()
|
||||||
|
|
||||||
|
download_controls_container.setFixedWidth(180)
|
||||||
|
controls_layout.addWidget(download_controls_container)
|
||||||
|
|
||||||
self.convert_gif_checkbox = QCheckBox("Convert GIF")
|
self.convert_gif_checkbox = QCheckBox("Convert GIF")
|
||||||
self.convert_gif_checkbox.setCursor(Qt.CursorShape.PointingHandCursor)
|
self.convert_gif_checkbox.setCursor(Qt.CursorShape.PointingHandCursor)
|
||||||
self.convert_gif_checkbox.setChecked(self.convert_gif)
|
self.convert_gif_checkbox.setChecked(self.convert_gif)
|
||||||
self.convert_gif_checkbox.toggled.connect(self.handle_gif_checkbox)
|
self.convert_gif_checkbox.toggled.connect(self.handle_conversion_checkbox)
|
||||||
|
controls_layout.addWidget(self.convert_gif_checkbox)
|
||||||
|
|
||||||
batch_layout.addWidget(batch_label)
|
controls_layout.addSpacing(5)
|
||||||
batch_layout.addWidget(self.download_batch_combo)
|
|
||||||
batch_layout.addWidget(self.convert_gif_checkbox)
|
|
||||||
|
|
||||||
self.gif_resolution_label = QLabel("Converted GIF Quality:")
|
mode_label = QLabel("Mode:")
|
||||||
self.gif_resolution_combo = QComboBox()
|
self.conversion_mode_combo = QComboBox()
|
||||||
self.gif_resolution_combo.setCursor(Qt.CursorShape.PointingHandCursor)
|
self.conversion_mode_combo.setCursor(Qt.CursorShape.PointingHandCursor)
|
||||||
self.gif_resolution_combo.setFixedWidth(85)
|
self.conversion_mode_combo.setFixedWidth(80)
|
||||||
gif_resolutions = [
|
conversion_modes = [('better', 'Better'), ('fast', 'Fast')]
|
||||||
|
for value, display in conversion_modes:
|
||||||
|
self.conversion_mode_combo.addItem(display, value)
|
||||||
|
self.conversion_mode_combo.currentTextChanged.connect(self.save_settings)
|
||||||
|
controls_layout.addWidget(mode_label)
|
||||||
|
controls_layout.addWidget(self.conversion_mode_combo)
|
||||||
|
|
||||||
|
controls_layout.addSpacing(5)
|
||||||
|
|
||||||
|
quality_label = QLabel("Quality:")
|
||||||
|
self.conversion_quality_combo = QComboBox()
|
||||||
|
self.conversion_quality_combo.setCursor(Qt.CursorShape.PointingHandCursor)
|
||||||
|
self.conversion_quality_combo.setFixedWidth(85)
|
||||||
|
gif_qualities = [
|
||||||
('original', 'Original'),
|
('original', 'Original'),
|
||||||
('high', 'High'),
|
('high', 'High'),
|
||||||
('medium', 'Medium'),
|
('medium', 'Medium'),
|
||||||
('low', 'Low')
|
('low', 'Low')
|
||||||
]
|
]
|
||||||
for value, display in gif_resolutions:
|
for value, display in gif_qualities:
|
||||||
self.gif_resolution_combo.addItem(display, value)
|
self.conversion_quality_combo.addItem(display, value)
|
||||||
self.gif_resolution_combo.currentTextChanged.connect(self.save_settings)
|
self.conversion_quality_combo.currentTextChanged.connect(self.save_settings)
|
||||||
batch_layout.addWidget(self.gif_resolution_label)
|
controls_layout.addWidget(quality_label)
|
||||||
batch_layout.addWidget(self.gif_resolution_combo)
|
controls_layout.addWidget(self.conversion_quality_combo)
|
||||||
|
|
||||||
|
self.mode_label = mode_label
|
||||||
|
self.quality_label = quality_label
|
||||||
|
|
||||||
if not self.convert_gif:
|
if not self.convert_gif:
|
||||||
self.gif_resolution_label.hide()
|
mode_label.hide()
|
||||||
self.gif_resolution_combo.hide()
|
self.conversion_mode_combo.hide()
|
||||||
|
quality_label.hide()
|
||||||
|
self.conversion_quality_combo.hide()
|
||||||
|
|
||||||
batch_layout.addStretch()
|
controls_layout.addStretch()
|
||||||
download_layout.addLayout(batch_layout)
|
download_conversion_layout.addLayout(controls_layout)
|
||||||
|
|
||||||
settings_layout.addWidget(download_group)
|
settings_layout.addWidget(download_conversion_group)
|
||||||
settings_layout.addStretch()
|
settings_layout.addStretch()
|
||||||
|
|
||||||
settings_tab.setLayout(settings_layout)
|
settings_tab.setLayout(settings_layout)
|
||||||
@@ -1048,9 +1098,13 @@ class TwitterMediaDownloaderGUI(QWidget):
|
|||||||
self.settings.setValue('convert_gif', self.convert_gif_checkbox.isChecked())
|
self.settings.setValue('convert_gif', self.convert_gif_checkbox.isChecked())
|
||||||
self.convert_gif = self.convert_gif_checkbox.isChecked()
|
self.convert_gif = self.convert_gif_checkbox.isChecked()
|
||||||
|
|
||||||
if hasattr(self, 'gif_resolution_combo'):
|
if hasattr(self, 'conversion_mode_combo'):
|
||||||
self.settings.setValue('gif_resolution', self.gif_resolution_combo.currentData())
|
self.settings.setValue('gif_conversion_mode', self.conversion_mode_combo.currentData())
|
||||||
self.gif_resolution = self.gif_resolution_combo.currentData()
|
self.gif_conversion_mode = self.conversion_mode_combo.currentData()
|
||||||
|
|
||||||
|
if hasattr(self, 'conversion_quality_combo'):
|
||||||
|
self.settings.setValue('gif_conversion_quality', self.conversion_quality_combo.currentData())
|
||||||
|
self.gif_conversion_quality = self.conversion_quality_combo.currentData()
|
||||||
|
|
||||||
self.settings.sync()
|
self.settings.sync()
|
||||||
|
|
||||||
@@ -1100,17 +1154,36 @@ class TwitterMediaDownloaderGUI(QWidget):
|
|||||||
self.convert_gif_checkbox.blockSignals(False)
|
self.convert_gif_checkbox.blockSignals(False)
|
||||||
|
|
||||||
if convert_gif:
|
if convert_gif:
|
||||||
self.gif_resolution_label.show()
|
if hasattr(self, 'mode_label'):
|
||||||
self.gif_resolution_combo.show()
|
self.mode_label.show()
|
||||||
|
if hasattr(self, 'conversion_mode_combo'):
|
||||||
|
self.conversion_mode_combo.show()
|
||||||
|
if hasattr(self, 'quality_label'):
|
||||||
|
self.quality_label.show()
|
||||||
|
if hasattr(self, 'conversion_quality_combo'):
|
||||||
|
self.conversion_quality_combo.show()
|
||||||
else:
|
else:
|
||||||
self.gif_resolution_label.hide()
|
if hasattr(self, 'mode_label'):
|
||||||
self.gif_resolution_combo.hide()
|
self.mode_label.hide()
|
||||||
|
if hasattr(self, 'conversion_mode_combo'):
|
||||||
|
self.conversion_mode_combo.hide()
|
||||||
|
if hasattr(self, 'quality_label'):
|
||||||
|
self.quality_label.hide()
|
||||||
|
if hasattr(self, 'conversion_quality_combo'):
|
||||||
|
self.conversion_quality_combo.hide()
|
||||||
|
|
||||||
gif_resolution = self.settings.value('gif_resolution', 'original')
|
gif_conversion_mode = self.settings.value('gif_conversion_mode', 'better')
|
||||||
if hasattr(self, 'gif_resolution_combo'):
|
if hasattr(self, 'conversion_mode_combo'):
|
||||||
for i in range(self.gif_resolution_combo.count()):
|
for i in range(self.conversion_mode_combo.count()):
|
||||||
if self.gif_resolution_combo.itemData(i) == gif_resolution:
|
if self.conversion_mode_combo.itemData(i) == gif_conversion_mode:
|
||||||
self.gif_resolution_combo.setCurrentIndex(i)
|
self.conversion_mode_combo.setCurrentIndex(i)
|
||||||
|
break
|
||||||
|
|
||||||
|
gif_conversion_quality = self.settings.value('gif_conversion_quality', 'original')
|
||||||
|
if hasattr(self, 'conversion_quality_combo'):
|
||||||
|
for i in range(self.conversion_quality_combo.count()):
|
||||||
|
if self.conversion_quality_combo.itemData(i) == gif_conversion_quality:
|
||||||
|
self.conversion_quality_combo.setCurrentIndex(i)
|
||||||
break
|
break
|
||||||
|
|
||||||
last_username_url = self.settings.value('twitter_url', '')
|
last_username_url = self.settings.value('twitter_url', '')
|
||||||
@@ -1137,16 +1210,28 @@ class TwitterMediaDownloaderGUI(QWidget):
|
|||||||
self.fetch_btn.setText('Fetch')
|
self.fetch_btn.setText('Fetch')
|
||||||
self.update_button_states()
|
self.update_button_states()
|
||||||
|
|
||||||
def handle_gif_checkbox(self, checked):
|
def handle_conversion_checkbox(self, checked):
|
||||||
self.convert_gif = checked
|
self.convert_gif = checked
|
||||||
self.save_settings()
|
self.save_settings()
|
||||||
|
|
||||||
if checked:
|
if checked:
|
||||||
self.gif_resolution_label.show()
|
if hasattr(self, 'mode_label'):
|
||||||
self.gif_resolution_combo.show()
|
self.mode_label.show()
|
||||||
|
if hasattr(self, 'conversion_mode_combo'):
|
||||||
|
self.conversion_mode_combo.show()
|
||||||
|
if hasattr(self, 'quality_label'):
|
||||||
|
self.quality_label.show()
|
||||||
|
if hasattr(self, 'conversion_quality_combo'):
|
||||||
|
self.conversion_quality_combo.show()
|
||||||
else:
|
else:
|
||||||
self.gif_resolution_label.hide()
|
if hasattr(self, 'mode_label'):
|
||||||
self.gif_resolution_combo.hide()
|
self.mode_label.hide()
|
||||||
|
if hasattr(self, 'conversion_mode_combo'):
|
||||||
|
self.conversion_mode_combo.hide()
|
||||||
|
if hasattr(self, 'quality_label'):
|
||||||
|
self.quality_label.hide()
|
||||||
|
if hasattr(self, 'conversion_quality_combo'):
|
||||||
|
self.conversion_quality_combo.hide()
|
||||||
|
|
||||||
def browse_output(self):
|
def browse_output(self):
|
||||||
directory = QFileDialog.getExistingDirectory(self, "Select Output Directory")
|
directory = QFileDialog.getExistingDirectory(self, "Select Output Directory")
|
||||||
@@ -2144,7 +2229,8 @@ class TwitterMediaDownloaderGUI(QWidget):
|
|||||||
self.filename_format,
|
self.filename_format,
|
||||||
self.download_batch_size,
|
self.download_batch_size,
|
||||||
self.convert_gif,
|
self.convert_gif,
|
||||||
self.gif_resolution
|
self.gif_conversion_quality,
|
||||||
|
self.gif_conversion_mode
|
||||||
)
|
)
|
||||||
self.worker.finished.connect(self.on_download_finished)
|
self.worker.finished.connect(self.on_download_finished)
|
||||||
self.worker.progress.connect(self.update_progress)
|
self.worker.progress.connect(self.update_progress)
|
||||||
|
|||||||
+1
-1
@@ -1,3 +1,3 @@
|
|||||||
{
|
{
|
||||||
"version": "3.4"
|
"version": "3.5"
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user