├── node
├── .gitignore
├── config
│ ├── config.json
│ └── config.js
├── package.json
├── index.html
├── json_filename.js
└── package-lock.json
├── .gitignore
├── sounds
├── No.mp3
├── Ya-mon!.mp3
├── Constipated.mp3
├── Do-do-do-do.mp3
├── Happy-Purim.mp3
├── Idiotic-jerk.mp3
├── Laugh-Bird.mp3
├── Laugh-Brooke.mp3
├── Laugh-Goofy.mp3
├── Yank-it-baby.mp3
├── Yeeeeeeesss.mp3
├── Frosty-Nads[Q].mp3
├── Happy-Birthday.mp3
├── Laugh-Gilbert.mp3
├── Laugh-Montage.mp3
├── Ayayayayayayayay!.mp3
├── I-Don't-Believe-It.mp3
├── Loan-me-50-Dollars.mp3
├── Floridians-Dumb-as-dirt.mp3
└── Only-in-the-Banana-Republic.mp3
├── php
├── getID3
│ ├── module.audio.ac3.php
│ ├── module.audio-video.mpeg.php
│ ├── module.misc.par2.php
│ ├── module.misc.pdf.php
│ ├── module.misc.msoffice.php
│ ├── module.archive.rar.php
│ ├── module.audio.aa.php
│ ├── module.audio-video.bink.php
│ ├── module.graphic.efax.php
│ ├── write.lyrics3.php
│ ├── module.misc.exe.php
│ ├── module.audio.mod.php
│ ├── module.archive.szip.php
│ ├── module.graphic.svg.php
│ ├── module.audio.rkau.php
│ ├── module.audio.amr.php
│ ├── write.vorbiscomment.php
│ ├── module.audio-video.ts.php
│ ├── module.audio.tta.php
│ ├── module.audio.dss.php
│ ├── module.graphic.pcd.php
│ ├── module.audio.au.php
│ ├── write.id3v1.php
│ ├── module.audio-video.swf.php
│ ├── module.audio.lpac.php
│ ├── module.audio.vqf.php
│ ├── write.metaflac.php
│ ├── extension.cache.dbm.php
│ ├── module.audio.avr.php
│ ├── module.audio.dsf.php
│ ├── module.archive.tar.php
│ ├── extension.cache.mysql.php
│ ├── extension.cache.mysqli.php
│ ├── module.audio.shorten.php
│ ├── write.apetag.php
│ ├── module.audio.voc.php
│ └── module.graphic.tiff.php
├── config.php
├── index.php
├── buildJSON_filename.php
├── filename_version.php
└── buildJSON_id3.php
├── inc
├── js
│ └── filter.js
├── json
│ └── soundboard.json
└── css
│ └── sb.css
├── README.md
└── index.html
/node/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules/
2 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | sounds/
2 | .vscode/
3 |
4 |
--------------------------------------------------------------------------------
/sounds/No.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/digitalcolony/Simple-Soundboard/HEAD/sounds/No.mp3
--------------------------------------------------------------------------------
/sounds/Ya-mon!.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/digitalcolony/Simple-Soundboard/HEAD/sounds/Ya-mon!.mp3
--------------------------------------------------------------------------------
/sounds/Constipated.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/digitalcolony/Simple-Soundboard/HEAD/sounds/Constipated.mp3
--------------------------------------------------------------------------------
/sounds/Do-do-do-do.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/digitalcolony/Simple-Soundboard/HEAD/sounds/Do-do-do-do.mp3
--------------------------------------------------------------------------------
/sounds/Happy-Purim.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/digitalcolony/Simple-Soundboard/HEAD/sounds/Happy-Purim.mp3
--------------------------------------------------------------------------------
/sounds/Idiotic-jerk.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/digitalcolony/Simple-Soundboard/HEAD/sounds/Idiotic-jerk.mp3
--------------------------------------------------------------------------------
/sounds/Laugh-Bird.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/digitalcolony/Simple-Soundboard/HEAD/sounds/Laugh-Bird.mp3
--------------------------------------------------------------------------------
/sounds/Laugh-Brooke.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/digitalcolony/Simple-Soundboard/HEAD/sounds/Laugh-Brooke.mp3
--------------------------------------------------------------------------------
/sounds/Laugh-Goofy.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/digitalcolony/Simple-Soundboard/HEAD/sounds/Laugh-Goofy.mp3
--------------------------------------------------------------------------------
/sounds/Yank-it-baby.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/digitalcolony/Simple-Soundboard/HEAD/sounds/Yank-it-baby.mp3
--------------------------------------------------------------------------------
/sounds/Yeeeeeeesss.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/digitalcolony/Simple-Soundboard/HEAD/sounds/Yeeeeeeesss.mp3
--------------------------------------------------------------------------------
/sounds/Frosty-Nads[Q].mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/digitalcolony/Simple-Soundboard/HEAD/sounds/Frosty-Nads[Q].mp3
--------------------------------------------------------------------------------
/sounds/Happy-Birthday.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/digitalcolony/Simple-Soundboard/HEAD/sounds/Happy-Birthday.mp3
--------------------------------------------------------------------------------
/sounds/Laugh-Gilbert.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/digitalcolony/Simple-Soundboard/HEAD/sounds/Laugh-Gilbert.mp3
--------------------------------------------------------------------------------
/sounds/Laugh-Montage.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/digitalcolony/Simple-Soundboard/HEAD/sounds/Laugh-Montage.mp3
--------------------------------------------------------------------------------
/sounds/Ayayayayayayayay!.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/digitalcolony/Simple-Soundboard/HEAD/sounds/Ayayayayayayayay!.mp3
--------------------------------------------------------------------------------
/sounds/I-Don't-Believe-It.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/digitalcolony/Simple-Soundboard/HEAD/sounds/I-Don't-Believe-It.mp3
--------------------------------------------------------------------------------
/sounds/Loan-me-50-Dollars.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/digitalcolony/Simple-Soundboard/HEAD/sounds/Loan-me-50-Dollars.mp3
--------------------------------------------------------------------------------
/php/getID3/module.audio.ac3.php:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/digitalcolony/Simple-Soundboard/HEAD/php/getID3/module.audio.ac3.php
--------------------------------------------------------------------------------
/sounds/Floridians-Dumb-as-dirt.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/digitalcolony/Simple-Soundboard/HEAD/sounds/Floridians-Dumb-as-dirt.mp3
--------------------------------------------------------------------------------
/php/getID3/module.audio-video.mpeg.php:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/digitalcolony/Simple-Soundboard/HEAD/php/getID3/module.audio-video.mpeg.php
--------------------------------------------------------------------------------
/sounds/Only-in-the-Banana-Republic.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/digitalcolony/Simple-Soundboard/HEAD/sounds/Only-in-the-Banana-Republic.mp3
--------------------------------------------------------------------------------
/node/config/config.json:
--------------------------------------------------------------------------------
1 | {
2 | "soundboard": {
3 | "MP3_DIRECTORY": "../sounds/",
4 | "JSON_FILENAME": "../inc/json/soundboard.json",
5 | "SOUNDBOARD_PAGE": "/"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/php/config.php:
--------------------------------------------------------------------------------
1 | '../sounds/',
4 | 'JSON_FILENAME' => '../inc/json/soundboard.json',
5 | 'SOUNDBOARD_PAGE' => '/',
6 | 'TIME_ZONE' => 'America/Los_Angeles'
7 | );
8 | ?>
9 |
10 |
--------------------------------------------------------------------------------
/node/config/config.js:
--------------------------------------------------------------------------------
1 | var env = process.env.NODE_ENV || "soundboard";
2 |
3 | if (env === "soundboard") {
4 | const config = require("./config.json");
5 | let envConfig = config[env];
6 |
7 | Object.keys(envConfig).forEach(key => {
8 | process.env[key] = envConfig[key];
9 | });
10 | }
11 |
--------------------------------------------------------------------------------
/node/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "node",
3 | "version": "1.0.0",
4 | "description": "Build a JSON file for the Simple Soundboard",
5 | "main": "json_filename.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "author": "",
10 | "license": "ISC",
11 | "dependencies": {
12 | "path": "^0.12.7"
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/node/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Build Simple Soundboard JSON File (Node)
8 |
9 |
10 |
11 | Build Simple Soundboard JSON File (Node)
12 |
13 | Update the config/config.js before building your JSON file.
14 |
15 | File Name Version
16 | Use [Q] for ? and spaces will be replaced with dashes.
17 | node json_filename.js
18 |
19 | ID3 Version
20 |
21 | Use a tool such as MP3Tag to
22 | update the ID3 fields of your MP3s.
23 |
24 | ID3 version is not coded yet.
25 |
26 |
27 |
--------------------------------------------------------------------------------
/node/json_filename.js:
--------------------------------------------------------------------------------
1 | require("./config/config");
2 | const path = require("path");
3 | const fs = require("fs");
4 |
5 | String.prototype.replaceAll = function(search, replace) {
6 | if (replace === undefined) {
7 | return this.toString();
8 | }
9 | return this.split(search).join(replace);
10 | };
11 |
12 | var obj = {
13 | files: []
14 | };
15 | const getSoundFileName = val => {
16 | let soundname = path.parse(val).name;
17 | soundname = soundname.replaceAll("[Q]", "?").replaceAll("-", " ");
18 | return soundname;
19 | };
20 |
21 | fs.readdirSync(process.env["MP3_DIRECTORY"]).forEach(file => {
22 | obj.files.push({
23 | name: getSoundFileName(file),
24 | artist: "", // artist is not built with filename version
25 | mp3: process.env["MP3_DIRECTORY"] + file.toString()
26 | });
27 | });
28 |
29 | const json = JSON.stringify(obj);
30 | fs.writeFile(process.env["JSON_FILENAME"], json, "utf8", function(err) {
31 | if (err) {
32 | throw err;
33 | }
34 | });
35 |
--------------------------------------------------------------------------------
/inc/js/filter.js:
--------------------------------------------------------------------------------
1 | const filterInput = document.getElementById("filterInput");
2 | const filterClearBtn = document.getElementById("filterClearBtn");
3 |
4 | document.addEventListener("DOMContentLoaded", function(event) {
5 | registerEventListeners();
6 | });
7 |
8 | function registerEventListeners() {
9 | filterInput.addEventListener("input", filterDrops);
10 | filterClearBtn.addEventListener("click", filterClear);
11 | }
12 |
13 | function filterClear(e){
14 | filterInput.value = "";
15 | filterInput.dispatchEvent(new Event("input"));
16 | }
17 |
18 | function filterDrops(e) {
19 | const text = e.target.value.toLowerCase();
20 | document.querySelectorAll(".myButton").forEach(function(drop) {
21 | const title = drop.firstChild.textContent;
22 | let artist = drop.getAttribute("data-balloon");
23 | if (artist === null) {
24 | artist = "";
25 | }
26 | // Search both title and artist
27 | const track = title + artist;
28 |
29 | if (track.toLowerCase().indexOf(text) != -1) {
30 | drop.style.display = "inline";
31 | } else {
32 | drop.style.display = "none";
33 | }
34 | });
35 | }
36 |
--------------------------------------------------------------------------------
/node/package-lock.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "node",
3 | "version": "1.0.0",
4 | "lockfileVersion": 1,
5 | "requires": true,
6 | "dependencies": {
7 | "inherits": {
8 | "version": "2.0.3",
9 | "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
10 | "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4="
11 | },
12 | "path": {
13 | "version": "0.12.7",
14 | "resolved": "https://registry.npmjs.org/path/-/path-0.12.7.tgz",
15 | "integrity": "sha1-1NwqUGxM4hl+tIHr/NWzbAFAsQ8=",
16 | "requires": {
17 | "process": "^0.11.1",
18 | "util": "^0.10.3"
19 | }
20 | },
21 | "process": {
22 | "version": "0.11.10",
23 | "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz",
24 | "integrity": "sha1-czIwDoQBYb2j5podHZGn1LwW8YI="
25 | },
26 | "util": {
27 | "version": "0.10.4",
28 | "resolved": "https://registry.npmjs.org/util/-/util-0.10.4.tgz",
29 | "integrity": "sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A==",
30 | "requires": {
31 | "inherits": "2.0.3"
32 | }
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/php/getID3/module.misc.par2.php:
--------------------------------------------------------------------------------
1 | //
4 | // available at http://getid3.sourceforge.net //
5 | // or http://www.getid3.org //
6 | // also https://github.com/JamesHeinrich/getID3 //
7 | /////////////////////////////////////////////////////////////////
8 | // See readme.txt for more details //
9 | /////////////////////////////////////////////////////////////////
10 | // //
11 | // module.misc.par2.php //
12 | // module for analyzing PAR2 files //
13 | // dependencies: NONE //
14 | // ///
15 | /////////////////////////////////////////////////////////////////
16 |
17 |
18 | class getid3_par2 extends getid3_handler
19 | {
20 |
21 | public function Analyze() {
22 | $info = &$this->getid3->info;
23 |
24 | $info['fileformat'] = 'par2';
25 |
26 | $this->error('PAR2 parsing not enabled in this version of getID3()');
27 | return false;
28 |
29 | }
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/php/getID3/module.misc.pdf.php:
--------------------------------------------------------------------------------
1 | //
4 | // available at http://getid3.sourceforge.net //
5 | // or http://www.getid3.org //
6 | // also https://github.com/JamesHeinrich/getID3 //
7 | /////////////////////////////////////////////////////////////////
8 | // See readme.txt for more details //
9 | /////////////////////////////////////////////////////////////////
10 | // //
11 | // module.misc.pdf.php //
12 | // module for analyzing PDF files //
13 | // dependencies: NONE //
14 | // ///
15 | /////////////////////////////////////////////////////////////////
16 |
17 |
18 | class getid3_pdf extends getid3_handler
19 | {
20 |
21 | public function Analyze() {
22 | $info = &$this->getid3->info;
23 |
24 | $info['fileformat'] = 'pdf';
25 |
26 | $this->error('PDF parsing not enabled in this version of getID3() ['.$this->getid3->version().']');
27 | return false;
28 |
29 | }
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/php/index.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Build Simple Soundboard JSON File
8 |
9 |
10 | Build Simple Soundboard JSON File
11 |
15 | MP3_DIRECTORY;
18 | $json_file = $configs->JSON_FILENAME;
19 | date_default_timezone_set($configs->TIME_ZONE);
20 |
21 | if(is_dir($mp3directory)){
22 | echo("MP3 Directory [".$mp3directory."] exists.
");
23 | if(is_file($json_file)){
24 | echo("JSON File [".$json_file."] was last built at ".date ("F d Y H:i:s", filemtime($json_file)).".
");
25 | } else {
26 | echo("JSON File [".$json_file."] has not been created.
");
27 | }
28 | } else {
29 | echo("MP3 Directory [".$mp3directory."] DOES NOT exist.
");
30 | }
31 | ?>
32 |
33 |
--------------------------------------------------------------------------------
/inc/json/soundboard.json:
--------------------------------------------------------------------------------
1 | {"files":[{"name":"Ayayayayayayayay!","artist":"","mp3":"\/sounds\/Ayayayayayayayay!.mp3"},{"name":"Bird laugh","artist":"Glen Hill","mp3":"\/sounds\/Laugh-Bird.mp3"},{"name":"Do do do do","artist":"","mp3":"\/sounds\/Do-do-do-do.mp3"},{"name":"Floridians dumb as dirt","artist":"Jennifer Rehm","mp3":"\/sounds\/Floridians-Dumb-as-dirt.mp3"},{"name":"Frosty Nads","artist":"Jennifer Rehm","mp3":"\/sounds\/Frosty-Nads[Q].mp3"},{"name":"Happy Birthday","artist":"","mp3":"\/sounds\/Happy-Birthday.mp3"},{"name":"Happy Purim","artist":"Thanks for Calling Lady","mp3":"\/sounds\/Happy-Purim.mp3"},{"name":"I Don't Believe It","artist":"Jim Mandich","mp3":"\/sounds\/I-Don't-Believe-It.mp3"},{"name":"I Don't Do my Job as Well When I'm Constipated","artist":"","mp3":"\/sounds\/Constipated.mp3"},{"name":"Idiotic jerk","artist":"Old Boat Dude","mp3":"\/sounds\/Idiotic-jerk.mp3"},{"name":"Laugh Brooke","artist":"Brooke Daniels","mp3":"\/sounds\/Laugh-Brooke.mp3"},{"name":"Laugh Gilbert","artist":"Gilbert Solomon","mp3":"\/sounds\/Laugh-Gilbert.mp3"},{"name":"Laugh Goofy","artist":"","mp3":"\/sounds\/Laugh-Goofy.mp3"},{"name":"Laugh Montage","artist":"Gilbert\/Brooke Daniels","mp3":"\/sounds\/Laugh-Montage.mp3"},{"name":"Loan me 50 Dollars","artist":"Larry King","mp3":"\/sounds\/Loan-me-50-Dollars.mp3"},{"name":"No","artist":"Drew Michaels","mp3":"\/sounds\/No.mp3"},{"name":"Only in the Banana Republic","artist":"Jim Mandich","mp3":"\/sounds\/Only-in-the-Banana-Republic.mp3"},{"name":"Ya mon!","artist":"","mp3":"\/sounds\/Ya-mon!.mp3"},{"name":"Yank it baby","artist":"Jennifer Rehm","mp3":"\/sounds\/Yank-it-baby.mp3"},{"name":"Yeeeeeeesss","artist":"Jim Mandich","mp3":"\/sounds\/Yeeeeeeesss.mp3"}]}
--------------------------------------------------------------------------------
/php/getID3/module.misc.msoffice.php:
--------------------------------------------------------------------------------
1 | //
4 | // available at http://getid3.sourceforge.net //
5 | // or http://www.getid3.org //
6 | // also https://github.com/JamesHeinrich/getID3 //
7 | /////////////////////////////////////////////////////////////////
8 | // See readme.txt for more details //
9 | /////////////////////////////////////////////////////////////////
10 | // //
11 | // module.misc.msoffice.php //
12 | // module for analyzing MS Office (.doc, .xls, etc) files //
13 | // dependencies: NONE //
14 | // ///
15 | /////////////////////////////////////////////////////////////////
16 |
17 |
18 | class getid3_msoffice extends getid3_handler
19 | {
20 |
21 | public function Analyze() {
22 | $info = &$this->getid3->info;
23 |
24 | $this->fseek($info['avdataoffset']);
25 | $DOCFILEheader = $this->fread(8);
26 | $magic = "\xD0\xCF\x11\xE0\xA1\xB1\x1A\xE1";
27 | if (substr($DOCFILEheader, 0, 8) != $magic) {
28 | $this->error('Expecting "'.getid3_lib::PrintHexBytes($magic).'" at '.$info['avdataoffset'].', found '.getid3_lib::PrintHexBytes(substr($DOCFILEheader, 0, 8)).' instead.');
29 | return false;
30 | }
31 | $info['fileformat'] = 'msoffice';
32 |
33 | $this->error('MS Office (.doc, .xls, etc) parsing not enabled in this version of getID3() ['.$this->getid3->version().']');
34 | return false;
35 |
36 | }
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/inc/css/sb.css:
--------------------------------------------------------------------------------
1 | @CHARSET "ISO-8859-1";
2 | .myButton {
3 | -moz-box-shadow: 3px 4px 0px 0px #9fb4f2;
4 | -webkit-box-shadow: 3px 4px 0px 0px #9fb4f2;
5 | box-shadow: 3px 4px 0px 0px #9fb4f2;
6 | background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #7892c2), color-stop(1, #476e9e));
7 | background:-moz-linear-gradient(top, #7892c2 5%, #476e9e 100%);
8 | background:-webkit-linear-gradient(top, #7892c2 5%, #476e9e 100%);
9 | background:-o-linear-gradient(top, #7892c2 5%, #476e9e 100%);
10 | background:-ms-linear-gradient(top, #7892c2 5%, #476e9e 100%);
11 | background:linear-gradient(to bottom, #7892c2 5%, #476e9e 100%);
12 | filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#7892c2', endColorstr='#476e9e',GradientType=0);
13 | background-color:#7892c2;
14 | -moz-border-radius:18px;
15 | -webkit-border-radius:18px;
16 | border-radius:18px;
17 | border:1px solid #4e6096;
18 | display:inline-block;
19 | cursor:pointer;
20 | color:#ffffff;
21 | font-family:arial;
22 | font-size:17px;
23 | padding:7px 25px;
24 | text-decoration:none;
25 | text-shadow:0px 1px 0px #283966;
26 | margin: 3px;
27 | }
28 | .myButton:hover {
29 | background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #476e9e), color-stop(1, #7892c2));
30 | background:-moz-linear-gradient(top, #476e9e 5%, #7892c2 100%);
31 | background:-webkit-linear-gradient(top, #476e9e 5%, #7892c2 100%);
32 | background:-o-linear-gradient(top, #476e9e 5%, #7892c2 100%);
33 | background:-ms-linear-gradient(top, #476e9e 5%, #7892c2 100%);
34 | background:linear-gradient(to bottom, #476e9e 5%, #7892c2 100%);
35 | filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#476e9e', endColorstr='#7892c2',GradientType=0);
36 | background-color:#476e9e;
37 | }
38 | .myButton:active {
39 | position:relative;
40 | top:1px;
41 | }
42 | .btn-filter:focus, .btn-filter:active:focus, .btn-filter.active:focus{
43 | outline:none;
44 | box-shadow:none;
45 | }
46 |
--------------------------------------------------------------------------------
/php/getID3/module.archive.rar.php:
--------------------------------------------------------------------------------
1 | //
4 | // available at http://getid3.sourceforge.net //
5 | // or http://www.getid3.org //
6 | // also https://github.com/JamesHeinrich/getID3 //
7 | /////////////////////////////////////////////////////////////////
8 | // See readme.txt for more details //
9 | /////////////////////////////////////////////////////////////////
10 | // //
11 | // module.archive.rar.php //
12 | // module for analyzing RAR files //
13 | // dependencies: NONE //
14 | // ///
15 | /////////////////////////////////////////////////////////////////
16 |
17 |
18 | class getid3_rar extends getid3_handler
19 | {
20 |
21 | public $option_use_rar_extension = false;
22 |
23 | public function Analyze() {
24 | $info = &$this->getid3->info;
25 |
26 | $info['fileformat'] = 'rar';
27 |
28 | if ($this->option_use_rar_extension === true) {
29 | if (function_exists('rar_open')) {
30 | if ($rp = rar_open($info['filenamepath'])) {
31 | $info['rar']['files'] = array();
32 | $entries = rar_list($rp);
33 | foreach ($entries as $entry) {
34 | $info['rar']['files'] = getid3_lib::array_merge_clobber($info['rar']['files'], getid3_lib::CreateDeepArray($entry->getName(), '/', $entry->getUnpackedSize()));
35 | }
36 | rar_close($rp);
37 | return true;
38 | } else {
39 | $this->error('failed to rar_open('.$info['filename'].')');
40 | }
41 | } else {
42 | $this->error('RAR support does not appear to be available in this PHP installation');
43 | }
44 | } else {
45 | $this->error('PHP-RAR processing has been disabled (set $getid3_rar->option_use_rar_extension=true to enable)');
46 | }
47 | return false;
48 |
49 | }
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/php/buildJSON_filename.php:
--------------------------------------------------------------------------------
1 | MP3_DIRECTORY;
4 | $json_file = $configs->JSON_FILENAME;
5 |
6 | $files = array();
7 | $sounds = array();
8 |
9 | // confirm directory exists
10 | if (is_dir($mp3directory)) {
11 | // build an array of MP3 files
12 | $it = new RecursiveDirectoryIterator(realpath($mp3directory));
13 |
14 | foreach(new RecursiveIteratorIterator($it) as $fileinfo) {
15 | if ($fileinfo->isFile()) {
16 | $extension = $fileinfo->getExtension();
17 | if($extension == "mp3"){
18 | $file_title = $fileinfo->getFilename();
19 | $file_title = str_replace(".mp3","",$file_title);
20 | $file_title = str_replace("[Q]","?", $file_title);
21 | $file_title = str_replace("-"," ", $file_title);
22 | $file_artist = "";
23 |
24 | $file_name = $mp3directory . $fileinfo->getFilename();
25 | // Remove .. from path for Soundboard loading
26 | $file_name = str_replace("../","/", $file_name);
27 |
28 | $sounds[] = array('name'=> $file_title,
29 | 'artist'=> $file_artist,
30 | 'mp3'=> $file_name);
31 | }
32 | }
33 | }
34 | if(count($sounds) == 0){
35 | echo "
ERROR: There are no MP3 files in the [". $mp3directory ."] directory. Add one or more and try again.";
36 | exit();
37 | }
38 | } else {
39 | echo "ERROR: Directory defined [". $mp3directory ."] is either undefined or does not exist.";
40 | exit();
41 | }
42 | // sort drops alphabetically
43 | sort($sounds);
44 | $files['files'] = $sounds;
45 | $fp = fopen($json_file, 'w');
46 | fwrite($fp, json_encode($files));
47 | fclose($fp);
48 | ?>
49 |
50 |
51 |
52 |
53 |
54 |
55 | Simple Soundboard JSON Built
56 |
57 |
58 | Simple Soundboard JSON Built successfully!
59 | Visit your Soundboard.
60 |
61 |
--------------------------------------------------------------------------------
/php/getID3/module.audio.aa.php:
--------------------------------------------------------------------------------
1 | //
4 | // available at http://getid3.sourceforge.net //
5 | // or http://www.getid3.org //
6 | // also https://github.com/JamesHeinrich/getID3 //
7 | /////////////////////////////////////////////////////////////////
8 | // See readme.txt for more details //
9 | /////////////////////////////////////////////////////////////////
10 | // //
11 | // module.audio.aa.php //
12 | // module for analyzing Audible Audiobook files //
13 | // dependencies: NONE //
14 | // ///
15 | /////////////////////////////////////////////////////////////////
16 |
17 |
18 | class getid3_aa extends getid3_handler
19 | {
20 |
21 | public function Analyze() {
22 | $info = &$this->getid3->info;
23 |
24 | $this->fseek($info['avdataoffset']);
25 | $AAheader = $this->fread(8);
26 |
27 | $magic = "\x57\x90\x75\x36";
28 | if (substr($AAheader, 4, 4) != $magic) {
29 | $this->error('Expecting "'.getid3_lib::PrintHexBytes($magic).'" at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes(substr($AAheader, 4, 4)).'"');
30 | return false;
31 | }
32 |
33 | // shortcut
34 | $info['aa'] = array();
35 | $thisfile_aa = &$info['aa'];
36 |
37 | $info['fileformat'] = 'aa';
38 | $info['audio']['dataformat'] = 'aa';
39 | $this->error('Audible Audiobook (.aa) parsing not enabled in this version of getID3() ['.$this->getid3->version().']');
40 | return false;
41 | $info['audio']['bitrate_mode'] = 'cbr'; // is it?
42 | $thisfile_aa['encoding'] = 'ISO-8859-1';
43 |
44 | $thisfile_aa['filesize'] = getid3_lib::BigEndian2Int(substr($AUheader, 0, 4));
45 | if ($thisfile_aa['filesize'] > ($info['avdataend'] - $info['avdataoffset'])) {
46 | $this->warning('Possible truncated file - expecting "'.$thisfile_aa['filesize'].'" bytes of data, only found '.($info['avdataend'] - $info['avdataoffset']).' bytes"');
47 | }
48 |
49 | $info['audio']['bits_per_sample'] = 16; // is it?
50 | $info['audio']['sample_rate'] = $thisfile_aa['sample_rate'];
51 | $info['audio']['channels'] = $thisfile_aa['channels'];
52 |
53 | //$info['playtime_seconds'] = 0;
54 | //$info['audio']['bitrate'] = 0;
55 |
56 | return true;
57 | }
58 |
59 | }
60 |
--------------------------------------------------------------------------------
/php/getID3/module.audio-video.bink.php:
--------------------------------------------------------------------------------
1 | //
4 | // available at http://getid3.sourceforge.net //
5 | // or http://www.getid3.org //
6 | // also https://github.com/JamesHeinrich/getID3 //
7 | /////////////////////////////////////////////////////////////////
8 | // See readme.txt for more details //
9 | /////////////////////////////////////////////////////////////////
10 | // //
11 | // module.audio.bink.php //
12 | // module for analyzing Bink or Smacker audio-video files //
13 | // dependencies: NONE //
14 | // ///
15 | /////////////////////////////////////////////////////////////////
16 |
17 |
18 | class getid3_bink extends getid3_handler
19 | {
20 |
21 | public function Analyze() {
22 | $info = &$this->getid3->info;
23 |
24 | $this->error('Bink / Smacker files not properly processed by this version of getID3() ['.$this->getid3->version().']');
25 |
26 | $this->fseek($info['avdataoffset']);
27 | $fileTypeID = $this->fread(3);
28 | switch ($fileTypeID) {
29 | case 'BIK':
30 | return $this->ParseBink();
31 | break;
32 |
33 | case 'SMK':
34 | return $this->ParseSmacker();
35 | break;
36 |
37 | default:
38 | $this->error('Expecting "BIK" or "SMK" at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes($fileTypeID).'"');
39 | return false;
40 | break;
41 | }
42 |
43 | return true;
44 |
45 | }
46 |
47 | public function ParseBink() {
48 | $info = &$this->getid3->info;
49 | $info['fileformat'] = 'bink';
50 | $info['video']['dataformat'] = 'bink';
51 |
52 | $fileData = 'BIK'.$this->fread(13);
53 |
54 | $info['bink']['data_size'] = getid3_lib::LittleEndian2Int(substr($fileData, 4, 4));
55 | $info['bink']['frame_count'] = getid3_lib::LittleEndian2Int(substr($fileData, 8, 2));
56 |
57 | if (($info['avdataend'] - $info['avdataoffset']) != ($info['bink']['data_size'] + 8)) {
58 | $this->error('Probably truncated file: expecting '.$info['bink']['data_size'].' bytes, found '.($info['avdataend'] - $info['avdataoffset']));
59 | }
60 |
61 | return true;
62 | }
63 |
64 | public function ParseSmacker() {
65 | $info = &$this->getid3->info;
66 | $info['fileformat'] = 'smacker';
67 | $info['video']['dataformat'] = 'smacker';
68 |
69 | return true;
70 | }
71 |
72 | }
73 |
--------------------------------------------------------------------------------
/php/getID3/module.graphic.efax.php:
--------------------------------------------------------------------------------
1 | //
4 | // available at http://getid3.sourceforge.net //
5 | // or http://www.getid3.org //
6 | // also https://github.com/JamesHeinrich/getID3 //
7 | /////////////////////////////////////////////////////////////////
8 | // See readme.txt for more details //
9 | /////////////////////////////////////////////////////////////////
10 | // //
11 | // module.archive.efax.php //
12 | // module for analyzing eFax files //
13 | // dependencies: NONE //
14 | // ///
15 | /////////////////////////////////////////////////////////////////
16 |
17 |
18 | class getid3_efax extends getid3_handler
19 | {
20 |
21 | public function Analyze() {
22 | $info = &$this->getid3->info;
23 |
24 | $this->fseek($info['avdataoffset']);
25 | $efaxheader = $this->fread(1024);
26 |
27 | $info['efax']['header']['magic'] = substr($efaxheader, 0, 2);
28 | if ($info['efax']['header']['magic'] != "\xDC\xFE") {
29 | $this->error('Invalid eFax byte order identifier (expecting DC FE, found '.getid3_lib::PrintHexBytes($info['efax']['header']['magic']).') at offset '.$info['avdataoffset']);
30 | return false;
31 | }
32 | $info['fileformat'] = 'efax';
33 |
34 | $info['efax']['header']['filesize'] = getid3_lib::LittleEndian2Int(substr($efaxheader, 2, 4));
35 | if ($info['efax']['header']['filesize'] != $info['filesize']) {
36 | $this->error('Probable '.(($info['efax']['header']['filesize'] > $info['filesize']) ? 'truncated' : 'corrupt').' file, expecting '.$info['efax']['header']['filesize'].' bytes, found '.$info['filesize'].' bytes');
37 | }
38 | $info['efax']['header']['software1'] = rtrim(substr($efaxheader, 26, 32), "\x00");
39 | $info['efax']['header']['software2'] = rtrim(substr($efaxheader, 58, 32), "\x00");
40 | $info['efax']['header']['software3'] = rtrim(substr($efaxheader, 90, 32), "\x00");
41 |
42 | $info['efax']['header']['pages'] = getid3_lib::LittleEndian2Int(substr($efaxheader, 198, 2));
43 | $info['efax']['header']['data_bytes'] = getid3_lib::LittleEndian2Int(substr($efaxheader, 202, 4));
44 |
45 | $this->error('eFax parsing not enabled in this version of getID3() ['.$this->getid3->version().']');
46 | return false;
47 |
48 | return true;
49 | }
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/php/filename_version.php:
--------------------------------------------------------------------------------
1 | MP3_DIRECTORY;
4 | $mp3 = array();
5 | // confirm directory exists
6 | if (file_exists($mp3directory)) {
7 | // build an array of MP3 files
8 | $directory = new DirectoryIterator($mp3directory);
9 | foreach ($directory as $fileinfo) {
10 | if ($fileinfo->isFile()) {
11 | $extension = $fileinfo->getExtension();
12 | if($extension == "mp3"){
13 | $mp3[] = $fileinfo->getFilename();
14 | }
15 | }
16 | }
17 | if(count($mp3) == 0){
18 | echo "ERROR: There are no MP3 files in the [". $mp3directory ."] directory. Add one or more and try again.";
19 | exit();
20 | }
21 | } else {
22 | echo "ERROR: Directory defined [". $mp3directory ."] does not exist.";
23 | exit();
24 | }
25 | // sort drops alphabetically
26 | sort($mp3);
27 | ?>
28 |
29 |
30 |
31 |
32 | PAGE_TITLE); ?>
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
69 |
70 |
73 |
74 |
75 |
--------------------------------------------------------------------------------
/php/getID3/write.lyrics3.php:
--------------------------------------------------------------------------------
1 | //
4 | // available at http://getid3.sourceforge.net //
5 | // or http://www.getid3.org //
6 | // also https://github.com/JamesHeinrich/getID3 //
7 | /////////////////////////////////////////////////////////////////
8 | // See readme.txt for more details //
9 | /////////////////////////////////////////////////////////////////
10 | // //
11 | // write.lyrics3.php //
12 | // module for writing Lyrics3 tags //
13 | // dependencies: module.tag.lyrics3.php //
14 | // ///
15 | /////////////////////////////////////////////////////////////////
16 |
17 |
18 | class getid3_write_lyrics3
19 | {
20 | public $filename;
21 | public $tag_data;
22 | //public $lyrics3_version = 2; // 1 or 2
23 | public $warnings = array(); // any non-critical errors will be stored here
24 | public $errors = array(); // any critical errors will be stored here
25 |
26 | public function __construct() {
27 | return true;
28 | }
29 |
30 | public function WriteLyrics3() {
31 | $this->errors[] = 'WriteLyrics3() not yet functional - cannot write Lyrics3';
32 | return false;
33 | }
34 | public function DeleteLyrics3() {
35 | // Initialize getID3 engine
36 | $getID3 = new getID3;
37 | $ThisFileInfo = $getID3->analyze($this->filename);
38 | if (isset($ThisFileInfo['lyrics3']['tag_offset_start']) && isset($ThisFileInfo['lyrics3']['tag_offset_end'])) {
39 | if (is_readable($this->filename) && is_writable($this->filename) && is_file($this->filename) && ($fp = fopen($this->filename, 'a+b'))) {
40 |
41 | flock($fp, LOCK_EX);
42 | $oldignoreuserabort = ignore_user_abort(true);
43 |
44 | fseek($fp, $ThisFileInfo['lyrics3']['tag_offset_end']);
45 | $DataAfterLyrics3 = '';
46 | if ($ThisFileInfo['filesize'] > $ThisFileInfo['lyrics3']['tag_offset_end']) {
47 | $DataAfterLyrics3 = fread($fp, $ThisFileInfo['filesize'] - $ThisFileInfo['lyrics3']['tag_offset_end']);
48 | }
49 |
50 | ftruncate($fp, $ThisFileInfo['lyrics3']['tag_offset_start']);
51 |
52 | if (!empty($DataAfterLyrics3)) {
53 | fseek($fp, $ThisFileInfo['lyrics3']['tag_offset_start']);
54 | fwrite($fp, $DataAfterLyrics3, strlen($DataAfterLyrics3));
55 | }
56 |
57 | flock($fp, LOCK_UN);
58 | fclose($fp);
59 | ignore_user_abort($oldignoreuserabort);
60 |
61 | return true;
62 |
63 | } else {
64 | $this->errors[] = 'Cannot fopen('.$this->filename.', "a+b")';
65 | return false;
66 | }
67 | }
68 | // no Lyrics3 present
69 | return true;
70 | }
71 |
72 | }
73 |
--------------------------------------------------------------------------------
/php/buildJSON_id3.php:
--------------------------------------------------------------------------------
1 | MP3_DIRECTORY;
4 | $json_file = $configs->JSON_FILENAME;
5 |
6 | $files = array();
7 | $sounds = array();
8 | require_once('getID3/getid3.php');
9 | $getid3_engine = new getID3;
10 | // confirm directory exists
11 | if (is_dir($mp3directory)) {
12 | // build an array of MP3 files
13 | $it = new RecursiveDirectoryIterator(realpath($mp3directory));
14 |
15 | foreach(new RecursiveIteratorIterator($it) as $fileinfo) {
16 | if ($fileinfo->isFile()) {
17 | $extension = $fileinfo->getExtension();
18 | if($extension == "mp3"){
19 | $id3_info = $getid3_engine->analyze($fileinfo);
20 | getid3_lib::CopyTagsToComments($id3_info);
21 | $file_title = htmlentities(!empty($id3_info['comments_html']['title']) ?
22 | implode('
', $id3_info['comments_html']['title']) : "");
23 | $file_artist = htmlentities(!empty($id3_info['comments_html']['artist']) ?
24 | implode('
', $id3_info['comments_html']['artist']) : "");
25 | // Not sure why, but getting a double quote to display right required a double decode.
26 | $file_title = html_entity_decode(html_entity_decode($file_title));
27 | $file_artist = html_entity_decode(html_entity_decode($file_artist));
28 | $file_name = $mp3directory . $fileinfo->getFilename();
29 | // Remove .. from path for Soundboard loading
30 | $file_name = str_replace("../","/", $file_name);
31 | if($file_title == ""){
32 | $file_title = str_replace(".mp3","",$file_name);
33 | }
34 |
35 | $sounds[] = array('name'=> $file_title,
36 | 'artist'=> $file_artist,
37 | 'mp3'=> $file_name);
38 | }
39 | }
40 | }
41 | if(count($sounds) == 0){
42 | echo "
ERROR: There are no MP3 files in the [". $mp3directory ."] directory. Add one or more and try again.";
43 | exit();
44 | }
45 | } else {
46 | echo "ERROR: Directory defined [". $mp3directory ."] is either undefined or does not exist.";
47 | exit();
48 | }
49 | // sort drops alphabetically
50 | sort($sounds);
51 | $files['files'] = $sounds;
52 | $fp = fopen($json_file, 'w');
53 | fwrite($fp, json_encode($files));
54 | fclose($fp);
55 | ?>
56 |
57 |
58 |
59 |
60 |
61 |
62 | Simple Soundboard JSON Built
63 |
64 |
65 | Simple Soundboard JSON Built successfully!
66 | Visit your Soundboard.
67 |
68 |
69 |
70 |
--------------------------------------------------------------------------------
/php/getID3/module.misc.exe.php:
--------------------------------------------------------------------------------
1 | //
4 | // available at http://getid3.sourceforge.net //
5 | // or http://www.getid3.org //
6 | // also https://github.com/JamesHeinrich/getID3 //
7 | /////////////////////////////////////////////////////////////////
8 | // See readme.txt for more details //
9 | /////////////////////////////////////////////////////////////////
10 | // //
11 | // module.misc.exe.php //
12 | // module for analyzing EXE files //
13 | // dependencies: NONE //
14 | // ///
15 | /////////////////////////////////////////////////////////////////
16 |
17 |
18 | class getid3_exe extends getid3_handler
19 | {
20 |
21 | public function Analyze() {
22 | $info = &$this->getid3->info;
23 |
24 | $this->fseek($info['avdataoffset']);
25 | $EXEheader = $this->fread(28);
26 |
27 | $magic = 'MZ';
28 | if (substr($EXEheader, 0, 2) != $magic) {
29 | $this->error('Expecting "'.getid3_lib::PrintHexBytes($magic).'" at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes(substr($EXEheader, 0, 2)).'"');
30 | return false;
31 | }
32 |
33 | $info['fileformat'] = 'exe';
34 | $info['exe']['mz']['magic'] = 'MZ';
35 |
36 | $info['exe']['mz']['raw']['last_page_size'] = getid3_lib::LittleEndian2Int(substr($EXEheader, 2, 2));
37 | $info['exe']['mz']['raw']['page_count'] = getid3_lib::LittleEndian2Int(substr($EXEheader, 4, 2));
38 | $info['exe']['mz']['raw']['relocation_count'] = getid3_lib::LittleEndian2Int(substr($EXEheader, 6, 2));
39 | $info['exe']['mz']['raw']['header_paragraphs'] = getid3_lib::LittleEndian2Int(substr($EXEheader, 8, 2));
40 | $info['exe']['mz']['raw']['min_memory_paragraphs'] = getid3_lib::LittleEndian2Int(substr($EXEheader, 10, 2));
41 | $info['exe']['mz']['raw']['max_memory_paragraphs'] = getid3_lib::LittleEndian2Int(substr($EXEheader, 12, 2));
42 | $info['exe']['mz']['raw']['initial_ss'] = getid3_lib::LittleEndian2Int(substr($EXEheader, 14, 2));
43 | $info['exe']['mz']['raw']['initial_sp'] = getid3_lib::LittleEndian2Int(substr($EXEheader, 16, 2));
44 | $info['exe']['mz']['raw']['checksum'] = getid3_lib::LittleEndian2Int(substr($EXEheader, 18, 2));
45 | $info['exe']['mz']['raw']['cs_ip'] = getid3_lib::LittleEndian2Int(substr($EXEheader, 20, 4));
46 | $info['exe']['mz']['raw']['relocation_table_offset'] = getid3_lib::LittleEndian2Int(substr($EXEheader, 24, 2));
47 | $info['exe']['mz']['raw']['overlay_number'] = getid3_lib::LittleEndian2Int(substr($EXEheader, 26, 2));
48 |
49 | $info['exe']['mz']['byte_size'] = (($info['exe']['mz']['raw']['page_count'] - 1)) * 512 + $info['exe']['mz']['raw']['last_page_size'];
50 | $info['exe']['mz']['header_size'] = $info['exe']['mz']['raw']['header_paragraphs'] * 16;
51 | $info['exe']['mz']['memory_minimum'] = $info['exe']['mz']['raw']['min_memory_paragraphs'] * 16;
52 | $info['exe']['mz']['memory_recommended'] = $info['exe']['mz']['raw']['max_memory_paragraphs'] * 16;
53 |
54 | $this->error('EXE parsing not enabled in this version of getID3() ['.$this->getid3->version().']');
55 | return false;
56 |
57 | }
58 |
59 | }
60 |
--------------------------------------------------------------------------------
/php/getID3/module.audio.mod.php:
--------------------------------------------------------------------------------
1 | //
4 | // available at http://getid3.sourceforge.net //
5 | // or http://www.getid3.org //
6 | // also https://github.com/JamesHeinrich/getID3 //
7 | /////////////////////////////////////////////////////////////////
8 | // See readme.txt for more details //
9 | /////////////////////////////////////////////////////////////////
10 | // //
11 | // module.audio.mod.php //
12 | // module for analyzing MOD Audio files //
13 | // dependencies: NONE //
14 | // ///
15 | /////////////////////////////////////////////////////////////////
16 |
17 |
18 | class getid3_mod extends getid3_handler
19 | {
20 |
21 | public function Analyze() {
22 | $info = &$this->getid3->info;
23 | $this->fseek($info['avdataoffset']);
24 | $fileheader = $this->fread(1088);
25 | if (preg_match('#^IMPM#', $fileheader)) {
26 | return $this->getITheaderFilepointer();
27 | } elseif (preg_match('#^Extended Module#', $fileheader)) {
28 | return $this->getXMheaderFilepointer();
29 | } elseif (preg_match('#^.{44}SCRM#', $fileheader)) {
30 | return $this->getS3MheaderFilepointer();
31 | } elseif (preg_match('#^.{1080}(M\\.K\\.|M!K!|FLT4|FLT8|[5-9]CHN|[1-3][0-9]CH)#', $fileheader)) {
32 | return $this->getMODheaderFilepointer();
33 | }
34 | $this->error('This is not a known type of MOD file');
35 | return false;
36 | }
37 |
38 |
39 | public function getMODheaderFilepointer() {
40 | $info = &$this->getid3->info;
41 | $this->fseek($info['avdataoffset'] + 1080);
42 | $FormatID = $this->fread(4);
43 | if (!preg_match('#^(M.K.|[5-9]CHN|[1-3][0-9]CH)$#', $FormatID)) {
44 | $this->error('This is not a known type of MOD file');
45 | return false;
46 | }
47 |
48 | $info['fileformat'] = 'mod';
49 |
50 | $this->error('MOD parsing not enabled in this version of getID3() ['.$this->getid3->version().']');
51 | return false;
52 | }
53 |
54 | public function getXMheaderFilepointer() {
55 | $info = &$this->getid3->info;
56 | $this->fseek($info['avdataoffset']);
57 | $FormatID = $this->fread(15);
58 | if (!preg_match('#^Extended Module$#', $FormatID)) {
59 | $this->error('This is not a known type of XM-MOD file');
60 | return false;
61 | }
62 |
63 | $info['fileformat'] = 'xm';
64 |
65 | $this->error('XM-MOD parsing not enabled in this version of getID3() ['.$this->getid3->version().']');
66 | return false;
67 | }
68 |
69 | public function getS3MheaderFilepointer() {
70 | $info = &$this->getid3->info;
71 | $this->fseek($info['avdataoffset'] + 44);
72 | $FormatID = $this->fread(4);
73 | if (!preg_match('#^SCRM$#', $FormatID)) {
74 | $this->error('This is not a ScreamTracker MOD file');
75 | return false;
76 | }
77 |
78 | $info['fileformat'] = 's3m';
79 |
80 | $this->error('ScreamTracker parsing not enabled in this version of getID3() ['.$this->getid3->version().']');
81 | return false;
82 | }
83 |
84 | public function getITheaderFilepointer() {
85 | $info = &$this->getid3->info;
86 | $this->fseek($info['avdataoffset']);
87 | $FormatID = $this->fread(4);
88 | if (!preg_match('#^IMPM$#', $FormatID)) {
89 | $this->error('This is not an ImpulseTracker MOD file');
90 | return false;
91 | }
92 |
93 | $info['fileformat'] = 'it';
94 |
95 | $this->error('ImpulseTracker parsing not enabled in this version of getID3() ['.$this->getid3->version().']');
96 | return false;
97 | }
98 |
99 | }
100 |
--------------------------------------------------------------------------------
/php/getID3/module.archive.szip.php:
--------------------------------------------------------------------------------
1 | //
4 | // available at http://getid3.sourceforge.net //
5 | // or http://www.getid3.org //
6 | // also https://github.com/JamesHeinrich/getID3 //
7 | /////////////////////////////////////////////////////////////////
8 | // See readme.txt for more details //
9 | /////////////////////////////////////////////////////////////////
10 | // //
11 | // module.archive.szip.php //
12 | // module for analyzing SZIP compressed files //
13 | // dependencies: NONE //
14 | // ///
15 | /////////////////////////////////////////////////////////////////
16 |
17 |
18 | class getid3_szip extends getid3_handler
19 | {
20 |
21 | public function Analyze() {
22 | $info = &$this->getid3->info;
23 |
24 | $this->fseek($info['avdataoffset']);
25 | $SZIPHeader = $this->fread(6);
26 | if (substr($SZIPHeader, 0, 4) != "SZ\x0A\x04") {
27 | $this->error('Expecting "53 5A 0A 04" at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes(substr($SZIPHeader, 0, 4)).'"');
28 | return false;
29 | }
30 | $info['fileformat'] = 'szip';
31 | $info['szip']['major_version'] = getid3_lib::BigEndian2Int(substr($SZIPHeader, 4, 1));
32 | $info['szip']['minor_version'] = getid3_lib::BigEndian2Int(substr($SZIPHeader, 5, 1));
33 | $this->error('SZIP parsing not enabled in this version of getID3() ['.$this->getid3->version().']');
34 | return false;
35 |
36 | while (!$this->feof()) {
37 | $NextBlockID = $this->fread(2);
38 | switch ($NextBlockID) {
39 | case 'SZ':
40 | // Note that szip files can be concatenated, this has the same effect as
41 | // concatenating the files. this also means that global header blocks
42 | // might be present between directory/data blocks.
43 | $this->fseek(4, SEEK_CUR);
44 | break;
45 |
46 | case 'BH':
47 | $BHheaderbytes = getid3_lib::BigEndian2Int($this->fread(3));
48 | $BHheaderdata = $this->fread($BHheaderbytes);
49 | $BHheaderoffset = 0;
50 | while (strpos($BHheaderdata, "\x00", $BHheaderoffset) > 0) {
51 | //filename as \0 terminated string (empty string indicates end)
52 | //owner as \0 terminated string (empty is same as last file)
53 | //group as \0 terminated string (empty is same as last file)
54 | //3 byte filelength in this block
55 | //2 byte access flags
56 | //4 byte creation time (like in unix)
57 | //4 byte modification time (like in unix)
58 | //4 byte access time (like in unix)
59 |
60 | $BHdataArray['filename'] = substr($BHheaderdata, $BHheaderoffset, strcspn($BHheaderdata, "\x00"));
61 | $BHheaderoffset += (strlen($BHdataArray['filename']) + 1);
62 |
63 | $BHdataArray['owner'] = substr($BHheaderdata, $BHheaderoffset, strcspn($BHheaderdata, "\x00"));
64 | $BHheaderoffset += (strlen($BHdataArray['owner']) + 1);
65 |
66 | $BHdataArray['group'] = substr($BHheaderdata, $BHheaderoffset, strcspn($BHheaderdata, "\x00"));
67 | $BHheaderoffset += (strlen($BHdataArray['group']) + 1);
68 |
69 | $BHdataArray['filelength'] = getid3_lib::BigEndian2Int(substr($BHheaderdata, $BHheaderoffset, 3));
70 | $BHheaderoffset += 3;
71 |
72 | $BHdataArray['access_flags'] = getid3_lib::BigEndian2Int(substr($BHheaderdata, $BHheaderoffset, 2));
73 | $BHheaderoffset += 2;
74 |
75 | $BHdataArray['creation_time'] = getid3_lib::BigEndian2Int(substr($BHheaderdata, $BHheaderoffset, 4));
76 | $BHheaderoffset += 4;
77 |
78 | $BHdataArray['modification_time'] = getid3_lib::BigEndian2Int(substr($BHheaderdata, $BHheaderoffset, 4));
79 | $BHheaderoffset += 4;
80 |
81 | $BHdataArray['access_time'] = getid3_lib::BigEndian2Int(substr($BHheaderdata, $BHheaderoffset, 4));
82 | $BHheaderoffset += 4;
83 |
84 | $info['szip']['BH'][] = $BHdataArray;
85 | }
86 | break;
87 |
88 | default:
89 | break 2;
90 | }
91 | }
92 |
93 | return true;
94 |
95 | }
96 |
97 | }
98 |
--------------------------------------------------------------------------------
/php/getID3/module.graphic.svg.php:
--------------------------------------------------------------------------------
1 | //
4 | // available at http://getid3.sourceforge.net //
5 | // or http://www.getid3.org //
6 | // also https://github.com/JamesHeinrich/getID3 //
7 | /////////////////////////////////////////////////////////////////
8 | // See readme.txt for more details //
9 | /////////////////////////////////////////////////////////////////
10 | // //
11 | // module.graphic.svg.php //
12 | // module for analyzing SVG Image files //
13 | // dependencies: NONE //
14 | // ///
15 | /////////////////////////////////////////////////////////////////
16 |
17 |
18 | class getid3_svg extends getid3_handler
19 | {
20 |
21 |
22 | public function Analyze() {
23 | $info = &$this->getid3->info;
24 |
25 | $this->fseek($info['avdataoffset']);
26 |
27 | $SVGheader = $this->fread(4096);
28 | if (preg_match('#\<\?xml([^\>]+)\?\>#i', $SVGheader, $matches)) {
29 | $info['svg']['xml']['raw'] = $matches;
30 | }
31 | if (preg_match('#\<\!DOCTYPE([^\>]+)\>#i', $SVGheader, $matches)) {
32 | $info['svg']['doctype']['raw'] = $matches;
33 | }
34 | if (preg_match('#\