From a5920a9c9ce200cf99c5d5f01e47a07c823b7cc6 Mon Sep 17 00:00:00 2001 From: blitzmann Date: Sat, 24 Oct 2015 16:46:45 -0400 Subject: [PATCH] Added missing files (and fix why they were missing) --- .gitignore | 2 +- eos/db/saveddata/crest.py | 31 ++++++++++++++++++++++++++ eos/saveddata/crest.py | 47 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 eos/db/saveddata/crest.py create mode 100644 eos/saveddata/crest.py diff --git a/.gitignore b/.gitignore index 96e9e15a3..13032ec18 100644 --- a/.gitignore +++ b/.gitignore @@ -13,7 +13,7 @@ *.patch #Personal -saveddata/ +/saveddata/ #PyCharm .idea/ diff --git a/eos/db/saveddata/crest.py b/eos/db/saveddata/crest.py new file mode 100644 index 000000000..af8fba88e --- /dev/null +++ b/eos/db/saveddata/crest.py @@ -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 . +#=============================================================================== + +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) diff --git a/eos/saveddata/crest.py b/eos/saveddata/crest.py new file mode 100644 index 000000000..bb43d7664 --- /dev/null +++ b/eos/saveddata/crest.py @@ -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 . +#=============================================================================== + +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) +