Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file

## 🗺️ Roadmap

- [X] App signing and notarization
- [X] App signing and notarization - _v0.6.0_
- [ ] Custom regex support for text removal (i.e., Page 21)
- [ ] Support for additional TTS voices
- [ ] Support for other TTS providers
Expand Down
19 changes: 15 additions & 4 deletions pdf2mp3_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def get_resource_path(filename):
try:
import edge_tts
from pypdf import PdfReader
from PyQt6.QtCore import Qt, QThread, pyqtSignal
from PyQt6.QtCore import Qt, QThread, pyqtSignal, QSettings
from PyQt6.QtGui import QDragEnterEvent, QDropEvent, QPixmap

try:
Expand Down Expand Up @@ -305,6 +305,7 @@ def stop_caffeinate(self):
class PDF2MP3App(QMainWindow):
def __init__(self):
super().__init__()
self.settings = QSettings("TextWave", "PDF2MP3")
self.pdf_path = None
self.update_banner = None
self.update_dismissed = False
Expand Down Expand Up @@ -708,10 +709,17 @@ def drop_event(self, event: QDropEvent):
self.set_pdf(files[0])

def select_pdf(self):
# Get last input directory or default to Downloads
default_dir = self.settings.value(
"last_input_dir", str(Path.home() / "Downloads")
)

file_path, _ = QFileDialog.getOpenFileName(
self, "Select PDF File", "", "PDF Files (*.pdf)"
self, "Select PDF File", default_dir, "PDF Files (*.pdf)"
)
if file_path:
# Save the directory for next time
self.settings.setValue("last_input_dir", str(Path(file_path).parent))
self.set_pdf(file_path)

def set_pdf(self, path):
Expand All @@ -728,9 +736,12 @@ def convert(self):
return

# Ask where to save
default_name = Path(self.pdf_path).stem + ".mp3"
# Default to the same folder as the input PDF
default_path = Path(self.pdf_path).parent / (
Path(self.pdf_path).stem + ".mp3"
)
output_path, _ = QFileDialog.getSaveFileName(
self, "Save MP3 As", default_name, "MP3 Files (*.mp3)"
self, "Save MP3 As", str(default_path), "MP3 Files (*.mp3)"
)

if not output_path:
Expand Down