def toAvidCheck(self, timeout):
        """Method to check the Avid publish was successful

        :param timeout: Time in sec before assuming the publish failed if there was no popup
        :return: None
        """
        log('## toAvidCheck')
    
        if not self.__waitPopup(timeout, "toAvidCheck"):
            return

        # Check all the PNGs have been created
        editPanels = self.toEditorial.testInfo.getPanelsFromShotEdit(perBeat=False)
        checkUtils.checkPanelDir(self.toEditorial.testInfo, editPanels, ['hdPng'], 'toAvidCheck')

        ale = self.__checkAleExists()
        if ale:
            self.__checkAleContents(ale, editPanels)

        self.__checkAafs()
        self.__checkMarkersTxt()

        # TODO: Check the html email for details of what failed
    
        log('All checks performed for toAvid.')
Exemple #2
0
    def sbpToFlixCheck(self, sbpShow):
        log('## sbpToFlixCheck')
        # SBP creates an extra version for some reason
        self.fromSbp.testInfo.incrementEditVersion()

        if not self.__checkStartProcessing():
            return

        # Read the CSV settings file for the given show to know what to expect
        self.settings = checkUtils.readSbpSettings(self.fromSbp.testInfo, sbpShow)

        if not self.__waitPopup():
            return

        self.__waitProcessed()

        # Save the edit after the SBP import was successful
        sikuliUtils.saveVersion(self.fromSbp.testInfo, 'Imported %s from SBP.' % sbpShow)

        self.__waitEmptyDir()

        self.__countNewPanels()

        editPanels = self.fromSbp.testInfo.getPanelsFromShotEdit()
        self.__checkNewPanels(editPanels)

        self.__checkMarkers()

        # TODO: Check audio file was created and audio tracks were copied over

        self.__updateTestInfo(editPanels)

        log('All checks performed for sbpToFlix.')
    def toSBPCheck(self, timeout):
        """Checks the publish to SBP was successful

        :param timeout: Time in sec before assuming the publish failed if there was no popup
        :return: None
        """
        log('## toSBPCheck:')

        if not self.__waitPopup(timeout, "toSBPCheck"):
            return

        # Check the XML was created
        xml = self.__checkSbpXml()
        if not xml:
            return

        # Check all the panels are in the XML
        self.__checkPanelsInSbpXml(xml)

        # Check the existing SBP panels have their Unique IDs in the XML
        self.__checkSbpIds(xml)

        # Check the audio is in the XML
        self.__checkAudioSbpXml(xml)

        log('All checks performed for toSBP.')
Exemple #4
0
 def __waitProcessed(self):
     # Wait until all the panels have finished processing
     if sikuli.waitVanish('processing.png', 30):
         log("- All panels have finished processing.")
     else:
         self.fromSbp.testInfo.failed('sbpToFlixCheck: Some panels are still '
                                      'processing 30sec after plugin finished.')
Exemple #5
0
def readSbpSettings(testInfo, sbpShow):
    """Reads the sbpShow_settings.csv file containing all the info for what to expect from the SBP import

    :param testInfo: TestInfo object
    :param sbpShow: Name of the SBP project to be imported
    :return: dict: dictionary containing information on what to expect from the SBP import
    """
    # Setting defaults so that the check doesn't fail if something's missing from the csv file
    settings = {"timeout": 200, "stills": 0, "animated": 0, "replace": 0, "markers": []}

    sourceDir = "%s/assets/fromSBP/%s/" % (testInfo.testPath, sbpShow)
    file = "%s/%s_settings.csv" % (sourceDir, sbpShow)
    if not os.path.exists(file):
        log("readSbpSettings: Could not find settings csv file for SBP show:\n%s" % file, "error")
        return settings

    with open(file, "rb") as csvfile:
        csvreader = csv.reader(csvfile)
        for row in csvreader:
            for setting in settings:
                if setting == "markers" and row[0] == setting:
                    for marker in row[1:]:
                        settings[setting].append(marker)
                elif row[0] == setting:
                    settings[setting] = int(row[1])

    log("readSbpSettings: Settings read from the SBP csv file:\n%s" % settings, "debug")

    return settings
    def publishToFlixCheck2(self, comment, assetName, toShotgun, branch, asStills):
        log("## publishToFlixCheck:")

        publishSettings = checkUtils.readPublishSettings(self.fromEditorial.testInfo, assetName)

        timeout = publishSettings["timeout"]

        checkUtils.popupCheck(self.fromEditorial.testInfo, timeout, methodName="publishToFlixCheck")

        # Check the audio was created
        checkUtils.newAudioFile(self.fromEditorial.testInfo, methodName="publishToFlixCheck")

        # Update self.fromEditorial.testInfo
        if branch != "main":
            self.fromEditorial.testInfo.currentBranch = branch
        self.fromEditorial.testInfo.incrementEditVersion()

        # Check the editorial branch was created, the shotEdit is there and it's got the comment
        if not self.__checkShotEdit(comment):
            return 0

        self.__checkMarkers(publishSettings["markers"])

        self.__checkDuration(publishSettings["duration"])

        self.__checkNPanels(
            publishSettings["stillRefs"] + publishSettings["animatedRefs"] + publishSettings["existing"]
        )

        self.__checkPanels(publishSettings["stillRefs"], publishSettings["animatedRefs"], publishSettings["existing"])

        log("All checks performed for publishToFlix.")
        return 1
Exemple #7
0
def readMayaSettings(testInfo, assetName):
    # Setting defaults so that the check doesn't fail if something's missing from the csv file
    settings = {"inFrame": 1, "outFrame": 24, "nShots": 0, "shotNames": [], "shotDurations": [], "audio": 0}

    sourceDir = "%s/assets/fromMaya/" % testInfo.testPath
    infoFile = "%s/%s_info.csv" % (sourceDir, assetName.strip(".mb"))
    if not os.path.exists(infoFile):
        log("readMayaSettings: Could not find info csv file %s." % infoFile, "error")
        return settings

    with open(infoFile, "rb") as csvfile:
        csvreader = csv.reader(csvfile)
        for row in csvreader:
            if row[0] == "frameRange":
                settings["inFrame"] = int(row[1])
                settings["outFrame"] = int(row[2])
            elif row[0] == "nShots":
                settings["nShots"] = int(row[1])
            elif row[0] == "shotNames":
                for shot in range(1, settings["nShots"] + 1):
                    settings["shotNames"].append(row[shot])
            elif row[0] == "shotDurations":
                for shot in range(1, settings["nShots"] + 1):
                    settings["shotDurations"].append(int(row[shot]))
            elif row[0] == "audio":
                settings["audio"] = int(row[1])

    log("readMayaSettings: Settings read from the Maya csv file:\n%s" % settings, "debug")

    return settings
Exemple #8
0
def readPublishSettings(testInfo, assetName):

    # Setting defaults so that the check doesn't fail if something's missing from the csv file
    settings = {
        "timeout": 300,
        "stillRefs": 0,
        "animatedRefs": 0,
        "undefinedRefs": 0,
        "existing": 0,
        "markers": [],
        "duration": 300,
    }

    sourceDir = "%s/assets/fromEditorial/" % testInfo.testPath
    file = "%s/%s_settings.csv" % (sourceDir, assetName)
    if not os.path.exists(file):
        log("readPublishSettings: Could not find settings csv file %s." % file, "error")
        return settings

    with open(file, "rb") as csvfile:
        csvreader = csv.reader(csvfile)
        for row in csvreader:
            for setting in settings:
                if setting == "markers" and row[0] == setting:
                    for marker in row[1:]:
                        settings[setting].append(marker)
                elif row[0] == setting:
                    settings[setting] = int(row[1])

    log("readPublishSettings: Settings read from the Publish csv file:\n%s" % settings, "debug")

    return settings
    def importPanelsCheck(self, ext, nPanels, panelList, checkImage=True, replace=0):
        log('## importPanelsCheck')
    
        if checkImage:
            self.__checkImage(ext, nPanels, panelList)
        else:
            self.__checkDoneProcessing(ext, nPanels)
        sikuliUtils.saveVersion(self.importDrawing.testInfo, 'Imported %s %ss.' % (nPanels, ext))
    
        # Check there's nPanels more panels in the current shotEdit
        if ext == 'mov':
            beat = 'a'
        else:
            beat = 'p'
        newPanels = checkUtils.newPanelsInShotEdit(self.importDrawing.testInfo,
                                                   {beat: nPanels},
                                                   replace,
                                                   beats=[beat],
                                                   methodName='importPanelsCheck')
    
        checkUtils.checkPanelDir(self.importDrawing.testInfo, newPanels,
                                 ['multitrack', 'jpg', 'xml'], 'importPanelsCheck')
    
        # Check the pose for each panel was copied
        checkUtils.checkPanelPose(self.importDrawing.testInfo, newPanels, 'importPanelsCheck')

        if not replace:
            self.__checkDuration(ext, nPanels, panelList)

        log('All checks performed for importPanels.')
Exemple #10
0
    def addDialogueCheck(self, panels, dialogue):
        """Checks the dialogue has been saved in each panel's multitrack

        :param panels: Array of panel indices to check for dialogue
        :param dialogue: String added to each panel as dialogue
        :return: None
        """
        log('## addDialogueCheck')
    
        sikuliUtils.saveVersion(self.editTools.testInfo, 'Added dialogue to %s panels.' % len(panels))
    
        editPanels = self.editTools.testInfo.getPanelsFromShotEdit(perBeat=False)
        missing = []
        for panel in panels:
            multitrackDialogue = self.editTools.testInfo.getPanelDialogue(editPanels[panel-1])
            if dialogue.replace("[panelIndex]", str(panel)) == multitrackDialogue:
                log("addDialogueCheck: Found dialogue in %s's multitrack." % editPanels[panel-1], "debug")
            else:
                missing.append(editPanels[panel-1])
                log("addDialogueCheck: Couldn't find dialogue in %s's multitrack." % editPanels[panel-1], "error")
            self.editTools.testInfo.dialogue[editPanels[panel-1]] = multitrackDialogue
        if len(missing):
            self.editTools.testInfo.failed("addDialogue: Failed to find dialogue in the following panels' multitracks: "
                                           "%s" % missing)
        else:
            log("addDialogueCheck: Found dialogue in every panel's multitrack.")

        log('All checks performed for addDialogue.')
Exemple #11
0
 def __waitEmptyDir(self):
     # Wait until the ~/flix directory is empty, meaning the import is complete
     if pyUtils.waitUntilEmpty(self.fromSbp.sbpDir, 5) == 0:
         self.fromSbp.testInfo.failed('sbpToFlixCheck: ~/flix directory still '
                                      'not empty after %s seconds.' % (self.settings["timeout"] + 5))
         pyUtils.emptyDir(self.fromSbp.sbpDir)
     else:
         log('- ~/flix directory emptied after SBP import.')
Exemple #12
0
 def __checkPanelsInSbpXml(self, xml):
     expectedAnyClips = self.toEditorial.testInfo.getEditPanels(True)
     foundAnyClips = pyUtils.findOccurences('<mastercomment1>', xml)
     if foundAnyClips != expectedAnyClips:
         self.toEditorial.testInfo.failed('toSBPCheck: Expected %s clips in the XML, '
                                          'found %s instead.' % (expectedAnyClips, foundAnyClips))
     else:
         log('- Found all expected clips in the XML.')
Exemple #13
0
 def __getFcpNewPanels(self):
     fcpNew = []
     for beat in self.toEditorial.testInfo.editPanels.iterkeys():
         if beat in ['a', 'p', 's']:
             for panel in self.toEditorial.testInfo.editPanels[beat]:
                 if panel not in self.toEditorial.testInfo.fcpPublished:
                     fcpNew.append(panel)
     log('toPremiereCheck: fcpNew: %s' % fcpNew, 'debug')
     return fcpNew
Exemple #14
0
 def __checkAleImported(self):
     # Check the ALE is in the output path
     if not os.path.exists('%s/%s_%s_v%s.ale' % (self.toEditorial.toAvidOutputDir,
                                                 self.toEditorial.testInfo.sequence,
                                                 self.toEditorial.testInfo.currentBranch,
                                                 self.toEditorial.testInfo.mainVersion)):
         self.toEditorial.testInfo.failed('importToAvidCheck: Did not find the ALE imported.')
     else:
         log('- Found the ALE after import.')
    def loadLatestVersionCheck(self):
        """Checks whether the latest version of the sequence was loaded

        :return: None
        """
        log('## loadLatestVersionCheck')

        log("No check for this method yet!")
        self.projectBrowser.showing = False
Exemple #16
0
 def __waitPopup(self, timeout, methodName):
     startTime = time.time()
     # Wait for the OK popup
     if not checkUtils.popupCheck(self.toEditorial.testInfo, timeout, methodName):
         self.toEditorial.testInfo.failed('%s: No popup after %s sec, '
                                          'check log for errors. Exiting current checks...' % (methodName, timeout))
         return 0
     log("%s: Found popup after %ssec (timeout was %ssec)." % (methodName, int(time.time()-startTime), timeout))
     return 1
 def __checkDoneProcessing(ext, nPanels):
     # Assuming 1sec per panel is enough for Flix to be done processing
     if ext != 'mov':
         timeout = nPanels
     else:
         timeout = nPanels*30
     if not sikuliUtils.waitUntilGone('processing.png', timeout):
         log('importPanelsCheck: Still processing after %s seconds; may need to increase the timeout.'
             % timeout, 'error')
         sikuliUtils.waitUntilGone('processing.png', timeout)
Exemple #18
0
def doneProcessing(testInfo, timeout, methodName="methodName"):
    """Waits until the 'Processing' thumbnail is gone

    :param testInfo: TestInfo object
    :param timeout: Maximum time (in seconds) before returning if images are still being processed
    :param methodName: Name of the method calling me, useful for logging
    :return: None
    """
    if sikuliUtils.waitUntilGone("processing.png", timeout) == 0:
        log("%s: still processing after %s seconds." % (methodName, timeout), "error")
    else:
        log("- Flix has finished processing thumbnails")
Exemple #19
0
    def __checkPublishedFcpDir(self, fcpNew):
        publishedDir = '%s/published' % self.toEditorial.fcpDir
        publishedFiles = pyUtils.getPanelsFromDir(publishedDir)

        if len(publishedFiles) != (len(self.toEditorial.testInfo.fcpPublished) + len(set(fcpNew))):
            self.toEditorial.testInfo.failed('toPremiereCheck: %s files should be '
                                             'in the published directory, found %s instead.' %
                                             ((len(self.toEditorial.testInfo.fcpPublished) + len(set(fcpNew))),
                                              len(publishedFiles)))
        else:
            log('- Found expected %s files in the published directory.' % len(publishedFiles))
        self.toEditorial.testInfo.fcpPublished = publishedFiles
Exemple #20
0
    def __checkStartProcessing(self):
        """Waits 10sec for the 'Processing' panel to make sure the SBP import process has started

        :return: 1 if Processing panel is found, 0 otherwise
        """
        if sikuli.exists("processing.png", 10):
            log("- Flix has started processing panels.")
            return 1
        else:
            self.fromSbp.testInfo.failed("sbpToFlixCheck: Flix has not started processing panels after 10sec, "
                                         "probably failed to parse the XML. Exiting...")
            return 0
Exemple #21
0
 def __checkAudioSbpXml(self, xml):
     audioFound = pyUtils.findOccurences('.mp3</pathurl>', xml)
     if self.toEditorial.testInfo.editAudio == 1:
         if audioFound != 1:
             self.toEditorial.testInfo.failed('toSBPCheck: There\'s no audio file referenced in the XML.')
         else:
             log('- Found audio file referenced in the XML.')
     else:
         if audioFound != 0:
             self.toEditorial.testInfo.failed('toSBPCheck: There should not be an audio file referenced in the XML.')
         else:
             log('- No audio in the XML as expected.')
Exemple #22
0
 def __checkAleExists(self):
     ale = "%s/%s_%s_v%s.ale" % (self.toEditorial.aleDir,
                                 self.toEditorial.testInfo.sequence,
                                 self.toEditorial.testInfo.currentBranch,
                                 self.toEditorial.testInfo.mainVersion)
     if not os.path.exists(ale):
         self.toEditorial.testInfo.failed('toAvidCheck: Could not find the ALE.')
         log('toAvidCheck: ALE: %s' % ale, 'debug')
         return 0
     else:
         log('- Found the ALE.')
         return ale
    def __checkImage(self, ext, nPanels, panelList):
        panelListPng = []
        for n in range(0, nPanels):
            panelPng = panelList[n].replace('.%s' % ext, '.png')
            panelListPng.append(panelPng)
        log(str(panelListPng), 'debug')

        missing = sikuliUtils.allExist(panelListPng)

        if missing != 0:
            self.importDrawing.testInfo.failed('importPanelsCheck: Failed to find panel %s on screen.' % missing)
        else:
            log('- All the imported panels have been found on screen.')
Exemple #24
0
 def __checkAafImported(self):
     # Check the imported aafs have been copied to the flix/editorial/aaf/imported directory
     aafPath = '%s/aaf/imported' % self.toEditorial.testInfo.getEditorialDir()
     allAAFs = pyUtils.findFileNames(aafPath, '%s_*.aaf' % self.toEditorial.testInfo.sequence, False)
     newAAFs = len(allAAFs) - len(self.toEditorial.testInfo.avidImported)
     expectedNewAAFs = len(self.toEditorial.testInfo.avidPublished) - len(self.toEditorial.testInfo.avidImported)
     if newAAFs != expectedNewAAFs:
         self.toEditorial.testInfo.failed(
                 'importToAvidCheck: Expected %s new AAFs copied in the imported directory, found %s instead.' % (
                     expectedNewAAFs, newAAFs))
     else:
         log('- Found all %s new AAFs in the aaf imported directory.' % newAAFs)
     self.toEditorial.testInfo.avidImported = allAAFs
Exemple #25
0
 def __checkSbpXml(self):
     xml = '%s/%s_%s_%s_v%s_sbp.xml' % (self.toEditorial.sbpDir,
                                        self.toEditorial.testInfo.show,
                                        self.toEditorial.testInfo.sequence,
                                        self.toEditorial.testInfo.currentBranch,
                                        self.toEditorial.testInfo.getEditVersion())
     if not os.path.exists(xml):
         self.toEditorial.testInfo.failed('toSBPCheck: Could not find the XML.')
         log('toSBPCheck: XML: %s' % xml, 'debug')
         return 0
     else:
         log('- Found the XML.')
         return xml
    def __checkDuration(self, duration):
        """Checks the total duration of the edit is the expected one

        :param duration: Expected duration of the published edit
        :return: None
        """
        # Check the total duration is right in Flix
        foundDuration = self.fromEditorial.testInfo.getDurationFromShotEdit()
        if foundDuration != duration:
            self.fromEditorial.testInfo.failed(
                "publishToFlix: Expected the edit to be %s frames, " "is %s instead." % (duration, foundDuration)
            )
        else:
            log("- The published edit came in with the right duration.")
Exemple #27
0
    def exportQuickTimeCheck(self, timeout):
        log('## exportQuickTimeCheck')

        if not checkUtils.popupCheck(self.export.testInfo, timeout, 'exportQuickTimeCheck'):
            self.export.testInfo.failed('exportQuickTimeCheck: Plugin failed, '
                                        'check log for errors. Exiting current checks...')
            return

        # movieFile = pyUtils.waitForFile(self.export.fleMovDir, '*.mov', 5)
        movieFile = "%s/%s_%s_v%s.mov" % (self.export.fleMovDir,
                                          self.export.testInfo.sequence,
                                          self.export.testInfo.currentBranch,
                                          self.export.testInfo.getEditVersion())

        if not os.path.exists(movieFile):
            self.export.testInfo.failed('exportQuickTimeCheck: Movie was not generated in %s.' % self.export.fleMovDir)
        else:
            log('- Found generated movie.')

            movieSize = os.path.getsize(movieFile)
            if movieSize < 100:
                self.export.testInfo.failed('exportQuickTimeCheck: Movie created is less than 100 bytes, '
                                            'probably failed to be created.\nFilesize: %s' % movieSize)
            else:
                log('- Generated movie is not 0 bytes.')

        log('All checks performed for exportQuickTime.')
Exemple #28
0
 def addSequencerCheck(self, nShots, duration):
     """After adding all the shots from the Maya sequencer, this method checks the thumbnails have finished processing,
     the new panel(s) are present in the new saved shotEdit, the multitrack, jpeg, xml and json files have been created
     for the new panel(s).
 
     :param nShots: Number of shots in Maya's Camera Sequencer Edit
     :param duration: Total duration in frames of all the shots sent from Maya
     :return: None
     """
     log('## addSequencerCheck')
 
     self.addSequencerShotsCheck(nShots, duration)
 
     log('All checks performed for addSequencer.')    
    def importAudioCheck(self, timeout):
        log('## importAudioCheck')
    
        if not exists('importAudioOK.png', timeout):
            self.importDrawing.testInfo.failed('importAudioCheck: No popup found after %s seconds.' % timeout)
        else:
            log('- Found popup after importing audio.')
            click('importAudioOK.png')
    
        sikuliUtils.saveVersion(self.importDrawing.testInfo, 'Imported audio.')
    
        # Check mp3 file is in the editorial directory
        checkUtils.newAudioFile(self.importDrawing.testInfo, methodName='importAudioCheck')

        # Check mp3 is in the shotEdit
        shotEdit = self.importDrawing.testInfo.getShotEdit()
        if shotEdit:
            mp3Found = pyUtils.findOccurences('.mp3', shotEdit)
            if mp3Found != 1:
                self.importDrawing.testInfo.failed('importAudioCheck: Expected 1 audio file in the shotEdit, '
                                                   'found %s instead.' % mp3Found)
            else:
                log('- Found imported audio file in the current shotEdit.')
                self.importDrawing.testInfo.editAudio = 1
        else:
            self.importDrawing.testInfo.failed('importAudioCheck: shotEdit not found, cannot check for audio.')
    
        log('All checks performed for importAudio.')
Exemple #30
0
def checkPanelPose(testInfo, editPanels, methodName="methodName"):
    missingPoses = []
    for beat in editPanels.iterkeys():
        for panel in editPanels[beat]:
            # poseFile = testInfo.getPanelPoseFile(panel)
            log("checkPanelPose: panel: %s" % panel)
            poseFile = testInfo.getPanelPoseFromMultitrack(panel)
            if not poseFile or not os.path.exists(poseFile):
                missingPoses.append(panel)

    if len(missingPoses):
        testInfo.failed("%s: missing pose for these panels: %s" % (methodName, missingPoses))
    else:
        log("- Found all expected poses.")