refactor: rename Format to Quality, add container Audio/Video sub-pickers

- Rename 'Format' button to 'Quality' in settings (audio_quality/video_quality)
- Add DefaultAudioContainer and DefaultVideoContainer to UserPreferences
- Container settings now has Audio/Video sub-pickers (mp3/m4a/opus vs mp4/mkv/webm)
- Add migration 003 for new container columns
- Update repo layer and playlist flow for new fields
- Update back routing: back_quality, back_container
This commit is contained in:
2026-06-25 16:03:03 +03:30
parent e08ed77884
commit 785e20bf94
7 changed files with 112 additions and 53 deletions

View File

@@ -142,16 +142,19 @@ func (h *Handler) handlePlaylistConfirm(ctx context.Context, chatID int64, msgID
prefs, prefErr := h.Repo.GetOrCreatePreferences(userID)
if prefErr != nil {
prefs = &domain.UserPreferences{
DefaultMediaType: domain.MediaTypeVideoAudio,
DefaultAudioFormat: "best",
DefaultVideoFormat: "best",
DefaultContainer: "mp4",
DefaultMediaType: domain.MediaTypeVideoAudio,
DefaultAudioFormat: "best",
DefaultVideoFormat: "best",
DefaultAudioContainer: "mp3",
DefaultVideoContainer: "mp4",
}
}
formatID := prefs.DefaultVideoFormat
container := prefs.DefaultVideoContainer
if prefs.DefaultMediaType == domain.MediaTypeAudio {
formatID = prefs.DefaultAudioFormat
container = prefs.DefaultAudioContainer
}
format := &domain.Format{ID: formatID}
for _, f := range info.Formats {
@@ -168,7 +171,7 @@ func (h *Handler) handlePlaylistConfirm(ctx context.Context, chatID int64, msgID
URL: entry.URL,
MediaType: prefs.DefaultMediaType,
SelectedFormat: format,
Container: prefs.DefaultContainer,
Container: container,
Language: prefs.DefaultLanguage,
Status: domain.StatusDownloading,
Title: entry.Title,