def generate_html(self):
        """
        Loop through all files in the input directory and create an HTML preview
        page for the swf and static version.
        """
        num_files = 0

        # Loop through all SWF files in the input directory
        files = [f for f in os.listdir(self.input_dir) if f.endswith('.swf')]
        for filen in files:
            filepath = os.path.join(self.input_dir, filen)
            if os.path.isfile(filepath):
                # get filename and extension
                basename = os.path.basename(filepath)
                name = os.path.splitext(basename)[0]

                # create a filename
                filename = os.path.join(self.input_dir, name+'.html')

                # do not overwrite existing HTML files (that would be bad)
                if os.path.isfile(filename):
                    if self.verbose:
                        basen = os.path.basename(filename)
                        logmsg.warning('"{0}" already exists'.format(basen))
                    continue

                self.create_html(filename)
                num_files += 1

        logmsg.success('Generated {0} HTML files'.format(num_files))
    def copy_files(self):
        """Copy files."""
        dest = os.path.join(self.input_dir, 'js')

        if not os.path.isdir(dest):
            if self.verbose:
                logmsg.info('Creating "js" directory...')
            shutil.copytree(self.get_data('js'), dest)
        else:
            if self.verbose:
                logmsg.warning('"js" directory already exists')
 def copy_files(self):
     """Copy quickstart files from data folder to the CWD."""
     logmsg.header('Copy quickstart files...', self.logger)
     # Loop through all non-hidden files in quickstart directory
     files = [f for f in os.listdir(self.get_data('quickstart')) if not f.startswith('.')]
     for filename in files:
         src = os.path.join(self.get_data('quickstart'), filename)
         dst = os.path.join(os.getcwd(), filename)
         if not os.path.isfile(filename):
             shutil.copy2(src, dst)
             logmsg.info('Copied "{0}"'.format(filename), self.logger)
         else:
             logmsg.warning('"{0}" already exists'.format(filename),
                            self.logger)