Added missing files (and fix why they were missing)

This commit is contained in:
blitzmann
2015-10-24 16:46:45 -04:00
parent c103e563a9
commit a5920a9c9c
3 changed files with 79 additions and 1 deletions

2
.gitignore vendored
View File

@@ -13,7 +13,7 @@
*.patch
#Personal
saveddata/
/saveddata/
#PyCharm
.idea/

31
eos/db/saveddata/crest.py Normal file
View File

@@ -0,0 +1,31 @@
#===============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of eos.
#
# eos is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# eos is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with eos. If not, see <http://www.gnu.org/licenses/>.
#===============================================================================
from sqlalchemy import Table, Column, Integer, String, Boolean
from sqlalchemy.orm import mapper
from eos.db import saveddata_meta
from eos.types import Crest
crest_table = Table("crest", saveddata_meta,
Column("ID", Integer, primary_key = True),
Column("name", String, nullable = False, unique = True),
Column("refresh_token", String, nullable = False))
mapper(Crest, crest_table)

47
eos/saveddata/crest.py Normal file
View File

@@ -0,0 +1,47 @@
#===============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of eos.
#
# eos is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# eos is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with eos. If not, see <http://www.gnu.org/licenses/>.
#===============================================================================
from sqlalchemy.orm import reconstructor
import pycrest
import config
from pycrest import EVE
from tomorrow import threads
import urllib
from cStringIO import StringIO
class Crest(object):
def __init__(self, id, name, refresh_token=None):
self.ID = id
self.name = name
self.refresh_token = refresh_token
@reconstructor
def init(self):
pass
@threads(1)
def fetchImage(self):
url = 'https://image.eveonline.com/character/%d_128.jpg'%self.ID
fp = urllib.urlopen(url)
data = fp.read()
fp.close()
self.img = StringIO(data)