Пример #1
0
def getGuildPointForSQL(clear=False):
    session = s.cnnf()
    countInDb = session.query(s.gpHistory).filter(s.gpHistory.gpDate==datetime.date.today()).count()
    if countInDb > 0 and clear==False:
        return False
    elif countInDb > 0 and clear:
        session.query(s.gpHistory).filter(s.gpHistory.gpDate==datetime.date.today()).delete()
        session.commit()
    else:
        pass

    response = requests.request('GET',r'https://www.ffxiah.com/guild-pattern')
    soup = bs4.BeautifulSoup(response.text, 'html.parser')
    table = soup.find('table',class_='tbl-gpi')
    rows = table.findAll('tr')
    craftOrder = {0:'Header',1:'Alchemy',2:'Bonecraft',3:'Clothcraft',4:'Cooking',5:'Fishing',6:'Goldsmithing',7:'Leathercraft',8:'Smithing',9:'Woodworking'}
    rankOrder = {1:'Novice',2:'Apprentice',3:'Journeyman',4:'Craftsman',5:'Artisan',6:'Adept',7:'Veteran'}
    rowNum = 1
    for row in rows[1:]:
        colNum = 1
        fields = row.findAll('td')
        for field in fields[1:]:
            gpRec = s.gpHistory()
            gpRec.craft = craftOrder[rowNum]
            gpRec.gpDate = datetime.date.today()
            gpRec.guildRankNum = colNum
            gpRec.guildRank = rankOrder[colNum]
            gpRec.itemid = int(field.find('a').attrs['href'].split('/')[4])
            session.add(gpRec)
            colNum += 1
        rowNum += 1
    session.commit()
    session.close()
    return True
Пример #2
0
 def __init__(self, override=False):
     self.session = s.cnnf()
     self.config = config()
     self.pid = os.getpid()
     if self.config['runningPID'] != '0' and override==False:
         raise 'Already running on <PID> %s' % self.config['runningPID']
     else:
         self.config['runningPID'] = self.pid
Пример #3
0
def getByPlayer(playerName, serverName='Bahamut'):
    response = requests.request('GET','https://www.ffxiah.com/player/%s/%s' % (serverName,playerName) )
    tx = response.text
    salesIdx = tx.find('Player.sales')
    if salesIdx == -1:
        return False
    end = tx[salesIdx:].find(';')
    arrObj = tx[salesIdx:salesIdx+end]
    jasonStr = arrObj[arrObj.find('=')+2:]
    salesList = json.loads(jasonStr)
    return s.addPlayerSales(salesList, playerName, s.cnnf())
Пример #4
0
def getByItem(itemId, stack=0):
    #todo determine stack or single 
    if stack== 0:
        response = requests.request('GET','https://www.ffxiah.com/item/%s' % itemId)
    else:
        response = requests.request('GET','https://www.ffxiah.com/item/%s?stack=1' % itemId)
    tx = response.text
    salesIdx = tx.find('Item.sales')
    end = tx[salesIdx:].find(';')
    arrObj = tx[salesIdx:salesIdx+end]
    jsonStr = arrObj[arrObj.find('=')+2:]
    salesList = json.loads(jsonStr)
    soup = bs4.BeautifulSoup(tx,'html.parser')
    stockVal = soup.findAll('table',class_='stdtbl')[0].findAll('tr')[3].findAll('td')[1].getText()
    return s.addSales(salesList, s.cnnf(), itemId, stack), stockVal
Пример #5
0
import ffxi_sql
import ffxi_sql_initData

import os
from pprint import pprint
import datetime
import tksFlags


session = ffxi_sql.cnnf()

#prepBatch
filePath = r'C:\Users\wong1\Desktop\Ashita\plugins\Packets'
fileBase = r'C:\Users\wong1\Desktop\Ashita\plugins'
finishedPath = r'C:\Users\wong1\Desktop\Ashita\plugins\Packets\Processed'

def findFiles(strExt, addExt, condition=lambda x: True):
    for root, dirs, files in os.walk(filePath):
        fileList = []
        for file in files:
            if file.endswith(strExt) and condition(os.path.join(root, file)):
                fileList.append(os.path.join(root, file))
        for file in fileList:
            src = file
            dst = file + addExt
            os.rename(src, dst)

#ffxi_sql_initData.init(session)
def fileModifiedYesterday(filename):
    s = os.stat(filename)
Пример #6
0
 def __setitem__(self, key, value):
     session = s.cnnf()
     obj = session.query(s.ffxiah_scanGlobalConfig).filter(key).first()
     obj.configValue = str(value)
     self.config[key] = str(value)
     session.commit()
Пример #7
0
 def __init__(self):
     self.config = {}
     session = s.cnnf()
     configObj = session.query(s.ffxiah_scanGlobalConfig).all()
     for item in configObj:
         self.config[item.configKey] = item.configValue
Пример #8
0
import os
import bs4
import requests
import ffxi_sql as s
from threading import Thread
from time import sleep
import json
import collections
import datetime
import ast

session = s.cnnf()
#functions to get and parse data
def getByItem(itemId, stack=0):
    #todo determine stack or single 
    if stack== 0:
        response = requests.request('GET','https://www.ffxiah.com/item/%s' % itemId)
    else:
        response = requests.request('GET','https://www.ffxiah.com/item/%s?stack=1' % itemId)
    tx = response.text
    salesIdx = tx.find('Item.sales')
    end = tx[salesIdx:].find(';')
    arrObj = tx[salesIdx:salesIdx+end]
    jsonStr = arrObj[arrObj.find('=')+2:]
    salesList = json.loads(jsonStr)
    soup = bs4.BeautifulSoup(tx,'html.parser')
    stockVal = soup.findAll('table',class_='stdtbl')[0].findAll('tr')[3].findAll('td')[1].getText()
    return s.addSales(salesList, s.cnnf(), itemId, stack), stockVal

def getByPlayer(playerName, serverName='Bahamut'):
    response = requests.request('GET','https://www.ffxiah.com/player/%s/%s' % (serverName,playerName) )