菜单

削减 js/css 的工具

2019年4月9日 - 皇家赌场系统
#_*_coding:utf-8_*_

import smtplib
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from email.mime.base import MIMEBase
from email.header import Header
from email import encoders
import time
import yaml,os,base64
from pos.lib import gl,scripts


class EmailClass(object):
    def __init__(self):
        self.curDateTime = str(time.strftime('%Y-%m-%d %H:%M:%S',time.localtime())) #当前日期时间
        self.config = scripts.getYamlfield(gl.configFile) #配置文件路径
        self.sender = self.config['EMAIL']['Smtp_Sender'] # 从配置文件获取,发件人
        self.receivers = self.config['EMAIL']['Receivers']  # 从配置文件获取,接收人
        self.msg_title = self.config['EMAIL']['Msg_Title'] #从配置文件获取,邮件标题
        self.sender_server = self.config['EMAIL']['Smtp_Server'] #从配置文件获取,发送服务器
        self.From = self.config['EMAIL']['From']
        self.To = self.config['EMAIL']['To']

    '''
    配置邮件内容
    '''
    @property
    def setMailContent(self):
        print self.receivers
        msg = MIMEMultipart()
        msg['From'] = Header(self.From,'utf-8')
        msg['To'] = self.To
        msg['Subject'] = Header('%s%s'%(self.msg_title,self.curDateTime),'utf-8')

        #附件路径
        dirpath = gl.reportPath
        zipfile = os.path.join(os.path.dirname(dirpath), 'report.zip')
        reportfile = os.path.join(gl.reportPath, 'Report.html')
        scripts.zipDir(dirpath,zipfile) #压缩报告
        #增加邮件内容为html
        fp = open(reportfile, 'rb')
        reportHtmlText = fp.read()
        msg.attach(MIMEText(reportHtmlText,'html','utf-8'))
        fp.close()

        #增加附件
        html = self.addAttach(zipfile,filename='Report%s.zip'%self.curDateTime) #自动化测试报告附件
        msg.attach(html)

        return msg


    '''
    增加附件
    '''
    def addAttach(self,apath,filename='Report.html'):
        with open(apath, 'rb') as fp:
            attach = MIMEBase('application','octet-stream')
            attach.set_payload(fp.read())
            attach.add_header('Content-Disposition', 'attachment', filename=filename)
            encoders.encode_base64(attach)
            fp.close()
            return attach


    '''
    发送电子邮件
    '''
    def sendEmail(self,message):
        try:
            smtpObj = smtplib.SMTP()
            smtpObj.connect(self.sender_server,25)
            smtpObj.login(self.sender,self.config['EMAIL']['Password'])
            smtpObj.sendmail(self.sender,self.receivers , message.as_string())
            smtpObj.quit()
            print "邮件发送成功"
        except smtplib.SMTPException as ex:
            print "Error: 无法发送邮件.%s"%ex

    #发送调用
    @property
    def send(self):
        self.sendEmail(self.setMailContent)

if __name__=="__main__":
    EmailClass().send

解压附属类小部件中的文件,直接在脚下文件夹(包涵子文件夹)中即可成功对js/css文件的缩减

二. Iso内部格式如下

蓝光原盘只有bdmv、certificate五个文件夹

在BDMV中找到STREAM文件夹并跻身;在STREAM文件下得以看到录像文件,扩大名称为m贰ts

一. Iso是个复合文件

EMAIL功能达成:

#!/bin/sh
echo "###########################"
echo "---------------------------"
echo "begin to compress JS file."
for file in `find . -name "*.js"`
do
echo "Compressing $file …"
java -jar yuicompressor-2.4.8.jar -type js -o $file $file
done
echo "compress js file compeleted."
echo "---------------------------"

echo "begin to compress css file."
for file in `find . -name "*.css"`
do
echo "Compressing $file …"
java -jar yuicompressor-2.4.8.jar -type css -o $file $file
done
echo "compress CSS file compeleted."
echo "---------------------------" 

3. m2ts2

贰.1. Bdmv文书夹格式 BDMV(Blu-ray Disk Movie、BD-MV),为蓝光光碟规格之一的“BD-ROM”所采纳的格式之壹1

 

减弱脚本:

一. Iso是个复合文件

 

三.布署文件config.yaml

这次压缩选择 yui compress (二.肆.八)

 

二.一. Bdmv文书夹格式 BDMV(Blu-ray Disk Movie、BD-MV),为蓝光光碟规则之1的“BD-ROM”所运用的格式之一

 

笔者:: 绰号:老哇的爪子 ( 全名::Attilax Akbar Al Rapanui 阿提拉克斯 阿克巴 阿尔 拉帕努伊 ) 汉字名:艾龙,  EMAIL:146651984玖@qq.com

转发请评释来源: 

 

文件夹 PATH 列表

卷体系号为 0000-482三

E:.

├─BDMV

│  ├─AUXDATA

│  ├─BACKUP

│  │  ├─CLIPINF

│  │  ├─JAR

│  │  │  └─00000

│  │  └─PLAYLIST

│  ├─CLIPINF

│  ├─JAR

│  │  └─00000

│  ├─META

│  │  └─DL

│  ├─PLAYLIST

│  └─STREAM

└─CERTIFICATE

    └─BACKUP

 

相关文章

发表评论

电子邮件地址不会被公开。 必填项已用*标注

网站地图xml地图