Now when it tries to tweet without a name it sends the it as a dm, this should fix alot of the crashes. Also added a couple of TODOs
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-05-21 23:38:33
|
# @Last Modified time: 2017-06-01 19:02:04
|
||||||
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
|
||||||
@@ -90,6 +90,7 @@ class strayEpisode(object):
|
|||||||
return file
|
return file
|
||||||
|
|
||||||
def analyseSubtitles(self, subFile):
|
def analyseSubtitles(self, subFile):
|
||||||
|
# TODO verify that it is a file
|
||||||
f = open(os.path.join([env.show_dir, self.parent, subFile]), 'r', encoding='ISO-8859-15')
|
f = open(os.path.join([env.show_dir, self.parent, subFile]), 'r', encoding='ISO-8859-15')
|
||||||
language = detect(f.read())
|
language = detect(f.read())
|
||||||
f.close()
|
f.close()
|
||||||
@@ -112,8 +113,11 @@ class strayEpisode(object):
|
|||||||
def notifyInsert(self):
|
def notifyInsert(self):
|
||||||
# Send unique id. (time)
|
# Send unique id. (time)
|
||||||
tweetObj = twitter()
|
tweetObj = twitter()
|
||||||
message = 'Added episode:\n' + self.showName + ' S' + self.season\
|
if self.showName is None:
|
||||||
+ 'E' + self.episode + '\nDetails: \n https://kevinmidboe.com/seasoned/verified.html?id=' + self._id
|
message = 'Error adding ep: ' + self._id
|
||||||
|
else:
|
||||||
|
message = 'Added episode:\n' + self.showName + ' S' + self.season\
|
||||||
|
+ 'E' + self.episode + '\nDetails: \n https://kevinmidboe.com/seasoned/verified.html?id=' + self._id
|
||||||
tweetObj.dm(message)
|
tweetObj.dm(message)
|
||||||
|
|
||||||
|
|
||||||
@@ -141,13 +145,13 @@ class strayEpisode(object):
|
|||||||
|
|
||||||
|
|
||||||
def getDirContent(dir=env.show_dir):
|
def getDirContent(dir=env.show_dir):
|
||||||
|
# TODO What if item in db is not in this list?
|
||||||
try:
|
try:
|
||||||
return [d for d in os.listdir(dir) if d[0] != '.']
|
return [d for d in os.listdir(dir) if d[0] != '.']
|
||||||
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)
|
# TODO Remove this exit(0)
|
||||||
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():
|
||||||
|
|||||||
Reference in New Issue
Block a user