feat: add auto-select from preferences and type picker
All checks were successful
CI / build (push) Successful in 52s
All checks were successful
CI / build (push) Successful in 52s
- Add MediaTypeAsk (0) as the default, mapping old video_audio to Ask - Show Video/Audio/Ask type picker when no default media type is set - Auto-select matching format and skip picker when defaults are configured - Add autoSelectVideoFormat / autoSelectAudioFormat helpers with closest-match - Add buildFilteredFormatList for type-filtered format lists - Add Media Type setting in settings UI (Ask/Video/Audio) - Add --merge-output-format mp4 for video downloads via yt-dlp - Fix formatLabelForDisplay to show Height fallback and Extension - Add cookies volume mount to docker-compose.yml - Document cookies setup and new features in README
This commit is contained in:
@@ -65,7 +65,7 @@ func (s *Store) GetOrCreateUser(chatID int64) (int64, error) {
|
||||
|
||||
func (s *Store) GetOrCreatePreferences(userID int64) (*domain.UserPreferences, error) {
|
||||
if _, err := s.db.Exec(
|
||||
"INSERT OR IGNORE INTO user_preferences (user_id) VALUES (?)",
|
||||
"INSERT OR IGNORE INTO user_preferences (user_id, default_media_type) VALUES (?, 'ask')",
|
||||
userID,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
@@ -90,14 +90,18 @@ func (s *Store) getPreferences(userID int64) (*domain.UserPreferences, error) {
|
||||
p.DefaultMediaType = domain.MediaTypeAudio
|
||||
case "video":
|
||||
p.DefaultMediaType = domain.MediaTypeVideo
|
||||
case "ask":
|
||||
p.DefaultMediaType = domain.MediaTypeAsk
|
||||
default:
|
||||
p.DefaultMediaType = domain.MediaTypeVideoAudio
|
||||
p.DefaultMediaType = domain.MediaTypeAsk
|
||||
}
|
||||
return &p, nil
|
||||
}
|
||||
|
||||
func mediaTypeToString(mt domain.MediaType) string {
|
||||
switch mt {
|
||||
case domain.MediaTypeAsk:
|
||||
return "ask"
|
||||
case domain.MediaTypeAudio:
|
||||
return "audio"
|
||||
case domain.MediaTypeVideo:
|
||||
|
||||
Reference in New Issue
Block a user