Ejemplo n.º 1
0
from xml.etree.ElementTree import Element, SubElement, iterparse
import unittest
from StringIO import StringIO

from JSI.RichMetadata.RichMetadata import RichMetadataGenerator, __revision__
from JSI.RichMetadata.conf import metadata
from JSI.RichMetadata.utils import log
from JSI.RichMetadata.utils.TimeSeries import StatisticTimeSeries

loglevel = log.INFO
runspeed = True

_log = log.getLog('RichMetadataTest')
log.setLevel(loglevel)

# For development purposes
llA = loglevel
llB = loglevel
llC = loglevel
llD = loglevel
llE = loglevel
llF = loglevel
llG = loglevel
llH = loglevel
llI = loglevel
llJ = loglevel

class RichMetadataTest(unittest.TestCase):
    """ 
    RichMetadata testing framework 
    """
Ejemplo n.º 2
0
import os
import sys
from optparse import OptionParser, OptionGroup

from JSI.RichMetadata.RichMetadata import RichMetadataGenerator, __revision__
from JSI.RichMetadata.conf import metadata
from JSI.RichMetadata.utils import log

_log = log.getLog('metagen')
log.setLevel(log.ERROR)

class MetaGen(object):

    def __init__(self):
        self.rmm = RichMetadataGenerator.getInstance()
        self.parser = None
        self.options = None
        self.metadataType = None
        self.meta = None
        self.setValue = False

    def run(self):
        """
        Runs the metagen tool and returns generated rich metadata on std out
        """
        if options.payments:
            self.metadataType = metadata.METADATA_PAYMENT
        if options.advertising:
            self.metadataType = metadata.METADATA_ADVERTISING
        if options.scalability:
            self.metadataType = metadata.METADATA_SCALABILITY
Ejemplo n.º 3
0
from xml.etree.cElementTree import Element, SubElement, iterparse, tostring
#from xml.etree.ElementTree import Element, SubElement, iterparse, tostring
from os import path
from threading import RLock
from cStringIO import StringIO

from JSI.RichMetadata.conf import metadata
from JSI.RichMetadata.utils import log

__author__ = 'D. Gabrijelcic ([email protected])'
__revision__ = '0.35'
__all__ = ['RichMetadataGenerator', '__revision__']

_log = log.getLog('RichMetadata')
log.setLevel(log.INFO, "RichMetadata")

class RichMetadataGenerator(object):

    __single = None
    __lock = RLock()

    def __init__(self):
        if RichMetadataGenerator.__single:
            raise RuntimeError, "RichMetadataGenerator is Singleton"
        RichMetadataGenerator.__single = self
        self.knownTypes = metadata.BASE_FORMAT_TYPES
        # Learn bases
        self.learnBase = metadata.LEARN_BASE_CORE
        self.learnBaseOptional = metadata.LEARN_BASE_OPTIONAL
        self.master = dict()
        # Tag sets