示例#1
0
 def POST(self): 
     form = config_form()
     result = db.getOAuthConnectionDetails(db.getConn(core.configobj))
     token = result[0]
     secret = result[1]
     smugmug.set_oauth_token(token, secret)
     
     if not form.validates(): 
         return self._GET(smugmug, form, False, form.value['root_dir'],form.value['log_dir'],form.value['data_dir'],form.value['start_time_hour']+':'+form.value['start_time_minute'])
     else:
         try:
             if smugmug.oauth_token == None:
                 smugmug.auth_getAccessToken()
         except smugpy.SmugMugException:
             return self._GET(smugmug, form, True, form.value['root_dir'],form.value['log_dir'],form.value['data_dir'],form.value['start_time_hour']+':'+form.value['start_time_minute'])
         else:
             #self.first = False
             core.configobj.picture_root  = form.value['root_dir']
             core.configobj.log_dir = form.value['log_dir']
             core.configobj.data_dir = form.value['data_dir']
             core.configobj.start_time = form.value['start_time_hour']+':'+form.value['start_time_minute']
             core.configobj.saveConfig()
             myLogger.info("Config file Created.")
             db.initDb(core.configobj)
             myLogger.info("Database started.")
             db.setOAuthConnectionDetails(db.getConn(core.configobj), smugmug.oauth_token, smugmug.oauth_token_secret)
             return self._GET(smugmug, form, False, core.configobj.picture_root, core.configobj.log_dir, core.configobj.data_dir,core.configobj.start_time)
示例#2
0
 def GET(self):
     form = config_form()
     result = db.getOAuthConnectionDetails(db.getConn(core.configobj))
     token = result[0]
     secret = result[1]
     smugmug.set_oauth_token(token, secret)
     return self._GET(smugmug, form, False, core.configobj.picture_root, core.configobj.log_dir, core.configobj.data_dir,core.configobj.start_time)
示例#3
0
 def GET(self):
     messages =["Passed along request to upload images."]
     lock = multiprocessing.Lock()
     result = db.getOAuthConnectionDetails(db.getConn(core.configobj))
     token = result[0]
     secret = result[1]
     smugmug.set_oauth_token(token, secret)
     core.smugmugupload.start(smugmug, core.configobj, lock)
     return json.dumps(messages)
示例#4
0
 def GET(self):
     lock = multiprocessing.Lock()
     result = db.getOAuthConnectionDetails(db.getConn(core.configobj))
     token = result[0]
     secret = result[1]
     smugmug.set_oauth_token(token, secret)
     core.smugmugscan.start(smugmug, core.configobj, lock)
     web.header('Content-Type', 'application/json')
     messages =["Passed along request to Scan SmugMug."]
     return json.dumps(messages)
示例#5
0
 def __init__(self, queue, conn, configobj, smugmug, lock):
     threading.Thread.__init__(self)
     self._queue = queue
     self._conn = conn
     self._configobj = configobj
     self._lock = lock
     self._smugmug = smugpy.SmugMug(api_key=core.API_KEY, oauth_secret=core.OAUTH_SECRET, api_version="1.3.0", app_name="Smuggler")
     result = db.getOAuthConnectionDetails(db.getConn(self._configobj))
     token = result[0]
     secret = result[1]
     self._smugmug.set_oauth_token(token, secret)
     self._run = True