From a0ae32050f074b12e4ee65a39349f02a0776671c Mon Sep 17 00:00:00 2001 From: r4 Date: Tue, 22 Jun 2021 14:08:38 +0200 Subject: [PATCH] Add more media types --- main.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/main.go b/main.go index 5f510b9..04e8c2d 100644 --- a/main.go +++ b/main.go @@ -76,15 +76,16 @@ func record(url, dir string) { // Set up extractor depending on content type. contentType := resp.Header.Get("content-type") - supported := "Ogg/Vorbis ('application/ogg'), mp3 ('audio/mpeg')" err = nil switch contentType { - case "application/ogg": + case "application/ogg", "audio/ogg", "audio/vorbis", "audio/vorbis-config": extractor, err = vorbis.NewExtractor() - case "audio/mpeg": + case "audio/mpeg", "audio/MPA", "audio/mpa-robust": extractor, err = mp3.NewExtractor(resp.Header) default: - printErr("Content type '%v' not supported, supported formats: %v", contentType, supported) + printErr(`Content type '%v' not supported, supported formats: + Ogg/Vorbis ('application/ogg', 'audio/ogg', 'audio/vorbis', 'audio/vorbis-config') + mp3 ('audio/mpeg', 'audio/MPA', 'audio/mpa-robust')`, contentType) } if err != nil { printErr("%v", err)