From ea777b47190b628521787b1ac391aeda8becbbbc Mon Sep 17 00:00:00 2001 From: Squandor Date: Wed, 4 Jan 2017 11:47:10 +0100 Subject: [PATCH] changed some code tweaks and plugin updates --- modules/api.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/modules/api.py b/modules/api.py index e16ef7d..caf9f90 100644 --- a/modules/api.py +++ b/modules/api.py @@ -3,7 +3,7 @@ from flask import request from flaskext.auth import login_required -from git import Repo +import git import security import requests, json, re import os, sys, imp, shutil @@ -260,10 +260,15 @@ def indexPlugins(params={}): os.makedirs(tmpFolder) if not os.path.exists(indexFolderPath): os.makedirs(indexFolderPath) + + if not os.path.isfile(indexFolderPath + 'README.md'): + shutil.rmtree(indexFolderPath) + try: + git.Repo.clone_from("https://github.com/wez3/domoboard-plugins.git", indexFolderPath) + except: + print 'indexed' else: - shutil.rmtree(indexFolderPath) - os.makedirs(indexFolderPath) - Repo.clone_from("https://github.com/wez3/domoboard-plugins.git", indexFolderPath) + git.cmd.Git(indexFolderPath).pull("https://github.com/wez3/domoboard-plugins.git") folders = filter(lambda x: os.path.isdir(os.path.join(indexFolderPath, x)), os.listdir(indexFolderPath)) return indexPlugins({'action': 'getPlugins'})