fixes (desc)
Some checks failed
telegram message / notify (push) Has been cancelled

- m3u8 parser
- segments download
- video-audio merge
This commit is contained in:
stefanodvx 2025-04-23 01:44:25 +02:00
parent 330cc39583
commit c8d0666d1d
5 changed files with 254 additions and 174 deletions

View file

@ -20,10 +20,22 @@ func MergeAudio(media *models.DownloadedMedia) error {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
audioFile, err := util.DownloadFile(
ctx, audioFormat.URL,
audioFormat.GetFileName(), nil,
)
var audioFile string
var err error
if len(audioFormat.Segments) == 0 {
audioFile, err = util.DownloadFile(
ctx, audioFormat.URL,
audioFormat.GetFileName(),
nil,
)
} else {
audioFile, err = util.DownloadFileWithSegments(
ctx, audioFormat.Segments,
audioFormat.GetFileName(),
nil,
)
}
if err != nil {
return fmt.Errorf("failed to download audio file: %w", err)
}