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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user