Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various reworking and fixes #32

Open
wants to merge 2 commits into
base: chazdazzle
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
File renamed without changes.
File renamed without changes.
202 changes: 101 additions & 101 deletions pyfpdb/Archive.py → Archive.py
Original file line number Diff line number Diff line change
@@ -1,102 +1,102 @@
# -*- coding: UTF-8 -*-
# Copyright 2012, Chaz Littlejohn
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# 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, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
########################################################################
import os, sys
import re
from time import time, sleep
import codecs
import shutil
import subprocess
from IdentifySite import *
class FPDBArchive:
def __init__(self, hand):
self.hid = hand.dbid_hands
self.handText = hand.handText
class Archive():
def __init__(self, config=None, path = None, ftype="hh"):
self.config = config
self.archivePath = None
if config:
self.archivePath = config.imp.archivePath
self.path = path
self.ftype = ftype
self.handList = {}
self.sessionsArchive = {}
self.startCardsArchive = {}
self.positionsArchive = {}
def quickImport(self, userid, filtertype, game, filter, settings, tz): pass
"""Sets up import in 'quick' mode to import the HandsPlayers, HandsActions, and HandsStove records"""
def getSiteSplit(self): pass
"""Returns split string for each site so it can be added back into the handText when writing to archive"""
def fileInfo(self, path, site, filter, filter_name, obj=None, summary=None): pass
"""Sets file site and header info if applicable"""
def addHand(self, hand, write=False): pass
"""Creates a FPDBArchive object for the hand and adds it to the handList dictionary"""
def createSession(self, sid): pass
"""Creates a session directory for a given sessionId"""
def mergeFiles(self, path1, path2): pass
"""Merges two files together in cases where cash sessions need to be combined within a session"""
def mergeSessions(self, oldsid, newsid): pass
"""Merges two session directories together"""
def mergeSubSessions(self, type, sid, oldId, newId, hids): pass
"""Merges two cash session files together"""
def addSessionHands(self, type, sid, id, hids): pass
"""Adds the handText records for a session to the sessionsArchive dictionary and sets the path"""
def addStartCardsHands(self, category, type, startCards, wid, siteId, hids): pass
"""Adds the handText records for startCards to the startCardsArchive dictionary and sets the path"""
def addPositionsHands(self, type, activeSeats, position, wid, siteId, hids): pass
"""Adds the handText records for Positions to the positionsArchive dictionary and sets the path"""
def getFile(self, path): pass
"""Method for creating, appending and or unzipping a file"""
def fileOrZip(self, path): pass
"""Checks to see if the file exists or if the zip file exists. Unzips if necessary"""
def writeHands(self, doinsert): pass
"""Take the hands stored in the sessionsArchive, startCardsArchive, and positionsArchive dictionaries
and write or append those hands to files organized in the archive directory"""
def zipFile(self, path): pass
"""Zip a file for archiving"""
def unzipFile(self, path): pass
"""Unzip a file for import"""
def zipAll(self): pass
"""Recursively zip all the files in the archive directory"""
def unzipAll(self): pass
"""Recursively unzip all the files in the archive directory"""
# -*- coding: UTF-8 -*-
# Copyright 2012, Chaz Littlejohn
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# 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, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

########################################################################

import os, sys
import re
from time import time, sleep
import codecs
import shutil
import subprocess

from IdentifySite import *

class FPDBArchive:
def __init__(self, hand):
self.hid = hand.dbid_hands
self.handText = hand.handText

class Archive():
def __init__(self, config=None, path = None, ftype="hh"):
self.config = config
self.archivePath = None
if config:
self.archivePath = config.imp.archivePath
self.path = path
self.ftype = ftype
self.handList = {}
self.sessionsArchive = {}
self.startCardsArchive = {}
self.positionsArchive = {}

def quickImport(self, userid, filtertype, game, filter, settings, tz): pass
"""Sets up import in 'quick' mode to import the HandsPlayers, HandsActions, and HandsStove records"""

def getSiteSplit(self): pass
"""Returns split string for each site so it can be added back into the handText when writing to archive"""

def fileInfo(self, path, site, filter, filter_name, obj=None, summary=None): pass
"""Sets file site and header info if applicable"""

def addHand(self, hand, write=False): pass
"""Creates a FPDBArchive object for the hand and adds it to the handList dictionary"""

def createSession(self, sid): pass
"""Creates a session directory for a given sessionId"""

def mergeFiles(self, path1, path2): pass
"""Merges two files together in cases where cash sessions need to be combined within a session"""

def mergeSessions(self, oldsid, newsid): pass
"""Merges two session directories together"""

def mergeSubSessions(self, type, sid, oldId, newId, hids): pass
"""Merges two cash session files together"""

def addSessionHands(self, type, sid, id, hids): pass
"""Adds the handText records for a session to the sessionsArchive dictionary and sets the path"""

def addStartCardsHands(self, category, type, startCards, wid, siteId, hids): pass
"""Adds the handText records for startCards to the startCardsArchive dictionary and sets the path"""

def addPositionsHands(self, type, activeSeats, position, wid, siteId, hids): pass
"""Adds the handText records for Positions to the positionsArchive dictionary and sets the path"""

def getFile(self, path): pass
"""Method for creating, appending and or unzipping a file"""

def fileOrZip(self, path): pass
"""Checks to see if the file exists or if the zip file exists. Unzips if necessary"""

def writeHands(self, doinsert): pass
"""Take the hands stored in the sessionsArchive, startCardsArchive, and positionsArchive dictionaries
and write or append those hands to files organized in the archive directory"""

def zipFile(self, path): pass
"""Zip a file for archiving"""

def unzipFile(self, path): pass
"""Unzip a file for import"""

def zipAll(self): pass
"""Recursively zip all the files in the archive directory"""

def unzipAll(self): pass
"""Recursively unzip all the files in the archive directory"""


File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading