refactor: remove container selection, extract helpers, add logging and tests
All checks were successful
CI / build (push) Successful in 51s
All checks were successful
CI / build (push) Successful in 51s
- Remove container picker UI, keyboard, settings, and ContainerOptions entirely — yt-dlp handles container format automatically - Remove Container field from DownloadJob struct and related references - Extract buildFormatList helper to deduplicate format list building between handleURLInput and handleBackStep - Break runDownload into trackDownloadProgress + handleDownloadCompletion - Add HTTP timeout (30s) to downloadFile helper - Log applyQuota and AddHistory errors instead of discarding - Log nil stepState warnings in all handler entry points - Include job.StderrLog in download failure messages - Add tests for buildFormatList, findFormatByID, determineMediaType, and buildFormatString - Update README with search, DRM fallback, and quota feature docs - Remove unused strings import from keyboard.go
This commit is contained in:
@@ -141,19 +141,15 @@ 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",
|
||||
DefaultAudioContainer: "mp3",
|
||||
DefaultVideoContainer: "mp4",
|
||||
DefaultMediaType: domain.MediaTypeVideoAudio,
|
||||
DefaultAudioFormat: "best",
|
||||
DefaultVideoFormat: "best",
|
||||
}
|
||||
}
|
||||
|
||||
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 {
|
||||
@@ -172,7 +168,6 @@ func (h *Handler) handlePlaylistConfirm(ctx context.Context, chatID int64, msgID
|
||||
URL: entry.URL,
|
||||
MediaType: prefs.DefaultMediaType,
|
||||
SelectedFormat: format,
|
||||
Container: container,
|
||||
Language: prefs.DefaultLanguage,
|
||||
Status: domain.StatusDownloading,
|
||||
Title: entry.Title,
|
||||
|
||||
Reference in New Issue
Block a user