Changeset 65953b in indico
- Timestamp:
- 06/10/10 18:11:38 (3 years ago)
- Branches:
- master, burotel, hello-world-walkthrough, ipv6, new-webex, v0.97-series, v0.98-series, v0.98.2, v0.98.3, v0.98b1, v0.98b2, v0.99, 051b2622c51afb171a1dedb46a0df4fbb0cbd02e, 0da0c1403bae8e51d8229f460181c71b9e6dda72
- Children:
- ebef78
- Parents:
- 8b01a9
- git-author:
- Jeremy Herr <jeremy.herr@…> (05/21/10 11:49:58)
- git-committer:
- Jeremy Herr <jeremy.herr@…> (06/10/10 18:11:38)
- Location:
- indico/MaKaC
- Files:
-
- 8 edited
-
plugins/Collaboration/RecordingManager/common.py (modified) (7 diffs)
-
plugins/Collaboration/RecordingManager/micala.py (modified) (6 diffs)
-
plugins/Collaboration/RecordingManager/services.py (modified) (2 diffs)
-
plugins/Collaboration/RecordingManager/tpls/Extra.js (modified) (1 diff)
-
webinterface/stylesheets/micala_lecture_conference.xsl (modified) (2 diffs)
-
webinterface/stylesheets/micala_lecture_contribution.xsl (modified) (2 diffs)
-
webinterface/stylesheets/micala_lecture_session.xsl (modified) (2 diffs)
-
webinterface/stylesheets/micala_lecture_subcontribution.xsl (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
indico/MaKaC/plugins/Collaboration/RecordingManager/common.py
r8b01a9 r65953b 363 363 try: 364 364 cursor = connection.cursor(cursorclass=MySQLdb.cursors.DictCursor) 365 cursor.execute("SELECT id, LOID, IndicoID, Title, Creator FROM Lectures WHERE NOT IndicoID ")365 cursor.execute("SELECT id, LOID, IndicoID, Title, Creator FROM Lectures WHERE NOT IndicoID OR IndicoID IS NULL ORDER BY LOID") 366 366 connection.commit() 367 367 rows = cursor.fetchall() … … 547 547 return xmlGen.getXml() 548 548 549 def createCDSRecord(aw, IndicoID, contentType, videoFormat, languages):549 def createCDSRecord(aw, IndicoID, LODBID, contentType, videoFormat, languages): 550 550 '''Retrieve a MARC XML string for the given conference, then web upload it to CDS.''' 551 551 … … 641 641 # Update the micala database with our current task status 642 642 try: 643 # first need to get DB ids for stuff 643 644 idMachine = MicalaCommunication.getIdMachine(CollaborationTools.getOptionValue("RecordingManager", "micalaDBMachineName")) 644 645 idTask = MicalaCommunication.getIdTask(CollaborationTools.getOptionValue("RecordingManager", "micalaDBStatusExportCDS")) 645 idLecture = MicalaCommunication.getIdLecture(IndicoID, pattern_cern, pattern_umich) 646 if idLecture == '': 647 idLecture = MicalaCommunication.createNewMicalaLecture(IndicoID, contentType, pattern_cern, pattern_umich) 646 # Look for the current talk in the Lectures table of the micala database 647 # If it is a plain_video talk, look for its IndicoID; 648 # if it is a web_lecture talk, use its LODBID 649 if contentType == 'plain_video': 650 idLecture = MicalaCommunication.getIdLecture(IndicoID, pattern_cern, pattern_umich) 651 # If the current talk was not found in the micala DB, add a new record. 652 if idLecture == '': 653 idLecture = MicalaCommunication.createNewMicalaLecture(IndicoID, contentType, pattern_cern, pattern_umich) 654 elif contentType == 'web_lecture': 655 # there's no question that there is a record for this lecture object, 656 # because we just read the database to get the LODBID. 657 idLecture = LODBID 658 648 659 MicalaCommunication.reportStatus('START', '', idMachine, idTask, idLecture) 649 660 except Exception, e: … … 653 664 return {"success": flagSuccess, "result": result} 654 665 655 def submitMicalaMetadata(aw, IndicoID, contentType, LO ID, videoFormat, languages):666 def submitMicalaMetadata(aw, IndicoID, contentType, LODBID, LOID, videoFormat, languages): 656 667 '''Generate a lecture.xml file for the given event, then web upload it to the micala server.''' 657 668 … … 662 673 result = "" 663 674 664 # First, update the micala Tasks table that the submission has started 665 666 # pattern to match for the signal file 667 # Here we are looking for 668 # CONFID 669 # or CONFIDcCONTRID 670 # or CONFIDcCONTRIDscSCONTRID 671 # or CONFIDsSESSID 672 pattern_cern = re.compile('([sc\d]+)$') 673 # Here we are looking for YYYYMMDD-DEVICENAME-HHMMSS 674 pattern_umich = re.compile('(\d+\-[\w\d]+\-\d)$') 675 676 # Update the micala database with our current task status 675 # First update the micala database that we've started this task 677 676 try: 678 Logger.get('RecMan').debug('calling getIdMachine...')679 677 idMachine = MicalaCommunication.getIdMachine(CollaborationTools.getOptionValue("RecordingManager", "micalaDBMachineName")) 680 Logger.get('RecMan').debug('calling getIdTask...')681 678 idTask = MicalaCommunication.getIdTask(CollaborationTools.getOptionValue("RecordingManager", "micalaDBStatusExportMicala")) 682 Logger.get('RecMan').debug('calling getIdLecture...') 683 idLecture = MicalaCommunication.getIdLecture(IndicoID, pattern_cern, pattern_umich) 684 Logger.get('RecMan').debug('calling reportStatus...') 685 if idLecture == '': 686 idLecture = MicalaCommunication.createNewMicalaLecture(IndicoID, contentType, pattern_cern, pattern_umich) 679 idLecture = LODBID 680 Logger.get('RecMan').debug('submitMicalaMetadata calling reportStatus...') 687 681 MicalaCommunication.reportStatus('START', '', idMachine, idTask, idLecture) 688 682 except Exception, e: … … 699 693 parsed = parseIndicoID(IndicoID) 700 694 701 # Choose the appropriate stylesheet :695 # Choose the appropriate stylesheet for the type of talk: 702 696 # - micala_lecture_conference.xsl 703 697 # - micala_lecture_session.xsl … … 755 749 # the submission actually succeeded. 756 750 if flagSuccess == True: 757 # pattern to match for the signal file758 # Here we are looking for759 # CONFID760 # or CONFIDcCONTRID761 # or CONFIDcCONTRIDscSCONTRID762 # or CONFIDsSESSID763 pattern_cern = re.compile('([sc\d]+)$')764 # Here we are looking for YYYYMMDD-DEVICENAME-HHMMSS765 pattern_umich = re.compile('(\d+\-[\w\d]+\-\d)$')766 767 # Update the micala database with our current task status768 751 try: 769 if idLecture == '':770 idLecture = MicalaCommunication.createNewMicalaLecture(IndicoID, contentType, pattern_cern, pattern_umich)771 752 MicalaCommunication.reportStatus('COMPLETE', '', idMachine, idTask, idLecture) 753 except Exception, e: 754 flagSuccess = False 755 result += _("Unknown error occured when updating COMPLETE MICALA task information in micala database: %s\n." % e) 756 # if errors were encountered, report ERROR status and details to micala DB 757 else: 758 try: 759 MicalaCommunication.reportStatus('ERROR', result, idMachine, idTask, idLecture) 772 760 except Exception, e: 773 761 flagSuccess = False -
indico/MaKaC/plugins/Collaboration/RecordingManager/micala.py
r2349da r65953b 79 79 80 80 @classmethod 81 def getIdLecture(cls, lecture_name , pattern_cern, pattern_umich):82 '''Look up ID of this lecture in database'''81 def getIdLecture(cls, lecture_name): 82 '''Look up internal database ID of the given lecture''' 83 83 84 84 Logger.get('RecMan').debug('lecture_name = [%s]' % lecture_name) 85 86 match_cern = pattern_cern.search(lecture_name)87 match_umich = pattern_umich.search(lecture_name)88 85 89 86 try: … … 105 102 result_set = cursor.fetchone() 106 103 107 if result_set is not None and len(result_set) > 0 and match_cern:104 if result_set is not None and len(result_set) > 0: 108 105 Logger.get('RecMan').debug("result_set: %s" % str(result_set)) 109 idLecture = result_set[0]110 elif result_set is not None and len(result_set) > 0 and match_umich:111 106 idLecture = result_set[0] 112 107 else: … … 156 151 connection.close() 157 152 158 return cls.getIdLecture(lecture_name , pattern_cern, pattern_umich)153 return cls.getIdLecture(lecture_name) 159 154 160 155 @classmethod … … 220 215 221 216 @classmethod 222 def updateMicala(cls, IndicoID, contentType, LODBID):217 def associateIndicoIDToLOID(cls, IndicoID, LODBID): 223 218 """Update the micala DB to associate the given talk with the given LOID""" 224 219 … … 227 222 result = "" 228 223 229 Logger.get('RecMan').debug("in updateMicala()") 230 231 if contentType == 'web_lecture': 232 try: 233 connection = MySQLdb.connect(host = CollaborationTools.getOptionValue("RecordingManager", "micalaDBServer"), 234 port = int(CollaborationTools.getOptionValue("RecordingManager", "micalaDBPort")), 235 user = CollaborationTools.getOptionValue("RecordingManager", "micalaDBUser"), 236 passwd = CollaborationTools.getOptionValue("RecordingManager", "micalaDBPW"), 237 db = CollaborationTools.getOptionValue("RecordingManager", "micalaDBName")) 238 except MySQLdb.Error, e: 239 flagSuccess = False 240 result += "MySQL error %d: %s" % (e.args[0], e.args[1]) 241 except Exception, e: 242 flagSuccess = False 243 result += "Unknown error %d: %s" % (e.args[0], e.args[1]) 244 245 cursor = connection.cursor(cursorclass=MySQLdb.cursors.DictCursor) 246 247 try: 248 cursor.execute("UPDATE Lectures SET IndicoID=%s WHERE id=%s", 249 (IndicoID, LODBID)) 250 connection.commit() 251 except MySQLdb.Error, e: 252 flagSuccess = False 253 result += "MySQL error %d: %s" % (e.args[0], e.args[1]) 254 except Exception, e: 255 flagSuccess = False 256 result += "Unknown error %d: %s" % (e.args[0], e.args[1]) 257 258 cursor.close() 259 connection.close() 260 261 elif contentType == 'plain_video': 262 # do nothing, since a record in Lectures should already have been created by createCDSRecord() 263 pass 224 Logger.get('RecMan').debug("in associateIndicoIDToLOID()") 225 226 try: 227 connection = MySQLdb.connect(host = CollaborationTools.getOptionValue("RecordingManager", "micalaDBServer"), 228 port = int(CollaborationTools.getOptionValue("RecordingManager", "micalaDBPort")), 229 user = CollaborationTools.getOptionValue("RecordingManager", "micalaDBUser"), 230 passwd = CollaborationTools.getOptionValue("RecordingManager", "micalaDBPW"), 231 db = CollaborationTools.getOptionValue("RecordingManager", "micalaDBName")) 232 except MySQLdb.Error, e: 233 flagSuccess = False 234 result += "MySQL error %d: %s" % (e.args[0], e.args[1]) 235 except Exception, e: 236 flagSuccess = False 237 result += "Unknown error %d: %s" % (e.args[0], e.args[1]) 238 239 cursor = connection.cursor(cursorclass=MySQLdb.cursors.DictCursor) 240 241 try: 242 cursor.execute("UPDATE Lectures SET IndicoID=%s WHERE id=%s", 243 (IndicoID, LODBID)) 244 connection.commit() 245 except MySQLdb.Error, e: 246 flagSuccess = False 247 result += "MySQL error %d: %s" % (e.args[0], e.args[1]) 248 except Exception, e: 249 flagSuccess = False 250 result += "Unknown error %d: %s" % (e.args[0], e.args[1]) 251 252 cursor.close() 253 connection.close() 264 254 265 255 return {"success": flagSuccess, "result": result} … … 333 323 idMachine = cls.getIdMachine(CollaborationTools.getOptionValue("RecordingManager", "micalaDBMachineName")) 334 324 idTask = cls.getIdTask(CollaborationTools.getOptionValue("RecordingManager", "micalaDBStatusExportCDS")) 335 import re 336 pattern_cern = re.compile('([sc\d]+)$') 337 pattern_umich = re.compile('(\d+\-[\w\d]+\-\d)$') 338 idLecture = cls.getIdLecture(pending, pattern_cern, pattern_umich) 325 idLecture = cls.getIdLecture(pending) 339 326 cls.reportStatus("COMPLETE", "CDS record: %s" % new_record, idMachine, idTask, idLecture) 340 327 -
indico/MaKaC/plugins/Collaboration/RecordingManager/services.py
r0cb016 r65953b 24 24 from MaKaC.plugins.Collaboration.RecordingManager.common import createIndicoLink, createCDSRecord, submitMicalaMetadata 25 25 from MaKaC.plugins.Collaboration.RecordingManager.micala import MicalaCommunication 26 27 class RMLinkService(CollaborationPluginServiceBase):28 29 def _checkParams(self):30 CollaborationPluginServiceBase._checkParams(self) #puts the Conference in self._conf31 self._IndicoID = self._params.get('IndicoID', None)32 self._LOID = self._params.get('LOID', None)33 34 if not self._IndicoID:35 raise RecordingManagerException("No IndicoID supplied")36 if not self._LOID:37 raise RecordingManagerException("No LOID supplied")38 39 def _getAnswer(self):40 # here is where we make a submission to the database?41 MicalaCommunication.updateMicala(self._params.get('IndicoID', None), self._params.get('LOID', None))42 return {'some':'thing'}43 26 44 27 class RMCreateCDSRecordService(CollaborationPluginServiceBase): … … 73 56 74 57 def _getAnswer(self): 58 """This method does everything necessary to create a CDS record and also update the micala database. 59 For plain_video talks, it does the following: 60 - calls createCDSRecord(), 61 which generates the MARC XML, 62 submits it to CDS, 63 and makes sure a record for this talk exists in micala DB 64 For web_lecture talks, it does the following: 65 - calls createCDSRecord(), 66 which generates the MARC XML and submits it to CDS 67 - calls associateIndicoIDToLOID(), 68 which associates the chosen IndicoID to the existing record of the LOID in micala DB 69 (no need to create a new record, because the user is only allowed to choose LOID's that are already in the micala DB) 70 - calls submitMicalaMetadata(), which generates the micala lecture.xml and submits it to micala DB. 71 All of these methods update their status to micala DB. 72 """ 73 74 ################################################################### 75 # FOR DEBUGGING 76 resultSubmitMicalaMetadata = submitMicalaMetadata(self._aw, 77 self._IndicoID, 78 self._contentType, 79 self._LODBID, 80 self._params.get('LOID', None), 81 self._videoFormat, 82 self._languages) 83 if resultSubmitMicalaMetadata["success"] == False: 84 raise RecordingManagerException("CDS record creation failed.\n%s" % resultSubmitMicalaMetadata["result"]) 85 return "micala metadata creation aborted." 86 87 return 88 # /FOR DEBUGGING! 89 ################################################################### 90 75 91 # Get the MARC XML and submit it to CDS, 76 # then update micala database Status table showing task completed 92 # then update micala database Status table showing task completed. 93 # do this for both plain_video and web_lecture talks 77 94 resultCreateCDSRecord = createCDSRecord(self._aw, 78 95 self._IndicoID, 96 self._LODBID, 79 97 self._contentType, 80 98 self._videoFormat, 81 99 self._languages) 82 83 100 if resultCreateCDSRecord["success"] == False: 84 101 raise RecordingManagerException("CDS record creation failed.\n%s" % resultCreateCDSRecord["result"]) 85 102 return "CDS record creation aborted." 86 103 87 # Create lecture.xml and submit to micala server,88 # then update micala database Status table showing task completed89 # (this only makes sense if it is a web lecture)90 104 if self._contentType == 'web_lecture': 105 # Update the micala database to match the LODBID with the IndicoID 106 # This only makes sense for web_lecture talks 107 # (for plain_video, a record in Lectures should already have been created by createCDSRecord() ) 108 resultAssociateIndicoIDToLOID = MicalaCommunication.associateIndicoIDToLOID(self._IndicoID, 109 self._params.get('LODBID', None)) 110 if resultAssociateIndicoIDToLOID["success"] == False: 111 raise RecordingManagerException("micala database update failed.\n%s" % resultAssociateIndicoIDToLOID["result"]) 112 return "CDS record creation aborted." 113 114 # Create lecture.xml and submit to micala server, 115 # then update micala database Status table showing task completed 116 # (this only makes sense if it is a web_lecture) 91 117 resultSubmitMicalaMetadata = submitMicalaMetadata(self._aw, 92 118 self._IndicoID, 93 119 self._contentType, 120 self._LODBID, 94 121 self._params.get('LOID', None), 95 122 self._videoFormat, 96 123 self._languages) 97 98 124 if resultSubmitMicalaMetadata["success"] == False: 99 125 raise RecordingManagerException("CDS record creation failed.\n%s" % resultSubmitMicalaMetadata["result"]) 100 126 return "micala metadata creation aborted." 101 102 # Update the micala database to match the LODBID with the IndicoID103 # This only makes sense for web lectures, so if contentType is plain_video,104 # this method does nothing.105 resultUpdateMicala = MicalaCommunication.updateMicala(self._IndicoID,106 self._contentType,107 self._params.get('LODBID', None))108 109 if resultUpdateMicala["success"] == False:110 raise RecordingManagerException("micala database update failed.\n%s" % resultUpdateMicala["result"])111 return "CDS record creation aborted."112 113 127 114 128 return "Successfully updated micala database and submitted CDS record for creation." -
indico/MaKaC/plugins/Collaboration/RecordingManager/tpls/Extra.js
r2349da r65953b 351 351 352 352 RMMatchSummaryMessageUpdate(); 353 }354 355 function RMLink() {356 //RMselectedTalk357 //RMselectedLO358 359 var killProgress = IndicoUI.Dialogs.Util.progress($T("doing something"));360 361 indicoRequest('collaboration.pluginService',362 {363 plugin: 'RecordingManager',364 service: 'RMLink',365 conference: '<%= ConferenceId %>',366 IndicoID: RMselectedTalkId,367 LOID: RMselectedLODBID368 },369 function(result, error){370 if (!error) {371 // I don't have anything here yet. This is where we could do something with the result if we want. Don't know what that would be.372 killProgress(); // turn off the progress indicator373 } else {374 killProgress(); // turn off the progress indicator375 IndicoUtil.errorReport(error);376 }377 }378 );379 353 } 380 354 -
indico/MaKaC/webinterface/stylesheets/micala_lecture_conference.xsl
r0cb016 r65953b 25 25 <xsl:template match="event"> 26 26 27 <!-- <!DOCTYPE LECTURE SYSTEM "http://www.wlap.org/dtd/lecture.dtd"> -->27 <!-- <!DOCTYPE LECTURE SYSTEM "http://www.wlap.org/dtd/lecture.dtd"> --> 28 28 <LECTURE> 29 29 <TITLE><xsl:value-of select="./title" /></TITLE> 30 <xsl:for-each select="./chair/user"> 31 <AUTHOR><xsl:apply-templates select="./name"/></AUTHOR> 32 </xsl:for-each> 30 <xsl:choose> 31 <xsl:when test="./chair/user != ''"> 32 <xsl:for-each select="./chair/user"> 33 <AUTHOR><xsl:apply-templates select="./name"/></AUTHOR> 34 </xsl:for-each> 35 </xsl:when> 36 <xsl:otherwise> 37 <AUTHOR>no speaker given</AUTHOR> 38 </xsl:otherwise> 39 </xsl:choose> 33 40 <DATE><xsl:value-of select="substring(./startDate, 0, 11)" /></DATE> 34 41 <LANGUAGE> … … 53 60 </VIDEO> 54 61 <SEQ TITLE="Sequence of slides" REGION="slide" > 55 <SLIDE TYPE="DUMMY" />62 <!-- This section will be populated by a list of slide timings later --> 56 63 </SEQ> 57 64 </PAR> -
indico/MaKaC/webinterface/stylesheets/micala_lecture_contribution.xsl
r0cb016 r65953b 28 28 <LECTURE> 29 29 <TITLE><xsl:value-of select="./contribution/title" /></TITLE> 30 <xsl:for-each select="./contribution/speakers/user"> 31 <AUTHOR><xsl:apply-templates select="./name"/></AUTHOR> 32 </xsl:for-each> 30 <xsl:choose> 31 <xsl:when test="./contribution/speakers/user != ''"> 32 <xsl:for-each select="./contribution/speakers/user"> 33 <AUTHOR><xsl:apply-templates select="./name"/></AUTHOR> 34 </xsl:for-each> 35 </xsl:when> 36 <xsl:otherwise> 37 <AUTHOR>no speaker given</AUTHOR> 38 </xsl:otherwise> 39 </xsl:choose> 33 40 <DATE><xsl:value-of select="substring(./startDate, 0, 11)" /></DATE> 34 41 <LANGUAGE> … … 53 60 </VIDEO> 54 61 <SEQ TITLE="Sequence of slides" REGION="slide" > 55 <SLIDE TYPE="DUMMY" />62 <!-- This section will be populated by a list of slide timings later --> 56 63 </SEQ> 57 64 </PAR> -
indico/MaKaC/webinterface/stylesheets/micala_lecture_session.xsl
r0cb016 r65953b 28 28 <LECTURE> 29 29 <TITLE><xsl:value-of select="./session/title" /></TITLE> 30 <xsl:for-each select="./session/speakers/user"> 31 <AUTHOR><xsl:apply-templates select="./name"/></AUTHOR> 32 </xsl:for-each> 30 <xsl:choose> 31 <xsl:when test="./session/speakers/user != ''"> 32 <xsl:for-each select="./session/speakers/user"> 33 <AUTHOR><xsl:apply-templates select="./name"/></AUTHOR> 34 </xsl:for-each> 35 </xsl:when> 36 <xsl:otherwise> 37 <AUTHOR>no speaker given</AUTHOR> 38 </xsl:otherwise> 39 </xsl:choose> 33 40 <DATE><xsl:value-of select="substring(./startDate, 0, 11)" /></DATE> 34 41 <LANGUAGE> … … 53 60 </VIDEO> 54 61 <SEQ TITLE="Sequence of slides" REGION="slide" > 55 <SLIDE TYPE="DUMMY" />62 <!-- This section will be populated by a list of slide timings later --> 56 63 </SEQ> 57 64 </PAR> -
indico/MaKaC/webinterface/stylesheets/micala_lecture_subcontribution.xsl
r0cb016 r65953b 28 28 <LECTURE> 29 29 <TITLE><xsl:value-of select="./contribution/subcontribution/title" /></TITLE> 30 <xsl:for-each select="./contribution/subcontribution/speakers/user"> 31 <AUTHOR><xsl:apply-templates select="./name"/></AUTHOR> 32 </xsl:for-each> 30 <xsl:choose> 31 <xsl:when test="./contribution/subcontribution/speakers/user != ''"> 32 <xsl:for-each select="./contribution/subcontribution/speakers/user"> 33 <AUTHOR><xsl:apply-templates select="./name"/></AUTHOR> 34 </xsl:for-each> 35 </xsl:when> 36 <xsl:otherwise> 37 <AUTHOR>no speaker given</AUTHOR> 38 </xsl:otherwise> 39 </xsl:choose> 33 40 <DATE><xsl:value-of select="substring(./startDate, 0, 11)" /></DATE> 34 41 <LANGUAGE> … … 53 60 </VIDEO> 54 61 <SEQ TITLE="Sequence of slides" REGION="slide" > 55 <SLIDE TYPE="DUMMY" />62 <!-- This section will be populated by a list of slide timings later --> 56 63 </SEQ> 57 64 </PAR>
Note: See TracChangeset
for help on using the changeset viewer.
