def run(): tmpZipFilePath = os.getcwd() + "/Tools/ffmpeg/ffmpeg.zip" tmpZipFilePath = tmpZipFilePath.replace('\\', '/') # print(tmpZipFilePath) tmpTargetDirPath = os.path.splitext(tmpZipFilePath)[0] if os.path.isdir(tmpTargetDirPath) == False: # 先解压 print(u"第一次打开,先解压\n") tmpZipFile = zipfile.ZipFile(tmpZipFilePath) print(tmpZipFile.namelist()) tmpTargetDirPath = os.path.splitext(tmpZipFilePath)[0] os.mkdir(tmpTargetDirPath) for tmpOneName in tmpZipFile.namelist(): tmpZipFile.extract(tmpOneName, tmpTargetDirPath) tmpZipFile.close() print(u"解压完成\n") print( u"MP3的采样频率分为48000 44100 32000 24000 22050 16000 12050 8000等等。\n码率有320kbps 256 224 192 128 112 96 80 64 56等等,都是2的n次方。\n" ) print(u"输入音效文件地址:") tmpFilePath = str(raw_input()) tmpFilePath = Helper.Remove_r_n(tmpFilePath) print(u"输入采样(默认44100hz):") tmpHZ = str(raw_input()) tmpHZ = Helper.Remove_r_n(tmpHZ) if tmpHZ == "": tmpHZ = "44100" print(u"输入声道 数字(默认单声道 1):") tmpChannel = str(raw_input()) tmpChannel = Helper.Remove_r_n(tmpChannel) if tmpChannel == "": tmpChannel = "1" print(u"输入比特率 数字(默认96kbps):") tmpBits = str(raw_input()) tmpBits = Helper.Remove_r_n(tmpBits) if tmpBits == "": tmpBits = "96k" tmpStrParts = tmpFilePath.rpartition('.') tmpNewPath = tmpStrParts[0] + '_new' + tmpStrParts[1] + tmpStrParts[2] os.system(os.getcwd() + "/Tools/ffmpeg/ffmpeg/ffmpeg.exe -y -i " + tmpFilePath + " -ar " + tmpHZ + " -ac " + tmpChannel + " -ab " + tmpBits + "k " + tmpNewPath)
def run(): tmpZipFilePath=os.getcwd()+"/Tools/ffmpeg/ffmpeg.zip" tmpZipFilePath=tmpZipFilePath.replace('\\','/') # print(tmpZipFilePath) tmpTargetDirPath=os.path.splitext(tmpZipFilePath)[0] if os.path.isdir(tmpTargetDirPath)==False: # 先解压 print(u"第一次打开,先解压\n") tmpZipFile=zipfile.ZipFile(tmpZipFilePath) print(tmpZipFile.namelist()) tmpTargetDirPath=os.path.splitext(tmpZipFilePath)[0] os.mkdir(tmpTargetDirPath) for tmpOneName in tmpZipFile.namelist(): tmpZipFile.extract(tmpOneName,tmpTargetDirPath) tmpZipFile.close() print(u"解压完成\n") print(u"输入第一个视频文件地址:") tmpFirstFilePath=str(raw_input()) tmpFirstFilePath=Helper.Remove_r_n(tmpFirstFilePath) print(u"输入第二个视频文件地址:") tmpSecondFilePath=str(raw_input()) tmpSecondFilePath=Helper.Remove_r_n(tmpSecondFilePath) # 首先生成 .actemp 文件 tmpFistOutputPath=Make_actemp(tmpFirstFilePath) tmpSecondOutputPath=Make_actemp(tmpSecondFilePath) # copy 操作 将两个 .actemp 文件合并 tmpMergeFilePath=Helper.getdirpath(tmpSecondFilePath)+"combine.flv.actemp" tmpMergeFilePath=Helper.getWinPath(tmpMergeFilePath) tmpFistOutputPath=Helper.getWinPath(tmpFistOutputPath) tmpSecondOutputPath=Helper.getWinPath(tmpSecondOutputPath) tmpCommand='copy /b "'+tmpFistOutputPath+'"+"'+tmpSecondOutputPath+'" "'+tmpMergeFilePath+'" /y' print(tmpCommand) os.system(tmpCommand) # 生成视频格式 tmpMergeVideoFilePath=Helper.getdirpath(tmpSecondFilePath)+"combine.mp4" tmpMergeVideoFilePath=Helper.getWinPath(tmpMergeVideoFilePath) tmpCommand=os.getcwd()+'/Tools/ffmpeg/ffmpeg/ffmpeg.exe -i "'+tmpMergeFilePath+'" -f mp4 -qscale 0.01 -y "'+tmpMergeVideoFilePath+'"' print(tmpCommand) os.system(tmpCommand)
def run(): # print("to_JPG") tmpFilePath = str(raw_input("Input PNG or dir Path:")) tmpFilePath = tmpFilePath.replace("\r", "").replace("\n", "") # print('Convert '+tmpFilePath+':\n') if os.path.isdir(tmpFilePath): tmpFilePathList = Helper.list_all_files(tmpFilePath) for tmpOneFilePath in tmpFilePathList: convert_one(tmpOneFilePath) elif os.path.isfile(tmpFilePath): convert_one(tmpFilePath) print("Convert Finish!\n")
def run(): # print("to_JPG") tmpFilePath=str(raw_input("Input PNG or dir Path:")) tmpFilePath=tmpFilePath.replace("\r","").replace("\n","") print('Convert '+tmpFilePath+':\n') tmpNewSize=str(raw_input("Input Size eg:100,100:")) tmpNewSize=Helper.Remove_r_n(tmpNewSize) tmpStrParts=tmpNewSize.partition(',') tmpWidth=int(tmpStrParts[0]) tmpHeight=int(tmpStrParts[2]) try: Image.open(tmpFilePath).resize((tmpWidth,tmpHeight),Image.ANTIALIAS).save(tmpFilePath) except: print(tmpFilePath+' not image or disk no space\n') print("Convert Finish!\n")
def run(): # print("to_JPG") tmpFilePath = str(raw_input("Input PNG or dir Path:")) tmpFilePath = tmpFilePath.replace("\r", "").replace("\n", "") print('Convert ' + tmpFilePath + ':\n') tmpScaleStr = str(raw_input("Input Scale eg:0.6:")) tmpScaleStr = Helper.Remove_r_n(tmpScaleStr) tmpScale = float(tmpScaleStr) tmpImage = Image.open(tmpFilePath) print("Image Size:" + str(tmpImage.width) + "," + str(tmpImage.height)) tmpWidth = tmpImage.width * tmpScale tmpHeight = tmpImage.height * tmpScale tmpImage.resize((int(tmpWidth), int(tmpHeight)), Image.ANTIALIAS).save(tmpFilePath) print("Convert Finish!\n")
#!/usr/bin/python # -*- coding: UTF-8 -*- import hashlib from Tools import Helper import io import os try: from PIL import Image except: Helper.InstallModule('Pillow') from PIL import Image def run(): # print("to_JPG") tmpFilePath=str(raw_input("Input PNG or dir Path:")) tmpFilePath=tmpFilePath.replace("\r","").replace("\n","") print('Convert '+tmpFilePath+':\n') tmpNewSize=str(raw_input("Input Size eg:100,100:")) tmpNewSize=Helper.Remove_r_n(tmpNewSize) tmpStrParts=tmpNewSize.partition(',') tmpWidth=int(tmpStrParts[0]) tmpHeight=int(tmpStrParts[2]) try: Image.open(tmpFilePath).resize((tmpWidth,tmpHeight),Image.ANTIALIAS).save(tmpFilePath) except: print(tmpFilePath+' not image or disk no space\n') print("Convert Finish!\n")
#!/usr/bin/python # -*- coding: UTF-8 -*- from Tools import Helper Helper.Checkpip() from Tools import GetFileMD5 from Tools import GetStrMD5 from Tools import GetUnixTimeStamp from Tools import GetUnixTimeStamp_ms from Tools import MultiSizeIcon from Tools import HttpServer from Tools import CheckServerPortOpen from Tools import UnZipTools from Tools import UnicodeToChinese from Tools import ScreenCaptureGif from Tools import Notepad from Tools import PNGoo_Win from Tools import lua_5_3_5_Debug from Tools import luac_5_3_5_Debug from Tools import TextureMerger from Tools import GetGIMP from Tools import WinMerge from Tools import GetBigJPG from Tools import SimpleDownload from Tools import VisitFreeSoundEffect from Tools import SqliteStudio_2_1_5 from Tools import putty from Tools import GetStrSHA1 from Tools import GetStrBASE64 from Tools import BASE64_Decode