Merge branch 'master' into rename_and_move
This commit is contained in:
@@ -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()
|
||||||
|
|
||||||
@@ -151,7 +156,6 @@ def getDirContent(dir=env.show_dir):
|
|||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
# TODO Log to error file
|
# TODO Log to error file
|
||||||
logging.info('Error: "' + dir + '" is not a directory.')
|
logging.info('Error: "' + dir + '" is not a directory.')
|
||||||
# TODO Remove this exit(0)
|
|
||||||
|
|
||||||
# Hashes the contents of media folder to easily check for changes.
|
# Hashes the contents of media folder to easily check for changes.
|
||||||
def directoryChecksum():
|
def directoryChecksum():
|
||||||
@@ -209,7 +213,7 @@ def main():
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
if (os.path.exists(env.logfile)):
|
if (os.path.exists(env.logfile)):
|
||||||
logging.basicConfig(filename=env.logfile, level=logging.INFO)
|
logging.basicConfig(filename=env.logfile, level=logging.DEBUG)
|
||||||
else:
|
else:
|
||||||
print('Logfile could not be found at ' + env.logfile + '. Verifiy presence or disable logging in config.')
|
print('Logfile could not be found at ' + env.logfile + '. Verifiy presence or disable logging in config.')
|
||||||
exit(0)
|
exit(0)
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ class episode(object):
|
|||||||
url = '/'.join(self.queries[dType])
|
url = '/'.join(self.queries[dType])
|
||||||
if create and not os.path.isdir(url):
|
if create and not os.path.isdir(url):
|
||||||
os.makedirs(url)
|
os.makedirs(url)
|
||||||
|
fix_ownership(url)
|
||||||
if mergeItem:
|
if mergeItem:
|
||||||
return '/'.join([url, str(mergeItem)])
|
return '/'.join([url, str(mergeItem)])
|
||||||
return url
|
return url
|
||||||
@@ -94,4 +95,3 @@ if __name__ == '__main__':
|
|||||||
print('Logfile could not be found at ' + env.logfile + '. Verifiy presence or disable logging in config.')
|
print('Logfile could not be found at ' + env.logfile + '. Verifiy presence or disable logging in config.')
|
||||||
|
|
||||||
moveStray(sys.argv[-1])
|
moveStray(sys.argv[-1])
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user