diff options
author | emkael <emkael@tlen.pl> | 2017-07-31 20:45:13 +0200 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2017-07-31 20:45:13 +0200 |
commit | bd5fd6a6596dd7625019c6c0f0ff043597cda837 (patch) | |
tree | 809a4ae96291a50fbf87e9dded7c946591163297 /playoff | |
parent | 85d798ae2eeab73062303f1561c58f23e84d29da (diff) |
Renaming module to avoid ambiguity
Diffstat (limited to 'playoff')
-rw-r--r-- | playoff/__init__.py | 0 | ||||
-rw-r--r-- | playoff/db.py | 19 | ||||
-rw-r--r-- | playoff/settings.py | 31 | ||||
-rw-r--r-- | playoff/sql.py | 34 | ||||
-rw-r--r-- | playoff/template.py | 128 |
5 files changed, 0 insertions, 212 deletions
diff --git a/playoff/__init__.py b/playoff/__init__.py deleted file mode 100644 index e69de29..0000000 --- a/playoff/__init__.py +++ /dev/null diff --git a/playoff/db.py b/playoff/db.py deleted file mode 100644 index aa0c2e2..0000000 --- a/playoff/db.py +++ /dev/null @@ -1,19 +0,0 @@ -import mysql.connector - -class PlayoffDB(object): - - db_cursor = None - - def __init__(self, settings): - self.database = mysql.connector.connect( - user=settings['user'], - password=settings['pass'], - host=settings['host'], - port=settings['port'] - ) - self.db_cursor = self.database.cursor(buffered=True) - - def fetch(self, db, sql, params): - self.db_cursor.execute(sql.replace('#db#', db), params) - row = self.db_cursor.fetchone() - return row diff --git a/playoff/settings.py b/playoff/settings.py deleted file mode 100644 index dd7399d..0000000 --- a/playoff/settings.py +++ /dev/null @@ -1,31 +0,0 @@ -import glob, json, os, readline, sys - -def complete_filename(text, state): - return (glob.glob(text+'*')+[None])[state] - -class PlayoffSettings: - - def __init__(self): - self.interactive = False - if len(sys.argv) > 1: - settings_file = sys.argv[1] - else: - self.interactive = True - readline.set_completer_delims(' \t\n;') - readline.parse_and_bind("tab: complete") - readline.set_completer(complete_filename) - settings_file = raw_input('JSON settings file: ') - - if not os.path.exists(settings_file): - raise IOError('Settings file %s not found' % settings_file) - - self.settings = json.load(open(settings_file)) - - def has_section(self, key): - return key in self.settings - - def get(self, *keys): - section = self.settings - for key in keys: - section = section[key] - return section diff --git a/playoff/sql.py b/playoff/sql.py deleted file mode 100644 index 76ea728..0000000 --- a/playoff/sql.py +++ /dev/null @@ -1,34 +0,0 @@ -MATCH_RESULTS = ''' -SELECT t1.fullname, t2.fullname, matches.carry, matches.vph, matches.vpv, matches.corrh, matches.corrv -FROM #db#.matches matches -JOIN #db#.teams t1 - ON t1.id = #db#.matches.homet -JOIN #db#.teams t2 - ON t2.id = #db#.matches.visit -WHERE matches.tabl = %s AND matches.rnd = %s -''' - -BOARD_COUNT = ''' -SELECT segmentsperround*boardspersegment, SUM(sc1.contract IS NOT NULL AND sc2.contract IS NOT NULL) -FROM #db#.scores sc1 -JOIN #db#.scores sc2 - ON sc1.rnd = sc2.rnd - AND sc1.segment = sc2.segment - AND sc1.tabl = sc2.tabl - AND sc1.board = sc2.board - AND sc1.room = 1 - AND sc2.room = 2 -JOIN #db#.admin -WHERE sc1.tabl = %s AND sc1.rnd = %s -''' - -TOWEL_COUNT = ''' -SELECT #db#.admin.boardspersegment * SUM(#db#.segments.towel > 0) -FROM #db#.segments -JOIN #db#.admin -WHERE #db#.segments.tabl = %s AND #db#.segments.rnd = %s -''' - -PREFIX = ''' -SELECT shortname FROM #db#.admin -''' diff --git a/playoff/template.py b/playoff/template.py deleted file mode 100644 index 8713ab9..0000000 --- a/playoff/template.py +++ /dev/null @@ -1,128 +0,0 @@ -#encoding=utf-8 - -MATCH_TABLE = ''' -<table border="0" cellspacing="0"> -<tr> -<td class="s12" width="%d"> </td> -<td class="bdcc2" width="%d"> wynik </td> -</tr> -%s -</table> -''' - -MATCH_TEAM_ROW = ''' -<tr class="%s"> -<td class="bd1"> <a href="%s" onmouseover="Tip('%s')" onmouseout="UnTip()">%s</a> </td> -<td class="bdc"> -<a href="%s" target="_top"> - %.1f -</a> -</td> -</tr> -''' - -MATCH_RUNNING = ''' -<a href="%s" target="_top"> -<img src="images/A.gif" /> -%d -<img src="images/A.gif" /> -</a> -''' - -MATCH_GRID = ''' -<div style="position: relative; width: %dpx; height: %dpx; margin: 10px"> -<canvas width="%d" height="%d" id="playoff_canvas" %s></canvas> -%s -<script src="sklady/playoff.js" type="text/javascript"></script> -</div> -''' - -MATCH_GRID_PHASE = ''' -<a href="%s" target="_top" style="display: inline-block; width: %dpx; text-align: center; position: absolute; top: 0; left: %dpx"> -<font size="4">%s</font> -</a> -''' - -MATCH_GRID_PHASE_RUNNING = ''' -<a href="%s" target="_top" style="display: inline-block; width: %dpx; text-align: center; position: absolute; top: 0; left: %dpx"> -<img src="images/A.gif" /> -<font size="4">%s</font> -<img src="images/A.gif" /> -</a> -''' - -MATCH_BOX = ''' -<div style="text-align: center; position: absolute; left: %dpx; top: %dpx" data-id="%d" data-winner="%s" data-loser="%s" class="playoff_matchbox"> -%s -</div> -''' - -LEADERBOARD = ''' -<table border="0" cellspacing="0"> -<tr> -<td class="bdnl12" colspan="2" align="center"><b> KLASYFIKACJA KOŃCOWA </b></td> -</tr> -<tr> -<td class="e" colspan="2"> </td> -</tr> -<tr> -<td class="bdcc12"> miejsce </td> -<td class="bdcc2"> drużyna </td> -</tr> -%s -</table> -''' - -LEADERBOARD_ROW = ''' -<tr> -<td class="bdc1">%d</td> -<td class="bd"> - %s %s -</td> -</tr> -''' - -LEADERBOARD_ROW_FLAG = ''' -<img class="fl" src="images/%s" /> -''' - -PAGE_HEAD = ''' -<meta http-equiv="Pragma" content="no-cache" /> -<meta http-equiv="Cache-Control" content="no-cache" /> -<meta name="robots" content="noarchive" /> -<meta http-equiv="expires" content="0" /> -<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> -<meta name="Generator" content="PlayOff" /> -%s -<title>%s</title> -<link rel="stylesheet" type="text/css" href="css/kolorki.css" /> -<script type="text/javascript" src="sklady/myAjax.js"></script> -''' - -PAGE_HEAD_REFRESH = ''' -<meta http-equiv="Refresh" content="%d" /> -''' - -PAGE_BODY = ''' -<script type="text/javascript" src="sklady/wz_tooltip.js"></script> -%s -%s -%s -%s -''' - -PAGE_BODY_FOOTER = ''' -<p class="f"> Admin ©Jan Romański'2005, PlayOff ©Michał Klichowicz'2017, strona wygenerowana %s</p> -''' - -PAGE = ''' -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> -<html> -<head> -%s -</head> -<body class="all"> -%s -</body> -</html> -''' |