comparison python/storage.py @ 665:15e244d2a1b5

corrected bug with circular import for VideoFilenameAddable, moved to base module
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Wed, 20 May 2015 13:57:47 +0200
parents 455f9b93819c
children da1352b89d02
comparison
equal deleted inserted replaced
664:455f9b93819c 665:15e244d2a1b5
1 #! /usr/bin/env python 1 #! /usr/bin/env python
2 # -*- coding: utf-8 -*- 2 # -*- coding: utf-8 -*-
3 '''Various utilities to save and load data''' 3 '''Various utilities to save and load data'''
4 4
5 import utils, moving, events, indicators 5 import utils, moving, events, indicators
6 from base import VideoFilenameAddable
6 7
7 import sqlite3, logging 8 import sqlite3, logging
8
9 __metaclass__ = type
10 9
11 10
12 commentChar = '#' 11 commentChar = '#'
13 12
14 delimiterChar = '%'; 13 delimiterChar = '%';
865 864
866 ######################### 865 #########################
867 # Utils to read .ini type text files for configuration, meta data... 866 # Utils to read .ini type text files for configuration, meta data...
868 ######################### 867 #########################
869 868
870 class VideoFilenameAddable:
871 'Base class with the capability to attach a video filename'
872
873 def setVideoFilename(self, videoFilename):
874 self.videoFilename = videoFilename
875
876
877 class ProcessParameters(VideoFilenameAddable): 869 class ProcessParameters(VideoFilenameAddable):
878 '''Class for all parameters controlling data processing: input, 870 '''Class for all parameters controlling data processing: input,
879 method parameters, etc. for tracking, classification and safety 871 method parameters, etc. for tracking, classification and safety
880 872
881 Note: framerate is already taken into account''' 873 Note: framerate is already taken into account'''
927 919
928 def __init__(self, filename = None): 920 def __init__(self, filename = None):
929 if filename is not None: 921 if filename is not None:
930 self.loadConfigFile(filename) 922 self.loadConfigFile(filename)
931 923
932 class SceneParameters: 924 class SceneParameters(object):
933 def __init__(self, config, sectionName): 925 def __init__(self, config, sectionName):
934 from ConfigParser import NoOptionError 926 from ConfigParser import NoOptionError
935 from ast import literal_eval 927 from ast import literal_eval
936 try: 928 try:
937 self.sitename = config.get(sectionName, 'sitename') 929 self.sitename = config.get(sectionName, 'sitename')