Merge pull request #10 from KevinMidboe/subtitles

Subtitles
This commit is contained in:
2017-06-27 23:27:07 +02:00
committed by GitHub

View File

@@ -3,7 +3,7 @@
# @Author: KevinMidboe # @Author: KevinMidboe
# @Date: 2017-04-05 18:40:11 # @Date: 2017-04-05 18:40:11
# @Last Modified by: KevinMidboe # @Last Modified by: KevinMidboe
# @Last Modified time: 2017-06-01 19:02:04 # @Last Modified time: 2017-06-18 21:49:33
import os.path, hashlib, time, glob, sqlite3, re, json, tweepy import os.path, hashlib, time, glob, sqlite3, re, json, tweepy
import logging import logging
from functools import reduce from functools import reduce
@@ -91,7 +91,12 @@ class strayEpisode(object):
def analyseSubtitles(self, subFile): def analyseSubtitles(self, subFile):
# TODO verify that it is a file # TODO verify that it is a file
f = open(os.path.join([env.show_dir, self.parent, subFile]), 'r', encoding='ISO-8859-15') try:
subtitlePath = os.path.join([env.show_dir, self.parent, subFile])
except TypeError:
# TODO don't get a list in subtitlePath
return self.removeUploadSign(subFile)
f = open(subtitlesPath, 'r', encoding='ISO-8859-15')
language = detect(f.read()) language = detect(f.read())
f.close() f.close()