Merge pull request #46 from KevinMidboe/api/update_requested
Api/update requested
This commit is contained in:
@@ -92,7 +92,7 @@ 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
|
||||||
try:
|
try:
|
||||||
subtitlePath = os.path.join([env.show_dir, self.parent, subFile])
|
subtitlePath = os.path.join([env.input_dir, self.parent, subFile])
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# TODO don't get a list in subtitlePath
|
# TODO don't get a list in subtitlePath
|
||||||
return self.removeUploadSign(subFile)
|
return self.removeUploadSign(subFile)
|
||||||
@@ -131,7 +131,7 @@ class strayEpisode(object):
|
|||||||
conn = sqlite3.connect(env.db_path)
|
conn = sqlite3.connect(env.db_path)
|
||||||
c = conn.cursor()
|
c = conn.cursor()
|
||||||
|
|
||||||
path = '/'.join([env.show_dir, self.parent])
|
path = '/'.join([env.input_dir, self.parent])
|
||||||
video_files = json.dumps(self.videoFiles)
|
video_files = json.dumps(self.videoFiles)
|
||||||
subtitles = json.dumps(self.subtitles)
|
subtitles = json.dumps(self.subtitles)
|
||||||
trash = json.dumps(self.trash)
|
trash = json.dumps(self.trash)
|
||||||
@@ -149,7 +149,7 @@ class strayEpisode(object):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
def getDirContent(dir=env.show_dir):
|
def getDirContent(dir=env.input_dir):
|
||||||
# TODO What if item in db is not in this list?
|
# 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] != '.']
|
||||||
@@ -189,12 +189,12 @@ def XOR(list1, list2):
|
|||||||
|
|
||||||
def filterChildItems(parent):
|
def filterChildItems(parent):
|
||||||
try:
|
try:
|
||||||
children = getDirContent('/'.join([env.show_dir, parent]))
|
children = getDirContent('/'.join([env.input_dir, parent]))
|
||||||
if children:
|
if children:
|
||||||
strayEpisode(parent, children)
|
strayEpisode(parent, children)
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
# TODO Log to error file
|
# TODO Log to error file
|
||||||
logging.info('Error: "' + '/'.join([env.show_dir, parent]) + '" is not a valid directory.')
|
logging.info('Error: "' + '/'.join([env.input_dir, parent]) + '" is not a valid directory.')
|
||||||
|
|
||||||
def getNewItems():
|
def getNewItems():
|
||||||
newItems = XOR(getDirContent(), getShowNames())
|
newItems = XOR(getDirContent(), getShowNames())
|
||||||
@@ -221,3 +221,4 @@ if __name__ == '__main__':
|
|||||||
while True:
|
while True:
|
||||||
main()
|
main()
|
||||||
sleep(30)
|
sleep(30)
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ class PlexRepository {
|
|||||||
|
|
||||||
searchMedia(query) {
|
searchMedia(query) {
|
||||||
var options = {
|
var options = {
|
||||||
uri: 'http://10.0.0.41:32400/search?query=' + query,
|
uri: 'http://10.0.0.42:32400/search?query=' + query,
|
||||||
headers: {
|
headers: {
|
||||||
'Accept': 'application/json'
|
'Accept': 'application/json'
|
||||||
},
|
},
|
||||||
@@ -53,4 +53,4 @@ class PlexRepository {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = PlexRepository;
|
module.exports = PlexRepository;
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ router.use(function(req, res, next) {
|
|||||||
res.setHeader('Access-Control-Allow-Origin', origin);
|
res.setHeader('Access-Control-Allow-Origin', origin);
|
||||||
}
|
}
|
||||||
res.header('Access-Control-Allow-Headers', 'Content-Type, Authorization');
|
res.header('Access-Control-Allow-Headers', 'Content-Type, Authorization');
|
||||||
res.header('Access-Control-Allow-Methods', 'POST, GET', 'PUT');
|
res.header('Access-Control-Allow-Methods', 'POST, GET, PUT');
|
||||||
|
|
||||||
next();
|
next();
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user