gyorgy@0: import sys gyorgy@0: import os gyorgy@0: import shutil gyorgy@0: gyorgy@0: me_filename = 'mediaelement' gyorgy@0: mep_filename = 'mediaelementplayer' gyorgy@0: combined_filename = 'mediaelement-and-player' gyorgy@0: gyorgy@0: # BUILD MediaElement (single file) gyorgy@0: gyorgy@0: me_files = [] gyorgy@0: me_files.append('me-header.js') gyorgy@0: me_files.append('me-namespace.js') gyorgy@0: me_files.append('me-utility.js') gyorgy@0: me_files.append('me-plugindetector.js') gyorgy@0: me_files.append('me-featuredetection.js') gyorgy@0: me_files.append('me-mediaelements.js') gyorgy@0: me_files.append('me-shim.js') gyorgy@0: gyorgy@0: code = '' gyorgy@0: gyorgy@0: for item in me_files: gyorgy@0: src_file = open('js/' + item,'r') gyorgy@0: code += src_file.read() + "\n" gyorgy@0: gyorgy@0: tmp_file = open('../build/' + me_filename + '.js','w') gyorgy@0: tmp_file.write(code) gyorgy@0: tmp_file.close() gyorgy@0: gyorgy@0: # BUILD MediaElementPlayer (single file) gyorgy@0: gyorgy@0: mep_files = [] gyorgy@0: mep_files.append('mep-header.js') gyorgy@0: mep_files.append('mep-library.js') gyorgy@0: mep_files.append('mep-player.js') gyorgy@0: mep_files.append('mep-feature-playpause.js') gyorgy@0: mep_files.append('mep-feature-stop.js') gyorgy@0: mep_files.append('mep-feature-progress.js') gyorgy@0: mep_files.append('mep-feature-time.js') gyorgy@0: mep_files.append('mep-feature-volume.js') gyorgy@0: mep_files.append('mep-feature-fullscreen.js') gyorgy@0: mep_files.append('mep-feature-tracks.js') gyorgy@0: mep_files.append('mep-feature-contextmenu.js') gyorgy@0: gyorgy@0: code = '' gyorgy@0: gyorgy@0: for item in mep_files: gyorgy@0: src_file = open('js/' + item,'r') gyorgy@0: code += src_file.read() + "\n" gyorgy@0: gyorgy@0: tmp_file = open('../build/' + mep_filename + '.js','w') gyorgy@0: tmp_file.write(code) gyorgy@0: tmp_file.close() gyorgy@0: gyorgy@0: # MINIFY both scripts gyorgy@0: gyorgy@0: # os.system("java -jar yuicompressor-2.4.2.jar ../build/" + me_filename + ".js -o ../build/" + me_filename + ".min.js --charset utf-8 -v") gyorgy@0: # os.system("java -jar yuicompressor-2.4.2.jar ../build/" + mep_filename + ".js -o ../build/" + mep_filename + ".min.js --charset utf-8 -v") gyorgy@0: os.system("java -jar compiler.jar --js ../build/" + me_filename + ".js --js_output_file ../build/" + me_filename + ".min.js") gyorgy@0: os.system("java -jar compiler.jar --js ../build/" + mep_filename + ".js --js_output_file ../build/" + mep_filename + ".min.js") gyorgy@0: gyorgy@0: # PREPEND intros gyorgy@0: def addHeader(headerFilename, filename): gyorgy@0: gyorgy@0: # get the header text gyorgy@0: tmp_file = open(headerFilename) gyorgy@0: header_txt = tmp_file.read(); gyorgy@0: tmp_file.close() gyorgy@0: gyorgy@0: # read the current contents of the file gyorgy@0: tmp_file = open(filename) gyorgy@0: file_txt = tmp_file.read() gyorgy@0: tmp_file.close() gyorgy@0: gyorgy@0: # open the file again for writing gyorgy@0: tmp_file = open(filename, 'w') gyorgy@0: tmp_file.write(header_txt) gyorgy@0: # write the original contents gyorgy@0: tmp_file.write(file_txt) gyorgy@0: tmp_file.close() gyorgy@0: gyorgy@0: addHeader('js/me-header.js', '../build/' + me_filename + '.min.js') gyorgy@0: addHeader('js/mep-header.js', '../build/' + mep_filename + '.min.js') gyorgy@0: gyorgy@0: gyorgy@0: # COMBINE into single script gyorgy@0: gyorgy@0: code = '' gyorgy@0: src_file = open('../build/' + me_filename + '.js','r') gyorgy@0: code += src_file.read() + "\n" gyorgy@0: src_file = open('../build/' + mep_filename + '.js','r') gyorgy@0: code += src_file.read() + "\n" gyorgy@0: gyorgy@0: tmp_file = open('../build/' + combined_filename + '.js','w') gyorgy@0: tmp_file.write(code) gyorgy@0: tmp_file.close() gyorgy@0: gyorgy@0: code = '' gyorgy@0: src_file = open('../build/' + me_filename + '.min.js','r') gyorgy@0: code += src_file.read() + "\n" gyorgy@0: src_file = open('../build/' + mep_filename + '.min.js','r') gyorgy@0: code += src_file.read() + "\n" gyorgy@0: gyorgy@0: tmp_file = open('../build/' + combined_filename + '.min.js','w') gyorgy@0: tmp_file.write(code) gyorgy@0: tmp_file.close() gyorgy@0: gyorgy@0: gyorgy@0: # MINIFY CSS gyorgy@0: src_file = open('css/mediaelementplayer.css','r') gyorgy@0: tmp_file = open('../build/mediaelementplayer.css','w') gyorgy@0: tmp_file.write(src_file.read()) gyorgy@0: tmp_file.close() gyorgy@0: os.system("java -jar yuicompressor-2.4.2.jar ../build/mediaelementplayer.css -o ../build/mediaelementplayer.min.css --charset utf-8 -v") gyorgy@0: gyorgy@0: #COPY skin files gyorgy@0: shutil.copy2('css/controls.png','../build/controls.png') gyorgy@0: shutil.copy2('css/bigplay.png','../build/bigplay.png') gyorgy@0: shutil.copy2('css/loading.gif','../build/loading.gif') gyorgy@0: gyorgy@0: shutil.copy2('css/mejs-skins.css','../build/mejs-skins.css') gyorgy@0: shutil.copy2('css/controls-ted.png','../build/controls-ted.png') gyorgy@0: shutil.copy2('css/controls-wmp.png','../build/controls-wmp.png') gyorgy@0: shutil.copy2('css/controls-wmp-bg.png','../build/controls-wmp-bg.png')