示例#1
0
def run_match():
    setup_all(True)

    sets = os.listdir(config.base_magic_set_dir)
    base_dir = config.base_magic_set_dir
    known = match_card.load_sets(base_dir, sets)
    cache = match_card.GradientCache(base_dir)
    print "all sets loaded!"

    cv.NamedWindow('debug')
    cv.StartWindowThread()
    match_card.match_db_cards(known, cache)
示例#2
0
import match_card
import cv
from models import InvCard
from elixir import setup_all, session
from sqlalchemy import distinct


if __name__ == '__main__':
	setup_all()

	sets = [s[0] for s in session.query(distinct(InvCard.set_name)).filter(InvCard.set_name != 'PROMO').all()]
	base_dir = u'/home/talin/Cockatrice/cards/downloadedPics'
	known = match_card.load_sets(base_dir, sets)
	cache = match_card.GradientCache(base_dir)
	print "all sets loaded!"

	cv.NamedWindow('debug')
	cv.StartWindowThread()
	match_card.match_db_cards(known, cache)
示例#3
0
"AVR", "P3", "EVG", "M12", "AQ", "A", "SHM", "M11", "V09", "4E", 
"ARC", "SC", "IN", "DIS", "ZEN", "VI", "SOK", "CMD", "RAV", "UNH", 
"UG", "GP", "PLC", "DGM", "DS", "V11", "NE", "LE", "MR", "RTR", 
"NPH", "H09", "TSP", "MI", "PD3", "AP", "CM1", "CFX", "6E", "DK", 
"HOP", "SOM", "ST", "PS", "DD2", "FD", "DKA", "DDG", "ARB", "SH", 
"CS", "PD2", "10E", "AL", "EX", "FE", "BOK", "BD", "MBS", "DDF", 
"EVE", "LG", "7E", "GTC", "UL", "TE", "DDD", "IA", "AN", "OD", 
"V12", "P2", "TO", "TSB", "WL", "LRW", "CHK", "8E", "MOR", "PY", 
"DDK", "MMA"
]

# Load the sets
known = load_set_cache(SET_CACHE_FILE)
if known is None:
	print "Processing magic sets"
	known = match_card.load_sets(BASE_SET_DIR, SETS)
	print "Saving sets to cache file %s" % (SET_CACHE_FILE)
	save_set_cache(SET_CACHE_FILE, known)
print "Magic sets loaded and ready"

cam = cv.CreateCameraCapture(-1)	# Camera, -1 indicates autofind
#cam = cv.CreateCameraCapture(1)
# TODO: detect failed to load camera, CAN NOT simply check if cam is None

scan_card.setup_windows() # win, snapshot, match, background
tts = TTS()		# Load test to speech festival
cache = match_card.GradientCache(BASE_SET_DIR)	# memory cache
scanCard = ScanCard(cam)
matchCard = MatchCard(BASE_SET_DIR)
csv = MagicAssistantCSV(CSV_FILE, append=True)
示例#4
0
This program 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 General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
"""

import match_card
import cv
from models import InvCard
from elixir import setup_all, session
from sqlalchemy import distinct
import config

import os

if __name__ == '__main__':
	setup_all(True)

	sets = os.listdir(config.base_magic_set_dir)
	base_dir = config.base_magic_set_dir
	known = match_card.load_sets(base_dir, sets)
	cache = match_card.GradientCache(base_dir)
	print "all sets loaded!"

	cv.NamedWindow('debug')
	cv.StartWindowThread()
	match_card.match_db_cards(known, cache)
示例#5
0
    "V10", "DDE", "FUT", "WWK", "9E", "DDH", "BRB", "AVR", "P3", "EVG", "M12",
    "AQ", "A", "SHM", "M11", "V09", "4E", "ARC", "SC", "IN", "DIS", "ZEN",
    "VI", "SOK", "CMD", "RAV", "UNH", "UG", "GP", "PLC", "DGM", "DS", "V11",
    "NE", "LE", "MR", "RTR", "NPH", "H09", "TSP", "MI", "PD3", "AP", "CM1",
    "CFX", "6E", "DK", "HOP", "SOM", "ST", "PS", "DD2", "FD", "DKA", "DDG",
    "ARB", "SH", "CS", "PD2", "10E", "AL", "EX", "FE", "BOK", "BD", "MBS",
    "DDF", "EVE", "LG", "7E", "GTC", "UL", "TE", "DDD", "IA", "AN", "OD",
    "V12", "P2", "TO", "TSB", "WL", "LRW", "CHK", "8E", "MOR", "PY", "DDK",
    "MMA"
]

# Load the sets
known = load_set_cache(SET_CACHE_FILE)
if known is None:
    print "Processing magic sets"
    known = match_card.load_sets(BASE_SET_DIR, SETS)
    print "Saving sets to cache file %s" % (SET_CACHE_FILE)
    save_set_cache(SET_CACHE_FILE, known)
print "Magic sets loaded and ready"

cam = cv.CreateCameraCapture(-1)  # Camera, -1 indicates autofind
#cam = cv.CreateCameraCapture(1)
# TODO: detect failed to load camera, CAN NOT simply check if cam is None

scan_card.setup_windows()  # win, snapshot, match, background
tts = TTS()  # Load test to speech festival
cache = match_card.GradientCache(BASE_SET_DIR)  # memory cache
scanCard = ScanCard(cam)
matchCard = MatchCard(BASE_SET_DIR)
csv = MagicAssistantCSV(CSV_FILE, append=True)