diff --git a/muk_web_glyphicons/README.md b/muk_web_glyphicons/README.md deleted file mode 100644 index e69de29..0000000 diff --git a/muk_web_glyphicons/static/lib/bootstrap/fonts/glyphicons-halflings-regular.eot b/muk_web_glyphicons/static/lib/bootstrap/fonts/glyphicons-halflings-regular.eot deleted file mode 100644 index b93a495..0000000 Binary files a/muk_web_glyphicons/static/lib/bootstrap/fonts/glyphicons-halflings-regular.eot and /dev/null differ diff --git a/muk_web_glyphicons/static/lib/bootstrap/fonts/glyphicons-halflings-regular.svg b/muk_web_glyphicons/static/lib/bootstrap/fonts/glyphicons-halflings-regular.svg deleted file mode 100644 index 94fb549..0000000 --- a/muk_web_glyphicons/static/lib/bootstrap/fonts/glyphicons-halflings-regular.svg +++ /dev/null @@ -1,288 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/muk_web_glyphicons/static/lib/bootstrap/fonts/glyphicons-halflings-regular.ttf b/muk_web_glyphicons/static/lib/bootstrap/fonts/glyphicons-halflings-regular.ttf deleted file mode 100644 index 1413fc6..0000000 Binary files a/muk_web_glyphicons/static/lib/bootstrap/fonts/glyphicons-halflings-regular.ttf and /dev/null differ diff --git a/muk_web_glyphicons/static/lib/bootstrap/fonts/glyphicons-halflings-regular.woff b/muk_web_glyphicons/static/lib/bootstrap/fonts/glyphicons-halflings-regular.woff deleted file mode 100644 index 9e61285..0000000 Binary files a/muk_web_glyphicons/static/lib/bootstrap/fonts/glyphicons-halflings-regular.woff and /dev/null differ diff --git a/muk_web_glyphicons/static/lib/bootstrap/fonts/glyphicons-halflings-regular.woff2 b/muk_web_glyphicons/static/lib/bootstrap/fonts/glyphicons-halflings-regular.woff2 deleted file mode 100644 index 64539b5..0000000 Binary files a/muk_web_glyphicons/static/lib/bootstrap/fonts/glyphicons-halflings-regular.woff2 and /dev/null differ diff --git a/muk_web_glyphicons/static/src/less/muk_web_glyphicons.less b/muk_web_glyphicons/static/src/less/muk_web_glyphicons.less deleted file mode 100644 index 3cc5593..0000000 --- a/muk_web_glyphicons/static/src/less/muk_web_glyphicons.less +++ /dev/null @@ -1,9 +0,0 @@ -@font-face { - font-family: 'Glyphicons Halflings'; - - src: url('/muk_web_glyphicons/static/lib/bootstrap/fonts/glyphicons-halflings-regular.eot'); - src: url('/muk_web_glyphicons/static/lib/bootstrap/fonts/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'), - url('/muk_web_glyphicons/static/lib/bootstrap/fonts/glyphicons-halflings-regular.woff2') format('woff2'), - url('/muk_web_glyphicons/static/lib/bootstrap/fonts/glyphicons-halflings-regular.woff') format('woff'), - url('/muk_web_glyphicons/static/lib/bootstrap/fonts/glyphicons-halflings-regular.ttf') format('truetype'), -} \ No newline at end of file diff --git a/muk_web_glyphicons/views/muk_web_glyphicons.xml b/muk_web_glyphicons/views/muk_web_glyphicons.xml deleted file mode 100644 index adfa692..0000000 --- a/muk_web_glyphicons/views/muk_web_glyphicons.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - diff --git a/muk_web_preview b/muk_web_preview new file mode 160000 index 0000000..2214d9a --- /dev/null +++ b/muk_web_preview @@ -0,0 +1 @@ +Subproject commit 2214d9a49a231fc14f1eae5818beccccb2d396c9 diff --git a/muk_web_glyphicons/LICENSE b/muk_web_preview_audio/LICENSE old mode 100644 new mode 100755 similarity index 100% rename from muk_web_glyphicons/LICENSE rename to muk_web_preview_audio/LICENSE diff --git a/muk_web_preview_audio/README.md b/muk_web_preview_audio/README.md new file mode 100755 index 0000000..d9e3887 --- /dev/null +++ b/muk_web_preview_audio/README.md @@ -0,0 +1,7 @@ +# MuK Preview Audio + +Extendes the Preview Dialog to support audio. Currently the following audio extensions are supported: + +* Wav (*.wav, audio/wav) +* Ogg Theora Vorbis (*.ogg, audio/ogg) +* MP3 (*.mp3, audio/mpeg) \ No newline at end of file diff --git a/muk_web_glyphicons/__init__.py b/muk_web_preview_audio/__init__.py old mode 100644 new mode 100755 similarity index 93% rename from muk_web_glyphicons/__init__.py rename to muk_web_preview_audio/__init__.py index a1cd351..48ccf85 --- a/muk_web_glyphicons/__init__.py +++ b/muk_web_preview_audio/__init__.py @@ -1,8 +1,6 @@ # -*- coding: utf-8 -*- ################################################################################### -# -# MuK Document Management System # # Copyright (C) 2017 MuK IT GmbH # @@ -19,4 +17,4 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . # -################################################################################### \ No newline at end of file +################################################################################### diff --git a/muk_web_preview_audio/__openerp__.py b/muk_web_preview_audio/__openerp__.py new file mode 100755 index 0000000..098bb20 --- /dev/null +++ b/muk_web_preview_audio/__openerp__.py @@ -0,0 +1,62 @@ +# -*- coding: utf-8 -*- + +################################################################################### +# +# Copyright (C) 2017 MuK IT GmbH +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +################################################################################### + +{ + "name": "MuK Preview Audio", + "summary": """Audio Preview""", + "description": """ + Extendes the Preview Dialog to support audio. + Currently the following audio extensions are supported: + - Wav (*.wav, audio/wav) + - Ogg Theora Vorbis (*.ogg, audio/ogg) + - MP3 (*.mp3, audio/mpeg) + """, + "version": "8.0.1.0", + "category": "Extra Tools", + "license": "AGPL-3", + "website": "http://www.mukit.at", + "author": "MuK IT", + "contributors": [ + "Mathias Markl ", + "EL HARTI Mohamed charif ", + ], + "depends": [ + "muk_web_preview", + ], + "data": [ + "template/assets.xml", + ], + "demo": [ + ], + "qweb": [ + "static/src/xml/*.xml", + ], + "images": [ + 'static/description/banner.png' + ], + "external_dependencies": { + "python": [], + "bin": [], + }, + "application": False, + "installable": True, + +} \ No newline at end of file diff --git a/muk_web_preview_audio/i18n/de.po b/muk_web_preview_audio/i18n/de.po new file mode 100755 index 0000000..1beeb4a --- /dev/null +++ b/muk_web_preview_audio/i18n/de.po @@ -0,0 +1,16 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-07-20 10:02+0000\n" +"PO-Revision-Date: 2017-07-20 10:02+0000\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + diff --git a/muk_web_preview_audio/static/description/banner.png b/muk_web_preview_audio/static/description/banner.png new file mode 100755 index 0000000..22510f2 Binary files /dev/null and b/muk_web_preview_audio/static/description/banner.png differ diff --git a/muk_web_preview_audio/static/description/icon.png b/muk_web_preview_audio/static/description/icon.png new file mode 100755 index 0000000..a62c6f1 Binary files /dev/null and b/muk_web_preview_audio/static/description/icon.png differ diff --git a/muk_web_preview_audio/static/description/index.html b/muk_web_preview_audio/static/description/index.html new file mode 100755 index 0000000..c631cf1 --- /dev/null +++ b/muk_web_preview_audio/static/description/index.html @@ -0,0 +1,40 @@ +
+
+

Preview Audio

+

Preview your audio files directly in Odoo.

+

MuK IT GmbH - + www.mukit.at

+
+ +
+
+
+ +
+
+
+

Overview

+

Extendes the Preview Dialog to support audio. + Currently the following audio extensions are supported:

+

+ Wav (*.wav, audio/wav)
+ Ogg Theora Vorbis (*.ogg, audio/ogg)
+ MP3 (*.mp3, audio/mpeg)
+

+
+
+
+ +
+

Help and Support

+ + +
\ No newline at end of file diff --git a/muk_web_preview_audio/static/description/logo.png b/muk_web_preview_audio/static/description/logo.png new file mode 100755 index 0000000..9427ce3 Binary files /dev/null and b/muk_web_preview_audio/static/description/logo.png differ diff --git a/muk_web_preview_audio/static/description/screenshot.png b/muk_web_preview_audio/static/description/screenshot.png new file mode 100755 index 0000000..2ff5bd0 Binary files /dev/null and b/muk_web_preview_audio/static/description/screenshot.png differ diff --git a/muk_web_preview_audio/static/lib/visualizer/visualizer.js b/muk_web_preview_audio/static/lib/visualizer/visualizer.js new file mode 100755 index 0000000..4d000be --- /dev/null +++ b/muk_web_preview_audio/static/lib/visualizer/visualizer.js @@ -0,0 +1,112 @@ +/********************************************************************************** +* +* Copyright (C) 2017 MuK IT GmbH +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Affero General Public License as +* published by the Free Software Foundation, either version 3 of the +* License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Affero General Public License for more details. +* +* You should have received a copy of the GNU Affero General Public License +* along with this program. If not, see . +* +**********************************************************************************/ + +window.AudioContext = window.AudioContext || window.webkitAudioContext || window.mozAudioContext; + +function Visualizer($audio, $container, $canvas) { + var _this = this; + + this.$audio = $audio; + this.$container = $container; + this.$canvas = $canvas; + + this.audio = $audio.get(0); + this.canvas = $canvas.get(0); + + this.audioCtx = new AudioContext(); + this.analyser = this.audioCtx.createAnalyser(); + this.audioSrc = this.audioCtx.createMediaElementSource(this.audio); + this.frequencyData = new Uint8Array(this.analyser.frequencyBinCount); + this.smoothEndingCounter = 0; + + this.audioSrc.connect(this.analyser); + this.analyser.connect(this.audioCtx.destination); + + this.ctx = this.canvas.getContext('2d'), + + this.capYPositionArray = []; + + this.$audio.bind('play', function (e) { + _this.smoothEndingCounter = 0; + _this.calcCanvas(); + _this.renderFrame(); + }); + + this.map = function (num, in_min, in_max, out_min, out_max) { + return (num - in_min) * (out_max - out_min) / (in_max - in_min) + out_min; + } + + this.calcCanvas = function() { + _this.canvas.width = _this.$container.width() !== 0 ? _this.$container.width() : 650; + _this.canvas.height = _this.$container.height() !== 0 ? _this.$container.height() : 360; + _this.cwidth = _this.canvas.width; + _this.cheight = _this.canvas.height - 4; + _this.meterWidth = 10; + _this.capHeight = 4; + _this.capStyle = '#FFF'; + _this.meterNum = (_this.$container.width() !== 0 ? _this.$container.width() : 650) / (10 + 2); + + _this.gradient = _this.ctx.createLinearGradient(0, 0, 0, _this.cheight); + _this.gradient.addColorStop(1, '#1CD5FB'); + _this.gradient.addColorStop(0.75, '#19DECA'); + _this.gradient.addColorStop(0.5, '#28F5A6'); + _this.gradient.addColorStop(0.25, '#19DE5A'); + _this.gradient.addColorStop(0, '#1CFB27'); + } + + this.renderFrame = function() { + if(_this.$container.width() !== _this.cwidth) { + _this.calcCanvas(); + } + + _this.ctx.clearRect(0, 0, _this.cwidth, _this.cheight); + + _this.analyser.getByteFrequencyData(_this.frequencyData); + var step = Math.round(_this.frequencyData.length / _this.meterNum); + + for (var i = 0; i < _this.meterNum; i++) { + var valueBar = _this.map(_this.frequencyData[i * step], 0, 255, 0, _this.cheight); + var valueCap = _this.map(_this.frequencyData[i * step], 0, 255, 0, _this.canvas.height); + + if (_this.capYPositionArray.length < Math.round(_this.meterNum)) { + _this.capYPositionArray.push(valueCap); + }; + + _this.ctx.fillStyle = _this.gradient; + _this.ctx.fillRect(i * 12, _this.cheight - valueBar, _this.meterWidth, _this.cheight); + + _this.ctx.fillStyle = _this.capStyle; + if (valueCap < _this.capYPositionArray[i]) { + _this.ctx.fillRect(i * 12, _this.canvas.height - (--_this.capYPositionArray[i]), _this.meterWidth, _this.capHeight); + } else { + _this.ctx.fillRect(i * 12, _this.canvas.height - valueCap, _this.meterWidth, _this.capHeight); + _this.capYPositionArray[i] = valueCap; + }; + } + + if(!_this.audio.paused) { + requestAnimationFrame(_this.renderFrame); + } else { + if(_this.smoothEndingCounter < 500) { + requestAnimationFrame(_this.renderFrame); + } + _this.smoothEndingCounter++; + } + } +}; diff --git a/muk_web_preview_audio/static/src/css/preview_content.css b/muk_web_preview_audio/static/src/css/preview_content.css new file mode 100755 index 0000000..9817f69 --- /dev/null +++ b/muk_web_preview_audio/static/src/css/preview_content.css @@ -0,0 +1,50 @@ +/********************************************************************************** +* +* Copyright (C) 2017 MuK IT GmbH +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Affero General Public License as +* published by the Free Software Foundation, either version 3 of the +* License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Affero General Public License for more details. +* +* You should have received a copy of the GNU Affero General Public License +* along with this program. If not, see . +* +**********************************************************************************/ + +.o_preview_audio { + position: absolute; + width: 100%; + height: 100%; +} +.o_preview_audio .visualizer-wrapper { + position: absolute; + height: 100%; + width: 100%; + background: -webkit-gradient(radial,center center,0,center center,460,from(#333333),to(#000000)); + background: -webkit-radial-gradient(circle,#333333,#000000); + background: -moz-radial-gradient(circle,#333333,#000000); + background: -ms-radial-gradient(circle,#333333,#000000); +} +.o_preview_audio .visualizer { + position: absolute; + width: 75%; + height: 80%; + top: 50%; + left: 50%; + transform: translate(-50%,-50%); + background: transparent; + box-shadow: none; +} +.o_preview_audio audio { + position: absolute; + bottom: 0; + width: 100%; +} + + diff --git a/muk_web_preview_audio/static/src/js/preview_handler.js b/muk_web_preview_audio/static/src/js/preview_handler.js new file mode 100755 index 0000000..a3c94bd --- /dev/null +++ b/muk_web_preview_audio/static/src/js/preview_handler.js @@ -0,0 +1,54 @@ +/********************************************************************************** +* +* Copyright (C) 2017 MuK IT GmbH +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Affero General Public License as +* published by the Free Software Foundation, either version 3 of the +* License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Affero General Public License for more details. +* +* You should have received a copy of the GNU Affero General Public License +* along with this program. If not, see . +* +**********************************************************************************/ + +openerp.muk_preview_audio_PreviewHandler =function(instance) { + +openerp.med_preview_PreviewHandler(instance); + +var _t = instance.web._t, + _lt = instance.web._lt; +var QWeb = instance.web.qweb; + +instance.web.AudioHandler =instance.web.BaseHandler.extend({ + mimetypeMap: { + '.wav': 'audio/wav', + '.ogg': 'audio/ogg', + '.mp3': 'audio/mpeg', + 'wav': 'audio/wav', + 'ogg': 'audio/ogg', + 'mp3': 'audio/mpeg', + }, + checkExtension: function(extension) { + return ['.wav', '.ogg', '.mp3', 'wav', 'ogg', 'mp3'].includes(extension); + }, + checkType: function(mimetype) { + return ['audio/wav', ' audio/ogg', 'audio/mpeg'].includes(mimetype); + }, + createHtml: function(url, mimetype, extension, title) { + var result = $.Deferred(); + if(!mimetype || mimetype === 'application/octet-stream') { + mimetype = this.mimetypeMap[extension]; + } + var $content = $(QWeb.render('AudioHTMLContent', {url: url, type: mimetype, title: title})); + var visualizer = new Visualizer($content.find('audio'), $content.find('.visualizer'), $content.find('canvas')); + result.resolve($content); + return $.when(result); + }, +}); +}; \ No newline at end of file diff --git a/muk_web_preview_audio/static/src/xml/preview_content.xml b/muk_web_preview_audio/static/src/xml/preview_content.xml new file mode 100755 index 0000000..af62a54 --- /dev/null +++ b/muk_web_preview_audio/static/src/xml/preview_content.xml @@ -0,0 +1,32 @@ + + + + + +
+
+
+ +
+ +
+
+
\ No newline at end of file diff --git a/muk_web_preview_audio/template/assets.xml b/muk_web_preview_audio/template/assets.xml new file mode 100755 index 0000000..1e95aec --- /dev/null +++ b/muk_web_preview_audio/template/assets.xml @@ -0,0 +1,30 @@ + + + + + + +