1
0
mirror of https://github.com/spaam/svtplay-dl.git synced 2024-11-24 04:05:39 +01:00

fetcher.http: if we can detect its mp3, use that as extension.

This commit is contained in:
Johan Andersson 2019-01-09 21:34:21 +01:00
parent 806fd55d3b
commit f47e729c01

View File

@ -1,6 +1,7 @@
# ex:ts=4:sw=4:sts=4:et
# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
from __future__ import absolute_import
import os
from svtplay_dl.utils.output import ETA, progressbar, output
from svtplay_dl.fetcher import VideoRetriever
@ -13,6 +14,10 @@ class HTTP(VideoRetriever):
def download(self):
""" Get the stream from HTTP """
_, ext = os.path.splitext(self.url)
if ext == ".mp3":
self.output_extention = "mp3"
else:
self.output_extention = "mp4" # this might be wrong..
data = self.http.request("get", self.url, stream=True)
try:
@ -22,7 +27,7 @@ class HTTP(VideoRetriever):
total_size = int(total_size)
bytes_so_far = 0
file_d = output(self.output, self.config, "mp4")
file_d = output(self.output, self.config, self.output_extention)
if file_d is None:
return