diff --git a/ext/handle_mp3/lib/jsmediatags.min.js b/ext/handle_mp3/lib/jsmediatags.min.js new file mode 100644 index 00000000..fcde0022 --- /dev/null +++ b/ext/handle_mp3/lib/jsmediatags.min.js @@ -0,0 +1,75 @@ +(function(v){"object"===typeof exports&&"undefined"!==typeof module?module.exports=v():"function"===typeof define&&define.amd?define([],v):("undefined"!==typeof window?window:"undefined"!==typeof global?global:"undefined"!==typeof self?self:this).jsmediatags=v()})(function(){return function f(h,m,k){function l(b,a){if(!m[b]){if(!h[b]){var e="function"==typeof require&&require;if(!a&&e)return e(b,!0);if(d)return d(b,!0);e=Error("Cannot find module '"+b+"'");throw e.code="MODULE_NOT_FOUND",e;}e=m[b]= +{exports:{}};h[b][0].call(e.exports,function(a){var e=h[b][1][a];return l(e?e:a)},e,e.exports,f,h,m,k)}return m[b].exports}for(var d="function"==typeof require&&require,c=0;ce.offset&&(e=this._sliceData(e.data, +0,d-e.offset),p.data=this._concatData(e,c));b&&(e=this._sliceData(p.data,0,g.offset-p.offset),p.data=this._concatData(e,g.data));this._fileData.splice(a.startIx,a.endIx-a.startIx+1,p)}}},{key:"_concatData",value:function(d,c){if("undefined"!==typeof ArrayBuffer&&ArrayBuffer.isView(d)){var b=new d.constructor(d.length+c.length);b.set(d,0);b.set(c,d.length);return b}return d.concat(c)}},{key:"_sliceData",value:function(d,c,b){return d.slice?d.slice(c,b):d.subarray(c,b)}},{key:"_getChunkRange",value:function(d, +c){for(var b=-1,a=-1,e=0,g=0;g=p-1){b=g;break}}if(-1===b)return{startIx:-1,endIx:-1,insertIx:e};for(g=b;g=p-1&&(a=g),c<=q+1);g++);-1===a&&(a=b);return{startIx:b,endIx:a}}},{key:"hasDataRange",value:function(d,c){for(var b=0;b=a.offset&&c=a&&d<=e){c=this._fileData[b];break}}if(c)return c.data[d-c.offset];throw Error("Offset "+d+" hasn't been loaded yet.");}}]);return f}();h.exports=f},{}],6:[function(f,h,m){function k(c,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+ +typeof b);c.prototype=Object.create(b&&b.prototype,{constructor:{value:c,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(c,b):c.__proto__=b)}var l=function(){function c(b,a){for(var e=0;eg?d[g]:""}};n&&(c.tags.track=n);return c}}],[{key:"getTagIdentifierByteRange",value:function(){return{offset:-128, +length:128}}},{key:"canReadTagFormat",value:function(a){return"TAG"===String.fromCharCode.apply(String,a.slice(0,3))}}]);return b}(m);var d="Blues;Classic Rock;Country;Dance;Disco;Funk;Grunge;Hip-Hop;Jazz;Metal;New Age;Oldies;Other;Pop;R&B;Rap;Reggae;Rock;Techno;Industrial;Alternative;Ska;Death Metal;Pranks;Soundtrack;Euro-Techno;Ambient;Trip-Hop;Vocal;Jazz+Funk;Fusion;Trance;Classical;Instrumental;Acid;House;Game;Sound Clip;Gospel;Noise;AlternRock;Bass;Soul;Punk;Space;Meditative;Instrumental Pop;Instrumental Rock;Ethnic;Gothic;Darkwave;Techno-Industrial;Electronic;Pop-Folk;Eurodance;Dream;Southern Rock;Comedy;Cult;Gangsta;Top 40;Christian Rap;Pop/Funk;Jungle;Native American;Cabaret;New Wave;Psychadelic;Rave;Showtunes;Trailer;Lo-Fi;Tribal;Acid Punk;Acid Jazz;Polka;Retro;Musical;Rock & Roll;Hard Rock;Folk;Folk-Rock;National Folk;Swing;Fast Fusion;Bebob;Latin;Revival;Celtic;Bluegrass;Avantgarde;Gothic Rock;Progressive Rock;Psychedelic Rock;Symphonic Rock;Slow Rock;Big Band;Chorus;Easy Listening;Acoustic;Humour;Speech;Chanson;Opera;Chamber Music;Sonata;Symphony;Booty Bass;Primus;Porn Groove;Satire;Slow Jam;Club;Tango;Samba;Folklore;Ballad;Power Ballad;Rhythmic Soul;Freestyle;Duet;Punk Rock;Drum Solo;Acapella;Euro-House;Dance Hall".split(";"); +h.exports=f},{"./MediaFileReader":10,"./MediaTagReader":11}],7:[function(f,h,m){function k(b){var a;switch(b){case 0:a="iso-8859-1";break;case 1:a="utf-16";break;case 2:a="utf-16be";break;case 3:a="utf-8"}return a}function l(b,a,e,g){g=e.getStringWithCharsetAt(b+1,a-1,g);b=e.getStringWithCharsetAt(b+1+g.bytesReadCount,a-1-g.bytesReadCount);return{user_description:g.toString(),data:b.toString()}}f("./MediaFileReader");var d={APIC:function(b,a,e,g,p){p=p||"3";g=b;var d=k(e.getByteAt(b));switch(p){case "2":p= +e.getStringAt(b+1,3);b+=4;break;case "3":case "4":p=e.getStringWithCharsetAt(b+1,a-1);b+=1+p.bytesReadCount;break;default:throw Error("Couldn't read ID3v2 major version.");}var r=e.getByteAt(b,1),r=c[r],d=e.getStringWithCharsetAt(b+1,a-(b-g)-1,d);b+=1+d.bytesReadCount;return{format:p.toString(),type:r,description:d.toString(),data:e.getBytesAt(b,g+a-b)}},COMM:function(b,a,e,g,c){var d=b,r=k(e.getByteAt(b));g=e.getStringAt(b+1,3);c=e.getStringWithCharsetAt(b+4,a-4,r);b+=4+c.bytesReadCount;b=e.getStringWithCharsetAt(b, +d+a-b,r);return{language:g,short_description:c.toString(),text:b.toString()}}};d.COM=d.COMM;d.PIC=function(b,a,e,g,c){return d.APIC(b,a,e,g,"2")};d.PCNT=function(b,a,e,g,c){return e.getLongAt(b,!1)};d.CNT=d.PCNT;d["T*"]=function(b,a,e,g,c){g=k(e.getByteAt(b));return e.getStringWithCharsetAt(b+1,a-1,g).toString()};d.TXXX=function(b,a,e,g,c){g=k(e.getByteAt(b));return l(b,a,e,g)};d["W*"]=function(b,a,e,g,c){g=k(e.getByteAt(b));return void 0!==g?l(b,a,e,g):e.getStringWithCharsetAt(b,a,g).toString()}; +d.TCON=function(b,a,e,g){return d["T*"].apply(this,arguments).replace(/^\(\d+\)/,"")};d.TCO=d.TCON;d.USLT=function(b,a,e,g,c){var d=b,r=k(e.getByteAt(b));g=e.getStringAt(b+1,3);c=e.getStringWithCharsetAt(b+4,a-4,r);b+=4+c.bytesReadCount;b=e.getStringWithCharsetAt(b,d+a-b,r);return{language:g,descriptor:c.toString(),lyrics:b.toString()}};d.ULT=d.USLT;var c="Other;32x32 pixels 'file icon' (PNG only);Other file icon;Cover (front);Cover (back);Leaflet page;Media (e.g. label side of CD);Lead artist/lead performer/soloist;Artist/performer;Conductor;Band/Orchestra;Composer;Lyricist/text writer;Recording Location;During recording;During performance;Movie/video screen capture;A bright coloured fish;Illustration;Band/artist logotype;Publisher/Studio logotype".split(";"); +h.exports={getFrameReaderFunction:function(b){return b in d?d[b]:"T"===b[0]?d["T*"]:"W"===b[0]?d["W*"]:null}}},{"./MediaFileReader":10}],8:[function(f,h,m){function k(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}var l=function(){function a(b, +e){for(var c=0;c2.4",tags:{}};var d=b.getByteAt(c+4),n=b.isBitSetAt(c+5,7),f=b.isBitSetAt(c+5,6),l=b.isBitSetAt(c+5,5),t=b.getSynchsafeInteger32At(c+6),c=c+10;if(f)var k=b.getLongAt(c,!0),c=c+ +(k+4);var g={type:"ID3",version:"2."+g+"."+d,major:g,revision:d,flags:{unsynchronisation:n,extended_header:f,experimental_indicator:l,footer_present:!1},size:t,tags:{}},c=this._readFrames(c,t+10,b,g,e),h;for(h in a)a.hasOwnProperty(h)&&(t=this._getFrameData(c,a[h]))&&(g.tags[h]=t);for(var m in c)c.hasOwnProperty(m)&&(g.tags[m]=c[m]);return g}},{key:"_getUnsyncFileReader",value:function(a,b,c){a=a.getBytesAt(b,c);for(b=0;b=a.getSize())e.onSuccess();else{var d=this,f=a.getLongAt(b,!0);if(0==f||isNaN(f))e.onSuccess();else{var n= +a.getStringAt(b+4,4);if(this._isContainerAtom(n)){"meta"==n&&(b+=4);var l=(c?c+".":"")+n;"moov.udta.meta.ilst"===l?a.loadRange([b,b+f],e):a.loadRange([b+8,b+8+8],{onSuccess:function(){d._loadAtom(a,b+8,l,e)},onError:e.onError})}else a.loadRange([b+f,b+f+8],{onSuccess:function(){d._loadAtom(a,b+f,c,e)},onError:e.onError})}}}},{key:"_isContainerAtom",value:function(a){return 0<=["moov","udta","meta","ilst"].indexOf(a)}},{key:"_canReadAtom",value:function(a){return"----"!==a}},{key:"_parseData",value:function(a, +c){var e={};c=this._expandShortcutTags(c);this._readAtom(e,a,0,a.getSize(),c);for(var d in b)if(b.hasOwnProperty(d)){var f=e[b[d]];f&&(e[d]="track"===d?f.data.track:f.data)}return{type:"MP4",ftyp:a.getStringAt(8,4),version:a.getLongAt(12,!0),tags:e}}},{key:"_readAtom",value:function(a,b,c,e,d,f,n){n=void 0===n?"":n+" ";for(var l=c;la&&(a+=65536);return a}},{key:"getSShortAt",value:function(c,b){var a=this.getShortAt(c,b);return 32767a&&(a+=4294967296);return a}},{key:"getSLongAt",value:function(c,b){var a=this.getLongAt(c,b);return 2147483647< +a?a-4294967296:a}},{key:"getInteger24At",value:function(c,b){var a=this.getByteAt(c),e=this.getByteAt(c+1),d=this.getByteAt(c+2),a=b?((a<<8)+e<<8)+d:((d<<8)+e<<8)+a;0>a&&(a+=16777216);return a}},{key:"getStringAt",value:function(c,b){for(var a=[],e=c,d=0;eh||224<=h?c[f]=String.fromCharCode(k):(h=(d[a+e]<<8)+d[a+g],a+=2,c[f]=String.fromCharCode(k,h))}return new l(c.join(""),a)},readUTF8String:function(d,c){var b=0;c=Math.min(c||d.length,d.length);239==d[0]&&187==d[1]&&191==d[2]&&(b=3);for(var a=[],e=0;bg)a[e]=String.fromCharCode(g);else if(194<= +g&&224>g){var f=d[b++];a[e]=String.fromCharCode(((g&31)<<6)+(f&63))}else if(224<=g&&240>g){var f=d[b++],h=d[b++];a[e]=String.fromCharCode(((g&255)<<12)+((f&63)<<6)+(h&63))}else if(240<=g&&245>g){var f=d[b++],h=d[b++],k=d[b++],g=((g&7)<<18)+((f&63)<<12)+((h&63)<<6)+(k&63)-65536;a[e]=String.fromCharCode((g>>10)+55296,(g&1023)+56320)}}return new l(a.join(""),b)},readNullTerminatedString:function(d,c){var b=[];c=c||d.length;for(var a=0;ab._config.disallowedXhrHeaders.indexOf(c.toLowerCase())&&a.setRequestHeader(c,d)}},{key:"_hasResponseHeader",value:function(a,b){var c=a.getAllResponseHeaders();if(!c)return!1;for(var c=c.split("\r\n"),d=[],f=0;f< +c.length;f++)d[f]=c[f].split(":")[0].toLowerCase();return 0<=d.indexOf(b.toLowerCase())}},{key:"_getResponseHeader",value:function(a,b){return this._hasResponseHeader(a,b)?a.getResponseHeader(b):null}},{key:"getByteAt",value:function(a){return this._fileData.getByteAt(a).charCodeAt(0)&255}},{key:"_createXHRObject",value:function(){if("undefined"===typeof window)return new (f("xhr2").XMLHttpRequest);if(window.XMLHttpRequest)return new window.XMLHttpRequest;throw Error("XMLHttpRequest is not supported"); +}}],[{key:"canReadFile",value:function(a){return"string"===typeof a&&/^[a-z]+:\/\//i.test(a)}},{key:"setConfig",value:function(a){for(var b in a)a.hasOwnProperty(b)&&(this._config[b]=a[b]);a=this._config.disallowedXhrHeaders;for(b=0;ba.offset&&(-a.offset>b||0=b||c)}var d=function(){function a(b,c){for(var d=0;dg.offset&&g.offset<-e/2?c.push(q[f]):d.push(q[f]))}var h=!1,f={onSuccess:function(){if(h){for(var c=0;cfilesize = $metadata['size']; $image->hash = $metadata['hash']; + + //Filename is renamed to "artist - title.mp3" when the user requests download by using the download attribute & jsmediatags.js + $image->filename = $metadata['filename']; + $image->ext = $metadata['extension']; $image->tag_array = $metadata['tags']; $image->source = $metadata['source']; diff --git a/ext/handle_mp3/style.css b/ext/handle_mp3/style.css new file mode 100644 index 00000000..5a6fa3f8 --- /dev/null +++ b/ext/handle_mp3/style.css @@ -0,0 +1,14 @@ +.audio { + min-width: 300px; + width: 65%; +} +/* Hide download button as we use our own */ +audio::-internal-media-controls-download-button { + display:none; +} +audio::-webkit-media-controls-enclosure { + overflow:hidden; +} +audio::-webkit-media-controls-panel { + width: calc(100% + 30px); /* Adjust as needed */ +} diff --git a/ext/handle_mp3/theme.php b/ext/handle_mp3/theme.php index d6beb126..039eade8 100644 --- a/ext/handle_mp3/theme.php +++ b/ext/handle_mp3/theme.php @@ -6,17 +6,35 @@ class MP3FileHandlerTheme extends Themelet { $ilink = $image->get_image_link(); $fname = url_escape($image->filename); //Most of the time this will be the title/artist of the song. $html = " - - - - - -

Download"; + +

Title: ??? | Artist: ???

+ + + +

Download"; + + $page->add_html_header(""); $page->add_block(new Block("Music", $html, "main", 10)); } } diff --git a/ext/handle_mp3/xspf_player_license.txt b/ext/handle_mp3/xspf_player_license.txt deleted file mode 100644 index 12d609e1..00000000 --- a/ext/handle_mp3/xspf_player_license.txt +++ /dev/null @@ -1,10 +0,0 @@ -Copyright (c) 2005, Fabricio Zuardi -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - * Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/ext/handle_mp3/xspf_player_slim.swf b/ext/handle_mp3/xspf_player_slim.swf deleted file mode 100644 index 24b36c9d..00000000 Binary files a/ext/handle_mp3/xspf_player_slim.swf and /dev/null differ diff --git a/ext/handle_video/theme.php b/ext/handle_video/theme.php index e8b7008f..9cc28fa5 100644 --- a/ext/handle_video/theme.php +++ b/ext/handle_video/theme.php @@ -50,7 +50,9 @@ class VideoFileHandlerTheme extends Themelet { {$html_fallback} - "; + + + "; } } else {