Esempio n. 1
0
def createIndicoLink(IndicoID, CDSID):
    """Create a link in Indico to the CDS record."""

#    Logger.get('RecMan').debug("in createIndicoLink()")
    # From IndicoID, get info
    try:
        talkInfo = parseIndicoID(IndicoID)
    except NoReportError:
        return False
    obj = talkInfo["object"]

    # Only one link per talk allowed.
    if doesExistIndicoLink(obj):
        return True # consider it a success anyway
    else:
#        Logger.get('RecMan').info("creating a new link in Indico for talk %s, CDS record %s" % (IndicoID, CDSID))

        # material object holds link object.
        # First create a material object with title "Video in CDS" or whatever the current text is.
        material = conference.Material()
        material.setTitle(CollaborationTools.getOptionValue("RecordingManager", "videoLinkName"))
        videoLink = Link()
        videoLink.setOwner(material)
#    I don't think this stuff is necessary:
#        videoLink.setName("Name goes here")
#        videoLink.setDescription("Description goes here")
        videoLink.setURL(CollaborationTools.getOptionValue("RecordingManager", "CDSBaseURL") % str(CDSID))
        material.addResource(videoLink)
        material.setMainResource(videoLink)
        obj.addMaterial(material)
        return True
Esempio n. 2
0
    def generateCDSCategoryXML(cls, out, obj):
        """Determine if this record should belong to any particular CDS categories,
        based on the recursive list of owners and Recording Manager options.
        This will become MARC tag 980__a after XSL transformation."""

        # Each Indico category may be associated with up to 1 CDS categories,
        # but multiple Indico categories may be associated with the same CDS category.
        listCDSCategories = []

        # Get every successive owner of this object up to the root category.
        # If this object is more than 20 levels deep that would be CRAZY!
        crazyCounter = 0
        while obj is not None and crazyCounter < 20:
            #Logger.get('RecMan').debug("obj id: %s, title: \"%s\"" % (obj.getId(), obj.getTitle()))

            # getId() is not unique for all objects across the database. It is unique for all categories, though,
            # so as long as we are only dealing with categories it's ok.
            if CollaborationTools.getOptionValue("RecordingManager", "CDSCategoryAssignments").has_key(obj.getId()) \
                and CollaborationTools.getOptionValue("RecordingManager", "CDSCategoryAssignments")[obj.getId()] is not None \
                and isinstance(obj, Category):
                if CollaborationTools.getOptionValue("RecordingManager", "CDSCategoryAssignments")[obj.getId()] not in listCDSCategories:
                    listCDSCategories.append(CollaborationTools.getOptionValue("RecordingManager", "CDSCategoryAssignments")[obj.getId()])
                    #Logger.get('RecMan').debug("  This one matches! Appending \"%s\"" % CollaborationTools.getOptionValue("RecordingManager", "CDSCategoryAssignments")[obj.getId()])

            obj = obj.getOwner()
            crazyCounter += 1

        # Generate the base XML tags
        if len(listCDSCategories) > 0:
            out.openTag("CDSCategories")
            for category in listCDSCategories:
                out.writeTag("category", category)
            out.closeTag("CDSCategories")
Esempio n. 3
0
    def generateExperimentXML(cls, out, obj):
        """Determine if this record belongs to a particular experiment,
        based on the recursive list of owners and Recording Manager options.
        This will become tag 693__e after XSL transformation."""

        # Each Indico category may be associated with 1 experiment.
        experiment = None

        # Get every successive owner of this object up to the root category, stop if match is found.
        # If this object is more than 20 levels deep that would be CRAZY!
        crazyCounter = 0
        while obj is not None and crazyCounter < 20:
            #Logger.get('RecMan').debug("obj id: %s, title: \"%s\"" % (obj.getId(), obj.getTitle()))

            # getId() is not unique for all objects across the database. It is unique for all categories, though,
            # so as long as we are only dealing with categories it's ok.
            if CollaborationTools.getOptionValue("RecordingManager", "CDSExperimentAssignments").has_key(obj.getId()) \
                and CollaborationTools.getOptionValue("RecordingManager", "CDSExperimentAssignments")[obj.getId()] is not None \
                and isinstance(obj, Category):
                experiment = CollaborationTools.getOptionValue(
                    "RecordingManager",
                    "CDSExperimentAssignments")[obj.getId()]
                #Logger.get('RecMan').debug("  This one matches! Experiment is \"%s\"" % experiment)
                break

            obj = obj.getOwner()
            crazyCounter += 1

        # Generate the base XML tags
        if experiment is not None:
            out.writeTag("CDSExperiment", experiment)
Esempio n. 4
0
def submitMicalaMetadata(aw, IndicoID, contentType, LODBID, LOID, videoFormat,
                         languages):
    '''Generate a lecture.xml file for the given event, then web upload it to the micala server.'''

    #    Logger.get('RecMan').debug('in submitMicalaMetadata()')

    # Initialize success flag, and result string to which we will append any errors.
    flagSuccess = True
    result = ""

    # First update the micala database that we've started this task
    try:
        idMachine = MicalaCommunication.getIdMachine(
            CollaborationTools.getOptionValue("RecordingManager",
                                              "micalaDBMachineName"))
        idTask = MicalaCommunication.getIdTask(
            CollaborationTools.getOptionValue("RecordingManager",
                                              "micalaDBStatusExportMicala"))
        idLecture = LODBID
        #        Logger.get('RecMan').debug('submitMicalaMetadata calling reportStatus...')
        MicalaCommunication.reportStatus('START', '', idMachine, idTask,
                                         idLecture)
    except Exception, e:
        flagSuccess = False
        result += _(
            "Unknown error occured when updating MICALA START task information in micala database: %s\n."
        ) % e
Esempio n. 5
0
    def generateExperimentXML(cls, out, obj):
        """Determine if this record belongs to a particular experiment,
        based on the recursive list of owners and Recording Manager options.
        This will become tag 693__e after XSL transformation."""

        # Each Indico category may be associated with 1 experiment.
        experiment = None

        # Get every successive owner of this object up to the root category, stop if match is found.
        # If this object is more than 20 levels deep that would be CRAZY!
        crazyCounter = 0
        while obj is not None and crazyCounter < 20:
            #Logger.get('RecMan').debug("obj id: %s, title: \"%s\"" % (obj.getId(), obj.getTitle()))

            # getId() is not unique for all objects across the database. It is unique for all categories, though,
            # so as long as we are only dealing with categories it's ok.
            if CollaborationTools.getOptionValue("RecordingManager", "CDSExperimentAssignments").has_key(obj.getId()) \
                and CollaborationTools.getOptionValue("RecordingManager", "CDSExperimentAssignments")[obj.getId()] is not None \
                and isinstance(obj, Category):
                experiment = CollaborationTools.getOptionValue("RecordingManager", "CDSExperimentAssignments")[obj.getId()]
                #Logger.get('RecMan').debug("  This one matches! Experiment is \"%s\"" % experiment)
                break

            obj = obj.getOwner()
            crazyCounter += 1

        # Generate the base XML tags
        if experiment is not None:
            out.writeTag("CDSExperiment", experiment)
Esempio n. 6
0
    def associateIndicoIDToLOID(cls, IndicoID, LODBID):
        """Update the micala DB to associate the given talk with the given LOID"""

        # Initialize success flag and result string
        flagSuccess = True
        result = ""

        #        Logger.get('RecMan').debug("in associateIndicoIDToLOID()")

        try:
            connection = MySQLdb.connect(
                host=CollaborationTools.getOptionValue("RecordingManager",
                                                       "micalaDBServer"),
                port=int(
                    CollaborationTools.getOptionValue("RecordingManager",
                                                      "micalaDBPort")),
                user=CollaborationTools.getOptionValue("RecordingManager",
                                                       "micalaDBUser"),
                passwd=CollaborationTools.getOptionValue(
                    "RecordingManager", "micalaDBPW"),
                db=CollaborationTools.getOptionValue("RecordingManager",
                                                     "micalaDBName"))
        except MySQLdb.Error, e:
            flagSuccess = False
            result += _("MySQL error %d: %s") % (e.args[0], e.args[1])
Esempio n. 7
0
 def getPaperAgreementURL(self):
     recordingFormURL = CollaborationTools.getOptionValue(
         "RecordingRequest", "ConsentFormURL")
     webcastFormURL = CollaborationTools.getOptionValue(
         "WebcastRequest", "ConsentFormURL")
     requestType = CollaborationTools.getRequestTypeUserCanManage(
         self._conf, self._user)
     #return recordingFormURL
     if requestType == 'recording' and recordingFormURL != '':
         return _("""<a href="%s">Paper version</a>.""" % recordingFormURL)
     elif requestType == 'webcast' and webcastFormURL != '':
         return _("""<a href="%s">Paper version</a>.""" % webcastFormURL)
     elif requestType == 'both':
         if recordingFormURL == webcastFormURL and recordingFormURL != '':  #same link, same file
             return _("""<a href="%s">Paper version</a>.""" %
                      recordingFormURL)
         elif recordingFormURL != '' and webcastFormURL != '':
             return _(
                 """<a href="%s">Paper version</a> for the recording request or
                     <a href="%s">Paper version</a> for the webcast request."""
                 % (recordingFormURL, webcastFormURL))
         elif recordingFormURL != '':
             return _("""<a href="%s">Paper version</a>.""" %
                      recordingFormURL)
         elif webcastFormURL != '':
             return _("""<a href="%s">Paper version</a>.""" %
                      webcastFormURL)
         else:
             return _("""<No agreement link available>.""")
     else:
         return _("""<No agreement link available>.""")
Esempio n. 8
0
def createIndicoLink(IndicoID, CDSID):
    """Create a link in Indico to the CDS record."""

    #    Logger.get('RecMan').debug("in createIndicoLink()")
    # From IndicoID, get info
    try:
        talkInfo = parseIndicoID(IndicoID)
    except NoReportError:
        return False
    obj = talkInfo["object"]

    # Only one link per talk allowed.
    if doesExistIndicoLink(obj):
        return True  # consider it a success anyway
    else:
        #        Logger.get('RecMan').info("creating a new link in Indico for talk %s, CDS record %s" % (IndicoID, CDSID))

        # material object holds link object.
        # First create a material object with title "Video in CDS" or whatever the current text is.
        material = conference.Material()
        material.setTitle(
            CollaborationTools.getOptionValue("RecordingManager",
                                              "videoLinkName"))
        videoLink = Link()
        videoLink.setOwner(material)
        #    I don't think this stuff is necessary:
        #        videoLink.setName("Name goes here")
        #        videoLink.setDescription("Description goes here")
        videoLink.setURL(
            CollaborationTools.getOptionValue("RecordingManager", "CDSBaseURL")
            % str(CDSID))
        material.addResource(videoLink)
        material.setMainResource(videoLink)
        obj.addMaterial(material)
        return True
Esempio n. 9
0
    def updateMicalaCDSExport(cls, cds_indico_matches, cds_indico_pending):
        '''If there are records found in CDS but not yet listed in the micala database as COMPLETE, then update it.
        cds_indico_matches is a dictionary of key-value pairs { IndicoID1: CDSID1, IndicoID2: CDSID2, ... }
        cds_indico_pending is a list of IndicoIDs (for whom the CDS export task has been started but not completed).'''

#        Logger.get('RecMan').debug('in updateMicalaCDSExport()')

        # debugging:
#        for matched in cds_indico_matches.keys():
#            Logger.get('RecMan').debug('Looping through cds_indico_matches: %s -> %s' % (matched, cds_indico_matches[matched]))
#        for pending in cds_indico_pending:
#            Logger.get('RecMan').debug('Looping through cds_indico_pending: %s' % pending)


        for pending in cds_indico_pending:
#            Logger.get('RecMan').debug('Looping through cds_indico_pending: %s (and looking up in cds_indico_matches)' % pending)
            try:
                newRecord = cds_indico_matches[pending]

                idMachine = cls.getIdMachine(CollaborationTools.getOptionValue("RecordingManager", "micalaDBMachineName"))
                idTask    = cls.getIdTask(CollaborationTools.getOptionValue("RecordingManager", "micalaDBStatusExportCDS"))
                idLecture = cls.getIdLecture(pending)
                cls.reportStatus("COMPLETE", "CDS record: %s" % newRecord, idMachine, idTask, idLecture)

                # add the CDS record number to the Lectures table
                resultAssociateCDSRecord = cls.associateCDSRecordToLOID(newRecord, idLecture)
                if not resultAssociateCDSRecord["success"]:
                    Logger.get('RecMan').error("Unable to update Lectures table in micala database: %s" % resultAssociateCDSRecord["result"])
                    # this is not currently used:
                    return resultAssociateCDSRecord["result"]

            except KeyError:
                # current pending lecture still not found in CDS so do nothing.
                Logger.get('RecMan').debug('%s listed as pending and not found in cds_indico_matches, so it must still be pending.' % pending)
Esempio n. 10
0
def getOrphans():
    """Get list of Lecture Objects in the database that have no IndicoID assigned"""

    # Initialize success flag and result string
    flagSuccess = True
    result = ""

    try:
        connection = MySQLdb.connect(
            host=CollaborationTools.getOptionValue("RecordingManager",
                                                   "micalaDBServer"),
            port=int(
                CollaborationTools.getOptionValue("RecordingManager",
                                                  "micalaDBPort")),
            user=CollaborationTools.getOptionValue("RecordingManager",
                                                   "micalaDBReaderUser"),
            passwd=CollaborationTools.getOptionValue("RecordingManager",
                                                     "micalaDBReaderPW"),
            db=CollaborationTools.getOptionValue("RecordingManager",
                                                 "micalaDBName"))
    except NameError:
        raise MaKaCError(
            "You need to install MySQLdb (python-mysql) in order to use the Recording Manager"
        )
    except MySQLdb.Error, e:
        flagSuccess = False
        result += "MySQL error %d: %s" % (e.args[0], e.args[1])
Esempio n. 11
0
    def associateCDSRecordToLOID(cls, CDSID, LODBID):
        """Update the micala DB to associate the CDS record number with the given lecture.
        Note: if you are using cdsdev, the CDSID stored in the micala database will be the cdsdev record, not the cds record.
        The micala database doesn't know the difference between cds and cdsdev. So if you create a bunch of test records and
        then want to go back and create them again in CDS, you'll have to tinker around with the micala database,
        deleting some status records and probably re-publish those lectures from the beginning."""

        # Initialize success flag and result string
        flagSuccess = True
        result = ""

        #        Logger.get('RecMan').debug("in associateIndicoIDToLOID()")

        try:
            connection = MySQLdb.connect(
                host=CollaborationTools.getOptionValue("RecordingManager",
                                                       "micalaDBServer"),
                port=int(
                    CollaborationTools.getOptionValue("RecordingManager",
                                                      "micalaDBPort")),
                user=CollaborationTools.getOptionValue("RecordingManager",
                                                       "micalaDBUser"),
                passwd=CollaborationTools.getOptionValue(
                    "RecordingManager", "micalaDBPW"),
                db=CollaborationTools.getOptionValue("RecordingManager",
                                                     "micalaDBName"))
        except MySQLdb.Error, e:
            flagSuccess = False
            result += _("MySQL error %d: %s") % (e.args[0], e.args[1])
Esempio n. 12
0
    def updateLectureInfo(cls, idLecture, lectureTitle, lectureSpeakers):
        '''Update basic info in micala DB for convenience in identifying records.'''

        try:
            connection = MySQLdb.connect(host   = CollaborationTools.getOptionValue("RecordingManager", "micalaDBServer"),
                                         port   = int(CollaborationTools.getOptionValue("RecordingManager", "micalaDBPort")),
                                         user   = CollaborationTools.getOptionValue("RecordingManager", "micalaDBUser"),
                                         passwd = CollaborationTools.getOptionValue("RecordingManager", "micalaDBPW"),
                                         db     = CollaborationTools.getOptionValue("RecordingManager", "micalaDBName"))
        except MySQLdb.Error, e:
            raise RecordingManagerException(_("MySQL database error %d: %s") % (e.args[0], e.args[1]))
Esempio n. 13
0
    def getMatches(cls, confID):
        '''For the current conference, get list from the database of IndicoID's already matched to Lecture Objects.'''

        try:
            connection = MySQLdb.connect(host   = CollaborationTools.getOptionValue("RecordingManager", "micalaDBServer"),
                                         port   = int(CollaborationTools.getOptionValue("RecordingManager", "micalaDBPort")),
                                         user   = CollaborationTools.getOptionValue("RecordingManager", "micalaDBReaderUser"),
                                         passwd = CollaborationTools.getOptionValue("RecordingManager", "micalaDBReaderPW"),
                                         db     = CollaborationTools.getOptionValue("RecordingManager", "micalaDBName"))
        except MySQLdb.Error, e:
            raise RecordingManagerException(_("MySQL database error %d: %s") % (e.args[0], e.args[1]))
Esempio n. 14
0
    def createNewMicalaLecture(cls, lecture_name, contentType):
        '''insert a record into the micala database for a new lecture'''

#        Logger.get('RecMan').debug('createNewMicalaLecture for [%s]' % lecture_name)

        try:
            connection = MySQLdb.connect(host   = CollaborationTools.getOptionValue("RecordingManager", "micalaDBServer"),
                                         port   = int(CollaborationTools.getOptionValue("RecordingManager", "micalaDBPort")),
                                         user   = CollaborationTools.getOptionValue("RecordingManager", "micalaDBUser"),
                                         passwd = CollaborationTools.getOptionValue("RecordingManager", "micalaDBPW"),
                                         db     = CollaborationTools.getOptionValue("RecordingManager", "micalaDBName"))
        except MySQLdb.Error, e:
            raise RecordingManagerException(_("MySQL database error %d: %s") % (e.args[0], e.args[1]))
Esempio n. 15
0
    def isTaskComplete(cls, idLecture, idTask):
        '''Check to see if given task has been completed for the given lecture.'''

        flagComplete = False

        try:
            connection = MySQLdb.connect(host   = CollaborationTools.getOptionValue("RecordingManager", "micalaDBServer"),
                                         port   = int(CollaborationTools.getOptionValue("RecordingManager", "micalaDBPort")),
                                         user   = CollaborationTools.getOptionValue("RecordingManager", "micalaDBReaderUser"),
                                         passwd = CollaborationTools.getOptionValue("RecordingManager", "micalaDBReaderPW"),
                                         db     = CollaborationTools.getOptionValue("RecordingManager", "micalaDBName"))
        except MySQLdb.Error, e:
            raise RecordingManagerException(_("MySQL database error %d: %s") % (e.args[0], e.args[1]))
Esempio n. 16
0
    def getIdTask(cls, task_name):
        '''Look up ID of this task in database'''

#        Logger.get('RecMan').debug('task_name = [%s]' % task_name)

        try:
            connection = MySQLdb.connect(host   = CollaborationTools.getOptionValue("RecordingManager", "micalaDBServer"),
                                         port   = int(CollaborationTools.getOptionValue("RecordingManager", "micalaDBPort")),
                                         user   = CollaborationTools.getOptionValue("RecordingManager", "micalaDBReaderUser"),
                                         passwd = CollaborationTools.getOptionValue("RecordingManager", "micalaDBReaderPW"),
                                         db     = CollaborationTools.getOptionValue("RecordingManager", "micalaDBName"))
        except MySQLdb.Error, e:
            raise RecordingManagerException(_("MySQL database error %d: %s") % (e.args[0], e.args[1]))
Esempio n. 17
0
    def getCDSPending(cls, confId):
        """Query the Micala database to find Indico IDs whose MARC has been exported to CDS, but not marked as completed in the micala DB.
        (Note: they may have just been completed, but we'll deal with newly completed tasks separately)
         Return a list of these Indico IDs."""

        try:
            connection = MySQLdb.connect(host   = CollaborationTools.getOptionValue("RecordingManager", "micalaDBServer"),
                                         port   = int(CollaborationTools.getOptionValue("RecordingManager", "micalaDBPort")),
                                         user   = CollaborationTools.getOptionValue("RecordingManager", "micalaDBReaderUser"),
                                         passwd = CollaborationTools.getOptionValue("RecordingManager", "micalaDBReaderPW"),
                                         db     = CollaborationTools.getOptionValue("RecordingManager", "micalaDBName"))
        except MySQLdb.Error, e:
            raise RecordingManagerException("MySQL database error %d: %s" % (e.args[0], e.args[1]))
Esempio n. 18
0
    def getWebcastServiceURL(self, wc):
        """ Returns the Webcast Service URL ( a string ).
            It will be used to display a link when an event is a forthcoming webcast.
        """
        if not wc:
            return None
        elif not wc.getAudience():
            return CollaborationTools.getOptionValue('WebcastRequest', "webcastPublicURL")

        for row in CollaborationTools.getOptionValue('WebcastRequest', "webcastAudiences"):
            if row['name'] == wc.getAudience():
                return row['structure']

        return ''
Esempio n. 19
0
    def reportStatus(cls, status, message, idMachine, idTask, idLecture):
        '''Make status report to the database'''

#        Logger.get('RecMan').debug('in reportStatus()')

        if idLecture == '':
            idLecture = None

        try:
            connection = MySQLdb.connect(host   = CollaborationTools.getOptionValue("RecordingManager", "micalaDBServer"),
                                         port   = int(CollaborationTools.getOptionValue("RecordingManager", "micalaDBPort")),
                                         user   = CollaborationTools.getOptionValue("RecordingManager", "micalaDBUser"),
                                         passwd = CollaborationTools.getOptionValue("RecordingManager", "micalaDBPW"),
                                         db     = CollaborationTools.getOptionValue("RecordingManager", "micalaDBName"))
        except MySQLdb.Error, e:
            raise RecordingManagerException(_("MySQL database error %d: %s") % (e.args[0], e.args[1]))
Esempio n. 20
0
    def getWebcastServiceURL(self, wc):
        """ Returns the Webcast Service URL ( a string ).
            It will be used to display a link when an event is a forthcoming webcast.
        """
        if not wc:
            return None
        elif not wc.getAudience():
            return CollaborationTools.getOptionValue('WebcastRequest',
                                                     "webcastPublicURL")

        for row in CollaborationTools.getOptionValue('WebcastRequest',
                                                     "webcastAudiences"):
            if row['name'] == wc.getAudience():
                return row['structure']

        return ''
Esempio n. 21
0
def getCommonTalkInformation(conference):
    """ Returns a tuple of 3 lists:
        -List of talks (Contribution objects which are not in a Poster session)
        -List of webcast capable rooms, as a list of "locationName:roomName" strings
        -List of webcast-able talks (list of Contribution objects who take place in a webcast capable room)
    """

    #a talk is defined as a non-poster contribution
    filter = PosterFilterField(conference, False, False)
    talks = [
        cont for cont in conference.getContributionList()
        if filter.satisfies(cont)
    ]

    #list of "locationName:roomName" strings
    webcastCapableRooms = CollaborationTools.getOptionValue(
        'WebcastRequest', "webcastCapableRooms")

    #a webcast-able talk is defined as a talk talking place in a webcast-able room
    webcastAbleTalks = []
    for t in talks:
        location = t.getLocation()
        room = t.getRoom()
        if location and room and (location.getName() + ":" + room.getName()
                                  in webcastCapableRooms):
            webcastAbleTalks.append(t)

    return (talks, webcastCapableRooms, webcastAbleTalks)
Esempio n. 22
0
def getCDSRecords(confId):
    '''Query CDS to see if it has an entry for the given event as well as all its sessions, contributions and subcontributions.
    If yes return a dictionary pairing CDS IDs with Indico IDs.'''

    # Also, this method should then make sure that the database Status table has been updated to show that the export to CDS task is complete

#    Logger.get('RecMan').debug('in getCDSRecords()')

    # Slap a wildcard on the end of the ID to find the conference itself as well as all children.
    id_plus_wildcard = confId + "*"

    # Here is a help page describing the GET args,
    # if this CDS query needs to be changed (thanks [email protected]):
    # http://invenio-demo.cern.ch/help/hacking/search-engine-api
    # NB: We replace the string REPLACE_WITH_INDICO_ID manually instead of using %s because
    # there are also url-encoded chars containing the % char.
    optionsCDSQueryURL = CollaborationTools.getOptionValue("RecordingManager", "CDSQueryURL")
    escapedOptionsCDSQueryURL = optionsCDSQueryURL.replace("REPLACE_WITH_INDICO_ID", id_plus_wildcard)
#    Logger.get('RecMan').debug("escapedOptionsCDSQueryURL = " + escapedOptionsCDSQueryURL)
    url = escapedOptionsCDSQueryURL

    # This dictionary will contain CDS ID's, referenced by Indico ID's
    results = {}

    # perform the URL query to CDS. It contains one line for each CDS record,
    # of the form:
    # 001121974 970__ $$aINDICO.21917c22
    # The first number is the CDS record ID, with leading zeros
    # The second number is the MARC XML tag
    # The third string contains the Indico ID
    # (see http://www.loc.gov/marc/bibliographic for detailed information on MARC)
    request = Request(url)
    f = urlopen(request)
    lines = f.readlines()
    f.close()

    # Read each line, extracting the IndicoIDs and their corresponding CDS IDs
    for line in lines:
        result = line.strip()
        if result != "":
#            Logger.get('RecMan').debug(" CDS query result: %s" % line)

            bigcdsid = result.split(" ")[0]
            CDSID = bigcdsid.lstrip("0")

            p = re.compile('INDICO\.(\w*[sc\d]+)')
            m = p.search(line)

            if m:
                IndicoID = m.group(1)
                results[IndicoID] = CDSID
            else:
                # If we end up here then probably something's wrong with the URL, or perhaps we jusy got a blank line
                pass

#            results.append({"CDSID": CDSID, "IndicoID": IndicoID})

    return results
Esempio n. 23
0
def getOrphans():
    """Get list of Lecture Objects in the database that have no IndicoID assigned"""

    # Initialize success flag and result string
    flagSuccess = True
    result      = ""

    try:
        connection = MySQLdb.connect(host   = CollaborationTools.getOptionValue("RecordingManager", "micalaDBServer"),
                                     port   = int(CollaborationTools.getOptionValue("RecordingManager", "micalaDBPort")),
                                     user   = CollaborationTools.getOptionValue("RecordingManager", "micalaDBReaderUser"),
                                     passwd = CollaborationTools.getOptionValue("RecordingManager", "micalaDBReaderPW"),
                                     db     = CollaborationTools.getOptionValue("RecordingManager", "micalaDBName"))
    except NameError:
        raise MaKaCError("You need to install MySQLdb (python-mysql) in order to use the Recording Manager")
    except MySQLdb.Error, e:
        flagSuccess = False
        result += "MySQL error %d: %s" % (e.args[0], e.args[1])
Esempio n. 24
0
    def associateIndicoIDToLOID(cls, IndicoID, LODBID):
        """Update the micala DB to associate the given talk with the given LOID"""

        # Initialize success flag and result string
        flagSuccess = True
        result      = ""

#        Logger.get('RecMan').debug("in associateIndicoIDToLOID()")

        try:
            connection = MySQLdb.connect(host   = CollaborationTools.getOptionValue("RecordingManager", "micalaDBServer"),
                                         port   = int(CollaborationTools.getOptionValue("RecordingManager", "micalaDBPort")),
                                         user   = CollaborationTools.getOptionValue("RecordingManager", "micalaDBUser"),
                                         passwd = CollaborationTools.getOptionValue("RecordingManager", "micalaDBPW"),
                                         db     = CollaborationTools.getOptionValue("RecordingManager", "micalaDBName"))
        except MySQLdb.Error, e:
            flagSuccess = False
            result += _("MySQL error %d: %s") % (e.args[0], e.args[1])
Esempio n. 25
0
    def getVars(self):
        vars = wcomponents.WTemplated.getVars(self)

        sortingField = None
        if self.sortCriteria in self.sortFields:
            sortingField = self.sortCriteria

        for crit in ["speaker", "status", "cont", "reqType"]:
            url = collaborationUrlHandlers.UHCollaborationElectronicAgreement.getURL(
                self._conf)
            vars["%sImg" % crit] = ""
            url.addParam("sortBy", crit)

            if sortingField == crit:
                if self.order == "up":
                    vars["%sImg" % crit] = '<img src="%s" alt="up">' % (
                        Config.getInstance().getSystemIconURL("upArrow"))
                    url.addParam("order", "down")
                elif self.order == "down":
                    vars["%sImg" % crit] = '<img src="%s" alt="down">' % (
                        Config.getInstance().getSystemIconURL("downArrow"))
                    url.addParam("order", "up")

            vars["%sSortingURL" % crit] = str(url)

        vars["conf"] = self._conf
        vars["contributions"] = self.getTableContent()

        self._fromList.append({
            "name": "Indico Mailer",
            "email": Config.getInstance().getNoReplyEmail()
        })
        vars['fromList'] = self._fromList
        manager = self._conf.getCSBookingManager()
        vars['manager'] = manager
        vars['user'] = self._user

        if hasattr(manager, "_speakerWrapperList"):
            vars['signatureCompleted'] = manager.areSignatureCompleted()
        else:
            vars['signatureCompleted'] = None

        vars['STATUS_STRING'] = STATUS_STRING
        vars['canShow'] = manager.isAnyRequestAccepted()
        vars['SpeakerStatusEnum'] = SpeakerStatusEnum
        vars['user'] = self._user
        vars['collaborationUrlHandlers'] = collaborationUrlHandlers
        vars['urlPaperAgreement'] = self.getPaperAgreementURL()
        vars['agreementName'] = CollaborationTools.getOptionValue(
            "RecordingRequest", "AgreementName")
        vars[
            "notifyElectronicAgreementAnswer"] = manager.notifyElectronicAgreementAnswer(
            )
        vars["emailIconURL"] = (str(
            Config.getInstance().getSystemIconURL("mail_grey")))
        return vars
Esempio n. 26
0
def submitMicalaMetadata(aw, IndicoID, contentType, LODBID, LOID, videoFormat, languages):
    '''Generate a lecture.xml file for the given event, then web upload it to the micala server.'''

#    Logger.get('RecMan').debug('in submitMicalaMetadata()')

    # Initialize success flag, and result string to which we will append any errors.
    flagSuccess = True
    result = ""

    # First update the micala database that we've started this task
    try:
        idMachine = MicalaCommunication.getIdMachine(CollaborationTools.getOptionValue("RecordingManager", "micalaDBMachineName"))
        idTask    = MicalaCommunication.getIdTask(CollaborationTools.getOptionValue("RecordingManager", "micalaDBStatusExportMicala"))
        idLecture = LODBID
#        Logger.get('RecMan').debug('submitMicalaMetadata calling reportStatus...')
        MicalaCommunication.reportStatus('START', '', idMachine, idTask, idLecture)
    except Exception, e:
        flagSuccess = False
        result += _("Unknown error occured when updating MICALA START task information in micala database: %s\n.") % e
Esempio n. 27
0
    def generateVideoXML(cls, out, recordingManagerTags):
        """Generate XML variables needed for video records."""

#        Logger.get('RecMan').info("in generateVideoXML(), contentType = %s" % recordingManagerTags["contentType"])
#        Logger.get('RecMan').info("in generateVideoXML(), contentType = %s" % recordingManagerTags["videoFormat"])

        # retrieve actual syntax to use from RecordingManager plug-in options.
        videoTagStandard      = CollaborationTools.getOptionValue("RecordingManager", "videoFormatStandard")
        videoTagWide          = CollaborationTools.getOptionValue("RecordingManager", "videoFormatWide")
        contentTypeWebLecture = CollaborationTools.getOptionValue("RecordingManager", "contentTypeWebLecture")

        # If it's plain video, specify whether standard or wide format
        if recordingManagerTags["contentType"] == 'plain_video':
            if recordingManagerTags["videoFormat"] == 'standard':
                out.writeTag("videoFormat", videoTagStandard)
            elif recordingManagerTags["videoFormat"] == 'wide':
                out.writeTag("videoFormat", videoTagWide)
        # if it's a web lecture, then specify that.
        elif recordingManagerTags["contentType"] == 'web_lecture':
            out.writeTag("videoFormat", contentTypeWebLecture)
Esempio n. 28
0
    def associateCDSRecordToLOID(cls, CDSID, LODBID):
        """Update the micala DB to associate the CDS record number with the given lecture.
        Note: if you are using cdsdev, the CDSID stored in the micala database will be the cdsdev record, not the cds record.
        The micala database doesn't know the difference between cds and cdsdev. So if you create a bunch of test records and
        then want to go back and create them again in CDS, you'll have to tinker around with the micala database,
        deleting some status records and probably re-publish those lectures from the beginning."""

        # Initialize success flag and result string
        flagSuccess = True
        result      = ""

#        Logger.get('RecMan').debug("in associateIndicoIDToLOID()")

        try:
            connection = MySQLdb.connect(host   = CollaborationTools.getOptionValue("RecordingManager", "micalaDBServer"),
                                         port   = int(CollaborationTools.getOptionValue("RecordingManager", "micalaDBPort")),
                                         user   = CollaborationTools.getOptionValue("RecordingManager", "micalaDBUser"),
                                         passwd = CollaborationTools.getOptionValue("RecordingManager", "micalaDBPW"),
                                         db     = CollaborationTools.getOptionValue("RecordingManager", "micalaDBName"))
        except MySQLdb.Error, e:
            flagSuccess = False
            result += _("MySQL error %d: %s") % (e.args[0], e.args[1])
Esempio n. 29
0
 def getPaperAgreementURL(self):
     recordingFormURL = CollaborationTools.getOptionValue("RecordingRequest", "ConsentFormURL")
     webcastFormURL = CollaborationTools.getOptionValue("WebcastRequest", "ConsentFormURL")
     requestType = CollaborationTools.getRequestTypeUserCanManage(self._conf, self._user)
     #return recordingFormURL
     if requestType == 'recording' and recordingFormURL != '':
         return _("""<a href="%s">Paper version</a>."""%recordingFormURL)
     elif requestType == 'webcast' and webcastFormURL != '':
         return _("""<a href="%s">Paper version</a>."""%webcastFormURL)
     elif requestType == 'both':
         if recordingFormURL == webcastFormURL and recordingFormURL != '': #same link, same file
             return _("""<a href="%s">Paper version</a>."""%recordingFormURL)
         elif recordingFormURL != '' and webcastFormURL != '':
             return _("""<a href="%s">Paper version</a> for the recording request or
                     <a href="%s">Paper version</a> for the webcast request."""%(recordingFormURL, webcastFormURL))
         elif recordingFormURL != '':
             return _("""<a href="%s">Paper version</a>."""%recordingFormURL)
         elif webcastFormURL != '':
             return _("""<a href="%s">Paper version</a>."""%webcastFormURL)
         else:
             return _("""<No agreement link available>.""")
     else:
         return _("""<No agreement link available>.""")
Esempio n. 30
0
    def getVars(self):
        vars = wcomponents.WTemplated.getVars(self)

        sortingField = None
        if self.sortCriteria in self.sortFields:
            sortingField = self.sortCriteria

        for crit in ["speaker", "status", "cont", "reqType"]:
            url = collaborationUrlHandlers.UHCollaborationElectronicAgreement.getURL(self._conf)
            vars["%sImg" % crit] = ""
            url.addParam("sortBy", crit)

            if sortingField == crit:
                if self.order == "up":
                    vars["%sImg" % crit] = '<img src="%s" alt="up">' % (Config.getInstance().getSystemIconURL("upArrow"))
                    url.addParam("order","down")
                elif self.order == "down":
                    vars["%sImg" % crit] = '<img src="%s" alt="down">' % (Config.getInstance().getSystemIconURL("downArrow"))
                    url.addParam("order","up")

            vars["%sSortingURL" % crit] = str(url)

        vars["conf"] = self._conf
        vars["contributions"] = self.getTableContent()

        self._fromList.append({"name": "Indico Mailer",
                               "email": Config.getInstance().getNoReplyEmail()})
        vars['fromList'] = self._fromList
        manager = Catalog.getIdx("cs_bookingmanager_conference").get(self._conf.getId())
        vars['manager'] = manager
        vars['user'] = self._user

        if hasattr(manager, "_speakerWrapperList"):
            vars['signatureCompleted'] = manager.areSignatureCompleted()
        else:
            vars['signatureCompleted'] = None

        vars['STATUS_STRING'] = STATUS_STRING
        vars['canShow'] = manager.isAnyRequestAccepted()
        vars['SpeakerStatusEnum'] = SpeakerStatusEnum
        vars['user'] = self._user
        vars['collaborationUrlHandlers'] = collaborationUrlHandlers
        vars['urlPaperAgreement'] = self.getPaperAgreementURL()
        vars['agreementName'] = CollaborationTools.getOptionValue("RecordingRequest", "AgreementName")
        vars["notifyElectronicAgreementAnswer"] = manager.notifyElectronicAgreementAnswer()
        vars["emailIconURL"]=(str(Config.getInstance().getSystemIconURL("mail_grey")))
        vars["canModify"] = self._conf.canModify( self._rh.getAW() )
        return vars
Esempio n. 31
0
def doesExistIndicoLink(obj):
    """This function will be called with a conference, session, contribution or subcontribution object.
    Each of those has a getAllMaterialList() method. Call that method and search for a title "Video in CDS"
    and make sure it has a link."""

    flagLinkFound = False

    materials = obj.getAllMaterialList()
    if materials is not None and len(materials) > 0:
        for material in materials:
            # If the material in question is a link
            # whose title is either the original "Video in CDS"
            # or whatever other title might be specified in the RecordingManager
            # plugin options, then we've found a link.
            if isinstance(material.getMainResource(), Link) and \
            (material.getTitle() == "Video in CDS" or material.getTitle() == \
             CollaborationTools.getOptionValue("RecordingManager", "videoLinkName") ):
                flagLinkFound = True

    return flagLinkFound
Esempio n. 32
0
def doesExistIndicoLink(obj):
    """This function will be called with a conference, session, contribution or subcontribution object.
    Each of those has a getAllMaterialList() method. Call that method and search for a title "Video in CDS"
    and make sure it has a link."""

    flagLinkFound = False

    materials = obj.getAllMaterialList()
    if materials is not None and len(materials) > 0:
        for material in materials:
            # If the material in question is a link
            # whose title is either the original "Video in CDS"
            # or whatever other title might be specified in the RecordingManager
            # plugin options, then we've found a link.
            if isinstance(material.getMainResource(), Link) and \
            (material.getTitle() == "Video in CDS" or material.getTitle() == \
             CollaborationTools.getOptionValue("RecordingManager", "videoLinkName") ):
                flagLinkFound = True

    return flagLinkFound
Esempio n. 33
0
def getCommonTalkInformation(conference):
    """ Returns a tuple of 3 lists:
        -List of talks (Contribution objects which are not in a Poster session)
        -List of webcast capable rooms, as a list of "locationName:roomName" strings
        -List of webcast-able talks (list of Contribution objects who take place in a webcast capable room)
    """

    #a talk is defined as a non-poster contribution
    filter = PosterFilterField(conference, False, False)
    talks = [cont for cont in conference.getContributionList() if filter.satisfies(cont)]
    
    #list of "locationName:roomName" strings
    webcastCapableRooms = CollaborationTools.getOptionValue('WebcastRequest', "webcastCapableRooms")
    
    #a webcast-able talk is defined as a talk talking place in a webcast-able room
    webcastAbleTalks = []
    for t in talks:
        location = t.getLocation()
        room = t.getRoom()
        if location and room and (location.getName() + ":" + room.getName() in webcastCapableRooms):
            webcastAbleTalks.append(t)
            
    return (talks, webcastCapableRooms, webcastAbleTalks)
Esempio n. 34
0
def getVidyoOptionValue(optionName):
    """ Shortcut to return the value of a Vidyo option
    """
    return CollaborationTools.getOptionValue('Vidyo', optionName)
Esempio n. 35
0
    def getVars(self):
        vars = wcomponents.WTemplated.getVars(self)
        manager = self._conf.getCSBookingManager()

        for sw in manager.getSpeakerWrapperList():
            if sw.getUniqueIdHash() == self.authKey:
                self.spkWrapper = sw

        if self.spkWrapper:
            speaker = self.spkWrapper.getObject()
            vars['speaker'] = speaker
            vars['conf'] = self._conf

            if self.spkWrapper.getStatus() in [
                    SpeakerStatusEnum.SIGNED, SpeakerStatusEnum.FROMFILE,
                    SpeakerStatusEnum.REFUSED
            ]:

                vars['error'] = 'Already Submitted'

                if self.spkWrapper.getStatus() == SpeakerStatusEnum.SIGNED:
                    dtagree = self.spkWrapper.getDateAgreementSigned()
                    vars['outcomeText'] = _(
                        "You have already submitted your electronic agreement, it appears that you accepted it on <strong>%s</strong>."
                    ) % format_datetime(dtagree)
                else:
                    vars['outcomeText'] = _(
                        "You have already submitted your electronic agreement, it appears that you refused it."
                    )

            else:
                vars['error'] = None
                vars['authKey'] = self.authKey

                if self._conf.getType() == 'simple_event':
                    # if it's a lecture we consider the _conf object as the normal
                    # contribution and trigger a flag, in order to not print
                    # contributions detail...
                    showContributionInfo = False
                    cont = self._conf
                else:
                    showContributionInfo = True
                    cont = self._conf.getContributionById(
                        self.spkWrapper.getContId())

                vars['cont'] = cont

                vars['showContributionInfo'] = self.authKey

                location = cont.getLocation()
                room = cont.getRoom()
                if location and location.getName() and location.getName(
                ).strip():
                    locationText = location.getName().strip()
                    if room and room.getName() and room.getName().strip():
                        locationText += ". " + _(
                            "Room: %s" % room.getName().strip())
                    else:
                        locationText += " " + _("(room not defined)")
                else:
                    locationText = _("location/room not defined")

                vars['locationText'] = locationText

                tz = self._conf.getTimezone()
                vars['confDate'] = "%s (%s)" % (formatTwoDates(
                    self._conf.getStartDate(),
                    self._conf.getEndDate(),
                    tz=tz,
                    showWeek=True), tz)
                vars['contDate'] = "%s (%s)" % (formatTwoDates(
                    cont.getStartDate(),
                    cont.getEndDate(),
                    tz=tz,
                    showWeek=True), tz)

                vars['linkToEvent'] = urlHandlers.UHConferenceDisplay.getURL(
                    self._conf)
                vars['agreementName'] = CollaborationTools.getOptionValue(
                    "RecordingRequest", "AgreementName")
        else:
            vars['error'] = 'Error'

        return vars
Esempio n. 36
0
def getEVOOptionValueByName(optionName):
    return CollaborationTools.getOptionValue('EVO', optionName)
Esempio n. 37
0
                                         port   = int(CollaborationTools.getOptionValue("RecordingManager", "micalaDBPort")),
                                         user   = CollaborationTools.getOptionValue("RecordingManager", "micalaDBReaderUser"),
                                         passwd = CollaborationTools.getOptionValue("RecordingManager", "micalaDBReaderPW"),
                                         db     = CollaborationTools.getOptionValue("RecordingManager", "micalaDBName"))
        except MySQLdb.Error, e:
            raise RecordingManagerException("MySQL database error %d: %s" % (e.args[0], e.args[1]))

        cursorTaskStarted = connection.cursor(cursorclass=MySQLdb.cursors.DictCursor)

        # The following query returns the IndicoID's for which the metadata export task was started.
        # Whether it was finished we will find out separately by querying CDS to see what records have been created.
        cursorTaskStarted.execute('''SELECT IndicoID, LOID, name, status FROM viewStatusComprehensive
                        WHERE status = 'START'
                        AND name = "%s"
                        AND IndicoID LIKE "%s%%"'''  % \
                       (CollaborationTools.getOptionValue("RecordingManager", "micalaDBStatusExportCDS"),
                       confId))

        connection.commit()
        rowsStarted = cursorTaskStarted.fetchall()
        cursorTaskStarted.close()

        # Do another query to get list of IndicoIDs marked as completed
        cursorTaskComplete = connection.cursor(cursorclass=MySQLdb.cursors.DictCursor)

        # The following query returns the IndicoID's for which the metadata export task is COMPLETE.
        cursorTaskComplete.execute('''SELECT IndicoID, LOID, name, status FROM viewStatusComprehensive
                        WHERE status = 'COMPLETE'
                        AND name = "%s"
                        AND IndicoID LIKE "%s%%"'''  % \
                       (CollaborationTools.getOptionValue("RecordingManager", "micalaDBStatusExportCDS"),
Esempio n. 38
0
def getCERNMCUOptionValueByName(optionName):
    return CollaborationTools.getOptionValue('CERNMCU', optionName)
Esempio n. 39
0
def getTalks(conference, sort = False):
    """
    sort: if True, contributions are sorted by start date (non scheduled contributions
    at the end)
    """

    # Logger.get('RecMan').debug("in getTalks()")

    # max length for title string
    title_length = 39

    # recordable_events is my own list of tags for each recordable event
    # which will be used by the tpl file.
    recordable_events = []
    talks = []

    speaker_str = ""
    speaker_list = conference.getChairList()
    if speaker_list is not None:
        speaker_str = ", ".join(["%s %s"%(speaker.getFirstName(), speaker.getFamilyName()) for speaker in speaker_list])

    event_info = {}
    event_info["contId"] = ""
    event_info["speakers"]   = speaker_str
    event_info["type"]       = "conference"
    event_info["IndicoID"]   = generateIndicoID(conference = conference.getId(),
                                              session         = None,
                                              contribution    = None,
                                              subcontribution = None)
    event_info["title"]      = conference.getTitle()
    event_info["titleshort"] = truncateString(event_info["title"], 40)
    # this always comes first, so just pretend it's 0 seconds past the epoch
    event_info["date"]       = int(time.mktime(conference.getAdjustedStartDate().timetuple()))

    event_info["LOID"]       = ""
    event_info["IndicoLink"] = doesExistIndicoLink(conference)

    recordable_events.append(event_info)

    # Posters are contributions that are not recordable,
    # so filter them out here
    filter = PosterFilterField(conference, False, False)
    for contribution in conference.getContributionList():
        if filter.satisfies(contribution):
            talks.append(contribution)
            speaker_str = ""
            speaker_list = contribution.getSpeakerList()
            if speaker_list is not None:
                speaker_str = ", ".join(["%s %s"%(speaker.getFirstName(), speaker.getFamilyName()) for speaker in speaker_list])

            event_info = {}
            event_info["contId"] = contribution.getId()
            event_info["speakers"]   = speaker_str
            event_info["type"]       = "contribution"
            event_info["IndicoID"]   = generateIndicoID(conference = conference.getId(),
                                              session         = None,
                                              contribution    = contribution.getId(),
                                              subcontribution = None)
            event_info["title"]      = contribution.getTitle()
            event_info["titleshort"] = truncateString(event_info["title"], title_length)
            # Sometimes contributions are not scheduled, so they have no start date.
            # In this case assign it the value None, and it will be displayed
            # at the end of the list with the time value "not scheduled"
            if contribution.getAdjustedStartDate() is not None:
                event_info["date"]   = int(time.mktime(contribution.getAdjustedStartDate().timetuple()))
            else:
                event_info["date"]   = None

            event_info["LOID"]       = ""
            event_info["IndicoLink"] = doesExistIndicoLink(contribution)

            recordable_events.append(event_info)
            ctr_sc = 0
            for subcontribution in contribution.getSubContributionList():
                ctr_sc += 1
                event_info = {}
                event_info["contId"] = contribution.getId()
                speaker_str = ""
                speaker_list = subcontribution.getSpeakerList()

                if speaker_list is not None:
                    speaker_str = ", ".join(["%s %s"%(speaker.getFirstName(), speaker.getFamilyName()) for speaker in speaker_list])

                event_info["speakers"]   = speaker_str
                event_info["type"]       = "subcontribution"
                event_info["IndicoID"]   = generateIndicoID(conference = conference.getId(),
                                              session         = None,
                                              contribution    = contribution.getId(),
                                              subcontribution = subcontribution.getId())
                event_info["title"]      = subcontribution.getTitle()
                event_info["titleshort"] = truncateString(event_info["title"], title_length)
                # Subcontribution objects don't have start dates,
                # so get the owner contribution's start date
                # and add the counter ctr_sc so they appear in order
                if subcontribution.getOwner().getAdjustedStartDate() is not None:
                    event_info["date"]     = int(time.mktime(subcontribution.getOwner().getAdjustedStartDate().timetuple()) + ctr_sc)
                else:
                    event_info["date"]       = int(time.mktime(conference.getAdjustedStartDate().timetuple())) + ctr_sc
                event_info["LOID"]       = ""
                event_info["IndicoLink"] = doesExistIndicoLink(subcontribution)

                recordable_events.append(event_info)


    for session in conference.getSessionList():
        event_info = {}
        event_info["contId"] = ""
        event_info["speakers"] = ""
        event_info["type"]     = "session"
        event_info["IndicoID"] = generateIndicoID(conference = conference.getId(),
                                                  session         = session.getId(),
                                                  contribution    = None,
                                                  subcontribution = None)
        event_info["title"]      = session.getTitle()
        event_info["titleshort"] = truncateString(event_info["title"], title_length)
        # Get start time as seconds since the epoch so we can sort
        if session.getAdjustedStartDate() is not None:
            event_info["date"]   = int(time.mktime(session.getAdjustedStartDate().timetuple()))
        else:
            event_info["date"]   = None
        event_info["LOID"]       = ""
        event_info["IndicoLink"] = doesExistIndicoLink(session)

        recordable_events.append(event_info)

    # Get list of matching IndicoIDs and CDS records from CDS
    cds_indico_matches = getCDSRecords(conference.getId())
#    Logger.get('RecMan').debug('cds_indico_pending...')
    cds_indico_pending = MicalaCommunication.getCDSPending(conference.getId())

    # In case there are any records that were pending and are now appearing in CDS,
    # then update the micala database accordingly.
    MicalaCommunication.updateMicalaCDSExport(cds_indico_matches, cds_indico_pending)

#    Logger.get('RecMan').debug("cds_indico_matches: %s, cds_indico_pending: %s" % (cds_indico_matches, cds_indico_pending))
    for event_info in recordable_events:
        try:
            event_info["CDSID"]     = cds_indico_matches[event_info["IndicoID"]]
            event_info["CDSURL"]    = CollaborationTools.getOptionValue("RecordingManager", "CDSBaseURL") % event_info["CDSID"]
        except KeyError:
#            Logger.get('RecMan').debug("Following talk not in CDS: %s" % event_info["title"])
            if cds_indico_pending is not None and event_info["IndicoID"] in set(cds_indico_pending):
                event_info["CDSID"]  = 'pending'
                event_info["CDSURL"] = ""
            else:
                event_info["CDSID"]  = "none"
                event_info["CDSURL"] = ""

    # Get list of matching IndicoID's and LOIDs from the Micala database
    existing_matches = MicalaCommunication.getMatches(conference.getId())

    # insert any existing matches into the recordable_events array
    for talk in recordable_events:
        # Look up IndicoID in existing_matches dictionary
        try:
            matching_LOID = existing_matches[talk["IndicoID"]]
        # If not found, do nothing (talk["LOID"] should already be assigned to "" by default)
        except KeyError:
            pass
        # If there is a matching_LOID, assign it to talk["LOID"]
        else:
            talk["LOID"] = matching_LOID

    # Now that we have all the micala, CDS and IndicoLink info, set up the bg images
    for talk in recordable_events:
        talk["bg"]         = chooseBGColor(talk)

    # Format dates for each talk for pleasing display
    for talk in recordable_events:
        talk["date_nice"] = formatDate(talk["date"])

    # Next, sort the list of events by startDate for display purposes
    recordable_events.sort(startTimeCompare)

#    Logger.get('RecMan').debug('leaving getTalks()')

    return recordable_events
Esempio n. 40
0
def createCDSRecord(aw, IndicoID, LODBID, lectureTitle, lectureSpeakers, contentType, videoFormat, languages):
    '''Retrieve a MARC XML string for the given conference, then web upload it to CDS.'''

    # Initialize success flag, and result string to which we will append any errors.
    flagSuccess = True
    result = ""

    # generate the basic XML from which we will produce MARC XML for CDS and lecture.xml for micala
    basexml = getBasicXMLRepresentation(aw, IndicoID, contentType, videoFormat, languages)

    from MaKaC.common import Config

    marcxml = ""

    # Given the IndicoID, retrieve the type of talk and IDs, so we know which XSL file to use.
    parsed = parseIndicoID(IndicoID)

    # Choose the appropriate stylesheet:
    # - cds_marcxml_video_conference.xsl
    # - cds_marcxml_video_session.xsl
    # - cds_marcxml_video_contribution.xsl
    # - cds_marcxml_video_subcontribution.xsl
    styleSheet = "%s_%s.xsl" % ('cds_marcxml_video', parsed["type"])
    stylePath = os.path.join(Config.getInstance().getStylesheetsDir(), styleSheet)

    if os.path.exists(stylePath):
        try:
#            Logger.get('RecMan').info("Trying to do XSLT using path %s" % stylePath)
            parser = XSLTransformer(stylePath)
            marcxml = parser.process(basexml)
        except Exception:
            flagSuccess = False
            result += _("Cannot parse stylesheet: %s") % sys.exc_info()[0]
    else:
        flagSuccess = False
        result += _("Stylesheet does not exist: %s") % stylePath

    # Uncomment these lines when debugging to see the basic XML representation that is being created.
#    f = open('/tmp/base.xml', 'w')
#    f.write(basexml)
#    f.close()

    # Uncomment these lines when debugging to see the MARC XML being submitted to CDS
#    f = open('/tmp/marc.xml', 'w')
#    f.write(marcxml)
#    f.close()

    # Submit MARC XML record to CDS
    data = urlencode({
        "file": marcxml,
        "mode": "-ir"
    })
    headers = {"User-Agent": "invenio_webupload"}
    url = CollaborationTools.getOptionValue("RecordingManager", "CDSUploadURL")
    if '%s' in url:
        callback_url = CollaborationTools.getOptionValue("RecordingManager", "CDSUploadCallbackURL")
        url = url % quote_plus(callback_url % IndicoID)
    req = Request(url, data, headers)
#    Logger.get('RecMan').debug("req = %s" % str(req))

    try:
        f = urlopen(req)
        cds_response = f.read()
 #        cds_response = "testing" # uncomment for debugging
        # Successful operations should result in a one-line message that looks like this:
        # [INFO] Some message here
        # anything else means there was an error
        if cds_response.lstrip()[0:6] != "[INFO]":
            flagSuccess = False
            result += _("CDS webupload response: %s\n") % cds_response
    except HTTPError, e:
        flagSuccess = False
        result += _("CDS returned an error when submitting to %s: %s\n") % (url, e)
Esempio n. 41
0
    except Exception, e:
        flagSuccess = False
        result += _("Unknown error occured when submitting CDS record: %s.\n") % e

    # Uncomment these lines when debugging to see the result returned by CDS
#    f = open('/tmp/cds_result.txt', 'w')
#    f.write(cds_response)
#    f.close()

    # Update the micala database showing the task has started, but only if
    # the submission actually succeeded.
    if flagSuccess == True:
        # Update the micala database with our current task status
        try:
            # first need to get DB ids for stuff
            idMachine = MicalaCommunication.getIdMachine(CollaborationTools.getOptionValue("RecordingManager", "micalaDBMachineName"))
            idTask    = MicalaCommunication.getIdTask(CollaborationTools.getOptionValue("RecordingManager", "micalaDBStatusExportCDS"))
            # Look for the current talk in the Lectures table of the micala database
            # If it is a plain_video talk, look for its IndicoID;
            # if it is a web_lecture talk, use its LODBID
            if contentType == 'plain_video':
                idLecture = MicalaCommunication.getIdLecture(IndicoID)
                # If the current talk was not found in the micala DB, add a new record.
                if idLecture == '':
                    # It's not necessary to pass contentType since this only gets called once,
                    # for plain_videos, but maybe later we'll want to use it to create records for LOIDs
                    idLecture = MicalaCommunication.createNewMicalaLecture(IndicoID, contentType)
            elif contentType == 'web_lecture':
                # there's no question that there is a record for this lecture object,
                # because we just read the database to get the LODBID.
                idLecture = LODBID
Esempio n. 42
0
def getEVOOptionValueByName(optionName):
    return CollaborationTools.getOptionValue('EVO', optionName)
Esempio n. 43
0
    def getVars(self):
        vars = wcomponents.WTemplated.getVars(self)

        agreement_name = CollaborationTools.getOptionValue("RecordingRequest", "AgreementName")
        manager = Catalog.getIdx("cs_bookingmanager_conference").get(self._conf.getId())

        for sw in manager.getSpeakerWrapperList():
            if sw.getUniqueIdHash() == self.authKey:
                self.spkWrapper = sw

        if self.spkWrapper:
            speaker = self.spkWrapper.getObject()
            vars['speaker'] = speaker
            vars['conf'] = self._conf

            if self.spkWrapper.getStatus() in [SpeakerStatusEnum.SIGNED,
                                               SpeakerStatusEnum.FROMFILE,
                                               SpeakerStatusEnum.REFUSED]:

                vars['error'] = 'Already Submitted'

                if self.spkWrapper.getStatus() == SpeakerStatusEnum.SIGNED:
                    dtagree = self.spkWrapper.getDateAgreementSigned()
                    vars['outcomeText'] = _("You have already submitted your electronic agreement, it appears that you accepted it on <strong>%s</strong>.") % format_datetime(dtagree)
                elif self.spkWrapper.getStatus() == SpeakerStatusEnum.REFUSED:
                    vars['outcomeText'] = _("You have already submitted your electronic agreement, it appears that you refused it.")
                else:
                    vars['outcomeText'] = _("The organizer has already uploaded a scanned copy of {0}. No electronic signature is needed.").format(
                        CollaborationTools.getOptionValue("RecordingRequest", "AgreementName"))

            else:
                vars['error'] = None
                vars['authKey'] = self.authKey

                if self._conf.getType() == 'simple_event':
                    # if it's a lecture we consider the _conf object as the normal
                    # contribution and trigger a flag, in order to not print
                    # contributions detail...
                    showContributionInfo = False
                    cont = self._conf
                else:
                    showContributionInfo = True
                    cont = self._conf.getContributionById(self.spkWrapper.getContId())

                vars['cont'] = cont
                vars['showContributionInfo'] = self.authKey

                location = cont.getLocation()
                room = cont.getRoom()
                if location and location.getName() and location.getName().strip():
                    locationText = location.getName().strip()
                    if room and room.getName() and room.getName().strip():
                        locationText += ". " + _("Room: %s" % room.getName().strip())
                    else:
                        locationText += " " + _("(room not defined)")
                else:
                    locationText = _("location/room not defined")

                vars['locationText'] = locationText

                tz = self._conf.getTimezone()
                vars['confDate'] = "%s (%s)" % (formatTwoDates(self._conf.getStartDate(), self._conf.getEndDate(), tz = tz, showWeek = True), tz)
                vars['contDate'] = "%s (%s)"%(formatTwoDates(cont.getStartDate(), cont.getEndDate(), tz = tz, showWeek = True), tz)

                vars['linkToEvent'] = urlHandlers.UHConferenceDisplay.getURL(self._conf)
                vars['agreementName'] = agreement_name
        else:
            vars['error'] = 'Error'

        return vars
Esempio n. 44
0
def getCERNMCUOptionValueByName(optionName):
    return CollaborationTools.getOptionValue('CERNMCU', optionName)
Esempio n. 45
0
def getCDSRecords(confId):
    '''Query CDS to see if it has an entry for the given event as well as all its sessions, contributions and subcontributions.
    If yes return a dictionary pairing CDS IDs with Indico IDs.'''

    # Also, this method should then make sure that the database Status table has been updated to show that the export to CDS task is complete

    #    Logger.get('RecMan').debug('in getCDSRecords()')

    # Slap a wildcard on the end of the ID to find the conference itself as well as all children.
    id_plus_wildcard = confId + "*"

    # Here is a help page describing the GET args,
    # if this CDS query needs to be changed (thanks [email protected]):
    # http://invenio-demo.cern.ch/help/hacking/search-engine-api
    # NB: We replace the string REPLACE_WITH_INDICO_ID manually instead of using %s because
    # there are also url-encoded chars containing the % char.
    optionsCDSQueryURL = CollaborationTools.getOptionValue(
        "RecordingManager", "CDSQueryURL")
    escapedOptionsCDSQueryURL = optionsCDSQueryURL.replace(
        "REPLACE_WITH_INDICO_ID", id_plus_wildcard)
    #    Logger.get('RecMan').debug("escapedOptionsCDSQueryURL = " + escapedOptionsCDSQueryURL)
    url = escapedOptionsCDSQueryURL

    # This dictionary will contain CDS ID's, referenced by Indico ID's
    results = {}

    # perform the URL query to CDS. It contains one line for each CDS record,
    # of the form:
    # 001121974 970__ $$aINDICO.21917c22
    # The first number is the CDS record ID, with leading zeros
    # The second number is the MARC XML tag
    # The third string contains the Indico ID
    # (see http://www.loc.gov/marc/bibliographic for detailed information on MARC)
    request = Request(url)
    f = urlopen(request)
    lines = f.readlines()
    f.close()

    # Read each line, extracting the IndicoIDs and their corresponding CDS IDs
    for line in lines:
        result = line.strip()
        if result != "":
            #            Logger.get('RecMan').debug(" CDS query result: %s" % line)

            bigcdsid = result.split(" ")[0]
            CDSID = bigcdsid.lstrip("0")

            p = re.compile('INDICO\.(\w*[sc\d]+)')
            m = p.search(line)

            if m:
                IndicoID = m.group(1)
                results[IndicoID] = CDSID
            else:
                # If we end up here then probably something's wrong with the URL, or perhaps we jusy got a blank line
                pass


#            results.append({"CDSID": CDSID, "IndicoID": IndicoID})

    return results
Esempio n. 46
0
                db=CollaborationTools.getOptionValue("RecordingManager",
                                                     "micalaDBName"))
        except MySQLdb.Error, e:
            raise RecordingManagerException("MySQL database error %d: %s" %
                                            (e.args[0], e.args[1]))

        cursorTaskStarted = connection.cursor(
            cursorclass=MySQLdb.cursors.DictCursor)

        # The following query returns the IndicoID's for which the metadata export task was started.
        # Whether it was finished we will find out separately by querying CDS to see what records have been created.
        cursorTaskStarted.execute('''SELECT IndicoID, LOID, Name, Status FROM ViewStatusComprehensive
                        WHERE Status = 'START'
                        AND Name = "%s"
                        AND IndicoID LIKE "%s%%"'''  % \
                       (CollaborationTools.getOptionValue("RecordingManager", "micalaDBStatusExportCDS"),
                       confId))

        connection.commit()
        rowsStarted = cursorTaskStarted.fetchall()
        cursorTaskStarted.close()

        # Do another query to get list of IndicoIDs marked as completed
        cursorTaskComplete = connection.cursor(
            cursorclass=MySQLdb.cursors.DictCursor)

        # The following query returns the IndicoID's for which the metadata export task is COMPLETE.
        cursorTaskComplete.execute('''SELECT IndicoID, LOID, Name, Status FROM ViewStatusComprehensive
                        WHERE Status = 'COMPLETE'
                        AND Name = "%s"
                        AND IndicoID LIKE "%s%%"'''  % \
Esempio n. 47
0
def createCDSRecord(aw, IndicoID, LODBID, lectureTitle, lectureSpeakers,
                    contentType, videoFormat, languages):
    '''Retrieve a MARC XML string for the given conference, then web upload it to CDS.'''

    # Initialize success flag, and result string to which we will append any errors.
    flagSuccess = True
    result = ""

    # generate the basic XML from which we will produce MARC XML for CDS and lecture.xml for micala
    basexml = getBasicXMLRepresentation(aw, IndicoID, contentType, videoFormat,
                                        languages)

    from MaKaC.common import Config

    marcxml = ""

    # Given the IndicoID, retrieve the type of talk and IDs, so we know which XSL file to use.
    parsed = parseIndicoID(IndicoID)

    # Choose the appropriate stylesheet:
    # - cds_marcxml_video_conference.xsl
    # - cds_marcxml_video_session.xsl
    # - cds_marcxml_video_contribution.xsl
    # - cds_marcxml_video_subcontribution.xsl
    styleSheet = "%s_%s.xsl" % ('cds_marcxml_video', parsed["type"])
    stylePath = os.path.join(Config.getInstance().getStylesheetsDir(),
                             styleSheet)

    if os.path.exists(stylePath):
        try:
            #            Logger.get('RecMan').info("Trying to do XSLT using path %s" % stylePath)
            parser = XSLTransformer(stylePath)
            marcxml = parser.process(basexml)
        except Exception:
            flagSuccess = False
            result += _("Cannot parse stylesheet: %s") % sys.exc_info()[0]
    else:
        flagSuccess = False
        result += _("Stylesheet does not exist: %s") % stylePath

    # Uncomment these lines when debugging to see the basic XML representation that is being created.
#    f = open('/tmp/base.xml', 'w')
#    f.write(basexml)
#    f.close()

# Uncomment these lines when debugging to see the MARC XML being submitted to CDS
#    f = open('/tmp/marc.xml', 'w')
#    f.write(marcxml)
#    f.close()

# Submit MARC XML record to CDS
    data = urlencode({"file": marcxml, "mode": "-ir"})
    headers = {"User-Agent": "invenio_webupload"}
    url = CollaborationTools.getOptionValue("RecordingManager", "CDSUploadURL")
    if '%s' in url:
        callback_url = CollaborationTools.getOptionValue(
            "RecordingManager", "CDSUploadCallbackURL")
        url = url % quote_plus(callback_url % IndicoID)
    req = Request(url, data, headers)
    #    Logger.get('RecMan').debug("req = %s" % str(req))

    try:
        f = urlopen(req)
        cds_response = f.read()
        #        cds_response = "testing" # uncomment for debugging
        # Successful operations should result in a one-line message that looks like this:
        # [INFO] Some message here
        # anything else means there was an error
        if cds_response.lstrip()[0:6] != "[INFO]":
            flagSuccess = False
            result += _("CDS webupload response: %s\n") % cds_response
    except HTTPError, e:
        flagSuccess = False
        result += _("CDS returned an error when submitting to %s: %s\n") % (
            url, e)
Esempio n. 48
0
def getTalks(conference, sort=False):
    """
    sort: if True, contributions are sorted by start date (non scheduled contributions
    at the end)
    """

    # Logger.get('RecMan').debug("in getTalks()")

    # max length for title string
    title_length = 39

    # recordable_events is my own list of tags for each recordable event
    # which will be used by the tpl file.
    recordable_events = []
    talks = []

    speaker_str = ""
    speaker_list = conference.getChairList()
    if speaker_list is not None:
        speaker_str = ", ".join([
            "%s %s" % (speaker.getFirstName(), speaker.getFamilyName())
            for speaker in speaker_list
        ])

    event_info = {}
    event_info["contId"] = ""
    event_info["speakers"] = speaker_str
    event_info["type"] = "conference"
    event_info["IndicoID"] = generateIndicoID(conference=conference.getId(),
                                              session=None,
                                              contribution=None,
                                              subcontribution=None)
    event_info["title"] = conference.getTitle()
    event_info["titleshort"] = truncate(event_info["title"], 40)
    # this always comes first, so just pretend it's 0 seconds past the epoch
    event_info["date"] = int(
        time.mktime(conference.getAdjustedStartDate().timetuple()))

    event_info["LOID"] = ""
    event_info["IndicoLink"] = doesExistIndicoLink(conference)

    recordable_events.append(event_info)

    # Posters are contributions that are not recordable,
    # so filter them out here
    filter = PosterFilterField(conference, False, False)
    for contribution in conference.getContributionList():
        if filter.satisfies(contribution):
            talks.append(contribution)
            speaker_str = ""
            speaker_list = contribution.getSpeakerList()
            if speaker_list is not None:
                speaker_str = ", ".join([
                    "%s %s" % (speaker.getFirstName(), speaker.getFamilyName())
                    for speaker in speaker_list
                ])

            event_info = {}
            event_info["contId"] = contribution.getId()
            event_info["speakers"] = speaker_str
            event_info["type"] = "contribution"
            event_info["IndicoID"] = generateIndicoID(
                conference=conference.getId(),
                session=None,
                contribution=contribution.getId(),
                subcontribution=None)
            event_info["title"] = contribution.getTitle()
            event_info["titleshort"] = truncate(event_info["title"],
                                                title_length)
            # Sometimes contributions are not scheduled, so they have no start date.
            # In this case assign it the value None, and it will be displayed
            # at the end of the list with the time value "not scheduled"
            if contribution.getAdjustedStartDate() is not None:
                event_info["date"] = int(
                    time.mktime(
                        contribution.getAdjustedStartDate().timetuple()))
            else:
                event_info["date"] = None

            event_info["LOID"] = ""
            event_info["IndicoLink"] = doesExistIndicoLink(contribution)

            recordable_events.append(event_info)
            ctr_sc = 0
            for subcontribution in contribution.getSubContributionList():
                ctr_sc += 1
                event_info = {}
                event_info["contId"] = contribution.getId()
                speaker_str = ""
                speaker_list = subcontribution.getSpeakerList()

                if speaker_list is not None:
                    speaker_str = ", ".join([
                        "%s %s" %
                        (speaker.getFirstName(), speaker.getFamilyName())
                        for speaker in speaker_list
                    ])

                event_info["speakers"] = speaker_str
                event_info["type"] = "subcontribution"
                event_info["IndicoID"] = generateIndicoID(
                    conference=conference.getId(),
                    session=None,
                    contribution=contribution.getId(),
                    subcontribution=subcontribution.getId())
                event_info["title"] = subcontribution.getTitle()
                event_info["titleshort"] = truncate(event_info["title"],
                                                    title_length)
                # Subcontribution objects don't have start dates,
                # so get the owner contribution's start date
                # and add the counter ctr_sc so they appear in order
                if subcontribution.getOwner().getAdjustedStartDate(
                ) is not None:
                    event_info["date"] = int(
                        time.mktime(subcontribution.getOwner(
                        ).getAdjustedStartDate().timetuple()) + ctr_sc)
                else:
                    event_info["date"] = int(
                        time.mktime(conference.getAdjustedStartDate().
                                    timetuple())) + ctr_sc
                event_info["LOID"] = ""
                event_info["IndicoLink"] = doesExistIndicoLink(subcontribution)

                recordable_events.append(event_info)

    for session in conference.getSessionList():
        event_info = {}
        event_info["contId"] = ""
        event_info["speakers"] = ""
        event_info["type"] = "session"
        event_info["IndicoID"] = generateIndicoID(
            conference=conference.getId(),
            session=session.getId(),
            contribution=None,
            subcontribution=None)
        event_info["title"] = session.getTitle()
        event_info["titleshort"] = truncate(event_info["title"], title_length)
        # Get start time as seconds since the epoch so we can sort
        if session.getAdjustedStartDate() is not None:
            event_info["date"] = int(
                time.mktime(session.getAdjustedStartDate().timetuple()))
        else:
            event_info["date"] = None
        event_info["LOID"] = ""
        event_info["IndicoLink"] = doesExistIndicoLink(session)

        recordable_events.append(event_info)

    # Get list of matching IndicoIDs and CDS records from CDS
    cds_indico_matches = getCDSRecords(conference.getId())
    #    Logger.get('RecMan').debug('cds_indico_pending...')
    cds_indico_pending = MicalaCommunication.getCDSPending(conference.getId())

    # In case there are any records that were pending and are now appearing in CDS,
    # then update the micala database accordingly.
    MicalaCommunication.updateMicalaCDSExport(cds_indico_matches,
                                              cds_indico_pending)

    #    Logger.get('RecMan').debug("cds_indico_matches: %s, cds_indico_pending: %s" % (cds_indico_matches, cds_indico_pending))
    for event_info in recordable_events:
        try:
            event_info["CDSID"] = cds_indico_matches[event_info["IndicoID"]]
            event_info["CDSURL"] = CollaborationTools.getOptionValue(
                "RecordingManager", "CDSBaseURL") % event_info["CDSID"]
        except KeyError:
            #            Logger.get('RecMan').debug("Following talk not in CDS: %s" % event_info["title"])
            if cds_indico_pending is not None and event_info[
                    "IndicoID"] in set(cds_indico_pending):
                event_info["CDSID"] = 'pending'
                event_info["CDSURL"] = ""
            else:
                event_info["CDSID"] = "none"
                event_info["CDSURL"] = ""

    # Get list of matching IndicoID's and LOIDs from the Micala database
    existing_matches = MicalaCommunication.getMatches(conference.getId())

    # insert any existing matches into the recordable_events array
    for talk in recordable_events:
        # Look up IndicoID in existing_matches dictionary
        try:
            matching_LOID = existing_matches[talk["IndicoID"]]
        # If not found, do nothing (talk["LOID"] should already be assigned to "" by default)
        except KeyError:
            pass
        # If there is a matching_LOID, assign it to talk["LOID"]
        else:
            talk["LOID"] = matching_LOID

    # Now that we have all the micala, CDS and IndicoLink info, set up the bg images
    for talk in recordable_events:
        talk["bg"] = chooseBGColor(talk)

    # Format dates for each talk for pleasing display
    for talk in recordable_events:
        talk["date_nice"] = formatDate(talk["date"])

    # Next, sort the list of events by startDate for display purposes
    recordable_events.sort(startTimeCompare)

    #    Logger.get('RecMan').debug('leaving getTalks()')

    return recordable_events
Esempio n. 49
0
    # Uncomment these lines when debugging to see the result returned by CDS


#    f = open('/tmp/cds_result.txt', 'w')
#    f.write(cds_response)
#    f.close()

# Update the micala database showing the task has started, but only if
# the submission actually succeeded.
    if flagSuccess == True:
        # Update the micala database with our current task status
        try:
            # first need to get DB ids for stuff
            idMachine = MicalaCommunication.getIdMachine(
                CollaborationTools.getOptionValue("RecordingManager",
                                                  "micalaDBMachineName"))
            idTask = MicalaCommunication.getIdTask(
                CollaborationTools.getOptionValue("RecordingManager",
                                                  "micalaDBStatusExportCDS"))
            # Look for the current talk in the Lectures table of the micala database
            # If it is a plain_video talk, look for its IndicoID;
            # if it is a web_lecture talk, use its LODBID
            if contentType == 'plain_video':
                idLecture = MicalaCommunication.getIdLecture(IndicoID)
                # If the current talk was not found in the micala DB, add a new record.
                if idLecture == '':
                    # It's not necessary to pass contentType since this only gets called once,
                    # for plain_videos, but maybe later we'll want to use it to create records for LOIDs
                    idLecture = MicalaCommunication.createNewMicalaLecture(
                        IndicoID, contentType)
            elif contentType == 'web_lecture':