feat: translate subtitles with an OpenAI-compatible LLM

This commit is contained in:
tri committed 2026-10-27 22:43:03 +07:00
1 parent 48cac86d60
commit 4665bf632a
21 files changed
+1877 -5

No files matched your search

+7 -1
View File
@@ -21,7 +21,8 @@ class MpvItem : public MpvAbstractItem
Q_PROPERTY(bool fileLoaded READ isFileLoaded NOTIFY fileLoadedChanged)
// Subtitle tracks of the current file, each a map with id, title, lang, codec,
// external and externalFilename. Track id 0 means "no subtitle".
// external, externalFilename and ffIndex (FFmpeg stream index, -1 for external
// files). Track id 0 means "no subtitle".
Q_PROPERTY(QVariantList subtitleTracks READ subtitleTracks NOTIFY subtitleTracksChanged)
Q_PROPERTY(int subtitleId READ subtitleId WRITE setSubtitleId NOTIFY subtitleTracksChanged)
Q_PROPERTY(int secondarySubtitleId READ secondarySubtitleId WRITE setSecondarySubtitleId NOTIFY subtitleTracksChanged)
@@ -53,6 +54,9 @@ public:
Q_INVOKABLE void seek(double seconds);
// Adds an external subtitle file and makes it the primary subtitle.
Q_INVOKABLE void addSubtitleFile(const QUrl &url);
// Shows \a url as the secondary subtitle, adding it first (named \a title) unless it
// is already loaded.
Q_INVOKABLE void showSecondarySubtitleFile(const QUrl &url, const QString &title);
// Shows a short message on mpv's on-screen display.
Q_INVOKABLE void showText(const QString &text);
@@ -83,4 +87,6 @@ private:
int m_subtitleId = 0;
int m_secondarySubtitleId = 0;
double m_subtitleDelay = 0.0;
// File added by showSecondarySubtitleFile() that should become secondary once mpv lists it.
QString m_pendingSecondaryPath;
};