summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorvitiko98 <[email protected]>2021-06-25 23:22:39 -0400
committervitiko98 <[email protected]>2021-06-25 23:22:39 -0400
commit92e0d13913cca747b6620888d429c770c3a4b3b8 (patch)
treec89c745531d341f5281460e66d83a801207c267f
parent9fbc58b56b6129a70b77a2b8efcbe7c7d855dac3 (diff)
downloadbazarr-92e0d13913cca747b6620888d429c770c3a4b3b8.tar.gz
bazarr-92e0d13913cca747b6620888d429c770c3a4b3b8.zip
Fix Subsynchro provider (Fix #1450)v0.9.6-beta.33
-rw-r--r--libs/subliminal_patch/providers/subsynchro.py17
1 files changed, 6 insertions, 11 deletions
diff --git a/libs/subliminal_patch/providers/subsynchro.py b/libs/subliminal_patch/providers/subsynchro.py
index d3feab733..e05e7c4e7 100644
--- a/libs/subliminal_patch/providers/subsynchro.py
+++ b/libs/subliminal_patch/providers/subsynchro.py
@@ -3,7 +3,7 @@ import io
import logging
import os
-from zipfile import ZipFile
+from zipfile import ZipFile, is_zipfile
from requests import Session
from guessit import guessit
@@ -144,15 +144,10 @@ class SubsynchroProvider(Provider):
)
response.raise_for_status()
- if subtitle.file_type.endswith(".zip"):
+ stream = io.BytesIO(response.content)
+ if is_zipfile(stream):
logger.debug("Zip file found")
- subtitle_ = self.get_file(ZipFile(io.BytesIO(response.content)))
-
- elif subtitle.file_type.endswith(".srt"):
- logger.debug("Srt file found")
- subtitle_ = response.content
-
+ subtitle_ = self.get_file(ZipFile(stream))
+ subtitle.content = fix_line_ending(subtitle_)
else:
- raise APIThrottled(f"Unknown file type: {subtitle.file_type}")
-
- subtitle.content = fix_line_ending(subtitle_)
+ raise APIThrottled(f"Unknown file type: {subtitle.download_url}")