commit 7010403607dbd9804b2210b3a0f2130a28806db0 Author: poka Date: Wed Nov 27 23:43:32 2019 +0100 init diff --git a/G1Tag.png b/G1Tag.png new file mode 100755 index 0000000..3ae4e3b Binary files /dev/null and b/G1Tag.png differ diff --git a/GSM_POWERKEY.py b/GSM_POWERKEY.py new file mode 100755 index 0000000..037387e --- /dev/null +++ b/GSM_POWERKEY.py @@ -0,0 +1,10 @@ +import RPi.GPIO as GPIO +import time +GPIO.setmode(GPIO.BOARD) +GPIO.setup(7, GPIO.OUT) +while True: + GPIO.output(7, GPIO.LOW) + time.sleep(4) + GPIO.output(7, GPIO.HIGH) + break +GPIO.cleanup() diff --git a/GSM_powerkey.sh b/GSM_powerkey.sh new file mode 100755 index 0000000..3615018 --- /dev/null +++ b/GSM_powerkey.sh @@ -0,0 +1,9 @@ +#!/bin/bash +if [ ! -e /sys/class/gpio/gpio4 ]; then + echo "File exists." + echo "4" > /sys/class/gpio/export +fi +echo "out" > /sys/class/gpio/gpio4/direction +echo "0" > /sys/class/gpio/gpio4/value +sleep 2 +echo "1" > /sys/class/gpio/gpio4/value diff --git a/_CopyLaRadio/bip.wav b/_CopyLaRadio/bip.wav new file mode 100644 index 0000000..1028cd4 Binary files /dev/null and b/_CopyLaRadio/bip.wav differ diff --git a/_CopyLaRadio/copy.sh b/_CopyLaRadio/copy.sh new file mode 100755 index 0000000..8391a86 --- /dev/null +++ b/_CopyLaRadio/copy.sh @@ -0,0 +1,88 @@ +#!/bin/bash + +# Clean /tmp/ytdl.list +#echo > /tmp/ytdl.list + +function replace_accents (){ +INPUT="$1" +declare -a acc +declare -a noa +acc=('$' 'è' 'ê' 'é' 'À' 'Á' 'Â' 'Ã' 'Ä' 'Å' 'Æ' 'Ç' 'È' 'É' 'Ê' 'Ë' 'Ì' 'Í' 'Î' 'Ï' 'Ð' 'Ñ' 'Ò' 'Ó' 'Ô' 'Õ' 'Ö' 'Ø' 'Ù' 'Ú' 'Û' 'Ü' 'Ý' 'ß' 'à' 'á' 'â' 'ã' 'ä' 'å' 'æ' 'ç' 'è' 'é' 'ê' 'ë' 'ì' 'í' 'î' 'ï' 'ñ' 'ò' 'ó' 'ô' 'õ' 'ö' 'ø' 'ù' 'ú' 'û' 'ü' 'ý' 'ÿ' 'Ā' 'ā' 'Ă' 'ă' 'Ą' 'ą' 'Ć' 'ć' 'Ĉ' 'ĉ' 'Ċ' 'ċ' 'Č' 'č' 'Ď' 'ď' 'Đ' 'đ' 'Ē' 'ē' 'Ĕ' 'ĕ' 'Ė' 'ė' 'Ę' 'ę' 'Ě' 'ě' 'Ĝ' 'ĝ' 'Ğ' 'ğ' 'Ġ' 'ġ' 'Ģ' 'ģ' 'Ĥ' 'ĥ' 'Ħ' 'ħ' 'Ĩ' 'ĩ' 'Ī' 'ī' 'Ĭ' 'ĭ' 'Į' 'į' 'İ' 'ı' 'IJ' 'ij' 'Ĵ' 'ĵ' 'Ķ' 'ķ' 'Ĺ' 'ĺ' 'Ļ' 'ļ' 'Ľ' 'ľ' 'Ŀ' 'ŀ' 'Ł' 'ł' 'Ń' 'ń' 'Ņ' 'ņ' 'Ň' 'ň' 'ʼn' 'Ō' 'ō' 'Ŏ' 'ŏ' 'Ő' 'ő' 'Œ' 'œ' 'Ŕ' 'ŕ' 'Ŗ' 'ŗ' 'Ř' 'ř' 'Ś' 'ś' 'Ŝ' 'ŝ' 'Ş' 'ş' 'Š' 'š' 'Ţ' 'ţ' 'Ť' 'ť' 'Ŧ' 'ŧ' 'Ũ' 'ũ' 'Ū' 'ū' 'Ŭ' 'ŭ' 'Ů' 'ů' 'Ű' 'ű' 'Ų' 'ų' 'Ŵ' 'ŵ' 'Ŷ' 'ŷ' 'Ÿ' 'Ź' 'ź' 'Ż' 'ż' 'Ž' 'ž' 'ſ' 'ƒ' 'Ơ' 'ơ' 'Ư' 'ư' 'Ǎ' 'ǎ' 'Ǐ' 'ǐ' 'Ǒ' 'ǒ' 'Ǔ' 'ǔ' 'Ǖ' 'ǖ' 'Ǘ' 'ǘ' 'Ǚ' 'ǚ' 'Ǜ' 'ǜ' 'Ǻ' 'ǻ' 'Ǽ' 'ǽ' 'Ǿ' 'ǿ'); +noa=('S' 'e' 'e' 'e' 'A' 'A' 'A' 'A' 'A' 'A' 'AE' 'C' 'E' 'E' 'E' 'E' 'I' 'I' 'I' 'I' 'D' 'N' 'O' 'O' 'O' 'O' 'O' 'O' 'U' 'U' 'U' 'U' 'Y' 's' 'a' 'a' 'a' 'a' 'a' 'a' 'ae' 'c' 'e' 'e' 'e' 'e' 'i' 'i' 'i' 'i' 'n' 'o' 'o' 'o' 'o' 'o' 'o' 'u' 'u' 'u' 'u' 'y' 'y' 'A' 'a' 'A' 'a' 'A' 'a' 'C' 'c' 'C' 'c' 'C' 'c' 'C' 'c' 'D' 'd' 'D' 'd' 'E' 'e' 'E' 'e' 'E' 'e' 'E' 'e' 'E' 'e' 'G' 'g' 'G' 'g' 'G' 'g' 'G' 'g' 'H' 'h' 'H' 'h' 'I' 'i' 'I' 'i' 'I' 'i' 'I' 'i' 'I' 'i' 'IJ' 'ij' 'J' 'j' 'K' 'k' 'L' 'l' 'L' 'l' 'L' 'l' 'L' 'l' 'l' 'l' 'N' 'n' 'N' 'n' 'N' 'n' 'n' 'O' 'o' 'O' 'o' 'O' 'o' 'OE' 'oe' 'R' 'r' 'R' 'r' 'R' 'r' 'S' 's' 'S' 's' 'S' 's' 'S' 's' 'T' 't' 'T' 't' 'T' 't' 'U' 'u' 'U' 'u' 'U' 'u' 'U' 'u' 'U' 'u' 'U' 'u' 'W' 'w' 'Y' 'y' 'Y' 'Z' 'z' 'Z' 'z' 'Z' 'z' 's' 'f' 'O' 'o' 'U' 'u' 'A' 'a' 'I' 'i' 'O' 'o' 'U' 'u' 'U' 'u' 'U' 'u' 'U' 'u' 'U' 'u' 'A' 'a' 'AE' 'ae' 'O' 'o'); + +OUTPUT="" +i=0 +length=${#INPUT} +while [[ $i -lt $length ]]; do + char=${INPUT:$i:1}; + #echo $i:$char + j=0 + for letter in "${acc[@]}" + do + if [[ "$letter" == "$char" ]]; then + char="${noa[$j]}" + fi + ((j++)) + done + ((i++)) + OUTPUT=$OUTPUT$char +done +echo $OUTPUT +} + +# SCAN NEW LINE IN NEW RECORD LIST AND RUN youtube-dl search and copy +tail -fn 1 /tmp/ytdl.list | while read -r line +do +################################################# + radio=$(echo $line | cut -d "|" -f 1) + artist=$(echo $line | cut -d "|" -f 2) + song=$(echo $line | cut -d "|" -f 3) + echo "######## $radio ########" >> /tmp/youtube-dl.log 2>&1 + echo $(date) >> /tmp/youtube-dl.log 2>&1 + echo ${line} >> /tmp/youtube-dl.log 2>&1 + +################################################# +# YOUTUBE-DL SEARCH & COPY : "radio|artist|song" +if [[ "$artist" != "" && "$song" != "" && "$radio" != "" && "$radio" != "$song" && "$radio" != "undefined" && "$artist" != "$song" ]]; then + mkdir -p "/home/pi/music/${artist}/${song}" + ~/parle.sh "Démarrage Enregistrement $radio." + ~/parle.sh "$artist" "en-US" + ~/parle.sh "$song" "en-US" + echo "Copy youtube-dl: $artist | $song ($radio)" >> /tmp/youtube-dl.log 2>&1 + # Clean search string + mysearch=$(replace_accents "$artist $song") + if [[ "$mysearch" == "" ]]; then ~/parle.sh "Aucune recherche reçue!"; continue; fi + # Search & Download bestaudio from 1st video result (ogg / opus / m4a): MEDIUM CPU + # OPTION: --embed-thumbnail --metadata-from-title "%(artist)s - %(title)s" --add-metadata + youtube-dl --default-search ytsearch1: --download-archive /home/pi/.ytdl.list --continue --no-overwrites --metadata-from-title "$artist - %(title)s" --add-metadata --embed-thumbnail --ignore-errors -f m4a --extract-audio -o "/home/pi/music/${artist}/${song}/%(id)s.%(title)s.%(uploader_id)s.%(ext)s" "$mysearch" >> /tmp/youtube-dl.log 2>&1 + # TODO: CHOOSE --metadata-from-title "$artist - %(title)s" or --metadata-from-title %(title)s" + # Update mpd playlist + curl -b "currenthost=Default;player_backend=mpd" http://localhost/albums.php?rebuild=yes > /dev/null + ~/parle.sh "Enregistrement $radio terminé!" +###################################################### +#### COPY LINK : "CopyLaRadio||https://link2media.url" +elif [[ "$radio" != "" && "$artist" == "" && "$song" != "" ]]; then + # LINK COPY + ~/parle.sh "Copie du lien!" + echo "Copy LINK: $song" >> /tmp/youtube-dl.log 2>&1 + mkdir -p /home/pi/download/ + youtube-dl --download-archive /home/pi/.ytdl.list --continue --no-overwrites --embed-thumbnail --metadata-from-title "%(artist)s - %(title)s" --add-metadata -o "/home/pi/download/%(title)s.%(ext)s" "$song" >> /tmp/youtube-dl.log 2>&1 + ~/parle.sh "Enregistrement du lien terminé!" +###################################################### +#### COPY LINK : "radio||" +elif [[ "$radio" != "" && "$artist" == "" && "$song" == "" ]]; then + # EXTERNAL PARSER: ADD SCRAPERS IN ./libradio + ~/parle.sh "Recherche RADIO ${radio}" + echo "External search: ${radio}" >> /tmp/youtube-dl.log 2>&1 + if [[ -f /home/pi/G1sms+/_CopyLaRadio/libradio/${radio}.php ]]; then + ~/parle.sh "Module existant" + php "/home/pi/G1sms+/_CopyLaRadio/libradio/${radio}.php" + else + ~/parle.sh "Aucun module de décodage pour cette radio." + fi +#### NOTHING GOOD +else + ~/parle.sh "Rien à copier" +fi +done + diff --git a/_CopyLaRadio/libradio/FIP autour de llectro.php b/_CopyLaRadio/libradio/FIP autour de llectro.php new file mode 100644 index 0000000..b4d883b --- /dev/null +++ b/_CopyLaRadio/libradio/FIP autour de llectro.php @@ -0,0 +1,75 @@ + array( + 'header'=>array("Referer: ".$referer.PHP_EOL), + 'timeout' => 5 + ) + ) +); +/////////////////////////// +// LOAD RADIO PAGE INTO PARSER +$ontheair = file_get_contents($radiourl); // JSON CONTENT +$ontheair = utf8_encode($ontheair); +$obj = json_decode($ontheair, true); + + +// GET TRACK INFO: ADAPT WITH DATA STRUCTURE +// ADPAPT HERE +$current = $obj['data']['now']['playing_item']; +// GET TRACK INFO +if ( $current ) { + // ADPAPT HERE + $artist = ucwords(strtolower($current['title'])); + $title = ucwords(strtolower($current['subtitle'])); + + if ( $debug != 0 ) $ERR .= "\nTITRE = ".print_r($title, true); + if ( $debug != 0 ) $ERR .= "\nARTISTE = ".print_r($artist, true); + +} +/////////////////////////// +// PREPARE COPY COMMAND +$cmd = $RADIO.'|'.$artist.'|'.$title; + +/////////////////////////// +// DEBUG OR PROD +if($debug == 1) { + print_r($obj); + print_r($cmd); +} else { + if( $artist != "" && $title != "" ) { + // TODO Clean strings?! + if (! exec('grep '.escapeshellarg($cmd).' /tmp/ytdl.list')) { + file_put_contents("/tmp/youtube-dl.log", "ARTIST: ".$artist.". SONG: ".$title, FILE_APPEND); + file_put_contents("/tmp/ytdl.list","$cmd\n", FILE_APPEND); + } else { + file_put_contents("/tmp/youtube-dl.log", "ALREADY THERE!", FILE_APPEND); + file_put_contents("/tmp/ytdl.list","||".PHP_EOL, FILE_APPEND); + } + } else { + file_put_contents("/tmp/youtube-dl.log", "NO TRACK. TRY PODCAST!", FILE_APPEND); + file_put_contents("/tmp/ytdl.list","||".PHP_EOL, FILE_APPEND); + } +} +?> diff --git a/_CopyLaRadio/libradio/Nova zz.php b/_CopyLaRadio/libradio/Nova zz.php new file mode 120000 index 0000000..67488fe --- /dev/null +++ b/_CopyLaRadio/libradio/Nova zz.php @@ -0,0 +1 @@ +radionova.php \ No newline at end of file diff --git a/_CopyLaRadio/libradio/fipelectro-midfi.mp3.php b/_CopyLaRadio/libradio/fipelectro-midfi.mp3.php new file mode 120000 index 0000000..62b4fe5 --- /dev/null +++ b/_CopyLaRadio/libradio/fipelectro-midfi.mp3.php @@ -0,0 +1 @@ +FIP autour de llectro.php \ No newline at end of file diff --git a/_CopyLaRadio/libradio/radionova.php b/_CopyLaRadio/libradio/radionova.php new file mode 100644 index 0000000..fef1c4c --- /dev/null +++ b/_CopyLaRadio/libradio/radionova.php @@ -0,0 +1,74 @@ + array( + 'header'=>array("Referer: ".$referer.PHP_EOL), + 'timeout' => 5 + ) + ) +); +/////////////////////////// +// LOAD RADIO PAGE INTO PARSER +$ontheair = file_get_contents($radiourl); // JSON CONTENT +$ontheair = utf8_encode($ontheair); +$obj = json_decode($ontheair, true); + + +// GET TRACK INFO: ADAPT WITH DATA STRUCTURE +// ADPAPT HERE +if ( $obj['currentTrack'] ) { + + // ADPAPT HERE + $title = ucwords(strtolower($obj['currentTrack']['title'])); + $artist = ucwords(strtolower($obj['currentTrack']['artist'])); + + if ( $debug != 0 ) $ERR .= "\nTITRE = ".print_r($title, true); + if ( $debug != 0 ) $ERR .= "\nARTISTE = ".print_r($artist, true); + +} +/////////////////////////// +// PREPARE COPY COMMAND +$cmd = $RADIO.'|'.$artist.'|'.$title; + +/////////////////////////// +// DEBUG OR PROD +if($debug == 1) { + print_r($obj); + print_r($cmd); +} else { + if( $artist != "" && $title != "" ) { + // TODO Clean strings?! + if (! exec('grep '.escapeshellarg($cmd).' /tmp/ytdl.list')) { + file_put_contents("/tmp/youtube-dl.log", "ARTIST: ".$artist.". SONG: ".$title, FILE_APPEND); + file_put_contents("/tmp/ytdl.list","$cmd\n", FILE_APPEND); + } else { + file_put_contents("/tmp/youtube-dl.log", "ALREADY THERE!", FILE_APPEND); + file_put_contents("/tmp/ytdl.list","||".PHP_EOL, FILE_APPEND); + } + } else { + file_put_contents("/tmp/youtube-dl.log", "NO TRACK. TRY PODCAST!", FILE_APPEND); + file_put_contents("/tmp/ytdl.list","||".PHP_EOL, FILE_APPEND); + } +} +?> diff --git a/_CopyLaRadio/libradio/simple_html_dom.php b/_CopyLaRadio/libradio/simple_html_dom.php new file mode 100644 index 0000000..c0001e3 --- /dev/null +++ b/_CopyLaRadio/libradio/simple_html_dom.php @@ -0,0 +1,2808 @@ +size is the "real" + * number of bytes the dom was created from. But for most purposes, it's a + * really good estimation. + * + * Paperg - Added the forceTagsClosed to the dom constructor. Forcing tags + * closed is great for malformed html, but it CAN lead to parsing errors. + * + * Allow the user to tell us how much they trust the html. + * + * Paperg add the text and plaintext to the selectors for the find syntax. + * plaintext implies text in the innertext of a node. text implies that the + * tag is a text node. This allows for us to find tags based on the text they + * contain. + * + * Create find_ancestor_tag to see if a tag is - at any level - inside of + * another specific tag. + * + * Paperg: added parse_charset so that we know about the character set of + * the source document. NOTE: If the user's system has a routine called + * get_last_retrieve_url_contents_content_type availalbe, we will assume it's + * returning the content-type header from the last transfer or curl_exec, and + * we will parse that and use it in preference to any other method of charset + * detection. + * + * Found infinite loop in the case of broken html in restore_noise. Rewrote to + * protect from that. + * + * PaperG (John Schlick) Added get_display_size for "IMG" tags. + * + * Licensed under The MIT License + * Redistributions of files must retain the above copyright notice. + * + * @author S.C. Chen + * @author John Schlick + * @author Rus Carroll + * @version Rev. 1.8.1 (247) + * @package PlaceLocalInclude + * @subpackage simple_html_dom + */ + +/** + * All of the Defines for the classes below. + * @author S.C. Chen + */ +define('HDOM_TYPE_ELEMENT', 1); +define('HDOM_TYPE_COMMENT', 2); +define('HDOM_TYPE_TEXT', 3); +define('HDOM_TYPE_ENDTAG', 4); +define('HDOM_TYPE_ROOT', 5); +define('HDOM_TYPE_UNKNOWN', 6); +define('HDOM_QUOTE_DOUBLE', 0); +define('HDOM_QUOTE_SINGLE', 1); +define('HDOM_QUOTE_NO', 3); +define('HDOM_INFO_BEGIN', 0); +define('HDOM_INFO_END', 1); +define('HDOM_INFO_QUOTE', 2); +define('HDOM_INFO_SPACE', 3); +define('HDOM_INFO_TEXT', 4); +define('HDOM_INFO_INNER', 5); +define('HDOM_INFO_OUTER', 6); +define('HDOM_INFO_ENDSPACE', 7); + +/** The default target charset */ +defined('DEFAULT_TARGET_CHARSET') || define('DEFAULT_TARGET_CHARSET', 'UTF-8'); + +/** The default
text used instead of
tags when returning text */ +defined('DEFAULT_BR_TEXT') || define('DEFAULT_BR_TEXT', "\r\n"); + +/** The default text used instead of tags when returning text */ +defined('DEFAULT_SPAN_TEXT') || define('DEFAULT_SPAN_TEXT', ' '); + +/** The maximum file size the parser should load */ +defined('MAX_FILE_SIZE') || define('MAX_FILE_SIZE', 600000); + +/** Contents between curly braces "{" and "}" are interpreted as text */ +define('HDOM_SMARTY_AS_TEXT', 1); + +// helper functions +// ----------------------------------------------------------------------------- +// get html dom from file +// $maxlen is defined in the code as PHP_STREAM_COPY_ALL which is defined as -1. +function file_get_html( + $url, + $use_include_path = false, + $context = null, + $offset = 0, + $maxLen = -1, + $lowercase = true, + $forceTagsClosed = true, + $target_charset = DEFAULT_TARGET_CHARSET, + $stripRN = true, + $defaultBRText = DEFAULT_BR_TEXT, + $defaultSpanText = DEFAULT_SPAN_TEXT) +{ + // Ensure maximum length is greater than zero + if($maxLen <= 0) { $maxLen = MAX_FILE_SIZE; } + + // We DO force the tags to be terminated. + $dom = new simple_html_dom( + null, + $lowercase, + $forceTagsClosed, + $target_charset, + $stripRN, + $defaultBRText, + $defaultSpanText); + + /** + * For sourceforge users: uncomment the next line and comment the + * retrieve_url_contents line 2 lines down if it is not already done. + */ + $contents = file_get_contents( + $url, + $use_include_path, + $context, + $offset, + $maxLen); + + // Paperg - use our own mechanism for getting the contents as we want to + // control the timeout. + // $contents = retrieve_url_contents($url); + if (empty($contents) || strlen($contents) > $maxLen) { return false; } + + // The second parameter can force the selectors to all be lowercase. + $dom->load($contents, $lowercase, $stripRN); + return $dom; +} + +// get html dom from string +function str_get_html( + $str, + $lowercase = true, + $forceTagsClosed = true, + $target_charset = DEFAULT_TARGET_CHARSET, + $stripRN = true, + $defaultBRText = DEFAULT_BR_TEXT, + $defaultSpanText = DEFAULT_SPAN_TEXT) +{ + $dom = new simple_html_dom( + null, + $lowercase, + $forceTagsClosed, + $target_charset, + $stripRN, + $defaultBRText, + $defaultSpanText); + + if (empty($str) || strlen($str) > MAX_FILE_SIZE) { + $dom->clear(); + return false; + } + + $dom->load($str, $lowercase, $stripRN); + return $dom; +} + +// dump html dom tree +function dump_html_tree($node, $show_attr = true, $deep = 0) +{ + $node->dump($node); +} + +/** + * simple html dom node + * PaperG - added ability for "find" routine to lowercase the value of the + * selector. + * + * PaperG - added $tag_start to track the start position of the tag in the total + * byte index + * + * @package PlaceLocalInclude + */ +class simple_html_dom_node +{ + /** + * Node type + * + * Default is {@see HDOM_TYPE_TEXT} + * + * @var int + */ + public $nodetype = HDOM_TYPE_TEXT; + + /** + * Tag name + * + * Default is 'text' + * + * @var string + */ + public $tag = 'text'; + + /** + * List of attributes + * + * @var array + */ + public $attr = array(); + + /** + * List of child node objects + * + * @var array + */ + public $children = array(); + public $nodes = array(); + + /** + * The parent node object + * + * @var object|null + */ + public $parent = null; + + // The "info" array - see HDOM_INFO_... for what each element contains. + public $_ = array(); + + /** + * Start position of the tag in the document + * + * @var int + */ + public $tag_start = 0; + + /** + * The DOM object + * + * @var object|null + */ + private $dom = null; + + /** + * Construct new node object + * + * Adds itself to the list of DOM Nodes {@see simple_html_dom::$nodes} + */ + function __construct($dom) + { + $this->dom = $dom; + $dom->nodes[] = $this; + } + + function __destruct() + { + $this->clear(); + } + + function __toString() + { + return $this->outertext(); + } + + // clean up memory due to php5 circular references memory leak... + function clear() + { + $this->dom = null; + $this->nodes = null; + $this->parent = null; + $this->children = null; + } + + // dump node's tree + function dump($show_attr = true, $deep = 0) + { + $lead = str_repeat(' ', $deep); + + echo $lead . $this->tag; + + if ($show_attr && count($this->attr) > 0) { + echo '('; + foreach ($this->attr as $k => $v) { + echo "[$k]=>\"" . $this->$k . '", '; + } + echo ')'; + } + + echo "\n"; + + if ($this->nodes) { + foreach ($this->nodes as $c) { + $c->dump($show_attr, $deep + 1); + } + } + } + + + // Debugging function to dump a single dom node with a bunch of information about it. + function dump_node($echo = true) + { + $string = $this->tag; + + if (count($this->attr) > 0) { + $string .= '('; + foreach ($this->attr as $k => $v) { + $string .= "[$k]=>\"" . $this->$k . '", '; + } + $string .= ')'; + } + + if (count($this->_) > 0) { + $string .= ' $_ ('; + foreach ($this->_ as $k => $v) { + if (is_array($v)) { + $string .= "[$k]=>("; + foreach ($v as $k2 => $v2) { + $string .= "[$k2]=>\"" . $v2 . '", '; + } + $string .= ')'; + } else { + $string .= "[$k]=>\"" . $v . '", '; + } + } + $string .= ')'; + } + + if (isset($this->text)) { + $string .= ' text: (' . $this->text . ')'; + } + + $string .= " HDOM_INNER_INFO: '"; + + if (isset($node->_[HDOM_INFO_INNER])) { + $string .= $node->_[HDOM_INFO_INNER] . "'"; + } else { + $string .= ' NULL '; + } + + $string .= ' children: ' . count($this->children); + $string .= ' nodes: ' . count($this->nodes); + $string .= ' tag_start: ' . $this->tag_start; + $string .= "\n"; + + if ($echo) { + echo $string; + return; + } else { + return $string; + } + } + + /** + * Return or set parent node + * + * @param object|null $parent (optional) The parent node, `null` to return + * the current parent node. + * @return object|null The parent node + */ + function parent($parent = null) + { + // I am SURE that this doesn't work properly. + // It fails to unset the current node from it's current parents nodes or + // children list first. + if ($parent !== null) { + $this->parent = $parent; + $this->parent->nodes[] = $this; + $this->parent->children[] = $this; + } + + return $this->parent; + } + + /** + * @return bool True if the node has at least one child node + */ + function has_child() + { + return !empty($this->children); + } + + /** + * Get child node at specified index + * + * @param int $idx The index of the child node to return, `-1` to return all + * child nodes. + * @return object|array|null The child node at the specified index, all child + * nodes or null if the index is invalid. + */ + function children($idx = -1) + { + if ($idx === -1) { + return $this->children; + } + + if (isset($this->children[$idx])) { + return $this->children[$idx]; + } + + return null; + } + + /** + * Get first child node + * + * @return object|null The first child node or null if the current node has + * no child nodes. + * + * @todo Use `empty()` instead of `count()` to improve performance on large + * arrays. + */ + function first_child() + { + if (count($this->children) > 0) { + return $this->children[0]; + } + return null; + } + + /** + * Get last child node + * + * @return object|null The last child node or null if the current node has + * no child nodes. + * + * @todo Use `end()` to slightly improve performance on large arrays. + */ + function last_child() + { + if (($count = count($this->children)) > 0) { + return $this->children[$count - 1]; + } + return null; + } + + /** + * Get next sibling node + * + * @return object|null The sibling node or null if the current node has no + * sibling nodes. + */ + function next_sibling() + { + if ($this->parent === null) { + return null; + } + + $idx = 0; + $count = count($this->parent->children); + + while ($idx < $count && $this !== $this->parent->children[$idx]) { + ++$idx; + } + + if (++$idx >= $count) { + return null; + } + + return $this->parent->children[$idx]; + } + + /** + * Get previous sibling node + * + * @return object|null The sibling node or null if the current node has no + * sibling nodes. + */ + function prev_sibling() + { + if ($this->parent === null) { return null; } + + $idx = 0; + $count = count($this->parent->children); + + while ($idx < $count && $this !== $this->parent->children[$idx]) { + ++$idx; + } + + if (--$idx < 0) { return null; } + + return $this->parent->children[$idx]; + } + + /** + * Traverse ancestors to the first matching tag. + * + * @param string $tag Tag to find + * @return object|null First matching node in the DOM tree or null if no + * match was found. + * + * @todo Null is returned implicitly by calling ->parent on the root node. + * This behaviour could change at any time, rendering this function invalid. + */ + function find_ancestor_tag($tag) + { + global $debug_object; + if (is_object($debug_object)) { $debug_object->debug_log_entry(1); } + + // Start by including ourselves in the comparison. + $returnDom = $this; + + while (!is_null($returnDom)) { + if (is_object($debug_object)) { + $debug_object->debug_log(2, 'Current tag is: ' . $returnDom->tag); + } + + if ($returnDom->tag == $tag) { + break; + } + + $returnDom = $returnDom->parent; + } + + return $returnDom; + } + + /** + * Get node's inner text (everything inside the opening and closing tags) + * + * @return string + */ + function innertext() + { + if (isset($this->_[HDOM_INFO_INNER])) { + return $this->_[HDOM_INFO_INNER]; + } + + if (isset($this->_[HDOM_INFO_TEXT])) { + return $this->dom->restore_noise($this->_[HDOM_INFO_TEXT]); + } + + $ret = ''; + + foreach ($this->nodes as $n) { + $ret .= $n->outertext(); + } + + return $ret; + } + + /** + * Get node's outer text (everything including the opening and closing tags) + * + * @return string + */ + function outertext() + { + global $debug_object; + + if (is_object($debug_object)) { + $text = ''; + + if ($this->tag === 'text') { + if (!empty($this->text)) { + $text = ' with text: ' . $this->text; + } + } + + $debug_object->debug_log(1, 'Innertext of tag: ' . $this->tag . $text); + } + + if ($this->tag === 'root') return $this->innertext(); + + // trigger callback + if ($this->dom && $this->dom->callback !== null) { + call_user_func_array($this->dom->callback, array($this)); + } + + if (isset($this->_[HDOM_INFO_OUTER])) { + return $this->_[HDOM_INFO_OUTER]; + } + + if (isset($this->_[HDOM_INFO_TEXT])) { + return $this->dom->restore_noise($this->_[HDOM_INFO_TEXT]); + } + + // render begin tag + if ($this->dom && $this->dom->nodes[$this->_[HDOM_INFO_BEGIN]]) { + $ret = $this->dom->nodes[$this->_[HDOM_INFO_BEGIN]]->makeup(); + } else { + $ret = ''; + } + + // render inner text + if (isset($this->_[HDOM_INFO_INNER])) { + // If it's a br tag... don't return the HDOM_INNER_INFO that we + // may or may not have added. + if ($this->tag !== 'br') { + $ret .= $this->_[HDOM_INFO_INNER]; + } + } else { + if ($this->nodes) { + foreach ($this->nodes as $n) { + $ret .= $this->convert_text($n->outertext()); + } + } + } + + // render end tag + if (isset($this->_[HDOM_INFO_END]) && $this->_[HDOM_INFO_END] != 0) { + $ret .= 'tag . '>'; + } + + return $ret; + } + + /** + * Get node's plain text (everything excluding all tags) + * + * @return string + */ + function text() + { + if (isset($this->_[HDOM_INFO_INNER])) { + return $this->_[HDOM_INFO_INNER]; + } + + switch ($this->nodetype) { + case HDOM_TYPE_TEXT: return $this->dom->restore_noise($this->_[HDOM_INFO_TEXT]); + case HDOM_TYPE_COMMENT: return ''; + case HDOM_TYPE_UNKNOWN: return ''; + } + + if (strcasecmp($this->tag, 'script') === 0) { return ''; } + if (strcasecmp($this->tag, 'style') === 0) { return ''; } + + $ret = ''; + + // In rare cases, (always node type 1 or HDOM_TYPE_ELEMENT - observed + // for some span tags, and some p tags) $this->nodes is set to NULL. + // NOTE: This indicates that there is a problem where it's set to NULL + // without a clear happening. + // WHY is this happening? + if (!is_null($this->nodes)) { + foreach ($this->nodes as $n) { + // Start paragraph after a blank line + if ($n->tag === 'p') { + $ret .= "\n\n"; + } + + $ret .= $this->convert_text($n->text()); + + // If this node is a span... add a space at the end of it so + // multiple spans don't run into each other. This is plaintext + // after all. + if ($n->tag === 'span') { + $ret .= $this->dom->default_span_text; + } + } + } + return trim($ret); + } + + /** + * Get node's xml text (inner text as a CDATA section) + * + * @return string + */ + function xmltext() + { + $ret = $this->innertext(); + $ret = str_ireplace('', '', $ret); + return $ret; + } + + // build node's text with tag + function makeup() + { + // text, comment, unknown + if (isset($this->_[HDOM_INFO_TEXT])) { + return $this->dom->restore_noise($this->_[HDOM_INFO_TEXT]); + } + + $ret = '<' . $this->tag; + $i = -1; + + foreach ($this->attr as $key => $val) { + ++$i; + + // skip removed attribute + if ($val === null || $val === false) { continue; } + + $ret .= $this->_[HDOM_INFO_SPACE][$i][0]; + + //no value attr: nowrap, checked selected... + if ($val === true) { + $ret .= $key; + } else { + switch ($this->_[HDOM_INFO_QUOTE][$i]) + { + case HDOM_QUOTE_DOUBLE: $quote = '"'; break; + case HDOM_QUOTE_SINGLE: $quote = '\''; break; + default: $quote = ''; + } + + $ret .= $key + . $this->_[HDOM_INFO_SPACE][$i][1] + . '=' + . $this->_[HDOM_INFO_SPACE][$i][2] + . $quote + . $val + . $quote; + } + } + + $ret = $this->dom->restore_noise($ret); + return $ret . $this->_[HDOM_INFO_ENDSPACE] . '>'; + } + + /** + * Find elements by CSS selector + * + * @param string $selector The CSS selector + * @param int|null $idx Index of element to return form the list of matching + * elements (default: `null` = disabled). + * @param bool $lowercase Matches tag names case insensitive (lowercase) if + * enabled (default: `false`) + * @return array|object|null A list of elements matching the specified CSS + * selector or a single element if $idx is specified or null if no element + * was found. + */ + function find($selector, $idx = null, $lowercase = false) + { + $selectors = $this->parse_selector($selector); + if (($count = count($selectors)) === 0) { return array(); } + $found_keys = array(); + + // find each selector + for ($c = 0; $c < $count; ++$c) { + // The change on the below line was documented on the sourceforge + // code tracker id 2788009 + // used to be: if (($levle=count($selectors[0]))===0) return array(); + if (($levle = count($selectors[$c])) === 0) { return array(); } + if (!isset($this->_[HDOM_INFO_BEGIN])) { return array(); } + + $head = array($this->_[HDOM_INFO_BEGIN] => 1); + $cmd = ' '; // Combinator + + // handle descendant selectors, no recursive! + for ($l = 0; $l < $levle; ++$l) { + $ret = array(); + + foreach ($head as $k => $v) { + $n = ($k === -1) ? $this->dom->root : $this->dom->nodes[$k]; + //PaperG - Pass this optional parameter on to the seek function. + $n->seek($selectors[$c][$l], $ret, $cmd, $lowercase); + } + + $head = $ret; + $cmd = $selectors[$c][$l][4]; // Next Combinator + } + + foreach ($head as $k => $v) { + if (!isset($found_keys[$k])) { + $found_keys[$k] = 1; + } + } + } + + // sort keys + ksort($found_keys); + + $found = array(); + foreach ($found_keys as $k => $v) { + $found[] = $this->dom->nodes[$k]; + } + + // return nth-element or array + if (is_null($idx)) { return $found; } + elseif ($idx < 0) { $idx = count($found) + $idx; } + return (isset($found[$idx])) ? $found[$idx] : null; + } + + /** + * Seek DOM elements by selector + * + * **Note** + * The selector element must be compatible to a selector from + * {@see simple_html_dom_node::parse_selector()} + * + * @param array $selector A selector element + * @param array $ret An array of matches + * @param bool $lowercase Matches tag names case insensitive (lowercase) if + * enabled (default: `false`) + * @return void + */ + protected function seek($selector, &$ret, $parent_cmd, $lowercase = false) + { + global $debug_object; + if (is_object($debug_object)) { $debug_object->debug_log_entry(1); } + + list($tag, $id, $class, $attributes, $cmb) = $selector; + $nodes = array(); + + if ($parent_cmd === ' ') { // Descendant Combinator + // Find parent closing tag if the current element doesn't have a closing + // tag (i.e. void element) + $end = (!empty($this->_[HDOM_INFO_END])) ? $this->_[HDOM_INFO_END] : 0; + if ($end == 0) { + $parent = $this->parent; + while (!isset($parent->_[HDOM_INFO_END]) && $parent !== null) { + $end -= 1; + $parent = $parent->parent; + } + $end += $parent->_[HDOM_INFO_END]; + } + + // Get list of target nodes + $nodes_start = $this->_[HDOM_INFO_BEGIN] + 1; + $nodes_count = $end - $nodes_start; + $nodes = array_slice($this->dom->nodes, $nodes_start, $nodes_count, true); + } elseif ($parent_cmd === '>') { // Child Combinator + $nodes = $this->children; + } elseif ($parent_cmd === '+' + && $this->parent + && in_array($this, $this->parent->children)) { // Next-Sibling Combinator + $index = array_search($this, $this->parent->children, true) + 1; + $nodes[] = $this->parent->children[$index]; + } elseif ($parent_cmd === '~' + && $this->parent + && in_array($this, $this->parent->children)) { // Subsequent Sibling Combinator + $index = array_search($this, $this->parent->children, true); + $nodes = array_slice($this->parent->children, $index); + } + + // Go throgh each element starting at this element until the end tag + // Note: If this element is a void tag, any previous void element is + // skipped. + foreach($nodes as $node) { + $pass = true; + + // Skip root nodes + if(!$node->parent) { + $pass = false; + } + + // Skip if node isn't a child node (i.e. text nodes) + if($pass && !in_array($node, $node->parent->children, true)) { + $pass = false; + } + + // Skip if tag doesn't match + if ($pass && $tag !== '' && $tag !== $node->tag && $tag !== '*') { + $pass = false; + } + + // Skip if ID doesn't exist + if ($pass && $id !== '' && !isset($node->attr['id'])) { + $pass = false; + } + + // Check if ID matches + if ($pass && $id !== '' && isset($node->attr['id'])) { + // Note: Only consider the first ID (as browsers do) + $node_id = explode(' ', trim($node->attr['id']))[0]; + + if($id !== $node_id) { $pass = false; } + } + + // Check if all class(es) exist + if ($pass && $class !== '' && is_array($class) && !empty($class)) { + if (isset($node->attr['class'])) { + $node_classes = explode(' ', $node->attr['class']); + + if ($lowercase) { + $node_classes = array_map('strtolower', $node_classes); + } + + foreach($class as $c) { + if(!in_array($c, $node_classes)) { + $pass = false; + break; + } + } + } else { + $pass = false; + } + } + + // Check attributes + if ($pass + && $attributes !== '' + && is_array($attributes) + && !empty($attributes)) { + foreach($attributes as $a) { + list ( + $att_name, + $att_expr, + $att_val, + $att_inv, + $att_case_sensitivity + ) = $a; + + // Handle indexing attributes (i.e. "[2]") + /** + * Note: This is not supported by the CSS Standard but adds + * the ability to select items compatible to XPath (i.e. + * the 3rd element within it's parent). + * + * Note: This doesn't conflict with the CSS Standard which + * doesn't work on numeric attributes anyway. + */ + if (is_numeric($att_name) + && $att_expr === '' + && $att_val === '') { + $count = 0; + + // Find index of current element in parent + foreach ($node->parent->children as $c) { + if ($c->tag === $node->tag) ++$count; + if ($c === $node) break; + } + + // If this is the correct node, continue with next + // attribute + if ($count === (int)$att_name) continue; + } + + // Check attribute availability + if ($att_inv) { // Attribute should NOT be set + if (isset($node->attr[$att_name])) { + $pass = false; + break; + } + } else { // Attribute should be set + // todo: "plaintext" is not a valid CSS selector! + if ($att_name !== 'plaintext' + && !isset($node->attr[$att_name])) { + $pass = false; + break; + } + } + + // Continue with next attribute if expression isn't defined + if ($att_expr === '') continue; + + // If they have told us that this is a "plaintext" + // search then we want the plaintext of the node - right? + // todo "plaintext" is not a valid CSS selector! + if ($att_name === 'plaintext') { + $nodeKeyValue = $node->text(); + } else { + $nodeKeyValue = $node->attr[$att_name]; + } + + if (is_object($debug_object)) { + $debug_object->debug_log(2, + 'testing node: ' + . $node->tag + . ' for attribute: ' + . $att_name + . $att_expr + . $att_val + . ' where nodes value is: ' + . $nodeKeyValue + ); + } + + // If lowercase is set, do a case insensitive test of + // the value of the selector. + if ($lowercase) { + $check = $this->match( + $att_expr, + strtolower($att_val), + strtolower($nodeKeyValue), + $att_case_sensitivity + ); + } else { + $check = $this->match( + $att_expr, + $att_val, + $nodeKeyValue, + $att_case_sensitivity + ); + } + + if (is_object($debug_object)) { + $debug_object->debug_log(2, + 'after match: ' + . ($check ? 'true' : 'false') + ); + } + + if (!$check) { + $pass = false; + break; + } + } + } + + // Found a match. Add to list and clear node + if ($pass) $ret[$node->_[HDOM_INFO_BEGIN]] = 1; + unset($node); + } + // It's passed by reference so this is actually what this function returns. + if (is_object($debug_object)) { + $debug_object->debug_log(1, 'EXIT - ret: ', $ret); + } + } + + /** + * Match value and pattern for a given CSS expression + * + * **Supported Expressions** + * + * | Expression | Description + * | ---------- | ----------- + * | `=` | $value and $pattern must be equal + * | `!=` | $value and $pattern must not be equal + * | `^=` | $value must start with $pattern + * | `$=` | $value must end with $pattern + * | `*=` | $value must contain $pattern + * + * @param string $exp The expression. + * @param string $pattern The pattern + * @param string $value The value + * @value bool True if $value matches $pattern + */ + protected function match($exp, $pattern, $value, $case_sensitivity) + { + global $debug_object; + if (is_object($debug_object)) {$debug_object->debug_log_entry(1);} + + if ($case_sensitivity === 'i') { + $pattern = strtolower($pattern); + $value = strtolower($value); + } + + switch ($exp) { + case '=': + return ($value === $pattern); + case '!=': + return ($value !== $pattern); + case '^=': + return preg_match('/^' . preg_quote($pattern, '/') . '/', $value); + case '$=': + return preg_match('/' . preg_quote($pattern, '/') . '$/', $value); + case '*=': + return preg_match('/' . preg_quote($pattern, '/') . '/', $value); + case '|=': + /** + * [att|=val] + * + * Represents an element with the att attribute, its value + * either being exactly "val" or beginning with "val" + * immediately followed by "-" (U+002D). + */ + return strpos($value, $pattern) === 0; + case '~=': + /** + * [att~=val] + * + * Represents an element with the att attribute whose value is a + * whitespace-separated list of words, one of which is exactly + * "val". If "val" contains whitespace, it will never represent + * anything (since the words are separated by spaces). Also if + * "val" is the empty string, it will never represent anything. + */ + return in_array($pattern, explode(' ', trim($value)), true); + } + return false; + } + + /** + * Parse CSS selector + * + * @param string $selector_string CSS selector string + * @return array List of CSS selectors. The format depends on the type of + * selector: + * + * ```php + * + * array( // list of selectors (each separated by a comma), i.e. 'img, p, div' + * array( // list of combinator selectors, i.e. 'img > p > div' + * array( // selector element + * [0], // (string) The element tag + * [1], // (string) The element id + * [2], // (array) The element classes + * [3], // (array>) The list of attributes, each + * // with four elements: name, expression, value, inverted + * [4] // (string) The selector combinator (' ' | '>' | '+' | '~') + * ) + * ) + * ) + * ``` + * + * @link https://www.w3.org/TR/selectors/#compound Compound selector + */ + protected function parse_selector($selector_string) + { + global $debug_object; + if (is_object($debug_object)) { $debug_object->debug_log_entry(1); } + + /** + * Pattern of CSS selectors, modified from mootools (https://mootools.net/) + * + * Paperg: Add the colon to the attribute, so that it properly finds + * like google does. + * + * Note: if you try to look at this attribute, you MUST use getAttribute + * since $dom->x:y will fail the php syntax check. + * + * Notice the \[ starting the attribute? and the @? following? This + * implies that an attribute can begin with an @ sign that is not + * captured. This implies that an html attribute specifier may start + * with an @ sign that is NOT captured by the expression. Farther study + * is required to determine of this should be documented or removed. + * + * Matches selectors in this order: + * + * [0] - full match + * + * [1] - tag name + * ([\w:\*-]*) + * Matches the tag name consisting of zero or more words, colons, + * asterisks and hyphens. + * + * [2] - id name + * (?:\#([\w-]+)) + * Optionally matches a id name, consisting of an "#" followed by + * the id name (one or more words and hyphens). + * + * [3] - class names (including dots) + * (?:\.([\w\.-]+))? + * Optionally matches a list of classs, consisting of an "." + * followed by the class name (one or more words and hyphens) + * where multiple classes can be chained (i.e. ".foo.bar.baz") + * + * [4] - attributes + * ((?:\[@?(?:!?[\w:-]+)(?:(?:[!*^$|~]?=)[\"']?(?:.*?)[\"']?)?(?:\s*?(?:[iIsS])?)?\])+)? + * Optionally matches the attributes list + * + * [5] - separator + * ([\/, >+~]+) + * Matches the selector list separator + */ + // phpcs:ignore Generic.Files.LineLength + $pattern = "/([\w:\*-]*)(?:\#([\w-]+))?(?:|\.([\w\.-]+))?((?:\[@?(?:!?[\w:-]+)(?:(?:[!*^$|~]?=)[\"']?(?:.*?)[\"']?)?(?:\s*?(?:[iIsS])?)?\])+)?([\/, >+~]+)/is"; + + preg_match_all( + $pattern, + trim($selector_string) . ' ', // Add final ' ' as pseudo separator + $matches, + PREG_SET_ORDER + ); + + if (is_object($debug_object)) { + $debug_object->debug_log(2, 'Matches Array: ', $matches); + } + + $selectors = array(); + $result = array(); + + foreach ($matches as $m) { + $m[0] = trim($m[0]); + + // Skip NoOps + if ($m[0] === '' || $m[0] === '/' || $m[0] === '//') { continue; } + + // Convert to lowercase + if ($this->dom->lowercase) { + $m[1] = strtolower($m[1]); + } + + // Extract classes + if ($m[3] !== '') { $m[3] = explode('.', $m[3]); } + + /* Extract attributes (pattern based on the pattern above!) + + * [0] - full match + * [1] - attribute name + * [2] - attribute expression + * [3] - attribute value + * [4] - case sensitivity + * + * Note: Attributes can be negated with a "!" prefix to their name + */ + if($m[4] !== '') { + preg_match_all( + "/\[@?(!?[\w:-]+)(?:([!*^$|~]?=)[\"']?(.*?)[\"']?)?(?:\s*?([iIsS])?)?\]/is", + trim($m[4]), + $attributes, + PREG_SET_ORDER + ); + + // Replace element by array + $m[4] = array(); + + foreach($attributes as $att) { + // Skip empty matches + if(trim($att[0]) === '') { continue; } + + $inverted = (isset($att[1][0]) && $att[1][0] === '!'); + $m[4][] = array( + $inverted ? substr($att[1], 1) : $att[1], // Name + (isset($att[2])) ? $att[2] : '', // Expression + (isset($att[3])) ? $att[3] : '', // Value + $inverted, // Inverted Flag + (isset($att[4])) ? strtolower($att[4]) : '', // Case-Sensitivity + ); + } + } + + // Sanitize Separator + if ($m[5] !== '' && trim($m[5]) === '') { // Descendant Separator + $m[5] = ' '; + } else { // Other Separator + $m[5] = trim($m[5]); + } + + // Clear Separator if it's a Selector List + if ($is_list = ($m[5] === ',')) { $m[5] = ''; } + + // Remove full match before adding to results + array_shift($m); + $result[] = $m; + + if ($is_list) { // Selector List + $selectors[] = $result; + $result = array(); + } + } + + if (count($result) > 0) { $selectors[] = $result; } + return $selectors; + } + + function __get($name) + { + if (isset($this->attr[$name])) { + return $this->convert_text($this->attr[$name]); + } + switch ($name) { + case 'outertext': return $this->outertext(); + case 'innertext': return $this->innertext(); + case 'plaintext': return $this->text(); + case 'xmltext': return $this->xmltext(); + default: return array_key_exists($name, $this->attr); + } + } + + function __set($name, $value) + { + global $debug_object; + if (is_object($debug_object)) { $debug_object->debug_log_entry(1); } + + switch ($name) { + case 'outertext': return $this->_[HDOM_INFO_OUTER] = $value; + case 'innertext': + if (isset($this->_[HDOM_INFO_TEXT])) { + return $this->_[HDOM_INFO_TEXT] = $value; + } + return $this->_[HDOM_INFO_INNER] = $value; + } + + if (!isset($this->attr[$name])) { + $this->_[HDOM_INFO_SPACE][] = array(' ', '', ''); + $this->_[HDOM_INFO_QUOTE][] = HDOM_QUOTE_DOUBLE; + } + + $this->attr[$name] = $value; + } + + function __isset($name) + { + switch ($name) { + case 'outertext': return true; + case 'innertext': return true; + case 'plaintext': return true; + } + //no value attr: nowrap, checked selected... + return (array_key_exists($name, $this->attr)) ? true : isset($this->attr[$name]); + } + + function __unset($name) + { + if (isset($this->attr[$name])) { unset($this->attr[$name]); } + } + + // PaperG - Function to convert the text from one character set to another + // if the two sets are not the same. + function convert_text($text) + { + global $debug_object; + if (is_object($debug_object)) { $debug_object->debug_log_entry(1); } + + $converted_text = $text; + + $sourceCharset = ''; + $targetCharset = ''; + + if ($this->dom) { + $sourceCharset = strtoupper($this->dom->_charset); + $targetCharset = strtoupper($this->dom->_target_charset); + } + + if (is_object($debug_object)) { + $debug_object->debug_log(3, + 'source charset: ' + . $sourceCharset + . ' target charaset: ' + . $targetCharset + ); + } + + if (!empty($sourceCharset) + && !empty($targetCharset) + && (strcasecmp($sourceCharset, $targetCharset) != 0)) { + // Check if the reported encoding could have been incorrect and the text is actually already UTF-8 + if ((strcasecmp($targetCharset, 'UTF-8') == 0) + && ($this->is_utf8($text))) { + $converted_text = $text; + } else { + $converted_text = iconv($sourceCharset, $targetCharset, $text); + } + } + + // Lets make sure that we don't have that silly BOM issue with any of the utf-8 text we output. + if ($targetCharset === 'UTF-8') { + if (substr($converted_text, 0, 3) === "\xef\xbb\xbf") { + $converted_text = substr($converted_text, 3); + } + + if (substr($converted_text, -3) === "\xef\xbb\xbf") { + $converted_text = substr($converted_text, 0, -3); + } + } + + return $converted_text; + } + + /** + * Returns true if $string is valid UTF-8 and false otherwise. + * + * @param mixed $str String to be tested + * @return boolean + */ + static function is_utf8($str) + { + $c = 0; $b = 0; + $bits = 0; + $len = strlen($str); + for($i = 0; $i < $len; $i++) { + $c = ord($str[$i]); + if($c > 128) { + if(($c >= 254)) { return false; } + elseif($c >= 252) { $bits = 6; } + elseif($c >= 248) { $bits = 5; } + elseif($c >= 240) { $bits = 4; } + elseif($c >= 224) { $bits = 3; } + elseif($c >= 192) { $bits = 2; } + else { return false; } + if(($i + $bits) > $len) { return false; } + while($bits > 1) { + $i++; + $b = ord($str[$i]); + if($b < 128 || $b > 191) { return false; } + $bits--; + } + } + } + return true; + } + + /** + * Function to try a few tricks to determine the displayed size of an img on + * the page. NOTE: This will ONLY work on an IMG tag. Returns FALSE on all + * other tag types. + * + * @author John Schlick + * @version April 19 2012 + * @return array an array containing the 'height' and 'width' of the image + * on the page or -1 if we can't figure it out. + */ + function get_display_size() + { + global $debug_object; + + $width = -1; + $height = -1; + + if ($this->tag !== 'img') { + return false; + } + + // See if there is aheight or width attribute in the tag itself. + if (isset($this->attr['width'])) { + $width = $this->attr['width']; + } + + if (isset($this->attr['height'])) { + $height = $this->attr['height']; + } + + // Now look for an inline style. + if (isset($this->attr['style'])) { + // Thanks to user gnarf from stackoverflow for this regular expression. + $attributes = array(); + + preg_match_all( + '/([\w-]+)\s*:\s*([^;]+)\s*;?/', + $this->attr['style'], + $matches, + PREG_SET_ORDER + ); + + foreach ($matches as $match) { + $attributes[$match[1]] = $match[2]; + } + + // If there is a width in the style attributes: + if (isset($attributes['width']) && $width == -1) { + // check that the last two characters are px (pixels) + if (strtolower(substr($attributes['width'], -2)) === 'px') { + $proposed_width = substr($attributes['width'], 0, -2); + // Now make sure that it's an integer and not something stupid. + if (filter_var($proposed_width, FILTER_VALIDATE_INT)) { + $width = $proposed_width; + } + } + } + + // If there is a width in the style attributes: + if (isset($attributes['height']) && $height == -1) { + // check that the last two characters are px (pixels) + if (strtolower(substr($attributes['height'], -2)) == 'px') { + $proposed_height = substr($attributes['height'], 0, -2); + // Now make sure that it's an integer and not something stupid. + if (filter_var($proposed_height, FILTER_VALIDATE_INT)) { + $height = $proposed_height; + } + } + } + + } + + // Future enhancement: + // Look in the tag to see if there is a class or id specified that has + // a height or width attribute to it. + + // Far future enhancement + // Look at all the parent tags of this image to see if they specify a + // class or id that has an img selector that specifies a height or width + // Note that in this case, the class or id will have the img subselector + // for it to apply to the image. + + // ridiculously far future development + // If the class or id is specified in a SEPARATE css file thats not on + // the page, go get it and do what we were just doing for the ones on + // the page. + + $result = array( + 'height' => $height, + 'width' => $width + ); + + return $result; + } + + // camel naming conventions + function getAllAttributes() + { + return $this->attr; + } + + function getAttribute($name) + { + return $this->__get($name); + } + + function setAttribute($name, $value) + { + $this->__set($name, $value); + } + + function hasAttribute($name) + { + return $this->__isset($name); + } + + function removeAttribute($name) + { + $this->__set($name, null); + } + + function getElementById($id) + { + return $this->find("#$id", 0); + } + + function getElementsById($id, $idx = null) + { + return $this->find("#$id", $idx); + } + + function getElementByTagName($name) + { + return $this->find($name, 0); + } + + function getElementsByTagName($name, $idx = null) + { + return $this->find($name, $idx); + } + + function parentNode() + { + return $this->parent(); + } + + function childNodes($idx = -1) + { + return $this->children($idx); + } + + function firstChild() + { + return $this->first_child(); + } + + function lastChild() + { + return $this->last_child(); + } + + function nextSibling() + { + return $this->next_sibling(); + } + + function previousSibling() + { + return $this->prev_sibling(); + } + + function hasChildNodes() + { + return $this->has_child(); + } + + function nodeName() + { + return $this->tag; + } + + function appendChild($node) + { + $node->parent($this); + return $node; + } + +} + +/** + * simple html dom parser + * + * Paperg - in the find routine: allow us to specify that we want case + * insensitive testing of the value of the selector. + * + * Paperg - change $size from protected to public so we can easily access it + * + * Paperg - added ForceTagsClosed in the constructor which tells us whether we + * trust the html or not. Default is to NOT trust it. + * + * @package PlaceLocalInclude + */ +class simple_html_dom +{ + /** + * The root node of the document + * + * @var object + */ + public $root = null; + + /** + * List of nodes in the current DOM + * + * @var array + */ + public $nodes = array(); + + /** + * Callback function to run for each element in the DOM. + * + * @var callable|null + */ + public $callback = null; + + /** + * Indicates how tags and attributes are matched + * + * @var bool When set to **true** tags and attributes will be converted to + * lowercase before matching. + */ + public $lowercase = false; + + /** + * Original document size + * + * Holds the original document size. + * + * @var int + */ + public $original_size; + + /** + * Current document size + * + * Holds the current document size. The document size is determined by the + * string length of ({@see simple_html_dom::$doc}). + * + * _Note_: Using this variable is more efficient than calling `strlen($doc)` + * + * @var int + * */ + public $size; + + /** + * Current position in the document + * + * @var int + */ + protected $pos; + + /** + * The document + * + * @var string + */ + protected $doc; + + /** + * Current character + * + * Holds the current character at position {@see simple_html_dom::$pos} in + * the document {@see simple_html_dom::$doc} + * + * _Note_: Using this variable is more efficient than calling + * `substr($doc, $pos, 1)` + * + * @var string + */ + protected $char; + + protected $cursor; + + /** + * Parent node of the next node detected by the parser + * + * @var object + */ + protected $parent; + protected $noise = array(); + + /** + * Tokens considered blank in HTML + * + * @var string + */ + protected $token_blank = " \t\r\n"; + + /** + * Tokens to identify the equal sign for attributes, stopping either at the + * closing tag ("/" i.e. "") or the end of an opening tag (">" i.e. + * "") + * + * @var string + */ + protected $token_equal = ' =/>'; + + /** + * Tokens to identify the end of a tag name. A tag name either ends on the + * ending slash ("/" i.e. "") or whitespace ("\s\r\n\t") + * + * @var string + */ + protected $token_slash = " />\r\n\t"; + + /** + * Tokens to identify the end of an attribute + * + * @var string + */ + protected $token_attr = ' >'; + + // Note that this is referenced by a child node, and so it needs to be + // public for that node to see this information. + public $_charset = ''; + public $_target_charset = ''; + + /** + * Innertext for
elements + * + * @var string + */ + protected $default_br_text = ''; + + /** + * Suffix for elements + * + * @var string + */ + public $default_span_text = ''; + + /** + * Defines a list of self-closing tags (Void elements) according to the HTML + * Specification + * + * _Remarks_: + * - Use `isset()` instead of `in_array()` on array elements to boost + * performance about 30% + * - Sort elements by name for better readability! + * + * @link https://www.w3.org/TR/html HTML Specification + * @link https://www.w3.org/TR/html/syntax.html#void-elements Void elements + */ + protected $self_closing_tags = array( + 'area' => 1, + 'base' => 1, + 'br' => 1, + 'col' => 1, + 'embed' => 1, + 'hr' => 1, + 'img' => 1, + 'input' => 1, + 'link' => 1, + 'meta' => 1, + 'param' => 1, + 'source' => 1, + 'track' => 1, + 'wbr' => 1 + ); + + /** + * Defines a list of tags which - if closed - close all optional closing + * elements within if they haven't been closed yet. (So, an element where + * neither opening nor closing tag is omissible consistently closes every + * optional closing element within) + * + * _Remarks_: + * - Use `isset()` instead of `in_array()` on array elements to boost + * performance about 30% + * - Sort elements by name for better readability! + */ + protected $block_tags = array( + 'body' => 1, + 'div' => 1, + 'form' => 1, + 'root' => 1, + 'span' => 1, + 'table' => 1 + ); + + /** + * Defines elements whose end tag is omissible. + * + * * key = Name of an element whose end tag is omissible. + * * value = Names of elements whose end tag is omissible, that are closed + * by the current element. + * + * _Remarks_: + * - Use `isset()` instead of `in_array()` on array elements to boost + * performance about 30% + * - Sort elements by name for better readability! + * + * **Example** + * + * An `li` element’s end tag may be omitted if the `li` element is immediately + * followed by another `li` element. To do that, add following element to the + * array: + * + * ```php + * 'li' => array('li'), + * ``` + * + * With this, the following two examples are considered equal. Note that the + * second example is missing the closing tags on `li` elements. + * + * ```html + *
  • First Item
  • Second Item
+ * ``` + * + *
  • First Item
  • Second Item
+ * + * ```html + *
  • First Item
  • Second Item
+ * ``` + * + *
  • First Item
  • Second Item
+ * + * @var array A two-dimensional array where the key is the name of an + * element whose end tag is omissible and the value is an array of elements + * whose end tag is omissible, that are closed by the current element. + * + * @link https://www.w3.org/TR/html/syntax.html#optional-tags Optional tags + * + * @todo The implementation of optional closing tags doesn't work in all cases + * because it only consideres elements who close other optional closing + * tags, not taking into account that some (non-blocking) tags should close + * these optional closing tags. For example, the end tag for "p" is omissible + * and can be closed by an "address" element, whose end tag is NOT omissible. + * Currently a "p" element without closing tag stops at the next "p" element + * or blocking tag, even if it contains other elements. + * + * @todo Known sourceforge issue #2977341 + * B tags that are not closed cause us to return everything to the end of + * the document. + */ + protected $optional_closing_tags = array( + // Not optional, see + // https://www.w3.org/TR/html/textlevel-semantics.html#the-b-element + 'b' => array('b' => 1), + 'dd' => array('dd' => 1, 'dt' => 1), + // Not optional, see + // https://www.w3.org/TR/html/grouping-content.html#the-dl-element + 'dl' => array('dd' => 1, 'dt' => 1), + 'dt' => array('dd' => 1, 'dt' => 1), + 'li' => array('li' => 1), + 'optgroup' => array('optgroup' => 1, 'option' => 1), + 'option' => array('optgroup' => 1, 'option' => 1), + 'p' => array('p' => 1), + 'rp' => array('rp' => 1, 'rt' => 1), + 'rt' => array('rp' => 1, 'rt' => 1), + 'td' => array('td' => 1, 'th' => 1), + 'th' => array('td' => 1, 'th' => 1), + 'tr' => array('td' => 1, 'th' => 1, 'tr' => 1), + ); + + function __construct( + $str = null, + $lowercase = true, + $forceTagsClosed = true, + $target_charset = DEFAULT_TARGET_CHARSET, + $stripRN = true, + $defaultBRText = DEFAULT_BR_TEXT, + $defaultSpanText = DEFAULT_SPAN_TEXT, + $options = 0) + { + if ($str) { + if (preg_match('/^http:\/\//i', $str) || is_file($str)) { + $this->load_file($str); + } else { + $this->load( + $str, + $lowercase, + $stripRN, + $defaultBRText, + $defaultSpanText, + $options + ); + } + } + // Forcing tags to be closed implies that we don't trust the html, but + // it can lead to parsing errors if we SHOULD trust the html. + if (!$forceTagsClosed) { + $this->optional_closing_array = array(); + } + + $this->_target_charset = $target_charset; + } + + function __destruct() + { + $this->clear(); + } + + // load html from string + function load( + $str, + $lowercase = true, + $stripRN = true, + $defaultBRText = DEFAULT_BR_TEXT, + $defaultSpanText = DEFAULT_SPAN_TEXT, + $options = 0) + { + global $debug_object; + + // prepare + $this->prepare($str, $lowercase, $defaultBRText, $defaultSpanText); + + // Per sourceforge http://sourceforge.net/tracker/?func=detail&aid=2949097&group_id=218559&atid=1044037 + // Script tags removal now preceeds style tag removal. + // strip out \n"; +print '\n"; +print ''."\n"; +print ''."\n"; +print ''."\n"; +?> + + +'."\n"; +} +include ("includes/globals.php"); +?> + + + + + +
+
+ + + + + '; +print ' + + + + '; +// +print ' + + + + '; + +print ' + + + '; +?> +

'.get_int_text("albumart_title").'

'.get_int_text('label_loading').'
+
+
+
+ +
+
+
'.get_int_text("albumart_allartists").'
'; + print ''; + print ''; + do_artists_db_style(); +} +?> +
+
+
+ +'; + +print "
\n"; +print "\n"; +print '\n"; +print "\n"; +print "\n"; + +function do_artists_db_style() { + $alist = get_list_of_artists(); + foreach ($alist as $artist) { + print ''; + } +} + +function do_covers_db_style() { + global $count; + global $albums_without_cover; + $alist = get_list_of_artists(); + foreach ($alist as $artist) { + print '
'; + print '
'; + print '

'.$artist['Artistname'].'

'; + print "
\n"; + print '
'; + $blist = get_list_of_albums($artist['Artistindex']); + foreach ($blist as $album) { + print '
'; + print '
'; + $class = "clickable clickicon clickalbumcover droppable"; + $src = ""; + if ($album['Image'] && $album['Image'] !== "") { + $src = $album['Image']; + } else { + $class = $class . " notexist"; + $albums_without_cover++; + } + print ''; + print ''; + print ''; + + print '
'.$album['Albumname'].'
'; + print '
'; + print '
'; + $count++; + } + print "
\n"; + print "
\n"; + } +} + +function do_radio_stations() { + + global $count; + global $albums_without_cover; + + $playlists = get_user_radio_streams(); + if (count($playlists) > 0) { + print '
'; + print '
'; + print '

Radio Stations

'; + print "
\n"; + print '
'; + foreach ($playlists as $file) { + print '
'; + print '
'; + $class = ""; + $src = ""; + if ($file['Image']) { + $src = $file['Image']; + } else { + $class = " notexist"; + $albums_without_cover++; + } + print ''; + print ''; + print ''; + $albumimage = new baseAlbumImage(array('artist' => 'STREAM', 'album' => $file['StationName'])); + print ''; + print '
'.htmlentities($file['StationName']).'
'; + print '
'; + print '
'; + $count++; + } + print "
\n"; + print "
\n"; + } +} + +function do_playlists() { + + global $count; + global $albums_without_cover; + global $PLAYER_TYPE; + logger::log("PLAYLISTART", "Player type is", $PLAYER_TYPE); + $player = new $PLAYER_TYPE(); + + $playlists = $player->get_stored_playlists(false); + if (!is_array($playlists)) { + $playlists = array(); + } + $plfiles = glob('prefs/userplaylists/*'); + foreach ($plfiles as $f) { + $playlists[] = basename($f); + } + print '
'; + print '
'; + print '

Saved Playlists

'; + print "
\n"; + print '
'; + sort($playlists, SORT_STRING); + foreach ($playlists as $pl) { + logger::log("PLAYLISTART", "Playlist",$pl); + print '
'; + print '
'; + $class = ""; + $albumimage = new baseAlbumImage(array('artist' => 'PLAYLIST', 'album' => $pl)); + $src = $albumimage->get_image_if_exists(); + if ($src === null) { + $class = " plimage notfound"; + $src = ''; + $albums_without_cover++; + } + $plsearch = preg_replace('/ \(by .*?\)$/', '', $pl); + print ''; + print ''; + print ''; + print ''; + print '
'.htmlentities($pl).'
'; + print '
'; + print '
'; + $count++; + } + print "
\n"; + print "
\n"; + +} + +?> diff --git a/www/rompr/albums.php b/www/rompr/albums.php new file mode 100644 index 0000000..ea85401 --- /dev/null +++ b/www/rompr/albums.php @@ -0,0 +1,331 @@ + /dev/null +// where currenthost is the name of one of the Players defined in the Configuration menu +// and player_backend MUST be mpd or mopidy, depending on what your player is. +// You can also use eg -b "debug_enabled=8;currenthost=MPD;player_backend=mpd" +// to get more debug info in the webserver error log. + +require_once ("includes/vars.php"); +require_once ("includes/functions.php"); +require_once ("utils/imagefunctions.php"); +require_once ("international.php"); +require_once ("backends/sql/backend.php"); +$error = 0; + +logger::trace("TIMINGS", "======================================================================"); +$initmem = memory_get_usage(); +logger::trace("COLLECTION", "Memory Used is ".$initmem); +$now2 = time(); + +switch (true) { + + case array_key_exists('item', $_REQUEST): + logit('item'); + // Populate a dropdown in the collection or search results + dumpAlbums($_REQUEST['item']); + break; + + case array_key_exists('mpdsearch', $_REQUEST): + logit('mpdsearch'); + // Handle an mpd-style search request + require_once ("player/".$prefs['player_backend']."/player.php"); + require_once ("collection/collection.php"); + $trackbytrack = true; + $doing_search = true; + mpd_search(); + break; + + case array_key_exists('browsealbum', $_REQUEST): + logit('browsealbum'); + // Populate a spotify album in mopidy's search results - as spotify doesn't return all tracks + require_once ("player/".$prefs['player_backend']."/player.php"); + require_once ("collection/collection.php"); + $trackbytrack = true; + $doing_search = true; + browse_album(); + break; + + case array_key_exists("rawterms", $_REQUEST): + logit('rawterms'); + // Handle an mpd-style search request requiring tl_track format results + // Note that raw_search uses the collection models but not the database + // hence $trackbytrack must be false + logger::log("MPD SEARCH", "Doing RAW search"); + require_once ("player/".$prefs['player_backend']."/player.php"); + require_once ("collection/collection.php"); + require_once ("collection/dbsearch.php"); + $doing_search = true; + raw_search(); + break; + + case array_key_exists('terms', $_REQUEST): + logit('terms'); + // SQL database search request + require_once ("player/".$prefs['player_backend']."/player.php"); + require_once ("collection/collection.php"); + require_once ("collection/dbsearch.php"); + $doing_search = true; + database_search(); + break; + + case array_key_exists('rebuild', $_REQUEST): + logit('rebuild'); + // This is a request to rebuild the music collection + require_once ("player/".$prefs['player_backend']."/player.php"); + require_once ("collection/collection.php"); + $trackbytrack = true; + update_collection(); + break; + + default: + logger::fail("ALBUMS", "Couldn't figure out what to do!"); + break; + +} + +logger::trace("TIMINGS", "== Collection Update And Send took ".format_time(time() - $now2)); +$peakmem = memory_get_peak_usage(); +$ourmem = $peakmem - $initmem; +logger::trace("TIMINGS", "Peak Memory Used Was ".number_format($peakmem)." bytes - meaning we used ".number_format($ourmem)." bytes."); +logger::trace("TIMINGS", "======================================================================"); + +function logit($key) { + logger::log("COLLECTION", "Request is",$key,"=",$_REQUEST[$key]); +} + +function checkDomains($d) { + if (array_key_exists('domains', $d)) { + return $d['domains']; + } + logger::debug("SEARCH", "No search domains in use"); + return false; +} + +function mpd_search() { + global $dbterms, $skin, $PLAYER_TYPE; + // If we're searching for tags or ratings it would seem sensible to only search the database + // HOWEVER - we could be searching for genre or performer or composer - which will not match in the database + // For those cases ONLY, controller.js will call into this instead of database_search, and we set $dbterms + // to make the collection check everything it finds against the database + $cmd = $_REQUEST['command']; + $domains = checkDomains($_REQUEST); + foreach ($_REQUEST['mpdsearch'] as $key => $term) { + switch ($key) { + case 'tag': + case 'rating': + $dbterms[$key] = $term; + break; + + case 'any': + // This makes a search term of 'Madness My Girl' into + // search any Madness any My any Girl + // which seems to produce better results with Spotify. But probably doesn't with Google Play, which + // only uses the first term. Soundcloud concatenates them all back into one term again. What does MPD do? + foreach ($term as $t) { + $terms = explode(' ',$t); + foreach ($terms as $tom) { + $cmd .= " ".$key.' "'.format_for_mpd(html_entity_decode(trim($tom))).'"'; + } + } + break; + + default: + foreach ($term as $t) { + $cmd .= " ".$key.' "'.format_for_mpd(html_entity_decode(trim($t))).'"'; + } + break; + + } + } + logger::log("MPD SEARCH", "Search command : ".$cmd); + if ($_REQUEST['resultstype'] == "tree") { + require_once ("player/mpd/filetree.php"); + require_once ("skins/".$skin."/ui_elements.php"); + $player = new fileCollector(); + $player->doFileSearch($cmd, $domains); + } else { + cleanSearchTables(); + prepareCollectionUpdate(); + $collection = new musicCollection(); + $player = new $PLAYER_TYPE(); + $player->populate_collection($cmd, $domains, $collection); + $collection->tracks_to_database(); + close_transaction(); + dumpAlbums($_REQUEST['dump']); + remove_findtracks(); + } +} + +function browse_album() { + global $PLAYER_TYPE, $skin; + $a = preg_match('/(a|b)(.*?)(\d+|root)/', $_REQUEST['browsealbum'], $matches); + if (!$a) { + print '

'.get_int_text("label_general_error").'

'; + logger::error("DUMPALBUMS", "Browse Album Failed - regexp failed to match", $_REQUEST['browsealbum']); + return false; + } + $why = $matches[1]; + $what = $matches[2]; + $who = $matches[3]; + $albumlink = get_albumlink($who); + if (substr($albumlink, 0, 8) == 'podcast+') { + require_once ('includes/podcastfunctions.php'); + logger::log("ALBUMS", "Browsing For Podcast ".substr($albumlink, 9)); + $podid = getNewPodcast(substr($albumlink, 8), 0, false); + logger::trace("ALBUMS", "Ouputting Podcast ID ".$podid); + outputPodcast($podid, false); + } else { + if (preg_match('/^.+?:artist:/', $albumlink)) { + remove_album_from_database($who); + } + $player = new $PLAYER_TYPE(); + $collection = new musicCollection(); + $cmd = 'find file "'.$albumlink.'"'; + logger::log("MPD", "Doing Album Browse : ".$cmd); + prepareCollectionUpdate(); + $player->populate_collection($cmd, false, $collection); + $collection->tracks_to_database(true); + close_transaction(); + remove_findtracks(); + if (preg_match('/^.+?:album:/', $albumlink)) { + // Just occasionally, the spotify album originally returned by search has an incorrect AlbumArtist + // When we browse the album the new tracks therefore get added to a new album, while the original tracks + // remain attached to the old one. This is where we use do_tracks_from_database with an array of albumids + // which joins them together into a virtual album, with the track ordering correct + print do_tracks_from_database($why, $what, find_justadded_albums(), true); + } else { + $artistarray = find_justadded_artists(); + $do_controlheader = true; + foreach ($artistarray as $artistid) { + do_albums_from_database($why, 'album', $artistid, false, false, true, $do_controlheader); + $do_controlheader = false; + } + } + } +} + +function raw_search() { + global $PLAYER_TYPE, $doing_search; + $domains = checkDomains($_REQUEST); + $collection = new musicCollection(); + $found = 0; + logger::trace("MPD SEARCH", "checkdb is ".$_REQUEST['checkdb']); + if ($_REQUEST['checkdb'] !== 'false') { + logger::trace("MPD SEARCH", " ... checking database first "); + $found = doDbCollection($_REQUEST['rawterms'], $domains, "RAW", $collection); + if ($found > 0) { + logger::log("MPD SEARCH", " ... found ".$found." matches in database"); + } + } + if ($found == 0) { + $cmd = $_REQUEST['command']; + foreach ($_REQUEST['rawterms'] as $key => $term) { + $cmd .= " ".$key.' "'.format_for_mpd(html_entity_decode($term[0])).'"'; + } + logger::log("MPD SEARCH", "Search command : ".$cmd); + $doing_search = true; + $player = new $PLAYER_TYPE(); + $player->populate_collection($cmd, $domains, $collection); + + // For backends that don't support multiple parameters (Google Play) + // This'll return nothing for Spotify, so it's OK. It might help SoundCloud too. + + $cmd = $_REQUEST['command'].' any '; + $parms = array(); + if (array_key_exists('artist', $_REQUEST['rawterms'])) { + $parms[] = format_for_mpd(html_entity_decode($_REQUEST['rawterms']['artist'][0])); + } + if (array_key_exists('title', $_REQUEST['rawterms'])) { + $parms[] = format_for_mpd(html_entity_decode($_REQUEST['rawterms']['title'][0])); + } + if (count($parms) > 0) { + $cmd .= '"'.implode(' ',$parms).'"'; + logger::log("MPD SEARCH", "Search command : ".$cmd); + $doing_search = true; + $collection->filter_duplicate_tracks(); + $player->populate_collection($cmd, $domains, $collection); + } + + } + print json_encode($collection->tracks_as_array()); +} + +function database_search() { + $tree = null; + $domains = checkDomains($_REQUEST); + if ($_REQUEST['resultstype'] == "tree") { + $tree = new mpdlistthing(null); + } else { + cleanSearchTables(); + open_transaction(); + } + $fcount = doDbCollection($_REQUEST['terms'], $domains, $_REQUEST['resultstype'], $tree); + if ($_REQUEST['resultstype'] == "tree") { + printFileSearch($tree, $fcount); + } else { + close_transaction(); + dumpAlbums($_REQUEST['dump']); + } +} + +function update_collection() { + global $PLAYER_TYPE; + + // Check that an update is not currently in progress + // and create the update lock if not + if (collectionUpdateRunning()) { + header('HTTP/1.1 500 Internal Server Error'); + print get_int_text('error_nocol'); + exit(0); + } + + if (file_exists('prefs/monitor')) { + unlink('prefs/monitor'); + } + // Send some dummy data back to the browser, then close the connection + // so that the browser doesn't time out and retry + $sapi_type = php_sapi_name(); + logger::log('COLLECTION','SAPI Name is',$sapi_type); + if (preg_match('/fpm/', $sapi_type) || preg_match('/fcgi/', $sapi_type)) { + logger::mark('COLLECTION', 'Closing Request The FastCGI Way'); + print(''); + fastcgi_finish_request(); + } else { + logger::mark('COLLECTION', 'Closing Request The Apache Way'); + ob_end_clean(); + ignore_user_abort(true); // just to be safe + ob_start(); + print(''); + $size = ob_get_length(); + header("Content-Length: $size"); + header("Content-Encoding: none"); + header("Connection: close"); + ob_end_flush(); + ob_flush(); + flush(); + if (ob_get_contents()) { + ob_end_clean(); + } + } + + if (session_id()) { + session_write_close(); + } + + // Browser is now happy. Now we can do our work in peace. + cleanSearchTables(); + prepareCollectionUpdate(); + $player = new $PLAYER_TYPE(); + $player->musicCollectionUpdate(); + tidy_database(); + remove_findtracks(); + // Add a marker to the monitor file to say we've finished + $player->collectionUpdateDone(); + // Clear the update lock + clearUpdateLock(); + +} + +?> diff --git a/www/rompr/backends/sql/backend.php b/www/rompr/backends/sql/backend.php new file mode 100644 index 0000000..f3ddf1d --- /dev/null +++ b/www/rompr/backends/sql/backend.php @@ -0,0 +1,1953 @@ + 4, + 'Rating' => 0, + 'Tags' => array() +); + +// So what are Hidden tracks? +// These are used to count plays from online sources when those tracks are not in the collection. +// Doing this does increase the size of the database. Quite a lot. But without it the stats for charts +// and fave artists etc don't make a lot of sense in a world where a proportion of your listening +// is in response to searches of Spotify or youtube etc. + +// Wishlist items have Uri as NULL. Each wishlist track is in a distinct album - this makes stuff +// easier for the wishlist viewer + +// Assumptions are made in the code that Wishlist items will not be hidden tracks and that hidden +// tracks have no metadata apart from a Playcount. Always be aware of this. + +// For tracks, LastModified controls whether a collection update will update any of its data. +// Tracks added by hand (by tagging or rating, via userRatings.php) must have LastModified as NULL +// - this is how we prevent the collection update from removing them. + +// Search: +// Tracktable.isSearchResult is set to: +// 1 on any existing track that comes up in the search +// 2 for any track that comes up the search and has to be added - i.e it's not part of the main collection. +// 3 for any hidden track that comes up in search so it can be re-hidden later. +// Note that there is arithmetical logic to the values used here, they're not arbitrary flags + +// Collection: +// justAdded is automatically set to 1 for any track that has just been added +// when updating the collection we set them all to 0 and then set to 1 on any existing track we find, +// then we can easily remove old tracks. + +function create_new_track(&$data) { + + // create_new_track + // Creates a new track, along with artists and album if necessary + // Returns: TTindex + + global $mysqlc; + + if ($data['albumai'] == null) { + // Does the albumartist exist? + $data['albumai'] = check_artist($data['albumartist']); + } + + // Does the track artist exist? + if ($data['trackai'] == null) { + if ($data['artist'] != $data['albumartist']) { + $data['trackai'] = check_artist($data['artist']); + } else { + $data['trackai'] = $data['albumai']; + } + } + + if ($data['albumai'] == null || $data['trackai'] == null) { + logger::fail("MYSQL", "Trying to create new track but failed to get an artist index"); + return null; + } + + if ($data['albumindex'] == null) { + // Does the album exist? + if ($data['album'] == null) { + $data['album'] = 'rompr_wishlist_'.microtime('true'); + } + $data['albumindex'] = check_album($data); + if ($data['albumindex'] == null) { + logger::fail("MYSQL", "Trying to create new track but failed to get an album index"); + return null; + } + } + + $data['sourceindex'] = null; + if ($data['uri'] === null && array_key_exists('streamuri', $data) && $data['streamuri'] !== null) { + $data['sourceindex'] = check_radio_source($data); + } + + if (sql_prepare_query(true, null, null, null, + "INSERT INTO + Tracktable + (Title, Albumindex, Trackno, Duration, Artistindex, Disc, Uri, LastModified, Hidden, isSearchResult, Sourceindex, isAudiobook) + VALUES + (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", + $data['title'], $data['albumindex'], $data['trackno'], $data['duration'], $data['trackai'], + $data['disc'], $data['uri'], $data['lastmodified'], $data['hidden'], $data['searchflag'], $data['sourceindex'], $data['isaudiobook'])) + { + return $mysqlc->lastInsertId(); + } + return null; +} + +function check_radio_source($data) { + global $mysqlc; + $index = simple_query('Sourceindex', 'WishlistSourcetable', 'SourceUri', $data['streamuri'], null); + if ($index === null) { + logger::log("SQL", "Creating Wishlist Source",$data['streamname']); + if (sql_prepare_query(true, null, null, null, + "INSERT INTO WishlistSourcetable (SourceName, SourceImage, SourceUri) VALUES (?, ?, ?)", + $data['streamname'], $data['streamimage'], $data['streamuri'])) + { + $index = $mysqlc->lastInsertId(); + } + } + return $index; +} + +function check_artist($artist) { + + // check_artist: + // Checks for the existence of an artist by name in the Artisttable and creates it if necessary + // Returns: Artistindex + + $index = sql_prepare_query(false, null, 'Artistindex', null, "SELECT Artistindex FROM Artisttable WHERE LOWER(Artistname) = LOWER(?)", $artist); + if ($index === null) { + $index = create_new_artist($artist); + } + return $index; +} + +function create_new_artist($artist) { + + // create_new_artist + // Creates a new artist + // Returns: Artistindex + + global $mysqlc; + $retval = null; + if (sql_prepare_query(true, null, null, null, "INSERT INTO Artisttable (Artistname) VALUES (?)", $artist)) { + $retval = $mysqlc->lastInsertId(); + logger::trace("MYSQL", "Created artist",$artist,"with Artistindex",$retval); + } + return $retval; +} + +function best_value($a, $b) { + + // best_value + // Used by check_album to determine the best value to use when updating album details + // Returns: value + + if ($b == null || $b == "") { + return $a; + } else { + return $b; + } +} + +function check_album(&$data) { + + // check_album: + // Checks for the existence of an album and creates it if necessary + // Returns: Albumindex + + global $prefs, $trackbytrack, $doing_search; + $index = null; + $year = null; + $img = null; + $mbid = null; + $result = sql_prepare_query(false, PDO::FETCH_OBJ, null, null, + "SELECT + Albumindex, + Year, + Image, + AlbumUri, + mbid + FROM + Albumtable + WHERE + LOWER(Albumname) = LOWER(?) + AND AlbumArtistindex = ? + AND Domain = ?", $data['album'], $data['albumai'], $data['domain']); + $obj = array_shift($result); + + if ($prefs['preferlocalfiles'] && $trackbytrack && !$doing_search && $data['domain'] == 'local' && !$obj) { + // Does the album exist on a different, non-local, domain? The checks above ensure we only do this + // during a collection update + $result = sql_prepare_query(false, PDO::FETCH_OBJ, null, null, + "SELECT + Albumindex, + Year, + Image, + AlbumUri, + mbid, + Domain + FROM + Albumtable + WHERE + LOWER(Albumname) = LOWER(?) + AND AlbumArtistindex = ?", $data['album'], $data['albumai']); + $obj = array_shift($result); + if ($obj) { + logger::log("MYSQL", "Album ".$data['album']." was found on domain ".$obj->Domain.". Changing to local"); + $index = $obj->Albumindex; + if (sql_prepare_query(true, null, null, null, "UPDATE Albumtable SET AlbumUri=NULL, Domain=?, justUpdated=? WHERE Albumindex=?", 'local', 1, $index)) { + $obj->AlbumUri = null; + logger::debug("MYSQL", " ...Success"); + } else { + logger::fail("MYSQL", " Album ".$data['album']." update FAILED"); + return false; + } + } + } + + if ($obj) { + $index = $obj->Albumindex; + $year = best_value($obj->Year, $data['date']); + $img = best_value($obj->Image, $data['image']); + $uri = best_value($obj->AlbumUri, $data['albumuri']); + $mbid = best_value($obj->mbid, $data['ambid']); + if ($year != $obj->Year || $img != $obj->Image || $uri != $obj->AlbumUri || $mbid != $obj->mbid) { + + if ($prefs['debug_enabled'] > 6) { + logger::log("BACKEND", "Updating Details For Album ".$data['album']." (index ".$index.")" ); + logger::log("BACKEND", " Old Date : ".$obj->Year); + logger::log("BACKEND", " New Date : ".$year); + logger::log("BACKEND", " Old Image : ".$obj->Image); + logger::log("BACKEND", " New Image : ".$img); + logger::log("BACKEND", " Old Uri : ".$obj->AlbumUri); + logger::log("BACKEND", " New Uri : ".$uri); + logger::log("BACKEND", " Old MBID : ".$obj->mbid); + logger::log("BACKEND", " New MBID : ".$mbid); + } + + if (sql_prepare_query(true, null, null, null, "UPDATE Albumtable SET Year=?, Image=?, AlbumUri=?, mbid=?, justUpdated=1 WHERE Albumindex=?",$year, $img, $uri, $mbid, $index)) { + logger::debug("BACKEND", " ...Success"); + } else { + logger::fail("BACKEND", " Album ".$data['album']." update FAILED"); + return false; + } + } + } else { + $index = create_new_album($data); + } + return $index; +} + +function create_new_album($data) { + + // create_new_album + // Creates an album + // Returns: Albumindex + + global $mysqlc; + $retval = null; + $im = array( + 'searched' => $data['image'] ? 1: 0, + 'image' => $data['image'] + ); + if (sql_prepare_query(true, null, null, null, + "INSERT INTO + Albumtable + (Albumname, AlbumArtistindex, AlbumUri, Year, Searched, ImgKey, mbid, Domain, Image) + VALUES + (?, ?, ?, ?, ?, ?, ?, ?, ?)", + $data['album'], $data['albumai'], $data['albumuri'], $data['date'], $im['searched'], $data['imagekey'], $data['ambid'], $data['domain'], $im['image'])) { + $retval = $mysqlc->lastInsertId(); + logger::log("BACKEND", "Created Album ".$data['album']." with Albumindex ".$retval); + } + return $retval; +} + +function remove_ttid($ttid) { + + // Remove a track from the database. + // Doesn't do any cleaning up - call remove_cruft afterwards to remove orphaned artists and albums + + // Deleting tracks will delete their associated playcounts. While it might seem like a good idea + // to hide them instead, in fact this results in a situation where we have tracks in our database + // that no longer exist in physical form - eg if local tracks are removed. This is really bad if we then + // later play those tracks from an online source and rate them. romprmetadata::find_item will return the hidden local track, + // which will get rated and appear back in the collection. So now we have an unplayable track in our collection. + // There's no real way round it, (without creating some godwaful lookup table of backends it's safe to do this with) + // so we just delete the track and lose the playcount information. + + // If it's a search result, it must be a manually added track (we can't delete collection tracks) + // and we might still need it in the search, so set it to a 2 instead of deleting it. + + logger::log("BACKEND", "Removing track ".$ttid); + $result = false; + if (generic_sql_query("DELETE FROM Tracktable WHERE isSearchResult != 1 AND TTindex = '".$ttid."'",true)) { + if (generic_sql_query("UPDATE Tracktable SET isSearchResult = 2 WHERE isSearchResult = 1 AND TTindex = '".$ttid."'", true)) { + $result = true;; + } + } + return $result; +} + +function list_tags() { + + // list_tags + // Return a sorted lst of tag names. Used by the UI for creating the tag menu + + $tags = array(); + $result = generic_sql_query("SELECT Name FROM Tagtable ORDER BY LOWER(Name)"); + foreach ($result as $r) { + $tags[] = $r['Name']; + } + return $tags; +} + +function get_rating_headers($sortby) { + + $ratings = array(); + + switch ($sortby) { + + case 'Rating': + $ratings = generic_sql_query("SELECT Rating AS Name, COUNT(TTindex) AS NumTracks FROM Ratingtable GROUP BY Rating ORDER BY Rating"); + break; + + case 'Tag': + $ratings = generic_sql_query('SELECT Name, COUNT(TTindex) AS NumTracks FROM Tagtable JOIN TagListtable USING (Tagindex) GROUP BY Name ORDER BY Name'); + break; + + case 'AlbumArtist': + // It's actually Track Artist, but sod changing it now. + $qstring = "SELECT DISTINCT Artistname AS Name, COUNT(DISTINCT TTindex) AS NumTracks + FROM + Artisttable AS a JOIN Tracktable AS tt USING (Artistindex) + LEFT JOIN Ratingtable USING (TTindex) + LEFT JOIN `TagListtable` USING (TTindex) + LEFT JOIN Tagtable AS t USING (Tagindex) + WHERE Hidden = 0 AND isSearchResult < 2 AND (Rating IS NOT NULL OR t.Name IS NOT NULL) + GROUP BY Artistname + ORDER BY "; + $qstring .= sort_artists_by_name(); + $ratings = generic_sql_query($qstring); + break; + + case 'Tags': + $ratings = generic_sql_query("SELECT DISTINCT ".SQL_TAG_CONCAT." AS Name, 0 AS NumTracks FROM + (SELECT Tagindex, TTindex FROM TagListtable ORDER BY Tagindex) AS tagorder + JOIN Tagtable AS t USING (Tagindex) + GROUP BY TTindex + ORDER By Name"); + break; + + default: + $ratings = array('INTERNAL ERROR!'); + break; + + } + + return $ratings; +} + +function sortletter_mangler() { + global $prefs; + $qstring = ''; + if (count($prefs['nosortprefixes']) > 0) { + $qstring .= "CASE "; + foreach($prefs['nosortprefixes'] AS $p) { + $phpisshitsometimes = strlen($p)+2; + $qstring .= "WHEN LOWER(a.Artistname) LIKE '".strtolower($p). + " %' THEN UPPER(SUBSTR(a.Artistname,".$phpisshitsometimes.",1)) "; + } + $qstring .= "ELSE UPPER(SUBSTR(a.Artistname,1,1)) END AS SortLetter"; + } else { + $qstring .= "UPPER(SUBSTR(a.Artistname,1,1)) AS SortLetter"; + } + return $qstring; +} + +function get_rating_info($sortby, $value) { + + global $prefs; + + // Tuned SQL queries for each type, for speed, otherwise it's unuseable + + switch ($sortby) { + case 'Rating': + $qstring = "SELECT + r.Rating AS Rating, + IFNULL(".SQL_TAG_CONCAT.", 'No Tags') AS Tags, + tr.TTindex, + tr.TrackNo, + tr.Title, + tr.Duration, + tr.Uri, + a.Artistname, + aa.Artistname AS AlbumArtist, + al.Albumname, + al.Image, "; + $qstring .= sortletter_mangler(); + + $qstring .= " FROM + Ratingtable AS r + JOIN Tracktable AS tr ON tr.TTindex = r.TTindex + LEFT JOIN TagListtable AS tl ON tr.TTindex = tl.TTindex + LEFT JOIN Tagtable AS t USING (Tagindex) + JOIN Albumtable AS al USING (Albumindex) + JOIN Artisttable AS a ON (tr.Artistindex = a.Artistindex) + JOIN Artisttable AS aa ON (al.AlbumArtistindex = aa.Artistindex) + WHERE r.Rating = ".$value." AND tr.isSearchResult < 2 AND tr.Uri IS NOT NULL"; + break; + + case 'Tag': + $qstring = "SELECT + IFNULL(r.Rating, 0) AS Rating, + IFNULL(".SQL_TAG_CONCAT.", 'No Tags') AS Tags, + tr.TTindex, + tr.TrackNo, + tr.Title, + tr.Duration, + tr.Uri, + a.Artistname, + aa.Artistname AS AlbumArtist, + al.Albumname, + al.Image, "; + $qstring .= sortletter_mangler(); + + $qstring .= " FROM + Tracktable AS tr + LEFT JOIN Ratingtable AS r ON tr.TTindex = r.TTindex + LEFT JOIN TagListtable AS tl ON tr.TTindex = tl.TTindex + LEFT JOIN Tagtable AS t USING (Tagindex) + JOIN Albumtable AS al USING (Albumindex) + JOIN Artisttable AS a ON (tr.Artistindex = a.Artistindex) + JOIN Artisttable AS aa ON (al.AlbumArtistindex = aa.Artistindex) + WHERE tr.isSearchResult < 2 AND tr.Uri IS NOT NULL AND tr.TTindex IN (SELECT TTindex FROM TagListtable JOIN Tagtable USING (Tagindex) WHERE Name = '".$value."')"; + break; + + case 'AlbumArtist': + // It's actually Track Artist, but sod changing it now. + $qstring = "SELECT + IFNULL(r.Rating, 0) AS Rating, + IFNULL(".SQL_TAG_CONCAT.", 'No Tags') AS Tags, + tr.TTindex, + tr.TrackNo, + tr.Title, + tr.Duration, + tr.Uri, + a.Artistname, + aa.Artistname AS AlbumArtist, + al.Albumname, + al.Image "; + + $qstring .= " FROM + Tracktable AS tr + LEFT JOIN Ratingtable AS r ON tr.TTindex = r.TTindex + LEFT JOIN TagListtable AS tl ON tr.TTindex = tl.TTindex + LEFT JOIN Tagtable AS t USING (Tagindex) + JOIN Albumtable AS al USING (Albumindex) + JOIN Artisttable AS a ON (tr.Artistindex = a.Artistindex) + JOIN Artisttable AS aa ON (al.AlbumArtistindex = aa.Artistindex) + WHERE (r.Rating IS NOT NULL OR t.Name IS NOT NULL) AND tr.Uri IS NOT NULL AND tr.isSearchResult < 2 AND a.Artistname = '".$value."'"; + break; + + case 'Tags': + $qstring = "SELECT + IFNULL(r.Rating, 0) AS Rating, + ".SQL_TAG_CONCAT." AS Tags, + tr.TTindex, + tr.TrackNo, + tr.Title, + tr.Duration, + tr.Uri, + a.Artistname, + aa.Artistname AS AlbumArtist, + al.Albumname, + COUNT(tr.TTindex) AS count, + al.Image, "; + $qstring .= sortletter_mangler(); + + $qstring .= " FROM + TagListtable AS tl + JOIN Tracktable AS tr USING (TTindex) + JOIN Tagtable AS t USING (Tagindex) + LEFT JOIN Ratingtable AS r ON tr.TTindex = r.TTindex + JOIN Albumtable AS al USING (Albumindex) + JOIN Artisttable AS a ON (tr.Artistindex = a.Artistindex) + JOIN Artisttable AS aa ON (al.AlbumArtistindex = aa.Artistindex) + WHERE "; + $tags = explode(', ',$value); + foreach ($tags as $i => $t) { + $tags[$i] = "tr.TTindex IN (SELECT TTindex FROM TagListtable JOIN Tagtable USING (Tagindex) WHERE Name='".$t."')"; + } + $qstring .= implode(' AND ', $tags); + $qstring .= " AND tr.isSearchResult < 2 AND tr.Uri IS NOT NULL"; + break; + } + + $qstring .= " GROUP BY tr.TTindex ORDER BY "; + $qstring .= sort_artists_by_name(); + $qstring .= ", al.Albumname, tr.TrackNo"; + + $t = microtime(true); + $ratings = generic_sql_query($qstring); + $took = microtime(true) - $t; + logger::debug("TIMINGS", " :: Getting rating data took ".$took." seconds"); + // Our query for Tags (Tag List) will get eg if we're looking for 'tag1' it'll get tracks with 'tag1' and 'tag2' + // So we check how many tags there are in each result and only use the ones that match the number of tags we're looking for + if ($sortby == 'Tags') { + $temp = array(); + $c = count($tags); + foreach ($ratings as $rat) { + if ($rat['count'] == $c) { + $temp[] = $rat; + } + } + $ratings = $temp; + } + + return $ratings; + +} + +function clear_wishlist() { + return generic_sql_query("DELETE FROM Tracktable WHERE Uri IS NULL", true); +} + +function num_collection_tracks($albumindex) { + // Returns the number of tracks this album contains that were added by a collection update + // (i.e. not added manually). We do this because editing year or album artist for those albums + // won't hold across a collection update, so we just forbid it. + return generic_sql_query("SELECT COUNT(TTindex) AS cnt FROM Tracktable WHERE Albumindex = ".$albumindex." AND LastModified IS NOT NULL AND Hidden = 0 AND Uri IS NOT NULL AND isSearchResult < 2", false, null, 'cnt', 0); + +} + +function get_all_data($ttid) { + + // Misleadingly named function which should be used to get ratings and tags + // (and whatever else we might add) based on a TTindex + global $nodata; + $data = $nodata; + $result = generic_sql_query("SELECT + IFNULL(r.Rating, 0) AS Rating, + IFNULL(p.Playcount, 0) AS Playcount, + ".sql_to_unixtime('p.LastPlayed')." AS LastTime, + ".sql_to_unixtime('tr.DateAdded')." AS DateAdded, + IFNULL(".SQL_TAG_CONCAT.", '') AS Tags, + tr.isSearchResult, + tr.Hidden + FROM + Tracktable AS tr + LEFT JOIN Ratingtable AS r ON tr.TTindex = r.TTindex + LEFT JOIN Playcounttable AS p ON tr.TTindex = p.TTindex + LEFT JOIN TagListtable AS tl ON tr.TTindex = tl.TTindex + LEFT JOIN Tagtable AS t USING (Tagindex) + WHERE tr.TTindex = ".$ttid." + GROUP BY tr.TTindex + ORDER BY t.Name" + ); + if (count($result) > 0) { + $data = array_shift($result); + $data['Tags'] = ($data['Tags'] == '') ? array() : explode(', ', $data['Tags']); + if ($data['LastTime'] != null && $data['LastTime'] != 0 && $data['LastTime'] != '0') { + $data['Last'] = $data['LastTime']; + } + } + return $data; +} + +// Looking up this way is hugely faster than looking up by Uri +function get_extra_track_info(&$filedata) { + $data = array();; + $result = sql_prepare_query(false, PDO::FETCH_ASSOC, null, null, + 'SELECT Uri, TTindex, Disc, Artistname AS AlbumArtist, Albumtable.Image AS "X-AlbumImage", mbid AS MUSICBRAINZ_ALBUMID, Searched, IFNULL(Playcount, 0) AS Playcount + FROM + Tracktable + JOIN Albumtable USING (Albumindex) + JOIN Artisttable ON Albumtable.AlbumArtistindex = Artisttable.Artistindex + LEFT JOIN Playcounttable USING (TTindex) + WHERE Title = ? + AND TrackNo = ? + AND Albumname = ?', + $filedata['Title'], $filedata['Track'], $filedata['Album'] + ); + foreach ($result as $tinfo) { + if ($tinfo['Uri'] == $filedata['file']) { + logger::trace("EXTRAINFO", "Found Track In Collection"); + $data = array_filter($tinfo, function($v) { + if ($v === null || $v == '') { + return false; + } + return true; + }); + break; + } + } + if (count($data) == 0) { + $result = sql_prepare_query(false, PDO::FETCH_ASSOC, null, null, + 'SELECT Albumtable.Image AS "X-AlbumImage", mbid AS MUSICBRAINZ_ALBUMID, Searched + FROM + Albumtable + JOIN Artisttable ON Albumtable.AlbumArtistindex = Artisttable.Artistindex + WHERE Albumname = ? + AND Artistname = ?', + $filedata['Album'], concatenate_artist_names($filedata['AlbumArtist']) + ); + foreach ($result as $tinfo) { + logger::trace("EXTRAINFO", "Found Album In Collection"); + $data = array_filter($tinfo, function($v) { + if ($v === null || $v == '') { + return false; + } + return true; + }); + break; + } + } + return $data; +} + +function get_imagesearch_info($key) { + + // Used by getalbumcover.php to get album and artist names etc based on an Image Key + + $retval = array('artist' => null, 'album' => null, 'mbid' => null, 'albumpath' => null, 'albumuri' => null); + $result = generic_sql_query( + "SELECT DISTINCT + Artisttable.Artistname, + Albumname, + mbid, + Albumindex, + AlbumUri, + isSearchResult + FROM + Albumtable + JOIN Artisttable ON AlbumArtistindex = Artisttable.Artistindex + JOIN Tracktable USING (Albumindex) + WHERE ImgKey = '".$key."' AND isSearchResult < 2 AND Hidden = 0", false, PDO::FETCH_OBJ + ); + // This can come back with multiple results if we have the same album on multiple backends + // So we make sure we combine the data to get the best possible set + foreach ($result as $obj) { + if ($retval['artist'] == null) { + $retval['artist'] = $obj->Artistname; + } + if ($retval['album'] == null) { + $retval['album'] = $obj->Albumname; + } + if ($retval['mbid'] == null || $retval['mbid'] == "") { + $retval['mbid'] = $obj->mbid; + } + if ($retval['albumpath'] == null) { + $retval['albumpath'] = get_album_directory($obj->Albumindex, $obj->AlbumUri); + } + if ($retval['albumuri'] == null || $retval['albumuri'] == "") { + $retval['albumuri'] = $obj->AlbumUri; + } + logger::log("GETALBUMCOVER", "Found album",$retval['album'],",in collection"); + } + + $result = generic_sql_query( + "SELECT DISTINCT + Artisttable.Artistname, + Albumname, + mbid, + Albumindex, + AlbumUri, + isSearchResult + FROM + Albumtable + JOIN Artisttable ON AlbumArtistindex = Artisttable.Artistindex + JOIN Tracktable USING (Albumindex) + WHERE ImgKey = '".$key."' AND isSearchResult > 1", false, PDO::FETCH_OBJ + ); + // This can come back with multiple results if we have the same album on multiple backends + // So we make sure we combine the data to get the best possible set + foreach ($result as $obj) { + if ($retval['artist'] == null) { + $retval['artist'] = $obj->Artistname; + } + if ($retval['album'] == null) { + $retval['album'] = $obj->Albumname; + } + if ($retval['mbid'] == null || $retval['mbid'] == "") { + $retval['mbid'] = $obj->mbid; + } + if ($retval['albumpath'] == null) { + $retval['albumpath'] = get_album_directory($obj->Albumindex, $obj->AlbumUri); + } + if ($retval['albumuri'] == null || $retval['albumuri'] == "") { + $retval['albumuri'] = $obj->AlbumUri; + } + logger::log("GETALBUMCOVER", "Found album",$retval['album'],"in search results or hidden tracks"); + } + return $retval; +} + +function get_albumlink($albumindex) { + return simple_query('AlbumUri', 'Albumtable', 'Albumindex', $albumindex, ""); +} + +function get_album_directory($albumindex, $uri) { + global $prefs; + $retval = null; + // Get album directory by using the Uri of one of its tracks, making sure we choose only local tracks + if (getDomain($uri) == 'local') { + $result = generic_sql_query("SELECT Uri FROM Tracktable WHERE Albumindex = ".$albumindex." LIMIT 1"); + foreach ($result as $obj2) { + $retval = dirname($obj2['Uri']); + $retval = preg_replace('#^local:track:#', '', $retval); + $retval = preg_replace('#^file://#', '', $retval); + $retval = preg_replace('#^beetslocal:\d+:'.$prefs['music_directory_albumart'].'/#', '', $retval); + logger::log("SQL", "Got album directory using track Uri :",$retval); + } + } + return $retval; +} + +function update_image_db($key, $found, $imagefile) { + $val = ($found) ? $imagefile : null; + if (sql_prepare_query(true, null, null, null, "UPDATE Albumtable SET Image = ?, Searched = 1 WHERE ImgKey = ?", $val, $key)) { + logger::log("MYSQL", " Database Image URL Updated"); + } else { + logger::fail("MYSQL", " Failed To Update Database Image URL",$val,$key); + } +} + +function track_is_hidden($ttid) { + $h = simple_query('Hidden', 'Tracktable', 'TTindex', $ttid, 0); + return ($h != 0) ? true : false; +} + +function track_is_searchresult($ttid) { + // This is for detecting tracks that were added as part of a search, or un-hidden as part of a search + $h = simple_query('isSearchResult', 'Tracktable', 'TTindex', $ttid, 0); + return ($h > 1) ? true : false; +} + +function track_is_wishlist($ttid) { + $u = simple_query('Uri', 'Tracktable', 'TTindex', $ttid, ''); + if ($u === null) { + logger::mark("USERRATING", "Track",$ttid,"is wishlist. Discarding"); + generic_sql_query("DELETE FROM Playcounttable WHERE TTindex=".$ttid, true); + generic_sql_query("DELETE FROM Tracktable WHERE TTindex=".$ttid, true); + return true; + } + return false; +} + +function check_for_wishlist_track(&$data) { + $result = sql_prepare_query(false, PDO::FETCH_ASSOC, null, null, "SELECT TTindex FROM Tracktable JOIN Artisttable USING (Artistindex) + WHERE Artistname=? AND Title=? AND Uri IS NULL",$data['artist'],$data['title']); + foreach ($result as $obj) { + logger::mark("USERRATING", "Wishlist Track",$obj['TTindex'],"matches the one we're adding"); + $meta = get_all_data($obj['TTindex']); + $data['attributes'] = array(); + $data['attributes'][] = array('attribute' => 'Rating', 'value' => $meta['Rating']); + $data['attributes'][] = array('attribute' => 'Tags', 'value' => $meta['Tags']); + generic_sql_query("DELETE FROM Tracktable WHERE TTindex=".$obj['TTindex'], true); + } +} + +function sort_artists_by_name() { + global $prefs; + $qstring = ''; + foreach ($prefs['artistsatstart'] as $a) { + $qstring .= "CASE WHEN LOWER(a.Artistname) = LOWER('".$a."') THEN 1 ELSE 2 END, "; + } + if (count($prefs['nosortprefixes']) > 0) { + $qstring .= "(CASE "; + foreach($prefs['nosortprefixes'] AS $p) { + $phpisshitsometimes = strlen($p)+2; + $qstring .= "WHEN LOWER(a.Artistname) LIKE '".strtolower($p). + " %' THEN LOWER(SUBSTR(a.Artistname,".$phpisshitsometimes.")) "; + } + $qstring .= "ELSE LOWER(a.Artistname) END)"; + } else { + $qstring .= "LOWER(a.Artistname)"; + } + return $qstring; +} + +function albumartist_sort_query($flag) { + // This query gives us album artists only. It also makes sure we only get artists for whom we + // have actual tracks (no album artists who appear only on the wishlist or who have only hidden tracks) + // Using GROUP BY is faster than using SELECT DISTINCT + // USING IN is faster than the double JOIN + global $prefs; + switch ($flag) { + case 'a': + $sflag = "AND isSearchResult < 2 AND isAudiobook = 0"; + break; + + case 'b': + $sflag = "AND isSearchResult > 0 AND isAudiobook = 0"; + break; + + case 'z': + $sflag = "AND isSearchResult < 2 AND isAudiobook = 1"; + break; + + case 'c': + // Special case for album art manager + $sflag = "AND isSearchResult < 2"; + break; + + } + + $qstring = "SELECT Artistname, Artistindex + FROM Artisttable AS a + WHERE + Artistindex IN + (SELECT AlbumArtistindex FROM Albumtable JOIN Tracktable USING (Albumindex) + WHERE Uri IS NOT NULL + AND Hidden = 0 + ".track_date_check($prefs['collectionrange'], $flag)." + ".$sflag." + GROUP BY AlbumArtistindex) + ORDER BY "; + $qstring .= sort_artists_by_name(); + return $qstring; +} + +function do_artists_from_database($why, $what, $who) { + global $divtype; + $singleheader = array(); + logger::trace("DUMPALBUMS", "Generating artist",$why.$what.$who,"from database"); + $singleheader['type'] = 'insertAfter'; + $singleheader['where'] = 'fothergill'; + $count = 0; + $t = microtime(true); + $result = generic_sql_query(albumartist_sort_query($why), false, PDO::FETCH_ASSOC); + $at = microtime(true) - $t; + logger::debug("TIMINGS", " -- Album Artist SQL query took ".$at." seconds"); + $t = microtime(true); + foreach($result as $obj) { + if ($who == "root") { + print artistHeader($why.$what.$obj['Artistindex'], $obj['Artistname']); + $count++; + } else { + if ($obj['Artistindex'] != $who) { + $singleheader['type'] = 'insertAfter'; + $singleheader['where'] = $why.$what.$obj['Artistindex']; + } else { + $singleheader['html'] = artistHeader($why.$what.$obj['Artistindex'], $obj['Artistname']); + $singleheader['id'] = $who; + $at = microtime(true) - $t; + logger::debug("TIMINGS", " -- Generating Artist Header took ".$at." seconds"); + return $singleheader; + } + } + $divtype = ($divtype == "album1") ? "album2" : "album1"; + } + $at = microtime(true) - $t; + logger::debug("TIMINGS", " -- Generating Artist List took ".$at." seconds"); + return $count; +} + +function get_list_of_artists() { + return generic_sql_query(albumartist_sort_query("c")); +} + +function album_sort_query($why, $what, $who) { + global $prefs; + $sflag = ($why == "b") ? "AND Tracktable.isSearchResult > 0" : "AND Tracktable.isSearchResult < 2"; + $sflag .= ($why == 'z') ? " AND Tracktable.isAudiobook = 1" : " AND Tracktable.isAudiobook = 0"; + + $qstring = "SELECT Albumtable.*, Artisttable.Artistname FROM Albumtable JOIN Artisttable ON + (Albumtable.AlbumArtistindex = Artisttable.Artistindex) WHERE "; + + if ($who != "root") { + $qstring .= "AlbumArtistindex = '".$who."' AND "; + } + $qstring .= "Albumindex IN (SELECT Albumindex FROM Tracktable WHERE + Tracktable.Albumindex = Albumtable.Albumindex AND "; + + $qstring .= "Tracktable.Uri IS NOT NULL AND Tracktable.Hidden = 0 ".track_date_check($prefs['collectionrange'], $why)." ".$sflag.")"; + $qstring .= " ORDER BY "; + if ($prefs['sortcollectionby'] == "albumbyartist" && $who == "root") { + foreach ($prefs['artistsatstart'] as $a) { + $qstring .= "CASE WHEN LOWER(Artisttable.Artistname) = LOWER('".$a."') THEN 1 ELSE 2 END, "; + } + if (count($prefs['nosortprefixes']) > 0) { + $qstring .= "(CASE "; + foreach($prefs['nosortprefixes'] AS $p) { + $phpisshitsometimes = strlen($p)+2; + $qstring .= "WHEN LOWER(Artisttable.Artistname) LIKE '".strtolower($p). + " %' THEN LOWER(SUBSTR(Artisttable.Artistname,".$phpisshitsometimes.")) "; + } + $qstring .= "ELSE LOWER(Artisttable.Artistname) END),"; + } else { + $qstring .= "LOWER(Artisttable.Artistname),"; + } + } + $qstring .= " CASE WHEN Albumname LIKE '".get_int_text('label_allartist')."%' THEN 1 ELSE 2 END,"; + if ($prefs['sortbydate']) { + if ($prefs['notvabydate']) { + $qstring .= " CASE WHEN Artisttable.Artistname = 'Various Artists' THEN LOWER(Albumname) ELSE Year END,"; + } else { + $qstring .= ' Year,'; + } + } + $qstring .= ' LOWER(Albumname)'; + return $qstring; +} + +function do_artist_banner($why, $what, $who) { + logger::debug("BACKEND", "Creating Banner ".$why." ".$what." ".$who); + $singleheader['type'] = 'insertAfter'; + $singleheader['where'] = 'fothergill'; + $qstring = album_sort_query($why, $what, 'root'); + $result = generic_sql_query($qstring, false, PDO::FETCH_OBJ); + foreach ($result as $obj) { + if ($obj->AlbumArtistindex != $who) { + $singleheader['where'] = 'aalbum'.$obj->Albumindex; + $singleheader['type'] = 'insertAfter'; + } else { + $singleheader['html'] = artistBanner($obj->Artistname, $obj->AlbumArtistindex, $why); + $singleheader['id'] = $obj->AlbumArtistindex; + return $singleheader; + } + } +} + +function do_albums_from_database($why, $what, $who, $fragment = false, $use_artistindex = false, $force_artistname = false, $do_controlheader = true) { + global $prefs; + $singleheader = array(); + $singleheader['why'] = $why; + if ($prefs['sortcollectionby'] == "artist") { + $singleheader['type'] = 'insertAtStart'; + $singleheader['where'] = $why.'artist'.$who; + } else { + $singleheader['type'] = 'insertAfter'; + $singleheader['where'] = 'fothergill'; + } + logger::log("DUMPALBUMS", "Generating albums for",$why.$what.$who,"from database"); + + $qstring = album_sort_query($why, $what, $who); + logger::debug("DUMPALBUMS", "Query String Is ".$qstring); + + $count = 0; + $currart = ""; + $currban = ""; + $result = generic_sql_query($qstring); + if ($do_controlheader && count($result) > 0) { + print albumControlHeader($fragment, $why, $what, $who, $result[0]['Artistname']); + } + foreach ($result as $obj) { + $artistbanner = ($prefs['sortcollectionby'] == 'albumbyartist' && $prefs['showartistbanners']) ? $obj['Artistname'] : null; + $obj['Artistname'] = ($force_artistname || $prefs['sortcollectionby'] == "album") ? $obj['Artistname'] : null; + $obj['why'] = $why; + $obj['id'] = $why.$what.$obj['Albumindex']; + $obj['class'] = 'album'; + if ($fragment === false) { + if ($artistbanner !== null && $artistbanner !== $currban) { + print artistBanner($artistbanner, $obj['AlbumArtistindex'], $why); + } + print albumHeader($obj); + } else { + if ($obj['Albumindex'] != $fragment) { + $singleheader['where'] = $why.'album'.$obj['Albumindex']; + $singleheader['type'] = 'insertAfter'; + } else { + $singleheader['html'] = albumHeader($obj); + $singleheader['id'] = $fragment; + return $singleheader; + } + } + $currart = $obj['Artistname']; + $currban = $artistbanner; + $count++; + } + logger::log("DUMPALBUMS", "... Found ".$count." albums"); + if ($count == 0 && !($why == 'a' && $who == 'root')) { + noAlbumsHeader(); + } + return $count; +} + +function artistBanner($a, $i, $why) { + return '
'.$a.'
'; +} + +function remove_album_from_database($albumid) { + generic_sql_query("DELETE FROM Tracktable WHERE Albumindex = ".$albumid, true); + generic_sql_query("DELETE FROM Albumtable WHERE Albumindex = ".$albumid, true); +} + +function get_list_of_albums($aid) { + $qstring = "SELECT * FROM Albumtable WHERE AlbumArtistindex = '".$aid."' AND "; + $qstring .= "Albumindex IN (SELECT Albumindex FROM Tracktable WHERE Tracktable.Albumindex = + Albumtable.Albumindex AND Tracktable.Uri IS NOT NULL AND Tracktable.Hidden = 0 AND + Tracktable.isSearchResult < 2)"; + $qstring .= ' ORDER BY LOWER(Albumname)'; + return generic_sql_query($qstring); +} + +function get_album_tracks_from_database($index, $cmd, $flag) { + global $prefs; + $retarr = array(); + $qstring = null; + $cmd = ($cmd === null) ? 'add' : $cmd; + switch ($flag) { + // Really need to make these flags simpler, but it does work. + case "b": + // b - tracks from search results + $action = "SELECT"; + $sflag = "AND isSearchResult > 0"; + $rflag = ""; + break; + + case "r": + // r - only tracks with ratings + $action = "SELECT"; + $sflag = "AND isSearchResult < 2 AND (LinkChecked = 0 OR LinkChecked = 2)"; + $rflag = " JOIN Ratingtable USING (TTindex)"; + break; + + case "t": + // t - only tracks with tags + $action = "SELECT DISTINCT"; + $sflag = "AND isSearchResult < 2 AND (LinkChecked = 0 OR LinkChecked = 2)"; + $rflag = " JOIN TagListtable USING (TTindex)"; + break; + + case "y": + // y = only tracks with tags and ratings + $action = "SELECT DISTINCT"; + $sflag = "AND isSearchResult < 2 AND (LinkChecked = 0 OR LinkChecked = 2)"; + $rflag = " JOIN Ratingtable USING (TTindex)"; + $rflag .= " JOIN TagListtable USING (TTindex)"; + break; + + case "u": + // u - only tracks with tags or ratings + $qstring = "SELECT Uri, Disc, Trackno FROM + Tracktable JOIN Ratingtable USING (TTindex) + WHERE Albumindex = '".$index. + "' AND Uri IS NOT NULL + AND Hidden = 0 + AND (LinkChecked = 0 OR LinkChecked = 2) + AND isSearchResult <2 " + .track_date_check($prefs['collectionrange'], $flag). + "UNION SELECT Uri, Disc, TrackNo FROM + Tracktable JOIN TagListtable USING (TTindex) + WHERE Albumindex = '".$index. + "' AND Uri IS NOT NULL + AND Hidden = 0 + AND (LinkChecked = 0 OR LinkChecked = 2) + AND isSearchResult <2 " + .track_date_check($prefs['collectionrange'], $flag). + "ORDER BY Disc, TrackNo;"; + break; + + case "z": + // z - Audiobooks + $action = "SELECT"; + $sflag = "AND isSearchResult < 2 AND isAudiobook = 1"; + $rflag = ""; + break; + + default: + // anything else - tracks from collection + $action = "SELECT"; + $sflag = "AND isSearchResult < 2 AND isAudiobook = 0"; + $rflag = ""; + break; + } + logger::log("GET TRACKS", "Getting Album Tracks for Albumindex",$index); + if ($qstring === null) { + $qstring = $action." Uri FROM Tracktable".$rflag." WHERE Albumindex = '".$index."' AND Uri IS NOT NULL AND Hidden = 0 ".track_date_check($prefs['collectionrange'], $flag)." ".$sflag." ORDER BY Disc, TrackNo"; + } + $result = generic_sql_query($qstring); + foreach($result as $a) { + $retarr[] = $cmd.' "'.$a['Uri'].'"'; + } + return $retarr; +} + +function get_artist_tracks_from_database($index, $cmd, $flag) { + global $prefs; + $retarr = array(); + logger::log("GET TRACKS", "Getting Tracks for AlbumArtist",$index); + $qstring = "SELECT Albumindex FROM Albumtable JOIN Artisttable ON + (Albumtable.AlbumArtistindex = Artisttable.Artistindex) WHERE AlbumArtistindex = ".$index." ORDER BY"; + if ($prefs['sortbydate']) { + if ($prefs['notvabydate']) { + $qstring .= " CASE WHEN Artistname = 'Various Artists' THEN LOWER(Albumname) ELSE Year END,"; + } else { + $qstring .= ' Year,'; + } + } + $qstring .= ' LOWER(Albumname)'; + $result = generic_sql_query($qstring); + foreach ($result as $a) { + $retarr = array_merge($retarr, get_album_tracks_from_database($a['Albumindex'], $cmd, $flag)); + } + return $retarr; +} + +function do_tracks_from_database($why, $what, $whom, $fragment = false) { + // This function can accept multiple album ids ($whom can be an array) + // in which case it will combine them all into one 'virtual album' - see browse_album() + global $prefs; + $who = getArray($whom); + logger::log("GET TRACKS", "Generating tracks for album(s)",$who,"from database"); + if ($fragment) { + ob_start(); + } + $t = ($why == "b") ? "AND isSearchResult > 0" : "AND isSearchResult < 2"; + $trackarr = generic_sql_query( + // This looks like a wierd way of doing it but the obvious way doesn't work with mysql + // due to table aliases being used. + "SELECT + ".SQL_TAG_CONCAT." AS tags, + r.Rating AS rating, + pr.Progress AS progress, + tr.TTindex AS ttid, + tr.Title AS title, + tr.TrackNo AS trackno, + tr.Duration AS time, + tr.LastModified AS lm, + tr.Disc AS disc, + tr.Uri AS uri, + tr.LinkChecked AS playable, + ta.Artistname AS artist, + tr.Artistindex AS trackartistindex, + al.AlbumArtistindex AS albumartistindex + FROM + (Tracktable AS tr, Artisttable AS ta, Albumtable AS al) + LEFT JOIN TagListtable AS tl ON tr.TTindex = tl.TTindex + LEFT JOIN Tagtable AS t USING (Tagindex) + LEFT JOIN Ratingtable AS r ON tr.TTindex = r.TTindex + LEFT JOIN Progresstable AS pr ON tr.TTindex = pr.TTindex + WHERE (".implode(' OR ', array_map('do_fiddle', $who)).") + AND uri IS NOT NULL + AND tr.Hidden = 0 + ".track_date_check($prefs['collectionrange'], $why)." + ".$t." + AND tr.Artistindex = ta.Artistindex + AND al.Albumindex = tr.Albumindex + GROUP BY tr.TTindex + ORDER BY CASE WHEN title LIKE 'Album: %' THEN 1 ELSE 2 END, disc, trackno" + ); + $numtracks = count($trackarr); + $numdiscs = get_highest_disc($trackarr); + $currdisc = -1; + trackControlHeader($why, $what, $who[0], get_album_details($who[0])); + foreach ($trackarr as $arr) { + if ($numdiscs > 1 && $arr['disc'] != $currdisc && $arr['disc'] > 0) { + $currdisc = $arr['disc']; + print '
'.ucfirst(strtolower(get_int_text("musicbrainz_disc"))).' '.$currdisc.'
'; + } + if ($currdisc > 0) { + $arr['discclass'] = ' disc'.$currdisc; + } else { + $arr['discclass'] = ''; + } + $arr['numtracks'] = $numtracks; + $tracktype = albumTrack($arr); + } + if ($tracktype == 1) { + logger::mark("GET TRACKS", "Album",$who,"has no tracks, just an artist link"); + print ''; + } else if ($tracktype == 2) { + logger::mark("GET TRACKS", "Album",$who,"has no tracks, just an album link"); + print ''; + } + if ($fragment) { + $s = ob_get_contents(); + ob_end_clean(); + return $s; + } +} + +function get_highest_disc($tracks) { + $n = 1; + foreach ($tracks as $t) { + if ($t['disc'] > $n) { + $n = $t['disc']; + } + } + return $n; +} + +function do_fiddle($a) { + return 'tr.Albumindex = '.$a; +} + +function get_album_details($albumindex) { + return generic_sql_query( + "SELECT Albumname, Artistname, Image, AlbumUri + FROM Albumtable + JOIN Artisttable ON Albumtable.AlbumArtistindex = Artisttable.Artistindex + WHERE Albumindex = ".$albumindex ); +} + +function get_artist_charts() { + $artists = array(); + $query = "SELECT SUM(Playcount) AS playtot, Artistindex, Artistname FROM + Playcounttable JOIN Tracktable USING (TTindex) JOIN Artisttable USING (Artistindex)"; + $query .= " GROUP BY Artistindex ORDER BY playtot DESC LIMIT 40"; + $result = generic_sql_query($query, false, PDO::FETCH_OBJ); + foreach ($result as $obj) { + $artists[] = array( 'label_artist' => $obj->Artistname, 'soundcloud_plays' => $obj->playtot); + } + return $artists; +} + +function get_album_charts() { + $albums = array(); + $query = "SELECT SUM(Playcount) AS playtot, Albumname, Artistname, AlbumUri, Albumindex + FROM Playcounttable JOIN Tracktable USING (TTindex) JOIN Albumtable USING (Albumindex) + JOIN Artisttable ON Albumtable.AlbumArtistindex = Artisttable.Artistindex"; + $query .= " GROUP BY Albumindex ORDER BY playtot DESC LIMIT 40"; + $result = generic_sql_query($query, false, PDO::FETCH_OBJ); + foreach ($result as $obj) { + $albums[] = array( 'label_artist' => $obj->Artistname, + 'label_album' => $obj->Albumname, + 'soundcloud_plays' => $obj->playtot, 'uri' => $obj->AlbumUri); + } + return $albums; +} + +function get_track_charts($limit = 40) { + $tracks = array(); + $query = "SELECT Title, Playcount, Artistname, Uri FROM Tracktable JOIN Playcounttable USING (TTIndex) + JOIN Artisttable USING (Artistindex)"; + $query .= " ORDER BY Playcount DESC LIMIT ".$limit; + $result = generic_sql_query($query, false, PDO::FETCH_OBJ); + foreach ($result as $obj) { + $tracks[] = array( 'label_artist' => $obj->Artistname, + 'label_track' => $obj->Title, + 'soundcloud_plays' => $obj->Playcount, 'uri' => $obj->Uri); + } + return $tracks; +} + +function find_justadded_artists() { + return sql_get_column("SELECT DISTINCT AlbumArtistindex FROM Albumtable JOIN Tracktable USING (Albumindex) WHERE justAdded = 1", 0); +} + +function find_justadded_albums() { + return sql_get_column("SELECT DISTINCT Albumindex FROM Tracktable WHERE justAdded = 1", 0); +} + +function get_user_radio_streams() { + return generic_sql_query("SELECT * FROM RadioStationtable WHERE IsFave = 1 ORDER BY Number, StationName"); +} + +function remove_user_radio_stream($x) { + generic_sql_query("UPDATE RadioStationtable SET IsFave = 0, Number = 65535 WHERE Stationindex = ".$x, true); +} + +function save_radio_order($order) { + foreach ($order as $i => $o) { + generic_sql_query("UPDATE RadioStationtable SET Number = ".$i." WHERE Stationindex = ".$o, true); + } +} + +function check_radio_station($playlisturl, $stationname, $image) { + global $mysqlc; + $index = null; + $index = sql_prepare_query(false, null, 'Stationindex', false, "SELECT Stationindex FROM RadioStationtable WHERE PlaylistUrl = ?", $playlisturl); + if ($index === false) { + logger::shout("RADIO", "Adding New Radio Station"); + logger::mark("RADIO", " Name :",$stationname); + logger::mark("RADIO", " Image :",$image); + logger::mark("RADIO", " URL :",$playlisturl); + if (sql_prepare_query(true, null, null, null, "INSERT INTO RadioStationtable (IsFave, StationName, PlaylistUrl, Image) VALUES (?, ?, ?, ?)", + 0, trim($stationname), trim($playlisturl), trim($image))) { + $index = $mysqlc->lastInsertId(); + logger::log("RADIO", "Created new radio station with index ".$index); + } + } else { + sql_prepare_query(true, null, null, null, "UPDATE RadioStationtable SET StationName = ?, Image = ? WHERE Stationindex = ?", + trim($stationname), trim($image), $index); + logger::shout("RADIO", "Found radio station",$stationname,"with index",$index); + } + return $index; +} + +function check_radio_tracks($stationid, $tracks) { + generic_sql_query("DELETE FROM RadioTracktable WHERE Stationindex = ".$stationid, true); + foreach ($tracks as $track) { + $index = sql_prepare_query(false, null, 'Stationindex', false, "SELECT Stationindex FROM RadioTracktable WHERE TrackUri = ?", trim($track['TrackUri'])); + if ($index !== false) { + logger::log("RADIO", " Track already exists for stationindex",$index); + $stationid = $index; + } else { + logger::mark("RADIO", " Adding New Track",$track['TrackUri'],"to station",$stationid); + sql_prepare_query(true, null, null, null, "INSERT INTO RadioTracktable (Stationindex, TrackUri, PrettyStream) VALUES (?, ?, ?)", + $stationid, trim($track['TrackUri']), trim($track['PrettyStream'])); + } + } + return $stationid; +} + +function add_fave_station($info) { + if (array_key_exists('streamid', $info) && $info['streamid']) { + logger::shout("RADIO", "Updating StationIndex",$info['streamid'],"to be fave"); + generic_sql_query("UPDATE RadioStationtable SET IsFave = 1 WHERE Stationindex = ".$info['streamid'], true); + return true; + } + $stationindex = check_radio_station($info['location'],$info['album'],$info['image']); + $stationindex = check_radio_tracks($stationindex, array(array('TrackUri' => $info['location'], 'PrettyStream' => $info['stream']))); + generic_sql_query("UPDATE RadioStationtable SET IsFave = 1 WHERE Stationindex = ".$stationindex, true); +} + +function update_radio_station_name($info) { + if ($info['streamid']) { + logger::shout("RADIO", "Updating Stationindex",$info['streamid'],"with new name",$info['name']); + sql_prepare_query(true, null, null, null, "UPDATE RadioStationtable SET StationName = ? WHERE Stationindex = ?",$info['name'],$info['streamid']); + } else { + $stationid = check_radio_station($info['uri'], $info['name'], ''); + check_radio_tracks($stationid, array(array('TrackUri' => $info['uri'], 'PrettyStream' => ''))); + } +} + +function find_stream_name_from_index($index) { + return simple_query('StationName', 'RadioStationtable', 'StationIndex', $index, ''); +} + +function update_stream_image($stream, $image) { + sql_prepare_query(true, null, null, null, "UPDATE RadioStationtable SET Image = ? WHERE StationName = ?",$image,$stream); +} + +function update_podcast_image($podid, $image) { + logger::log("PODCASTS", "Setting Image to",$image,"for podid",$podid); + sql_prepare_query(true, null, null, null, 'UPDATE Podcasttable SET Image = ? WHERE PODindex = ?',$image, $podid); +} + +function find_radio_track_from_url($url) { + return sql_prepare_query(false, PDO::FETCH_OBJ, null, null, + "SELECT + Stationindex, PlaylistUrl, StationName, Image, PrettyStream + FROM + RadioStationtable JOIN RadioTracktable USING (Stationindex) + WHERE TrackUri = ?",$url); +} + +function find_podcast_track_from_url($url) { + return sql_prepare_query(false, PDO::FETCH_OBJ, null, null, + "SELECT + PodcastTracktable.Title AS title, + PodcastTracktable.Artist AS artist, + PodcastTracktable.Duration AS duration, + PodcastTracktable.Description AS comment, + Podcasttable.Title AS album, + Podcasttable.Artist AS albumartist, + Podcasttable.Image AS image + FROM PodcastTracktable JOIN Podcasttable USING (PODindex) + WHERE PodcastTracktable.Link=? + OR PodcastTracktable.Localfilename=?", + $url, + preg_replace('#http://.*?/#', '/', $url)); +} + +// +// Database Global Stats and Version Control +// + +function update_track_stats() { + logger::log("BACKEND", "Updating Track Stats"); + $t = microtime(true); + $ac = get_artist_count(ADDED_ALL_TIME, 0); + update_stat('ArtistCount',$ac); + + $ac = get_album_count(ADDED_ALL_TIME, 0); + update_stat('AlbumCount',$ac); + + $ac = get_track_count(ADDED_ALL_TIME, 0); + update_stat('TrackCount',$ac); + + $ac = get_duration_count(ADDED_ALL_TIME, 0); + update_stat('TotalTime',$ac); + $at = microtime(true) - $t; + logger::debug("TIMINGS", "Updating Track Stats took ".$at." seconds"); +} + +function update_stat($item, $value) { + generic_sql_query("UPDATE Statstable SET Value='".$value."' WHERE Item='".$item."'", true); +} + +function get_stat($item) { + return simple_query('Value', 'Statstable', 'Item', $item, 0); +} + +function get_artist_count($range, $iab) { + $ac = generic_sql_query( + "SELECT COUNT(*) AS NumArtists FROM (SELECT AlbumArtistindex FROM Albumtable + INNER JOIN Tracktable USING (Albumindex) WHERE Uri IS NOT NULL + AND Hidden = 0 AND isSearchResult < 2 AND isAudiobook = ".$iab." ".track_date_check($range, 'a')." GROUP BY AlbumArtistindex) AS t", false, null, 'NumArtists', 0); + return $ac; +} + +function get_album_count($range, $iab) { + $ac = generic_sql_query( + "SELECT COUNT(*) AS NumAlbums FROM (SELECT Albumindex FROM Tracktable WHERE Uri IS NOT NULL + AND Hidden = 0 AND isSearchResult < 2 AND isAudiobook = ".$iab." ".track_date_check($range, 'a')." GROUP BY Albumindex) AS t", false, null, 'NumAlbums', 0); + return $ac; +} + +function get_track_count($range, $iab) { + $ac = generic_sql_query("SELECT COUNT(*) AS NumTracks FROM Tracktable WHERE Uri IS NOT NULL AND Hidden=0 AND isAudiobook = ".$iab." ".track_date_check($range, 'a')." AND isSearchResult < 2", false, null, 'NumTracks', 0); + return $ac; +} + +function get_duration_count($range, $iab) { + $ac = generic_sql_query("SELECT SUM(Duration) AS TotalTime FROM Tracktable WHERE Uri IS NOT NULL AND Hidden=0 AND isAudiobook = ".$iab." ".track_date_check($range, 'a')." AND isSearchResult < 2", false, null, 'TotalTime', 0); + if ($ac == '') { + $ac = 0; + } + return $ac; +} + +function dumpAlbums($which) { + + global $divtype, $prefs; + + $a = preg_match('/(a|b|z)(.*?)(\d+|root)/', $which, $matches); + if (!$a) { + print '

'.get_int_text("label_general_error").'

'; + logger::fail("DUMPALBUMS", "Artist dump failed - regexp failed to match",$which); + return false; + } + $why = $matches[1]; + $what = $matches[2]; + $who = $matches[3]; + $count = null; + + switch ($who) { + case 'root': + print '
'; + switch ($why) { + case 'a': + print collectionStats(); + break; + + case 'b': + searchStats(); + break; + + case 'z': + print audiobookStats(); + break; + + } + $divtype = "album1"; + switch ($what) { + case 'artist': + $count = do_artists_from_database($why, $what, $who); + break; + + case 'album': + case 'albumbyartist': + $count = do_albums_from_database($why, 'album', $who, false, false, false); + break; + + } + if ($count == 0) { + switch ($why) { + case 'a': + emptyCollectionDisplay(); + break; + + case 'b': + emptySearchDisplay(); + break; + } + } + break; + + default: + switch ($what) { + case 'artist': + do_albums_from_database($why, 'album', $who, false, false, false); + break; + case 'album': + do_tracks_from_database($why, $what, $who, false); + break; + } + } + +} + +function collectionStats() { + global $prefs; + $html = '
'; + if ($prefs['collectionrange'] == ADDED_ALL_TIME) { + $html .= alistheader(get_stat('ArtistCount'), + get_stat('AlbumCount'), + get_stat('TrackCount'), + format_time(get_stat('TotalTime')) + ); + } else { + $html .= alistheader(get_artist_count($prefs['collectionrange'], 0), + get_album_count($prefs['collectionrange'], 0), + get_track_count($prefs['collectionrange'], 0), + format_time(get_duration_count($prefs['collectionrange'], 0))); + } + $html .= '
'; + return $html; +} + +function audiobookStats() { + global $prefs; + $html = '
'; + $html .= alistheader(get_artist_count($prefs['collectionrange'], 1), + get_album_count($prefs['collectionrange'], 1), + get_track_count($prefs['collectionrange'], 1), + format_time(get_duration_count($prefs['collectionrange'], 1))); + $html .= "
"; + return $html; +} + +function searchStats() { + $numartists = generic_sql_query( + "SELECT COUNT(*) AS NumArtists FROM (SELECT DISTINCT AlbumArtistIndex FROM Albumtable + INNER JOIN Tracktable USING (Albumindex) WHERE Albumname IS NOT NULL AND Uri IS NOT + NULL AND Hidden = 0 AND isSearchResult > 0) AS t", false, null, 'NumArtists', 0); + + $numalbums = generic_sql_query( + "SELECT COUNT(*) AS NumAlbums FROM (SELECT DISTINCT Albumindex FROM Albumtable + INNER JOIN Tracktable USING (Albumindex) WHERE Albumname IS NOT NULL AND Uri IS NOT + NULL AND Hidden = 0 AND isSearchResult > 0) AS t", false, null, 'NumAlbums', 0); + + $numtracks = generic_sql_query( + "SELECT COUNT(*) AS NumTracks FROM Tracktable WHERE Uri IS NOT NULL + AND Hidden=0 AND isSearchResult > 0", false, null, 'NumTracks', 0); + + $numtime = generic_sql_query( + "SELECT SUM(Duration) AS TotalTime FROM Tracktable WHERE Uri IS NOT NULL AND + Hidden=0 AND isSearchResult > 0", false, null, 'TotalTime', 0); + + print '
'; + print alistheader($numartists, $numalbums, $numtracks, format_time($numtime)); + print '
'; + +} + +function getItemsToAdd($which, $cmd = null) { + $a = preg_match('/(a|b|r|t|y|u|z)(.*?)(\d+|root)/', $which, $matches); + if (!$a) { + logger::fail("GETITEMSTOADD", "Regexp failed to match",$which); + return array(); + } + $why = $matches[1]; + $what = $matches[2]; + $who = $matches[3]; + switch ($what) { + case "artist": + return get_artist_tracks_from_database($who, $cmd, $why); + break; + + case "album": + return get_album_tracks_from_database($who, $cmd, $why); + break; + + default: + logger::fail("GETITEMSTOADD", "Unknown type",$which); + return array(); + break; + } +} + +function playAlbumFromTrack($uri) { + $retval = array('add "'.$uri.'"'); + $result = sql_prepare_query(false, PDO::FETCH_OBJ, null, null, "SELECT Albumindex, TrackNo, Disc, isSearchResult FROM Tracktable WHERE Uri = ?", $uri); + $album = array_shift($result); + if ($album) { + $newsr = ($album->isSearchResult == 0) ? 2 : 3; + $retval = array(); + $result = sql_prepare_query(false, PDO::FETCH_OBJ, null, null, "SELECT Uri FROM Tracktable WHERE Albumindex = ? AND ((Disc = ? AND TrackNo >= ?) OR (Disc > ?)) AND Hidden = 0 AND isSearchResult < ? ORDER BY Disc, TrackNo", + $album->Albumindex, $album->Disc, $album->TrackNo, $album->Disc, $newsr); + foreach ($result as $obj) { + $retval[] = 'add "'.$obj->Uri.'"'; + } + + } + return $retval; +} + +function check_url_against_database($url, $itags, $rating) { + global $mysqlc; + if ($mysqlc === null) connect_to_database(); + $qstring = "SELECT COUNT(t.TTindex) AS num FROM Tracktable AS t "; + $tags = array(); + if ($itags !== null) { + $qstring .= "JOIN (SELECT DISTINCT TTindex FROM TagListtable JOIN Tagtable AS tag USING (Tagindex) WHERE"; + $tagterms = array(); + foreach ($itags as $tag) { + $tags[] = trim($tag); + $tagterms[] = " tag.Name LIKE ?"; + } + $qstring .= implode(" OR",$tagterms); + $qstring .=") AS j ON j.TTindex = t.TTindex "; + } + if ($rating !== null) { + $qstring .= "JOIN (SELECT * FROM Ratingtable WHERE Rating >= ".$rating.") AS rat ON rat.TTindex = t.TTindex "; + } + $tags[] = $url; + $qstring .= "WHERE t.Uri = ?"; + $count = sql_prepare_query(false, null, 'num', 0, $qstring, $tags); + if ($count > 0) { + return true; + } + return false; +} + +function cleanSearchTables() { + // Clean up the database tables before performing a new search or updating the collection + + logger::trace("MYSQL", "Cleaning Search Results"); + // Any track that was previously hidden needs to be re-hidden + generic_sql_query("UPDATE Tracktable SET Hidden = 1, isSearchResult = 0 WHERE isSearchResult = 3", true); + + // Any track that was previously a '2' (added to database as search result) but now + // has a playcount needs to become a zero and be hidden. + hide_played_tracks(); + + // remove any remaining '2's + generic_sql_query("DELETE FROM Tracktable WHERE isSearchResult = 2", true); + + // Set '1's back to '0's + generic_sql_query("UPDATE Tracktable SET isSearchResult = 0 WHERE isSearchResult = 1", true); + + // This may leave some orphaned albums and artists + remove_cruft(); + + // + // remove_cruft creates some temporary tables and we need to remove them because + // remove cruft will be called again later on if we're doing a collection update. + // Sadly, DROP TABLE runs into locking problems, at least with SQLite, so instead + // we close the DB connection and start again. + // So this function must be called BEFORE prepareCollectionUpdate, as that creates + // temporary tables of its own. + // + + close_database(); + sleep(1); + connect_to_database(); + +} + +// +// Stuff to do with creating the database from a music collection (collection.php) +// + +function collectionUpdateRunning() { + $cur = simple_query('Value', 'Statstable', 'Item', 'Updating', null); + switch ($cur) { + case null: + logger::warn('COLLECTION', 'Got null response to update lock check'); + case '0': + generic_sql_query("UPDATE Statstable SET Value = 1 WHERE Item = 'Updating'", true); + return false; + + case '1': + logger::warn('COLLECTION', 'Multiple collection updates attempted'); + return true; + } +} + +function clearUpdateLock() { + generic_sql_query("UPDATE Statstable SET Value = 0 WHERE Item = 'Updating'", true); +} + +function prepareCollectionUpdate() { + create_foundtracks(); + prepare_findtracks(); + open_transaction(); +} + +function prepare_findtracks() { + global $find_track, $update_track; + if ($find_track = sql_prepare_query_later( + "SELECT TTindex, Disc, LastModified, Hidden, isSearchResult, Uri, isAudiobook FROM Tracktable WHERE Title=? AND ((Albumindex=? AND TrackNo=? AND Disc=?) OR (Artistindex=? AND Uri IS NULL))")) { + } else { + show_sql_error(); + exit(1); + } + + if ($update_track = sql_prepare_query_later( + "UPDATE Tracktable SET LinkChecked=0, Trackno=?, Duration=?, Disc=?, LastModified=?, Uri=?, Albumindex=?, isSearchResult=?, isAudiobook=?, Hidden=0, justAdded=1 WHERE TTindex=?")) { + } else { + show_sql_error(); + exit(1); + } +} + +function remove_findtracks() { + global $find_track, $update_track; + $find_track = null; + $update_track = null; +} + +function tidy_database() { + // Find tracks that have been removed + logger::debug("TIMINGS", "Starting Cruft Removal"); + $now = time(); + logger::trace("MYSQL", "Finding tracks that have been deleted"); + generic_sql_query("DELETE FROM Tracktable WHERE LastModified IS NOT NULL AND Hidden = 0 AND justAdded = 0", true); + remove_cruft(); + update_stat('ListVersion',ROMPR_COLLECTION_VERSION); + update_track_stats(); + $dur = format_time(time() - $now); + logger::debug("TIMINGS", "Cruft Removal Took ".$dur); + logger::debug("TIMINGS", "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); + close_transaction(); +} + +function create_foundtracks() { + // The order of these is VERY IMPORTANT! + // Also the WHERE (thing) = 1 is important otherwise, at least with MySQL, it sets EVERY ROW to 0 + // whether or not it's already 0. That takes a very long time + generic_sql_query("UPDATE Tracktable SET justAdded = 0 WHERE justAdded = 1", true); + generic_sql_query("UPDATE Albumtable SET justUpdated = 0 WHERE justUpdated = 1", true); +} + +function remove_cruft() { + logger::log("MYSQL", "Removing orphaned albums"); + $t = microtime(true); + generic_sql_query("DELETE FROM Albumtable WHERE Albumindex NOT IN (SELECT DISTINCT Albumindex FROM Tracktable)", true); + $at = microtime(true) - $t; + logger::debug("TIMINGS", " -- Removing orphaned albums took ".$at." seconds"); + + logger::log("MYSQL", "Removing orphaned artists"); + $t = microtime(true); + delete_orphaned_artists(); + $at = microtime(true) - $t; + logger::debug("TIMINGS", " -- Removing orphaned artists took ".$at." seconds"); + + logger::log("MYSQL", "Tidying Metadata"); + $t = microtime(true); + generic_sql_query("DELETE FROM Ratingtable WHERE Rating = '0'", true); + generic_sql_query("DELETE FROM Ratingtable WHERE TTindex NOT IN (SELECT TTindex FROM Tracktable WHERE Hidden = 0)", true); + generic_sql_query("DELETE FROM TagListtable WHERE TTindex NOT IN (SELECT TTindex FROM Tracktable WHERE Hidden = 0)", true); + // Temporary table needed because we can't use an IN clause as it conflicts with a trigger + generic_sql_query("CREATE TEMPORARY TABLE used_tags AS SELECT DISTINCT Tagindex FROM TagListtable", true); + generic_sql_query("DELETE FROM Tagtable WHERE Tagindex NOT IN (SELECT Tagindex FROM used_tags)", true); + generic_sql_query("DELETE FROM Playcounttable WHERE Playcount = '0'", true); + generic_sql_query("DELETE FROM Playcounttable WHERE TTindex NOT IN (SELECT TTindex FROM Tracktable)", true); + $at = microtime(true) - $t; + logger::debug("TIMINGS", " -- Tidying metadata took ".$at." seconds"); +} + +function do_track_by_track($trackobject) { + + // Tracks must have disc and albumartist tags to be handled by this method. + // Loads of static variables to speed things up - we don't have to look things up every time. + + static $current_albumartist = null; + static $current_album = null; + static $current_domain = null; + static $current_albumlink= null; + static $albumobj = null; + + if ($trackobject === null) { + if ($albumobj !== null) { + $albumobj->check_database(); + $albumobj = null; + } + return true; + } + + $artistname = $trackobject->get_sort_artist(); + + if ($albumobj === null || + $current_albumartist != $artistname || + $current_album != $trackobject->tags['Album'] || + $current_domain != $trackobject->tags['domain'] || + ($trackobject->tags['X-AlbumUri'] != null && $trackobject->tags['X-AlbumUri'] != $current_albumlink)) { + if ($albumobj !== null) { + $albumobj->check_database(); + } + $albumobj = new album($trackobject); + } else { + $albumobj->newTrack($trackobject); + } + + $current_albumartist = $artistname; + $current_album = $albumobj->name; + $current_domain = $albumobj->domain; + $current_albumlink = $albumobj->uri; + +} + +function check_and_update_track($trackobj, $albumindex, $artistindex, $artistname) { + global $find_track, $update_track, $numdone, $prefs, $doing_search; + static $current_trackartist = null; + static $trackartistindex = null; + $ttid = null; + $lastmodified = null; + $hidden = 0; + $disc = 0; + $uri = null; + $issearchresult = 0; + $isaudiobook = 0; + + // Why are we not checking by URI? That should be unique, right? + // Well, er. no. They're not. + // Especially Spotify returns the same URI multiple times if it's in mutliple playlists + // We CANNOT HANDLE that. Nor do we want to. + + // The other advantage of this is that we can put an INDEX on Albumindex, TrackNo, and Title, + // which we can't do with Uri cos it's too long - this speeds the whole process up by a factor + // of about 32 (9 minutes when checking by URI vs 15 seconds this way, on my collection) + // Also, URIs might change if the user moves his music collection. + + if ($prefs['collection_type'] == "sqlite") { + // Lord knows why, but we have to re-prepare these every single bloody time! + prepare_findtracks(); + } + + if ($find_track->execute(array($trackobj->tags['Title'], $albumindex, $trackobj->tags['Track'],$trackobj->tags['Disc'],$artistindex))) { + while ($obj = $find_track->fetch(PDO::FETCH_OBJ)) { + $ttid = $obj->TTindex; + $lastmodified = $obj->LastModified; + $hidden = $obj->Hidden; + $disc = $obj->Disc; + $issearchresult = $obj->isSearchResult; + $uri = $obj->Uri; + $isaudiobook = $obj->isAudiobook; + break; + } + } else { + show_sql_error(); + return false; + } + + // NOTE: It is imperative that the search results have been tidied up - + // i.e. there are no 1s or 2s in the database before we do a collection update + + // When doing a search, we MUST NOT change lastmodified of any track, because this will cause + // user-added tracks to get a lastmodified date, and lastmodified == NULL + // is how we detect user-added tracks and prevent them being deleted on collection updates + + // Note the use of === to detect LastModified, because == doesn't tell the difference between 0 and null + // - so if we have a manually added track and then add a collection track over it from a backend that doesn't + // give us LastModified (eg Spotify-Web), we don't update lastModified and the track remains manually added. + + if ($ttid) { + if ((!$doing_search && $trackobj->tags['Last-Modified'] !== $lastmodified) || + ($doing_search && $issearchresult == 0) || + ($trackobj->tags['Disc'] != $disc && $trackobj->tags['Disc'] !== '') || + $hidden != 0 || + ($trackobj->tags['type'] == 'audiobook' && $isaudiobook == 0) || + ($trackobj->tags['type'] != 'audiobook' && $isaudiobook == 1) || + $trackobj->tags['file'] != $uri) { + + // + // Lots of debug output + // + + if ($prefs['debug_enabled'] > 6) { + logger::log("MYSQL", " Updating track with ttid $ttid because :"); + + if (!$doing_search && $lastmodified === null) logger::log("MYSQL", " LastModified is not set in the database"); + if (!$doing_search && $trackobj->tags['Last-Modified'] === null) logger::log("MYSQL", " TrackObj LastModified is NULL too!"); + if (!$doing_search && $lastmodified !== $trackobj->tags['Last-Modified']) logger::log("MYSQL", " LastModified has changed: We have ".$lastmodified." but track has ".$trackobj->tags['Last-Modified']); + if ($disc != $trackobj->tags['Disc']) logger::log("MYSQL", " Disc Number has changed: We have ".$disc." but track has ".$trackobj->tags['Disc']); + if ($hidden != 0) logger::log("MYSQL", " It is hidden"); + if ($trackobj->tags['type'] == 'audiobook' && $isaudiobook == 0) logger::log("MYSQL", " It needs to be marked as an Auidiobook"); + if ($trackobj->tags['type'] != 'audiobook' && $isaudiobook == 1) logger::log("MYSQL", " It needs to be un-marked as an Audiobook"); + if ($trackobj->tags['file'] != $uri) { + logger::log("MYSQL", " Uri has changed from : ".$uri); + logger::log("MYSQL", " to : ".$trackobj->tags['file']); + } + } + + // + // End of debug output + // + + $newsearchresult = 0; + if ($doing_search) { + // Sometimes spotify search returns the same track with multiple URIs. This means we update the track + // when we get the second one and isSearchResult gets set to zero unless we do this. + $newsearchresult = $issearchresult; + } + $newlastmodified = $trackobj->tags['Last-Modified']; + if ($issearchresult == 0 && $doing_search) { + $newsearchresult = ($hidden != 0) ? 3 : 1; + logger::log("MYSQL", " It needs to be marked as a search result : Value ".$newsearchresult); + $newlastmodified = $lastmodified; + } + $newisaudiobook = $trackobj->tags['type'] == 'audiobook' ? 1 : 0; + if ($update_track->execute(array($trackobj->tags['Track'], $trackobj->tags['Time'], $trackobj->tags['Disc'], + $newlastmodified, $trackobj->tags['file'], $albumindex, $newsearchresult, $newisaudiobook, $ttid))) { + $numdone++; + } else { + show_sql_error(); + } + } else { + generic_sql_query("UPDATE Tracktable SET justAdded = 1 WHERE TTindex = ".$ttid, true); + } + } else { + $a = $trackobj->get_artist_string(); + if ($a != $current_trackartist || $trackartistindex == null) { + if ($artistname != $a && $a != null) { + $trackartistindex = check_artist($a); + } else { + $trackartistindex = $artistindex; + } + } + if ($trackartistindex == null) { + logger::error("MYSQL_TBT", "ERROR! Trackartistindex is still null!"); + return false; + } + + $current_trackartist = $a; + $sflag = ($doing_search) ? 2 : 0; + $params = array( + 'title' => $trackobj->tags['Title'], + 'artist' => null, + 'trackno' => $trackobj->tags['Track'], + 'duration' => $trackobj->tags['Time'], + 'albumartist' => null, + 'albumuri' => null, + 'image' => null, + 'album' => null, + 'date' => null, + 'uri' => $trackobj->tags['file'], + 'trackai' => $trackartistindex, + 'albumai' => $artistindex, + 'albumindex' => $albumindex, + 'searched' => null, + 'imagekey' => null, + 'lastmodified' => $trackobj->tags['Last-Modified'], + 'disc' => $trackobj->tags['Disc'], + 'ambid' => null, + 'domain' => null, + 'hidden' => 0, + 'searchflag' => $sflag, + 'isaudiobook' => $trackobj->tags['type'] == 'audiobook' ? 1 : 0 + ); + $ttid = create_new_track($params); + $numdone++; + } + check_transaction(); + if ($ttid == null) { + logger::error("MYSQL", "ERROR! No ttid for track ".$trackobj->tags['file']); + logger::error("MYSQL", "Parameters were : "); + logger::error("MYSQL", " Title : ".$trackobj->tags['Title']); + logger::error("MYSQL", " Track : ".$trackobj->tags['Track']); + logger::error("MYSQL", " Time : ".$trackobj->tags['Time']); + logger::error("MYSQL", " file : ".$trackobj->tags['file']); + logger::error("MYSQL", " trackartistindex : ".$trackartistindex); + logger::error("MYSQL", " artistindex : ".$artistindex); + logger::error("MYSQL", " albumindex : ".$albumindex); + logger::error("MYSQL", " Last-Modified : ".$trackobj->tags['Last-Modified']); + logger::error("MYSQL", " Disc : ".$trackobj->tags['Disc']); + logger::error("MYSQL", " sflag : ".$sflag); + } +} + +?> diff --git a/www/rompr/backends/sql/connect.php b/www/rompr/backends/sql/connect.php new file mode 100644 index 0000000..056fe4f --- /dev/null +++ b/www/rompr/backends/sql/connect.php @@ -0,0 +1,301 @@ +errorInfo()[1],":",$mysqlc->errorInfo()[2]); + if ($stmt !== null) { + logger::error("STMT ERROR", $text,":",$stmt->errorInfo()[1],":",$stmt->errorInfo()[2]); + } +} + +// +// Queries +// + +function generic_sql_query($qstring, $return_boolean = false, $return_type = PDO::FETCH_ASSOC, $return_value = null, $value_default = null, $return_rowcount = false ) { + global $mysqlc; + logger::debug("GENERIC_SQL", $qstring); + $retval = true; + if (($result = @$mysqlc->query($qstring)) !== false) { + logger::debug("GENERIC_SQL", "Done : ".($result->rowCount())." rows affected"); + if ($return_value !== null) { + $arr = $result->fetch(PDO::FETCH_ASSOC); + $retval = ($arr) ? $arr[$return_value] : $value_default; + } else if ($return_boolean) { + $retval = true; + } else if ($return_rowcount) { + return $result->rowCount(); + } else { + $retval = $result->fetchAll($return_type); + } + } else { + logger::warn("GENERIC_SQL", "Command Failed :",$qstring); + show_sql_error(); + if ($return_value !== null) { + $retval = $value_default; + } else if ($return_boolean) { + $retval = false; + } else { + $retval = array(); + } + } + $result = null; + return $retval; +} + +function sql_get_column($qstring, $column) { + global $mysqlc; + logger::debug("SQL_GET_COLUMN", "Get column",$column,"from",$qstring); + $retval = array(); + if (($result = $mysqlc->query($qstring)) !== false) { + $retval = $result->fetchAll(PDO::FETCH_COLUMN, $column); + } + return $retval; +} + +function simple_query($select, $from, $where, $item, $default) { + $retval = $default; + $qstring = "SELECT ".$select." AS TheThingToFind FROM ".$from; + if ($where != null) { + $qstring .= " WHERE ".$where." = ?"; + } + $retval = sql_prepare_query(false, null, 'TheThingToFind', $default, $qstring, $item); + return $retval; +} + +function sql_prepare_query() { + // Variable arguments but at least 5 are required: + // 1. flag for whether to just return a boolean + // 2. return type + // 3. field name + // 4. default value for field name + // 5. query string + // ... parameters for query + // return type of PDO::FETCH_COLUMN returns an array of the values + // from the column identified by field name + // --**-- NO PARAMETER CHECKING IS DONE BY THIS FUNCTION! --**-- + // because we want to make it fast, so make sure you call it right! + + // This doesn't appear to work with MySQL when one of the args has to be an integer + // eg LIMIT ? doesn't work. + + global $mysqlc; + $allargs = func_get_args(); + logger::debug("SQL_PREPARE",$allargs); + $return_boolean = $allargs[0]; + $return_type = $allargs[1]; + $return_value = $allargs[2]; + $value_default = $allargs[3]; + $query = $allargs[4]; + if (is_array($allargs[5])) { + $args = $allargs[5]; + } else { + $args = array_slice($allargs, 5); + } + + $stmt = $mysqlc->prepare($query); + if ($stmt !== false) { + if ($stmt->execute($args)) { + if ($return_type == PDO::FETCH_COLUMN) { + $retval = $stmt->fetchAll(PDO::FETCH_COLUMN, $return_value); + } else if ($return_value !== null) { + $arr = $stmt->fetch(PDO::FETCH_ASSOC); + $retval = ($arr) ? $arr[$return_value] : $value_default; + } else if ($return_boolean) { + $retval = true; + } else { + $retval = $stmt->fetchAll($return_type); + } + $stmt = null; + return $retval; + } else { + show_sql_error("SQL Statement Error for",$stmt); + } + } else { + show_sql_error(); + } + if ($return_value !== null) { + $retval = $value_default; + } else if ($return_boolean) { + $retval = false; + } else { + $retval = array(); + } + $stmt = null; + return $retval; +} + +function sql_prepare_query_later($query) { + global $mysqlc; + $stmt = $mysqlc->prepare($query); + if ($stmt === FALSE) { + show_sql_error(); + } + return $stmt; +} + +// Debug function for prepared statement +function dbg_params($string,$data) { + $indexed = $data==array_values($data); + + foreach($data as $k=>$v) { + if (is_string($v)) { + $v = "'$v'"; + } + if($indexed) { + $string = preg_replace('/\?/', $v, $string, 1); + } else { + $string=str_replace(":$k", $v, $string); + } + } + return $string; +} + +function checkCollectionStatus() { + $lv = generic_sql_query("SELECT Value FROM Statstable WHERE Item = 'ListVersion'", false, null, 'Value', null); + if ($lv == ROMPR_COLLECTION_VERSION) { + logger::log("MYSQL", "Collection version is correct"); + return "0"; + } else { + if ($lv > 0) { + logger::warn("MYSQL", "Collection version is outdated - ".$lv); + return "1"; + } else { + logger::shout("MYSQL", "Collection has not been built".$lv); + return "2"; + } + } +} + +function checkAlbumArt() { + $oa = generic_sql_query("SELECT COUNT(ImgVersion) AS NumOldAlbums FROM Albumtable WHERE Image LIKE 'albumart/small/%' AND ImgVersion < ".ROMPR_IMAGE_VERSION, false, null, 'NumOldAlbums', 0); + logger::log("INIT", "There are ".$oa." albums with old-style album art"); + return $oa; +} + +function open_transaction() { + global $transaction_open, $mysqlc; + if (!$transaction_open) { + if ($mysqlc->beginTransaction()) { + $transaction_open = true; + } + } +} + +function check_transaction() { + global $numdone, $transaction_open; + if ($transaction_open) { + if ($numdone >= ROMPR_MAX_TRACKS_PER_TRANSACTION) { + close_transaction(); + open_transaction(); + } + } else { + logger::warn("BACKEND", "WARNING! check_transaction called when transaction not open!"); + } +} + +function close_transaction() { + global $transaction_open, $numdone, $mysqlc; + if ($transaction_open) { + if ($mysqlc->commit()) { + $transaction_open = false; + $numdone = 0; + } + } else { + logger::warn("BACKEND", "WARNING! close_transaction called when transaction not open!"); + } +} + +function saveCollectionPlayer($type) { + global $prefs; + logger::mark("COLLECTION", "Setting Collection Type to",$type); + switch ($type) { + case 'mopidy': + sql_prepare_query(true, null, null, null, + "UPDATE Statstable SET Value = ? WHERE Item = 'CollType'", 1); + $prefs['collection_player'] = 'mopidy'; + break; + + case 'mpd': + sql_prepare_query(true, null, null, null, + "UPDATE Statstable SET Value = ? WHERE Item = 'CollType'", 0); + $prefs['collection_player'] = 'mpd'; + break; + } + savePrefs(); +} + +function readCollectionPlayer($sp = treu) { + global $prefs; + $c = simple_query('Value', 'Statstable', 'Item', 'CollType', 999); + switch ($c) { + case 999: + logger::trace("COLLECTION", "Collection type from database is not set"); + logger::trace("COLLECTION", "Prefs collection_player is currently",$prefs['collection_player']); + $prefs['collection_player'] = null; + break; + + case 1: + logger::debug("COLLECTION", "Collection type from database is mopidy"); + $prefs['collection_player'] = 'mopidy'; + break; + + case 0: + logger::debug("COLLECTION", "Collection type from database is mpd"); + $prefs['collection_player'] = 'mpd'; + break; + } + if ($sp) { + savePrefs(); + } + return $c; +} + + +?> diff --git a/www/rompr/backends/sql/metadatafunctions.php b/www/rompr/backends/sql/metadatafunctions.php new file mode 100644 index 0000000..30bb1a5 --- /dev/null +++ b/www/rompr/backends/sql/metadatafunctions.php @@ -0,0 +1,878 @@ + artist_for_image($data['type'], $data['albumartist']), + 'album' => $data['album'] + )); + $data['imagekey'] = $albumimage->get_image_key(); + } + } + + public static function set($data, $keep_wishlist = false) { + global $returninfo; + if ($data['artist'] === null || + $data['title'] === null || + $data['attributes'] == null) { + logger::error("USERRATING", "Something is not set", $data); + header('HTTP/1.1 400 Bad Request'); + print json_encode(array('error' => 'Artist or Title or Attributes not set')); + exit(0); + } + + switch ($data['artist']) { + case 'geturisfordir': + $ttids = romprmetadata::geturisfordir($data); + break; + + case 'geturis': + $ttids = romprmetadata::geturis($data); + break; + + default: + $ttids = romprmetadata::find_item($data, forcedUriOnly($data['urionly'], getDomain($data['uri']))); + break; + } + + $newttids = array(); + foreach ($ttids as $ttid) { + if ($keep_wishlist || !track_is_wishlist($ttid)) { + $newttids[] = $ttid; + } + } + $ttids = $newttids; + + if (count($ttids) == 0) { + $ttids[0] = create_new_track($data); + logger::log("USERRATINGS", "Created New Track with TTindex ".$ttids[0]); + } + + if (count($ttids) > 0) { + if (romprmetadata::doTheSetting($ttids, $data['attributes'], $data['uri'])) { + } else { + header('HTTP/1.1 417 Expectation Failed'); + $returninfo['error'] = 'Setting attributes failed'; + } + } else { + logger::fail("USERRATING", "TTID Not Found"); + header('HTTP/1.1 417 Expectation Failed'); + $returninfo['error'] = 'TTindex not found'; + } + } + + public static function add($data, $urionly = true) { + // This is used for adding specific tracks so we need urionly to be true + // We don't simply call into this using 'set' with urionly set to true + // because that might result in the rating being changed + + // The only time we call inot this with $urionly set to false is when we're restoring a metadata + // backup. In that case we might be copying data from one setup to another and we might have + // the track already in local, so we don't want to add duplicates. Neither way is perfect but + // this makes most sense I think. + + global $returninfo; + $ttids = romprmetadata::find_item($data, $urionly); + + // As we check by URI we can only have one result. + $ttid = null; + if (count($ttids) > 0) { + $ttid = $ttids[0]; + if (track_is_hidden($ttid) || track_is_searchresult($ttid)) { + logger::mark("USERRATINGS", "Track ".$ttid." being added is a search result or a hidden track"); + // Setting attributes (Rating: 0) will unhide/un-searchify it. Ratings of 0 are got rid of + // by remove_cruft at the end, because they're meaningless + if ($data['attributes'] == null) { + $data['attributes'] = array(array('attribute' => 'Rating', 'value'=> 0)); + } + } else { + logger::warn("USERRATINGS", "Track being added already exists"); + } + } + + check_for_wishlist_track($data); + + if ($ttid == null) { + logger::log("USERRATINGS", "Creating Track being added"); + $ttid = create_new_track($data); + } + + romprmetadata::doTheSetting(array($ttid), $data['attributes'], $data['uri']); + } + + public static function inc($data) { + global $returninfo; + // NOTE : 'inc' does not do what you might expect. + // This is not an 'increment' function, it still does a SET but it will create a hidden track + // if the track can't be found, compare to SET which creates a new unhidden track. + if ($data['artist'] === null || + $data['title'] === null || + $data['attributes'] == null) { + logger::error("USERRATING", "Something is not set",$data); + header('HTTP/1.1 400 Bad Request'); + print json_encode(array('error' => 'Artist or Title or Attributes not set')); + exit(0); + } + $ttids = romprmetadata::find_item($data, forcedUriOnly(false,getDomain($data['uri']))); + if (count($ttids) == 0) { + logger::log("USERRATING", "Doing an INCREMENT action - Found NOTHING so creating hidden track"); + $data['hidden'] = 1; + $ttids[0] = create_new_track($data); + } + + romprmetadata::checkLastPlayed($data); + + if (count($ttids) > 0) { + foreach ($ttids as $ttid) { + logger::trace("USERRATING", "Doing an INCREMENT action - Found TTID ",$ttid); + foreach ($data['attributes'] as $pair) { + logger::log("USERRATING", "(Increment) Setting",$pair["attribute"],"to",$pair["value"],"on",$ttid); + romprmetadata::increment_value($ttid, $pair["attribute"], $pair["value"], $data['lastplayed']); + } + $returninfo['metadata'] = get_all_data($ttid); + } + } + return $ttids; + } + + private static function checkLastPlayed(&$data) { + if (array_key_exists('lastplayed', $data)) { + if (is_numeric($data['lastplayed'])) { + // Convert timestamp from LastFM into MySQL TIMESTAMP format + $data['lastplayed'] = date('Y-m-d H:i:s', $data['lastplayed']); + } + } else { + $data['lastplayed'] = date('Y-m-d H:i:s'); + } + } + + public static function syncinc($data) { + global $returninfo; + if ($data['artist'] === null || + $data['title'] === null || + $data['attributes'] == null) { + logger::error("SYNCINC", "Something is not set", $data); + header('HTTP/1.1 400 Bad Request'); + print json_encode(array('error' => 'Artist or Title or Attributes not set')); + exit(0); + } + + $ttids = romprmetadata::find_item($data, forcedUriOnly(false,getDomain($data['uri']))); + if (count($ttids) == 0) { + $ttids = romprmetadata::inc($data); + romprmetadata::resetSyncCounts($ttids); + return true; + } + + romprmetadata::checkLastPlayed($data); + logger::log("SYNCINC", "LastPlayed is ".$data['lastplayed']); + foreach ($ttids as $ttid) { + logger::log("SYNCINC", "Doing a SYNC action on TTID ".$ttid); + $rowcount = generic_sql_query("UPDATE Playcounttable SET SyncCount = SyncCount - 1, LastPlayed = '".$data['lastplayed']."' WHERE TTindex = ".$ttid." AND SyncCount > 0", + false, null, null, null, true); + if ($rowcount > 0) { + logger::log("SYNCINC", " Decremented sync counter for this track"); + } else { + $rowcount = generic_sql_query("UPDATE Playcounttable SET Playcount = Playcount + 1, LastPlayed = '".$data['lastplayed']."' WHERE TTindex = ".$ttid, + false, null, null, null, true); + if ($rowcount > 0) { + logger::log("SYNCINC", " Incremented Playcount for this track"); + // At this point, SyncCount must have been zero but the update will have incremented it again, + // because of the trigger. resetSyncCounts takes care of this; + } else { + logger::log("SYNCINC", " Track not found in Playcounttable"); + $metadata = get_all_data($ttid); + romprmetadata::increment_value($ttid, 'Playcount', $metadata['Playcount'] + 1, $data['lastplayed']); + // At this point, SyncCount must have been zero but the update will have incremented it again, + // because of the trigger. resetSyncCounts takes care of this; + } + romprmetadata::resetSyncCounts(array($ttid)); + } + } + } + + public static function resetSyncCounts($ttids) { + foreach ($ttids as $ttid) { + generic_sql_query("UPDATE Playcounttable SET SyncCount = 0 WHERE TTindex = ".$ttid, true); + } + } + + public static function resetallsyncdata() { + generic_sql_query('UPDATE Playcounttable SET SyncCount = 0 WHERE TTindex > 0', true); + } + + public static function remove($data) { + global $returninfo; + if ($data['artist'] === null || $data['title'] === null) { + header('HTTP/1.1 400 Bad Request'); + print json_encode(array('error' => 'Artist or Title not set')); + exit(0); + } + $ttids = romprmetadata::find_item($data, forcedUriOnly($data['urionly'], getDomain($data['uri']))); + if (count($ttids) > 0) { + foreach ($ttids as $ttid) { + $result = true; + foreach ($data['attributes'] as $pair) { + logger::trace("USERRATING", "Removing",$pair); + $r = romprmetadata::remove_tag($ttid, $pair["value"]); + if ($r == false) { + logger::fail("USERRATING", "FAILED Removing",$pair); + $result = false; + } + } + if ($result) { + $returninfo['metadata'] = get_all_data($ttid); + } else { + header('HTTP/1.1 417 Expectation Failed'); + $returninfo['error'] = 'Removing attributes failed'; + } + } + } else { + logger::fail("USERRATING", "TTID Not Found"); + header('HTTP/1.1 417 Expectation Failed'); + $returninfo['error'] = 'TTindex not found'; + } + } + + public static function get($data) { + global $returninfo, $nodata; + if ($data['artist'] === null || $data['title'] === null) { + header('HTTP/1.1 400 Bad Request'); + print json_encode(array('error' => 'Artist or Title not set')); + exit(0); + } + $ttids = romprmetadata::find_item($data, forcedUriOnly(false, getDomain($data['uri']))); + if (count($ttids) > 0) { + $ttid = array_shift($ttids); + $returninfo = get_all_data($ttid); + } else { + $returninfo = $nodata; + } + } + + public static function setalbummbid($data) { + global $returninfo, $nodata; + $ttids = romprmetadata::find_item($data, forcedUriOnly(false, getDomain($data['uri']))); + if (count($ttids) > 0) { + foreach ($ttids as $ttid) { + logger::log("BACKEND", "Updating album MBID ".$data['attributes']." from TTindex ".$ttid); + $albumindex = simple_query('Albumindex', 'Tracktable', 'TTindex', $ttid, null); + logger::trace("BACKEND", " .. album index is ".$albumindex); + sql_prepare_query(true, null, null, null, "UPDATE Albumtable SET mbid = ? WHERE Albumindex = ? AND mbid IS NULL",$data['attributes'],$albumindex); + } + } + $returninfo = $nodata; + } + + public static function cleanup($data) { + logger::log("SQL", "Doing Database Cleanup And Stats Update"); + remove_cruft(); + update_track_stats(); + doCollectionHeader(); + } + + public static function amendalbum($data) { + if ($data['albumindex'] !== null && romprmetadata::amend_album($data['albumindex'], $data['albumartist'], $data['date'])) { + } else { + header('HTTP/1.1 400 Bad Request'); + $returninfo['error'] = 'That just did not work'; + } + } + + public static function deletetag($data) { + if (romprmetadata::remove_tag_from_db($data['value'])) { + } else { + header('HTTP/1.1 400 Bad Request'); + $returninfo['error'] = 'Well, that went well'; + } + } + + public static function delete($data) { + $ttids = romprmetadata::find_item($data, true); + if (count($ttids) == 0) { + header('HTTP/1.1 400 Bad Request'); + $returninfo['error'] = 'TTindex not found'; + } else { + romprmetadata::delete_track(array_shift($ttids)); + } + } + + public static function deletewl($data) { + romprmetadata::delete_track($data['wltrack']); + } + + public static function deleteid($data) { + romprmetadata::delete_track($data['ttid']); + } + + public static function getcharts($data) { + global $returninfo; + $returninfo['Artists'] = get_artist_charts(); + $returninfo['Albums'] = get_album_charts(); + $returninfo['Tracks'] = get_track_charts(); + } + + public static function clearwishlist() { + logger::log("MONKEYS", "Removing Wishlist Tracks"); + if (clear_wishlist()) { + logger::log("MONKEYS", " ... Success!"); + } else { + logger::warn("MONKEYS", "Failed removing wishlist tracks"); + } + } + + // Private Functions + + static function geturisfordir($data) { + global $PLAYER_TYPE; + $player = new $PLAYER_TYPE(); + $uris = $player->get_uris_for_directory($data['uri']); + $ttids = array(); + foreach ($uris as $uri) { + $t = sql_prepare_query(false, PDO::FETCH_COLUMN, 'TTindex', null, "SELECT TTindex FROM Tracktable WHERE Uri = ?", $uri); + $ttids = array_merge($ttids, $t); + } + return $ttids; + } + + static function geturis($data) { + $uris = getItemsToAdd($data['uri'], ""); + $ttids = array(); + foreach ($uris as $uri) { + $uri = trim(substr($uri, strpos($uri, ' ')+1, strlen($uri)), '"'); + $r = sql_prepare_query(false, PDO::FETCH_COLUMN, 'TTindex', null, "SELECT TTindex FROM Tracktable WHERE Uri = ?", $uri); + $ttids = array_merge($ttids, $t); + } + return $ttids; + } + + static function print_debug_ttids($ttids, $s) { + $time = time() - $s; + if (count($ttids) > 0) { + logger::log("TIMINGS", " Found TTindex(es)",$ttids,"in",$time,"seconds"); + } + } + + static function find_item($data,$urionly) { + + // romprmetadata::find_item + // Looks for a track in the database based on uri, title, artist, album, and albumartist or + // combinations of those + // Returns: Array of TTindex + + // romprmetadata::find_item is used by userRatings to find tracks on which to update or display metadata. + // It is NOT used when the collection is created + + // When Setting Metadata we do not use a URI because we might have mutliple versions of the + // track in the database or someone might be rating a track from Spotify that they already have + // in Local. So in this case we check using an increasingly wider check to find the track, + // returning as soon as one of these produces matches. + // First by Title, TrackNo, AlbumArtist and Album + // Third by Track, Album Artist, and Album + // Then by Track, Track Artist, and Album + // Then by Track, Artist, and Album NULL (meaning wishlist) + // We return ALL tracks found, because you might have the same track on multiple backends, + // and set metadata on them all. + // This means that when getting metadata it doesn't matter which one we match on. + // When we Get Metadata we do supply a URI BUT we don't use it if we have one, just because. + // $urionly can be set to force looking up only by URI. This is used by when we need to import a + // specific version of the track - currently from either the Last.FM importer or when we add a + // spotify album to the collection + + // If we don't supply an album to this function that's because we're listening to the radio. + // In that case we look for a match where there is something in the album field and then for + // where album is NULL + + // FIXME! There is one scenario where the above fails. + // If you tag or rate a track, and then add it to the collection again from another backend + // later on, the rating doesn't get picked up by the new copy. + // Looking everything up by name/album/artist (i.e. ignoring the URI in romprmetadata::find_item) + // doesn't fix this because the collection display still doesn't show the rating as that's + // looked up by TTindex + + $start_time = time(); + logger::shout("FIND ITEM", "Looking for item ".$data['title']); + $ttids = array(); + if ($urionly && $data['uri']) { + logger::mark("FIND ITEM", " Trying by URI ".$data['uri']); + $t = sql_prepare_query(false, PDO::FETCH_COLUMN, 'TTindex', null, "SELECT TTindex FROM Tracktable WHERE Uri = ?", $data['uri']); + $ttids = array_merge($ttids, $t); + } + + if ($data['artist'] == null || $data['title'] == null || ($urionly && $data['uri'])) { + romprmetadata::print_debug_ttids($ttids, $start_time); + return $ttids; + } + + if (count($ttids) == 0) { + if ($data['album']) { + if ($data['albumartist'] !== null && $data['trackno'] != 0) { + logger::mark("FIND ITEM", " Trying by albumartist",$data['albumartist'],"album",$data['album'],"title",$data['title'],"track number",$data['trackno']); + $t = sql_prepare_query(false, PDO::FETCH_COLUMN, 'TTindex', null, + "SELECT + TTindex + FROM + Tracktable JOIN Albumtable USING (Albumindex) + JOIN Artisttable ON Albumtable.AlbumArtistindex = Artisttable.Artistindex + WHERE + LOWER(Title) = LOWER(?) + AND LOWER(Artistname) = LOWER(?) + AND LOWER(Albumname) = LOWER(?) + AND TrackNo = ?", + $data['title'], $data['albumartist'], $data['album'], $data['trackno']); + $ttids = array_merge($ttids, $t); + } + + if (count($ttids) == 0 && $data['albumartist'] !== null) { + logger::mark("FIND ITEM", " Trying by albumartist",$data['albumartist'],"album",$data['album'],"and title",$data['title']); + $t = sql_prepare_query(false, PDO::FETCH_COLUMN, 'TTindex', null, + "SELECT + TTindex + FROM + Tracktable JOIN Albumtable USING (Albumindex) + JOIN Artisttable ON Albumtable.AlbumArtistindex = Artisttable.Artistindex + WHERE + LOWER(Title) = LOWER(?) + AND LOWER(Artistname) = LOWER(?) + AND LOWER(Albumname) = LOWER(?)", + $data['title'], $data['albumartist'], $data['album']); + $ttids = array_merge($ttids, $t); + } + + if (count($ttids) == 0 && ($data['albumartist'] == null || $data['albumartist'] == $data['artist'])) { + logger::mark("FIND ITEM", " Trying by artist",$data['artist'],",album",$data['album'],"and title",$data['title']); + $t = sql_prepare_query(false, PDO::FETCH_COLUMN, 'TTindex', null, + "SELECT + TTindex + FROM + Tracktable JOIN Artisttable USING (Artistindex) + JOIN Albumtable USING (Albumindex) + WHERE + LOWER(Title) = LOWER(?) + AND LOWER(Artistname) = LOWER(?) + AND LOWER(Albumname) = LOWER(?)", $data['title'], $data['artist'], $data['album']); + $ttids = array_merge($ttids, $t); + } + + // Finally look for Uri NULL which will be a wishlist item added via a radio station + if (count($ttids) == 0) { + logger::mark("FIND ITEM", " Trying by (wishlist) artist",$data['artist'],"and title",$data['title']); + $t = sql_prepare_query(false, PDO::FETCH_COLUMN, 'TTindex', null, + "SELECT + TTindex + FROM + Tracktable JOIN Artisttable USING (Artistindex) + WHERE + LOWER(Title) = LOWER(?) + AND LOWER(Artistname) = LOWER(?) + AND Uri IS NULL", + $data['title'], $data['artist']); + $ttids = array_merge($ttids, $t); + } + } else { + // No album supplied - ie this is from a radio stream. First look for a match where + // there is something in the album field + logger::mark("FIND ITEM", " Trying by artist",$data['artist'],"Uri NOT NULL and title",$data['title']); + $t = sql_prepare_query(false, PDO::FETCH_COLUMN, 'TTindex', null, + "SELECT + TTindex + FROM + Tracktable JOIN Artisttable USING (Artistindex) + WHERE + LOWER(Title) = LOWER(?) + AND LOWER(Artistname) = LOWER(?) + AND Uri IS NOT NULL", $data['title'], $data['artist']); + $ttids = array_merge($ttids, $t); + + if (count($ttids) == 0) { + logger::mark("FIND ITEM", " Trying by (wishlist) artist",$data['artist'],"and title",$data['title']); + $t = sql_prepare_query(false, PDO::FETCH_COLUMN, 'TTindex', null, + "SELECT + TTindex + FROM + Tracktable JOIN Artisttable USING (Artistindex) + WHERE + LOWER(Title) = LOWER(?) + AND LOWER(Artistname) = LOWER(?) + AND Uri IS NULL", $data['title'], $data['artist']); + $ttids = array_merge($ttids, $t); + } + } + } + romprmetadata::print_debug_ttids($ttids, $start_time); + return $ttids; + } + + static function increment_value($ttid, $attribute, $value, $lp) { + + // Increment_value doesn't 'increment' as such - it's used for setting values on tracks without + // unhiding them. It's used for Playcount, which was originally an 'increment' type function but + // that changed because multiple rompr instances cause multiple increments + + logger::mark("INCREMENT", "Setting",$attribute,"to",$value,"for TTID",$ttid); + if (sql_prepare_query(true, null, null, null, "REPLACE INTO ".$attribute."table (TTindex, ".$attribute.", LastPlayed) VALUES (?, ?, ?)", $ttid, $value, $lp)) { + logger::trace("INCREMENT", " .. success"); + } else { + logger::fail("INCREMENT", "FAILED Setting",$attribute,"to",$value,"for TTID",$ttid); + return false; + } + return true; + + } + + static function set_attribute($ttid, $attribute, $value) { + + // set_attribute + // Sets an attribute (Rating, Tag etc) on a TTindex. + logger::mark("ATTRIBUTE", "Setting",$attribute,"to",$value,"on",$ttid); + if (sql_prepare_query(true, null, null, null, "REPLACE INTO ".$attribute."table (TTindex, ".$attribute.") VALUES (?, ?)", $ttid, $value)) { + logger::trace("ATTRIBUTE", " .. success"); + } else { + logger::fail("ATTRIBUTE", "FAILED Setting",$attribute,"to",$value,"on",$ttid); + return false; + } + return true; + } + + static function doTheSetting($ttids, $attributes, $uri) { + global $returninfo; + $result = true; + logger::trace("USERRATING", "Checking For attributes"); + if ($attributes !== null) { + logger::trace("USERRATING", "Setting attributes"); + foreach($ttids as $ttid) { + logger::debug("USERRATING", "TTid ".$ttid); + foreach ($attributes as $pair) { + logger::log("USERRATING", "Setting",$pair["attribute"],"to",$pair['value'],"on TTindex",$ttid); + switch ($pair['attribute']) { + case 'Tags': + $result = romprmetadata::addTags($ttid, $pair['value']); + break; + + default: + $result = romprmetadata::set_attribute($ttid, $pair["attribute"], $pair["value"]); + break; + } + if (!$result) { break; } + } + if ($uri) { + $returninfo['metadata'] = get_all_data($ttid); + } + } + } + return $result; + } + + static function addTags($ttid, $tags) { + + // addTags + // Add a list of tags to a TTindex + + foreach ($tags as $tag) { + $t = trim($tag); + if ($t == '') continue; + logger::mark("ADD TAGS", "Adding Tag",$t,"to TTindex",$ttid); + $tagindex = sql_prepare_query(false, null, 'Tagindex', null, "SELECT Tagindex FROM Tagtable WHERE Name=?", $t); + if ($tagindex == null) $tagindex = romprmetadata::create_new_tag($t); + if ($tagindex == null) { + logger::fail("ADD TAGS", " Could not create tag",$t); + return false; + } + + if ($result = generic_sql_query("INSERT INTO TagListtable (TTindex, Tagindex) VALUES ('".$ttid."', '".$tagindex."')", true)) { + logger::trace("ADD TAGS", "Success"); + } else { + // Doesn't matter, we have a UNIQUE constraint on both columns to prevent us adding the same tag twice + logger::debug("ADD TAGS", " .. Failed but that's OK if it's because of a duplicate entry or UNQIUE constraint"); + } + } + return true; + } + + static function create_new_tag($tag) { + + // create_new_tags + // Creates a new entry in Tagtable + // Returns: Tagindex + + global $mysqlc; + logger::mark("CREATE TAG", "Creating new tag",$tag); + $tagindex = null; + if (sql_prepare_query(true, null, null, null, "INSERT INTO Tagtable (Name) VALUES (?)", $tag)) { + $tagindex = $mysqlc->lastInsertId(); + } + return $tagindex; + } + + static function remove_tag($ttid, $tag) { + + // remove_tags + // Removes a tag relation from a TTindex + + logger::mark("REMOVE TAG", "Removing Tag",$tag,"from TTindex",$ttid); + $retval = false; + if ($tagindex = simple_query('Tagindex', 'Tagtable', 'Name', $tag, false)) { + $retval = generic_sql_query("DELETE FROM TagListtable WHERE TTindex = '".$ttid."' AND Tagindex = '".$tagindex."'", true); + } else { + logger::fail("REMOVE TAG", " .. Could not find tag",$tag); + } + return $retval; + } + + static function remove_tag_from_db($tag) { + logger::mark("REMOVE TAG", "Removing Tag",$tag,",from database"); + return sql_prepare_query(true, null, null, null, "DELETE FROM Tagtable WHERE Name=?", $tag); + } + + static function delete_track($ttid) { + if (remove_ttid($ttid)) { + } else { + header('HTTP/1.1 400 Bad Request'); + } + } + + static function amend_album($albumindex, $newartist, $date) { + logger::mark("AMEND ALBUM", "Updating Album index",$albumindex,"with new artist",$newartist,"and new date",$date); + $artistindex = ($newartist == null) ? null : check_artist($newartist); + $result = sql_prepare_query(false, PDO::FETCH_OBJ, null, null, "SELECT * FROM Albumtable WHERE Albumindex = ?", $albumindex); + $obj = array_shift($result); + if ($obj) { + $params = array( + 'album' => $obj->Albumname, + 'albumai' => ($artistindex == null) ? $obj->AlbumArtistindex : $artistindex, + 'albumuri' => $obj->AlbumUri, + 'image' => $obj->Image, + 'date' => ($date == null) ? $obj->Year : $date, + 'searched' => $obj->Searched, + 'imagekey' => $obj->ImgKey, + 'ambid' => $obj->mbid, + 'domain' => $obj->Domain); + $newalbumindex = check_album($params); + if ($albumindex != $newalbumindex) { + logger::log("AMEND ALBUM", "Moving all tracks from album",$albumindex,"to album",$newalbumindex); + if (sql_prepare_query(true, null, null, null, "UPDATE Tracktable SET Albumindex = ? WHERE Albumindex = ?", $newalbumindex, $albumindex)) { + logger::trace("AMEND ALBUM", "...Success"); + } else { + logger::fail("AMEND ALBUM", "Track move Failed!"); + return false; + } + } + } else { + logger::error("AMEND ALBUM", "Failed to find album to update!"); + return false; + } + return true; + } + +} + +function forcedUriOnly($u,$d) { + + // Some mopidy backends - YouTube and SoundCloud - can return the same artist/album/track info + // for multiple different tracks. + // This gives us a problem because romprmetadata::find_item will think they're the same. + // So for those backends we always force urionly to be true + logger::debug("USERRATINGS", "Checking domain : ".$d); + + if ($u || $d == "youtube" || $d == "soundcloud") { + return true; + } else { + return false; + } + +} + +function preparePlaylist() { + generic_sql_query("DROP TABLE IF EXISTS pltable", true); + generic_sql_query("CREATE TABLE pltable(TTindex INT UNSIGNED NOT NULL UNIQUE)", true); +} + +function preparePlTrackTable() { + generic_sql_query("DROP TABLE IF EXISTS pltracktable", true); + generic_sql_query("CREATE TABLE pltracktable(TTindex INT UNSIGNED NOT NULL UNIQUE)", true); +} + +function doPlaylist($playlist, $limit) { + global $prefs; + logger::blurt("SMARTRADIO", "Loading Playlist",$playlist,'limit',$limit); + $sqlstring = ""; + $tags = null; + $random = true; + switch($playlist) { + case "1stars": + $sqlstring = "SELECT TTindex FROM Tracktable JOIN Ratingtable USING (TTindex) WHERE Uri + IS NOT NULL AND Hidden=0 AND isSearchResult < 2 AND Rating > 0"; + break; + case "2stars": + $sqlstring = "SELECT TTindex FROM Tracktable JOIN Ratingtable USING (TTindex) WHERE Uri + IS NOT NULL AND Hidden=0 AND isSearchResult < 2 AND Rating > 1"; + break; + case "3stars": + $sqlstring = "SELECT TTindex FROM Tracktable JOIN Ratingtable USING (TTindex) WHERE Uri + IS NOT NULL AND Hidden=0 AND isSearchResult < 2 AND Rating > 2"; + break; + case "4stars": + $sqlstring = "SELECT TTindex FROM Tracktable JOIN Ratingtable USING (TTindex) WHERE Uri + IS NOT NULL AND Hidden=0 AND isSearchResult < 2 AND Rating > 3"; + break; + case "5stars": + $sqlstring = "SELECT TTindex FROM Tracktable JOIN Ratingtable USING (TTindex) WHERE Uri + IS NOT NULL AND Hidden=0 AND isSearchResult < 2 AND Rating > 4"; + break; + case "favealbums": + case "recentlyadded_byalbum": + // This is a rather odd SQL query but it needs a WHERE clause and a JOIN with Tracktable + // in order to work with the generic track dumping functions + $sqlstring = "SELECT TTindex FROM pltracktable JOIN Tracktable USING (TTindex) WHERE TTindex > 0"; + $random = false; + break; + + case "recentlyadded_random": + $sqlstring = "SELECT TTindex FROM pltracktable JOIN Tracktable USING (TTindex) WHERE TTindex > 0"; + break; + + case "mostplayed": + // Used to be tracks with above average playcount, now also includes any rated tracks. + // Still called mostplayed :) + $avgplays = getAveragePlays(); + $sqlstring = "SELECT TTindex FROM Tracktable JOIN Playcounttable USING (TTindex) + LEFT JOIN Ratingtable USING (TTindex) WHERE Uri IS NOT NULL AND Hidden = 0 AND + isSearchResult < 2 AND (Playcount > ".$avgplays." OR Rating IS NOT NULL)"; + break; + + case "allrandom": + $sqlstring = "SELECT TTindex FROM Tracktable WHERE Uri IS NOT NULL AND Hidden=0 AND + isSearchResult < 2"; + break; + + case "neverplayed": + // LEFT JOIN (used here and above) means that the right-hand side of the JOIN will be + // NULL if TTindex doesn't exist on that side. Very handy. + $sqlstring = "SELECT Tracktable.TTindex FROM Tracktable LEFT JOIN Playcounttable ON + Tracktable.TTindex = Playcounttable.TTindex WHERE Playcounttable.TTindex IS NULL"; + break; + + case "recentlyplayed": + $sqlstring = recently_played_playlist(); + break; + + default: + if (preg_match('/tag\+(.*)/', $playlist, $matches)) { + $taglist = explode(',', $matches[1]); + $sqlstring = 'SELECT DISTINCT TTindex FROM Tracktable JOIN TagListtable USING (TTindex) JOIN Tagtable USING (Tagindex) WHERE '; + // Concatenate this bracket here otherwise Atom's syntax colouring goes haywire + $sqlstring .= '('; + $tags = array(); + foreach ($taglist as $i => $tag) { + logger::mark("SMART RADIO", "Getting tag playlist for",$tag); + $tags[] = trim($tag); + if ($i > 0) { + $sqlstring .= " OR "; + } + $sqlstring .= "Tagtable.Name = ?"; + } + $sqlstring .= ") AND Tracktable.Uri IS NOT NULL AND Tracktable.Hidden = 0 AND + Tracktable.isSearchResult < 2 "; + } else { + logger::fail("SMART RADIO", "Unrecognised playlist",$playlist); + } + break; + } + $sqlstring .= ' AND (LinkChecked = 0 OR LinkChecked = 2) AND isAudiobook = 0'; + if ($prefs['collection_player'] == 'mopidy' && $prefs['player_backend'] == 'mpd') { + $sqlstring .= ' AND Uri LIKE "local:%"'; + } + $uris = getAllURIs($sqlstring, $limit, $tags, $random); + $json = array(); + foreach ($uris as $u) { + $json[] = array( 'type' => 'uri', 'name' => $u); + } + return $json; +} + +function getAllURIs($sqlstring, $limit, $tags, $random = true) { + + // Get all track URIs using a supplied SQL string. For playlist generators + $uris = array(); + $tries = 0; + do { + if ($tries == 1) { + logger::log("SMART PLAYLIST", "No URIs found. Resetting history table"); + preparePlaylist(); + } + generic_sql_query("CREATE TEMPORARY TABLE IF NOT EXISTS pltemptable(TTindex INT UNSIGNED NOT NULL UNIQUE)", true); + theBabyDumper($sqlstring, $limit, $tags, $random); + $uris = sql_get_column("SELECT Uri FROM Tracktable WHERE TTindex IN (SELECT TTindex FROM pltemptable)", 0); + $tries++; + } while (count($uris) == 0 && $tries < 2); + generic_sql_query("INSERT INTO pltable (TTindex) SELECT TTindex FROM pltemptable", true); + return $uris; +} + +function theBabyDumper($sqlstring, $limit, $tags, $random) { + logger::trace("SMART PLAYLIST", "Selector is ".$sqlstring); + $rndstr = $random ? " ORDER BY ".SQL_RANDOM_SORT : " ORDER BY Albumindex, TrackNo"; + if ($tags) { + sql_prepare_query(true, null, null, null, + "INSERT INTO pltemptable(TTindex) ".$sqlstring. + " AND NOT Tracktable.TTindex IN (SELECT TTindex FROM pltable)".$rndstr." LIMIT ".$limit, $tags); + } else { + generic_sql_query( + "INSERT INTO pltemptable(TTindex) ".$sqlstring. + " AND NOT Tracktable.TTindex IN (SELECT TTindex FROM pltable)".$rndstr." LIMIT ".$limit, true); + } +} + +function getAveragePlays() { + $avgplays = simple_query('avg(Playcount)', 'Playcounttable', null, null, 0); + return round($avgplays, 0, PHP_ROUND_HALF_DOWN); +} + +?> diff --git a/www/rompr/backends/sql/mysql/specifics.php b/www/rompr/backends/sql/mysql/specifics.php new file mode 100644 index 0000000..2ec4a31 --- /dev/null +++ b/www/rompr/backends/sql/mysql/specifics.php @@ -0,0 +1,960 @@ +getMessage()); + } +} + +function close_database() { + global $mysqlc; + $mysqlc = null; +} + +function check_sql_tables() { + global $mysqlc, $prefs; + if (generic_sql_query("CREATE TABLE IF NOT EXISTS Tracktable(". + "TTindex INT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE, ". + "PRIMARY KEY(TTindex), ". + "Title VARCHAR(255), ". + "Albumindex INT UNSIGNED, ". + "TrackNo SMALLINT UNSIGNED, ". + "Duration INT UNSIGNED, ". + "Artistindex INT UNSIGNED, ". + "Disc TINYINT(3) UNSIGNED, ". + "Uri VARCHAR(2000), ". + "LastModified CHAR(32), ". + "Hidden TINYINT(1) UNSIGNED DEFAULT 0, ". + "DateAdded TIMESTAMP DEFAULT CURRENT_TIMESTAMP, ". + "isSearchResult TINYINT(1) UNSIGNED DEFAULT 0, ". + "justAdded TINYINT(1) UNSIGNED DEFAULT 1, ". + "Sourceindex INT UNSIGNED DEFAULT NULL, ". + "LinkChecked TINYINT(1) UNSIGNED DEFAULT 0, ". + "isAudiobook TINYINT(1) UNSIGNED DEFAULT 0, ". + "INDEX(Albumindex), ". + "INDEX(Title), ". + "INDEX(TrackNo)) ENGINE=InnoDB", true)) + { + logger::log("MYSQL_CONNECT", " Tracktable OK"); + } else { + $err = $mysqlc->errorInfo()[2]; + return array(false, "Error While Checking Tracktable : ".$err); + } + + if (generic_sql_query("CREATE TABLE IF NOT EXISTS Albumtable(". + "Albumindex INT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE, ". + "PRIMARY KEY(Albumindex), ". + "Albumname VARCHAR(255), ". + "AlbumArtistindex INT UNSIGNED, ". + "AlbumUri VARCHAR(255), ". + "Year YEAR, ". + "Searched TINYINT(1) UNSIGNED, ". + "ImgKey CHAR(32), ". + "mbid CHAR(40), ". + "ImgVersion INT UNSIGNED DEFAULT ".ROMPR_IMAGE_VERSION.", ". + "Domain CHAR(32), ". + "Image VARCHAR(255), ". + "justUpdated TINYINT(1) UNSIGNED DEFAULT 1, ". + "INDEX(Albumname), ". + "INDEX(AlbumArtistindex), ". + "INDEX(Domain), ". + "INDEX(ImgKey)) ENGINE=InnoDB", true)) + { + logger::log("MYSQL_CONNECT", " Albumtable OK"); + } else { + $err = $mysqlc->errorInfo()[2]; + return array(false, "Error While Checking Albumtable : ".$err); + } + + if (generic_sql_query("CREATE TABLE IF NOT EXISTS Artisttable(". + "Artistindex INT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE, ". + "PRIMARY KEY(Artistindex), ". + "Artistname VARCHAR(255), ". + "INDEX(Artistname)) ENGINE=InnoDB", true)) + { + logger::log("MYSQL_CONNECT", " Artisttable OK"); + } else { + $err = $mysqlc->errorInfo()[2]; + return array(false, "Error While Checking Artisttable : ".$err); + } + + if (generic_sql_query("CREATE TABLE IF NOT EXISTS Ratingtable(". + "TTindex INT UNSIGNED, ". + "PRIMARY KEY(TTindex), ". + "Rating TINYINT(1) UNSIGNED) ENGINE=InnoDB", true)) + { + logger::log("MYSQL_CONNECT", " Ratingtable OK"); + } else { + $err = $mysqlc->errorInfo()[2]; + return array(false, "Error While Checking Ratingtable : ".$err); + } + + if (generic_sql_query("CREATE TABLE IF NOT EXISTS Progresstable(". + "TTindex INT UNSIGNED, ". + "PRIMARY KEY(TTindex), ". + "Progress INT UNSIGNED) ENGINE=InnoDB", true)) + { + logger::log("MYSQL_CONNECT", " Progresstable OK"); + } else { + $err = $mysqlc->errorInfo()[2]; + return array(false, "Error While Checking Progresstable : ".$err); + } + + if (generic_sql_query("CREATE TABLE IF NOT EXISTS Tagtable(". + "Tagindex INT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE, ". + "PRIMARY KEY(Tagindex), ". + "Name VARCHAR(255)) ENGINE=InnoDB", true)) + { + logger::log("MYSQL_CONNECT", " Tagtable OK"); + } else { + $err = $mysqlc->errorInfo()[2]; + return array(false, "Error While Checking Tagtable : ".$err); + } + + if (generic_sql_query("CREATE TABLE IF NOT EXISTS TagListtable(". + "Tagindex INT UNSIGNED NOT NULL REFERENCES Tagtable(Tagindex), ". + "TTindex INT UNSIGNED NOT NULL REFERENCES Tracktable(TTindex), ". + "PRIMARY KEY (Tagindex, TTindex)) ENGINE=InnoDB", true)) + { + logger::log("MYSQL_CONNECT", " TagListtable OK"); + } else { + $err = $mysqlc->errorInfo()[2]; + return array(false, "Error While Checking TagListtable : ".$err); + } + + if (generic_sql_query("CREATE TABLE IF NOT EXISTS Playcounttable(". + "TTindex INT UNSIGNED NOT NULL REFERENCES Tracktable(TTindex), ". + "Playcount INT UNSIGNED NOT NULL, ". + "SyncCount INT UNSIGNED DEFAULT 0, ". + "LastPlayed TIMESTAMP, ". + "PRIMARY KEY (TTindex)) ENGINE=InnoDB", true)) + { + logger::log("MYSQL_CONNECT", " Playcounttable OK"); + } else { + $err = $mysqlc->errorInfo()[2]; + return array(false, "Error While Checking Playcounttable : ".$err); + } + + if (generic_sql_query("CREATE TABLE IF NOT EXISTS Podcasttable(". + "PODindex INT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE, ". + "FeedURL TEXT, ". + "LastUpdate INT UNSIGNED, ". + "Image VARCHAR(255), ". + "Title VARCHAR(255), ". + "Artist VARCHAR(255), ". + "RefreshOption TINYINT(2) UNSIGNED DEFAULT 0, ". + "SortMode TINYINT(2) UNSIGNED DEFAULT 0, ". + "HideDescriptions TINYINT(1) UNSIGNED DEFAULT 0, ". + "DisplayMode TINYINT(2) UNSIGNED DEFAULT 0, ". + "DaysToKeep INT UNSIGNED DEFAULT 0, ". + "NumToKeep INT UNSIGNED DEFAULT 0, ". + "KeepDownloaded TINYINT(1) UNSIGNED DEFAULT 0, ". + "AutoDownload TINYINT(1) UNSIGNED DEFAULT 0, ". + "DaysLive INT, ". + "Version TINYINT(2), ". + "Subscribed TINYINT(1) NOT NULL DEFAULT 1, ". + "Description TEXT, ". + "LastPubDate INT UNSIGNED DEFAULT NULL, ". + "Category VARCHAR(255) NOT NULL, ". + "PRIMARY KEY (PODindex)) ENGINE=InnoDB", true)) + { + logger::log("MYSQL_CONNECT", " Podcasttable OK"); + } else { + $err = $mysqlc->errorInfo()[2]; + return array(false, "Error While Checking Podcasttable : ".$err); + } + + if (generic_sql_query("CREATE TABLE IF NOT EXISTS PodcastTracktable(". + "PODTrackindex INT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE, ". + "JustUpdated TINYINT(1), ". + "PODindex INT UNSIGNED, ". + "Title VARCHAR(255), ". + "Artist VARCHAR(255), ". + "Duration INT UNSIGNED, ". + "PubDate INT, ". + "FileSize INT UNSIGNED, ". + "Description TEXT, ". + "Link TEXT, ". + "Guid TEXT, ". + "Localfilename VARCHAR(255), ". + "Downloaded TINYINT(1) UNSIGNED DEFAULT 0, ". + "Listened TINYINT(1) UNSIGNED DEFAULT 0, ". + "New TINYINT(1) UNSIGNED DEFAULT 1, ". + "Deleted TINYINT(1) UNSIGNED DEFAULT 0, ". + "Progress INT UNSIGNED DEFAULT 0, ". + "INDEX (PODindex), ". + "PRIMARY KEY (PODTrackindex), ". + "INDEX (Title)) ENGINE=InnoDB", true)) + { + logger::log("MYSQL_CONNECT", " PodcastTracktable OK"); + } else { + $err = $mysqlc->errorInfo()[2]; + return array(false, "Error While Checking PodcastTracktable : ".$err); + } + + if (generic_sql_query("CREATE TABLE IF NOT EXISTS RadioStationtable(". + "Stationindex INT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE, ". + "Number SMALLINT UNSIGNED DEFAULT 65535, ". + "IsFave TINYINT(1), ". + "StationName VARCHAR(255), ". + "PlaylistUrl TEXT, ". + "Image VARCHAR(255), ". + "PRIMARY KEY (Stationindex)) ENGINE=InnoDB", true)) + { + logger::log("MYSQL_CONNECT", " RadioStationtable OK"); + } else { + $err = $mysqlc->errorInfo()[2]; + return array(false, "Error While Checking RadioStationtable : ".$err); + } + + if (generic_sql_query("CREATE TABLE IF NOT EXISTS RadioTracktable(". + "Trackindex INT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE, ". + "Stationindex INT UNSIGNED REFERENCES RadioStationtable(Stationindex), ". + "TrackUri TEXT, ". + "PrettyStream TEXT, ". + "PRIMARY KEY (Trackindex)) ENGINE=InnoDB", true)) + { + logger::log("MYSQL_CONNECT", " RadioTracktable OK"); + } else { + $err = $mysqlc->errorInfo()[2]; + return array(false, "Error While Checking RadioTracktable : ".$err); + } + + if (generic_sql_query("CREATE TABLE IF NOT EXISTS WishlistSourcetable(". + "Sourceindex INT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE, ". + "SourceName VARCHAR(255), ". + "SourceImage VARCHAR(255), ". + "SourceUri TEXT, ". + "PRIMARY KEY (Sourceindex)) ENGINE=InnoDB", true)) + { + logger::log("MYSQL_CONNECT", " WishlistSourcetable OK"); + } else { + $err = $mysqlc->errorInfo()[2]; + return array(false, "Error While Checking WishlistSourcetable : ".$err); + } + + if (generic_sql_query("CREATE TABLE IF NOT EXISTS AlbumsToListenTotable(". + "Listenindex INT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE, ". + "JsonData TEXT, ". + "PRIMARY KEY (Listenindex)) ENGINE=InnoDB", true)) + { + logger::log("MYSQL_CONNECT", " AlbumsToListenTotabletable OK"); + } else { + $err = $mysqlc->errorInfo()[2]; + return array(false, "Error While Checking AlbumsToListenTotable : ".$err); + } + + if (generic_sql_query("CREATE TABLE IF NOT EXISTS BackgroundImageTable(". + "BgImageIndex INT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE, ". + "Skin VARCHAR(255), ". + "BrowserID VARCHAR(20) DEFAULT NULL, ". + "Filename VARCHAR(255), ". + "Orientation TINYINT(2), ". + "PRIMARY KEY (BgImageIndex), ". + "INDEX (Skin), ". + "INDEX (BrowserID)) ENGINE=InnoDB", true)) + { + logger::log("MYSQL_CONNECT", " BackgounrdImageTable OK"); + } else { + $err = $mysqlc->errorInfo()[2]; + return array(false, "Error While Checking BackgroundImageTable : ".$err); + } + + if (!generic_sql_query("CREATE TABLE IF NOT EXISTS Statstable(Item CHAR(11), PRIMARY KEY(Item), Value INT UNSIGNED) ENGINE=InnoDB", true)) { + $err = $mysqlc->errorInfo()[2]; + return array(false, "Error While Checking Statstable : ".$err); + } + // Check schema version and update tables as necessary + $sv = simple_query('Value', 'Statstable', 'Item', 'SchemaVer', 0); + if ($sv == 0) { + logger::log("SQL_CONNECT", "No Schema Version Found - initialising table"); + generic_sql_query("INSERT INTO Statstable (Item, Value) VALUES ('ListVersion', '0')", true); + generic_sql_query("INSERT INTO Statstable (Item, Value) VALUES ('ArtistCount', '0')", true); + generic_sql_query("INSERT INTO Statstable (Item, Value) VALUES ('AlbumCount', '0')", true); + generic_sql_query("INSERT INTO Statstable (Item, Value) VALUES ('TrackCount', '0')", true); + generic_sql_query("INSERT INTO Statstable (Item, Value) VALUES ('TotalTime', '0')", true); + generic_sql_query("INSERT INTO Statstable (Item, Value) VALUES ('CollType', '999')", true); + generic_sql_query("INSERT INTO Statstable (Item, Value) VALUES ('SchemaVer', '".ROMPR_SCHEMA_VERSION."')", true); + $sv = ROMPR_SCHEMA_VERSION; + logger::log("MYSQL_CONNECT", "Statstable populated"); + create_update_triggers(); + create_conditional_triggers(); + create_playcount_triggers(); + } + + if ($sv > ROMPR_SCHEMA_VERSION) { + logger::log("MYSQL_CONNECT", "Schema Mismatch! We are version ".ROMPR_SCHEMA_VERSION." but database is version ".$sv); + return array(false, "Your database has version number ".$sv." but this version of rompr only handles version ".ROMPR_SCHEMA_VERSION); + } + + while ($sv < ROMPR_SCHEMA_VERSION) { + switch ($sv) { + case 0: + logger::error("SQL", "BIG ERROR! No Schema Version found!!"); + return array(false, "Database Error - could not read schema version. Cannot continue."); + break; + + case 1: + logger::log("SQL", "Updating FROM Schema version 1 TO Schema version 2"); + generic_sql_query("ALTER TABLE Albumtable DROP Directory", true); + generic_sql_query("UPDATE Statstable SET Value = 2 WHERE Item = 'SchemaVer'", true); + break; + + case 2: + logger::log("SQL", "Updating FROM Schema version 2 TO Schema version 3"); + generic_sql_query("ALTER TABLE Tracktable ADD Hidden TINYINT(1) UNSIGNED DEFAULT 0", true); + generic_sql_query("UPDATE Tracktable SET Hidden = 0 WHERE Hidden IS NULL", true); + generic_sql_query("UPDATE Statstable SET Value = 3 WHERE Item = 'SchemaVer'", true); + break; + + case 3: + logger::log("SQL", "Updating FROM Schema version 3 TO Schema version 4"); + generic_sql_query("UPDATE Tracktable SET Disc = 1 WHERE Disc IS NULL OR Disc = 0", true); + generic_sql_query("UPDATE Statstable SET Value = 4 WHERE Item = 'SchemaVer'", true); + break; + + case 4: + logger::log("SQL", "Updating FROM Schema version 4 TO Schema version 5"); + generic_sql_query("UPDATE Albumtable SET Searched = 0 WHERE Image NOT LIKE 'albumart%'", true); + generic_sql_query("ALTER TABLE Albumtable DROP Image", true); + generic_sql_query("UPDATE Statstable SET Value = 5 WHERE Item = 'SchemaVer'", true); + break; + + case 5: + logger::log("SQL", "Updating FROM Schema version 5 TO Schema version 6"); + generic_sql_query("DROP INDEX Disc on Tracktable", true); + generic_sql_query("UPDATE Statstable SET Value = 6 WHERE Item = 'SchemaVer'", true); + break; + + case 6: + logger::log("SQL", "Updating FROM Schema version 6 TO Schema version 7"); + // This was going to be a nice datestamp but newer versions of mysql don't work that way + generic_sql_query("ALTER TABLE Tracktable ADD DateAdded TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP", true); + generic_sql_query("UPDATE Tracktable SET DateAdded = FROM_UNIXTIME(LastModified) WHERE LastModified IS NOT NULL AND LastModified > 0", true); + generic_sql_query("UPDATE Statstable SET Value = 7 WHERE Item = 'SchemaVer'", true); + break; + + case 7: + logger::log("SQL", "Updating FROM Schema version 7 TO Schema version 8"); + // Since we've changed the way we're joining artist names together, + // rather than force the database to be recreated and screw up everyone's + // tags and rating, just modify the artist data. + $stmt = sql_prepare_query_later("UPDATE Artisttable SET Artistname = ? WHERE Artistindex = ?"); + if ($stmt !== FALSE) { + $result = generic_sql_query("SELECT * FROM Artisttable", false, PDO::FETCH_OBJ); + foreach ($result as $obj) { + $artist = (string) $obj->Artistname; + $art = explode(' & ', $artist); + if (count($art) > 2) { + $f = array_slice($art, 0, count($art) - 1); + $newname = implode($f, ", ")." & ".$art[count($art) - 1]; + logger::log("UPGRADE_SCHEMA", "Updating artist name from ".$artist." to ".$newname); + $stmt->execute(array($newname, $obj->Artistindex)); + } + } + } + generic_sql_query("UPDATE Statstable SET Value = 8 WHERE Item = 'SchemaVer'", true); + $stmt = null; + break; + + case 8: + logger::log("SQL", "Updating FROM Schema version 8 TO Schema version 9"); + // We removed the image column earlier, but I've decided we need it again + // because some mopidy backends supply images and archiving them all makes + // creating the collection take waaaaay too long. + generic_sql_query("ALTER TABLE Albumtable ADD Image VARCHAR(255)", true); + // So we now need to recreate the image database. Sadly this means that people using Beets will lose their album images. + $result = generic_sql_query("SELECT Albumindex, ImgKey FROM Albumtable", false, PDO::FETCH_OBJ); + foreach ($result as $obj) { + if (file_exists('albumart/small/'.$obj->ImgKey.'.jpg')) { + generic_sql_query("UPDATE Albumtable SET Image = 'albumart/small/".$obj->ImgKey.".jpg', Searched = 1 WHERE Albumindex = ".$obj->Albumindex, true); + } else { + generic_sql_query("UPDATE Albumtable SET Image = '', Searched = 0 WHERE Albumindex = ".$obj->Albumindex, true); + } + } + generic_sql_query("UPDATE Statstable SET Value = 9 WHERE Item = 'SchemaVer'", true); + break; + + case 9: + logger::log("SQL", "Updating FROM Schema version 9 TO Schema version 10"); + generic_sql_query("ALTER TABLE Albumtable DROP NumDiscs", true); + generic_sql_query("UPDATE Statstable SET Value = 10 WHERE Item = 'SchemaVer'", true); + break; + + case 10: + logger::log("SQL", "Updating FROM Schema version 10 TO Schema version 11"); + generic_sql_query("ALTER TABLE Albumtable DROP IsOneFile", true); + generic_sql_query("UPDATE Statstable SET Value = 11 WHERE Item = 'SchemaVer'", true); + break; + + case 11: + logger::log("SQL", "Updating FROM Schema version 11 TO Scheme version 12"); + generic_sql_query("ALTER TABLE Tracktable ADD isSearchResult TINYINT(1) UNSIGNED DEFAULT 0", true); + generic_sql_query("UPDATE Statstable SET Value = 12 WHERE Item = 'SchemaVer'", true); + break; + + case 12: + logger::log("SQL", "Updating FROM Schema version 12 TO Scheme version 13"); + generic_sql_query("ALTER TABLE Albumtable CHANGE Spotilink AlbumUri VARCHAR(255)", true); + generic_sql_query("UPDATE Statstable SET Value = 13 WHERE Item = 'SchemaVer'", true); + break; + + case 13: + logger::log("SQL", "Updating FROM Schema version 13 TO Scheme version 14"); + // Nothing to do here, this is for SQLite only. + generic_sql_query("UPDATE Statstable SET Value = 14 WHERE Item = 'SchemaVer'", true); + break; + + case 14: + logger::log("SQL", "Updating FROM Schema version 14 TO Scheme version 15"); + generic_sql_query("ALTER TABLE Tracktable MODIFY LastModified CHAR(32)", true); + generic_sql_query("UPDATE Statstable SET Value = 15 WHERE Item = 'SchemaVer'", true); + break; + + case 15: + logger::log("SQL", "Updating FROM Schema version 15 TO Schema version 16"); + albumImageBuggery(); + generic_sql_query("UPDATE Statstable SET Value = 16 WHERE Item = 'SchemaVer'", true); + break; + + case 16: + logger::log("SQL", "Updating FROM Schema version 16 TO Schema version 17"); + // Early MPD versions had LastModified as an integer value. They changed it to a datestamp some time ago but I didn't notice + $r = generic_sql_query("SELECT DATA_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'Tracktable' AND COLUMN_NAME = 'LastModified'"); + foreach ($r as $obj) { + logger::log("MYSQL_INIT", "Data Type of LastModified is ".$obj['DATA_TYPE']); + if ($obj['DATA_TYPE'] == 'int') { + logger::log("MYSQL_INIT", "Modifying Tracktable"); + generic_sql_query("ALTER TABLE Tracktable ADD LM CHAR(32)", true); + generic_sql_query("UPDATE Tracktable SET LM = LastModified", true); + generic_sql_query("ALTER TABLE Tracktable DROP LastModified", true); + generic_sql_query("ALTER TABLE Tracktable CHANGE LM LastModified CHAR(32)", true); + } + } + generic_sql_query("UPDATE Statstable SET Value = 17 WHERE Item = 'SchemaVer'", true); + break; + + case 17: + logger::log("SQL", "Updating FROM Schema version 17 TO Schema version 18"); + include("utils/podcastupgrade.php"); + generic_sql_query("UPDATE Statstable SET Value = 18 WHERE Item = 'SchemaVer'", true); + break; + + case 18: + logger::log("SQL", "Updating FROM Schema version 18 TO Schema version 19"); + $result = generic_sql_query('SELECT Tracktable.Uri AS uri, Tracktable.TTindex, Tracktable.Title AS ttit, Albumtable.*, Trackimagetable.Image AS ti FROM Tracktable JOIN Albumtable USING (Albumindex) LEFT JOIN Trackimagetable USING (TTindex) WHERE Tracktable.Uri LIKE "soundcloud:%"', false, PDO::FETCH_OBJ); + foreach ($result as $obj) { + logger::log("SQL", " Creating new Album ".$obj->ttit." Image ".$obj->ti); + $ti = $obj->ti; + if (preg_match('/^http/', $ti)) { + $ti = 'getRemoteImage.php?url='.$ti; + } + if (sql_prepare_query(true, null, null, null, + "INSERT INTO Albumtable + (Albumname, AlbumArtistindex, AlbumUri, Year, Searched, ImgKey, mbid, Domain, Image) + VALUES + (?, ?, ?, ?, ?, ?, ?, ?, ?)", + $obj->ttit, $obj->AlbumArtistindex, $obj->uri, $obj->Year, $obj->Searched, $obj->ImgKey, $obj->mbid, $obj->Domain, $ti + )) { + $retval = $mysqlc->lastInsertId(); + logger::log("SQL", " .. success, Albumindex ".$retval); + generic_sql_query("UPDATE Tracktable SET Albumindex = ".$retval." WHERE TTindex = ".$obj->TTindex, true); + } else { + logger::log("SQL", " .. ERROR!"); + } + } + generic_sql_query("UPDATE Statstable SET Value = 19 WHERE Item = 'SchemaVer'", true); + break; + + case 19: + logger::log("SQL", "Updating FROM Schema version 19 TO Schema version 20"); + $result = generic_sql_query('SELECT Tracktable.Uri AS uri, Tracktable.TTindex, Tracktable.Title AS ttit, Albumtable.*, Trackimagetable.Image AS ti FROM Tracktable JOIN Albumtable USING (Albumindex) LEFT JOIN Trackimagetable USING (TTindex) WHERE Tracktable.Uri LIKE "youtube:%"', false, PDO::FETCH_OBJ); + foreach ($result as $obj) { + logger::log("SQL", " Creating new Album ".$obj->ttit." Image ".$obj->ti); + $ti = $obj->ti; + if (preg_match('/^http/', $ti)) { + $ti = 'getRemoteImage.php?url='.$ti; + } + if (sql_prepare_query(true, null, null, null, + "INSERT INTO Albumtable + (Albumname, AlbumArtistindex, AlbumUri, Year, Searched, ImgKey, mbid, Domain, Image) + VALUES + (?, ?, ?, ?, ?, ?, ?, ?, ?)", + $obj->ttit, $obj->AlbumArtistindex, $obj->uri, $obj->Year, $obj->Searched, $obj->ImgKey, $obj->mbid, $obj->Domain, $ti + )) { + $retval = $mysqlc->lastInsertId(); + logger::log("SQL", " .. success, Albumindex ".$retval); + generic_sql_query("UPDATE Tracktable SET Albumindex = ".$retval." WHERE TTindex = ".$obj->TTindex, true); + } else { + logger::error("SQL", " .. ERROR!"); + } + } + generic_sql_query("UPDATE Statstable SET Value = 20 WHERE Item = 'SchemaVer'", true); + break; + + case 20: + logger::log("SQL", "Updating FROM Schema version 20 TO Schema version 21"); + generic_sql_query("DROP TABLE Trackimagetable", true); + generic_sql_query("UPDATE Statstable SET Value = 21 WHERE Item = 'SchemaVer'", true); + break; + + case 21: + logger::log("SQL", "Updating FROM Schema version 21 TO Schema version 22"); + generic_sql_query("ALTER TABLE Playcounttable ADD LastPlayed TIMESTAMP NULL", true); + generic_sql_query("UPDATE Statstable SET Value = 22 WHERE Item = 'SchemaVer'", true); + break; + + case 22: + logger::log("SQL", "Updating FROM Schema version 22 TO Schema version 23"); + generic_sql_query("ALTER TABLE Podcasttable ADD Version TINYINT(2)", true); + generic_sql_query("ALTER TABLE PodcastTracktable ADD Guid VARCHAR(2000)", true); + generic_sql_query("ALTER TABLE PodcastTracktable ADD Localfilename VARCHAR(255)", true); + generic_sql_query("UPDATE Podcasttable SET Version = 1 WHERE PODindex IS NOT NULL", true); + generic_sql_query("UPDATE Statstable SET Value = 23 WHERE Item = 'SchemaVer'", true); + break; + + case 23: + logger::log("SQL", "Updating FROM Schema version 23 TO Schema version 24"); + generic_sql_query("ALTER TABLE Tracktable CHANGE DateAdded DateAdded TIMESTAMP DEFAULT CURRENT_TIMESTAMP", true); + generic_sql_query("UPDATE Statstable SET Value = 24 WHERE Item = 'SchemaVer'", true); + break; + + case 24: + logger::log("SQL", "Updating FROM Schema version 24 TO Schema version 25"); + generic_sql_query("ALTER DATABASE romprdb CHARACTER SET utf8 COLLATE utf8_unicode_ci", true); + generic_sql_query("UPDATE Statstable SET Value = 25 WHERE Item = 'SchemaVer'", true); + break; + + case 25: + logger::log("SQL", "Updating FROM Schema version 25 TO Schema version 26"); + generic_sql_query("ALTER TABLE Tracktable ADD justAdded TINYINT(1) UNSIGNED DEFAULT 1", true); + generic_sql_query("UPDATE Statstable SET Value = 26 WHERE Item = 'SchemaVer'", true); + break; + + case 26: + logger::log("SQL", "Updating FROM Schema version 26 TO Schema version 27"); + generic_sql_query("ALTER TABLE Albumtable ADD justUpdated TINYINT(1) UNSIGNED DEFAULT 1", true); + generic_sql_query("UPDATE Statstable SET Value = 27 WHERE Item = 'SchemaVer'", true); + break; + + case 27: + logger::log("SQL", "Updating FROM Schema version 27 TO Schema version 28"); + rejig_wishlist_tracks(); + generic_sql_query("UPDATE Statstable SET Value = 28 WHERE Item = 'SchemaVer'", true); + break; + + case 28: + logger::log("SQL", "Updating FROM Schema version 28 TO Schema version 29"); + create_update_triggers(); + generic_sql_query("UPDATE Statstable SET Value = 29 WHERE Item = 'SchemaVer'", true); + break; + + case 29: + logger::log("SQL", "Updating FROM Schema version 29 TO Schema version 30"); + include('utils/radioupgrade.php'); + generic_sql_query("UPDATE Statstable SET Value = 30 WHERE Item = 'SchemaVer'", true); + break; + + case 30: + logger::log("SQL", "Updating FROM Schema version 30 TO Schema version 31"); + generic_sql_query("ALTER TABLE PodcastTracktable CHANGE Description Description TEXT", true); + generic_sql_query("ALTER TABLE PodcastTracktable CHANGE Link Link TEXT", true); + generic_sql_query("ALTER TABLE PodcastTracktable CHANGE Guid Guid TEXT", true); + generic_sql_query("ALTER TABLE Podcasttable CHANGE FeedURL FeedURL TEXT", true); + generic_sql_query("ALTER TABLE Podcasttable CHANGE Description Description TEXT", true); + generic_sql_query("ALTER TABLE Tracktable CHANGE Uri Uri TEXT", true); + generic_sql_query("UPDATE Statstable SET Value = 31 WHERE Item = 'SchemaVer'", true); + break; + + case 31: + logger::log("SQL", "Updating FROM Schema version 31 TO Schema version 32"); + generic_sql_query("ALTER TABLE Podcasttable ADD Subscribed TINYINT(1) NOT NULL DEFAULT 1", true); + generic_sql_query("UPDATE Statstable SET Value = 32 WHERE Item = 'SchemaVer'", true); + break; + + case 32: + logger::log("SQL", "Updating FROM Schema version 32 TO Schema version 33"); + generic_sql_query("DROP TRIGGER IF EXISTS track_insert_trigger", true); + generic_sql_query("DROP TRIGGER IF EXISTS track_update_trigger", true); + create_conditional_triggers(); + generic_sql_query("UPDATE Statstable SET Value = 33 WHERE Item = 'SchemaVer'", true); + break; + + case 33: + logger::log("SQL", "Updating FROM Schema version 33 TO Schema version 34"); + generic_sql_query("ALTER TABLE Albumtable ADD ImgVersion INT UNSIGNED DEFAULT ".ROMPR_IMAGE_VERSION, true); + generic_sql_query("UPDATE Albumtable SET ImgVersion = 1",true); + generic_sql_query("UPDATE Statstable SET Value = 34 WHERE Item = 'SchemaVer'", true); + break; + + case 34: + logger::log("SQL", "Updating FROM Schema version 34 TO Schema version 35"); + generic_sql_query("ALTER TABLE Tracktable ADD Sourceindex INT UNSIGNED DEFAULT NULL", true); + generic_sql_query("UPDATE Statstable SET Value = 35 WHERE Item = 'SchemaVer'", true); + break; + + case 35: + generic_sql_query("UPDATE Statstable SET Value = 36 WHERE Item = 'SchemaVer'", true); + break; + + case 36: + logger::log("SQL", "Updating FROM Schema version 35 TO Schema version 37"); + $localpods = generic_sql_query("SELECT PODTrackindex, PODindex, LocalFilename FROM PodcastTracktable WHERE LocalFilename IS NOT NULL"); + foreach ($localpods as $pod) { + sql_prepare_query(true, null, null, null, "UPDATE PodcastTracktable SET LocalFilename = ? WHERE PODTrackindex = ?", '/prefs/podcasts/'.$pod['PODindex'].'/'.$pod['PODTrackindex'].'/'.$pod['LocalFilename'], $pod['PODTrackindex']); + } + generic_sql_query("UPDATE Statstable SET Value = 37 WHERE Item = 'SchemaVer'", true); + break; + + case 37: + logger::log("SQL", "Updating FROM Schema version 37 TO Schema version 38"); + generic_sql_query("ALTER TABLE Albumtable MODIFY ImgVersion INT UNSIGNED DEFAULT ".ROMPR_IMAGE_VERSION, true); + generic_sql_query("UPDATE Statstable SET Value = 38 WHERE Item = 'SchemaVer'", true); + break; + + case 38: + logger::log("SQL", "Updating FROM Schema version 38 TO Schema version 39"); + generic_sql_query("ALTER TABLE Podcasttable ADD LastPubDate INT UNSIGNED DEFAULT NULL", true); + generic_sql_query("CREATE INDEX ptt ON PodcastTracktable (Title)", true); + require_once('includes/podcastfunctions.php'); + upgrade_podcasts_to_version(); + generic_sql_query("UPDATE Statstable SET Value = 39 WHERE Item = 'SchemaVer'", true); + break; + + case 39: + logger::log("SQL", "Updating FROM Schema version 39 TO Schema version 40"); + // Takes too long. It'll happen when they get refreshed anyway. + // require_once('includes/podcastfunctions.php'); + // upgrade_podcast_images(); + generic_sql_query("UPDATE Statstable SET Value = 40 WHERE Item = 'SchemaVer'", true); + break; + + case 40: + logger::log("SQL", "Updating FROM Schema version 40 TO Schema version 41"); + generic_sql_query("ALTER TABLE Podcasttable ADD Category VARCHAR(255) NOT NULL", true); + generic_sql_query("UPDATE Statstable SET Value = 41 WHERE Item = 'SchemaVer'", true); + break; + + case 41: + logger::log("SQL", "Updating FROM Schema version 41 TO Schema version 42"); + generic_sql_query("ALTER TABLE PodcastTracktable ADD Progress INT UNSIGNED DEFAULT 0", true); + generic_sql_query("UPDATE Statstable SET Value = 42 WHERE Item = 'SchemaVer'", true); + break; + + case 42: + logger::log("SQL", "Updating FROM Schema version 42 TO Schema version 43"); + update_stream_images(43); + generic_sql_query("UPDATE Statstable SET Value = 43 WHERE Item = 'SchemaVer'", true); + break; + + case 43: + logger::log("SQL", "Updating FROM Schema version 43 TO Schema version 44"); + empty_modified_cache_dirs(44); + generic_sql_query("UPDATE Statstable SET Value = 44 WHERE Item = 'SchemaVer'", true); + break; + + case 44: + logger::log("SQL", "Updating FROM Schema version 44 TO Schema version 45"); + upgrade_host_defs(45); + generic_sql_query("UPDATE Statstable SET Value = 45 WHERE Item = 'SchemaVer'", true); + break; + + case 45: + logger::log("SQL", "Updating FROM Schema version 45 TO Schema version 46"); + generic_sql_query("UPDATE Statstable SET Value = 46 WHERE Item = 'SchemaVer'", true); + break; + + case 46: + logger::log("SQL", "Updating FROM Schema version 46 TO Schema version 47"); + generic_sql_query("ALTER TABLE Playcounttable ADD SyncCount INT UNSIGNED DEFAULT 0", true); + generic_sql_query("UPDATE Statstable SET Value = 47 WHERE Item = 'SchemaVer'", true); + create_playcount_triggers(); + break; + + case 47: + logger::log("SQL", "Updating FROM Schema version 47 TO Schema version 48"); + // Some versions had a default value and an on update for LastPlayed, which is WRONG and fucks things up + generic_sql_query("ALTER TABLE Playcounttable ALTER LastPlayed DROP DEFAULT", true); + generic_sql_query("ALTER TABLE Playcounttable CHANGE LastPlayed LastPlayed TIMESTAMP NULL", true); + generic_sql_query("UPDATE Statstable SET Value = 48 WHERE Item = 'SchemaVer'", true); + break; + + case 48: + logger::log("SQL", "Updating FROM Schema version 48 TO Schema version 49"); + upgrade_host_defs(49); + generic_sql_query("UPDATE Statstable SET Value = 49 WHERE Item = 'SchemaVer'", true); + break; + + case 49: + logger::log("SQL", "Updating FROM Schema version 49 TO Schema version 50"); + generic_sql_query("ALTER TABLE Tracktable ADD LinkChecked TINYINT(1) UNSIGNED DEFAULT 0", true); + generic_sql_query("UPDATE Statstable SET Value = 50 WHERE Item = 'SchemaVer'", true); + break; + + case 50: + logger::log("SQL", "Updating FROM Schema version 50 TO Schema version 51"); + // Something wierd happened and I lost half my triggers. In case it happens to anyone else... + generic_sql_query("DROP TRIGGER IF EXISTS track_insert_trigger", true); + generic_sql_query("DROP TRIGGER IF EXISTS track_update_trigger", true); + generic_sql_query("DROP TRIGGER IF EXISTS rating_update_trigger", true); + generic_sql_query("DROP TRIGGER IF EXISTS rating_insert_trigger", true); + generic_sql_query("DROP TRIGGER IF EXISTS tag_delete_trigger", true); + generic_sql_query("DROP TRIGGER IF EXISTS tag_insert_trigger", true); + generic_sql_query("DROP TRIGGER IF EXISTS tag_remove_trigger", true); + generic_sql_query("DROP TRIGGER IF EXISTS track_delete_trigger", true); + create_conditional_triggers(); + create_update_triggers(); + generic_sql_query("UPDATE Statstable SET Value = 51 WHERE Item = 'SchemaVer'", true); + break; + + case 51: + logger::log("SQL", "Updating FROM Schema version 51 TO Schema version 52"); + generic_sql_query("ALTER TABLE Tracktable ADD isAudiobook TINYINT(1) UNSIGNED DEFAULT 0", true); + generic_sql_query("UPDATE Statstable SET Value = 52 WHERE Item = 'SchemaVer'", true); + break; + + case 52: + logger::log("SQL", "Updating FROM Schema version 52 TO Schema version 53"); + create_progress_triggers(); + generic_sql_query("UPDATE Statstable SET Value = 53 WHERE Item = 'SchemaVer'", true); + break; + + case 53: + logger::log("SQL", "Updating FROM Schema version 53 TO Schema version 54"); + require_once ('utils/backgroundimages.php'); + first_upgrade_of_user_backgrounds(); + generic_sql_query("UPDATE Statstable SET Value = 54 WHERE Item = 'SchemaVer'", true); + break; + + case 54: + logger::log("SQL", "Updating FROM Schema version 54 TO Schema version 55"); + generic_sql_query("INSERT INTO Statstable (Item, Value) VALUES ('PodUpPid', 0)", true); + generic_sql_query("UPDATE Statstable SET Value = 55 WHERE Item = 'SchemaVer'", true); + break; + + case 55: + logger::log("SQL", "Updating FROM Schema version 55 TO Schema version 56"); + generic_sql_query("INSERT INTO Statstable (Item, Value) VALUES ('Updating', '0')", true); + generic_sql_query("UPDATE Statstable SET Value = 56 WHERE Item = 'SchemaVer'", true); + break; + + } + $sv++; + } + + return array(true, ""); +} + +function delete_oldtracks() { + // generic_sql_query("DELETE Tracktable FROM Tracktable JOIN Playcounttable USING (TTindex) WHERE Hidden = 1 AND DATE_SUB(CURDATE(), INTERVAL 6 MONTH) > DateAdded AND Playcount < 2", true); +} + +function delete_orphaned_artists() { + generic_sql_query("DROP TABLE IF EXISTS Croft", true); + generic_sql_query("DROP TABLE IF EXISTS Cruft", true); + generic_sql_query("CREATE TEMPORARY TABLE Croft(Artistindex INT UNSIGNED NOT NULL UNIQUE, PRIMARY KEY(Artistindex)) AS SELECT Artistindex FROM Tracktable UNION SELECT AlbumArtistindex FROM Albumtable", true); + generic_sql_query("CREATE TEMPORARY TABLE Cruft(Artistindex INT UNSIGNED NOT NULL UNIQUE, PRIMARY KEY(Artistindex)) AS SELECT Artistindex FROM Artisttable WHERE Artistindex NOT IN (SELECT Artistindex FROM Croft)", true); + generic_sql_query("DELETE Artisttable FROM Artisttable INNER JOIN Cruft ON Artisttable.Artistindex = Cruft.Artistindex", true); +} + +function hide_played_tracks() { + generic_sql_query("CREATE TEMPORARY TABLE Fluff(TTindex INT UNSIGNED NOT NULL UNIQUE, PRIMARY KEY(TTindex)) AS SELECT TTindex FROM Tracktable JOIN Playcounttable USING (TTindex) WHERE isSearchResult = 2", true); + generic_sql_query("UPDATE Tracktable SET Hidden = 1, isSearchResult = 0 WHERE TTindex IN (SELECT TTindex FROM Fluff)", true); +} + +function sql_recent_tracks() { + global $prefs; + $qstring = "SELECT TTindex FROM Tracktable WHERE (DATE_SUB(CURDATE(),INTERVAL 60 DAY) <= DateAdded) AND Hidden = 0 AND isSearchResult < 2 AND isAudiobook = 0 AND Uri IS NOT NULL"; + if ($prefs['collection_player'] == 'mopidy' && $prefs['player_backend'] == 'mpd') { + $qstring .= ' AND Uri LIKE "local:%"'; + } + return $qstring." ORDER BY RAND()"; +} + +function sql_recent_albums() { + global $prefs; + $qstring = "SELECT TTindex, Albumindex, TrackNo FROM Tracktable WHERE DATE_SUB(CURDATE(),INTERVAL 60 DAY) <= DateAdded AND Hidden = 0 AND isSearchResult < 2 AND isAudiobook = 0 AND Uri IS NOT NULL"; + if ($prefs['collection_player'] == 'mopidy' && $prefs['player_backend'] == 'mpd') { + $qstring .= ' AND Uri LIKE "local:%"'; + } + return $qstring; +} + +function sql_recently_played() { + return "SELECT t.Uri, t.Title, a.Artistname, al.Albumname, al.Image, al.ImgKey, UNIX_TIMESTAMP(p.LastPlayed) AS unixtime FROM Tracktable AS t JOIN Playcounttable AS p USING (TTindex) JOIN Albumtable AS al USING (albumindex) JOIN Artisttable AS a ON (a.Artistindex = al.AlbumArtistindex) WHERE DATE_SUB(CURDATE(),INTERVAL 14 DAY) <= p.LastPlayed AND p.LastPlayed IS NOT NULL ORDER BY p.LastPlayed DESC"; +} + +function recently_played_playlist() { + $qstring = "SELECT TTindex FROM Playcounttable JOIN Tracktable USING (TTindex) WHERE DATE_SUB(CURDATE(),INTERVAL 14 DAY) <= LastPlayed AND LastPlayed IS NOT NULL AND isAudiobook = 0 AND Hidden = 0"; + return $qstring; +} + +function sql_two_weeks() { + return "DATE_SUB(CURDATE(),INTERVAL 14 DAY) > LastPlayed"; +} + +function sql_two_weeks_include($days) { + return "DATE_SUB(CURDATE(),INTERVAL ".$days." DAY) <= LastPlayed AND LastPlayed IS NOT NULL"; +} + +function sql_to_unixtime($s) { + return "UNIX_TIMESTAMP(".$s.")"; +} + +function track_date_check($range, $flag) { + if ($flag == 'b') { + return ''; + } + switch ($range) { + case ADDED_ALL_TIME: + return ''; + break; + + case ADDED_TODAY: + return 'AND DATE_SUB(CURDATE(), INTERVAL 1 DAY) <= DateAdded'; + break; + + case ADDED_THIS_WEEK: + return 'AND DATE_SUB(CURDATE(), INTERVAL 7 DAY) <= DateAdded'; + break; + + case ADDED_THIS_MONTH: + return 'AND DATE_SUB(CURDATE(), INTERVAL 1 MONTH) <= DateAdded'; + break; + + case ADDED_THIS_YEAR: + return 'AND DATE_SUB(CURDATE(), INTERVAL 1 YEAR) <= DateAdded'; + break; + + default: + logger::warn("SQL", "ERROR! Unknown Collection Range ".$range); + return ''; + break; + + } +} + +function create_conditional_triggers() { + generic_sql_query("CREATE TRIGGER track_insert_trigger AFTER INSERT ON Tracktable + FOR EACH ROW + BEGIN + IF (NEW.Hidden=0) + THEN + UPDATE Albumtable SET justUpdated = 1 WHERE Albumindex = NEW.Albumindex; + END IF; + END;", true); + + generic_sql_query("CREATE TRIGGER track_update_trigger AFTER UPDATE ON Tracktable + FOR EACH ROW + BEGIN + IF (NEW.Hidden=0) + THEN + UPDATE Albumtable SET justUpdated = 1 WHERE Albumindex = NEW.Albumindex; + UPDATE Albumtable SET justUpdated = 1 WHERE Albumindex = OLD.Albumindex; + END IF; + END;", true); + +} + +function create_playcount_triggers() { + generic_sql_query("CREATE TRIGGER syncupdatetrigger BEFORE UPDATE ON Playcounttable + FOR EACH ROW + BEGIN + IF (NEW.Playcount > OLD.Playcount) + THEN + SET NEW.SyncCount = OLD.SyncCount + 1; + END IF; + END;", true); + + generic_sql_query("CREATE TRIGGER syncinserttrigger BEFORE INSERT ON Playcounttable + FOR EACH ROW + BEGIN + SET NEW.SyncCount = 1; + END;", true); + +} + +function create_update_triggers() { + + logger::debug("MYSQL", "Creating Triggers for update operation"); + + generic_sql_query("CREATE TRIGGER rating_update_trigger AFTER UPDATE ON Ratingtable + FOR EACH ROW + BEGIN + UPDATE Albumtable SET justUpdated = 1 WHERE Albumindex = (SELECT Albumindex FROM Tracktable WHERE TTindex = NEW.TTindex); + UPDATE Tracktable SET Hidden = 0, justAdded = 1 WHERE Hidden = 1 AND TTindex = NEW.TTindex; + UPDATE Tracktable SET isSearchResult = 1, LastModified = NULL, justAdded = 1 WHERE isSearchResult > 1 AND TTindex = NEW.TTindex; + END;", true); + + generic_sql_query("CREATE TRIGGER rating_insert_trigger AFTER INSERT ON Ratingtable + FOR EACH ROW + BEGIN + UPDATE Albumtable SET justUpdated = 1 WHERE Albumindex = (SELECT Albumindex FROM Tracktable WHERE TTindex = NEW.TTindex); + UPDATE Tracktable SET Hidden = 0, justAdded = 1 WHERE Hidden = 1 AND TTindex = NEW.TTindex; + UPDATE Tracktable SET isSearchResult = 1, LastModified = NULL, justAdded = 1 WHERE isSearchResult > 1 AND TTindex = NEW.TTindex; + END;", true); + + generic_sql_query("CREATE TRIGGER tag_delete_trigger AFTER DELETE ON Tagtable + FOR EACH ROW + BEGIN + DELETE FROM TagListtable WHERE Tagindex = OLD.Tagindex; + END;", true); + + generic_sql_query("CREATE TRIGGER tag_insert_trigger AFTER INSERT ON TagListtable + FOR EACH ROW + BEGIN + UPDATE Albumtable SET justUpdated = 1 WHERE Albumindex = (SELECT Albumindex FROM Tracktable WHERE TTindex = NEW.TTindex); + UPDATE Tracktable SET Hidden = 0, justAdded = 1 WHERE Hidden = 1 AND TTindex = NEW.TTindex; + UPDATE Tracktable SET isSearchResult = 1, LastModified = NULL, justAdded = 1 WHERE isSearchResult > 1 AND TTindex = NEW.TTindex; + END;", true); + + generic_sql_query("CREATE TRIGGER tag_remove_trigger AFTER DELETE ON TagListtable + FOR EACH ROW + UPDATE Albumtable SET justUpdated = 1 WHERE Albumindex = (SELECT Albumindex FROM Tracktable WHERE TTindex = OLD.TTindex);", true); + + generic_sql_query("CREATE TRIGGER track_delete_trigger AFTER DELETE ON Tracktable + FOR EACH ROW + UPDATE Albumtable SET justUpdated = 1 WHERE Albumindex = OLD.Albumindex;", true); + +} + +function create_progress_triggers() { + + generic_sql_query("CREATE TRIGGER progress_update_trigger AFTER UPDATE ON Progresstable + FOR EACH ROW + BEGIN + UPDATE Albumtable SET justUpdated = 1 WHERE Albumindex = (SELECT Albumindex FROM Tracktable WHERE TTindex = NEW.TTindex); + END;", true); + + generic_sql_query("CREATE TRIGGER progress_insert_trigger AFTER INSERT ON Progresstable + FOR EACH ROW + BEGIN + UPDATE Albumtable SET justUpdated = 1 WHERE Albumindex = (SELECT Albumindex FROM Tracktable WHERE TTindex = NEW.TTindex); + END;", true); + + +} + +?> diff --git a/www/rompr/backends/sql/recentlyplayed.php b/www/rompr/backends/sql/recentlyplayed.php new file mode 100644 index 0000000..eda8d71 --- /dev/null +++ b/www/rompr/backends/sql/recentlyplayed.php @@ -0,0 +1,29 @@ +'; +$date = ''; +$result = generic_sql_query(sql_recently_played(), false, PDO::FETCH_OBJ); +foreach ($result as $obj) { + $thisdate = date('l, jS F Y', $obj->unixtime); + if ($thisdate != $date) { + $date = $thisdate; + print ''.$date.''; + } + print ''; + print ''; + print ''.$obj->Title.'
by '.$obj->Artistname.'
on '.$obj->Albumname.''; + print ''.date('H:i', $obj->unixtime).''; + print ''; +} +print ''; +?> diff --git a/www/rompr/backends/sql/rompr-tweaks.cnf b/www/rompr/backends/sql/rompr-tweaks.cnf new file mode 100644 index 0000000..aed2441 --- /dev/null +++ b/www/rompr/backends/sql/rompr-tweaks.cnf @@ -0,0 +1,15 @@ +# These are the settings that I found made a MASSIVE difference to +# performance. Make them as high as you dare, except for +# innodb_flush_log_at_trx_commit, which should be 0. +# NOTE that the last setting can cause you to lose one second's worth +# of data on a crash. If this is important, then don't enable this setting +# put these in /etc/mysql/conf.d/rompr-tweaks.cnf + +[mysqld] +query_cache_limit = 16M +query_cache_size = 64M + +binlog_ignore_db = romprdb + +innodb_buffer_pool_size = 64M +innodb_flush_log_at_trx_commit = 0 diff --git a/www/rompr/backends/sql/sqlite/specifics.php b/www/rompr/backends/sql/sqlite/specifics.php new file mode 100644 index 0000000..10fcd52 --- /dev/null +++ b/www/rompr/backends/sql/sqlite/specifics.php @@ -0,0 +1,984 @@ +getMessage()); + } +} + +function close_database() { + global $mysqlc; + $mysqlc = null; +} + +function check_sql_tables() { + global $mysqlc, $prefs; + + if (generic_sql_query("CREATE TABLE IF NOT EXISTS Tracktable(". + "TTindex INTEGER PRIMARY KEY NOT NULL UNIQUE, ". + "Title VARCHAR(255), ". + "Albumindex INTEGER, ". + "TrackNo SMALLINT, ". + "Duration INTEGER, ". + "Artistindex INTEGER, ". + "Disc TINYINT(3), ". + "Uri TEXT,". + "LastModified CHAR(32), ". + "Hidden TINYINT(1) DEFAULT 0, ". + "DateAdded TIMESTAMP DEFAULT CURRENT_TIMESTAMP, ". + "isSearchResult TINYINT(1) DEFAULT 0, ". + "Sourceindex INTEGER DEFAULT NULL, ". + "LinkChecked TINYINT(1) DEFAULT 0, ". + "isAudiobook TINYINT(1) DEFAULT 0, ". + "justAdded TINYINT(1) DEFAULT 1)", true)) + { + logger::log("SQLITE_CONNECT", " Tracktable OK"); + if (generic_sql_query("CREATE INDEX IF NOT EXISTS ai ON Tracktable (Albumindex)", true)) { + } else { + $err = $mysqlc->errorInfo()[2]; + return array(false, "Error While Checking Tracktable : ".$err); + } + if (generic_sql_query("CREATE INDEX IF NOT EXISTS ti ON Tracktable (Title)", true)) { + } else { + $err = $mysqlc->errorInfo()[2]; + return array(false, "Error While Checking Tracktable : ".$err); + } + if (generic_sql_query("CREATE INDEX IF NOT EXISTS tn ON Tracktable (TrackNo)", true)) { + } else { + $err = $mysqlc->errorInfo()[2]; + return array(false, "Error While Checking Tracktable : ".$err); + } + if (generic_sql_query("CREATE INDEX IF NOT EXISTS di ON Tracktable (Disc)", true)) { + } else { + $err = $mysqlc->errorInfo()[2]; + return array(false, "Error While Checking Tracktable : ".$err); + } + } else { + $err = $mysqlc->errorInfo()[2]; + return array(false, "Error While Checking Tracktable : ".$err); + } + + if (generic_sql_query("CREATE TABLE IF NOT EXISTS Albumtable(". + "Albumindex INTEGER PRIMARY KEY NOT NULL UNIQUE, ". + "Albumname VARCHAR(255), ". + "AlbumArtistindex INTEGER, ". + "AlbumUri VARCHAR(255), ". + "Year YEAR, ". + "Searched TINYINT(1), ". + "ImgKey CHAR(32), ". + "mbid CHAR(40), ". + "ImgVersion INTEGER DEFAULT ".ROMPR_IMAGE_VERSION.", ". + "Domain CHAR(32), ". + "Image VARCHAR(255), ". + "justUpdated TINYINT(1) DEFAULT 0)", true)) + { + logger::log("SQLITE_CONNECT", " Albumtable OK"); + if (generic_sql_query("CREATE INDEX IF NOT EXISTS ni ON Albumtable (Albumname)", true)) { + } else { + $err = $mysqlc->errorInfo()[2]; + return array(false, "Error While Checking Albumtable : ".$err); + } + if (generic_sql_query("CREATE INDEX IF NOT EXISTS aai ON Albumtable (AlbumArtistindex)", true)) { + } else { + $err = $mysqlc->errorInfo()[2]; + return array(false, "Error While Checking Albumtable : ".$err); + } + if (generic_sql_query("CREATE INDEX IF NOT EXISTS di ON Albumtable (Domain)", true)) { + } else { + $err = $mysqlc->errorInfo()[2]; + return array(false, "Error While Checking Albumtable : ".$err); + } + if (generic_sql_query("CREATE INDEX IF NOT EXISTS ii ON Albumtable (ImgKey)", true)) { + } else { + $err = $mysqlc->errorInfo()[2]; + return array(false, "Error While Checking Albumtable : ".$err); + } + } else { + $err = $mysqlc->errorInfo()[2]; + return array(false, "Error While Checking Albumtable : ".$err); + } + + if (generic_sql_query("CREATE TABLE IF NOT EXISTS Artisttable(". + "Artistindex INTEGER PRIMARY KEY NOT NULL UNIQUE, ". + "Artistname VARCHAR(255))", true)) + { + logger::log("SQLITE_CONNECT", " Artisttable OK"); + if (generic_sql_query("CREATE INDEX IF NOT EXISTS ni ON Artisttable (Artistname)", true)) { + } else { + $err = $mysqlc->errorInfo()[2]; + return array(false, "Error While Checking Artisttable : ".$err); + } + } else { + $err = $mysqlc->errorInfo()[2]; + return array(false, "Error While Checking Artisttable : ".$err); + } + + if (generic_sql_query("CREATE TABLE IF NOT EXISTS Ratingtable(". + "TTindex INTEGER PRIMARY KEY NOT NULL UNIQUE, ". + "Rating TINYINT(1))", true)) + { + logger::log("SQLITE_CONNECT", " Ratingtable OK"); + } else { + $err = $mysqlc->errorInfo()[2]; + return array(false, "Error While Checking Ratingtable : ".$err); + } + + if (generic_sql_query("CREATE TABLE IF NOT EXISTS Progresstable(". + "TTindex INTEGER PRIMARY KEY NOT NULL UNIQUE, ". + "Progress INTEGER)", true)) + { + logger::log("SQLITE_CONNECT", " Progresstable OK"); + } else { + $err = $mysqlc->errorInfo()[2]; + return array(false, "Error While Checking Progresstable : ".$err); + } + + if (generic_sql_query("CREATE TABLE IF NOT EXISTS Tagtable(". + "Tagindex INTEGER PRIMARY KEY NOT NULL UNIQUE, ". + "Name VARCHAR(255))", true)) + { + logger::log("SQLITE_CONNECT", " Tagtable OK"); + } else { + $err = $mysqlc->errorInfo()[2]; + return array(false, "Error While Checking Tagtable : ".$err); + } + + if (generic_sql_query("CREATE TABLE IF NOT EXISTS TagListtable(". + "Tagindex INTEGER NOT NULL REFERENCES Tagtable(Tagindex), ". + "TTindex INTEGER NOT NULL REFERENCES Tracktable(TTindex), ". + "PRIMARY KEY (Tagindex, TTindex))", true)) + { + logger::log("SQLITE_CONNECT", " TagListtable OK"); + } else { + $err = $mysqlc->errorInfo()[2]; + return array(false, "Error While Checking TagListtable : ".$err); + } + + if (generic_sql_query("CREATE TABLE IF NOT EXISTS Playcounttable(". + "TTindex INTEGER PRIMARY KEY NOT NULL UNIQUE REFERENCES Tracktable(TTindex), ". + "Playcount INT UNSIGNED NOT NULL, ". + "SyncCount INT UNSIGNED DEFAULT 0, ". + "LastPlayed TIMESTAMP DEFAULT NULL)", true)) + { + logger::log("SQLITE_CONNECT", " Playcounttable OK"); + } else { + $err = $mysqlc->errorInfo()[2]; + return array(false, "Error While Checking Playcounttable : ".$err); + } + + if (!generic_sql_query("CREATE TABLE IF NOT EXISTS Statstable(Item CHAR(11), Value INTEGER, PRIMARY KEY(Item))", true)) { + $err = $mysqlc->errorInfo()[2]; + return array(false, "Error While Checking Statstable : ".$err); + } + + if (generic_sql_query("CREATE TABLE IF NOT EXISTS Podcasttable(". + "PODindex INTEGER PRIMARY KEY NOT NULL UNIQUE, ". + "FeedURL TEXT, ". + "LastUpdate INTEGER, ". + "Image VARCHAR(255), ". + "Title VARCHAR(255), ". + "Artist VARCHAR(255), ". + "RefreshOption TINYINT(2) DEFAULT 0, ". + "SortMode TINYINT(2) DEFAULT 0, ". + "HideDescriptions TINYINT(1) DEFAULT 0, ". + "DisplayMode TINYINT(2) DEFAULT 0, ". + "DaysToKeep INTEGER DEFAULT 0, ". + "NumToKeep INTEGER DEFAULT 0, ". + "KeepDownloaded TINYINT(1) DEFAULT 0, ". + "AutoDownload TINYINT(1) DEFAULT 0, ". + "DaysLive INTEGER, ". + "Version TINYINT(2), ". + "Subscribed TINYINT(1) NOT NULL DEFAULT 1, ". + "Description TEXT, ". + "LastPubDate INTEGER DEFAULT NULL, ". + "Category VARCHAR(255))", true)) + { + logger::log("SQLITE_CONNECT", " Podcasttable OK"); + } else { + $err = $mysqlc->errorInfo()[2]; + return array(false, "Error While Checking Podcasttable : ".$err); + } + + if (generic_sql_query("CREATE TABLE IF NOT EXISTS PodcastTracktable(". + "PODTrackindex INTEGER PRIMARY KEY NOT NULL UNIQUE, ". + "JustUpdated TINYINT(1), ". + "PODindex INTEGER, ". + "Title VARCHAR(255), ". + "Artist VARCHAR(255), ". + "Duration INTEGER, ". + "PubDate INTEGER, ". + "FileSize INTEGER, ". + "Description TEXT, ". + "Link TEXT, ". + "Guid TEXT, ". + "Localfilename VARCHAR(255), ". + "Downloaded TINYINT(1) DEFAULT 0, ". + "Listened TINYINT(1) DEFAULT 0, ". + "New TINYINT(1) DEFAULT 1, ". + "Progress INTEGER DEFAULT 0, ". + "Deleted TINYINT(1) DEFAULT 0)", true)) + { + logger::log("SQLITE_CONNECT", " PodcastTracktable OK"); + if (generic_sql_query("CREATE INDEX IF NOT EXISTS ptt ON PodcastTracktable (Title)", true)) { + } else { + $err = $mysqlc->errorInfo()[2]; + return array(false, "Error While Checking PodcastTracktable : ".$err); + } + } else { + $err = $mysqlc->errorInfo()[2]; + return array(false, "Error While Checking PodcastTracktable : ".$err); + } + + if (generic_sql_query("CREATE TABLE IF NOT EXISTS RadioStationtable(". + "Stationindex INTEGER PRIMARY KEY NOT NULL UNIQUE, ". + "Number SMALLINT DEFAULT 65535, ". + "IsFave TINYINT(1), ". + "StationName VARCHAR(255), ". + "PlaylistUrl TEXT, ". + "Image VARCHAR(255))", true)) + { + logger::log("SQLITE_CONNECT", " RadioStationtable OK"); + if (generic_sql_query("CREATE INDEX IF NOT EXISTS ui ON RadioStationtable (PlaylistUrl)", true)) { + } else { + $err = $mysqlc->errorInfo()[2]; + return array(false, "Error While Checking RadioStationtable : ".$err); + } + } else { + $err = $mysqlc->errorInfo()[2]; + return array(false, "Error While Checking RadioStationtable : ".$err); + } + + if (generic_sql_query("CREATE TABLE IF NOT EXISTS RadioTracktable(". + "Trackindex INTEGER PRIMARY KEY NOT NULL UNIQUE, ". + "Stationindex INTEGER REFERENCES RadioStationtable(Stationindex), ". + "TrackUri TEXT, ". + "PrettyStream TEXT)", true)) + { + logger::log("SQLITE_CONNECT", " RadioTracktable OK"); + if (generic_sql_query("CREATE INDEX IF NOT EXISTS uri ON RadioTracktable (TrackUri)", true)) { + } else { + $err = $mysqlc->errorInfo()[2]; + return array(false, "Error While Checking RadioTracktable : ".$err); + } + } else { + $err = $mysqlc->errorInfo()[2]; + return array(false, "Error While Checking RadioTracktable : ".$err); + } + + if (generic_sql_query("CREATE TABLE IF NOT EXISTS WishlistSourcetable(". + "Sourceindex INTEGER PRIMARY KEY NOT NULL UNIQUE, ". + "SourceName VARCHAR(255), ". + "SourceImage VARCHAR(255), ". + "SourceUri TEXT)", true)) + { + logger::log("SQLITE_CONNECT", " WishlistSourcetable OK"); + if (generic_sql_query("CREATE INDEX IF NOT EXISTS suri ON WishlistSourcetable (SourceUri)", true)) { + } else { + $err = $mysqlc->errorInfo()[2]; + return array(false, "Error While Checking WishlistSourcetable : ".$err); + } + } else { + $err = $mysqlc->errorInfo()[2]; + return array(false, "Error While Checking WishlistSourcetable : ".$err); + } + + if (generic_sql_query("CREATE TABLE IF NOT EXISTS AlbumsToListenTotable(". + "Listenindex INTEGER PRIMARY KEY NOT NULL UNIQUE, ". + "JsonData TEXT)", true)) + { + logger::log("MYSQL_CONNECT", " AlbumsToListenTotabletable OK"); + } else { + $err = $mysqlc->errorInfo()[2]; + return array(false, "Error While Checking AlbumsToListenTotable : ".$err); + } + + if (generic_sql_query("CREATE TABLE IF NOT EXISTS BackgroundImageTable(". + "BgImageIndex INTEGER PRIMARY KEY NOT NULL UNIQUE, ". + "Skin VARCHAR(255), ". + "BrowserID VARCHAR(20) DEFAULT NULL, ". + "Filename VARCHAR(255), ". + "Orientation TINYINT(2))", true)) + { + logger::log("MYSQL_CONNECT", " BackgounrdImageTable OK"); + } else { + $err = $mysqlc->errorInfo()[2]; + return array(false, "Error While Checking BackgroundImageTable : ".$err); + } + + // Check schema version and update tables as necessary + $sv = simple_query('Value', 'Statstable', 'Item', 'SchemaVer', 0); + if ($sv == 0) { + logger::log("SQLITE_CONNECT", "No Schema Version Found - initialising table"); + generic_sql_query("INSERT INTO Statstable (Item, Value) VALUES ('ListVersion', '0')", true); + generic_sql_query("INSERT INTO Statstable (Item, Value) VALUES ('ArtistCount', '0')", true); + generic_sql_query("INSERT INTO Statstable (Item, Value) VALUES ('AlbumCount', '0')", true); + generic_sql_query("INSERT INTO Statstable (Item, Value) VALUES ('TrackCount', '0')", true); + generic_sql_query("INSERT INTO Statstable (Item, Value) VALUES ('TotalTime', '0')", true); + generic_sql_query("INSERT INTO Statstable (Item, Value) VALUES ('CollType', '999')", true); + generic_sql_query("INSERT INTO Statstable (Item, Value) VALUES ('SchemaVer', '".ROMPR_SCHEMA_VERSION."')", true); + $sv = ROMPR_SCHEMA_VERSION; + logger::log("SQLITE_CONNECT", "Statstable populated"); + create_update_triggers(); + create_conditional_triggers(); + create_playcount_triggers(); + } + + if ($sv > ROMPR_SCHEMA_VERSION) { + logger::log("SQLITE_CONNECT", "Schema Mismatch! We are version ".ROMPR_SCHEMA_VERSION." but database is version ".$sv); + return array(false, "Your database has version number ".$sv." but this version of rompr only handles version ".ROMPR_SCHEMA_VERSION); + } + + while ($sv < ROMPR_SCHEMA_VERSION) { + switch ($sv) { + case 0: + logger::log("SQL", "BIG ERROR! No Schema Version found!!"); + return array(false, "Database Error - could not read schema version. Cannot continue."); + break; + + case 11: + logger::log("SQL", "Updating FROM Schema version 11 TO Scheme version 12"); + generic_sql_query("ALTER TABLE Tracktable ADD isSearchResult TINYINT(1) DEFAULT 0", true); + generic_sql_query("UPDATE Statstable SET Value = 12 WHERE Item = 'SchemaVer'", true); + break; + + case 12; + logger::log("SQL", "Updating FROM Schema version 12 TO Scheme version 13"); + // First attempt didn't work + generic_sql_query("UPDATE Statstable SET Value = 13 WHERE Item = 'SchemaVer'", true); + break; + + case 13: + // SQLite doesn't let you rename or remove a column. Holy Shitting heck. + logger::log("SQL", "Updating FROM Schema version 13 TO Schema version 14"); + generic_sql_query("CREATE TABLE Albumtable_New(". + "Albumindex INTEGER PRIMARY KEY NOT NULL UNIQUE, ". + "Albumname VARCHAR(255), ". + "AlbumArtistindex INTEGER, ". + "AlbumUri VARCHAR(255), ". + "Year YEAR, ". + "Searched TINYINT(1), ". + "ImgKey CHAR(32), ". + "mbid CHAR(40), ". + "Domain CHAR(32), ". + "Image VARCHAR(255))", true); + generic_sql_query("INSERT INTO Albumtable_New SELECT Albumindex, Albumname, + AlbumArtistindex, Spotilink AS AlbumUri, Year, Searched, ImgKey, mbid, Domain, Image + FROM Albumtable", true); + generic_sql_query("DROP TABLE Albumtable", true); + generic_sql_query("ALTER TABLE Albumtable_New RENAME TO Albumtable", true); + generic_sql_query("CREATE INDEX IF NOT EXISTS ni ON Albumtable (Albumname)", true); + generic_sql_query("CREATE INDEX IF NOT EXISTS aai ON Albumtable (AlbumArtistindex)", true); + generic_sql_query("CREATE INDEX IF NOT EXISTS di ON Albumtable (Domain)", true); + generic_sql_query("CREATE INDEX IF NOT EXISTS ii ON Albumtable (ImgKey)", true); + generic_sql_query("UPDATE Statstable SET Value = 14 WHERE Item = 'SchemaVer'", true); + break; + + case 14: + // SQLite doesn't let you rename or remove a column. Holy Shitting heck. + logger::log("SQL", "Updating FROM Schema version 14 TO Schema version 15"); + generic_sql_query("CREATE TABLE Tracktable_New(". + "TTindex INTEGER PRIMARY KEY NOT NULL UNIQUE, ". + "Title VARCHAR(255), ". + "Albumindex INTEGER, ". + "TrackNo SMALLINT, ". + "Duration INTEGER, ". + "Artistindex INTEGER, ". + "Disc TINYINT(3), ". + "Uri VARCHAR(2000) ,". + "LastModified CHAR(32), ". + "Hidden TINYINT(1) DEFAULT 0, ". + "DateAdded TIMESTAMP DEFAULT CURRENT_TIMESTAMP, ". + "isSearchResult TINYINT(1) DEFAULT 0)", true); + generic_sql_query("INSERT INTO Tracktable_New SELECT TTindex, Title, Albumindex, + TrackNo, Duration, Artistindex, Disc, Uri, LastModified, Hidden, DateAdded, isSearchResult + FROM Tracktable", true); + generic_sql_query("DROP TABLE Tracktable", true); + generic_sql_query("ALTER TABLE Tracktable_New RENAME TO Tracktable", true); + generic_sql_query("CREATE TRIGGER IF NOT EXISTS updatetime AFTER UPDATE ON Tracktable BEGIN UPDATE Tracktable SET DateAdded = CURRENT_TIMESTAMP WHERE TTindex = old.TTindex; END", true); + generic_sql_query("CREATE INDEX IF NOT EXISTS ai ON Tracktable (Albumindex)", true); + generic_sql_query("CREATE INDEX IF NOT EXISTS ti ON Tracktable (Title)", true); + generic_sql_query("CREATE INDEX IF NOT EXISTS tn ON Tracktable (TrackNo)", true); + generic_sql_query("CREATE INDEX IF NOT EXISTS di ON Tracktable (Disc)", true); + generic_sql_query("UPDATE Statstable SET Value = 15 WHERE Item = 'SchemaVer'", true); + break; + + case 15: + logger::log("SQL", "Updating FROM Schema version 15 TO Schema version 16"); + albumImageBuggery(); + generic_sql_query("UPDATE Statstable SET Value = 16 WHERE Item = 'SchemaVer'", true); + break; + + case 16: + //Nothing to do here + logger::log("SQL", "Updating FROM Schema version 16 TO Schema version 17"); + generic_sql_query("UPDATE Statstable SET Value = 17 WHERE Item = 'SchemaVer'", true); + break; + + case 17: + logger::log("SQL", "Updating FROM Schema version 17 TO Schema version 18"); + include("utils/podcastupgrade.php"); + generic_sql_query("UPDATE Statstable SET Value = 18 WHERE Item = 'SchemaVer'", true); + break; + + case 18: + logger::log("SQL", "Updating FROM Schema version 18 TO Schema version 19"); + $result = generic_sql_query('SELECT Tracktable.Uri AS uri, Tracktable.TTindex, Tracktable.Title AS ttit, Albumtable.*, Trackimagetable.Image AS ti FROM Tracktable JOIN Albumtable USING (Albumindex) LEFT JOIN Trackimagetable USING (TTindex) WHERE Tracktable.Uri LIKE "soundcloud:%"', false, PDO::FETCH_OBJ); + foreach ($result as $obj) { + logger::log("SQL", " Creating new Album ".$obj->ttit." Image ".$obj->ti); + $ti = $obj->ti; + if (preg_match('/^http/', $ti)) { + $ti = 'getRemoteImage.php?url='.$ti; + } + if (sql_prepare_query(true, null, null, null, + "INSERT INTO Albumtable + (Albumname, AlbumArtistindex, AlbumUri, Year, Searched, ImgKey, mbid, Domain, Image) + VALUES + (?, ?, ?, ?, ?, ?, ?, ?, ?)", + $obj->ttit, $obj->AlbumArtistindex, $obj->uri, $obj->Year, $obj->Searched, $obj->ImgKey, $obj->mbid, $obj->Domain, $ti + )) { + $retval = $mysqlc->lastInsertId(); + logger::log("SQL", " .. success, Albumindex ".$retval); + generic_sql_query("UPDATE Tracktable SET Albumindex = ".$retval." WHERE TTindex = ".$obj->TTindex, true); + } else { + logger::log("SQL", " .. ERROR!"); + } + } + generic_sql_query("UPDATE Statstable SET Value = 19 WHERE Item = 'SchemaVer'"); + break; + + case 19: + logger::log("SQL", "Updating FROM Schema version 19 TO Schema version 20"); + $result = generic_sql_query('SELECT Tracktable.Uri AS uri, Tracktable.TTindex, Tracktable.Title AS ttit, Albumtable.*, Trackimagetable.Image AS ti FROM Tracktable JOIN Albumtable USING (Albumindex) LEFT JOIN Trackimagetable USING (TTindex) WHERE Tracktable.Uri LIKE "youtube:%"', false, PDO::FETCH_OBJ); + foreach ($result as $obj) { + logger::log("SQL", " Creating new Album ".$obj->ttit." Image ".$obj->ti); + $ti = $obj->ti; + if (preg_match('/^http/', $ti)) { + $ti = 'getRemoteImage.php?url='.$ti; + } + if (sql_prepare_query(true, null, null, null, + "INSERT INTO Albumtable + (Albumname, AlbumArtistindex, AlbumUri, Year, Searched, ImgKey, mbid, Domain, Image) + VALUES + (?, ?, ?, ?, ?, ?, ?, ?, ?)", + $obj->ttit, $obj->AlbumArtistindex, $obj->uri, $obj->Year, $obj->Searched, $obj->ImgKey, $obj->mbid, $obj->Domain, $ti + )) { + $retval = $mysqlc->lastInsertId(); + logger::log("SQL", " .. success, Albumindex ".$retval); + generic_sql_query("UPDATE Tracktable SET Albumindex = ".$retval." WHERE TTindex = ".$obj->TTindex, true); + } else { + logger::log("SQL", " .. ERROR!"); + } + } + generic_sql_query("UPDATE Statstable SET Value = 20 WHERE Item = 'SchemaVer'", true); + break; + + case 20: + logger::log("SQL", "Updating FROM Schema version 20 TO Schema version 21"); + generic_sql_query("DROP TABLE Trackimagetable", true); + generic_sql_query("UPDATE Statstable SET Value = 21 WHERE Item = 'SchemaVer'", true); + break; + + case 21: + logger::log("SQL", "Updating FROM Schema version 21 TO Schema version 22"); + generic_sql_query("ALTER TABLE Playcounttable ADD COLUMN LastPlayed TIMESTAMP DEFAULT NULL", true); + generic_sql_query("UPDATE Statstable SET Value = 22 WHERE Item = 'SchemaVer'", true); + break; + + case 22: + logger::log("SQL", "Updating FROM Schema version 22 TO Schema version 23"); + generic_sql_query("ALTER TABLE Podcasttable ADD COLUMN Version TINYINT(2)", true); + generic_sql_query("ALTER TABLE PodcastTracktable ADD COLUMN Guid VARCHAR(2000)", true); + generic_sql_query("ALTER TABLE PodcastTracktable ADD COLUMN Localfilename VARCHAR(255)", true); + generic_sql_query("UPDATE Podcasttable SET Version = 1 WHERE PODindex IS NOT NULL", true); + generic_sql_query("UPDATE Statstable SET Value = 23 WHERE Item = 'SchemaVer'", true); + break; + + case 23: + logger::log("SQL", "Updating FROM Schema version 23 TO Schema version 24"); + generic_sql_query("DROP TRIGGER IF EXISTS updatetime", true); + generic_sql_query("UPDATE Statstable SET Value = 24 WHERE Item = 'SchemaVer'", true); + break; + + case 24: + logger::log("SQL", "Updating FROM Schema version 24 TO Schema version 25"); + // Nothing to do here + generic_sql_query("UPDATE Statstable SET Value = 25 WHERE Item = 'SchemaVer'", true); + break; + + case 25: + logger::log("SQL", "Updating FROM Schema version 25 TO Schema version 26"); + generic_sql_query("ALTER TABLE Tracktable ADD justAdded TINYINT(1) DEFAULT 1", true); + generic_sql_query("UPDATE Statstable SET Value = 26 WHERE Item = 'SchemaVer'", true); + break; + + case 26: + logger::log("SQL", "Updating FROM Schema version 26 TO Schema version 27"); + generic_sql_query("ALTER TABLE Albumtable ADD justUpdated TINYINT(1) DEFAULT 1", true); + generic_sql_query("UPDATE Statstable SET Value = 27 WHERE Item = 'SchemaVer'", true); + break; + + case 27: + logger::log("SQL", "Updating FROM Schema version 27 TO Schema version 28"); + rejig_wishlist_tracks(); + generic_sql_query("UPDATE Statstable SET Value = 28 WHERE Item = 'SchemaVer'", true); + break; + + case 28: + logger::log("SQL", "Updating FROM Schema version 28 TO Schema version 29"); + create_update_triggers(); + generic_sql_query("UPDATE Statstable SET Value = 29 WHERE Item = 'SchemaVer'", true); + break; + + case 29: + logger::log("SQL", "Updating FROM Schema version 29 TO Schema version 30"); + include('utils/radioupgrade.php'); + generic_sql_query("UPDATE Statstable SET Value = 30 WHERE Item = 'SchemaVer'", true); + break; + + case 30: + logger::log("SQL", "Updating FROM Schema version 30 TO Schema version 31"); + // No need to do anything here + generic_sql_query("UPDATE Statstable SET Value = 31 WHERE Item = 'SchemaVer'", true); + break; + + case 31: + logger::log("SQL", "Updating FROM Schema version 31 TO Schema version 32"); + generic_sql_query("ALTER TABLE Podcasttable ADD Subscribed TINYINT(1) NOT NULL DEFAULT 1", true); + generic_sql_query("UPDATE Statstable SET Value = 32 WHERE Item = 'SchemaVer'", true); + break; + + case 32: + logger::log("SQL", "Updating FROM Schema version 32 TO Schema version 33"); + generic_sql_query("DROP TRIGGER IF EXISTS track_insert_trigger", true); + generic_sql_query("DROP TRIGGER IF EXISTS track_update_trigger", true); + create_conditional_triggers(); + generic_sql_query("UPDATE Statstable SET Value = 33 WHERE Item = 'SchemaVer'", true); + break; + + case 33: + logger::log("SQL", "Updating FROM Schema version 33 TO Schema version 34"); + generic_sql_query("ALTER TABLE Albumtable ADD COLUMN ImgVersion INTEGER DEFAULT ".ROMPR_IMAGE_VERSION, true); + generic_sql_query("UPDATE Albumtable SET ImgVersion = 1",true); + generic_sql_query("UPDATE Statstable SET Value = 34 WHERE Item = 'SchemaVer'", true); + break; + + case 34: + logger::log("SQL", "Updating FROM Schema version 34 TO Schema version 35"); + generic_sql_query("ALTER TABLE Tracktable ADD COLUMN Sourceindex INTEGER DEFAULT NULL", true); + generic_sql_query("UPDATE Statstable SET Value = 35 WHERE Item = 'SchemaVer'", true); + break; + + case 35: + generic_sql_query("UPDATE Statstable SET Value = 36 WHERE Item = 'SchemaVer'", true); + break; + + case 36: + logger::log("SQL", "Updating FROM Schema version 35 TO Schema version 37"); + $localpods = generic_sql_query("SELECT PODTrackindex, PODindex, LocalFilename FROM PodcastTracktable WHERE LocalFilename IS NOT NULL"); + foreach ($localpods as $pod) { + sql_prepare_query(true, null, null, null, "UPDATE PodcastTracktable SET LocalFilename = ? WHERE PODTrackindex = ?", '/prefs/podcasts/'.$pod['PODindex'].'/'.$pod['PODTrackindex'].'/'.$pod['LocalFilename'], $pod['PODTrackindex']); + } + generic_sql_query("UPDATE Statstable SET Value = 37 WHERE Item = 'SchemaVer'", true); + break; + + case 37: + logger::log("SQL", "Updating FROM Schema version 37 TO Schema version 38"); + generic_sql_query("CREATE TABLE IF NOT EXISTS Albumtable_New(". + "Albumindex INTEGER PRIMARY KEY NOT NULL UNIQUE, ". + "Albumname VARCHAR(255), ". + "AlbumArtistindex INTEGER, ". + "AlbumUri VARCHAR(255), ". + "Year YEAR, ". + "Searched TINYINT(1), ". + "ImgKey CHAR(32), ". + "mbid CHAR(40), ". + "ImgVersion INTEGER DEFAULT ".ROMPR_IMAGE_VERSION.", ". + "Domain CHAR(32), ". + "Image VARCHAR(255), ". + "justUpdated TINYINT(1) DEFAULT 0)", true); + generic_sql_query("INSERT INTO Albumtable_New SELECT Albumindex, Albumname, AlbumArtistindex, + AlbumUri, Year, Searched, ImgKey, mbid, ImgVersion, Domain, Image, justUpdated + FROM Albumtable", true); + generic_sql_query("DROP TABLE Albumtable", true); + generic_sql_query("ALTER TABLE Albumtable_New RENAME TO Albumtable", true); + generic_sql_query("CREATE INDEX IF NOT EXISTS ni ON Albumtable (Albumname)", true); + generic_sql_query("CREATE INDEX IF NOT EXISTS aai ON Albumtable (AlbumArtistindex)", true); + generic_sql_query("CREATE INDEX IF NOT EXISTS di ON Albumtable (Domain)", true); + generic_sql_query("CREATE INDEX IF NOT EXISTS ii ON Albumtable (ImgKey)", true); + generic_sql_query("UPDATE Statstable SET Value = 38 WHERE Item = 'SchemaVer'", true); + break; + + case 38: + logger::log("SQL", "Updating FROM Schema version 38 TO Schema version 39"); + generic_sql_query("ALTER TABLE Podcasttable ADD LastPubDate INTEGER DEFAULT NULL", true); + require_once('includes/podcastfunctions.php'); + upgrade_podcasts_to_version(); + generic_sql_query("UPDATE Statstable SET Value = 39 WHERE Item = 'SchemaVer'", true); + break; + + case 39: + logger::log("SQL", "Updating FROM Schema version 39 TO Schema version 40"); + // Takes too long. It'll happen when they get refreshed anyway. + // require_once('includes/podcastfunctions.php'); + // upgrade_podcast_images(); + generic_sql_query("UPDATE Statstable SET Value = 40 WHERE Item = 'SchemaVer'", true); + break; + + case 40: + logger::log("SQL", "Updating FROM Schema version 40 TO Schema version 41"); + generic_sql_query("CREATE TABLE IF NOT EXISTS Podcasttable_New(". + "PODindex INTEGER PRIMARY KEY NOT NULL UNIQUE, ". + "FeedURL TEXT, ". + "LastUpdate INTEGER, ". + "Image VARCHAR(255), ". + "Title VARCHAR(255), ". + "Artist VARCHAR(255), ". + "RefreshOption TINYINT(2) DEFAULT 0, ". + "SortMode TINYINT(2) DEFAULT 0, ". + "HideDescriptions TINYINT(1) DEFAULT 0, ". + "DisplayMode TINYINT(2) DEFAULT 0, ". + "DaysToKeep INTEGER DEFAULT 0, ". + "NumToKeep INTEGER DEFAULT 0, ". + "KeepDownloaded TINYINT(1) DEFAULT 0, ". + "AutoDownload TINYINT(1) DEFAULT 0, ". + "DaysLive INTEGER, ". + "Version TINYINT(2), ". + "Subscribed TINYINT(1) NOT NULL DEFAULT 1, ". + "Description TEXT, ". + "LastPubDate INTEGER DEFAULT NULL, ". + "Category VARCHAR(255))", true); + generic_sql_query("INSERT INTO Podcasttable_New SELECT PODindex, FeedURL, LastUpdate, Image, Title, Artist, + RefreshOption, SortMode, HideDescriptions, DisplayMode, DaysToKeep, NumToKeep, KeepDownloaded, AutoDownload, + DaysLive, Version, Subscribed, Description, LastPubDate, '' AS Category + FROM Podcasttable", true); + generic_sql_query("DROP TABLE Podcasttable", true); + generic_sql_query("ALTER TABLE Podcasttable_New RENAME TO Podcasttable", true); + generic_sql_query("UPDATE Statstable SET Value = 41 WHERE Item = 'SchemaVer'", true); + break; + + case 41: + logger::log("SQL", "Updating FROM Schema version 41 TO Schema version 42"); + generic_sql_query("CREATE TABLE IF NOT EXISTS PodcastTracktable_New(". + "PODTrackindex INTEGER PRIMARY KEY NOT NULL UNIQUE, ". + "JustUpdated TINYINT(1), ". + "PODindex INTEGER, ". + "Title VARCHAR(255), ". + "Artist VARCHAR(255), ". + "Duration INTEGER, ". + "PubDate INTEGER, ". + "FileSize INTEGER, ". + "Description TEXT, ". + "Link TEXT, ". + "Guid TEXT, ". + "Localfilename VARCHAR(255), ". + "Downloaded TINYINT(1) DEFAULT 0, ". + "Listened TINYINT(1) DEFAULT 0, ". + "New TINYINT(1) DEFAULT 1, ". + "Progress INTEGER DEFAULT 0, ". + "Deleted TINYINT(1) DEFAULT 0)", true); + generic_sql_query("INSERT INTO PodcastTracktable_New SELECT PODTrackindex, JustUpdated, PODindex, Title, Artist, + Duration, PubDate, FileSize, Description, Link, Guid, Localfilename, Downloaded, Listened, New, 0 AS Progress, Deleted + FROM PodcastTracktable", true); + generic_sql_query("DROP TABLE PodcastTracktable", true); + generic_sql_query("ALTER TABLE PodcastTracktable_New RENAME TO PodcastTracktable", true); + generic_sql_query("CREATE INDEX IF NOT EXISTS ptt ON PodcastTracktable (Title)", true); + generic_sql_query("UPDATE Statstable SET Value = 42 WHERE Item = 'SchemaVer'", true); + break; + + case 42: + logger::log("SQL", "Updating FROM Schema version 42 TO Schema version 43"); + update_stream_images(43); + generic_sql_query("UPDATE Statstable SET Value = 43 WHERE Item = 'SchemaVer'", true); + break; + + case 43: + logger::log("SQL", "Updating FROM Schema version 43 TO Schema version 44"); + empty_modified_cache_dirs(44); + generic_sql_query("UPDATE Statstable SET Value = 44 WHERE Item = 'SchemaVer'", true); + break; + + case 44: + logger::log("SQL", "Updating FROM Schema version 44 TO Schema version 45"); + upgrade_host_defs(45); + generic_sql_query("UPDATE Statstable SET Value = 45 WHERE Item = 'SchemaVer'", true); + break; + + case 45: + logger::log("SQL", "Updating FROM Schema version 45 TO Schema version 46"); + generic_sql_query("UPDATE Statstable SET Value = 46 WHERE Item = 'SchemaVer'", true); + break; + + case 46: + logger::log("SQL", "Updating FROM Schema version 46 TO Schema version 47"); + generic_sql_query("ALTER TABLE Playcounttable ADD COLUMN SyncCount INT UNSIGNED DEFAULT 0", true); + generic_sql_query("UPDATE Statstable SET Value = 47 WHERE Item = 'SchemaVer'", true); + create_playcount_triggers(); + break; + + case 47: + logger::log("SQL", "Updating FROM Schema version 47 TO Schema version 48"); + generic_sql_query("UPDATE Statstable SET Value = 48 WHERE Item = 'SchemaVer'", true); + break; + + case 48: + logger::log("SQL", "Updating FROM Schema version 48 TO Schema version 49"); + upgrade_host_defs(49); + generic_sql_query("UPDATE Statstable SET Value = 49 WHERE Item = 'SchemaVer'", true); + break; + + case 49: + logger::log("SQL", "Updating FROM Schema version 49 TO Schema version 50"); + generic_sql_query("ALTER TABLE Tracktable ADD COLUMN LinkChecked TINYINT(1) DEFAULT 0", true); + generic_sql_query("UPDATE Statstable SET Value = 50 WHERE Item = 'SchemaVer'", true); + break; + + case 50: + logger::log("SQL", "Updating FROM Schema version 50 TO Schema version 51"); + generic_sql_query("UPDATE Statstable SET Value = 51 WHERE Item = 'SchemaVer'", true); + break; + + case 51: + logger::log("SQL", "Updating FROM Schema version 51 TO Schema version 52"); + generic_sql_query("ALTER TABLE Tracktable ADD COLUMN isAudiobook TINYINT(1) DEFAULT 0", true); + generic_sql_query("UPDATE Statstable SET Value = 52 WHERE Item = 'SchemaVer'", true); + break; + + case 52: + logger::log("SQL", "Updating FROM Schema version 52 TO Schema version 53"); + create_progress_triggers(); + generic_sql_query("UPDATE Statstable SET Value = 53 WHERE Item = 'SchemaVer'", true); + break; + + case 53: + logger::log("SQL", "Updating FROM Schema version 53 TO Schema version 54"); + require_once ('utils/backgroundimages.php'); + first_upgrade_of_user_backgrounds(); + generic_sql_query("UPDATE Statstable SET Value = 54 WHERE Item = 'SchemaVer'", true); + break; + + case 54: + logger::log("SQL", "Updating FROM Schema version 54 TO Schema version 55"); + generic_sql_query("INSERT INTO Statstable (Item, Value) VALUES ('PodUpPid', 0)", true); + generic_sql_query("UPDATE Statstable SET Value = 55 WHERE Item = 'SchemaVer'", true); + break; + + case 55: + logger::log("SQL", "Updating FROM Schema version 55 TO Schema version 56"); + generic_sql_query("INSERT INTO Statstable (Item, Value) VALUES ('Updating', '0')", true); + generic_sql_query("UPDATE Statstable SET Value = 56 WHERE Item = 'SchemaVer'", true); + break; + + + } + $sv++; + } + + return array(true, ""); +} + +function delete_oldtracks() { + // generic_sql_query("DROP TABLE IF EXISTS OldTracks", true); + // generic_sql_query("CREATE TEMPORARY TABLE OldTracks AS SELECT TTindex FROM Tracktable JOIN Playcounttable USING (TTindex) WHERE Hidden = 1 AND DATETIME('now', '-6 MONTH') > DateAdded AND Playcount < 2", true); + // generic_sql_query("DELETE FROM Tracktable WHERE TTindex IN (SELECT TTindex FROM OldTracks)", true); +} + +function delete_orphaned_artists() { + generic_sql_query("DROP TABLE IF EXISTS Croft", true); + generic_sql_query("CREATE TEMPORARY TABLE Croft AS SELECT Artistindex FROM Tracktable UNION SELECT AlbumArtistindex FROM Albumtable", true); + generic_sql_query("DELETE FROM Artisttable WHERE Artistindex NOT IN (SELECT Artistindex FROM Croft)", true); +} + +function hide_played_tracks() { + generic_sql_query("UPDATE Tracktable SET Hidden = 1, isSearchResult = 0 WHERE TTindex IN (SELECT TTindex FROM Tracktable JOIN Playcounttable USING (TTindex) WHERE isSearchResult = 2)", true); +} + +function sql_recent_tracks() { + global $prefs; + $qstring = "SELECT TTindex FROM Tracktable WHERE DATETIME('now', '-2 MONTH') <= DATETIME(DateAdded) AND Hidden = 0 AND isSearchResult < 2 AND isAudiobook = 0 AND Uri IS NOT NULL"; + if ($prefs['collection_player'] == 'mopidy' && $prefs['player_backend'] == 'mpd') { + $qstring .= ' AND Uri LIKE "local:%"'; + } + return $qstring . " ORDER BY RANDOM()"; +} + +function sql_recent_albums() { + global $prefs; + $qstring = "SELECT TTindex, Albumindex, TrackNo FROM Tracktable WHERE DATETIME('now', '-2 MONTH') <= DATETIME(DateAdded) AND Hidden = 0 AND isSearchResult < 2 AND isAudiobook = 0 AND Uri IS NOT NULL"; + if ($prefs['collection_player'] == 'mopidy' && $prefs['player_backend'] == 'mpd') { + $qstring .= ' AND Uri LIKE "local:%"'; + } + return $qstring; +} + +function sql_recently_played() { + return "SELECT t.Uri, t.Title, a.Artistname, al.Albumname, al.Image, al.ImgKey, CAST(strftime('%s', p.LastPlayed) AS INT) AS unixtime FROM Tracktable AS t JOIN Playcounttable AS p USING (TTindex) JOIN Albumtable AS al USING (albumindex) JOIN Artisttable AS a ON (a.Artistindex = al.AlbumArtistindex) WHERE DATETIME('now', '-14 DAYS') <= DATETIME(p.LastPlayed) AND p.LastPlayed IS NOT NULL ORDER BY p.LastPlayed DESC"; +} + +function recently_played_playlist() { + $qstring = "SELECT TTindex FROM Playcounttable JOIN Tracktable USING (TTindex) WHERE DATETIME('now', '-14 DAYS') <= DATETIME(LastPlayed) AND LastPlayed IS NOT NULL AND isAudiobook = 0 AND Hidden = 0"; + return $qstring; +} + +function sql_two_weeks() { + return "DATETIME('now', '-14 DAYS') > DATETIME(LastPlayed)"; +} + +function sql_two_weeks_include($days) { + return "DATETIME('now', '-".$days." DAYS') <= DATETIME(LastPlayed) AND LastPlayed IS NOT NULL"; +} + +function sql_to_unixtime($s) { + return "CAST(strftime('%s', ".$s.") AS INT)"; +} + +function track_date_check($range, $flag) { + if ($flag == 'b') { + return ''; + } + switch ($range) { + case ADDED_ALL_TIME: + return ''; + break; + + case ADDED_TODAY: + return "AND DATETIME('now', '-1 DAYS') <= DateAdded"; + break; + + case ADDED_THIS_WEEK: + return "AND DATETIME('now', '-7 DAYS') <= DateAdded"; + break; + + case ADDED_THIS_MONTH: + return "AND DATETIME('now', '-1 MONTHS') <= DateAdded"; + break; + + case ADDED_THIS_YEAR: + return "AND DATETIME('now', '-1 YEAR') <= DateAdded"; + break; + + default: + logger::error("SQL", "ERROR! Unknown Collection Range ".$range); + return ''; + break; + + } +} + +function create_conditional_triggers() { + generic_sql_query("CREATE TRIGGER track_insert_trigger AFTER INSERT ON Tracktable + FOR EACH ROW + WHEN NEW.Hidden=0 + BEGIN + UPDATE Albumtable SET justUpdated = 1 WHERE Albumindex = NEW.Albumindex; + END;", true); + + generic_sql_query("CREATE TRIGGER track_update_trigger AFTER UPDATE ON Tracktable + FOR EACH ROW + WHEN NEW.Hidden=0 + BEGIN + UPDATE Albumtable SET justUpdated = 1 WHERE Albumindex = NEW.Albumindex; + UPDATE Albumtable SET justUpdated = 1 WHERE Albumindex = OLD.Albumindex; + END;", true); +} + +function create_playcount_triggers() { + generic_sql_query("CREATE TRIGGER syncupdatetrigger AFTER UPDATE ON Playcounttable + FOR EACH ROW + WHEN NEW.Playcount > OLD.Playcount + BEGIN + UPDATE Playcounttable SET SyncCount = OLD.SyncCount + 1 WHERE TTindex = New.TTindex; + END;", true); + + generic_sql_query("CREATE TRIGGER syncinserttrigger AFTER INSERT ON Playcounttable + FOR EACH ROW + BEGIN + UPDATE Playcounttable SET SyncCount = 1 WHERE TTindex = NEW.TTindex; + END;", true); + +} + +function create_update_triggers() { + + logger::trace("SQLITE", "Creating Triggers for update operation"); + + generic_sql_query("CREATE TRIGGER rating_update_trigger AFTER UPDATE ON Ratingtable + FOR EACH ROW + BEGIN + UPDATE Albumtable SET justUpdated = 1 WHERE Albumindex = (SELECT Albumindex FROM Tracktable WHERE TTindex = NEW.TTindex); + UPDATE Tracktable SET Hidden = 0, justAdded = 1 WHERE Hidden = 1 AND TTindex = NEW.TTindex; + UPDATE Tracktable SET isSearchResult = 1, LastModified = NULL, justAdded = 1 WHERE isSearchResult > 1 AND TTindex = NEW.TTindex; + END;", true); + + generic_sql_query("CREATE TRIGGER rating_insert_trigger AFTER INSERT ON Ratingtable + FOR EACH ROW + BEGIN + UPDATE Albumtable SET justUpdated = 1 WHERE Albumindex = (SELECT Albumindex FROM Tracktable WHERE TTindex = NEW.TTindex); + UPDATE Tracktable SET Hidden = 0, justAdded = 1 WHERE Hidden = 1 AND TTindex = NEW.TTindex; + UPDATE Tracktable SET isSearchResult = 1, LastModified = NULL, justAdded = 1 WHERE isSearchResult > 1 AND TTindex = NEW.TTindex; + END;", true); + + generic_sql_query("CREATE TRIGGER tag_delete_trigger AFTER DELETE ON Tagtable + FOR EACH ROW + BEGIN + DELETE FROM TagListtable WHERE Tagindex = OLD.Tagindex; + END;", true); + + generic_sql_query("CREATE TRIGGER tag_insert_trigger AFTER INSERT ON TagListtable + FOR EACH ROW + BEGIN + UPDATE Albumtable SET justUpdated = 1 WHERE Albumindex = (SELECT Albumindex FROM Tracktable WHERE TTindex = NEW.TTindex); + UPDATE Tracktable SET Hidden = 0, justAdded = 1 WHERE Hidden = 1 AND TTindex = NEW.TTindex; + UPDATE Tracktable SET isSearchResult = 1, LastModified = NULL, justAdded = 1 WHERE isSearchResult > 1 AND TTindex = NEW.TTindex; + END;", true); + + generic_sql_query("CREATE TRIGGER tag_remove_trigger AFTER DELETE ON TagListtable + FOR EACH ROW + BEGIN + UPDATE Albumtable SET justUpdated = 1 WHERE Albumindex = (SELECT Albumindex FROM Tracktable WHERE TTindex = OLD.TTindex); + END;", true); + + generic_sql_query("CREATE TRIGGER track_delete_trigger AFTER DELETE ON Tracktable + FOR EACH ROW + BEGIN + UPDATE Albumtable SET justUpdated = 1 WHERE Albumindex = OLD.Albumindex; + END;", true); + +} + +function create_progress_triggers() { + + generic_sql_query("CREATE TRIGGER progress_update_trigger AFTER UPDATE ON Progresstable + FOR EACH ROW + BEGIN + UPDATE Albumtable SET justUpdated = 1 WHERE Albumindex = (SELECT Albumindex FROM Tracktable WHERE TTindex = NEW.TTindex); + END;", true); + + generic_sql_query("CREATE TRIGGER progress_insert_trigger AFTER INSERT ON Progresstable + FOR EACH ROW + BEGIN + UPDATE Albumtable SET justUpdated = 1 WHERE Albumindex = (SELECT Albumindex FROM Tracktable WHERE TTindex = NEW.TTindex); + END;", true); + +} + +?> diff --git a/www/rompr/backends/sql/userRatings.php b/www/rompr/backends/sql/userRatings.php new file mode 100644 index 0000000..90080ff --- /dev/null +++ b/www/rompr/backends/sql/userRatings.php @@ -0,0 +1,631 @@ + 'baby'); + +if ($mysqlc == null) { + logger::error("RATINGS", "Can't Do ratings stuff as no SQL connection!"); + header('HTTP/1.0 403 Forbidden'); + exit(0); +} + +$start = time(); +open_transaction(); +create_foundtracks(); +$took = time() - $start; +logger::debug("TIMINGS", "Creating FoundTracks took ".$took." seconds"); + +$params = json_decode(file_get_contents('php://input'), true); + +// If you add new actions remember to update actions_requring_cleanup in metahandlers.js + +foreach($params as $p) { + + romprmetadata::sanitise_data($p); + + logger::mark("USERRATING", "Doing action",strtoupper($p['action'])); + foreach ($p as $i => $v) { + if ($i != 'action' && $v) { + logger::log(" Parameter", $i,':',$v); + } + } + + switch ($p['action']) { + + case 'dummy': + $returninfo = $dummydata; + break; + + case 'getplaylist': + preparePlaylist(); + case 'repopulate': + $returninfo = doPlaylist($p['playlist'], $p['numtracks']); + break; + + case 'ratlist': + $returninfo = get_rating_headers($p['sortby']); + break; + + case 'ratentries': + $returninfo = get_rating_info($p['sortby'], $p['value']); + break; + + case 'metabackup': + backup_unrecoverable_data(); + $returninfo = $dummydata; + break; + + case 'getbackupdata': + $returninfo = analyse_backups(); + break; + + case 'backupremove': + removeBackup($p['which']); + $returninfo = $dummydata; + break; + + case 'backuprestore': + restoreBackup($p['which']); + $returninfo = $dummydata; + break; + + case 'gettags': + $returninfo = list_tags(); + break; + + case 'getfaveartists': + $returninfo = get_fave_artists(); + break; + + case 'getrecommendationseeds'; + $returninfo = get_recommendation_seeds($p['days'], $p['limit'], $p['top']); + break; + + case 'addtolistenlater': + addToListenLater($p['json']); + $returninfo = $dummydata; + break; + + case 'getlistenlater': + $returninfo = getListenLater(); + break; + + case 'removelistenlater': + removeListenLater($p['index']); + $returninfo = $dummydata; + break; + + case 'getlinktocheck': + $returninfo = getLinkToCheck(); + break; + + case 'updatelinkcheck': + updateCheckedLink($p['ttindex'], $p['uri'], $p['status']); + $returninfo = $dummydata; + break; + + case 'resetlinkcheck': + resetLinkCheck(); + $returninfo = $dummydata; + break; + + case 'get': + case 'inc': + case "add": + case 'set': + case 'remove': + case 'cleanup': + case 'amendalbum': + case 'deletetag': + case 'delete': + case 'deletewl': + case 'getcharts': + case 'clearwishlist': + case 'setalbummbid': + case 'syncinc': + case 'resetallsyncdata': + case 'deleteid': + romprmetadata::{$p['action']}($p); + break; + + default: + logger::fail("USERRATINGS", "Unknown Request",$p['action']); + header('HTTP/1.1 400 Bad Request'); + break; + + + } + check_transaction(); +} + +if (count($returninfo) == 0 || array_key_exists('metadata', $returninfo)) { + // We don't do a database cleanup here. It can take a long time and this + // really slows the GUI down. Cleanups and stats updates are done out-of-band + // by the frontend DB Queue manager by calling into here with action = cleanup + prepare_returninfo(); +} +print json_encode($returninfo); +close_transaction(); + +logger::blurt("USERRATING", "---------------------------END----------------------"); + +function prepare_returninfo() { + logger::log("USERRATINGS", "Preparing Return Info"); + global $returninfo, $prefs; + $t = microtime(true); + $result = generic_sql_query('SELECT DISTINCT AlbumArtistindex FROM Albumtable WHERE justUpdated = 1'); + foreach ($result as $mod) { + if (artist_albumcount($mod['AlbumArtistindex']) == 0) { + $returninfo['deletedartists'][] = $mod['AlbumArtistindex']; + logger::mark("USERRATINGS", " Artist ".$mod['AlbumArtistindex']." has no visible albums"); + } else { + logger::mark("USERRATINGS", " Artist ".$mod['AlbumArtistindex']." has modified albums"); + switch ($prefs['sortcollectionby']) { + case 'album': + break; + + case 'artist': + logger::trace("USERRATINGS", " Creating Artist Header"); + $returninfo['modifiedartists'][] = do_artists_from_database('a', $prefs['sortcollectionby'], $mod['AlbumArtistindex']); + break; + + case 'albumbyartist': + if ($prefs['showartistbanners']) { + logger::trace("USERRATINGS", " Creating Artist Banner"); + $returninfo['modifiedartists'][] = do_artist_banner('a','album',$mod['AlbumArtistindex']); + } + break; + } + } + } + + $at = microtime(true) - $t; + logger::debug("TIMINGS", " -- Finding modified artists took ".$at." seconds"); + + $t = microtime(true); + $result = generic_sql_query('SELECT Albumindex, AlbumArtistindex FROM Albumtable WHERE justUpdated = 1'); + foreach ($result as $mod) { + if (album_trackcount($mod['Albumindex']) == 0) { + logger::mark("USERRATINGS", " Album ".$mod['Albumindex']." has no visible tracks"); + $returninfo['deletedalbums'][] = $mod['Albumindex']; + } else { + logger::mark("USERRATINGS", " Album ".$mod['Albumindex']." was modified"); + $prefix = check_album_is_album($mod['Albumindex']); + switch ($prefs['sortcollectionby']) { + case 'album': + case 'albumbyartist': + $r = do_albums_from_database($prefix, 'album', 'root', $mod['Albumindex'], false, false); + break; + + case 'artist': + $r = do_albums_from_database($prefix, 'album', $mod['AlbumArtistindex'], $mod['Albumindex'], false, false); + break; + } + $r['tracklist'] = do_tracks_from_database($prefix, 'album', $mod['Albumindex'], true); + $returninfo['modifiedalbums'][] = $r; + } + } + $at = microtime(true) - $t; + logger::debug("TIMINGS", " -- Finding modified albums took ".$at." seconds"); + + $t = microtime(true); + $result = generic_sql_query('SELECT Albumindex, AlbumArtistindex, Uri, TTindex FROM Tracktable JOIN Albumtable USING (Albumindex) WHERE justAdded = 1 AND Hidden = 0'); + foreach ($result as $mod) { + logger::log("USERRATING", " New Track in album ".$mod['Albumindex'].' has TTindex '.$mod['TTindex']); + $returninfo['addedtracks'][] = array('artistindex' => $mod['AlbumArtistindex'], 'albumindex' => $mod['Albumindex'], 'trackuri' => rawurlencode($mod['Uri'])); + } + $at = microtime(true) - $t; + logger::debug("TIMINGS", " -- Finding added tracks took ".$at." seconds"); +} + +function check_album_is_album($albumindex) { + // See if the album is an album or an audiobook + $c = simple_query('COUNT(TTindex)', 'Tracktable', 'isAudiobook = 1 AND Albumindex', $albumindex, 0); + if ($c > 0) { + logger::trace("USERRATINGS", " This is an audiobook"); + return 'z'; + } else { + return 'a'; + } +} + +function artist_albumcount($artistindex) { + return generic_sql_query( + "SELECT + COUNT(Albumindex) AS num + FROM + Albumtable LEFT JOIN Tracktable USING (Albumindex) + WHERE + AlbumArtistindex = ".$artistindex. + " AND Hidden = 0 + AND isSearchResult < 2 + AND Uri IS NOT NULL", false, null, 'num', 0); +} + +function album_trackcount($albumindex) { + return generic_sql_query( + "SELECT + COUNT(TTindex) AS num + FROM + Tracktable + WHERE + Albumindex = ".$albumindex. + " AND Hidden = 0 + AND isSearchResult < 2 + AND Uri IS NOT NULL", false, null, 'num', 0); +} + +function doCollectionHeader() { + global $returninfo; + $returninfo['stats'] = collectionStats(); +} + +function check_backup_dir() { + $dirname = date('Y-m-d-H-i'); + if (is_dir('prefs/databackups/'.$dirname)) { + rrmdir('prefs/databackups/'.$dirname); + } + mkdir('prefs/databackups/'.$dirname, 0755); + return 'prefs/databackups/'.$dirname; +} + +function backup_unrecoverable_data() { + + // This makes a backup of all manually added tracks and all + // rating, tag, and playcount data. This can be used to restore it + // or transfer it to another machine + + $dirname = check_backup_dir(); + + logger::log("BACKEND", "Backing up manually added tracks"); + $tracks = get_manually_added_tracks(); + file_put_contents($dirname.'/tracks.json',json_encode($tracks)); + + logger::log("BACKEND", "Backing up ratings"); + $tracks = get_ratings(); + file_put_contents($dirname.'/ratings.json',json_encode($tracks)); + + logger::log("BACKEND", "Backing up Playcounts"); + $tracks = get_playcounts(); + file_put_contents($dirname.'/playcounts.json',json_encode($tracks)); + + logger::log("BACKEND", "Backing up Tags"); + $tracks = get_tags(); + file_put_contents($dirname.'/tags.json',json_encode($tracks)); + +} + +function analyse_backups() { + $data = array(); + $bs = glob('prefs/databackups/*'); + rsort($bs); + foreach ($bs as $backup) { + // This is nice data to have, but it takes a very long time on a moderate computer + // FIXME: We should create these numbers when we create the backup and save them so we can read them in + // $tracks = count(json_decode(file_get_contents($backup.'/tracks.json'))); + // $ratings = count(json_decode(file_get_contents($backup.'/ratings.json'))); + // $playcounts = count(json_decode(file_get_contents($backup.'/playcounts.json'))); + // $tags = count(json_decode(file_get_contents($backup.'/tags.json'))); + $data[] = array( + 'dir' => basename($backup), + 'name' => strftime('%c', DateTime::createFromFormat('Y-m-d-H-i', basename($backup))->getTimestamp()), + 'stats' => array( + 'Manually Added Tracks' => file_exists($backup.'/tracks.json') ? 'OK' : 'Missing!', + 'Playcounts' => file_exists($backup.'/playcounts.json') ? 'OK' : 'Missing!', + 'Tracks With Ratings' => file_exists($backup.'/ratings.json') ? 'OK' : 'Missing!', + 'Tracks With Tags' => file_exists($backup.'/tags.json') ? 'OK' : 'Missing!', + ) + ); + } + return $data; +} + +function removeBackup($which) { + rrmdir('prefs/databackups/'.$which); +} + +function restoreBackup($backup) { + global $prefs; + if (file_exists('prefs/backupmonitor')) { + unlink('prefs/backupmonitor'); + } + $monitor = fopen('prefs/backupmonitor', 'w'); + if (file_exists('prefs/databackups/'.$backup.'/tracks.json')) { + logger::mark("BACKUPS", "Restoring Manually Added Tracks"); + $tracks = json_decode(file_get_contents('prefs/databackups/'.$backup.'/tracks.json'), true); + foreach ($tracks as $i => $trackdata) { + romprmetadata::sanitise_data($trackdata); + romprmetadata::add($trackdata, false); + $progress = round(($i/count($tracks))*100); + fwrite($monitor, "\nRestoring Manually Added Tracks : ".$progress."%"); + } + } + if (file_exists('prefs/databackups/'.$backup.'/ratings.json')) { + logger::mark("BACKUPS", "Restoring Ratings"); + $tracks = json_decode(file_get_contents('prefs/databackups/'.$backup.'/ratings.json'), true); + foreach ($tracks as $i => $trackdata) { + romprmetadata::sanitise_data($trackdata); + $trackdata['attributes'] = array(array('attribute' => 'Rating', 'value' => $trackdata['rating'])); + romprmetadata::set($trackdata, true); + $progress = round(($i/count($tracks))*100); + fwrite($monitor, "\nRestoring Ratings : ".$progress."%"); + } + } + if (file_exists('prefs/databackups/'.$backup.'/tags.json')) { + logger::mark("BACKUPS", "Restoring Tags"); + $tracks = json_decode(file_get_contents('prefs/databackups/'.$backup.'/tags.json'), true); + foreach ($tracks as $i => $trackdata) { + romprmetadata::sanitise_data($trackdata); + $trackdata['attributes'] = array(array('attribute' => 'Tags', 'value' => explode(',',$trackdata['tag']))); + romprmetadata::set($trackdata, true); + $progress = round(($i/count($tracks))*100); + fwrite($monitor, "\nRestoring Tags : ".$progress."%"); + } + } + if (file_exists('prefs/databackups/'.$backup.'/playcounts.json')) { + logger::mark("BACKUPS", "Restoring Playcounts"); + $tracks = json_decode(file_get_contents('prefs/databackups/'.$backup.'/playcounts.json'), true); + foreach ($tracks as $i => $trackdata) { + romprmetadata::sanitise_data($trackdata); + $trackdata['attributes'] = array(array('attribute' => 'Playcount', 'value' => $trackdata['playcount'])); + if (!array_key_exists('lastplayed', $trackdata)) { + // Sanitise backups made before lastplayed was added + $trackdata['lastplayed'] = null; + } + romprmetadata::inc($trackdata); + $progress = round(($i/count($tracks))*100); + fwrite($monitor, "\nRestoring Playcounts : ".$progress."%"); + } + } + fwrite($monitor, "\nCleaning Up..."); + // Now... we may have restored data on tracks that were previously local and now aren't there any more. + // If they're local tracks that have been removed, then we don't want them or care about their data + if ($prefs['player_backend'] == "mpd") { + generic_sql_query("DELETE FROM Tracktable WHERE Uri IS NOT NULL AND LastModified IS NULL AND Hidden = 0", true); + } else { + generic_sql_query("DELETE FROM Tracktable WHERE Uri LIKE 'local:%' AND LastModified IS NULL AND Hidden = 0", true); + } + romprmetadata::resetallsyncdata(); + remove_cruft(); + update_track_stats(); + fclose($monitor); +} + +function get_manually_added_tracks() { + + // get_manually_added_tracks + // Creates data for backup + + return generic_sql_query( + "SELECT + Tracktable.Title AS title, + Tracktable.TrackNo AS trackno, + Tracktable.Duration AS duration, + Tracktable.Disc AS disc, + Tracktable.Uri AS uri, + Albumtable.Albumname AS album, + Albumtable.AlbumUri AS albumuri, + Albumtable.Year AS date, + ta.Artistname AS artist, + aat.Artistname AS albumartist + FROM + Tracktable + JOIN Artisttable AS ta USING (Artistindex) + JOIN Albumtable ON Tracktable.Albumindex = Albumtable.Albumindex + JOIN Artisttable AS aat ON Albumtable.AlbumArtistindex = aat.Artistindex + WHERE Tracktable.LastModified IS NULL AND Tracktable.Hidden = 0 AND Tracktable.isSearchResult < 2 AND uri IS NOT NULL"); +} + +function get_ratings() { + + // get_ratings + // Creates data for backup + + return generic_sql_query( + "SELECT + r.Rating AS rating, + tr.Title AS title, + tr.TrackNo AS trackno, + tr.Duration AS duration, + tr.Disc AS disc, + tr.Uri AS uri, + al.Albumname AS album, + al.AlbumUri AS albumuri, + al.Year AS date, + ta.Artistname AS artist, + aat.Artistname AS albumartist + FROM + Ratingtable AS r + JOIN Tracktable AS tr USING (TTindex) + JOIN Artisttable AS ta USING (Artistindex) + JOIN Albumtable AS al ON tr.Albumindex = al.Albumindex + JOIN Artisttable AS aat ON al.AlbumArtistindex = aat.Artistindex + WHERE rating > 0 AND tr.Hidden = 0 AND tr.isSearchResult < 2 + ORDER BY rating, albumartist, album, trackno"); +} + +function get_playcounts() { + + // get_playcounts + // Creates data for backup + + return generic_sql_query( + "SELECT + p.Playcount AS playcount, + p.LastPlayed AS lastplayed, + tr.Title AS title, + tr.TrackNo AS trackno, + tr.Duration AS duration, + tr.Disc AS disc, + tr.Uri AS uri, + al.Albumname AS album, + al.AlbumUri AS albumuri, + al.Year AS date, + ta.Artistname AS artist, + aat.Artistname AS albumartist + FROM + Playcounttable AS p + JOIN Tracktable AS tr USING (TTindex) + JOIN Artisttable AS ta USING (Artistindex) + JOIN Albumtable AS al ON tr.Albumindex = al.Albumindex + JOIN Artisttable AS aat ON al.AlbumArtistindex = aat.Artistindex + WHERE playcount > 0 + ORDER BY playcount, albumartist, album, trackno"); +} + +function get_tags() { + + // get_tags + // Creates data for backup + + return generic_sql_query( + "SELECT + ".SQL_TAG_CONCAT."AS tag, + tr.Title AS title, + tr.TrackNo AS trackno, + tr.Duration AS duration, + tr.Disc AS disc, + tr.Uri AS uri, + al.Albumname AS album, + al.AlbumUri AS albumuri, + al.Year AS date, + ta.Artistname AS artist, + aat.Artistname AS albumartist + FROM + Tagtable AS t + JOIN TagListtable AS tl USING (Tagindex) + JOIN Tracktable AS tr ON tl.TTindex = tr.TTindex + JOIN Artisttable AS ta USING (Artistindex) + JOIN Albumtable AS al ON tr.Albumindex = al.Albumindex + JOIN Artisttable AS aat ON al.AlbumArtistindex = aat.Artistindex + WHERE tr.Hidden = 0 AND tr.isSearchResult < 2 + GROUP BY tr.TTindex"); +} + +function get_recommendation_seeds($days, $limit, $top) { + + // 1. Get a list of tracks played in the last $days days, sorted by their OVERALL popularity + $resultset = generic_sql_query( + "SELECT SUM(Playcount) AS playtotal, Artistname, Title, Uri + FROM Playcounttable JOIN Tracktable USING (TTindex) + JOIN Artisttable USING (Artistindex) + WHERE ".sql_two_weeks_include($days). + " AND Uri IS NOT NULL GROUP BY Artistindex ORDER BY playtotal DESC LIMIT ".$limit); + + // 2. Get a list of recently played tracks, ignoring popularity + // $result = generic_sql_query( + // "SELECT 0 AS playtotal, Artistname, Title, Uri + // FROM Playcounttable JOIN Tracktable USING (TTindex) + // JOIN Artisttable USING (Artistindex) + // WHERE ".sql_two_weeks_include(intval($days/2)). + // " AND Uri IS NOT NULL GROUP BY Artistindex ORDER BY ".SQL_RANDOM_SORT." LIMIT ".intval($limit/2)); + // $resultset = array_merge($resultset, $result); + + // 3. Get the top tracks overall + $tracks = get_track_charts(intval($limit/2)); + foreach ($tracks as $track) { + if ($track['uri']) { + $resultset[] = array('playtotal' => $track['soundcloud_plays'], + 'Artistname' => $track['label_artist'], + 'Title' => $track['label_track'], + 'Uri' => $track['uri']); + } + } + + // 4. Randomise that list and return the first $top. + shuffle($resultset); + return array_slice($resultset,0,$top); +} + +function get_fave_artists() { + // Can we have a tuning slider to increase the 'Playcount > x' value? + generic_sql_query( + "CREATE TEMPORARY TABLE aplaytable AS SELECT SUM(Playcount) AS playtotal, Artistindex FROM + (SELECT Playcount, Artistindex FROM Playcounttable JOIN Tracktable USING (TTindex) WHERE + Playcount > 10) AS derived GROUP BY Artistindex", true); + + $artists = array(); + $result = generic_sql_query( + "SELECT playtot, Artistname FROM (SELECT SUM(Playcount) AS playtot, Artistindex FROM + (SELECT Playcount, Artistindex FROM Playcounttable JOIN Tracktable USING (TTindex)) AS + derived GROUP BY Artistindex) AS alias JOIN Artisttable USING (Artistindex) WHERE + playtot > (SELECT AVG(playtotal) FROM aplaytable) ORDER BY ".SQL_RANDOM_SORT, false, PDO::FETCH_OBJ); + foreach ($result as $obj) { + logger::log("FAVEARTISTS", "Artist :",$obj->Artistname); + $artists[] = array( 'name' => $obj->Artistname, 'plays' => $obj->playtot); + } + return $artists; +} + +function addToListenLater($album) { + $newid = spotifyAlbumId($album); + $result = generic_sql_query("SELECT * FROM AlbumsToListenTotable"); + foreach ($result as $r) { + $d = json_decode($r['JsonData'], true); + $thisid = spotifyAlbumId($d); + if ($thisid == $newid) { + logger::warn("LISTENLATER", "Trying to add duplicate album to Listen Later"); + return; + } + } + $d = json_encode($album); + sql_prepare_query(true, null, null, null, "INSERT INTO AlbumsToListenTotable (JsonData) VALUES (?)", $d); +} + +function getListenLater() { + $result = generic_sql_query("SELECT * FROM AlbumsToListenTotable"); + $retval = array(); + foreach ($result as $r) { + $d = json_decode($r['JsonData']); + $d->rompr_index = $r['Listenindex']; + $retval[] = $d; + } + return $retval; +} + +function removeListenLater($id) { + generic_sql_query("DELETE FROM AlbumsToListenTotable WHERE Listenindex = ".$id, true); +} + +function spotifyAlbumId($album) { + if (array_key_exists('album', $album)) { + return $album['album']['id']; + } else { + return $album['id']; + } +} + +function getLinkToCheck() { + // LinkChecked: + // 0 = Not Checked, Assumed Playable or Playable at last check + // 1 = Not Checked, Unplayable at last check + // 2 = Checked, Playable + // 3 = Checked, Unplayable + return generic_sql_query("SELECT TTindex, Uri, LinkChecked FROM Tracktable WHERE Uri LIKE 'spotify:%' AND Hidden = 0 AND isSearchResult < 2 AND LinkChecked < 2 ORDER BY TTindex ASC LIMIT 25"); +} + +function updateCheckedLink($ttindex, $uri, $status) { + logger::log("METADATA", "Updating Link Check For TTindex",$ttindex,$uri); + sql_prepare_query(true, null, null, null, + "UPDATE Tracktable SET LinkChecked = ?, Uri = ? WHERE TTindex = ?", $status, $uri, $ttindex); +} + +function resetLinkCheck() { + generic_sql_query("UPDATE Tracktable SET LinkChecked = 0 WHERE LinkChecked = 2"); + generic_sql_query("UPDATE Tracktable SET LinkChecked = 1 WHERE LinkChecked = 3"); +} + +?> diff --git a/www/rompr/backimage.php b/www/rompr/backimage.php new file mode 100644 index 0000000..fc1481e --- /dev/null +++ b/www/rompr/backimage.php @@ -0,0 +1,133 @@ + $r) { + logger::log("BACKIMAGE", $i,'=',$r); +} + +$retval = array(); + +if (array_key_exists('getbackground', $_REQUEST)) { + + $images = sql_prepare_query(false, PDO::FETCH_ASSOC, null, null, 'SELECT * FROM BackgroundImageTable WHERE Skin = ? AND BrowserID = ?', $_REQUEST['getbackground'], $_REQUEST['browser_id']); + $thisbrowseronly = true; + if (count($images) == 0) { + logger::log("BACKIMAGE", "No Custom Backgrounds Exist for",$_REQUEST['getbackground'],$_REQUEST['browser_id']); + $images = sql_prepare_query(false, PDO::FETCH_ASSOC, null, null, 'SELECT * FROM BackgroundImageTable WHERE Skin = ? AND BrowserID IS NULL', $_REQUEST['getbackground']); + $thisbrowseronly = false; + } else { + logger::log("BACKIMAGE", "Custom Backgrounds Exist for",$_REQUEST['getbackground'],$_REQUEST['browser_id']); + } + if (count($images) > 0) { + logger::log("BACKIMAGE", "Custom Backgrounds Exist for",$_REQUEST['getbackground']); + $retval = array('images' => array('portrait' => array(), 'landscape' => array()), 'thisbrowseronly' => $thisbrowseronly); + foreach ($images as $image) { + if ($image['Orientation'] == ORIENTATION_PORTRAIT) { + $retval['images']['portrait'][] = $image['Filename']; + } else { + $retval['images']['landscape'][] = $image['Filename']; + } + } + } + +} else if (array_key_exists('clearbackground', $_REQUEST)) { + + sql_prepare_query(true, null, null, null, 'DELETE FROM BackgroundImageTable WHERE Filename = ?', $_REQUEST['clearbackground']); + unlink($_REQUEST['clearbackground']); + if (is_numeric(basename(dirname($_REQUEST['clearbackground'])))) { + check_empty_directory(dirname('clearbackground')); + } + +} else if (array_key_exists('clearallbackgrounds', $_REQUEST)) { + + // Remove these here, just in case the folder has been deleted for some reason + sql_prepare_query(true, null, null, null, 'DELETE FROM BackgroundImageTable WHERE Skin = ? AND BrowserID = ?', $_REQUEST['clearallbackgrounds'], $_REQUEST['browser_id']); + if (is_dir('prefs/userbackgrounds/'.$_REQUEST['clearallbackgrounds'].'/'.$_REQUEST['browser_id'])) { + logger::log("BACKIMAGE", "Removing All Backgrounds For ".$_REQUEST['clearallbackgrounds'].'/'.$_REQUEST['browser_id']); + delete_files('prefs/userbackgrounds/'.$_REQUEST['clearallbackgrounds'].'/'.$_REQUEST['browser_id']); + check_empty_directory('prefs/userbackgrounds/'.$_REQUEST['clearallbackgrounds'].'/'.$_REQUEST['browser_id']); + } else if (is_dir('prefs/userbackgrounds/'.$_REQUEST['clearallbackgrounds'])) { + logger::log("BACKIMAGE", "Removing All Backgrounds For ".$_REQUEST['clearallbackgrounds']); + delete_files('prefs/userbackgrounds/'.$_REQUEST['clearallbackgrounds']); + sql_prepare_query(true, null, null, null, 'DELETE FROM BackgroundImageTable WHERE Skin = ? AND BrowserID IS NULL', $_REQUEST['clearallbackgrounds']); + } + +} else { + + if (!array_key_exists('currbackground', $_REQUEST) || !array_key_exists('imagefile', $_FILES)) { + if (isset($_SERVER["CONTENT_LENGTH"])) { + if ($_SERVER["CONTENT_LENGTH"] > ((int) ini_get('post_max_size')*1024*1024)) { + logger::warn("BACKIMAGE", "Content Length Error"); + header("HTTP/1.1 400 Bad Request", 'BACKIMAGE'); + ob_flush(); + exit(0); + } + } + logger::warn("BACKIMAGE", "Some kind of upload error"); + header("HTTP/1.1 500 Internal Server Error"); + ob_flush(); + exit(0); + } + $skin = $_REQUEST['currbackground']; + $base = $skin; + $browserid = null; + if (array_key_exists('thisbrowseronly', $_REQUEST)) { + $base .= '/'.$_REQUEST['browser_id']; + $browserid = $_REQUEST['browser_id']; + } + + $files = make_files_useful($_FILES['imagefile']); + foreach ($files as $filedata) { + $file = $filedata['name']; + logger::log("BACKIMAGE", "Uploading File ".$file); + $fname = format_for_url(format_for_disc(basename($file))); + $download_file = get_user_file($file, $fname, $filedata['tmp_name']); + if (!is_dir('prefs/userbackgrounds/'.$base)) { + mkdir('prefs/userbackgrounds/'.$base, 0755, true); + } + $file = 'prefs/userbackgrounds/'.$base.'/'.$fname; + if (file_exists($file)) { + logger::trace("BACKIMAGE", "Image",$file,"already exists"); + unlink($download_file); + } else { + rename($download_file, $file); + $orientation = analyze_background_image($file); + sql_prepare_query(true, null, null, null, 'INSERT INTO BackgroundImageTable (Skin, BrowserID, Filename, Orientation) VALUES (?, ?, ?, ?)', $skin, $browserid, $file, $orientation); + } + } +} + +print json_encode($retval); + +ob_flush(); + +function check_empty_directory($dir) { + if (is_dir($dir) && !(new FilesystemIterator($dir))->valid()) { + rmdir($dir); + } +} + +function delete_files($path, $expr = '*.*') { + // Prevents file not found or could not stat errors + $f = glob($path.'/'.$expr); + foreach ($f as $file) { + unlink($file); + } +} + +function make_files_useful($arr) { + $new = array(); + foreach ($arr as $key => $all) { + foreach ($all as $i => $val) { + $new[$i][$key] = $val; + } + } + return $new; +} + + +?> diff --git a/www/rompr/browser/backends/getBeetsInfo.php b/www/rompr/browser/backends/getBeetsInfo.php new file mode 100644 index 0000000..74ddd65 --- /dev/null +++ b/www/rompr/browser/backends/getBeetsInfo.php @@ -0,0 +1,14 @@ + $uri)); +if ($d->get_data_to_string()) { + print $d->get_data(); +} else { + header("HTTP/1.1 404 Not Found"); +} +?> diff --git a/www/rompr/browser/backends/getLyrics.php b/www/rompr/browser/backends/getLyrics.php new file mode 100644 index 0000000..6a95e3d --- /dev/null +++ b/www/rompr/browser/backends/getLyrics.php @@ -0,0 +1,97 @@ +analyze($fname); + getid3_lib::CopyTagsToComments($tags); + + if (array_key_exists('comments', $tags) && + array_key_exists('lyrics', $tags['comments'])) { + $output = $tags['comments']['lyrics'][0]; + } else if (array_key_exists('comments', $tags) && + array_key_exists('unsynchronised_lyric', $tags['comments'])) { + $output = $tags['comments']['unsynchronised_lyric'][0]; + } else if (array_key_exists('quicktime', $tags) && + array_key_exists('moov', $tags['quicktime']) && + array_key_exists('subatoms', $tags['quicktime']['moov'])) { + read_apple_awfulness($tags['quicktime']['moov']['subatoms']); + } +} + +if ($output == null) { + $uri = "http://lyrics.wikia.com/api.php?func=getSong&artist=".urlencode($artist)."&song=".urlencode($song)."&fmt=xml"; + logger::mark("LYRICS", "Trying",$uri); + $d = new url_downloader(array( + 'url' => $uri, + 'cache' => 'lyrics', + 'return_data' => true + )); + if ($d->get_data_to_file()) { + $l = simplexml_load_string($d->get_data()); + if ($l->url) { + logger::log("LYRICS", " Now Getting",html_entity_decode($l->url)); + $d2 = new url_downloader(array( + 'url' => html_entity_decode($l->url), + 'cache' => 'lyrics', + 'return_data' => true + )); + if ($d2->get_data_to_file()) { + if (preg_match('/\
\.*?\<\/script\>(.*?)\<\!--/', $d2->get_data(), $matches)) { + $output = html_entity_decode($matches[1]); + } else if (preg_match('/\
(.*?)\
/', $d2->get_data(), $matches)) { + $output = html_entity_decode($matches[1]); + } else { + logger::mark("LYRICS", " Could Not Find Lyrics"); + } + } + } else { + logger::mark("LYRICS", " Nope, nothing there"); + } + } +} else { + logger::mark("LYRICS", " Got lyrics from file"); +} + +if ($output == null) { + $output = '

'.get_int_text("lyrics_nonefound").'

'.get_int_text("lyrics_info").'

'; +} + +print $output; + +function read_apple_awfulness($a) { + // Whoever came up with this was on something. + // All we want to do is read some metadata... + // why do you have to store it in such a horrible, horrible, way? + global $output; + foreach ($a as $atom) { + if (array_key_exists('name', $atom)) { + if (preg_match('/lyr$/', $atom['name'])) { + $output = preg_replace( '/^.*?data/', '', $atom['data']); + break; + } + } + if (array_key_exists('subatoms', $atom)) { + read_apple_awfulness($atom['subatoms']); + } + } +} + +?> diff --git a/www/rompr/browser/backends/getambio.php b/www/rompr/browser/backends/getambio.php new file mode 100644 index 0000000..f279a82 --- /dev/null +++ b/www/rompr/browser/backends/getambio.php @@ -0,0 +1,84 @@ +

'; + } +} else { + header('HTTP/1.1 400 Bad Request'); +} +ob_flush(); + +function get_bio_link($url) { + $html = ''; + $d = new url_downloader(array( + 'url' => $url, + 'cache' => 'allmusic', + 'return_data' => true + )); + if ($d->get_data_to_file()) { + $DOM = new DOMDocument; + @$DOM->loadHTML($d->get_data()); + $els = getElementsByClass($DOM, 'li', 'biography'); + if (count($els) > 0) { + $e = $els[0]; + $links = $e->GetElementsByTagName('a'); + for ($i = 0; $i < $links->length; $i++) { + $link = $links->item($i)->getAttribute('href'); + logger::log("AMBIO", "Found Bio Link",$link); + } + return 'http://www.allmusic.com'.$link; + } else { + return false; + } + } else { + return false; + } +} + +function get_allmusic_page($url) { + logger::log("AMBIO", "Getting allmusic Page",$url); + $r = '

'; + $d = new url_downloader(array( + 'url' => $url, + 'cache' => 'allmusic', + 'return_data' => true + )); + if ($d->get_data_to_file()) { + $DOM = new DOMDocument; + @$DOM->loadHTML($d->get_data()); + $els = getElementsByClass($DOM, 'div', 'text'); + foreach ($els as $el) { + $a = $el->getAttribute('itemprop'); + if ($a == 'reviewBody') { + logger::trace("AMBIO", "Found Review Body"); + $r = $el->nodeValue; + } + } + $r = '

'.$r.'

Biography courtesy of AllMusic

'; + } + print preg_replace('/\n/', '

',$r); +} + +function getElementsByClass(&$parentNode, $tagName, $className) { + $nodes=array(); + + $childNodeList = $parentNode->getElementsByTagName($tagName); + for ($i = 0; $i < $childNodeList->length; $i++) { + $temp = $childNodeList->item($i); + if (stripos($temp->getAttribute('class'), $className) !== false) { + $nodes[]=$temp; + } + } + + return $nodes; +} + +?> diff --git a/www/rompr/browser/backends/getamimage.php b/www/rompr/browser/backends/getamimage.php new file mode 100644 index 0000000..e2df483 --- /dev/null +++ b/www/rompr/browser/backends/getamimage.php @@ -0,0 +1,60 @@ + $url, + 'cache' => 'allmusic', + 'return_data' => true + )); + if ($d->get_data_to_file()) { + $DOM = new DOMDocument; + @$DOM->loadHTML($d->get_data()); + $els = getElementsByClass($DOM, 'div', 'artist-contain'); + if (count($els) > 0) { + $e = $els[0]; + $links = $e->GetElementsByTagName('img'); + for ($i = 0; $i < $links->length; $i++) { + $link = $links->item($i)->getAttribute('src'); + logger::log("AMIMAGE", "Found Image",$link); + } + return $link; + } else { + return false; + } + } else { + return false; + } +} + +function getElementsByClass(&$parentNode, $tagName, $className) { + $nodes=array(); + + $childNodeList = $parentNode->getElementsByTagName($tagName); + for ($i = 0; $i < $childNodeList->length; $i++) { + $temp = $childNodeList->item($i); + if (stripos($temp->getAttribute('class'), $className) !== false) { + $nodes[]=$temp; + } + } + + return $nodes; +} + +?> diff --git a/www/rompr/browser/backends/getdidata.php b/www/rompr/browser/backends/getdidata.php new file mode 100644 index 0000000..9f07bc3 --- /dev/null +++ b/www/rompr/browser/backends/getdidata.php @@ -0,0 +1,22 @@ + $v) { + if ($k != 'url') { + $params[] = $k.'='.rawurlencode($v); + } +} +$params[] = 'key=qmBviLdmIHhnxXkzWLHR'; +$params[] = 'secret=KAtjSjsJJlfQjdCXUrnbyXAltXDfelaV'; +if (count($params) > 0) { + $uri .= "?".implode('&', $params); +} + +getCacheData($uri, 'discogs'); + +?> diff --git a/www/rompr/browser/backends/getlfmdata.php b/www/rompr/browser/backends/getlfmdata.php new file mode 100644 index 0000000..acfd0f5 --- /dev/null +++ b/www/rompr/browser/backends/getlfmdata.php @@ -0,0 +1,18 @@ + $v) { + if ($k != 'cache') { + $params[] = $k.'='.rawurlencode($v); + } +} + +$url = "https://ws.audioscrobbler.com/2.0/?"; +$url .= implode('&', $params); +getCacheData($url, 'lastfm', $use_cache); +?> diff --git a/www/rompr/browser/backends/getmbdata.php b/www/rompr/browser/backends/getmbdata.php new file mode 100644 index 0000000..32a87e0 --- /dev/null +++ b/www/rompr/browser/backends/getmbdata.php @@ -0,0 +1,19 @@ + $v) { + if ($k != 'url') { + $params[] = $k.'='.$v; + } +} +if (count($params) > 0) { + $uri .= "?".implode('&', $params); +} +getCacheData($uri, 'musicbrainz'); + +?> diff --git a/www/rompr/browser/backends/getscdata.php b/www/rompr/browser/backends/getscdata.php new file mode 100644 index 0000000..738597d --- /dev/null +++ b/www/rompr/browser/backends/getscdata.php @@ -0,0 +1,9 @@ + diff --git a/www/rompr/browser/backends/getspdata.php b/www/rompr/browser/backends/getspdata.php new file mode 100644 index 0000000..a0a608e --- /dev/null +++ b/www/rompr/browser/backends/getspdata.php @@ -0,0 +1,29 @@ + $status, 'message' => $content); + print json_encode($r); + } +} +?> diff --git a/www/rompr/browser/backends/google.php b/www/rompr/browser/backends/google.php new file mode 100644 index 0000000..3dfb097 --- /dev/null +++ b/www/rompr/browser/backends/google.php @@ -0,0 +1,10 @@ + diff --git a/www/rompr/browser/backends/info_wikipedia.php b/www/rompr/browser/backends/info_wikipedia.php new file mode 100644 index 0000000..4f294ee --- /dev/null +++ b/www/rompr/browser/backends/info_wikipedia.php @@ -0,0 +1,761 @@ + $url, + 'cache' => 'wikipedia', + 'return_data' => true + )); + if ($d->get_data_to_file()) { + return $d->get_data(); + } else { + return null; + } +} + +function get_wikipedia_page($page, $site, $langsearch) { + + // $page will be eg 'Air_(French_band)' + // $site will be eg 'en.wikipedia.org' + // $langsearch is true if we want to find a page in the user's language + + // $domain is the language the user wants to use - eg 'fr' + global $domain; + global $userdomain; + global $mobile; + + // $request_domain is the language of the page we've been asked to get + $r = preg_match("#(.*?)\.#", $site, $matches); + $request_domain = $matches[1]; + $format_domain = $request_domain; + $req = ""; + + if ($langsearch) { + + logger::log("WIKIPEDIA", "Request for page ".$page." from ".$site.". Domain is ".$request_domain." and user domain is ".$domain); + + $user_link = ($request_domain == $domain) ? $page : null; + $english_link = ($site == "en.wikipedia.org") ? $page : null; + + logger::log("WIKIPEDIA", "User Link is ".$user_link." and english link is ".$english_link); + + if ($domain != $request_domain) { + logger::log("WIKIPEDIA", "Asked for page ".$page." from site ".$site." but user wants domain ".$domain); + // Find language links for the requested page + $langlinks = wikipedia_request("http://".$site."/w/api.php?action=query&prop=langlinks&titles=".$page."&format=xml"); + if ($langlinks !== null) { + $langs = simplexml_load_string($langlinks); + if ($langs->query->pages->page->langlinks) { + foreach($langs->query->pages->page->langlinks->ll as $ll) { + $l = $ll['lang']; + $t = dom_import_simplexml($ll)->textContent; + logger::log("WIKIPEDIA", "Found language link ".$l." title ".$t); + if ($l == $domain) { + $user_link = preg_replace('/ /', '_', $t); + } + if ($l == "en" && $english_link == null) { + $english_link = preg_replace('/ /', '_', $t); + } + } + } + } + } + + logger::log("WIKIPEDIA", "Language Scan Complete for ".$page); + logger::log("WIKIPEDIA", "User Link is ".$user_link." and english link is ".$english_link); + + if ($user_link !== null) { + $format_domain = $domain; + $userdomain = true; + $page = $user_link; + $site = $domain.'.wikipedia.org'; + } else if ($english_link !== null) { + $page = $english_link; + $site = "en.wikipedia.org"; + $format_domain = "en"; + } + + } + + if ($mobile) { + $req = 'http://'.$site.'/w/api.php?action=mobileview§ions=all&prop=text&page='.$page.'&format=xml'; + } else { + $req = 'http://'.$site.'/w/api.php?action=parse&prop=text&page='.$page.'&format=xml'; + } + + $xml = wikipedia_request($req); + if ($xml !== null) { + $info = ""; + if ($mobile) { + $info = simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA); + $reformat = ''; + foreach($info->mobileview->sections->section as $section) { + $reformat .= htmlspecialchars($section, ENT_QUOTES); + } + $reformat .= ''.$format_domain.''.$page.''; + return $reformat; + } else { + $info = simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA); + $html = $info->parse->text; + $matches = array(); + if (preg_match( '/REDIRECT

  • addChild('rompr'); + $meta->addChild('domain', $domain); + $meta->addChild('page', $page); + return $xml->asXML(); +} + +function join_responses($bits) { + $t = ""; + $d = ""; + $p = ""; + foreach ($bits as $b) { + $info = simplexml_load_string($b, 'SimpleXMLElement', LIBXML_NOCDATA); + $t .= htmlspecialchars($info->parse->text, ENT_QUOTES); + $d = $info->rompr->domain; + $p = $info->rompr->page; + } + $reformat = ''.$t.''.$d.''.$p.''; + return $reformat; +} + +function send_result($xml) { + header('Content-Type: text/xml'); + print $xml; +} + +function send_failure($term) { + $xml = ''; + $xml .= htmlspecialchars('

    ', ENT_QUOTES).get_int_text("wiki_fail", array($term)).htmlspecialchars('

    ', ENT_QUOTES); + $xml .= '
    '; + $xml .= 'nullnull
    '; + send_result($xml); +} + +// ========================================================================== +// +// Utility Functions +// +// ========================================================================== + +function prepare_string($searchstring) { + // Escape naughty characters + $searchstring = preg_replace( '/(\(|\)|\^|\$|\\\\|\/)/', '\\\\$1', $searchstring ); + return $searchstring; +} + +function wikipedia_find_exact($searchfor, $domain) { + + $xml = wikipedia_request('http://'.$domain.'.wikipedia.org/w/api.php?action=query&list=search&srsearch=' . rawurlencode($searchfor) . '&srprop=score&format=xml'); + if ($xml == null) { + return ''; + } + $info = simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA); + $page = null; + + // This is international, so we only look for an exact match (we can't possibly translate every possibility that's in artist_search, etc) + foreach ($info->query->search->p as $id) { + $searchstring = $id['title']; + $searchstring = prepare_string($searchstring); + if (preg_match('/^\s*' . $searchstring . '\s*$/i', $searchfor)) { + $page = $id['title']; + break; + } + } + + if ($page == null) { + return ''; + } else { + return get_wikipedia_page(preg_replace('/ /', '_', $page), $domain.".wikipedia.org", false); + } + +} + +function find_dismbiguation_page($page) { + + $searchfor = $page.' (disambiguation)'; + logger::log("WIKIPEDIA", "Searching Wikipedia for ".$searchfor); + $xml = wikipedia_request('http://en.wikipedia.org/w/api.php?action=query&list=search&srsearch=' . rawurlencode($searchfor) . '&srprop=score&format=xml'); + $results = simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA); + + foreach ($results->query->search->p as $id) { + if ($id['title'] == $searchfor) { + logger::log("WIKIPEDIA", "returning disambiguation page for ".$page); + return get_wikipedia_page(preg_replace('/ /', '_', $id['title']), "en.wikipedia.org", true); + } + } + + return ''; +} + +function wikipedia_get_list_of_suggestions($term) { + + global $domain; + logger::log("WIKIPEDIA", "Getting list of suggestions for ".$term." from ".$domain.".wikipedia.org"); + $xml = wikipedia_request('http://'.$domain.'.wikipedia.org/w/api.php?action=query&list=search&srsearch=' . rawurlencode($term) . '&srprop=score&format=xml'); + if ($xml != "") { + $html = ''; + $xml = simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA); + + if (count($xml->query->search->p) == 0) { + return null; + } + $html .= htmlspecialchars('

    ', ENT_QUOTES).get_int_text("wiki_suggest", array($term)).htmlspecialchars('

    ', ENT_QUOTES); + $html .= htmlspecialchars('

    ', ENT_QUOTES).get_int_text("wiki_suggest2").htmlspecialchars('

    ', ENT_QUOTES); + $html .= htmlspecialchars('
    ", ENT_QUOTES); + $html .= ''; + $html .= ''.$domain.''.htmlspecialchars($term, ENT_QUOTES).''; + + return $html; + } else { + return ""; + } + +} + +// ========================================================================== +// +// Artist Search +// +// ========================================================================== + + +function getArtistWiki($artist_name, $disambig) { + + global $domain; + + // First, try a search and exact match in the user's chosen language. + // This is to catch the case where a page exists on that user's wikipedia + // domain and it has no language links to the en site + if ($domain != "en") { + $h = wikipedia_find_exact($artist_name, $domain); + if ($h != '') { + return $h; + } + } + + // Now try a search on the english site. We can be more wide-ranging in this search + // we do this in English because (a) it has the most stuff and (b) I can speak it. + // We can find translation links later. + $h = wikipedia_artist_search($artist_name, $disambig); + if ($h != '') { + return $h; + } + + // No results returned. If there's an '&' or 'and' or '+' in the name - such as 'Fruitbat & Umbrella' + // try querying for 'Fruitbat' and 'Umbrella' separately and if there are any results, display them all + $artist = preg_replace('/ and /', ' & ', $artist_name); + $artist = preg_replace('/\+/', '&', $artist); + $jhtml = array(); + if (preg_match('/ & /', $artist) > 0) { + $alist = explode(' & ', $artist); + foreach ($alist as $artistname) { + $j = wikipedia_artist_search($artistname, ""); + if ($j != '') { + $jhtml[] = $j; + } + } + } elseif (preg_match('/,/', $artist) > 0) { + $alist = explode(',', $artist); + $jhtml = array(); + foreach ($alist as $artistname) { + $j = wikipedia_artist_search($artistname, ""); + if ($j != '') { + $jhtml[] = $j; + } + } + } + if (count($jhtml) > 0) { + return join_responses($jhtml); + } + + $h = find_dismbiguation_page($artist_name); + if ($h != '') { + return $h; + } + + return wikipedia_get_list_of_suggestions($artist_name); +} + +function wikipedia_artist_search($artist, $disambig) { + + $page = null; + if ($disambig != "") { + $searchfor = $artist.' ('.$disambig.')'; + logger::log("WIKIPEDIA ARTIST", "Searching Wikipedia for ".$searchfor); + $xml = wikipedia_request('http://en.wikipedia.org/w/api.php?action=query&list=search&srsearch=' . rawurlencode($searchfor) . '&srprop=score&format=xml'); + $artistinfo = simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA); + + // First look for exact match + foreach ($artistinfo->query->search->p as $id) { + $searchstring = $id['title']; + $searchstring = prepare_string($searchstring); + if (preg_match('/^\s*' . $searchstring . '\s*$/i', $searchfor)) { + $page = $id['title']; + break; + } + } + + if ($page == null) { + $poss = array(); + foreach ($artistinfo->query->search->p as $id) { + if (preg_match('/\(.*?band\)|\(.*?musician\)|\(.*?singer\)/i', $id['title'])) { + $poss[] = $id['title']; + } + } + if (count($poss) == 1) { + $page = array_shift($poss); + } + } + } + + if ($page == null) { + logger::log("WIKIPEDIA ARTIST", "Searching Wikipedia for ".$artist); + $xml = wikipedia_request('http://en.wikipedia.org/w/api.php?action=query&list=search&srsearch=' . rawurlencode($artist) . '&srprop=score&format=xml'); + $artist2info = simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA); + foreach ($artist2info->query->search->p as $id) { + + $searchstring = $id['title']; + $searchstring = prepare_string($searchstring); + if (preg_match('/^\s*' . $searchstring . '\s*$/i', $artist)) { + $page = $id['title']; + break; + } + + $poss = array(); + if (preg_match('/\(.*?band\)|\(.*?musician\)|\(.*?singer\)/i', $id['title'])) { + $poss[] = $id['title']; + } + if (count($poss) == 1) { + $page = array_shift($poss); + break; + } + + $searchstring = $id['title']; + $searchstring = prepare_string($searchstring); + if (preg_match('/^\s*' . $searchstring . '\s*$/i', "The " . $artist)) { + $page = $id['title']; + break; + } + $searchstring = $id['title']; + $searchstring = prepare_string($searchstring); + if (preg_match('/^\s*The ' . $searchstring . '\s*$/i', $artist)) { + $page = $id['title']; + break; + } + + if (preg_match('/&/', $id['title'])) { + $searchstring = $id['title']; + $searchstring = preg_replace( '/&/', 'and', $searchstring ); + $searchstring = prepare_string($searchstring); + if (preg_match('/^\s*' . $searchstring . '\s*$/i', $artist)) { + $page = $id['title']; + break; + } + } + + if (preg_match('/and/', $id['title'])) { + $searchstring = $id['title']; + $searchstring = preg_replace( '/and/', '&', $searchstring ); + $searchstring = prepare_string($searchstring); + if (preg_match('/^\s*' . $searchstring . '\s*$/i', $artist)) { + $page = $id['title']; + break; + } + } + + // Any '.'? Let's remove them (both ways round) + if (preg_match('/\./', $id['title'])) { + $searchstring = $id['title']; + $searchstring = preg_replace( '/\./', '', $searchstring ); + $searchstring = prepare_string($searchstring); + if (preg_match('/^\s*' . $searchstring . '\s*$/i', $artist)) { + $page = $id['title']; + break; + } + } + if (preg_match('/\./', $artist)) { + $searchstring = $id['title']; + $t = preg_replace( '/\./', '', $artist ); + $searchstring = prepare_string($searchstring); + if (preg_match('/^\s*' . $searchstring . '\s*$/i', $t)) { + $page = $id['title']; + break; + } + } + + // Words for numbers, numbers for words. + $numbers = array('/1/','/2/','/3/','/4/','/5/','/6/','/7/','/8/','/9/'); + $words = array("one", "two", "three", "four", "five", "six", "seven", "eight", "nine"); + + $searchstring = $id['title']; + $searchstring = preg_replace( $numbers, $words, $searchstring); + $searchstring = prepare_string($searchstring); + if (preg_match('/^\s*' . $searchstring . '\s*$/i', $artist) || + preg_match('/^\s*' . $searchstring . '\s*$/i', "The ".$artist)) { + $page = $id['title']; + break; + } + + $numbers = array('1','2','3','4','5','6','7','8','9'); + $words = array("/one/", "/two/", "/three/", "/four/", "/five/", "/six/", "/seven/", "/eight/", "/nine/"); + $searchstring = $id['title']; + $searchstring = preg_replace( $words, $numbers, $searchstring); + $searchstring = prepare_string($searchstring); + if (preg_match('/^\s*' . $searchstring . '\s*$/i', $artist) || + preg_match('/^\s*' . $searchstring . '\s*$/i', "The ".$artist)) { + $page = $id['title']; + break; + } + + } + } + + if ($page == null && preg_match('/.*\(.*\).*/', $artist)) { + $sf = trim(preg_replace('/\(.*?\)/','',$artist));; + logger::log("WIKIPEDIA ARTIST", "Searching Wikipedia for ".$sf); + $xml = wikipedia_request('http://en.wikipedia.org/w/api.php?action=query&list=search&srsearch=' . rawurlencode($sf) . '&srprop=score&format=xml'); + $artist3info = simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA); + foreach ($artist3info->query->search->p as $id) { + $searchstring = $id['title']; + $searchstring = prepare_string($searchstring); + if (preg_match('/^\s*' . $searchstring . '\s*$/i', $sf)) { + $page = $id['title']; + break; + } + } + } + + if ($page == null) { + return ''; + } + + logger::log("WIKIPEDIA ARTIST", "Artist search found page ".$page); + return get_wikipedia_page(preg_replace('/ /', '_', $page), "en.wikipedia.org", true); + +} + +// ========================================================================== +// +// Album Search +// +// ========================================================================== + + +function getAlbumWiki($album_name, $artist_name) { + + global $domain; + // First, try a search and exact match in the user's chosen language. + // This is to catch the case where a page exists on that user's wikipedia + // domain and it has no language links to the en site + if ($domain != "en") { + $h = wikipedia_find_exact($album_name, $domain); + if ($h != '') { + return $h; + } + } + + // Now try a search on the english site. We can be more wide-ranging in this search + // we do this in English because (a) it has the most stuff and (b) I can speak it. + // We can find translation links later. + $h = wikipedia_album_search($album_name, $artist_name); + if ($h != '') { + return $h; + } + + $h = find_dismbiguation_page($album_name); + if ($h != '') { + return $h; + } + + return wikipedia_get_list_of_suggestions($album_name); + +} + +function wikipedia_album_search($album, $artist) { + + $album = munge_album_name($album); + logger::log("WIKIPEDIA ALBUM", "Searching Wikipedia for ".$album." (album)"); + $xml = wikipedia_request('http://en.wikipedia.org/w/api.php?action=query&list=search&srsearch=' . rawurlencode($album." (album)") . '&srprop=score&format=xml'); + $albuminfo = simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA); + + $page = null; + + foreach ($albuminfo->query->search->p as $id) { + $searchstring = prepare_string($album).'\s+\('.prepare_string($artist).' album\)'; + // logger::log("WIKIDEBUG", "1. Checking page ".$id['title']." against ".$searchstring); + if (preg_match('/^\s*' . $searchstring . '/i', $id['title'])) { + logger::log("WIKIPEDIA", "Found Page : ".$id['title']); + $page = $id['title']; + break; + } + } + + if ($page == null) { + foreach ($albuminfo->query->search->p as $id) { + $searchstring = prepare_string($album).'\s+\(album\)'; + // logger::log("WIKIDEBUG", "2. Checking page ".$id['title']." against ".$searchstring); + if (preg_match('/^\s*' . $searchstring . '/i', $id['title'])) { + logger::log("WIKIPEDIA", "Found Page : ".$id['title']); + $page = $id['title']; + break; + } + } + } + + if ($page == null) { + foreach ($albuminfo->query->search->p as $id) { + $searchstring = prepare_string($album).'\s+\(\d+ album\)'; + // logger::log("WIKIDEBUG", "2. Checking page ".$id['title']." against ".$searchstring); + if (preg_match('/^\s*' . $searchstring . '/i', $id['title'])) { + logger::log("WIKIPEDIA", "Found Page : ".$id['title']); + $page = $id['title']; + break; + } + } + } + + if ($page == null) { + foreach ($albuminfo->query->search->p as $id) { + $searchstring = prepare_string($album); + // logger::log("WIKIDEBUG", "3. Checking page ".$id['title']." against ".$searchstring); + if (preg_match('/^\s*' . $searchstring . '\s*$/i', $id['title'])) { + logger::log("WIKIPEDIA", "Found Page : ".$id['title']); + $page = $id['title']; + break; + } + } + } + + if ($page == null) { + logger::log("WIKIPEDIA ALBUM", "Searching Wikipedia for ".$album); + $xml = wikipedia_request('http://en.wikipedia.org/w/api.php?action=query&list=search&srsearch=' . rawurlencode($album) . '&srprop=score&format=xml'); + $album2info = simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA); + foreach ($album2info->query->search->p as $id) { + $searchstring = prepare_string($album); + // logger::log("WIKIDEBUG", "3. Checking page ".$id['title']." against ".$searchstring); + if (preg_match('/^\s*' . $searchstring . '\s*$/i', $id['title'])) { + logger::log("WIKIPEDIA", "Found Page : ".$id['title']); + $page = $id['title']; + break; + } + } + } + + if ($page == null) { + return null; + } + logger::log("WIKIPEDIA ALBUM", "Album search found page ".$page); + return get_wikipedia_page(preg_replace('/ /', '_', $page), "en.wikipedia.org", true); + +} + +// ========================================================================== +// +// Track Search +// +// ========================================================================== + + +function getTrackWiki($track_name, $artist_name) { + + global $domain; + // First, try a search and exact match in the user's chosen language. + // This is to catch the case where a page exists on that user's wikipedia + // domain and it has no language links to the en site + if ($domain != "en") { + $h = wikipedia_find_exact($track_name, $domain); + if ($h != '') { + return $h; + } + } + + // Now try a search on the english site. We can be more wide-ranging in this search + // we do this in English because (a) it has the most stuff and (b) I can speak it. + // We can find translation links later. + $h = wikipedia_track_search($track_name, $artist_name); + if ($h != '') { + return $h; + } + + $h = find_dismbiguation_page($track_name); + if ($h != '') { + return $h; + } + + return wikipedia_get_list_of_suggestions($track_name); +} + +function wikipedia_track_search($track, $trackartist) { + + logger::log("WIKIPEDIA TRACK", "Searching Wikipedia for ".$track." (song) by ".$trackartist); + $xml = wikipedia_request('http://en.wikipedia.org/w/api.php?action=query&list=search&srsearch=' . rawurlencode($track." (song)") . '&srprop=score&format=xml'); + $albuminfo = simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA); + + // Comments assume the following: + // track is 'A Track' + // artist is 'An Artist' + + $page = null; + + // Look for 'A Track (An Artist song)' + foreach ($albuminfo->query->search->p as $id) { + $searchstring = prepare_string($track).'\s+\('.prepare_string($trackartist).' song\)'; + // logger::log("WIKIDEBUG", "1. Checking page ".$id['title']." against ".$searchstring); + if (preg_match('/^\s*' . $searchstring . '/i', $id['title'])) { + logger::log("WIKIPEDIA", "Found Page : ".$id['title']); + $page = $id['title']; + break; + } + } + + // Look for 'A Track (song)' + if ($page == null) { + foreach ($albuminfo->query->search->p as $id) { + $searchstring = prepare_string($track).'\s+\(song\)'; + // logger::log("WIKIDEBUG", "2. Checking page ".$id['title']." against ".$searchstring); + if (preg_match('/^\s*' . $searchstring . '/i', $id['title'])) { + logger::log("WIKIPEDIA", "Found Page : ".$id['title']); + $page = $id['title']; + break; + } + } + } + + // Look for 'A Track' + if ($page == null) { + foreach ($albuminfo->query->search->p as $id) { + $searchstring = prepare_string($track); + // logger::log("WIKIDEBUG", "3. Checking page ".$id['title']." against ".$searchstring); + if (preg_match('/^\s*' . $searchstring . '\s*$/i', $id['title'])) { + logger::log("WIKIPEDIA", "Found Page : ".$id['title']); + $page = $id['title']; + break; + } + } + } + + if ($page == null) { + logger::log("WIKIPEDIA TRACK", "Searching Wikipedia for ".$track); + $xml = wikipedia_request('http://en.wikipedia.org/w/api.php?action=query&list=search&srsearch=' . rawurlencode($track) . '&srprop=score&format=xml'); + $album2info = simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA); + foreach ($album2info->query->search->p as $id) { + $searchstring = prepare_string($track); + // logger::log("WIKIDEBUG", "3. Checking page ".$id['title']." against ".$searchstring); + if (preg_match('/^\s*' . $searchstring . '\s*$/i', $id['title'])) { + logger::log("WIKIPEDIA", "Found Page : ".$id['title']); + $page = $id['title']; + break; + } + } + } + + if ($page == null) { + return null; + } + + logger::log("WIKIPEDIA TRACK", "Track search found page ".$page); + return get_wikipedia_page(preg_replace('/ /', '_', $page), "en.wikipedia.org", true); + +} + +?> diff --git a/www/rompr/browser/helpers/discogs.js b/www/rompr/browser/helpers/discogs.js new file mode 100644 index 0000000..64657b8 --- /dev/null +++ b/www/rompr/browser/helpers/discogs.js @@ -0,0 +1,157 @@ +var discogs = function() { + + var baseURL = 'https://api.discogs.com/'; + var queue = new Array(); + var throttle = null; + + return { + + request: function(reqid, data, success, fail) { + + queue.push( {flag: false, reqid: reqid, data: data, success: success, fail: fail } ); + debug.debug("DISCOGS","New request",data.url,"throttle is",throttle,"length is",queue.length); + if (throttle == null && queue.length == 1) { + discogs.getrequest(); + } + + }, + + getrequest: function() { + + var req = queue[0]; + clearTimeout(throttle); + + if (req !== undefined) { + if (req.flag) { + debug.error("DISCOGS","Request just pulled from queue is already being handled",req.data.url); + return; + } + queue[0].flag = true; + debug.debug("DISCOGS","Taking next request from queue",req.data); + var getit = $.ajax({ + method: 'POST', + url: "browser/backends/getdidata.php", + data: req.data, + dataType: "json" + }) + .done(function(data) { + var c = getit.getResponseHeader('Pragma'); + debug.debug("DISCOGS", "Request Success",c,data); + if (c == "From Cache") { + throttle = setTimeout(discogs.getrequest, 100); + } else { + throttle = setTimeout(discogs.getrequest, 1500); + } + req = queue.shift(); + if (data === null) { + data = {error: language.gettext("discogs_error")} + } else if (!data.error) { + // info_discogs.js was written to accept jsonp data passed back from $.jsonp + // However as Discogs now seem to be refusing to respond to those requests + // we're using a php script to get it instead. So here we bodge the response + // into the form that info_discogs.js is expecting. + data = {data: data}; + } + if (req.reqid != '') { + data.id = req.reqid; + } + if (data.error) { + req.fail(data); + } else { + req.success(data); + } + }) + .fail(function(xhr,status,err) { + throttle = setTimeout(discogs.getrequest, 1500); + req = queue.shift(); + debug.warn("DISCOGS","Request failed",req,xhr); + data = {error: language.gettext("discogs_error") + ' ('+xhr.status+' '+err+')'}; + if (req.reqid != '') { + data.id = req.reqid; + } + req.fail(data); + }); + } else { + throttle = null; + } + }, + + artist: { + + search: function(name, success, fail) { + var data = { + url: baseURL+'database/search', + type: 'artist', + q: name + } + discogs.request('', data, success, fail); + }, + + getInfo: function(reqid, id, success, fail) { + var data = {url: baseURL+'artists/'+id}; + discogs.request(reqid, data, success, fail); + }, + + getReleases: function(name, page, reqid, success, fail) { + debug.log("DISCOGS","Get Artist Releases",name,page); + var data = { + url: baseURL+'artists/'+name+'/releases', + per_page: 25, + page: page + }; + discogs.request(reqid, data, success, fail); + } + }, + + album: { + + getInfo: function(reqid, id, success, fail) { + // NOTE id must be either releases/id or masters/id + var data = {url: baseURL+id}; + discogs.request(reqid, data, success, fail); + }, + + search: function(artist, album, success, fail) { + var data = { + url: baseURL+'database/search', + type: 'release', + artist: artist, + release_title: album + }; + discogs.request('', data, success, fail); + } + + }, + + track: { + + getInfo: function(reqid, id, success, fail) { + // NOTE id must be either releases/id or masters/id + var data = {url: baseURL+id}; + discogs.request(reqid, data, success, fail); + }, + + search: function(artist, track, success, fail) { + var data = { + url: baseURL+'database/search', + type: 'release', + artist: artist, + track: track + }; + discogs.request('', data, success, fail); + } + + }, + + label: { + + getInfo: function(reqid, id, success, fail) { + // NOTE id must be either releases/id or masters/id + var data = {url: baseURL+'labels/'+id}; + discogs.request(reqid, data, success, fail); + } + } + + } + +}(); diff --git a/www/rompr/browser/helpers/musicbrainz.js b/www/rompr/browser/helpers/musicbrainz.js new file mode 100644 index 0000000..b6f08eb --- /dev/null +++ b/www/rompr/browser/helpers/musicbrainz.js @@ -0,0 +1,199 @@ +var musicbrainz = function() { + + var baseURL = 'http://musicbrainz.org/ws/2/'; + var coverURL = 'http://coverartarchive.org/release/'; + var queue = new Array(); + var throttle = null; + + return { + + request: function(reqid, data, success, fail) { + + queue.push( {flag: false, reqid: reqid, data: data, success: success, fail: fail } ); + debug.debug("MUSICBRAINZ","New request",data.url); + if (throttle == null && queue.length == 1) { + musicbrainz.getrequest(); + } + + }, + + getrequest: function() { + + var req = queue[0]; + clearTimeout(throttle); + + if (req) { + if (req.flag) { + debug.error("MUSICBRAINZ","Request just pulled from queue is already being handled"); + return; + } + queue[0].flag = true; + debug.debug("MUSICBRAINZ","Taking next request from queue",req.data); + var getit = $.ajax({ + method: 'POST', + url: "browser/backends/getmbdata.php", + data: req.data, + dataType: "json", + }) + .done(function(data) { + var c = getit.getResponseHeader('Pragma'); + debug.debug("MUSICBRAINZ","Request success",c,data); + if (c == "From Cache") { + throttle = setTimeout(musicbrainz.getrequest, 100); + } else { + throttle = setTimeout(musicbrainz.getrequest, 1500); + } + req = queue.shift(); + if (data === null) { + data = {error: language.gettext("musicbrainz_error")}; + } + if (req.reqid != '') { + data.id = req.reqid; + } + if (data.error) { + req.fail(data); + } else { + req.success(data); + } + }) + .fail(function(xhr,status,err) { + throttle = setTimeout(musicbrainz.getrequest, 1500); + req = queue.shift(); + debug.warn("MUSICBRAINZ","Request failed",req,xhr); + data = {error: language.gettext("musicbrainz_noinfo") + ' ('+xhr.status+' '+err+')'}; + if (req.reqid != '') { + data.id = req.reqid; + } + req.fail(data); + }); + } else { + throttle = null; + } + }, + + artist: { + + getInfo: function(mbid, success, fail) { + var data = { + url: baseURL+'artist/'+mbid, + inc: 'aliases+tags+ratings+release-groups+artist-rels+label-rels+url-rels+release-group-rels+annotation', + fmt: 'json' + }; + musicbrainz.request('', data, success, fail); + + }, + + getReleases: function(mbid, reqid, success, fail) { + var result = { id: reqid }; + result['release-groups'] = new Array(); + (function getAllReleaseGroups() { + var data = { + url: baseURL+'release-group', + artist: mbid, + limit: 100, + fmt: 'json', + inc: 'artist-credits+tags+ratings+url-rels+annotation', + offset: result['release-groups'].length + }; + musicbrainz.request(reqid, data, function(data) { + debug.debug("MUSICBRAINZ","Release group data:",data); + if (data.error) { + if (result['release-groups'].length > 0) { + success(result); + } else { + fail(data); + } + } else { + for (var i in data['release-groups']) { + result['release-groups'].push(data['release-groups'][i]); + } + if (result['release-groups'].length == data['release-group-count']) { + success(result); + } else { + getAllReleaseGroups(); + } + } + + + }, fail); + })(); + } + + }, + + album: { + + getInfo: function(mbid, success, fail) { + var data = { + url: baseURL+'release/'+mbid, + inc: 'annotation+tags+ratings+artists+labels+recordings+release-groups+artist-credits+url-rels+release-group-rels+recording-rels+artist-rels', + fmt: 'json' + }; + musicbrainz.request('', data, success, fail); + + }, + + getCoverArt: function(id, success, fail) { + var data = {url: coverURL + id + "/" }; + musicbrainz.request('', data, success, fail); + }, + + }, + + releasegroup: { + + getInfo: function(mbid, reqid, success, fail) { + var data = { + url: baseURL+'release-group/'+mbid, + inc: 'artists+releases+artist-rels+label-rels+url-rels', + fmt: 'json' + }; + musicbrainz.request(reqid, data, success, fail); + } + }, + + track: { + + getInfo: function(mbid, success, fail) { + var data = { + url: baseURL+'recording/'+mbid, + inc: 'annotation+tags+ratings+releases+url-rels+work-rels+release-rels+release-group-rels+artist-rels+label-rels+recording-rels', + fmt: 'json' + }; + var result = {}; + // For a track, although there might be some good stuff in the recording data, what we really want + // is the associated work, if there is one, because that's where the wiki and discogs links will probably be. + musicbrainz.request('', data, + function(data) { + result.recording = data; + debug.debug("MUSICBRAINZ","Scanning recording for work data"); + for (var i in data.relations) { + if (data.relations[i].work) { + debug.debug("MUSICBRAINZ","Found work data",data.relations[i].work.id); + var newdata = { + url: baseURL+'work/'+data.relations[i].work.id, + inc: 'annotation+tags+ratings+url-rels+artist-rels', + fmt: 'json' + }; + musicbrainz.request('', newdata, + function(workdata) { + debug.debug("MUSICBRAINZ","Got work data",workdata); + result.work = workdata; + success(result); + }, + function(workdata) { + debug.debug("MUSICBRAINZ","Got NO work data",workdata); + success(result); + }); + return; + } + } + success(result); + }, + fail); + } + } + + } + +}(); diff --git a/www/rompr/browser/helpers/soundcloud.js b/www/rompr/browser/helpers/soundcloud.js new file mode 100644 index 0000000..e11b610 --- /dev/null +++ b/www/rompr/browser/helpers/soundcloud.js @@ -0,0 +1,40 @@ +var soundcloud = function() { + + var self = this; + + return { + getTrackInfo: function(mopidyURI, callback) { + // "soundcloud:song/King Tubby meets Soul Rebel Uptown.92868852" + debug.log("SOUNDCLOUD","Trying to get track info from",mopidyURI); + var a = mopidyURI.match(/(\d+)$/); + var tracknum = a[1]; + debug.log("SOUNDCLOUD","Getting soundcloud info for track",tracknum); + $.ajax({ + method: 'POST', + dataType: 'json', + url: 'browser/backends/getscdata.php', + data: {url: 'tracks/'+tracknum+'.json'} + }) + .done(callback) + .fail(function(xhr,status,err) { + debug.warn("SOUNDCLOUD","SoundCloud Error",xhr); + callback(xhr.responseJSON); + }); + }, + + getUserInfo: function(userid, callback) { + debug.log("SOUNDCLOUD","Getting soundcloud info for user",userid); + $.ajax({ + method: 'POST', + dataType: 'json', + url: 'browser/backends/getscdata.php', + data: {url: 'users/'+userid+'.json'} + }) + .done(callback) + .fail(function(xhr,status,err) { + debug.warn("SOUNDCLOUD","SoundCloud Error",xhr); + callback(xhr.responseJSON); + }); + } + } +}(); diff --git a/www/rompr/browser/helpers/spotify.js b/www/rompr/browser/helpers/spotify.js new file mode 100644 index 0000000..129bfca --- /dev/null +++ b/www/rompr/browser/helpers/spotify.js @@ -0,0 +1,216 @@ +var spotify = function() { + + var baseURL = 'https://api.spotify.com'; + var queue = new Array(); + var throttle = null; + var collectedobj = null; + var getit; + var rate = 500; + var backofftimer; + + function objFirst(obj) { + for (var a in obj) { + return a; + } + } + + return { + + request: function(reqid, url, success, fail, prio, cache) { + + if (prio && queue.length > 1) { + queue.splice(1, 0, {flag: false, reqid: reqid, url: url, success: success, fail: fail, cache: cache } ); + } else { + queue.push( {flag: false, reqid: reqid, url: url, success: success, fail: fail, cache: cache } ); + } + debug.debug("SPOTIFY","New request",url,throttle,queue.length,cache); + if (throttle == null && queue.length == 1) { + spotify.getrequest(); + } + + }, + + requestSuccess: function(data) { + var c = getit.getResponseHeader('Pragma'); + debug.debug("SPOTIFY","Request success",c,data); + req = queue.shift(); + if (data === null) { + debug.warn("SPOTIFY","No data in response",req); + data = {error: language.gettext("spotify_error")}; + } + if (req.reqid != '') { + data.reqid = req.reqid; + } + var root = objFirst(data); + if (data[root].next) { + debug.log("SPOTIFY","Got a response with a next page!"); + if (data[root].previous == null) { + collectedobj = data; + } else { + collectedobj[root].items = collectedobj[root].items.concat(data[root].items); + } + queue.unshift({flag: false, reqid: '', url: data[root].next, success: req.success, fail: req.fail}); + } else if (data[root].previous) { + collectedobj[root].items = collectedobj[root].items.concat(data[root].items); + debug.log("SPOTIFY","Returning concatenated multi-page result"); + req.success(collectedobj); + } else if (data.next) { + debug.log("SPOTIFY","Got a response with a next page!"); + if (data.previous == null) { + collectedobj = data; + } else { + collectedobj.items = collectedobj.items.concat(data.items); + } + queue.unshift({flag: false, reqid: '', url: data.next, success: req.success, fail: req.fail}); + } else if (data.previous) { + collectedobj.items = collectedobj.items.concat(data.items); + debug.log("SPOTIFY","Returning concatenated multi-page result"); + req.success(collectedobj); + } else { + req.success(data); + } + + if (c == "From Cache") { + throttle = setTimeout(spotify.getrequest, 100); + } else { + throttle = setTimeout(spotify.getrequest, rate); + } + + }, + + requestFail: function(xhr,status,err) { + if (xhr.responseJSON.error == 429) { + debug.warn("SPOTIFY","Too Many Requests. Slowing Request Rate"); + rate += rate; + clearTimeout(backofftimer); + backofftimer = setTimeout(spotify.speedBackUp, 90000); + } + throttle = setTimeout(spotify.getrequest, rate); + req = queue.shift(); + debug.warn("SPOTIFY","Request failed",req,xhr,status,err); + data = {error: language.gettext("spotify_noinfo") + ' ('+xhr.responseJSON.error+' '+xhr.responseJSON.message+')'} + if (req.reqid != '') { + data.reqid = req.reqid; + } + req.fail(data); + }, + + speedBackUp: function() { + rate = 500; + }, + + getrequest: function() { + + var req = queue[0]; + clearTimeout(throttle); + + if (req) { + if (req.flag) { + debug.warn("SPOTIFY","Request just pulled from queue is already being handled",req,throttle); + return; + } + queue[0].flag = true; + debug.debug("SPOTIFY","Taking next request from queue",req.url); + getit = $.ajax({ + type: 'POST', + url: "browser/backends/getspdata.php", + dataType: "json", + data: { + url: req.url, + cache: req.cache + } + }) + .done(spotify.requestSuccess) + .fail(spotify.requestFail); + } else { + throttle = null; + } + }, + + track: { + + getInfo: function(id, success, fail, prio) { + var url = baseURL + '/v1/tracks/' + id; + spotify.request('', url, success, fail, prio, true); + }, + + checkLinking: function(id, success, fail, prio) { + var url = baseURL + '/v1/tracks/' + id + '?market='+prefs.lastfm_country_code; + spotify.request('', url, success, fail, prio, false); + } + + }, + + tracks: { + + checkLinking: function(ids, success, fail, prio) { + var url = baseURL + '/v1/tracks?ids='+ids.join(',')+'&market='+prefs.lastfm_country_code; + spotify.request('', url, success, fail, prio, false); + } + + }, + + album: { + + getInfo: function(id, success, fail, prio) { + var url = baseURL + '/v1/albums/' + id; + spotify.request(id, url, success, fail, prio, true); + }, + + getMultiInfo: function(ids, success, fail, prio) { + var url = baseURL + '/v1/albums/?ids=' + ids.join(); + spotify.request('', url, success, fail, prio, true); + } + + }, + + artist: { + + getInfo: function(id, success, fail, prio) { + var url = baseURL + '/v1/artists/' + id; + spotify.request('', url, success, fail, prio, true); + }, + + getRelatedArtists: function(id, success, fail, prio) { + var url = baseURL + '/v1/artists/' + id + '/related-artists' + spotify.request('', url, success, fail, prio, true); + }, + + getTopTracks: function(id, success, fail, prio) { + var url = baseURL + '/v1/artists/' + id + '/top-tracks' + spotify.request('', url, success, fail, prio, true); + }, + + getAlbums: function(id, types, success, fail, prio) { + var url = baseURL + '/v1/artists/'+id+'/albums?album_type='+types+'&market='+prefs.lastfm_country_code+'&limit=50'; + spotify.request(id, url, success, fail, prio, true); + }, + + search: function(name, success, fail, prio) { + var url = baseURL + '/v1/search?q='+name.replace(/&|%|@|:|\+|'|\\|\*|"|\?|\//g,'').replace(/\s+/g,'+')+'&type=artist'; + spotify.request('', url, success, fail, prio, true); + } + + }, + + recommendations: { + + getGenreSeeds: function(success, fail) { + var url = baseURL + '/v1/recommendations/available-genre-seeds'; + spotify.request('', url, success, fail, true, true); + }, + + getRecommendations: function(param, success, fail) { + var p = new Array(); + for (var i in param) { + p.push(i+'='+encodeURIComponent(param[i])); + } + var paramstring = p.join('&'); + var url = baseURL + '/v1/recommendations?'+paramstring; + spotify.request('', url, success, fail, false, false); + } + + } + + } +}(); diff --git a/www/rompr/browser/helpers/wikipedia.js b/www/rompr/browser/helpers/wikipedia.js new file mode 100644 index 0000000..e953c28 --- /dev/null +++ b/www/rompr/browser/helpers/wikipedia.js @@ -0,0 +1,77 @@ +var wikipedia = function() { + + return { + + getLanguage: function() { + if (lastfm.getLanguage()) { + return lastfm.getLanguage(); + } else { + return "en"; + } + }, + + search: function(terms, successCallback, failCallback) { + terms.lang = wikipedia.getLanguage(); + terms.layout = skin; + $.ajax({ + type: "POST", + url: "browser/backends/info_wikipedia.php", + data: terms, + dataType: "xml" + }) + .done(successCallback) + .fail(failCallback); + }, + + getFullUri: function(terms, successCallback, failCallback) { + terms.lang = wikipedia.getLanguage(); + terms.layout = skin; + $.ajax({ + type: "POST", + url: "browser/backends/info_wikipedia.php", + data: terms, + dataType: "xml" + }) + .done(successCallback) + .fail(failCallback); + }, + + wikiMediaPopup: function(element, event) { + var thing = element.attr("name"); + debug.log("WIKIPEDIA","Clicked element has name",thing); + var a = thing.match(/(.*?)\/(.*)/); + if (a && a[1] && a[2]) { + var fname = a[2]; + if (fname.match(/jpg$/i) || fname.match(/gif$/i) || fname.match(/png$/i) || fname.match(/jpeg$/i) || fname.match(/svg$/i) || fname.match(/bmp$/i)) { + imagePopup.create(element, event); + var url = "http://"+a[1]+"/w/api.php?action=query&iiprop=url|size&prop=imageinfo&titles=" + a[2] + "&format=json&callback=?"; + $.getJSON(url, function(data) { + $.each(data.query.pages, function(index, value) { + imagePopup.create(element, event, 'getRemoteImage.php?url='+value.imageinfo[0].url); + return false; + }); + }).fail( function() { imagePopup.close() }); + } + } + return false; + }, + + getWiki: function(link, successCallback, failCallback) { + $("#infopane").css({cursor:'wait'}); + $("#infopane a").css({cursor:'wait'}); + $.ajax({ + type: "POST", + url: "browser/backends/info_wikipedia.php", + data: {wiki: link, layout: skin}, + dataType: "xml" + }) + .done(successCallback) + .fail(failCallback) + .always(function() { + $("#infopane").css({cursor:'auto'}); + $("#infopane a").css({cursor:'auto'}); + }); + }, + } + +}(); diff --git a/www/rompr/browser/info.js b/www/rompr/browser/info.js new file mode 100644 index 0000000..2e2fee6 --- /dev/null +++ b/www/rompr/browser/info.js @@ -0,0 +1,573 @@ +var browser = function() { + + var history = [{ + source: "", + artist: { + name: "", + }, + album: { + name: "", + artist: "", + }, + track: { + name: "", + } + }]; + var displaypointer = 0; + var panelclosed = {artist: false, album: false, track: false}; + var waitingon = {artist: false, album: false, track: false, index: -1, source: null}; + var extraPlugins = []; + var maxhistorylength = 20; + var sources = nowplaying.getAllPlugins(); + var doneone = false; + + function displayTheData(ptr, showartist, showalbum, showtrack) { + var a = waitingon.artist; + var b = waitingon.album; + var c = waitingon.track; + waitingon = { artist: a || showartist, + album: b || showalbum, + track: c || showtrack, + index: history[ptr].mastercollection.nowplayingindex, + source: history[ptr].source + }; + debug.log("BROWSER", "Waiting on source",waitingon.source,"for index", waitingon.index); + if (waitingon.source != prefs.infosource) { + // Need to do this here rather than in switchsource otherwise it prevents + // the browser from accepting the update + $("#button_source"+prefs.infosource).removeClass("currentbun"); + prefs.save({infosource: waitingon.source}); + debug.log("BROWSER", "Source switched to",prefs.infosource); + $("#button_source"+prefs.infosource).addClass("currentbun"); + } + for (var i in waitingon) { + if (waitingon[i] === true) { + $("#"+i+"information").html(waitingBanner(i)); + } + } + for (var i = 1; i < history.length-1; i++) { + history[i].mastercollection.stopDisplaying(); + } + // Remember, here we tell artist, album, and track to display even if we only want one of them. + // This is because we need the new collections to handle clicks and other stuff, + // as otherwise it all gets very out of hand and impossible to follow, + // mainly because it's super tricky to keep the stopDisplaying/displayData displaying flags + // all in sync since they're global to one dataCollection and not individual for artist, + // album, and track. (This was tried before and got stupid). + history[ptr].mastercollection.sendDataToBrowser(waitingon); + if (displaypointer == history.length-1) { + // We only allow artist switching on the current playing track. + // It's not that it doesn't work, but it means the artist switch gets added to + // the end of history and then you have to go back to get to the current track, + // which means things stop auto-updating. + // Also it makes truncating the history really hard. + // TODO perhaps artist switches should be spliced in? + history[ptr].mastercollection.doArtistChoices(); + } else { + if ($("#artistchooser").is(':visible')) { + $("#artistchooser").slideUp('fast'); + } + } + + } + + function waitingBanner(which) { + var html = ''; + return html; + } + + function banner(data, title, hidden, source, close) { + var html = ''; + html += '
    ' + +language.gettext("button_history") + +'
    ' + ); + if (displaypointer == 1) { + $("#backbutton").off('click').addClass('button-disabled'); + } + if (displaypointer > 1 && $("#backbutton").hasClass('button-disabled')) { + $("#backbutton").on('click', browser.back ); + $("#backbutton").removeClass('button-disabled'); + } + if (displaypointer == (history.length)-1) { + $("#forwardbutton").off('click').addClass('button-disabled'); + } + if (displaypointer < (history.length)-1 && $("#forwardbutton").hasClass('button-disabled')) { + $("#forwardbutton").on('click', browser.forward ); + $("#forwardbutton").removeClass('button-disabled'); + } + + var bits = ["artist","album","track"]; + var t = $('', {class: 'histable', width: '100%'}).appendTo('#historypanel'); + + for (var i = 1; i < history.length; i++) { + var clas = "top clickable clickicon"; + if (i == displaypointer) { + clas = clas + " current"; + } + var r = $('', {class: clas, name: i}).appendTo(t); + r.append(''); + var td = $(''; + html += ''; + $('table[name="'+table+'tagtable"]').append(html); + $(".newtag").fadeIn('fast', function(){ + $(this).removeClass('newtag'); + }); + } + + function getArtistHTML(lfmdata, parent, artistmeta) { + if (lfmdata.error()) { + return formatLastFmError(lfmdata, 'artist'); + } + var html = sectionHeader(lfmdata); + html += '
    '; + + html += doTags(lfmdata.tags()); + if (lastfm.isLoggedIn()) { + html += tagsInput("artist"); + html += doUserTags("artist"); + } + + html += '
    '; + + html += '
    '; + html += lastfm.formatBio(lfmdata.bio(), lfmdata.url()); + html += '
    '; + html += ''; + + var similies = lfmdata.similar(); + if (similies.length > 0 && typeof similies[0].name != 'undefined') { + html += '

    '+language.gettext("lastfm_simar")+'

    '; + html += '
    ').appendTo(r); + var html = ''; + bits.forEach(function(n) { + if (history[i][n].collection) { + html += history[i][n].collection.bannername()+'
    '; + } else { + html += language.gettext("label_"+n)+' : '+history[i][n].name+'
    '; + } + }); + td.html(html); + } + $('#historypanel').on('click', browser.historyClicked); + } + + function removeSection(section) { + extraPlugins[section].parent.close(); + extraPlugins[section].div.fadeOut('fast', function() { + extraPlugins[section].div.empty(); + extraPlugins[section].div.remove(); + extraPlugins[section].div = null; + if ($('#pluginholder').length > 0 && openPlugins() == 0) { + layoutProcessor.sourceControl('specialplugins'); + } + }); + } + + function openPlugins() { + var c = 0; + for (var i in extraPlugins) { + if (extraPlugins[i].div !== null) { + c++; + } + } + return c; + } + + function checkHistoryLength() { + if (history.length > maxhistorylength) { + debug.shout("BROWSER", "Truncating History"); + var np = history[1].mastercollection.nowplayingindex; + history.splice(1,1); + displaypointer--; + for (var i = 1; i < history.length; i++) { + // Scan our history to see if this nowplayingindex is being used anywhere else + if (history[i].mastercollection.nowplayingindex == np) { + return; + } + } + debug.log("BROWSER","Telling nowplaying to remove nowplayingindex",np); + nowplaying.remove(np); + } + } + + return { + + historyClicked: function(event) { + var clickedRow = $(event.target); + while (!clickedRow.hasClass('clickable') && !clickedRow.is('#historypanel')) { + clickedRow = clickedRow.parent(); + } + if (clickedRow.hasAttr('name')) { + browser.doHistory(clickedRow.attr('name')); + } + }, + + areweatfront: function() { + debug.log("BROWSER","displaypointer:",displaypointer,"historylength",history.length); + return (displaypointer == history.length - 1); + }, + + createButtons: function() { + for (var i in sources) { + if (sources[i].icon !== null) { + debug.log("BROWSER", "Found plugin", i,sources[i].icon); + layoutProcessor.addInfoSource(i, sources[i]); + } + } + layoutProcessor.setupInfoButtons(); + }, + + nextSource: function(direction) { + var s = new Array(); + for (var i in sources) { + if (sources[i].icon !== null) { + s.push(i); + } + } + var cursourceidx = s.indexOf(prefs.infosource); + var newsourceidx = cursourceidx+direction; + if (newsourceidx >= s.length) newsourceidx = 0; + if (newsourceidx < 0) newsourceidx = s.length-1; + browser.switchsource(s[newsourceidx]); + }, + + dataIsComing: function(mastercollection, isartistswitch, nowplayingindex, source, trackartist, artist, albumartist, album, track) { + debug.log("BROWSER","Data is coming",isartistswitch, nowplayingindex, source, artist, albumartist, album, track) + if (prefs.hidebrowser) { + debug.log("BROWSER","Browser is hidden. Ignoring Data"); + return; + } + var showalbum = (album != history[displaypointer].album.name || albumartist != history[displaypointer].album.artist || source != prefs.infosource); + var showartist = (isartistswitch || artist != history[displaypointer].artist.name || source != prefs.infosource || + (showalbum && artist != history[displaypointer].artist.name)); + var showtrack = (track != history[displaypointer].track.name || showalbum || source != prefs.infosource); + + checkHistoryLength(); + + history.push( { + mastercollection: mastercollection, + source: source, + trackartist: trackartist, + artist: { + name: artist, + collection: null + }, + album: { + name: album, + artist: albumartist, + collection: null + }, + track: { + name: track, + collection: null + } + }); + + // Display the new data only if either: + // We are currently displaying the most recent track (ie continuous updates) + // This is an artist switch request + // This is a source switch request + // History has been truncated such that the currently displayed info needs to be removed + if (displaypointer == history.length - 2 || isartistswitch || source != prefs.infosource || displaypointer < 1) { + displaypointer = history.length - 1; + // Hack timeout to get around a problem where Masonry doesn't layout properly + // during page load. + if (doneone) { + displayTheData( displaypointer, showartist, showalbum, showtrack ); + } else { + setTimeout(function() { + displayTheData( displaypointer, showartist, showalbum, showtrack ); + doneone = true; + }, 1000); + } + } + updateHistory(); + }, + + Update: function(collection, type, source, nowplayingindex, data, scrollto, force) { + if (prefs.hidebrowser) { + return false; + } + debug.mark("BROWSER", "Got",type,"info from",source,"for index",nowplayingindex,force,waitingon); + if (force === true || (source == waitingon.source && nowplayingindex == waitingon.index)) { + if (force === true || waitingon[type]) { + debug.trace("BROWSER", " .. and we are going to display it"); + if (data.data !== null && (source == "file" || data.name !== "")) { + if ($("#"+type+"information").is(':hidden')) { + $("#"+type+"information").show(); + } + $("#"+type+"information").html(banner(data, (collection === null) ? type : collection.bannertitle(), panelclosed[type], source)+data.data); + } else { + $("#"+type+"information").empty(); + if ($("#"+type+"information").is(':visible')) { + $("#"+type+"information").hide(); + } + } + waitingon[type] = false; + if (scrollto) { + layoutProcessor.goToBrowserPanel(type); + } + return true; + } else { + return false; + } + } + }, + + reDo: function(index, source) { + if (history[displaypointer].mastercollection && index == history[displaypointer].mastercollection.nowplayingindex && source == prefs.infosource) { + debug.log("BROWSER","Re-displaying data for",source,"index",index); + displayTheData(displaypointer, true, true, true); + } + }, + + switchsource: function(src) { + debug.log("BROWSER","Switching to",src); + if (displaypointer >= 1) { + displaypointer = history.length - 1; + history[displaypointer].mastercollection.populate(src, true); + updateHistory(); + } + }, + + handleClick: function(source, element, event) { + debug.log("BROWSER","Was clicked on",source,element); + if (element.hasClass('frog')) { + toggleSection(element); + } else if (element.hasClass('tadpole')) { + removeSection(source); + } else if (element.hasClass('plugclickable')) { + extraPlugins[source].parent.handleClick(element, event); + } else if (element.hasClass('clickartistchoose')) { + nowplaying.switchArtist(history[displaypointer].source, element.next().val()); + } else { + history[displaypointer].mastercollection.handleClick(history[displaypointer].source, source, element, event); + } + }, + + // This function is for links which are followed internally by one of the panels + // eg wikipedia + speciaUpdate: function(source, panel, data) { + debug.mark("BROWSER","Special Update from",source,"for",panel); + var n = new specialUpdateCollection(source, panel, data); + + history.splice(displaypointer+1,0, { + mastercollection: history[displaypointer].mastercollection, + source: source, + trackartist: history[displaypointer].trackartist, + artist: { + name: history[displaypointer].artist.name, + collection: (panel == "artist") ? n : history[displaypointer].artist.collection + }, + album: { + name: history[displaypointer].album.name, + albumartist: history[displaypointer].albumartist, + collection: (panel == "album") ? n : history[displaypointer].album.collection + }, + track: { + name: history[displaypointer].track.name, + collection: (panel == "track") ? n : history[displaypointer].track.collection + } + }); + + waitingon[panel] = true; + waitingon.source = source; + waitingon.index = history[displaypointer].mastercollection.nowplayingindex; + displaypointer++; + updateHistory(); + browser.Update(n, panel, source, waitingon.index, data, true); + }, + + doHistory: function(index) { + debug.log("BROWSER", "Doing history, index is",index); + + var showartist = (history[index].artist.collection === null && + (history[index].artist.name != history[displaypointer].artist.name || + history[index].source != history[displaypointer].source || + history[displaypointer].artist.collection !== null)); + + var showalbum = (history[index].album.collection === null && + (history[index].album.name != history[displaypointer].album.name || + history[index].album.artist != history[displaypointer].album.artist || + history[index].source != history[displaypointer].source || + history[displaypointer].album.collection !== null)); + + var showtrack = (history[index].track.collection === null && + (history[index].track.name != history[displaypointer].track.name || + history[index].album.name != history[displaypointer].album.name || + history[index].album.artist != history[displaypointer].album.artist || + history[index].source != history[displaypointer].source || + history[displaypointer].track.collection !== null)); + + displaypointer = index; + debug.log("BROWSER","History flags are",showartist,showalbum,showtrack); + // Calling displayTheData is important even if all the showxxx flags are false + // since it makes sure the correct trackDataCollection gets its displaying flag set. + displayTheData(displaypointer, showartist, showalbum, showtrack); + updateHistory(); + + var bits = ["artist","album","track"]; + bits.forEach(function(n) { + debug.log("BROWSER","Updating",n); + if (history[index][n].collection) { + waitingon[n] = true; + waitingon.source = history[index].source; + waitingon.index = history[index].mastercollection.nowplayingindex; + browser.Update(history[index][n].collection, n, waitingon.source, waitingon.index, history[index][n].collection.getData()); + } + }); + layoutProcessor.afterHistory(); + }, + + forward: function() { + browser.doHistory(displaypointer+1); + return false; + }, + + back: function() { + browser.doHistory(displaypointer-1); + return false; + }, + + registerExtraPlugin: function(id, name, parent, help) { + var displayer; + if (prefs.hidebrowser) { + $("#hidebrowser").prop("checked", !$("#hidebrowser").is(':checked')); + prefs.save({hidebrowser: $("#hidebrowser").is(':checked')}, hideBrowser); + } + if ($('#pluginholder').length > 0 && !($('#pluginholder').is(':visible'))) { + displayer = $('
    ', {id: id+"information", class: "infotext invisible"}).appendTo('#pluginholder'); + } else { + displayer = $('
    ', {id: id+"information", class: "infotext invisible"}).insertBefore('#artistchooser'); + } + var opts = {name: name}; + if (help) { + opts.help = help; + } + displayer.html(banner(opts, id, false, false, true)); + panelclosed[id] = false; + displayer.off('click'); + extraPlugins[id] = { div: displayer, parent: parent }; + displayer.on('click', '.infoclick', onBrowserClicked); + return displayer; + }, + + goToPlugin: function(id) { + layoutProcessor.goToBrowserPlugin(id); + }, + + rePoint: function(panel, params) { + if (prefs.hidebrowser || $('#infopane').width() == 0) { return } + + debug.debug("BROWSER","Repointing"); + layoutProcessor.updateInfopaneScrollbars(); + + $('#infopane .masonified:visible').each(function() { + var h = $(this); + var width = calcPercentWidth(h, '.tagholder', 500, h.width()); + h.find(".tagholder").css('width', width.toString()+'%'); + // Check if it is being handled by Masonry, prevents early init with no paramerts + if (typeof(params) == 'undefined' && h.css('position') == 'relative') { + h.masonry(); + } + }); + + $('#infopane .masonified5.filled:visible').each(function() { + var h = $(this); + var width = calcPercentWidth(h, '.tagholder5', 260, h.width()); + h.find(".tagholder5").css('width', width.toString()+'%'); + h.find(".sizer").css('width', width.toString()+'%'); + if (typeof(params) == 'undefined' && h.css('position') == 'relative') { + h.masonry(); + } + }); + + $('#infopane .masonified2:visible').each(function() { + var h = $(this); + var width = calcPercentWidth(h, '.tagholder2', 260, h.width()); + h.find(".tagholder2").css('width', width.toString()+'%'); + h.find(".sizer").css('width', width.toString()+'%'); + h.find(".tagholder_wide").css("width", "100%"); + h.find(".brick_wide").css("width", "100%"); + if (typeof(params) == 'undefined' && h.css('position') == 'relative') { + h.masonry(); + } + }); + + $('#infopane .masonified7:visible').each(function() { + var h = $(this); + if (h.width() > 800) { + var width = 48; + } else { + var width = 99; + } + h.find(".tagholder2").css('width', width.toString()+'%'); + h.find(".tagholder_wode").css("width", "100%"); + if (typeof(params) == 'undefined' && h.css('position') == 'relative') { + h.masonry(); + } + }); + + $('#infopane .masonified4:visible').each(function() { + var h = $(this); + var width = calcPercentWidth(h, '.tagholder4', 140, h.width()); + h.find(".tagholder4").css('width', width.toString()+'%'); + if (typeof(params) == 'undefined' && h.css('position') == 'relative') { + h.masonry(); + } + }); + + $('#infopane .mixcontainer:visible').each(function() { + var h = $(this); + var w = h.width(); + var m = h.children('.mixbox'); + if (m.length == 1 || w < 700) { + m.css('width', '100%'); + } else { + m.css('width', '50%'); + } + }); + + if (typeof(params) != 'undefined') { + params.gutter = masonry_gutter; + panel.masonry(params); + } + } + } +}(); + +function specialUpdateCollection(source, panel, data) { + + this.bannertitle = function() { + return source; + } + + this.bannername = function() { + return data.name; + } + + this.getData = function() { + return data; + } + +} diff --git a/www/rompr/browser/plugins/01_info_file.js b/www/rompr/browser/plugins/01_info_file.js new file mode 100644 index 0000000..1c3157c --- /dev/null +++ b/www/rompr/browser/plugins/01_info_file.js @@ -0,0 +1,310 @@ +var info_file = function() { + + var me = "file"; + + function podComment(parent) { + if (parent.playlistinfo.type == 'podcast' && parent.playlistinfo.Comment) { + return '
    '+ + language.gettext("info_comment").replace(':','')+'
    '+parent.playlistinfo.Comment+'
    '; + } + return ''; + } + + function createInfoFromPlayerInfo(info, parent) { + + var html = ""; + var file = decodeURI(info.file); + debug.log("FILE INFO","Decoded File Name is",file); + file = file.replace(/^file:\/\//, ''); + var filetype = ""; + if (file) { + var n = file.match(/.*\.(.*?)$/); + if (n) { + filetype = n[n.length-1]; + filetype = filetype.toLowerCase(); + if (filetype.match(/\/|\?|\=/)) { + filetype = ""; + } + } + } + if (file == "null" || file == "undefined") file = ""; + html += ''; + html += ''; + html += ''; + if (filetype != "" && !file.match(/^http/)) { + html += ''; + } + if (info.bitrate && info.bitrate != 'None' && info.bitrate != 0) { + html += ''; + } + var ai = info.audio; + if (ai) { + var p = ai.split(":"); + html += ''; + } + if (info.Date) { + if (typeof info.Date == "string") { + info.Date = info.Date.split(';'); + } + html += ''; + } + + if (info.Genre) { + if (typeof info.Genre == "string") { + info.Genre = info.Genre.split(';'); + } + html += ''; + } + + if (info.Performer) { + if (typeof info.Performer == "object") { + info.Performer = info.Performer.join(';'); + } + html += ''; + } + if (info.Composer) { + if (typeof info.Composer == "object") { + info.Composer = info.Composer.join(';'); + } + html += ''; + } + if (info.Comment) { + if (typeof info.Comment == "object") { + info.Comment = info.Comment.join('
    '); + } + html += ''; + } + if (parent.playlistinfo.type == 'stream' && parent.playlistinfo.stream) { + html += ''; + } + html += '
    Format Information
    '+language.gettext("info_file")+''+file; + if (file.match(/^http:\/\/.*item\/\d+\/file/)) html += ' '+language.gettext("info_from_beets")+''; + if (info.file) { + var f = info.file.match(/^podcast[\:|\+](http.*?)\#/); + if (f && f[1]) { + html += ''+ + ''; + } + } + html += '
    '+language.gettext("info_format")+''+filetype+'
    '+language.gettext("info_bitrate")+''+info.bitrate+'
    '+language.gettext("info_samplerate")+''+p[0]+' Hz, '+p[1]+' Bit, '; + if (p[2] == 1) { + html += language.gettext("info_mono"); + } else if (p[2] == 2) { + html += language.gettext("info_stereo"); + } else { + html += p[2]+' '+language.gettext("info_channels"); + } + '
    '+language.gettext("info_date")+''+info.Date[0]+'
    '+language.gettext("info_genre")+''+info.Genre.join(', ')+'
    '+language.gettext("info_performers")+''+concatenate_artist_names(info.Performer.split(';'))+'
    '+language.gettext("info_composers")+''+concatenate_artist_names(info.Composer.split(';'))+'
    '+language.gettext("info_comment")+''+info.Comment+'
    '+language.gettext("info_comment")+''+parent.playlistinfo.stream+'
    '; + return html; + } + + function createInfoFromBeetsInfo(data) { + + var html = ""; + debug.log("FILE PLUGIN","Doing info from Beets server"); + var file = decodeURIComponent(player.status.file); + var gibbons = [ 'year', 'genre', 'label', 'disctitle', 'encoder']; + if (!file) { return "" } + html += ''; + html += ''; + html += ''; + html += ''; + if (data.bitrate) html += ''; + html += ''; + $.each(gibbons, function (i,g) { + if (data[g]) html += ''; + }); + if (data.composer) html += ''; + if (data.comments) html += ''; + html += '
    Format Information
    '+language.gettext("info_file")+''+file; + html += ' '+language.gettext("info_from_beets")+''; + html = html +'
    '+language.gettext("info_format")+''+data.format+'
    '+language.gettext("info_bitrate")+''+data.bitrate+'
    '+language.gettext("info_samplerate")+''+data.samplerate+' Hz, '+data.bitdepth+' Bit, '; + if (data.channels == 1) { + html += language.gettext("info_mono"); + } else if (data.channels == 2) { + html = html +language.gettext("info_stereo"); + } else { + html += data.channels +' '+language.gettext("info_channels"); + } + html += '
    '+language.gettext("info_"+g)+''+data[g]+'
    '+language.gettext("info_composers")+''+data.composer+'
    '+language.gettext("info_comment")+''+data.comments+'
    '; + return html; + } + + return { + getRequirements: function(parent) { + return []; + }, + + collection: function(parent, artistmeta, albummeta, trackmeta) { + + debug.trace("FILE PLUGIN", "Creating data collection"); + + var self = this; + var displaying = false; + + this.displayData = function() { + displaying = true; + self.doBrowserUpdate(); + browser.Update(null, 'album', me, parent.nowplayingindex, + { name: "", link: "", data: null } + ); + browser.Update(null, 'artist', me, parent.nowplayingindex, + { name: "", link: "", data: null } + ); + } + + this.stopDisplaying = function() { + displaying = false; + } + + this.handleClick = function(source, element, event) { + if (element.hasClass("clicksetrating")) { + nowplaying.setRating(event); + } else if (element.hasClass("clickaddtocollection")) { + nowplaying.addTrackToCollection(event, parent.nowplayingindex); + } else if (element.hasClass("clickremtag")) { + nowplaying.removeTag(event, parent.nowplayingindex); + } else if (element.hasClass("clickaddtags")) { + tagAdder.show(event, parent.nowplayingindex); + } + } + + this.populate = function() { + if (trackmeta.fileinfo === undefined) { + var file = parent.playlistinfo.file; + var m = file.match(/^beets:library:track(:|;)(\d+)/) + if (m && m[2] && prefs.beets_server_location != '') { + debug.trace("FILE PLUGIN","File is from beets server",m[2]); + self.updateBeetsInformation(m[2]); + } else { + setTimeout(function() { + player.controller.do_command_list([], self.updateFileInformation) + }, 1000); + } + } else { + debug.mark("FILE PLUGIN",parent.nowplayingindex,"is already populated"); + } + } + + this.updateFileInformation = function() { + trackmeta.fileinfo = {beets: null, player: cloneObject(player.status)}; + debug.log("FILE PLUGIN","Doing update from",trackmeta); + trackmeta.lyrics = null; + player.controller.checkProgress(); + self.doBrowserUpdate(); + } + + this.updateBeetsInformation = function(thing) { + // Get around possible same origin policy restriction by using a php script + $.getJSON('browser/backends/getBeetsInfo.php', 'uri='+thing) + .done(function(data) { + debug.trace("FILE PLUGIN",'Got info from beets server',data); + trackmeta.fileinfo = {beets: data, player: null}; + if (data.lyrics) { + debug.shout("FILE PLUGIN","Got lyrics from Beets Server"); + trackmeta.lyrics = data.lyrics; + } else { + trackmeta.lyrics = null; + } + self.doBrowserUpdate(); + + }) + .fail( function() { + debug.error("FILE PLUGIN", "Error getting info from beets server"); + self.updateFileInformation(); + }); + } + + this.ratingsInfo = function() { + var html = ""; + debug.shout("FILE PLUGIN","Doing the monkey spanner",trackmeta); + if (trackmeta.usermeta) { + html += ''; + html += ''; + if (typeof trackmeta.usermeta.Playcount != 'undefined') { + html += ''; + } + if (typeof trackmeta.usermeta.Last != 'undefined' && trackmeta.usermeta.Last != 0) { + var t = parseInt(trackmeta.usermeta.Last) * 1000; + var d = new Date(t); + var s = d.toLocaleTimeString(getLocale(), { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' }); + html += ''; + } + if (prefs.player_backend == 'mopidy') { + html += ''; + } + if (trackmeta.usermeta.isSearchResult < 2 && trackmeta.usermeta.Hidden == 0) { + var t = parseInt(trackmeta.usermeta.DateAdded) * 1000; + var d = new Date(t); + var s = d.toLocaleDateString(getLocale(), { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' }); + html += ''; + } + html += ''; + html += ''; + } + html += '
    Collection Information
    '; + switch (trackmeta.usermeta.Playcount) { + case '0': + html += language.gettext('played_never'); + break + case '1': + html += language.gettext('played_once'); + break + case '2': + html += language.gettext('played_twice'); + break + default: + html += language.gettext('played_n',[trackmeta.usermeta.Playcount]); + break + } + html += '
    '+language.gettext('played_last',[s]); + html += '
    '; + if (trackmeta.usermeta.isSearchResult < 2 && trackmeta.usermeta.Hidden == 0) { + html += 'This track is in the Music Collection'; + } else { + html += 'This track is not in the Music Collection. Click to add it'; + } + html += '
    '+language.gettext('added_on',[s]); + html += '
    Rating:'; + html += ''; + html += ''; + html += '
    '+language.gettext("musicbrainz_tags")+''; + for(var i = 0; i < trackmeta.usermeta.Tags.length; i++) { + if (trackmeta.usermeta.Tags[i] != '') { + html += ''+trackmeta.usermeta.Tags[i]+' '; + } + } + html += '
    '; + return html; + } + + this.doBrowserUpdate = function() { + if (displaying && trackmeta.fileinfo !== undefined) { + var data = '
    '; + // data += '
    '; + data += '
    '; + data += (trackmeta.fileinfo.player !== null) ? createInfoFromPlayerInfo(trackmeta.fileinfo.player, parent) : createInfoFromBeetsInfo(trackmeta.fileinfo.beets); + data += '
    '; + data += '
    '; + data += self.ratingsInfo(); + data += '
    '; + data += podComment(parent); + data += '
    '; + browser.Update( + null, + 'track', + me, + parent.nowplayingindex, + { name: trackmeta.name, + link: "", + data: data + } + ); + browser.rePoint($('#tinfobox'), { itemSelector: '.brick', columnWidth: '.dingo', percentPosition: true }); + } + } + } + } +}(); + +nowplaying.registerPlugin("file", info_file, "icon-library", "button_fileinfo"); diff --git a/www/rompr/browser/plugins/02_info_lastfm.js b/www/rompr/browser/plugins/02_info_lastfm.js new file mode 100644 index 0000000..68410d3 --- /dev/null +++ b/www/rompr/browser/plugins/02_info_lastfm.js @@ -0,0 +1,829 @@ +var info_lastfm = function() { + + var me = "lastfm"; + var medebug = "LASTFM PLUGIN"; + + function formatLastFmError(lfmdata, type) { + if (lfmdata.errorcode() == 6) { + return '

    '+language.gettext('label_no'+type+'info')+'

    '; + } else { + return '

    '+lfmdata.error()+'

    '; + } + } + + function sectionHeader(data) { + var html = '
    '; + html += '
      '; + html += '
    • '+language.gettext("lastfm_listeners")+' '+data.listeners()+'
    • '; + html += '
    • '+language.gettext("lastfm_plays")+' '+data.playcount()+'
    • '; + html += '
    • '+language.gettext("lastfm_yourplays")+' '+data.userplaycount()+'
    • '; + return html; + } + + function doTags(taglist) { + debug.trace(medebug," Doing Tags"); + var html = '
      • '+language.gettext("lastfm_toptags")+'
      • '; + for(var i in taglist) { + if (taglist[i].name) { + html += ''; + } + } + html += '
        '+taglist[i].name+'
      '; + return html; + } + + function tagsInput(type) { + var html = '
      • '+language.gettext("lastfm_addtags")+'
      • '; + html += '
      • '+language.gettext("lastfm_addtagslabel")+'
      • '; + html += '
      • '; + html += ''+ + '
      '; + return html; + } + + function doUserTags(name) { + var html = '
      • '+language.gettext("lastfm_yourtags")+'
      • '; + html += '
      '; + return html; + } + + function findTag(name, taglist) { + for(var i in taglist) { + if (name == taglist[i].name) { + debug.debug("FINDTAG", "Found tag",name); + return true; + } + } + return false; + } + + function findTag2(name, table) { + var retval = false; + table.find('tr').each( function() { + var n = $(this).find('a').text(); + if (n.toLowerCase() == name.toLowerCase()) { + debug.debug("FINDTAG 2",'Found Tag',name); + retval = true; + } + }); + return retval; + } + + function appendTag(table, name, url) { + var html = '
    '; + for(var i in similies) { + html += '
    '; + html += ''; + html += ''; + html += '
    '; + html += '
    '+similies[i].name+'
    '; + html += '
    '; + } + html += '
  • '; + } + return html; + } + + function getAlbumHTML(lfmdata) { + if (lfmdata.error()) { + return formatLastFmError(lfmdata, 'album'); + } + var html = sectionHeader(lfmdata); + html += '
    '; + + html += doTags(lfmdata.tags()); + if (lastfm.isLoggedIn()) { + html += tagsInput("album"); + html += doUserTags("album"); + } + + html += '
    '; + var imageurl = lfmdata.image("large"); + var bigurl = lfmdata.image("mega"); + if (imageurl != '') { + html += ''; + if (bigurl && bigurl != imageurl) { + html += ''; + } + } + if (lfmdata.releasedate() != 'Unknown') { + html += '

    '; + html += ''+language.gettext("lastfm_releasedate")+' : '+lfmdata.releasedate(); + html += '

    '; + } + html += '

    '+lastfm.formatBio(lfmdata.bio())+'

    '; + var tracks = lfmdata.tracklisting(); + debug.trace(medebug,"Track Listing",tracks); + if (tracks && tracks.length > 0) { + var dh = false; + for(var i in tracks) { + if (tracks[i].name) { + if (!dh) { + html += ''; + dh = true; + } + html += ''; + html += ''; + } + } + html += '
    '+language.gettext("discogs_tracklisting")+'
    '; + if (tracks[i]['@attr']) { html += tracks[i]['@attr'].rank+':'; } + html += ''+tracks[i].name+''+formatTimeString(tracks[i].duration)+''; + html += '
    '; + } + html += '
    ' + html += '
    '; + return html; + } + + function getTrackHTML(lfmdata) { + if (lfmdata.error()) { + return formatLastFmError(lfmdata, 'track'); + } + var html = sectionHeader(lfmdata); + html += '
  • '; + html = html +'
  • '; + html += '
    '; + + html += doTags(lfmdata.tags()); + if (lastfm.isLoggedIn()) { + html += tagsInput("track"); + html += doUserTags("track"); + } + html += ''; + html += '

    '+lastfm.formatBio(lfmdata.bio())+'

    '; + html += ''; + return html; + } + + return { + getRequirements: function(parent) { + return ['musicbrainz']; + }, + + collection: function(parent, artistmeta, albummeta, trackmeta) { + + debug.trace(medebug, "Creating data collection"); + + var self = this; + var displaying = false; + + this.populate = function() { + $('#love').addClass('notloved').makeSpinner(); + self.artist.populate(); + self.album.populate(); + self.track.populate(); + } + + this.displayData = function() { + displaying = true; + self.artist.doBrowserUpdate(); + self.album.doBrowserUpdate(); + self.track.doBrowserUpdate(); + } + + this.stopDisplaying = function() { + $('#love').stopSpinner(); + displaying = false; + } + + this.handleClick = function(source, element, event) { + debug.trace(medebug,parent.nowplayingindex,source,"is handling a click event"); + if (element.hasClass('clickremovetag')) { + var tagname = element.parent().prev().children().text(); + debug.trace(medebug,parent.nowplayingindex,source,"wants to remove tag",tagname); + self[source].removetags(tagname); + if (prefs.synctags) { + parent.setMeta('remove', 'Tags', tagname); + } + } else if (element.hasClass('clickaddtags')) { + var tagname = element.prev().val(); + debug.trace(medebug,parent.nowplayingindex,source,"wants to add tags",tagname); + self[source].addtags(tagname); + if (prefs.synctags) { + parent.setMeta('set', 'Tags', tagname.split(',')); + } + } else if (element.hasClass('clickzoomimage')) { + imagePopup.create(element, event, element.next().val()); + } else if (element.hasClass('clickunlove')) { + self[source].unlove(); + if (prefs.synclove) { + parent.setMeta('set', 'Rating', '0'); + } + } else if (element.hasClass('clicklove')) { + self[source].love(); + if (prefs.synclove) { + parent.setMeta('set', 'Rating', prefs.synclovevalue); + } + } + } + + this.somethingfailed = function(data) { + debug.warn(medebug,"Something went wrong",data); + } + + this.justaddedtags = function(type, tags) { + debug.trace(medebug,parent.nowplayingindex,"Just added or removed tags",tags,"on",type); + self[type].resetUserTags(); + self[type].getUserTags(); + } + + this.tagAddFailed = function(type, tags) { + $("#tagadd"+type).stopSpinner(); + infobar.error(language.gettext("lastfm_tagerror")); + debug.warn(medebug,"Failed to modify tags",type,tags); + } + + function formatUserTagData(name, taglist, displaying) { + if (displaying) { + debug.trace("FUTD","Doing",name,"tags"); + var toAdd = new Array(); + var toRemove = new Array(); + $('table[name="'+name+'tagtable"]').find("tr").each( function() { + if (!(findTag($(this).find('a').text(), taglist))) { + debug.trace("FUTD","Marking tag",$(this).find('a').text(),"for removal"); + toRemove.push($(this)); + } + }); + for(var i in taglist) { + debug.trace("FUTD","Checking for addition",taglist[i].name); + if (!(findTag2(taglist[i].name, $('table[name="'+name+'tagtable"]')))) { + debug.trace("FUTD","Marking Tag",taglist[i].name,"for addition"); + toAdd.push(taglist[i]) + } + } + for (var i in toRemove) { + toRemove[i].fadeOut('fast', function() { $(this).remove() }); + } + for (var i in toAdd) { + appendTag(name, toAdd[i].name, toAdd[i].url); + } + } + } + + function doUserLoved(flag) { + debug.log("LASTFM","Doing UserLoved With Flags at",flag); + if (parent.isCurrentTrack()) { + $('#love').stopSpinner(); + if (flag) { + $('#love').removeClass('notloved').attr('title', language.gettext("lastfm_unlove")).off('click').on('click', nowplaying.unlove); + } else { + $('#love').removeClass('notloved').addClass('notloved').attr('title', language.gettext("lastfm_lovethis")).off('click').on('click', nowplaying.love); + } + } + if (displaying) { + var li = $('li[name="userloved"]'); + li.empty(); + if (flag) { + li.append($('').html(language.gettext("lastfm_loved")+': ')).append(language.gettext("label_yes")+'   ') + li.append($('', { + title: language.gettext("lastfm_unlove"), + class: "icon-heart-broken smallicon infoclick clickunlove tooltip" + })); + } else { + li.append($('').html(language.gettext("lastfm_loved")+': ')).append(language.gettext("label_no")+'   ') + li.append($('', { + title: language.gettext("lastfm_lovethis"), + class: "icon-heart smallicon infoclick clicklove tooltip notloved" + })); + } + } + } + + function getSearchArtist() { + return (albummeta.artist && albummeta.artist != "" && parent.playlistinfo.type != 'stream') ? albummeta.artist : parent.playlistinfo.trackartist; + } + + function sendLastFMCorrections() { + try { + var updates = { trackartist: (parent.playlistinfo.metadata.artists.length == 1) ? self.artist.name() : parent.playlistinfo.trackartist, + album: self.album.name(), + title: self.track.name(), + image: self.album.image('mega') ? self.album.image('mega') : self.album.image('medium') + }; + nowplaying.setLastFMCorrections(parent.currenttrack, updates); + } catch(err) { + debug.fail(medebug,"Not enough information to send corrections"); + } + } + + function sendMetadataUpdates(de) { + var lfmdata = new lfmDataExtractor(trackmeta.lastfm.track); + nowplaying.setMetadataFromLastFM(parent.nowplayingindex, {Playcount: lfmdata.userplaycount()}); + } + + this.artist = function() { + + var retries = 10; + + return { + + populate: function() { + if (artistmeta.lastfm === undefined) { + debug.mark(medebug,parent.nowplayingindex,"artist is populating",artistmeta.name); + lastfm.artist.getInfo( {artist: artistmeta.name}, + this.lfmResponseHandler, + this.lfmResponseHandler + ); + } else { + debug.trace(medebug,parent.nowplayingindex,"artist is already populated",artistmeta.name); + } + }, + + lfmResponseHandler: function(data) { + debug.trace(medebug,parent.nowplayingindex,"got artist data for",artistmeta.name); + debug.trace(medebug,data); + var de = new lfmDataExtractor(data); + artistmeta.lastfm = de.getCheckedData('artist'); + if (artistmeta.musicbrainz_id == "") { + var mbid = null; + try { + mbid = data.artist.mbid || null; + } catch(err) { + mbid = null; + } + debug.log(medebug,parent.nowplayingindex,"has found a musicbrainz artist ID",mbid); + artistmeta.musicbrainz_id = mbid; + } + self.artist.doBrowserUpdate(); + }, + + tryForAllmusicImage: function() { + if (typeof artistmeta.allmusic == 'undefined' || typeof artistmeta.allmusic.artistlink === 'undefined') { + debug.shout(medebug,"Allmusic artist link not back yet"); + retries--; + if (retries > 0) { + setTimeout(self.artist.tryForAllmusicImage, 2000); + } else { + debug.shout(medebug,"Artist giving up waiting for musicbrainz"); + } + } else if (artistmeta.allmusic.artistlink === null) { + debug.shout(medebug,"No Allmusic artist bio link found"); + } else { + debug.shout(medebug,"Getting allmusic bio from",artistmeta.allmusic.artistlink); + $.post('browser/backends/getamimage.php', {url: artistmeta.allmusic.artistlink}) + .done( function(data) { + debug.log(medebug,"Got Allmusic Image", data); + if (displaying) { + var image = $('', {class: "stright standout infoclick clickzoomimage cshrinker", src: "getRemoteImage.php?url="+data}).insertBefore('#artistbio'); + var input = $('', {type: "hidden", value: "getRemoteImage.php?url="+data}); + }; + }) + .fail( function() { + debug.log(medebug,"Didn't Get Allmusic Image"); + }); + } + }, + + doBrowserUpdate: function() { + if (displaying && artistmeta.lastfm !== undefined) { + debug.trace(medebug,parent.nowplayingindex,"artist was asked to display"); + var lfmdata = new lfmDataExtractor(artistmeta.lastfm.artist); + var accepted = browser.Update( + null, + 'artist', + me, + parent.nowplayingindex, + { name: self.artist.name(), + link: lfmdata.url(), + data: getArtistHTML(lfmdata, parent, artistmeta) + } + ); + + if (accepted && lastfm.isLoggedIn() && !lfmdata.error()) { + self.artist.getUserTags(); + self.artist.tryForAllmusicImage(); + } + + } + }, + + name: function() { + try { + return artistmeta.lastfm.artist.name || artistmeta.name; + } catch(err) { + return artistmeta.name; + } + }, + + getFullBio: function(callback, failcallback) { + debug.shout(medebug,parent.nowplayingindex,"Not Getting Bio URL:", artistmeta.lastfm.artist.url); + }, + + updateBio: function(data) { + if (displaying) { + $("#artistbio").html(lastfm.formatBio(data, null)); + } + }, + + resetUserTags: function() { + artistmeta.lastfm.usertags = null; + }, + + getUserTags: function() { + debug.debug(medebug,parent.nowplayingindex,"Getting Artist User Tags"); + if (artistmeta.lastfm.usertags) { + formatUserTagData('artist', artistmeta.lastfm.usertags, displaying); + } else { + var options = { artist: self.artist.name() }; + if (artistmeta.musicbrainz_id != "") { + options.mbid = artistmeta.musicbrainz_id; + } + lastfm.artist.getTags( + options, + self.artist.gotUserTags, + self.artist.somethingfailed + ); + } + + }, + + somethingfailed: function(data) { + $("#tagaddartist").stopSpinner(); + debug.warn(medebug,"Something went wrong getting artist user tags",data); + }, + + gotUserTags: function(data) { + $("#tagaddartist").stopSpinner(); + var de = new lfmDataExtractor(data); + artistmeta.lastfm.usertags = de.tags(); + formatUserTagData('artist', artistmeta.lastfm.usertags, displaying); + }, + + addtags: function(tags) { + $("#tagaddartist").makeSpinner(); + lastfm.artist.addTags({ artist: self.artist.name(), + tags: tags}, + self.justaddedtags, + self.tagAddFailed + ); + }, + + removetags: function(tags) { + $("#tagaddartist").makeSpinner(); + lastfm.artist.removeTag({artist: self.artist.name(), + tag: tags}, + self.justaddedtags, + self.tagAddFailed + ); + } + + } + + }(); + + this.album = function() { + + return { + + populate: function() { + if (albummeta.lastfm === undefined) { + debug.mark(medebug,"Getting last.fm data for album",albummeta.name); + if (parent.playlistinfo.type == 'stream') { + lastfm.artist.getInfo({ artist: albummeta.name }, + this.lfmArtistResponseHandler, + this.lfmArtistResponseHandler ); + + } else { + lastfm.album.getInfo({ artist: getSearchArtist(), + album: albummeta.name}, + this.lfmResponseHandler, + this.lfmResponseHandler ); + } + } else { + debug.trace(medebug,"Album is already populated",albummeta.name); + } + + }, + + lfmResponseHandler: function(data) { + debug.trace(medebug,"Got Album Info for",albummeta.name); + debug.debug(medebug, data); + var de = new lfmDataExtractor(data); + albummeta.lastfm = de.getCheckedData('album'); + if (albummeta.musicbrainz_id == "") { + var mbid = null; + try { + mbid = data.album.mbid || null; + } catch(err) { + mbid = null; + } + if (mbid !== null) { + debug.log(medebug,parent.nowplayingindex,"has found a musicbrainz album ID",mbid); + nowplaying.updateAlbumMBID(parent.nowplayingindex,mbid); + } + albummeta.musicbrainz_id = mbid; + } + self.album.doBrowserUpdate(); + }, + + lfmArtistResponseHandler: function(data) { + debug.trace(medebug,"Got Album/Artist Info for",albummeta.name); + debug.debug(medebug, data); + var de = new lfmDataExtractor(data); + albummeta.lastfm = de.getCheckedData('artist'); + albummeta.musicbrainz_id = null; + self.album.doBrowserUpdate(); + }, + + doBrowserUpdate: function() { + if (displaying && albummeta.lastfm !== undefined) { + debug.trace(medebug,parent.nowplayingindex,"album was asked to display"); + var lfmdata = (parent.playlistinfo.type == 'stream') ? new lfmDataExtractor(albummeta.lastfm.artist) : new lfmDataExtractor(albummeta.lastfm.album); + var accepted = browser.Update( + null, + 'album', + me, + parent.nowplayingindex, + { name: lfmdata.name() || albummeta.name, + link: lfmdata.url(), + data: (parent.playlistinfo.type == 'stream') ? getArtistHTML(lfmdata) : getAlbumHTML(lfmdata) + } + ); + + if (accepted && lastfm.isLoggedIn() && !lfmdata.error()) { + self.album.getUserTags(); + } + } + }, + + name: function() { + try { + return albummeta.lastfm.album.name || albummeta.name; + } catch(err) { + return albummeta.name; + } + }, + + image: function(size) { + if (albummeta.lastfm.album) { + var lfmdata = new lfmDataExtractor(albummeta.lastfm.album); + return lfmdata.image(size); + } + return ""; + }, + + resetUserTags: function() { + albummeta.lastfm.usertags = null; + }, + + getUserTags: function() { + debug.debug(medebug,parent.nowplayingindex,"Getting Album User Tags"); + if (albummeta.lastfm.usertags) { + formatUserTagData('album', albummeta.lastfm.usertags, displaying); + } else { + var options = { artist: getSearchArtist(), album: self.album.name() }; + if (albummeta.musicbrainz_id != "" && albummeta.musicbrainz_id != null) { + options.mbid = albummeta.musicbrainz_id; + } + lastfm.album.getTags( + options, + self.album.gotUserTags, + self.album.somethingfailed + ); + } + + }, + + somethingfailed: function(data) { + $("#tagaddalbum").stopSpinner(); + debug.warn(medebug,"Something went wrong getting album user tags",data); + }, + + gotUserTags: function(data) { + $("#tagaddalbum").stopSpinner(); + var de = new lfmDataExtractor(data); + albummeta.lastfm.usertags = de.tags(); + formatUserTagData('album', albummeta.lastfm.usertags, displaying); + }, + + addtags: function(tags) { + $("#tagaddalbum").makeSpinner(); + lastfm.album.addTags({ artist: getSearchArtist(), + album: self.album.name(), + tags: tags}, + self.justaddedtags, + self.tagAddFailed + ); + }, + + removetags: function(tags) { + $("#tagaddalbum").makeSpinner(); + lastfm.album.removeTag({ artist: getSearchArtist(), + album: self.album.name(), + tag: tags}, + self.justaddedtags, + self.tagAddFailed + ); + } + } + }(); + + this.track = function() { + + return { + + populate: function() { + if (trackmeta.lastfm === undefined) { + debug.mark(medebug,parent.nowplayingindex,"Getting last.fm data for track",trackmeta.name); + lastfm.track.getInfo( { artist: getSearchArtist(), track: trackmeta.name }, + this.lfmResponseHandler, + this.lfmResponseHandler ); + } else { + debug.trace(medebug,parent.nowplayingindex,"Track is already populated",trackmeta.name); + sendLastFMCorrections(); + } + }, + + lfmResponseHandler: function(data) { + debug.trace(medebug,parent.nowplayingindex,"Got Track Info for",trackmeta.name); + debug.debug(medebug, data); + var de = new lfmDataExtractor(data); + trackmeta.lastfm = de.getCheckedData('track'); + if (trackmeta.musicbrainz_id == "") { + var mbid = null; + try { + mbid = data.track.mbid || null; + } catch(err) { + mbid = null; + } + debug.trace(medebug,parent.nowplayingindex,"has found a musicbrainz track ID",mbid); + trackmeta.musicbrainz_id = mbid; + } + sendLastFMCorrections(); + sendMetadataUpdates(); + self.track.doBrowserUpdate(); + }, + + doBrowserUpdate: function() { + if (displaying && trackmeta.lastfm !== undefined) { + debug.trace(medebug,parent.nowplayingindex,"track was asked to display"); + var lfmdata = new lfmDataExtractor(trackmeta.lastfm.track); + var accepted = browser.Update( + null, + 'track', + me, + parent.nowplayingindex, + { name: self.track.name(), + link: lfmdata.url(), + data: getTrackHTML(lfmdata) + } + ); + + if (accepted && lastfm.isLoggedIn() && !lfmdata.error()) { + self.track.getUserTags(); + } + } + if (trackmeta.lastfm !== undefined) { + var lfmdata = new lfmDataExtractor(trackmeta.lastfm.track); + doUserLoved(lfmdata.userloved()); + } + }, + + name: function() { + try { + return trackmeta.lastfm.track.name || trackmeta.name; + } catch(err) { + return trackmeta.name; + } + }, + + resetUserTags: function() { + trackmeta.lastfm.usertags = null; + }, + + getUserTags: function() { + debug.debug(medebug,parent.nowplayingindex,"Getting Track User Tags"); + if (trackmeta.lastfm.usertags) { + formatUserTagData('track', trackmeta.lastfm.usertags, displaying); + } else { + var options = { artist: self.artist.name(), track: self.track.name() }; + if (trackmeta.musicbrainz_id != "" && trackmeta.musicbrainz_id != null) { + options.mbid = trackmeta.musicbrainz_id; + } + lastfm.track.getTags( + options, + self.track.gotUserTags, + self.track.somethingfailed, + 0 + ); + } + + }, + + somethingfailed: function(data) { + $("#tagaddtrack").stopSpinner(); + debug.warn(medebug,"Something went wrong getting track user tags",data); + }, + + gotUserTags: function(data) { + $("#tagaddtrack").stopSpinner(); + var de = new lfmDataExtractor(data); + trackmeta.lastfm.usertags = de.tags(); + formatUserTagData('track', trackmeta.lastfm.usertags, displaying); + }, + + addtags: function(tags) { + $("#tagaddtrack").makeSpinner(); + lastfm.track.addTags({ artist: self.artist.name(), + track: self.track.name(), + tags: tags}, + self.justaddedtags, + self.tagAddFailed + ); + }, + + removetags: function(tags) { + if (findTag2(tags, $('table[name="tracktagtable"]'))) { + $("#tagaddtrack").makeSpinner(); + lastfm.track.removeTag({ artist: self.artist.name(), + track: self.track.name(), + tag: tags}, + self.justaddedtags, + self.tagAddFailed + ); + } else { + debug.warn(medebug, "Tag",tags,"not found on track"); + } + }, + + love: function() { + lastfm.track.love({ track: self.track.name(), artist: self.artist.name() }, self.track.donelove); + }, + + unlove: function(callback) { + lastfm.track.unlove({ track: self.track.name(), artist: self.artist.name() }, self.track.donelove); + }, + + unloveifloved: function() { + if (trackmeta.lastfm.track.userloved == 1) { + self.track.unlove(); + } + }, + + donelove: function(loved) { + if (loved) { + // Rather than re-get all the details, we can just edit the track data directly. + trackmeta.lastfm.track.userloved = 1; + if (prefs.autotagname != '') { + self.track.addtags(prefs.autotagname); + if (prefs.synctags && prefs.synclove) { + parent.setMeta('set', 'Tags', [prefs.autotagname]); + } + } + doUserLoved(true) + } else { + trackmeta.lastfm.track.userloved = 0; + if (prefs.autotagname != '') { + self.track.removetags(prefs.autotagname); + if (prefs.synctags && prefs.synclove) { + parent.setMeta('remove', 'Tags', prefs.autotagname); + } + } + doUserLoved(false) + } + } + + } + }(); + } + } + +}(); + +nowplaying.registerPlugin("lastfm", info_lastfm, "icon-lastfm-1", "button_infolastfm"); diff --git a/www/rompr/browser/plugins/03_info_wikipedia.js b/www/rompr/browser/plugins/03_info_wikipedia.js new file mode 100644 index 0000000..7df4958 --- /dev/null +++ b/www/rompr/browser/plugins/03_info_wikipedia.js @@ -0,0 +1,420 @@ +var info_wikipedia = function() { + + var me = "wikipedia"; + + function formatWiki(xml) { + var xml_node = $(xml); + var html = xml_node.find('parse > text').text(); + var domain = xml_node.find('rompr > domain').text(); + + var jq = $('
    '+html+'
    '); + + // Remove unwanted edit links + jq.find("span.editsection").remove(); + jq.find("a.edit-page").remove(); + + // Make external links open in a new tab + jq.find("a[href^='http:']").attr("target", "_blank"); + jq.find("a[href^='//']").attr("target", "_blank"); + jq.find("a[href^='/w/']").each( function() { + var ref = $(this).attr('href'); + $(this).attr('href', 'http://'+domain+'.wikipedia.org'+ref); + $(this).attr("target", "_blank"); + }); + + // Make the contents table links work + jq.find("a[href^='#']").each( function() { + if (!$(this).hasClass('infoclick')) { + var ref = $(this).attr('href'); + $(this).attr('name', ref); + $(this).attr("href", "#"); + $(this).addClass("infoclick clickwikicontents"); + } + }); + + // Redirect wiki image links so they go to our function to be displayed + jq.find("a.image[href^='/wiki/']").each( function() { + var ref = $(this).attr('href'); + $(this).attr('href', '#'); + $(this).attr('name', domain+'.wikipedia.org/'+ref.replace(/\/wiki\//,'')); + $(this).addClass('infoclick clickwikimedia'); + }); + jq.find("a.image[href^='//commons.wikimedia.org/']").each( function() { + var ref = $(this).attr('href'); + $(this).attr('href', '#'); + $(this).attr('name', 'commons.wikimedia.org/'+ref.replace(/\/\/commons\.wikimedia\.org\/wiki\//,'')); + $(this).addClass('infoclick clickwikimedia'); + }); + + // Redirect intra-wikipedia links so they go to our function + jq.find("a[href^='/wiki/']").each( function() { + var ref = $(this).attr('href'); + $(this).attr('href', '#'); + $(this).attr('name', domain+'/'+ref.replace(/\/wiki\//,'')); + $(this).addClass('infoclick clickwikilink'); + }); + + // Remove inline colour styles on elements. + // We do background color twice because some elements have been found + // to have 2 background color styles applied. + // if (prefs.theme == "Darkness.css" || prefs.theme == "TheBlues.css" || prefs.theme == "DarknessHiDPI.css" ) { + jq.find('[style*=background-color]').removeInlineCss('background-color'); + jq.find('[style*=background-color]').removeInlineCss('background-color'); + jq.find('[style*=background]').removeInlineCss('background'); + jq.find('[style*=color]').removeInlineCss('color'); + // } + // Remove these bits because they're a pain in the arse + jq.find("li[class|='nv']").remove(); + + return jq.html(); + + } + + function formatLink(xml) { + var xml_node = $('api',xml); + return 'http://'+xml_node.find('rompr > domain').text()+'.wikipedia.org/wiki/'+xml_node.find('rompr > page').text(); + } + + function formatPage(xml) { + var xml_node = $('api',xml); + var page = xml_node.find('rompr > page').text(); + return page.replace(/_/g, ' '); + } + + return { + getRequirements: function(parent) { + return ["musicbrainz"]; + }, + + collection: function(parent, artistmeta, albummeta, trackmeta) { + + debug.trace("WIKI PLUGIN", "Creating data collection"); + + var self = this; + var displaying = false; + + this.populate = function() { + self.artist.populate(); + self.album.populate(); + self.track.populate(); + } + + this.displayData = function() { + displaying = true; + self.artist.doBrowserUpdate(); + self.album.doBrowserUpdate(); + self.track.doBrowserUpdate(); + } + + this.stopDisplaying = function(waitingon) { + displaying = false; + } + + + this.handleClick = function(source, element, event) { + debug.trace("WIKI PLUGIN",parent.nowplayingindex,source,"is handling a click event"); + if (element.hasClass('clickwikimedia')) { + wikipedia.wikiMediaPopup(element, event); + } else if (element.hasClass('clickwikilink')) { + var link = decodeURIComponent(element.attr('name')); + debug.trace("WIKI PLUGIN",parent.nowplayingindex,source,"clicked a wiki link",link); + self[source].followLink(link); + } else if (element.hasClass('clickwikicontents')) { + var section = element.attr('name'); + debug.trace("WIKI PLUGIN",parent.nowplayingindex,source,"clicked a contents link",section); + layoutProcessor.goToBrowserSection(section); + } + } + + this.wikiGotFailed = function(data) { + debug.warn("WIKI PLUGIN", "Failed to get Wiki Link",data); + } + + function getSearchArtist() { + return (albummeta.artist && albummeta.artist != "") ? albummeta.artist : parent.playlistinfo.trackartist; + } + + this.artist = function() { + + var retries = 10; + + return { + + populate: function() { + if (artistmeta.wikipedia === undefined) { + artistmeta.wikipedia = {}; + } + if (artistmeta.wikipedia.artistinfo === undefined) { + if (artistmeta.wikipedia.artistlink === undefined) { + debug.shout("WIKI PLUGIN",parent.nowplayingindex,"Artist asked to populate but no link yet"); + retries--; + if (retries == 0) { + debug.shout("WIKI PLUGIN",parent.nowplayingindex,"Artist giving up waiting for poxy musicbrainz"); + artistmeta.wikipedia.artistlink = null; + setTimeout(self.artist.populate, 200); + } else { + setTimeout(self.artist.populate, 2000); + } + return; + } + if (artistmeta.wikipedia.artistlink === null) { + debug.shout("WIKI PLUGIN",parent.nowplayingindex,"Artist asked to populate but no link could be found. Trying a search"); + wikipedia.search({ artist: artistmeta.name, + disambiguation: artistmeta.disambiguation || "" + }, + self.artist.wikiResponseHandler, + self.artist.wikiResponseHandler); + return; + } + debug.trace("WIKI PLUGIN",parent.nowplayingindex,"artist is populating",artistmeta.wikipedia.artistlink); + wikipedia.getFullUri({ uri: artistmeta.wikipedia.artistlink, + term: artistmeta.name + }, + self.artist.wikiResponseHandler, + self.artist.wikiResponseHandler); + } else { + debug.trace("WIKI PLUGIN",parent.nowplayingindex,"artist is already populated",artistmeta.wikipedia.artistlink); + } + }, + + wikiResponseHandler: function(data) { + debug.trace("WIKI PLUGIN",parent.nowplayingindex,"got artist data for",artistmeta.name,data); + if (data) { + artistmeta.wikipedia.artistinfo = formatWiki(data); + artistmeta.wikipedia.artistlink = formatLink(data); + } else { + artistmeta.wikipedia.artistinfo = '

    '+language.gettext("wiki_nothing")+'

    '; + artistmeta.wikipedia.artistlink = null; + } + + self.artist.doBrowserUpdate(); + }, + + doBrowserUpdate: function() { + if (displaying && artistmeta.wikipedia.artistinfo !== undefined) { + debug.trace("WIKI PLUGIN",parent.nowplayingindex,"artist was asked to display"); + browser.Update( + null, + 'artist', + me, + parent.nowplayingindex, + { name: artistmeta.name, + link: artistmeta.wikipedia.artistlink, + data: artistmeta.wikipedia.artistinfo + } + ); + } + }, + + followLink: function(link) { + wikipedia.getWiki(link, self.artist.gotWikiLink, self.wikiGotFailed); + }, + + gotWikiLink: function(data) { + browser.speciaUpdate( + me, + 'artist', + { name: formatPage(data), + link: formatLink(data), + data: formatWiki(data) + } + ); + } + } + }(); + + this.album = function() { + + var retries = 12; + + return { + + populate: function() { + if (albummeta.wikipedia === undefined) { + albummeta.wikipedia = {}; + } + if (albummeta.wikipedia.albumdata === undefined) { + if (albummeta.wikipedia.albumlink === undefined) { + debug.shout("WIKI PLUGIN",parent.nowplayingindex,"Album asked to populate but no link yet"); + retries--; + if (retries == 0) { + debug.shout("WIKI PLUGIN",parent.nowplayingindex,"Album giving up waiting for poxy musicbrainz"); + albummeta.wikipedia.albumlink = null; + setTimeout(self.album.populate, 200); + } else { + setTimeout(self.album.populate, 2000); + } + return; + } + if (albummeta.wikipedia.albumlink === null) { + if (albummeta.musicbrainz.album_releasegroupid !== null) { + debug.trace("WIKI PLUGIN",parent.nowplayingindex,"No album link found ... trying the album release group"); + musicbrainz.releasegroup.getInfo(albummeta.musicbrainz.album_releasegroupid, '', self.album.mbRgHandler, self.album.mbRgHandler); + } else { + debug.trace("WIKI PLUGIN",parent.nowplayingindex,"No album link or release group link ... trying a search"); + wikipedia.search({album: albummeta.name, albumartist: getSearchArtist()}, self.album.wikiResponseHandler, self.album.wikiResponseHandler); + } + return; + } + debug.trace("WIKI PLUGIN",parent.nowplayingindex,"album is populating",albummeta.wikipedia.albumlink); + wikipedia.getFullUri({ uri: albummeta.wikipedia.albumlink, + term: albummeta.name + }, + self.album.wikiResponseHandler, + self.album.wikiResponseHandler + ); + } else { + debug.trace("WIKI PLUGIN",parent.nowplayingindex,"album is already populated",albummeta.wikipedia.albumlink); + } + }, + + wikiResponseHandler: function(data) { + debug.trace("WIKI PLUGIN",parent.nowplayingindex,"got album data for",albummeta.name); + if (data) { + albummeta.wikipedia.albumdata = formatWiki(data); + albummeta.wikipedia.albumlink = formatLink(data); + } else { + albummeta.wikipedia.albumdata = '

    '+language.gettext("wiki_nothing")+'

    '; + albummeta.wikipedia.albumlink = null; + } + self.album.doBrowserUpdate(); + }, + + mbRgHandler: function(data) { + debug.trace("WIKI PLUGIN",parent.nowplayingindex,"got musicbrainz release group data for",albummeta.name, data); + if (data.error) { + debug.trace("WIKI PLUGIN",parent.nowplayingindex," ... MB error",data); + } else { + for (var i in data.relations) { + if (data.relations[i].type == "wikipedia") { + debug.trace("WIKI PLUGIN",parent.nowplayingindex,"has found a Wikipedia album link",data.relations[i].url.resource); + albummeta.wikipedia.albumlink = data.relations[i].url.resource; + self.album.populate(); + return; + } + } + } + albummeta.wikipedia.albumlink = null; + albummeta.musicbrainz.album_releasegroupid = null; + self.album.populate(); + }, + + doBrowserUpdate: function() { + if (displaying && albummeta.wikipedia.albumdata !== undefined) { + debug.trace("WIKI PLUGIN",parent.nowplayingindex,"album was asked to display"); + browser.Update( + null, + 'album', + me, + parent.nowplayingindex, + { name: albummeta.name, + link: albummeta.wikipedia.albumlink, + data: albummeta.wikipedia.albumdata + } + ); + } + }, + + followLink: function(link) { + wikipedia.getWiki(link, self.album.gotWikiLink, self.wikiGotFailed); + }, + + gotWikiLink: function(data) { + browser.speciaUpdate(me, 'album', { name: formatPage(data), + link: formatLink(data), + data: formatWiki(data)}); + } + + } + }(); + + this.track = function() { + + var retries = 15; + + return { + + populate: function() { + if (trackmeta.wikipedia === undefined) { + trackmeta.wikipedia = {}; + } + if (trackmeta.wikipedia.trackdata === undefined) { + if (trackmeta.wikipedia.tracklink === undefined) { + debug.shout("WIKI PLUGIN",parent.nowplayingindex,"track asked to populate but no link yet"); + retries--; + if (retries == 0) { + debug.shout("WIKI PLUGIN",parent.nowplayingindex,"Track giving up waiting for poxy musicbrainz"); + trackmeta.wikipedia.tracklink = null; + setTimeout(self.track.populate, 200); + } else { + setTimeout(self.track.populate, 2000); + } + return; + } + if (trackmeta.wikipedia.tracklink === null) { + debug.shout("WIKI PLUGIN",parent.nowplayingindex,"track asked to populate but no link could be found. Trying a search"); + wikipedia.search({track: trackmeta.name, trackartist: parent.playlistinfo.trackartist}, self.track.wikiResponseHandler, self.track.wikiResponseHandler); + return; + } + debug.trace("WIKI PLUGIN",parent.nowplayingindex,"track is populating",trackmeta.wikipedia.tracklink); + wikipedia.getFullUri({ uri: trackmeta.wikipedia.tracklink, + term: trackmeta.name + }, + self.track.wikiResponseHandler, + self.track.wikiResponseHandler + ); + } else { + debug.trace("WIKI PLUGIN",parent.nowplayingindex,"track is already populated",trackmeta.wikipedia.tracklink); + } + }, + + wikiResponseHandler: function(data) { + debug.trace("WIKI PLUGIN",parent.nowplayingindex,"got track data for",trackmeta.name); + if (data) { + trackmeta.wikipedia.trackdata = formatWiki(data); + trackmeta.wikipedia.tracklink = formatLink(data); + } else { + trackmeta.wikipedia.trackdata = '

    '+language.gettext("wiki_nothing")+'

    '; + trackmeta.wikipedia.tracklink = null; + } + + self.track.doBrowserUpdate(); + }, + + doBrowserUpdate: function() { + if (displaying && trackmeta.wikipedia.trackdata !== undefined) { + debug.trace("WIKI PLUGIN",parent.nowplayingindex,"track was asked to display"); + browser.Update( + null, + 'track', + me, + parent.nowplayingindex, + { name: trackmeta.name, + link: trackmeta.wikipedia.tracklink, + data: trackmeta.wikipedia.trackdata + } + ); + } + }, + + followLink: function(link) { + wikipedia.getWiki(link, self.track.gotWikiLink, self.wikiGotFailed); + }, + + gotWikiLink: function(data) { + browser.speciaUpdate( me, 'track', + { name: formatPage(data), + link: formatLink(data), + data: formatWiki(data) + } + ); + } + + } + }(); + } + } + +}(); + +nowplaying.registerPlugin("wikipedia", info_wikipedia, "icon-wikipedia", "button_wikipedia"); diff --git a/www/rompr/browser/plugins/04_info_musicbrainz.js b/www/rompr/browser/plugins/04_info_musicbrainz.js new file mode 100644 index 0000000..528aaaf --- /dev/null +++ b/www/rompr/browser/plugins/04_info_musicbrainz.js @@ -0,0 +1,1125 @@ +var info_musicbrainz = function() { + + var me = "musicbrainz"; + var medebug = "MBNZ PLUGIN"; + + function getYear(data) { + try { + var date = data['first-release-date'] || data.date; + if (!date) { + var t = data.title; + var m = t.match(/^(\d\d\d\d)/); + date = m[0]; + } + var d = new Date(date); + var y = d.getFullYear(); + if (!y) { y = 0 } + return parseInt(y); + } catch(err) { + return 0; + } + } + + function doSpan(data) { + if (data.begin === undefined || data.begin === null) { + return ""; + } + var by = new Date(data.begin); + var ey = new Date(data.end); + var tby = by.getFullYear() || ""; + var tey = data.ended ? (ey.getFullYear() || "") : language.gettext("musicbrainz_now"); + return '('+tby+' - '+tey+')'; + } + + function albumsbyyear(a, b) { + var year_a = getYear(a); + var year_b = getYear(b); + if (year_a == year_b) { return 0 } + return (year_a > year_b) ? 1 : -1; + } + + function getArtistHTML(data, expand) { + + if (data.error) { + return '

    '+data.error+'

    '; + } + + var html = '
    '; + html += '
    '; + html += '
    • '+data.disambiguation+'
    '; + if (data.type !== null) { + html += '
    • '+language.gettext("title_type")+': '+data.type+'
    '; + } + if (data.aliases && data.aliases.length > 0) { + html += '
    • '+language.gettext("discogs_aliases")+'
    • '; + for (var i in data.aliases) { + html += '
    • '+data.aliases[i].name + '
    • '; + } + html += '
    '; + } + + if (data.begin_area && data.area) { + html += '
    • '+language.gettext("musicbrainz_origin")+': '+data.begin_area.name+", "+data.area.name+'
    '; + } else if (data.area) { + html += '
    • '+language.gettext("musicbrainz_origin")+': '+data.area.name+'
    '; + } + if (data['life-span'] && data['life-span'].begin !== null) { + html += '
    • '+language.gettext("musicbrainz_active")+': '+data['life-span'].begin+" - "+(data['life-span'].end || language.gettext("musicbrainz_now"))+'
    '; + } + if (data.rating && data.rating.value !== null) { + html += '
    • '+language.gettext("musicbrainz_rating")+': '+data.rating.value+"/5 from "+data.rating['votes-count']+' votes
    '; + } + html += '
    '+getURLs(data.relations, true); + html += '
    '; + + html += '
    '; + if (expand) { + html += '
    '; + } + + if (data.annotation) { + var a = data.annotation; + a = a.replace(/\n/, '
    '); + a = a.replace(/\[(.*?)\|(.*?)\]/g, '$2'); + html += '
    '+language.gettext("musicbrainz_notes")+':
    '+a+'
    '; + } + + if (data.tags && data.tags.length > 0) { + html += '
    '+language.gettext("musicbrainz_tags")+'
    '; + for (var i in data.tags) { + html += ''+data.tags[i].name+' '; + } + html += '
    '; + } + + var bandMembers = new Array(); + var memberOf = new Array(); + for (var i in (data.relations)) { + if (data.relations[i].type == "member of band") { + if (data.relations[i].direction == "backward") { + bandMembers.push(data.relations[i]); + } else { + memberOf.push(data.relations[i]); + } + } + } + if (bandMembers.length > 0) { + html += '
    '+language.gettext("discogs_bandmembers")+'
    '+getMembers(bandMembers); + } + if (memberOf.length > 0) { + html += '
    '+language.gettext("discogs_memberof")+'
    '+getMembers(memberOf); + } + + html += '
    '; + html += ''; + html += ''+language.gettext("discogs_discography", [data.name.toUpperCase()])+'
    '; + html += ''; + + html += '
    '; + html += '
    '; + return html; + + } + + function getMembers(data) { + var html = ""; + var already_done = new Array(); + var ayears = new Array(); + for (var i in data) { + if (already_done[data[i].artist.id] !== true) { + debug.debug(medebug,"New Artist",data[i].artist.id,data[i].artist.name,data[i].begin,data[i].end); + html += '
    '; + // The already_done flag is just there because artist can appear multiple times in this data + // if they did multiple stints in the band. + + html += ''; + html += ''+data[i].artist.name+' '+"AYEARS_"+data[i].artist.id; + ayears[data[i].artist.id] = doSpan(data[i]); + html += '
    '; + html += ''; + already_done[data[i].artist.id] = true; + } else { + debug.debug(medebug,"Repeat Artist",data[i].artist.id,data[i].artist.name,data[i].begin,data[i].end); + ayears[data[i].artist.id] = ayears[data[i].artist.id] + " " + doSpan(data[i]); + } + } + for(var i in ayears) { + html = html.replace("AYEARS_"+i, ayears[i]); + } + return html; + + } + + function getURLs(relations, withheader) { + if (relations.length == 0) { + return ""; + } + if (withheader) { + var html = '
    • '+language.gettext("discogs_external")+'
    • '; + } else { + var html = '' + return html; + + } + + function getReleaseHTML(data) { + + if (data.error) { + return '

      '+language.gettext("musicbrainz_contacterror")+'

      '; + } + if (data['release-groups'].length > 0) { + var dby = data['release-groups'].sort(albumsbyyear); + var html = '
      '; + html += '' + for (var i in dby) { + + var y = getYear(dby[i]); + if (y == 0) { + y = "-"; + } + html += ''; + html += ''; + } + html += '
      '+language.gettext("title_year")+''+language.gettext("title_title")+' / ' + +language.getUCtext("label_artist")+''+language.gettext("title_type")+'' + +language.gettext("musicbrainz_rating")+''+language.gettext("discogs_external")+'
      '+y+''+dby[i].title+''; + + var ac = dby[i]['artist-credit'][0].name; + var jp = dby[i]['artist-credit'][0].joinphrase; + for(var j = 1; j < dby[i]['artist-credit'].length; j++) { + ac = ac + " "+jp+" "+dby[i]['artist-credit'][j].name; + } + + html += '
      '+ac+'
      '; + html += dby[i]['secondary-types'].join(' '); + html += ' ' + (dby[i]['primary-type'] || ""); + html += ''; + if (dby[i].rating['votes-count'] == 0) { + html += language.gettext("musicbrainz_novotes"); + } else { + html += language.gettext("musicbrainz_votes", [dby[i].rating.value, dby[i].rating['votes-count']]); + } + html += ''; + html += getURLs(dby[i].relations); + html += '
      '; + return html; + } else { + return ""; + } + } + + function getCoverHTML(data) { + var html = ""; + if (data) { + for (var i in data.images) { + html += '
      '; + html += ''; + html += '
      '; + html += ''; + } + } + return html; + } + + function getTrackHTML(data) { + if (data.error && data.recording === undefined && data.work === undefined) { + return '

      '+data.error.error+'

      '; + } + var html = '
      '; + html += '
      '; + if (data.recording) { + if (data.recording.disambiguation) { + html += '
        '+data.recording.disambiguation+'
      '; + } + } + if (data.work) { + if (data.work.disambiguation) { + html += '
        '+data.work.disambiguation+'
      '; + } + } + + if (data.recording.rating && data.recording.rating.value !== null) { + html += '
      • RATING: ' + +language.gettext("musicbrainz_votes", [data.recording.rating.value, data.recording.rating['votes-count']]) + +'
      '; + } + var rels = new Array(); + + if (data.work) { + for (var i in data.work.relations) { + rels.push(data.work.relations[i]); + } + } + if (data.recording) { + for (var i in data.recording.relations) { + rels.push(data.recording.relations[i]); + } + } + html += getURLs(rels, true); + html += '
      '; + + html += '
      '; + if ((data.work && data.work.annotation) || (data.recording && data.recording.annotation)) { + var a = ""; + if (data.work && data.work.annotation) { + a = a + data.work.annotation; + } + if (data.recording && data.recording.annotation) { + a = a + data.recording.annotation; + } + a = a.replace(/\n/, '
      '); + a = a.replace(/\[(.*?)\|(.*?)\]/, '$2'); + html += '
      '+language.gettext("musicbrainz_notes")+':
      '+a+'
      '; + } + + if (data.recording && data.recording.tags && data.recording.tags.length > 0) { + html += '
      '+language.gettext("musicbrainz_tags")+'
      '; + for (var i in data.recording.tags) { + html += ''+data.recording.tags[i].name+' '; + } + html += '
      '; + } + html += doCredits(rels); + + if (data.recording && data.recording.releases && data.recording.releases.length > 0) { + html += '
      '+language.gettext("musicbrainz_appears")+'
      '; + for (var i in data.recording.releases) { + html += ''; + } + html += '
      '+ + data.recording.releases[i].title+''+ + data.recording.releases[i].date+''+ + data.recording.releases[i].status+','+ + data.recording.releases[i].country+'
      '; + + } + + + html += '
      '; + return html; + + } + + function doCredits(rels) { + var doit = true; + var html = ""; + for (var i in rels) { + if (rels[i].artist) { + if (doit) { + html += '
      '+language.gettext("musicbrainz_credits")+'
      '; + doit = false; + } + html += ''; + } + } + if (!doit) { + html += '
      '+rels[i].type; + if (rels[i].attributes) { + var c = false; + for (var j in rels[i].attributes) { + if (j == 0) { + html += ' ('; + c = true; + } else { + html = html +', '; + } + html += rels[i].attributes[j]; + } + if (c) { + html += ')'; + } + } + html = html +''+rels[i].artist.name+''; + if (rels[i].artist.disambiguation) { + html += ' ('+rels[i].artist.disambiguation+')'; + } + html = html +'
      '; + } + return html; + } + + return { + getRequirements: function(parent) { + if (parent.playlistinfo.metadata.artists[parent.artistindex].musicbrainz_id == "" || + parent.playlistinfo.metadata.album.musicbrainz_id == "" || + parent.playlistinfo.metadata.track.musicbrainz_id == "") { + return ["lastfm"]; + } else { + return []; + } + }, + + collection: function(parent, artistmeta, albummeta, trackmeta) { + + debug.trace(medebug, "Creating data collection"); + + var self = this; + var displaying = false; + + this.populate = function() { + self.artist.populate(); + self.album.populate(); + self.track.populate(); + } + + this.displayData = function() { + displaying = true; + self.artist.doBrowserUpdate(); + self.album.doBrowserUpdate(); + self.track.doBrowserUpdate(); + } + + this.stopDisplaying = function() { + displaying = false; + } + + this.handleClick = function(source, element, event) { + debug.trace(medebug,parent.nowplayingindex,source,"is handling a click event"); + if (element.hasClass('clickdoartist')){ + var targetdiv = element.parent().next(); + if (!(targetdiv.hasClass('full')) && element.isClosed()) { + doSomethingUseful(targetdiv, language.gettext("info_gettinginfo")); + targetdiv.slideToggle('fast'); + getArtistData(element.attr('name')); + element.toggleOpen(); + targetdiv.addClass('underline'); + } else { + if (element.isOpen()) { + element.toggleClosed(); + targetdiv.removeClass('underline'); + } else { + element.toggleOpen(); + targetdiv.addClass('underline'); + } + targetdiv.slideToggle('fast'); + } + } else if (element.hasClass('clickdodiscography')) { + var targetdiv = element.parent().next(); + if (!(targetdiv.hasClass('full')) && element.isClosed()) { + doSomethingUseful(targetdiv, language.gettext("info_gettinginfo")); + getArtistReleases(element.attr('name'), 'discography_'+element.attr('name')); + element.toggleOpen(); + targetdiv.slideToggle('fast'); + } else { + if (element.isOpen()) { + element.toggleClosed(); + } else { + element.toggleOpen(); + } + targetdiv.slideToggle('fast'); + } + } else if (element.hasClass('clickexpandbox')) { + var id = element.attr('name'); + var expandingframe = element.parent().parent().parent().parent(); + var content = expandingframe.html(); + content=content.replace(/'+data.error+''; + } + + var html = '
      '; + html += '
      '; + + if (data['cover-art-archive'].artwork == true) { + debug.trace(medebug,"There is cover art available"); + html += '
        '; + html += getCoverArt(); + html += '

      '; + } + + html += '
      • '+data.disambiguation+'
      '; + html += '
      • '+language.gettext("musicbrainz_status")+': '; + if (data.status) { + html = html +data.status+" "; + } + for(var j in data['release-group']['secondary-types']) { + html += data['release-group']['secondary-types'][j] + " "; + } + html += (data['release-group']['primary-type'] || ""); + html += '
      '; + if (data['release-group'] && data['release-group']['first-release-date']) { + html += '
      • '+language.gettext("musicbrainz_date")+': '+data['release-group']['first-release-date']+'
      '; + } else { + html += '
      • '+language.gettext("musicbrainz_date")+': '+data.date+'
      '; + } + if (data.country) { + html += '
      • '+language.gettext("musicbrainz_country")+': '+data.country+'
      '; + } + if (data['label-info'] && data['label-info'].length > 0) { + html += '
      • '+language.gettext("title_label")+':
      • '; + for (var i in data['label-info']) { + if (data['label-info'][i].label) { + html += '
      • '+data['label-info'][i].label.name+'
      • '; + } + } + html += '
      '; + } + html += '
      '+getURLs(data.relations, true); + html += '
      '; + + html += '
      '; + if (data.annotation) { + var a = data.annotation; + a = a.replace(/\n/, '
      '); + a = a.replace(/\[(.*?)\|(.*?)\]/, '$2'); + html += '
      '+language.gettext("musicbrainz_notes")+':
      '+a+'
      '; + } + + if (data.tags && data.tags.length > 0) { + html += '
      '+language.gettext("musicbrainz_tags")+'
      '; + for (var i in data.tags) { + html += ''+data.tags[i].name+' '; + } + html += '
      '; + } + + html += doCredits(data.relations); + + html += '
      '+language.gettext("discogs_tracklisting")+'
      '; + for (var i in data.media) { + html += ''; + for (var j in data.media[i].tracks) { + html += ''; + html += ''; + html += ''; + } + } + html += '
      '+language.gettext("musicbrainz_disc")+' '+data.media[i].position; + if (data.media[i].title !== null && data.media[i].title != "") { + html += " - " + data.media[i].title; + } + html += '
      '+data.media[i].tracks[j].number+''+data.media[i].tracks[j].title; + if (data['artist-credit'][0].name == "Various Artists" && data.media[i].tracks[j]['artist-credit']) { + html += '
      '; + var jp = ""; + for (var k in data.media[i].tracks[j]['artist-credit']) { + if (jp != "") { + html += " "+jp+" "; + } + html += data.media[i].tracks[j]['artist-credit'][k].name; + jp = data.media[i].tracks[j]['artist-credit'][k].joinphrase; + } + html += ''; + } + html += '
      '+formatTimeString(Math.round(data.media[i].tracks[j].length/1000))+'
      '; + html += '
      '; + html += '
      '; + html += '
      '; + return html; + } + + function getCoverArt() { + debug.mark(medebug,parent.nowplayingindex,"Getting Cover Art"); + if (albummeta.musicbrainz.coverart === undefined) { + debug.trace(medebug,parent.nowplayingindex," ... retrieivng data"); + musicbrainz.album.getCoverArt( + albummeta.musicbrainz_id, + self.album.coverResponseHandler, + self.album.coverResponseHandler + ); + return ""; + } else { + debug.trace(medebug,parent.nowplayingindex," ... displaying what we've already got"); + return (getCoverHTML(albummeta.musicbrainz.coverart)); + } + } + + this.artist = function() { + + return { + + populate: function() { + if (artistmeta.musicbrainz === undefined) { + artistmeta.musicbrainz = {}; + } + if (artistmeta.musicbrainz_id == "") { + debug.shout(medebug,parent.nowplayingindex,"Artist asked to populate but no MBID, trying again in 2 seonds"); + setTimeout(self.artist.populate, 2000); + return; + } + if (artistmeta.musicbrainz_id === null) { + debug.fail(medebug,parent.nowplayingindex,"Artist asked to populate but no MBID could be found. Aborting"); + artistmeta.musicbrainz.artist = {error: language.gettext("musicbrainz_noartist")}; + parent.updateData({ + wikipedia: { artistlink: null }, + discogs: { artistlink: null }, + allmusic: { artistlink: null } + }, + artistmeta + ); + self.artist.doBrowserUpdate(); + return; + } + if (artistmeta.musicbrainz.artist === undefined && + artistmeta.musicbrainz[artistmeta.musicbrainz_id] === undefined) { + debug.trace(medebug,parent.nowplayingindex,"artist is populating",artistmeta.musicbrainz_id); + musicbrainz.artist.getInfo(artistmeta.musicbrainz_id, self.artist.mbResponseHandler, self.artist.mbResponseHandler); + } else { + debug.trace(medebug,parent.nowplayingindex,"artist is already populated",artistmeta.musicbrainz_id); + } + }, + + mbResponseHandler: function(data) { + debug.trace(medebug,parent.nowplayingindex,"got artist data for",artistmeta.musicbrainz_id,data); + // Look for the information that other plugins need + var update = { disambiguation: null, + wikipedia: { artistlink: null }, + discogs: { artistlink: null }, + allmusic: { artistlink: null } + }; + if (data) { + if (data.error) { + artistmeta.musicbrainz.artist = data; + } else { + artistmeta.musicbrainz[artistmeta.musicbrainz_id] = data; + var wikilinks = { user: null, english: null, anything: null }; + debug.trace(medebug,parent.nowplayingindex,"wikipedia language is",wikipedia.getLanguage()); + + var domain = '^http://'+wikipedia.getLanguage(); + var re = new RegExp(domain); + for (var i in data.relations) { + if (data.relations[i].type == "wikipedia") { + debug.mark(medebug,parent.nowplayingindex,"has found a Wikipedia artist link",data.relations[i].url.resource); + // For wikipedia links we need to prioritise: + // user's chosen domain first + // english second + // followed by anything will do + // the php side will also try to use the link we choose to get language links for the + // user's chosen language, but it's definitely best if we prioritise them here + var wikitemp = data.relations[i].url.resource; + if (re.test(wikitemp)) { + debug.trace(medebug,parent.nowplayingindex,"found user domain wiki link"); + wikilinks.user = wikitemp; + } else if (wikitemp.match(/en.wikipedia.org/)) { + debug.trace(medebug,parent.nowplayingindex,"found english domain wiki link"); + wikilinks.english = wikitemp; + } else { + debug.trace(medebug,parent.nowplayingindex,"found wiki link"); + wikilinks.anything = wikitemp; + } + } + if (data.relations[i].type == "discogs" && update.discogs.artistlink == null) { + debug.mark(medebug,parent.nowplayingindex,"has found a Discogs artist link",data.relations[i].url.resource); + update.discogs.artistlink = data.relations[i].url.resource; + } + if (data.relations[i].type == "allmusic" && update.allmusic.artistlink == null) { + debug.mark(medebug,parent.nowplayingindex,"has found an Allmusic artist link",data.relations[i].url.resource); + update.allmusic.artistlink = data.relations[i].url.resource; + } + } + if (update.wikipedia.artistlink == null) { + if (wikilinks.user) { + debug.trace(medebug,parent.nowplayingindex,"using user domain wiki link",wikilinks.user); + update.wikipedia.artistlink = wikilinks.user; + } else if (wikilinks.english) { + debug.trace(medebug,parent.nowplayingindex,"using english domain wiki link",wikilinks.english); + update.wikipedia.artistlink = wikilinks.english; + } else if (wikilinks.anything) { + debug.trace(medebug,parent.nowplayingindex,"using any old domain wiki link",wikilinks.anything); + update.wikipedia.artistlink = wikilinks.anything; + } + + } + if (data.disambiguation) { + update.disambiguation = data.disambiguation; + } + } + } else { + artistmeta.musicbrainz.artist = {error: language.gettext("musicbrainz_noinfo")}; + } + + parent.updateData(update, artistmeta); + self.artist.doBrowserUpdate(); + + }, + + extraResponseHandler: function(data) { + if (data) { + debug.trace(medebug,parent.nowplayingindex,"got extra artist data for",data.id,data); + artistmeta.musicbrainz[data.id] = data; + putArtistData(artistmeta.musicbrainz[data.id], data.id); + } + + }, + + releaseResponseHandler: function(data) { + if (data) { + debug.trace(medebug,parent.nowplayingindex,"got release data for",data.id,data); + artistmeta.musicbrainz[data.id] = data; + putArtistReleases(artistmeta.musicbrainz[data.id], data.id); + } + + }, + + doBrowserUpdate: function() { + if (displaying) { + debug.trace(medebug,parent.nowplayingindex," artist was asked to display"); + var up = null; + if (artistmeta.musicbrainz.artist !== undefined && artistmeta.musicbrainz.artist.error) { + up = { name: artistmeta.name, + link: null, + data: '

      '+artistmeta.musicbrainz.artist.error+'

      '} + } else if (artistmeta.musicbrainz[artistmeta.musicbrainz_id] !== undefined) { + up = { name: artistmeta.musicbrainz[artistmeta.musicbrainz_id].name, + link: 'http://musicbrainz.org/artist/'+artistmeta.musicbrainz_id, + data: getArtistHTML(artistmeta.musicbrainz[artistmeta.musicbrainz_id], false)} + } + if (up !== null) { + browser.Update( + null, + 'artist', + me, + parent.nowplayingindex, + up + ); + } + } + }, + + } + + }(); + + this.album = function() { + + return { + + populate: function() { + if (albummeta.musicbrainz === undefined) { + albummeta.musicbrainz = {}; + } + if (albummeta.musicbrainz.album === undefined) { + if (albummeta.musicbrainz_id == "") { + debug.shout(medebug,parent.nowplayingindex,"Album asked to populate but no MBID, trying again in 2 seonds"); + setTimeout(self.album.populate, 2000); + return; + } + if (albummeta.musicbrainz_id === null) { + debug.fail(medebug,parent.nowplayingindex,"Album asked to populate but no MBID could be found."); + albummeta.musicbrainz.album = {error: language.gettext("musicbrainz_noalbum")}; + parent.updateData({ + musicbrainz: { album_releasegroupid: null }, + wikipedia: { albumlink: null }, + discogs: { albumlink: null } + }, albummeta); + self.album.doBrowserUpdate(); + return; + } + debug.trace(medebug,parent.nowplayingindex,"album is populating",albummeta.musicbrainz_id); + musicbrainz.album.getInfo( + albummeta.musicbrainz_id, + self.album.mbResponseHandler, + self.album.mbResponseHandler + ); + } else { + debug.trace(medebug,parent.nowplayingindex,"album is already populated",albummeta.musicbrainz_id); + } + }, + + mbResponseHandler: function(data) { + debug.trace(medebug,parent.nowplayingindex,"got album data for",albummeta.musicbrainz_id); + // Look for the information that other plugins need + var update = { + musicbrainz: { album_releasegroupid: null }, + wikipedia: { albumlink: null }, + discogs: { albumlink: null } + }; + if (data) { + albummeta.musicbrainz.album = data; + var wikilinks = { user: null, english: null, anything: null }; + debug.trace(medebug,parent.nowplayingindex,"wikipedia language is",wikipedia.getLanguage()); + + var domain = '^http://'+wikipedia.getLanguage(); + var re = new RegExp(domain); + for (var i in data.relations) { + if (data.relations[i].type == "wikipedia" && update.wikipedia.albumlink === null) { + debug.mark(medebug,parent.nowplayingindex,"has found a Wikipedia album link",data.relations[i].url.resource); + var wikitemp = data.relations[i].url.resource; + if (re.test(wikitemp)) { + debug.trace(medebug,parent.nowplayingindex,"found user domain wiki link"); + wikilinks.user = wikitemp; + } else if (wikitemp.match(/en.wikipedia.org/)) { + debug.trace(medebug,parent.nowplayingindex,"found english domain wiki link"); + wikilinks.english = wikitemp; + } else { + debug.trace(medebug,parent.nowplayingindex,"found wiki link"); + wikilinks.anything = wikitemp; + } + } + if (data.relations[i].type == "discogs" && update.discogs.albumlink === null) { + debug.mark(medebug,parent.nowplayingindex,"has found a Discogs album link",data.relations[i].url.resource); + update.discogs.albumlink = data.relations[i].url.resource; + } + } + if (update.wikipedia.albumlink == null) { + if (wikilinks.user) { + debug.trace(medebug,parent.nowplayingindex,"using user domain wiki link",wikilinks.user); + update.wikipedia.albumlink = wikilinks.user; + } else if (wikilinks.english) { + debug.trace(medebug,parent.nowplayingindex,"using english domain wiki link",wikilinks.english); + update.wikipedia.albumlink = wikilinks.english; + } else if (wikilinks.anything) { + debug.trace(medebug,parent.nowplayingindex,"using any old domain wiki link",wikilinks.anything); + update.wikipedia.albumlink = wikilinks.anything; + } + + } + + if (data['release-group']) { + update.musicbrainz.album_releasegroupid = data['release-group'].id; + } + } else { + albummeta.musicbrainz.album = {error: language.gettext("musicbrainz_noinfo")}; + } + parent.updateData(update,albummeta); + self.album.doBrowserUpdate(); + }, + + coverResponseHandler: function(data) { + debug.mark(medebug,parent.nowplayingindex,"got Cover Art Data",data); + parent.updateData({ musicbrainz: { coverart: data }}, albummeta); + if (displaying) { + $("#coverart").html(getCoverHTML(albummeta.musicbrainz.coverart)); + } + }, + + doBrowserUpdate: function() { + if (displaying && albummeta.musicbrainz.album !== undefined) { + debug.trace(medebug,parent.nowplayingindex,"album was asked to display"); + var up = null; + if (parent.playlistinfo.type == 'stream') { + browser.Update(null, 'album', me, parent.nowplayingindex, { name: "", + link: "", + data: null + } + ); + } else if (albummeta.musicbrainz.album.error) { + up = { name: albummeta.name, + link: null, + data: '

      '+albummeta.musicbrainz.album.error+'

      '} + } else { + up = { name: albummeta.musicbrainz.album.title, + link: 'http://musicbrainz.org/release/'+albummeta.musicbrainz.album.id, + data: html = getAlbumHTML(albummeta.musicbrainz.album)} + + } + browser.Update( + null, + 'album', + me, + parent.nowplayingindex, + up + ); + } + } + } + + }(); + + this.track = function() { + + return { + + populate: function() { + if (trackmeta.musicbrainz === undefined) { + trackmeta.musicbrainz = {}; + } + if (trackmeta.musicbrainz.track === undefined) { + if (trackmeta.musicbrainz_id == "") { + debug.shout(medebug,parent.nowplayingindex,"Track asked to populate but no MBID, trying again in 2 seonds"); + setTimeout(self.track.populate, 2000); + return; + } + if (trackmeta.musicbrainz_id === null) { + debug.fail(medebug,parent.nowplayingindex,"Track asked to populate but no MBID could be found.."); + trackmeta.musicbrainz.track = {}; + trackmeta.musicbrainz.track.error = {error: language.gettext("musicbrainz_notrack")}; + parent.updateData({ + wikipedia: { tracklink: null }, + discogs: { tracklink: null } + }, trackmeta); + self.track.doBrowserUpdate(); + return; + } + debug.trace(medebug,parent.nowplayingindex,"track is populating",trackmeta.musicbrainz_id); + musicbrainz.track.getInfo(trackmeta.musicbrainz_id, self.track.mbResponseHandler, self.track.mbResponseHandler); + } else { + debug.trace(medebug,parent.nowplayingindex,"track is already populated",trackmeta.musicbrainz_id); + } + }, + + mbResponseHandler: function(data) { + debug.trace(medebug,parent.nowplayingindex,"got track data for",trackmeta.musicbrainz_id,data); + // Look for the information that other plugins need + var update = { + wikipedia: { tracklink: null }, + discogs: { tracklink: null } + }; + if (data) { + if (data.error) { + trackmeta.musicbrainz.track = {}; + trackmeta.musicbrainz.track.error = data; + } else { + trackmeta.musicbrainz.track = data; + if (data.recording) { + for (var i in data.recording.relations) { + if (data.recording.relations[i].type == "wikipedia" && update.wikipedia.tracklink === null) { + debug.mark(medebug,parent.nowplayingindex,"has found a Wikipedia track link!!!!!",data.recording.relations[i].url.resource); + update.wikipedia.tracklink = data.recording.relations[i].url.resource; + } + if (data.recording.relations[i].type == "discogs" && update.discogs.tracklink === null) { + debug.mark(medebug,parent.nowplayingindex,"has found a Discogs track link!!!!!",data.recording.relations[i].url.resource); + update.discogs.tracklink = data.recording.relations[i].url.resource; + } + } + } + if (data.work) { + for (var i in data.work.relations) { + if (data.work.relations[i].type == "wikipedia" && update.wikipedia.tracklink === null) { + debug.mark(medebug,parent.nowplayingindex,"has found a Wikipedia track link!!!!!",data.work.relations[i].url.resource); + update.wikipedia.tracklink = data.work.relations[i].url.resource; + } + if (data.work.relations[i].type == "discogs" && update.discogs.tracklink === null) { + debug.mark(medebug,parent.nowplayingindex,"has found a Discogs track link!!!!!",data.work.relations[i].url.resource); + update.discogs.tracklink = data.work.relations[i].url.resource; + } + } + } + } + } else { + trackmeta.musicbrainz.track.error = {error: language.gettext("musicbrainz_noinfo")}; + } + parent.updateData(update,trackmeta); + self.track.doBrowserUpdate(); + }, + + doBrowserUpdate: function() { + if (displaying && trackmeta.musicbrainz.track !== undefined && + (trackmeta.musicbrainz.track.error !== undefined || + trackmeta.musicbrainz.track.recording !== undefined || + trackmeta.musicbrainz.track.work !== undefined)) { + debug.trace(medebug,parent.nowplayingindex,"track was asked to display"); + var link = null; + if (trackmeta.musicbrainz.track.recording) { + link = 'http://musicbrainz.org/recording/'+trackmeta.musicbrainz.track.recording.id; + } + browser.Update( + null, + 'track', + me, + parent.nowplayingindex, + { name: trackmeta.name, + link: link, + data: getTrackHTML(trackmeta.musicbrainz.track) + } + ); + } + } + } + + }(); + } + } + +}(); + +nowplaying.registerPlugin("musicbrainz", info_musicbrainz, "icon-musicbrainz", "button_musicbrainz"); diff --git a/www/rompr/browser/plugins/05_info_discogs.js b/www/rompr/browser/plugins/05_info_discogs.js new file mode 100644 index 0000000..3ca1c93 --- /dev/null +++ b/www/rompr/browser/plugins/05_info_discogs.js @@ -0,0 +1,1354 @@ +var info_discogs = function() { + + var me = "discogs"; + var medebug = 'DISCOGS PLUGIN'; + + function getURLs(urls) { + var html = ""; + for (var i in urls) { + if (urls[i] != "") { + var u = urls[i]; + var d = u.match(/https*:\/\/(.*?)(\/|$)/); + if (d == null) { + d = [u,u]; + u = 'http://'+u; + } + if (u.match(/wikipedia/i)) { + html += '
    • Wikipedia ('+d[1]+')
    • '; + } else if (u.match(/facebook/i)) { + html += '
    • Facebook
    • '; + } else { + html += '
    • '+d[1]+'
    • '; + } + } + } + return html; + } + + function getBestImage(images) { + var image = null; + var types = ['primary', 'secondary']; + var index = -1; + while (image === null && types.length > 0) { + var type = types.shift(); + var maxsize = 0; + for (var i in images) { + if (images[i].resource_url && images[i].type == type) { + var size = images[i].height*images[i].width; + if (size > maxsize) { + image = images[i].resource_url; + maxsize = size; + } + } + } + } + return image; + } + + function compareArtists(art1, art2) { + var a1 = mungeArtist(art1); + var a2 = mungeArtist(art2); + if (a1 == a2) { + return true; + } + return tryWithoutAccents(a1, a2); + } + + function tryWithoutAccents(a1, a2) { + return (a1.normalize("NFD").replace(/[\u0300-\u036f]/g, "") == a2.normalize("NFD").replace(/[\u0300-\u036f]/g, "")); + } + + function mungeArtist(n) { + n = n.replace(/ \(\d+\)$/, ''); + var p = n.split(' '); + for (var i in prefs.nosortprefixes) { + if (p[0].toLowerCase() == prefs.nosortprefixes[i].toLowerCase()) { + p.shift(); + break; + } + } + var retval = p.join(' ').toLowerCase(); + retval.replace(/ featuring .+$/, ''); + retval.replace(/ feat\. .+$/, ''); + debug.debug(medebug,'Munged artist',n,'to',retval); + return retval; + } + + function getReleaseHTML(data) { + var html = ""; + debug.trace(medebug,"Generating release HTML for",data.id); + if (data.data.releases.length > 0) { + html += '
      PAGES: '; + for (var i = 1; i <= data.data.pagination.pages; i++) { + if (i == data.data.pagination.page) { + html += " "+i+""; + } else { + var a = data.data.pagination.urls.last || data.data.pagination.urls.first; + var b = a.match(/artists\/(\d+)\/releases/); + if (b && b[1]) { + html += ' '+i+''; + } + } + } + html += '
      '; + html += '
      '; + html += ''; + for (var i in data.data.releases) { + html += ''; + if (data.data.releases[i].thumb) { + html += ''; + } else { + html += ''; + } + if (data.data.releases[i].year) { + html += ''; + } else { + html += ''; + } + if (data.data.releases[i].title) { + html += ''; + } else { + html += ''; + } + if (data.data.releases[i].artist) { + html += ''; + } else { + html += ''; + } + if (data.data.releases[i].format) { + html += ''; + } else { + html += ''; + } + if (data.data.releases[i].label) { + html += ''; + } else { + html += ''; + } + html += ''; + } + html += '
      '+language.gettext("title_year")+''+language.gettext("title_title")+'' + +language.getUCtext("label_artist")+''+language.gettext("title_type")+''+language.gettext("title_label")+'
      '+data.data.releases[i].year+''+ + data.data.releases[i].title+ + ''; + if (data.data.releases[i].role && data.data.releases[i].role != 'Main') { + var r = data.data.releases[i].role; + r = r.replace(/([a-z])([A-Z])/, '$1 $2'); + html += '
      ('+r+')' + } + if (data.data.releases[i].trackinfo) { + html += '
      ('+data.data.releases[i].trackinfo+')' + } + html += '
      '+data.data.releases[i].artist+''+data.data.releases[i].format+''+data.data.releases[i].label+'
      '; + html += '
      '+language.gettext("label_pages")+': '; + for (var i = 1; i <= data.data.pagination.pages; i++) { + if (i == data.data.pagination.page) { + html += " "+i+""; + } else { + var a = data.data.pagination.urls.last || data.data.pagination.urls.first; + var b = a.match(/artists\/(\d+)\/releases/); + if (b && b[1]) { + html += ' '+i+''; + } + } + } + html += '
      '; + } + debug.trace(medebug,"Returning release HTML for",data.id); + return html; + } + + function getStyles(styles) { + var html = '
      • '+language.gettext("discogs_styles")+'
      • '; + for (var i in styles) { + html += '
      • '+styles[i]+'
      • '; + } + html += '
      '; + return html; + } + + function getGenres(genres) { + var html = '
      • '+language.gettext("discogs_genres")+'
      • '; + for (var i in genres) { + html += '
      • '+genres[i]+'
      • '; + } + html += '
      '; + return html; + } + + function getTracklist(tracks) { + var html = '
      '+language.gettext("discogs_tracklisting")+'
      '; + for (var i in tracks) { + if (tracks[i].position == "") { + html += ''; + } else { + html += ''; + html += ''; + html += ''; + } + } + html += '
      '+tracks[i].title+'
      '+tracks[i].position+''+tracks[i].title+''; + if (tracks[i].artists && tracks[i].artists.length > 0) { + html += '
      '; + var jp = ""; + for (var k in tracks[i].artists) { + if (jp != "") { + html += " "+jp+" "; + } + html += tracks[i].artists[k].name; + jp = tracks[i].artists[k].join; + } + html += ''; + } + + if (tracks[i].extraartists) { + for (var j in tracks[i].extraartists) { + html += '
      '+tracks[i].extraartists[j].role+ + ' - '+tracks[i].extraartists[j].name+''; + } + } + html += '
      '+tracks[i].duration+'
      '; + return html; + } + + return { + getRequirements: function(parent) { + return ["musicbrainz"]; + }, + + collection: function(parent, artistmeta, albummeta, trackmeta) { + + debug.trace(medebug, "Creating data collection"); + + var self = this; + var displaying = false; + var artisttimer; + var albumtimer; + var tracktimer; + + this.populate = function() { + debug.log(medebug,'Populating'); + parent.updateData({ + discogs: { + triedsearch: false, + triedmunge: false + } + }, + artistmeta + ); + parent.updateData({ + discogs: { + album: {}, + triedmusicbrainz: false, + triedsearch: false, + triedmunge: false + } + }, + albummeta + ); + parent.updateData({ + discogs: { + track: {}, + triedsearch: false, + triedmunge: false + } + }, + trackmeta + ); + self.album.populate(); + self.track.populate(); + } + + this.displayData = function() { + displaying = true; + self.artist.doBrowserUpdate(); + self.album.doBrowserUpdate(); + self.track.doBrowserUpdate(); + } + + this.stopDisplaying = function(waitingon) { + displaying = false; + clearTimeout(artisttimer); + clearTimeout(albumtimer); + clearTimeout(tracktimer); + } + + this.handleClick = function(source, element, event) { + debug.trace(medebug,parent.nowplayingindex,source,"is handling a click event"); + if (element.hasClass('clickdoartist')) { + var targetdiv = element.parent().next(); + if (!(targetdiv.hasClass('full')) && element.isClosed()) { + doSomethingUseful(targetdiv, language.gettext("info_gettinginfo")); + targetdiv.slideToggle('fast'); + getArtistData(element.attr('name')); + element.toggleOpen(); + targetdiv.addClass('underline'); + } else { + var id = element.attr('name'); + if (element.isOpen()) { + element.toggleClosed(); + targetdiv.removeClass('underline'); + } else { + element.toggleOpen(); + targetdiv.addClass('underline'); + } + targetdiv.slideToggle('fast'); + } + } else if (element.hasClass('clickreleasepage')) { + var targetdiv = element.parent().parent().parent().attr("name"); + element.parent().parent().parent().addClass("expectingpage_"+element.text()); + doSomethingUseful(element.parent().parent(), language.gettext("info_gettinginfo")); + getArtistReleases(element.attr('name'), element.text()); + } else if (element.hasClass('clickdodiscography')) { + var targetdiv = element.parent().next(); + if (!(targetdiv.hasClass('full')) && element.isClosed()) { + doSomethingUseful(targetdiv, language.gettext("info_gettinginfo")); + targetdiv.addClass("expectingpage_1"); + getArtistReleases(element.attr('name'), 1); + element.toggleOpen(); + targetdiv.slideToggle('fast'); + } else { + if (element.isOpen()) { + element.toggleClosed(); + } else { + element.toggleOpen(); + } + targetdiv.slideToggle('fast'); + } + } else if (element.hasClass('clickzoomimage')) { + imagePopup.create(element, event, element.next().val()); + } else if (element.hasClass('clickgetdiscstuff')) { + var link = element.next().val(); + var b = link.match(/(releases\/\d+)|(masters\/\d+)/); + if (b && b[0]) { + debug.log("DISCOGS","Getting info for",b[0]) + discogs.album.getInfo('', b[0], + function(data) { + debug.trace("DISCOGS", "Got Data",data); + if (data.data.uri) { + debug.trace("DISCOGS", "Opening Data",data.data.uri); + var box = element.parent(); + box.empty(); + var newlink = $(''+data.data.title+'').appendTo(box); + window.open(data.data.uri, '_blank'); + } + }, + function(data) { + infobar.error(language.gettext('label_general_error')); + } + ); + } + } else if (element.hasClass('clickexpandbox')) { + var id = element.attr('name'); + var expandingframe = element.parent().parent().parent().parent(); + var content = expandingframe.html(); + content=content.replace(/'); + // Inline links using an artist id + p = p.replace(/\[a=*(\d+?)\]/g, '$1'); + // Inline links using an artist name + var reg = /\[a=*(.+?)\]/g; + var matches = [...p.matchAll(reg)]; + for (var i in matches) { + p = p.replace(matches[i][0], ''+matches[i][1]+'') + } + // Same ofr inline label links + p = p.replace(/\[l=*(.\d+?)\]/g, '$1'); + reg = /\[l=*(.+?)\]/g; + matches = [...p.matchAll(reg)]; + for (var i in matches) { + p = p.replace(matches[i][0], ''+matches[i][1]+'') + } + // Same for inline master links + p = p.replace(/\[m=*(\d+?)\]/g, '$1'); + var reg = /\[m=*(.+?)\]/g; + var matches = [...p.matchAll(reg)]; + for (var i in matches) { + p = p.replace(matches[i][0], ''+matches[i][1]+'') + } + // Same for inline release links + p = p.replace(/\[r=*(\d+?)\]/g, '$1'); + var reg = /\[r=*(.+?)\]/g; + var matches = [...p.matchAll(reg)]; + for (var i in matches) { + p = p.replace(matches[i][0], ''+matches[i][1]+'') + } + + p = p.replace(/\[url=*(.+?)\](.+?)\[\/url\]/g, '$2'); + p = p.replace(/\[b\]/g, ''); + p = p.replace(/\[\/b\]/g, ''); + p = p.replace(/\[i\]/g, ''); + p = p.replace(/\[\/i\]/g, ''); + + // Discogs profiles come with a bunch of references to other artists formatted as [a123456] + // (where 123456 is the discogs artist id). formatNotes replaces these with spans so we can + // get the arist bio and update the displayed items without having to resort to replacing + // all the html in the div every time. + // To avoid getting the artist data every time we display the html, we'll also check to see + // if we already have the data and use it now if we do. + + // Not only that they've started doing [r=123456] to denote a release! (See Hawkwind) + var m = p.match(//g); + if (m) { + for(var i in m) { + var n = m[i].match(//); + if (n && n[1]) { + debug.shout(medebug,"Found unpopulated artist reference",n[1]); + if (artistmeta.discogs['artist_'+n[1]] === undefined) { + debug.trace(medebug,parent.nowplayingindex," ... retrieivng data"); + discogs.artist.getInfo( + n[1], + n[1], + self.artist.extraResponseHandler2, + self.artist.extraResponseHandler2 + ); + } else { + debug.trace(medebug,parent.nowplayingindex," ... displaying what we've already got"); + var name = artistmeta.discogs['artist_'+n[1]].data.name; + var link = artistmeta.discogs['artist_'+n[1]].data.uri; + p = p.replace(new RegExp(''+n[1]+'<\/span>', 'g'), ''+name+''); + } + } + } + } + + var m = p.match(//g); + if (m) { + for(var i in m) { + var n = m[i].match(//); + if (n && n[1]) { + debug.shout(medebug, "Found unpopulated master reference", n[1]); + discogs.album.getInfo( + n[1], + 'masters/'+n[1], + self.artist.gotExtraAlbumInfo, + self.artist.gotExtraAlbumInfo + ); + } + } + } + + var m = p.match(//g); + if (m) { + for(var i in m) { + var n = m[i].match(//); + if (n && n[1]) { + debug.shout(medebug, "Found unpopulated release reference", n[1]); + discogs.album.getInfo( + n[1], + 'releases/'+n[1], + self.artist.gotExtraAlbumInfo2, + self.artist.gotExtraAlbumInfo2 + ); + } + } + } + + var m = p.match(//g); + if (m) { + for(var i in m) { + var n = m[i].match(//); + if (n && n[1]) { + debug.shout(medebug, "Found unpopulated label reference", n[1]); + discogs.label.getInfo( + n[1], + n[1], + self.artist.gotExtraLabelInfo, + self.artist.gotExtraLabelInfo + ); + } + } + } + + return p; + } + + function getAlbumHTML(data, order) { + debug.trace(medebug,"Creating HTML from release/master data",data); + + if (data.error && data.master === undefined && data.release === undefined) { + return '

      '+data.error.error+'

      '; + } + + var html = '
      '; + + html += '
      '; + + for (var i in order) { + if (data[order[i]] && data[order[i]].data.styles && data[order[i]].data.styles.length > 0) { + html += getStyles(data[order[i]].data.styles); + break; + } + } + + for (var i in order) { + if (data[order[i]] && data[order[i]].data.genres && data[order[i]].data.genres.length > 0) { + html += getGenres(data[order[i]].data.genres); + break; + } + } + + if (data.release && data.release.data.companies && data.release.data.companies.length > 0) { + html += '
      • '+language.gettext("discogs_companies")+'
      • '; + for (var i in data.release.data.companies) { + html += '
      • '+data.release.data.companies[i].entity_type_name+ + " "+data.release.data.companies[i].name+'
      • '; + + } + html += '
      '; + } + + html += '
      '; + + html += '
      '; + + var image = null; + for (var i in order) { + if (data[order[i]] && data[order[i]].data.images) { + image = getBestImage(data[order[i]].data.images); + if (image !== null) { + break; + } + } + } + if (image !== null) { + html += ''; + html += ''; + } + + if (data.master && data.master.data.notes) { + var n = formatNotes(data.master.data.notes); + html += '

      '+n+'

      '; + } + + if (data.release && data.release.data.notes) { + var n = formatNotes(data.release.data.notes); + html += '

      '+n+'

      '; + } + + if (data.release && data.release.data.extraartists && data.release.data.extraartists.length > 0) { + html += '
      '+language.gettext("discogs_personnel")+'
      '; + for (var i in data.release.data.extraartists) { + html += '
      '+data.release.data.extraartists[i].role+' '+data.release.data.extraartists[i].name+'
      '; + } + } + + for (var i in order) { + if (data[order[i]] && data[order[i]].data.tracklist && data[order[i]].data.tracklist.length > 0) { + html += '
      '; + html += getTracklist(data[order[i]].data.tracklist); + break; + } + } + + html += '
      '; + html += '
      '; + return html; + } + + function getArtistHTML(data, expand) { + if (data.error) { + return '

      '+data.error+'

      '; + } + debug.trace(medebug, "Creating Artist HTML",data); + + var html = ''; + + if (artistmeta.discogs.possibilities && artistmeta.discogs.possibilities.length > 1) { + html += '
      '+ + '
      '+ + '
      All possibilities for "'+ + artistmeta.name+'"
      '+ + '
      '; + for (var i in artistmeta.discogs.possibilities) { + html += '
      '; + if (artistmeta.discogs.possibilities[i].image) { + html += ''; + } else { + html += ''; + } + html += ''+artistmeta.discogs.possibilities[i].name+''; + html += '
      '; + } + html += '
      '; + html += '
      '; + } + + html += '
      '; + html += '
      '; + + if (data.data.realname && data.data.realname != "") { + html += '
      • '+language.gettext("discogs_realname")+' '+data.data.realname+'
      • '; + } + + if (data.data.aliases && data.data.aliases.length > 0) { + html += '
        • '+language.gettext("discogs_aliases")+'
        • '; + for (var i in data.data.aliases) { + html += '
        • '+data.data.aliases[i].name+'
        • '; + } + html += '
        '; + } + + if (data.data.namevariations && data.data.namevariations.length > 0) { + html += '
        • '+language.gettext("discogs_alsoknown")+'
        • '; + for (var i in data.data.namevariations) { + html += '
        • '+data.data.namevariations[i]+'
        • '; + } + html += '
        '; + } + + if (data.data.urls && data.data.urls.length > 0) { + html += '
        • '+language.gettext("discogs_external")+'
        • '; + html += getURLs(data.data.urls); + html += '
        '; + } + html += '
      '; + + html += '
      '; + + html += '
      '; + var image = null; + if (data.data.images) { + image = getBestImage(data.data.images); + } + if (image !== null) { + html += ''; + html += ''; + } + + if (expand) { + html += ''; + } + + if (data.data.profile) { + var p = formatNotes(data.data.profile); + html += '

      '+p+'

      '; + } + html += '
      '; + + html += '
      '; + + html += '
      '; + if (data.data.members && data.data.members.length > 0) { + html += '
      '+language.gettext("discogs_bandmembers")+'
      '; + html += doMembers(data.data.members); + } + + if (data.data.groups && data.data.groups.length > 0) { + html += '
      '+language.gettext("discogs_memberof")+'
      '; + html += doMembers(data.data.groups); + } + html += '
      '; + html += ''; + html += ''+language.gettext("discogs_discography", [data.data.name.toUpperCase()])+'
      '; + html += ''; + return html; + } + + function doMembers(members) { + var html = ""; + for (var i in members) { + html += '
      '; + html += ''; + var n = members[i].name; + n = n.replace(/ \(\d+\)$/, ''); + html += ''+n+''; + html += '
      '; + html += ''; + } + return html; + } + + function getSearchArtistForAlbum() { + var a = (albummeta.artist && albummeta.artist != "") ? albummeta.artist : parent.playlistinfo.trackartist; + if (a == "Various Artists") { + a = "Various"; + } + return a; + } + + function getSearchArtist() { + return artistmeta.name; + } + + this.artist = function() { + + var retries = 10; + var force = false; + + return { + + populate: function() { + + // The link will either be /artist/[number] in which case we can use it + // Or it'll be /artist/Artist+Name which we can't use + + // artistlink is what musicbrainz will try to give us. If it's undefined it means musicbrainz + // hasn't yet come up with any sort of answer. If it's null it means musicbrainz failed to find one + // or we gave up waiting for musicbrainz. + // artistid is what we're trying to find. (All we have at the initial stage is an artist name). + // If it's undefined it means we haven't even looked yet. If it's null it means we looked and failed. + + // Let's look at what we're doing here, because this is hard. + // 1. Wait to see if musicbrainz can find a link to discogs for us. This is good because it will + // have come via the MUSICBRAINZ_ARTISTID tag (althought possible it might have come from an MB tag found by Last.FM) + // 2. We wait for up to 20 seconds for that to happen, then give up. If MB doesn't find one it sents it to null. + // 3. In the meantime, the track may have found an aristuri for us. This is likely to be accurate, and probably more + // accurate than the one MB gave us (since that may have come bia Last.FM) so if there is one, we use it. + // 4. If we didn't get a link, or it didn't work, we search. First we search for the artist name as it stands. + // Then if that didn't give us anything useful we munge it (remove (digits) from the end, The from the beginning + // ' featuring some shithead' from the end etc) and try again. + + if (artistmeta.discogs.artistinfo === undefined && (artistmeta.discogs.artistid === undefined || artistmeta.discogs.artistid === null)) { + if (artistmeta.discogs.artistlink === undefined) { + debug.shout(medebug,parent.nowplayingindex,"Artist asked to populate but no link yet"); + retries--; + if (retries == 0 || artistmeta.discogs.artisturi !== undefined) { + debug.warn(medebug,parent.nowplayingindex,"Artist giving up waiting for bloody musicbrainz"); + artistmeta.discogs.artistlink = null; + } else { + artisttimer = setTimeout(self.artist.populate, 2000); + return; + } + } + // artisturi is returned by the track, if it finds a suitable match. It's likely to be more accurate than + // anything returned by musicbrainz (except if local tracks are tagged with mb artist ids I guess) + var link = (artistmeta.discogs.artisturi === undefined) ? artistmeta.discogs.artistlink : artistmeta.discogs.artisturi; + if (link !== undefined && link !== null) { + var s = link.split('/').pop() + if (s.match(/^\d+$/)) { + debug.mark(medebug,parent.nowplayingindex,"Artist asked to populate, using supplied link",s); + artistmeta.discogs.artistid = s; + discogs.artist.getInfo( + 'artist_'+s, + s, + self.artist.artistResponseHandler, + self.artist.artistResponseHandler + ); + return; + } else { + debug.log(medebug,'Artist link was useless',s); + } + } + if (artistmeta.discogs.triedsearch && artistmeta.discogs.triedmunge) { + self.artist.abjectFailure(); + } else { + self.artist.search(artistmeta.discogs.triedsearch ? mungeArtist(getSearchArtist()) : getSearchArtist()); + } + } else { + debug.mark(medebug,parent.nowplayingindex,"Artist is already populated"); + } + }, + + search: function(name) { + debug.log(medebug,'Searching for artist',name); + discogs.artist.search(name, self.artist.searchResponse, self.artist.abjectFailure); + }, + + searchResponse: function(data) { + debug.log(medebug,'Got artist search response', data); + if (artistmeta.discogs.triedsearch) { + artistmeta.discogs.triedmunge = true; + } else { + artistmeta.discogs.triedsearch = true; + } + artistmeta.discogs.possibilities = new Array(); + if (data.data.results && data.data.results.length > 0) { + for (var i in data.data.results) { + if (artistmeta.discogs.triedmunge) { + var amatch = mungeArtist(getSearchArtist()); + } else { + var amatch = getSearchArtist(); + } + if (compareArtists(data.data.results[i].title, amatch)) { + debug.log(medebug,'Found Artist index',i,data.data.results[i].title); + artistmeta.discogs.possibilities.push({ + name: data.data.results[i].title, + link: data.data.results[i].resource_url, + image: data.data.results[i].thumb + }); + } + } + if (artistmeta.discogs.possibilities.length > 0) { + artistmeta.discogs.artistlink = artistmeta.discogs.possibilities[0].link; + artistmeta.discogs.currentposs = 0; + } + } + self.artist.populate(); + }, + + artistResponseHandler: function(data) { + debug.log(medebug,parent.nowplayingindex,"got artist data",data); + if (data) { + artistmeta.discogs['artist_'+artistmeta.discogs.artistid] = data; + self.artist.doBrowserUpdate(); + } else { + self.artist.abjectFailure(); + artistmeta.videos.youtube = null; + } + }, + + abjectFailure: function() { + debug.fail(medebug,"Failed to find any artist data"); + artistmeta.discogs.artistinfo = {error: language.gettext("discogs_nonsense")}; + self.artist.doBrowserUpdate(); + }, + + extraResponseHandler: function(data) { + debug.mark(medebug,parent.nowplayingindex,"got extra artist data for",data.id,data); + if (data) { + artistmeta.discogs[data.id] = data; + putArtistData(artistmeta.discogs[data.id], data.id); + } + }, + + extraResponseHandler2: function(data) { + debug.mark(medebug,parent.nowplayingindex,"got stupidly extra artist data for",data.id,data); + if (data) { + artistmeta.discogs['artist_'+data.id] = data; + if (data.data) { + // Fill in any [a123456] or [a=123456] links in the main text body. + $('span.artists[name="'+data.data.id+'"]').html(data.data.name); + $('span.artists[name="'+data.data.id+'"]').wrap(''); + } + } + }, + + gotExtraAlbumInfo: function(data) { + debug.mark(medebug, 'got extra album info',data); + if (data) { + artistmeta.discogs['masters_'+data.id] = data; + if (data.data) { + // Fill in any [m123456] or [m=123456] links in the main text body. + $('span.masters[name="'+data.data.id+'"]').html(data.data.title); + $('span.masters[name="'+data.data.id+'"]').wrap(''); + } + } + }, + + gotExtraAlbumInfo2: function(data) { + debug.mark(medebug, 'got extra album info',data); + if (data) { + artistmeta.discogs['releases_'+data.id] = data; + if (data.data) { + // Fill in any [r123456] or [r=123456] links in the main text body. + $('span.releases[name="'+data.data.id+'"]').html(data.data.title); + $('span.releases[name="'+data.data.id+'"]').wrap(''); + } + } + }, + + gotExtraLabelInfo: function(data) { + debug.mark(medebug, 'got extra label info',data); + if (data) { + if (data.data) { + // Fill in any [l123456] or [l=123456] links in the main text body. + $('span.labels[name="'+data.data.id+'"]').html(data.data.name); + $('span.labels[name="'+data.data.id+'"]').wrap(''); + } + } + }, + + releaseResponseHandler: function(data) { + debug.mark(medebug,parent.nowplayingindex,"got release data for",data.id,data); + if (data) { + artistmeta.discogs[data.id+"_"+data.data.pagination.page] = data; + putArtistReleases(artistmeta.discogs[data.id+"_"+data.data.pagination.page], data.id); + } + }, + + doBrowserUpdate: function() { + if (displaying) { + debug.mark(medebug,parent.nowplayingindex,"artist was asked to display"); + // Any errors (such as failing to find the artist) go under artistinfo. Originally, this was where the actual artist info would go + // too, but then this bright spark had the idea to index all the artist info by the artist ID. This is indeed useful. + // But if there was an error in the initial search we don't know the ID. Hence artistinfo still exists and has to be checked. + var up = null; + if (artistmeta.discogs.artistinfo && artistmeta.discogs.artistinfo.error) { + up = { name: artistmeta.name, + link: null, + data: '

      '+artistmeta.discogs.artistinfo.error+'

      '} + } else if (artistmeta.discogs.artistid !== null && + artistmeta.discogs['artist_'+artistmeta.discogs.artistid] !== undefined) { + up = { name: artistmeta.name, + link: artistmeta.discogs['artist_'+artistmeta.discogs.artistid].data.uri, + data: getArtistHTML(artistmeta.discogs['artist_'+artistmeta.discogs.artistid], false)} + } + if (up !== null) { + browser.Update( + null, + 'artist', + me, + parent.nowplayingindex, + up, + false, + self.artist.force + ); + } + } + } + } + }(); + + this.album = function() { + + var retries = 12; + + return { + + populate: function() { + + if (albummeta.discogs.album.error === undefined && albummeta.discogs.album.master === undefined) { + if (albummeta.discogs.albumlink === undefined) { + debug.shout(medebug,parent.nowplayingindex,"Album asked to populate but no link yet"); + retries--; + if (retries == 0) { + debug.warn(medebug,parent.nowplayingindex,"Album giving up waiting for bloody musicbrainz"); + albummeta.discogs.albumlink = null; + } else { + albumtimer = setTimeout(self.album.populate, 2000); + return; + } + } + if (albummeta.discogs.albumlink === null && albummeta.discogs.triedmusicbrainz == false) { + debug.fail(medebug,parent.nowplayingindex,"Album asked to populate but no link could be found"); + if (albummeta.musicbrainz.album_releasegroupid !== null && albummeta.musicbrainz.album_releasegroupid !== undefined) { + debug.mark(medebug,parent.nowplayingindex," ... trying the album release group"); + musicbrainz.releasegroup.getInfo( + albummeta.musicbrainz.album_releasegroupid, + '', + self.album.mbRgHandler, + self.album.mbRgHandler + ); + return; + } + } else if (albummeta.discogs.albumlink !== null) { + var b = albummeta.discogs.albumlink.match(/releases*\/(\d+)/); + if (b && b[1]) { + debug.mark(medebug,parent.nowplayingindex,"Found album release link",b[1]); + discogs.album.getInfo( + b[1], + 'releases/'+b[1], + self.album.albumResponseHandler, + self.album.albumResponseErrorHandler + ); + return; + } + var b = albummeta.discogs.albumlink.match(/masters*\/(\d+)/); + if (b && b[1]) { + debug.mark(medebug,parent.nowplayingindex,"Found album master link",b[1]); + discogs.album.getInfo( + b[1], + 'masters/'+b[1], + self.album.albumResponseHandler, + self.album.albumResponseErrorHandler + ); + return; + } + } + if (albummeta.discogs.triedsearch && albummeta.discogs.triedmunge) { + self.album.abjectFailure(); + } else { + self.album.search(albummeta.discogs.triedsearch ? mungeArtist(getSearchArtistForAlbum()) : getSearchArtistForAlbum()); + } + } else { + debug.mark(medebug,parent.nowplayingindex,"Album is already populated, I think"); + } + }, + + search: function(artist) { + debug.log(medebug, 'Searching for album',artist,albummeta.name); + discogs.album.search(artist, albummeta.name, self.album.searchResponse, self.album.abjectFailure); + }, + + searchResponse: function(data) { + debug.log(medebug, 'Got album search results', data); + if (albummeta.discogs.triedsearch) { + albummeta.discogs.triedmunge = true; + } else { + albummeta.discogs.triedsearch = true; + } + if (data.data.results && data.data.results.length > 0) { + var best = -1; + var besta = 0; + find_best_album: { + for (var i in data.data.results) { + if (data.data.results[i].format && data.data.results[i].master_url) { + for (var j in data.data.results[i].format) { + if (getSearchArtistForAlbum() == "Various" && data.data.results[i].format[j] == "Compilation") { + debug.log(medebug, 'Using Compilation Result'); + best = i; + break find_best_album; + } else if (data.data.results[i].format[j] == 'Album' && besta == 0) { + besta = i; + } + } + } + } + } + best = (best >= 0) ? best : besta; + albummeta.discogs.albumlink = data.data.results[best].master_url; + debug.log(medebug,'Using album search result', best, albummeta.discogs.albumlink); + } + self.album.populate(); + }, + + albumResponseHandler: function(data) { + debug.mark(medebug,parent.nowplayingindex,"Got album data",data); + if (data.data.master_id) { + // If this key exists, then we have retrieved a release page - this data is useful but we also + // want the master release info. (Links that come to us from musicbrainz could be either master or release). + // We will only display when we have the master info. Since we can't go back from master to release + // then if we got a master link from musicbrainz that's all we're ever going to get. + albummeta.discogs.album.release = data; + discogs.album.getInfo( + '', + 'masters/'+data.data.master_id, + self.album.albumResponseHandler, + self.album.albumResponseErrorHandler + ); + } else { + albummeta.discogs.album.master = data; + self.album.doBrowserUpdate(); + } + }, + + albumResponseErrorHandler: function(data) { + debug.fail(medebug,"Error in album request",data); + albummeta.discogs.album.error = data; + self.album.doBrowserUpdate(); + }, + + mbRgHandler: function(data) { + debug.mark(medebug,parent.nowplayingindex,"got musicbrainz release group data for",parent.playlistinfo.album, data); + if (data.error) { + debug.fail(medebug,parent.nowplayingindex," ... MB error",data); + } else { + for (var i in data.relations) { + if (data.relations[i].type == "discogs") { + debug.mark(medebug,parent.nowplayingindex,"has found a Discogs album link",data.relations[i].url.resource); + albummeta.discogs.albumlink = data.relations[i].url.resource; + self.album.populate(); + return; + } + } + } + debug.log(medebug,'No useful info in MB release group data'); + albummeta.discogs.triedmusicbrainz = true; + self.album.populate(); + }, + + abjectFailure: function() { + debug.fail(medebug,"Completely failed to find the album"); + albummeta.discogs.album.error = {error: language.gettext("discogs_noalbum")}; + self.album.doBrowserUpdate(); + }, + + doBrowserUpdate: function() { + if (displaying && albummeta.discogs.album !== undefined && + (albummeta.discogs.album.error !== undefined || + albummeta.discogs.album.master !== undefined || + albummeta.discogs.album.release !== undefined)) { + debug.mark(medebug,parent.nowplayingindex,"album was asked to display"); + if (parent.playlistinfo.type == 'stream') { + browser.Update(null, 'album', me, parent.nowplayingindex, { name: "", + link: "", + data: null + } + ); + } else { + browser.Update( + null, + 'album', + me, + parent.nowplayingindex, + { + name: albummeta.name, + link: (albummeta.discogs.album.master === undefined) ? null : albummeta.discogs.album.master.data.uri, + data: getAlbumHTML(albummeta.discogs.album, ['master', 'release']) + } + ); + } + } + }, + } + }(); + + this.track = function() { + + var retries = 15; + + return { + + populate: function() { + + if (trackmeta.discogs.track.error === undefined && trackmeta.discogs.track.master === undefined) { + if (trackmeta.discogs.tracklink === undefined) { + debug.trace(medebug,parent.nowplayingindex,"Track asked to populate but no link yet"); + retries--; + if (retries == 0) { + debug.warn(medebug,parent.nowplayingindex,"Track giving up on bloody musicbrainz"); + trackmeta.discogs.tracklink = null; + } else { + tracktimer = setTimeout(self.track.populate, 2000); + return; + } + } + if (trackmeta.discogs.tracklink === null) { + debug.mark(medebug,parent.nowplayingindex,"No track link found by musicbrainz"); + } else { + var b = trackmeta.discogs.tracklink.match(/releases*\/(\d+)/); + if (b && b[1]) { + debug.mark(medebug,parent.nowplayingindex,"Track Link is useful - Track is populating",b[1]); + discogs.track.getInfo( + b[1], + 'releases/'+b[1], + self.track.trackResponseHandler, + self.track.trackResponseErrorHandler + ); + return; + } + var b = trackmeta.discogs.tracklink.match(/masters*\/(\d+)/); + if (b && b[1]) { + debug.mark(medebug,parent.nowplayingindex,"Track Link is useful - Track is populating",b[1]); + discogs.track.getInfo( + b[1], + 'masters/'+b[1], + self.track.trackResponseHandler, + self.track.trackResponseErrorHandler + ); + return; + } + } + if (trackmeta.discogs.triedsearch && trackmeta.discogs.triedmunge) { + self.track.abjectFailure(); + } else { + self.track.search(trackmeta.discogs.triedsearch ? mungeArtist(artistmeta.name) : artistmeta.name); + } + } else { + debug.mark(medebug,parent.nowplayingindex,"Track is already populated, probably"); + self.artist.populate(); + } + }, + + search: function(artist) { + debug.log(medebug,'Searching for track',artist,trackmeta.name); + discogs.track.search(artist, trackmeta.name, self.track.searchResponse, self.track.abjectFailure); + }, + + searchResponse: function(data) { + debug.log(medebug, 'Got track search results', data); + if (trackmeta.discogs.triedsearch) { + trackmeta.discogs.triedmunge = true; + } else { + trackmeta.discogs.triedsearch = true; + } + if (data.data.results && data.data.results.length > 0) { + var best = 0; + find_best: { + for (var i in data.data.results) { + if (trackmeta.discogs.triedmunge) { + var amatch = mungeArtist(artistmeta.name) + } else { + var amatch = artistmeta.name.toLowerCase(); + } + if (data.data.results[i].format && data.data.results[i].resource_url && data.data.results[i].title.toLowerCase() == amatch+' - '+trackmeta.name.toLowerCase()) { + debug.log(medebug,'Found Artist - Title match'); + for (var j in data.data.results[i].format) { + if (data.data.results[i].format[j] == 'Single') { + best = i; + break find_best; + } + } + } + } + } + trackmeta.discogs.tracklink = data.data.results[best].resource_url; + debug.log(medebug,'Using track search result', best, trackmeta.discogs.tracklink); + } + self.track.populate(); + }, + + trackResponseHandler: function(data) { + debug.mark(medebug,parent.nowplayingindex,"Got track data",data); + if (data.data.master_id) { + // If this key exists, then we have retrieved a release page - this data is useful but we also + // want the master release info. (Links that come to us from musicbrainz could be either master or release). + // We will only display when we have the master info. Since we can't go back from master to release + // then if we got a master link from musicbrainz that's all we're ever going to get. + trackmeta.discogs.track.release = data; + discogs.track.getInfo( + '', + 'masters/'+data.data.master_id, + self.track.trackResponseHandler, + self.track.trackResponseErrorHandler + ); + } else { + trackmeta.discogs.track.master = data; + if (artistmeta.discogs.artisturi === undefined) { + if (data.data.artists) { + for (var i in data.data.artists) { + if (compareArtists(data.data.artists[i].name, getSearchArtist())) { + debug.log(medebug,'Using artist link from found track',data.data.artists[i].resource_url); + artistmeta.discogs.artisturi = data.data.artists[i].resource_url; + } + } + } + } + self.artist.populate(); + self.track.doBrowserUpdate(); + } + }, + + trackResponseErrorHandler: function(data) { + debug.fail(medebug,"Got error in track request",data); + trackmeta.discogs.track.error = data; + self.track.doBrowserUpdate(); + }, + + abjectFailure: function() { + debug.fail(medebug,"Completely failed to find the track"); + trackmeta.discogs.track.error = {error: language.gettext("discogs_notrack")}; + self.track.doBrowserUpdate(); + self.artist.populate(); + }, + + doBrowserUpdate: function() { + if (displaying && trackmeta.discogs.track !== undefined && + (trackmeta.discogs.track.error !== undefined || + trackmeta.discogs.track.master !== undefined)) { + debug.mark(medebug,parent.nowplayingindex,"track was asked to display"); + browser.Update( + null, + 'track', + me, + parent.nowplayingindex, + { + name: trackmeta.name, + link: (trackmeta.discogs.track.master === undefined) ? null : trackmeta.discogs.track.master.data.uri, + data: getAlbumHTML(trackmeta.discogs.track, ['master', 'release']) + } + ); + } + }, + } + }(); + } + } +}(); + +nowplaying.registerPlugin("discogs", info_discogs, "icon-discogs", "button_discogs"); diff --git a/www/rompr/browser/plugins/06_info_lyrics.js b/www/rompr/browser/plugins/06_info_lyrics.js new file mode 100644 index 0000000..9043493 --- /dev/null +++ b/www/rompr/browser/plugins/06_info_lyrics.js @@ -0,0 +1,97 @@ +var info_lyrics = function() { + + var me = "lyrics"; + + return { + getRequirements: function(parent) { + return ['file']; + }, + + collection: function(parent, artistmeta, albummeta, trackmeta) { + + debug.trace("LYRICS PLUGIN", "Creating data collection"); + + var self = this; + var displaying = false; + + function formatLyrics(data) { + debug.trace("LYRICS PLUGIN","Formatting Lyrics"); + if (data) { + data = data.replace(/^(\w)/, '$1') + data = data.replace(/\n/g, '
      '); + } + return '

      '+language.gettext("lyrics_lyrics")+'

      '+data+'

      '; + } + + function getSearchArtist() { + return (albummeta.artist && albummeta.artist != "") ? albummeta.artist : parent.playlistinfo.trackartist; + } + + this.displayData = function() { + displaying = true; + browser.Update(null, 'album', me, parent.nowplayingindex, { name: "", + link: "", + data: null + } + ); + browser.Update(null, 'artist', me, parent.nowplayingindex, { name: "", + link: "", + data: null + } + ); + self.doBrowserUpdate(); + } + + this.stopDisplaying = function() { + displaying = false; + } + + this.startAfterSpecial = function() { + + } + + this.tryReadingTags = function() { + if (prefs.music_directory_albumart == "") { + trackmeta.lyrics = '

      '+language.gettext("lyrics_nonefound")+'

      '+language.gettext("lyrics_nopath")+'

      '; + self.doBrowserUpdate(); + } else { + $.post("browser/backends/getLyrics.php", {file: player.status.file, artist: getSearchArtist(), song: trackmeta.name}) + .done(function(data) { + debug.trace("LYRICS",data); + trackmeta.lyrics = data; + self.doBrowserUpdate(); + }); + } + } + + this.populate = function() { + if (trackmeta.lyrics === undefined) { + debug.trace("LYRICS PLUGIN",parent.nowplayingindex,"No lyrics yet, trying again in 1 second"); + setTimeout(self.populate, 1000); + return; + } + if (trackmeta.lyrics === null) { + self.tryReadingTags(); + } else { + self.doBrowserUpdate(); + } + + } + + this.doBrowserUpdate = function() { + if (displaying && trackmeta.lyrics !== undefined && trackmeta.lyrics !== null) { + browser.Update(null, 'track', me, parent.nowplayingindex, { name: trackmeta.name, + link: "", + data: formatLyrics(trackmeta.lyrics) + } + ); + } + } + } + + } + + +}(); + +nowplaying.registerPlugin("lyrics", info_lyrics, "icon-doc-text-1", "button_lyrics"); diff --git a/www/rompr/browser/plugins/07_info_soundcloud.js b/www/rompr/browser/plugins/07_info_soundcloud.js new file mode 100644 index 0000000..dc68cd1 --- /dev/null +++ b/www/rompr/browser/plugins/07_info_soundcloud.js @@ -0,0 +1,297 @@ +var info_soundcloud = function() { + + var me = "soundcloud"; + var tempcanvas = document.createElement('canvas'); + var scImg = new Image(); + + function getTrackHTML(data) { + + debug.trace("SOUNDCLOUD PLUGIN","Creating track HTML from",data); + var html = '
      '; + html += '
      '; + + if (data.artwork_url) { + html += ''; + } + html += '
      • '+language.gettext("soundcloud_trackinfo")+':

      • '; + html += '
      • '+language.gettext("soundcloud_plays")+': '+formatSCMessyBits(data.playback_count)+'
      • '; + html += '
      • '+language.gettext("soundcloud_downloads")+': '+formatSCMessyBits(data.download_count)+'
      • '; + html += '
      • '+language.gettext("soundcloud_faves")+': '+formatSCMessyBits(data.favoritings_count)+'
      • '; + html += '
      • '+language.gettext("soundcloud_state")+' '+formatSCMessyBits(data.state)+'
      • '; + html += '
      • '+language.gettext("info_genre")+' '+formatSCMessyBits(data.genre)+'
      • '; + html += '
      • '+language.gettext("info_label")+' '+formatSCMessyBits(data.label_name)+'
      • '; + html += '
      • '+language.gettext("soundcloud_license")+': '+formatSCMessyBits(data.license)+'
      • '; + if (data.purchase_url) { + html += '
      • '+language.gettext("soundcloud_buy")+'
      • '; + } + html += '
      • '+language.gettext("soundcloud_view")+'
      • '; + html += '
      '; + html += '
      '; + + html += '
      '; + html += '
      '+ + '
      '+ + ''+ + '
      '; + var d = formatSCMessyBits(data.description); + d = d.replace(/\n/g, "

      "); + html += '

      '+d+'

      '; + html += '
      '; + html += '
      '; + return html; + + } + + function getArtistHTML(data) { + debug.trace("SOUNDCLOUD PLUGIN","Creating artist HTML from",data); + var html = '
      '; + html += '
      '; + + if (data.avatar_url) { + html += ''; + } + html += '
      • '+language.gettext("soundcloud_user")+':

      • '; + html += '
      • '+language.gettext("soundcloud_fullname")+': '+formatSCMessyBits(data.full_name)+'
      • '; + html += '
      • '+language.gettext("soundcloud_Country")+': '+formatSCMessyBits(data.country)+'
      • '; + html += '
      • '+language.gettext("soundcloud_city")+': '+formatSCMessyBits(data.city)+'
      • '; + if (data.website) { + html += '
      • '+language.gettext("soundcloud_website")+'
      • '; + } + html += '
      '; + html += '
      '; + html += '
      '; + var f = formatSCMessyBits(data.description) + f = f.replace(/\n/g, "

      "); + html += '

      '+ f +'

      '; + html += '
      '; + html += '
      '; + return html; + } + + function formatSCMessyBits(bits) { + try { + if (bits) { + return bits.fixDodgyLinks(); + } else { + return ""; + } + } catch(err) { + return ""; + } + } + + return { + getRequirements: function(parent) { + return []; + }, + + collection: function(parent, artistmeta, albummeta, trackmeta) { + debug.log("SOUNDCLOUD PLUGIN", "Creating data collection"); + + var self = this; + var wi = 0; + var displaying = false; + + this.populate = function() { + self.track.populate(); + } + + this.displayData = function(waitingon) { + displaying = true; + self.artist.doBrowserUpdate(); + self.album.doBrowserUpdate(); + self.track.doBrowserUpdate(); + } + + this.stopDisplaying = function(waitingon) { + displaying = false; + } + + this.progressUpdate = function(percent) { + self.track.updateProgress(percent); + } + + this.artist = function() { + + return { + + populate: function() { + if (trackmeta.soundcloud.track.error) { + browser.Update(null, 'artist', me, parent.nowplayingindex, { name: "", + link: "", + data: null + } + ); + } else { + if (artistmeta.soundcloud.artist === undefined) { + debug.log("SOUNDCLOUD PLUGIN","Artist is populating"); + soundcloud.getUserInfo(artistmeta.soundcloud.id, self.artist.scResponseHandler); + } + } + }, + + scResponseHandler: function(data) { + artistmeta.soundcloud.artist = data; + self.artist.doBrowserUpdate(); + }, + + doBrowserUpdate: function() { + if (displaying && trackmeta.soundcloud.track !== undefined) { + if (trackmeta.soundcloud.track.error) { + browser.Update(null, 'artist', me, parent.nowplayingindex, { name: "", + link: "", + data: null + } + ); + } else if (artistmeta.soundcloud !== undefined && + artistmeta.soundcloud.artist !== undefined) { + if (artistmeta.soundcloud.artist.error) { + browser.Update(null, 'artist', me, parent.nowplayingindex, {name: artistmeta.name, + link: "", + data: '

      '+artistmeta.soundcloud.artist.error+'

      ' + } + ); + } else { + var accepted = browser.Update(null, 'artist', me, parent.nowplayingindex, { name: artistmeta.soundcloud.artist.username, + link: artistmeta.soundcloud.artist.permalink_url, + data: getArtistHTML(artistmeta.soundcloud.artist) + } + ); + } + } + } + + } + } + }(); + + this.album = function() { + + return { + + doBrowserUpdate: function() { + if (displaying) { + browser.Update(null, 'album', me, parent.nowplayingindex, { name: "", + link: "", + data: null + } + ); + } + } + } + }(); + + // I do not have a pet alligator + + this.track = function() { + + return { + + populate: function() { + if (artistmeta.soundcloud === undefined) { + artistmeta.soundcloud = {}; + } + if (trackmeta.soundcloud === undefined) { + trackmeta.soundcloud = {}; + var t = parent.playlistinfo.file; + if (t.substring(0,11) == 'soundcloud:') { + soundcloud.getTrackInfo(parent.playlistinfo.file, self.track.scResponseHandler); + } else if (t.match(/api\.soundcloud\.com\/tracks\/(\d+)\//)) { + var sc = t.match(/api\.soundcloud\.com\/tracks\/(\d+)\//); + soundcloud.getTrackInfo(sc[1], self.track.scResponseHandler); + } else if (t.match(/feeds\.soundcloud\.com\/stream\/(\d+)/)) { + var sc = t.match(/feeds\.soundcloud\.com\/stream\/(\d+)/); + soundcloud.getTrackInfo(sc[1], self.track.scResponseHandler); + } else { + trackmeta.soundcloud.track = {error: language.gettext("soundcloud_not")}; + self.artist.populate(); + self.track.doBrowserUpdate(); + } + } else { + self.artist.populate(); + } + }, + + scResponseHandler: function(data) { + debug.log("SOUNDCLOUD PLUGIN","Got SoundCloud Track Data:",data); + trackmeta.soundcloud.track = data; + artistmeta.soundcloud.id = data.user_id; + self.artist.populate(); + self.track.doBrowserUpdate(); + }, + + doBrowserUpdate: function() { + if (displaying && trackmeta.soundcloud.track !== undefined) { + debug.log("SOUNDCLOUD PLUGIN","Track was asked to display"); + if (trackmeta.soundcloud.track.error) { + browser.Update(null, 'track', me, parent.nowplayingindex, { name: trackmeta.name, + link: "", + data: '

      '+trackmeta.soundcloud.track.error+'

      ' + } + ); + } else { + var accepted = browser.Update(null, 'track', me, parent.nowplayingindex, { name: trackmeta.name, + link: trackmeta.soundcloud.track.permalink_url, + data: getTrackHTML(trackmeta.soundcloud.track) + } + ); + if (accepted) { + debug.log("SOUNDCLOUD PLUGIN","Getting Track Waveform",formatSCMessyBits(trackmeta.soundcloud.track.waveform_url)); + scImg.onload = self.track.doSCImageStuff; + scImg.src = "getRemoteImage.php?url="+formatSCMessyBits(trackmeta.soundcloud.track.waveform_url); + } + } + } + }, + + doSCImageStuff: function() { + // The soundcloud waveform is a png where the waveform itself is transparent + // and has a grey-ish border. We want an image with a gradient for the waveform + // and a transparent border. + tempcanvas.width = scImg.width; + tempcanvas.height = scImg.height; + var ctx = tempcanvas.getContext("2d"); + ctx.clearRect(0,0,tempcanvas.width,tempcanvas.height); + + // Fill tempcanvas with a linear gradient + var gradient = ctx.createLinearGradient(0,0,0,tempcanvas.height); + gradient.addColorStop(0,'rgba(255,82,0,1)'); + gradient.addColorStop(0.6,'rgba(150, 48, 0, 1)'); + gradient.addColorStop(1,'rgba(100, 25, 0, 0.1)'); + ctx.fillStyle = gradient; + ctx.fillRect(0,0,tempcanvas.width,tempcanvas.height); + + // Plop the image over the top. + ctx.drawImage(scImg,0,0,tempcanvas.width,tempcanvas.height); + + // Now translate all the grey pixels into transparent ones + var pixels = ctx.getImageData(0,0,tempcanvas.width,tempcanvas.height); + var data = pixels.data; + for (var i = 0; i'+data.error+''; + } + + var h = '
      '; + h += '
      '; + h += '
        '; + h += '
      • '+language.gettext("label_pop")+': '+data.popularity+'
      • '; + if (player.canPlay('spotify')) { + h += '
      • '+ + '
      • '; + } + h += '
      '; + h += '
      '; + if (data.explicit) { + h += ''; + } + h += '
      '; + h += '
      '; + h += '
      '; + return h; + } + + function getAlbumHTML(data) { + + debug.trace(medebug,"Making Album Info From",data); + if (data.error) { + return '

      '+data.error+'

      '; + } + var html = '
      '; + html += '
      '; + html += '
        '; + html += '
      • '+language.gettext("label_pop")+': '+data.popularity+'
      • '; + html += '
      • '+language.gettext("lastfm_releasedate")+': '+data.release_date+'
      • '; + + if (player.canPlay('spotify')) { + + html += '
      • '; + + html += '
      • '; + + } + + html += '
      '; + html += '
      '; + + html += '
      '; + html += spotifyTrackListing(data)+'
      '; + html += '
      '; + if (data.images && data.images[0]) { + html += ''; + } + html += '
      '; + html += '
      '; + return html; + } + + function getArtistHTML(data, parent, artistmeta) { + + debug.trace(medebug,"Making Artist Info From",data); + if (data.error) { + return '

      '+data.error+'

      '; + } + + var h = ""; + + if (artistmeta.spotify.possibilities && artistmeta.spotify.possibilities.length > 1) { + h += '
      '+ + '
      '+ + '
      All possibilities for "'+ + artistmeta.spotify.artist.name+'"
      '+ + '
      '; + for (var i in artistmeta.spotify.possibilities) { + h += '
      '; + if (artistmeta.spotify.possibilities[i].image) { + h += ''; + } else { + h += ''; + } + h += ''+artistmeta.spotify.possibilities[i].name+''; + h += '
      '; + } + h += '
      '; + h += '
      '; + } + + h += '
      '; + h += '
      • '+language.gettext("label_pop")+ + ': '+data.popularity+'
      • '; + h += '
      • '; + if (player.canPlay('spotify')) { + h += '
      • '+ + '
      • '; + h += '
      • '+ + '
      • '; + } + h += '
      '; + if (data.images && data.images[0]) { + h += ''; + } + + h += '
      '; + h += '
      '; + h += '
      ' + + '
      ' + + '
      ' + + '
      '; + return h; + + } + + function findDisplayPanel(element) { + var c = element; + while (!c.hasClass('nobwobbler')) { + c = c.parent(); + } + if (c.hasClass('nobalbum')) { + debug.log(medebug,"Opening Album Panel Via Widget"); + $('#artistalbums').spotifyAlbumThing('handleClick', element); + return true; + } else if (c.hasClass('nobartist')) { + debug.log(medebug,"Opening Artist Panel Via Widget"); + $('#artistalbums').spotifyArtistThing('handleClick', element); + return true; + } else { + debug.error(medebug,"Click On Unknown Element!",element); + return false; + } + } + + return { + + getRequirements: function(parent) { + return ["musicbrainz"]; + }, + + collection: function(parent, artistmeta, albummeta, trackmeta) { + + debug.trace(medebug, "Creating data collection"); + + var self = this; + var displaying = false; + if (artistmeta.spotify === undefined) { + artistmeta.spotify = {}; + } + if (artistmeta.spotify.showing === undefined) { + artistmeta.spotify.showing = "albums"; + } + + this.populate = function() { + self.track.populate(); + } + + this.displayData = function() { + displaying = true; + self.artist.doBrowserUpdate(); + self.album.doBrowserUpdate(); + self.track.doBrowserUpdate(); + } + + this.stopDisplaying = function() { + displaying = false; + } + + this.handleClick = function(source, element, event) { + debug.trace(medebug,parent.nowplayingindex,source,"is handling a click event"); + if (element.hasClass('clickzoomimage')) { + imagePopup.create(element, event, element.attr("src")); + } else if (element.hasClass('clickspotifywidget')) { + findDisplayPanel(element); + } else if (element.hasClass('clickchooseposs')) { + var poss = element.attr("name"); + if (poss != artistmeta.spotify.currentposs) { + artistmeta.spotify = { + currentposs: poss, + possibilities: artistmeta.spotify.possibilities, + id: artistmeta.spotify.possibilities[poss].id, + showing: "albums" + } + self.artist.force = true; + self.artist.populate(); + } + } else if (element.hasClass('clickshowalbums') && artistmeta.spotify.showing != "albums") { + $('#artistalbums').spotifyArtistThing('destroy'); + artistmeta.spotify.showing = "albums"; + $("#bumhole .bsel").removeClass("bsel"); + element.addClass("bsel"); + getAlbums(); + } else if (element.hasClass('clickshowartists') && artistmeta.spotify.showing != "artists") { + $('#artistalbums').spotifyAlbumThing('destroy'); + artistmeta.spotify.showing = "artists"; + $("#bumhole .bsel").removeClass("bsel"); + element.addClass("bsel"); + getArtists(); + } else if (element.hasClass('clickaddtolistenlater')) { + metaHandlers.addToListenLater(albummeta.spotify.album); + } else if (element.hasClass('clickaddtocollection')) { + metaHandlers.fromSpotifyData.addAlbumTracksToCollection(albummeta.spotify.album, artistmeta.spotify.artist.name); + } else if (element.hasClass('clickstartradio')) { + playlist.radioManager.load("artistRadio", 'spotify:artist:'+artistmeta.spotify.id); + } else if (element.hasClass('clickstartsingleradio')) { + playlist.radioManager.load("singleArtistRadio", artistmeta.name); + } else if (element.hasClass('clickstarttrackradio')) { + debug.log("SPOTIFY","Starting Track Recommendations With",trackmeta.spotify.id); + playlist.radioManager.load("spotiTrackRadio", {seed_tracks: trackmeta.spotify.id, name: trackmeta.spotify.track.name}); + } else if (element.hasClass('clickstartartistradio')) { + debug.log("SPOTIFY","Starting Artist Recommendations With",artistmeta.spotify.id); + playlist.radioManager.load("spotiTrackRadio", {seed_artists: artistmeta.spotify.id, name: artistmeta.spotify.artist.name}); + } + } + + function getAlbums() { + $("#hibbert").makeSpinner(); + if (artistmeta.spotify.albums === undefined) { + spotify.artist.getAlbums(artistmeta.spotify.id, 'album,single', storeAlbums, self.artist.spotifyError, true) + } else { + doAlbums(artistmeta.spotify.albums); + } + } + + function getArtists() { + $("#hibbert").makeSpinner() + if (artistmeta.spotify.related === undefined) { + spotify.artist.getRelatedArtists(artistmeta.spotify.id, storeArtists, self.artist.spotifyError, true) + } else { + doArtists(artistmeta.spotify.related); + } + } + + function storeAlbums(data) { + artistmeta.spotify.albums = data; + doAlbums(data); + } + + function storeArtists(data) { + artistmeta.spotify.related = data; + doArtists(data); + } + + function doAlbums(data) { + debug.trace(medebug,"DoAlbums",artistmeta.spotify.showing, displaying); + if (artistmeta.spotify.showing == "albums" && displaying && data) { + debug.trace(medebug,"Doing Albums For Artist",data); + $('#artistalbums').spotifyAlbumThing({ + classes: 'nobwobbler nobalbum tagholder2 selecotron', + itemselector: 'nobwobbler', + sub: null, + showbiogs: false, + layoutcallback: function() { $("#hibbert").stopSpinner(); browser.rePoint() }, + maxwidth: maxwidth, + is_plugin: false, + imageclass: 'masochist', + data: data.items + }); + } + } + + function doArtists(data) { + if (artistmeta.spotify.showing == "artists" && displaying && data) { + debug.trace(medebug,"Doing Related Artists",data); + $('#artistalbums').spotifyArtistThing({ + classes: 'nobwobbler nobartist tagholder2', + itemselector: 'nobwobbler', + sub: null, + layoutcallback: function() { $("#hibbert").stopSpinner(); browser.rePoint() }, + is_plugin: false, + imageclass: 'jalopy', + maxalbumwidth: maxwidth, + data: data.artists + }); + + } + } + + this.track = function() { + + function spotifyResponse(data) { + debug.trace(medebug, "Got Spotify Track Data"); + debug.trace(medebug, data); + if (trackmeta.spotify.track === undefined) { + trackmeta.spotify.track = data; + } + if (albummeta.spotify === undefined) { + albummeta.spotify = {id: data.album.id}; + } + for(var i in data.artists) { + if (data.artists[i].name == artistmeta.name) { + debug.trace(medebug,parent.nowplayingindex,"Found Spotify ID for", artistmeta.name); + artistmeta.spotify.id = data.artists[i].id; + } + } + debug.trace(medebug,"Spotify Data now looks like",artistmeta, albummeta, trackmeta); + self.track.doBrowserUpdate(); + self.artist.populate(); + } + + function gotTrackRecommendations(data) { + trackmeta.spotify.recommendations = data; + doRecommendations(data); + } + + function doRecommendations(data) { + $('#helpful_title').html('

      '+language.gettext('discover_now', [trackmeta.spotify.track.name])+'

      '); + for (var i in data.tracks) { + var x = $('
      ', {class: 'arsecandle tagholder4 clickable draggable clicktrack playable notthere', name: data.tracks[i].uri}).appendTo($('#helpful_tracks')); + var a = data.tracks[i].album; + var img = ''; + if (a.images && a.images[0]) { + img = 'getRemoteImage.php?url='+a.images[0].url + for (var j in a.images) { + if (a.images[j].width <= maxwidth) { + img = 'getRemoteImage.php?url='+a.images[j].url; + break; + } + } + img += '&rompr_resize_size=smallish'; + } else { + img = 'newimages/spotify-icon.png'; + } + x.append('
      '); + + var an = new Array(); + for (var j in data.tracks[i].artists) { + an.push(data.tracks[i].artists[j].name); + } + + x.append('
      '+concatenate_artist_names(an)+'
      '+data.tracks[i].name+'
      '); + } + $('#helpful_tracks').imagesLoaded(doBlockLayout); + + } + + function doBlockLayout() { + debug.shout(medebug,"Track Images Have Loaded"); + browser.rePoint($('#helpful_tracks'),{ itemSelector: '.arsecandle', columnWidth: '.arsecandle', percentPosition: true}); + donetheother = true; + setDraggable('#helpful_tracks'); + $('#helpful_title').find('.notthere').removeClass('notthere'); + $('#helpful_tracks').find('.notthere').removeClass('notthere'); + } + + return { + + populate: function() { + if (trackmeta.spotify === undefined || artistmeta.spotify.id === undefined) { + if (parent.playlistinfo.file.substring(0,8) !== 'spotify:') { + self.track.doBrowserUpdate() + self.artist.populate(); + self.album.populate(); + } else { + if (trackmeta.spotify === undefined) { + trackmeta.spotify = {id: parent.playlistinfo.file.substr(14, parent.playlistinfo.file.length) }; + } + spotify.track.getInfo(trackmeta.spotify.id, spotifyResponse, self.track.spotifyError, true); + } + } else { + self.artist.populate(); + } + }, + + spotifyError: function(data) { + debug.warn(medebug, "Spotify Error!", data); + data.name = parent.playlistinfo.Title; + data.external_urls = {spotify: ''}; + trackmeta.spotify.track = data; + if (albummeta.spotify === undefined) { + albummeta.spotify = {}; + } + self.track.doBrowserUpdate() + self.artist.populate(); + }, + + spotifyRecError: function(data) { + debug.warn(medebug,"Error getting track reccomendations",data); + }, + + doBrowserUpdate: function() { + var accepted = false; + if (displaying && trackmeta.spotify !== undefined && trackmeta.spotify.track !== undefined) { + debug.trace(medebug,parent.nowplayingindex,"track was asked to display"); + accepted = browser.Update( + null, + 'track', + me, + parent.nowplayingindex, + { name: trackmeta.spotify.track.name, + link: trackmeta.spotify.track.external_urls.spotify, + data: getTrackHTML(trackmeta.spotify.track) + } + ); + } else if (parent.playlistinfo.file.substring(0,8) !== 'spotify:') { + browser.Update(null, 'track', me, parent.nowplayingindex, { name: "", + link: "", + data: null + } + ); + } + if (accepted && !trackmeta.spotify.track.error) { + if (trackmeta.spotify.recommendations) { + doRecommendations(trackmeta.spotify.recommendations); + } else { + var params = { limit: 8 } + if (prefs.lastfm_country_code) { + params.market = prefs.lastfm_country_code; + } + params.seed_tracks = trackmeta.spotify.id; + spotify.recommendations.getRecommendations(params, gotTrackRecommendations, self.track.spotifyRecError); + } + } + } + } + + }(); + + this.album = function() { + + function spotifyResponse(data) { + debug.trace(medebug, "Got Spotify Album Data"); + debug.trace(medebug, data); + albummeta.spotify.album = data; + self.album.doBrowserUpdate(); + } + + return { + + populate: function() { + if (albummeta.spotify === undefined || albummeta.spotify.album === undefined ) { + if (parent.playlistinfo.file.substring(0,8) !== 'spotify:') { + self.album.doBrowserUpdate(); + } else { + spotify.album.getInfo(albummeta.spotify.id, spotifyResponse, self.album.spotifyError, true); + } + } + }, + + spotifyError: function(data) { + debug.error(medebug, "Spotify Error!"); + data.name = parent.playlistinfo.Album; + data.external_urls = {spotify: ''}; + albummeta.spotify.album = data; + self.album.doBrowserUpdate(); + }, + + doBrowserUpdate: function() { + if (displaying && albummeta.spotify !== undefined && albummeta.spotify.album !== undefined) { + debug.trace(medebug,parent.nowplayingindex,"album was asked to display"); + var accepted = browser.Update( + null, + 'album', + me, + parent.nowplayingindex, + { name: albummeta.spotify.album.name, + link: albummeta.spotify.album.external_urls.spotify, + data: getAlbumHTML(albummeta.spotify.album) + } + ); + } else if (parent.playlistinfo.file.substring(0,8) !== 'spotify:') { + browser.Update(null, 'album', me, parent.nowplayingindex, { name: "", + link: "", + data: null + } + ); + } + infobar.markCurrentTrack(); + } + + } + + }(); + + this.artist = function() { + + var triedWithoutBrackets = 0; + var retries = 10; + var searchingfor = artistmeta.name; + + function spotifyResponse(data) { + debug.trace(medebug, "Got Spotify Artist Data"); + debug.trace(medebug, data); + artistmeta.spotify.artist = data; + self.artist.doBrowserUpdate(); + self.album.populate(); + } + + function search(aname) { + if (parent.playlistinfo.type == "stream" && artistmeta.name == "" && trackmeta.name == "") { + debug.shout(medebug, "Searching Spotify for artist",albummeta.name) + spotify.artist.search(albummeta.name, searchResponse, searchFail, true); + } else { + debug.shout(medebug, "Searching Spotify for artist",aname) + spotify.artist.search(aname, searchResponse, searchFail, true); + } + } + + function searchResponse(data) { + debug.trace(medebug,"Got Spotify Search Data",data); + var match = searchingfor.toLowerCase(); + artistmeta.spotify.possibilities = new Array(); + for (var i in data.artists.items) { + if (data.artists.items[i].name.toLowerCase() == match) { + artistmeta.spotify.possibilities.push({ + name: data.artists.items[i].name, + id: data.artists.items[i].id, + image: (data.artists.items[i].images && + data.artists.items[i].images.length > 0) ? + data.artists.items[i].images[data.artists.items[i].images.length-1].url : null + }); + } + } + if (artistmeta.spotify.possibilities.length == 0 && data.artists.items.length == 1) { + // only one match returned, it wasn't an exact match, but use it anyway + artistmeta.spotify.possibilities.push({ + name: data.artists.items[0].name, + id: data.artists.items[0].id, + image: (data.artists.items[0].images && + data.artists.items[0].images.length > 0) ? + data.artists.items[0].images[data.artists.items[0].images.length-1].url : null + }); + } + if (artistmeta.spotify.possibilities.length > 0) { + artistmeta.spotify.currentposs = 0; + artistmeta.spotify.id = artistmeta.spotify.possibilities[0].id; + artistmeta.spotify.showing = "albums"; + } + if (artistmeta.spotify.id === undefined) { + searchFail(); + } else { + self.artist.populate(); + } + } + + function searchFail() { + debug.trace("SPOTIFY PLUGIN","Couldn't find anything for",artistmeta.name); + var test; + switch (triedWithoutBrackets) { + case 0: + triedWithoutBrackets = 1; + test = artistmeta.name.replace(/ \(+.+?\)+$/, ''); + if (test != artistmeta.name) { + searchingfor = test; + debug.trace("SPOTIFY PLUGIN","Searching instead for",test); + search(test); + return; + } + // Fall Through + + case 1: + triedWithoutBrackets = 2; + test = artistmeta.name.split(/ & | and /)[0]; + if (test != artistmeta.name) { + searchingfor = test; + debug.trace("SPOTIFY PLUGIN","Searching instead for",test); + search(test); + return; + } + // Fall Through + + default: + artistmeta.spotify = { artist: { error: '

      '+ + language.gettext("label_noartistinfo")+ + '

      ', + name: artistmeta.name, + external_urls: { spotify: '' } + } + }; + self.artist.doBrowserUpdate(); + break; + + } + } + + return { + + force: false, + + populate: function() { + if (artistmeta.spotify.id === undefined) { + search(artistmeta.name); + } else { + if (artistmeta.spotify.artist === undefined) { + spotify.artist.getInfo(artistmeta.spotify.id, spotifyResponse, self.artist.spotifyError, true); + } else { + self.album.populate(); + } + } + }, + + spotifyError: function(data) { + debug.error(medebug, "Spotify Error!"); + data.external_urls = {spotify: ''}; + data.name = artistmeta.name; + artistmeta.spotify.artist = data; + self.artist.doBrowserUpdate(); + self.album.populate(); + }, + + tryForAllmusicBio: function() { + if (typeof artistmeta.allmusic == 'undefined' || typeof artistmeta.allmusic.artistlink === 'undefined') { + debug.shout(medebug,"Allmusic artist link not back yet"); + retries--; + if (retries > 0) { + setTimeout(self.artist.tryForAllmusicBio, 2000); + } else { + debug.shout(medebug,"Artist giving up waiting for musicbrainz"); + } + } else if (artistmeta.allmusic.artistlink === null) { + debug.shout(medebug,"No Allmusic artist bio link found"); + } else { + debug.shout(medebug,"Getting allmusic bio from",artistmeta.allmusic.artistlink); + $.post('browser/backends/getambio.php', {url: artistmeta.allmusic.artistlink}) + .done( function(data) { + debug.log(medebug,"Got Allmusic Bio"); + if (displaying) $("#artistbio").html(data); + }) + .fail( function() { + debug.log(medebug,"Didn't Get Allmusic Bio"); + if (displaying) $("#artistbio").html(""); + }); + } + }, + + doBrowserUpdate: function() { + if (displaying && artistmeta.spotify !== undefined && artistmeta.spotify.artist !== undefined) { + debug.trace(medebug,parent.nowplayingindex,"artist was asked to display"); + var accepted = browser.Update( + null, + 'artist', + me, + parent.nowplayingindex, + { name: artistmeta.spotify.artist.name, + link: artistmeta.spotify.artist.external_urls.spotify, + data: getArtistHTML(artistmeta.spotify.artist, parent, artistmeta) + }, + false, + self.artist.force + ); + if (accepted && artistmeta.spotify.artist.error == undefined) { + debug.trace(medebug,"Update was accepted by browser"); + self.artist.tryForAllmusicBio(); + if (artistmeta.spotify.showing == "albums") { + getAlbums(); + } else { + getArtists(); + } + } + } + } + } + }(); + } + } +}(); + +nowplaying.registerPlugin("spotify", info_spotify, "icon-spotify-circled", "button_infospotify"); diff --git a/www/rompr/browser/plugins/09_info_videos.js b/www/rompr/browser/plugins/09_info_videos.js new file mode 100644 index 0000000..2db07c0 --- /dev/null +++ b/www/rompr/browser/plugins/09_info_videos.js @@ -0,0 +1,125 @@ +var info_videos = function() { + + var me = "videos"; + + return { + + getRequirements: function(parent) { + return ['discogs']; + }, + + collection: function(parent, artistmeta, albummeta, trackmeta) { + + debug.trace("VIDEOS PLUGIN", "Creating data collection"); + + var self = this; + var displaying = false; + var ids = []; + var retrytimer; + + function mungeDiscogsData(videos) { + debug.trace("VIDEOS PLUGIN","Doing Videos From Discogs Data",videos); + for (var i in videos) { + var u = videos[i].uri; + if (videos[i].embed == true && u.match(/youtube\.com/)) { + var d = u.match(/\/\/www\.youtube\.com\/watch\?v=(.+)$/); + if (d && d[1] && ids.indexOf(d[1]) == -1) { + ids.push(d[1]); + } + } + } + } + + function doVideos() { + var html = ''; + if (ids.length == 0) { + return '

      No Videos Found

      '; + } + for (var i in ids) { + html += '
      '; + } + return html; + } + + function getVideosHtml() { + if (albummeta.discogs.album.master && parent.playlistinfo.type != 'stream') { + debug.debug('VIDEOS', 'Doing videos from album master'); + mungeDiscogsData(albummeta.discogs.album.master.data.videos); + } + if (albummeta.discogs.album.release && parent.playlistinfo.type != 'stream') { + debug.debug('VIDEOS', 'Doing videos from album release'); + mungeDiscogsData(albummeta.discogs.album.release.data.videos); + } + if (trackmeta.discogs.track.master) { + debug.debug('VIDEOS', 'Doing videos from track master'); + mungeDiscogsData(trackmeta.discogs.track.master.data.videos); + } + if (trackmeta.discogs.track.release) { + debug.debug('VIDEOS', 'Doing videos from track release'); + mungeDiscogsData(trackmeta.discogs.track.release.data.videos); + } + return doVideos(); + } + + this.populate = function() { + self.track.populate(); + } + + this.displayData = function() { + displaying = true; + self.track.doBrowserUpdate(); + browser.Update(null, 'album', me, parent.nowplayingindex, { name: "", + link: "", + data: null + } + ); + browser.Update(null, 'artist', me, parent.nowplayingindex, { name: "", + link: "", + data: null + } + ); + } + + this.stopDisplaying = function() { + displaying = false; + clearTimeout(retrytimer); + } + + this.track = function() { + return { + populate: function() { + debug.trace('VIDEOS','album master', albummeta.discogs.album.master); + debug.trace('VIDEOS','track master', trackmeta.discogs.track.master); + debug.trace('VIDEOS','album error', albummeta.discogs.album.error); + debug.trace('VIDEOS','track error', trackmeta.discogs.track.error); + if ((trackmeta.discogs.track.master && albummeta.discogs.album.master) || + (trackmeta.discogs.track.master && albummeta.discogs.album.error) || + (trackmeta.discogs.track.error && albummeta.discogs.album.master) || + (trackmeta.discogs.track.error && albummeta.discogs.album.error)) { + self.track.doBrowserUpdate(); + } else { + debug.trace("VIDEOS PLUGIN",parent.nowplayingindex,"No data yet, trying again in 1 second"); + retrytimer = setTimeout(self.track.populate, 2000); + } + }, + + doBrowserUpdate: function() { + if (displaying && albummeta.discogs.album !== undefined && trackmeta.discogs.track !== undefined && + (albummeta.discogs.album.error !== undefined || albummeta.discogs.album.master !== undefined) && + (trackmeta.discogs.track.error !== undefined || trackmeta.discogs.track.master !== undefined)) { + debug.mark("VIDEOS PLUGIN",parent.nowplayingindex,"track was asked to display"); + browser.Update(null, 'track', me, parent.nowplayingindex, { name: artistmeta.name+' / '+trackmeta.name, + link: "", + data: getVideosHtml() + } + ); + } + } + } + }(); + } + } + +}(); + +nowplaying.registerPlugin("videos", info_videos, "icon-video", "button_videos"); diff --git a/www/rompr/browser/plugins/info_ratings.js b/www/rompr/browser/plugins/info_ratings.js new file mode 100644 index 0000000..4f78fbf --- /dev/null +++ b/www/rompr/browser/plugins/info_ratings.js @@ -0,0 +1,189 @@ +var info_ratings = function() { + + var me = "ratings"; + var trackFinder = new faveFinder(false); + var update_wishlist = false; + + return { + getRequirements: function(parent) { + return []; + }, + + collection: function(parent, artistmeta, albummeta, trackmeta) { + + debug.log("RATINGS PLUGIN", "Creating data collection"); + + var self = this; + var displaying = false; + var lfmupdates = null; + + function doThingsWithData() { + if (parent.isCurrentTrack() && trackmeta.usermeta) { + if (prefs.sync_lastfm_playcounts && lfmupdates !== null) { + $.each(lfmupdates, function(i, v) { + switch (i) { + case 'Playcount': + if (parseInt(trackmeta.usermeta[i]) < parseInt(v)) { + debug.log("RATINGS PLUGIN","Update :",i,"is now",v); + trackmeta.usermeta[i] = v; + } else { + debug.log("RATINGS PLUGIN","Not using update for",i,"as",v,"is less than",trackmeta.usermeta[i]); + } + break; + } + }); + } + var playtext = ''; + if (trackmeta.usermeta.Playcount && trackmeta.usermeta.Playcount > 0) { + playtext = 'PLAYS  '+trackmeta.usermeta.Playcount+''; + if (uiHelper.showTagButton()) { + $("#playcount").html(playtext); + } + if (typeof charts != 'undefined') { + charts.reloadAll(); + } + if (typeof recentlyPlayed != 'undefined') { + recentlyPlayed.reloadAll(); + } + } else { + $("#playcount").empty(); + } + displayRating("#ratingimage", trackmeta.usermeta.Rating); + if (uiHelper.showTagButton()) { + $("#dbtags").html(''+language.gettext("musicbrainz_tags")+ + ''); + } else { + $('#dbtags').html(playtext); + if (trackmeta.usermeta.Tags.length > 0) { + debug.log('INFOBAR', 'Tags are',trackmeta.usermeta.Tags.length); + $('#dbtags').append(''+language.gettext("musicbrainz_tags")+'  '); + } + } + for(var i = 0; i < trackmeta.usermeta.Tags.length; i++) { + $("#dbtags").append(''+trackmeta.usermeta.Tags[i]+ + ' '); + } + layoutProcessor.adjustLayout(); + } + // Make sure the browser updates the file info display + browser.reDo(parent.nowplayingindex, 'file'); + } + + function hideTheInputs() { + if (parent.isCurrentTrack()) { + displayRating("#ratingimage", false); + $("#dbtags").html(''); + $("#playcount").html(''); + } + } + + function setSuccess(rdata) { + debug.log("RATING PLUGIN","Success"); + if (rdata) { + trackmeta.usermeta = rdata.metadata; + doThingsWithData(); + collectionHelper.updateCollectionDisplay(rdata); + } + } + + function findSuccess(rdata) { + debug.log("RATING PLUGIN","Success"); + if (rdata) { + trackmeta.usermeta = rdata.metadata; + doThingsWithData(); + collectionHelper.updateCollectionDisplay(rdata); + if (!rdata.hasOwnProperty('addedtracks')) { + infobar.error(language.gettext('error_trackexists')); + } + } + if (update_wishlist && typeof(wishlistViewer) != 'undefined') { + wishlistViewer.update(); + } + update_wishlist = false; + } + + function setFail(rdata) { + debug.warn("RATING PLUGIN","Failure"); + // infobar.error("Failed! Have you read the Wiki?"); + doThingsWithData(); + } + + this.displayData = function() { + debug.error("RATINGS PLUGIN", "Was asked to display data!"); + } + + this.stopDisplaying = function() { + } + + this.updateMeta = function(updates) { + lfmupdates = updates; + doThingsWithData(); + } + + this.refresh = function() { + trackmeta.usermeta = undefined; + self.populate(); + } + + this.populate = function() { + if (trackmeta.usermeta === undefined) { + metaHandlers.fromPlaylistInfo.getMeta( + parent.playlistinfo, + function(data) { + trackmeta.usermeta = data; + doThingsWithData(); + }, + function(data) { + trackmeta.usermeta = null; + hideTheInputs(); + } + ); + } else { + debug.mark("RATINGS PLUGIN",parent.nowplayingindex,"is already populated"); + doThingsWithData(); + } + } + + this.setMeta = function(action, type, value) { + debug.log("RATINGS PLUGIN",parent.nowplayingindex,"Doing",action,type,value); + if (parent.playlistinfo.type == 'stream') { + infobar.notify(language.gettext('label_searching')); + trackFinder.findThisOne(metaHandlers.fromPlaylistInfo.mapData(parent.playlistinfo, action, [{attribute: type, value: value}]), + self.updateDatabase + ); + } else { + metaHandlers.fromPlaylistInfo.setMeta(parent.playlistinfo, action, [{attribute: type, value: value}], setSuccess, setFail); + } + } + + this.setAlbumMBID = function(mbid) { + debug.log("RATINGS PLUGIN",parent.nowplayingindex," Updating backend album MBID"); + metaHandlers.fromPlaylistInfo.setMeta(parent.playlistinfo, 'setalbummbid', mbid, false, false); + } + + this.getMeta = function(meta) { + if (trackmeta.usermeta) { + if (trackmeta.usermeta[meta]) { + return trackmeta.usermeta[meta]; + } else { + return 0; + } + } else { + return 0; + } + } + + this.updateDatabase = function(data) { + debug.log("RATINGS","Update Database Function Called",data); + if (!data.uri) { + infobar.notify(language.gettext("label_addtow")); + update_wishlist = true; + } + dbQueue.request([data], findSuccess, setFail); + } + } + } +}(); + +nowplaying.registerPlugin("ratings", info_ratings, null, null); diff --git a/www/rompr/checkwindowsize.php b/www/rompr/checkwindowsize.php new file mode 100644 index 0000000..60ac1a9 --- /dev/null +++ b/www/rompr/checkwindowsize.php @@ -0,0 +1,26 @@ + + + +RompЯ + + + + + + + + + + diff --git a/www/rompr/collection/collection.php b/www/rompr/collection/collection.php new file mode 100644 index 0000000..9cf969d --- /dev/null +++ b/www/rompr/collection/collection.php @@ -0,0 +1,362 @@ + null, 'rating' => null ); +$trackbytrack = false; + +define('ROMPR_MIN_TRACKS_TO_DETERMINE_COMPILATION', 3); +define('ROMPR_MIN_NOT_COMPILATION_THRESHOLD', 0.6); + +class musicCollection { + + public function __construct() { + $this->albums = array(); + $this->filter_duplicates = false; + } + + public function newTrack(&$filedata) { + + global $trackbytrack, $doing_search; + + if ($doing_search) { + // If we're doing a search, we check to see if that track is in the database + // because the user might have set the AlbumArtist to something different + $filedata = array_replace($filedata, get_extra_track_info($filedata)); + } + + $track = new track($filedata); + if ($trackbytrack && $filedata['AlbumArtist'] && $filedata['Disc'] !== null) { + do_track_by_track( $track ); + } else { + $albumkey = md5($track->tags['folder'].strtolower($track->tags['Album']).strtolower($track->get_sort_artist(true))); + if (array_key_exists($albumkey, $this->albums)) { + if (!$this->filter_duplicates || !$this->albums[$albumkey]->checkForDuplicate($track)) { + $this->albums[$albumkey]->newTrack($track); + } + } else { + $this->albums[$albumkey] = new album($track); + } + } + + } + + public function getAllTracks($cmd) { + $tracks = array(); + foreach($this->albums as $album) { + $tracks = array_merge($album->getAllTracks($cmd), $tracks); + } + return $tracks; + } + + public function tracks_to_database() { + // Fluch the previous albumobj from track_by_track + do_track_by_track(null); + foreach ($this->albums as $album) { + $album->sortTracks(); + $album->check_database(); + } + $this->albums = array(); + } + + public function get_albumartist_by_folder($f) { + foreach ($this->albums as $album) { + if ($album->folder == $f) { + logger::trace("COLLECTION", " Found albumartist by folder",$album->artist); + return $album->artist; + } + } + return null; + } + + public function filter_duplicate_tracks() { + $this->filter_duplicates = true; + } + + public function tracks_as_array() { + $results = array(); + foreach($this->albums as $album) { + logger::log("COLLECTION", "Doing Album",$album->name); + $album->sortTracks(); + foreach($album->tracks as $trackobj) { + $track = array( + "uri" => $trackobj->tags['file'], + "album" => $album->name, + "title" => $trackobj->tags['Title'], + "artist" => $trackobj->get_artist_string(), + "albumartist" => $album->artist, + "trackno" => $trackobj->tags['Track'], + "disc" => $trackobj->tags['Disc'], + "albumuri" => $album->uri, + "image" => $album->getImage('asdownloaded'), + "duration" => $trackobj->tags['Time'], + "date" => $album->datestamp + ); + logger::log("COLLECTION", "Title - ".$trackobj->tags['Title']); + // A lot of code that depends on this was written to handle mopidy model search results. + // The above is not mopidy model, so friggicate it into just such a thing + $d = getDomain($track['uri']); + if (!array_key_exists($d, $results)) { + logger::log("COLLECTION", "Creating Results Set For ".$d); + $results[$d] = array( + "tracks" => array(), + "uri" => $d.':bodgehack' + ); + } + array_push($results[$d]['tracks'], $track); + } + } + return $results; + } + +} + +class album { + + public function __construct(&$track) { + global $numalbums; + $numalbums++; + $this->tracks = array($track); + // Sets album artist to composer (if set and required) or albumartist but NOT trackartist + // therefore may still be null at this point. + $this->artist = $track->get_sort_artist(true); + $this->name = trim($track->tags['Album']); + $this->folder = $track->tags['folder']; + $this->musicbrainz_albumid = $track->tags['MUSICBRAINZ_ALBUMID']; + $this->datestamp = $track->tags['Date']; + $this->uri = $track->tags['X-AlbumUri']; + $this->numOfDiscs = $track->tags['Disc']; + $this->image = $track->tags['X-AlbumImage']; + $this->key = $track->tags['ImgKey']; + $this->numOfDiscs = $track->tags['Disc']; + $this->numOfTrackOnes = $track->tags['Track'] == 1 ? 1 : 0; + $this->domain = $track->tags['domain']; + $this->albumartistindex = null; + $this->albumindex = null; + } + + public function newTrack(&$track) { + $this->tracks[] = $track; + if ($this->artist == null) { + $this->artist = $track->get_sort_artist(true); + } + if ($this->image == null) { + $this->image = $track->tags['X-AlbumImage']; + } + if ($this->datestamp == null) { + $this->datestamp = $track->tags['Date']; + } + if ($this->musicbrainz_albumid == '') { + $this->musicbrainz_albumid = $track->tags['MUSICBRAINZ_ALBUMID']; + } + if ($track->tags['Disc'] !== null && $this->numOfDiscs < $track->tags['Disc']) { + $this->numOfDiscs = $track->tags['Disc']; + } + if ($track->tags['Track'] == 1) { + $this->numOfTrackOnes++; + } + if ($this->uri == null) { + $this->uri = $track->tags['X-AlbumUri']; + } + } + + public function check_database() { + if ($this->albumartistindex == null) { + $this->albumartistindex = check_artist($this->artist); + } + if ($this->albumindex == null) { + $album = array( + 'album' => $this->name, + 'albumai' => $this->albumartistindex, + 'albumuri' => $this->uri, + 'image' => $this->getImage('small'), + 'date' => $this->getDate(), + 'searched' => "0", + 'imagekey' => $this->getKey(), + 'ambid' => $this->musicbrainz_albumid, + 'domain' => $this->domain + ); + $this->albumindex = check_album($album); + } + foreach ($this->tracks as $trackobj) { + check_and_update_track($trackobj, $this->albumindex, $this->albumartistindex, $this->artist); + } + } + + public function getKey() { + return $this->key; + } + + public function getImage($size) { + $albumimage = new baseAlbumImage(array( + 'baseimage' => ($this->image) ? $this->image : '', + 'artist' => artist_for_image($this->tracks[0]->tags['type'], $this->artist), + 'album' => $this->name + )); + $albumimage->check_image($this->domain, $this->tracks[0]->tags['type']); + $images = $albumimage->get_images(); + $this->key = $albumimage->get_image_key(); + return $images[$size]; + } + + public function trackCount() { + return count($this->tracks); + } + + public function getDate() { + return getYear($this->datestamp); + } + + public function getAllTracks($cmd) { + $tracks = array(); + foreach ($this->tracks as $track) { + if (preg_match('/:track:/', $track->tags['file'])) { + $tracks[] = $cmd.' "'.format_for_mpd($track->tags['file']).'"'; + } + } + return $tracks; + } + + public function sortTracks($always = false) { + + // NB. BLOODY WELL CALL THIS FUNCTION + // Unless you're so sure you know how all this works and you really don't need it. + // Collection updates might be one such area but if you're not sure CALL IT ANYWAY and see what happens. + + // Some Mopidy backends don't send disc numbers. If we're using the sql backend + // we don't really need to pre-sort tracks because we can do it on the fly. + // However, when there are no disc numbers multi-disc albums don't sort properly. + // Hence we do a little check that we have have the same number of 'Track 1's + // as discs and only do the sort if they're not the same. This'll also + // sort out badly tagged local files. It's essential that disc numbers are set + // because the database will not find the tracks otherwise. + + // Also here, because ths gets called always, we try to set our albumartist + // to something sensible. So far it has been set to Composer tags if required by the + // user, or to the AlbumArtist setting, which will be null if no AlbumArtist tag is present - + // as is the case with many mopidy backends + + if ($this->artist == null) { + logger::mark("COLLECTION", "Finding AlbumArtist for album ".$this->name); + if (count($this->tracks) < ROMPR_MIN_TRACKS_TO_DETERMINE_COMPILATION) { + logger::log("COLLECTION", " Album ".$this->name." has too few tracks to determine album artist"); + $this->decideOnArtist($this->tracks[0]->get_sort_artist()); + } else { + $artists = array(); + foreach ($this->tracks as $track) { + $a = $track->get_sort_artist(); + if (!array_key_exists($a, $artists)) { + $artists[$a] = 0; + } + $artists[$a]++; + } + $q = array_flip($artists); + rsort($q); + $candidate_artist = $q[0]; + $fraction = $artists[$candidate_artist]/count($this->tracks); + logger::log("COLLECTION", " Artist ".$candidate_artist." has ".$artists[$candidate_artist]." tracks out of ".count($this->tracks)); + if ($fraction > ROMPR_MIN_NOT_COMPILATION_THRESHOLD) { + logger::log("COLLECTION", " ... which is good enough. Album ".$this->name." is by ".$candidate_artist); + $this->artist = $candidate_artist; + } else { + logger::log("COLLECTION", " ... which is not enough"); + $this->decideOnArtist("Various Artists"); + } + } + } + + foreach ($this->tracks as $track) { + $track->tags['AlbumArtist'] = $this->artist; + } + + if ($always == false && $this->numOfDiscs > 0 && ($this->numOfTrackOnes <= 1 || $this->numOfTrackOnes == $this->numOfDiscs)) { + return $this->numOfDiscs; + } + + $discs = array(); + $number = 1; + foreach ($this->tracks as $ob) { + if ($ob->tags['Track'] !== '') { + $track_no = intval($ob->tags['Track']); + } else { + $track_no = $number; + } + # Just in case we have a multiple disc album with no disc number tags + $discno = intval($ob->tags['Disc']); + if ($discno == '' || $discno == null || $discno == 0) { + $discno = 1; + } + if (!array_key_exists($discno, $discs)) { + $discs[$discno] = array(); + } + while(array_key_exists($track_no, $discs[$discno])) { + $discno++; + if (!array_key_exists($discno, $discs)) { + $discs[$discno] = array(); + } + } + $discs[$discno][$track_no] = $ob; + $ob->updateTrackInfo(array('Disc' => $discno)); + $number++; + } + $numdiscs = count($discs); + + $this->tracks = array(); + ksort($discs, SORT_NUMERIC); + foreach ($discs as $disc) { + ksort($disc, SORT_NUMERIC); + $this->tracks = array_merge($this->tracks, $disc); + } + $this->numOfDiscs = $numdiscs; + + return $numdiscs; + } + + public function checkForDuplicate($t) { + foreach ($this->tracks as $track) { + if ($t->tags['file'] == $track->tags['file']) { + logger::trace("COLLECTION", "Filtering Duplicate Track ".$t->tags['file']); + return true; + } + } + return false; + } + + private function decideOnArtist($candidate) { + if ($this->artist == null) { + logger::log("COLLECTION", " ... Setting artist to ".$candidate); + $this->artist = $candidate; + } + } + +} + +class track { + + public $tags; + + public function __construct(&$filedata) { + $this->tags = $filedata; + } + + public function updateTrackInfo($info) { + $this->tags = array_replace($this->tags, $info); + } + + public function get_artist_string() { + return format_artist($this->tags['Artist']); + } + + public function get_sort_artist($return_albumartist = false) { + return format_sortartist($this->tags, $return_albumartist); + } + +} + +?> diff --git a/www/rompr/collection/dbsearch.php b/www/rompr/collection/dbsearch.php new file mode 100644 index 0000000..e2de15c --- /dev/null +++ b/www/rompr/collection/dbsearch.php @@ -0,0 +1,156 @@ += ". + $terms['rating'].") AS rat ON rat.TTindex = t.TTindex "; + } + $qstring .= "JOIN Artisttable AS a1 ON a1.Artistindex = t.Artistindex "; + $qstring .= "JOIN Albumtable AS al ON al.Albumindex = t.Albumindex "; + $qstring .= "JOIN Artisttable AS a2 ON al.AlbumArtistindex = a2.Artistindex "; + if (array_key_exists('wishlist', $terms)) { + $qstring .= "WHERE t.Uri IS NULL"; + } else { + $qstring .= "WHERE t.Uri IS NOT NULL "; + } + $qstring .= "AND t.Hidden = 0 AND t.isSearchResult < 2 "; + + // Map search parameters to database tables + $searchmap = array( + 'artist' => 'a1.Artistname', + 'album' => 'al.Albumname', + 'title' => 't.Title', + 'file' => 't.Uri', + 'albumartist' => 'a2.Artistname' + ); + + foreach ($searchmap as $t => $d) { + if (array_key_exists($t, $terms)) { + $qstring .= 'AND ('; + $qstring .= format_for_search($terms[$t],$d, $parameters); + $qstring .= ' OR '.format_for_search2($terms[$t],$d, $parameters); + $qstring .= ') '; + } + } + + if (array_key_exists('any', $terms)) { + $qstring .= ' AND ('; + $bunga = array(); + foreach ($terms['any'] as $tim) { + $t = explode(' ',$tim); + foreach ($t as $tom) { + foreach ($searchmap AS $d) { + $bunga[] = format_for_search(array($tom), $d, $parameters); + $bunga[] = format_for_search2(array($tom), $d, $parameters); + } + } + } + $qstring .= implode(' OR ', $bunga); + $qstring .= ')'; + } + + if (array_key_exists('date', $terms)) { + $qstring .= "AND "; + $parameters[] = trim($terms['date'][0]); + $qstring .= "al.Year = ? "; + } + + if (is_array($domains)) { + $qstring .= "AND ("; + $domainterms = array(); + foreach ($domains as $dom) { + $parameters[] = trim($dom)."%"; + $domainterms[] = "t.Uri LIKE ?"; + } + $qstring .= implode(" OR ",$domainterms); + $qstring .= ")"; + } + + logger::log("DB SEARCH", "Parameters", $parameters); + + $result = sql_prepare_query(false, PDO::FETCH_OBJ, null, null, $qstring, $parameters); + $fcount = count($result); + foreach ($result as $obj) { + $filedata = array( + 'Artist' => array($obj->Artistname), + 'Album' => $obj->Albumname, + 'AlbumArtist' => array($obj->AlbumArtistName), + 'file' => $obj->Uri, + 'Title' => $obj->Title, + 'Track' => $obj->TrackNo, + 'X-AlbumImage' => $obj->Image, + 'Time' => $obj->Duration, + 'X-AlbumUri' => $obj->AlbumUri, + 'Date' => $obj->Year, + 'Last-Modified' => $obj->LastModified + ); + $filedata = array_merge(MPD_FILE_MODEL, $filedata); + logger::log("DB SEARCH", "Found :",$obj->Title,$obj->Uri); + if ($resultstype == "tree") { + $collection->newItem($filedata); + } else if ($resultstype == "RAW") { + $collection->newTrack($filedata); + } else { + generic_sql_query("UPDATE Tracktable SET isSearchResult = 1 WHERE TTindex = ".$obj->TTindex, true); + } + } + + return $fcount; + +} + +function format_for_search($terms, $s, &$parameters) { + // Make things a little more searchable + $a = array(); + foreach ($terms as $i => $term) { + $t = trim($term); + $t = preg_replace('/[\(\)\/\[\]\&\*\+\'\"\,\/]/','%',$t); + $a[] = $s.' LIKE ?'; + $parameters[] = '% '.$t. '%'; + $a[] = $s.' LIKE ?'; + $parameters[] = '%'.$t. ' %'; + } + $ret = implode(' OR ',$a); + return $ret; +} + +function format_for_search2($terms, $s, &$parameters) { + // Make things a little more searchable + $a = array(); + foreach ($terms as $i => $term) { + $t = trim($term); + $t = preg_replace('/[\(\)\/\[\]\&\*\+\'\"\,\/]/','%',$t); + $a[] = $s.' = ?'; + $parameters[] = $t; + } + $ret = implode(' OR ',$a); + return $ret; +} + +?> diff --git a/www/rompr/collection/playlistcollection.php b/www/rompr/collection/playlistcollection.php new file mode 100644 index 0000000..ec52118 --- /dev/null +++ b/www/rompr/collection/playlistcollection.php @@ -0,0 +1,199 @@ + $filedata['X-AlbumImage'], + 'artist' => artist_for_image($filedata['type'], $albumartist), + 'album' => $filedata['Album'] + )); + $albumimage->check_image($filedata['domain'], $filedata['type'], true); + + $info['Id'] = (int) $filedata['Id']; + $info['ImgKey'] = $albumimage->get_image_key(); + $info['images'] = $albumimage->get_images(); + $info['trackartist'] = $tartist; + $info['albumartist'] = $albumartist; + $info['metadata']['track']['name'] = trim($filedata['Title']); + $info['metadata']['track']['musicbrainz_id'] = trim($filedata['MUSICBRAINZ_TRACKID']); + $info['metadata']['album']['name'] = trim($filedata['Album']); + $info['metadata']['album']['artist'] = trim($albumartist); + $info['metadata']['album']['musicbrainz_id'] = trim($filedata['MUSICBRAINZ_ALBUMID']); + $info['metadata']['album']['uri'] = $filedata['X-AlbumUri']; + if ($info['X-AlbumUri'] && getDomain($filedata['X-AlbumUri']) == 'spotify') { + $info['metadata']['album']['spotify'] = array( + 'id' => substr($filedata['X-AlbumUri'], 14) + ); + } + + $this->foundartists = array(); + + // All kinds of places we get artist names from: + // Composer, Performer, Track Artist, Album Artist + // Note that we filter duplicates + // This creates the metadata array used by the info panel and nowplaying - + // Metadata such as scrobbles and ratings will still use the Album Artist + + if ($prefs['displaycomposer']) { + // The user has chosen to display Composer/Perfomer information + // Here check: + // a) There is composer/performer information AND + // bi) Specific Genre Selected, Track Has Genre, Genre Matches Specific Genre OR + // bii) No Specific Genre Selected, Track Has Genre + if (($info['Composer'] !== null || $info['Performer'] !== null) && + (($prefs['composergenre'] && $info['Genre'] && + checkComposerGenre($info['Genre'], $prefs['composergenrename'])) || + (!$prefs['composergenre'] && $info['Genre']))) + { + // Track Genre matches selected 'Sort By Composer' Genre + // Display Compoer - Performer - AlbumArtist + $this->do_composers($info); + $this->do_performers($info); + // The album artist probably won't be required in this case, but use it just in case + $this->do_albumartist($info); + // Don't do track artist as with things tagged like this this is usually rubbish + } else { + // Track Genre Does Not Match Selected 'Sort By Composer' Genre + // Or there is no composer/performer info + // Do Track Artist - Album Artist - Composer - Performer + $this->do_track_artists($info); + $this->do_albumartist($info); + $this->do_performers($info); + $this->do_composers($info); + } + if ($info['Composer'] !== null || $info['Performer'] !== null) { + $info['metadata']['iscomposer'] = 'true'; + } + } else { + // The user does not want Composer/Performer information + $this->do_track_artists($info, $albumartist); + $this->do_albumartist($info, $albumartist); + } + + if (count($info['metadata']['artists']) == 0) { + array_push($info['metadata']['artists'], array( "name" => "", "musicbrainz_id" => "")); + } + + return $info; + } + + private function do_composers(&$info) { + if ($info['Composer'] == null) { + return; + } + foreach ($info['Composer'] as $comp) { + if ($this->artist_not_found_yet($comp)) { + array_push($info['metadata']['artists'], array( "name" => trim($comp), "musicbrainz_id" => "", "type" => "composer", "ignore" => "false")); + } + } + } + + private function do_performers(&$info) { + if ($info['Performer'] == null) { + return; + } + foreach ($info['Performer'] as $comp) { + $toremove = null; + foreach($info['metadata']['artists'] as $i => $artist) { + if ($artist['type'] == "albumartist" || $artist['type'] == "artist") { + if (strtolower($artist['name'] == strtolower($comp))) { + $toremove = $i; + break; + } + } + } + if ($toremove !== null) { + array_splice($info['metadata']['artists'], $toremove, 1); + } + + if ($toremove !== null || $this->artist_not_found_yet($comp)) { + array_push($info['metadata']['artists'], array( "name" => trim($comp), "musicbrainz_id" => "", "type" => "performer", "ignore" => "false")); + } + } + } + + private function do_albumartist(&$info) { + $aartist = null; + if (!($info['type'] == "stream" && $info['albumartist'] == "Radio") && + strtolower($info['albumartist']) != "various artists" && + strtolower($info['albumartist']) != "various") + { + $aartist = $info['albumartist']; + } + if ($aartist !== null && $this->artist_not_found_yet($aartist)) { + array_push($info['metadata']['artists'], array( "name" => trim($aartist), "musicbrainz_id" => trim($info['MUSICBRAINZ_ALBUMARTISTID']), "type" => "albumartist", "ignore" => "false")); + } + } + + private function do_track_artists(&$info) { + if ($info['Artist'] == null) { + return; + } + $artists = getArray($info['Artist']); + $mbids = $info['MUSICBRAINZ_ARTISTID']; + if (count($mbids) > count($artists)) { + // More MBIDs that Artists. This might be one of those daft things where MBIDs are semicolon-separated + // but artists are comma-separated. + // You can even get artists = ['artist1, artist2', 'artist3']. Sigh. Hence the first implode. + $astring = implode(', ',$artists); + $newartists = explode(',', $astring); + if (count($newartists) == count($mbids)) { + logger::trace("Trying splitting comma-separated artist string", "GETPLAYLIST"); + // In case AlbumArtist has that format too + $this->artist_not_found_yet($astring); + $artists = $newartists; + } + } + while (count($mbids) < count($artists)) { + $mbids[] = ""; + } + $a = array(); + foreach ($artists as $i => $comp) { + if ($comp != "") { + if ($this->artist_not_found_yet($comp)) { + array_push($info['metadata']['artists'], array( "name" => trim($comp), "musicbrainz_id" => trim($mbids[$i]), "type" => "artist", "ignore" => "false")); + $a[] = $comp; + } + } + } + // This is to try and prevent repeated names - eg artists = [Pete, Dud] and albumartist = Pete & Dud or Dud & Pete + $this->artist_not_found_yet(concatenate_artist_names($a)); + $this->artist_not_found_yet(concatenate_artist_names(array_reverse($a))); + } + + private function artist_not_found_yet($a) { + $s = strtolower($a); + if (in_array($s, $this->foundartists)) { + return false; + } else { + $this->foundartists[] = $s; + return true; + } + } +} + +?> \ No newline at end of file diff --git a/www/rompr/coversizes/05-Tiny.css b/www/rompr/coversizes/05-Tiny.css new file mode 100644 index 0000000..cc837a0 --- /dev/null +++ b/www/rompr/coversizes/05-Tiny.css @@ -0,0 +1,13 @@ +.smallcover +{ + width:24px; +} + +.smallcover-svg { + height:24px; +} + +img.notexist,img.notfound { + width:24px; + height:24px; +} diff --git a/www/rompr/coversizes/10-Small.css b/www/rompr/coversizes/10-Small.css new file mode 100644 index 0000000..e4f50bd --- /dev/null +++ b/www/rompr/coversizes/10-Small.css @@ -0,0 +1,13 @@ +.smallcover +{ + width:32px; +} + +.smallcover-svg { + height:32px; +} + +img.notexist,img.notfound { + width:32px; + height:32px; +} diff --git a/www/rompr/coversizes/30-Medium.css b/www/rompr/coversizes/30-Medium.css new file mode 100644 index 0000000..e5da88a --- /dev/null +++ b/www/rompr/coversizes/30-Medium.css @@ -0,0 +1,23 @@ +.smallcover +{ + width:48px; +} + +.smallcover-svg { + height:48px; +} + +img.notexist,img.notfound { + width:48px; + height:48px; +} + +body.desktop .smallcover.svg-square.noindent +{ + width:32px; +} + +body.mobile .smallcover.svg-square.noindent +{ + width:32px; +} diff --git a/www/rompr/coversizes/40-Large.css b/www/rompr/coversizes/40-Large.css new file mode 100644 index 0000000..d0945b0 --- /dev/null +++ b/www/rompr/coversizes/40-Large.css @@ -0,0 +1,24 @@ +.smallcover +{ + width:64px; +} + +.smallcover-svg { + height:64px; +} + +img.notexist,img.notfound { + width:64px; + height:64px; +} + +body.desktop .smallcover.svg-square.noindent +{ + width:42px; + margin-right:18px; +} + +body.mobile .smallcover.svg-square.noindent +{ + width:32px; +} diff --git a/www/rompr/coversizes/50-ExtraLarge.css b/www/rompr/coversizes/50-ExtraLarge.css new file mode 100644 index 0000000..e45b340 --- /dev/null +++ b/www/rompr/coversizes/50-ExtraLarge.css @@ -0,0 +1,25 @@ +.smallcover +{ + width:82px; +} + +.smallcover-svg { + height:82px; +} + +img.notexist,img.notfound { + width:82px; + height:82px; +} + +body.desktop .smallcover.svg-square.noindent +{ + width:42px; + margin-right:28px; +} + +body.mobile .smallcover.svg-square.noindent +{ + width:32px; + margin-right:16px; +} diff --git a/www/rompr/coversizes/60-Super.css b/www/rompr/coversizes/60-Super.css new file mode 100644 index 0000000..f0a7dca --- /dev/null +++ b/www/rompr/coversizes/60-Super.css @@ -0,0 +1,25 @@ +.smallcover +{ + width:100px; +} + +.smallcover-svg { + height:100px; +} + +img.notexist,img.notfound { + width:100px; + height:100px; +} + +body.desktop .smallcover.svg-square.noindent +{ + width:42px; + margin-right:28px; +} + +body.mobile .smallcover.svg-square.noindent +{ + width:32px; + margin-right:16px; +} diff --git a/www/rompr/css/albumart.css b/www/rompr/css/albumart.css new file mode 100644 index 0000000..2e0ee13 --- /dev/null +++ b/www/rompr/css/albumart.css @@ -0,0 +1,148 @@ +#imageeditor { + min-height:400px; + box-sizing:border-box; + position: relative; + z-index:100; +} + +#origimage { + flex-grow: 1; + flex-shrink: 0; + flex-basis: auto; + max-width:40%; + border-left: 1px solid #fe6500; + margin-right:8px; + margin-bottom:8px; + padding-right: 8px; + padding-bottom: 8px; + margin-top:8px; + transition: width 0.5s ease; +} + +#browns { + transition: opacity 0.5s ease; + opacity: 0; +} + +.albumcovers .infosection { + margin-bottom:0px; +} + +.gimage { + float:left; + padding:8px; +} + +.outer { + width:20%; +} + +.closet { + position:relative; + width:160px; + text-align:center; + overflow:visible; +} + +.covercontainer +{ + position: relative; + padding-left:4px; + padding-right:4px; + z-index:1; +} + +.covercontainer div { + z-index:1; +} + +.covercontainer.highlighted +{ + z-index:150; + box-sizing:border-box; +} + +.rightpad { + padding-right:16px; + margin-right:16px; +} + +img#browns { + max-width:100%; +} + +#searchcontent { + flex-grow: 2; + flex-shrink: 1; + flex-basis: auto; + padding:8px; +} + +.albumimg { + padding-top:8px; +} + +.albumimg img { + padding:8px; +} + +.albumimg .covercontainer img { + width: 100px; + height:auto; +} + +.albumimg .covercontainer img.notfound, .albumimg .covercontainer img.notexist { + width: 100px; + height: 100px; +} + +#brian { + padding-left:8px; + padding-right:8px; +} + +#editcontrols { + padding-top:2px; + padding-bottom:4px; +} + +#artistcoverslist { + overflow-y:auto; + height:100%; + width:20%; +} + +#coverslist { + overflow-y:auto; + height:100%; + width:80%; +} + +#progress { + font-size:12pt; +} + +.artistrow { + padding-top:2px; + padding-bottom:2px; +} + +.albumsection { + padding-top:4px; + padding-bottom:4px; + display:table; + width:100%; + margin-left:4px; +} + +.albumsection .tleft h2 { + margin:8px; +} + +.albumsection .tleft button { + margin-top:8px; +} + +#morebutton { + text-align:center; +} diff --git a/www/rompr/css/jquery.mCustomScrollbar.css b/www/rompr/css/jquery.mCustomScrollbar.css new file mode 100755 index 0000000..ba3db39 --- /dev/null +++ b/www/rompr/css/jquery.mCustomScrollbar.css @@ -0,0 +1,1277 @@ +/* +== malihu jquery custom scrollbar plugin == +Plugin URI: http://manos.malihu.gr/jquery-custom-content-scroller +*/ + + + +/* +CONTENTS: + 1. BASIC STYLE - Plugin's basic/essential CSS properties (normally, should not be edited). + 2. VERTICAL SCROLLBAR - Positioning and dimensions of vertical scrollbar. + 3. HORIZONTAL SCROLLBAR - Positioning and dimensions of horizontal scrollbar. + 4. VERTICAL AND HORIZONTAL SCROLLBARS - Positioning and dimensions of 2-axis scrollbars. + 5. TRANSITIONS - CSS3 transitions for hover events, auto-expanded and auto-hidden scrollbars. + 6. SCROLLBAR COLORS, OPACITY AND BACKGROUNDS + 6.1 THEMES - Scrollbar colors, opacity, dimensions, backgrounds etc. via ready-to-use themes. +*/ + + + +/* +------------------------------------------------------------------------------------------------------------------------ +1. BASIC STYLE +------------------------------------------------------------------------------------------------------------------------ +*/ + + .mCustomScrollbar{ -ms-touch-action: pinch-zoom; touch-action: pinch-zoom; /* direct pointer events to js */ } + .mCustomScrollbar.mCS_no_scrollbar, .mCustomScrollbar.mCS_touch_action{ -ms-touch-action: auto; touch-action: auto; } + + .mCustomScrollBox{ /* contains plugin's markup */ + position: relative; + overflow: hidden; + height: 100%; + max-width: 100%; + outline: none; + direction: ltr; + } + + .mCSB_container{ /* contains the original content */ + overflow: hidden; + width: auto; + height: auto; + } + + + +/* +------------------------------------------------------------------------------------------------------------------------ +2. VERTICAL SCROLLBAR +y-axis +------------------------------------------------------------------------------------------------------------------------ +*/ + + .mCSB_inside > .mCSB_container{ margin-right: 16px; } + + .mCSB_container.mCS_no_scrollbar_y.mCS_y_hidden{ margin-right: 0; } /* non-visible scrollbar */ + + .mCS-dir-rtl > .mCSB_inside > .mCSB_container{ /* RTL direction/left-side scrollbar */ + margin-right: 0; + margin-left: 30px; + } + + .mCS-dir-rtl > .mCSB_inside > .mCSB_container.mCS_no_scrollbar_y.mCS_y_hidden{ margin-left: 0; } /* RTL direction/left-side scrollbar */ + + .mCSB_scrollTools{ /* contains scrollbar markup (draggable element, dragger rail, buttons etc.) */ + position: absolute; + width: 16px; + height: auto; + left: auto; + top: 0; + right: 0; + bottom: 0; + } + + .mCSB_outside + .mCSB_scrollTools{ right: -26px; } /* scrollbar position: outside */ + + .mCS-dir-rtl > .mCSB_inside > .mCSB_scrollTools, + .mCS-dir-rtl > .mCSB_outside + .mCSB_scrollTools{ /* RTL direction/left-side scrollbar */ + right: auto; + left: 0; + } + + .mCS-dir-rtl > .mCSB_outside + .mCSB_scrollTools{ left: -26px; } /* RTL direction/left-side scrollbar (scrollbar position: outside) */ + + .mCSB_scrollTools .mCSB_draggerContainer{ /* contains the draggable element and dragger rail markup */ + position: absolute; + top: 0; + left: 0; + bottom: 0; + right: 0; + height: auto; + } + + .mCSB_scrollTools a + .mCSB_draggerContainer{ margin: 20px 0; } + + .mCSB_scrollTools .mCSB_draggerRail{ + width: 2px; + height: 100%; + margin: 0 auto; + /* -webkit-border-radius: 16px; -moz-border-radius: 16px; */ + border-radius: 16px; + } + + .mCSB_scrollTools .mCSB_dragger{ /* the draggable element */ + cursor: pointer; + width: 100%; + height: 30px; /* minimum dragger height */ + z-index: 1; + } + + .mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar{ /* the dragger element */ + position: relative; + width: 4px; + height: 100%; + margin: 0 auto; + /* -webkit-border-radius: 16px; -moz-border-radius: 16px; */ + border-radius: 16px; + text-align: center; + } + + .mCSB_scrollTools_vertical.mCSB_scrollTools_onDrag_expand .mCSB_dragger.mCSB_dragger_onDrag_expanded .mCSB_dragger_bar, + .mCSB_scrollTools_vertical.mCSB_scrollTools_onDrag_expand .mCSB_draggerContainer:hover .mCSB_dragger .mCSB_dragger_bar{ width: 12px; /* auto-expanded scrollbar */ } + + .mCSB_scrollTools_vertical.mCSB_scrollTools_onDrag_expand .mCSB_dragger.mCSB_dragger_onDrag_expanded + .mCSB_draggerRail, + .mCSB_scrollTools_vertical.mCSB_scrollTools_onDrag_expand .mCSB_draggerContainer:hover .mCSB_draggerRail{ width: 8px; /* auto-expanded scrollbar */ } + + .mCSB_scrollTools .mCSB_buttonUp, + .mCSB_scrollTools .mCSB_buttonDown{ + display: block; + position: absolute; + height: 20px; + width: 100%; + overflow: hidden; + margin: 0 auto; + cursor: pointer; + } + + .mCSB_scrollTools .mCSB_buttonDown{ bottom: 0; } + + + +/* +------------------------------------------------------------------------------------------------------------------------ +3. HORIZONTAL SCROLLBAR +x-axis +------------------------------------------------------------------------------------------------------------------------ +*/ + + .mCSB_horizontal.mCSB_inside > .mCSB_container{ + margin-right: 0; + margin-bottom: 30px; + } + + .mCSB_horizontal.mCSB_outside > .mCSB_container{ min-height: 100%; } + + .mCSB_horizontal > .mCSB_container.mCS_no_scrollbar_x.mCS_x_hidden{ margin-bottom: 0; } /* non-visible scrollbar */ + + .mCSB_scrollTools.mCSB_scrollTools_horizontal{ + width: auto; + height: 16px; + top: auto; + right: 0; + bottom: 0; + left: 0; + } + + .mCustomScrollBox + .mCSB_scrollTools.mCSB_scrollTools_horizontal, + .mCustomScrollBox + .mCSB_scrollTools + .mCSB_scrollTools.mCSB_scrollTools_horizontal{ bottom: -26px; } /* scrollbar position: outside */ + + .mCSB_scrollTools.mCSB_scrollTools_horizontal a + .mCSB_draggerContainer{ margin: 0 20px; } + + .mCSB_scrollTools.mCSB_scrollTools_horizontal .mCSB_draggerRail{ + width: 100%; + height: 2px; + margin: 7px 0; + } + + .mCSB_scrollTools.mCSB_scrollTools_horizontal .mCSB_dragger{ + width: 30px; /* minimum dragger width */ + height: 100%; + left: 0; + } + + .mCSB_scrollTools.mCSB_scrollTools_horizontal .mCSB_dragger .mCSB_dragger_bar{ + width: 100%; + height: 4px; + margin: 6px auto; + } + + .mCSB_scrollTools_horizontal.mCSB_scrollTools_onDrag_expand .mCSB_dragger.mCSB_dragger_onDrag_expanded .mCSB_dragger_bar, + .mCSB_scrollTools_horizontal.mCSB_scrollTools_onDrag_expand .mCSB_draggerContainer:hover .mCSB_dragger .mCSB_dragger_bar{ + height: 12px; /* auto-expanded scrollbar */ + margin: 2px auto; + } + + .mCSB_scrollTools_horizontal.mCSB_scrollTools_onDrag_expand .mCSB_dragger.mCSB_dragger_onDrag_expanded + .mCSB_draggerRail, + .mCSB_scrollTools_horizontal.mCSB_scrollTools_onDrag_expand .mCSB_draggerContainer:hover .mCSB_draggerRail{ + height: 8px; /* auto-expanded scrollbar */ + margin: 4px 0; + } + + .mCSB_scrollTools.mCSB_scrollTools_horizontal .mCSB_buttonLeft, + .mCSB_scrollTools.mCSB_scrollTools_horizontal .mCSB_buttonRight{ + display: block; + position: absolute; + width: 20px; + height: 100%; + overflow: hidden; + margin: 0 auto; + cursor: pointer; + } + + .mCSB_scrollTools.mCSB_scrollTools_horizontal .mCSB_buttonLeft{ left: 0; } + + .mCSB_scrollTools.mCSB_scrollTools_horizontal .mCSB_buttonRight{ right: 0; } + + + +/* +------------------------------------------------------------------------------------------------------------------------ +4. VERTICAL AND HORIZONTAL SCROLLBARS +yx-axis +------------------------------------------------------------------------------------------------------------------------ +*/ + + .mCSB_container_wrapper{ + position: absolute; + height: auto; + width: auto; + overflow: hidden; + top: 0; + left: 0; + right: 0; + bottom: 0; + margin-right: 16px; + margin-bottom: 30px; + } + + .mCSB_container_wrapper > .mCSB_container{ + padding-right: 30px; + padding-bottom: 30px; + -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; + } + + .mCSB_vertical_horizontal > .mCSB_scrollTools.mCSB_scrollTools_vertical{ bottom: 20px; } + + .mCSB_vertical_horizontal > .mCSB_scrollTools.mCSB_scrollTools_horizontal{ right: 20px; } + + /* non-visible horizontal scrollbar */ + .mCSB_container_wrapper.mCS_no_scrollbar_x.mCS_x_hidden + .mCSB_scrollTools.mCSB_scrollTools_vertical{ bottom: 0; } + + /* non-visible vertical scrollbar/RTL direction/left-side scrollbar */ + .mCSB_container_wrapper.mCS_no_scrollbar_y.mCS_y_hidden + .mCSB_scrollTools ~ .mCSB_scrollTools.mCSB_scrollTools_horizontal, + .mCS-dir-rtl > .mCustomScrollBox.mCSB_vertical_horizontal.mCSB_inside > .mCSB_scrollTools.mCSB_scrollTools_horizontal{ right: 0; } + + /* RTL direction/left-side scrollbar */ + .mCS-dir-rtl > .mCustomScrollBox.mCSB_vertical_horizontal.mCSB_inside > .mCSB_scrollTools.mCSB_scrollTools_horizontal{ left: 20px; } + + /* non-visible scrollbar/RTL direction/left-side scrollbar */ + .mCS-dir-rtl > .mCustomScrollBox.mCSB_vertical_horizontal.mCSB_inside > .mCSB_container_wrapper.mCS_no_scrollbar_y.mCS_y_hidden + .mCSB_scrollTools ~ .mCSB_scrollTools.mCSB_scrollTools_horizontal{ left: 0; } + + .mCS-dir-rtl > .mCSB_inside > .mCSB_container_wrapper{ /* RTL direction/left-side scrollbar */ + margin-right: 0; + margin-left: 30px; + } + + .mCSB_container_wrapper.mCS_no_scrollbar_y.mCS_y_hidden > .mCSB_container{ padding-right: 0; } + + .mCSB_container_wrapper.mCS_no_scrollbar_x.mCS_x_hidden > .mCSB_container{ padding-bottom: 0; } + + .mCustomScrollBox.mCSB_vertical_horizontal.mCSB_inside > .mCSB_container_wrapper.mCS_no_scrollbar_y.mCS_y_hidden{ + margin-right: 0; /* non-visible scrollbar */ + margin-left: 0; + } + + /* non-visible horizontal scrollbar */ + .mCustomScrollBox.mCSB_vertical_horizontal.mCSB_inside > .mCSB_container_wrapper.mCS_no_scrollbar_x.mCS_x_hidden{ margin-bottom: 0; } + + + +/* +------------------------------------------------------------------------------------------------------------------------ +5. TRANSITIONS +------------------------------------------------------------------------------------------------------------------------ +*/ + + .mCSB_scrollTools, + .mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar, + .mCSB_scrollTools .mCSB_buttonUp, + .mCSB_scrollTools .mCSB_buttonDown, + .mCSB_scrollTools .mCSB_buttonLeft, + .mCSB_scrollTools .mCSB_buttonRight{ + -webkit-transition: opacity .2s ease-in-out, background-color .2s ease-in-out; + -moz-transition: opacity .2s ease-in-out, background-color .2s ease-in-out; + -o-transition: opacity .2s ease-in-out, background-color .2s ease-in-out; + transition: opacity .2s ease-in-out, background-color .2s ease-in-out; + } + + .mCSB_scrollTools_vertical.mCSB_scrollTools_onDrag_expand .mCSB_dragger_bar, /* auto-expanded scrollbar */ + .mCSB_scrollTools_vertical.mCSB_scrollTools_onDrag_expand .mCSB_draggerRail, + .mCSB_scrollTools_horizontal.mCSB_scrollTools_onDrag_expand .mCSB_dragger_bar, + .mCSB_scrollTools_horizontal.mCSB_scrollTools_onDrag_expand .mCSB_draggerRail{ + -webkit-transition: width .2s ease-out .2s, height .2s ease-out .2s, + margin-left .2s ease-out .2s, margin-right .2s ease-out .2s, + margin-top .2s ease-out .2s, margin-bottom .2s ease-out .2s, + opacity .2s ease-in-out, background-color .2s ease-in-out; + -moz-transition: width .2s ease-out .2s, height .2s ease-out .2s, + margin-left .2s ease-out .2s, margin-right .2s ease-out .2s, + margin-top .2s ease-out .2s, margin-bottom .2s ease-out .2s, + opacity .2s ease-in-out, background-color .2s ease-in-out; + -o-transition: width .2s ease-out .2s, height .2s ease-out .2s, + margin-left .2s ease-out .2s, margin-right .2s ease-out .2s, + margin-top .2s ease-out .2s, margin-bottom .2s ease-out .2s, + opacity .2s ease-in-out, background-color .2s ease-in-out; + transition: width .2s ease-out .2s, height .2s ease-out .2s, + margin-left .2s ease-out .2s, margin-right .2s ease-out .2s, + margin-top .2s ease-out .2s, margin-bottom .2s ease-out .2s, + opacity .2s ease-in-out, background-color .2s ease-in-out; + } + + + +/* +------------------------------------------------------------------------------------------------------------------------ +6. SCROLLBAR COLORS, OPACITY AND BACKGROUNDS +------------------------------------------------------------------------------------------------------------------------ +*/ + + /* + ---------------------------------------- + 6.1 THEMES + ---------------------------------------- + */ + + /* default theme ("light") */ + + .mCSB_scrollTools{ opacity: 0.75; } + + .mCS-autoHide > .mCustomScrollBox > .mCSB_scrollTools, + .mCS-autoHide > .mCustomScrollBox ~ .mCSB_scrollTools{ opacity: 0; } + + .mCustomScrollbar > .mCustomScrollBox > .mCSB_scrollTools.mCSB_scrollTools_onDrag, + .mCustomScrollbar > .mCustomScrollBox ~ .mCSB_scrollTools.mCSB_scrollTools_onDrag, + .mCustomScrollBox:hover > .mCSB_scrollTools, + .mCustomScrollBox:hover ~ .mCSB_scrollTools, + .mCS-autoHide:hover > .mCustomScrollBox > .mCSB_scrollTools, + .mCS-autoHide:hover > .mCustomScrollBox ~ .mCSB_scrollTools{ opacity: 1; } + + .mCSB_scrollTools .mCSB_draggerRail{ + background-color: #000; background-color: rgba(0,0,0,0.4); + /* filter: "alpha(opacity=40)"; -ms-filter: "alpha(opacity=40)"; */ + } + + .mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar{ + background-color: #fff; background-color: rgba(255,255,255,0.75); + /* filter: "alpha(opacity=75)"; -ms-filter: "alpha(opacity=75)"; */ + } + + .mCSB_scrollTools .mCSB_dragger:hover .mCSB_dragger_bar{ + background-color: #fff; background-color: rgba(255,255,255,0.85); + /* filter: "alpha(opacity=85)"; -ms-filter: "alpha(opacity=85)"; */ + } + .mCSB_scrollTools .mCSB_dragger:active .mCSB_dragger_bar, + .mCSB_scrollTools .mCSB_dragger.mCSB_dragger_onDrag .mCSB_dragger_bar{ + background-color: #fff; background-color: rgba(255,255,255,0.9); + /* filter: "alpha(opacity=90)"; -ms-filter: "alpha(opacity=90)"; */ + } + + .mCSB_scrollTools .mCSB_buttonUp, + .mCSB_scrollTools .mCSB_buttonDown, + .mCSB_scrollTools .mCSB_buttonLeft, + .mCSB_scrollTools .mCSB_buttonRight{ + background-image: url(mCSB_buttons.png); /* css sprites */ + background-repeat: no-repeat; + opacity: 0.4; + } + + .mCSB_scrollTools .mCSB_buttonUp{ + background-position: 0 0; + /* + sprites locations + light: 0 0, -16px 0, -32px 0, -48px 0, 0 -72px, -16px -72px, -32px -72px + dark: -80px 0, -96px 0, -112px 0, -128px 0, -80px -72px, -96px -72px, -112px -72px + */ + } + + .mCSB_scrollTools .mCSB_buttonDown{ + background-position: 0 -20px; + /* + sprites locations + light: 0 -20px, -16px -20px, -32px -20px, -48px -20px, 0 -92px, -16px -92px, -32px -92px + dark: -80px -20px, -96px -20px, -112px -20px, -128px -20px, -80px -92px, -96px -92px, -112 -92px + */ + } + + .mCSB_scrollTools .mCSB_buttonLeft{ + background-position: 0 -40px; + /* + sprites locations + light: 0 -40px, -20px -40px, -40px -40px, -60px -40px, 0 -112px, -20px -112px, -40px -112px + dark: -80px -40px, -100px -40px, -120px -40px, -140px -40px, -80px -112px, -100px -112px, -120px -112px + */ + } + + .mCSB_scrollTools .mCSB_buttonRight{ + background-position: 0 -56px; + /* + sprites locations + light: 0 -56px, -20px -56px, -40px -56px, -60px -56px, 0 -128px, -20px -128px, -40px -128px + dark: -80px -56px, -100px -56px, -120px -56px, -140px -56px, -80px -128px, -100px -128px, -120px -128px + */ + } + + .mCSB_scrollTools .mCSB_buttonUp:hover, + .mCSB_scrollTools .mCSB_buttonDown:hover, + .mCSB_scrollTools .mCSB_buttonLeft:hover, + .mCSB_scrollTools .mCSB_buttonRight:hover{ opacity: 0.75; } + + .mCSB_scrollTools .mCSB_buttonUp:active, + .mCSB_scrollTools .mCSB_buttonDown:active, + .mCSB_scrollTools .mCSB_buttonLeft:active, + .mCSB_scrollTools .mCSB_buttonRight:active{ opacity: 0.9; } + + + /* theme: "dark" */ + + .mCS-dark.mCSB_scrollTools .mCSB_draggerRail{ background-color: #000; background-color: rgba(0,0,0,0.15); } + + .mCS-dark.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar{ background-color: #000; background-color: rgba(0,0,0,0.75); } + + .mCS-dark.mCSB_scrollTools .mCSB_dragger:hover .mCSB_dragger_bar{ background-color: rgba(0,0,0,0.85); } + + .mCS-dark.mCSB_scrollTools .mCSB_dragger:active .mCSB_dragger_bar, + .mCS-dark.mCSB_scrollTools .mCSB_dragger.mCSB_dragger_onDrag .mCSB_dragger_bar{ background-color: rgba(0,0,0,0.9); } + + .mCS-dark.mCSB_scrollTools .mCSB_buttonUp{ background-position: -80px 0; } + + .mCS-dark.mCSB_scrollTools .mCSB_buttonDown{ background-position: -80px -20px; } + + .mCS-dark.mCSB_scrollTools .mCSB_buttonLeft{ background-position: -80px -40px; } + + .mCS-dark.mCSB_scrollTools .mCSB_buttonRight{ background-position: -80px -56px; } + + /* ---------------------------------------- */ + + + + /* theme: "light-2", "dark-2" */ + + .mCS-light-2.mCSB_scrollTools .mCSB_draggerRail, + .mCS-dark-2.mCSB_scrollTools .mCSB_draggerRail{ + width: 4px; + background-color: #fff; background-color: rgba(255,255,255,0.1); + /* -webkit-border-radius: 1px; -moz-border-radius: 1px; */ + border-radius: 1px; + } + + .mCS-light-2.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar, + .mCS-dark-2.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar{ + width: 4px; + background-color: #fff; background-color: rgba(255,255,255,0.75); + /* -webkit-border-radius: 1px; -moz-border-radius: 1px; */ + border-radius: 1px; + } + + .mCS-light-2.mCSB_scrollTools_horizontal .mCSB_draggerRail, + .mCS-dark-2.mCSB_scrollTools_horizontal .mCSB_draggerRail, + .mCS-light-2.mCSB_scrollTools_horizontal .mCSB_dragger .mCSB_dragger_bar, + .mCS-dark-2.mCSB_scrollTools_horizontal .mCSB_dragger .mCSB_dragger_bar{ + width: 100%; + height: 4px; + margin: 6px auto; + } + + .mCS-light-2.mCSB_scrollTools .mCSB_dragger:hover .mCSB_dragger_bar{ background-color: #fff; background-color: rgba(255,255,255,0.85); } + + .mCS-light-2.mCSB_scrollTools .mCSB_dragger:active .mCSB_dragger_bar, + .mCS-light-2.mCSB_scrollTools .mCSB_dragger.mCSB_dragger_onDrag .mCSB_dragger_bar{ background-color: #fff; background-color: rgba(255,255,255,0.9); } + + .mCS-light-2.mCSB_scrollTools .mCSB_buttonUp{ background-position: -32px 0; } + + .mCS-light-2.mCSB_scrollTools .mCSB_buttonDown{ background-position: -32px -20px; } + + .mCS-light-2.mCSB_scrollTools .mCSB_buttonLeft{ background-position: -40px -40px; } + + .mCS-light-2.mCSB_scrollTools .mCSB_buttonRight{ background-position: -40px -56px; } + + + /* theme: "dark-2" */ + + .mCS-dark-2.mCSB_scrollTools .mCSB_draggerRail{ + background-color: #000; background-color: rgba(0,0,0,0.1); + /* -webkit-border-radius: 1px; -moz-border-radius: 1px; */ + border-radius: 1px; + } + + .mCS-dark-2.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar{ + background-color: #000; background-color: rgba(0,0,0,0.75); + /* -webkit-border-radius: 1px; -moz-border-radius: 1px; */ + border-radius: 1px; + } + + .mCS-dark-2.mCSB_scrollTools .mCSB_dragger:hover .mCSB_dragger_bar{ background-color: #000; background-color: rgba(0,0,0,0.85); } + + .mCS-dark-2.mCSB_scrollTools .mCSB_dragger:active .mCSB_dragger_bar, + .mCS-dark-2.mCSB_scrollTools .mCSB_dragger.mCSB_dragger_onDrag .mCSB_dragger_bar{ background-color: #000; background-color: rgba(0,0,0,0.9); } + + .mCS-dark-2.mCSB_scrollTools .mCSB_buttonUp{ background-position: -112px 0; } + + .mCS-dark-2.mCSB_scrollTools .mCSB_buttonDown{ background-position: -112px -20px; } + + .mCS-dark-2.mCSB_scrollTools .mCSB_buttonLeft{ background-position: -120px -40px; } + + .mCS-dark-2.mCSB_scrollTools .mCSB_buttonRight{ background-position: -120px -56px; } + + /* ---------------------------------------- */ + + + + /* theme: "light-thick", "dark-thick" */ + + .mCS-light-thick.mCSB_scrollTools .mCSB_draggerRail, + .mCS-dark-thick.mCSB_scrollTools .mCSB_draggerRail{ + width: 4px; + background-color: #fff; background-color: rgba(255,255,255,0.1); + /* -webkit-border-radius: 2px; -moz-border-radius: 2px; */ + border-radius: 2px; + } + + .mCS-light-thick.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar, + .mCS-dark-thick.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar{ + width: 6px; + background-color: #fff; background-color: rgba(255,255,255,0.75); + /* -webkit-border-radius: 2px; -moz-border-radius: 2px; */ + border-radius: 2px; + } + + .mCS-light-thick.mCSB_scrollTools_horizontal .mCSB_draggerRail, + .mCS-dark-thick.mCSB_scrollTools_horizontal .mCSB_draggerRail{ + width: 100%; + height: 4px; + margin: 6px 0; + } + + .mCS-light-thick.mCSB_scrollTools_horizontal .mCSB_dragger .mCSB_dragger_bar, + .mCS-dark-thick.mCSB_scrollTools_horizontal .mCSB_dragger .mCSB_dragger_bar{ + width: 100%; + height: 6px; + margin: 5px auto; + } + + .mCS-light-thick.mCSB_scrollTools .mCSB_dragger:hover .mCSB_dragger_bar{ background-color: #fff; background-color: rgba(255,255,255,0.85); } + + .mCS-light-thick.mCSB_scrollTools .mCSB_dragger:active .mCSB_dragger_bar, + .mCS-light-thick.mCSB_scrollTools .mCSB_dragger.mCSB_dragger_onDrag .mCSB_dragger_bar{ background-color: #fff; background-color: rgba(255,255,255,0.9); } + + .mCS-light-thick.mCSB_scrollTools .mCSB_buttonUp{ background-position: -16px 0; } + + .mCS-light-thick.mCSB_scrollTools .mCSB_buttonDown{ background-position: -16px -20px; } + + .mCS-light-thick.mCSB_scrollTools .mCSB_buttonLeft{ background-position: -20px -40px; } + + .mCS-light-thick.mCSB_scrollTools .mCSB_buttonRight{ background-position: -20px -56px; } + + + /* theme: "dark-thick" */ + + .mCS-dark-thick.mCSB_scrollTools .mCSB_draggerRail{ + background-color: #000; background-color: rgba(0,0,0,0.1); + /* -webkit-border-radius: 2px; -moz-border-radius: 2px; */ + border-radius: 2px; + } + + .mCS-dark-thick.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar{ + background-color: #000; background-color: rgba(0,0,0,0.75); + /* -webkit-border-radius: 2px; -moz-border-radius: 2px; */ + border-radius: 2px; + } + + .mCS-dark-thick.mCSB_scrollTools .mCSB_dragger:hover .mCSB_dragger_bar{ background-color: #000; background-color: rgba(0,0,0,0.85); } + + .mCS-dark-thick.mCSB_scrollTools .mCSB_dragger:active .mCSB_dragger_bar, + .mCS-dark-thick.mCSB_scrollTools .mCSB_dragger.mCSB_dragger_onDrag .mCSB_dragger_bar{ background-color: #000; background-color: rgba(0,0,0,0.9); } + + .mCS-dark-thick.mCSB_scrollTools .mCSB_buttonUp{ background-position: -96px 0; } + + .mCS-dark-thick.mCSB_scrollTools .mCSB_buttonDown{ background-position: -96px -20px; } + + .mCS-dark-thick.mCSB_scrollTools .mCSB_buttonLeft{ background-position: -100px -40px; } + + .mCS-dark-thick.mCSB_scrollTools .mCSB_buttonRight{ background-position: -100px -56px; } + + /* ---------------------------------------- */ + + + + /* theme: "light-thin", "dark-thin" */ + + .mCS-light-thin.mCSB_scrollTools .mCSB_draggerRail{ background-color: #fff; background-color: rgba(255,255,255,0.1); } + + .mCS-light-thin.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar, + .mCS-dark-thin.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar{ width: 2px; } + + .mCS-light-thin.mCSB_scrollTools_horizontal .mCSB_draggerRail, + .mCS-dark-thin.mCSB_scrollTools_horizontal .mCSB_draggerRail{ width: 100%; } + + .mCS-light-thin.mCSB_scrollTools_horizontal .mCSB_dragger .mCSB_dragger_bar, + .mCS-dark-thin.mCSB_scrollTools_horizontal .mCSB_dragger .mCSB_dragger_bar{ + width: 100%; + height: 2px; + margin: 7px auto; + } + + + /* theme "dark-thin" */ + + .mCS-dark-thin.mCSB_scrollTools .mCSB_draggerRail{ background-color: #000; background-color: rgba(0,0,0,0.15); } + + .mCS-dark-thin.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar{ background-color: #000; background-color: rgba(0,0,0,0.75); } + + .mCS-dark-thin.mCSB_scrollTools .mCSB_dragger:hover .mCSB_dragger_bar{ background-color: #000; background-color: rgba(0,0,0,0.85); } + + .mCS-dark-thin.mCSB_scrollTools .mCSB_dragger:active .mCSB_dragger_bar, + .mCS-dark-thin.mCSB_scrollTools .mCSB_dragger.mCSB_dragger_onDrag .mCSB_dragger_bar{ background-color: #000; background-color: rgba(0,0,0,0.9); } + + .mCS-dark-thin.mCSB_scrollTools .mCSB_buttonUp{ background-position: -80px 0; } + + .mCS-dark-thin.mCSB_scrollTools .mCSB_buttonDown{ background-position: -80px -20px; } + + .mCS-dark-thin.mCSB_scrollTools .mCSB_buttonLeft{ background-position: -80px -40px; } + + .mCS-dark-thin.mCSB_scrollTools .mCSB_buttonRight{ background-position: -80px -56px; } + + /* ---------------------------------------- */ + + + + /* theme "rounded", "rounded-dark", "rounded-dots", "rounded-dots-dark" */ + + .mCS-rounded.mCSB_scrollTools .mCSB_draggerRail{ background-color: #fff; background-color: rgba(255,255,255,0.15); } + + .mCS-rounded.mCSB_scrollTools .mCSB_dragger, + .mCS-rounded-dark.mCSB_scrollTools .mCSB_dragger, + .mCS-rounded-dots.mCSB_scrollTools .mCSB_dragger, + .mCS-rounded-dots-dark.mCSB_scrollTools .mCSB_dragger{ height: 14px; } + + .mCS-rounded.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar, + .mCS-rounded-dark.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar, + .mCS-rounded-dots.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar, + .mCS-rounded-dots-dark.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar{ + width: 14px; + margin: 0 1px; + } + + .mCS-rounded.mCSB_scrollTools_horizontal .mCSB_dragger, + .mCS-rounded-dark.mCSB_scrollTools_horizontal .mCSB_dragger, + .mCS-rounded-dots.mCSB_scrollTools_horizontal .mCSB_dragger, + .mCS-rounded-dots-dark.mCSB_scrollTools_horizontal .mCSB_dragger{ width: 14px; } + + .mCS-rounded.mCSB_scrollTools_horizontal .mCSB_dragger .mCSB_dragger_bar, + .mCS-rounded-dark.mCSB_scrollTools_horizontal .mCSB_dragger .mCSB_dragger_bar, + .mCS-rounded-dots.mCSB_scrollTools_horizontal .mCSB_dragger .mCSB_dragger_bar, + .mCS-rounded-dots-dark.mCSB_scrollTools_horizontal .mCSB_dragger .mCSB_dragger_bar{ + height: 14px; + margin: 1px 0; + } + + .mCS-rounded.mCSB_scrollTools_vertical.mCSB_scrollTools_onDrag_expand .mCSB_dragger.mCSB_dragger_onDrag_expanded .mCSB_dragger_bar, + .mCS-rounded.mCSB_scrollTools_vertical.mCSB_scrollTools_onDrag_expand .mCSB_draggerContainer:hover .mCSB_dragger .mCSB_dragger_bar, + .mCS-rounded-dark.mCSB_scrollTools_vertical.mCSB_scrollTools_onDrag_expand .mCSB_dragger.mCSB_dragger_onDrag_expanded .mCSB_dragger_bar, + .mCS-rounded-dark.mCSB_scrollTools_vertical.mCSB_scrollTools_onDrag_expand .mCSB_draggerContainer:hover .mCSB_dragger .mCSB_dragger_bar{ + width: 16px; /* auto-expanded scrollbar */ + height: 16px; + margin: -1px 0; + } + + .mCS-rounded.mCSB_scrollTools_vertical.mCSB_scrollTools_onDrag_expand .mCSB_dragger.mCSB_dragger_onDrag_expanded + .mCSB_draggerRail, + .mCS-rounded.mCSB_scrollTools_vertical.mCSB_scrollTools_onDrag_expand .mCSB_draggerContainer:hover .mCSB_draggerRail, + .mCS-rounded-dark.mCSB_scrollTools_vertical.mCSB_scrollTools_onDrag_expand .mCSB_dragger.mCSB_dragger_onDrag_expanded + .mCSB_draggerRail, + .mCS-rounded-dark.mCSB_scrollTools_vertical.mCSB_scrollTools_onDrag_expand .mCSB_draggerContainer:hover .mCSB_draggerRail{ width: 4px; /* auto-expanded scrollbar */ } + + .mCS-rounded.mCSB_scrollTools_horizontal.mCSB_scrollTools_onDrag_expand .mCSB_dragger.mCSB_dragger_onDrag_expanded .mCSB_dragger_bar, + .mCS-rounded.mCSB_scrollTools_horizontal.mCSB_scrollTools_onDrag_expand .mCSB_draggerContainer:hover .mCSB_dragger .mCSB_dragger_bar, + .mCS-rounded-dark.mCSB_scrollTools_horizontal.mCSB_scrollTools_onDrag_expand .mCSB_dragger.mCSB_dragger_onDrag_expanded .mCSB_dragger_bar, + .mCS-rounded-dark.mCSB_scrollTools_horizontal.mCSB_scrollTools_onDrag_expand .mCSB_draggerContainer:hover .mCSB_dragger .mCSB_dragger_bar{ + height: 16px; /* auto-expanded scrollbar */ + width: 16px; + margin: 0 -1px; + } + + .mCS-rounded.mCSB_scrollTools_horizontal.mCSB_scrollTools_onDrag_expand .mCSB_dragger.mCSB_dragger_onDrag_expanded + .mCSB_draggerRail, + .mCS-rounded.mCSB_scrollTools_horizontal.mCSB_scrollTools_onDrag_expand .mCSB_draggerContainer:hover .mCSB_draggerRail, + .mCS-rounded-dark.mCSB_scrollTools_horizontal.mCSB_scrollTools_onDrag_expand .mCSB_dragger.mCSB_dragger_onDrag_expanded + .mCSB_draggerRail, + .mCS-rounded-dark.mCSB_scrollTools_horizontal.mCSB_scrollTools_onDrag_expand .mCSB_draggerContainer:hover .mCSB_draggerRail{ + height: 4px; /* auto-expanded scrollbar */ + margin: 6px 0; + } + + .mCS-rounded.mCSB_scrollTools .mCSB_buttonUp{ background-position: 0 -72px; } + + .mCS-rounded.mCSB_scrollTools .mCSB_buttonDown{ background-position: 0 -92px; } + + .mCS-rounded.mCSB_scrollTools .mCSB_buttonLeft{ background-position: 0 -112px; } + + .mCS-rounded.mCSB_scrollTools .mCSB_buttonRight{ background-position: 0 -128px; } + + + /* theme "rounded-dark", "rounded-dots-dark" */ + + .mCS-rounded-dark.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar, + .mCS-rounded-dots-dark.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar{ background-color: #000; background-color: rgba(0,0,0,0.75); } + + .mCS-rounded-dark.mCSB_scrollTools .mCSB_draggerRail{ background-color: #000; background-color: rgba(0,0,0,0.15); } + + .mCS-rounded-dark.mCSB_scrollTools .mCSB_dragger:hover .mCSB_dragger_bar, + .mCS-rounded-dots-dark.mCSB_scrollTools .mCSB_dragger:hover .mCSB_dragger_bar{ background-color: #000; background-color: rgba(0,0,0,0.85); } + + .mCS-rounded-dark.mCSB_scrollTools .mCSB_dragger:active .mCSB_dragger_bar, + .mCS-rounded-dark.mCSB_scrollTools .mCSB_dragger.mCSB_dragger_onDrag .mCSB_dragger_bar, + .mCS-rounded-dots-dark.mCSB_scrollTools .mCSB_dragger:active .mCSB_dragger_bar, + .mCS-rounded-dots-dark.mCSB_scrollTools .mCSB_dragger.mCSB_dragger_onDrag .mCSB_dragger_bar{ background-color: #000; background-color: rgba(0,0,0,0.9); } + + .mCS-rounded-dark.mCSB_scrollTools .mCSB_buttonUp{ background-position: -80px -72px; } + + .mCS-rounded-dark.mCSB_scrollTools .mCSB_buttonDown{ background-position: -80px -92px; } + + .mCS-rounded-dark.mCSB_scrollTools .mCSB_buttonLeft{ background-position: -80px -112px; } + + .mCS-rounded-dark.mCSB_scrollTools .mCSB_buttonRight{ background-position: -80px -128px; } + + + /* theme "rounded-dots", "rounded-dots-dark" */ + + .mCS-rounded-dots.mCSB_scrollTools_vertical .mCSB_draggerRail, + .mCS-rounded-dots-dark.mCSB_scrollTools_vertical .mCSB_draggerRail{ width: 4px; } + + .mCS-rounded-dots.mCSB_scrollTools .mCSB_draggerRail, + .mCS-rounded-dots-dark.mCSB_scrollTools .mCSB_draggerRail, + .mCS-rounded-dots.mCSB_scrollTools_horizontal .mCSB_draggerRail, + .mCS-rounded-dots-dark.mCSB_scrollTools_horizontal .mCSB_draggerRail{ + background-color: transparent; + background-position: center; + } + + .mCS-rounded-dots.mCSB_scrollTools .mCSB_draggerRail, + .mCS-rounded-dots-dark.mCSB_scrollTools .mCSB_draggerRail{ + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAANElEQVQYV2NkIAAYiVbw//9/Y6DiM1ANJoyMjGdBbLgJQAX/kU0DKgDLkaQAvxW4HEvQFwCRcxIJK1XznAAAAABJRU5ErkJggg=="); + background-repeat: repeat-y; + opacity: 0.3; + /* filter: "alpha(opacity=30)"; -ms-filter: "alpha(opacity=30)"; */ + } + + .mCS-rounded-dots.mCSB_scrollTools_horizontal .mCSB_draggerRail, + .mCS-rounded-dots-dark.mCSB_scrollTools_horizontal .mCSB_draggerRail{ + height: 4px; + margin: 6px 0; + background-repeat: repeat-x; + } + + .mCS-rounded-dots.mCSB_scrollTools .mCSB_buttonUp{ background-position: -16px -72px; } + + .mCS-rounded-dots.mCSB_scrollTools .mCSB_buttonDown{ background-position: -16px -92px; } + + .mCS-rounded-dots.mCSB_scrollTools .mCSB_buttonLeft{ background-position: -20px -112px; } + + .mCS-rounded-dots.mCSB_scrollTools .mCSB_buttonRight{ background-position: -20px -128px; } + + + /* theme "rounded-dots-dark" */ + + .mCS-rounded-dots-dark.mCSB_scrollTools .mCSB_draggerRail{ + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAALElEQVQYV2NkIAAYSVFgDFR8BqrBBEifBbGRTfiPZhpYjiQFBK3A6l6CvgAAE9kGCd1mvgEAAAAASUVORK5CYII="); + } + + .mCS-rounded-dots-dark.mCSB_scrollTools .mCSB_buttonUp{ background-position: -96px -72px; } + + .mCS-rounded-dots-dark.mCSB_scrollTools .mCSB_buttonDown{ background-position: -96px -92px; } + + .mCS-rounded-dots-dark.mCSB_scrollTools .mCSB_buttonLeft{ background-position: -100px -112px; } + + .mCS-rounded-dots-dark.mCSB_scrollTools .mCSB_buttonRight{ background-position: -100px -128px; } + + /* ---------------------------------------- */ + + + + /* theme "3d", "3d-dark", "3d-thick", "3d-thick-dark" */ + + .mCS-3d.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar, + .mCS-3d-dark.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar, + .mCS-3d-thick.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar, + .mCS-3d-thick-dark.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar{ + background-repeat: repeat-y; + /* background-image: -moz-linear-gradient(left, rgba(255,255,255,0.5) 0%, rgba(255,255,255,0) 100%); + background-image: -webkit-gradient(linear, left top, right top, color-stop(0%,rgba(255,255,255,0.5)), color-stop(100%,rgba(255,255,255,0))); + background-image: -webkit-linear-gradient(left, rgba(255,255,255,0.5) 0%,rgba(255,255,255,0) 100%); + background-image: -o-linear-gradient(left, rgba(255,255,255,0.5) 0%,rgba(255,255,255,0) 100%); + background-image: -ms-linear-gradient(left, rgba(255,255,255,0.5) 0%,rgba(255,255,255,0) 100%); */ + background-image: linear-gradient(to right, rgba(255,255,255,0.5) 0%,rgba(255,255,255,0) 100%); + } + + .mCS-3d.mCSB_scrollTools_horizontal .mCSB_dragger .mCSB_dragger_bar, + .mCS-3d-dark.mCSB_scrollTools_horizontal .mCSB_dragger .mCSB_dragger_bar, + .mCS-3d-thick.mCSB_scrollTools_horizontal .mCSB_dragger .mCSB_dragger_bar, + .mCS-3d-thick-dark.mCSB_scrollTools_horizontal .mCSB_dragger .mCSB_dragger_bar{ + background-repeat: repeat-x; + /* background-image: -moz-linear-gradient(top, rgba(255,255,255,0.5) 0%, rgba(255,255,255,0) 100%); + background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(255,255,255,0.5)), color-stop(100%,rgba(255,255,255,0))); + background-image: -webkit-linear-gradient(top, rgba(255,255,255,0.5) 0%,rgba(255,255,255,0) 100%); + background-image: -o-linear-gradient(top, rgba(255,255,255,0.5) 0%,rgba(255,255,255,0) 100%); + background-image: -ms-linear-gradient(top, rgba(255,255,255,0.5) 0%,rgba(255,255,255,0) 100%); */ + background-image: linear-gradient(to bottom, rgba(255,255,255,0.5) 0%,rgba(255,255,255,0) 100%); + } + + + /* theme "3d", "3d-dark" */ + + .mCS-3d.mCSB_scrollTools_vertical .mCSB_dragger, + .mCS-3d-dark.mCSB_scrollTools_vertical .mCSB_dragger{ height: 70px; } + + .mCS-3d.mCSB_scrollTools_horizontal .mCSB_dragger, + .mCS-3d-dark.mCSB_scrollTools_horizontal .mCSB_dragger{ width: 70px; } + + .mCS-3d.mCSB_scrollTools, + .mCS-3d-dark.mCSB_scrollTools{ + opacity: 1; + /* filter: "alpha(opacity=30)"; -ms-filter: "alpha(opacity=30)"; */ + } + + .mCS-3d.mCSB_scrollTools .mCSB_draggerRail, + .mCS-3d.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar, + .mCS-3d-dark.mCSB_scrollTools .mCSB_draggerRail, + .mCS-3d-dark.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar{ border-radius: 16px; } + + .mCS-3d.mCSB_scrollTools .mCSB_draggerRail, + .mCS-3d-dark.mCSB_scrollTools .mCSB_draggerRail{ + width: 8px; + background-color: #000; background-color: rgba(0,0,0,0.2); + box-shadow: inset 1px 0 1px rgba(0,0,0,0.5), inset -1px 0 1px rgba(255,255,255,0.2); + } + + .mCS-3d.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar, + .mCS-3d.mCSB_scrollTools .mCSB_dragger:hover .mCSB_dragger_bar, + .mCS-3d.mCSB_scrollTools .mCSB_dragger:active .mCSB_dragger_bar, + .mCS-3d.mCSB_scrollTools .mCSB_dragger.mCSB_dragger_onDrag .mCSB_dragger_bar, + .mCS-3d-dark.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar, + .mCS-3d-dark.mCSB_scrollTools .mCSB_dragger:hover .mCSB_dragger_bar, + .mCS-3d-dark.mCSB_scrollTools .mCSB_dragger:active .mCSB_dragger_bar, + .mCS-3d-dark.mCSB_scrollTools .mCSB_dragger.mCSB_dragger_onDrag .mCSB_dragger_bar{ background-color: #555; } + + .mCS-3d.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar, + .mCS-3d-dark.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar{ width: 8px; } + + .mCS-3d.mCSB_scrollTools_horizontal .mCSB_draggerRail, + .mCS-3d-dark.mCSB_scrollTools_horizontal .mCSB_draggerRail{ + width: 100%; + height: 8px; + margin: 4px 0; + box-shadow: inset 0 1px 1px rgba(0,0,0,0.5), inset 0 -1px 1px rgba(255,255,255,0.2); + } + + .mCS-3d.mCSB_scrollTools_horizontal .mCSB_dragger .mCSB_dragger_bar, + .mCS-3d-dark.mCSB_scrollTools_horizontal .mCSB_dragger .mCSB_dragger_bar{ + width: 100%; + height: 8px; + margin: 4px auto; + } + + .mCS-3d.mCSB_scrollTools .mCSB_buttonUp{ background-position: -32px -72px; } + + .mCS-3d.mCSB_scrollTools .mCSB_buttonDown{ background-position: -32px -92px; } + + .mCS-3d.mCSB_scrollTools .mCSB_buttonLeft{ background-position: -40px -112px; } + + .mCS-3d.mCSB_scrollTools .mCSB_buttonRight{ background-position: -40px -128px; } + + + /* theme "3d-dark" */ + + .mCS-3d-dark.mCSB_scrollTools .mCSB_draggerRail{ + background-color: #000; background-color: rgba(0,0,0,0.1); + box-shadow: inset 1px 0 1px rgba(0,0,0,0.1); + } + + .mCS-3d-dark.mCSB_scrollTools_horizontal .mCSB_draggerRail{ box-shadow: inset 0 1px 1px rgba(0,0,0,0.1); } + + .mCS-3d-dark.mCSB_scrollTools .mCSB_buttonUp{ background-position: -112px -72px; } + + .mCS-3d-dark.mCSB_scrollTools .mCSB_buttonDown{ background-position: -112px -92px; } + + .mCS-3d-dark.mCSB_scrollTools .mCSB_buttonLeft{ background-position: -120px -112px; } + + .mCS-3d-dark.mCSB_scrollTools .mCSB_buttonRight{ background-position: -120px -128px; } + + /* ---------------------------------------- */ + + + + /* theme: "3d-thick", "3d-thick-dark" */ + + .mCS-3d-thick.mCSB_scrollTools, + .mCS-3d-thick-dark.mCSB_scrollTools{ + opacity: 1; + /* filter: "alpha(opacity=30)"; -ms-filter: "alpha(opacity=30)"; */ + } + + .mCS-3d-thick.mCSB_scrollTools, + .mCS-3d-thick-dark.mCSB_scrollTools, + .mCS-3d-thick.mCSB_scrollTools .mCSB_draggerContainer, + .mCS-3d-thick-dark.mCSB_scrollTools .mCSB_draggerContainer{ -webkit-border-radius: 7px; } + + .mCS-3d-thick.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar, + .mCS-3d-thick-dark.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar{ -webkit-border-radius: 5px; } + + .mCSB_inside + .mCS-3d-thick.mCSB_scrollTools_vertical, + .mCSB_inside + .mCS-3d-thick-dark.mCSB_scrollTools_vertical{ right: 1px; } + + .mCS-3d-thick.mCSB_scrollTools_vertical, + .mCS-3d-thick-dark.mCSB_scrollTools_vertical{ box-shadow: inset 1px 0 1px rgba(0,0,0,0.1), inset 0 0 14px rgba(0,0,0,0.5); } + + .mCS-3d-thick.mCSB_scrollTools_horizontal, + .mCS-3d-thick-dark.mCSB_scrollTools_horizontal{ + bottom: 1px; + box-shadow: inset 0 1px 1px rgba(0,0,0,0.1), inset 0 0 14px rgba(0,0,0,0.5); + } + + .mCS-3d-thick.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar, + .mCS-3d-thick-dark.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar{ + box-shadow: inset 1px 0 0 rgba(255,255,255,0.4); + width: 12px; + margin: 2px; + position: absolute; + height: auto; + top: 0; + bottom: 0; + left: 0; + right: 0; + } + + .mCS-3d-thick.mCSB_scrollTools_horizontal .mCSB_dragger .mCSB_dragger_bar, + .mCS-3d-thick-dark.mCSB_scrollTools_horizontal .mCSB_dragger .mCSB_dragger_bar{ box-shadow: inset 0 1px 0 rgba(255,255,255,0.4); } + + .mCS-3d-thick.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar, + .mCS-3d-thick.mCSB_scrollTools .mCSB_dragger:hover .mCSB_dragger_bar, + .mCS-3d-thick.mCSB_scrollTools .mCSB_dragger:active .mCSB_dragger_bar, + .mCS-3d-thick.mCSB_scrollTools .mCSB_dragger.mCSB_dragger_onDrag .mCSB_dragger_bar{ background-color: #555; } + + .mCS-3d-thick.mCSB_scrollTools_horizontal .mCSB_dragger .mCSB_dragger_bar, + .mCS-3d-thick-dark.mCSB_scrollTools_horizontal .mCSB_dragger .mCSB_dragger_bar{ + height: 12px; + width: auto; + } + + .mCS-3d-thick.mCSB_scrollTools .mCSB_draggerContainer{ + background-color: #000; background-color: rgba(0,0,0,0.05); + box-shadow: inset 1px 1px 16px rgba(0,0,0,0.1); + } + + .mCS-3d-thick.mCSB_scrollTools .mCSB_draggerRail{ background-color: transparent; } + + .mCS-3d-thick.mCSB_scrollTools .mCSB_buttonUp{ background-position: -32px -72px; } + + .mCS-3d-thick.mCSB_scrollTools .mCSB_buttonDown{ background-position: -32px -92px; } + + .mCS-3d-thick.mCSB_scrollTools .mCSB_buttonLeft{ background-position: -40px -112px; } + + .mCS-3d-thick.mCSB_scrollTools .mCSB_buttonRight{ background-position: -40px -128px; } + + + /* theme: "3d-thick-dark" */ + + .mCS-3d-thick-dark.mCSB_scrollTools{ box-shadow: inset 0 0 14px rgba(0,0,0,0.2); } + + .mCS-3d-thick-dark.mCSB_scrollTools_horizontal{ box-shadow: inset 0 1px 1px rgba(0,0,0,0.1), inset 0 0 14px rgba(0,0,0,0.2); } + + .mCS-3d-thick-dark.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar{ box-shadow: inset 1px 0 0 rgba(255,255,255,0.4), inset -1px 0 0 rgba(0,0,0,0.2); } + + .mCS-3d-thick-dark.mCSB_scrollTools_horizontal .mCSB_dragger .mCSB_dragger_bar{ box-shadow: inset 0 1px 0 rgba(255,255,255,0.4), inset 0 -1px 0 rgba(0,0,0,0.2); } + + .mCS-3d-thick-dark.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar, + .mCS-3d-thick-dark.mCSB_scrollTools .mCSB_dragger:hover .mCSB_dragger_bar, + .mCS-3d-thick-dark.mCSB_scrollTools .mCSB_dragger:active .mCSB_dragger_bar, + .mCS-3d-thick-dark.mCSB_scrollTools .mCSB_dragger.mCSB_dragger_onDrag .mCSB_dragger_bar{ background-color: #777; } + + .mCS-3d-thick-dark.mCSB_scrollTools .mCSB_draggerContainer{ + background-color: #fff; background-color: rgba(0,0,0,0.05); + box-shadow: inset 1px 1px 16px rgba(0,0,0,0.1); + } + + .mCS-3d-thick-dark.mCSB_scrollTools .mCSB_draggerRail{ background-color: transparent; } + + .mCS-3d-thick-dark.mCSB_scrollTools .mCSB_buttonUp{ background-position: -112px -72px; } + + .mCS-3d-thick-dark.mCSB_scrollTools .mCSB_buttonDown{ background-position: -112px -92px; } + + .mCS-3d-thick-dark.mCSB_scrollTools .mCSB_buttonLeft{ background-position: -120px -112px; } + + .mCS-3d-thick-dark.mCSB_scrollTools .mCSB_buttonRight{ background-position: -120px -128px; } + + /* ---------------------------------------- */ + + + + /* theme: "minimal", "minimal-dark" */ + + .mCSB_outside + .mCS-minimal.mCSB_scrollTools_vertical, + .mCSB_outside + .mCS-minimal-dark.mCSB_scrollTools_vertical{ + right: 0; + margin: 12px 0; + } + + .mCustomScrollBox.mCS-minimal + .mCSB_scrollTools.mCSB_scrollTools_horizontal, + .mCustomScrollBox.mCS-minimal + .mCSB_scrollTools + .mCSB_scrollTools.mCSB_scrollTools_horizontal, + .mCustomScrollBox.mCS-minimal-dark + .mCSB_scrollTools.mCSB_scrollTools_horizontal, + .mCustomScrollBox.mCS-minimal-dark + .mCSB_scrollTools + .mCSB_scrollTools.mCSB_scrollTools_horizontal{ + bottom: 0; + margin: 0 12px; + } + + /* RTL direction/left-side scrollbar */ + .mCS-dir-rtl > .mCSB_outside + .mCS-minimal.mCSB_scrollTools_vertical, + .mCS-dir-rtl > .mCSB_outside + .mCS-minimal-dark.mCSB_scrollTools_vertical{ + left: 0; + right: auto; + } + + .mCS-minimal.mCSB_scrollTools .mCSB_draggerRail, + .mCS-minimal-dark.mCSB_scrollTools .mCSB_draggerRail{ background-color: transparent; } + + .mCS-minimal.mCSB_scrollTools_vertical .mCSB_dragger, + .mCS-minimal-dark.mCSB_scrollTools_vertical .mCSB_dragger{ height: 50px; } + + .mCS-minimal.mCSB_scrollTools_horizontal .mCSB_dragger, + .mCS-minimal-dark.mCSB_scrollTools_horizontal .mCSB_dragger{ width: 50px; } + + .mCS-minimal.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar{ + background-color: #fff; background-color: rgba(255,255,255,0.2); + /* filter: "alpha(opacity=20)"; -ms-filter: "alpha(opacity=20)"; */ + } + + .mCS-minimal.mCSB_scrollTools .mCSB_dragger:active .mCSB_dragger_bar, + .mCS-minimal.mCSB_scrollTools .mCSB_dragger.mCSB_dragger_onDrag .mCSB_dragger_bar{ + background-color: #fff; background-color: rgba(255,255,255,0.5); + /* filter: "alpha(opacity=50)"; -ms-filter: "alpha(opacity=50)"; */ + } + + + /* theme: "minimal-dark" */ + + .mCS-minimal-dark.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar{ + background-color: #000; background-color: rgba(0,0,0,0.2); + /* filter: "alpha(opacity=20)"; -ms-filter: "alpha(opacity=20)"; */ + } + + .mCS-minimal-dark.mCSB_scrollTools .mCSB_dragger:active .mCSB_dragger_bar, + .mCS-minimal-dark.mCSB_scrollTools .mCSB_dragger.mCSB_dragger_onDrag .mCSB_dragger_bar{ + background-color: #000; background-color: rgba(0,0,0,0.5); + /* filter: "alpha(opacity=50)"; -ms-filter: "alpha(opacity=50)"; */ + } + + /* ---------------------------------------- */ + + + + /* theme "light-3", "dark-3" */ + + .mCS-light-3.mCSB_scrollTools .mCSB_draggerRail, + .mCS-dark-3.mCSB_scrollTools .mCSB_draggerRail{ + width: 6px; + background-color: #000; background-color: rgba(0,0,0,0.2); + } + + .mCS-light-3.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar, + .mCS-dark-3.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar{ width: 6px; } + + .mCS-light-3.mCSB_scrollTools_horizontal .mCSB_dragger .mCSB_dragger_bar, + .mCS-dark-3.mCSB_scrollTools_horizontal .mCSB_dragger .mCSB_dragger_bar, + .mCS-light-3.mCSB_scrollTools_horizontal .mCSB_draggerRail, + .mCS-dark-3.mCSB_scrollTools_horizontal .mCSB_draggerRail{ + width: 100%; + height: 6px; + margin: 5px 0; + } + + .mCS-light-3.mCSB_scrollTools_vertical.mCSB_scrollTools_onDrag_expand .mCSB_dragger.mCSB_dragger_onDrag_expanded + .mCSB_draggerRail, + .mCS-light-3.mCSB_scrollTools_vertical.mCSB_scrollTools_onDrag_expand .mCSB_draggerContainer:hover .mCSB_draggerRail, + .mCS-dark-3.mCSB_scrollTools_vertical.mCSB_scrollTools_onDrag_expand .mCSB_dragger.mCSB_dragger_onDrag_expanded + .mCSB_draggerRail, + .mCS-dark-3.mCSB_scrollTools_vertical.mCSB_scrollTools_onDrag_expand .mCSB_draggerContainer:hover .mCSB_draggerRail{ + width: 12px; + } + + .mCS-light-3.mCSB_scrollTools_horizontal.mCSB_scrollTools_onDrag_expand .mCSB_dragger.mCSB_dragger_onDrag_expanded + .mCSB_draggerRail, + .mCS-light-3.mCSB_scrollTools_horizontal.mCSB_scrollTools_onDrag_expand .mCSB_draggerContainer:hover .mCSB_draggerRail, + .mCS-dark-3.mCSB_scrollTools_horizontal.mCSB_scrollTools_onDrag_expand .mCSB_dragger.mCSB_dragger_onDrag_expanded + .mCSB_draggerRail, + .mCS-dark-3.mCSB_scrollTools_horizontal.mCSB_scrollTools_onDrag_expand .mCSB_draggerContainer:hover .mCSB_draggerRail{ + height: 12px; + margin: 2px 0; + } + + .mCS-light-3.mCSB_scrollTools .mCSB_buttonUp{ background-position: -32px -72px; } + + .mCS-light-3.mCSB_scrollTools .mCSB_buttonDown{ background-position: -32px -92px; } + + .mCS-light-3.mCSB_scrollTools .mCSB_buttonLeft{ background-position: -40px -112px; } + + .mCS-light-3.mCSB_scrollTools .mCSB_buttonRight{ background-position: -40px -128px; } + + + /* theme "dark-3" */ + + .mCS-dark-3.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar{ background-color: #000; background-color: rgba(0,0,0,0.75); } + + .mCS-dark-3.mCSB_scrollTools .mCSB_dragger:hover .mCSB_dragger_bar{ background-color: #000; background-color: rgba(0,0,0,0.85); } + + .mCS-dark-3.mCSB_scrollTools .mCSB_dragger:active .mCSB_dragger_bar, + .mCS-dark-3.mCSB_scrollTools .mCSB_dragger.mCSB_dragger_onDrag .mCSB_dragger_bar{ background-color: #000; background-color: rgba(0,0,0,0.9); } + + .mCS-dark-3.mCSB_scrollTools .mCSB_draggerRail{ background-color: #000; background-color: rgba(0,0,0,0.1); } + + .mCS-dark-3.mCSB_scrollTools .mCSB_buttonUp{ background-position: -112px -72px; } + + .mCS-dark-3.mCSB_scrollTools .mCSB_buttonDown{ background-position: -112px -92px; } + + .mCS-dark-3.mCSB_scrollTools .mCSB_buttonLeft{ background-position: -120px -112px; } + + .mCS-dark-3.mCSB_scrollTools .mCSB_buttonRight{ background-position: -120px -128px; } + + /* ---------------------------------------- */ + + + + /* theme "inset", "inset-dark", "inset-2", "inset-2-dark", "inset-3", "inset-3-dark" */ + + .mCS-inset.mCSB_scrollTools .mCSB_draggerRail, + .mCS-inset-dark.mCSB_scrollTools .mCSB_draggerRail, + .mCS-inset-2.mCSB_scrollTools .mCSB_draggerRail, + .mCS-inset-2-dark.mCSB_scrollTools .mCSB_draggerRail, + .mCS-inset-3.mCSB_scrollTools .mCSB_draggerRail, + .mCS-inset-3-dark.mCSB_scrollTools .mCSB_draggerRail{ + width: 12px; + background-color: #000; background-color: rgba(0,0,0,0.2); + } + + .mCS-inset.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar, + .mCS-inset-dark.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar, + .mCS-inset-2.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar, + .mCS-inset-2-dark.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar, + .mCS-inset-3.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar, + .mCS-inset-3-dark.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar{ + width: 6px; + margin: 3px 5px; + position: absolute; + height: auto; + top: 0; + bottom: 0; + left: 0; + right: 0; + } + + .mCS-inset.mCSB_scrollTools_horizontal .mCSB_dragger .mCSB_dragger_bar, + .mCS-inset-dark.mCSB_scrollTools_horizontal .mCSB_dragger .mCSB_dragger_bar, + .mCS-inset-2.mCSB_scrollTools_horizontal .mCSB_dragger .mCSB_dragger_bar, + .mCS-inset-2-dark.mCSB_scrollTools_horizontal .mCSB_dragger .mCSB_dragger_bar, + .mCS-inset-3.mCSB_scrollTools_horizontal .mCSB_dragger .mCSB_dragger_bar, + .mCS-inset-3-dark.mCSB_scrollTools_horizontal .mCSB_dragger .mCSB_dragger_bar{ + height: 6px; + margin: 5px 3px; + position: absolute; + width: auto; + top: 0; + bottom: 0; + left: 0; + right: 0; + } + + .mCS-inset.mCSB_scrollTools_horizontal .mCSB_draggerRail, + .mCS-inset-dark.mCSB_scrollTools_horizontal .mCSB_draggerRail, + .mCS-inset-2.mCSB_scrollTools_horizontal .mCSB_draggerRail, + .mCS-inset-2-dark.mCSB_scrollTools_horizontal .mCSB_draggerRail, + .mCS-inset-3.mCSB_scrollTools_horizontal .mCSB_draggerRail, + .mCS-inset-3-dark.mCSB_scrollTools_horizontal .mCSB_draggerRail{ + width: 100%; + height: 12px; + margin: 2px 0; + } + + .mCS-inset.mCSB_scrollTools .mCSB_buttonUp, + .mCS-inset-2.mCSB_scrollTools .mCSB_buttonUp, + .mCS-inset-3.mCSB_scrollTools .mCSB_buttonUp{ background-position: -32px -72px; } + + .mCS-inset.mCSB_scrollTools .mCSB_buttonDown, + .mCS-inset-2.mCSB_scrollTools .mCSB_buttonDown, + .mCS-inset-3.mCSB_scrollTools .mCSB_buttonDown{ background-position: -32px -92px; } + + .mCS-inset.mCSB_scrollTools .mCSB_buttonLeft, + .mCS-inset-2.mCSB_scrollTools .mCSB_buttonLeft, + .mCS-inset-3.mCSB_scrollTools .mCSB_buttonLeft{ background-position: -40px -112px; } + + .mCS-inset.mCSB_scrollTools .mCSB_buttonRight, + .mCS-inset-2.mCSB_scrollTools .mCSB_buttonRight, + .mCS-inset-3.mCSB_scrollTools .mCSB_buttonRight{ background-position: -40px -128px; } + + + /* theme "inset-dark", "inset-2-dark", "inset-3-dark" */ + + .mCS-inset-dark.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar, + .mCS-inset-2-dark.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar, + .mCS-inset-3-dark.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar{ background-color: #000; background-color: rgba(0,0,0,0.75); } + + .mCS-inset-dark.mCSB_scrollTools .mCSB_dragger:hover .mCSB_dragger_bar, + .mCS-inset-2-dark.mCSB_scrollTools .mCSB_dragger:hover .mCSB_dragger_bar, + .mCS-inset-3-dark.mCSB_scrollTools .mCSB_dragger:hover .mCSB_dragger_bar{ background-color: #000; background-color: rgba(0,0,0,0.85); } + + .mCS-inset-dark.mCSB_scrollTools .mCSB_dragger:active .mCSB_dragger_bar, + .mCS-inset-dark.mCSB_scrollTools .mCSB_dragger.mCSB_dragger_onDrag .mCSB_dragger_bar, + .mCS-inset-2-dark.mCSB_scrollTools .mCSB_dragger:active .mCSB_dragger_bar, + .mCS-inset-2-dark.mCSB_scrollTools .mCSB_dragger.mCSB_dragger_onDrag .mCSB_dragger_bar, + .mCS-inset-3-dark.mCSB_scrollTools .mCSB_dragger:active .mCSB_dragger_bar, + .mCS-inset-3-dark.mCSB_scrollTools .mCSB_dragger.mCSB_dragger_onDrag .mCSB_dragger_bar{ background-color: #000; background-color: rgba(0,0,0,0.9); } + + .mCS-inset-dark.mCSB_scrollTools .mCSB_draggerRail, + .mCS-inset-2-dark.mCSB_scrollTools .mCSB_draggerRail, + .mCS-inset-3-dark.mCSB_scrollTools .mCSB_draggerRail{ background-color: #000; background-color: rgba(0,0,0,0.1); } + + .mCS-inset-dark.mCSB_scrollTools .mCSB_buttonUp, + .mCS-inset-2-dark.mCSB_scrollTools .mCSB_buttonUp, + .mCS-inset-3-dark.mCSB_scrollTools .mCSB_buttonUp{ background-position: -112px -72px; } + + .mCS-inset-dark.mCSB_scrollTools .mCSB_buttonDown, + .mCS-inset-2-dark.mCSB_scrollTools .mCSB_buttonDown, + .mCS-inset-3-dark.mCSB_scrollTools .mCSB_buttonDown{ background-position: -112px -92px; } + + .mCS-inset-dark.mCSB_scrollTools .mCSB_buttonLeft, + .mCS-inset-2-dark.mCSB_scrollTools .mCSB_buttonLeft, + .mCS-inset-3-dark.mCSB_scrollTools .mCSB_buttonLeft{ background-position: -120px -112px; } + + .mCS-inset-dark.mCSB_scrollTools .mCSB_buttonRight, + .mCS-inset-2-dark.mCSB_scrollTools .mCSB_buttonRight, + .mCS-inset-3-dark.mCSB_scrollTools .mCSB_buttonRight{ background-position: -120px -128px; } + + + /* theme "inset-2", "inset-2-dark" */ + + .mCS-inset-2.mCSB_scrollTools .mCSB_draggerRail, + .mCS-inset-2-dark.mCSB_scrollTools .mCSB_draggerRail{ + background-color: transparent; + border-width: 1px; + border-style: solid; + border-color: #fff; + border-color: rgba(255,255,255,0.2); + -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; + } + + .mCS-inset-2-dark.mCSB_scrollTools .mCSB_draggerRail{ border-color: #000; border-color: rgba(0,0,0,0.2); } + + + /* theme "inset-3", "inset-3-dark" */ + + .mCS-inset-3.mCSB_scrollTools .mCSB_draggerRail{ background-color: #fff; background-color: rgba(255,255,255,0.6); } + + .mCS-inset-3-dark.mCSB_scrollTools .mCSB_draggerRail{ background-color: #000; background-color: rgba(0,0,0,0.6); } + + .mCS-inset-3.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar{ background-color: #000; background-color: rgba(0,0,0,0.75); } + + .mCS-inset-3.mCSB_scrollTools .mCSB_dragger:hover .mCSB_dragger_bar{ background-color: #000; background-color: rgba(0,0,0,0.85); } + + .mCS-inset-3.mCSB_scrollTools .mCSB_dragger:active .mCSB_dragger_bar, + .mCS-inset-3.mCSB_scrollTools .mCSB_dragger.mCSB_dragger_onDrag .mCSB_dragger_bar{ background-color: #000; background-color: rgba(0,0,0,0.9); } + + .mCS-inset-3-dark.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar{ background-color: #fff; background-color: rgba(255,255,255,0.75); } + + .mCS-inset-3-dark.mCSB_scrollTools .mCSB_dragger:hover .mCSB_dragger_bar{ background-color: #fff; background-color: rgba(255,255,255,0.85); } + + .mCS-inset-3-dark.mCSB_scrollTools .mCSB_dragger:active .mCSB_dragger_bar, + .mCS-inset-3-dark.mCSB_scrollTools .mCSB_dragger.mCSB_dragger_onDrag .mCSB_dragger_bar{ background-color: #fff; background-color: rgba(255,255,255,0.9); } + + /* ---------------------------------------- */ diff --git a/www/rompr/css/layout-january.css b/www/rompr/css/layout-january.css new file mode 100644 index 0000000..f445b29 --- /dev/null +++ b/www/rompr/css/layout-january.css @@ -0,0 +1,2259 @@ +/* +===================================================================== += Standard HTML Elements +===================================================================== +*/ + +html { + height:100%; + transition: background-image 0.5s ease-in-out; +} + +body { + font-size:8pt; + margin:0px; + overflow:hidden; + -webkit-font-smoothing: subpixel-antialiased; + -moz-osx-font-smoothing: auto; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -o-user-select: none; + user-select: none; +} + +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input { + font-family:verdana,helvetica,arial,sans-serif; + -webkit-text-size-adjust: 100%; +} + +h1 { + font-size:250%; + margin-top:20%; + margin-left:20%; + margin-right:20%; + font-weight:normal; +} + +h2 { + font-size:170%; + font-weight:bold; + margin-top:0px; + margin-bottom:0px; +} + +h3 { + padding-bottom:0px; + margin-bottom:8px; +} + +h1,h2,h3,h4,h5,h6 { + background-color:transparent; + white-space:normal; +} + +a { + text-decoration:none; +} + +hr { + -webkit-margin-before:0px; + -webkit-margin-after:0px; +} + +input, .filebutton { + font-size:100%; + width:100%; + margin-bottom:4px; + margin-top:4px; + padding-top:2px; + padding-bottom:2px; + padding-left:0px; + padding-right:0px; +} + +.inputfile { + width: 0.1px; + height: 0.1px; + opacity: 0; + overflow: hidden; + position: absolute; + z-index: -1; +} + +.filebutton { + word-break: break-all; +} + +input[type=checkbox], input[type=radio] { + width:auto; +} + +input[type=text] { + /* padding: 0px 2px; */ + height: 2em; + border: 0px none; + border-radius: 0 0; + background-color: white; +} + +.selectholder { + background-color:white; +} + +input.snapclientname[type=text] { + /* padding: 0px 2px; */ + height: 1.5em !important; + background-color: transparent !important; +} + +select { + width:100%; + background-color:transparent; + border:0px none; + margin:0px; + height:2em; + font-size:100%; + -webkit-appearance:none; + -moz-appearance:none; + appearance:none; + pointer-events:auto; + z-index:99; +} + +select:hover { + cursor:pointer; +} + +button { + font-size:100%; + margin-bottom:4px; + margin-top:4px; + margin-left:8px; + margin-right:8px; + padding-top:2px; + padding-bottom:2px; + padding-left:6px; + padding-right:6px; + min-height:2em; + cursor:pointer; +} + +/* +===================================================================== += Classes for custom styling of select boxes etc +===================================================================== +*/ + +#pset { + position:absolute; + display:none; +} + +#pmaxset { + position:absolute; + display:none; +} + +.selectholder { + overflow:hidden; + width:58%; + margin-top:4px; + margin-bottom:4px; + padding-left:2px; + pointer-events:none; + z-index:98; +} + +.noclicks { + pointer-events:none; +} + +.pref .selectholder { + margin-left: 1em; +} + +.selectholder-noselect { + width:58%; + margin-top:4px; + margin-bottom:4px; + padding-left:2px; + margin-left:1em; +} + +.combo-button { + background-size:contain; + background-position: center; + background-repeat:no-repeat; + display:block; + height:2em; + width:2em; + margin-left:4px; +} + +.enter { + box-sizing: border-box; +} + +.dropdown-container +{ + -webkit-box-align:center; + align-items: center; +} + +.dropdown-holder +{ + position:relative; +} + +.drop-box +{ + position:relative; + z-index:3000; + display:none; + max-height:15em; + overflow:auto; + background-color:#ffffff; + color:#000000; + line-height:1.3em; + padding-left:4px; + cursor:pointer; +} + +.tagmenu +{ + width:100%; + box-sizing:border-box; +} + +.tag { + white-space:nowrap; + margin-right:1em; +} + +.helpfulalbum .tag +{ + white-space: normal; +} + +.tagmenu-contents .backhi:hover +{ + color:#ffffff !important; + background-color:#000000 !important; +} + +.drop-box .mCSB_draggerRail +{ + background:rgba(0,0,0,0.1) !important; +} + +.drop-box .mCSB_dragger_bar +{ + background:rgba(0,0,0,0.75) !important; +} + +.drop-box .backhi +{ + transition: all 0s !important; +} + +.drop-box .backhi:hover +{ + transition: all 0s !important; +} + +/* +===================================================================== += General Layout Control - flex, float, etc +===================================================================== +*/ + +.tright { + float:right; +} + +.tleft { + float:left; +} + +.textcentre { + text-align:center; +} + +.containerbox { + display:-webkit-box; + display: flex; +} + +.vertical { + -webkit-box-orient:vertical; + flex-direction: column; +} + +.center { + -webkit-box-pack:center; + justify-content: center; +} + +.expand { + -webkit-box-flex:1; + flex-grow: 1; + flex-shrink: 1; + flex-basis: auto; +} + +.expandslightly { + flex-grow: 1; + flex-shrink: 2; + flex-basis: auto; +} + +.expandalot { + flex-grow: 5; + flex-shrink: 1; + flex-basis: auto; +} + +.expandabit { + flex-grow: 2; + flex-shrink: 2; + flex-basis: auto; +} + +.fixed { + -webkit-box-flex:0; + flex-grow: 0; + flex-shrink:0; +} + +.noselection { + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -o-user-select: none; + user-select: none; + cursor:default; +} + +.bold { + font-weight:bold; +} + +.alignmid { + vertical-align:middle; +} + +.clickicon { + cursor:pointer; +} + +.infoclick { + cursor:pointer; +} + +.playable { + cursor: pointer; +} + +.clickplaylist { + cursor: pointer; +} + +.invisible { + display:none; +} + +.moveable { + cursor: move; +} + +.notbold { + font-weight:normal !important; +} + +.clearfix:after { + content: " "; + display: block; + height: 0; + clear: both; +} + +.nopointer { + cursor: default !important; +} + +.noborder { + margin:0px; + padding:0px; +} + +.ucfirst { + text-transform:capitalize; +} + +/* +===================================================================== += Used by masonry layouts +===================================================================== +*/ + +.masochist { + margin-right:auto; + margin-left:auto; + display:block; + max-width:95%; + transition: opacity 0.5s ease; + opacity: 1; +} + +.masochist2 +{ + margin-right:auto; + margin-left:auto; + display:block; + width: 90%; + max-width:300px; + transition: opacity 0.5s ease; + opacity: 1; +} + +.tagholder { + margin-top: 12px; +} + +.tagholder2 { + margin-top: 12px; + width:20%; +} + +.tagholder_wide { + margin-top:4px; + padding: 8px; + box-sizing:border-box; + margin-bottom:2em; +} + +.tagholder4 { + margin-top: 12px; + width:20%; +} + +.tagholder5 { + margin-top: 12px; +} + +.minwidthed:before +{ + content:""; + width: 10em; + display:block; + overflow:hidden; +} + +.minwidthed3:before +{ + content:""; + width: 20em; + display:block; + overflow:hidden; +} + +.sensiblebox { + box-sizing: border-box; +} + +.tagholder table tr.datetag +{ + font-size: 120%; + border-top:4px solid rgba(0,0,0,0); + padding:4px; +} + +.mixbox +{ + width:100%; + margin-top:4px; + align-items:center; + padding-top:0.4em; + padding-bottom:0.4em; + box-sizing: border-box; + border: 4px solid rgba(0,0,0,0); +} + +.mixbox .fixed .topimg +{ + margin-top:4px; +} + +.mixbox div b +{ + font-size:110%; +} + +.mixinfo +{ + padding-left:12px; +} + +/* +===================================================================== += Specific Elements By ID +===================================================================== +*/ + +#amontobin { + font-size:8pt; +} + +#collectionsearcher { + padding-left:8px; +} + +#playlist { + height:100%; +} + +#pscroller { + overflow:auto; +} + +#playlistbuttons { + margin-bottom:4px; +} + +#playlistbuttons > table { + border-collapse:collapse; + border-spacing:2px; + margin-top:2px; + margin-bottom:2px; +} + +#horse { + padding-top:4px; + padding-bottom:0px; + font-weight:bold; + font-size:90%; + cursor:default; +} + +#horse > table { + border-spacing:0px; +} + +#similarartists { + width:100%; + margin-top:8px; +} + +#smlrtst { + margin-left:auto; + margin-right:auto; + float:none; + display:block; + width:auto; +} + +#wikipopup { + position:absolute; + display:none; + z-index:1001; + opacity:0.75; +} + +#dragger { + position:absolute; + width:300px; + z-index:1200; + padding: 4px; +} + +#wobblebottom { + height:80%; +} + +#scrobwrangler { + /*cursor: pointer;*/ + font-size:6pt; +} + +#tagadder { + z-index:1500; + position:absolute; +} + +#tagslist { + line-height:150%; +} + +.padleft { + padding-left:8px; +} + +#artistchooser { + font-weight:bold; + text-align:center; + width:98%; + margin-right:auto; + margin-left:auto; + margin-top:4px; + margin-bottom:2px; + padding-bottom:4px; + padding-top:4px; +} + +#pluginplaylistslist .menuitem { + margin-bottom: 4px; +} + +#imagecontainer { + position:absolute; + opacity:1; + z-index:1002; + display:none; +} + +#status { + font-weight:bold; + overflow:hidden; +} + +#nptext { + opacity: 0; +} + +#nptext.ready { + opacity: 1; +} + +#nptext>p { + font-weight:bold; + margin-top: 0px; + margin-bottom: 0px; +} + +#nptext>p>i { + font-weight:normal; +} + +#nptext>p.line0 { + font-size:100%; + line-height:125%; +} + +#nptext>p.line1 { + font-size:75%; + line-height:125%; +} + +#nptext>p.line2 { + font-size:75%; + line-height:125%; +} + +#nptext.calculating { + opacity: 0; +} + +/* +===================================================================== += General Classes +===================================================================== +*/ + +.mobonly { + display:none; +} + +.progressbar { + width:95%; + height:1em; + margin-right:auto; + margin-left:auto; + background-repeat:no-repeat; +} + +.progressbar.animated { + transition: background-position 1s linear; +} + +.progressbar_v { + height:100%; + width:12px; + margin-right:auto; + margin-left:auto; +} + +.alarmnumbers { + font-size:250%; + font-weight:bold; + /* line-height:0.7em; + padding-bottom:0.2em; */ +} + +.pref { + margin-left:8px; + margin-bottom:8px; +} + +.configtitle { + padding-top:2px; + padding-bottom:4px; + margin-bottom:4px; + font-size:110%; + display:flex; + align-items:center; +} + +.configtitle b { + flex-grow: 1; +} + +.artistbanner { + margin-left:4px; + padding-left:8px; + margin-top:8px; +} + +.divlabel { + width:41%; + padding-right:6px; + font-weight:bold; +} + +.podconfigpanel .divlabel { + width: 50%; +} + +.topbox { + padding-top:4px; +} + +.dropmenu { + display:none; + margin:0px; + padding-right:0px; + padding-top:0px; + padding-bottom:4px; +} + +.dropmenu.marged, #mopidysearchdomains { + margin-bottom:4px; +} + +.dropmenu.visible { + display:block; +} + +.bumpad { + padding-bottom:4px; +} + +.fullwidth { + width:100%; + padding:0px; + margin:0px; +} + +.smallcover { + width:32px; + height:auto; + vertical-align:middle; + margin-right:8px; +} + +div.item div.containerbox.vertical.expand { + align-self: center; +} + +.svg-square { + width:32px; + height:32px; + vertical-align:middle; + margin-right:8px; +} + +.tracknumber { + height:1.3em; + width:2em; + font-weight:bold; +} + +.smallspacer { + width:2px; +} + +.tracknumbr { + width:2em; +} + +.discnumber { + font-weight:bold; + font-size:110%; + padding-top:2px; + padding-bottom:2px; + display:block; +} + +.bum { + font-style:italic; +} + +.clicktrack { + margin-bottom: 2px; +} + +.line { + padding-bottom:2px; +} + +.playlistitem { + padding-top:0px; + font-size:90%; +} + +.trackgroup { + margin-right:2px; +} + +.playlisttitle { + padding-left:4px; + margin-right:2px; + margin-left:4px; + padding-top:8px; + padding-bottom:8px; + font-size:110%; +} + +.playlistcurrenttitle { + font-size:120%; + box-sizing:border-box; +} + +.playlistcurrentitem { + font-size:100%; + box-sizing:border-box; +} + +div.item { + margin-right:2px; + box-sizing: border-box; +} + +.playlistrow2 { + font-size:88%; + font-style:italic; + font-weight:normal; +} + +.tracktime { + margin-left:4px !important; +} + +.track { + box-sizing: border-box; +} + +.togglebutton { + padding:0px; + height:20px; + width:48px; + font-size:18px; + display:table-cell !important; +} + +.togglediv { + display:table-cell; + vertical-align:middle; + font-size:8pt; +} + +.togglecontainer { + display:table; + /*width:100%;*/ + transition: opacity 1s ease; +} + +.tgtl { + padding-right:4px; + /*because firefox is dumb and ignores the align settings of the parent container.*/ + text-align:right; +} + +.tgtr { + padding-left:4px; +} + +.holdingcell { + display:inline-block; + width:100% +} + +.holdingcell li input { + width:90%; +} + +.holdingcell li button { + margin-right:6px; +} + +.tiny { + font-size:80%; + margin-right:4px; + margin-left:2px; +} + +td.fil { + font-weight:bold; +} + +.popupwindow { + position:absolute; + display:none; + z-index:20001; + overflow-y: hidden; + overflow-x: hidden; + transition: opacity 0.3s ease; + opacity: 0; +} + +.popupcontentcontainer { + height: 100%; +} + +.popupcontentholder { + overflow-y: auto; +} + +.popupcontents { + padding:8px; +} + +.cheese { + width:98%; + padding-top:4px; + margin-right:auto; + margin-left:auto; +} + +.dingleberry { + margin-left:auto; + margin-right:auto; + text-align:center; + width:90%; + display:block; +} + +.bleft { + font-weight:bold; + padding-top:2px; + padding-bottom:2px; + padding-left:8px; + padding-right:8px; +} + +.bsel { + font-size:110%; +} + +.spacer { + padding-bottom:4px; + padding-top:4px; +} + +.modeimg { + height:20px; + width:20px; + margin-right:8px; + vertical-align:middle; +} + +.modespan { + vertical-align:middle; + font-weight:bold; +} + +.prefinput { + width: 100%; +} + +.slt { + white-space: nowrap; +} + +.clickalbummenu +{ + position:relative; +} + +.imgfill { + width: 100%; + height: 100%; +} + +/* +===================================================================== += Dropdown Menus +===================================================================== +*/ + +div.topdrop +{ + margin:0; + padding:0; + float:left; + position:relative; +} + +div.topdropmenu +{ + z-index:1000; + overflow-y:auto; + overflow-x:hidden; + display:none; + position: absolute; + opacity:1 !important; + padding:4px; +} + +.thin +{ + opacity: 0.3 !important; +} + +div.topdropmenu div:not(.canbefaded) { + opacity: 1 !important; +} + +div.topdropmenu div.notenabled, div.togglecontainer.notenabled, div#flowcontrols.notenabled { + opacity: 0.2 !important; +} + +div.topdropmenu.albumbitsmenu { + top: 12px; +} + +div.clickalbummenu div.rightmenu +{ + left:-240px; + width:240px; +} + +/* +===================================================================== += Info Panel - General +===================================================================== +*/ + +#artistbio ul { + list-style-type:none; +} + +.infotext { + margin-left:4px; + margin-right:4px; + margin-bottom:4px; + padding:4px; +} + +.infosection { + padding-left:12px; + padding-right:12px; + margin-bottom:4px; +} + +.infowiki h2 { + margin-top: 10px; + margin-bottom:8px; + border-bottom:1px solid #454545; + padding-bottom:0.5em; + overflow:hidden; +} + +.infowiki h3 { + margin-top: 6px; + margin-bottom:4px; + padding-top:0.5em; +} + +.title-menu { + vertical-align:middle; + margin-left:8px; + margin-right:8px; + font-weight:bold; +} + +.info-box-list ul { + list-style-type: none; + line-height:1.5em; + padding-left:2px; + list-style:none; + margin:2px; + padding:0px; +} + +.info-box-list ul li { + line-height:1.5em; +} + +.stleft { + float:left; + width:auto; + max-width:30%; + margin-right:12px; +} + +.stright { + float:right; + margin-left:12px; + padding-right:0px; +} + +.standout { + margin-bottom:12px; + margin-top:12px; +} + +.standout ul { + list-style:none; + margin:2px; + padding:0px; +} + +.standout ul li { + line-height:1.5em; +} + +.statsbox { + margin-left:0px; + padding:4px; +} + +table.padded { + border-collapse: collapse; +} + +table.padded tr { + border-bottom:1px solid #454545; +} + +table.padded tr td { + line-height:1.6em; + padding-left:8px; + padding-right:8px; +} + +table.padded tr th { + line-height:1.8em; + padding-left:8px; + padding-right:8px; + font-weight:bold; +} + +table.histable { + border-collapse: collapse; + cursor: pointer; +} + +table.histable tr.top { + border-top:1px solid #454545; +} + +table.histable tr td { + line-height:1.6em; + padding-left:8px; + padding-right:8px; +} + +table.histable tr.current { + font-weight:bold; +} + +.stumpy { + padding-left: 1em; +} + +.underline { + border-bottom: 1px solid #454545; + margin-top:2em; + margin-bottom:0.75em; +} + +div.info-box-expand>.underline:nth-child(1) { + margin-top:0; +} + +.textunderline { + margin-top:8px; + padding-bottom:2px; + margin-bottom:4px; + border-bottom: 1px solid #cccccc; + width:99%; + margin-right:auto; + margin-left:auto; +} + +.mbbox { + margin-left:0px; + margin-right:6px; + padding:4px; +} + +.foldup .indent table tbody tr td img { + max-width: 100%; +} + +/* +===================================================================== += Info Panel - File +===================================================================== +*/ + +table.motherfucker tr td { + vertical-align:middle; + padding:4px; +} + +/* +===================================================================== += Info Panel - LastFM +===================================================================== +*/ + +.simar { + padding-left:4px; + padding-right:4px; + padding-top:4px; + padding-bottom:4px; + display:inline-block; +} + +.notloved { + opacity: 0.3; +} + +/* +===================================================================== += Info Panel - Musicbrainz +===================================================================== +*/ + +.mbtag { + margin-left:4px; + margin-right:4px; + white-space:nowrap; +} + +/* +===================================================================== += Info Panel - Discogs +===================================================================== +*/ + +a.infoclick.clickreleasepage +{ + margin:2px; + line-height:2em; + padding-left:2px; + padding-right:2px; +} + +/* +===================================================================== += Info Panel - Soundcloud +===================================================================== +*/ + +#scprog { + position:absolute; + width:2px; + top:0px; + opacity:0.6; + background-color:black; + z-index:100; + left:0px; + transition-property: left; + transition-duration: 1s; + transition-timing-function: linear; +} + +#gosblin { + width:100%; + height:auto; +} + +/* +===================================================================== += Info Panel - Spotify +===================================================================== +*/ + +.spotpossimg { + height:48px; + font-size:48px; + vertical-align:middle; + margin-right:8px; +} + +.spotthing { + vertical-align:middle; + border-right: 1px solid #999999; +} + +.spotchoices { + border-bottom:1px solid #999999; + padding-bottom: 8px; + padding-top: 8px; +} + +.albumthing { + padding:4px; +} + +.albumthing .clicktrack +{ + text-align:left; +} + +.widermiddle { + flex-grow: 2; + flex-shrink: 0.2; + flex-basis: auto; +} + +.narrowright { + flex-grow: 0.4; + flex-shrink: 1; + flex-basis: auto; + max-width:400px; +} + +.cnotshrinker { + max-width:100%; +} + +/* +===================================================================== += Info Panel - Lyrics +===================================================================== +*/ + +div.lyrics { + width:95%; + margin:auto; +} + +div.lyrics p { + text-align:center; + font-size:110%; +} + +/* +===================================================================== += Info Panel - Videos +===================================================================== +*/ + +.video { + margin-left:auto; + margin-right:auto; + margin-top:2em; + position: relative; + padding-bottom: 56.25%; /* 16:9 */ + padding-top: 25px; + height: 0; +} + +.youtubevid { + border:none; + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; +} + +/* +===================================================================== += Plugins - Playlist Manager +===================================================================== +*/ + +.plmantable { + border-collapse:collapse; + width:96%; + position:relative; + word-wrap:break-word; + word-break:break-all; +} + +.plmantableback { + position: absolute; + top: 0; + left: 0; + bottom: 0; + right: 0; + opacity: 0.2; +} + +/* +===================================================================== += Plugins - Backup Manager +===================================================================== +*/ + +.backuptable { + border-collapse:collapse; + width:95%; + padding:4px; +} + +.backuptable tr { + border-bottom:1px solid black; +} + +.backuptable th { + background-color:rgba(10,10,10,0.2); + text-align:center; + border-left:1px solid #aaaaaa; +} + +.backuptable td { + text-align:center; +} + +/* +===================================================================== += Podcasts +===================================================================== +*/ + +.newpod { + font-weight:bold; + font-size:90%; + margin-left:1em; + padding-left:6px; + padding-right:6px; + padding-bottom:2px; + padding-top:1px; + background-color: rgba(255, 0, 0, 0.9); + border-radius: 1em; +} + +.unlistenedpod { + font-weight:bold; + font-size:90%; + margin-left:1em; + padding-left:6px; + padding-right:6px; + padding-bottom:2px; + padding-top:1px; + background-color: rgba(255, 160, 0, 0.9); + border-radius: 1em; +} + +.podtitle { + font-weight:bold; + padding:2px; + margin:2px; +} + +.newpodicon { + height:24px; + width:24px; + margin-top:2px; +} + +.oldpodicon { + height:20px; + width:20px; + margin-top:2px; +} + +.podoptions { + margin-top:4px; +} + +.podoptions td { + vertical-align:middle; +} + +.podcastitem { + margin-bottom:0.5em !important; +} + +/* also SomaFM */ +.whatdoicallthis { + padding-left:0px; + padding-top:2px; + padding-bottom:4px; + font-size:96%; + font-weight:normal; +} + +.whatdoicallthis strong { + font-weight: normal; +} + +.whatdoicallthis p { + -webkit-margin-before: 0.2em; + -webkit-margin-after: 0.2em; + -margin-before: 0.2em; + -margin-after: 0.2em; +} + +.whatdoicallthis img { + max-width:100%; +} + +/* +===================================================================== += Styling of data scraped from Icecast +===================================================================== +*/ + +#content { + padding-left:8px; +} + +td.tune-in { + vertical-align:middle; + padding:8px; +} + +span.name { + font-size:130%; + font-weight:bold; +} + +span.listeners { + font-size:90%; +} + +table.servers-list { + width:100%; + list-style-type:none; + border-collapse:collapse; +} + +table.servers-list tr { + border-bottom:1px solid #ffffff; + margin-bottom:0.3em; +} + +table.servers-list tr td { + padding-bottom:0.8em; +} + +table.servers-list div.stream-tags ul { + display: inline; +} + +table.servers-list div.stream-tags ul li { + display: inline; +} + +.inline-tags { + list-style-type: none; + padding-left: 4px; + margin: 0; +} + +.stream-onair { + font-size:90%; +} + +.stream-tags { + font-size:90%; +} + +ul.pager { + list-style-type:none; + padding-bottom:1em; +} + +ul.pager li { + display: inline; +} + +ul.pager li a.active { + font-weight:bold; +} + +.stream-description { + font-style:italic; +} + +a.previewbutton { + display:none; +} + +table.mbox-small { + clear: right; + float: right; + margin: 4px 0 4px 1em; + width: 238px; + font-size: 88%; + line-height: 1.25em; +} + +div.fn { + display:table; + width:100%; +} + +.mediaContainer { + margin-top:6px; +} + + +/* +===================================================================== += CSS Animations +===================================================================== +*/ + +@-webkit-keyframes pulseit{ + 0%{ + opacity:1; + } + 50%{ + opacity:0; + } + 100%{ + opacity:1; + } +} +@-moz-keyframes pulseit{ + 0%{ + opacity:1; + } + 50%{ + opacity:0; + } + 100%{ + opacity:1; + } +} +@keyframes pulseit{ + 0%{ + opacity:1; + } + 50%{ + opacity:0; + } + 100%{ + opacity:1; + } +} + +.spinner { + animation: spin 4s linear infinite; +} + +.nospin { + transform: rotate(0deg); +} + +.oneeighty { + transform: rotate(180deg); +} + +.ninety { + transform: rotate(90deg); +} + +@-webkit-keyframes spin{ + 0%{ + -webkit-transform: rotate(0deg); + } + 100%{ + -webkit-transform: rotate(359deg); + } +} +@-moz-keyframes spin{ + 0% { + -moz-transform: rotate(0deg); + } + 50% { + -moz-transform: rotate(180deg); + } + 100% { + -moz-transform: rotate(359deg); + } +} +@keyframes spin{ + 0% { + transform: rotate(0deg); + } + 50% { + transform: rotate(180deg); + } + 100% { + transform: rotate(359deg); + } +} + +/* +===================================================================== += Things that I don't know what they're for but can't be arsed to search all the code +===================================================================== +*/ + +.bar h3.label { + padding-left:12px; + padding-bottom:4px; + animation: pulseit 4s ease infinite; +} + +tr.chart td { + padding-right:1em; +} + +.tracktime .standout ul li { + display: inline-block; + margin-left: 2em; +} + +/* +===================================================================== += Things that look like they might be for styling wikipedia data +===================================================================== +*/ + +.mw-headline { + padding-top:8px; + padding-bottom:8px; + padding-left:12px; + padding-right:12px; + margin-bottom:8px; +} + +.infobox { + float:right; + margin-right:0px; + margin-bottom:12px; + margin-left:12px; + margin-top:12px; + border: 1px solid #454545; + font-size: 92%; + line-height: 1.5em; + clear: right; +} + +.infobox_v3 { + float:right; + margin-right:0px; + margin-bottom:12px; + margin-left:12px; + margin-top:12px; + border: 1px solid #454545; + font-size: 92%; + line-height: 1.5em; + clear: right; + max-width: 325px; + word-wrap: break-word; +} + +.thumb { + margin-right:12px; + margin-bottom:12px; + margin-left:12px; + margin-top:12px; + text-align:center; +} + +div .thumb { + clear: right; +} + +table.navbox { + width: 100%; + margin: auto; + clear: both; +} + +.navbox-title { + padding-bottom:4px; +} + +.navbox-abovebelow div ul { + padding-left:0.5em; +} + +.navbox-abovebelow ul li { + list-style:none; + float:left; + padding-left:1em; +} + +.navbox-list { + padding-bottom:4px; + border-color:#454545; +} + +.navbox-list div ul { + display:inline-block; + margin: 0.125em; + padding-left:0.5em; +} + +.navbox-list div ul li { + list-style:none; + float:left; + padding-right:1.5em; +} + + +.mw-editsection { + display:none; +} + +th.mbox-text +{ + padding-top: 0.25em; + padding-right: 0.9em; +} + +#toc ul, .toc ul { + list-style-type: none; + list-style-image: none; + text-align: left; + line-height: 1.5em; + margin-left: -20px; +} + +#toc, .toc { + display: inline-block; + zoom: 1; + padding: 7px; + border: 1px solid #454545; + font-size:90%; +} + +#toc #toctitle, .toc #toctitle, #toc .toctitle, .toc .toctitle { + text-align: center; +} + +.infobox td, .infobox th { + vertical-align: top; +} + +span.item { + border:none; +} + +table.wikitable { + margin: 1em 0; + border: 1px solid #454545; + border-collapse: collapse; +} + +table.wikitable tr td { + border: 1px solid #454545; + padding:0.2em; +} + +table.wikitable tr th { + border: 1px solid #454545; + padding:0.2em; +} + +.navbox-group { + padding-right:1em; + padding-left:1em; + border-color:#454545; +} + +th.navbox-group { + white-space: nowrap; + text-align: right; +} + +.navbox-inner, .navbox-subgroup { + width: 100%; +} + +.infowiki div.tright { + clear:right; + float:right; +} + +table.ambox-content { + border-left: 10px solid #f28500; +} + +table.ambox { + margin: 1em 10%; +} + +.infobox caption { + font-size:120%; + font-weight:bold; +} + +#choptions +{ + margin-top:4px; +} + +#choptions label +{ + margin-right: 2em; +} + +.helpfulalbum +{ + text-align:center; + opacity: 1; + transition: opacity 0.5s ease; + padding-left:4px; + padding-right:4px; + padding-bottom:4px; + padding-top:4px; + box-sizing:border-box; + max-width:100%; +} + +.tagholder_wide .helpfulalbum +{ + margin-right:1em; +} + +.tagholder_wide .helpfulalbum.tleft +{ + padding-top:4px; +} + +.wrap +{ + flex-wrap:wrap; +} + +.brianblessed +{ + margin-right:1em; +} + +[id^="pluginplaylists"] .textunderline +{ + font-size:120%; +} + +[id^="walbum"] { + margin-top:8px; +} + +.arsecandle +{ + text-align:center; + font-weight:bold; + transition: opacity 0.5s ease; + opacity: 1; +} + +.cheeseandfish +{ + width:95%; + height:auto; +} + +.jalopy +{ + width:95%; + height:auto; + max-width:400px; + transition: opacity 0.5s ease; + opacity: 1; + object-fit: scale-down; +} + +.jalopy120 +{ + max-width:120px; +} + +.jalopy200 +{ + max-width: 200px; +} + +.sponklick +{ + vertical-align: middle; + line-height:1.5em; +} + +.notthere +{ + opacity:0; +} + +.rowspacer +{ + height: 0.8em; +} + +#helpful_spinner{ + margin-top:1em; + margin-bottom:1em; + text-align:center; +} + +.pluginsection { + font-weight:bold; + font-size:150%; +} + +.pluginsection .filterinfo +{ + font-weight:normal; + font-size:100%; +} + +.pluginitem +{ + margin-bottom:1em; + padding:4px; + box-sizing:border-box; +} + +.thebigholder { + transition: opacity 1s ease; +} + +.carol span i.tagremover { + margin-right: 1em; +} + +.ratinstr { + margin-top:8px; + margin-bottom:8px; +} + +.ratsoptions { + padding-top:8px; + margin-top:8px; + margin-bottom:12px; +} + +.rattitle { + margin-left:1em; +} + +.filterinfo { + margin-left: 1em; +} + +.ratsoptions { + border-top: 1px solid #444444; +} + +.letterholder { + padding:8px; + box-sizing:border-box; + text-align:center; + font-size:200%; + line-height:1.1em; + font-weight:bold; + margin-bottom:0.5em; +} + +.artistnamething { + font-size:140%; + line-height:1.1em; + word-wrap:break-word; +} + +.radioplugin_normal { + display:flex; + width:33%; + /*min-width:120px;*/ + margin:2px; +} + +.radioplugin_wide { + display:flex; + width:100%; + /*min-width:120px;*/ +} + +.podresult { + margin-bottom:1em; +} + +.podresult button { + height:2em; +} + +tr.spacerboogie { + border-bottom: 8px solid transparent; +} + +table.fileinfotable tr td:nth-child(1):not(.notbold) { + font-weight:bold; + padding-right:1em; +} + +table.fileinfotable tr td:nth-child(2) { + width:100%; +} + +.nosides +{ + border-left: none !important; + border-right: none !important; + border-bottom: none !important; +} + +.fsize { + font-style: italic; + font-size:90%; +} + +.setupdiv { + max-width: 60em; +} + +.relpos +{ + position: relative; +} + +.playdiv +{ + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + background-size: contain; + background-repeat: no-repeat; + background-position: center; + opacity: 0.2; +} + +.smallicon { + padding:0px; + margin:4px; + height:20px; + width:20px; + vertical-align:middle; +} + +.medicon { + padding:0px; + margin:2px; + height:30px; + width:30px; + vertical-align:middle; +} + +.playlistup { + position: relative; + left: 0; + bottom: 100%; + z-index: 5000; +} + +.playlistdown { + position: relative; + left: 0; + top: 100%; + z-index: 5000; +} + +.podcastresume { + margin-top: 0.5em; + margin-bottom: 0.5em; +} + +div.notification { + opacity: 1; + transition: opacity 0.5s ease; +} + +div.notification.new { + opacity: 0 !important; + transition: opacity 0.5s ease; +} + +#lfmitable { + max-width:95%; + margin:auto; + border-collapse: collapse; +} + +#lfmitable tr td, #lfmitable tr th { + padding-left: 0.5em; + padding-right: 0.5em; +} + +#lfmitable tr td:nth-child(7){ + text-align:center; +} + +#lfmitable tr td:nth-child(8){ + text-align:center; +} + +div.unplayable { + opacity: 0.4; +} + +.robotlove { + margin-bottom: 8px; +} + +.altablebit { + text-align: right; + padding-right: 1em; +} + +.alarmbutton { + width: 120px; + height: 120px; +} + +.alarmdropempty { + height: 100px; +} + +.giveitsomespace { + margin-left: 4px; +} + +.toomanyclasses { + margin-top: 4px; +} + +.newalarmholder { + height: 3em; +} + +.snapcastgroup { + margin-bottom: 0.5em; +} + +.snapgrouptitle { + margin-bottom: 0.25em; + background-color: rgba(0,0,0,0.1); + padding: 2px; +} + +.snapcastclient { + padding-bottom:1em; +} + +.snapclientname { + font-weight: bold; + font-size: 120%; +} + +.snapclienthost { + font-size: 85% +} + +.alarmdescription { + line-height: 1.2em; + height:2.2em; +} \ No newline at end of file diff --git a/www/rompr/css/tipTip.css b/www/rompr/css/tipTip.css new file mode 100644 index 0000000..eb906db --- /dev/null +++ b/www/rompr/css/tipTip.css @@ -0,0 +1,109 @@ +/* TipTip CSS - Version 1.2 */ + +#tiptip_holder { + display: none; + position: absolute; + top: 0; + left: 0; + z-index: 99999; +} + +#tiptip_holder.tip_top { + padding-bottom: 5px; +} + +#tiptip_holder.tip_bottom { + padding-top: 5px; +} + +#tiptip_holder.tip_right { + padding-left: 5px; +} + +#tiptip_holder.tip_left { + padding-right: 5px; +} + +#tiptip_content { + font-size: 11px; + color: #fff; + text-shadow: 0 0 2px #000; + padding: 4px 8px; + border: 1px solid rgba(255,255,255,0.25); + background-color: rgb(25,25,25); + background-color: rgba(25,25,25,0.92); + background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(transparent), to(#000)); + border-radius: 3px; + box-shadow: 0 0 3px #555; +} + +#tiptip_arrow, #tiptip_arrow_inner { + position: absolute; + border-color: transparent; + border-style: solid; + border-width: 6px; + height: 0; + width: 0; +} + +#tiptip_holder.tip_top #tiptip_arrow { + border-top-color: #fff; + border-top-color: rgba(255,255,255,0.35); +} + +#tiptip_holder.tip_bottom #tiptip_arrow { + border-bottom-color: #fff; + border-bottom-color: rgba(255,255,255,0.35); +} + +#tiptip_holder.tip_right #tiptip_arrow { + border-right-color: #fff; + border-right-color: rgba(255,255,255,0.35); +} + +#tiptip_holder.tip_left #tiptip_arrow { + border-left-color: #fff; + border-left-color: rgba(255,255,255,0.35); +} + +#tiptip_holder.tip_top #tiptip_arrow_inner { + margin-top: -7px; + margin-left: -6px; + border-top-color: rgb(25,25,25); + border-top-color: rgba(25,25,25,0.92); +} + +#tiptip_holder.tip_bottom #tiptip_arrow_inner { + margin-top: -5px; + margin-left: -6px; + border-bottom-color: rgb(25,25,25); + border-bottom-color: rgba(25,25,25,0.92); +} + +#tiptip_holder.tip_right #tiptip_arrow_inner { + margin-top: -6px; + margin-left: -5px; + border-right-color: rgb(25,25,25); + border-right-color: rgba(25,25,25,0.92); +} + +#tiptip_holder.tip_left #tiptip_arrow_inner { + margin-top: -6px; + margin-left: -7px; + border-left-color: rgb(25,25,25); + border-left-color: rgba(25,25,25,0.92); +} + +/* Webkit Hacks */ +@media screen and (-webkit-min-device-pixel-ratio:0) { + #tiptip_content { + padding: 4px 8px 5px 8px; + background-color: rgba(45,45,45,0.88); + } + #tiptip_holder.tip_bottom #tiptip_arrow_inner { + border-bottom-color: rgba(45,45,45,0.88); + } + #tiptip_holder.tip_top #tiptip_arrow_inner { + border-top-color: rgba(20,20,20,0.92); + } +} \ No newline at end of file diff --git a/www/rompr/dirbrowser.php b/www/rompr/dirbrowser.php new file mode 100644 index 0000000..8963e21 --- /dev/null +++ b/www/rompr/dirbrowser.php @@ -0,0 +1,29 @@ + null, 'rating' => null ); + +$path = (array_key_exists('path', $_REQUEST)) ? $_REQUEST['path'] : ""; +$prefix = (array_key_exists('prefix', $_REQUEST)) ? $_REQUEST['prefix'].'_' : "dirholder"; + +$player = new fileCollector(); +if ($player->is_connected()) { + if ($path == "") { + // print '
      '.get_int_text('button_file_browser').'
      '; + } else { + directoryControlHeader($prefix); + } + $player->doFileBrowse($path, $prefix); +} else { + header("HTTP/1.1 500 Internal Server Error"); +} + +?> diff --git a/www/rompr/favicon.ico b/www/rompr/favicon.ico new file mode 100644 index 0000000..3b3c594 Binary files /dev/null and b/www/rompr/favicon.ico differ diff --git a/www/rompr/fonts/Alegreya.css b/www/rompr/fonts/Alegreya.css new file mode 100644 index 0000000..f85dd8f --- /dev/null +++ b/www/rompr/fonts/Alegreya.css @@ -0,0 +1,5 @@ +@import url("https://fonts.googleapis.com/css?family=Alegreya:400,400i,700,700i&subset=cyrillic,cyrillic-ext,greek,greek-ext,latin-ext,vietnamese"); +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input,button,select,option +{ + font-family: "Alegreya", sans-serif; +} \ No newline at end of file diff --git a/www/rompr/fonts/AppleGothic.css b/www/rompr/fonts/AppleGothic.css new file mode 100644 index 0000000..47c7f35 --- /dev/null +++ b/www/rompr/fonts/AppleGothic.css @@ -0,0 +1,4 @@ +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input,button,select,option +{ + font-family: "AppleGothic", "Gothic Uralic", sans-serif; +} \ No newline at end of file diff --git a/www/rompr/fonts/ArimaMadurai.css b/www/rompr/fonts/ArimaMadurai.css new file mode 100644 index 0000000..c2c49b1 --- /dev/null +++ b/www/rompr/fonts/ArimaMadurai.css @@ -0,0 +1,5 @@ +@import url('https://fonts.googleapis.com/css?family=Arima+Madurai:400,700'); +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input,button,select,option +{ + font-family: "Arima Madurai", cursive; +} \ No newline at end of file diff --git a/www/rompr/fonts/Baskerville.css b/www/rompr/fonts/Baskerville.css new file mode 100644 index 0000000..bb82ed5 --- /dev/null +++ b/www/rompr/fonts/Baskerville.css @@ -0,0 +1,4 @@ +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input,button,select,option +{ + font-family: Baskerville, "Baskerville Old Face", "Hoefler Text", Garamond, "Times New Roman", serif; +} diff --git a/www/rompr/fonts/Cabin.css b/www/rompr/fonts/Cabin.css new file mode 100644 index 0000000..9eb1a3e --- /dev/null +++ b/www/rompr/fonts/Cabin.css @@ -0,0 +1,5 @@ +@import url('https://fonts.googleapis.com/css?family=Cabin:400,400i,700,700i&subset=latin-ext'); +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input,button,select,option +{ + font-family: "Cabin", sans-serif; +} \ No newline at end of file diff --git a/www/rompr/fonts/Calibri.css b/www/rompr/fonts/Calibri.css new file mode 100644 index 0000000..7a0ec45 --- /dev/null +++ b/www/rompr/fonts/Calibri.css @@ -0,0 +1,4 @@ +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input,button,select,option +{ + font-family: Calibri, Candara, Segoe, "Segoe UI", Optima, BetecknaLowerCase, Arial, sans-serif; +} diff --git a/www/rompr/fonts/Calisto.css b/www/rompr/fonts/Calisto.css new file mode 100644 index 0000000..a1ed391 --- /dev/null +++ b/www/rompr/fonts/Calisto.css @@ -0,0 +1,4 @@ +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input,button,select,option +{ + font-family: "Calisto MT", "Bookman Old Style", Bookman, "Goudy Old Style", Garamond, "Hoefler Text", "Bitstream Charter", Georgia, serif; +} diff --git a/www/rompr/fonts/Comfortaa.css b/www/rompr/fonts/Comfortaa.css new file mode 100644 index 0000000..f523efa --- /dev/null +++ b/www/rompr/fonts/Comfortaa.css @@ -0,0 +1,5 @@ +@import url('https://fonts.googleapis.com/css?family=Comfortaa:400,700&subset=cyrillic,cyrillic-ext,greek,latin-ext,vietnamese'); +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input,button,select,option +{ + font-family: "Comfortaa", sans-serif; +} \ No newline at end of file diff --git a/www/rompr/fonts/Copperplate.css b/www/rompr/fonts/Copperplate.css new file mode 100644 index 0000000..3b5a402 --- /dev/null +++ b/www/rompr/fonts/Copperplate.css @@ -0,0 +1,4 @@ +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input,button,select,option +{ + font-family: Copperplate, "Copperplate Gothic Light", "Libris ADF Std", fantasy; +} diff --git a/www/rompr/fonts/CormorantGaramond.css b/www/rompr/fonts/CormorantGaramond.css new file mode 100644 index 0000000..d0d6035 --- /dev/null +++ b/www/rompr/fonts/CormorantGaramond.css @@ -0,0 +1,6 @@ +@import url('https://fonts.googleapis.com/css?family=Cormorant+Garamond:400,400i,700,700i&subset=cyrillic,latin-ext'); +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input,button,select,option +{ + font-family: "Cormorant Garamond", serif; + line-height: 140%; +} diff --git a/www/rompr/fonts/Crimson Text.css b/www/rompr/fonts/Crimson Text.css new file mode 100644 index 0000000..35941b3 --- /dev/null +++ b/www/rompr/fonts/Crimson Text.css @@ -0,0 +1,5 @@ +@import url('https://fonts.googleapis.com/css?family=Crimson+Text:400,400i,700,700i'); +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input,button,select,option +{ + font-family: "Crimson Text", serif; +} \ No newline at end of file diff --git a/www/rompr/fonts/Darker Grotesque.css b/www/rompr/fonts/Darker Grotesque.css new file mode 100644 index 0000000..7ac3662 --- /dev/null +++ b/www/rompr/fonts/Darker Grotesque.css @@ -0,0 +1,5 @@ +@import url('https://fonts.googleapis.com/css?family=Darker+Grotesque:400,700&display=swap&subset=latin-ext'); +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input,button,select,option +{ + font-family: "Darker Grotesque", sans-serif; +} \ No newline at end of file diff --git a/www/rompr/fonts/Dosis.css b/www/rompr/fonts/Dosis.css new file mode 100644 index 0000000..c9f57a2 --- /dev/null +++ b/www/rompr/fonts/Dosis.css @@ -0,0 +1,5 @@ +@import url('https://fonts.googleapis.com/css?family=Dosis:400,700&subset=latin-ext'); +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input,button,select,option +{ + font-family: "Dosis", sans-serif; +} \ No newline at end of file diff --git a/www/rompr/fonts/Fahkwang.css b/www/rompr/fonts/Fahkwang.css new file mode 100644 index 0000000..a142acc --- /dev/null +++ b/www/rompr/fonts/Fahkwang.css @@ -0,0 +1,5 @@ +@import url("https://fonts.googleapis.com/css?family=Fahkwang:400,400i,700,700i&subset=latin-ext,thai,vietnamese"); +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input,button,select,option +{ + font-family: "Fahkwang", sans-serif; +} \ No newline at end of file diff --git a/www/rompr/fonts/Fantasy.css b/www/rompr/fonts/Fantasy.css new file mode 100644 index 0000000..448deb9 --- /dev/null +++ b/www/rompr/fonts/Fantasy.css @@ -0,0 +1,4 @@ +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input,button,select,option +{ + font-family:CupolaUnicode,fantasy; +} diff --git a/www/rompr/fonts/Futura.css b/www/rompr/fonts/Futura.css new file mode 100644 index 0000000..0309dde --- /dev/null +++ b/www/rompr/fonts/Futura.css @@ -0,0 +1,4 @@ +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input,button,select,option +{ + font-family: Futura, "Trebuchet MS", Arial, sans-serif; +} diff --git a/www/rompr/fonts/Garamond.css b/www/rompr/fonts/Garamond.css new file mode 100644 index 0000000..02f53e7 --- /dev/null +++ b/www/rompr/fonts/Garamond.css @@ -0,0 +1,4 @@ +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input,button,select,option +{ + font-family: Garamond, Baskerville, "Baskerville Old Face", "Hoefler Text", "Times New Roman", serif; +} diff --git a/www/rompr/fonts/Geneva.css b/www/rompr/fonts/Geneva.css new file mode 100644 index 0000000..d80de89 --- /dev/null +++ b/www/rompr/fonts/Geneva.css @@ -0,0 +1,4 @@ +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input,button,select,option +{ + font-family: Geneva, "URW Gothic L", Tahoma, Verdana, sans-serif; +} diff --git a/www/rompr/fonts/Georgia.css b/www/rompr/fonts/Georgia.css new file mode 100644 index 0000000..aa4cbc4 --- /dev/null +++ b/www/rompr/fonts/Georgia.css @@ -0,0 +1,4 @@ +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input,button,select,option +{ + font-family:Georgia, serif; +} diff --git a/www/rompr/fonts/GillSans.css b/www/rompr/fonts/GillSans.css new file mode 100644 index 0000000..a758bed --- /dev/null +++ b/www/rompr/fonts/GillSans.css @@ -0,0 +1,4 @@ +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input,button,select,option +{ + font-family: "Gill Sans", "Droid Sans", sans-serif; +} \ No newline at end of file diff --git a/www/rompr/fonts/Handwriting.css b/www/rompr/fonts/Handwriting.css new file mode 100644 index 0000000..5016a9e --- /dev/null +++ b/www/rompr/fonts/Handwriting.css @@ -0,0 +1,4 @@ +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input,button,select,option +{ + font-family:breip,UnPilgia,cursive; +} diff --git a/www/rompr/fonts/Herculanum.css b/www/rompr/fonts/Herculanum.css new file mode 100644 index 0000000..e33c870 --- /dev/null +++ b/www/rompr/fonts/Herculanum.css @@ -0,0 +1,4 @@ +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input,button,select,option +{ + font-family: Herculanum, "Licorice Strings BRK", fantasy; +} diff --git a/www/rompr/fonts/IBMPlexSans.css b/www/rompr/fonts/IBMPlexSans.css new file mode 100644 index 0000000..4d9747a --- /dev/null +++ b/www/rompr/fonts/IBMPlexSans.css @@ -0,0 +1,6 @@ +@import url('https://fonts.googleapis.com/css?family=IBM+Plex+Sans:400,400i,700,700i&subset=cyrillic,cyrillic-ext,latin-ext,vietnamese'); +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input,button,select,option +{ + font-family: "IBM Plex Sans", sans-serif; + line-height: 140%; +} diff --git a/www/rompr/fonts/IBMPlexSerif.css b/www/rompr/fonts/IBMPlexSerif.css new file mode 100644 index 0000000..3ec70ae --- /dev/null +++ b/www/rompr/fonts/IBMPlexSerif.css @@ -0,0 +1,6 @@ +@import url('https://fonts.googleapis.com/css?family=IBM+Plex+Serif:400,400i,700,700i&subset=cyrillic,cyrillic-ext,latin-ext,vietnamese'); +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input,button,select,option +{ + font-family: "IBM Plex Serif", serif; + line-height: 140%; +} diff --git a/www/rompr/fonts/JosefinSans.css b/www/rompr/fonts/JosefinSans.css new file mode 100644 index 0000000..14d0a03 --- /dev/null +++ b/www/rompr/fonts/JosefinSans.css @@ -0,0 +1,6 @@ +@import url('https://fonts.googleapis.com/css?family=Josefin+Sans:400,400i,700,700i&subset=latin-ext,vietnamese'); +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input,button,select,option +{ + font-family: "Josefin Sans", sans-serif; + line-height: 140%; +} diff --git a/www/rompr/fonts/JosefinSlab.css b/www/rompr/fonts/JosefinSlab.css new file mode 100644 index 0000000..b931ed5 --- /dev/null +++ b/www/rompr/fonts/JosefinSlab.css @@ -0,0 +1,5 @@ +@import url('https://fonts.googleapis.com/css?family=Josefin+Slab:400,400i,700,700i');body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input,button,select,option +{ + font-family: "Josefin Slab", serif; + line-height: 140%; +} diff --git a/www/rompr/fonts/Libre Franklin.css b/www/rompr/fonts/Libre Franklin.css new file mode 100644 index 0000000..baf35fe --- /dev/null +++ b/www/rompr/fonts/Libre Franklin.css @@ -0,0 +1,5 @@ +@import url('https://fonts.googleapis.com/css?family=Libre+Franklin:400,400i,700,700i&subset=latin-ext'); +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input,button,select,option +{ + font-family: "Libre Franklin", sans-serif; +} \ No newline at end of file diff --git a/www/rompr/fonts/Lora.css b/www/rompr/fonts/Lora.css new file mode 100644 index 0000000..bde92df --- /dev/null +++ b/www/rompr/fonts/Lora.css @@ -0,0 +1,5 @@ +@import url('https://fonts.googleapis.com/css?family=Lora:400,400i,700,700i&subset=cyrillic,cyrillic-ext,latin-ext,vietnamese'); +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input,button,select,option +{ + font-family: "Lora", serif; +} \ No newline at end of file diff --git a/www/rompr/fonts/Lucida.css b/www/rompr/fonts/Lucida.css new file mode 100644 index 0000000..dc6a8d2 --- /dev/null +++ b/www/rompr/fonts/Lucida.css @@ -0,0 +1,4 @@ +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input,button,select,option +{ + font-family:"Lucida Grande", "Lucida Sans Unicode", "Linux Biolinum O", sans-serif; +} diff --git a/www/rompr/fonts/Luminari.css b/www/rompr/fonts/Luminari.css new file mode 100644 index 0000000..e9785c5 --- /dev/null +++ b/www/rompr/fonts/Luminari.css @@ -0,0 +1,4 @@ +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input,button,select,option +{ + font-family: "Luminari", "Mathematica6", "eufm10", serif; +} \ No newline at end of file diff --git a/www/rompr/fonts/Marker.css b/www/rompr/fonts/Marker.css new file mode 100644 index 0000000..a60483a --- /dev/null +++ b/www/rompr/fonts/Marker.css @@ -0,0 +1,4 @@ +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input,button,select,option +{ + font-family: "Marker Felt", "Backlash BRK", fantasy; +} diff --git a/www/rompr/fonts/Mirza.css b/www/rompr/fonts/Mirza.css new file mode 100644 index 0000000..4c7b5d1 --- /dev/null +++ b/www/rompr/fonts/Mirza.css @@ -0,0 +1,5 @@ +@import url('https://fonts.googleapis.com/css?family=Mirza:400,700&subset=arabic,latin-ext'); +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input,button,select,option +{ + font-family: "Mirza", cursive; +} \ No newline at end of file diff --git a/www/rompr/fonts/Monospace.css b/www/rompr/fonts/Monospace.css new file mode 100644 index 0000000..fb0c880 --- /dev/null +++ b/www/rompr/fonts/Monospace.css @@ -0,0 +1,4 @@ +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input,button,select,option +{ + font-family:"Courier New", Courier, monospace; +} diff --git a/www/rompr/fonts/Montserrat.css b/www/rompr/fonts/Montserrat.css new file mode 100644 index 0000000..91f0133 --- /dev/null +++ b/www/rompr/fonts/Montserrat.css @@ -0,0 +1,5 @@ +@import url('https://fonts.googleapis.com/css?family=Montserrat:400,400i,700,700i&subset=cyrillic,cyrillic-ext,latin-ext,vietnamese'); +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input,button,select,option +{ + font-family: 'Montserrat', sans-serif; +} \ No newline at end of file diff --git a/www/rompr/fonts/Mukta.css b/www/rompr/fonts/Mukta.css new file mode 100644 index 0000000..f68f9b8 --- /dev/null +++ b/www/rompr/fonts/Mukta.css @@ -0,0 +1,5 @@ +@import url("https://fonts.googleapis.com/css?family=Mukta:400,700&subset=devanagari,latin-ext"); +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input,button,select,option +{ + font-family: "Mukta", sans-serif; +} \ No newline at end of file diff --git a/www/rompr/fonts/Muli.css b/www/rompr/fonts/Muli.css new file mode 100644 index 0000000..2f75d38 --- /dev/null +++ b/www/rompr/fonts/Muli.css @@ -0,0 +1,5 @@ +@import url("https://fonts.googleapis.com/css?family=Muli:400,400i,700,700i&subset=latin-ext,vietnamese"); +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input,button,select,option +{ + font-family: "Muli", sans-serif; +} \ No newline at end of file diff --git a/www/rompr/fonts/Noteworthy.css b/www/rompr/fonts/Noteworthy.css new file mode 100644 index 0000000..436019a --- /dev/null +++ b/www/rompr/fonts/Noteworthy.css @@ -0,0 +1,4 @@ +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input,button,select,option +{ + font-family: "Noteworthy", "Delphine", "Comic Sans MS", sans-serif; +} \ No newline at end of file diff --git a/www/rompr/fonts/NoticiaText.css b/www/rompr/fonts/NoticiaText.css new file mode 100644 index 0000000..5d9427c --- /dev/null +++ b/www/rompr/fonts/NoticiaText.css @@ -0,0 +1,5 @@ +@import url('https://fonts.googleapis.com/css?family=Noticia+Text:400,400i,700,700i&subset=latin-ext,vietnamese'); +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input,button,select,option +{ + font-family: "Noticia Text", serif; +} \ No newline at end of file diff --git a/www/rompr/fonts/Nunito Sans.css b/www/rompr/fonts/Nunito Sans.css new file mode 100644 index 0000000..33b2e23 --- /dev/null +++ b/www/rompr/fonts/Nunito Sans.css @@ -0,0 +1,5 @@ +@import url('https://fonts.googleapis.com/css?family=Nunito+Sans:400,400i,700,700i&subset=latin-ext,vietnamese'); +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input,button,select,option +{ + font-family: "Nunito Sans", sans-serif; +} \ No newline at end of file diff --git a/www/rompr/fonts/Nunito.css b/www/rompr/fonts/Nunito.css new file mode 100644 index 0000000..871995e --- /dev/null +++ b/www/rompr/fonts/Nunito.css @@ -0,0 +1,5 @@ +@import url('https://fonts.googleapis.com/css?family=Nunito:400,400i,700,700i&subset=latin-ext,vietnamese'); +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input,button,select,option +{ + font-family: "Nunito", sans-serif; +} \ No newline at end of file diff --git a/www/rompr/fonts/Optima.css b/www/rompr/fonts/Optima.css new file mode 100644 index 0000000..86516e3 --- /dev/null +++ b/www/rompr/fonts/Optima.css @@ -0,0 +1,4 @@ +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input,button,select,option +{ + font-family: Optima, Segoe, "Segoe UI", Candara, Calibri, Arial, sans-serif; +} diff --git a/www/rompr/fonts/Overlock.css b/www/rompr/fonts/Overlock.css new file mode 100644 index 0000000..e401c29 --- /dev/null +++ b/www/rompr/fonts/Overlock.css @@ -0,0 +1,5 @@ +@import url('https://fonts.googleapis.com/css?family=Overlock:400,400i,700,700i&subset=latin-ext'); +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input,button,select,option +{ + font-family: "Overlock", cursive; +} \ No newline at end of file diff --git a/www/rompr/fonts/OverlockSC.css b/www/rompr/fonts/OverlockSC.css new file mode 100644 index 0000000..2658acf --- /dev/null +++ b/www/rompr/fonts/OverlockSC.css @@ -0,0 +1,5 @@ +@import url('https://fonts.googleapis.com/css?family=Overlock+SC&subset=latin-ext'); +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input,button,select,option +{ + font-family: "Overlock SC", cursive; +} \ No newline at end of file diff --git a/www/rompr/fonts/PT Sans Narrow.css b/www/rompr/fonts/PT Sans Narrow.css new file mode 100644 index 0000000..5ef22d3 --- /dev/null +++ b/www/rompr/fonts/PT Sans Narrow.css @@ -0,0 +1,5 @@ +@import url('https://fonts.googleapis.com/css?family=PT+Sans+Narrow:400,700&subset=cyrillic,cyrillic-ext,latin-ext'); +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input,button,select,option +{ + font-family: "PT Sans Narrow", sans-serif; +} \ No newline at end of file diff --git a/www/rompr/fonts/PT Sans.css b/www/rompr/fonts/PT Sans.css new file mode 100644 index 0000000..cb00897 --- /dev/null +++ b/www/rompr/fonts/PT Sans.css @@ -0,0 +1,5 @@ +@import url('https://fonts.googleapis.com/css?family=PT+Sans:400,400i,700,700i&subset=cyrillic,cyrillic-ext,latin-ext'); +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input,button,select,option +{ + font-family: "PT Sans", sans-serif; +} \ No newline at end of file diff --git a/www/rompr/fonts/Palatino.css b/www/rompr/fonts/Palatino.css new file mode 100644 index 0000000..5e946e0 --- /dev/null +++ b/www/rompr/fonts/Palatino.css @@ -0,0 +1,4 @@ +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input,button,select,option +{ + font-family:"Palatino Linotype", "Book Antiqua", Palatino, serif; +} diff --git a/www/rompr/fonts/Papyrus.css b/www/rompr/fonts/Papyrus.css new file mode 100644 index 0000000..9721237 --- /dev/null +++ b/www/rompr/fonts/Papyrus.css @@ -0,0 +1,4 @@ +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input,button,select,option +{ + font-family: "Papyrus Condensed", "Lobster Two", "mikachan", fantasy; +} \ No newline at end of file diff --git a/www/rompr/fonts/Playfair Display.css b/www/rompr/fonts/Playfair Display.css new file mode 100644 index 0000000..653bc5d --- /dev/null +++ b/www/rompr/fonts/Playfair Display.css @@ -0,0 +1,5 @@ +@import url('https://fonts.googleapis.com/css?family=Playfair+Display:400,400i,700,700i&display=swap&subset=cyrillic,latin-ext,vietnamese'); +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input,button,select,option +{ + font-family: "Playfair Display", sans-serif; +} \ No newline at end of file diff --git a/www/rompr/fonts/Pompiere.css b/www/rompr/fonts/Pompiere.css new file mode 100644 index 0000000..26b8ffa --- /dev/null +++ b/www/rompr/fonts/Pompiere.css @@ -0,0 +1,5 @@ + @import url('https://fonts.googleapis.com/css?family=Pompiere'); + body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input,button,select,option +{ + font-family: "Pompiere", cursive; +} \ No newline at end of file diff --git a/www/rompr/fonts/Poppins.css b/www/rompr/fonts/Poppins.css new file mode 100644 index 0000000..d78b49a --- /dev/null +++ b/www/rompr/fonts/Poppins.css @@ -0,0 +1,5 @@ +@import url("https://fonts.googleapis.com/css?family=Poppins:400,400i,700,700i&subset=devanagari,latin-ext"); +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input,button,select,option +{ + font-family: "Poppins", sans-serif; +} \ No newline at end of file diff --git a/www/rompr/fonts/Qucksand.css b/www/rompr/fonts/Qucksand.css new file mode 100644 index 0000000..f614f47 --- /dev/null +++ b/www/rompr/fonts/Qucksand.css @@ -0,0 +1,5 @@ +@import url('https://fonts.googleapis.com/css?family=Quicksand:400,700&subset=latin-ext,vietnamese'); +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input,button,select,option +{ + font-family: "Quicksand", sans-serif; +} \ No newline at end of file diff --git a/www/rompr/fonts/Raleway.css b/www/rompr/fonts/Raleway.css new file mode 100644 index 0000000..1a18ac8 --- /dev/null +++ b/www/rompr/fonts/Raleway.css @@ -0,0 +1,5 @@ +@import url('https://fonts.googleapis.com/css?family=Raleway:400,400i,700,700i&subset=latin-ext'); +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input,button,select,option +{ + font-family: "Raleway", sans-serif; +} \ No newline at end of file diff --git a/www/rompr/fonts/Rockwell.css b/www/rompr/fonts/Rockwell.css new file mode 100644 index 0000000..9108550 --- /dev/null +++ b/www/rompr/fonts/Rockwell.css @@ -0,0 +1,4 @@ +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input,button,select,option +{ + font-family: Rockwell, "Courier Bold", Courier, Georgia, Times, "Times New Roman", serif; +} diff --git a/www/rompr/fonts/Rubik.css b/www/rompr/fonts/Rubik.css new file mode 100644 index 0000000..3cd251c --- /dev/null +++ b/www/rompr/fonts/Rubik.css @@ -0,0 +1,5 @@ +@import url('https://fonts.googleapis.com/css?family=Rubik:400,400i,700,700i&display=swap&subset=cyrillic,hebrew,latin-ext'); +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input,button,select,option +{ + font-family: "Rubik", sans-serif; +} \ No newline at end of file diff --git a/www/rompr/fonts/Savoye.css b/www/rompr/fonts/Savoye.css new file mode 100644 index 0000000..4ac6ee7 --- /dev/null +++ b/www/rompr/fonts/Savoye.css @@ -0,0 +1,4 @@ +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input,button,select,option +{ + font-family: "Savoye LET", "Purisa", sans-serif; +} \ No newline at end of file diff --git a/www/rompr/fonts/Script.css b/www/rompr/fonts/Script.css new file mode 100644 index 0000000..9942538 --- /dev/null +++ b/www/rompr/fonts/Script.css @@ -0,0 +1,4 @@ +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input,button,select,option +{ + font-family: "Brush Script MT", "Romande ADF Script Std", cursive; +} diff --git a/www/rompr/fonts/Skia.css b/www/rompr/fonts/Skia.css new file mode 100644 index 0000000..6207116 --- /dev/null +++ b/www/rompr/fonts/Skia.css @@ -0,0 +1,4 @@ +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input,button,select,option +{ + font-family: "Skia", "Sawsadee", sans-serif; +} \ No newline at end of file diff --git a/www/rompr/fonts/Source Sans Pro.css b/www/rompr/fonts/Source Sans Pro.css new file mode 100644 index 0000000..157b6b8 --- /dev/null +++ b/www/rompr/fonts/Source Sans Pro.css @@ -0,0 +1,5 @@ +@import url('https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,700,700i&display=swap&subset=cyrillic,cyrillic-ext,greek,greek-ext,latin-ext,vietnamese'); +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input,button,select,option +{ + font-family: "Source Sans Pro", sans-serif; +} diff --git a/www/rompr/fonts/Tahoma.css b/www/rompr/fonts/Tahoma.css new file mode 100644 index 0000000..04ca347 --- /dev/null +++ b/www/rompr/fonts/Tahoma.css @@ -0,0 +1,4 @@ +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input,button,select,option +{ + font-family:Tahoma, Geneva, sans-serif; +} diff --git a/www/rompr/fonts/Tamil.css b/www/rompr/fonts/Tamil.css new file mode 100644 index 0000000..7f22e31 --- /dev/null +++ b/www/rompr/fonts/Tamil.css @@ -0,0 +1,4 @@ +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input,button,select,option +{ + font-family: "Tamil MN", sans-serif; +} \ No newline at end of file diff --git a/www/rompr/fonts/Times.css b/www/rompr/fonts/Times.css new file mode 100644 index 0000000..71cad19 --- /dev/null +++ b/www/rompr/fonts/Times.css @@ -0,0 +1,4 @@ +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input,button,select,option +{ + font-family: TimesNewRoman, "Times New Roman", Times, Baskerville, Georgia, serif; +} diff --git a/www/rompr/fonts/Titilium Web.css b/www/rompr/fonts/Titilium Web.css new file mode 100644 index 0000000..0829dcd --- /dev/null +++ b/www/rompr/fonts/Titilium Web.css @@ -0,0 +1,5 @@ +@import url('https://fonts.googleapis.com/css?family=Titillium+Web:400,400i,700,700i&display=swap&subset=latin-ext'); +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input,button,select,option +{ + font-family: "Titilium Web", sans-serif; +} diff --git a/www/rompr/fonts/Trattatello.css b/www/rompr/fonts/Trattatello.css new file mode 100644 index 0000000..d3e084d --- /dev/null +++ b/www/rompr/fonts/Trattatello.css @@ -0,0 +1,4 @@ +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input,button,select,option +{ + font-family: "Trattatello", sans-serif; +} \ No newline at end of file diff --git a/www/rompr/fonts/Ubuntu Mono.css b/www/rompr/fonts/Ubuntu Mono.css new file mode 100644 index 0000000..2b93047 --- /dev/null +++ b/www/rompr/fonts/Ubuntu Mono.css @@ -0,0 +1,5 @@ +@import url('https://fonts.googleapis.com/css?family=Ubuntu+Mono:400,400i,700,700i&subset=cyrillic,cyrillic-ext,greek,greek-ext,latin-ext'); +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input,button,select,option +{ + font-family: "Ubuntu Mono", sans-serif; +} \ No newline at end of file diff --git a/www/rompr/fonts/Ubuntu.css b/www/rompr/fonts/Ubuntu.css new file mode 100644 index 0000000..d4f67b1 --- /dev/null +++ b/www/rompr/fonts/Ubuntu.css @@ -0,0 +1,5 @@ +@import url('https://fonts.googleapis.com/css?family=Ubuntu:400,400i,700,700i&subset=cyrillic,cyrillic-ext,greek,greek-ext,latin-ext'); +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input,button,select,option +{ + font-family: "Ubuntu", sans-serif; +} \ No newline at end of file diff --git a/www/rompr/fonts/Verdana.css b/www/rompr/fonts/Verdana.css new file mode 100644 index 0000000..7f9e694 --- /dev/null +++ b/www/rompr/fonts/Verdana.css @@ -0,0 +1,4 @@ +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input,button,select,option +{ + font-family:verdana,helvetica,arial,sans-serif; +} diff --git a/www/rompr/getRemoteImage.php b/www/rompr/getRemoteImage.php new file mode 100644 index 0000000..da131e5 --- /dev/null +++ b/www/rompr/getRemoteImage.php @@ -0,0 +1,75 @@ + $v) { + if ($k != 'url' && $k != 'rompr_resize_size' && $k != 'rompr_backup_type') { + $url .= '&'.$k.'='.$v; + } +} + +if (!$url) { + logger::error("GETREMOTEIMAGE", "Asked to download image but no URL given!"); + header("HTTP/1.1 404 Not Found"); +} else { + logger::log("GETREMOTEIMAGE", "Getting Remote Image ".$url); + $outfile = 'prefs/imagecache/'.md5($url); + if (!file_exists($outfile)) { + if (download_image_file($url, $outfile)) { + output_file($outfile); + } else { + send_backup_image(); + } + } else { + output_file($outfile); + } +} + +function output_file($outfile) { + $imagehandler = new imageHandler($outfile); + $size = array_key_exists('rompr_resize_size', $_REQUEST) ? $_REQUEST['rompr_resize_size'] : 'asdownloaded'; + $imagehandler->outputResizedFile($size); +} + +function download_image_file($url, $outfile) { + + if (substr($url, 0, 10) == 'data:image') { + logger::trace("GETREMOTEIMAGE", " ... Decoding Base64 Data"); + create_image_from_base64($url, $outfile); + } else { + logger::trace("GETREMOTEIMAGE", " ... Downloading it"); + $d = new url_downloader(array('url' => $url)); + if ($d->get_data_to_file($outfile, true)) { + logger::trace("GETREMOTEIMAGE", "Cached Image ".$outfile); + $content_type = $d->get_content_type(); + logger::trace("GETREMOTEIMAGE", " ... Content Type is ".$content_type); + if (substr($content_type,0,5) != 'image' && $content_type != 'application/octet-stream') { + logger::warn("GETREMOTEIMAGE", " Not an image file! ",$url); + unlink($outfile); + return false; + } + } else { + return false; + } + } + return true; +} + +function send_backup_image() { + if (array_key_exists('rompr_backup_type', $_REQUEST)) { + switch ($_REQUEST['rompr_backup_type']) { + case 'stream': + logger::log("GETREMOTEIMAGE","Sending backup image for stream"); + header('Content-type: image/svg+xml'); + readfile('newimages/broadcast.svg'); + break; + } + } else { + header("HTTP/1.1 404 Not Found"); + } +} + +?> diff --git a/www/rompr/getalbumcover.php b/www/rompr/getalbumcover.php new file mode 100644 index 0000000..cb2ce7f --- /dev/null +++ b/www/rompr/getalbumcover.php @@ -0,0 +1,311 @@ + $v) { + if ($k == 'base64data') { + logger::log("GETALBUMCOVER", "We have base64 data"); + } else { + logger::log("GETALBUMCOVER", $k, '=', $v); + } +} + +$albumimage = new albumImage($_REQUEST); +$delaytime = 1; +$ignore_local = (array_key_exists('ignorelocal', $_REQUEST) && $_REQUEST['ignorelocal'] == 'true') ? true : false; + +if ($albumimage->mbid != "") { + $searchfunctions = array( 'tryLocal', 'trySpotify', 'tryMusicBrainz', 'tryLastFM', 'tryGoogle' ); +} else { + // Try LastFM twice - first time just to get an MBID since coverartarchive images tend to be bigger + $searchfunctions = array( 'tryLocal', 'trySpotify', 'tryLastFM', 'tryMusicBrainz', 'tryLastFM', 'tryGoogle' ); +} + +$result = $albumimage->download_image(); +if (!$albumimage->has_source()) { + while (count($searchfunctions) > 0 && $result === false) { + $fn = array_shift($searchfunctions); + $src = $fn($albumimage); + if ($src != "") { + $albumimage->set_source($src); + $result = $albumimage->download_image(); + } + } +} +if ($result === false) { + $result = $albumimage->set_default(); +} +if ($result === false) { + logger::shout("GETALBUMCOVER", "No art was found. Try the Tate Modern"); + $result = array(); +} +$albumimage->update_image_database(); +$result['delaytime'] = $delaytime; +header('Content-Type: application/json; charset=utf-8'); +print json_encode($result); +logger::shout("GETALBUMCOVER", "--------------------------------------------"); +ob_flush(); + +function tryLocal($albumimage) { + global $ignore_local; + global $delaytime; + logger::mark("GETALBUMCOVER", " Checking for local images"); + $covernames = array("cover", "albumart", "thumb", "albumartsmall", "front"); + if ($albumimage->albumpath == "" || $albumimage->albumpath == "." || $albumimage->albumpath === null || $ignore_local) { + return ""; + } + $files = scan_for_images($albumimage->albumpath); + foreach ($files as $i => $file) { + $info = pathinfo($file); + if (array_key_exists('extension', $info)) { + $file_name = strtolower(rawurldecode(html_entity_decode(basename($file,'.'.$info['extension'])))); + if ($file_name == $albumimage->get_image_key()) { + logger::log("GETALBUMCOVER", " Returning archived image"); + return $file; + } + } + } + foreach ($files as $i => $file) { + $info = pathinfo($file); + if (array_key_exists('extension', $info)) { + $file_name = strtolower(rawurldecode(html_entity_decode(basename($file,'.'.$info['extension'])))); + if ($file_name == strtolower($albumimage->artist." - ".$albumimage->album) || + $file_name == strtolower($albumimage->album)) { + logger::log("GETALBUMCOVER", " Returning file matching album name"); + return $file; + } + } + } + foreach ($covernames as $j => $name) { + foreach ($files as $i => $file) { + $info = pathinfo($file); + if (array_key_exists('extension', $info)) { + $file_name = strtolower(rawurldecode(html_entity_decode(basename($file,'.'.$info['extension'])))); + if ($file_name == $name) { + logger::log("GETALBUMCOVER", " Returning ".$file); + return $file; + } + } + } + } + if (count($files) > 1) { + logger::log("GETALBUMCOVER", " Returning ".$files[0]); + $delaytime = 1; + return $files[0]; + } + return ""; +} + +function trySpotify($albumimage) { + global $delaytime; + if ($albumimage->albumuri === null || substr($albumimage->albumuri, 0, 8) != 'spotify:') { + return ""; + } + $image = ""; + logger::mark("GETALBUMCOVER", " Trying Spotify for ".$albumimage->albumuri); + + // php strict prevents me from doing end(explode()) because + // only variables can be passed by reference. Stupid php. + $spaffy = explode(":", $albumimage->albumuri); + $spiffy = end($spaffy); + $boop = $spaffy[1]; + $url = 'https://api.spotify.com/v1/'.$boop.'s/'.$spiffy; + logger::log("GETALBUMCOVER", " Getting ".$url); + list($success, $content, $status) = get_spotify_data($url); + + if ($success) { + $data = json_decode($content); + if (property_exists($data, 'images')) { + $width = 0; + foreach ($data->images as $img) { + if ($img->width > $width) { + $width = $img->width; + $image = $img->url; + logger::log("GETALBUMCOVER", " Found image with width ".$width); + logger::log("GETALBUMCOVER", " URL is ".$image); + } + } + } else { + logger::log("GETALBUMCOVER", " No Spotify Data Found"); + } + } else { + logger::warn("GETALBUMCOVER", " Spotify API data not retrieved"); + } + $delaytime = 1000; + if ($image == "" && $boop == 'artist') { + // Hackety Hack + $image = "newimages/artist-icon.png"; + $o = array( 'small' => $image, 'medium' => $image, 'asdownloaded' => $image, 'delaytime' => $delaytime); + header('Content-Type: application/json; charset=utf-8'); + print json_encode($o); + logger::shout("GETALBUMCOVER", "--------------------------------------------"); + ob_flush(); + exit(0); + } + return $image; +} + +function tryLastFM($albumimage) { + + global $delaytime, $mysqlc; + static $tried_lastfm_once = false; + + if ($tried_lastfm_once) { return ""; } + $retval = ""; + $pic = ""; + $cs = -1; + + $sizeorder = array( 0 => 'small', 1 => 'medium', 2 => 'large', 3=> 'extralarge', 4 => 'mega'); + + $al = munge_album_name($albumimage->album); + + $sa = $albumimage->get_artist_for_search(); + if ($sa == '') { + logger::mark("GETALBUMCOVER", " Trying last.FM for ".$al); + $json = loadJSON('lastfm', "https://ws.audioscrobbler.com/2.0/?album=".rawurlencode($al)."&api_key=15f7532dff0b8d84635c757f9f18aaa3&autocorrect=0&method=album.getinfo&format=json"); + } else if ($sa == 'Podcast') { + logger::mark("GETALBUMCOVER", " Trying last.FM for ".$al); + // Last.FM sometimes works for podcasts if you use Artist + $json = loadJSON('lastfm', "https://ws.audioscrobbler.com/2.0/?artist=".rawurlencode($al)."&method=album.getinfo&autocorrect=0&api_key=15f7532dff0b8d84635c757f9f18aaa3&format=json"); + } else { + logger::mark("GETALBUMCOVER", " Trying last.FM for ".$sa." ".$al); + $json = loadJSON('lastfm', "https://ws.audioscrobbler.com/2.0/?artist=".rawurlencode($sa)."&album=".rawurlencode($al)."&api_key=15f7532dff0b8d84635c757f9f18aaa3&autocorrect=0&method=album.getinfo&format=json"); + } + if ($json === false) { + logger::fail("GETALBUMCOVER", " Received error response from Last.FM"); + $tried_lastfm_once = true; + return ""; + } else { + if (property_exists($json, 'album')) { + if (property_exists($json->album, 'mbid') && $albumimage->mbid === null && $json->album->mbid) { + $albumimage->mbid = (string) $json->album->mbid; + logger::log("GETALBUMCOVER", " Last.FM gave us the MBID of '".$albumimage->mbid."'"); + if ($mysqlc) { + if (sql_prepare_query(true, null, null, null, "UPDATE Albumtable SET mbid = ? WHERE ImgKey = ? AND mbid IS NULL", $albumimage->mbid, $albumimage->get_image_key())) { + logger::trace("GETALBUMCOVER", " Updated collection with new MBID"); + } else { + logger::fail("GETALBUMCOVER", " Failed trying to update collection with new MBID"); + } + } + // return nothing here so we can try musicbrainz first + return ""; + } + + if (property_exists($json->album, 'image')) { + foreach ($json->album->image as $image) { + if ($image->{'#text'}) { $pic = $image->{'#text'}; } + $s = array_search($image->size, $sizeorder); + if ($s > $cs) { + logger::trace("GETALBUMCOVER", " Image ".$image->size." '".$image->{'#text'}."'"); + $retval = $image->{'#text'}; + $cs = $s; + } + } + } + + } + if ($retval == "") { + $retval = $pic; + } + } + if ($retval != "") { + logger::log("GETALBUMCOVER", " Last.FM gave us ".$retval); + } else { + logger::log("GETALBUMCOVER", " No cover found on Last.FM"); + } + $delaytime = 1000; + $tried_lastfm_once = true; + + return $retval; + +} + +function tryGoogle($albumimage) { + global $delaytime; + global $prefs; + $retval = ""; + if ($prefs['google_api_key'] != '' && $prefs['google_search_engine_id'] != '') { + $nureek = "https://www.googleapis.com/customsearch/v1?key=".$prefs['google_api_key']."&cx=".$prefs['google_search_engine_id']."&searchType=image&alt=json"; + $sa = trim($albumimage->get_artist_for_search()); + $ma = munge_album_name($albumimage->album); + if ($sa == '') { + logger::mark("GETALBUMCOVER", " Trying Google for",$ma); + $uri = $nureek."&q=".urlencode($ma); + } else { + logger::log("GETALBUMCOVER", " Trying Google for",$sa,$ma); + $uri = $nureek."&q=".urlencode($sa.' '.$ma); + } + $d = new url_downloader(array( + 'url' => $uri, + 'cache' => 'google', + 'return_data' => true + )); + $d->get_data_to_file(); + $json = json_decode($d->get_data(), true); + if (array_key_exists('items', $json)) { + foreach($json['items'] as $item) { + $retval = $item['link']; + break; + } + } else if (array_key_exists('error', $json)) { + logger::fail("GETALBUMCOVER", " Error response from Google : ".$json['error']['errors'][0]['reason']); + } + if ($retval != '') { + logger::log("GETALBUMCOVER", " Found image ".$retval." from Google"); + $delaytime = 1000; + } + } else { + logger::mark("GETALBUMCOVER", " Not trying Google because no API Key or Search Engine ID"); + } + return $retval; +} + +function tryMusicBrainz($albumimage) { + global $delaytime; + $delaytime = 600; + if ($albumimage->mbid === null) { + return ""; + } + $retval = ""; + // Let's get some information from musicbrainz about this album + logger::mark("GETALBUMCOVER", " Getting MusicBrainz release info for ".$albumimage->mbid); + $url = 'http://musicbrainz.org/ws/2/release/'.$albumimage->mbid.'?inc=release-groups'; + $d = new url_downloader(array( + 'url' => $url, + 'cache' => 'musicbrainz', + 'return_data' => true + )); + if ($d->get_data_to_file()) { + $x = simplexml_load_string($d->get_data(), 'SimpleXMLElement', LIBXML_NOCDATA); + if ($x->{'release'}->{'cover-art-archive'}->{'artwork'} == "true" && + $x->{'release'}->{'cover-art-archive'}->{'front'} == "true") { + logger::log("GETALBUMCOVER", " Musicbrainz has artwork for this release"); + $retval = "http://coverartarchive.org/release/".$albumimage->mbid."/front"; + } + } else { + logger::fail("GETALBUMCOVER", " Status code ".$d->get_status()." from Musicbrainz"); + } + return $retval; + +} + +function loadJSON($domain, $path) { + $d = new url_downloader(array( + 'url' => $path, + 'cache' => $domain, + 'return_data' => true + )); + if ($d->get_data_to_file()) { + return json_decode($d->get_data()); + } else { + return false; + } +} + +?> diff --git a/www/rompr/getid3/extension.cache.dbm.php b/www/rompr/getid3/extension.cache.dbm.php new file mode 100644 index 0000000..a9332b9 --- /dev/null +++ b/www/rompr/getid3/extension.cache.dbm.php @@ -0,0 +1,209 @@ + // +// available at http://getid3.sourceforge.net // +// or http://www.getid3.org // +// also https://github.com/JamesHeinrich/getID3 // +///////////////////////////////////////////////////////////////// +// // +// extension.cache.dbm.php - part of getID3() // +// Please see readme.txt for more information // +// /// +///////////////////////////////////////////////////////////////// +// // +// This extension written by Allan Hansen // +// /// +///////////////////////////////////////////////////////////////// + + +/** +* This is a caching extension for getID3(). It works the exact same +* way as the getID3 class, but return cached information very fast +* +* Example: +* +* Normal getID3 usage (example): +* +* require_once 'getid3/getid3.php'; +* $getID3 = new getID3; +* $getID3->encoding = 'UTF-8'; +* $info1 = $getID3->analyze('file1.flac'); +* $info2 = $getID3->analyze('file2.wv'); +* +* getID3_cached usage: +* +* require_once 'getid3/getid3.php'; +* require_once 'getid3/getid3/extension.cache.dbm.php'; +* $getID3 = new getID3_cached('db3', '/tmp/getid3_cache.dbm', +* '/tmp/getid3_cache.lock'); +* $getID3->encoding = 'UTF-8'; +* $info1 = $getID3->analyze('file1.flac'); +* $info2 = $getID3->analyze('file2.wv'); +* +* +* Supported Cache Types +* +* SQL Databases: (use extension.cache.mysql) +* +* cache_type cache_options +* ------------------------------------------------------------------- +* mysql host, database, username, password +* +* +* DBM-Style Databases: (this extension) +* +* cache_type cache_options +* ------------------------------------------------------------------- +* gdbm dbm_filename, lock_filename +* ndbm dbm_filename, lock_filename +* db2 dbm_filename, lock_filename +* db3 dbm_filename, lock_filename +* db4 dbm_filename, lock_filename (PHP5 required) +* +* PHP must have write access to both dbm_filename and lock_filename. +* +* +* Recommended Cache Types +* +* Infrequent updates, many reads any DBM +* Frequent updates mysql +*/ + + +class getID3_cached_dbm extends getID3 +{ + + // public: constructor - see top of this file for cache type and cache_options + public function __construct($cache_type, $dbm_filename, $lock_filename) { + + // Check for dba extension + if (!extension_loaded('dba')) { + throw new Exception('PHP is not compiled with dba support, required to use DBM style cache.'); + } + + // Check for specific dba driver + if (!function_exists('dba_handlers') || !in_array($cache_type, dba_handlers())) { + throw new Exception('PHP is not compiled --with '.$cache_type.' support, required to use DBM style cache.'); + } + + // Create lock file if needed + if (!file_exists($lock_filename)) { + if (!touch($lock_filename)) { + throw new Exception('failed to create lock file: '.$lock_filename); + } + } + + // Open lock file for writing + if (!is_writeable($lock_filename)) { + throw new Exception('lock file: '.$lock_filename.' is not writable'); + } + $this->lock = fopen($lock_filename, 'w'); + + // Acquire exclusive write lock to lock file + flock($this->lock, LOCK_EX); + + // Create dbm-file if needed + if (!file_exists($dbm_filename)) { + if (!touch($dbm_filename)) { + throw new Exception('failed to create dbm file: '.$dbm_filename); + } + } + + // Try to open dbm file for writing + $this->dba = dba_open($dbm_filename, 'w', $cache_type); + if (!$this->dba) { + + // Failed - create new dbm file + $this->dba = dba_open($dbm_filename, 'n', $cache_type); + + if (!$this->dba) { + throw new Exception('failed to create dbm file: '.$dbm_filename); + } + + // Insert getID3 version number + dba_insert(getID3::VERSION, getID3::VERSION, $this->dba); + } + + // Init misc values + $this->cache_type = $cache_type; + $this->dbm_filename = $dbm_filename; + + // Register destructor + register_shutdown_function(array($this, '__destruct')); + + // Check version number and clear cache if changed + if (dba_fetch(getID3::VERSION, $this->dba) != getID3::VERSION) { + $this->clear_cache(); + } + + parent::__construct(); + } + + + + // public: destructor + public function __destruct() { + + // Close dbm file + dba_close($this->dba); + + // Release exclusive lock + flock($this->lock, LOCK_UN); + + // Close lock file + fclose($this->lock); + } + + + + // public: clear cache + public function clear_cache() { + + // Close dbm file + dba_close($this->dba); + + // Create new dbm file + $this->dba = dba_open($this->dbm_filename, 'n', $this->cache_type); + + if (!$this->dba) { + throw new Exception('failed to clear cache/recreate dbm file: '.$this->dbm_filename); + } + + // Insert getID3 version number + dba_insert(getID3::VERSION, getID3::VERSION, $this->dba); + + // Re-register shutdown function + register_shutdown_function(array($this, '__destruct')); + } + + + + // public: analyze file + public function analyze($filename) { + + if (file_exists($filename)) { + + // Calc key filename::mod_time::size - should be unique + $key = $filename.'::'.filemtime($filename).'::'.filesize($filename); + + // Loopup key + $result = dba_fetch($key, $this->dba); + + // Hit + if ($result !== false) { + return unserialize($result); + } + } + + // Miss + $result = parent::analyze($filename); + + // Save result + if (file_exists($filename)) { + dba_insert($key, serialize($result), $this->dba); + } + + return $result; + } + +} diff --git a/www/rompr/getid3/extension.cache.mysql.php b/www/rompr/getid3/extension.cache.mysql.php new file mode 100644 index 0000000..305064d --- /dev/null +++ b/www/rompr/getid3/extension.cache.mysql.php @@ -0,0 +1,190 @@ + // +// available at http://getid3.sourceforge.net // +// or http://www.getid3.org // +// also https://github.com/JamesHeinrich/getID3 // +///////////////////////////////////////////////////////////////// +// // +// extension.cache.mysql.php - part of getID3() // +// Please see readme.txt for more information // +// /// +///////////////////////////////////////////////////////////////// +// // +// This extension written by Allan Hansen // +// Table name mod by Carlo Capocasa // +// /// +///////////////////////////////////////////////////////////////// + + +/** +* This is a caching extension for getID3(). It works the exact same +* way as the getID3 class, but return cached information very fast +* +* Example: (see also demo.cache.mysql.php in /demo/) +* +* Normal getID3 usage (example): +* +* require_once 'getid3/getid3.php'; +* $getID3 = new getID3; +* $getID3->encoding = 'UTF-8'; +* $info1 = $getID3->analyze('file1.flac'); +* $info2 = $getID3->analyze('file2.wv'); +* +* getID3_cached usage: +* +* require_once 'getid3/getid3.php'; +* require_once 'getid3/getid3/extension.cache.mysql.php'; +* // 5th parameter (tablename) is optional, default is 'getid3_cache' +* $getID3 = new getID3_cached_mysql('localhost', 'database', 'username', 'password', 'tablename'); +* $getID3->encoding = 'UTF-8'; +* $info1 = $getID3->analyze('file1.flac'); +* $info2 = $getID3->analyze('file2.wv'); +* +* +* Supported Cache Types (this extension) +* +* SQL Databases: +* +* cache_type cache_options +* ------------------------------------------------------------------- +* mysql host, database, username, password +* +* +* DBM-Style Databases: (use extension.cache.dbm) +* +* cache_type cache_options +* ------------------------------------------------------------------- +* gdbm dbm_filename, lock_filename +* ndbm dbm_filename, lock_filename +* db2 dbm_filename, lock_filename +* db3 dbm_filename, lock_filename +* db4 dbm_filename, lock_filename (PHP5 required) +* +* PHP must have write access to both dbm_filename and lock_filename. +* +* +* Recommended Cache Types +* +* Infrequent updates, many reads any DBM +* Frequent updates mysql +*/ + + +class getID3_cached_mysql extends getID3 +{ + + // private vars + private $cursor; + private $connection; + + + // public: constructor - see top of this file for cache type and cache_options + public function __construct($host, $database, $username, $password, $table='getid3_cache') { + + // Check for mysql support + if (!function_exists('mysql_pconnect')) { + throw new Exception('PHP not compiled with mysql support.'); + } + + // Connect to database + $this->connection = mysql_pconnect($host, $username, $password); + if (!$this->connection) { + throw new Exception('mysql_pconnect() failed - check permissions and spelling.'); + } + + // Select database + if (!mysql_select_db($database, $this->connection)) { + throw new Exception('Cannot use database '.$database); + } + + // Set table + $this->table = $table; + + // Create cache table if not exists + $this->create_table(); + + // Check version number and clear cache if changed + $version = ''; + $SQLquery = 'SELECT `value`'; + $SQLquery .= ' FROM `'.mysql_real_escape_string($this->table).'`'; + $SQLquery .= ' WHERE (`filename` = \''.mysql_real_escape_string(getID3::VERSION).'\')'; + $SQLquery .= ' AND (`filesize` = -1)'; + $SQLquery .= ' AND (`filetime` = -1)'; + $SQLquery .= ' AND (`analyzetime` = -1)'; + if ($this->cursor = mysql_query($SQLquery, $this->connection)) { + list($version) = mysql_fetch_array($this->cursor); + } + if ($version != getID3::VERSION) { + $this->clear_cache(); + } + + parent::__construct(); + } + + + + // public: clear cache + public function clear_cache() { + + $this->cursor = mysql_query('DELETE FROM `'.mysql_real_escape_string($this->table).'`', $this->connection); + $this->cursor = mysql_query('INSERT INTO `'.mysql_real_escape_string($this->table).'` VALUES (\''.getID3::VERSION.'\', -1, -1, -1, \''.getID3::VERSION.'\')', $this->connection); + } + + + + // public: analyze file + public function analyze($filename, $filesize=null, $original_filename='') { + + if (file_exists($filename)) { + + // Short-hands + $filetime = filemtime($filename); + $filesize = filesize($filename); + + // Lookup file + $SQLquery = 'SELECT `value`'; + $SQLquery .= ' FROM `'.mysql_real_escape_string($this->table).'`'; + $SQLquery .= ' WHERE (`filename` = \''.mysql_real_escape_string($filename).'\')'; + $SQLquery .= ' AND (`filesize` = \''.mysql_real_escape_string($filesize).'\')'; + $SQLquery .= ' AND (`filetime` = \''.mysql_real_escape_string($filetime).'\')'; + $this->cursor = mysql_query($SQLquery, $this->connection); + if (mysql_num_rows($this->cursor) > 0) { + // Hit + list($result) = mysql_fetch_array($this->cursor); + return unserialize(base64_decode($result)); + } + } + + // Miss + $analysis = parent::analyze($filename, $filesize, $original_filename); + + // Save result + if (file_exists($filename)) { + $SQLquery = 'INSERT INTO `'.mysql_real_escape_string($this->table).'` (`filename`, `filesize`, `filetime`, `analyzetime`, `value`) VALUES ('; + $SQLquery .= '\''.mysql_real_escape_string($filename).'\''; + $SQLquery .= ', \''.mysql_real_escape_string($filesize).'\''; + $SQLquery .= ', \''.mysql_real_escape_string($filetime).'\''; + $SQLquery .= ', \''.mysql_real_escape_string(time() ).'\''; + $SQLquery .= ', \''.mysql_real_escape_string(base64_encode(serialize($analysis))).'\')'; + $this->cursor = mysql_query($SQLquery, $this->connection); + } + return $analysis; + } + + + + // private: (re)create sql table + private function create_table($drop=false) { + + $SQLquery = 'CREATE TABLE IF NOT EXISTS `'.mysql_real_escape_string($this->table).'` ('; + $SQLquery .= '`filename` VARCHAR(990) NOT NULL DEFAULT \'\''; + $SQLquery .= ', `filesize` INT(11) NOT NULL DEFAULT \'0\''; + $SQLquery .= ', `filetime` INT(11) NOT NULL DEFAULT \'0\''; + $SQLquery .= ', `analyzetime` INT(11) NOT NULL DEFAULT \'0\''; + $SQLquery .= ', `value` LONGTEXT NOT NULL'; + $SQLquery .= ', PRIMARY KEY (`filename`, `filesize`, `filetime`))'; + $this->cursor = mysql_query($SQLquery, $this->connection); + echo mysql_error($this->connection); + } +} diff --git a/www/rompr/getid3/extension.cache.mysqli.php b/www/rompr/getid3/extension.cache.mysqli.php new file mode 100755 index 0000000..185e831 --- /dev/null +++ b/www/rompr/getid3/extension.cache.mysqli.php @@ -0,0 +1,183 @@ + // +// available at http://getid3.sourceforge.net // +// or http://www.getid3.org // +// also https://github.com/JamesHeinrich/getID3 // +///////////////////////////////////////////////////////////////// +// // +// extension.cache.mysqli.php - part of getID3() // +// Please see readme.txt for more information // +// /// +///////////////////////////////////////////////////////////////// +// // +// This extension written by Allan Hansen // +// Table name mod by Carlo Capocasa // +// /// +///////////////////////////////////////////////////////////////// + + +/** +* This is a caching extension for getID3(). It works the exact same +* way as the getID3 class, but return cached information very fast +* +* Example: (see also demo.cache.mysql.php in /demo/) +* +* Normal getID3 usage (example): +* +* require_once 'getid3/getid3.php'; +* $getID3 = new getID3; +* $getID3->encoding = 'UTF-8'; +* $info1 = $getID3->analyze('file1.flac'); +* $info2 = $getID3->analyze('file2.wv'); +* +* getID3_cached usage: +* +* require_once 'getid3/getid3.php'; +* require_once 'getid3/getid3/extension.cache.mysqli.php'; +* // 5th parameter (tablename) is optional, default is 'getid3_cache' +* $getID3 = new getID3_cached_mysqli('localhost', 'database', 'username', 'password', 'tablename'); +* $getID3->encoding = 'UTF-8'; +* $info1 = $getID3->analyze('file1.flac'); +* $info2 = $getID3->analyze('file2.wv'); +* +* +* Supported Cache Types (this extension) +* +* SQL Databases: +* +* cache_type cache_options +* ------------------------------------------------------------------- +* mysqli host, database, username, password +* +* +* DBM-Style Databases: (use extension.cache.dbm) +* +* cache_type cache_options +* ------------------------------------------------------------------- +* gdbm dbm_filename, lock_filename +* ndbm dbm_filename, lock_filename +* db2 dbm_filename, lock_filename +* db3 dbm_filename, lock_filename +* db4 dbm_filename, lock_filename (PHP5 required) +* +* PHP must have write access to both dbm_filename and lock_filename. +* +* +* Recommended Cache Types +* +* Infrequent updates, many reads any DBM +* Frequent updates mysqli +*/ + +class getID3_cached_mysqli extends getID3 +{ + // private vars + private $mysqli; + private $cursor; + + + // public: constructor - see top of this file for cache type and cache_options + public function __construct($host, $database, $username, $password, $table='getid3_cache') { + + // Check for mysqli support + if (!function_exists('mysqli_connect')) { + throw new Exception('PHP not compiled with mysqli support.'); + } + + // Connect to database + $this->mysqli = new mysqli($host, $username, $password); + if (!$this->mysqli) { + throw new Exception('mysqli_connect() failed - check permissions and spelling.'); + } + + // Select database + if (!$this->mysqli->select_db($database)) { + throw new Exception('Cannot use database '.$database); + } + + // Set table + $this->table = $table; + + // Create cache table if not exists + $this->create_table(); + + // Check version number and clear cache if changed + $version = ''; + $SQLquery = 'SELECT `value`'; + $SQLquery .= ' FROM `'.$this->mysqli->real_escape_string($this->table).'`'; + $SQLquery .= ' WHERE (`filename` = \''.$this->mysqli->real_escape_string(getID3::VERSION).'\')'; + $SQLquery .= ' AND (`filesize` = -1)'; + $SQLquery .= ' AND (`filetime` = -1)'; + $SQLquery .= ' AND (`analyzetime` = -1)'; + if ($this->cursor = $this->mysqli->query($SQLquery)) { + list($version) = $this->cursor->fetch_array(); + } + if ($version != getID3::VERSION) { + $this->clear_cache(); + } + + parent::__construct(); + } + + + // public: clear cache + public function clear_cache() { + $this->mysqli->query('DELETE FROM `'.$this->mysqli->real_escape_string($this->table).'`'); + $this->mysqli->query('INSERT INTO `'.$this->mysqli->real_escape_string($this->table).'` (`filename`, `filesize`, `filetime`, `analyzetime`, `value`) VALUES (\''.getID3::VERSION.'\', -1, -1, -1, \''.getID3::VERSION.'\')'); + } + + + // public: analyze file + public function analyze($filename, $filesize=null, $original_filename='') { + + if (file_exists($filename)) { + + // Short-hands + $filetime = filemtime($filename); + $filesize = filesize($filename); + + // Lookup file + $SQLquery = 'SELECT `value`'; + $SQLquery .= ' FROM `'.$this->mysqli->real_escape_string($this->table).'`'; + $SQLquery .= ' WHERE (`filename` = \''.$this->mysqli->real_escape_string($filename).'\')'; + $SQLquery .= ' AND (`filesize` = \''.$this->mysqli->real_escape_string($filesize).'\')'; + $SQLquery .= ' AND (`filetime` = \''.$this->mysqli->real_escape_string($filetime).'\')'; + $this->cursor = $this->mysqli->query($SQLquery); + if ($this->cursor->num_rows > 0) { + // Hit + list($result) = $this->cursor->fetch_array(); + return unserialize(base64_decode($result)); + } + } + + // Miss + $analysis = parent::analyze($filename, $filesize, $original_filename); + + // Save result + if (file_exists($filename)) { + $SQLquery = 'INSERT INTO `'.$this->mysqli->real_escape_string($this->table).'` (`filename`, `filesize`, `filetime`, `analyzetime`, `value`) VALUES ('; + $SQLquery .= '\''.$this->mysqli->real_escape_string($filename).'\''; + $SQLquery .= ', \''.$this->mysqli->real_escape_string($filesize).'\''; + $SQLquery .= ', \''.$this->mysqli->real_escape_string($filetime).'\''; + $SQLquery .= ', \''.$this->mysqli->real_escape_string(time() ).'\''; + $SQLquery .= ', \''.$this->mysqli->real_escape_string(base64_encode(serialize($analysis))).'\')'; + $this->cursor = $this->mysqli->query($SQLquery); + } + return $analysis; + } + + + // private: (re)create mysqli table + private function create_table($drop=false) { + $SQLquery = 'CREATE TABLE IF NOT EXISTS `'.$this->mysqli->real_escape_string($this->table).'` ('; + $SQLquery .= '`filename` VARCHAR(990) NOT NULL DEFAULT \'\''; + $SQLquery .= ', `filesize` INT(11) NOT NULL DEFAULT \'0\''; + $SQLquery .= ', `filetime` INT(11) NOT NULL DEFAULT \'0\''; + $SQLquery .= ', `analyzetime` INT(11) NOT NULL DEFAULT \'0\''; + $SQLquery .= ', `value` LONGTEXT NOT NULL'; + $SQLquery .= ', PRIMARY KEY (`filename`, `filesize`, `filetime`))'; + $this->cursor = $this->mysqli->query($SQLquery); + echo $this->mysqli->error; + } +} \ No newline at end of file diff --git a/www/rompr/getid3/extension.cache.sqlite3.php b/www/rompr/getid3/extension.cache.sqlite3.php new file mode 100644 index 0000000..dccd78d --- /dev/null +++ b/www/rompr/getid3/extension.cache.sqlite3.php @@ -0,0 +1,265 @@ + // +// available at http://getid3.sourceforge.net // +// or http://www.getid3.org // +// also https://github.com/JamesHeinrich/getID3 // +///////////////////////////////////////////////////////////////////////////////// +/// // +// extension.cache.sqlite3.php - part of getID3() // +// Please see readme.txt for more information // +// /// +///////////////////////////////////////////////////////////////////////////////// +/// // +// MySQL extension written by Allan Hansen // +// Table name mod by Carlo Capocasa // +// MySQL extension was reworked for SQLite3 by Karl G. Holz // +// /// +///////////////////////////////////////////////////////////////////////////////// +/** +* This is a caching extension for getID3(). It works the exact same +* way as the getID3 class, but return cached information much faster +* +* Normal getID3 usage (example): +* +* require_once 'getid3/getid3.php'; +* $getID3 = new getID3; +* $getID3->encoding = 'UTF-8'; +* $info1 = $getID3->analyze('file1.flac'); +* $info2 = $getID3->analyze('file2.wv'); +* +* getID3_cached usage: +* +* require_once 'getid3/getid3.php'; +* require_once 'getid3/extension.cache.sqlite3.php'; +* // all parameters are optional, defaults are: +* $getID3 = new getID3_cached_sqlite3($table='getid3_cache', $hide=FALSE); +* $getID3->encoding = 'UTF-8'; +* $info1 = $getID3->analyze('file1.flac'); +* $info2 = $getID3->analyze('file2.wv'); +* +* +* Supported Cache Types (this extension) +* +* SQL Databases: +* +* cache_type cache_options +* ------------------------------------------------------------------- +* mysql host, database, username, password +* +* sqlite3 table='getid3_cache', hide=false (PHP5) +* +* +* *** database file will be stored in the same directory as this script, +* *** webserver must have write access to that directory! +* *** set $hide to TRUE to prefix db file with .ht to pervent access from web client +* *** this is a default setting in the Apache configuration: +* +* The following lines prevent .htaccess and .htpasswd files from being viewed by Web clients. +* +* +* Order allow,deny +* Deny from all +* Satisfy all +* +* +******************************************************************************** +* +* ------------------------------------------------------------------- +* DBM-Style Databases: (use extension.cache.dbm) +* +* cache_type cache_options +* ------------------------------------------------------------------- +* gdbm dbm_filename, lock_filename +* ndbm dbm_filename, lock_filename +* db2 dbm_filename, lock_filename +* db3 dbm_filename, lock_filename +* db4 dbm_filename, lock_filename (PHP5 required) +* +* PHP must have write access to both dbm_filename and lock_filename. +* +* Recommended Cache Types +* +* Infrequent updates, many reads any DBM +* Frequent updates mysql +******************************************************************************** +* +* IMHO this is still a bit slow, I'm using this with MP4/MOV/ M4v files +* there is a plan to add directory scanning and analyzing to make things work much faster +* +* +*/ +class getID3_cached_sqlite3 extends getID3 { + + /** + * __construct() + * @param string $table holds name of sqlite table + * @return type + */ + public function __construct($table='getid3_cache', $hide=false) { + $this->table = $table; // Set table + $file = dirname(__FILE__).'/'.basename(__FILE__, 'php').'sqlite'; + if ($hide) { + $file = dirname(__FILE__).'/.ht.'.basename(__FILE__, 'php').'sqlite'; + } + $this->db = new SQLite3($file); + $db = $this->db; + $this->create_table(); // Create cache table if not exists + $version = ''; + $sql = $this->version_check; + $stmt = $db->prepare($sql); + $stmt->bindValue(':filename', getID3::VERSION, SQLITE3_TEXT); + $result = $stmt->execute(); + list($version) = $result->fetchArray(); + if ($version != getID3::VERSION) { // Check version number and clear cache if changed + $this->clear_cache(); + } + return parent::__construct(); + } + + /** + * close the database connection + */ + public function __destruct() { + $db=$this->db; + $db->close(); + } + + /** + * hold the sqlite db + * @var SQLite Resource + */ + private $db; + + /** + * table to use for caching + * @var string $table + */ + private $table; + + /** + * clear the cache + * @access private + * @return type + */ + private function clear_cache() { + $db = $this->db; + $sql = $this->delete_cache; + $db->exec($sql); + $sql = $this->set_version; + $stmt = $db->prepare($sql); + $stmt->bindValue(':filename', getID3::VERSION, SQLITE3_TEXT); + $stmt->bindValue(':dirname', getID3::VERSION, SQLITE3_TEXT); + $stmt->bindValue(':val', getID3::VERSION, SQLITE3_TEXT); + return $stmt->execute(); + } + + /** + * analyze file and cache them, if cached pull from the db + * @param type $filename + * @return boolean + */ + public function analyze($filename, $filesize=null, $original_filename='') { + if (!file_exists($filename)) { + return false; + } + // items to track for caching + $filetime = filemtime($filename); + $filesize_real = filesize($filename); + // this will be saved for a quick directory lookup of analized files + // ... why do 50 seperate sql quries when you can do 1 for the same result + $dirname = dirname($filename); + // Lookup file + $db = $this->db; + $sql = $this->get_id3_data; + $stmt = $db->prepare($sql); + $stmt->bindValue(':filename', $filename, SQLITE3_TEXT); + $stmt->bindValue(':filesize', $filesize_real, SQLITE3_INTEGER); + $stmt->bindValue(':filetime', $filetime, SQLITE3_INTEGER); + $res = $stmt->execute(); + list($result) = $res->fetchArray(); + if (count($result) > 0 ) { + return unserialize(base64_decode($result)); + } + // if it hasn't been analyzed before, then do it now + $analysis = parent::analyze($filename, $filesize, $original_filename); + // Save result + $sql = $this->cache_file; + $stmt = $db->prepare($sql); + $stmt->bindValue(':filename', $filename, SQLITE3_TEXT); + $stmt->bindValue(':dirname', $dirname, SQLITE3_TEXT); + $stmt->bindValue(':filesize', $filesize_real, SQLITE3_INTEGER); + $stmt->bindValue(':filetime', $filetime, SQLITE3_INTEGER); + $stmt->bindValue(':atime', time(), SQLITE3_INTEGER); + $stmt->bindValue(':val', base64_encode(serialize($analysis)), SQLITE3_TEXT); + $res = $stmt->execute(); + return $analysis; + } + + /** + * create data base table + * this is almost the same as MySQL, with the exception of the dirname being added + * @return type + */ + private function create_table() { + $db = $this->db; + $sql = $this->make_table; + return $db->exec($sql); + } + + /** + * get cached directory + * + * This function is not in the MySQL extention, it's ment to speed up requesting multiple files + * which is ideal for podcasting, playlists, etc. + * + * @access public + * @param string $dir directory to search the cache database for + * @return array return an array of matching id3 data + */ + public function get_cached_dir($dir) { + $db = $this->db; + $rows = array(); + $sql = $this->get_cached_dir; + $stmt = $db->prepare($sql); + $stmt->bindValue(':dirname', $dir, SQLITE3_TEXT); + $res = $stmt->execute(); + while ($row=$res->fetchArray()) { + $rows[] = unserialize(base64_decode($row)); + } + return $rows; + } + + /** + * use the magical __get() for sql queries + * + * access as easy as $this->{case name}, returns NULL if query is not found + */ + public function __get($name) { + switch($name) { + case 'version_check': + return "SELECT val FROM $this->table WHERE filename = :filename AND filesize = '-1' AND filetime = '-1' AND analyzetime = '-1'"; + break; + case 'delete_cache': + return "DELETE FROM $this->table"; + break; + case 'set_version': + return "INSERT INTO $this->table (filename, dirname, filesize, filetime, analyzetime, val) VALUES (:filename, :dirname, -1, -1, -1, :val)"; + break; + case 'get_id3_data': + return "SELECT val FROM $this->table WHERE filename = :filename AND filesize = :filesize AND filetime = :filetime"; + break; + case 'cache_file': + return "INSERT INTO $this->table (filename, dirname, filesize, filetime, analyzetime, val) VALUES (:filename, :dirname, :filesize, :filetime, :atime, :val)"; + break; + case 'make_table': + return "CREATE TABLE IF NOT EXISTS $this->table (filename VARCHAR(255) DEFAULT '', dirname VARCHAR(255) DEFAULT '', filesize INT(11) DEFAULT '0', filetime INT(11) DEFAULT '0', analyzetime INT(11) DEFAULT '0', val text, PRIMARY KEY (filename, filesize, filetime))"; + break; + case 'get_cached_dir': + return "SELECT val FROM $this->table WHERE dirname = :dirname"; + break; + } + return null; + } + +} diff --git a/www/rompr/getid3/getid3.lib.php b/www/rompr/getid3/getid3.lib.php new file mode 100644 index 0000000..1931bb3 --- /dev/null +++ b/www/rompr/getid3/getid3.lib.php @@ -0,0 +1,1436 @@ + // +// available at http://getid3.sourceforge.net // +// or http://www.getid3.org // +// also https://github.com/JamesHeinrich/getID3 // +///////////////////////////////////////////////////////////////// +// // +// getid3.lib.php - part of getID3() // +// See readme.txt for more details // +// /// +///////////////////////////////////////////////////////////////// + + +class getid3_lib +{ + + public static function PrintHexBytes($string, $hex=true, $spaces=true, $htmlencoding='UTF-8') { + $returnstring = ''; + for ($i = 0; $i < strlen($string); $i++) { + if ($hex) { + $returnstring .= str_pad(dechex(ord($string{$i})), 2, '0', STR_PAD_LEFT); + } else { + $returnstring .= ' '.(preg_match("#[\x20-\x7E]#", $string{$i}) ? $string{$i} : '¤'); + } + if ($spaces) { + $returnstring .= ' '; + } + } + if (!empty($htmlencoding)) { + if ($htmlencoding === true) { + $htmlencoding = 'UTF-8'; // prior to getID3 v1.9.0 the function's 4th parameter was boolean + } + $returnstring = htmlentities($returnstring, ENT_QUOTES, $htmlencoding); + } + return $returnstring; + } + + public static function trunc($floatnumber) { + // truncates a floating-point number at the decimal point + // returns int (if possible, otherwise float) + if ($floatnumber >= 1) { + $truncatednumber = floor($floatnumber); + } elseif ($floatnumber <= -1) { + $truncatednumber = ceil($floatnumber); + } else { + $truncatednumber = 0; + } + if (self::intValueSupported($truncatednumber)) { + $truncatednumber = (int) $truncatednumber; + } + return $truncatednumber; + } + + + public static function safe_inc(&$variable, $increment=1) { + if (isset($variable)) { + $variable += $increment; + } else { + $variable = $increment; + } + return true; + } + + public static function CastAsInt($floatnum) { + // convert to float if not already + $floatnum = (float) $floatnum; + + // convert a float to type int, only if possible + if (self::trunc($floatnum) == $floatnum) { + // it's not floating point + if (self::intValueSupported($floatnum)) { + // it's within int range + $floatnum = (int) $floatnum; + } + } + return $floatnum; + } + + public static function intValueSupported($num) { + // check if integers are 64-bit + static $hasINT64 = null; + if ($hasINT64 === null) { // 10x faster than is_null() + $hasINT64 = is_int(pow(2, 31)); // 32-bit int are limited to (2^31)-1 + if (!$hasINT64 && !defined('PHP_INT_MIN')) { + define('PHP_INT_MIN', ~PHP_INT_MAX); + } + } + // if integers are 64-bit - no other check required + if ($hasINT64 || (($num <= PHP_INT_MAX) && ($num >= PHP_INT_MIN))) { + return true; + } + return false; + } + + public static function DecimalizeFraction($fraction) { + list($numerator, $denominator) = explode('/', $fraction); + return $numerator / ($denominator ? $denominator : 1); + } + + + public static function DecimalBinary2Float($binarynumerator) { + $numerator = self::Bin2Dec($binarynumerator); + $denominator = self::Bin2Dec('1'.str_repeat('0', strlen($binarynumerator))); + return ($numerator / $denominator); + } + + + public static function NormalizeBinaryPoint($binarypointnumber, $maxbits=52) { + // http://www.scri.fsu.edu/~jac/MAD3401/Backgrnd/binary.html + if (strpos($binarypointnumber, '.') === false) { + $binarypointnumber = '0.'.$binarypointnumber; + } elseif ($binarypointnumber{0} == '.') { + $binarypointnumber = '0'.$binarypointnumber; + } + $exponent = 0; + while (($binarypointnumber{0} != '1') || (substr($binarypointnumber, 1, 1) != '.')) { + if (substr($binarypointnumber, 1, 1) == '.') { + $exponent--; + $binarypointnumber = substr($binarypointnumber, 2, 1).'.'.substr($binarypointnumber, 3); + } else { + $pointpos = strpos($binarypointnumber, '.'); + $exponent += ($pointpos - 1); + $binarypointnumber = str_replace('.', '', $binarypointnumber); + $binarypointnumber = $binarypointnumber{0}.'.'.substr($binarypointnumber, 1); + } + } + $binarypointnumber = str_pad(substr($binarypointnumber, 0, $maxbits + 2), $maxbits + 2, '0', STR_PAD_RIGHT); + return array('normalized'=>$binarypointnumber, 'exponent'=>(int) $exponent); + } + + + public static function Float2BinaryDecimal($floatvalue) { + // http://www.scri.fsu.edu/~jac/MAD3401/Backgrnd/binary.html + $maxbits = 128; // to how many bits of precision should the calculations be taken? + $intpart = self::trunc($floatvalue); + $floatpart = abs($floatvalue - $intpart); + $pointbitstring = ''; + while (($floatpart != 0) && (strlen($pointbitstring) < $maxbits)) { + $floatpart *= 2; + $pointbitstring .= (string) self::trunc($floatpart); + $floatpart -= self::trunc($floatpart); + } + $binarypointnumber = decbin($intpart).'.'.$pointbitstring; + return $binarypointnumber; + } + + + public static function Float2String($floatvalue, $bits) { + // http://www.scri.fsu.edu/~jac/MAD3401/Backgrnd/ieee-expl.html + switch ($bits) { + case 32: + $exponentbits = 8; + $fractionbits = 23; + break; + + case 64: + $exponentbits = 11; + $fractionbits = 52; + break; + + default: + return false; + break; + } + if ($floatvalue >= 0) { + $signbit = '0'; + } else { + $signbit = '1'; + } + $normalizedbinary = self::NormalizeBinaryPoint(self::Float2BinaryDecimal($floatvalue), $fractionbits); + $biasedexponent = pow(2, $exponentbits - 1) - 1 + $normalizedbinary['exponent']; // (127 or 1023) +/- exponent + $exponentbitstring = str_pad(decbin($biasedexponent), $exponentbits, '0', STR_PAD_LEFT); + $fractionbitstring = str_pad(substr($normalizedbinary['normalized'], 2), $fractionbits, '0', STR_PAD_RIGHT); + + return self::BigEndian2String(self::Bin2Dec($signbit.$exponentbitstring.$fractionbitstring), $bits % 8, false); + } + + + public static function LittleEndian2Float($byteword) { + return self::BigEndian2Float(strrev($byteword)); + } + + + public static function BigEndian2Float($byteword) { + // ANSI/IEEE Standard 754-1985, Standard for Binary Floating Point Arithmetic + // http://www.psc.edu/general/software/packages/ieee/ieee.html + // http://www.scri.fsu.edu/~jac/MAD3401/Backgrnd/ieee.html + + $bitword = self::BigEndian2Bin($byteword); + if (!$bitword) { + return 0; + } + $signbit = $bitword{0}; + + switch (strlen($byteword) * 8) { + case 32: + $exponentbits = 8; + $fractionbits = 23; + break; + + case 64: + $exponentbits = 11; + $fractionbits = 52; + break; + + case 80: + // 80-bit Apple SANE format + // http://www.mactech.com/articles/mactech/Vol.06/06.01/SANENormalized/ + $exponentstring = substr($bitword, 1, 15); + $isnormalized = intval($bitword{16}); + $fractionstring = substr($bitword, 17, 63); + $exponent = pow(2, self::Bin2Dec($exponentstring) - 16383); + $fraction = $isnormalized + self::DecimalBinary2Float($fractionstring); + $floatvalue = $exponent * $fraction; + if ($signbit == '1') { + $floatvalue *= -1; + } + return $floatvalue; + break; + + default: + return false; + break; + } + $exponentstring = substr($bitword, 1, $exponentbits); + $fractionstring = substr($bitword, $exponentbits + 1, $fractionbits); + $exponent = self::Bin2Dec($exponentstring); + $fraction = self::Bin2Dec($fractionstring); + + if (($exponent == (pow(2, $exponentbits) - 1)) && ($fraction != 0)) { + // Not a Number + $floatvalue = false; + } elseif (($exponent == (pow(2, $exponentbits) - 1)) && ($fraction == 0)) { + if ($signbit == '1') { + $floatvalue = '-infinity'; + } else { + $floatvalue = '+infinity'; + } + } elseif (($exponent == 0) && ($fraction == 0)) { + if ($signbit == '1') { + $floatvalue = -0; + } else { + $floatvalue = 0; + } + $floatvalue = ($signbit ? 0 : -0); + } elseif (($exponent == 0) && ($fraction != 0)) { + // These are 'unnormalized' values + $floatvalue = pow(2, (-1 * (pow(2, $exponentbits - 1) - 2))) * self::DecimalBinary2Float($fractionstring); + if ($signbit == '1') { + $floatvalue *= -1; + } + } elseif ($exponent != 0) { + $floatvalue = pow(2, ($exponent - (pow(2, $exponentbits - 1) - 1))) * (1 + self::DecimalBinary2Float($fractionstring)); + if ($signbit == '1') { + $floatvalue *= -1; + } + } + return (float) $floatvalue; + } + + + public static function BigEndian2Int($byteword, $synchsafe=false, $signed=false) { + $intvalue = 0; + $bytewordlen = strlen($byteword); + if ($bytewordlen == 0) { + return false; + } + for ($i = 0; $i < $bytewordlen; $i++) { + if ($synchsafe) { // disregard MSB, effectively 7-bit bytes + //$intvalue = $intvalue | (ord($byteword{$i}) & 0x7F) << (($bytewordlen - 1 - $i) * 7); // faster, but runs into problems past 2^31 on 32-bit systems + $intvalue += (ord($byteword{$i}) & 0x7F) * pow(2, ($bytewordlen - 1 - $i) * 7); + } else { + $intvalue += ord($byteword{$i}) * pow(256, ($bytewordlen - 1 - $i)); + } + } + if ($signed && !$synchsafe) { + // synchsafe ints are not allowed to be signed + if ($bytewordlen <= PHP_INT_SIZE) { + $signMaskBit = 0x80 << (8 * ($bytewordlen - 1)); + if ($intvalue & $signMaskBit) { + $intvalue = 0 - ($intvalue & ($signMaskBit - 1)); + } + } else { + throw new Exception('ERROR: Cannot have signed integers larger than '.(8 * PHP_INT_SIZE).'-bits ('.strlen($byteword).') in self::BigEndian2Int()'); + } + } + return self::CastAsInt($intvalue); + } + + + public static function LittleEndian2Int($byteword, $signed=false) { + return self::BigEndian2Int(strrev($byteword), false, $signed); + } + + public static function LittleEndian2Bin($byteword) { + return self::BigEndian2Bin(strrev($byteword)); + } + + public static function BigEndian2Bin($byteword) { + $binvalue = ''; + $bytewordlen = strlen($byteword); + for ($i = 0; $i < $bytewordlen; $i++) { + $binvalue .= str_pad(decbin(ord($byteword{$i})), 8, '0', STR_PAD_LEFT); + } + return $binvalue; + } + + + public static function BigEndian2String($number, $minbytes=1, $synchsafe=false, $signed=false) { + if ($number < 0) { + throw new Exception('ERROR: self::BigEndian2String() does not support negative numbers'); + } + $maskbyte = (($synchsafe || $signed) ? 0x7F : 0xFF); + $intstring = ''; + if ($signed) { + if ($minbytes > PHP_INT_SIZE) { + throw new Exception('ERROR: Cannot have signed integers larger than '.(8 * PHP_INT_SIZE).'-bits in self::BigEndian2String()'); + } + $number = $number & (0x80 << (8 * ($minbytes - 1))); + } + while ($number != 0) { + $quotient = ($number / ($maskbyte + 1)); + $intstring = chr(ceil(($quotient - floor($quotient)) * $maskbyte)).$intstring; + $number = floor($quotient); + } + return str_pad($intstring, $minbytes, "\x00", STR_PAD_LEFT); + } + + + public static function Dec2Bin($number) { + while ($number >= 256) { + $bytes[] = (($number / 256) - (floor($number / 256))) * 256; + $number = floor($number / 256); + } + $bytes[] = $number; + $binstring = ''; + for ($i = 0; $i < count($bytes); $i++) { + $binstring = (($i == count($bytes) - 1) ? decbin($bytes[$i]) : str_pad(decbin($bytes[$i]), 8, '0', STR_PAD_LEFT)).$binstring; + } + return $binstring; + } + + + public static function Bin2Dec($binstring, $signed=false) { + $signmult = 1; + if ($signed) { + if ($binstring{0} == '1') { + $signmult = -1; + } + $binstring = substr($binstring, 1); + } + $decvalue = 0; + for ($i = 0; $i < strlen($binstring); $i++) { + $decvalue += ((int) substr($binstring, strlen($binstring) - $i - 1, 1)) * pow(2, $i); + } + return self::CastAsInt($decvalue * $signmult); + } + + + public static function Bin2String($binstring) { + // return 'hi' for input of '0110100001101001' + $string = ''; + $binstringreversed = strrev($binstring); + for ($i = 0; $i < strlen($binstringreversed); $i += 8) { + $string = chr(self::Bin2Dec(strrev(substr($binstringreversed, $i, 8)))).$string; + } + return $string; + } + + + public static function LittleEndian2String($number, $minbytes=1, $synchsafe=false) { + $intstring = ''; + while ($number > 0) { + if ($synchsafe) { + $intstring = $intstring.chr($number & 127); + $number >>= 7; + } else { + $intstring = $intstring.chr($number & 255); + $number >>= 8; + } + } + return str_pad($intstring, $minbytes, "\x00", STR_PAD_RIGHT); + } + + + public static function array_merge_clobber($array1, $array2) { + // written by kcØhireability*com + // taken from http://www.php.net/manual/en/function.array-merge-recursive.php + if (!is_array($array1) || !is_array($array2)) { + return false; + } + $newarray = $array1; + foreach ($array2 as $key => $val) { + if (is_array($val) && isset($newarray[$key]) && is_array($newarray[$key])) { + $newarray[$key] = self::array_merge_clobber($newarray[$key], $val); + } else { + $newarray[$key] = $val; + } + } + return $newarray; + } + + + public static function array_merge_noclobber($array1, $array2) { + if (!is_array($array1) || !is_array($array2)) { + return false; + } + $newarray = $array1; + foreach ($array2 as $key => $val) { + if (is_array($val) && isset($newarray[$key]) && is_array($newarray[$key])) { + $newarray[$key] = self::array_merge_noclobber($newarray[$key], $val); + } elseif (!isset($newarray[$key])) { + $newarray[$key] = $val; + } + } + return $newarray; + } + + public static function flipped_array_merge_noclobber($array1, $array2) { + if (!is_array($array1) || !is_array($array2)) { + return false; + } + # naturally, this only works non-recursively + $newarray = array_flip($array1); + foreach (array_flip($array2) as $key => $val) { + if (!isset($newarray[$key])) { + $newarray[$key] = count($newarray); + } + } + return array_flip($newarray); + } + + + public static function ksort_recursive(&$theArray) { + ksort($theArray); + foreach ($theArray as $key => $value) { + if (is_array($value)) { + self::ksort_recursive($theArray[$key]); + } + } + return true; + } + + public static function fileextension($filename, $numextensions=1) { + if (strstr($filename, '.')) { + $reversedfilename = strrev($filename); + $offset = 0; + for ($i = 0; $i < $numextensions; $i++) { + $offset = strpos($reversedfilename, '.', $offset + 1); + if ($offset === false) { + return ''; + } + } + return strrev(substr($reversedfilename, 0, $offset)); + } + return ''; + } + + + public static function PlaytimeString($seconds) { + $sign = (($seconds < 0) ? '-' : ''); + $seconds = round(abs($seconds)); + $H = (int) floor( $seconds / 3600); + $M = (int) floor(($seconds - (3600 * $H) ) / 60); + $S = (int) round( $seconds - (3600 * $H) - (60 * $M) ); + return $sign.($H ? $H.':' : '').($H ? str_pad($M, 2, '0', STR_PAD_LEFT) : intval($M)).':'.str_pad($S, 2, 0, STR_PAD_LEFT); + } + + + public static function DateMac2Unix($macdate) { + // Macintosh timestamp: seconds since 00:00h January 1, 1904 + // UNIX timestamp: seconds since 00:00h January 1, 1970 + return self::CastAsInt($macdate - 2082844800); + } + + + public static function FixedPoint8_8($rawdata) { + return self::BigEndian2Int(substr($rawdata, 0, 1)) + (float) (self::BigEndian2Int(substr($rawdata, 1, 1)) / pow(2, 8)); + } + + + public static function FixedPoint16_16($rawdata) { + return self::BigEndian2Int(substr($rawdata, 0, 2)) + (float) (self::BigEndian2Int(substr($rawdata, 2, 2)) / pow(2, 16)); + } + + + public static function FixedPoint2_30($rawdata) { + $binarystring = self::BigEndian2Bin($rawdata); + return self::Bin2Dec(substr($binarystring, 0, 2)) + (float) (self::Bin2Dec(substr($binarystring, 2, 30)) / pow(2, 30)); + } + + + public static function CreateDeepArray($ArrayPath, $Separator, $Value) { + // assigns $Value to a nested array path: + // $foo = self::CreateDeepArray('/path/to/my', '/', 'file.txt') + // is the same as: + // $foo = array('path'=>array('to'=>'array('my'=>array('file.txt')))); + // or + // $foo['path']['to']['my'] = 'file.txt'; + $ArrayPath = ltrim($ArrayPath, $Separator); + if (($pos = strpos($ArrayPath, $Separator)) !== false) { + $ReturnedArray[substr($ArrayPath, 0, $pos)] = self::CreateDeepArray(substr($ArrayPath, $pos + 1), $Separator, $Value); + } else { + $ReturnedArray[$ArrayPath] = $Value; + } + return $ReturnedArray; + } + + public static function array_max($arraydata, $returnkey=false) { + $maxvalue = false; + $maxkey = false; + foreach ($arraydata as $key => $value) { + if (!is_array($value)) { + if ($value > $maxvalue) { + $maxvalue = $value; + $maxkey = $key; + } + } + } + return ($returnkey ? $maxkey : $maxvalue); + } + + public static function array_min($arraydata, $returnkey=false) { + $minvalue = false; + $minkey = false; + foreach ($arraydata as $key => $value) { + if (!is_array($value)) { + if ($value > $minvalue) { + $minvalue = $value; + $minkey = $key; + } + } + } + return ($returnkey ? $minkey : $minvalue); + } + + public static function XML2array($XMLstring) { + if (function_exists('simplexml_load_string') && function_exists('libxml_disable_entity_loader')) { + // http://websec.io/2012/08/27/Preventing-XEE-in-PHP.html + // https://core.trac.wordpress.org/changeset/29378 + $loader = libxml_disable_entity_loader(true); + $XMLobject = simplexml_load_string($XMLstring, 'SimpleXMLElement', LIBXML_NOENT); + $return = self::SimpleXMLelement2array($XMLobject); + libxml_disable_entity_loader($loader); + return $return; + } + return false; + } + + public static function SimpleXMLelement2array($XMLobject) { + if (!is_object($XMLobject) && !is_array($XMLobject)) { + return $XMLobject; + } + $XMLarray = (is_object($XMLobject) ? get_object_vars($XMLobject) : $XMLobject); + foreach ($XMLarray as $key => $value) { + $XMLarray[$key] = self::SimpleXMLelement2array($value); + } + return $XMLarray; + } + + + // Allan Hansen + // self::md5_data() - returns md5sum for a file from startuing position to absolute end position + public static function hash_data($file, $offset, $end, $algorithm) { + static $tempdir = ''; + if (!self::intValueSupported($end)) { + return false; + } + switch ($algorithm) { + case 'md5': + $hash_function = 'md5_file'; + $unix_call = 'md5sum'; + $windows_call = 'md5sum.exe'; + $hash_length = 32; + break; + + case 'sha1': + $hash_function = 'sha1_file'; + $unix_call = 'sha1sum'; + $windows_call = 'sha1sum.exe'; + $hash_length = 40; + break; + + default: + throw new Exception('Invalid algorithm ('.$algorithm.') in self::hash_data()'); + break; + } + $size = $end - $offset; + while (true) { + if (GETID3_OS_ISWINDOWS) { + + // It seems that sha1sum.exe for Windows only works on physical files, does not accept piped data + // Fall back to create-temp-file method: + if ($algorithm == 'sha1') { + break; + } + + $RequiredFiles = array('cygwin1.dll', 'head.exe', 'tail.exe', $windows_call); + foreach ($RequiredFiles as $required_file) { + if (!is_readable(GETID3_HELPERAPPSDIR.$required_file)) { + // helper apps not available - fall back to old method + break 2; + } + } + $commandline = GETID3_HELPERAPPSDIR.'head.exe -c '.$end.' '.escapeshellarg(str_replace('/', DIRECTORY_SEPARATOR, $file)).' | '; + $commandline .= GETID3_HELPERAPPSDIR.'tail.exe -c '.$size.' | '; + $commandline .= GETID3_HELPERAPPSDIR.$windows_call; + + } else { + + $commandline = 'head -c'.$end.' '.escapeshellarg($file).' | '; + $commandline .= 'tail -c'.$size.' | '; + $commandline .= $unix_call; + + } + if (preg_match('#(1|ON)#i', ini_get('safe_mode'))) { + //throw new Exception('PHP running in Safe Mode - backtick operator not available, using slower non-system-call '.$algorithm.' algorithm'); + break; + } + return substr(`$commandline`, 0, $hash_length); + } + + if (empty($tempdir)) { + // yes this is ugly, feel free to suggest a better way + require_once(dirname(__FILE__).'/getid3.php'); + $getid3_temp = new getID3(); + $tempdir = $getid3_temp->tempdir; + unset($getid3_temp); + } + // try to create a temporary file in the system temp directory - invalid dirname should force to system temp dir + if (($data_filename = tempnam($tempdir, 'gI3')) === false) { + // can't find anywhere to create a temp file, just fail + return false; + } + + // Init + $result = false; + + // copy parts of file + try { + self::CopyFileParts($file, $data_filename, $offset, $end - $offset); + $result = $hash_function($data_filename); + } catch (Exception $e) { + throw new Exception('self::CopyFileParts() failed in getid_lib::hash_data(): '.$e->getMessage()); + } + unlink($data_filename); + return $result; + } + + public static function CopyFileParts($filename_source, $filename_dest, $offset, $length) { + if (!self::intValueSupported($offset + $length)) { + throw new Exception('cannot copy file portion, it extends beyond the '.round(PHP_INT_MAX / 1073741824).'GB limit'); + } + if (is_readable($filename_source) && is_file($filename_source) && ($fp_src = fopen($filename_source, 'rb'))) { + if (($fp_dest = fopen($filename_dest, 'wb'))) { + if (fseek($fp_src, $offset) == 0) { + $byteslefttowrite = $length; + while (($byteslefttowrite > 0) && ($buffer = fread($fp_src, min($byteslefttowrite, getID3::FREAD_BUFFER_SIZE)))) { + $byteswritten = fwrite($fp_dest, $buffer, $byteslefttowrite); + $byteslefttowrite -= $byteswritten; + } + return true; + } else { + throw new Exception('failed to seek to offset '.$offset.' in '.$filename_source); + } + fclose($fp_dest); + } else { + throw new Exception('failed to create file for writing '.$filename_dest); + } + fclose($fp_src); + } else { + throw new Exception('failed to open file for reading '.$filename_source); + } + return false; + } + + public static function iconv_fallback_int_utf8($charval) { + if ($charval < 128) { + // 0bbbbbbb + $newcharstring = chr($charval); + } elseif ($charval < 2048) { + // 110bbbbb 10bbbbbb + $newcharstring = chr(($charval >> 6) | 0xC0); + $newcharstring .= chr(($charval & 0x3F) | 0x80); + } elseif ($charval < 65536) { + // 1110bbbb 10bbbbbb 10bbbbbb + $newcharstring = chr(($charval >> 12) | 0xE0); + $newcharstring .= chr(($charval >> 6) | 0xC0); + $newcharstring .= chr(($charval & 0x3F) | 0x80); + } else { + // 11110bbb 10bbbbbb 10bbbbbb 10bbbbbb + $newcharstring = chr(($charval >> 18) | 0xF0); + $newcharstring .= chr(($charval >> 12) | 0xC0); + $newcharstring .= chr(($charval >> 6) | 0xC0); + $newcharstring .= chr(($charval & 0x3F) | 0x80); + } + return $newcharstring; + } + + // ISO-8859-1 => UTF-8 + public static function iconv_fallback_iso88591_utf8($string, $bom=false) { + if (function_exists('utf8_encode')) { + return utf8_encode($string); + } + // utf8_encode() unavailable, use getID3()'s iconv_fallback() conversions (possibly PHP is compiled without XML support) + $newcharstring = ''; + if ($bom) { + $newcharstring .= "\xEF\xBB\xBF"; + } + for ($i = 0; $i < strlen($string); $i++) { + $charval = ord($string{$i}); + $newcharstring .= self::iconv_fallback_int_utf8($charval); + } + return $newcharstring; + } + + // ISO-8859-1 => UTF-16BE + public static function iconv_fallback_iso88591_utf16be($string, $bom=false) { + $newcharstring = ''; + if ($bom) { + $newcharstring .= "\xFE\xFF"; + } + for ($i = 0; $i < strlen($string); $i++) { + $newcharstring .= "\x00".$string{$i}; + } + return $newcharstring; + } + + // ISO-8859-1 => UTF-16LE + public static function iconv_fallback_iso88591_utf16le($string, $bom=false) { + $newcharstring = ''; + if ($bom) { + $newcharstring .= "\xFF\xFE"; + } + for ($i = 0; $i < strlen($string); $i++) { + $newcharstring .= $string{$i}."\x00"; + } + return $newcharstring; + } + + // ISO-8859-1 => UTF-16LE (BOM) + public static function iconv_fallback_iso88591_utf16($string) { + return self::iconv_fallback_iso88591_utf16le($string, true); + } + + // UTF-8 => ISO-8859-1 + public static function iconv_fallback_utf8_iso88591($string) { + if (function_exists('utf8_decode')) { + return utf8_decode($string); + } + // utf8_decode() unavailable, use getID3()'s iconv_fallback() conversions (possibly PHP is compiled without XML support) + $newcharstring = ''; + $offset = 0; + $stringlength = strlen($string); + while ($offset < $stringlength) { + if ((ord($string{$offset}) | 0x07) == 0xF7) { + // 11110bbb 10bbbbbb 10bbbbbb 10bbbbbb + $charval = ((ord($string{($offset + 0)}) & 0x07) << 18) & + ((ord($string{($offset + 1)}) & 0x3F) << 12) & + ((ord($string{($offset + 2)}) & 0x3F) << 6) & + (ord($string{($offset + 3)}) & 0x3F); + $offset += 4; + } elseif ((ord($string{$offset}) | 0x0F) == 0xEF) { + // 1110bbbb 10bbbbbb 10bbbbbb + $charval = ((ord($string{($offset + 0)}) & 0x0F) << 12) & + ((ord($string{($offset + 1)}) & 0x3F) << 6) & + (ord($string{($offset + 2)}) & 0x3F); + $offset += 3; + } elseif ((ord($string{$offset}) | 0x1F) == 0xDF) { + // 110bbbbb 10bbbbbb + $charval = ((ord($string{($offset + 0)}) & 0x1F) << 6) & + (ord($string{($offset + 1)}) & 0x3F); + $offset += 2; + } elseif ((ord($string{$offset}) | 0x7F) == 0x7F) { + // 0bbbbbbb + $charval = ord($string{$offset}); + $offset += 1; + } else { + // error? throw some kind of warning here? + $charval = false; + $offset += 1; + } + if ($charval !== false) { + $newcharstring .= (($charval < 256) ? chr($charval) : '?'); + } + } + return $newcharstring; + } + + // UTF-8 => UTF-16BE + public static function iconv_fallback_utf8_utf16be($string, $bom=false) { + $newcharstring = ''; + if ($bom) { + $newcharstring .= "\xFE\xFF"; + } + $offset = 0; + $stringlength = strlen($string); + while ($offset < $stringlength) { + if ((ord($string{$offset}) | 0x07) == 0xF7) { + // 11110bbb 10bbbbbb 10bbbbbb 10bbbbbb + $charval = ((ord($string{($offset + 0)}) & 0x07) << 18) & + ((ord($string{($offset + 1)}) & 0x3F) << 12) & + ((ord($string{($offset + 2)}) & 0x3F) << 6) & + (ord($string{($offset + 3)}) & 0x3F); + $offset += 4; + } elseif ((ord($string{$offset}) | 0x0F) == 0xEF) { + // 1110bbbb 10bbbbbb 10bbbbbb + $charval = ((ord($string{($offset + 0)}) & 0x0F) << 12) & + ((ord($string{($offset + 1)}) & 0x3F) << 6) & + (ord($string{($offset + 2)}) & 0x3F); + $offset += 3; + } elseif ((ord($string{$offset}) | 0x1F) == 0xDF) { + // 110bbbbb 10bbbbbb + $charval = ((ord($string{($offset + 0)}) & 0x1F) << 6) & + (ord($string{($offset + 1)}) & 0x3F); + $offset += 2; + } elseif ((ord($string{$offset}) | 0x7F) == 0x7F) { + // 0bbbbbbb + $charval = ord($string{$offset}); + $offset += 1; + } else { + // error? throw some kind of warning here? + $charval = false; + $offset += 1; + } + if ($charval !== false) { + $newcharstring .= (($charval < 65536) ? self::BigEndian2String($charval, 2) : "\x00".'?'); + } + } + return $newcharstring; + } + + // UTF-8 => UTF-16LE + public static function iconv_fallback_utf8_utf16le($string, $bom=false) { + $newcharstring = ''; + if ($bom) { + $newcharstring .= "\xFF\xFE"; + } + $offset = 0; + $stringlength = strlen($string); + while ($offset < $stringlength) { + if ((ord($string{$offset}) | 0x07) == 0xF7) { + // 11110bbb 10bbbbbb 10bbbbbb 10bbbbbb + $charval = ((ord($string{($offset + 0)}) & 0x07) << 18) & + ((ord($string{($offset + 1)}) & 0x3F) << 12) & + ((ord($string{($offset + 2)}) & 0x3F) << 6) & + (ord($string{($offset + 3)}) & 0x3F); + $offset += 4; + } elseif ((ord($string{$offset}) | 0x0F) == 0xEF) { + // 1110bbbb 10bbbbbb 10bbbbbb + $charval = ((ord($string{($offset + 0)}) & 0x0F) << 12) & + ((ord($string{($offset + 1)}) & 0x3F) << 6) & + (ord($string{($offset + 2)}) & 0x3F); + $offset += 3; + } elseif ((ord($string{$offset}) | 0x1F) == 0xDF) { + // 110bbbbb 10bbbbbb + $charval = ((ord($string{($offset + 0)}) & 0x1F) << 6) & + (ord($string{($offset + 1)}) & 0x3F); + $offset += 2; + } elseif ((ord($string{$offset}) | 0x7F) == 0x7F) { + // 0bbbbbbb + $charval = ord($string{$offset}); + $offset += 1; + } else { + // error? maybe throw some warning here? + $charval = false; + $offset += 1; + } + if ($charval !== false) { + $newcharstring .= (($charval < 65536) ? self::LittleEndian2String($charval, 2) : '?'."\x00"); + } + } + return $newcharstring; + } + + // UTF-8 => UTF-16LE (BOM) + public static function iconv_fallback_utf8_utf16($string) { + return self::iconv_fallback_utf8_utf16le($string, true); + } + + // UTF-16BE => UTF-8 + public static function iconv_fallback_utf16be_utf8($string) { + if (substr($string, 0, 2) == "\xFE\xFF") { + // strip BOM + $string = substr($string, 2); + } + $newcharstring = ''; + for ($i = 0; $i < strlen($string); $i += 2) { + $charval = self::BigEndian2Int(substr($string, $i, 2)); + $newcharstring .= self::iconv_fallback_int_utf8($charval); + } + return $newcharstring; + } + + // UTF-16LE => UTF-8 + public static function iconv_fallback_utf16le_utf8($string) { + if (substr($string, 0, 2) == "\xFF\xFE") { + // strip BOM + $string = substr($string, 2); + } + $newcharstring = ''; + for ($i = 0; $i < strlen($string); $i += 2) { + $charval = self::LittleEndian2Int(substr($string, $i, 2)); + $newcharstring .= self::iconv_fallback_int_utf8($charval); + } + return $newcharstring; + } + + // UTF-16BE => ISO-8859-1 + public static function iconv_fallback_utf16be_iso88591($string) { + if (substr($string, 0, 2) == "\xFE\xFF") { + // strip BOM + $string = substr($string, 2); + } + $newcharstring = ''; + for ($i = 0; $i < strlen($string); $i += 2) { + $charval = self::BigEndian2Int(substr($string, $i, 2)); + $newcharstring .= (($charval < 256) ? chr($charval) : '?'); + } + return $newcharstring; + } + + // UTF-16LE => ISO-8859-1 + public static function iconv_fallback_utf16le_iso88591($string) { + if (substr($string, 0, 2) == "\xFF\xFE") { + // strip BOM + $string = substr($string, 2); + } + $newcharstring = ''; + for ($i = 0; $i < strlen($string); $i += 2) { + $charval = self::LittleEndian2Int(substr($string, $i, 2)); + $newcharstring .= (($charval < 256) ? chr($charval) : '?'); + } + return $newcharstring; + } + + // UTF-16 (BOM) => ISO-8859-1 + public static function iconv_fallback_utf16_iso88591($string) { + $bom = substr($string, 0, 2); + if ($bom == "\xFE\xFF") { + return self::iconv_fallback_utf16be_iso88591(substr($string, 2)); + } elseif ($bom == "\xFF\xFE") { + return self::iconv_fallback_utf16le_iso88591(substr($string, 2)); + } + return $string; + } + + // UTF-16 (BOM) => UTF-8 + public static function iconv_fallback_utf16_utf8($string) { + $bom = substr($string, 0, 2); + if ($bom == "\xFE\xFF") { + return self::iconv_fallback_utf16be_utf8(substr($string, 2)); + } elseif ($bom == "\xFF\xFE") { + return self::iconv_fallback_utf16le_utf8(substr($string, 2)); + } + return $string; + } + + public static function iconv_fallback($in_charset, $out_charset, $string) { + + if ($in_charset == $out_charset) { + return $string; + } + + // mb_convert_encoding() availble + if (function_exists('mb_convert_encoding')) { + if ($converted_string = @mb_convert_encoding($string, $out_charset, $in_charset)) { + switch ($out_charset) { + case 'ISO-8859-1': + $converted_string = rtrim($converted_string, "\x00"); + break; + } + return $converted_string; + } + return $string; + } + // iconv() availble + else if (function_exists('iconv')) { + if ($converted_string = @iconv($in_charset, $out_charset.'//TRANSLIT', $string)) { + switch ($out_charset) { + case 'ISO-8859-1': + $converted_string = rtrim($converted_string, "\x00"); + break; + } + return $converted_string; + } + + // iconv() may sometimes fail with "illegal character in input string" error message + // and return an empty string, but returning the unconverted string is more useful + return $string; + } + + + // neither mb_convert_encoding or iconv() is available + static $ConversionFunctionList = array(); + if (empty($ConversionFunctionList)) { + $ConversionFunctionList['ISO-8859-1']['UTF-8'] = 'iconv_fallback_iso88591_utf8'; + $ConversionFunctionList['ISO-8859-1']['UTF-16'] = 'iconv_fallback_iso88591_utf16'; + $ConversionFunctionList['ISO-8859-1']['UTF-16BE'] = 'iconv_fallback_iso88591_utf16be'; + $ConversionFunctionList['ISO-8859-1']['UTF-16LE'] = 'iconv_fallback_iso88591_utf16le'; + $ConversionFunctionList['UTF-8']['ISO-8859-1'] = 'iconv_fallback_utf8_iso88591'; + $ConversionFunctionList['UTF-8']['UTF-16'] = 'iconv_fallback_utf8_utf16'; + $ConversionFunctionList['UTF-8']['UTF-16BE'] = 'iconv_fallback_utf8_utf16be'; + $ConversionFunctionList['UTF-8']['UTF-16LE'] = 'iconv_fallback_utf8_utf16le'; + $ConversionFunctionList['UTF-16']['ISO-8859-1'] = 'iconv_fallback_utf16_iso88591'; + $ConversionFunctionList['UTF-16']['UTF-8'] = 'iconv_fallback_utf16_utf8'; + $ConversionFunctionList['UTF-16LE']['ISO-8859-1'] = 'iconv_fallback_utf16le_iso88591'; + $ConversionFunctionList['UTF-16LE']['UTF-8'] = 'iconv_fallback_utf16le_utf8'; + $ConversionFunctionList['UTF-16BE']['ISO-8859-1'] = 'iconv_fallback_utf16be_iso88591'; + $ConversionFunctionList['UTF-16BE']['UTF-8'] = 'iconv_fallback_utf16be_utf8'; + } + if (isset($ConversionFunctionList[strtoupper($in_charset)][strtoupper($out_charset)])) { + $ConversionFunction = $ConversionFunctionList[strtoupper($in_charset)][strtoupper($out_charset)]; + return self::$ConversionFunction($string); + } + throw new Exception('PHP does not has mb_convert_encoding() or iconv() support - cannot convert from '.$in_charset.' to '.$out_charset); + } + + public static function recursiveMultiByteCharString2HTML($data, $charset='ISO-8859-1') { + if (is_string($data)) { + return self::MultiByteCharString2HTML($data, $charset); + } elseif (is_array($data)) { + $return_data = array(); + foreach ($data as $key => $value) { + $return_data[$key] = self::recursiveMultiByteCharString2HTML($value, $charset); + } + return $return_data; + } + // integer, float, objects, resources, etc + return $data; + } + + public static function MultiByteCharString2HTML($string, $charset='ISO-8859-1') { + $string = (string) $string; // in case trying to pass a numeric (float, int) string, would otherwise return an empty string + $HTMLstring = ''; + + switch (strtolower($charset)) { + case '1251': + case '1252': + case '866': + case '932': + case '936': + case '950': + case 'big5': + case 'big5-hkscs': + case 'cp1251': + case 'cp1252': + case 'cp866': + case 'euc-jp': + case 'eucjp': + case 'gb2312': + case 'ibm866': + case 'iso-8859-1': + case 'iso-8859-15': + case 'iso8859-1': + case 'iso8859-15': + case 'koi8-r': + case 'koi8-ru': + case 'koi8r': + case 'shift_jis': + case 'sjis': + case 'win-1251': + case 'windows-1251': + case 'windows-1252': + $HTMLstring = htmlentities($string, ENT_COMPAT, $charset); + break; + + case 'utf-8': + $strlen = strlen($string); + for ($i = 0; $i < $strlen; $i++) { + $char_ord_val = ord($string{$i}); + $charval = 0; + if ($char_ord_val < 0x80) { + $charval = $char_ord_val; + } elseif ((($char_ord_val & 0xF0) >> 4) == 0x0F && $i+3 < $strlen) { + $charval = (($char_ord_val & 0x07) << 18); + $charval += ((ord($string{++$i}) & 0x3F) << 12); + $charval += ((ord($string{++$i}) & 0x3F) << 6); + $charval += (ord($string{++$i}) & 0x3F); + } elseif ((($char_ord_val & 0xE0) >> 5) == 0x07 && $i+2 < $strlen) { + $charval = (($char_ord_val & 0x0F) << 12); + $charval += ((ord($string{++$i}) & 0x3F) << 6); + $charval += (ord($string{++$i}) & 0x3F); + } elseif ((($char_ord_val & 0xC0) >> 6) == 0x03 && $i+1 < $strlen) { + $charval = (($char_ord_val & 0x1F) << 6); + $charval += (ord($string{++$i}) & 0x3F); + } + if (($charval >= 32) && ($charval <= 127)) { + $HTMLstring .= htmlentities(chr($charval)); + } else { + $HTMLstring .= '&#'.$charval.';'; + } + } + break; + + case 'utf-16le': + for ($i = 0; $i < strlen($string); $i += 2) { + $charval = self::LittleEndian2Int(substr($string, $i, 2)); + if (($charval >= 32) && ($charval <= 127)) { + $HTMLstring .= chr($charval); + } else { + $HTMLstring .= '&#'.$charval.';'; + } + } + break; + + case 'utf-16be': + for ($i = 0; $i < strlen($string); $i += 2) { + $charval = self::BigEndian2Int(substr($string, $i, 2)); + if (($charval >= 32) && ($charval <= 127)) { + $HTMLstring .= chr($charval); + } else { + $HTMLstring .= '&#'.$charval.';'; + } + } + break; + + default: + $HTMLstring = 'ERROR: Character set "'.$charset.'" not supported in MultiByteCharString2HTML()'; + break; + } + return $HTMLstring; + } + + + + public static function RGADnameLookup($namecode) { + static $RGADname = array(); + if (empty($RGADname)) { + $RGADname[0] = 'not set'; + $RGADname[1] = 'Track Gain Adjustment'; + $RGADname[2] = 'Album Gain Adjustment'; + } + + return (isset($RGADname[$namecode]) ? $RGADname[$namecode] : ''); + } + + + public static function RGADoriginatorLookup($originatorcode) { + static $RGADoriginator = array(); + if (empty($RGADoriginator)) { + $RGADoriginator[0] = 'unspecified'; + $RGADoriginator[1] = 'pre-set by artist/producer/mastering engineer'; + $RGADoriginator[2] = 'set by user'; + $RGADoriginator[3] = 'determined automatically'; + } + + return (isset($RGADoriginator[$originatorcode]) ? $RGADoriginator[$originatorcode] : ''); + } + + + public static function RGADadjustmentLookup($rawadjustment, $signbit) { + $adjustment = $rawadjustment / 10; + if ($signbit == 1) { + $adjustment *= -1; + } + return (float) $adjustment; + } + + + public static function RGADgainString($namecode, $originatorcode, $replaygain) { + if ($replaygain < 0) { + $signbit = '1'; + } else { + $signbit = '0'; + } + $storedreplaygain = intval(round($replaygain * 10)); + $gainstring = str_pad(decbin($namecode), 3, '0', STR_PAD_LEFT); + $gainstring .= str_pad(decbin($originatorcode), 3, '0', STR_PAD_LEFT); + $gainstring .= $signbit; + $gainstring .= str_pad(decbin($storedreplaygain), 9, '0', STR_PAD_LEFT); + + return $gainstring; + } + + public static function RGADamplitude2dB($amplitude) { + return 20 * log10($amplitude); + } + + + public static function GetDataImageSize($imgData, &$imageinfo=array()) { + static $tempdir = ''; + if (empty($tempdir)) { + if (function_exists('sys_get_temp_dir')) { + $tempdir = sys_get_temp_dir(); // https://github.com/JamesHeinrich/getID3/issues/52 + } + + // yes this is ugly, feel free to suggest a better way + if (include_once(dirname(__FILE__).'/getid3.php')) { + if ($getid3_temp = new getID3()) { + if ($getid3_temp_tempdir = $getid3_temp->tempdir) { + $tempdir = $getid3_temp_tempdir; + } + unset($getid3_temp, $getid3_temp_tempdir); + } + } + } + $GetDataImageSize = false; + if ($tempfilename = tempnam($tempdir, 'gI3')) { + if (is_writable($tempfilename) && is_file($tempfilename) && ($tmp = fopen($tempfilename, 'wb'))) { + fwrite($tmp, $imgData); + fclose($tmp); + $GetDataImageSize = @getimagesize($tempfilename, $imageinfo); + if (($GetDataImageSize === false) || !isset($GetDataImageSize[0]) || !isset($GetDataImageSize[1])) { + return false; + } + $GetDataImageSize['height'] = $GetDataImageSize[0]; + $GetDataImageSize['width'] = $GetDataImageSize[1]; + } + unlink($tempfilename); + } + return $GetDataImageSize; + } + + public static function ImageExtFromMime($mime_type) { + // temporary way, works OK for now, but should be reworked in the future + return str_replace(array('image/', 'x-', 'jpeg'), array('', '', 'jpg'), $mime_type); + } + + public static function ImageTypesLookup($imagetypeid) { + static $ImageTypesLookup = array(); + if (empty($ImageTypesLookup)) { + $ImageTypesLookup[1] = 'gif'; + $ImageTypesLookup[2] = 'jpeg'; + $ImageTypesLookup[3] = 'png'; + $ImageTypesLookup[4] = 'swf'; + $ImageTypesLookup[5] = 'psd'; + $ImageTypesLookup[6] = 'bmp'; + $ImageTypesLookup[7] = 'tiff (little-endian)'; + $ImageTypesLookup[8] = 'tiff (big-endian)'; + $ImageTypesLookup[9] = 'jpc'; + $ImageTypesLookup[10] = 'jp2'; + $ImageTypesLookup[11] = 'jpx'; + $ImageTypesLookup[12] = 'jb2'; + $ImageTypesLookup[13] = 'swc'; + $ImageTypesLookup[14] = 'iff'; + } + return (isset($ImageTypesLookup[$imagetypeid]) ? $ImageTypesLookup[$imagetypeid] : ''); + } + + public static function CopyTagsToComments(&$ThisFileInfo) { + + // Copy all entries from ['tags'] into common ['comments'] + if (!empty($ThisFileInfo['tags'])) { + foreach ($ThisFileInfo['tags'] as $tagtype => $tagarray) { + foreach ($tagarray as $tagname => $tagdata) { + foreach ($tagdata as $key => $value) { + if (!empty($value)) { + if (empty($ThisFileInfo['comments'][$tagname])) { + + // fall through and append value + + } elseif ($tagtype == 'id3v1') { + + $newvaluelength = strlen(trim($value)); + foreach ($ThisFileInfo['comments'][$tagname] as $existingkey => $existingvalue) { + $oldvaluelength = strlen(trim($existingvalue)); + if (($newvaluelength <= $oldvaluelength) && (substr($existingvalue, 0, $newvaluelength) == trim($value))) { + // new value is identical but shorter-than (or equal-length to) one already in comments - skip + break 2; + } + } + + } elseif (!is_array($value)) { + + $newvaluelength = strlen(trim($value)); + foreach ($ThisFileInfo['comments'][$tagname] as $existingkey => $existingvalue) { + $oldvaluelength = strlen(trim($existingvalue)); + if ((strlen($existingvalue) > 10) && ($newvaluelength > $oldvaluelength) && (substr(trim($value), 0, strlen($existingvalue)) == $existingvalue)) { + $ThisFileInfo['comments'][$tagname][$existingkey] = trim($value); + //break 2; + break; + } + } + + } + if (is_array($value) || empty($ThisFileInfo['comments'][$tagname]) || !in_array(trim($value), $ThisFileInfo['comments'][$tagname])) { + $value = (is_string($value) ? trim($value) : $value); + if (!is_int($key) && !ctype_digit($key)) { + $ThisFileInfo['comments'][$tagname][$key] = $value; + } else { + if (isset($ThisFileInfo['comments'][$tagname])) { + $ThisFileInfo['comments'][$tagname] = array($value); + } else { + $ThisFileInfo['comments'][$tagname][] = $value; + } + } + } + } + } + } + } + + // attempt to standardize spelling of returned keys + $StandardizeFieldNames = array( + 'tracknumber' => 'track_number', + 'track' => 'track_number', + ); + foreach ($StandardizeFieldNames as $badkey => $goodkey) { + if (array_key_exists($badkey, $ThisFileInfo['comments']) && !array_key_exists($goodkey, $ThisFileInfo['comments'])) { + $ThisFileInfo['comments'][$goodkey] = $ThisFileInfo['comments'][$badkey]; + unset($ThisFileInfo['comments'][$badkey]); + } + } + + // Copy to ['comments_html'] + if (!empty($ThisFileInfo['comments'])) { + foreach ($ThisFileInfo['comments'] as $field => $values) { + if ($field == 'picture') { + // pictures can take up a lot of space, and we don't need multiple copies of them + // let there be a single copy in [comments][picture], and not elsewhere + continue; + } + foreach ($values as $index => $value) { + if (is_array($value)) { + $ThisFileInfo['comments_html'][$field][$index] = $value; + } else { + $ThisFileInfo['comments_html'][$field][$index] = str_replace('�', '', self::MultiByteCharString2HTML($value, $ThisFileInfo['encoding'])); + } + } + } + } + + } + return true; + } + + + public static function EmbeddedLookup($key, $begin, $end, $file, $name) { + + // Cached + static $cache; + if (isset($cache[$file][$name])) { + return (isset($cache[$file][$name][$key]) ? $cache[$file][$name][$key] : ''); + } + + // Init + $keylength = strlen($key); + $line_count = $end - $begin - 7; + + // Open php file + $fp = fopen($file, 'r'); + + // Discard $begin lines + for ($i = 0; $i < ($begin + 3); $i++) { + fgets($fp, 1024); + } + + // Loop thru line + while (0 < $line_count--) { + + // Read line + $line = ltrim(fgets($fp, 1024), "\t "); + + // METHOD A: only cache the matching key - less memory but slower on next lookup of not-previously-looked-up key + //$keycheck = substr($line, 0, $keylength); + //if ($key == $keycheck) { + // $cache[$file][$name][$keycheck] = substr($line, $keylength + 1); + // break; + //} + + // METHOD B: cache all keys in this lookup - more memory but faster on next lookup of not-previously-looked-up key + //$cache[$file][$name][substr($line, 0, $keylength)] = trim(substr($line, $keylength + 1)); + $explodedLine = explode("\t", $line, 2); + $ThisKey = (isset($explodedLine[0]) ? $explodedLine[0] : ''); + $ThisValue = (isset($explodedLine[1]) ? $explodedLine[1] : ''); + $cache[$file][$name][$ThisKey] = trim($ThisValue); + } + + // Close and return + fclose($fp); + return (isset($cache[$file][$name][$key]) ? $cache[$file][$name][$key] : ''); + } + + public static function IncludeDependency($filename, $sourcefile, $DieOnFailure=false) { + global $GETID3_ERRORARRAY; + + if (file_exists($filename)) { + if (include_once($filename)) { + return true; + } else { + $diemessage = basename($sourcefile).' depends on '.$filename.', which has errors'; + } + } else { + $diemessage = basename($sourcefile).' depends on '.$filename.', which is missing'; + } + if ($DieOnFailure) { + throw new Exception($diemessage); + } else { + $GETID3_ERRORARRAY[] = $diemessage; + } + return false; + } + + public static function trimNullByte($string) { + return trim($string, "\x00"); + } + + public static function getFileSizeSyscall($path) { + $filesize = false; + + if (GETID3_OS_ISWINDOWS) { + if (class_exists('COM')) { // From PHP 5.3.15 and 5.4.5, COM and DOTNET is no longer built into the php core.you have to add COM support in php.ini: + $filesystem = new COM('Scripting.FileSystemObject'); + $file = $filesystem->GetFile($path); + $filesize = $file->Size(); + unset($filesystem, $file); + } else { + $commandline = 'for %I in ('.escapeshellarg($path).') do @echo %~zI'; + } + } else { + $commandline = 'ls -l '.escapeshellarg($path).' | awk \'{print $5}\''; + } + if (isset($commandline)) { + $output = trim(`$commandline`); + if (ctype_digit($output)) { + $filesize = (float) $output; + } + } + return $filesize; + } + + + /** + * Workaround for Bug #37268 (https://bugs.php.net/bug.php?id=37268) + * @param string $path A path. + * @param string $suffix If the name component ends in suffix this will also be cut off. + * @return string + */ + public static function mb_basename($path, $suffix = null) { + $splited = preg_split('#/#', rtrim($path, '/ ')); + return substr(basename('X'.$splited[count($splited) - 1], $suffix), 1); + } + +} diff --git a/www/rompr/getid3/getid3.php b/www/rompr/getid3/getid3.php new file mode 100644 index 0000000..5b6e953 --- /dev/null +++ b/www/rompr/getid3/getid3.php @@ -0,0 +1,1858 @@ + // +// available at http://getid3.sourceforge.net // +// or http://www.getid3.org // +// also https://github.com/JamesHeinrich/getID3 // +///////////////////////////////////////////////////////////////// +// // +// Please see readme.txt for more information // +// /// +///////////////////////////////////////////////////////////////// + +// define a constant rather than looking up every time it is needed +if (!defined('GETID3_OS_ISWINDOWS')) { + define('GETID3_OS_ISWINDOWS', (stripos(PHP_OS, 'WIN') === 0)); +} +// Get base path of getID3() - ONCE +if (!defined('GETID3_INCLUDEPATH')) { + define('GETID3_INCLUDEPATH', dirname(__FILE__).DIRECTORY_SEPARATOR); +} +// Workaround Bug #39923 (https://bugs.php.net/bug.php?id=39923) +if (!defined('IMG_JPG') && defined('IMAGETYPE_JPEG')) { + define('IMG_JPG', IMAGETYPE_JPEG); +} +if (!defined('ENT_SUBSTITUTE')) { // PHP5.3 adds ENT_IGNORE, PHP5.4 adds ENT_SUBSTITUTE + define('ENT_SUBSTITUTE', (defined('ENT_IGNORE') ? ENT_IGNORE : 8)); +} + +/* +http://www.getid3.org/phpBB3/viewtopic.php?t=2114 +If you are running into a the problem where filenames with special characters are being handled +incorrectly by external helper programs (e.g. metaflac), notably with the special characters removed, +and you are passing in the filename in UTF8 (typically via a HTML form), try uncommenting this line: +*/ +//setlocale(LC_CTYPE, 'en_US.UTF-8'); + +// attempt to define temp dir as something flexible but reliable +$temp_dir = ini_get('upload_tmp_dir'); +if ($temp_dir && (!is_dir($temp_dir) || !is_readable($temp_dir))) { + $temp_dir = ''; +} +if (!$temp_dir && function_exists('sys_get_temp_dir')) { // sys_get_temp_dir added in PHP v5.2.1 + // sys_get_temp_dir() may give inaccessible temp dir, e.g. with open_basedir on virtual hosts + $temp_dir = sys_get_temp_dir(); +} +$temp_dir = @realpath($temp_dir); // see https://github.com/JamesHeinrich/getID3/pull/10 +$open_basedir = ini_get('open_basedir'); +if ($open_basedir) { + // e.g. "/var/www/vhosts/getid3.org/httpdocs/:/tmp/" + $temp_dir = str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $temp_dir); + $open_basedir = str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $open_basedir); + if (substr($temp_dir, -1, 1) != DIRECTORY_SEPARATOR) { + $temp_dir .= DIRECTORY_SEPARATOR; + } + $found_valid_tempdir = false; + $open_basedirs = explode(PATH_SEPARATOR, $open_basedir); + foreach ($open_basedirs as $basedir) { + if (substr($basedir, -1, 1) != DIRECTORY_SEPARATOR) { + $basedir .= DIRECTORY_SEPARATOR; + } + if (preg_match('#^'.preg_quote($basedir).'#', $temp_dir)) { + $found_valid_tempdir = true; + break; + } + } + if (!$found_valid_tempdir) { + $temp_dir = ''; + } + unset($open_basedirs, $found_valid_tempdir, $basedir); +} +if (!$temp_dir) { + $temp_dir = '*'; // invalid directory name should force tempnam() to use system default temp dir +} +// $temp_dir = '/something/else/'; // feel free to override temp dir here if it works better for your system +if (!defined('GETID3_TEMP_DIR')) { + define('GETID3_TEMP_DIR', $temp_dir); +} +unset($open_basedir, $temp_dir); + +// End: Defines + + +class getID3 +{ + // public: Settings + public $encoding = 'UTF-8'; // CASE SENSITIVE! - i.e. (must be supported by iconv()). Examples: ISO-8859-1 UTF-8 UTF-16 UTF-16BE + public $encoding_id3v1 = 'ISO-8859-1'; // Should always be 'ISO-8859-1', but some tags may be written in other encodings such as 'EUC-CN' or 'CP1252' + + // public: Optional tag checks - disable for speed. + public $option_tag_id3v1 = true; // Read and process ID3v1 tags + public $option_tag_id3v2 = true; // Read and process ID3v2 tags + public $option_tag_lyrics3 = true; // Read and process Lyrics3 tags + public $option_tag_apetag = true; // Read and process APE tags + public $option_tags_process = true; // Copy tags to root key 'tags' and encode to $this->encoding + public $option_tags_html = true; // Copy tags to root key 'tags_html' properly translated from various encodings to HTML entities + + // public: Optional tag/comment calucations + public $option_extra_info = true; // Calculate additional info such as bitrate, channelmode etc + + // public: Optional handling of embedded attachments (e.g. images) + public $option_save_attachments = true; // defaults to true (ATTACHMENTS_INLINE) for backward compatibility + + // public: Optional calculations + public $option_md5_data = false; // Get MD5 sum of data part - slow + public $option_md5_data_source = false; // Use MD5 of source file if availble - only FLAC and OptimFROG + public $option_sha1_data = false; // Get SHA1 sum of data part - slow + public $option_max_2gb_check = null; // Check whether file is larger than 2GB and thus not supported by 32-bit PHP (null: auto-detect based on PHP_INT_MAX) + + // public: Read buffer size in bytes + public $option_fread_buffer_size = 32768; + + // Public variables + public $filename; // Filename of file being analysed. + public $fp; // Filepointer to file being analysed. + public $info; // Result array. + public $tempdir = GETID3_TEMP_DIR; + public $memory_limit = 0; + + // Protected variables + protected $startup_error = ''; + protected $startup_warning = ''; + + const VERSION = '1.9.15-201709291043'; + const FREAD_BUFFER_SIZE = 32768; + + const ATTACHMENTS_NONE = false; + const ATTACHMENTS_INLINE = true; + + // public: constructor + public function __construct() { + + // Check for PHP version + $required_php_version = '5.3.0'; + if (version_compare(PHP_VERSION, $required_php_version, '<')) { + $this->startup_error .= 'getID3() requires PHP v'.$required_php_version.' or higher - you are running v'.PHP_VERSION."\n"; + return false; + } + + // Check memory + $this->memory_limit = ini_get('memory_limit'); + if (preg_match('#([0-9]+) ?M#i', $this->memory_limit, $matches)) { + // could be stored as "16M" rather than 16777216 for example + $this->memory_limit = $matches[1] * 1048576; + } elseif (preg_match('#([0-9]+) ?G#i', $this->memory_limit, $matches)) { // The 'G' modifier is available since PHP 5.1.0 + // could be stored as "2G" rather than 2147483648 for example + $this->memory_limit = $matches[1] * 1073741824; + } + if ($this->memory_limit <= 0) { + // memory limits probably disabled + } elseif ($this->memory_limit <= 4194304) { + $this->startup_error .= 'PHP has less than 4MB available memory and will very likely run out. Increase memory_limit in php.ini'."\n"; + } elseif ($this->memory_limit <= 12582912) { + $this->startup_warning .= 'PHP has less than 12MB available memory and might run out if all modules are loaded. Increase memory_limit in php.ini'."\n"; + } + + // Check safe_mode off + if (preg_match('#(1|ON)#i', ini_get('safe_mode'))) { + $this->warning('WARNING: Safe mode is on, shorten support disabled, md5data/sha1data for ogg vorbis disabled, ogg vorbos/flac tag writing disabled.'); + } + + if (($mbstring_func_overload = ini_get('mbstring.func_overload')) && ($mbstring_func_overload & 0x02)) { + // http://php.net/manual/en/mbstring.overload.php + // "mbstring.func_overload in php.ini is a positive value that represents a combination of bitmasks specifying the categories of functions to be overloaded. It should be set to 1 to overload the mail() function. 2 for string functions, 4 for regular expression functions" + // getID3 cannot run when string functions are overloaded. It doesn't matter if mail() or ereg* functions are overloaded since getID3 does not use those. + $this->startup_error .= 'WARNING: php.ini contains "mbstring.func_overload = '.ini_get('mbstring.func_overload').'", getID3 cannot run with this setting (bitmask 2 (string functions) cannot be set). Recommended to disable entirely.'."\n"; + } + + // Check for magic_quotes_runtime + if (function_exists('get_magic_quotes_runtime')) { + if (get_magic_quotes_runtime()) { + $this->startup_error .= 'magic_quotes_runtime must be disabled before running getID3(). Surround getid3 block by set_magic_quotes_runtime(0) and set_magic_quotes_runtime(1).'."\n"; + } + } + + // Check for magic_quotes_gpc + if (function_exists('magic_quotes_gpc')) { + if (get_magic_quotes_gpc()) { + $this->startup_error .= 'magic_quotes_gpc must be disabled before running getID3(). Surround getid3 block by set_magic_quotes_gpc(0) and set_magic_quotes_gpc(1).'."\n"; + } + } + + // Load support library + if (!include_once(GETID3_INCLUDEPATH.'getid3.lib.php')) { + $this->startup_error .= 'getid3.lib.php is missing or corrupt'."\n"; + } + + if ($this->option_max_2gb_check === null) { + $this->option_max_2gb_check = (PHP_INT_MAX <= 2147483647); + } + + + // Needed for Windows only: + // Define locations of helper applications for Shorten, VorbisComment, MetaFLAC + // as well as other helper functions such as head, tail, md5sum, etc + // This path cannot contain spaces, but the below code will attempt to get the + // 8.3-equivalent path automatically + // IMPORTANT: This path must include the trailing slash + if (GETID3_OS_ISWINDOWS && !defined('GETID3_HELPERAPPSDIR')) { + + $helperappsdir = GETID3_INCLUDEPATH.'..'.DIRECTORY_SEPARATOR.'helperapps'; // must not have any space in this path + + if (!is_dir($helperappsdir)) { + $this->startup_warning .= '"'.$helperappsdir.'" cannot be defined as GETID3_HELPERAPPSDIR because it does not exist'."\n"; + } elseif (strpos(realpath($helperappsdir), ' ') !== false) { + $DirPieces = explode(DIRECTORY_SEPARATOR, realpath($helperappsdir)); + $path_so_far = array(); + foreach ($DirPieces as $key => $value) { + if (strpos($value, ' ') !== false) { + if (!empty($path_so_far)) { + $commandline = 'dir /x '.escapeshellarg(implode(DIRECTORY_SEPARATOR, $path_so_far)); + $dir_listing = `$commandline`; + $lines = explode("\n", $dir_listing); + foreach ($lines as $line) { + $line = trim($line); + if (preg_match('#^([0-9/]{10}) +([0-9:]{4,5}( [AP]M)?) +(|[0-9,]+) +([^ ]{0,11}) +(.+)$#', $line, $matches)) { + list($dummy, $date, $time, $ampm, $filesize, $shortname, $filename) = $matches; + if ((strtoupper($filesize) == '') && (strtolower($filename) == strtolower($value))) { + $value = $shortname; + } + } + } + } else { + $this->startup_warning .= 'GETID3_HELPERAPPSDIR must not have any spaces in it - use 8dot3 naming convention if neccesary. You can run "dir /x" from the commandline to see the correct 8.3-style names.'."\n"; + } + } + $path_so_far[] = $value; + } + $helperappsdir = implode(DIRECTORY_SEPARATOR, $path_so_far); + } + define('GETID3_HELPERAPPSDIR', $helperappsdir.DIRECTORY_SEPARATOR); + } + + if (!empty($this->startup_error)) { + echo $this->startup_error; + throw new getid3_exception($this->startup_error); + } + + return true; + } + + public function version() { + return self::VERSION; + } + + public function fread_buffer_size() { + return $this->option_fread_buffer_size; + } + + + // public: setOption + public function setOption($optArray) { + if (!is_array($optArray) || empty($optArray)) { + return false; + } + foreach ($optArray as $opt => $val) { + if (isset($this->$opt) === false) { + continue; + } + $this->$opt = $val; + } + return true; + } + + + public function openfile($filename, $filesize=null) { + try { + if (!empty($this->startup_error)) { + throw new getid3_exception($this->startup_error); + } + if (!empty($this->startup_warning)) { + foreach (explode("\n", $this->startup_warning) as $startup_warning) { + $this->warning($startup_warning); + } + } + + // init result array and set parameters + $this->filename = $filename; + $this->info = array(); + $this->info['GETID3_VERSION'] = $this->version(); + $this->info['php_memory_limit'] = (($this->memory_limit > 0) ? $this->memory_limit : false); + + // remote files not supported + if (preg_match('#^(ht|f)tp://#', $filename)) { + throw new getid3_exception('Remote files are not supported - please copy the file locally first'); + } + + $filename = str_replace('/', DIRECTORY_SEPARATOR, $filename); + $filename = preg_replace('#(?fp = fopen($filename, 'rb'))) { // see http://www.getid3.org/phpBB3/viewtopic.php?t=1720 + if ((is_readable($filename) || file_exists($filename)) && is_file($filename) && ($this->fp = fopen($filename, 'rb'))) { + // great + } else { + $errormessagelist = array(); + if (!is_readable($filename)) { + $errormessagelist[] = '!is_readable'; + } + if (!is_file($filename)) { + $errormessagelist[] = '!is_file'; + } + if (!file_exists($filename)) { + $errormessagelist[] = '!file_exists'; + } + if (empty($errormessagelist)) { + $errormessagelist[] = 'fopen failed'; + } + throw new getid3_exception('Could not open "'.$filename.'" ('.implode('; ', $errormessagelist).')'); + } + + $this->info['filesize'] = (!is_null($filesize) ? $filesize : filesize($filename)); + // set redundant parameters - might be needed in some include file + // filenames / filepaths in getID3 are always expressed with forward slashes (unix-style) for both Windows and other to try and minimize confusion + $filename = str_replace('\\', '/', $filename); + $this->info['filepath'] = str_replace('\\', '/', realpath(dirname($filename))); + $this->info['filename'] = getid3_lib::mb_basename($filename); + $this->info['filenamepath'] = $this->info['filepath'].'/'.$this->info['filename']; + + // set more parameters + $this->info['avdataoffset'] = 0; + $this->info['avdataend'] = $this->info['filesize']; + $this->info['fileformat'] = ''; // filled in later + $this->info['audio']['dataformat'] = ''; // filled in later, unset if not used + $this->info['video']['dataformat'] = ''; // filled in later, unset if not used + $this->info['tags'] = array(); // filled in later, unset if not used + $this->info['error'] = array(); // filled in later, unset if not used + $this->info['warning'] = array(); // filled in later, unset if not used + $this->info['comments'] = array(); // filled in later, unset if not used + $this->info['encoding'] = $this->encoding; // required by id3v2 and iso modules - can be unset at the end if desired + + // option_max_2gb_check + if ($this->option_max_2gb_check) { + // PHP (32-bit all, and 64-bit Windows) doesn't support integers larger than 2^31 (~2GB) + // filesize() simply returns (filesize % (pow(2, 32)), no matter the actual filesize + // ftell() returns 0 if seeking to the end is beyond the range of unsigned integer + $fseek = fseek($this->fp, 0, SEEK_END); + if (($fseek < 0) || (($this->info['filesize'] != 0) && (ftell($this->fp) == 0)) || + ($this->info['filesize'] < 0) || + (ftell($this->fp) < 0)) { + $real_filesize = getid3_lib::getFileSizeSyscall($this->info['filenamepath']); + + if ($real_filesize === false) { + unset($this->info['filesize']); + fclose($this->fp); + throw new getid3_exception('Unable to determine actual filesize. File is most likely larger than '.round(PHP_INT_MAX / 1073741824).'GB and is not supported by PHP.'); + } elseif (getid3_lib::intValueSupported($real_filesize)) { + unset($this->info['filesize']); + fclose($this->fp); + throw new getid3_exception('PHP seems to think the file is larger than '.round(PHP_INT_MAX / 1073741824).'GB, but filesystem reports it as '.number_format($real_filesize, 3).'GB, please report to info@getid3.org'); + } + $this->info['filesize'] = $real_filesize; + $this->warning('File is larger than '.round(PHP_INT_MAX / 1073741824).'GB (filesystem reports it as '.number_format($real_filesize, 3).'GB) and is not properly supported by PHP.'); + } + } + + return true; + + } catch (Exception $e) { + $this->error($e->getMessage()); + } + return false; + } + + // public: analyze file + public function analyze($filename, $filesize=null, $original_filename='') { + try { + if (!$this->openfile($filename, $filesize)) { + return $this->info; + } + + // Handle tags + foreach (array('id3v2'=>'id3v2', 'id3v1'=>'id3v1', 'apetag'=>'ape', 'lyrics3'=>'lyrics3') as $tag_name => $tag_key) { + $option_tag = 'option_tag_'.$tag_name; + if ($this->$option_tag) { + $this->include_module('tag.'.$tag_name); + try { + $tag_class = 'getid3_'.$tag_name; + $tag = new $tag_class($this); + $tag->Analyze(); + } + catch (getid3_exception $e) { + throw $e; + } + } + } + if (isset($this->info['id3v2']['tag_offset_start'])) { + $this->info['avdataoffset'] = max($this->info['avdataoffset'], $this->info['id3v2']['tag_offset_end']); + } + foreach (array('id3v1'=>'id3v1', 'apetag'=>'ape', 'lyrics3'=>'lyrics3') as $tag_name => $tag_key) { + if (isset($this->info[$tag_key]['tag_offset_start'])) { + $this->info['avdataend'] = min($this->info['avdataend'], $this->info[$tag_key]['tag_offset_start']); + } + } + + // ID3v2 detection (NOT parsing), even if ($this->option_tag_id3v2 == false) done to make fileformat easier + if (!$this->option_tag_id3v2) { + fseek($this->fp, 0); + $header = fread($this->fp, 10); + if ((substr($header, 0, 3) == 'ID3') && (strlen($header) == 10)) { + $this->info['id3v2']['header'] = true; + $this->info['id3v2']['majorversion'] = ord($header{3}); + $this->info['id3v2']['minorversion'] = ord($header{4}); + $this->info['avdataoffset'] += getid3_lib::BigEndian2Int(substr($header, 6, 4), 1) + 10; // length of ID3v2 tag in 10-byte header doesn't include 10-byte header length + } + } + + // read 32 kb file data + fseek($this->fp, $this->info['avdataoffset']); + $formattest = fread($this->fp, 32774); + + // determine format + $determined_format = $this->GetFileFormat($formattest, ($original_filename ? $original_filename : $filename)); + + // unable to determine file format + if (!$determined_format) { + fclose($this->fp); + return $this->error('unable to determine file format'); + } + + // check for illegal ID3 tags + if (isset($determined_format['fail_id3']) && (in_array('id3v1', $this->info['tags']) || in_array('id3v2', $this->info['tags']))) { + if ($determined_format['fail_id3'] === 'ERROR') { + fclose($this->fp); + return $this->error('ID3 tags not allowed on this file type.'); + } elseif ($determined_format['fail_id3'] === 'WARNING') { + $this->warning('ID3 tags not allowed on this file type.'); + } + } + + // check for illegal APE tags + if (isset($determined_format['fail_ape']) && in_array('ape', $this->info['tags'])) { + if ($determined_format['fail_ape'] === 'ERROR') { + fclose($this->fp); + return $this->error('APE tags not allowed on this file type.'); + } elseif ($determined_format['fail_ape'] === 'WARNING') { + $this->warning('APE tags not allowed on this file type.'); + } + } + + // set mime type + $this->info['mime_type'] = $determined_format['mime_type']; + + // supported format signature pattern detected, but module deleted + if (!file_exists(GETID3_INCLUDEPATH.$determined_format['include'])) { + fclose($this->fp); + return $this->error('Format not supported, module "'.$determined_format['include'].'" was removed.'); + } + + // module requires mb_convert_encoding/iconv support + // Check encoding/iconv support + if (!empty($determined_format['iconv_req']) && !function_exists('mb_convert_encoding') && !function_exists('iconv') && !in_array($this->encoding, array('ISO-8859-1', 'UTF-8', 'UTF-16LE', 'UTF-16BE', 'UTF-16'))) { + $errormessage = 'mb_convert_encoding() or iconv() support is required for this module ('.$determined_format['include'].') for encodings other than ISO-8859-1, UTF-8, UTF-16LE, UTF16-BE, UTF-16. '; + if (GETID3_OS_ISWINDOWS) { + $errormessage .= 'PHP does not have mb_convert_encoding() or iconv() support. Please enable php_mbstring.dll / php_iconv.dll in php.ini, and copy php_mbstring.dll / iconv.dll from c:/php/dlls to c:/windows/system32'; + } else { + $errormessage .= 'PHP is not compiled with mb_convert_encoding() or iconv() support. Please recompile with the --enable-mbstring / --with-iconv switch'; + } + return $this->error($errormessage); + } + + // include module + include_once(GETID3_INCLUDEPATH.$determined_format['include']); + + // instantiate module class + $class_name = 'getid3_'.$determined_format['module']; + if (!class_exists($class_name)) { + return $this->error('Format not supported, module "'.$determined_format['include'].'" is corrupt.'); + } + $class = new $class_name($this); + $class->Analyze(); + unset($class); + + // close file + fclose($this->fp); + + // process all tags - copy to 'tags' and convert charsets + if ($this->option_tags_process) { + $this->HandleAllTags(); + } + + // perform more calculations + if ($this->option_extra_info) { + $this->ChannelsBitratePlaytimeCalculations(); + $this->CalculateCompressionRatioVideo(); + $this->CalculateCompressionRatioAudio(); + $this->CalculateReplayGain(); + $this->ProcessAudioStreams(); + } + + // get the MD5 sum of the audio/video portion of the file - without ID3/APE/Lyrics3/etc header/footer tags + if ($this->option_md5_data) { + // do not calc md5_data if md5_data_source is present - set by flac only - future MPC/SV8 too + if (!$this->option_md5_data_source || empty($this->info['md5_data_source'])) { + $this->getHashdata('md5'); + } + } + + // get the SHA1 sum of the audio/video portion of the file - without ID3/APE/Lyrics3/etc header/footer tags + if ($this->option_sha1_data) { + $this->getHashdata('sha1'); + } + + // remove undesired keys + $this->CleanUp(); + + } catch (Exception $e) { + $this->error('Caught exception: '.$e->getMessage()); + } + + // return info array + return $this->info; + } + + + // private: error handling + public function error($message) { + $this->CleanUp(); + if (!isset($this->info['error'])) { + $this->info['error'] = array(); + } + $this->info['error'][] = $message; + return $this->info; + } + + + // private: warning handling + public function warning($message) { + $this->info['warning'][] = $message; + return true; + } + + + // private: CleanUp + private function CleanUp() { + + // remove possible empty keys + $AVpossibleEmptyKeys = array('dataformat', 'bits_per_sample', 'encoder_options', 'streams', 'bitrate'); + foreach ($AVpossibleEmptyKeys as $dummy => $key) { + if (empty($this->info['audio'][$key]) && isset($this->info['audio'][$key])) { + unset($this->info['audio'][$key]); + } + if (empty($this->info['video'][$key]) && isset($this->info['video'][$key])) { + unset($this->info['video'][$key]); + } + } + + // remove empty root keys + if (!empty($this->info)) { + foreach ($this->info as $key => $value) { + if (empty($this->info[$key]) && ($this->info[$key] !== 0) && ($this->info[$key] !== '0')) { + unset($this->info[$key]); + } + } + } + + // remove meaningless entries from unknown-format files + if (empty($this->info['fileformat'])) { + if (isset($this->info['avdataoffset'])) { + unset($this->info['avdataoffset']); + } + if (isset($this->info['avdataend'])) { + unset($this->info['avdataend']); + } + } + + // remove possible duplicated identical entries + if (!empty($this->info['error'])) { + $this->info['error'] = array_values(array_unique($this->info['error'])); + } + if (!empty($this->info['warning'])) { + $this->info['warning'] = array_values(array_unique($this->info['warning'])); + } + + // remove "global variable" type keys + unset($this->info['php_memory_limit']); + + return true; + } + + + // return array containing information about all supported formats + public function GetFileFormatArray() { + static $format_info = array(); + if (empty($format_info)) { + $format_info = array( + + // Audio formats + + // AC-3 - audio - Dolby AC-3 / Dolby Digital + 'ac3' => array( + 'pattern' => '^\\x0B\\x77', + 'group' => 'audio', + 'module' => 'ac3', + 'mime_type' => 'audio/ac3', + ), + + // AAC - audio - Advanced Audio Coding (AAC) - ADIF format + 'adif' => array( + 'pattern' => '^ADIF', + 'group' => 'audio', + 'module' => 'aac', + 'mime_type' => 'audio/aac', + 'fail_ape' => 'WARNING', + ), + +/* + // AA - audio - Audible Audiobook + 'aa' => array( + 'pattern' => '^.{4}\\x57\\x90\\x75\\x36', + 'group' => 'audio', + 'module' => 'aa', + 'mime_type' => 'audio/audible', + ), +*/ + // AAC - audio - Advanced Audio Coding (AAC) - ADTS format (very similar to MP3) + 'adts' => array( + 'pattern' => '^\\xFF[\\xF0-\\xF1\\xF8-\\xF9]', + 'group' => 'audio', + 'module' => 'aac', + 'mime_type' => 'audio/aac', + 'fail_ape' => 'WARNING', + ), + + + // AU - audio - NeXT/Sun AUdio (AU) + 'au' => array( + 'pattern' => '^\\.snd', + 'group' => 'audio', + 'module' => 'au', + 'mime_type' => 'audio/basic', + ), + + // AMR - audio - Adaptive Multi Rate + 'amr' => array( + 'pattern' => '^\\x23\\x21AMR\\x0A', // #!AMR[0A] + 'group' => 'audio', + 'module' => 'amr', + 'mime_type' => 'audio/amr', + ), + + // AVR - audio - Audio Visual Research + 'avr' => array( + 'pattern' => '^2BIT', + 'group' => 'audio', + 'module' => 'avr', + 'mime_type' => 'application/octet-stream', + ), + + // BONK - audio - Bonk v0.9+ + 'bonk' => array( + 'pattern' => '^\\x00(BONK|INFO|META| ID3)', + 'group' => 'audio', + 'module' => 'bonk', + 'mime_type' => 'audio/xmms-bonk', + ), + + // DSF - audio - Direct Stream Digital (DSD) Storage Facility files (DSF) - https://en.wikipedia.org/wiki/Direct_Stream_Digital + 'dsf' => array( + 'pattern' => '^DSD ', // including trailing space: 44 53 44 20 + 'group' => 'audio', + 'module' => 'dsf', + 'mime_type' => 'audio/dsd', + ), + + // DSS - audio - Digital Speech Standard + 'dss' => array( + 'pattern' => '^[\\x02-\\x06]ds[s2]', + 'group' => 'audio', + 'module' => 'dss', + 'mime_type' => 'application/octet-stream', + ), + + // DTS - audio - Dolby Theatre System + 'dts' => array( + 'pattern' => '^\\x7F\\xFE\\x80\\x01', + 'group' => 'audio', + 'module' => 'dts', + 'mime_type' => 'audio/dts', + ), + + // FLAC - audio - Free Lossless Audio Codec + 'flac' => array( + 'pattern' => '^fLaC', + 'group' => 'audio', + 'module' => 'flac', + 'mime_type' => 'audio/x-flac', + ), + + // LA - audio - Lossless Audio (LA) + 'la' => array( + 'pattern' => '^LA0[2-4]', + 'group' => 'audio', + 'module' => 'la', + 'mime_type' => 'application/octet-stream', + ), + + // LPAC - audio - Lossless Predictive Audio Compression (LPAC) + 'lpac' => array( + 'pattern' => '^LPAC', + 'group' => 'audio', + 'module' => 'lpac', + 'mime_type' => 'application/octet-stream', + ), + + // MIDI - audio - MIDI (Musical Instrument Digital Interface) + 'midi' => array( + 'pattern' => '^MThd', + 'group' => 'audio', + 'module' => 'midi', + 'mime_type' => 'audio/midi', + ), + + // MAC - audio - Monkey's Audio Compressor + 'mac' => array( + 'pattern' => '^MAC ', + 'group' => 'audio', + 'module' => 'monkey', + 'mime_type' => 'audio/x-monkeys-audio', + ), + +// has been known to produce false matches in random files (e.g. JPEGs), leave out until more precise matching available +// // MOD - audio - MODule (assorted sub-formats) +// 'mod' => array( +// 'pattern' => '^.{1080}(M\\.K\\.|M!K!|FLT4|FLT8|[5-9]CHN|[1-3][0-9]CH)', +// 'group' => 'audio', +// 'module' => 'mod', +// 'option' => 'mod', +// 'mime_type' => 'audio/mod', +// ), + + // MOD - audio - MODule (Impulse Tracker) + 'it' => array( + 'pattern' => '^IMPM', + 'group' => 'audio', + 'module' => 'mod', + //'option' => 'it', + 'mime_type' => 'audio/it', + ), + + // MOD - audio - MODule (eXtended Module, various sub-formats) + 'xm' => array( + 'pattern' => '^Extended Module', + 'group' => 'audio', + 'module' => 'mod', + //'option' => 'xm', + 'mime_type' => 'audio/xm', + ), + + // MOD - audio - MODule (ScreamTracker) + 's3m' => array( + 'pattern' => '^.{44}SCRM', + 'group' => 'audio', + 'module' => 'mod', + //'option' => 's3m', + 'mime_type' => 'audio/s3m', + ), + + // MPC - audio - Musepack / MPEGplus + 'mpc' => array( + 'pattern' => '^(MPCK|MP\\+|[\\x00\\x01\\x10\\x11\\x40\\x41\\x50\\x51\\x80\\x81\\x90\\x91\\xC0\\xC1\\xD0\\xD1][\\x20-\\x37][\\x00\\x20\\x40\\x60\\x80\\xA0\\xC0\\xE0])', + 'group' => 'audio', + 'module' => 'mpc', + 'mime_type' => 'audio/x-musepack', + ), + + // MP3 - audio - MPEG-audio Layer 3 (very similar to AAC-ADTS) + 'mp3' => array( + 'pattern' => '^\\xFF[\\xE2-\\xE7\\xF2-\\xF7\\xFA-\\xFF][\\x00-\\x0B\\x10-\\x1B\\x20-\\x2B\\x30-\\x3B\\x40-\\x4B\\x50-\\x5B\\x60-\\x6B\\x70-\\x7B\\x80-\\x8B\\x90-\\x9B\\xA0-\\xAB\\xB0-\\xBB\\xC0-\\xCB\\xD0-\\xDB\\xE0-\\xEB\\xF0-\\xFB]', + 'group' => 'audio', + 'module' => 'mp3', + 'mime_type' => 'audio/mpeg', + ), + + // OFR - audio - OptimFROG + 'ofr' => array( + 'pattern' => '^(\\*RIFF|OFR)', + 'group' => 'audio', + 'module' => 'optimfrog', + 'mime_type' => 'application/octet-stream', + ), + + // RKAU - audio - RKive AUdio compressor + 'rkau' => array( + 'pattern' => '^RKA', + 'group' => 'audio', + 'module' => 'rkau', + 'mime_type' => 'application/octet-stream', + ), + + // SHN - audio - Shorten + 'shn' => array( + 'pattern' => '^ajkg', + 'group' => 'audio', + 'module' => 'shorten', + 'mime_type' => 'audio/xmms-shn', + 'fail_id3' => 'ERROR', + 'fail_ape' => 'ERROR', + ), + + // TTA - audio - TTA Lossless Audio Compressor (http://tta.corecodec.org) + 'tta' => array( + 'pattern' => '^TTA', // could also be '^TTA(\\x01|\\x02|\\x03|2|1)' + 'group' => 'audio', + 'module' => 'tta', + 'mime_type' => 'application/octet-stream', + ), + + // VOC - audio - Creative Voice (VOC) + 'voc' => array( + 'pattern' => '^Creative Voice File', + 'group' => 'audio', + 'module' => 'voc', + 'mime_type' => 'audio/voc', + ), + + // VQF - audio - transform-domain weighted interleave Vector Quantization Format (VQF) + 'vqf' => array( + 'pattern' => '^TWIN', + 'group' => 'audio', + 'module' => 'vqf', + 'mime_type' => 'application/octet-stream', + ), + + // WV - audio - WavPack (v4.0+) + 'wv' => array( + 'pattern' => '^wvpk', + 'group' => 'audio', + 'module' => 'wavpack', + 'mime_type' => 'application/octet-stream', + ), + + + // Audio-Video formats + + // ASF - audio/video - Advanced Streaming Format, Windows Media Video, Windows Media Audio + 'asf' => array( + 'pattern' => '^\\x30\\x26\\xB2\\x75\\x8E\\x66\\xCF\\x11\\xA6\\xD9\\x00\\xAA\\x00\\x62\\xCE\\x6C', + 'group' => 'audio-video', + 'module' => 'asf', + 'mime_type' => 'video/x-ms-asf', + 'iconv_req' => false, + ), + + // BINK - audio/video - Bink / Smacker + 'bink' => array( + 'pattern' => '^(BIK|SMK)', + 'group' => 'audio-video', + 'module' => 'bink', + 'mime_type' => 'application/octet-stream', + ), + + // FLV - audio/video - FLash Video + 'flv' => array( + 'pattern' => '^FLV[\\x01]', + 'group' => 'audio-video', + 'module' => 'flv', + 'mime_type' => 'video/x-flv', + ), + + // MKAV - audio/video - Mastroka + 'matroska' => array( + 'pattern' => '^\\x1A\\x45\\xDF\\xA3', + 'group' => 'audio-video', + 'module' => 'matroska', + 'mime_type' => 'video/x-matroska', // may also be audio/x-matroska + ), + + // MPEG - audio/video - MPEG (Moving Pictures Experts Group) + 'mpeg' => array( + 'pattern' => '^\\x00\\x00\\x01[\\xB3\\xBA]', + 'group' => 'audio-video', + 'module' => 'mpeg', + 'mime_type' => 'video/mpeg', + ), + + // NSV - audio/video - Nullsoft Streaming Video (NSV) + 'nsv' => array( + 'pattern' => '^NSV[sf]', + 'group' => 'audio-video', + 'module' => 'nsv', + 'mime_type' => 'application/octet-stream', + ), + + // Ogg - audio/video - Ogg (Ogg-Vorbis, Ogg-FLAC, Speex, Ogg-Theora(*), Ogg-Tarkin(*)) + 'ogg' => array( + 'pattern' => '^OggS', + 'group' => 'audio', + 'module' => 'ogg', + 'mime_type' => 'application/ogg', + 'fail_id3' => 'WARNING', + 'fail_ape' => 'WARNING', + ), + + // QT - audio/video - Quicktime + 'quicktime' => array( + 'pattern' => '^.{4}(cmov|free|ftyp|mdat|moov|pnot|skip|wide)', + 'group' => 'audio-video', + 'module' => 'quicktime', + 'mime_type' => 'video/quicktime', + ), + + // RIFF - audio/video - Resource Interchange File Format (RIFF) / WAV / AVI / CD-audio / SDSS = renamed variant used by SmartSound QuickTracks (www.smartsound.com) / FORM = Audio Interchange File Format (AIFF) + 'riff' => array( + 'pattern' => '^(RIFF|SDSS|FORM)', + 'group' => 'audio-video', + 'module' => 'riff', + 'mime_type' => 'audio/x-wav', + 'fail_ape' => 'WARNING', + ), + + // Real - audio/video - RealAudio, RealVideo + 'real' => array( + 'pattern' => '^\\.(RMF|ra)', + 'group' => 'audio-video', + 'module' => 'real', + 'mime_type' => 'audio/x-realaudio', + ), + + // SWF - audio/video - ShockWave Flash + 'swf' => array( + 'pattern' => '^(F|C)WS', + 'group' => 'audio-video', + 'module' => 'swf', + 'mime_type' => 'application/x-shockwave-flash', + ), + + // TS - audio/video - MPEG-2 Transport Stream + 'ts' => array( + 'pattern' => '^(\\x47.{187}){10,}', // packets are 188 bytes long and start with 0x47 "G". Check for at least 10 packets matching this pattern + 'group' => 'audio-video', + 'module' => 'ts', + 'mime_type' => 'video/MP2T', + ), + + + // Still-Image formats + + // BMP - still image - Bitmap (Windows, OS/2; uncompressed, RLE8, RLE4) + 'bmp' => array( + 'pattern' => '^BM', + 'group' => 'graphic', + 'module' => 'bmp', + 'mime_type' => 'image/bmp', + 'fail_id3' => 'ERROR', + 'fail_ape' => 'ERROR', + ), + + // GIF - still image - Graphics Interchange Format + 'gif' => array( + 'pattern' => '^GIF', + 'group' => 'graphic', + 'module' => 'gif', + 'mime_type' => 'image/gif', + 'fail_id3' => 'ERROR', + 'fail_ape' => 'ERROR', + ), + + // JPEG - still image - Joint Photographic Experts Group (JPEG) + 'jpg' => array( + 'pattern' => '^\\xFF\\xD8\\xFF', + 'group' => 'graphic', + 'module' => 'jpg', + 'mime_type' => 'image/jpeg', + 'fail_id3' => 'ERROR', + 'fail_ape' => 'ERROR', + ), + + // PCD - still image - Kodak Photo CD + 'pcd' => array( + 'pattern' => '^.{2048}PCD_IPI\\x00', + 'group' => 'graphic', + 'module' => 'pcd', + 'mime_type' => 'image/x-photo-cd', + 'fail_id3' => 'ERROR', + 'fail_ape' => 'ERROR', + ), + + + // PNG - still image - Portable Network Graphics (PNG) + 'png' => array( + 'pattern' => '^\\x89\\x50\\x4E\\x47\\x0D\\x0A\\x1A\\x0A', + 'group' => 'graphic', + 'module' => 'png', + 'mime_type' => 'image/png', + 'fail_id3' => 'ERROR', + 'fail_ape' => 'ERROR', + ), + + + // SVG - still image - Scalable Vector Graphics (SVG) + 'svg' => array( + 'pattern' => '( 'graphic', + 'module' => 'svg', + 'mime_type' => 'image/svg+xml', + 'fail_id3' => 'ERROR', + 'fail_ape' => 'ERROR', + ), + + + // TIFF - still image - Tagged Information File Format (TIFF) + 'tiff' => array( + 'pattern' => '^(II\\x2A\\x00|MM\\x00\\x2A)', + 'group' => 'graphic', + 'module' => 'tiff', + 'mime_type' => 'image/tiff', + 'fail_id3' => 'ERROR', + 'fail_ape' => 'ERROR', + ), + + + // EFAX - still image - eFax (TIFF derivative) + 'efax' => array( + 'pattern' => '^\\xDC\\xFE', + 'group' => 'graphic', + 'module' => 'efax', + 'mime_type' => 'image/efax', + 'fail_id3' => 'ERROR', + 'fail_ape' => 'ERROR', + ), + + + // Data formats + + // ISO - data - International Standards Organization (ISO) CD-ROM Image + 'iso' => array( + 'pattern' => '^.{32769}CD001', + 'group' => 'misc', + 'module' => 'iso', + 'mime_type' => 'application/octet-stream', + 'fail_id3' => 'ERROR', + 'fail_ape' => 'ERROR', + 'iconv_req' => false, + ), + + // RAR - data - RAR compressed data + 'rar' => array( + 'pattern' => '^Rar\\!', + 'group' => 'archive', + 'module' => 'rar', + 'mime_type' => 'application/octet-stream', + 'fail_id3' => 'ERROR', + 'fail_ape' => 'ERROR', + ), + + // SZIP - audio/data - SZIP compressed data + 'szip' => array( + 'pattern' => '^SZ\\x0A\\x04', + 'group' => 'archive', + 'module' => 'szip', + 'mime_type' => 'application/octet-stream', + 'fail_id3' => 'ERROR', + 'fail_ape' => 'ERROR', + ), + + // TAR - data - TAR compressed data + 'tar' => array( + 'pattern' => '^.{100}[0-9\\x20]{7}\\x00[0-9\\x20]{7}\\x00[0-9\\x20]{7}\\x00[0-9\\x20\\x00]{12}[0-9\\x20\\x00]{12}', + 'group' => 'archive', + 'module' => 'tar', + 'mime_type' => 'application/x-tar', + 'fail_id3' => 'ERROR', + 'fail_ape' => 'ERROR', + ), + + // GZIP - data - GZIP compressed data + 'gz' => array( + 'pattern' => '^\\x1F\\x8B\\x08', + 'group' => 'archive', + 'module' => 'gzip', + 'mime_type' => 'application/x-gzip', + 'fail_id3' => 'ERROR', + 'fail_ape' => 'ERROR', + ), + + // ZIP - data - ZIP compressed data + 'zip' => array( + 'pattern' => '^PK\\x03\\x04', + 'group' => 'archive', + 'module' => 'zip', + 'mime_type' => 'application/zip', + 'fail_id3' => 'ERROR', + 'fail_ape' => 'ERROR', + ), + + + // Misc other formats + + // PAR2 - data - Parity Volume Set Specification 2.0 + 'par2' => array ( + 'pattern' => '^PAR2\\x00PKT', + 'group' => 'misc', + 'module' => 'par2', + 'mime_type' => 'application/octet-stream', + 'fail_id3' => 'ERROR', + 'fail_ape' => 'ERROR', + ), + + // PDF - data - Portable Document Format + 'pdf' => array( + 'pattern' => '^\\x25PDF', + 'group' => 'misc', + 'module' => 'pdf', + 'mime_type' => 'application/pdf', + 'fail_id3' => 'ERROR', + 'fail_ape' => 'ERROR', + ), + + // MSOFFICE - data - ZIP compressed data + 'msoffice' => array( + 'pattern' => '^\\xD0\\xCF\\x11\\xE0\\xA1\\xB1\\x1A\\xE1', // D0CF11E == DOCFILE == Microsoft Office Document + 'group' => 'misc', + 'module' => 'msoffice', + 'mime_type' => 'application/octet-stream', + 'fail_id3' => 'ERROR', + 'fail_ape' => 'ERROR', + ), + + // CUE - data - CUEsheet (index to single-file disc images) + 'cue' => array( + 'pattern' => '', // empty pattern means cannot be automatically detected, will fall through all other formats and match based on filename and very basic file contents + 'group' => 'misc', + 'module' => 'cue', + 'mime_type' => 'application/octet-stream', + ), + + ); + } + + return $format_info; + } + + + + public function GetFileFormat(&$filedata, $filename='') { + // this function will determine the format of a file based on usually + // the first 2-4 bytes of the file (8 bytes for PNG, 16 bytes for JPG, + // and in the case of ISO CD image, 6 bytes offset 32kb from the start + // of the file). + + // Identify file format - loop through $format_info and detect with reg expr + foreach ($this->GetFileFormatArray() as $format_name => $info) { + // The /s switch on preg_match() forces preg_match() NOT to treat + // newline (0x0A) characters as special chars but do a binary match + if (!empty($info['pattern']) && preg_match('#'.$info['pattern'].'#s', $filedata)) { + $info['include'] = 'module.'.$info['group'].'.'.$info['module'].'.php'; + return $info; + } + } + + + if (preg_match('#\\.mp[123a]$#i', $filename)) { + // Too many mp3 encoders on the market put gabage in front of mpeg files + // use assume format on these if format detection failed + $GetFileFormatArray = $this->GetFileFormatArray(); + $info = $GetFileFormatArray['mp3']; + $info['include'] = 'module.'.$info['group'].'.'.$info['module'].'.php'; + return $info; + } elseif (preg_match('#\\.cue$#i', $filename) && preg_match('#FILE "[^"]+" (BINARY|MOTOROLA|AIFF|WAVE|MP3)#', $filedata)) { + // there's not really a useful consistent "magic" at the beginning of .cue files to identify them + // so until I think of something better, just go by filename if all other format checks fail + // and verify there's at least one instance of "TRACK xx AUDIO" in the file + $GetFileFormatArray = $this->GetFileFormatArray(); + $info = $GetFileFormatArray['cue']; + $info['include'] = 'module.'.$info['group'].'.'.$info['module'].'.php'; + return $info; + } + + return false; + } + + + // converts array to $encoding charset from $this->encoding + public function CharConvert(&$array, $encoding) { + + // identical encoding - end here + if ($encoding == $this->encoding) { + return; + } + + // loop thru array + foreach ($array as $key => $value) { + + // go recursive + if (is_array($value)) { + $this->CharConvert($array[$key], $encoding); + } + + // convert string + elseif (is_string($value)) { + $array[$key] = trim(getid3_lib::iconv_fallback($encoding, $this->encoding, $value)); + } + } + } + + + public function HandleAllTags() { + + // key name => array (tag name, character encoding) + static $tags; + if (empty($tags)) { + $tags = array( + 'asf' => array('asf' , 'UTF-16LE'), + 'midi' => array('midi' , 'ISO-8859-1'), + 'nsv' => array('nsv' , 'ISO-8859-1'), + 'ogg' => array('vorbiscomment' , 'UTF-8'), + 'png' => array('png' , 'UTF-8'), + 'tiff' => array('tiff' , 'ISO-8859-1'), + 'quicktime' => array('quicktime' , 'UTF-8'), + 'real' => array('real' , 'ISO-8859-1'), + 'vqf' => array('vqf' , 'ISO-8859-1'), + 'zip' => array('zip' , 'ISO-8859-1'), + 'riff' => array('riff' , 'ISO-8859-1'), + 'lyrics3' => array('lyrics3' , 'ISO-8859-1'), + 'id3v1' => array('id3v1' , $this->encoding_id3v1), + 'id3v2' => array('id3v2' , 'UTF-8'), // not according to the specs (every frame can have a different encoding), but getID3() force-converts all encodings to UTF-8 + 'ape' => array('ape' , 'UTF-8'), + 'cue' => array('cue' , 'ISO-8859-1'), + 'matroska' => array('matroska' , 'UTF-8'), + 'flac' => array('vorbiscomment' , 'UTF-8'), + 'divxtag' => array('divx' , 'ISO-8859-1'), + 'iptc' => array('iptc' , 'ISO-8859-1'), + ); + } + + // loop through comments array + foreach ($tags as $comment_name => $tagname_encoding_array) { + list($tag_name, $encoding) = $tagname_encoding_array; + + // fill in default encoding type if not already present + if (isset($this->info[$comment_name]) && !isset($this->info[$comment_name]['encoding'])) { + $this->info[$comment_name]['encoding'] = $encoding; + } + + // copy comments if key name set + if (!empty($this->info[$comment_name]['comments'])) { + foreach ($this->info[$comment_name]['comments'] as $tag_key => $valuearray) { + foreach ($valuearray as $key => $value) { + if (is_string($value)) { + $value = trim($value, " \r\n\t"); // do not trim nulls from $value!! Unicode characters will get mangled if trailing nulls are removed! + } + if ($value) { + if (!is_numeric($key)) { + $this->info['tags'][trim($tag_name)][trim($tag_key)][$key] = $value; + } else { + $this->info['tags'][trim($tag_name)][trim($tag_key)][] = $value; + } + } + } + if ($tag_key == 'picture') { + unset($this->info[$comment_name]['comments'][$tag_key]); + } + } + + if (!isset($this->info['tags'][$tag_name])) { + // comments are set but contain nothing but empty strings, so skip + continue; + } + + $this->CharConvert($this->info['tags'][$tag_name], $this->info[$comment_name]['encoding']); // only copy gets converted! + + if ($this->option_tags_html) { + foreach ($this->info['tags'][$tag_name] as $tag_key => $valuearray) { + $this->info['tags_html'][$tag_name][$tag_key] = getid3_lib::recursiveMultiByteCharString2HTML($valuearray, $this->info[$comment_name]['encoding']); + } + } + + } + + } + + // pictures can take up a lot of space, and we don't need multiple copies of them + // let there be a single copy in [comments][picture], and not elsewhere + if (!empty($this->info['tags'])) { + $unset_keys = array('tags', 'tags_html'); + foreach ($this->info['tags'] as $tagtype => $tagarray) { + foreach ($tagarray as $tagname => $tagdata) { + if ($tagname == 'picture') { + foreach ($tagdata as $key => $tagarray) { + $this->info['comments']['picture'][] = $tagarray; + if (isset($tagarray['data']) && isset($tagarray['image_mime'])) { + if (isset($this->info['tags'][$tagtype][$tagname][$key])) { + unset($this->info['tags'][$tagtype][$tagname][$key]); + } + if (isset($this->info['tags_html'][$tagtype][$tagname][$key])) { + unset($this->info['tags_html'][$tagtype][$tagname][$key]); + } + } + } + } + } + foreach ($unset_keys as $unset_key) { + // remove possible empty keys from (e.g. [tags][id3v2][picture]) + if (empty($this->info[$unset_key][$tagtype]['picture'])) { + unset($this->info[$unset_key][$tagtype]['picture']); + } + if (empty($this->info[$unset_key][$tagtype])) { + unset($this->info[$unset_key][$tagtype]); + } + if (empty($this->info[$unset_key])) { + unset($this->info[$unset_key]); + } + } + // remove duplicate copy of picture data from (e.g. [id3v2][comments][picture]) + if (isset($this->info[$tagtype]['comments']['picture'])) { + unset($this->info[$tagtype]['comments']['picture']); + } + if (empty($this->info[$tagtype]['comments'])) { + unset($this->info[$tagtype]['comments']); + } + if (empty($this->info[$tagtype])) { + unset($this->info[$tagtype]); + } + } + } + return true; + } + + public function getHashdata($algorithm) { + switch ($algorithm) { + case 'md5': + case 'sha1': + break; + + default: + return $this->error('bad algorithm "'.$algorithm.'" in getHashdata()'); + break; + } + + if (!empty($this->info['fileformat']) && !empty($this->info['dataformat']) && ($this->info['fileformat'] == 'ogg') && ($this->info['audio']['dataformat'] == 'vorbis')) { + + // We cannot get an identical md5_data value for Ogg files where the comments + // span more than 1 Ogg page (compared to the same audio data with smaller + // comments) using the normal getID3() method of MD5'ing the data between the + // end of the comments and the end of the file (minus any trailing tags), + // because the page sequence numbers of the pages that the audio data is on + // do not match. Under normal circumstances, where comments are smaller than + // the nominal 4-8kB page size, then this is not a problem, but if there are + // very large comments, the only way around it is to strip off the comment + // tags with vorbiscomment and MD5 that file. + // This procedure must be applied to ALL Ogg files, not just the ones with + // comments larger than 1 page, because the below method simply MD5's the + // whole file with the comments stripped, not just the portion after the + // comments block (which is the standard getID3() method. + + // The above-mentioned problem of comments spanning multiple pages and changing + // page sequence numbers likely happens for OggSpeex and OggFLAC as well, but + // currently vorbiscomment only works on OggVorbis files. + + if (preg_match('#(1|ON)#i', ini_get('safe_mode'))) { + + $this->warning('Failed making system call to vorbiscomment.exe - '.$algorithm.'_data is incorrect - error returned: PHP running in Safe Mode (backtick operator not available)'); + $this->info[$algorithm.'_data'] = false; + + } else { + + // Prevent user from aborting script + $old_abort = ignore_user_abort(true); + + // Create empty file + $empty = tempnam(GETID3_TEMP_DIR, 'getID3'); + touch($empty); + + // Use vorbiscomment to make temp file without comments + $temp = tempnam(GETID3_TEMP_DIR, 'getID3'); + $file = $this->info['filenamepath']; + + if (GETID3_OS_ISWINDOWS) { + + if (file_exists(GETID3_HELPERAPPSDIR.'vorbiscomment.exe')) { + + $commandline = '"'.GETID3_HELPERAPPSDIR.'vorbiscomment.exe" -w -c "'.$empty.'" "'.$file.'" "'.$temp.'"'; + $VorbisCommentError = `$commandline`; + + } else { + + $VorbisCommentError = 'vorbiscomment.exe not found in '.GETID3_HELPERAPPSDIR; + + } + + } else { + + $commandline = 'vorbiscomment -w -c '.escapeshellarg($empty).' '.escapeshellarg($file).' '.escapeshellarg($temp).' 2>&1'; + $VorbisCommentError = `$commandline`; + + } + + if (!empty($VorbisCommentError)) { + + $this->warning('Failed making system call to vorbiscomment(.exe) - '.$algorithm.'_data will be incorrect. If vorbiscomment is unavailable, please download from http://www.vorbis.com/download.psp and put in the getID3() directory. Error returned: '.$VorbisCommentError); + $this->info[$algorithm.'_data'] = false; + + } else { + + // Get hash of newly created file + switch ($algorithm) { + case 'md5': + $this->info[$algorithm.'_data'] = md5_file($temp); + break; + + case 'sha1': + $this->info[$algorithm.'_data'] = sha1_file($temp); + break; + } + } + + // Clean up + unlink($empty); + unlink($temp); + + // Reset abort setting + ignore_user_abort($old_abort); + + } + + } else { + + if (!empty($this->info['avdataoffset']) || (isset($this->info['avdataend']) && ($this->info['avdataend'] < $this->info['filesize']))) { + + // get hash from part of file + $this->info[$algorithm.'_data'] = getid3_lib::hash_data($this->info['filenamepath'], $this->info['avdataoffset'], $this->info['avdataend'], $algorithm); + + } else { + + // get hash from whole file + switch ($algorithm) { + case 'md5': + $this->info[$algorithm.'_data'] = md5_file($this->info['filenamepath']); + break; + + case 'sha1': + $this->info[$algorithm.'_data'] = sha1_file($this->info['filenamepath']); + break; + } + } + + } + return true; + } + + + public function ChannelsBitratePlaytimeCalculations() { + + // set channelmode on audio + if (!empty($this->info['audio']['channelmode']) || !isset($this->info['audio']['channels'])) { + // ignore + } elseif ($this->info['audio']['channels'] == 1) { + $this->info['audio']['channelmode'] = 'mono'; + } elseif ($this->info['audio']['channels'] == 2) { + $this->info['audio']['channelmode'] = 'stereo'; + } + + // Calculate combined bitrate - audio + video + $CombinedBitrate = 0; + $CombinedBitrate += (isset($this->info['audio']['bitrate']) ? $this->info['audio']['bitrate'] : 0); + $CombinedBitrate += (isset($this->info['video']['bitrate']) ? $this->info['video']['bitrate'] : 0); + if (($CombinedBitrate > 0) && empty($this->info['bitrate'])) { + $this->info['bitrate'] = $CombinedBitrate; + } + //if ((isset($this->info['video']) && !isset($this->info['video']['bitrate'])) || (isset($this->info['audio']) && !isset($this->info['audio']['bitrate']))) { + // // for example, VBR MPEG video files cannot determine video bitrate: + // // should not set overall bitrate and playtime from audio bitrate only + // unset($this->info['bitrate']); + //} + + // video bitrate undetermined, but calculable + if (isset($this->info['video']['dataformat']) && $this->info['video']['dataformat'] && (!isset($this->info['video']['bitrate']) || ($this->info['video']['bitrate'] == 0))) { + // if video bitrate not set + if (isset($this->info['audio']['bitrate']) && ($this->info['audio']['bitrate'] > 0) && ($this->info['audio']['bitrate'] == $this->info['bitrate'])) { + // AND if audio bitrate is set to same as overall bitrate + if (isset($this->info['playtime_seconds']) && ($this->info['playtime_seconds'] > 0)) { + // AND if playtime is set + if (isset($this->info['avdataend']) && isset($this->info['avdataoffset'])) { + // AND if AV data offset start/end is known + // THEN we can calculate the video bitrate + $this->info['bitrate'] = round((($this->info['avdataend'] - $this->info['avdataoffset']) * 8) / $this->info['playtime_seconds']); + $this->info['video']['bitrate'] = $this->info['bitrate'] - $this->info['audio']['bitrate']; + } + } + } + } + + if ((!isset($this->info['playtime_seconds']) || ($this->info['playtime_seconds'] <= 0)) && !empty($this->info['bitrate'])) { + $this->info['playtime_seconds'] = (($this->info['avdataend'] - $this->info['avdataoffset']) * 8) / $this->info['bitrate']; + } + + if (!isset($this->info['bitrate']) && !empty($this->info['playtime_seconds'])) { + $this->info['bitrate'] = (($this->info['avdataend'] - $this->info['avdataoffset']) * 8) / $this->info['playtime_seconds']; + } + if (isset($this->info['bitrate']) && empty($this->info['audio']['bitrate']) && empty($this->info['video']['bitrate'])) { + if (isset($this->info['audio']['dataformat']) && empty($this->info['video']['resolution_x'])) { + // audio only + $this->info['audio']['bitrate'] = $this->info['bitrate']; + } elseif (isset($this->info['video']['resolution_x']) && empty($this->info['audio']['dataformat'])) { + // video only + $this->info['video']['bitrate'] = $this->info['bitrate']; + } + } + + // Set playtime string + if (!empty($this->info['playtime_seconds']) && empty($this->info['playtime_string'])) { + $this->info['playtime_string'] = getid3_lib::PlaytimeString($this->info['playtime_seconds']); + } + } + + + public function CalculateCompressionRatioVideo() { + if (empty($this->info['video'])) { + return false; + } + if (empty($this->info['video']['resolution_x']) || empty($this->info['video']['resolution_y'])) { + return false; + } + if (empty($this->info['video']['bits_per_sample'])) { + return false; + } + + switch ($this->info['video']['dataformat']) { + case 'bmp': + case 'gif': + case 'jpeg': + case 'jpg': + case 'png': + case 'tiff': + $FrameRate = 1; + $PlaytimeSeconds = 1; + $BitrateCompressed = $this->info['filesize'] * 8; + break; + + default: + if (!empty($this->info['video']['frame_rate'])) { + $FrameRate = $this->info['video']['frame_rate']; + } else { + return false; + } + if (!empty($this->info['playtime_seconds'])) { + $PlaytimeSeconds = $this->info['playtime_seconds']; + } else { + return false; + } + if (!empty($this->info['video']['bitrate'])) { + $BitrateCompressed = $this->info['video']['bitrate']; + } else { + return false; + } + break; + } + $BitrateUncompressed = $this->info['video']['resolution_x'] * $this->info['video']['resolution_y'] * $this->info['video']['bits_per_sample'] * $FrameRate; + + $this->info['video']['compression_ratio'] = $BitrateCompressed / $BitrateUncompressed; + return true; + } + + + public function CalculateCompressionRatioAudio() { + if (empty($this->info['audio']['bitrate']) || empty($this->info['audio']['channels']) || empty($this->info['audio']['sample_rate']) || !is_numeric($this->info['audio']['sample_rate'])) { + return false; + } + $this->info['audio']['compression_ratio'] = $this->info['audio']['bitrate'] / ($this->info['audio']['channels'] * $this->info['audio']['sample_rate'] * (!empty($this->info['audio']['bits_per_sample']) ? $this->info['audio']['bits_per_sample'] : 16)); + + if (!empty($this->info['audio']['streams'])) { + foreach ($this->info['audio']['streams'] as $streamnumber => $streamdata) { + if (!empty($streamdata['bitrate']) && !empty($streamdata['channels']) && !empty($streamdata['sample_rate'])) { + $this->info['audio']['streams'][$streamnumber]['compression_ratio'] = $streamdata['bitrate'] / ($streamdata['channels'] * $streamdata['sample_rate'] * (!empty($streamdata['bits_per_sample']) ? $streamdata['bits_per_sample'] : 16)); + } + } + } + return true; + } + + + public function CalculateReplayGain() { + if (isset($this->info['replay_gain'])) { + if (!isset($this->info['replay_gain']['reference_volume'])) { + $this->info['replay_gain']['reference_volume'] = (double) 89.0; + } + if (isset($this->info['replay_gain']['track']['adjustment'])) { + $this->info['replay_gain']['track']['volume'] = $this->info['replay_gain']['reference_volume'] - $this->info['replay_gain']['track']['adjustment']; + } + if (isset($this->info['replay_gain']['album']['adjustment'])) { + $this->info['replay_gain']['album']['volume'] = $this->info['replay_gain']['reference_volume'] - $this->info['replay_gain']['album']['adjustment']; + } + + if (isset($this->info['replay_gain']['track']['peak'])) { + $this->info['replay_gain']['track']['max_noclip_gain'] = 0 - getid3_lib::RGADamplitude2dB($this->info['replay_gain']['track']['peak']); + } + if (isset($this->info['replay_gain']['album']['peak'])) { + $this->info['replay_gain']['album']['max_noclip_gain'] = 0 - getid3_lib::RGADamplitude2dB($this->info['replay_gain']['album']['peak']); + } + } + return true; + } + + public function ProcessAudioStreams() { + if (!empty($this->info['audio']['bitrate']) || !empty($this->info['audio']['channels']) || !empty($this->info['audio']['sample_rate'])) { + if (!isset($this->info['audio']['streams'])) { + foreach ($this->info['audio'] as $key => $value) { + if ($key != 'streams') { + $this->info['audio']['streams'][0][$key] = $value; + } + } + } + } + return true; + } + + public function getid3_tempnam() { + return tempnam($this->tempdir, 'gI3'); + } + + public function include_module($name) { + //if (!file_exists($this->include_path.'module.'.$name.'.php')) { + if (!file_exists(GETID3_INCLUDEPATH.'module.'.$name.'.php')) { + throw new getid3_exception('Required module.'.$name.'.php is missing.'); + } + include_once(GETID3_INCLUDEPATH.'module.'.$name.'.php'); + return true; + } + + public static function is_writable ($filename) { + $ret = is_writable($filename); + + if (!$ret) { + $perms = fileperms($filename); + $ret = ($perms & 0x0080) || ($perms & 0x0010) || ($perms & 0x0002); + } + + return $ret; + } + +} + + +abstract class getid3_handler { + + /** + * @var getID3 + */ + protected $getid3; // pointer + + protected $data_string_flag = false; // analyzing filepointer or string + protected $data_string = ''; // string to analyze + protected $data_string_position = 0; // seek position in string + protected $data_string_length = 0; // string length + + private $dependency_to = null; + + + public function __construct(getID3 $getid3, $call_module=null) { + $this->getid3 = $getid3; + + if ($call_module) { + $this->dependency_to = str_replace('getid3_', '', $call_module); + } + } + + + // Analyze from file pointer + abstract public function Analyze(); + + + // Analyze from string instead + public function AnalyzeString($string) { + // Enter string mode + $this->setStringMode($string); + + // Save info + $saved_avdataoffset = $this->getid3->info['avdataoffset']; + $saved_avdataend = $this->getid3->info['avdataend']; + $saved_filesize = (isset($this->getid3->info['filesize']) ? $this->getid3->info['filesize'] : null); // may be not set if called as dependency without openfile() call + + // Reset some info + $this->getid3->info['avdataoffset'] = 0; + $this->getid3->info['avdataend'] = $this->getid3->info['filesize'] = $this->data_string_length; + + // Analyze + $this->Analyze(); + + // Restore some info + $this->getid3->info['avdataoffset'] = $saved_avdataoffset; + $this->getid3->info['avdataend'] = $saved_avdataend; + $this->getid3->info['filesize'] = $saved_filesize; + + // Exit string mode + $this->data_string_flag = false; + } + + public function setStringMode($string) { + $this->data_string_flag = true; + $this->data_string = $string; + $this->data_string_length = strlen($string); + } + + protected function ftell() { + if ($this->data_string_flag) { + return $this->data_string_position; + } + return ftell($this->getid3->fp); + } + + protected function fread($bytes) { + if ($this->data_string_flag) { + $this->data_string_position += $bytes; + return substr($this->data_string, $this->data_string_position - $bytes, $bytes); + } + $pos = $this->ftell() + $bytes; + if (!getid3_lib::intValueSupported($pos)) { + throw new getid3_exception('cannot fread('.$bytes.' from '.$this->ftell().') because beyond PHP filesystem limit', 10); + } + + //return fread($this->getid3->fp, $bytes); + /* + * http://www.getid3.org/phpBB3/viewtopic.php?t=1930 + * "I found out that the root cause for the problem was how getID3 uses the PHP system function fread(). + * It seems to assume that fread() would always return as many bytes as were requested. + * However, according the PHP manual (http://php.net/manual/en/function.fread.php), this is the case only with regular local files, but not e.g. with Linux pipes. + * The call may return only part of the requested data and a new call is needed to get more." + */ + $contents = ''; + do { + $part = fread($this->getid3->fp, $bytes); + $partLength = strlen($part); + $bytes -= $partLength; + $contents .= $part; + } while (($bytes > 0) && ($partLength > 0)); + return $contents; + } + + protected function fseek($bytes, $whence=SEEK_SET) { + if ($this->data_string_flag) { + switch ($whence) { + case SEEK_SET: + $this->data_string_position = $bytes; + break; + + case SEEK_CUR: + $this->data_string_position += $bytes; + break; + + case SEEK_END: + $this->data_string_position = $this->data_string_length + $bytes; + break; + } + return 0; + } else { + $pos = $bytes; + if ($whence == SEEK_CUR) { + $pos = $this->ftell() + $bytes; + } elseif ($whence == SEEK_END) { + $pos = $this->getid3->info['filesize'] + $bytes; + } + if (!getid3_lib::intValueSupported($pos)) { + throw new getid3_exception('cannot fseek('.$pos.') because beyond PHP filesystem limit', 10); + } + } + return fseek($this->getid3->fp, $bytes, $whence); + } + + protected function feof() { + if ($this->data_string_flag) { + return $this->data_string_position >= $this->data_string_length; + } + return feof($this->getid3->fp); + } + + final protected function isDependencyFor($module) { + return $this->dependency_to == $module; + } + + protected function error($text) { + $this->getid3->info['error'][] = $text; + + return false; + } + + protected function warning($text) { + return $this->getid3->warning($text); + } + + protected function notice($text) { + // does nothing for now + } + + public function saveAttachment($name, $offset, $length, $image_mime=null) { + try { + + // do not extract at all + if ($this->getid3->option_save_attachments === getID3::ATTACHMENTS_NONE) { + + $attachment = null; // do not set any + + // extract to return array + } elseif ($this->getid3->option_save_attachments === getID3::ATTACHMENTS_INLINE) { + + $this->fseek($offset); + $attachment = $this->fread($length); // get whole data in one pass, till it is anyway stored in memory + if ($attachment === false || strlen($attachment) != $length) { + throw new Exception('failed to read attachment data'); + } + + // assume directory path is given + } else { + + // set up destination path + $dir = rtrim(str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $this->getid3->option_save_attachments), DIRECTORY_SEPARATOR); + if (!is_dir($dir) || !getID3::is_writable($dir)) { // check supplied directory + throw new Exception('supplied path ('.$dir.') does not exist, or is not writable'); + } + $dest = $dir.DIRECTORY_SEPARATOR.$name.($image_mime ? '.'.getid3_lib::ImageExtFromMime($image_mime) : ''); + + // create dest file + if (($fp_dest = fopen($dest, 'wb')) == false) { + throw new Exception('failed to create file '.$dest); + } + + // copy data + $this->fseek($offset); + $buffersize = ($this->data_string_flag ? $length : $this->getid3->fread_buffer_size()); + $bytesleft = $length; + while ($bytesleft > 0) { + if (($buffer = $this->fread(min($buffersize, $bytesleft))) === false || ($byteswritten = fwrite($fp_dest, $buffer)) === false || ($byteswritten === 0)) { + throw new Exception($buffer === false ? 'not enough data to read' : 'failed to write to destination file, may be not enough disk space'); + } + $bytesleft -= $byteswritten; + } + + fclose($fp_dest); + $attachment = $dest; + + } + + } catch (Exception $e) { + + // close and remove dest file if created + if (isset($fp_dest) && is_resource($fp_dest)) { + fclose($fp_dest); + unlink($dest); + } + + // do not set any is case of error + $attachment = null; + $this->warning('Failed to extract attachment '.$name.': '.$e->getMessage()); + + } + + // seek to the end of attachment + $this->fseek($offset + $length); + + return $attachment; + } + +} + + +class getid3_exception extends Exception +{ + public $message; +} diff --git a/www/rompr/getid3/module.archive.gzip.php b/www/rompr/getid3/module.archive.gzip.php new file mode 100755 index 0000000..112a1e6 --- /dev/null +++ b/www/rompr/getid3/module.archive.gzip.php @@ -0,0 +1,281 @@ + // +// available at http://getid3.sourceforge.net // +// or http://www.getid3.org // +// also https://github.com/JamesHeinrich/getID3 // +///////////////////////////////////////////////////////////////// +// See readme.txt for more details // +///////////////////////////////////////////////////////////////// +// // +// module.archive.gzip.php // +// module for analyzing GZIP files // +// dependencies: NONE // +// /// +///////////////////////////////////////////////////////////////// +// // +// Module originally written by // +// Mike Mozolin // +// // +///////////////////////////////////////////////////////////////// + + +class getid3_gzip extends getid3_handler { + + // public: Optional file list - disable for speed. + public $option_gzip_parse_contents = false; // decode gzipped files, if possible, and parse recursively (.tar.gz for example) + + public function Analyze() { + $info = &$this->getid3->info; + + $info['fileformat'] = 'gzip'; + + $start_length = 10; + $unpack_header = 'a1id1/a1id2/a1cmethod/a1flags/a4mtime/a1xflags/a1os'; + //+---+---+---+---+---+---+---+---+---+---+ + //|ID1|ID2|CM |FLG| MTIME |XFL|OS | + //+---+---+---+---+---+---+---+---+---+---+ + + if ($info['php_memory_limit'] && ($info['filesize'] > $info['php_memory_limit'])) { + $this->error('File is too large ('.number_format($info['filesize']).' bytes) to read into memory (limit: '.number_format($info['php_memory_limit'] / 1048576).'MB)'); + return false; + } + $this->fseek(0); + $buffer = $this->fread($info['filesize']); + + $arr_members = explode("\x1F\x8B\x08", $buffer); + while (true) { + $is_wrong_members = false; + $num_members = intval(count($arr_members)); + for ($i = 0; $i < $num_members; $i++) { + if (strlen($arr_members[$i]) == 0) { + continue; + } + $buf = "\x1F\x8B\x08".$arr_members[$i]; + + $attr = unpack($unpack_header, substr($buf, 0, $start_length)); + if (!$this->get_os_type(ord($attr['os']))) { + // Merge member with previous if wrong OS type + $arr_members[($i - 1)] .= $buf; + $arr_members[$i] = ''; + $is_wrong_members = true; + continue; + } + } + if (!$is_wrong_members) { + break; + } + } + + $info['gzip']['files'] = array(); + + $fpointer = 0; + $idx = 0; + for ($i = 0; $i < $num_members; $i++) { + if (strlen($arr_members[$i]) == 0) { + continue; + } + $thisInfo = &$info['gzip']['member_header'][++$idx]; + + $buff = "\x1F\x8B\x08".$arr_members[$i]; + + $attr = unpack($unpack_header, substr($buff, 0, $start_length)); + $thisInfo['filemtime'] = getid3_lib::LittleEndian2Int($attr['mtime']); + $thisInfo['raw']['id1'] = ord($attr['cmethod']); + $thisInfo['raw']['id2'] = ord($attr['cmethod']); + $thisInfo['raw']['cmethod'] = ord($attr['cmethod']); + $thisInfo['raw']['os'] = ord($attr['os']); + $thisInfo['raw']['xflags'] = ord($attr['xflags']); + $thisInfo['raw']['flags'] = ord($attr['flags']); + + $thisInfo['flags']['crc16'] = (bool) ($thisInfo['raw']['flags'] & 0x02); + $thisInfo['flags']['extra'] = (bool) ($thisInfo['raw']['flags'] & 0x04); + $thisInfo['flags']['filename'] = (bool) ($thisInfo['raw']['flags'] & 0x08); + $thisInfo['flags']['comment'] = (bool) ($thisInfo['raw']['flags'] & 0x10); + + $thisInfo['compression'] = $this->get_xflag_type($thisInfo['raw']['xflags']); + + $thisInfo['os'] = $this->get_os_type($thisInfo['raw']['os']); + if (!$thisInfo['os']) { + $this->error('Read error on gzip file'); + return false; + } + + $fpointer = 10; + $arr_xsubfield = array(); + // bit 2 - FLG.FEXTRA + //+---+---+=================================+ + //| XLEN |...XLEN bytes of "extra field"...| + //+---+---+=================================+ + if ($thisInfo['flags']['extra']) { + $w_xlen = substr($buff, $fpointer, 2); + $xlen = getid3_lib::LittleEndian2Int($w_xlen); + $fpointer += 2; + + $thisInfo['raw']['xfield'] = substr($buff, $fpointer, $xlen); + // Extra SubFields + //+---+---+---+---+==================================+ + //|SI1|SI2| LEN |... LEN bytes of subfield data ...| + //+---+---+---+---+==================================+ + $idx = 0; + while (true) { + if ($idx >= $xlen) { + break; + } + $si1 = ord(substr($buff, $fpointer + $idx++, 1)); + $si2 = ord(substr($buff, $fpointer + $idx++, 1)); + if (($si1 == 0x41) && ($si2 == 0x70)) { + $w_xsublen = substr($buff, $fpointer + $idx, 2); + $xsublen = getid3_lib::LittleEndian2Int($w_xsublen); + $idx += 2; + $arr_xsubfield[] = substr($buff, $fpointer + $idx, $xsublen); + $idx += $xsublen; + } else { + break; + } + } + $fpointer += $xlen; + } + // bit 3 - FLG.FNAME + //+=========================================+ + //|...original file name, zero-terminated...| + //+=========================================+ + // GZIP files may have only one file, with no filename, so assume original filename is current filename without .gz + $thisInfo['filename'] = preg_replace('#\\.gz$#i', '', $info['filename']); + if ($thisInfo['flags']['filename']) { + $thisInfo['filename'] = ''; + while (true) { + if (ord($buff[$fpointer]) == 0) { + $fpointer++; + break; + } + $thisInfo['filename'] .= $buff[$fpointer]; + $fpointer++; + } + } + // bit 4 - FLG.FCOMMENT + //+===================================+ + //|...file comment, zero-terminated...| + //+===================================+ + if ($thisInfo['flags']['comment']) { + while (true) { + if (ord($buff[$fpointer]) == 0) { + $fpointer++; + break; + } + $thisInfo['comment'] .= $buff[$fpointer]; + $fpointer++; + } + } + // bit 1 - FLG.FHCRC + //+---+---+ + //| CRC16 | + //+---+---+ + if ($thisInfo['flags']['crc16']) { + $w_crc = substr($buff, $fpointer, 2); + $thisInfo['crc16'] = getid3_lib::LittleEndian2Int($w_crc); + $fpointer += 2; + } + // bit 0 - FLG.FTEXT + //if ($thisInfo['raw']['flags'] & 0x01) { + // Ignored... + //} + // bits 5, 6, 7 - reserved + + $thisInfo['crc32'] = getid3_lib::LittleEndian2Int(substr($buff, strlen($buff) - 8, 4)); + $thisInfo['filesize'] = getid3_lib::LittleEndian2Int(substr($buff, strlen($buff) - 4)); + + $info['gzip']['files'] = getid3_lib::array_merge_clobber($info['gzip']['files'], getid3_lib::CreateDeepArray($thisInfo['filename'], '/', $thisInfo['filesize'])); + + if ($this->option_gzip_parse_contents) { + // Try to inflate GZip + $csize = 0; + $inflated = ''; + $chkcrc32 = ''; + if (function_exists('gzinflate')) { + $cdata = substr($buff, $fpointer); + $cdata = substr($cdata, 0, strlen($cdata) - 8); + $csize = strlen($cdata); + $inflated = gzinflate($cdata); + + // Calculate CRC32 for inflated content + $thisInfo['crc32_valid'] = (bool) (sprintf('%u', crc32($inflated)) == $thisInfo['crc32']); + + // determine format + $formattest = substr($inflated, 0, 32774); + $getid3_temp = new getID3(); + $determined_format = $getid3_temp->GetFileFormat($formattest); + unset($getid3_temp); + + // file format is determined + $determined_format['module'] = (isset($determined_format['module']) ? $determined_format['module'] : ''); + switch ($determined_format['module']) { + case 'tar': + // view TAR-file info + if (file_exists(GETID3_INCLUDEPATH.$determined_format['include']) && include_once(GETID3_INCLUDEPATH.$determined_format['include'])) { + if (($temp_tar_filename = tempnam(GETID3_TEMP_DIR, 'getID3')) === false) { + // can't find anywhere to create a temp file, abort + $this->error('Unable to create temp file to parse TAR inside GZIP file'); + break; + } + if ($fp_temp_tar = fopen($temp_tar_filename, 'w+b')) { + fwrite($fp_temp_tar, $inflated); + fclose($fp_temp_tar); + $getid3_temp = new getID3(); + $getid3_temp->openfile($temp_tar_filename); + $getid3_tar = new getid3_tar($getid3_temp); + $getid3_tar->Analyze(); + $info['gzip']['member_header'][$idx]['tar'] = $getid3_temp->info['tar']; + unset($getid3_temp, $getid3_tar); + unlink($temp_tar_filename); + } else { + $this->error('Unable to fopen() temp file to parse TAR inside GZIP file'); + break; + } + } + break; + + case '': + default: + // unknown or unhandled format + break; + } + } + } + } + return true; + } + + // Converts the OS type + public function get_os_type($key) { + static $os_type = array( + '0' => 'FAT filesystem (MS-DOS, OS/2, NT/Win32)', + '1' => 'Amiga', + '2' => 'VMS (or OpenVMS)', + '3' => 'Unix', + '4' => 'VM/CMS', + '5' => 'Atari TOS', + '6' => 'HPFS filesystem (OS/2, NT)', + '7' => 'Macintosh', + '8' => 'Z-System', + '9' => 'CP/M', + '10' => 'TOPS-20', + '11' => 'NTFS filesystem (NT)', + '12' => 'QDOS', + '13' => 'Acorn RISCOS', + '255' => 'unknown' + ); + return (isset($os_type[$key]) ? $os_type[$key] : ''); + } + + // Converts the eXtra FLags + public function get_xflag_type($key) { + static $xflag_type = array( + '0' => 'unknown', + '2' => 'maximum compression', + '4' => 'fastest algorithm' + ); + return (isset($xflag_type[$key]) ? $xflag_type[$key] : ''); + } +} + diff --git a/www/rompr/getid3/module.archive.rar.php b/www/rompr/getid3/module.archive.rar.php new file mode 100755 index 0000000..30961fb --- /dev/null +++ b/www/rompr/getid3/module.archive.rar.php @@ -0,0 +1,51 @@ + // +// available at http://getid3.sourceforge.net // +// or http://www.getid3.org // +// also https://github.com/JamesHeinrich/getID3 // +///////////////////////////////////////////////////////////////// +// See readme.txt for more details // +///////////////////////////////////////////////////////////////// +// // +// module.archive.rar.php // +// module for analyzing RAR files // +// dependencies: NONE // +// /// +///////////////////////////////////////////////////////////////// + + +class getid3_rar extends getid3_handler +{ + + public $option_use_rar_extension = false; + + public function Analyze() { + $info = &$this->getid3->info; + + $info['fileformat'] = 'rar'; + + if ($this->option_use_rar_extension === true) { + if (function_exists('rar_open')) { + if ($rp = rar_open($info['filenamepath'])) { + $info['rar']['files'] = array(); + $entries = rar_list($rp); + foreach ($entries as $entry) { + $info['rar']['files'] = getid3_lib::array_merge_clobber($info['rar']['files'], getid3_lib::CreateDeepArray($entry->getName(), '/', $entry->getUnpackedSize())); + } + rar_close($rp); + return true; + } else { + $this->error('failed to rar_open('.$info['filename'].')'); + } + } else { + $this->error('RAR support does not appear to be available in this PHP installation'); + } + } else { + $this->error('PHP-RAR processing has been disabled (set $getid3_rar->option_use_rar_extension=true to enable)'); + } + return false; + + } + +} diff --git a/www/rompr/getid3/module.archive.szip.php b/www/rompr/getid3/module.archive.szip.php new file mode 100755 index 0000000..6751729 --- /dev/null +++ b/www/rompr/getid3/module.archive.szip.php @@ -0,0 +1,97 @@ + // +// available at http://getid3.sourceforge.net // +// or http://www.getid3.org // +// also https://github.com/JamesHeinrich/getID3 // +///////////////////////////////////////////////////////////////// +// See readme.txt for more details // +///////////////////////////////////////////////////////////////// +// // +// module.archive.szip.php // +// module for analyzing SZIP compressed files // +// dependencies: NONE // +// /// +///////////////////////////////////////////////////////////////// + + +class getid3_szip extends getid3_handler +{ + + public function Analyze() { + $info = &$this->getid3->info; + + $this->fseek($info['avdataoffset']); + $SZIPHeader = $this->fread(6); + if (substr($SZIPHeader, 0, 4) != "SZ\x0A\x04") { + $this->error('Expecting "53 5A 0A 04" at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes(substr($SZIPHeader, 0, 4)).'"'); + return false; + } + $info['fileformat'] = 'szip'; + $info['szip']['major_version'] = getid3_lib::BigEndian2Int(substr($SZIPHeader, 4, 1)); + $info['szip']['minor_version'] = getid3_lib::BigEndian2Int(substr($SZIPHeader, 5, 1)); +$this->error('SZIP parsing not enabled in this version of getID3() ['.$this->getid3->version().']'); +return false; + + while (!$this->feof()) { + $NextBlockID = $this->fread(2); + switch ($NextBlockID) { + case 'SZ': + // Note that szip files can be concatenated, this has the same effect as + // concatenating the files. this also means that global header blocks + // might be present between directory/data blocks. + $this->fseek(4, SEEK_CUR); + break; + + case 'BH': + $BHheaderbytes = getid3_lib::BigEndian2Int($this->fread(3)); + $BHheaderdata = $this->fread($BHheaderbytes); + $BHheaderoffset = 0; + while (strpos($BHheaderdata, "\x00", $BHheaderoffset) > 0) { + //filename as \0 terminated string (empty string indicates end) + //owner as \0 terminated string (empty is same as last file) + //group as \0 terminated string (empty is same as last file) + //3 byte filelength in this block + //2 byte access flags + //4 byte creation time (like in unix) + //4 byte modification time (like in unix) + //4 byte access time (like in unix) + + $BHdataArray['filename'] = substr($BHheaderdata, $BHheaderoffset, strcspn($BHheaderdata, "\x00")); + $BHheaderoffset += (strlen($BHdataArray['filename']) + 1); + + $BHdataArray['owner'] = substr($BHheaderdata, $BHheaderoffset, strcspn($BHheaderdata, "\x00")); + $BHheaderoffset += (strlen($BHdataArray['owner']) + 1); + + $BHdataArray['group'] = substr($BHheaderdata, $BHheaderoffset, strcspn($BHheaderdata, "\x00")); + $BHheaderoffset += (strlen($BHdataArray['group']) + 1); + + $BHdataArray['filelength'] = getid3_lib::BigEndian2Int(substr($BHheaderdata, $BHheaderoffset, 3)); + $BHheaderoffset += 3; + + $BHdataArray['access_flags'] = getid3_lib::BigEndian2Int(substr($BHheaderdata, $BHheaderoffset, 2)); + $BHheaderoffset += 2; + + $BHdataArray['creation_time'] = getid3_lib::BigEndian2Int(substr($BHheaderdata, $BHheaderoffset, 4)); + $BHheaderoffset += 4; + + $BHdataArray['modification_time'] = getid3_lib::BigEndian2Int(substr($BHheaderdata, $BHheaderoffset, 4)); + $BHheaderoffset += 4; + + $BHdataArray['access_time'] = getid3_lib::BigEndian2Int(substr($BHheaderdata, $BHheaderoffset, 4)); + $BHheaderoffset += 4; + + $info['szip']['BH'][] = $BHdataArray; + } + break; + + default: + break 2; + } + } + + return true; + + } + +} diff --git a/www/rompr/getid3/module.archive.tar.php b/www/rompr/getid3/module.archive.tar.php new file mode 100755 index 0000000..9e8d72a --- /dev/null +++ b/www/rompr/getid3/module.archive.tar.php @@ -0,0 +1,177 @@ + // +// available at http://getid3.sourceforge.net // +// or http://www.getid3.org // +// also https://github.com/JamesHeinrich/getID3 // +///////////////////////////////////////////////////////////////// +// See readme.txt for more details // +///////////////////////////////////////////////////////////////// +// // +// module.archive.tar.php // +// module for analyzing TAR files // +// dependencies: NONE // +// /// +///////////////////////////////////////////////////////////////// +// // +// Module originally written by // +// Mike Mozolin // +// // +///////////////////////////////////////////////////////////////// + + +class getid3_tar extends getid3_handler +{ + + public function Analyze() { + $info = &$this->getid3->info; + + $info['fileformat'] = 'tar'; + $info['tar']['files'] = array(); + + $unpack_header = 'a100fname/a8mode/a8uid/a8gid/a12size/a12mtime/a8chksum/a1typflag/a100lnkname/a6magic/a2ver/a32uname/a32gname/a8devmaj/a8devmin/a155prefix'; + $null_512k = str_repeat("\x00", 512); // end-of-file marker + + $this->fseek(0); + while (!feof($this->getid3->fp)) { + $buffer = $this->fread(512); + if (strlen($buffer) < 512) { + break; + } + + // check the block + $checksum = 0; + for ($i = 0; $i < 148; $i++) { + $checksum += ord($buffer{$i}); + } + for ($i = 148; $i < 156; $i++) { + $checksum += ord(' '); + } + for ($i = 156; $i < 512; $i++) { + $checksum += ord($buffer{$i}); + } + $attr = unpack($unpack_header, $buffer); + $name = (isset($attr['fname'] ) ? trim($attr['fname'] ) : ''); + $mode = octdec(isset($attr['mode'] ) ? trim($attr['mode'] ) : ''); + $uid = octdec(isset($attr['uid'] ) ? trim($attr['uid'] ) : ''); + $gid = octdec(isset($attr['gid'] ) ? trim($attr['gid'] ) : ''); + $size = octdec(isset($attr['size'] ) ? trim($attr['size'] ) : ''); + $mtime = octdec(isset($attr['mtime'] ) ? trim($attr['mtime'] ) : ''); + $chksum = octdec(isset($attr['chksum'] ) ? trim($attr['chksum'] ) : ''); + $typflag = (isset($attr['typflag']) ? trim($attr['typflag']) : ''); + $lnkname = (isset($attr['lnkname']) ? trim($attr['lnkname']) : ''); + $magic = (isset($attr['magic'] ) ? trim($attr['magic'] ) : ''); + $ver = (isset($attr['ver'] ) ? trim($attr['ver'] ) : ''); + $uname = (isset($attr['uname'] ) ? trim($attr['uname'] ) : ''); + $gname = (isset($attr['gname'] ) ? trim($attr['gname'] ) : ''); + $devmaj = octdec(isset($attr['devmaj'] ) ? trim($attr['devmaj'] ) : ''); + $devmin = octdec(isset($attr['devmin'] ) ? trim($attr['devmin'] ) : ''); + $prefix = (isset($attr['prefix'] ) ? trim($attr['prefix'] ) : ''); + if (($checksum == 256) && ($chksum == 0)) { + // EOF Found + break; + } + if ($prefix) { + $name = $prefix.'/'.$name; + } + if ((preg_match('#/$#', $name)) && !$name) { + $typeflag = 5; + } + if ($buffer == $null_512k) { + // it's the end of the tar-file... + break; + } + + // Read to the next chunk + $this->fseek($size, SEEK_CUR); + + $diff = $size % 512; + if ($diff != 0) { + // Padding, throw away + $this->fseek((512 - $diff), SEEK_CUR); + } + // Protect against tar-files with garbage at the end + if ($name == '') { + break; + } + $info['tar']['file_details'][$name] = array ( + 'name' => $name, + 'mode_raw' => $mode, + 'mode' => self::display_perms($mode), + 'uid' => $uid, + 'gid' => $gid, + 'size' => $size, + 'mtime' => $mtime, + 'chksum' => $chksum, + 'typeflag' => self::get_flag_type($typflag), + 'linkname' => $lnkname, + 'magic' => $magic, + 'version' => $ver, + 'uname' => $uname, + 'gname' => $gname, + 'devmajor' => $devmaj, + 'devminor' => $devmin + ); + $info['tar']['files'] = getid3_lib::array_merge_clobber($info['tar']['files'], getid3_lib::CreateDeepArray($info['tar']['file_details'][$name]['name'], '/', $size)); + } + return true; + } + + // Parses the file mode to file permissions + public function display_perms($mode) { + // Determine Type + if ($mode & 0x1000) $type='p'; // FIFO pipe + elseif ($mode & 0x2000) $type='c'; // Character special + elseif ($mode & 0x4000) $type='d'; // Directory + elseif ($mode & 0x6000) $type='b'; // Block special + elseif ($mode & 0x8000) $type='-'; // Regular + elseif ($mode & 0xA000) $type='l'; // Symbolic Link + elseif ($mode & 0xC000) $type='s'; // Socket + else $type='u'; // UNKNOWN + + // Determine permissions + $owner['read'] = (($mode & 00400) ? 'r' : '-'); + $owner['write'] = (($mode & 00200) ? 'w' : '-'); + $owner['execute'] = (($mode & 00100) ? 'x' : '-'); + $group['read'] = (($mode & 00040) ? 'r' : '-'); + $group['write'] = (($mode & 00020) ? 'w' : '-'); + $group['execute'] = (($mode & 00010) ? 'x' : '-'); + $world['read'] = (($mode & 00004) ? 'r' : '-'); + $world['write'] = (($mode & 00002) ? 'w' : '-'); + $world['execute'] = (($mode & 00001) ? 'x' : '-'); + + // Adjust for SUID, SGID and sticky bit + if ($mode & 0x800) $owner['execute'] = ($owner['execute'] == 'x') ? 's' : 'S'; + if ($mode & 0x400) $group['execute'] = ($group['execute'] == 'x') ? 's' : 'S'; + if ($mode & 0x200) $world['execute'] = ($world['execute'] == 'x') ? 't' : 'T'; + + $s = sprintf('%1s', $type); + $s .= sprintf('%1s%1s%1s', $owner['read'], $owner['write'], $owner['execute']); + $s .= sprintf('%1s%1s%1s', $group['read'], $group['write'], $group['execute']); + $s .= sprintf('%1s%1s%1s'."\n", $world['read'], $world['write'], $world['execute']); + return $s; + } + + // Converts the file type + public function get_flag_type($typflag) { + static $flag_types = array( + '0' => 'LF_NORMAL', + '1' => 'LF_LINK', + '2' => 'LF_SYNLINK', + '3' => 'LF_CHR', + '4' => 'LF_BLK', + '5' => 'LF_DIR', + '6' => 'LF_FIFO', + '7' => 'LF_CONFIG', + 'D' => 'LF_DUMPDIR', + 'K' => 'LF_LONGLINK', + 'L' => 'LF_LONGNAME', + 'M' => 'LF_MULTIVOL', + 'N' => 'LF_NAMES', + 'S' => 'LF_SPARSE', + 'V' => 'LF_VOLHDR' + ); + return (isset($flag_types[$typflag]) ? $flag_types[$typflag] : ''); + } + +} diff --git a/www/rompr/getid3/module.archive.zip.php b/www/rompr/getid3/module.archive.zip.php new file mode 100755 index 0000000..4b7aa58 --- /dev/null +++ b/www/rompr/getid3/module.archive.zip.php @@ -0,0 +1,513 @@ + // +// available at http://getid3.sourceforge.net // +// or http://www.getid3.org // +// also https://github.com/JamesHeinrich/getID3 // +///////////////////////////////////////////////////////////////// +// See readme.txt for more details // +///////////////////////////////////////////////////////////////// +// // +// module.archive.zip.php // +// module for analyzing pkZip files // +// dependencies: NONE // +// /// +///////////////////////////////////////////////////////////////// + + +class getid3_zip extends getid3_handler +{ + + public function Analyze() { + $info = &$this->getid3->info; + + $info['fileformat'] = 'zip'; + $info['zip']['encoding'] = 'ISO-8859-1'; + $info['zip']['files'] = array(); + + $info['zip']['compressed_size'] = 0; + $info['zip']['uncompressed_size'] = 0; + $info['zip']['entries_count'] = 0; + + if (!getid3_lib::intValueSupported($info['filesize'])) { + $this->error('File is larger than '.round(PHP_INT_MAX / 1073741824).'GB, not supported by PHP'); + return false; + } else { + $EOCDsearchData = ''; + $EOCDsearchCounter = 0; + while ($EOCDsearchCounter++ < 512) { + + $this->fseek(-128 * $EOCDsearchCounter, SEEK_END); + $EOCDsearchData = $this->fread(128).$EOCDsearchData; + + if (strstr($EOCDsearchData, 'PK'."\x05\x06")) { + + $EOCDposition = strpos($EOCDsearchData, 'PK'."\x05\x06"); + $this->fseek((-128 * $EOCDsearchCounter) + $EOCDposition, SEEK_END); + $info['zip']['end_central_directory'] = $this->ZIPparseEndOfCentralDirectory(); + + $this->fseek($info['zip']['end_central_directory']['directory_offset']); + $info['zip']['entries_count'] = 0; + while ($centraldirectoryentry = $this->ZIPparseCentralDirectory($this->getid3->fp)) { + $info['zip']['central_directory'][] = $centraldirectoryentry; + $info['zip']['entries_count']++; + $info['zip']['compressed_size'] += $centraldirectoryentry['compressed_size']; + $info['zip']['uncompressed_size'] += $centraldirectoryentry['uncompressed_size']; + + //if ($centraldirectoryentry['uncompressed_size'] > 0) { zero-byte files are valid + if (!empty($centraldirectoryentry['filename'])) { + $info['zip']['files'] = getid3_lib::array_merge_clobber($info['zip']['files'], getid3_lib::CreateDeepArray($centraldirectoryentry['filename'], '/', $centraldirectoryentry['uncompressed_size'])); + } + } + + if ($info['zip']['entries_count'] == 0) { + $this->error('No Central Directory entries found (truncated file?)'); + return false; + } + + if (!empty($info['zip']['end_central_directory']['comment'])) { + $info['zip']['comments']['comment'][] = $info['zip']['end_central_directory']['comment']; + } + + if (isset($info['zip']['central_directory'][0]['compression_method'])) { + $info['zip']['compression_method'] = $info['zip']['central_directory'][0]['compression_method']; + } + if (isset($info['zip']['central_directory'][0]['flags']['compression_speed'])) { + $info['zip']['compression_speed'] = $info['zip']['central_directory'][0]['flags']['compression_speed']; + } + if (isset($info['zip']['compression_method']) && ($info['zip']['compression_method'] == 'store') && !isset($info['zip']['compression_speed'])) { + $info['zip']['compression_speed'] = 'store'; + } + + // secondary check - we (should) already have all the info we NEED from the Central Directory above, but scanning each + // Local File Header entry will + foreach ($info['zip']['central_directory'] as $central_directory_entry) { + $this->fseek($central_directory_entry['entry_offset']); + if ($fileentry = $this->ZIPparseLocalFileHeader()) { + $info['zip']['entries'][] = $fileentry; + } else { + $this->warning('Error parsing Local File Header at offset '.$central_directory_entry['entry_offset']); + } + } + + if (!empty($info['zip']['files']['[Content_Types].xml']) && + !empty($info['zip']['files']['_rels']['.rels']) && + !empty($info['zip']['files']['docProps']['app.xml']) && + !empty($info['zip']['files']['docProps']['core.xml'])) { + // http://technet.microsoft.com/en-us/library/cc179224.aspx + $info['fileformat'] = 'zip.msoffice'; + if (!empty($ThisFileInfo['zip']['files']['ppt'])) { + $info['mime_type'] = 'application/vnd.openxmlformats-officedocument.presentationml.presentation'; + } elseif (!empty($ThisFileInfo['zip']['files']['xl'])) { + $info['mime_type'] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'; + } elseif (!empty($ThisFileInfo['zip']['files']['word'])) { + $info['mime_type'] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'; + } + } + + return true; + } + } + } + + if (!$this->getZIPentriesFilepointer()) { + unset($info['zip']); + $info['fileformat'] = ''; + $this->error('Cannot find End Of Central Directory (truncated file?)'); + return false; + } + + // central directory couldn't be found and/or parsed + // scan through actual file data entries, recover as much as possible from probable trucated file + if ($info['zip']['compressed_size'] > ($info['filesize'] - 46 - 22)) { + $this->error('Warning: Truncated file! - Total compressed file sizes ('.$info['zip']['compressed_size'].' bytes) is greater than filesize minus Central Directory and End Of Central Directory structures ('.($info['filesize'] - 46 - 22).' bytes)'); + } + $this->error('Cannot find End Of Central Directory - returned list of files in [zip][entries] array may not be complete'); + foreach ($info['zip']['entries'] as $key => $valuearray) { + $info['zip']['files'][$valuearray['filename']] = $valuearray['uncompressed_size']; + } + return true; + } + + + public function getZIPHeaderFilepointerTopDown() { + $info = &$this->getid3->info; + + $info['fileformat'] = 'zip'; + + $info['zip']['compressed_size'] = 0; + $info['zip']['uncompressed_size'] = 0; + $info['zip']['entries_count'] = 0; + + rewind($this->getid3->fp); + while ($fileentry = $this->ZIPparseLocalFileHeader()) { + $info['zip']['entries'][] = $fileentry; + $info['zip']['entries_count']++; + } + if ($info['zip']['entries_count'] == 0) { + $this->error('No Local File Header entries found'); + return false; + } + + $info['zip']['entries_count'] = 0; + while ($centraldirectoryentry = $this->ZIPparseCentralDirectory($this->getid3->fp)) { + $info['zip']['central_directory'][] = $centraldirectoryentry; + $info['zip']['entries_count']++; + $info['zip']['compressed_size'] += $centraldirectoryentry['compressed_size']; + $info['zip']['uncompressed_size'] += $centraldirectoryentry['uncompressed_size']; + } + if ($info['zip']['entries_count'] == 0) { + $this->error('No Central Directory entries found (truncated file?)'); + return false; + } + + if ($EOCD = $this->ZIPparseEndOfCentralDirectory()) { + $info['zip']['end_central_directory'] = $EOCD; + } else { + $this->error('No End Of Central Directory entry found (truncated file?)'); + return false; + } + + if (!empty($info['zip']['end_central_directory']['comment'])) { + $info['zip']['comments']['comment'][] = $info['zip']['end_central_directory']['comment']; + } + + return true; + } + + + public function getZIPentriesFilepointer() { + $info = &$this->getid3->info; + + $info['zip']['compressed_size'] = 0; + $info['zip']['uncompressed_size'] = 0; + $info['zip']['entries_count'] = 0; + + rewind($this->getid3->fp); + while ($fileentry = $this->ZIPparseLocalFileHeader()) { + $info['zip']['entries'][] = $fileentry; + $info['zip']['entries_count']++; + $info['zip']['compressed_size'] += $fileentry['compressed_size']; + $info['zip']['uncompressed_size'] += $fileentry['uncompressed_size']; + } + if ($info['zip']['entries_count'] == 0) { + $this->error('No Local File Header entries found'); + return false; + } + + return true; + } + + + public function ZIPparseLocalFileHeader() { + $LocalFileHeader['offset'] = $this->ftell(); + + $ZIPlocalFileHeader = $this->fread(30); + + $LocalFileHeader['raw']['signature'] = getid3_lib::LittleEndian2Int(substr($ZIPlocalFileHeader, 0, 4)); + if ($LocalFileHeader['raw']['signature'] != 0x04034B50) { // "PK\x03\x04" + // invalid Local File Header Signature + $this->fseek($LocalFileHeader['offset']); // seek back to where filepointer originally was so it can be handled properly + return false; + } + $LocalFileHeader['raw']['extract_version'] = getid3_lib::LittleEndian2Int(substr($ZIPlocalFileHeader, 4, 2)); + $LocalFileHeader['raw']['general_flags'] = getid3_lib::LittleEndian2Int(substr($ZIPlocalFileHeader, 6, 2)); + $LocalFileHeader['raw']['compression_method'] = getid3_lib::LittleEndian2Int(substr($ZIPlocalFileHeader, 8, 2)); + $LocalFileHeader['raw']['last_mod_file_time'] = getid3_lib::LittleEndian2Int(substr($ZIPlocalFileHeader, 10, 2)); + $LocalFileHeader['raw']['last_mod_file_date'] = getid3_lib::LittleEndian2Int(substr($ZIPlocalFileHeader, 12, 2)); + $LocalFileHeader['raw']['crc_32'] = getid3_lib::LittleEndian2Int(substr($ZIPlocalFileHeader, 14, 4)); + $LocalFileHeader['raw']['compressed_size'] = getid3_lib::LittleEndian2Int(substr($ZIPlocalFileHeader, 18, 4)); + $LocalFileHeader['raw']['uncompressed_size'] = getid3_lib::LittleEndian2Int(substr($ZIPlocalFileHeader, 22, 4)); + $LocalFileHeader['raw']['filename_length'] = getid3_lib::LittleEndian2Int(substr($ZIPlocalFileHeader, 26, 2)); + $LocalFileHeader['raw']['extra_field_length'] = getid3_lib::LittleEndian2Int(substr($ZIPlocalFileHeader, 28, 2)); + + $LocalFileHeader['extract_version'] = sprintf('%1.1f', $LocalFileHeader['raw']['extract_version'] / 10); + $LocalFileHeader['host_os'] = $this->ZIPversionOSLookup(($LocalFileHeader['raw']['extract_version'] & 0xFF00) >> 8); + $LocalFileHeader['compression_method'] = $this->ZIPcompressionMethodLookup($LocalFileHeader['raw']['compression_method']); + $LocalFileHeader['compressed_size'] = $LocalFileHeader['raw']['compressed_size']; + $LocalFileHeader['uncompressed_size'] = $LocalFileHeader['raw']['uncompressed_size']; + $LocalFileHeader['flags'] = $this->ZIPparseGeneralPurposeFlags($LocalFileHeader['raw']['general_flags'], $LocalFileHeader['raw']['compression_method']); + $LocalFileHeader['last_modified_timestamp'] = $this->DOStime2UNIXtime($LocalFileHeader['raw']['last_mod_file_date'], $LocalFileHeader['raw']['last_mod_file_time']); + + $FilenameExtrafieldLength = $LocalFileHeader['raw']['filename_length'] + $LocalFileHeader['raw']['extra_field_length']; + if ($FilenameExtrafieldLength > 0) { + $ZIPlocalFileHeader .= $this->fread($FilenameExtrafieldLength); + + if ($LocalFileHeader['raw']['filename_length'] > 0) { + $LocalFileHeader['filename'] = substr($ZIPlocalFileHeader, 30, $LocalFileHeader['raw']['filename_length']); + } + if ($LocalFileHeader['raw']['extra_field_length'] > 0) { + $LocalFileHeader['raw']['extra_field_data'] = substr($ZIPlocalFileHeader, 30 + $LocalFileHeader['raw']['filename_length'], $LocalFileHeader['raw']['extra_field_length']); + } + } + + if ($LocalFileHeader['compressed_size'] == 0) { + // *Could* be a zero-byte file + // But could also be a file written on the fly that didn't know compressed filesize beforehand. + // Correct compressed filesize should be in the data_descriptor located after this file data, and also in Central Directory (at end of zip file) + if (!empty($this->getid3->info['zip']['central_directory'])) { + foreach ($this->getid3->info['zip']['central_directory'] as $central_directory_entry) { + if ($central_directory_entry['entry_offset'] == $LocalFileHeader['offset']) { + if ($central_directory_entry['compressed_size'] > 0) { + // overwrite local zero value (but not ['raw']'compressed_size']) so that seeking for data_descriptor (and next file entry) works correctly + $LocalFileHeader['compressed_size'] = $central_directory_entry['compressed_size']; + } + break; + } + } + } + + } + $LocalFileHeader['data_offset'] = $this->ftell(); + $this->fseek($LocalFileHeader['compressed_size'], SEEK_CUR); // this should (but may not) match value in $LocalFileHeader['raw']['compressed_size'] -- $LocalFileHeader['compressed_size'] could have been overwritten above with value from Central Directory + + if ($LocalFileHeader['flags']['data_descriptor_used']) { + $DataDescriptor = $this->fread(16); + $LocalFileHeader['data_descriptor']['signature'] = getid3_lib::LittleEndian2Int(substr($DataDescriptor, 0, 4)); + if ($LocalFileHeader['data_descriptor']['signature'] != 0x08074B50) { // "PK\x07\x08" + $this->getid3->warning[] = 'invalid Local File Header Data Descriptor Signature at offset '.($this->ftell() - 16).' - expecting 08 07 4B 50, found '.getid3_lib::PrintHexBytes($LocalFileHeader['data_descriptor']['signature']); + $this->fseek($LocalFileHeader['offset']); // seek back to where filepointer originally was so it can be handled properly + return false; + } + $LocalFileHeader['data_descriptor']['crc_32'] = getid3_lib::LittleEndian2Int(substr($DataDescriptor, 4, 4)); + $LocalFileHeader['data_descriptor']['compressed_size'] = getid3_lib::LittleEndian2Int(substr($DataDescriptor, 8, 4)); + $LocalFileHeader['data_descriptor']['uncompressed_size'] = getid3_lib::LittleEndian2Int(substr($DataDescriptor, 12, 4)); + if (!$LocalFileHeader['raw']['compressed_size'] && $LocalFileHeader['data_descriptor']['compressed_size']) { + foreach ($this->getid3->info['zip']['central_directory'] as $central_directory_entry) { + if ($central_directory_entry['entry_offset'] == $LocalFileHeader['offset']) { + if ($LocalFileHeader['data_descriptor']['compressed_size'] == $central_directory_entry['compressed_size']) { + // $LocalFileHeader['compressed_size'] already set from Central Directory + } else { + $this->warning('conflicting compressed_size from data_descriptor ('.$LocalFileHeader['data_descriptor']['compressed_size'].') vs Central Directory ('.$central_directory_entry['compressed_size'].') for file at offset '.$LocalFileHeader['offset']); + } + + if ($LocalFileHeader['data_descriptor']['uncompressed_size'] == $central_directory_entry['uncompressed_size']) { + $LocalFileHeader['uncompressed_size'] = $LocalFileHeader['data_descriptor']['uncompressed_size']; + } else { + $this->warning('conflicting uncompressed_size from data_descriptor ('.$LocalFileHeader['data_descriptor']['uncompressed_size'].') vs Central Directory ('.$central_directory_entry['uncompressed_size'].') for file at offset '.$LocalFileHeader['offset']); + } + break; + } + } + } + } + return $LocalFileHeader; + } + + + public function ZIPparseCentralDirectory() { + $CentralDirectory['offset'] = $this->ftell(); + + $ZIPcentralDirectory = $this->fread(46); + + $CentralDirectory['raw']['signature'] = getid3_lib::LittleEndian2Int(substr($ZIPcentralDirectory, 0, 4)); + if ($CentralDirectory['raw']['signature'] != 0x02014B50) { + // invalid Central Directory Signature + $this->fseek($CentralDirectory['offset']); // seek back to where filepointer originally was so it can be handled properly + return false; + } + $CentralDirectory['raw']['create_version'] = getid3_lib::LittleEndian2Int(substr($ZIPcentralDirectory, 4, 2)); + $CentralDirectory['raw']['extract_version'] = getid3_lib::LittleEndian2Int(substr($ZIPcentralDirectory, 6, 2)); + $CentralDirectory['raw']['general_flags'] = getid3_lib::LittleEndian2Int(substr($ZIPcentralDirectory, 8, 2)); + $CentralDirectory['raw']['compression_method'] = getid3_lib::LittleEndian2Int(substr($ZIPcentralDirectory, 10, 2)); + $CentralDirectory['raw']['last_mod_file_time'] = getid3_lib::LittleEndian2Int(substr($ZIPcentralDirectory, 12, 2)); + $CentralDirectory['raw']['last_mod_file_date'] = getid3_lib::LittleEndian2Int(substr($ZIPcentralDirectory, 14, 2)); + $CentralDirectory['raw']['crc_32'] = getid3_lib::LittleEndian2Int(substr($ZIPcentralDirectory, 16, 4)); + $CentralDirectory['raw']['compressed_size'] = getid3_lib::LittleEndian2Int(substr($ZIPcentralDirectory, 20, 4)); + $CentralDirectory['raw']['uncompressed_size'] = getid3_lib::LittleEndian2Int(substr($ZIPcentralDirectory, 24, 4)); + $CentralDirectory['raw']['filename_length'] = getid3_lib::LittleEndian2Int(substr($ZIPcentralDirectory, 28, 2)); + $CentralDirectory['raw']['extra_field_length'] = getid3_lib::LittleEndian2Int(substr($ZIPcentralDirectory, 30, 2)); + $CentralDirectory['raw']['file_comment_length'] = getid3_lib::LittleEndian2Int(substr($ZIPcentralDirectory, 32, 2)); + $CentralDirectory['raw']['disk_number_start'] = getid3_lib::LittleEndian2Int(substr($ZIPcentralDirectory, 34, 2)); + $CentralDirectory['raw']['internal_file_attrib'] = getid3_lib::LittleEndian2Int(substr($ZIPcentralDirectory, 36, 2)); + $CentralDirectory['raw']['external_file_attrib'] = getid3_lib::LittleEndian2Int(substr($ZIPcentralDirectory, 38, 4)); + $CentralDirectory['raw']['local_header_offset'] = getid3_lib::LittleEndian2Int(substr($ZIPcentralDirectory, 42, 4)); + + $CentralDirectory['entry_offset'] = $CentralDirectory['raw']['local_header_offset']; + $CentralDirectory['create_version'] = sprintf('%1.1f', $CentralDirectory['raw']['create_version'] / 10); + $CentralDirectory['extract_version'] = sprintf('%1.1f', $CentralDirectory['raw']['extract_version'] / 10); + $CentralDirectory['host_os'] = $this->ZIPversionOSLookup(($CentralDirectory['raw']['extract_version'] & 0xFF00) >> 8); + $CentralDirectory['compression_method'] = $this->ZIPcompressionMethodLookup($CentralDirectory['raw']['compression_method']); + $CentralDirectory['compressed_size'] = $CentralDirectory['raw']['compressed_size']; + $CentralDirectory['uncompressed_size'] = $CentralDirectory['raw']['uncompressed_size']; + $CentralDirectory['flags'] = $this->ZIPparseGeneralPurposeFlags($CentralDirectory['raw']['general_flags'], $CentralDirectory['raw']['compression_method']); + $CentralDirectory['last_modified_timestamp'] = $this->DOStime2UNIXtime($CentralDirectory['raw']['last_mod_file_date'], $CentralDirectory['raw']['last_mod_file_time']); + + $FilenameExtrafieldCommentLength = $CentralDirectory['raw']['filename_length'] + $CentralDirectory['raw']['extra_field_length'] + $CentralDirectory['raw']['file_comment_length']; + if ($FilenameExtrafieldCommentLength > 0) { + $FilenameExtrafieldComment = $this->fread($FilenameExtrafieldCommentLength); + + if ($CentralDirectory['raw']['filename_length'] > 0) { + $CentralDirectory['filename'] = substr($FilenameExtrafieldComment, 0, $CentralDirectory['raw']['filename_length']); + } + if ($CentralDirectory['raw']['extra_field_length'] > 0) { + $CentralDirectory['raw']['extra_field_data'] = substr($FilenameExtrafieldComment, $CentralDirectory['raw']['filename_length'], $CentralDirectory['raw']['extra_field_length']); + } + if ($CentralDirectory['raw']['file_comment_length'] > 0) { + $CentralDirectory['file_comment'] = substr($FilenameExtrafieldComment, $CentralDirectory['raw']['filename_length'] + $CentralDirectory['raw']['extra_field_length'], $CentralDirectory['raw']['file_comment_length']); + } + } + + return $CentralDirectory; + } + + public function ZIPparseEndOfCentralDirectory() { + $EndOfCentralDirectory['offset'] = $this->ftell(); + + $ZIPendOfCentralDirectory = $this->fread(22); + + $EndOfCentralDirectory['signature'] = getid3_lib::LittleEndian2Int(substr($ZIPendOfCentralDirectory, 0, 4)); + if ($EndOfCentralDirectory['signature'] != 0x06054B50) { + // invalid End Of Central Directory Signature + $this->fseek($EndOfCentralDirectory['offset']); // seek back to where filepointer originally was so it can be handled properly + return false; + } + $EndOfCentralDirectory['disk_number_current'] = getid3_lib::LittleEndian2Int(substr($ZIPendOfCentralDirectory, 4, 2)); + $EndOfCentralDirectory['disk_number_start_directory'] = getid3_lib::LittleEndian2Int(substr($ZIPendOfCentralDirectory, 6, 2)); + $EndOfCentralDirectory['directory_entries_this_disk'] = getid3_lib::LittleEndian2Int(substr($ZIPendOfCentralDirectory, 8, 2)); + $EndOfCentralDirectory['directory_entries_total'] = getid3_lib::LittleEndian2Int(substr($ZIPendOfCentralDirectory, 10, 2)); + $EndOfCentralDirectory['directory_size'] = getid3_lib::LittleEndian2Int(substr($ZIPendOfCentralDirectory, 12, 4)); + $EndOfCentralDirectory['directory_offset'] = getid3_lib::LittleEndian2Int(substr($ZIPendOfCentralDirectory, 16, 4)); + $EndOfCentralDirectory['comment_length'] = getid3_lib::LittleEndian2Int(substr($ZIPendOfCentralDirectory, 20, 2)); + + if ($EndOfCentralDirectory['comment_length'] > 0) { + $EndOfCentralDirectory['comment'] = $this->fread($EndOfCentralDirectory['comment_length']); + } + + return $EndOfCentralDirectory; + } + + + public static function ZIPparseGeneralPurposeFlags($flagbytes, $compressionmethod) { + // https://users.cs.jmu.edu/buchhofp/forensics/formats/pkzip-printable.html + $ParsedFlags['encrypted'] = (bool) ($flagbytes & 0x0001); + // 0x0002 -- see below + // 0x0004 -- see below + $ParsedFlags['data_descriptor_used'] = (bool) ($flagbytes & 0x0008); + $ParsedFlags['enhanced_deflation'] = (bool) ($flagbytes & 0x0010); + $ParsedFlags['compressed_patched_data'] = (bool) ($flagbytes & 0x0020); + $ParsedFlags['strong_encryption'] = (bool) ($flagbytes & 0x0040); + // 0x0080 - unused + // 0x0100 - unused + // 0x0200 - unused + // 0x0400 - unused + $ParsedFlags['language_encoding'] = (bool) ($flagbytes & 0x0800); + // 0x1000 - reserved + $ParsedFlags['mask_header_values'] = (bool) ($flagbytes & 0x2000); + // 0x4000 - reserved + // 0x8000 - reserved + + switch ($compressionmethod) { + case 6: + $ParsedFlags['dictionary_size'] = (($flagbytes & 0x0002) ? 8192 : 4096); + $ParsedFlags['shannon_fano_trees'] = (($flagbytes & 0x0004) ? 3 : 2); + break; + + case 8: + case 9: + switch (($flagbytes & 0x0006) >> 1) { + case 0: + $ParsedFlags['compression_speed'] = 'normal'; + break; + case 1: + $ParsedFlags['compression_speed'] = 'maximum'; + break; + case 2: + $ParsedFlags['compression_speed'] = 'fast'; + break; + case 3: + $ParsedFlags['compression_speed'] = 'superfast'; + break; + } + break; + } + + return $ParsedFlags; + } + + + public static function ZIPversionOSLookup($index) { + static $ZIPversionOSLookup = array( + 0 => 'MS-DOS and OS/2 (FAT / VFAT / FAT32 file systems)', + 1 => 'Amiga', + 2 => 'OpenVMS', + 3 => 'Unix', + 4 => 'VM/CMS', + 5 => 'Atari ST', + 6 => 'OS/2 H.P.F.S.', + 7 => 'Macintosh', + 8 => 'Z-System', + 9 => 'CP/M', + 10 => 'Windows NTFS', + 11 => 'MVS', + 12 => 'VSE', + 13 => 'Acorn Risc', + 14 => 'VFAT', + 15 => 'Alternate MVS', + 16 => 'BeOS', + 17 => 'Tandem', + 18 => 'OS/400', + 19 => 'OS/X (Darwin)', + ); + + return (isset($ZIPversionOSLookup[$index]) ? $ZIPversionOSLookup[$index] : '[unknown]'); + } + + public static function ZIPcompressionMethodLookup($index) { + // http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/ZIP.html + static $ZIPcompressionMethodLookup = array( + 0 => 'store', + 1 => 'shrink', + 2 => 'reduce-1', + 3 => 'reduce-2', + 4 => 'reduce-3', + 5 => 'reduce-4', + 6 => 'implode', + 7 => 'tokenize', + 8 => 'deflate', + 9 => 'deflate64', + 10 => 'Imploded (old IBM TERSE)', + 11 => 'RESERVED[11]', + 12 => 'BZIP2', + 13 => 'RESERVED[13]', + 14 => 'LZMA (EFS)', + 15 => 'RESERVED[15]', + 16 => 'RESERVED[16]', + 17 => 'RESERVED[17]', + 18 => 'IBM TERSE (new)', + 19 => 'IBM LZ77 z Architecture (PFS)', + 96 => 'JPEG recompressed', + 97 => 'WavPack compressed', + 98 => 'PPMd version I, Rev 1', + ); + + return (isset($ZIPcompressionMethodLookup[$index]) ? $ZIPcompressionMethodLookup[$index] : '[unknown]'); + } + + public static function DOStime2UNIXtime($DOSdate, $DOStime) { + // wFatDate + // Specifies the MS-DOS date. The date is a packed 16-bit value with the following format: + // Bits Contents + // 0-4 Day of the month (1-31) + // 5-8 Month (1 = January, 2 = February, and so on) + // 9-15 Year offset from 1980 (add 1980 to get actual year) + + $UNIXday = ($DOSdate & 0x001F); + $UNIXmonth = (($DOSdate & 0x01E0) >> 5); + $UNIXyear = (($DOSdate & 0xFE00) >> 9) + 1980; + + // wFatTime + // Specifies the MS-DOS time. The time is a packed 16-bit value with the following format: + // Bits Contents + // 0-4 Second divided by 2 + // 5-10 Minute (0-59) + // 11-15 Hour (0-23 on a 24-hour clock) + + $UNIXsecond = ($DOStime & 0x001F) * 2; + $UNIXminute = (($DOStime & 0x07E0) >> 5); + $UNIXhour = (($DOStime & 0xF800) >> 11); + + return gmmktime($UNIXhour, $UNIXminute, $UNIXsecond, $UNIXmonth, $UNIXday, $UNIXyear); + } + +} diff --git a/www/rompr/getid3/module.audio-video.asf.php b/www/rompr/getid3/module.audio-video.asf.php new file mode 100644 index 0000000..23d3a0e --- /dev/null +++ b/www/rompr/getid3/module.audio-video.asf.php @@ -0,0 +1,2013 @@ + // +// available at http://getid3.sourceforge.net // +// or http://www.getid3.org // +// also https://github.com/JamesHeinrich/getID3 // +///////////////////////////////////////////////////////////////// +// See readme.txt for more details // +///////////////////////////////////////////////////////////////// +// // +// module.audio-video.asf.php // +// module for analyzing ASF, WMA and WMV files // +// dependencies: module.audio-video.riff.php // +// /// +///////////////////////////////////////////////////////////////// + +getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio-video.riff.php', __FILE__, true); + +class getid3_asf extends getid3_handler { + + public function __construct(getID3 $getid3) { + parent::__construct($getid3); // extends getid3_handler::__construct() + + // initialize all GUID constants + $GUIDarray = $this->KnownGUIDs(); + foreach ($GUIDarray as $GUIDname => $hexstringvalue) { + if (!defined($GUIDname)) { + define($GUIDname, $this->GUIDtoBytestring($hexstringvalue)); + } + } + } + + public function Analyze() { + $info = &$this->getid3->info; + + // Shortcuts + $thisfile_audio = &$info['audio']; + $thisfile_video = &$info['video']; + $info['asf'] = array(); + $thisfile_asf = &$info['asf']; + $thisfile_asf['comments'] = array(); + $thisfile_asf_comments = &$thisfile_asf['comments']; + $thisfile_asf['header_object'] = array(); + $thisfile_asf_headerobject = &$thisfile_asf['header_object']; + + + // ASF structure: + // * Header Object [required] + // * File Properties Object [required] (global file attributes) + // * Stream Properties Object [required] (defines media stream & characteristics) + // * Header Extension Object [required] (additional functionality) + // * Content Description Object (bibliographic information) + // * Script Command Object (commands for during playback) + // * Marker Object (named jumped points within the file) + // * Data Object [required] + // * Data Packets + // * Index Object + + // Header Object: (mandatory, one only) + // Field Name Field Type Size (bits) + // Object ID GUID 128 // GUID for header object - GETID3_ASF_Header_Object + // Object Size QWORD 64 // size of header object, including 30 bytes of Header Object header + // Number of Header Objects DWORD 32 // number of objects in header object + // Reserved1 BYTE 8 // hardcoded: 0x01 + // Reserved2 BYTE 8 // hardcoded: 0x02 + + $info['fileformat'] = 'asf'; + + $this->fseek($info['avdataoffset']); + $HeaderObjectData = $this->fread(30); + + $thisfile_asf_headerobject['objectid'] = substr($HeaderObjectData, 0, 16); + $thisfile_asf_headerobject['objectid_guid'] = $this->BytestringToGUID($thisfile_asf_headerobject['objectid']); + if ($thisfile_asf_headerobject['objectid'] != GETID3_ASF_Header_Object) { + unset($info['fileformat'], $info['asf']); + return $this->error('ASF header GUID {'.$this->BytestringToGUID($thisfile_asf_headerobject['objectid']).'} does not match expected "GETID3_ASF_Header_Object" GUID {'.$this->BytestringToGUID(GETID3_ASF_Header_Object).'}'); + } + $thisfile_asf_headerobject['objectsize'] = getid3_lib::LittleEndian2Int(substr($HeaderObjectData, 16, 8)); + $thisfile_asf_headerobject['headerobjects'] = getid3_lib::LittleEndian2Int(substr($HeaderObjectData, 24, 4)); + $thisfile_asf_headerobject['reserved1'] = getid3_lib::LittleEndian2Int(substr($HeaderObjectData, 28, 1)); + $thisfile_asf_headerobject['reserved2'] = getid3_lib::LittleEndian2Int(substr($HeaderObjectData, 29, 1)); + + $NextObjectOffset = $this->ftell(); + $ASFHeaderData = $this->fread($thisfile_asf_headerobject['objectsize'] - 30); + $offset = 0; + + for ($HeaderObjectsCounter = 0; $HeaderObjectsCounter < $thisfile_asf_headerobject['headerobjects']; $HeaderObjectsCounter++) { + $NextObjectGUID = substr($ASFHeaderData, $offset, 16); + $offset += 16; + $NextObjectGUIDtext = $this->BytestringToGUID($NextObjectGUID); + $NextObjectSize = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 8)); + $offset += 8; + switch ($NextObjectGUID) { + + case GETID3_ASF_File_Properties_Object: + // File Properties Object: (mandatory, one only) + // Field Name Field Type Size (bits) + // Object ID GUID 128 // GUID for file properties object - GETID3_ASF_File_Properties_Object + // Object Size QWORD 64 // size of file properties object, including 104 bytes of File Properties Object header + // File ID GUID 128 // unique ID - identical to File ID in Data Object + // File Size QWORD 64 // entire file in bytes. Invalid if Broadcast Flag == 1 + // Creation Date QWORD 64 // date & time of file creation. Maybe invalid if Broadcast Flag == 1 + // Data Packets Count QWORD 64 // number of data packets in Data Object. Invalid if Broadcast Flag == 1 + // Play Duration QWORD 64 // playtime, in 100-nanosecond units. Invalid if Broadcast Flag == 1 + // Send Duration QWORD 64 // time needed to send file, in 100-nanosecond units. Players can ignore this value. Invalid if Broadcast Flag == 1 + // Preroll QWORD 64 // time to buffer data before starting to play file, in 1-millisecond units. If <> 0, PlayDuration and PresentationTime have been offset by this amount + // Flags DWORD 32 // + // * Broadcast Flag bits 1 (0x01) // file is currently being written, some header values are invalid + // * Seekable Flag bits 1 (0x02) // is file seekable + // * Reserved bits 30 (0xFFFFFFFC) // reserved - set to zero + // Minimum Data Packet Size DWORD 32 // in bytes. should be same as Maximum Data Packet Size. Invalid if Broadcast Flag == 1 + // Maximum Data Packet Size DWORD 32 // in bytes. should be same as Minimum Data Packet Size. Invalid if Broadcast Flag == 1 + // Maximum Bitrate DWORD 32 // maximum instantaneous bitrate in bits per second for entire file, including all data streams and ASF overhead + + // shortcut + $thisfile_asf['file_properties_object'] = array(); + $thisfile_asf_filepropertiesobject = &$thisfile_asf['file_properties_object']; + + $thisfile_asf_filepropertiesobject['offset'] = $NextObjectOffset + $offset; + $thisfile_asf_filepropertiesobject['objectid'] = $NextObjectGUID; + $thisfile_asf_filepropertiesobject['objectid_guid'] = $NextObjectGUIDtext; + $thisfile_asf_filepropertiesobject['objectsize'] = $NextObjectSize; + $thisfile_asf_filepropertiesobject['fileid'] = substr($ASFHeaderData, $offset, 16); + $offset += 16; + $thisfile_asf_filepropertiesobject['fileid_guid'] = $this->BytestringToGUID($thisfile_asf_filepropertiesobject['fileid']); + $thisfile_asf_filepropertiesobject['filesize'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 8)); + $offset += 8; + $thisfile_asf_filepropertiesobject['creation_date'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 8)); + $thisfile_asf_filepropertiesobject['creation_date_unix'] = $this->FILETIMEtoUNIXtime($thisfile_asf_filepropertiesobject['creation_date']); + $offset += 8; + $thisfile_asf_filepropertiesobject['data_packets'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 8)); + $offset += 8; + $thisfile_asf_filepropertiesobject['play_duration'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 8)); + $offset += 8; + $thisfile_asf_filepropertiesobject['send_duration'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 8)); + $offset += 8; + $thisfile_asf_filepropertiesobject['preroll'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 8)); + $offset += 8; + $thisfile_asf_filepropertiesobject['flags_raw'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4)); + $offset += 4; + $thisfile_asf_filepropertiesobject['flags']['broadcast'] = (bool) ($thisfile_asf_filepropertiesobject['flags_raw'] & 0x0001); + $thisfile_asf_filepropertiesobject['flags']['seekable'] = (bool) ($thisfile_asf_filepropertiesobject['flags_raw'] & 0x0002); + + $thisfile_asf_filepropertiesobject['min_packet_size'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4)); + $offset += 4; + $thisfile_asf_filepropertiesobject['max_packet_size'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4)); + $offset += 4; + $thisfile_asf_filepropertiesobject['max_bitrate'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4)); + $offset += 4; + + if ($thisfile_asf_filepropertiesobject['flags']['broadcast']) { + + // broadcast flag is set, some values invalid + unset($thisfile_asf_filepropertiesobject['filesize']); + unset($thisfile_asf_filepropertiesobject['data_packets']); + unset($thisfile_asf_filepropertiesobject['play_duration']); + unset($thisfile_asf_filepropertiesobject['send_duration']); + unset($thisfile_asf_filepropertiesobject['min_packet_size']); + unset($thisfile_asf_filepropertiesobject['max_packet_size']); + + } else { + + // broadcast flag NOT set, perform calculations + $info['playtime_seconds'] = ($thisfile_asf_filepropertiesobject['play_duration'] / 10000000) - ($thisfile_asf_filepropertiesobject['preroll'] / 1000); + + //$info['bitrate'] = $thisfile_asf_filepropertiesobject['max_bitrate']; + $info['bitrate'] = ((isset($thisfile_asf_filepropertiesobject['filesize']) ? $thisfile_asf_filepropertiesobject['filesize'] : $info['filesize']) * 8) / $info['playtime_seconds']; + } + break; + + case GETID3_ASF_Stream_Properties_Object: + // Stream Properties Object: (mandatory, one per media stream) + // Field Name Field Type Size (bits) + // Object ID GUID 128 // GUID for stream properties object - GETID3_ASF_Stream_Properties_Object + // Object Size QWORD 64 // size of stream properties object, including 78 bytes of Stream Properties Object header + // Stream Type GUID 128 // GETID3_ASF_Audio_Media, GETID3_ASF_Video_Media or GETID3_ASF_Command_Media + // Error Correction Type GUID 128 // GETID3_ASF_Audio_Spread for audio-only streams, GETID3_ASF_No_Error_Correction for other stream types + // Time Offset QWORD 64 // 100-nanosecond units. typically zero. added to all timestamps of samples in the stream + // Type-Specific Data Length DWORD 32 // number of bytes for Type-Specific Data field + // Error Correction Data Length DWORD 32 // number of bytes for Error Correction Data field + // Flags WORD 16 // + // * Stream Number bits 7 (0x007F) // number of this stream. 1 <= valid <= 127 + // * Reserved bits 8 (0x7F80) // reserved - set to zero + // * Encrypted Content Flag bits 1 (0x8000) // stream contents encrypted if set + // Reserved DWORD 32 // reserved - set to zero + // Type-Specific Data BYTESTREAM variable // type-specific format data, depending on value of Stream Type + // Error Correction Data BYTESTREAM variable // error-correction-specific format data, depending on value of Error Correct Type + + // There is one GETID3_ASF_Stream_Properties_Object for each stream (audio, video) but the + // stream number isn't known until halfway through decoding the structure, hence it + // it is decoded to a temporary variable and then stuck in the appropriate index later + + $StreamPropertiesObjectData['offset'] = $NextObjectOffset + $offset; + $StreamPropertiesObjectData['objectid'] = $NextObjectGUID; + $StreamPropertiesObjectData['objectid_guid'] = $NextObjectGUIDtext; + $StreamPropertiesObjectData['objectsize'] = $NextObjectSize; + $StreamPropertiesObjectData['stream_type'] = substr($ASFHeaderData, $offset, 16); + $offset += 16; + $StreamPropertiesObjectData['stream_type_guid'] = $this->BytestringToGUID($StreamPropertiesObjectData['stream_type']); + $StreamPropertiesObjectData['error_correct_type'] = substr($ASFHeaderData, $offset, 16); + $offset += 16; + $StreamPropertiesObjectData['error_correct_guid'] = $this->BytestringToGUID($StreamPropertiesObjectData['error_correct_type']); + $StreamPropertiesObjectData['time_offset'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 8)); + $offset += 8; + $StreamPropertiesObjectData['type_data_length'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4)); + $offset += 4; + $StreamPropertiesObjectData['error_data_length'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4)); + $offset += 4; + $StreamPropertiesObjectData['flags_raw'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); + $offset += 2; + $StreamPropertiesObjectStreamNumber = $StreamPropertiesObjectData['flags_raw'] & 0x007F; + $StreamPropertiesObjectData['flags']['encrypted'] = (bool) ($StreamPropertiesObjectData['flags_raw'] & 0x8000); + + $offset += 4; // reserved - DWORD + $StreamPropertiesObjectData['type_specific_data'] = substr($ASFHeaderData, $offset, $StreamPropertiesObjectData['type_data_length']); + $offset += $StreamPropertiesObjectData['type_data_length']; + $StreamPropertiesObjectData['error_correct_data'] = substr($ASFHeaderData, $offset, $StreamPropertiesObjectData['error_data_length']); + $offset += $StreamPropertiesObjectData['error_data_length']; + + switch ($StreamPropertiesObjectData['stream_type']) { + + case GETID3_ASF_Audio_Media: + $thisfile_audio['dataformat'] = (!empty($thisfile_audio['dataformat']) ? $thisfile_audio['dataformat'] : 'asf'); + $thisfile_audio['bitrate_mode'] = (!empty($thisfile_audio['bitrate_mode']) ? $thisfile_audio['bitrate_mode'] : 'cbr'); + + $audiodata = getid3_riff::parseWAVEFORMATex(substr($StreamPropertiesObjectData['type_specific_data'], 0, 16)); + unset($audiodata['raw']); + $thisfile_audio = getid3_lib::array_merge_noclobber($audiodata, $thisfile_audio); + break; + + case GETID3_ASF_Video_Media: + $thisfile_video['dataformat'] = (!empty($thisfile_video['dataformat']) ? $thisfile_video['dataformat'] : 'asf'); + $thisfile_video['bitrate_mode'] = (!empty($thisfile_video['bitrate_mode']) ? $thisfile_video['bitrate_mode'] : 'cbr'); + break; + + case GETID3_ASF_Command_Media: + default: + // do nothing + break; + + } + + $thisfile_asf['stream_properties_object'][$StreamPropertiesObjectStreamNumber] = $StreamPropertiesObjectData; + unset($StreamPropertiesObjectData); // clear for next stream, if any + break; + + case GETID3_ASF_Header_Extension_Object: + // Header Extension Object: (mandatory, one only) + // Field Name Field Type Size (bits) + // Object ID GUID 128 // GUID for Header Extension object - GETID3_ASF_Header_Extension_Object + // Object Size QWORD 64 // size of Header Extension object, including 46 bytes of Header Extension Object header + // Reserved Field 1 GUID 128 // hardcoded: GETID3_ASF_Reserved_1 + // Reserved Field 2 WORD 16 // hardcoded: 0x00000006 + // Header Extension Data Size DWORD 32 // in bytes. valid: 0, or > 24. equals object size minus 46 + // Header Extension Data BYTESTREAM variable // array of zero or more extended header objects + + // shortcut + $thisfile_asf['header_extension_object'] = array(); + $thisfile_asf_headerextensionobject = &$thisfile_asf['header_extension_object']; + + $thisfile_asf_headerextensionobject['offset'] = $NextObjectOffset + $offset; + $thisfile_asf_headerextensionobject['objectid'] = $NextObjectGUID; + $thisfile_asf_headerextensionobject['objectid_guid'] = $NextObjectGUIDtext; + $thisfile_asf_headerextensionobject['objectsize'] = $NextObjectSize; + $thisfile_asf_headerextensionobject['reserved_1'] = substr($ASFHeaderData, $offset, 16); + $offset += 16; + $thisfile_asf_headerextensionobject['reserved_1_guid'] = $this->BytestringToGUID($thisfile_asf_headerextensionobject['reserved_1']); + if ($thisfile_asf_headerextensionobject['reserved_1'] != GETID3_ASF_Reserved_1) { + $this->warning('header_extension_object.reserved_1 GUID ('.$this->BytestringToGUID($thisfile_asf_headerextensionobject['reserved_1']).') does not match expected "GETID3_ASF_Reserved_1" GUID ('.$this->BytestringToGUID(GETID3_ASF_Reserved_1).')'); + //return false; + break; + } + $thisfile_asf_headerextensionobject['reserved_2'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); + $offset += 2; + if ($thisfile_asf_headerextensionobject['reserved_2'] != 6) { + $this->warning('header_extension_object.reserved_2 ('.getid3_lib::PrintHexBytes($thisfile_asf_headerextensionobject['reserved_2']).') does not match expected value of "6"'); + //return false; + break; + } + $thisfile_asf_headerextensionobject['extension_data_size'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4)); + $offset += 4; + $thisfile_asf_headerextensionobject['extension_data'] = substr($ASFHeaderData, $offset, $thisfile_asf_headerextensionobject['extension_data_size']); + $unhandled_sections = 0; + $thisfile_asf_headerextensionobject['extension_data_parsed'] = $this->HeaderExtensionObjectDataParse($thisfile_asf_headerextensionobject['extension_data'], $unhandled_sections); + if ($unhandled_sections === 0) { + unset($thisfile_asf_headerextensionobject['extension_data']); + } + $offset += $thisfile_asf_headerextensionobject['extension_data_size']; + break; + + case GETID3_ASF_Codec_List_Object: + // Codec List Object: (optional, one only) + // Field Name Field Type Size (bits) + // Object ID GUID 128 // GUID for Codec List object - GETID3_ASF_Codec_List_Object + // Object Size QWORD 64 // size of Codec List object, including 44 bytes of Codec List Object header + // Reserved GUID 128 // hardcoded: 86D15241-311D-11D0-A3A4-00A0C90348F6 + // Codec Entries Count DWORD 32 // number of entries in Codec Entries array + // Codec Entries array of: variable // + // * Type WORD 16 // 0x0001 = Video Codec, 0x0002 = Audio Codec, 0xFFFF = Unknown Codec + // * Codec Name Length WORD 16 // number of Unicode characters stored in the Codec Name field + // * Codec Name WCHAR variable // array of Unicode characters - name of codec used to create the content + // * Codec Description Length WORD 16 // number of Unicode characters stored in the Codec Description field + // * Codec Description WCHAR variable // array of Unicode characters - description of format used to create the content + // * Codec Information Length WORD 16 // number of Unicode characters stored in the Codec Information field + // * Codec Information BYTESTREAM variable // opaque array of information bytes about the codec used to create the content + + // shortcut + $thisfile_asf['codec_list_object'] = array(); + $thisfile_asf_codeclistobject = &$thisfile_asf['codec_list_object']; + + $thisfile_asf_codeclistobject['offset'] = $NextObjectOffset + $offset; + $thisfile_asf_codeclistobject['objectid'] = $NextObjectGUID; + $thisfile_asf_codeclistobject['objectid_guid'] = $NextObjectGUIDtext; + $thisfile_asf_codeclistobject['objectsize'] = $NextObjectSize; + $thisfile_asf_codeclistobject['reserved'] = substr($ASFHeaderData, $offset, 16); + $offset += 16; + $thisfile_asf_codeclistobject['reserved_guid'] = $this->BytestringToGUID($thisfile_asf_codeclistobject['reserved']); + if ($thisfile_asf_codeclistobject['reserved'] != $this->GUIDtoBytestring('86D15241-311D-11D0-A3A4-00A0C90348F6')) { + $this->warning('codec_list_object.reserved GUID {'.$this->BytestringToGUID($thisfile_asf_codeclistobject['reserved']).'} does not match expected "GETID3_ASF_Reserved_1" GUID {86D15241-311D-11D0-A3A4-00A0C90348F6}'); + //return false; + break; + } + $thisfile_asf_codeclistobject['codec_entries_count'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4)); + $offset += 4; + for ($CodecEntryCounter = 0; $CodecEntryCounter < $thisfile_asf_codeclistobject['codec_entries_count']; $CodecEntryCounter++) { + // shortcut + $thisfile_asf_codeclistobject['codec_entries'][$CodecEntryCounter] = array(); + $thisfile_asf_codeclistobject_codecentries_current = &$thisfile_asf_codeclistobject['codec_entries'][$CodecEntryCounter]; + + $thisfile_asf_codeclistobject_codecentries_current['type_raw'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); + $offset += 2; + $thisfile_asf_codeclistobject_codecentries_current['type'] = self::codecListObjectTypeLookup($thisfile_asf_codeclistobject_codecentries_current['type_raw']); + + $CodecNameLength = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)) * 2; // 2 bytes per character + $offset += 2; + $thisfile_asf_codeclistobject_codecentries_current['name'] = substr($ASFHeaderData, $offset, $CodecNameLength); + $offset += $CodecNameLength; + + $CodecDescriptionLength = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)) * 2; // 2 bytes per character + $offset += 2; + $thisfile_asf_codeclistobject_codecentries_current['description'] = substr($ASFHeaderData, $offset, $CodecDescriptionLength); + $offset += $CodecDescriptionLength; + + $CodecInformationLength = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); + $offset += 2; + $thisfile_asf_codeclistobject_codecentries_current['information'] = substr($ASFHeaderData, $offset, $CodecInformationLength); + $offset += $CodecInformationLength; + + if ($thisfile_asf_codeclistobject_codecentries_current['type_raw'] == 2) { // audio codec + + if (strpos($thisfile_asf_codeclistobject_codecentries_current['description'], ',') === false) { + $this->warning('[asf][codec_list_object][codec_entries]['.$CodecEntryCounter.'][description] expected to contain comma-separated list of parameters: "'.$thisfile_asf_codeclistobject_codecentries_current['description'].'"'); + } else { + + list($AudioCodecBitrate, $AudioCodecFrequency, $AudioCodecChannels) = explode(',', $this->TrimConvert($thisfile_asf_codeclistobject_codecentries_current['description'])); + $thisfile_audio['codec'] = $this->TrimConvert($thisfile_asf_codeclistobject_codecentries_current['name']); + + if (!isset($thisfile_audio['bitrate']) && strstr($AudioCodecBitrate, 'kbps')) { + $thisfile_audio['bitrate'] = (int) (trim(str_replace('kbps', '', $AudioCodecBitrate)) * 1000); + } + //if (!isset($thisfile_video['bitrate']) && isset($thisfile_audio['bitrate']) && isset($thisfile_asf['file_properties_object']['max_bitrate']) && ($thisfile_asf_codeclistobject['codec_entries_count'] > 1)) { + if (empty($thisfile_video['bitrate']) && !empty($thisfile_audio['bitrate']) && !empty($info['bitrate'])) { + //$thisfile_video['bitrate'] = $thisfile_asf['file_properties_object']['max_bitrate'] - $thisfile_audio['bitrate']; + $thisfile_video['bitrate'] = $info['bitrate'] - $thisfile_audio['bitrate']; + } + + $AudioCodecFrequency = (int) trim(str_replace('kHz', '', $AudioCodecFrequency)); + switch ($AudioCodecFrequency) { + case 8: + case 8000: + $thisfile_audio['sample_rate'] = 8000; + break; + + case 11: + case 11025: + $thisfile_audio['sample_rate'] = 11025; + break; + + case 12: + case 12000: + $thisfile_audio['sample_rate'] = 12000; + break; + + case 16: + case 16000: + $thisfile_audio['sample_rate'] = 16000; + break; + + case 22: + case 22050: + $thisfile_audio['sample_rate'] = 22050; + break; + + case 24: + case 24000: + $thisfile_audio['sample_rate'] = 24000; + break; + + case 32: + case 32000: + $thisfile_audio['sample_rate'] = 32000; + break; + + case 44: + case 441000: + $thisfile_audio['sample_rate'] = 44100; + break; + + case 48: + case 48000: + $thisfile_audio['sample_rate'] = 48000; + break; + + default: + $this->warning('unknown frequency: "'.$AudioCodecFrequency.'" ('.$this->TrimConvert($thisfile_asf_codeclistobject_codecentries_current['description']).')'); + break; + } + + if (!isset($thisfile_audio['channels'])) { + if (strstr($AudioCodecChannels, 'stereo')) { + $thisfile_audio['channels'] = 2; + } elseif (strstr($AudioCodecChannels, 'mono')) { + $thisfile_audio['channels'] = 1; + } + } + + } + } + } + break; + + case GETID3_ASF_Script_Command_Object: + // Script Command Object: (optional, one only) + // Field Name Field Type Size (bits) + // Object ID GUID 128 // GUID for Script Command object - GETID3_ASF_Script_Command_Object + // Object Size QWORD 64 // size of Script Command object, including 44 bytes of Script Command Object header + // Reserved GUID 128 // hardcoded: 4B1ACBE3-100B-11D0-A39B-00A0C90348F6 + // Commands Count WORD 16 // number of Commands structures in the Script Commands Objects + // Command Types Count WORD 16 // number of Command Types structures in the Script Commands Objects + // Command Types array of: variable // + // * Command Type Name Length WORD 16 // number of Unicode characters for Command Type Name + // * Command Type Name WCHAR variable // array of Unicode characters - name of a type of command + // Commands array of: variable // + // * Presentation Time DWORD 32 // presentation time of that command, in milliseconds + // * Type Index WORD 16 // type of this command, as a zero-based index into the array of Command Types of this object + // * Command Name Length WORD 16 // number of Unicode characters for Command Name + // * Command Name WCHAR variable // array of Unicode characters - name of this command + + // shortcut + $thisfile_asf['script_command_object'] = array(); + $thisfile_asf_scriptcommandobject = &$thisfile_asf['script_command_object']; + + $thisfile_asf_scriptcommandobject['offset'] = $NextObjectOffset + $offset; + $thisfile_asf_scriptcommandobject['objectid'] = $NextObjectGUID; + $thisfile_asf_scriptcommandobject['objectid_guid'] = $NextObjectGUIDtext; + $thisfile_asf_scriptcommandobject['objectsize'] = $NextObjectSize; + $thisfile_asf_scriptcommandobject['reserved'] = substr($ASFHeaderData, $offset, 16); + $offset += 16; + $thisfile_asf_scriptcommandobject['reserved_guid'] = $this->BytestringToGUID($thisfile_asf_scriptcommandobject['reserved']); + if ($thisfile_asf_scriptcommandobject['reserved'] != $this->GUIDtoBytestring('4B1ACBE3-100B-11D0-A39B-00A0C90348F6')) { + $this->warning('script_command_object.reserved GUID {'.$this->BytestringToGUID($thisfile_asf_scriptcommandobject['reserved']).'} does not match expected "GETID3_ASF_Reserved_1" GUID {4B1ACBE3-100B-11D0-A39B-00A0C90348F6}'); + //return false; + break; + } + $thisfile_asf_scriptcommandobject['commands_count'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); + $offset += 2; + $thisfile_asf_scriptcommandobject['command_types_count'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); + $offset += 2; + for ($CommandTypesCounter = 0; $CommandTypesCounter < $thisfile_asf_scriptcommandobject['command_types_count']; $CommandTypesCounter++) { + $CommandTypeNameLength = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)) * 2; // 2 bytes per character + $offset += 2; + $thisfile_asf_scriptcommandobject['command_types'][$CommandTypesCounter]['name'] = substr($ASFHeaderData, $offset, $CommandTypeNameLength); + $offset += $CommandTypeNameLength; + } + for ($CommandsCounter = 0; $CommandsCounter < $thisfile_asf_scriptcommandobject['commands_count']; $CommandsCounter++) { + $thisfile_asf_scriptcommandobject['commands'][$CommandsCounter]['presentation_time'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4)); + $offset += 4; + $thisfile_asf_scriptcommandobject['commands'][$CommandsCounter]['type_index'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); + $offset += 2; + + $CommandTypeNameLength = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)) * 2; // 2 bytes per character + $offset += 2; + $thisfile_asf_scriptcommandobject['commands'][$CommandsCounter]['name'] = substr($ASFHeaderData, $offset, $CommandTypeNameLength); + $offset += $CommandTypeNameLength; + } + break; + + case GETID3_ASF_Marker_Object: + // Marker Object: (optional, one only) + // Field Name Field Type Size (bits) + // Object ID GUID 128 // GUID for Marker object - GETID3_ASF_Marker_Object + // Object Size QWORD 64 // size of Marker object, including 48 bytes of Marker Object header + // Reserved GUID 128 // hardcoded: 4CFEDB20-75F6-11CF-9C0F-00A0C90349CB + // Markers Count DWORD 32 // number of Marker structures in Marker Object + // Reserved WORD 16 // hardcoded: 0x0000 + // Name Length WORD 16 // number of bytes in the Name field + // Name WCHAR variable // name of the Marker Object + // Markers array of: variable // + // * Offset QWORD 64 // byte offset into Data Object + // * Presentation Time QWORD 64 // in 100-nanosecond units + // * Entry Length WORD 16 // length in bytes of (Send Time + Flags + Marker Description Length + Marker Description + Padding) + // * Send Time DWORD 32 // in milliseconds + // * Flags DWORD 32 // hardcoded: 0x00000000 + // * Marker Description Length DWORD 32 // number of bytes in Marker Description field + // * Marker Description WCHAR variable // array of Unicode characters - description of marker entry + // * Padding BYTESTREAM variable // optional padding bytes + + // shortcut + $thisfile_asf['marker_object'] = array(); + $thisfile_asf_markerobject = &$thisfile_asf['marker_object']; + + $thisfile_asf_markerobject['offset'] = $NextObjectOffset + $offset; + $thisfile_asf_markerobject['objectid'] = $NextObjectGUID; + $thisfile_asf_markerobject['objectid_guid'] = $NextObjectGUIDtext; + $thisfile_asf_markerobject['objectsize'] = $NextObjectSize; + $thisfile_asf_markerobject['reserved'] = substr($ASFHeaderData, $offset, 16); + $offset += 16; + $thisfile_asf_markerobject['reserved_guid'] = $this->BytestringToGUID($thisfile_asf_markerobject['reserved']); + if ($thisfile_asf_markerobject['reserved'] != $this->GUIDtoBytestring('4CFEDB20-75F6-11CF-9C0F-00A0C90349CB')) { + $this->warning('marker_object.reserved GUID {'.$this->BytestringToGUID($thisfile_asf_markerobject['reserved_1']).'} does not match expected "GETID3_ASF_Reserved_1" GUID {4CFEDB20-75F6-11CF-9C0F-00A0C90349CB}'); + break; + } + $thisfile_asf_markerobject['markers_count'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4)); + $offset += 4; + $thisfile_asf_markerobject['reserved_2'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); + $offset += 2; + if ($thisfile_asf_markerobject['reserved_2'] != 0) { + $this->warning('marker_object.reserved_2 ('.getid3_lib::PrintHexBytes($thisfile_asf_markerobject['reserved_2']).') does not match expected value of "0"'); + break; + } + $thisfile_asf_markerobject['name_length'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); + $offset += 2; + $thisfile_asf_markerobject['name'] = substr($ASFHeaderData, $offset, $thisfile_asf_markerobject['name_length']); + $offset += $thisfile_asf_markerobject['name_length']; + for ($MarkersCounter = 0; $MarkersCounter < $thisfile_asf_markerobject['markers_count']; $MarkersCounter++) { + $thisfile_asf_markerobject['markers'][$MarkersCounter]['offset'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 8)); + $offset += 8; + $thisfile_asf_markerobject['markers'][$MarkersCounter]['presentation_time'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 8)); + $offset += 8; + $thisfile_asf_markerobject['markers'][$MarkersCounter]['entry_length'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); + $offset += 2; + $thisfile_asf_markerobject['markers'][$MarkersCounter]['send_time'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4)); + $offset += 4; + $thisfile_asf_markerobject['markers'][$MarkersCounter]['flags'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4)); + $offset += 4; + $thisfile_asf_markerobject['markers'][$MarkersCounter]['marker_description_length'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4)); + $offset += 4; + $thisfile_asf_markerobject['markers'][$MarkersCounter]['marker_description'] = substr($ASFHeaderData, $offset, $thisfile_asf_markerobject['markers'][$MarkersCounter]['marker_description_length']); + $offset += $thisfile_asf_markerobject['markers'][$MarkersCounter]['marker_description_length']; + $PaddingLength = $thisfile_asf_markerobject['markers'][$MarkersCounter]['entry_length'] - 4 - 4 - 4 - $thisfile_asf_markerobject['markers'][$MarkersCounter]['marker_description_length']; + if ($PaddingLength > 0) { + $thisfile_asf_markerobject['markers'][$MarkersCounter]['padding'] = substr($ASFHeaderData, $offset, $PaddingLength); + $offset += $PaddingLength; + } + } + break; + + case GETID3_ASF_Bitrate_Mutual_Exclusion_Object: + // Bitrate Mutual Exclusion Object: (optional) + // Field Name Field Type Size (bits) + // Object ID GUID 128 // GUID for Bitrate Mutual Exclusion object - GETID3_ASF_Bitrate_Mutual_Exclusion_Object + // Object Size QWORD 64 // size of Bitrate Mutual Exclusion object, including 42 bytes of Bitrate Mutual Exclusion Object header + // Exlusion Type GUID 128 // nature of mutual exclusion relationship. one of: (GETID3_ASF_Mutex_Bitrate, GETID3_ASF_Mutex_Unknown) + // Stream Numbers Count WORD 16 // number of video streams + // Stream Numbers WORD variable // array of mutually exclusive video stream numbers. 1 <= valid <= 127 + + // shortcut + $thisfile_asf['bitrate_mutual_exclusion_object'] = array(); + $thisfile_asf_bitratemutualexclusionobject = &$thisfile_asf['bitrate_mutual_exclusion_object']; + + $thisfile_asf_bitratemutualexclusionobject['offset'] = $NextObjectOffset + $offset; + $thisfile_asf_bitratemutualexclusionobject['objectid'] = $NextObjectGUID; + $thisfile_asf_bitratemutualexclusionobject['objectid_guid'] = $NextObjectGUIDtext; + $thisfile_asf_bitratemutualexclusionobject['objectsize'] = $NextObjectSize; + $thisfile_asf_bitratemutualexclusionobject['reserved'] = substr($ASFHeaderData, $offset, 16); + $thisfile_asf_bitratemutualexclusionobject['reserved_guid'] = $this->BytestringToGUID($thisfile_asf_bitratemutualexclusionobject['reserved']); + $offset += 16; + if (($thisfile_asf_bitratemutualexclusionobject['reserved'] != GETID3_ASF_Mutex_Bitrate) && ($thisfile_asf_bitratemutualexclusionobject['reserved'] != GETID3_ASF_Mutex_Unknown)) { + $this->warning('bitrate_mutual_exclusion_object.reserved GUID {'.$this->BytestringToGUID($thisfile_asf_bitratemutualexclusionobject['reserved']).'} does not match expected "GETID3_ASF_Mutex_Bitrate" GUID {'.$this->BytestringToGUID(GETID3_ASF_Mutex_Bitrate).'} or "GETID3_ASF_Mutex_Unknown" GUID {'.$this->BytestringToGUID(GETID3_ASF_Mutex_Unknown).'}'); + //return false; + break; + } + $thisfile_asf_bitratemutualexclusionobject['stream_numbers_count'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); + $offset += 2; + for ($StreamNumberCounter = 0; $StreamNumberCounter < $thisfile_asf_bitratemutualexclusionobject['stream_numbers_count']; $StreamNumberCounter++) { + $thisfile_asf_bitratemutualexclusionobject['stream_numbers'][$StreamNumberCounter] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); + $offset += 2; + } + break; + + case GETID3_ASF_Error_Correction_Object: + // Error Correction Object: (optional, one only) + // Field Name Field Type Size (bits) + // Object ID GUID 128 // GUID for Error Correction object - GETID3_ASF_Error_Correction_Object + // Object Size QWORD 64 // size of Error Correction object, including 44 bytes of Error Correction Object header + // Error Correction Type GUID 128 // type of error correction. one of: (GETID3_ASF_No_Error_Correction, GETID3_ASF_Audio_Spread) + // Error Correction Data Length DWORD 32 // number of bytes in Error Correction Data field + // Error Correction Data BYTESTREAM variable // structure depends on value of Error Correction Type field + + // shortcut + $thisfile_asf['error_correction_object'] = array(); + $thisfile_asf_errorcorrectionobject = &$thisfile_asf['error_correction_object']; + + $thisfile_asf_errorcorrectionobject['offset'] = $NextObjectOffset + $offset; + $thisfile_asf_errorcorrectionobject['objectid'] = $NextObjectGUID; + $thisfile_asf_errorcorrectionobject['objectid_guid'] = $NextObjectGUIDtext; + $thisfile_asf_errorcorrectionobject['objectsize'] = $NextObjectSize; + $thisfile_asf_errorcorrectionobject['error_correction_type'] = substr($ASFHeaderData, $offset, 16); + $offset += 16; + $thisfile_asf_errorcorrectionobject['error_correction_guid'] = $this->BytestringToGUID($thisfile_asf_errorcorrectionobject['error_correction_type']); + $thisfile_asf_errorcorrectionobject['error_correction_data_length'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4)); + $offset += 4; + switch ($thisfile_asf_errorcorrectionobject['error_correction_type']) { + case GETID3_ASF_No_Error_Correction: + // should be no data, but just in case there is, skip to the end of the field + $offset += $thisfile_asf_errorcorrectionobject['error_correction_data_length']; + break; + + case GETID3_ASF_Audio_Spread: + // Field Name Field Type Size (bits) + // Span BYTE 8 // number of packets over which audio will be spread. + // Virtual Packet Length WORD 16 // size of largest audio payload found in audio stream + // Virtual Chunk Length WORD 16 // size of largest audio payload found in audio stream + // Silence Data Length WORD 16 // number of bytes in Silence Data field + // Silence Data BYTESTREAM variable // hardcoded: 0x00 * (Silence Data Length) bytes + + $thisfile_asf_errorcorrectionobject['span'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 1)); + $offset += 1; + $thisfile_asf_errorcorrectionobject['virtual_packet_length'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); + $offset += 2; + $thisfile_asf_errorcorrectionobject['virtual_chunk_length'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); + $offset += 2; + $thisfile_asf_errorcorrectionobject['silence_data_length'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); + $offset += 2; + $thisfile_asf_errorcorrectionobject['silence_data'] = substr($ASFHeaderData, $offset, $thisfile_asf_errorcorrectionobject['silence_data_length']); + $offset += $thisfile_asf_errorcorrectionobject['silence_data_length']; + break; + + default: + $this->warning('error_correction_object.error_correction_type GUID {'.$this->BytestringToGUID($thisfile_asf_errorcorrectionobject['reserved']).'} does not match expected "GETID3_ASF_No_Error_Correction" GUID {'.$this->BytestringToGUID(GETID3_ASF_No_Error_Correction).'} or "GETID3_ASF_Audio_Spread" GUID {'.$this->BytestringToGUID(GETID3_ASF_Audio_Spread).'}'); + //return false; + break; + } + + break; + + case GETID3_ASF_Content_Description_Object: + // Content Description Object: (optional, one only) + // Field Name Field Type Size (bits) + // Object ID GUID 128 // GUID for Content Description object - GETID3_ASF_Content_Description_Object + // Object Size QWORD 64 // size of Content Description object, including 34 bytes of Content Description Object header + // Title Length WORD 16 // number of bytes in Title field + // Author Length WORD 16 // number of bytes in Author field + // Copyright Length WORD 16 // number of bytes in Copyright field + // Description Length WORD 16 // number of bytes in Description field + // Rating Length WORD 16 // number of bytes in Rating field + // Title WCHAR 16 // array of Unicode characters - Title + // Author WCHAR 16 // array of Unicode characters - Author + // Copyright WCHAR 16 // array of Unicode characters - Copyright + // Description WCHAR 16 // array of Unicode characters - Description + // Rating WCHAR 16 // array of Unicode characters - Rating + + // shortcut + $thisfile_asf['content_description_object'] = array(); + $thisfile_asf_contentdescriptionobject = &$thisfile_asf['content_description_object']; + + $thisfile_asf_contentdescriptionobject['offset'] = $NextObjectOffset + $offset; + $thisfile_asf_contentdescriptionobject['objectid'] = $NextObjectGUID; + $thisfile_asf_contentdescriptionobject['objectid_guid'] = $NextObjectGUIDtext; + $thisfile_asf_contentdescriptionobject['objectsize'] = $NextObjectSize; + $thisfile_asf_contentdescriptionobject['title_length'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); + $offset += 2; + $thisfile_asf_contentdescriptionobject['author_length'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); + $offset += 2; + $thisfile_asf_contentdescriptionobject['copyright_length'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); + $offset += 2; + $thisfile_asf_contentdescriptionobject['description_length'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); + $offset += 2; + $thisfile_asf_contentdescriptionobject['rating_length'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); + $offset += 2; + $thisfile_asf_contentdescriptionobject['title'] = substr($ASFHeaderData, $offset, $thisfile_asf_contentdescriptionobject['title_length']); + $offset += $thisfile_asf_contentdescriptionobject['title_length']; + $thisfile_asf_contentdescriptionobject['author'] = substr($ASFHeaderData, $offset, $thisfile_asf_contentdescriptionobject['author_length']); + $offset += $thisfile_asf_contentdescriptionobject['author_length']; + $thisfile_asf_contentdescriptionobject['copyright'] = substr($ASFHeaderData, $offset, $thisfile_asf_contentdescriptionobject['copyright_length']); + $offset += $thisfile_asf_contentdescriptionobject['copyright_length']; + $thisfile_asf_contentdescriptionobject['description'] = substr($ASFHeaderData, $offset, $thisfile_asf_contentdescriptionobject['description_length']); + $offset += $thisfile_asf_contentdescriptionobject['description_length']; + $thisfile_asf_contentdescriptionobject['rating'] = substr($ASFHeaderData, $offset, $thisfile_asf_contentdescriptionobject['rating_length']); + $offset += $thisfile_asf_contentdescriptionobject['rating_length']; + + $ASFcommentKeysToCopy = array('title'=>'title', 'author'=>'artist', 'copyright'=>'copyright', 'description'=>'comment', 'rating'=>'rating'); + foreach ($ASFcommentKeysToCopy as $keytocopyfrom => $keytocopyto) { + if (!empty($thisfile_asf_contentdescriptionobject[$keytocopyfrom])) { + $thisfile_asf_comments[$keytocopyto][] = $this->TrimTerm($thisfile_asf_contentdescriptionobject[$keytocopyfrom]); + } + } + break; + + case GETID3_ASF_Extended_Content_Description_Object: + // Extended Content Description Object: (optional, one only) + // Field Name Field Type Size (bits) + // Object ID GUID 128 // GUID for Extended Content Description object - GETID3_ASF_Extended_Content_Description_Object + // Object Size QWORD 64 // size of ExtendedContent Description object, including 26 bytes of Extended Content Description Object header + // Content Descriptors Count WORD 16 // number of entries in Content Descriptors list + // Content Descriptors array of: variable // + // * Descriptor Name Length WORD 16 // size in bytes of Descriptor Name field + // * Descriptor Name WCHAR variable // array of Unicode characters - Descriptor Name + // * Descriptor Value Data Type WORD 16 // Lookup array: + // 0x0000 = Unicode String (variable length) + // 0x0001 = BYTE array (variable length) + // 0x0002 = BOOL (DWORD, 32 bits) + // 0x0003 = DWORD (DWORD, 32 bits) + // 0x0004 = QWORD (QWORD, 64 bits) + // 0x0005 = WORD (WORD, 16 bits) + // * Descriptor Value Length WORD 16 // number of bytes stored in Descriptor Value field + // * Descriptor Value variable variable // value for Content Descriptor + + // shortcut + $thisfile_asf['extended_content_description_object'] = array(); + $thisfile_asf_extendedcontentdescriptionobject = &$thisfile_asf['extended_content_description_object']; + + $thisfile_asf_extendedcontentdescriptionobject['offset'] = $NextObjectOffset + $offset; + $thisfile_asf_extendedcontentdescriptionobject['objectid'] = $NextObjectGUID; + $thisfile_asf_extendedcontentdescriptionobject['objectid_guid'] = $NextObjectGUIDtext; + $thisfile_asf_extendedcontentdescriptionobject['objectsize'] = $NextObjectSize; + $thisfile_asf_extendedcontentdescriptionobject['content_descriptors_count'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); + $offset += 2; + for ($ExtendedContentDescriptorsCounter = 0; $ExtendedContentDescriptorsCounter < $thisfile_asf_extendedcontentdescriptionobject['content_descriptors_count']; $ExtendedContentDescriptorsCounter++) { + // shortcut + $thisfile_asf_extendedcontentdescriptionobject['content_descriptors'][$ExtendedContentDescriptorsCounter] = array(); + $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current = &$thisfile_asf_extendedcontentdescriptionobject['content_descriptors'][$ExtendedContentDescriptorsCounter]; + + $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['base_offset'] = $offset + 30; + $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['name_length'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); + $offset += 2; + $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['name'] = substr($ASFHeaderData, $offset, $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['name_length']); + $offset += $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['name_length']; + $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value_type'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); + $offset += 2; + $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value_length'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); + $offset += 2; + $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'] = substr($ASFHeaderData, $offset, $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value_length']); + $offset += $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value_length']; + switch ($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value_type']) { + case 0x0000: // Unicode string + break; + + case 0x0001: // BYTE array + // do nothing + break; + + case 0x0002: // BOOL + $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'] = (bool) getid3_lib::LittleEndian2Int($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value']); + break; + + case 0x0003: // DWORD + case 0x0004: // QWORD + case 0x0005: // WORD + $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'] = getid3_lib::LittleEndian2Int($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value']); + break; + + default: + $this->warning('extended_content_description.content_descriptors.'.$ExtendedContentDescriptorsCounter.'.value_type is invalid ('.$thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value_type'].')'); + //return false; + break; + } + switch ($this->TrimConvert(strtolower($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['name']))) { + + case 'wm/albumartist': + case 'artist': + // Note: not 'artist', that comes from 'author' tag + $thisfile_asf_comments['albumartist'] = array($this->TrimTerm($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'])); + break; + + case 'wm/albumtitle': + case 'album': + $thisfile_asf_comments['album'] = array($this->TrimTerm($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'])); + break; + + case 'wm/genre': + case 'genre': + $thisfile_asf_comments['genre'] = array($this->TrimTerm($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'])); + break; + + case 'wm/partofset': + $thisfile_asf_comments['partofset'] = array($this->TrimTerm($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'])); + break; + + case 'wm/tracknumber': + case 'tracknumber': + // be careful casting to int: casting unicode strings to int gives unexpected results (stops parsing at first non-numeric character) + $thisfile_asf_comments['track'] = array($this->TrimTerm($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'])); + foreach ($thisfile_asf_comments['track'] as $key => $value) { + if (preg_match('/^[0-9\x00]+$/', $value)) { + $thisfile_asf_comments['track'][$key] = intval(str_replace("\x00", '', $value)); + } + } + break; + + case 'wm/track': + if (empty($thisfile_asf_comments['track'])) { + $thisfile_asf_comments['track'] = array(1 + $this->TrimConvert($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'])); + } + break; + + case 'wm/year': + case 'year': + case 'date': + $thisfile_asf_comments['year'] = array( $this->TrimTerm($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'])); + break; + + case 'wm/lyrics': + case 'lyrics': + $thisfile_asf_comments['lyrics'] = array($this->TrimTerm($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'])); + break; + + case 'isvbr': + if ($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value']) { + $thisfile_audio['bitrate_mode'] = 'vbr'; + $thisfile_video['bitrate_mode'] = 'vbr'; + } + break; + + case 'id3': + $this->getid3->include_module('tag.id3v2'); + + $getid3_id3v2 = new getid3_id3v2($this->getid3); + $getid3_id3v2->AnalyzeString($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value']); + unset($getid3_id3v2); + + if ($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value_length'] > 1024) { + $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'] = ''; + } + break; + + case 'wm/encodingtime': + $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['encoding_time_unix'] = $this->FILETIMEtoUNIXtime($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value']); + $thisfile_asf_comments['encoding_time_unix'] = array($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['encoding_time_unix']); + break; + + case 'wm/picture': + $WMpicture = $this->ASF_WMpicture($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value']); + foreach ($WMpicture as $key => $value) { + $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current[$key] = $value; + } + unset($WMpicture); +/* + $wm_picture_offset = 0; + $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['image_type_id'] = getid3_lib::LittleEndian2Int(substr($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'], $wm_picture_offset, 1)); + $wm_picture_offset += 1; + $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['image_type'] = self::WMpictureTypeLookup($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['image_type_id']); + $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['image_size'] = getid3_lib::LittleEndian2Int(substr($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'], $wm_picture_offset, 4)); + $wm_picture_offset += 4; + + $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['image_mime'] = ''; + do { + $next_byte_pair = substr($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'], $wm_picture_offset, 2); + $wm_picture_offset += 2; + $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['image_mime'] .= $next_byte_pair; + } while ($next_byte_pair !== "\x00\x00"); + + $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['image_description'] = ''; + do { + $next_byte_pair = substr($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'], $wm_picture_offset, 2); + $wm_picture_offset += 2; + $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['image_description'] .= $next_byte_pair; + } while ($next_byte_pair !== "\x00\x00"); + + $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['dataoffset'] = $wm_picture_offset; + $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['data'] = substr($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'], $wm_picture_offset); + unset($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value']); + + $imageinfo = array(); + $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['image_mime'] = ''; + $imagechunkcheck = getid3_lib::GetDataImageSize($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['data'], $imageinfo); + unset($imageinfo); + if (!empty($imagechunkcheck)) { + $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['image_mime'] = image_type_to_mime_type($imagechunkcheck[2]); + } + if (!isset($thisfile_asf_comments['picture'])) { + $thisfile_asf_comments['picture'] = array(); + } + $thisfile_asf_comments['picture'][] = array('data'=>$thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['data'], 'image_mime'=>$thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['image_mime']); +*/ + break; + + default: + switch ($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value_type']) { + case 0: // Unicode string + if (substr($this->TrimConvert($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['name']), 0, 3) == 'WM/') { + $thisfile_asf_comments[str_replace('wm/', '', strtolower($this->TrimConvert($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['name'])))] = array($this->TrimTerm($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'])); + } + break; + + case 1: + break; + } + break; + } + + } + break; + + case GETID3_ASF_Stream_Bitrate_Properties_Object: + // Stream Bitrate Properties Object: (optional, one only) + // Field Name Field Type Size (bits) + // Object ID GUID 128 // GUID for Stream Bitrate Properties object - GETID3_ASF_Stream_Bitrate_Properties_Object + // Object Size QWORD 64 // size of Extended Content Description object, including 26 bytes of Stream Bitrate Properties Object header + // Bitrate Records Count WORD 16 // number of records in Bitrate Records + // Bitrate Records array of: variable // + // * Flags WORD 16 // + // * * Stream Number bits 7 (0x007F) // number of this stream + // * * Reserved bits 9 (0xFF80) // hardcoded: 0 + // * Average Bitrate DWORD 32 // in bits per second + + // shortcut + $thisfile_asf['stream_bitrate_properties_object'] = array(); + $thisfile_asf_streambitratepropertiesobject = &$thisfile_asf['stream_bitrate_properties_object']; + + $thisfile_asf_streambitratepropertiesobject['offset'] = $NextObjectOffset + $offset; + $thisfile_asf_streambitratepropertiesobject['objectid'] = $NextObjectGUID; + $thisfile_asf_streambitratepropertiesobject['objectid_guid'] = $NextObjectGUIDtext; + $thisfile_asf_streambitratepropertiesobject['objectsize'] = $NextObjectSize; + $thisfile_asf_streambitratepropertiesobject['bitrate_records_count'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); + $offset += 2; + for ($BitrateRecordsCounter = 0; $BitrateRecordsCounter < $thisfile_asf_streambitratepropertiesobject['bitrate_records_count']; $BitrateRecordsCounter++) { + $thisfile_asf_streambitratepropertiesobject['bitrate_records'][$BitrateRecordsCounter]['flags_raw'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); + $offset += 2; + $thisfile_asf_streambitratepropertiesobject['bitrate_records'][$BitrateRecordsCounter]['flags']['stream_number'] = $thisfile_asf_streambitratepropertiesobject['bitrate_records'][$BitrateRecordsCounter]['flags_raw'] & 0x007F; + $thisfile_asf_streambitratepropertiesobject['bitrate_records'][$BitrateRecordsCounter]['bitrate'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4)); + $offset += 4; + } + break; + + case GETID3_ASF_Padding_Object: + // Padding Object: (optional) + // Field Name Field Type Size (bits) + // Object ID GUID 128 // GUID for Padding object - GETID3_ASF_Padding_Object + // Object Size QWORD 64 // size of Padding object, including 24 bytes of ASF Padding Object header + // Padding Data BYTESTREAM variable // ignore + + // shortcut + $thisfile_asf['padding_object'] = array(); + $thisfile_asf_paddingobject = &$thisfile_asf['padding_object']; + + $thisfile_asf_paddingobject['offset'] = $NextObjectOffset + $offset; + $thisfile_asf_paddingobject['objectid'] = $NextObjectGUID; + $thisfile_asf_paddingobject['objectid_guid'] = $NextObjectGUIDtext; + $thisfile_asf_paddingobject['objectsize'] = $NextObjectSize; + $thisfile_asf_paddingobject['padding_length'] = $thisfile_asf_paddingobject['objectsize'] - 16 - 8; + $thisfile_asf_paddingobject['padding'] = substr($ASFHeaderData, $offset, $thisfile_asf_paddingobject['padding_length']); + $offset += ($NextObjectSize - 16 - 8); + break; + + case GETID3_ASF_Extended_Content_Encryption_Object: + case GETID3_ASF_Content_Encryption_Object: + // WMA DRM - just ignore + $offset += ($NextObjectSize - 16 - 8); + break; + + default: + // Implementations shall ignore any standard or non-standard object that they do not know how to handle. + if ($this->GUIDname($NextObjectGUIDtext)) { + $this->warning('unhandled GUID "'.$this->GUIDname($NextObjectGUIDtext).'" {'.$NextObjectGUIDtext.'} in ASF header at offset '.($offset - 16 - 8)); + } else { + $this->warning('unknown GUID {'.$NextObjectGUIDtext.'} in ASF header at offset '.($offset - 16 - 8)); + } + $offset += ($NextObjectSize - 16 - 8); + break; + } + } + if (isset($thisfile_asf_streambitrateproperties['bitrate_records_count'])) { + $ASFbitrateAudio = 0; + $ASFbitrateVideo = 0; + for ($BitrateRecordsCounter = 0; $BitrateRecordsCounter < $thisfile_asf_streambitrateproperties['bitrate_records_count']; $BitrateRecordsCounter++) { + if (isset($thisfile_asf_codeclistobject['codec_entries'][$BitrateRecordsCounter])) { + switch ($thisfile_asf_codeclistobject['codec_entries'][$BitrateRecordsCounter]['type_raw']) { + case 1: + $ASFbitrateVideo += $thisfile_asf_streambitrateproperties['bitrate_records'][$BitrateRecordsCounter]['bitrate']; + break; + + case 2: + $ASFbitrateAudio += $thisfile_asf_streambitrateproperties['bitrate_records'][$BitrateRecordsCounter]['bitrate']; + break; + + default: + // do nothing + break; + } + } + } + if ($ASFbitrateAudio > 0) { + $thisfile_audio['bitrate'] = $ASFbitrateAudio; + } + if ($ASFbitrateVideo > 0) { + $thisfile_video['bitrate'] = $ASFbitrateVideo; + } + } + if (isset($thisfile_asf['stream_properties_object']) && is_array($thisfile_asf['stream_properties_object'])) { + + $thisfile_audio['bitrate'] = 0; + $thisfile_video['bitrate'] = 0; + + foreach ($thisfile_asf['stream_properties_object'] as $streamnumber => $streamdata) { + + switch ($streamdata['stream_type']) { + case GETID3_ASF_Audio_Media: + // Field Name Field Type Size (bits) + // Codec ID / Format Tag WORD 16 // unique ID of audio codec - defined as wFormatTag field of WAVEFORMATEX structure + // Number of Channels WORD 16 // number of channels of audio - defined as nChannels field of WAVEFORMATEX structure + // Samples Per Second DWORD 32 // in Hertz - defined as nSamplesPerSec field of WAVEFORMATEX structure + // Average number of Bytes/sec DWORD 32 // bytes/sec of audio stream - defined as nAvgBytesPerSec field of WAVEFORMATEX structure + // Block Alignment WORD 16 // block size in bytes of audio codec - defined as nBlockAlign field of WAVEFORMATEX structure + // Bits per sample WORD 16 // bits per sample of mono data. set to zero for variable bitrate codecs. defined as wBitsPerSample field of WAVEFORMATEX structure + // Codec Specific Data Size WORD 16 // size in bytes of Codec Specific Data buffer - defined as cbSize field of WAVEFORMATEX structure + // Codec Specific Data BYTESTREAM variable // array of codec-specific data bytes + + // shortcut + $thisfile_asf['audio_media'][$streamnumber] = array(); + $thisfile_asf_audiomedia_currentstream = &$thisfile_asf['audio_media'][$streamnumber]; + + $audiomediaoffset = 0; + + $thisfile_asf_audiomedia_currentstream = getid3_riff::parseWAVEFORMATex(substr($streamdata['type_specific_data'], $audiomediaoffset, 16)); + $audiomediaoffset += 16; + + $thisfile_audio['lossless'] = false; + switch ($thisfile_asf_audiomedia_currentstream['raw']['wFormatTag']) { + case 0x0001: // PCM + case 0x0163: // WMA9 Lossless + $thisfile_audio['lossless'] = true; + break; + } + + if (!empty($thisfile_asf['stream_bitrate_properties_object']['bitrate_records'])) { + foreach ($thisfile_asf['stream_bitrate_properties_object']['bitrate_records'] as $dummy => $dataarray) { + if (isset($dataarray['flags']['stream_number']) && ($dataarray['flags']['stream_number'] == $streamnumber)) { + $thisfile_asf_audiomedia_currentstream['bitrate'] = $dataarray['bitrate']; + $thisfile_audio['bitrate'] += $dataarray['bitrate']; + break; + } + } + } else { + if (!empty($thisfile_asf_audiomedia_currentstream['bytes_sec'])) { + $thisfile_audio['bitrate'] += $thisfile_asf_audiomedia_currentstream['bytes_sec'] * 8; + } elseif (!empty($thisfile_asf_audiomedia_currentstream['bitrate'])) { + $thisfile_audio['bitrate'] += $thisfile_asf_audiomedia_currentstream['bitrate']; + } + } + $thisfile_audio['streams'][$streamnumber] = $thisfile_asf_audiomedia_currentstream; + $thisfile_audio['streams'][$streamnumber]['wformattag'] = $thisfile_asf_audiomedia_currentstream['raw']['wFormatTag']; + $thisfile_audio['streams'][$streamnumber]['lossless'] = $thisfile_audio['lossless']; + $thisfile_audio['streams'][$streamnumber]['bitrate'] = $thisfile_audio['bitrate']; + $thisfile_audio['streams'][$streamnumber]['dataformat'] = 'wma'; + unset($thisfile_audio['streams'][$streamnumber]['raw']); + + $thisfile_asf_audiomedia_currentstream['codec_data_size'] = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $audiomediaoffset, 2)); + $audiomediaoffset += 2; + $thisfile_asf_audiomedia_currentstream['codec_data'] = substr($streamdata['type_specific_data'], $audiomediaoffset, $thisfile_asf_audiomedia_currentstream['codec_data_size']); + $audiomediaoffset += $thisfile_asf_audiomedia_currentstream['codec_data_size']; + + break; + + case GETID3_ASF_Video_Media: + // Field Name Field Type Size (bits) + // Encoded Image Width DWORD 32 // width of image in pixels + // Encoded Image Height DWORD 32 // height of image in pixels + // Reserved Flags BYTE 8 // hardcoded: 0x02 + // Format Data Size WORD 16 // size of Format Data field in bytes + // Format Data array of: variable // + // * Format Data Size DWORD 32 // number of bytes in Format Data field, in bytes - defined as biSize field of BITMAPINFOHEADER structure + // * Image Width LONG 32 // width of encoded image in pixels - defined as biWidth field of BITMAPINFOHEADER structure + // * Image Height LONG 32 // height of encoded image in pixels - defined as biHeight field of BITMAPINFOHEADER structure + // * Reserved WORD 16 // hardcoded: 0x0001 - defined as biPlanes field of BITMAPINFOHEADER structure + // * Bits Per Pixel Count WORD 16 // bits per pixel - defined as biBitCount field of BITMAPINFOHEADER structure + // * Compression ID FOURCC 32 // fourcc of video codec - defined as biCompression field of BITMAPINFOHEADER structure + // * Image Size DWORD 32 // image size in bytes - defined as biSizeImage field of BITMAPINFOHEADER structure + // * Horizontal Pixels / Meter DWORD 32 // horizontal resolution of target device in pixels per meter - defined as biXPelsPerMeter field of BITMAPINFOHEADER structure + // * Vertical Pixels / Meter DWORD 32 // vertical resolution of target device in pixels per meter - defined as biYPelsPerMeter field of BITMAPINFOHEADER structure + // * Colors Used Count DWORD 32 // number of color indexes in the color table that are actually used - defined as biClrUsed field of BITMAPINFOHEADER structure + // * Important Colors Count DWORD 32 // number of color index required for displaying bitmap. if zero, all colors are required. defined as biClrImportant field of BITMAPINFOHEADER structure + // * Codec Specific Data BYTESTREAM variable // array of codec-specific data bytes + + // shortcut + $thisfile_asf['video_media'][$streamnumber] = array(); + $thisfile_asf_videomedia_currentstream = &$thisfile_asf['video_media'][$streamnumber]; + + $videomediaoffset = 0; + $thisfile_asf_videomedia_currentstream['image_width'] = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 4)); + $videomediaoffset += 4; + $thisfile_asf_videomedia_currentstream['image_height'] = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 4)); + $videomediaoffset += 4; + $thisfile_asf_videomedia_currentstream['flags'] = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 1)); + $videomediaoffset += 1; + $thisfile_asf_videomedia_currentstream['format_data_size'] = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 2)); + $videomediaoffset += 2; + $thisfile_asf_videomedia_currentstream['format_data']['format_data_size'] = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 4)); + $videomediaoffset += 4; + $thisfile_asf_videomedia_currentstream['format_data']['image_width'] = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 4)); + $videomediaoffset += 4; + $thisfile_asf_videomedia_currentstream['format_data']['image_height'] = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 4)); + $videomediaoffset += 4; + $thisfile_asf_videomedia_currentstream['format_data']['reserved'] = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 2)); + $videomediaoffset += 2; + $thisfile_asf_videomedia_currentstream['format_data']['bits_per_pixel'] = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 2)); + $videomediaoffset += 2; + $thisfile_asf_videomedia_currentstream['format_data']['codec_fourcc'] = substr($streamdata['type_specific_data'], $videomediaoffset, 4); + $videomediaoffset += 4; + $thisfile_asf_videomedia_currentstream['format_data']['image_size'] = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 4)); + $videomediaoffset += 4; + $thisfile_asf_videomedia_currentstream['format_data']['horizontal_pels'] = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 4)); + $videomediaoffset += 4; + $thisfile_asf_videomedia_currentstream['format_data']['vertical_pels'] = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 4)); + $videomediaoffset += 4; + $thisfile_asf_videomedia_currentstream['format_data']['colors_used'] = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 4)); + $videomediaoffset += 4; + $thisfile_asf_videomedia_currentstream['format_data']['colors_important'] = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 4)); + $videomediaoffset += 4; + $thisfile_asf_videomedia_currentstream['format_data']['codec_data'] = substr($streamdata['type_specific_data'], $videomediaoffset); + + if (!empty($thisfile_asf['stream_bitrate_properties_object']['bitrate_records'])) { + foreach ($thisfile_asf['stream_bitrate_properties_object']['bitrate_records'] as $dummy => $dataarray) { + if (isset($dataarray['flags']['stream_number']) && ($dataarray['flags']['stream_number'] == $streamnumber)) { + $thisfile_asf_videomedia_currentstream['bitrate'] = $dataarray['bitrate']; + $thisfile_video['streams'][$streamnumber]['bitrate'] = $dataarray['bitrate']; + $thisfile_video['bitrate'] += $dataarray['bitrate']; + break; + } + } + } + + $thisfile_asf_videomedia_currentstream['format_data']['codec'] = getid3_riff::fourccLookup($thisfile_asf_videomedia_currentstream['format_data']['codec_fourcc']); + + $thisfile_video['streams'][$streamnumber]['fourcc'] = $thisfile_asf_videomedia_currentstream['format_data']['codec_fourcc']; + $thisfile_video['streams'][$streamnumber]['codec'] = $thisfile_asf_videomedia_currentstream['format_data']['codec']; + $thisfile_video['streams'][$streamnumber]['resolution_x'] = $thisfile_asf_videomedia_currentstream['image_width']; + $thisfile_video['streams'][$streamnumber]['resolution_y'] = $thisfile_asf_videomedia_currentstream['image_height']; + $thisfile_video['streams'][$streamnumber]['bits_per_sample'] = $thisfile_asf_videomedia_currentstream['format_data']['bits_per_pixel']; + break; + + default: + break; + } + } + } + + while ($this->ftell() < $info['avdataend']) { + $NextObjectDataHeader = $this->fread(24); + $offset = 0; + $NextObjectGUID = substr($NextObjectDataHeader, 0, 16); + $offset += 16; + $NextObjectGUIDtext = $this->BytestringToGUID($NextObjectGUID); + $NextObjectSize = getid3_lib::LittleEndian2Int(substr($NextObjectDataHeader, $offset, 8)); + $offset += 8; + + switch ($NextObjectGUID) { + case GETID3_ASF_Data_Object: + // Data Object: (mandatory, one only) + // Field Name Field Type Size (bits) + // Object ID GUID 128 // GUID for Data object - GETID3_ASF_Data_Object + // Object Size QWORD 64 // size of Data object, including 50 bytes of Data Object header. may be 0 if FilePropertiesObject.BroadcastFlag == 1 + // File ID GUID 128 // unique identifier. identical to File ID field in Header Object + // Total Data Packets QWORD 64 // number of Data Packet entries in Data Object. invalid if FilePropertiesObject.BroadcastFlag == 1 + // Reserved WORD 16 // hardcoded: 0x0101 + + // shortcut + $thisfile_asf['data_object'] = array(); + $thisfile_asf_dataobject = &$thisfile_asf['data_object']; + + $DataObjectData = $NextObjectDataHeader.$this->fread(50 - 24); + $offset = 24; + + $thisfile_asf_dataobject['objectid'] = $NextObjectGUID; + $thisfile_asf_dataobject['objectid_guid'] = $NextObjectGUIDtext; + $thisfile_asf_dataobject['objectsize'] = $NextObjectSize; + + $thisfile_asf_dataobject['fileid'] = substr($DataObjectData, $offset, 16); + $offset += 16; + $thisfile_asf_dataobject['fileid_guid'] = $this->BytestringToGUID($thisfile_asf_dataobject['fileid']); + $thisfile_asf_dataobject['total_data_packets'] = getid3_lib::LittleEndian2Int(substr($DataObjectData, $offset, 8)); + $offset += 8; + $thisfile_asf_dataobject['reserved'] = getid3_lib::LittleEndian2Int(substr($DataObjectData, $offset, 2)); + $offset += 2; + if ($thisfile_asf_dataobject['reserved'] != 0x0101) { + $this->warning('data_object.reserved ('.getid3_lib::PrintHexBytes($thisfile_asf_dataobject['reserved']).') does not match expected value of "0x0101"'); + //return false; + break; + } + + // Data Packets array of: variable // + // * Error Correction Flags BYTE 8 // + // * * Error Correction Data Length bits 4 // if Error Correction Length Type == 00, size of Error Correction Data in bytes, else hardcoded: 0000 + // * * Opaque Data Present bits 1 // + // * * Error Correction Length Type bits 2 // number of bits for size of the error correction data. hardcoded: 00 + // * * Error Correction Present bits 1 // If set, use Opaque Data Packet structure, else use Payload structure + // * Error Correction Data + + $info['avdataoffset'] = $this->ftell(); + $this->fseek(($thisfile_asf_dataobject['objectsize'] - 50), SEEK_CUR); // skip actual audio/video data + $info['avdataend'] = $this->ftell(); + break; + + case GETID3_ASF_Simple_Index_Object: + // Simple Index Object: (optional, recommended, one per video stream) + // Field Name Field Type Size (bits) + // Object ID GUID 128 // GUID for Simple Index object - GETID3_ASF_Data_Object + // Object Size QWORD 64 // size of Simple Index object, including 56 bytes of Simple Index Object header + // File ID GUID 128 // unique identifier. may be zero or identical to File ID field in Data Object and Header Object + // Index Entry Time Interval QWORD 64 // interval between index entries in 100-nanosecond units + // Maximum Packet Count DWORD 32 // maximum packet count for all index entries + // Index Entries Count DWORD 32 // number of Index Entries structures + // Index Entries array of: variable // + // * Packet Number DWORD 32 // number of the Data Packet associated with this index entry + // * Packet Count WORD 16 // number of Data Packets to sent at this index entry + + // shortcut + $thisfile_asf['simple_index_object'] = array(); + $thisfile_asf_simpleindexobject = &$thisfile_asf['simple_index_object']; + + $SimpleIndexObjectData = $NextObjectDataHeader.$this->fread(56 - 24); + $offset = 24; + + $thisfile_asf_simpleindexobject['objectid'] = $NextObjectGUID; + $thisfile_asf_simpleindexobject['objectid_guid'] = $NextObjectGUIDtext; + $thisfile_asf_simpleindexobject['objectsize'] = $NextObjectSize; + + $thisfile_asf_simpleindexobject['fileid'] = substr($SimpleIndexObjectData, $offset, 16); + $offset += 16; + $thisfile_asf_simpleindexobject['fileid_guid'] = $this->BytestringToGUID($thisfile_asf_simpleindexobject['fileid']); + $thisfile_asf_simpleindexobject['index_entry_time_interval'] = getid3_lib::LittleEndian2Int(substr($SimpleIndexObjectData, $offset, 8)); + $offset += 8; + $thisfile_asf_simpleindexobject['maximum_packet_count'] = getid3_lib::LittleEndian2Int(substr($SimpleIndexObjectData, $offset, 4)); + $offset += 4; + $thisfile_asf_simpleindexobject['index_entries_count'] = getid3_lib::LittleEndian2Int(substr($SimpleIndexObjectData, $offset, 4)); + $offset += 4; + + $IndexEntriesData = $SimpleIndexObjectData.$this->fread(6 * $thisfile_asf_simpleindexobject['index_entries_count']); + for ($IndexEntriesCounter = 0; $IndexEntriesCounter < $thisfile_asf_simpleindexobject['index_entries_count']; $IndexEntriesCounter++) { + $thisfile_asf_simpleindexobject['index_entries'][$IndexEntriesCounter]['packet_number'] = getid3_lib::LittleEndian2Int(substr($IndexEntriesData, $offset, 4)); + $offset += 4; + $thisfile_asf_simpleindexobject['index_entries'][$IndexEntriesCounter]['packet_count'] = getid3_lib::LittleEndian2Int(substr($IndexEntriesData, $offset, 4)); + $offset += 2; + } + + break; + + case GETID3_ASF_Index_Object: + // 6.2 ASF top-level Index Object (optional but recommended when appropriate, 0 or 1) + // Field Name Field Type Size (bits) + // Object ID GUID 128 // GUID for the Index Object - GETID3_ASF_Index_Object + // Object Size QWORD 64 // Specifies the size, in bytes, of the Index Object, including at least 34 bytes of Index Object header + // Index Entry Time Interval DWORD 32 // Specifies the time interval between each index entry in ms. + // Index Specifiers Count WORD 16 // Specifies the number of Index Specifiers structures in this Index Object. + // Index Blocks Count DWORD 32 // Specifies the number of Index Blocks structures in this Index Object. + + // Index Entry Time Interval DWORD 32 // Specifies the time interval between index entries in milliseconds. This value cannot be 0. + // Index Specifiers Count WORD 16 // Specifies the number of entries in the Index Specifiers list. Valid values are 1 and greater. + // Index Specifiers array of: varies // + // * Stream Number WORD 16 // Specifies the stream number that the Index Specifiers refer to. Valid values are between 1 and 127. + // * Index Type WORD 16 // Specifies Index Type values as follows: + // 1 = Nearest Past Data Packet - indexes point to the data packet whose presentation time is closest to the index entry time. + // 2 = Nearest Past Media Object - indexes point to the closest data packet containing an entire object or first fragment of an object. + // 3 = Nearest Past Cleanpoint. - indexes point to the closest data packet containing an entire object (or first fragment of an object) that has the Cleanpoint Flag set. + // Nearest Past Cleanpoint is the most common type of index. + // Index Entry Count DWORD 32 // Specifies the number of Index Entries in the block. + // * Block Positions QWORD varies // Specifies a list of byte offsets of the beginnings of the blocks relative to the beginning of the first Data Packet (i.e., the beginning of the Data Object + 50 bytes). The number of entries in this list is specified by the value of the Index Specifiers Count field. The order of those byte offsets is tied to the order in which Index Specifiers are listed. + // * Index Entries array of: varies // + // * * Offsets DWORD varies // An offset value of 0xffffffff indicates an invalid offset value + + // shortcut + $thisfile_asf['asf_index_object'] = array(); + $thisfile_asf_asfindexobject = &$thisfile_asf['asf_index_object']; + + $ASFIndexObjectData = $NextObjectDataHeader.$this->fread(34 - 24); + $offset = 24; + + $thisfile_asf_asfindexobject['objectid'] = $NextObjectGUID; + $thisfile_asf_asfindexobject['objectid_guid'] = $NextObjectGUIDtext; + $thisfile_asf_asfindexobject['objectsize'] = $NextObjectSize; + + $thisfile_asf_asfindexobject['entry_time_interval'] = getid3_lib::LittleEndian2Int(substr($ASFIndexObjectData, $offset, 4)); + $offset += 4; + $thisfile_asf_asfindexobject['index_specifiers_count'] = getid3_lib::LittleEndian2Int(substr($ASFIndexObjectData, $offset, 2)); + $offset += 2; + $thisfile_asf_asfindexobject['index_blocks_count'] = getid3_lib::LittleEndian2Int(substr($ASFIndexObjectData, $offset, 4)); + $offset += 4; + + $ASFIndexObjectData .= $this->fread(4 * $thisfile_asf_asfindexobject['index_specifiers_count']); + for ($IndexSpecifiersCounter = 0; $IndexSpecifiersCounter < $thisfile_asf_asfindexobject['index_specifiers_count']; $IndexSpecifiersCounter++) { + $IndexSpecifierStreamNumber = getid3_lib::LittleEndian2Int(substr($ASFIndexObjectData, $offset, 2)); + $offset += 2; + $thisfile_asf_asfindexobject['index_specifiers'][$IndexSpecifiersCounter]['stream_number'] = $IndexSpecifierStreamNumber; + $thisfile_asf_asfindexobject['index_specifiers'][$IndexSpecifiersCounter]['index_type'] = getid3_lib::LittleEndian2Int(substr($ASFIndexObjectData, $offset, 2)); + $offset += 2; + $thisfile_asf_asfindexobject['index_specifiers'][$IndexSpecifiersCounter]['index_type_text'] = $this->ASFIndexObjectIndexTypeLookup($thisfile_asf_asfindexobject['index_specifiers'][$IndexSpecifiersCounter]['index_type']); + } + + $ASFIndexObjectData .= $this->fread(4); + $thisfile_asf_asfindexobject['index_entry_count'] = getid3_lib::LittleEndian2Int(substr($ASFIndexObjectData, $offset, 4)); + $offset += 4; + + $ASFIndexObjectData .= $this->fread(8 * $thisfile_asf_asfindexobject['index_specifiers_count']); + for ($IndexSpecifiersCounter = 0; $IndexSpecifiersCounter < $thisfile_asf_asfindexobject['index_specifiers_count']; $IndexSpecifiersCounter++) { + $thisfile_asf_asfindexobject['block_positions'][$IndexSpecifiersCounter] = getid3_lib::LittleEndian2Int(substr($ASFIndexObjectData, $offset, 8)); + $offset += 8; + } + + $ASFIndexObjectData .= $this->fread(4 * $thisfile_asf_asfindexobject['index_specifiers_count'] * $thisfile_asf_asfindexobject['index_entry_count']); + for ($IndexEntryCounter = 0; $IndexEntryCounter < $thisfile_asf_asfindexobject['index_entry_count']; $IndexEntryCounter++) { + for ($IndexSpecifiersCounter = 0; $IndexSpecifiersCounter < $thisfile_asf_asfindexobject['index_specifiers_count']; $IndexSpecifiersCounter++) { + $thisfile_asf_asfindexobject['offsets'][$IndexSpecifiersCounter][$IndexEntryCounter] = getid3_lib::LittleEndian2Int(substr($ASFIndexObjectData, $offset, 4)); + $offset += 4; + } + } + break; + + + default: + // Implementations shall ignore any standard or non-standard object that they do not know how to handle. + if ($this->GUIDname($NextObjectGUIDtext)) { + $this->warning('unhandled GUID "'.$this->GUIDname($NextObjectGUIDtext).'" {'.$NextObjectGUIDtext.'} in ASF body at offset '.($offset - 16 - 8)); + } else { + $this->warning('unknown GUID {'.$NextObjectGUIDtext.'} in ASF body at offset '.($this->ftell() - 16 - 8)); + } + $this->fseek(($NextObjectSize - 16 - 8), SEEK_CUR); + break; + } + } + + if (isset($thisfile_asf_codeclistobject['codec_entries']) && is_array($thisfile_asf_codeclistobject['codec_entries'])) { + foreach ($thisfile_asf_codeclistobject['codec_entries'] as $streamnumber => $streamdata) { + switch ($streamdata['information']) { + case 'WMV1': + case 'WMV2': + case 'WMV3': + case 'MSS1': + case 'MSS2': + case 'WMVA': + case 'WVC1': + case 'WMVP': + case 'WVP2': + $thisfile_video['dataformat'] = 'wmv'; + $info['mime_type'] = 'video/x-ms-wmv'; + break; + + case 'MP42': + case 'MP43': + case 'MP4S': + case 'mp4s': + $thisfile_video['dataformat'] = 'asf'; + $info['mime_type'] = 'video/x-ms-asf'; + break; + + default: + switch ($streamdata['type_raw']) { + case 1: + if (strstr($this->TrimConvert($streamdata['name']), 'Windows Media')) { + $thisfile_video['dataformat'] = 'wmv'; + if ($info['mime_type'] == 'video/x-ms-asf') { + $info['mime_type'] = 'video/x-ms-wmv'; + } + } + break; + + case 2: + if (strstr($this->TrimConvert($streamdata['name']), 'Windows Media')) { + $thisfile_audio['dataformat'] = 'wma'; + if ($info['mime_type'] == 'video/x-ms-asf') { + $info['mime_type'] = 'audio/x-ms-wma'; + } + } + break; + + } + break; + } + } + } + + switch (isset($thisfile_audio['codec']) ? $thisfile_audio['codec'] : '') { + case 'MPEG Layer-3': + $thisfile_audio['dataformat'] = 'mp3'; + break; + + default: + break; + } + + if (isset($thisfile_asf_codeclistobject['codec_entries'])) { + foreach ($thisfile_asf_codeclistobject['codec_entries'] as $streamnumber => $streamdata) { + switch ($streamdata['type_raw']) { + + case 1: // video + $thisfile_video['encoder'] = $this->TrimConvert($thisfile_asf_codeclistobject['codec_entries'][$streamnumber]['name']); + break; + + case 2: // audio + $thisfile_audio['encoder'] = $this->TrimConvert($thisfile_asf_codeclistobject['codec_entries'][$streamnumber]['name']); + + // AH 2003-10-01 + $thisfile_audio['encoder_options'] = $this->TrimConvert($thisfile_asf_codeclistobject['codec_entries'][0]['description']); + + $thisfile_audio['codec'] = $thisfile_audio['encoder']; + break; + + default: + $this->warning('Unknown streamtype: [codec_list_object][codec_entries]['.$streamnumber.'][type_raw] == '.$streamdata['type_raw']); + break; + + } + } + } + + if (isset($info['audio'])) { + $thisfile_audio['lossless'] = (isset($thisfile_audio['lossless']) ? $thisfile_audio['lossless'] : false); + $thisfile_audio['dataformat'] = (!empty($thisfile_audio['dataformat']) ? $thisfile_audio['dataformat'] : 'asf'); + } + if (!empty($thisfile_video['dataformat'])) { + $thisfile_video['lossless'] = (isset($thisfile_audio['lossless']) ? $thisfile_audio['lossless'] : false); + $thisfile_video['pixel_aspect_ratio'] = (isset($thisfile_audio['pixel_aspect_ratio']) ? $thisfile_audio['pixel_aspect_ratio'] : (float) 1); + $thisfile_video['dataformat'] = (!empty($thisfile_video['dataformat']) ? $thisfile_video['dataformat'] : 'asf'); + } + if (!empty($thisfile_video['streams'])) { + $thisfile_video['resolution_x'] = 0; + $thisfile_video['resolution_y'] = 0; + foreach ($thisfile_video['streams'] as $key => $valuearray) { + if (($valuearray['resolution_x'] > $thisfile_video['resolution_x']) || ($valuearray['resolution_y'] > $thisfile_video['resolution_y'])) { + $thisfile_video['resolution_x'] = $valuearray['resolution_x']; + $thisfile_video['resolution_y'] = $valuearray['resolution_y']; + } + } + } + $info['bitrate'] = (isset($thisfile_audio['bitrate']) ? $thisfile_audio['bitrate'] : 0) + (isset($thisfile_video['bitrate']) ? $thisfile_video['bitrate'] : 0); + + if ((!isset($info['playtime_seconds']) || ($info['playtime_seconds'] <= 0)) && ($info['bitrate'] > 0)) { + $info['playtime_seconds'] = ($info['filesize'] - $info['avdataoffset']) / ($info['bitrate'] / 8); + } + + return true; + } + + public static function codecListObjectTypeLookup($CodecListType) { + static $lookup = array( + 0x0001 => 'Video Codec', + 0x0002 => 'Audio Codec', + 0xFFFF => 'Unknown Codec' + ); + + return (isset($lookup[$CodecListType]) ? $lookup[$CodecListType] : 'Invalid Codec Type'); + } + + public static function KnownGUIDs() { + static $GUIDarray = array( + 'GETID3_ASF_Extended_Stream_Properties_Object' => '14E6A5CB-C672-4332-8399-A96952065B5A', + 'GETID3_ASF_Padding_Object' => '1806D474-CADF-4509-A4BA-9AABCB96AAE8', + 'GETID3_ASF_Payload_Ext_Syst_Pixel_Aspect_Ratio' => '1B1EE554-F9EA-4BC8-821A-376B74E4C4B8', + 'GETID3_ASF_Script_Command_Object' => '1EFB1A30-0B62-11D0-A39B-00A0C90348F6', + 'GETID3_ASF_No_Error_Correction' => '20FB5700-5B55-11CF-A8FD-00805F5C442B', + 'GETID3_ASF_Content_Branding_Object' => '2211B3FA-BD23-11D2-B4B7-00A0C955FC6E', + 'GETID3_ASF_Content_Encryption_Object' => '2211B3FB-BD23-11D2-B4B7-00A0C955FC6E', + 'GETID3_ASF_Digital_Signature_Object' => '2211B3FC-BD23-11D2-B4B7-00A0C955FC6E', + 'GETID3_ASF_Extended_Content_Encryption_Object' => '298AE614-2622-4C17-B935-DAE07EE9289C', + 'GETID3_ASF_Simple_Index_Object' => '33000890-E5B1-11CF-89F4-00A0C90349CB', + 'GETID3_ASF_Degradable_JPEG_Media' => '35907DE0-E415-11CF-A917-00805F5C442B', + 'GETID3_ASF_Payload_Extension_System_Timecode' => '399595EC-8667-4E2D-8FDB-98814CE76C1E', + 'GETID3_ASF_Binary_Media' => '3AFB65E2-47EF-40F2-AC2C-70A90D71D343', + 'GETID3_ASF_Timecode_Index_Object' => '3CB73FD0-0C4A-4803-953D-EDF7B6228F0C', + 'GETID3_ASF_Metadata_Library_Object' => '44231C94-9498-49D1-A141-1D134E457054', + 'GETID3_ASF_Reserved_3' => '4B1ACBE3-100B-11D0-A39B-00A0C90348F6', + 'GETID3_ASF_Reserved_4' => '4CFEDB20-75F6-11CF-9C0F-00A0C90349CB', + 'GETID3_ASF_Command_Media' => '59DACFC0-59E6-11D0-A3AC-00A0C90348F6', + 'GETID3_ASF_Header_Extension_Object' => '5FBF03B5-A92E-11CF-8EE3-00C00C205365', + 'GETID3_ASF_Media_Object_Index_Parameters_Obj' => '6B203BAD-3F11-4E84-ACA8-D7613DE2CFA7', + 'GETID3_ASF_Header_Object' => '75B22630-668E-11CF-A6D9-00AA0062CE6C', + 'GETID3_ASF_Content_Description_Object' => '75B22633-668E-11CF-A6D9-00AA0062CE6C', + 'GETID3_ASF_Error_Correction_Object' => '75B22635-668E-11CF-A6D9-00AA0062CE6C', + 'GETID3_ASF_Data_Object' => '75B22636-668E-11CF-A6D9-00AA0062CE6C', + 'GETID3_ASF_Web_Stream_Media_Subtype' => '776257D4-C627-41CB-8F81-7AC7FF1C40CC', + 'GETID3_ASF_Stream_Bitrate_Properties_Object' => '7BF875CE-468D-11D1-8D82-006097C9A2B2', + 'GETID3_ASF_Language_List_Object' => '7C4346A9-EFE0-4BFC-B229-393EDE415C85', + 'GETID3_ASF_Codec_List_Object' => '86D15240-311D-11D0-A3A4-00A0C90348F6', + 'GETID3_ASF_Reserved_2' => '86D15241-311D-11D0-A3A4-00A0C90348F6', + 'GETID3_ASF_File_Properties_Object' => '8CABDCA1-A947-11CF-8EE4-00C00C205365', + 'GETID3_ASF_File_Transfer_Media' => '91BD222C-F21C-497A-8B6D-5AA86BFC0185', + 'GETID3_ASF_Old_RTP_Extension_Data' => '96800C63-4C94-11D1-837B-0080C7A37F95', + 'GETID3_ASF_Advanced_Mutual_Exclusion_Object' => 'A08649CF-4775-4670-8A16-6E35357566CD', + 'GETID3_ASF_Bandwidth_Sharing_Object' => 'A69609E6-517B-11D2-B6AF-00C04FD908E9', + 'GETID3_ASF_Reserved_1' => 'ABD3D211-A9BA-11cf-8EE6-00C00C205365', + 'GETID3_ASF_Bandwidth_Sharing_Exclusive' => 'AF6060AA-5197-11D2-B6AF-00C04FD908E9', + 'GETID3_ASF_Bandwidth_Sharing_Partial' => 'AF6060AB-5197-11D2-B6AF-00C04FD908E9', + 'GETID3_ASF_JFIF_Media' => 'B61BE100-5B4E-11CF-A8FD-00805F5C442B', + 'GETID3_ASF_Stream_Properties_Object' => 'B7DC0791-A9B7-11CF-8EE6-00C00C205365', + 'GETID3_ASF_Video_Media' => 'BC19EFC0-5B4D-11CF-A8FD-00805F5C442B', + 'GETID3_ASF_Audio_Spread' => 'BFC3CD50-618F-11CF-8BB2-00AA00B4E220', + 'GETID3_ASF_Metadata_Object' => 'C5F8CBEA-5BAF-4877-8467-AA8C44FA4CCA', + 'GETID3_ASF_Payload_Ext_Syst_Sample_Duration' => 'C6BD9450-867F-4907-83A3-C77921B733AD', + 'GETID3_ASF_Group_Mutual_Exclusion_Object' => 'D1465A40-5A79-4338-B71B-E36B8FD6C249', + 'GETID3_ASF_Extended_Content_Description_Object' => 'D2D0A440-E307-11D2-97F0-00A0C95EA850', + 'GETID3_ASF_Stream_Prioritization_Object' => 'D4FED15B-88D3-454F-81F0-ED5C45999E24', + 'GETID3_ASF_Payload_Ext_System_Content_Type' => 'D590DC20-07BC-436C-9CF7-F3BBFBF1A4DC', + 'GETID3_ASF_Old_File_Properties_Object' => 'D6E229D0-35DA-11D1-9034-00A0C90349BE', + 'GETID3_ASF_Old_ASF_Header_Object' => 'D6E229D1-35DA-11D1-9034-00A0C90349BE', + 'GETID3_ASF_Old_ASF_Data_Object' => 'D6E229D2-35DA-11D1-9034-00A0C90349BE', + 'GETID3_ASF_Index_Object' => 'D6E229D3-35DA-11D1-9034-00A0C90349BE', + 'GETID3_ASF_Old_Stream_Properties_Object' => 'D6E229D4-35DA-11D1-9034-00A0C90349BE', + 'GETID3_ASF_Old_Content_Description_Object' => 'D6E229D5-35DA-11D1-9034-00A0C90349BE', + 'GETID3_ASF_Old_Script_Command_Object' => 'D6E229D6-35DA-11D1-9034-00A0C90349BE', + 'GETID3_ASF_Old_Marker_Object' => 'D6E229D7-35DA-11D1-9034-00A0C90349BE', + 'GETID3_ASF_Old_Component_Download_Object' => 'D6E229D8-35DA-11D1-9034-00A0C90349BE', + 'GETID3_ASF_Old_Stream_Group_Object' => 'D6E229D9-35DA-11D1-9034-00A0C90349BE', + 'GETID3_ASF_Old_Scalable_Object' => 'D6E229DA-35DA-11D1-9034-00A0C90349BE', + 'GETID3_ASF_Old_Prioritization_Object' => 'D6E229DB-35DA-11D1-9034-00A0C90349BE', + 'GETID3_ASF_Bitrate_Mutual_Exclusion_Object' => 'D6E229DC-35DA-11D1-9034-00A0C90349BE', + 'GETID3_ASF_Old_Inter_Media_Dependency_Object' => 'D6E229DD-35DA-11D1-9034-00A0C90349BE', + 'GETID3_ASF_Old_Rating_Object' => 'D6E229DE-35DA-11D1-9034-00A0C90349BE', + 'GETID3_ASF_Index_Parameters_Object' => 'D6E229DF-35DA-11D1-9034-00A0C90349BE', + 'GETID3_ASF_Old_Color_Table_Object' => 'D6E229E0-35DA-11D1-9034-00A0C90349BE', + 'GETID3_ASF_Old_Language_List_Object' => 'D6E229E1-35DA-11D1-9034-00A0C90349BE', + 'GETID3_ASF_Old_Audio_Media' => 'D6E229E2-35DA-11D1-9034-00A0C90349BE', + 'GETID3_ASF_Old_Video_Media' => 'D6E229E3-35DA-11D1-9034-00A0C90349BE', + 'GETID3_ASF_Old_Image_Media' => 'D6E229E4-35DA-11D1-9034-00A0C90349BE', + 'GETID3_ASF_Old_Timecode_Media' => 'D6E229E5-35DA-11D1-9034-00A0C90349BE', + 'GETID3_ASF_Old_Text_Media' => 'D6E229E6-35DA-11D1-9034-00A0C90349BE', + 'GETID3_ASF_Old_MIDI_Media' => 'D6E229E7-35DA-11D1-9034-00A0C90349BE', + 'GETID3_ASF_Old_Command_Media' => 'D6E229E8-35DA-11D1-9034-00A0C90349BE', + 'GETID3_ASF_Old_No_Error_Concealment' => 'D6E229EA-35DA-11D1-9034-00A0C90349BE', + 'GETID3_ASF_Old_Scrambled_Audio' => 'D6E229EB-35DA-11D1-9034-00A0C90349BE', + 'GETID3_ASF_Old_No_Color_Table' => 'D6E229EC-35DA-11D1-9034-00A0C90349BE', + 'GETID3_ASF_Old_SMPTE_Time' => 'D6E229ED-35DA-11D1-9034-00A0C90349BE', + 'GETID3_ASF_Old_ASCII_Text' => 'D6E229EE-35DA-11D1-9034-00A0C90349BE', + 'GETID3_ASF_Old_Unicode_Text' => 'D6E229EF-35DA-11D1-9034-00A0C90349BE', + 'GETID3_ASF_Old_HTML_Text' => 'D6E229F0-35DA-11D1-9034-00A0C90349BE', + 'GETID3_ASF_Old_URL_Command' => 'D6E229F1-35DA-11D1-9034-00A0C90349BE', + 'GETID3_ASF_Old_Filename_Command' => 'D6E229F2-35DA-11D1-9034-00A0C90349BE', + 'GETID3_ASF_Old_ACM_Codec' => 'D6E229F3-35DA-11D1-9034-00A0C90349BE', + 'GETID3_ASF_Old_VCM_Codec' => 'D6E229F4-35DA-11D1-9034-00A0C90349BE', + 'GETID3_ASF_Old_QuickTime_Codec' => 'D6E229F5-35DA-11D1-9034-00A0C90349BE', + 'GETID3_ASF_Old_DirectShow_Transform_Filter' => 'D6E229F6-35DA-11D1-9034-00A0C90349BE', + 'GETID3_ASF_Old_DirectShow_Rendering_Filter' => 'D6E229F7-35DA-11D1-9034-00A0C90349BE', + 'GETID3_ASF_Old_No_Enhancement' => 'D6E229F8-35DA-11D1-9034-00A0C90349BE', + 'GETID3_ASF_Old_Unknown_Enhancement_Type' => 'D6E229F9-35DA-11D1-9034-00A0C90349BE', + 'GETID3_ASF_Old_Temporal_Enhancement' => 'D6E229FA-35DA-11D1-9034-00A0C90349BE', + 'GETID3_ASF_Old_Spatial_Enhancement' => 'D6E229FB-35DA-11D1-9034-00A0C90349BE', + 'GETID3_ASF_Old_Quality_Enhancement' => 'D6E229FC-35DA-11D1-9034-00A0C90349BE', + 'GETID3_ASF_Old_Number_of_Channels_Enhancement' => 'D6E229FD-35DA-11D1-9034-00A0C90349BE', + 'GETID3_ASF_Old_Frequency_Response_Enhancement' => 'D6E229FE-35DA-11D1-9034-00A0C90349BE', + 'GETID3_ASF_Old_Media_Object' => 'D6E229FF-35DA-11D1-9034-00A0C90349BE', + 'GETID3_ASF_Mutex_Language' => 'D6E22A00-35DA-11D1-9034-00A0C90349BE', + 'GETID3_ASF_Mutex_Bitrate' => 'D6E22A01-35DA-11D1-9034-00A0C90349BE', + 'GETID3_ASF_Mutex_Unknown' => 'D6E22A02-35DA-11D1-9034-00A0C90349BE', + 'GETID3_ASF_Old_ASF_Placeholder_Object' => 'D6E22A0E-35DA-11D1-9034-00A0C90349BE', + 'GETID3_ASF_Old_Data_Unit_Extension_Object' => 'D6E22A0F-35DA-11D1-9034-00A0C90349BE', + 'GETID3_ASF_Web_Stream_Format' => 'DA1E6B13-8359-4050-B398-388E965BF00C', + 'GETID3_ASF_Payload_Ext_System_File_Name' => 'E165EC0E-19ED-45D7-B4A7-25CBD1E28E9B', + 'GETID3_ASF_Marker_Object' => 'F487CD01-A951-11CF-8EE6-00C00C205365', + 'GETID3_ASF_Timecode_Index_Parameters_Object' => 'F55E496D-9797-4B5D-8C8B-604DFE9BFB24', + 'GETID3_ASF_Audio_Media' => 'F8699E40-5B4D-11CF-A8FD-00805F5C442B', + 'GETID3_ASF_Media_Object_Index_Object' => 'FEB103F8-12AD-4C64-840F-2A1D2F7AD48C', + 'GETID3_ASF_Alt_Extended_Content_Encryption_Obj' => 'FF889EF1-ADEE-40DA-9E71-98704BB928CE', + 'GETID3_ASF_Index_Placeholder_Object' => 'D9AADE20-7C17-4F9C-BC28-8555DD98E2A2', // http://cpan.uwinnipeg.ca/htdocs/Audio-WMA/Audio/WMA.pm.html + 'GETID3_ASF_Compatibility_Object' => '26F18B5D-4584-47EC-9F5F-0E651F0452C9', // http://cpan.uwinnipeg.ca/htdocs/Audio-WMA/Audio/WMA.pm.html + ); + return $GUIDarray; + } + + public static function GUIDname($GUIDstring) { + static $GUIDarray = array(); + if (empty($GUIDarray)) { + $GUIDarray = self::KnownGUIDs(); + } + return array_search($GUIDstring, $GUIDarray); + } + + public static function ASFIndexObjectIndexTypeLookup($id) { + static $ASFIndexObjectIndexTypeLookup = array(); + if (empty($ASFIndexObjectIndexTypeLookup)) { + $ASFIndexObjectIndexTypeLookup[1] = 'Nearest Past Data Packet'; + $ASFIndexObjectIndexTypeLookup[2] = 'Nearest Past Media Object'; + $ASFIndexObjectIndexTypeLookup[3] = 'Nearest Past Cleanpoint'; + } + return (isset($ASFIndexObjectIndexTypeLookup[$id]) ? $ASFIndexObjectIndexTypeLookup[$id] : 'invalid'); + } + + public static function GUIDtoBytestring($GUIDstring) { + // Microsoft defines these 16-byte (128-bit) GUIDs in the strangest way: + // first 4 bytes are in little-endian order + // next 2 bytes are appended in little-endian order + // next 2 bytes are appended in little-endian order + // next 2 bytes are appended in big-endian order + // next 6 bytes are appended in big-endian order + + // AaBbCcDd-EeFf-GgHh-IiJj-KkLlMmNnOoPp is stored as this 16-byte string: + // $Dd $Cc $Bb $Aa $Ff $Ee $Hh $Gg $Ii $Jj $Kk $Ll $Mm $Nn $Oo $Pp + + $hexbytecharstring = chr(hexdec(substr($GUIDstring, 6, 2))); + $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 4, 2))); + $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 2, 2))); + $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 0, 2))); + + $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 11, 2))); + $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 9, 2))); + + $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 16, 2))); + $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 14, 2))); + + $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 19, 2))); + $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 21, 2))); + + $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 24, 2))); + $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 26, 2))); + $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 28, 2))); + $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 30, 2))); + $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 32, 2))); + $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 34, 2))); + + return $hexbytecharstring; + } + + public static function BytestringToGUID($Bytestring) { + $GUIDstring = str_pad(dechex(ord($Bytestring{3})), 2, '0', STR_PAD_LEFT); + $GUIDstring .= str_pad(dechex(ord($Bytestring{2})), 2, '0', STR_PAD_LEFT); + $GUIDstring .= str_pad(dechex(ord($Bytestring{1})), 2, '0', STR_PAD_LEFT); + $GUIDstring .= str_pad(dechex(ord($Bytestring{0})), 2, '0', STR_PAD_LEFT); + $GUIDstring .= '-'; + $GUIDstring .= str_pad(dechex(ord($Bytestring{5})), 2, '0', STR_PAD_LEFT); + $GUIDstring .= str_pad(dechex(ord($Bytestring{4})), 2, '0', STR_PAD_LEFT); + $GUIDstring .= '-'; + $GUIDstring .= str_pad(dechex(ord($Bytestring{7})), 2, '0', STR_PAD_LEFT); + $GUIDstring .= str_pad(dechex(ord($Bytestring{6})), 2, '0', STR_PAD_LEFT); + $GUIDstring .= '-'; + $GUIDstring .= str_pad(dechex(ord($Bytestring{8})), 2, '0', STR_PAD_LEFT); + $GUIDstring .= str_pad(dechex(ord($Bytestring{9})), 2, '0', STR_PAD_LEFT); + $GUIDstring .= '-'; + $GUIDstring .= str_pad(dechex(ord($Bytestring{10})), 2, '0', STR_PAD_LEFT); + $GUIDstring .= str_pad(dechex(ord($Bytestring{11})), 2, '0', STR_PAD_LEFT); + $GUIDstring .= str_pad(dechex(ord($Bytestring{12})), 2, '0', STR_PAD_LEFT); + $GUIDstring .= str_pad(dechex(ord($Bytestring{13})), 2, '0', STR_PAD_LEFT); + $GUIDstring .= str_pad(dechex(ord($Bytestring{14})), 2, '0', STR_PAD_LEFT); + $GUIDstring .= str_pad(dechex(ord($Bytestring{15})), 2, '0', STR_PAD_LEFT); + + return strtoupper($GUIDstring); + } + + public static function FILETIMEtoUNIXtime($FILETIME, $round=true) { + // FILETIME is a 64-bit unsigned integer representing + // the number of 100-nanosecond intervals since January 1, 1601 + // UNIX timestamp is number of seconds since January 1, 1970 + // 116444736000000000 = 10000000 * 60 * 60 * 24 * 365 * 369 + 89 leap days + if ($round) { + return intval(round(($FILETIME - 116444736000000000) / 10000000)); + } + return ($FILETIME - 116444736000000000) / 10000000; + } + + public static function WMpictureTypeLookup($WMpictureType) { + static $lookup = null; + if ($lookup === null) { + $lookup = array( + 0x03 => 'Front Cover', + 0x04 => 'Back Cover', + 0x00 => 'User Defined', + 0x05 => 'Leaflet Page', + 0x06 => 'Media Label', + 0x07 => 'Lead Artist', + 0x08 => 'Artist', + 0x09 => 'Conductor', + 0x0A => 'Band', + 0x0B => 'Composer', + 0x0C => 'Lyricist', + 0x0D => 'Recording Location', + 0x0E => 'During Recording', + 0x0F => 'During Performance', + 0x10 => 'Video Screen Capture', + 0x12 => 'Illustration', + 0x13 => 'Band Logotype', + 0x14 => 'Publisher Logotype' + ); + $lookup = array_map(function($str) { + return getid3_lib::iconv_fallback('UTF-8', 'UTF-16LE', $str); + }, $lookup); + } + + return (isset($lookup[$WMpictureType]) ? $lookup[$WMpictureType] : ''); + } + + public function HeaderExtensionObjectDataParse(&$asf_header_extension_object_data, &$unhandled_sections) { + // http://msdn.microsoft.com/en-us/library/bb643323.aspx + + $offset = 0; + $objectOffset = 0; + $HeaderExtensionObjectParsed = array(); + while ($objectOffset < strlen($asf_header_extension_object_data)) { + $offset = $objectOffset; + $thisObject = array(); + + $thisObject['guid'] = substr($asf_header_extension_object_data, $offset, 16); + $offset += 16; + $thisObject['guid_text'] = $this->BytestringToGUID($thisObject['guid']); + $thisObject['guid_name'] = $this->GUIDname($thisObject['guid_text']); + + $thisObject['size'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 8)); + $offset += 8; + if ($thisObject['size'] <= 0) { + break; + } + + switch ($thisObject['guid']) { + case GETID3_ASF_Extended_Stream_Properties_Object: + $thisObject['start_time'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 8)); + $offset += 8; + $thisObject['start_time_unix'] = $this->FILETIMEtoUNIXtime($thisObject['start_time']); + + $thisObject['end_time'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 8)); + $offset += 8; + $thisObject['end_time_unix'] = $this->FILETIMEtoUNIXtime($thisObject['end_time']); + + $thisObject['data_bitrate'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4)); + $offset += 4; + + $thisObject['buffer_size'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4)); + $offset += 4; + + $thisObject['initial_buffer_fullness'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4)); + $offset += 4; + + $thisObject['alternate_data_bitrate'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4)); + $offset += 4; + + $thisObject['alternate_buffer_size'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4)); + $offset += 4; + + $thisObject['alternate_initial_buffer_fullness'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4)); + $offset += 4; + + $thisObject['maximum_object_size'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4)); + $offset += 4; + + $thisObject['flags_raw'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4)); + $offset += 4; + $thisObject['flags']['reliable'] = (bool) $thisObject['flags_raw'] & 0x00000001; + $thisObject['flags']['seekable'] = (bool) $thisObject['flags_raw'] & 0x00000002; + $thisObject['flags']['no_cleanpoints'] = (bool) $thisObject['flags_raw'] & 0x00000004; + $thisObject['flags']['resend_live_cleanpoints'] = (bool) $thisObject['flags_raw'] & 0x00000008; + + $thisObject['stream_number'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); + $offset += 2; + + $thisObject['stream_language_id_index'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); + $offset += 2; + + $thisObject['average_time_per_frame'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4)); + $offset += 4; + + $thisObject['stream_name_count'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); + $offset += 2; + + $thisObject['payload_extension_system_count'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); + $offset += 2; + + for ($i = 0; $i < $thisObject['stream_name_count']; $i++) { + $streamName = array(); + + $streamName['language_id_index'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); + $offset += 2; + + $streamName['stream_name_length'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); + $offset += 2; + + $streamName['stream_name'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, $streamName['stream_name_length'])); + $offset += $streamName['stream_name_length']; + + $thisObject['stream_names'][$i] = $streamName; + } + + for ($i = 0; $i < $thisObject['payload_extension_system_count']; $i++) { + $payloadExtensionSystem = array(); + + $payloadExtensionSystem['extension_system_id'] = substr($asf_header_extension_object_data, $offset, 16); + $offset += 16; + $payloadExtensionSystem['extension_system_id_text'] = $this->BytestringToGUID($payloadExtensionSystem['extension_system_id']); + + $payloadExtensionSystem['extension_system_size'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); + $offset += 2; + if ($payloadExtensionSystem['extension_system_size'] <= 0) { + break 2; + } + + $payloadExtensionSystem['extension_system_info_length'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4)); + $offset += 4; + + $payloadExtensionSystem['extension_system_info_length'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, $payloadExtensionSystem['extension_system_info_length'])); + $offset += $payloadExtensionSystem['extension_system_info_length']; + + $thisObject['payload_extension_systems'][$i] = $payloadExtensionSystem; + } + + break; + + case GETID3_ASF_Padding_Object: + // padding, skip it + break; + + case GETID3_ASF_Metadata_Object: + $thisObject['description_record_counts'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); + $offset += 2; + + for ($i = 0; $i < $thisObject['description_record_counts']; $i++) { + $descriptionRecord = array(); + + $descriptionRecord['reserved_1'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); // must be zero + $offset += 2; + + $descriptionRecord['stream_number'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); + $offset += 2; + + $descriptionRecord['name_length'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); + $offset += 2; + + $descriptionRecord['data_type'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); + $offset += 2; + $descriptionRecord['data_type_text'] = self::metadataLibraryObjectDataTypeLookup($descriptionRecord['data_type']); + + $descriptionRecord['data_length'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4)); + $offset += 4; + + $descriptionRecord['name'] = substr($asf_header_extension_object_data, $offset, $descriptionRecord['name_length']); + $offset += $descriptionRecord['name_length']; + + $descriptionRecord['data'] = substr($asf_header_extension_object_data, $offset, $descriptionRecord['data_length']); + $offset += $descriptionRecord['data_length']; + switch ($descriptionRecord['data_type']) { + case 0x0000: // Unicode string + break; + + case 0x0001: // BYTE array + // do nothing + break; + + case 0x0002: // BOOL + $descriptionRecord['data'] = (bool) getid3_lib::LittleEndian2Int($descriptionRecord['data']); + break; + + case 0x0003: // DWORD + case 0x0004: // QWORD + case 0x0005: // WORD + $descriptionRecord['data'] = getid3_lib::LittleEndian2Int($descriptionRecord['data']); + break; + + case 0x0006: // GUID + $descriptionRecord['data_text'] = $this->BytestringToGUID($descriptionRecord['data']); + break; + } + + $thisObject['description_record'][$i] = $descriptionRecord; + } + break; + + case GETID3_ASF_Language_List_Object: + $thisObject['language_id_record_counts'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); + $offset += 2; + + for ($i = 0; $i < $thisObject['language_id_record_counts']; $i++) { + $languageIDrecord = array(); + + $languageIDrecord['language_id_length'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 1)); + $offset += 1; + + $languageIDrecord['language_id'] = substr($asf_header_extension_object_data, $offset, $languageIDrecord['language_id_length']); + $offset += $languageIDrecord['language_id_length']; + + $thisObject['language_id_record'][$i] = $languageIDrecord; + } + break; + + case GETID3_ASF_Metadata_Library_Object: + $thisObject['description_records_count'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); + $offset += 2; + + for ($i = 0; $i < $thisObject['description_records_count']; $i++) { + $descriptionRecord = array(); + + $descriptionRecord['language_list_index'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); + $offset += 2; + + $descriptionRecord['stream_number'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); + $offset += 2; + + $descriptionRecord['name_length'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); + $offset += 2; + + $descriptionRecord['data_type'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); + $offset += 2; + $descriptionRecord['data_type_text'] = self::metadataLibraryObjectDataTypeLookup($descriptionRecord['data_type']); + + $descriptionRecord['data_length'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4)); + $offset += 4; + + $descriptionRecord['name'] = substr($asf_header_extension_object_data, $offset, $descriptionRecord['name_length']); + $offset += $descriptionRecord['name_length']; + + $descriptionRecord['data'] = substr($asf_header_extension_object_data, $offset, $descriptionRecord['data_length']); + $offset += $descriptionRecord['data_length']; + + if (preg_match('#^WM/Picture$#', str_replace("\x00", '', trim($descriptionRecord['name'])))) { + $WMpicture = $this->ASF_WMpicture($descriptionRecord['data']); + foreach ($WMpicture as $key => $value) { + $descriptionRecord['data'] = $WMpicture; + } + unset($WMpicture); + } + + $thisObject['description_record'][$i] = $descriptionRecord; + } + break; + + default: + $unhandled_sections++; + if ($this->GUIDname($thisObject['guid_text'])) { + $this->warning('unhandled Header Extension Object GUID "'.$this->GUIDname($thisObject['guid_text']).'" {'.$thisObject['guid_text'].'} at offset '.($offset - 16 - 8)); + } else { + $this->warning('unknown Header Extension Object GUID {'.$thisObject['guid_text'].'} in at offset '.($offset - 16 - 8)); + } + break; + } + $HeaderExtensionObjectParsed[] = $thisObject; + + $objectOffset += $thisObject['size']; + } + return $HeaderExtensionObjectParsed; + } + + + public static function metadataLibraryObjectDataTypeLookup($id) { + static $lookup = array( + 0x0000 => 'Unicode string', // The data consists of a sequence of Unicode characters + 0x0001 => 'BYTE array', // The type of the data is implementation-specific + 0x0002 => 'BOOL', // The data is 2 bytes long and should be interpreted as a 16-bit unsigned integer. Only 0x0000 or 0x0001 are permitted values + 0x0003 => 'DWORD', // The data is 4 bytes long and should be interpreted as a 32-bit unsigned integer + 0x0004 => 'QWORD', // The data is 8 bytes long and should be interpreted as a 64-bit unsigned integer + 0x0005 => 'WORD', // The data is 2 bytes long and should be interpreted as a 16-bit unsigned integer + 0x0006 => 'GUID', // The data is 16 bytes long and should be interpreted as a 128-bit GUID + ); + return (isset($lookup[$id]) ? $lookup[$id] : 'invalid'); + } + + public function ASF_WMpicture(&$data) { + //typedef struct _WMPicture{ + // LPWSTR pwszMIMEType; + // BYTE bPictureType; + // LPWSTR pwszDescription; + // DWORD dwDataLen; + // BYTE* pbData; + //} WM_PICTURE; + + $WMpicture = array(); + + $offset = 0; + $WMpicture['image_type_id'] = getid3_lib::LittleEndian2Int(substr($data, $offset, 1)); + $offset += 1; + $WMpicture['image_type'] = self::WMpictureTypeLookup($WMpicture['image_type_id']); + $WMpicture['image_size'] = getid3_lib::LittleEndian2Int(substr($data, $offset, 4)); + $offset += 4; + + $WMpicture['image_mime'] = ''; + do { + $next_byte_pair = substr($data, $offset, 2); + $offset += 2; + $WMpicture['image_mime'] .= $next_byte_pair; + } while ($next_byte_pair !== "\x00\x00"); + + $WMpicture['image_description'] = ''; + do { + $next_byte_pair = substr($data, $offset, 2); + $offset += 2; + $WMpicture['image_description'] .= $next_byte_pair; + } while ($next_byte_pair !== "\x00\x00"); + + $WMpicture['dataoffset'] = $offset; + $WMpicture['data'] = substr($data, $offset); + + $imageinfo = array(); + $WMpicture['image_mime'] = ''; + $imagechunkcheck = getid3_lib::GetDataImageSize($WMpicture['data'], $imageinfo); + unset($imageinfo); + if (!empty($imagechunkcheck)) { + $WMpicture['image_mime'] = image_type_to_mime_type($imagechunkcheck[2]); + } + if (!isset($this->getid3->info['asf']['comments']['picture'])) { + $this->getid3->info['asf']['comments']['picture'] = array(); + } + $this->getid3->info['asf']['comments']['picture'][] = array('data'=>$WMpicture['data'], 'image_mime'=>$WMpicture['image_mime']); + + return $WMpicture; + } + + + // Remove terminator 00 00 and convert UTF-16LE to Latin-1 + public static function TrimConvert($string) { + return trim(getid3_lib::iconv_fallback('UTF-16LE', 'ISO-8859-1', self::TrimTerm($string)), ' '); + } + + + // Remove terminator 00 00 + public static function TrimTerm($string) { + // remove terminator, only if present (it should be, but...) + if (substr($string, -2) === "\x00\x00") { + $string = substr($string, 0, -2); + } + return $string; + } + +} diff --git a/www/rompr/getid3/module.audio-video.bink.php b/www/rompr/getid3/module.audio-video.bink.php new file mode 100644 index 0000000..af4b4f8 --- /dev/null +++ b/www/rompr/getid3/module.audio-video.bink.php @@ -0,0 +1,72 @@ + // +// available at http://getid3.sourceforge.net // +// or http://www.getid3.org // +// also https://github.com/JamesHeinrich/getID3 // +///////////////////////////////////////////////////////////////// +// See readme.txt for more details // +///////////////////////////////////////////////////////////////// +// // +// module.audio.bink.php // +// module for analyzing Bink or Smacker audio-video files // +// dependencies: NONE // +// /// +///////////////////////////////////////////////////////////////// + + +class getid3_bink extends getid3_handler +{ + + public function Analyze() { + $info = &$this->getid3->info; + +$this->error('Bink / Smacker files not properly processed by this version of getID3() ['.$this->getid3->version().']'); + + $this->fseek($info['avdataoffset']); + $fileTypeID = $this->fread(3); + switch ($fileTypeID) { + case 'BIK': + return $this->ParseBink(); + break; + + case 'SMK': + return $this->ParseSmacker(); + break; + + default: + $this->error('Expecting "BIK" or "SMK" at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes($fileTypeID).'"'); + return false; + break; + } + + return true; + + } + + public function ParseBink() { + $info = &$this->getid3->info; + $info['fileformat'] = 'bink'; + $info['video']['dataformat'] = 'bink'; + + $fileData = 'BIK'.$this->fread(13); + + $info['bink']['data_size'] = getid3_lib::LittleEndian2Int(substr($fileData, 4, 4)); + $info['bink']['frame_count'] = getid3_lib::LittleEndian2Int(substr($fileData, 8, 2)); + + if (($info['avdataend'] - $info['avdataoffset']) != ($info['bink']['data_size'] + 8)) { + $this->error('Probably truncated file: expecting '.$info['bink']['data_size'].' bytes, found '.($info['avdataend'] - $info['avdataoffset'])); + } + + return true; + } + + public function ParseSmacker() { + $info = &$this->getid3->info; + $info['fileformat'] = 'smacker'; + $info['video']['dataformat'] = 'smacker'; + + return true; + } + +} diff --git a/www/rompr/getid3/module.audio-video.flv.php b/www/rompr/getid3/module.audio-video.flv.php new file mode 100644 index 0000000..661c77c --- /dev/null +++ b/www/rompr/getid3/module.audio-video.flv.php @@ -0,0 +1,745 @@ + // +// available at http://getid3.sourceforge.net // +// or http://www.getid3.org // +// also https://github.com/JamesHeinrich/getID3 // +// // +// FLV module by Seth Kaufman // +// // +// * version 0.1 (26 June 2005) // +// // +// // +// * version 0.1.1 (15 July 2005) // +// minor modifications by James Heinrich // +// // +// * version 0.2 (22 February 2006) // +// Support for On2 VP6 codec and meta information // +// by Steve Webster // +// // +// * version 0.3 (15 June 2006) // +// Modified to not read entire file into memory // +// by James Heinrich // +// // +// * version 0.4 (07 December 2007) // +// Bugfixes for incorrectly parsed FLV dimensions // +// and incorrect parsing of onMetaTag // +// by Evgeny Moysevich // +// // +// * version 0.5 (21 May 2009) // +// Fixed parsing of audio tags and added additional codec // +// details. The duration is now read from onMetaTag (if // +// exists), rather than parsing whole file // +// by Nigel Barnes // +// // +// * version 0.6 (24 May 2009) // +// Better parsing of files with h264 video // +// by Evgeny Moysevich // +// // +// * version 0.6.1 (30 May 2011) // +// prevent infinite loops in expGolombUe() // +// // +// * version 0.7.0 (16 Jul 2013) // +// handle GETID3_FLV_VIDEO_VP6FLV_ALPHA // +// improved AVCSequenceParameterSetReader::readData() // +// by Xander Schouwerwou // +// // +///////////////////////////////////////////////////////////////// +// // +// module.audio-video.flv.php // +// module for analyzing Shockwave Flash Video files // +// dependencies: NONE // +// /// +///////////////////////////////////////////////////////////////// + +define('GETID3_FLV_TAG_AUDIO', 8); +define('GETID3_FLV_TAG_VIDEO', 9); +define('GETID3_FLV_TAG_META', 18); + +define('GETID3_FLV_VIDEO_H263', 2); +define('GETID3_FLV_VIDEO_SCREEN', 3); +define('GETID3_FLV_VIDEO_VP6FLV', 4); +define('GETID3_FLV_VIDEO_VP6FLV_ALPHA', 5); +define('GETID3_FLV_VIDEO_SCREENV2', 6); +define('GETID3_FLV_VIDEO_H264', 7); + +define('H264_AVC_SEQUENCE_HEADER', 0); +define('H264_PROFILE_BASELINE', 66); +define('H264_PROFILE_MAIN', 77); +define('H264_PROFILE_EXTENDED', 88); +define('H264_PROFILE_HIGH', 100); +define('H264_PROFILE_HIGH10', 110); +define('H264_PROFILE_HIGH422', 122); +define('H264_PROFILE_HIGH444', 144); +define('H264_PROFILE_HIGH444_PREDICTIVE', 244); + +class getid3_flv extends getid3_handler { + + const magic = 'FLV'; + + public $max_frames = 100000; // break out of the loop if too many frames have been scanned; only scan this many if meta frame does not contain useful duration + + public function Analyze() { + $info = &$this->getid3->info; + + $this->fseek($info['avdataoffset']); + + $FLVdataLength = $info['avdataend'] - $info['avdataoffset']; + $FLVheader = $this->fread(5); + + $info['fileformat'] = 'flv'; + $info['flv']['header']['signature'] = substr($FLVheader, 0, 3); + $info['flv']['header']['version'] = getid3_lib::BigEndian2Int(substr($FLVheader, 3, 1)); + $TypeFlags = getid3_lib::BigEndian2Int(substr($FLVheader, 4, 1)); + + if ($info['flv']['header']['signature'] != self::magic) { + $this->error('Expecting "'.getid3_lib::PrintHexBytes(self::magic).'" at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes($info['flv']['header']['signature']).'"'); + unset($info['flv'], $info['fileformat']); + return false; + } + + $info['flv']['header']['hasAudio'] = (bool) ($TypeFlags & 0x04); + $info['flv']['header']['hasVideo'] = (bool) ($TypeFlags & 0x01); + + $FrameSizeDataLength = getid3_lib::BigEndian2Int($this->fread(4)); + $FLVheaderFrameLength = 9; + if ($FrameSizeDataLength > $FLVheaderFrameLength) { + $this->fseek($FrameSizeDataLength - $FLVheaderFrameLength, SEEK_CUR); + } + $Duration = 0; + $found_video = false; + $found_audio = false; + $found_meta = false; + $found_valid_meta_playtime = false; + $tagParseCount = 0; + $info['flv']['framecount'] = array('total'=>0, 'audio'=>0, 'video'=>0); + $flv_framecount = &$info['flv']['framecount']; + while ((($this->ftell() + 16) < $info['avdataend']) && (($tagParseCount++ <= $this->max_frames) || !$found_valid_meta_playtime)) { + $ThisTagHeader = $this->fread(16); + + $PreviousTagLength = getid3_lib::BigEndian2Int(substr($ThisTagHeader, 0, 4)); + $TagType = getid3_lib::BigEndian2Int(substr($ThisTagHeader, 4, 1)); + $DataLength = getid3_lib::BigEndian2Int(substr($ThisTagHeader, 5, 3)); + $Timestamp = getid3_lib::BigEndian2Int(substr($ThisTagHeader, 8, 3)); + $LastHeaderByte = getid3_lib::BigEndian2Int(substr($ThisTagHeader, 15, 1)); + $NextOffset = $this->ftell() - 1 + $DataLength; + if ($Timestamp > $Duration) { + $Duration = $Timestamp; + } + + $flv_framecount['total']++; + switch ($TagType) { + case GETID3_FLV_TAG_AUDIO: + $flv_framecount['audio']++; + if (!$found_audio) { + $found_audio = true; + $info['flv']['audio']['audioFormat'] = ($LastHeaderByte >> 4) & 0x0F; + $info['flv']['audio']['audioRate'] = ($LastHeaderByte >> 2) & 0x03; + $info['flv']['audio']['audioSampleSize'] = ($LastHeaderByte >> 1) & 0x01; + $info['flv']['audio']['audioType'] = $LastHeaderByte & 0x01; + } + break; + + case GETID3_FLV_TAG_VIDEO: + $flv_framecount['video']++; + if (!$found_video) { + $found_video = true; + $info['flv']['video']['videoCodec'] = $LastHeaderByte & 0x07; + + $FLVvideoHeader = $this->fread(11); + + if ($info['flv']['video']['videoCodec'] == GETID3_FLV_VIDEO_H264) { + // this code block contributed by: moysevichØgmail*com + + $AVCPacketType = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 0, 1)); + if ($AVCPacketType == H264_AVC_SEQUENCE_HEADER) { + // read AVCDecoderConfigurationRecord + $configurationVersion = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 4, 1)); + $AVCProfileIndication = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 5, 1)); + $profile_compatibility = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 6, 1)); + $lengthSizeMinusOne = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 7, 1)); + $numOfSequenceParameterSets = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 8, 1)); + + if (($numOfSequenceParameterSets & 0x1F) != 0) { + // there is at least one SequenceParameterSet + // read size of the first SequenceParameterSet + //$spsSize = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 9, 2)); + $spsSize = getid3_lib::LittleEndian2Int(substr($FLVvideoHeader, 9, 2)); + // read the first SequenceParameterSet + $sps = $this->fread($spsSize); + if (strlen($sps) == $spsSize) { // make sure that whole SequenceParameterSet was red + $spsReader = new AVCSequenceParameterSetReader($sps); + $spsReader->readData(); + $info['video']['resolution_x'] = $spsReader->getWidth(); + $info['video']['resolution_y'] = $spsReader->getHeight(); + } + } + } + // end: moysevichØgmail*com + + } elseif ($info['flv']['video']['videoCodec'] == GETID3_FLV_VIDEO_H263) { + + $PictureSizeType = (getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 3, 2))) >> 7; + $PictureSizeType = $PictureSizeType & 0x0007; + $info['flv']['header']['videoSizeType'] = $PictureSizeType; + switch ($PictureSizeType) { + case 0: + //$PictureSizeEnc = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 5, 2)); + //$PictureSizeEnc <<= 1; + //$info['video']['resolution_x'] = ($PictureSizeEnc & 0xFF00) >> 8; + //$PictureSizeEnc = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 6, 2)); + //$PictureSizeEnc <<= 1; + //$info['video']['resolution_y'] = ($PictureSizeEnc & 0xFF00) >> 8; + + $PictureSizeEnc['x'] = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 4, 2)) >> 7; + $PictureSizeEnc['y'] = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 5, 2)) >> 7; + $info['video']['resolution_x'] = $PictureSizeEnc['x'] & 0xFF; + $info['video']['resolution_y'] = $PictureSizeEnc['y'] & 0xFF; + break; + + case 1: + $PictureSizeEnc['x'] = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 4, 3)) >> 7; + $PictureSizeEnc['y'] = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 6, 3)) >> 7; + $info['video']['resolution_x'] = $PictureSizeEnc['x'] & 0xFFFF; + $info['video']['resolution_y'] = $PictureSizeEnc['y'] & 0xFFFF; + break; + + case 2: + $info['video']['resolution_x'] = 352; + $info['video']['resolution_y'] = 288; + break; + + case 3: + $info['video']['resolution_x'] = 176; + $info['video']['resolution_y'] = 144; + break; + + case 4: + $info['video']['resolution_x'] = 128; + $info['video']['resolution_y'] = 96; + break; + + case 5: + $info['video']['resolution_x'] = 320; + $info['video']['resolution_y'] = 240; + break; + + case 6: + $info['video']['resolution_x'] = 160; + $info['video']['resolution_y'] = 120; + break; + + default: + $info['video']['resolution_x'] = 0; + $info['video']['resolution_y'] = 0; + break; + + } + + } elseif ($info['flv']['video']['videoCodec'] == GETID3_FLV_VIDEO_VP6FLV_ALPHA) { + + /* contributed by schouwerwouØgmail*com */ + if (!isset($info['video']['resolution_x'])) { // only when meta data isn't set + $PictureSizeEnc['x'] = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 6, 2)); + $PictureSizeEnc['y'] = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 7, 2)); + $info['video']['resolution_x'] = ($PictureSizeEnc['x'] & 0xFF) << 3; + $info['video']['resolution_y'] = ($PictureSizeEnc['y'] & 0xFF) << 3; + } + /* end schouwerwouØgmail*com */ + + } + if (!empty($info['video']['resolution_x']) && !empty($info['video']['resolution_y'])) { + $info['video']['pixel_aspect_ratio'] = $info['video']['resolution_x'] / $info['video']['resolution_y']; + } + } + break; + + // Meta tag + case GETID3_FLV_TAG_META: + if (!$found_meta) { + $found_meta = true; + $this->fseek(-1, SEEK_CUR); + $datachunk = $this->fread($DataLength); + $AMFstream = new AMFStream($datachunk); + $reader = new AMFReader($AMFstream); + $eventName = $reader->readData(); + $info['flv']['meta'][$eventName] = $reader->readData(); + unset($reader); + + $copykeys = array('framerate'=>'frame_rate', 'width'=>'resolution_x', 'height'=>'resolution_y', 'audiodatarate'=>'bitrate', 'videodatarate'=>'bitrate'); + foreach ($copykeys as $sourcekey => $destkey) { + if (isset($info['flv']['meta']['onMetaData'][$sourcekey])) { + switch ($sourcekey) { + case 'width': + case 'height': + $info['video'][$destkey] = intval(round($info['flv']['meta']['onMetaData'][$sourcekey])); + break; + case 'audiodatarate': + $info['audio'][$destkey] = getid3_lib::CastAsInt(round($info['flv']['meta']['onMetaData'][$sourcekey] * 1000)); + break; + case 'videodatarate': + case 'frame_rate': + default: + $info['video'][$destkey] = $info['flv']['meta']['onMetaData'][$sourcekey]; + break; + } + } + } + if (!empty($info['flv']['meta']['onMetaData']['duration'])) { + $found_valid_meta_playtime = true; + } + } + break; + + default: + // noop + break; + } + $this->fseek($NextOffset); + } + + $info['playtime_seconds'] = $Duration / 1000; + if ($info['playtime_seconds'] > 0) { + $info['bitrate'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / $info['playtime_seconds']; + } + + if ($info['flv']['header']['hasAudio']) { + $info['audio']['codec'] = self::audioFormatLookup($info['flv']['audio']['audioFormat']); + $info['audio']['sample_rate'] = self::audioRateLookup($info['flv']['audio']['audioRate']); + $info['audio']['bits_per_sample'] = self::audioBitDepthLookup($info['flv']['audio']['audioSampleSize']); + + $info['audio']['channels'] = $info['flv']['audio']['audioType'] + 1; // 0=mono,1=stereo + $info['audio']['lossless'] = ($info['flv']['audio']['audioFormat'] ? false : true); // 0=uncompressed + $info['audio']['dataformat'] = 'flv'; + } + if (!empty($info['flv']['header']['hasVideo'])) { + $info['video']['codec'] = self::videoCodecLookup($info['flv']['video']['videoCodec']); + $info['video']['dataformat'] = 'flv'; + $info['video']['lossless'] = false; + } + + // Set information from meta + if (!empty($info['flv']['meta']['onMetaData']['duration'])) { + $info['playtime_seconds'] = $info['flv']['meta']['onMetaData']['duration']; + $info['bitrate'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / $info['playtime_seconds']; + } + if (isset($info['flv']['meta']['onMetaData']['audiocodecid'])) { + $info['audio']['codec'] = self::audioFormatLookup($info['flv']['meta']['onMetaData']['audiocodecid']); + } + if (isset($info['flv']['meta']['onMetaData']['videocodecid'])) { + $info['video']['codec'] = self::videoCodecLookup($info['flv']['meta']['onMetaData']['videocodecid']); + } + return true; + } + + + public static function audioFormatLookup($id) { + static $lookup = array( + 0 => 'Linear PCM, platform endian', + 1 => 'ADPCM', + 2 => 'mp3', + 3 => 'Linear PCM, little endian', + 4 => 'Nellymoser 16kHz mono', + 5 => 'Nellymoser 8kHz mono', + 6 => 'Nellymoser', + 7 => 'G.711A-law logarithmic PCM', + 8 => 'G.711 mu-law logarithmic PCM', + 9 => 'reserved', + 10 => 'AAC', + 11 => 'Speex', + 12 => false, // unknown? + 13 => false, // unknown? + 14 => 'mp3 8kHz', + 15 => 'Device-specific sound', + ); + return (isset($lookup[$id]) ? $lookup[$id] : false); + } + + public static function audioRateLookup($id) { + static $lookup = array( + 0 => 5500, + 1 => 11025, + 2 => 22050, + 3 => 44100, + ); + return (isset($lookup[$id]) ? $lookup[$id] : false); + } + + public static function audioBitDepthLookup($id) { + static $lookup = array( + 0 => 8, + 1 => 16, + ); + return (isset($lookup[$id]) ? $lookup[$id] : false); + } + + public static function videoCodecLookup($id) { + static $lookup = array( + GETID3_FLV_VIDEO_H263 => 'Sorenson H.263', + GETID3_FLV_VIDEO_SCREEN => 'Screen video', + GETID3_FLV_VIDEO_VP6FLV => 'On2 VP6', + GETID3_FLV_VIDEO_VP6FLV_ALPHA => 'On2 VP6 with alpha channel', + GETID3_FLV_VIDEO_SCREENV2 => 'Screen video v2', + GETID3_FLV_VIDEO_H264 => 'Sorenson H.264', + ); + return (isset($lookup[$id]) ? $lookup[$id] : false); + } +} + +class AMFStream { + public $bytes; + public $pos; + + public function __construct(&$bytes) { + $this->bytes =& $bytes; + $this->pos = 0; + } + + public function readByte() { + return getid3_lib::BigEndian2Int(substr($this->bytes, $this->pos++, 1)); + } + + public function readInt() { + return ($this->readByte() << 8) + $this->readByte(); + } + + public function readLong() { + return ($this->readByte() << 24) + ($this->readByte() << 16) + ($this->readByte() << 8) + $this->readByte(); + } + + public function readDouble() { + return getid3_lib::BigEndian2Float($this->read(8)); + } + + public function readUTF() { + $length = $this->readInt(); + return $this->read($length); + } + + public function readLongUTF() { + $length = $this->readLong(); + return $this->read($length); + } + + public function read($length) { + $val = substr($this->bytes, $this->pos, $length); + $this->pos += $length; + return $val; + } + + public function peekByte() { + $pos = $this->pos; + $val = $this->readByte(); + $this->pos = $pos; + return $val; + } + + public function peekInt() { + $pos = $this->pos; + $val = $this->readInt(); + $this->pos = $pos; + return $val; + } + + public function peekLong() { + $pos = $this->pos; + $val = $this->readLong(); + $this->pos = $pos; + return $val; + } + + public function peekDouble() { + $pos = $this->pos; + $val = $this->readDouble(); + $this->pos = $pos; + return $val; + } + + public function peekUTF() { + $pos = $this->pos; + $val = $this->readUTF(); + $this->pos = $pos; + return $val; + } + + public function peekLongUTF() { + $pos = $this->pos; + $val = $this->readLongUTF(); + $this->pos = $pos; + return $val; + } +} + +class AMFReader { + public $stream; + + public function __construct(&$stream) { + $this->stream =& $stream; + } + + public function readData() { + $value = null; + + $type = $this->stream->readByte(); + switch ($type) { + + // Double + case 0: + $value = $this->readDouble(); + break; + + // Boolean + case 1: + $value = $this->readBoolean(); + break; + + // String + case 2: + $value = $this->readString(); + break; + + // Object + case 3: + $value = $this->readObject(); + break; + + // null + case 6: + return null; + break; + + // Mixed array + case 8: + $value = $this->readMixedArray(); + break; + + // Array + case 10: + $value = $this->readArray(); + break; + + // Date + case 11: + $value = $this->readDate(); + break; + + // Long string + case 13: + $value = $this->readLongString(); + break; + + // XML (handled as string) + case 15: + $value = $this->readXML(); + break; + + // Typed object (handled as object) + case 16: + $value = $this->readTypedObject(); + break; + + // Long string + default: + $value = '(unknown or unsupported data type)'; + break; + } + + return $value; + } + + public function readDouble() { + return $this->stream->readDouble(); + } + + public function readBoolean() { + return $this->stream->readByte() == 1; + } + + public function readString() { + return $this->stream->readUTF(); + } + + public function readObject() { + // Get highest numerical index - ignored +// $highestIndex = $this->stream->readLong(); + + $data = array(); + + while ($key = $this->stream->readUTF()) { + $data[$key] = $this->readData(); + } + // Mixed array record ends with empty string (0x00 0x00) and 0x09 + if (($key == '') && ($this->stream->peekByte() == 0x09)) { + // Consume byte + $this->stream->readByte(); + } + return $data; + } + + public function readMixedArray() { + // Get highest numerical index - ignored + $highestIndex = $this->stream->readLong(); + + $data = array(); + + while ($key = $this->stream->readUTF()) { + if (is_numeric($key)) { + $key = (float) $key; + } + $data[$key] = $this->readData(); + } + // Mixed array record ends with empty string (0x00 0x00) and 0x09 + if (($key == '') && ($this->stream->peekByte() == 0x09)) { + // Consume byte + $this->stream->readByte(); + } + + return $data; + } + + public function readArray() { + $length = $this->stream->readLong(); + $data = array(); + + for ($i = 0; $i < $length; $i++) { + $data[] = $this->readData(); + } + return $data; + } + + public function readDate() { + $timestamp = $this->stream->readDouble(); + $timezone = $this->stream->readInt(); + return $timestamp; + } + + public function readLongString() { + return $this->stream->readLongUTF(); + } + + public function readXML() { + return $this->stream->readLongUTF(); + } + + public function readTypedObject() { + $className = $this->stream->readUTF(); + return $this->readObject(); + } +} + +class AVCSequenceParameterSetReader { + public $sps; + public $start = 0; + public $currentBytes = 0; + public $currentBits = 0; + public $width; + public $height; + + public function __construct($sps) { + $this->sps = $sps; + } + + public function readData() { + $this->skipBits(8); + $this->skipBits(8); + $profile = $this->getBits(8); // read profile + if ($profile > 0) { + $this->skipBits(8); + $level_idc = $this->getBits(8); // level_idc + $this->expGolombUe(); // seq_parameter_set_id // sps + $this->expGolombUe(); // log2_max_frame_num_minus4 + $picOrderType = $this->expGolombUe(); // pic_order_cnt_type + if ($picOrderType == 0) { + $this->expGolombUe(); // log2_max_pic_order_cnt_lsb_minus4 + } elseif ($picOrderType == 1) { + $this->skipBits(1); // delta_pic_order_always_zero_flag + $this->expGolombSe(); // offset_for_non_ref_pic + $this->expGolombSe(); // offset_for_top_to_bottom_field + $num_ref_frames_in_pic_order_cnt_cycle = $this->expGolombUe(); // num_ref_frames_in_pic_order_cnt_cycle + for ($i = 0; $i < $num_ref_frames_in_pic_order_cnt_cycle; $i++) { + $this->expGolombSe(); // offset_for_ref_frame[ i ] + } + } + $this->expGolombUe(); // num_ref_frames + $this->skipBits(1); // gaps_in_frame_num_value_allowed_flag + $pic_width_in_mbs_minus1 = $this->expGolombUe(); // pic_width_in_mbs_minus1 + $pic_height_in_map_units_minus1 = $this->expGolombUe(); // pic_height_in_map_units_minus1 + + $frame_mbs_only_flag = $this->getBits(1); // frame_mbs_only_flag + if ($frame_mbs_only_flag == 0) { + $this->skipBits(1); // mb_adaptive_frame_field_flag + } + $this->skipBits(1); // direct_8x8_inference_flag + $frame_cropping_flag = $this->getBits(1); // frame_cropping_flag + + $frame_crop_left_offset = 0; + $frame_crop_right_offset = 0; + $frame_crop_top_offset = 0; + $frame_crop_bottom_offset = 0; + + if ($frame_cropping_flag) { + $frame_crop_left_offset = $this->expGolombUe(); // frame_crop_left_offset + $frame_crop_right_offset = $this->expGolombUe(); // frame_crop_right_offset + $frame_crop_top_offset = $this->expGolombUe(); // frame_crop_top_offset + $frame_crop_bottom_offset = $this->expGolombUe(); // frame_crop_bottom_offset + } + $this->skipBits(1); // vui_parameters_present_flag + // etc + + $this->width = (($pic_width_in_mbs_minus1 + 1) * 16) - ($frame_crop_left_offset * 2) - ($frame_crop_right_offset * 2); + $this->height = ((2 - $frame_mbs_only_flag) * ($pic_height_in_map_units_minus1 + 1) * 16) - ($frame_crop_top_offset * 2) - ($frame_crop_bottom_offset * 2); + } + } + + public function skipBits($bits) { + $newBits = $this->currentBits + $bits; + $this->currentBytes += (int)floor($newBits / 8); + $this->currentBits = $newBits % 8; + } + + public function getBit() { + $result = (getid3_lib::BigEndian2Int(substr($this->sps, $this->currentBytes, 1)) >> (7 - $this->currentBits)) & 0x01; + $this->skipBits(1); + return $result; + } + + public function getBits($bits) { + $result = 0; + for ($i = 0; $i < $bits; $i++) { + $result = ($result << 1) + $this->getBit(); + } + return $result; + } + + public function expGolombUe() { + $significantBits = 0; + $bit = $this->getBit(); + while ($bit == 0) { + $significantBits++; + $bit = $this->getBit(); + + if ($significantBits > 31) { + // something is broken, this is an emergency escape to prevent infinite loops + return 0; + } + } + return (1 << $significantBits) + $this->getBits($significantBits) - 1; + } + + public function expGolombSe() { + $result = $this->expGolombUe(); + if (($result & 0x01) == 0) { + return -($result >> 1); + } else { + return ($result + 1) >> 1; + } + } + + public function getWidth() { + return $this->width; + } + + public function getHeight() { + return $this->height; + } +} diff --git a/www/rompr/getid3/module.audio-video.matroska.php b/www/rompr/getid3/module.audio-video.matroska.php new file mode 100644 index 0000000..0852969 --- /dev/null +++ b/www/rompr/getid3/module.audio-video.matroska.php @@ -0,0 +1,1790 @@ + // +// available at http://getid3.sourceforge.net // +// or http://www.getid3.org // +// also https://github.com/JamesHeinrich/getID3 // +///////////////////////////////////////////////////////////////// +// See readme.txt for more details // +///////////////////////////////////////////////////////////////// +// // +// module.audio-video.matriska.php // +// module for analyzing Matroska containers // +// dependencies: NONE // +// /// +///////////////////////////////////////////////////////////////// + + +define('EBML_ID_CHAPTERS', 0x0043A770); // [10][43][A7][70] -- A system to define basic menus and partition data. For more detailed information, look at the Chapters Explanation. +define('EBML_ID_SEEKHEAD', 0x014D9B74); // [11][4D][9B][74] -- Contains the position of other level 1 elements. +define('EBML_ID_TAGS', 0x0254C367); // [12][54][C3][67] -- Element containing elements specific to Tracks/Chapters. A list of valid tags can be found . +define('EBML_ID_INFO', 0x0549A966); // [15][49][A9][66] -- Contains miscellaneous general information and statistics on the file. +define('EBML_ID_TRACKS', 0x0654AE6B); // [16][54][AE][6B] -- A top-level block of information with many tracks described. +define('EBML_ID_SEGMENT', 0x08538067); // [18][53][80][67] -- This element contains all other top-level (level 1) elements. Typically a Matroska file is composed of 1 segment. +define('EBML_ID_ATTACHMENTS', 0x0941A469); // [19][41][A4][69] -- Contain attached files. +define('EBML_ID_EBML', 0x0A45DFA3); // [1A][45][DF][A3] -- Set the EBML characteristics of the data to follow. Each EBML document has to start with this. +define('EBML_ID_CUES', 0x0C53BB6B); // [1C][53][BB][6B] -- A top-level element to speed seeking access. All entries are local to the segment. +define('EBML_ID_CLUSTER', 0x0F43B675); // [1F][43][B6][75] -- The lower level element containing the (monolithic) Block structure. +define('EBML_ID_LANGUAGE', 0x02B59C); // [22][B5][9C] -- Specifies the language of the track in the Matroska languages form. +define('EBML_ID_TRACKTIMECODESCALE', 0x03314F); // [23][31][4F] -- The scale to apply on this track to work at normal speed in relation with other tracks (mostly used to adjust video speed when the audio length differs). +define('EBML_ID_DEFAULTDURATION', 0x03E383); // [23][E3][83] -- Number of nanoseconds (i.e. not scaled) per frame. +define('EBML_ID_CODECNAME', 0x058688); // [25][86][88] -- A human-readable string specifying the codec. +define('EBML_ID_CODECDOWNLOADURL', 0x06B240); // [26][B2][40] -- A URL to download about the codec used. +define('EBML_ID_TIMECODESCALE', 0x0AD7B1); // [2A][D7][B1] -- Timecode scale in nanoseconds (1.000.000 means all timecodes in the segment are expressed in milliseconds). +define('EBML_ID_COLOURSPACE', 0x0EB524); // [2E][B5][24] -- Same value as in AVI (32 bits). +define('EBML_ID_GAMMAVALUE', 0x0FB523); // [2F][B5][23] -- Gamma Value. +define('EBML_ID_CODECSETTINGS', 0x1A9697); // [3A][96][97] -- A string describing the encoding setting used. +define('EBML_ID_CODECINFOURL', 0x1B4040); // [3B][40][40] -- A URL to find information about the codec used. +define('EBML_ID_PREVFILENAME', 0x1C83AB); // [3C][83][AB] -- An escaped filename corresponding to the previous segment. +define('EBML_ID_PREVUID', 0x1CB923); // [3C][B9][23] -- A unique ID to identify the previous chained segment (128 bits). +define('EBML_ID_NEXTFILENAME', 0x1E83BB); // [3E][83][BB] -- An escaped filename corresponding to the next segment. +define('EBML_ID_NEXTUID', 0x1EB923); // [3E][B9][23] -- A unique ID to identify the next chained segment (128 bits). +define('EBML_ID_CONTENTCOMPALGO', 0x0254); // [42][54] -- The compression algorithm used. Algorithms that have been specified so far are: +define('EBML_ID_CONTENTCOMPSETTINGS', 0x0255); // [42][55] -- Settings that might be needed by the decompressor. For Header Stripping (ContentCompAlgo=3), the bytes that were removed from the beggining of each frames of the track. +define('EBML_ID_DOCTYPE', 0x0282); // [42][82] -- A string that describes the type of document that follows this EBML header ('matroska' in our case). +define('EBML_ID_DOCTYPEREADVERSION', 0x0285); // [42][85] -- The minimum DocType version an interpreter has to support to read this file. +define('EBML_ID_EBMLVERSION', 0x0286); // [42][86] -- The version of EBML parser used to create the file. +define('EBML_ID_DOCTYPEVERSION', 0x0287); // [42][87] -- The version of DocType interpreter used to create the file. +define('EBML_ID_EBMLMAXIDLENGTH', 0x02F2); // [42][F2] -- The maximum length of the IDs you'll find in this file (4 or less in Matroska). +define('EBML_ID_EBMLMAXSIZELENGTH', 0x02F3); // [42][F3] -- The maximum length of the sizes you'll find in this file (8 or less in Matroska). This does not override the element size indicated at the beginning of an element. Elements that have an indicated size which is larger than what is allowed by EBMLMaxSizeLength shall be considered invalid. +define('EBML_ID_EBMLREADVERSION', 0x02F7); // [42][F7] -- The minimum EBML version a parser has to support to read this file. +define('EBML_ID_CHAPLANGUAGE', 0x037C); // [43][7C] -- The languages corresponding to the string, in the bibliographic ISO-639-2 form. +define('EBML_ID_CHAPCOUNTRY', 0x037E); // [43][7E] -- The countries corresponding to the string, same 2 octets as in Internet domains. +define('EBML_ID_SEGMENTFAMILY', 0x0444); // [44][44] -- A randomly generated unique ID that all segments related to each other must use (128 bits). +define('EBML_ID_DATEUTC', 0x0461); // [44][61] -- Date of the origin of timecode (value 0), i.e. production date. +define('EBML_ID_TAGLANGUAGE', 0x047A); // [44][7A] -- Specifies the language of the tag specified, in the Matroska languages form. +define('EBML_ID_TAGDEFAULT', 0x0484); // [44][84] -- Indication to know if this is the default/original language to use for the given tag. +define('EBML_ID_TAGBINARY', 0x0485); // [44][85] -- The values of the Tag if it is binary. Note that this cannot be used in the same SimpleTag as TagString. +define('EBML_ID_TAGSTRING', 0x0487); // [44][87] -- The value of the Tag. +define('EBML_ID_DURATION', 0x0489); // [44][89] -- Duration of the segment (based on TimecodeScale). +define('EBML_ID_CHAPPROCESSPRIVATE', 0x050D); // [45][0D] -- Some optional data attached to the ChapProcessCodecID information. For ChapProcessCodecID = 1, it is the "DVD level" equivalent. +define('EBML_ID_CHAPTERFLAGENABLED', 0x0598); // [45][98] -- Specify wether the chapter is enabled. It can be enabled/disabled by a Control Track. When disabled, the movie should skip all the content between the TimeStart and TimeEnd of this chapter. +define('EBML_ID_TAGNAME', 0x05A3); // [45][A3] -- The name of the Tag that is going to be stored. +define('EBML_ID_EDITIONENTRY', 0x05B9); // [45][B9] -- Contains all information about a segment edition. +define('EBML_ID_EDITIONUID', 0x05BC); // [45][BC] -- A unique ID to identify the edition. It's useful for tagging an edition. +define('EBML_ID_EDITIONFLAGHIDDEN', 0x05BD); // [45][BD] -- If an edition is hidden (1), it should not be available to the user interface (but still to Control Tracks). +define('EBML_ID_EDITIONFLAGDEFAULT', 0x05DB); // [45][DB] -- If a flag is set (1) the edition should be used as the default one. +define('EBML_ID_EDITIONFLAGORDERED', 0x05DD); // [45][DD] -- Specify if the chapters can be defined multiple times and the order to play them is enforced. +define('EBML_ID_FILEDATA', 0x065C); // [46][5C] -- The data of the file. +define('EBML_ID_FILEMIMETYPE', 0x0660); // [46][60] -- MIME type of the file. +define('EBML_ID_FILENAME', 0x066E); // [46][6E] -- Filename of the attached file. +define('EBML_ID_FILEREFERRAL', 0x0675); // [46][75] -- A binary value that a track/codec can refer to when the attachment is needed. +define('EBML_ID_FILEDESCRIPTION', 0x067E); // [46][7E] -- A human-friendly name for the attached file. +define('EBML_ID_FILEUID', 0x06AE); // [46][AE] -- Unique ID representing the file, as random as possible. +define('EBML_ID_CONTENTENCALGO', 0x07E1); // [47][E1] -- The encryption algorithm used. The value '0' means that the contents have not been encrypted but only signed. Predefined values: +define('EBML_ID_CONTENTENCKEYID', 0x07E2); // [47][E2] -- For public key algorithms this is the ID of the public key the data was encrypted with. +define('EBML_ID_CONTENTSIGNATURE', 0x07E3); // [47][E3] -- A cryptographic signature of the contents. +define('EBML_ID_CONTENTSIGKEYID', 0x07E4); // [47][E4] -- This is the ID of the private key the data was signed with. +define('EBML_ID_CONTENTSIGALGO', 0x07E5); // [47][E5] -- The algorithm used for the signature. A value of '0' means that the contents have not been signed but only encrypted. Predefined values: +define('EBML_ID_CONTENTSIGHASHALGO', 0x07E6); // [47][E6] -- The hash algorithm used for the signature. A value of '0' means that the contents have not been signed but only encrypted. Predefined values: +define('EBML_ID_MUXINGAPP', 0x0D80); // [4D][80] -- Muxing application or library ("libmatroska-0.4.3"). +define('EBML_ID_SEEK', 0x0DBB); // [4D][BB] -- Contains a single seek entry to an EBML element. +define('EBML_ID_CONTENTENCODINGORDER', 0x1031); // [50][31] -- Tells when this modification was used during encoding/muxing starting with 0 and counting upwards. The decoder/demuxer has to start with the highest order number it finds and work its way down. This value has to be unique over all ContentEncodingOrder elements in the segment. +define('EBML_ID_CONTENTENCODINGSCOPE', 0x1032); // [50][32] -- A bit field that describes which elements have been modified in this way. Values (big endian) can be OR'ed. Possible values: +define('EBML_ID_CONTENTENCODINGTYPE', 0x1033); // [50][33] -- A value describing what kind of transformation has been done. Possible values: +define('EBML_ID_CONTENTCOMPRESSION', 0x1034); // [50][34] -- Settings describing the compression used. Must be present if the value of ContentEncodingType is 0 and absent otherwise. Each block must be decompressable even if no previous block is available in order not to prevent seeking. +define('EBML_ID_CONTENTENCRYPTION', 0x1035); // [50][35] -- Settings describing the encryption used. Must be present if the value of ContentEncodingType is 1 and absent otherwise. +define('EBML_ID_CUEREFNUMBER', 0x135F); // [53][5F] -- Number of the referenced Block of Track X in the specified Cluster. +define('EBML_ID_NAME', 0x136E); // [53][6E] -- A human-readable track name. +define('EBML_ID_CUEBLOCKNUMBER', 0x1378); // [53][78] -- Number of the Block in the specified Cluster. +define('EBML_ID_TRACKOFFSET', 0x137F); // [53][7F] -- A value to add to the Block's Timecode. This can be used to adjust the playback offset of a track. +define('EBML_ID_SEEKID', 0x13AB); // [53][AB] -- The binary ID corresponding to the element name. +define('EBML_ID_SEEKPOSITION', 0x13AC); // [53][AC] -- The position of the element in the segment in octets (0 = first level 1 element). +define('EBML_ID_STEREOMODE', 0x13B8); // [53][B8] -- Stereo-3D video mode. +define('EBML_ID_OLDSTEREOMODE', 0x13B9); // [53][B9] -- Bogus StereoMode value used in old versions of libmatroska. DO NOT USE. (0: mono, 1: right eye, 2: left eye, 3: both eyes). +define('EBML_ID_PIXELCROPBOTTOM', 0x14AA); // [54][AA] -- The number of video pixels to remove at the bottom of the image (for HDTV content). +define('EBML_ID_DISPLAYWIDTH', 0x14B0); // [54][B0] -- Width of the video frames to display. +define('EBML_ID_DISPLAYUNIT', 0x14B2); // [54][B2] -- Type of the unit for DisplayWidth/Height (0: pixels, 1: centimeters, 2: inches). +define('EBML_ID_ASPECTRATIOTYPE', 0x14B3); // [54][B3] -- Specify the possible modifications to the aspect ratio (0: free resizing, 1: keep aspect ratio, 2: fixed). +define('EBML_ID_DISPLAYHEIGHT', 0x14BA); // [54][BA] -- Height of the video frames to display. +define('EBML_ID_PIXELCROPTOP', 0x14BB); // [54][BB] -- The number of video pixels to remove at the top of the image. +define('EBML_ID_PIXELCROPLEFT', 0x14CC); // [54][CC] -- The number of video pixels to remove on the left of the image. +define('EBML_ID_PIXELCROPRIGHT', 0x14DD); // [54][DD] -- The number of video pixels to remove on the right of the image. +define('EBML_ID_FLAGFORCED', 0x15AA); // [55][AA] -- Set if that track MUST be used during playback. There can be many forced track for a kind (audio, video or subs), the player should select the one which language matches the user preference or the default + forced track. Overlay MAY happen between a forced and non-forced track of the same kind. +define('EBML_ID_MAXBLOCKADDITIONID', 0x15EE); // [55][EE] -- The maximum value of BlockAddID. A value 0 means there is no BlockAdditions for this track. +define('EBML_ID_WRITINGAPP', 0x1741); // [57][41] -- Writing application ("mkvmerge-0.3.3"). +define('EBML_ID_CLUSTERSILENTTRACKS', 0x1854); // [58][54] -- The list of tracks that are not used in that part of the stream. It is useful when using overlay tracks on seeking. Then you should decide what track to use. +define('EBML_ID_CLUSTERSILENTTRACKNUMBER', 0x18D7); // [58][D7] -- One of the track number that are not used from now on in the stream. It could change later if not specified as silent in a further Cluster. +define('EBML_ID_ATTACHEDFILE', 0x21A7); // [61][A7] -- An attached file. +define('EBML_ID_CONTENTENCODING', 0x2240); // [62][40] -- Settings for one content encoding like compression or encryption. +define('EBML_ID_BITDEPTH', 0x2264); // [62][64] -- Bits per sample, mostly used for PCM. +define('EBML_ID_CODECPRIVATE', 0x23A2); // [63][A2] -- Private data only known to the codec. +define('EBML_ID_TARGETS', 0x23C0); // [63][C0] -- Contain all UIDs where the specified meta data apply. It is void to describe everything in the segment. +define('EBML_ID_CHAPTERPHYSICALEQUIV', 0x23C3); // [63][C3] -- Specify the physical equivalent of this ChapterAtom like "DVD" (60) or "SIDE" (50), see complete list of values. +define('EBML_ID_TAGCHAPTERUID', 0x23C4); // [63][C4] -- A unique ID to identify the Chapter(s) the tags belong to. If the value is 0 at this level, the tags apply to all chapters in the Segment. +define('EBML_ID_TAGTRACKUID', 0x23C5); // [63][C5] -- A unique ID to identify the Track(s) the tags belong to. If the value is 0 at this level, the tags apply to all tracks in the Segment. +define('EBML_ID_TAGATTACHMENTUID', 0x23C6); // [63][C6] -- A unique ID to identify the Attachment(s) the tags belong to. If the value is 0 at this level, the tags apply to all the attachments in the Segment. +define('EBML_ID_TAGEDITIONUID', 0x23C9); // [63][C9] -- A unique ID to identify the EditionEntry(s) the tags belong to. If the value is 0 at this level, the tags apply to all editions in the Segment. +define('EBML_ID_TARGETTYPE', 0x23CA); // [63][CA] -- An informational string that can be used to display the logical level of the target like "ALBUM", "TRACK", "MOVIE", "CHAPTER", etc (see TargetType). +define('EBML_ID_TRACKTRANSLATE', 0x2624); // [66][24] -- The track identification for the given Chapter Codec. +define('EBML_ID_TRACKTRANSLATETRACKID', 0x26A5); // [66][A5] -- The binary value used to represent this track in the chapter codec data. The format depends on the ChapProcessCodecID used. +define('EBML_ID_TRACKTRANSLATECODEC', 0x26BF); // [66][BF] -- The chapter codec using this ID (0: Matroska Script, 1: DVD-menu). +define('EBML_ID_TRACKTRANSLATEEDITIONUID', 0x26FC); // [66][FC] -- Specify an edition UID on which this translation applies. When not specified, it means for all editions found in the segment. +define('EBML_ID_SIMPLETAG', 0x27C8); // [67][C8] -- Contains general information about the target. +define('EBML_ID_TARGETTYPEVALUE', 0x28CA); // [68][CA] -- A number to indicate the logical level of the target (see TargetType). +define('EBML_ID_CHAPPROCESSCOMMAND', 0x2911); // [69][11] -- Contains all the commands associated to the Atom. +define('EBML_ID_CHAPPROCESSTIME', 0x2922); // [69][22] -- Defines when the process command should be handled (0: during the whole chapter, 1: before starting playback, 2: after playback of the chapter). +define('EBML_ID_CHAPTERTRANSLATE', 0x2924); // [69][24] -- A tuple of corresponding ID used by chapter codecs to represent this segment. +define('EBML_ID_CHAPPROCESSDATA', 0x2933); // [69][33] -- Contains the command information. The data should be interpreted depending on the ChapProcessCodecID value. For ChapProcessCodecID = 1, the data correspond to the binary DVD cell pre/post commands. +define('EBML_ID_CHAPPROCESS', 0x2944); // [69][44] -- Contains all the commands associated to the Atom. +define('EBML_ID_CHAPPROCESSCODECID', 0x2955); // [69][55] -- Contains the type of the codec used for the processing. A value of 0 means native Matroska processing (to be defined), a value of 1 means the DVD command set is used. More codec IDs can be added later. +define('EBML_ID_CHAPTERTRANSLATEID', 0x29A5); // [69][A5] -- The binary value used to represent this segment in the chapter codec data. The format depends on the ChapProcessCodecID used. +define('EBML_ID_CHAPTERTRANSLATECODEC', 0x29BF); // [69][BF] -- The chapter codec using this ID (0: Matroska Script, 1: DVD-menu). +define('EBML_ID_CHAPTERTRANSLATEEDITIONUID', 0x29FC); // [69][FC] -- Specify an edition UID on which this correspondance applies. When not specified, it means for all editions found in the segment. +define('EBML_ID_CONTENTENCODINGS', 0x2D80); // [6D][80] -- Settings for several content encoding mechanisms like compression or encryption. +define('EBML_ID_MINCACHE', 0x2DE7); // [6D][E7] -- The minimum number of frames a player should be able to cache during playback. If set to 0, the reference pseudo-cache system is not used. +define('EBML_ID_MAXCACHE', 0x2DF8); // [6D][F8] -- The maximum cache size required to store referenced frames in and the current frame. 0 means no cache is needed. +define('EBML_ID_CHAPTERSEGMENTUID', 0x2E67); // [6E][67] -- A segment to play in place of this chapter. Edition ChapterSegmentEditionUID should be used for this segment, otherwise no edition is used. +define('EBML_ID_CHAPTERSEGMENTEDITIONUID', 0x2EBC); // [6E][BC] -- The edition to play from the segment linked in ChapterSegmentUID. +define('EBML_ID_TRACKOVERLAY', 0x2FAB); // [6F][AB] -- Specify that this track is an overlay track for the Track specified (in the u-integer). That means when this track has a gap (see SilentTracks) the overlay track should be used instead. The order of multiple TrackOverlay matters, the first one is the one that should be used. If not found it should be the second, etc. +define('EBML_ID_TAG', 0x3373); // [73][73] -- Element containing elements specific to Tracks/Chapters. +define('EBML_ID_SEGMENTFILENAME', 0x3384); // [73][84] -- A filename corresponding to this segment. +define('EBML_ID_SEGMENTUID', 0x33A4); // [73][A4] -- A randomly generated unique ID to identify the current segment between many others (128 bits). +define('EBML_ID_CHAPTERUID', 0x33C4); // [73][C4] -- A unique ID to identify the Chapter. +define('EBML_ID_TRACKUID', 0x33C5); // [73][C5] -- A unique ID to identify the Track. This should be kept the same when making a direct stream copy of the Track to another file. +define('EBML_ID_ATTACHMENTLINK', 0x3446); // [74][46] -- The UID of an attachment that is used by this codec. +define('EBML_ID_CLUSTERBLOCKADDITIONS', 0x35A1); // [75][A1] -- Contain additional blocks to complete the main one. An EBML parser that has no knowledge of the Block structure could still see and use/skip these data. +define('EBML_ID_CHANNELPOSITIONS', 0x347B); // [7D][7B] -- Table of horizontal angles for each successive channel, see appendix. +define('EBML_ID_OUTPUTSAMPLINGFREQUENCY', 0x38B5); // [78][B5] -- Real output sampling frequency in Hz (used for SBR techniques). +define('EBML_ID_TITLE', 0x3BA9); // [7B][A9] -- General name of the segment. +define('EBML_ID_CHAPTERDISPLAY', 0x00); // [80] -- Contains all possible strings to use for the chapter display. +define('EBML_ID_TRACKTYPE', 0x03); // [83] -- A set of track types coded on 8 bits (1: video, 2: audio, 3: complex, 0x10: logo, 0x11: subtitle, 0x12: buttons, 0x20: control). +define('EBML_ID_CHAPSTRING', 0x05); // [85] -- Contains the string to use as the chapter atom. +define('EBML_ID_CODECID', 0x06); // [86] -- An ID corresponding to the codec, see the codec page for more info. +define('EBML_ID_FLAGDEFAULT', 0x08); // [88] -- Set if that track (audio, video or subs) SHOULD be used if no language found matches the user preference. +define('EBML_ID_CHAPTERTRACKNUMBER', 0x09); // [89] -- UID of the Track to apply this chapter too. In the absense of a control track, choosing this chapter will select the listed Tracks and deselect unlisted tracks. Absense of this element indicates that the Chapter should be applied to any currently used Tracks. +define('EBML_ID_CLUSTERSLICES', 0x0E); // [8E] -- Contains slices description. +define('EBML_ID_CHAPTERTRACK', 0x0F); // [8F] -- List of tracks on which the chapter applies. If this element is not present, all tracks apply +define('EBML_ID_CHAPTERTIMESTART', 0x11); // [91] -- Timecode of the start of Chapter (not scaled). +define('EBML_ID_CHAPTERTIMEEND', 0x12); // [92] -- Timecode of the end of Chapter (timecode excluded, not scaled). +define('EBML_ID_CUEREFTIME', 0x16); // [96] -- Timecode of the referenced Block. +define('EBML_ID_CUEREFCLUSTER', 0x17); // [97] -- Position of the Cluster containing the referenced Block. +define('EBML_ID_CHAPTERFLAGHIDDEN', 0x18); // [98] -- If a chapter is hidden (1), it should not be available to the user interface (but still to Control Tracks). +define('EBML_ID_FLAGINTERLACED', 0x1A); // [9A] -- Set if the video is interlaced. +define('EBML_ID_CLUSTERBLOCKDURATION', 0x1B); // [9B] -- The duration of the Block (based on TimecodeScale). This element is mandatory when DefaultDuration is set for the track. When not written and with no DefaultDuration, the value is assumed to be the difference between the timecode of this Block and the timecode of the next Block in "display" order (not coding order). This element can be useful at the end of a Track (as there is not other Block available), or when there is a break in a track like for subtitle tracks. +define('EBML_ID_FLAGLACING', 0x1C); // [9C] -- Set if the track may contain blocks using lacing. +define('EBML_ID_CHANNELS', 0x1F); // [9F] -- Numbers of channels in the track. +define('EBML_ID_CLUSTERBLOCKGROUP', 0x20); // [A0] -- Basic container of information containing a single Block or BlockVirtual, and information specific to that Block/VirtualBlock. +define('EBML_ID_CLUSTERBLOCK', 0x21); // [A1] -- Block containing the actual data to be rendered and a timecode relative to the Cluster Timecode. +define('EBML_ID_CLUSTERBLOCKVIRTUAL', 0x22); // [A2] -- A Block with no data. It must be stored in the stream at the place the real Block should be in display order. +define('EBML_ID_CLUSTERSIMPLEBLOCK', 0x23); // [A3] -- Similar to Block but without all the extra information, mostly used to reduced overhead when no extra feature is needed. +define('EBML_ID_CLUSTERCODECSTATE', 0x24); // [A4] -- The new codec state to use. Data interpretation is private to the codec. This information should always be referenced by a seek entry. +define('EBML_ID_CLUSTERBLOCKADDITIONAL', 0x25); // [A5] -- Interpreted by the codec as it wishes (using the BlockAddID). +define('EBML_ID_CLUSTERBLOCKMORE', 0x26); // [A6] -- Contain the BlockAdditional and some parameters. +define('EBML_ID_CLUSTERPOSITION', 0x27); // [A7] -- Position of the Cluster in the segment (0 in live broadcast streams). It might help to resynchronise offset on damaged streams. +define('EBML_ID_CODECDECODEALL', 0x2A); // [AA] -- The codec can decode potentially damaged data. +define('EBML_ID_CLUSTERPREVSIZE', 0x2B); // [AB] -- Size of the previous Cluster, in octets. Can be useful for backward playing. +define('EBML_ID_TRACKENTRY', 0x2E); // [AE] -- Describes a track with all elements. +define('EBML_ID_CLUSTERENCRYPTEDBLOCK', 0x2F); // [AF] -- Similar to SimpleBlock but the data inside the Block are Transformed (encrypt and/or signed). +define('EBML_ID_PIXELWIDTH', 0x30); // [B0] -- Width of the encoded video frames in pixels. +define('EBML_ID_CUETIME', 0x33); // [B3] -- Absolute timecode according to the segment time base. +define('EBML_ID_SAMPLINGFREQUENCY', 0x35); // [B5] -- Sampling frequency in Hz. +define('EBML_ID_CHAPTERATOM', 0x36); // [B6] -- Contains the atom information to use as the chapter atom (apply to all tracks). +define('EBML_ID_CUETRACKPOSITIONS', 0x37); // [B7] -- Contain positions for different tracks corresponding to the timecode. +define('EBML_ID_FLAGENABLED', 0x39); // [B9] -- Set if the track is used. +define('EBML_ID_PIXELHEIGHT', 0x3A); // [BA] -- Height of the encoded video frames in pixels. +define('EBML_ID_CUEPOINT', 0x3B); // [BB] -- Contains all information relative to a seek point in the segment. +define('EBML_ID_CRC32', 0x3F); // [BF] -- The CRC is computed on all the data of the Master element it's in, regardless of its position. It's recommended to put the CRC value at the beggining of the Master element for easier reading. All level 1 elements should include a CRC-32. +define('EBML_ID_CLUSTERBLOCKADDITIONID', 0x4B); // [CB] -- The ID of the BlockAdditional element (0 is the main Block). +define('EBML_ID_CLUSTERLACENUMBER', 0x4C); // [CC] -- The reverse number of the frame in the lace (0 is the last frame, 1 is the next to last, etc). While there are a few files in the wild with this element, it is no longer in use and has been deprecated. Being able to interpret this element is not required for playback. +define('EBML_ID_CLUSTERFRAMENUMBER', 0x4D); // [CD] -- The number of the frame to generate from this lace with this delay (allow you to generate many frames from the same Block/Frame). +define('EBML_ID_CLUSTERDELAY', 0x4E); // [CE] -- The (scaled) delay to apply to the element. +define('EBML_ID_CLUSTERDURATION', 0x4F); // [CF] -- The (scaled) duration to apply to the element. +define('EBML_ID_TRACKNUMBER', 0x57); // [D7] -- The track number as used in the Block Header (using more than 127 tracks is not encouraged, though the design allows an unlimited number). +define('EBML_ID_CUEREFERENCE', 0x5B); // [DB] -- The Clusters containing the required referenced Blocks. +define('EBML_ID_VIDEO', 0x60); // [E0] -- Video settings. +define('EBML_ID_AUDIO', 0x61); // [E1] -- Audio settings. +define('EBML_ID_CLUSTERTIMESLICE', 0x68); // [E8] -- Contains extra time information about the data contained in the Block. While there are a few files in the wild with this element, it is no longer in use and has been deprecated. Being able to interpret this element is not required for playback. +define('EBML_ID_CUECODECSTATE', 0x6A); // [EA] -- The position of the Codec State corresponding to this Cue element. 0 means that the data is taken from the initial Track Entry. +define('EBML_ID_CUEREFCODECSTATE', 0x6B); // [EB] -- The position of the Codec State corresponding to this referenced element. 0 means that the data is taken from the initial Track Entry. +define('EBML_ID_VOID', 0x6C); // [EC] -- Used to void damaged data, to avoid unexpected behaviors when using damaged data. The content is discarded. Also used to reserve space in a sub-element for later use. +define('EBML_ID_CLUSTERTIMECODE', 0x67); // [E7] -- Absolute timecode of the cluster (based on TimecodeScale). +define('EBML_ID_CLUSTERBLOCKADDID', 0x6E); // [EE] -- An ID to identify the BlockAdditional level. +define('EBML_ID_CUECLUSTERPOSITION', 0x71); // [F1] -- The position of the Cluster containing the required Block. +define('EBML_ID_CUETRACK', 0x77); // [F7] -- The track for which a position is given. +define('EBML_ID_CLUSTERREFERENCEPRIORITY', 0x7A); // [FA] -- This frame is referenced and has the specified cache priority. In cache only a frame of the same or higher priority can replace this frame. A value of 0 means the frame is not referenced. +define('EBML_ID_CLUSTERREFERENCEBLOCK', 0x7B); // [FB] -- Timecode of another frame used as a reference (ie: B or P frame). The timecode is relative to the block it's attached to. +define('EBML_ID_CLUSTERREFERENCEVIRTUAL', 0x7D); // [FD] -- Relative position of the data that should be in position of the virtual block. + + +/** +* @tutorial http://www.matroska.org/technical/specs/index.html +* +* @todo Rewrite EBML parser to reduce it's size and honor default element values +* @todo After rewrite implement stream size calculation, that will provide additional useful info and enable AAC/FLAC audio bitrate detection +*/ +class getid3_matroska extends getid3_handler +{ + // public options + public static $hide_clusters = true; // if true, do not return information about CLUSTER chunks, since there's a lot of them and they're not usually useful [default: TRUE] + public static $parse_whole_file = false; // true to parse the whole file, not only header [default: FALSE] + + // private parser settings/placeholders + private $EBMLbuffer = ''; + private $EBMLbuffer_offset = 0; + private $EBMLbuffer_length = 0; + private $current_offset = 0; + private $unuseful_elements = array(EBML_ID_CRC32, EBML_ID_VOID); + + public function Analyze() + { + $info = &$this->getid3->info; + + // parse container + try { + $this->parseEBML($info); + } catch (Exception $e) { + $this->error('EBML parser: '.$e->getMessage()); + } + + // calculate playtime + if (isset($info['matroska']['info']) && is_array($info['matroska']['info'])) { + foreach ($info['matroska']['info'] as $key => $infoarray) { + if (isset($infoarray['Duration'])) { + // TimecodeScale is how many nanoseconds each Duration unit is + $info['playtime_seconds'] = $infoarray['Duration'] * ((isset($infoarray['TimecodeScale']) ? $infoarray['TimecodeScale'] : 1000000) / 1000000000); + break; + } + } + } + + // extract tags + if (isset($info['matroska']['tags']) && is_array($info['matroska']['tags'])) { + foreach ($info['matroska']['tags'] as $key => $infoarray) { + $this->ExtractCommentsSimpleTag($infoarray); + } + } + + // process tracks + if (isset($info['matroska']['tracks']['tracks']) && is_array($info['matroska']['tracks']['tracks'])) { + foreach ($info['matroska']['tracks']['tracks'] as $key => $trackarray) { + + $track_info = array(); + $track_info['dataformat'] = self::CodecIDtoCommonName($trackarray['CodecID']); + $track_info['default'] = (isset($trackarray['FlagDefault']) ? $trackarray['FlagDefault'] : true); + if (isset($trackarray['Name'])) { $track_info['name'] = $trackarray['Name']; } + + switch ($trackarray['TrackType']) { + + case 1: // Video + $track_info['resolution_x'] = $trackarray['PixelWidth']; + $track_info['resolution_y'] = $trackarray['PixelHeight']; + $track_info['display_unit'] = self::displayUnit(isset($trackarray['DisplayUnit']) ? $trackarray['DisplayUnit'] : 0); + $track_info['display_x'] = (isset($trackarray['DisplayWidth']) ? $trackarray['DisplayWidth'] : $trackarray['PixelWidth']); + $track_info['display_y'] = (isset($trackarray['DisplayHeight']) ? $trackarray['DisplayHeight'] : $trackarray['PixelHeight']); + + if (isset($trackarray['PixelCropBottom'])) { $track_info['crop_bottom'] = $trackarray['PixelCropBottom']; } + if (isset($trackarray['PixelCropTop'])) { $track_info['crop_top'] = $trackarray['PixelCropTop']; } + if (isset($trackarray['PixelCropLeft'])) { $track_info['crop_left'] = $trackarray['PixelCropLeft']; } + if (isset($trackarray['PixelCropRight'])) { $track_info['crop_right'] = $trackarray['PixelCropRight']; } + if (isset($trackarray['DefaultDuration'])) { $track_info['frame_rate'] = round(1000000000 / $trackarray['DefaultDuration'], 3); } + if (isset($trackarray['CodecName'])) { $track_info['codec'] = $trackarray['CodecName']; } + + switch ($trackarray['CodecID']) { + case 'V_MS/VFW/FOURCC': + getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio-video.riff.php', __FILE__, true); + + $parsed = getid3_riff::ParseBITMAPINFOHEADER($trackarray['CodecPrivate']); + $track_info['codec'] = getid3_riff::fourccLookup($parsed['fourcc']); + $info['matroska']['track_codec_parsed'][$trackarray['TrackNumber']] = $parsed; + break; + + /*case 'V_MPEG4/ISO/AVC': + $h264['profile'] = getid3_lib::BigEndian2Int(substr($trackarray['CodecPrivate'], 1, 1)); + $h264['level'] = getid3_lib::BigEndian2Int(substr($trackarray['CodecPrivate'], 3, 1)); + $rn = getid3_lib::BigEndian2Int(substr($trackarray['CodecPrivate'], 4, 1)); + $h264['NALUlength'] = ($rn & 3) + 1; + $rn = getid3_lib::BigEndian2Int(substr($trackarray['CodecPrivate'], 5, 1)); + $nsps = ($rn & 31); + $offset = 6; + for ($i = 0; $i < $nsps; $i ++) { + $length = getid3_lib::BigEndian2Int(substr($trackarray['CodecPrivate'], $offset, 2)); + $h264['SPS'][] = substr($trackarray['CodecPrivate'], $offset + 2, $length); + $offset += 2 + $length; + } + $npps = getid3_lib::BigEndian2Int(substr($trackarray['CodecPrivate'], $offset, 1)); + $offset += 1; + for ($i = 0; $i < $npps; $i ++) { + $length = getid3_lib::BigEndian2Int(substr($trackarray['CodecPrivate'], $offset, 2)); + $h264['PPS'][] = substr($trackarray['CodecPrivate'], $offset + 2, $length); + $offset += 2 + $length; + } + $info['matroska']['track_codec_parsed'][$trackarray['TrackNumber']] = $h264; + break;*/ + } + + $info['video']['streams'][] = $track_info; + break; + + case 2: // Audio + $track_info['sample_rate'] = (isset($trackarray['SamplingFrequency']) ? $trackarray['SamplingFrequency'] : 8000.0); + $track_info['channels'] = (isset($trackarray['Channels']) ? $trackarray['Channels'] : 1); + $track_info['language'] = (isset($trackarray['Language']) ? $trackarray['Language'] : 'eng'); + if (isset($trackarray['BitDepth'])) { $track_info['bits_per_sample'] = $trackarray['BitDepth']; } + if (isset($trackarray['CodecName'])) { $track_info['codec'] = $trackarray['CodecName']; } + + switch ($trackarray['CodecID']) { + case 'A_PCM/INT/LIT': + case 'A_PCM/INT/BIG': + $track_info['bitrate'] = $trackarray['SamplingFrequency'] * $trackarray['Channels'] * $trackarray['BitDepth']; + break; + + case 'A_AC3': + case 'A_EAC3': + case 'A_DTS': + case 'A_MPEG/L3': + case 'A_MPEG/L2': + case 'A_FLAC': + $module_dataformat = ($track_info['dataformat'] == 'mp2' ? 'mp3' : ($track_info['dataformat'] == 'eac3' ? 'ac3' : $track_info['dataformat'])); + getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio.'.$module_dataformat.'.php', __FILE__, true); + + if (!isset($info['matroska']['track_data_offsets'][$trackarray['TrackNumber']])) { + $this->warning('Unable to parse audio data ['.basename(__FILE__).':'.__LINE__.'] because $info[matroska][track_data_offsets]['.$trackarray['TrackNumber'].'] not set'); + break; + } + + // create temp instance + $getid3_temp = new getID3(); + if ($track_info['dataformat'] != 'flac') { + $getid3_temp->openfile($this->getid3->filename); + } + $getid3_temp->info['avdataoffset'] = $info['matroska']['track_data_offsets'][$trackarray['TrackNumber']]['offset']; + if ($track_info['dataformat'][0] == 'm' || $track_info['dataformat'] == 'flac') { + $getid3_temp->info['avdataend'] = $info['matroska']['track_data_offsets'][$trackarray['TrackNumber']]['offset'] + $info['matroska']['track_data_offsets'][$trackarray['TrackNumber']]['length']; + } + + // analyze + $class = 'getid3_'.$module_dataformat; + $header_data_key = $track_info['dataformat'][0] == 'm' ? 'mpeg' : $track_info['dataformat']; + $getid3_audio = new $class($getid3_temp, __CLASS__); + if ($track_info['dataformat'] == 'flac') { + $getid3_audio->AnalyzeString($trackarray['CodecPrivate']); + } + else { + $getid3_audio->Analyze(); + } + if (!empty($getid3_temp->info[$header_data_key])) { + $info['matroska']['track_codec_parsed'][$trackarray['TrackNumber']] = $getid3_temp->info[$header_data_key]; + if (isset($getid3_temp->info['audio']) && is_array($getid3_temp->info['audio'])) { + foreach ($getid3_temp->info['audio'] as $key => $value) { + $track_info[$key] = $value; + } + } + } + else { + $this->warning('Unable to parse audio data ['.basename(__FILE__).':'.__LINE__.'] because '.$class.'::Analyze() failed at offset '.$getid3_temp->info['avdataoffset']); + } + + // copy errors and warnings + if (!empty($getid3_temp->info['error'])) { + foreach ($getid3_temp->info['error'] as $newerror) { + $this->warning($class.'() says: ['.$newerror.']'); + } + } + if (!empty($getid3_temp->info['warning'])) { + foreach ($getid3_temp->info['warning'] as $newerror) { + $this->warning($class.'() says: ['.$newerror.']'); + } + } + unset($getid3_temp, $getid3_audio); + break; + + case 'A_AAC': + case 'A_AAC/MPEG2/LC': + case 'A_AAC/MPEG2/LC/SBR': + case 'A_AAC/MPEG4/LC': + case 'A_AAC/MPEG4/LC/SBR': + $this->warning($trackarray['CodecID'].' audio data contains no header, audio/video bitrates can\'t be calculated'); + break; + + case 'A_VORBIS': + if (!isset($trackarray['CodecPrivate'])) { + $this->warning('Unable to parse audio data ['.basename(__FILE__).':'.__LINE__.'] because CodecPrivate data not set'); + break; + } + $vorbis_offset = strpos($trackarray['CodecPrivate'], 'vorbis', 1); + if ($vorbis_offset === false) { + $this->warning('Unable to parse audio data ['.basename(__FILE__).':'.__LINE__.'] because CodecPrivate data does not contain "vorbis" keyword'); + break; + } + $vorbis_offset -= 1; + + getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio.ogg.php', __FILE__, true); + + // create temp instance + $getid3_temp = new getID3(); + + // analyze + $getid3_ogg = new getid3_ogg($getid3_temp); + $oggpageinfo['page_seqno'] = 0; + $getid3_ogg->ParseVorbisPageHeader($trackarray['CodecPrivate'], $vorbis_offset, $oggpageinfo); + if (!empty($getid3_temp->info['ogg'])) { + $info['matroska']['track_codec_parsed'][$trackarray['TrackNumber']] = $getid3_temp->info['ogg']; + if (isset($getid3_temp->info['audio']) && is_array($getid3_temp->info['audio'])) { + foreach ($getid3_temp->info['audio'] as $key => $value) { + $track_info[$key] = $value; + } + } + } + + // copy errors and warnings + if (!empty($getid3_temp->info['error'])) { + foreach ($getid3_temp->info['error'] as $newerror) { + $this->warning('getid3_ogg() says: ['.$newerror.']'); + } + } + if (!empty($getid3_temp->info['warning'])) { + foreach ($getid3_temp->info['warning'] as $newerror) { + $this->warning('getid3_ogg() says: ['.$newerror.']'); + } + } + + if (!empty($getid3_temp->info['ogg']['bitrate_nominal'])) { + $track_info['bitrate'] = $getid3_temp->info['ogg']['bitrate_nominal']; + } + unset($getid3_temp, $getid3_ogg, $oggpageinfo, $vorbis_offset); + break; + + case 'A_MS/ACM': + getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio-video.riff.php', __FILE__, true); + + $parsed = getid3_riff::parseWAVEFORMATex($trackarray['CodecPrivate']); + foreach ($parsed as $key => $value) { + if ($key != 'raw') { + $track_info[$key] = $value; + } + } + $info['matroska']['track_codec_parsed'][$trackarray['TrackNumber']] = $parsed; + break; + + default: + $this->warning('Unhandled audio type "'.(isset($trackarray['CodecID']) ? $trackarray['CodecID'] : '').'"'); + break; + } + + $info['audio']['streams'][] = $track_info; + break; + } + } + + if (!empty($info['video']['streams'])) { + $info['video'] = self::getDefaultStreamInfo($info['video']['streams']); + } + if (!empty($info['audio']['streams'])) { + $info['audio'] = self::getDefaultStreamInfo($info['audio']['streams']); + } + } + + // process attachments + if (isset($info['matroska']['attachments']) && $this->getid3->option_save_attachments !== getID3::ATTACHMENTS_NONE) { + foreach ($info['matroska']['attachments'] as $i => $entry) { + if (strpos($entry['FileMimeType'], 'image/') === 0 && !empty($entry['FileData'])) { + $info['matroska']['comments']['picture'][] = array('data' => $entry['FileData'], 'image_mime' => $entry['FileMimeType'], 'filename' => $entry['FileName']); + } + } + } + + // determine mime type + if (!empty($info['video']['streams'])) { + $info['mime_type'] = ($info['matroska']['doctype'] == 'webm' ? 'video/webm' : 'video/x-matroska'); + } elseif (!empty($info['audio']['streams'])) { + $info['mime_type'] = ($info['matroska']['doctype'] == 'webm' ? 'audio/webm' : 'audio/x-matroska'); + } elseif (isset($info['mime_type'])) { + unset($info['mime_type']); + } + + return true; + } + + private function parseEBML(&$info) { + // http://www.matroska.org/technical/specs/index.html#EBMLBasics + $this->current_offset = $info['avdataoffset']; + + while ($this->getEBMLelement($top_element, $info['avdataend'])) { + switch ($top_element['id']) { + + case EBML_ID_EBML: + $info['matroska']['header']['offset'] = $top_element['offset']; + $info['matroska']['header']['length'] = $top_element['length']; + + while ($this->getEBMLelement($element_data, $top_element['end'], true)) { + switch ($element_data['id']) { + + case EBML_ID_EBMLVERSION: + case EBML_ID_EBMLREADVERSION: + case EBML_ID_EBMLMAXIDLENGTH: + case EBML_ID_EBMLMAXSIZELENGTH: + case EBML_ID_DOCTYPEVERSION: + case EBML_ID_DOCTYPEREADVERSION: + $element_data['data'] = getid3_lib::BigEndian2Int($element_data['data']); + break; + + case EBML_ID_DOCTYPE: + $element_data['data'] = getid3_lib::trimNullByte($element_data['data']); + $info['matroska']['doctype'] = $element_data['data']; + $info['fileformat'] = $element_data['data']; + break; + + default: + $this->unhandledElement('header', __LINE__, $element_data); + break; + } + + unset($element_data['offset'], $element_data['end']); + $info['matroska']['header']['elements'][] = $element_data; + } + break; + + case EBML_ID_SEGMENT: + $info['matroska']['segment'][0]['offset'] = $top_element['offset']; + $info['matroska']['segment'][0]['length'] = $top_element['length']; + + while ($this->getEBMLelement($element_data, $top_element['end'])) { + if ($element_data['id'] != EBML_ID_CLUSTER || !self::$hide_clusters) { // collect clusters only if required + $info['matroska']['segments'][] = $element_data; + } + switch ($element_data['id']) { + + case EBML_ID_SEEKHEAD: // Contains the position of other level 1 elements. + + while ($this->getEBMLelement($seek_entry, $element_data['end'])) { + switch ($seek_entry['id']) { + + case EBML_ID_SEEK: // Contains a single seek entry to an EBML element + while ($this->getEBMLelement($sub_seek_entry, $seek_entry['end'], true)) { + + switch ($sub_seek_entry['id']) { + + case EBML_ID_SEEKID: + $seek_entry['target_id'] = self::EBML2Int($sub_seek_entry['data']); + $seek_entry['target_name'] = self::EBMLidName($seek_entry['target_id']); + break; + + case EBML_ID_SEEKPOSITION: + $seek_entry['target_offset'] = $element_data['offset'] + getid3_lib::BigEndian2Int($sub_seek_entry['data']); + break; + + default: + $this->unhandledElement('seekhead.seek', __LINE__, $sub_seek_entry); } + break; + } + if (!isset($seek_entry['target_id'])) { + $this->warning('seek_entry[target_id] unexpectedly not set at '.$seek_entry['offset']); + break; + } + if (($seek_entry['target_id'] != EBML_ID_CLUSTER) || !self::$hide_clusters) { // collect clusters only if required + $info['matroska']['seek'][] = $seek_entry; + } + break; + + default: + $this->unhandledElement('seekhead', __LINE__, $seek_entry); + break; + } + } + break; + + case EBML_ID_TRACKS: // A top-level block of information with many tracks described. + $info['matroska']['tracks'] = $element_data; + + while ($this->getEBMLelement($track_entry, $element_data['end'])) { + switch ($track_entry['id']) { + + case EBML_ID_TRACKENTRY: //subelements: Describes a track with all elements. + + while ($this->getEBMLelement($subelement, $track_entry['end'], array(EBML_ID_VIDEO, EBML_ID_AUDIO, EBML_ID_CONTENTENCODINGS, EBML_ID_CODECPRIVATE))) { + switch ($subelement['id']) { + + case EBML_ID_TRACKNUMBER: + case EBML_ID_TRACKUID: + case EBML_ID_TRACKTYPE: + case EBML_ID_MINCACHE: + case EBML_ID_MAXCACHE: + case EBML_ID_MAXBLOCKADDITIONID: + case EBML_ID_DEFAULTDURATION: // nanoseconds per frame + $track_entry[$subelement['id_name']] = getid3_lib::BigEndian2Int($subelement['data']); + break; + + case EBML_ID_TRACKTIMECODESCALE: + $track_entry[$subelement['id_name']] = getid3_lib::BigEndian2Float($subelement['data']); + break; + + case EBML_ID_CODECID: + case EBML_ID_LANGUAGE: + case EBML_ID_NAME: + case EBML_ID_CODECNAME: + $track_entry[$subelement['id_name']] = getid3_lib::trimNullByte($subelement['data']); + break; + + case EBML_ID_CODECPRIVATE: + $track_entry[$subelement['id_name']] = $this->readEBMLelementData($subelement['length'], true); + break; + + case EBML_ID_FLAGENABLED: + case EBML_ID_FLAGDEFAULT: + case EBML_ID_FLAGFORCED: + case EBML_ID_FLAGLACING: + case EBML_ID_CODECDECODEALL: + $track_entry[$subelement['id_name']] = (bool) getid3_lib::BigEndian2Int($subelement['data']); + break; + + case EBML_ID_VIDEO: + + while ($this->getEBMLelement($sub_subelement, $subelement['end'], true)) { + switch ($sub_subelement['id']) { + + case EBML_ID_PIXELWIDTH: + case EBML_ID_PIXELHEIGHT: + case EBML_ID_PIXELCROPBOTTOM: + case EBML_ID_PIXELCROPTOP: + case EBML_ID_PIXELCROPLEFT: + case EBML_ID_PIXELCROPRIGHT: + case EBML_ID_DISPLAYWIDTH: + case EBML_ID_DISPLAYHEIGHT: + case EBML_ID_DISPLAYUNIT: + case EBML_ID_ASPECTRATIOTYPE: + case EBML_ID_STEREOMODE: + case EBML_ID_OLDSTEREOMODE: + $track_entry[$sub_subelement['id_name']] = getid3_lib::BigEndian2Int($sub_subelement['data']); + break; + + case EBML_ID_FLAGINTERLACED: + $track_entry[$sub_subelement['id_name']] = (bool)getid3_lib::BigEndian2Int($sub_subelement['data']); + break; + + case EBML_ID_GAMMAVALUE: + $track_entry[$sub_subelement['id_name']] = getid3_lib::BigEndian2Float($sub_subelement['data']); + break; + + case EBML_ID_COLOURSPACE: + $track_entry[$sub_subelement['id_name']] = getid3_lib::trimNullByte($sub_subelement['data']); + break; + + default: + $this->unhandledElement('track.video', __LINE__, $sub_subelement); + break; + } + } + break; + + case EBML_ID_AUDIO: + + while ($this->getEBMLelement($sub_subelement, $subelement['end'], true)) { + switch ($sub_subelement['id']) { + + case EBML_ID_CHANNELS: + case EBML_ID_BITDEPTH: + $track_entry[$sub_subelement['id_name']] = getid3_lib::BigEndian2Int($sub_subelement['data']); + break; + + case EBML_ID_SAMPLINGFREQUENCY: + case EBML_ID_OUTPUTSAMPLINGFREQUENCY: + $track_entry[$sub_subelement['id_name']] = getid3_lib::BigEndian2Float($sub_subelement['data']); + break; + + case EBML_ID_CHANNELPOSITIONS: + $track_entry[$sub_subelement['id_name']] = getid3_lib::trimNullByte($sub_subelement['data']); + break; + + default: + $this->unhandledElement('track.audio', __LINE__, $sub_subelement); + break; + } + } + break; + + case EBML_ID_CONTENTENCODINGS: + + while ($this->getEBMLelement($sub_subelement, $subelement['end'])) { + switch ($sub_subelement['id']) { + + case EBML_ID_CONTENTENCODING: + + while ($this->getEBMLelement($sub_sub_subelement, $sub_subelement['end'], array(EBML_ID_CONTENTCOMPRESSION, EBML_ID_CONTENTENCRYPTION))) { + switch ($sub_sub_subelement['id']) { + + case EBML_ID_CONTENTENCODINGORDER: + case EBML_ID_CONTENTENCODINGSCOPE: + case EBML_ID_CONTENTENCODINGTYPE: + $track_entry[$sub_subelement['id_name']][$sub_sub_subelement['id_name']] = getid3_lib::BigEndian2Int($sub_sub_subelement['data']); + break; + + case EBML_ID_CONTENTCOMPRESSION: + + while ($this->getEBMLelement($sub_sub_sub_subelement, $sub_sub_subelement['end'], true)) { + switch ($sub_sub_sub_subelement['id']) { + + case EBML_ID_CONTENTCOMPALGO: + $track_entry[$sub_subelement['id_name']][$sub_sub_subelement['id_name']][$sub_sub_sub_subelement['id_name']] = getid3_lib::BigEndian2Int($sub_sub_sub_subelement['data']); + break; + + case EBML_ID_CONTENTCOMPSETTINGS: + $track_entry[$sub_subelement['id_name']][$sub_sub_subelement['id_name']][$sub_sub_sub_subelement['id_name']] = $sub_sub_sub_subelement['data']; + break; + + default: + $this->unhandledElement('track.contentencodings.contentencoding.contentcompression', __LINE__, $sub_sub_sub_subelement); + break; + } + } + break; + + case EBML_ID_CONTENTENCRYPTION: + + while ($this->getEBMLelement($sub_sub_sub_subelement, $sub_sub_subelement['end'], true)) { + switch ($sub_sub_sub_subelement['id']) { + + case EBML_ID_CONTENTENCALGO: + case EBML_ID_CONTENTSIGALGO: + case EBML_ID_CONTENTSIGHASHALGO: + $track_entry[$sub_subelement['id_name']][$sub_sub_subelement['id_name']][$sub_sub_sub_subelement['id_name']] = getid3_lib::BigEndian2Int($sub_sub_sub_subelement['data']); + break; + + case EBML_ID_CONTENTENCKEYID: + case EBML_ID_CONTENTSIGNATURE: + case EBML_ID_CONTENTSIGKEYID: + $track_entry[$sub_subelement['id_name']][$sub_sub_subelement['id_name']][$sub_sub_sub_subelement['id_name']] = $sub_sub_sub_subelement['data']; + break; + + default: + $this->unhandledElement('track.contentencodings.contentencoding.contentcompression', __LINE__, $sub_sub_sub_subelement); + break; + } + } + break; + + default: + $this->unhandledElement('track.contentencodings.contentencoding', __LINE__, $sub_sub_subelement); + break; + } + } + break; + + default: + $this->unhandledElement('track.contentencodings', __LINE__, $sub_subelement); + break; + } + } + break; + + default: + $this->unhandledElement('track', __LINE__, $subelement); + break; + } + } + + $info['matroska']['tracks']['tracks'][] = $track_entry; + break; + + default: + $this->unhandledElement('tracks', __LINE__, $track_entry); + break; + } + } + break; + + case EBML_ID_INFO: // Contains miscellaneous general information and statistics on the file. + $info_entry = array(); + + while ($this->getEBMLelement($subelement, $element_data['end'], true)) { + switch ($subelement['id']) { + + case EBML_ID_TIMECODESCALE: + $info_entry[$subelement['id_name']] = getid3_lib::BigEndian2Int($subelement['data']); + break; + + case EBML_ID_DURATION: + $info_entry[$subelement['id_name']] = getid3_lib::BigEndian2Float($subelement['data']); + break; + + case EBML_ID_DATEUTC: + $info_entry[$subelement['id_name']] = getid3_lib::BigEndian2Int($subelement['data']); + $info_entry[$subelement['id_name'].'_unix'] = self::EBMLdate2unix($info_entry[$subelement['id_name']]); + break; + + case EBML_ID_SEGMENTUID: + case EBML_ID_PREVUID: + case EBML_ID_NEXTUID: + $info_entry[$subelement['id_name']] = getid3_lib::trimNullByte($subelement['data']); + break; + + case EBML_ID_SEGMENTFAMILY: + $info_entry[$subelement['id_name']][] = getid3_lib::trimNullByte($subelement['data']); + break; + + case EBML_ID_SEGMENTFILENAME: + case EBML_ID_PREVFILENAME: + case EBML_ID_NEXTFILENAME: + case EBML_ID_TITLE: + case EBML_ID_MUXINGAPP: + case EBML_ID_WRITINGAPP: + $info_entry[$subelement['id_name']] = getid3_lib::trimNullByte($subelement['data']); + $info['matroska']['comments'][strtolower($subelement['id_name'])][] = $info_entry[$subelement['id_name']]; + break; + + case EBML_ID_CHAPTERTRANSLATE: + $chaptertranslate_entry = array(); + + while ($this->getEBMLelement($sub_subelement, $subelement['end'], true)) { + switch ($sub_subelement['id']) { + + case EBML_ID_CHAPTERTRANSLATEEDITIONUID: + $chaptertranslate_entry[$sub_subelement['id_name']][] = getid3_lib::BigEndian2Int($sub_subelement['data']); + break; + + case EBML_ID_CHAPTERTRANSLATECODEC: + $chaptertranslate_entry[$sub_subelement['id_name']] = getid3_lib::BigEndian2Int($sub_subelement['data']); + break; + + case EBML_ID_CHAPTERTRANSLATEID: + $chaptertranslate_entry[$sub_subelement['id_name']] = getid3_lib::trimNullByte($sub_subelement['data']); + break; + + default: + $this->unhandledElement('info.chaptertranslate', __LINE__, $sub_subelement); + break; + } + } + $info_entry[$subelement['id_name']] = $chaptertranslate_entry; + break; + + default: + $this->unhandledElement('info', __LINE__, $subelement); + break; + } + } + $info['matroska']['info'][] = $info_entry; + break; + + case EBML_ID_CUES: // A top-level element to speed seeking access. All entries are local to the segment. Should be mandatory for non "live" streams. + if (self::$hide_clusters) { // do not parse cues if hide clusters is "ON" till they point to clusters anyway + $this->current_offset = $element_data['end']; + break; + } + $cues_entry = array(); + + while ($this->getEBMLelement($subelement, $element_data['end'])) { + switch ($subelement['id']) { + + case EBML_ID_CUEPOINT: + $cuepoint_entry = array(); + + while ($this->getEBMLelement($sub_subelement, $subelement['end'], array(EBML_ID_CUETRACKPOSITIONS))) { + switch ($sub_subelement['id']) { + + case EBML_ID_CUETRACKPOSITIONS: + $cuetrackpositions_entry = array(); + + while ($this->getEBMLelement($sub_sub_subelement, $sub_subelement['end'], true)) { + switch ($sub_sub_subelement['id']) { + + case EBML_ID_CUETRACK: + case EBML_ID_CUECLUSTERPOSITION: + case EBML_ID_CUEBLOCKNUMBER: + case EBML_ID_CUECODECSTATE: + $cuetrackpositions_entry[$sub_sub_subelement['id_name']] = getid3_lib::BigEndian2Int($sub_sub_subelement['data']); + break; + + default: + $this->unhandledElement('cues.cuepoint.cuetrackpositions', __LINE__, $sub_sub_subelement); + break; + } + } + $cuepoint_entry[$sub_subelement['id_name']][] = $cuetrackpositions_entry; + break; + + case EBML_ID_CUETIME: + $cuepoint_entry[$sub_subelement['id_name']] = getid3_lib::BigEndian2Int($sub_subelement['data']); + break; + + default: + $this->unhandledElement('cues.cuepoint', __LINE__, $sub_subelement); + break; + } + } + $cues_entry[] = $cuepoint_entry; + break; + + default: + $this->unhandledElement('cues', __LINE__, $subelement); + break; + } + } + $info['matroska']['cues'] = $cues_entry; + break; + + case EBML_ID_TAGS: // Element containing elements specific to Tracks/Chapters. + $tags_entry = array(); + + while ($this->getEBMLelement($subelement, $element_data['end'], false)) { + switch ($subelement['id']) { + + case EBML_ID_TAG: + $tag_entry = array(); + + while ($this->getEBMLelement($sub_subelement, $subelement['end'], false)) { + switch ($sub_subelement['id']) { + + case EBML_ID_TARGETS: + $targets_entry = array(); + + while ($this->getEBMLelement($sub_sub_subelement, $sub_subelement['end'], true)) { + switch ($sub_sub_subelement['id']) { + + case EBML_ID_TARGETTYPEVALUE: + $targets_entry[$sub_sub_subelement['id_name']] = getid3_lib::BigEndian2Int($sub_sub_subelement['data']); + $targets_entry[strtolower($sub_sub_subelement['id_name']).'_long'] = self::TargetTypeValue($targets_entry[$sub_sub_subelement['id_name']]); + break; + + case EBML_ID_TARGETTYPE: + $targets_entry[$sub_sub_subelement['id_name']] = $sub_sub_subelement['data']; + break; + + case EBML_ID_TAGTRACKUID: + case EBML_ID_TAGEDITIONUID: + case EBML_ID_TAGCHAPTERUID: + case EBML_ID_TAGATTACHMENTUID: + $targets_entry[$sub_sub_subelement['id_name']][] = getid3_lib::BigEndian2Int($sub_sub_subelement['data']); + break; + + default: + $this->unhandledElement('tags.tag.targets', __LINE__, $sub_sub_subelement); + break; + } + } + $tag_entry[$sub_subelement['id_name']] = $targets_entry; + break; + + case EBML_ID_SIMPLETAG: + $tag_entry[$sub_subelement['id_name']][] = $this->HandleEMBLSimpleTag($sub_subelement['end']); + break; + + default: + $this->unhandledElement('tags.tag', __LINE__, $sub_subelement); + break; + } + } + $tags_entry[] = $tag_entry; + break; + + default: + $this->unhandledElement('tags', __LINE__, $subelement); + break; + } + } + $info['matroska']['tags'] = $tags_entry; + break; + + case EBML_ID_ATTACHMENTS: // Contain attached files. + + while ($this->getEBMLelement($subelement, $element_data['end'])) { + switch ($subelement['id']) { + + case EBML_ID_ATTACHEDFILE: + $attachedfile_entry = array(); + + while ($this->getEBMLelement($sub_subelement, $subelement['end'], array(EBML_ID_FILEDATA))) { + switch ($sub_subelement['id']) { + + case EBML_ID_FILEDESCRIPTION: + case EBML_ID_FILENAME: + case EBML_ID_FILEMIMETYPE: + $attachedfile_entry[$sub_subelement['id_name']] = $sub_subelement['data']; + break; + + case EBML_ID_FILEDATA: + $attachedfile_entry['data_offset'] = $this->current_offset; + $attachedfile_entry['data_length'] = $sub_subelement['length']; + + $attachedfile_entry[$sub_subelement['id_name']] = $this->saveAttachment( + $attachedfile_entry['FileName'], + $attachedfile_entry['data_offset'], + $attachedfile_entry['data_length']); + + $this->current_offset = $sub_subelement['end']; + break; + + case EBML_ID_FILEUID: + $attachedfile_entry[$sub_subelement['id_name']] = getid3_lib::BigEndian2Int($sub_subelement['data']); + break; + + default: + $this->unhandledElement('attachments.attachedfile', __LINE__, $sub_subelement); + break; + } + } + $info['matroska']['attachments'][] = $attachedfile_entry; + break; + + default: + $this->unhandledElement('attachments', __LINE__, $subelement); + break; + } + } + break; + + case EBML_ID_CHAPTERS: + + while ($this->getEBMLelement($subelement, $element_data['end'])) { + switch ($subelement['id']) { + + case EBML_ID_EDITIONENTRY: + $editionentry_entry = array(); + + while ($this->getEBMLelement($sub_subelement, $subelement['end'], array(EBML_ID_CHAPTERATOM))) { + switch ($sub_subelement['id']) { + + case EBML_ID_EDITIONUID: + $editionentry_entry[$sub_subelement['id_name']] = getid3_lib::BigEndian2Int($sub_subelement['data']); + break; + + case EBML_ID_EDITIONFLAGHIDDEN: + case EBML_ID_EDITIONFLAGDEFAULT: + case EBML_ID_EDITIONFLAGORDERED: + $editionentry_entry[$sub_subelement['id_name']] = (bool)getid3_lib::BigEndian2Int($sub_subelement['data']); + break; + + case EBML_ID_CHAPTERATOM: + $chapteratom_entry = array(); + + while ($this->getEBMLelement($sub_sub_subelement, $sub_subelement['end'], array(EBML_ID_CHAPTERTRACK, EBML_ID_CHAPTERDISPLAY))) { + switch ($sub_sub_subelement['id']) { + + case EBML_ID_CHAPTERSEGMENTUID: + case EBML_ID_CHAPTERSEGMENTEDITIONUID: + $chapteratom_entry[$sub_sub_subelement['id_name']] = $sub_sub_subelement['data']; + break; + + case EBML_ID_CHAPTERFLAGENABLED: + case EBML_ID_CHAPTERFLAGHIDDEN: + $chapteratom_entry[$sub_sub_subelement['id_name']] = (bool)getid3_lib::BigEndian2Int($sub_sub_subelement['data']); + break; + + case EBML_ID_CHAPTERUID: + case EBML_ID_CHAPTERTIMESTART: + case EBML_ID_CHAPTERTIMEEND: + $chapteratom_entry[$sub_sub_subelement['id_name']] = getid3_lib::BigEndian2Int($sub_sub_subelement['data']); + break; + + case EBML_ID_CHAPTERTRACK: + $chaptertrack_entry = array(); + + while ($this->getEBMLelement($sub_sub_sub_subelement, $sub_sub_subelement['end'], true)) { + switch ($sub_sub_sub_subelement['id']) { + + case EBML_ID_CHAPTERTRACKNUMBER: + $chaptertrack_entry[$sub_sub_sub_subelement['id_name']] = getid3_lib::BigEndian2Int($sub_sub_sub_subelement['data']); + break; + + default: + $this->unhandledElement('chapters.editionentry.chapteratom.chaptertrack', __LINE__, $sub_sub_sub_subelement); + break; + } + } + $chapteratom_entry[$sub_sub_subelement['id_name']][] = $chaptertrack_entry; + break; + + case EBML_ID_CHAPTERDISPLAY: + $chapterdisplay_entry = array(); + + while ($this->getEBMLelement($sub_sub_sub_subelement, $sub_sub_subelement['end'], true)) { + switch ($sub_sub_sub_subelement['id']) { + + case EBML_ID_CHAPSTRING: + case EBML_ID_CHAPLANGUAGE: + case EBML_ID_CHAPCOUNTRY: + $chapterdisplay_entry[$sub_sub_sub_subelement['id_name']] = $sub_sub_sub_subelement['data']; + break; + + default: + $this->unhandledElement('chapters.editionentry.chapteratom.chapterdisplay', __LINE__, $sub_sub_sub_subelement); + break; + } + } + $chapteratom_entry[$sub_sub_subelement['id_name']][] = $chapterdisplay_entry; + break; + + default: + $this->unhandledElement('chapters.editionentry.chapteratom', __LINE__, $sub_sub_subelement); + break; + } + } + $editionentry_entry[$sub_subelement['id_name']][] = $chapteratom_entry; + break; + + default: + $this->unhandledElement('chapters.editionentry', __LINE__, $sub_subelement); + break; + } + } + $info['matroska']['chapters'][] = $editionentry_entry; + break; + + default: + $this->unhandledElement('chapters', __LINE__, $subelement); + break; + } + } + break; + + case EBML_ID_CLUSTER: // The lower level element containing the (monolithic) Block structure. + $cluster_entry = array(); + + while ($this->getEBMLelement($subelement, $element_data['end'], array(EBML_ID_CLUSTERSILENTTRACKS, EBML_ID_CLUSTERBLOCKGROUP, EBML_ID_CLUSTERSIMPLEBLOCK))) { + switch ($subelement['id']) { + + case EBML_ID_CLUSTERTIMECODE: + case EBML_ID_CLUSTERPOSITION: + case EBML_ID_CLUSTERPREVSIZE: + $cluster_entry[$subelement['id_name']] = getid3_lib::BigEndian2Int($subelement['data']); + break; + + case EBML_ID_CLUSTERSILENTTRACKS: + $cluster_silent_tracks = array(); + + while ($this->getEBMLelement($sub_subelement, $subelement['end'], true)) { + switch ($sub_subelement['id']) { + + case EBML_ID_CLUSTERSILENTTRACKNUMBER: + $cluster_silent_tracks[] = getid3_lib::BigEndian2Int($sub_subelement['data']); + break; + + default: + $this->unhandledElement('cluster.silenttracks', __LINE__, $sub_subelement); + break; + } + } + $cluster_entry[$subelement['id_name']][] = $cluster_silent_tracks; + break; + + case EBML_ID_CLUSTERBLOCKGROUP: + $cluster_block_group = array('offset' => $this->current_offset); + + while ($this->getEBMLelement($sub_subelement, $subelement['end'], array(EBML_ID_CLUSTERBLOCK))) { + switch ($sub_subelement['id']) { + + case EBML_ID_CLUSTERBLOCK: + $cluster_block_group[$sub_subelement['id_name']] = $this->HandleEMBLClusterBlock($sub_subelement, EBML_ID_CLUSTERBLOCK, $info); + break; + + case EBML_ID_CLUSTERREFERENCEPRIORITY: // unsigned-int + case EBML_ID_CLUSTERBLOCKDURATION: // unsigned-int + $cluster_block_group[$sub_subelement['id_name']] = getid3_lib::BigEndian2Int($sub_subelement['data']); + break; + + case EBML_ID_CLUSTERREFERENCEBLOCK: // signed-int + $cluster_block_group[$sub_subelement['id_name']][] = getid3_lib::BigEndian2Int($sub_subelement['data'], false, true); + break; + + case EBML_ID_CLUSTERCODECSTATE: + $cluster_block_group[$sub_subelement['id_name']] = getid3_lib::trimNullByte($sub_subelement['data']); + break; + + default: + $this->unhandledElement('clusters.blockgroup', __LINE__, $sub_subelement); + break; + } + } + $cluster_entry[$subelement['id_name']][] = $cluster_block_group; + break; + + case EBML_ID_CLUSTERSIMPLEBLOCK: + $cluster_entry[$subelement['id_name']][] = $this->HandleEMBLClusterBlock($subelement, EBML_ID_CLUSTERSIMPLEBLOCK, $info); + break; + + default: + $this->unhandledElement('cluster', __LINE__, $subelement); + break; + } + $this->current_offset = $subelement['end']; + } + if (!self::$hide_clusters) { + $info['matroska']['cluster'][] = $cluster_entry; + } + + // check to see if all the data we need exists already, if so, break out of the loop + if (!self::$parse_whole_file) { + if (isset($info['matroska']['info']) && is_array($info['matroska']['info'])) { + if (isset($info['matroska']['tracks']['tracks']) && is_array($info['matroska']['tracks']['tracks'])) { + if (count($info['matroska']['track_data_offsets']) == count($info['matroska']['tracks']['tracks'])) { + return; + } + } + } + } + break; + + default: + $this->unhandledElement('segment', __LINE__, $element_data); + break; + } + } + break; + + default: + $this->unhandledElement('root', __LINE__, $top_element); + break; + } + } + } + + private function EnsureBufferHasEnoughData($min_data=1024) { + if (($this->current_offset - $this->EBMLbuffer_offset) >= ($this->EBMLbuffer_length - $min_data)) { + $read_bytes = max($min_data, $this->getid3->fread_buffer_size()); + + try { + $this->fseek($this->current_offset); + $this->EBMLbuffer_offset = $this->current_offset; + $this->EBMLbuffer = $this->fread($read_bytes); + $this->EBMLbuffer_length = strlen($this->EBMLbuffer); + } catch (getid3_exception $e) { + $this->warning('EBML parser: '.$e->getMessage()); + return false; + } + + if ($this->EBMLbuffer_length == 0 && $this->feof()) { + return $this->error('EBML parser: ran out of file at offset '.$this->current_offset); + } + } + return true; + } + + private function readEBMLint() { + $actual_offset = $this->current_offset - $this->EBMLbuffer_offset; + + // get length of integer + $first_byte_int = ord($this->EBMLbuffer[$actual_offset]); + if (0x80 & $first_byte_int) { + $length = 1; + } elseif (0x40 & $first_byte_int) { + $length = 2; + } elseif (0x20 & $first_byte_int) { + $length = 3; + } elseif (0x10 & $first_byte_int) { + $length = 4; + } elseif (0x08 & $first_byte_int) { + $length = 5; + } elseif (0x04 & $first_byte_int) { + $length = 6; + } elseif (0x02 & $first_byte_int) { + $length = 7; + } elseif (0x01 & $first_byte_int) { + $length = 8; + } else { + throw new Exception('invalid EBML integer (leading 0x00) at '.$this->current_offset); + } + + // read + $int_value = self::EBML2Int(substr($this->EBMLbuffer, $actual_offset, $length)); + $this->current_offset += $length; + + return $int_value; + } + + private function readEBMLelementData($length, $check_buffer=false) { + if ($check_buffer && !$this->EnsureBufferHasEnoughData($length)) { + return false; + } + $data = substr($this->EBMLbuffer, $this->current_offset - $this->EBMLbuffer_offset, $length); + $this->current_offset += $length; + return $data; + } + + private function getEBMLelement(&$element, $parent_end, $get_data=false) { + if ($this->current_offset >= $parent_end) { + return false; + } + + if (!$this->EnsureBufferHasEnoughData()) { + $this->current_offset = PHP_INT_MAX; // do not exit parser right now, allow to finish current loop to gather maximum information + return false; + } + + $element = array(); + + // set offset + $element['offset'] = $this->current_offset; + + // get ID + $element['id'] = $this->readEBMLint(); + + // get name + $element['id_name'] = self::EBMLidName($element['id']); + + // get length + $element['length'] = $this->readEBMLint(); + + // get end offset + $element['end'] = $this->current_offset + $element['length']; + + // get raw data + $dont_parse = (in_array($element['id'], $this->unuseful_elements) || $element['id_name'] == dechex($element['id'])); + if (($get_data === true || (is_array($get_data) && !in_array($element['id'], $get_data))) && !$dont_parse) { + $element['data'] = $this->readEBMLelementData($element['length'], $element); + } + + return true; + } + + private function unhandledElement($type, $line, $element) { + // warn only about unknown and missed elements, not about unuseful + if (!in_array($element['id'], $this->unuseful_elements)) { + $this->warning('Unhandled '.$type.' element ['.basename(__FILE__).':'.$line.'] ('.$element['id'].'::'.$element['id_name'].' ['.$element['length'].' bytes]) at '.$element['offset']); + } + + // increase offset for unparsed elements + if (!isset($element['data'])) { + $this->current_offset = $element['end']; + } + } + + private function ExtractCommentsSimpleTag($SimpleTagArray) { + if (!empty($SimpleTagArray['SimpleTag'])) { + foreach ($SimpleTagArray['SimpleTag'] as $SimpleTagKey => $SimpleTagData) { + if (!empty($SimpleTagData['TagName']) && !empty($SimpleTagData['TagString'])) { + $this->getid3->info['matroska']['comments'][strtolower($SimpleTagData['TagName'])][] = $SimpleTagData['TagString']; + } + if (!empty($SimpleTagData['SimpleTag'])) { + $this->ExtractCommentsSimpleTag($SimpleTagData); + } + } + } + + return true; + } + + private function HandleEMBLSimpleTag($parent_end) { + $simpletag_entry = array(); + + while ($this->getEBMLelement($element, $parent_end, array(EBML_ID_SIMPLETAG))) { + switch ($element['id']) { + + case EBML_ID_TAGNAME: + case EBML_ID_TAGLANGUAGE: + case EBML_ID_TAGSTRING: + case EBML_ID_TAGBINARY: + $simpletag_entry[$element['id_name']] = $element['data']; + break; + + case EBML_ID_SIMPLETAG: + $simpletag_entry[$element['id_name']][] = $this->HandleEMBLSimpleTag($element['end']); + break; + + case EBML_ID_TAGDEFAULT: + $simpletag_entry[$element['id_name']] = (bool)getid3_lib::BigEndian2Int($element['data']); + break; + + default: + $this->unhandledElement('tag.simpletag', __LINE__, $element); + break; + } + } + + return $simpletag_entry; + } + + private function HandleEMBLClusterBlock($element, $block_type, &$info) { + // http://www.matroska.org/technical/specs/index.html#block_structure + // http://www.matroska.org/technical/specs/index.html#simpleblock_structure + + $block_data = array(); + $block_data['tracknumber'] = $this->readEBMLint(); + $block_data['timecode'] = getid3_lib::BigEndian2Int($this->readEBMLelementData(2), false, true); + $block_data['flags_raw'] = getid3_lib::BigEndian2Int($this->readEBMLelementData(1)); + + if ($block_type == EBML_ID_CLUSTERSIMPLEBLOCK) { + $block_data['flags']['keyframe'] = (($block_data['flags_raw'] & 0x80) >> 7); + //$block_data['flags']['reserved1'] = (($block_data['flags_raw'] & 0x70) >> 4); + } + else { + //$block_data['flags']['reserved1'] = (($block_data['flags_raw'] & 0xF0) >> 4); + } + $block_data['flags']['invisible'] = (bool)(($block_data['flags_raw'] & 0x08) >> 3); + $block_data['flags']['lacing'] = (($block_data['flags_raw'] & 0x06) >> 1); // 00=no lacing; 01=Xiph lacing; 11=EBML lacing; 10=fixed-size lacing + if ($block_type == EBML_ID_CLUSTERSIMPLEBLOCK) { + $block_data['flags']['discardable'] = (($block_data['flags_raw'] & 0x01)); + } + else { + //$block_data['flags']['reserved2'] = (($block_data['flags_raw'] & 0x01) >> 0); + } + $block_data['flags']['lacing_type'] = self::BlockLacingType($block_data['flags']['lacing']); + + // Lace (when lacing bit is set) + if ($block_data['flags']['lacing'] > 0) { + $block_data['lace_frames'] = getid3_lib::BigEndian2Int($this->readEBMLelementData(1)) + 1; // Number of frames in the lace-1 (uint8) + if ($block_data['flags']['lacing'] != 0x02) { + for ($i = 1; $i < $block_data['lace_frames']; $i ++) { // Lace-coded size of each frame of the lace, except for the last one (multiple uint8). *This is not used with Fixed-size lacing as it is calculated automatically from (total size of lace) / (number of frames in lace). + if ($block_data['flags']['lacing'] == 0x03) { // EBML lacing + $block_data['lace_frames_size'][$i] = $this->readEBMLint(); // TODO: read size correctly, calc size for the last frame. For now offsets are deteminded OK with readEBMLint() and that's the most important thing. + } + else { // Xiph lacing + $block_data['lace_frames_size'][$i] = 0; + do { + $size = getid3_lib::BigEndian2Int($this->readEBMLelementData(1)); + $block_data['lace_frames_size'][$i] += $size; + } + while ($size == 255); + } + } + if ($block_data['flags']['lacing'] == 0x01) { // calc size of the last frame only for Xiph lacing, till EBML sizes are now anyway determined incorrectly + $block_data['lace_frames_size'][] = $element['end'] - $this->current_offset - array_sum($block_data['lace_frames_size']); + } + } + } + + if (!isset($info['matroska']['track_data_offsets'][$block_data['tracknumber']])) { + $info['matroska']['track_data_offsets'][$block_data['tracknumber']]['offset'] = $this->current_offset; + $info['matroska']['track_data_offsets'][$block_data['tracknumber']]['length'] = $element['end'] - $this->current_offset; + //$info['matroska']['track_data_offsets'][$block_data['tracknumber']]['total_length'] = 0; + } + //$info['matroska']['track_data_offsets'][$block_data['tracknumber']]['total_length'] += $info['matroska']['track_data_offsets'][$block_data['tracknumber']]['length']; + //$info['matroska']['track_data_offsets'][$block_data['tracknumber']]['duration'] = $block_data['timecode'] * ((isset($info['matroska']['info'][0]['TimecodeScale']) ? $info['matroska']['info'][0]['TimecodeScale'] : 1000000) / 1000000000); + + // set offset manually + $this->current_offset = $element['end']; + + return $block_data; + } + + private static function EBML2Int($EBMLstring) { + // http://matroska.org/specs/ + + // Element ID coded with an UTF-8 like system: + // 1xxx xxxx - Class A IDs (2^7 -2 possible values) (base 0x8X) + // 01xx xxxx xxxx xxxx - Class B IDs (2^14-2 possible values) (base 0x4X 0xXX) + // 001x xxxx xxxx xxxx xxxx xxxx - Class C IDs (2^21-2 possible values) (base 0x2X 0xXX 0xXX) + // 0001 xxxx xxxx xxxx xxxx xxxx xxxx xxxx - Class D IDs (2^28-2 possible values) (base 0x1X 0xXX 0xXX 0xXX) + // Values with all x at 0 and 1 are reserved (hence the -2). + + // Data size, in octets, is also coded with an UTF-8 like system : + // 1xxx xxxx - value 0 to 2^7-2 + // 01xx xxxx xxxx xxxx - value 0 to 2^14-2 + // 001x xxxx xxxx xxxx xxxx xxxx - value 0 to 2^21-2 + // 0001 xxxx xxxx xxxx xxxx xxxx xxxx xxxx - value 0 to 2^28-2 + // 0000 1xxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx - value 0 to 2^35-2 + // 0000 01xx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx - value 0 to 2^42-2 + // 0000 001x xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx - value 0 to 2^49-2 + // 0000 0001 xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx - value 0 to 2^56-2 + + $first_byte_int = ord($EBMLstring[0]); + if (0x80 & $first_byte_int) { + $EBMLstring[0] = chr($first_byte_int & 0x7F); + } elseif (0x40 & $first_byte_int) { + $EBMLstring[0] = chr($first_byte_int & 0x3F); + } elseif (0x20 & $first_byte_int) { + $EBMLstring[0] = chr($first_byte_int & 0x1F); + } elseif (0x10 & $first_byte_int) { + $EBMLstring[0] = chr($first_byte_int & 0x0F); + } elseif (0x08 & $first_byte_int) { + $EBMLstring[0] = chr($first_byte_int & 0x07); + } elseif (0x04 & $first_byte_int) { + $EBMLstring[0] = chr($first_byte_int & 0x03); + } elseif (0x02 & $first_byte_int) { + $EBMLstring[0] = chr($first_byte_int & 0x01); + } elseif (0x01 & $first_byte_int) { + $EBMLstring[0] = chr($first_byte_int & 0x00); + } + + return getid3_lib::BigEndian2Int($EBMLstring); + } + + private static function EBMLdate2unix($EBMLdatestamp) { + // Date - signed 8 octets integer in nanoseconds with 0 indicating the precise beginning of the millennium (at 2001-01-01T00:00:00,000000000 UTC) + // 978307200 == mktime(0, 0, 0, 1, 1, 2001) == January 1, 2001 12:00:00am UTC + return round(($EBMLdatestamp / 1000000000) + 978307200); + } + + public static function TargetTypeValue($target_type) { + // http://www.matroska.org/technical/specs/tagging/index.html + static $TargetTypeValue = array(); + if (empty($TargetTypeValue)) { + $TargetTypeValue[10] = 'A: ~ V:shot'; // the lowest hierarchy found in music or movies + $TargetTypeValue[20] = 'A:subtrack/part/movement ~ V:scene'; // corresponds to parts of a track for audio (like a movement) + $TargetTypeValue[30] = 'A:track/song ~ V:chapter'; // the common parts of an album or a movie + $TargetTypeValue[40] = 'A:part/session ~ V:part/session'; // when an album or episode has different logical parts + $TargetTypeValue[50] = 'A:album/opera/concert ~ V:movie/episode/concert'; // the most common grouping level of music and video (equals to an episode for TV series) + $TargetTypeValue[60] = 'A:edition/issue/volume/opus ~ V:season/sequel/volume'; // a list of lower levels grouped together + $TargetTypeValue[70] = 'A:collection ~ V:collection'; // the high hierarchy consisting of many different lower items + } + return (isset($TargetTypeValue[$target_type]) ? $TargetTypeValue[$target_type] : $target_type); + } + + public static function BlockLacingType($lacingtype) { + // http://matroska.org/technical/specs/index.html#block_structure + static $BlockLacingType = array(); + if (empty($BlockLacingType)) { + $BlockLacingType[0x00] = 'no lacing'; + $BlockLacingType[0x01] = 'Xiph lacing'; + $BlockLacingType[0x02] = 'fixed-size lacing'; + $BlockLacingType[0x03] = 'EBML lacing'; + } + return (isset($BlockLacingType[$lacingtype]) ? $BlockLacingType[$lacingtype] : $lacingtype); + } + + public static function CodecIDtoCommonName($codecid) { + // http://www.matroska.org/technical/specs/codecid/index.html + static $CodecIDlist = array(); + if (empty($CodecIDlist)) { + $CodecIDlist['A_AAC'] = 'aac'; + $CodecIDlist['A_AAC/MPEG2/LC'] = 'aac'; + $CodecIDlist['A_AC3'] = 'ac3'; + $CodecIDlist['A_EAC3'] = 'eac3'; + $CodecIDlist['A_DTS'] = 'dts'; + $CodecIDlist['A_FLAC'] = 'flac'; + $CodecIDlist['A_MPEG/L1'] = 'mp1'; + $CodecIDlist['A_MPEG/L2'] = 'mp2'; + $CodecIDlist['A_MPEG/L3'] = 'mp3'; + $CodecIDlist['A_PCM/INT/LIT'] = 'pcm'; // PCM Integer Little Endian + $CodecIDlist['A_PCM/INT/BIG'] = 'pcm'; // PCM Integer Big Endian + $CodecIDlist['A_QUICKTIME/QDMC'] = 'quicktime'; // Quicktime: QDesign Music + $CodecIDlist['A_QUICKTIME/QDM2'] = 'quicktime'; // Quicktime: QDesign Music v2 + $CodecIDlist['A_VORBIS'] = 'vorbis'; + $CodecIDlist['V_MPEG1'] = 'mpeg'; + $CodecIDlist['V_THEORA'] = 'theora'; + $CodecIDlist['V_REAL/RV40'] = 'real'; + $CodecIDlist['V_REAL/RV10'] = 'real'; + $CodecIDlist['V_REAL/RV20'] = 'real'; + $CodecIDlist['V_REAL/RV30'] = 'real'; + $CodecIDlist['V_QUICKTIME'] = 'quicktime'; // Quicktime + $CodecIDlist['V_MPEG4/ISO/AP'] = 'mpeg4'; + $CodecIDlist['V_MPEG4/ISO/ASP'] = 'mpeg4'; + $CodecIDlist['V_MPEG4/ISO/AVC'] = 'h264'; + $CodecIDlist['V_MPEG4/ISO/SP'] = 'mpeg4'; + $CodecIDlist['V_VP8'] = 'vp8'; + $CodecIDlist['V_MS/VFW/FOURCC'] = 'vcm'; // Microsoft (TM) Video Codec Manager (VCM) + $CodecIDlist['A_MS/ACM'] = 'acm'; // Microsoft (TM) Audio Codec Manager (ACM) + } + return (isset($CodecIDlist[$codecid]) ? $CodecIDlist[$codecid] : $codecid); + } + + private static function EBMLidName($value) { + static $EBMLidList = array(); + if (empty($EBMLidList)) { + $EBMLidList[EBML_ID_ASPECTRATIOTYPE] = 'AspectRatioType'; + $EBMLidList[EBML_ID_ATTACHEDFILE] = 'AttachedFile'; + $EBMLidList[EBML_ID_ATTACHMENTLINK] = 'AttachmentLink'; + $EBMLidList[EBML_ID_ATTACHMENTS] = 'Attachments'; + $EBMLidList[EBML_ID_AUDIO] = 'Audio'; + $EBMLidList[EBML_ID_BITDEPTH] = 'BitDepth'; + $EBMLidList[EBML_ID_CHANNELPOSITIONS] = 'ChannelPositions'; + $EBMLidList[EBML_ID_CHANNELS] = 'Channels'; + $EBMLidList[EBML_ID_CHAPCOUNTRY] = 'ChapCountry'; + $EBMLidList[EBML_ID_CHAPLANGUAGE] = 'ChapLanguage'; + $EBMLidList[EBML_ID_CHAPPROCESS] = 'ChapProcess'; + $EBMLidList[EBML_ID_CHAPPROCESSCODECID] = 'ChapProcessCodecID'; + $EBMLidList[EBML_ID_CHAPPROCESSCOMMAND] = 'ChapProcessCommand'; + $EBMLidList[EBML_ID_CHAPPROCESSDATA] = 'ChapProcessData'; + $EBMLidList[EBML_ID_CHAPPROCESSPRIVATE] = 'ChapProcessPrivate'; + $EBMLidList[EBML_ID_CHAPPROCESSTIME] = 'ChapProcessTime'; + $EBMLidList[EBML_ID_CHAPSTRING] = 'ChapString'; + $EBMLidList[EBML_ID_CHAPTERATOM] = 'ChapterAtom'; + $EBMLidList[EBML_ID_CHAPTERDISPLAY] = 'ChapterDisplay'; + $EBMLidList[EBML_ID_CHAPTERFLAGENABLED] = 'ChapterFlagEnabled'; + $EBMLidList[EBML_ID_CHAPTERFLAGHIDDEN] = 'ChapterFlagHidden'; + $EBMLidList[EBML_ID_CHAPTERPHYSICALEQUIV] = 'ChapterPhysicalEquiv'; + $EBMLidList[EBML_ID_CHAPTERS] = 'Chapters'; + $EBMLidList[EBML_ID_CHAPTERSEGMENTEDITIONUID] = 'ChapterSegmentEditionUID'; + $EBMLidList[EBML_ID_CHAPTERSEGMENTUID] = 'ChapterSegmentUID'; + $EBMLidList[EBML_ID_CHAPTERTIMEEND] = 'ChapterTimeEnd'; + $EBMLidList[EBML_ID_CHAPTERTIMESTART] = 'ChapterTimeStart'; + $EBMLidList[EBML_ID_CHAPTERTRACK] = 'ChapterTrack'; + $EBMLidList[EBML_ID_CHAPTERTRACKNUMBER] = 'ChapterTrackNumber'; + $EBMLidList[EBML_ID_CHAPTERTRANSLATE] = 'ChapterTranslate'; + $EBMLidList[EBML_ID_CHAPTERTRANSLATECODEC] = 'ChapterTranslateCodec'; + $EBMLidList[EBML_ID_CHAPTERTRANSLATEEDITIONUID] = 'ChapterTranslateEditionUID'; + $EBMLidList[EBML_ID_CHAPTERTRANSLATEID] = 'ChapterTranslateID'; + $EBMLidList[EBML_ID_CHAPTERUID] = 'ChapterUID'; + $EBMLidList[EBML_ID_CLUSTER] = 'Cluster'; + $EBMLidList[EBML_ID_CLUSTERBLOCK] = 'ClusterBlock'; + $EBMLidList[EBML_ID_CLUSTERBLOCKADDID] = 'ClusterBlockAddID'; + $EBMLidList[EBML_ID_CLUSTERBLOCKADDITIONAL] = 'ClusterBlockAdditional'; + $EBMLidList[EBML_ID_CLUSTERBLOCKADDITIONID] = 'ClusterBlockAdditionID'; + $EBMLidList[EBML_ID_CLUSTERBLOCKADDITIONS] = 'ClusterBlockAdditions'; + $EBMLidList[EBML_ID_CLUSTERBLOCKDURATION] = 'ClusterBlockDuration'; + $EBMLidList[EBML_ID_CLUSTERBLOCKGROUP] = 'ClusterBlockGroup'; + $EBMLidList[EBML_ID_CLUSTERBLOCKMORE] = 'ClusterBlockMore'; + $EBMLidList[EBML_ID_CLUSTERBLOCKVIRTUAL] = 'ClusterBlockVirtual'; + $EBMLidList[EBML_ID_CLUSTERCODECSTATE] = 'ClusterCodecState'; + $EBMLidList[EBML_ID_CLUSTERDELAY] = 'ClusterDelay'; + $EBMLidList[EBML_ID_CLUSTERDURATION] = 'ClusterDuration'; + $EBMLidList[EBML_ID_CLUSTERENCRYPTEDBLOCK] = 'ClusterEncryptedBlock'; + $EBMLidList[EBML_ID_CLUSTERFRAMENUMBER] = 'ClusterFrameNumber'; + $EBMLidList[EBML_ID_CLUSTERLACENUMBER] = 'ClusterLaceNumber'; + $EBMLidList[EBML_ID_CLUSTERPOSITION] = 'ClusterPosition'; + $EBMLidList[EBML_ID_CLUSTERPREVSIZE] = 'ClusterPrevSize'; + $EBMLidList[EBML_ID_CLUSTERREFERENCEBLOCK] = 'ClusterReferenceBlock'; + $EBMLidList[EBML_ID_CLUSTERREFERENCEPRIORITY] = 'ClusterReferencePriority'; + $EBMLidList[EBML_ID_CLUSTERREFERENCEVIRTUAL] = 'ClusterReferenceVirtual'; + $EBMLidList[EBML_ID_CLUSTERSILENTTRACKNUMBER] = 'ClusterSilentTrackNumber'; + $EBMLidList[EBML_ID_CLUSTERSILENTTRACKS] = 'ClusterSilentTracks'; + $EBMLidList[EBML_ID_CLUSTERSIMPLEBLOCK] = 'ClusterSimpleBlock'; + $EBMLidList[EBML_ID_CLUSTERTIMECODE] = 'ClusterTimecode'; + $EBMLidList[EBML_ID_CLUSTERTIMESLICE] = 'ClusterTimeSlice'; + $EBMLidList[EBML_ID_CODECDECODEALL] = 'CodecDecodeAll'; + $EBMLidList[EBML_ID_CODECDOWNLOADURL] = 'CodecDownloadURL'; + $EBMLidList[EBML_ID_CODECID] = 'CodecID'; + $EBMLidList[EBML_ID_CODECINFOURL] = 'CodecInfoURL'; + $EBMLidList[EBML_ID_CODECNAME] = 'CodecName'; + $EBMLidList[EBML_ID_CODECPRIVATE] = 'CodecPrivate'; + $EBMLidList[EBML_ID_CODECSETTINGS] = 'CodecSettings'; + $EBMLidList[EBML_ID_COLOURSPACE] = 'ColourSpace'; + $EBMLidList[EBML_ID_CONTENTCOMPALGO] = 'ContentCompAlgo'; + $EBMLidList[EBML_ID_CONTENTCOMPRESSION] = 'ContentCompression'; + $EBMLidList[EBML_ID_CONTENTCOMPSETTINGS] = 'ContentCompSettings'; + $EBMLidList[EBML_ID_CONTENTENCALGO] = 'ContentEncAlgo'; + $EBMLidList[EBML_ID_CONTENTENCKEYID] = 'ContentEncKeyID'; + $EBMLidList[EBML_ID_CONTENTENCODING] = 'ContentEncoding'; + $EBMLidList[EBML_ID_CONTENTENCODINGORDER] = 'ContentEncodingOrder'; + $EBMLidList[EBML_ID_CONTENTENCODINGS] = 'ContentEncodings'; + $EBMLidList[EBML_ID_CONTENTENCODINGSCOPE] = 'ContentEncodingScope'; + $EBMLidList[EBML_ID_CONTENTENCODINGTYPE] = 'ContentEncodingType'; + $EBMLidList[EBML_ID_CONTENTENCRYPTION] = 'ContentEncryption'; + $EBMLidList[EBML_ID_CONTENTSIGALGO] = 'ContentSigAlgo'; + $EBMLidList[EBML_ID_CONTENTSIGHASHALGO] = 'ContentSigHashAlgo'; + $EBMLidList[EBML_ID_CONTENTSIGKEYID] = 'ContentSigKeyID'; + $EBMLidList[EBML_ID_CONTENTSIGNATURE] = 'ContentSignature'; + $EBMLidList[EBML_ID_CRC32] = 'CRC32'; + $EBMLidList[EBML_ID_CUEBLOCKNUMBER] = 'CueBlockNumber'; + $EBMLidList[EBML_ID_CUECLUSTERPOSITION] = 'CueClusterPosition'; + $EBMLidList[EBML_ID_CUECODECSTATE] = 'CueCodecState'; + $EBMLidList[EBML_ID_CUEPOINT] = 'CuePoint'; + $EBMLidList[EBML_ID_CUEREFCLUSTER] = 'CueRefCluster'; + $EBMLidList[EBML_ID_CUEREFCODECSTATE] = 'CueRefCodecState'; + $EBMLidList[EBML_ID_CUEREFERENCE] = 'CueReference'; + $EBMLidList[EBML_ID_CUEREFNUMBER] = 'CueRefNumber'; + $EBMLidList[EBML_ID_CUEREFTIME] = 'CueRefTime'; + $EBMLidList[EBML_ID_CUES] = 'Cues'; + $EBMLidList[EBML_ID_CUETIME] = 'CueTime'; + $EBMLidList[EBML_ID_CUETRACK] = 'CueTrack'; + $EBMLidList[EBML_ID_CUETRACKPOSITIONS] = 'CueTrackPositions'; + $EBMLidList[EBML_ID_DATEUTC] = 'DateUTC'; + $EBMLidList[EBML_ID_DEFAULTDURATION] = 'DefaultDuration'; + $EBMLidList[EBML_ID_DISPLAYHEIGHT] = 'DisplayHeight'; + $EBMLidList[EBML_ID_DISPLAYUNIT] = 'DisplayUnit'; + $EBMLidList[EBML_ID_DISPLAYWIDTH] = 'DisplayWidth'; + $EBMLidList[EBML_ID_DOCTYPE] = 'DocType'; + $EBMLidList[EBML_ID_DOCTYPEREADVERSION] = 'DocTypeReadVersion'; + $EBMLidList[EBML_ID_DOCTYPEVERSION] = 'DocTypeVersion'; + $EBMLidList[EBML_ID_DURATION] = 'Duration'; + $EBMLidList[EBML_ID_EBML] = 'EBML'; + $EBMLidList[EBML_ID_EBMLMAXIDLENGTH] = 'EBMLMaxIDLength'; + $EBMLidList[EBML_ID_EBMLMAXSIZELENGTH] = 'EBMLMaxSizeLength'; + $EBMLidList[EBML_ID_EBMLREADVERSION] = 'EBMLReadVersion'; + $EBMLidList[EBML_ID_EBMLVERSION] = 'EBMLVersion'; + $EBMLidList[EBML_ID_EDITIONENTRY] = 'EditionEntry'; + $EBMLidList[EBML_ID_EDITIONFLAGDEFAULT] = 'EditionFlagDefault'; + $EBMLidList[EBML_ID_EDITIONFLAGHIDDEN] = 'EditionFlagHidden'; + $EBMLidList[EBML_ID_EDITIONFLAGORDERED] = 'EditionFlagOrdered'; + $EBMLidList[EBML_ID_EDITIONUID] = 'EditionUID'; + $EBMLidList[EBML_ID_FILEDATA] = 'FileData'; + $EBMLidList[EBML_ID_FILEDESCRIPTION] = 'FileDescription'; + $EBMLidList[EBML_ID_FILEMIMETYPE] = 'FileMimeType'; + $EBMLidList[EBML_ID_FILENAME] = 'FileName'; + $EBMLidList[EBML_ID_FILEREFERRAL] = 'FileReferral'; + $EBMLidList[EBML_ID_FILEUID] = 'FileUID'; + $EBMLidList[EBML_ID_FLAGDEFAULT] = 'FlagDefault'; + $EBMLidList[EBML_ID_FLAGENABLED] = 'FlagEnabled'; + $EBMLidList[EBML_ID_FLAGFORCED] = 'FlagForced'; + $EBMLidList[EBML_ID_FLAGINTERLACED] = 'FlagInterlaced'; + $EBMLidList[EBML_ID_FLAGLACING] = 'FlagLacing'; + $EBMLidList[EBML_ID_GAMMAVALUE] = 'GammaValue'; + $EBMLidList[EBML_ID_INFO] = 'Info'; + $EBMLidList[EBML_ID_LANGUAGE] = 'Language'; + $EBMLidList[EBML_ID_MAXBLOCKADDITIONID] = 'MaxBlockAdditionID'; + $EBMLidList[EBML_ID_MAXCACHE] = 'MaxCache'; + $EBMLidList[EBML_ID_MINCACHE] = 'MinCache'; + $EBMLidList[EBML_ID_MUXINGAPP] = 'MuxingApp'; + $EBMLidList[EBML_ID_NAME] = 'Name'; + $EBMLidList[EBML_ID_NEXTFILENAME] = 'NextFilename'; + $EBMLidList[EBML_ID_NEXTUID] = 'NextUID'; + $EBMLidList[EBML_ID_OUTPUTSAMPLINGFREQUENCY] = 'OutputSamplingFrequency'; + $EBMLidList[EBML_ID_PIXELCROPBOTTOM] = 'PixelCropBottom'; + $EBMLidList[EBML_ID_PIXELCROPLEFT] = 'PixelCropLeft'; + $EBMLidList[EBML_ID_PIXELCROPRIGHT] = 'PixelCropRight'; + $EBMLidList[EBML_ID_PIXELCROPTOP] = 'PixelCropTop'; + $EBMLidList[EBML_ID_PIXELHEIGHT] = 'PixelHeight'; + $EBMLidList[EBML_ID_PIXELWIDTH] = 'PixelWidth'; + $EBMLidList[EBML_ID_PREVFILENAME] = 'PrevFilename'; + $EBMLidList[EBML_ID_PREVUID] = 'PrevUID'; + $EBMLidList[EBML_ID_SAMPLINGFREQUENCY] = 'SamplingFrequency'; + $EBMLidList[EBML_ID_SEEK] = 'Seek'; + $EBMLidList[EBML_ID_SEEKHEAD] = 'SeekHead'; + $EBMLidList[EBML_ID_SEEKID] = 'SeekID'; + $EBMLidList[EBML_ID_SEEKPOSITION] = 'SeekPosition'; + $EBMLidList[EBML_ID_SEGMENT] = 'Segment'; + $EBMLidList[EBML_ID_SEGMENTFAMILY] = 'SegmentFamily'; + $EBMLidList[EBML_ID_SEGMENTFILENAME] = 'SegmentFilename'; + $EBMLidList[EBML_ID_SEGMENTUID] = 'SegmentUID'; + $EBMLidList[EBML_ID_SIMPLETAG] = 'SimpleTag'; + $EBMLidList[EBML_ID_CLUSTERSLICES] = 'ClusterSlices'; + $EBMLidList[EBML_ID_STEREOMODE] = 'StereoMode'; + $EBMLidList[EBML_ID_OLDSTEREOMODE] = 'OldStereoMode'; + $EBMLidList[EBML_ID_TAG] = 'Tag'; + $EBMLidList[EBML_ID_TAGATTACHMENTUID] = 'TagAttachmentUID'; + $EBMLidList[EBML_ID_TAGBINARY] = 'TagBinary'; + $EBMLidList[EBML_ID_TAGCHAPTERUID] = 'TagChapterUID'; + $EBMLidList[EBML_ID_TAGDEFAULT] = 'TagDefault'; + $EBMLidList[EBML_ID_TAGEDITIONUID] = 'TagEditionUID'; + $EBMLidList[EBML_ID_TAGLANGUAGE] = 'TagLanguage'; + $EBMLidList[EBML_ID_TAGNAME] = 'TagName'; + $EBMLidList[EBML_ID_TAGTRACKUID] = 'TagTrackUID'; + $EBMLidList[EBML_ID_TAGS] = 'Tags'; + $EBMLidList[EBML_ID_TAGSTRING] = 'TagString'; + $EBMLidList[EBML_ID_TARGETS] = 'Targets'; + $EBMLidList[EBML_ID_TARGETTYPE] = 'TargetType'; + $EBMLidList[EBML_ID_TARGETTYPEVALUE] = 'TargetTypeValue'; + $EBMLidList[EBML_ID_TIMECODESCALE] = 'TimecodeScale'; + $EBMLidList[EBML_ID_TITLE] = 'Title'; + $EBMLidList[EBML_ID_TRACKENTRY] = 'TrackEntry'; + $EBMLidList[EBML_ID_TRACKNUMBER] = 'TrackNumber'; + $EBMLidList[EBML_ID_TRACKOFFSET] = 'TrackOffset'; + $EBMLidList[EBML_ID_TRACKOVERLAY] = 'TrackOverlay'; + $EBMLidList[EBML_ID_TRACKS] = 'Tracks'; + $EBMLidList[EBML_ID_TRACKTIMECODESCALE] = 'TrackTimecodeScale'; + $EBMLidList[EBML_ID_TRACKTRANSLATE] = 'TrackTranslate'; + $EBMLidList[EBML_ID_TRACKTRANSLATECODEC] = 'TrackTranslateCodec'; + $EBMLidList[EBML_ID_TRACKTRANSLATEEDITIONUID] = 'TrackTranslateEditionUID'; + $EBMLidList[EBML_ID_TRACKTRANSLATETRACKID] = 'TrackTranslateTrackID'; + $EBMLidList[EBML_ID_TRACKTYPE] = 'TrackType'; + $EBMLidList[EBML_ID_TRACKUID] = 'TrackUID'; + $EBMLidList[EBML_ID_VIDEO] = 'Video'; + $EBMLidList[EBML_ID_VOID] = 'Void'; + $EBMLidList[EBML_ID_WRITINGAPP] = 'WritingApp'; + } + + return (isset($EBMLidList[$value]) ? $EBMLidList[$value] : dechex($value)); + } + + public static function displayUnit($value) { + // http://www.matroska.org/technical/specs/index.html#DisplayUnit + static $units = array( + 0 => 'pixels', + 1 => 'centimeters', + 2 => 'inches', + 3 => 'Display Aspect Ratio'); + + return (isset($units[$value]) ? $units[$value] : 'unknown'); + } + + private static function getDefaultStreamInfo($streams) + { + foreach (array_reverse($streams) as $stream) { + if ($stream['default']) { + break; + } + } + + $unset = array('default', 'name'); + foreach ($unset as $u) { + if (isset($stream[$u])) { + unset($stream[$u]); + } + } + + $info = $stream; + $info['streams'] = $streams; + + return $info; + } + +} diff --git a/www/rompr/getid3/module.audio-video.mpeg.php b/www/rompr/getid3/module.audio-video.mpeg.php new file mode 100644 index 0000000..044481f --- /dev/null +++ b/www/rompr/getid3/module.audio-video.mpeg.php @@ -0,0 +1,606 @@ + // +// available at http://getid3.sourceforge.net // +// or http://www.getid3.org // +// also https://github.com/JamesHeinrich/getID3 // +///////////////////////////////////////////////////////////////// +// See readme.txt for more details // +///////////////////////////////////////////////////////////////// +// // +// module.audio-video.mpeg.php // +// module for analyzing MPEG files // +// dependencies: module.audio.mp3.php // +// /// +///////////////////////////////////////////////////////////////// + +getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio.mp3.php', __FILE__, true); + +class getid3_mpeg extends getid3_handler { + + const START_CODE_BASE = "\x00\x00\x01"; + const VIDEO_PICTURE_START = "\x00\x00\x01\x00"; + const VIDEO_USER_DATA_START = "\x00\x00\x01\xB2"; + const VIDEO_SEQUENCE_HEADER = "\x00\x00\x01\xB3"; + const VIDEO_SEQUENCE_ERROR = "\x00\x00\x01\xB4"; + const VIDEO_EXTENSION_START = "\x00\x00\x01\xB5"; + const VIDEO_SEQUENCE_END = "\x00\x00\x01\xB7"; + const VIDEO_GROUP_START = "\x00\x00\x01\xB8"; + const AUDIO_START = "\x00\x00\x01\xC0"; + + + public function Analyze() { + $info = &$this->getid3->info; + + $info['fileformat'] = 'mpeg'; + $this->fseek($info['avdataoffset']); + + $MPEGstreamData = $this->fread($this->getid3->option_fread_buffer_size); + $MPEGstreamBaseOffset = 0; // how far are we from the beginning of the file data ($info['avdataoffset']) + $MPEGstreamDataOffset = 0; // how far are we from the beginning of the buffer data (~32kB) + + $StartCodeValue = false; + $prevStartCodeValue = false; + + $GOPcounter = -1; + $FramesByGOP = array(); + $ParsedAVchannels = array(); + + do { +//echo $MPEGstreamDataOffset.' vs '.(strlen($MPEGstreamData) - 1024).'
      '; + if ($MPEGstreamDataOffset > (strlen($MPEGstreamData) - 16384)) { + // buffer running low, get more data +//echo 'reading more data
      '; + $MPEGstreamData .= $this->fread($this->getid3->option_fread_buffer_size); + if (strlen($MPEGstreamData) > $this->getid3->option_fread_buffer_size) { + $MPEGstreamData = substr($MPEGstreamData, $MPEGstreamDataOffset); + $MPEGstreamBaseOffset += $MPEGstreamDataOffset; + $MPEGstreamDataOffset = 0; + } + } + if (($StartCodeOffset = strpos($MPEGstreamData, self::START_CODE_BASE, $MPEGstreamDataOffset)) === false) { +//echo 'no more start codes found.
      '; + break; + } else { + $MPEGstreamDataOffset = $StartCodeOffset; + $prevStartCodeValue = $StartCodeValue; + $StartCodeValue = ord(substr($MPEGstreamData, $StartCodeOffset + 3, 1)); +//echo 'Found "'.strtoupper(dechex($StartCodeValue)).'" at offset '.($MPEGstreamBaseOffset + $StartCodeOffset).' ($MPEGstreamDataOffset = '.$MPEGstreamDataOffset.')
      '; + } + $MPEGstreamDataOffset += 4; + switch ($StartCodeValue) { + + case 0x00: // picture_start_code + if (!empty($info['mpeg']['video']['bitrate_mode']) && ($info['mpeg']['video']['bitrate_mode'] == 'vbr')) { + $bitstream = getid3_lib::BigEndian2Bin(substr($MPEGstreamData, $StartCodeOffset + 4, 4)); + $bitstreamoffset = 0; + + $PictureHeader = array(); + + $PictureHeader['temporal_reference'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 10); // 10-bit unsigned integer associated with each input picture. It is incremented by one, modulo 1024, for each input frame. When a frame is coded as two fields the temporal reference in the picture header of both fields is the same. Following a group start header the temporal reference of the earliest picture (in display order) shall be reset to zero. + $PictureHeader['picture_coding_type'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 3); // 3 bits for picture_coding_type + $PictureHeader['vbv_delay'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 16); // 16 bits for vbv_delay + //... etc + + $FramesByGOP[$GOPcounter][] = $PictureHeader; + } + break; + + case 0xB3: // sequence_header_code + /* + Note: purposely doing the less-pretty (and probably a bit slower) method of using string of bits rather than bitwise operations. + Mostly because PHP 32-bit doesn't handle unsigned integers well for bitwise operation. + Also the MPEG stream is designed as a bitstream and often doesn't align nicely with byte boundaries. + */ + $info['video']['codec'] = 'MPEG-1'; // will be updated if extension_start_code found + + $bitstream = getid3_lib::BigEndian2Bin(substr($MPEGstreamData, $StartCodeOffset + 4, 8)); + $bitstreamoffset = 0; + + $info['mpeg']['video']['raw']['horizontal_size_value'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 12); // 12 bits for horizontal frame size. Note: horizontal_size_extension, if present, will add 2 most-significant bits to this value + $info['mpeg']['video']['raw']['vertical_size_value'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 12); // 12 bits for vertical frame size. Note: vertical_size_extension, if present, will add 2 most-significant bits to this value + $info['mpeg']['video']['raw']['aspect_ratio_information'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 4); // 4 bits for aspect_ratio_information + $info['mpeg']['video']['raw']['frame_rate_code'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 4); // 4 bits for Frame Rate id code + $info['mpeg']['video']['raw']['bitrate'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 18); // 18 bits for bit_rate_value (18 set bits = VBR, otherwise bitrate = this value * 400) + $marker_bit = self::readBitsFromStream($bitstream, $bitstreamoffset, 1); // The term "marker_bit" indicates a one bit field in which the value zero is forbidden. These marker bits are introduced at several points in the syntax to avoid start code emulation. + $info['mpeg']['video']['raw']['vbv_buffer_size'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 10); // 10 bits vbv_buffer_size_value + $info['mpeg']['video']['raw']['constrained_param_flag'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 1); // 1 bit flag: constrained_param_flag + $info['mpeg']['video']['raw']['load_intra_quantiser_matrix'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 1); // 1 bit flag: load_intra_quantiser_matrix + + if ($info['mpeg']['video']['raw']['load_intra_quantiser_matrix']) { + $bitstream .= getid3_lib::BigEndian2Bin(substr($MPEGstreamData, $StartCodeOffset + 12, 64)); + for ($i = 0; $i < 64; $i++) { + $info['mpeg']['video']['raw']['intra_quantiser_matrix'][$i] = self::readBitsFromStream($bitstream, $bitstreamoffset, 8); + } + } + $info['mpeg']['video']['raw']['load_non_intra_quantiser_matrix'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 1); + + if ($info['mpeg']['video']['raw']['load_non_intra_quantiser_matrix']) { + $bitstream .= getid3_lib::BigEndian2Bin(substr($MPEGstreamData, $StartCodeOffset + 12 + ($info['mpeg']['video']['raw']['load_intra_quantiser_matrix'] ? 64 : 0), 64)); + for ($i = 0; $i < 64; $i++) { + $info['mpeg']['video']['raw']['non_intra_quantiser_matrix'][$i] = self::readBitsFromStream($bitstream, $bitstreamoffset, 8); + } + } + + $info['mpeg']['video']['pixel_aspect_ratio'] = self::videoAspectRatioLookup($info['mpeg']['video']['raw']['aspect_ratio_information']); + $info['mpeg']['video']['pixel_aspect_ratio_text'] = self::videoAspectRatioTextLookup($info['mpeg']['video']['raw']['aspect_ratio_information']); + $info['mpeg']['video']['frame_rate'] = self::videoFramerateLookup($info['mpeg']['video']['raw']['frame_rate_code']); + if ($info['mpeg']['video']['raw']['bitrate'] == 0x3FFFF) { // 18 set bits = VBR + //$this->warning('This version of getID3() ['.$this->getid3->version().'] cannot determine average bitrate of VBR MPEG video files'); + $info['mpeg']['video']['bitrate_mode'] = 'vbr'; + } else { + $info['mpeg']['video']['bitrate'] = $info['mpeg']['video']['raw']['bitrate'] * 400; + $info['mpeg']['video']['bitrate_mode'] = 'cbr'; + $info['video']['bitrate'] = $info['mpeg']['video']['bitrate']; + } + $info['video']['resolution_x'] = $info['mpeg']['video']['raw']['horizontal_size_value']; + $info['video']['resolution_y'] = $info['mpeg']['video']['raw']['vertical_size_value']; + $info['video']['frame_rate'] = $info['mpeg']['video']['frame_rate']; + $info['video']['bitrate_mode'] = $info['mpeg']['video']['bitrate_mode']; + $info['video']['pixel_aspect_ratio'] = $info['mpeg']['video']['pixel_aspect_ratio']; + $info['video']['lossless'] = false; + $info['video']['bits_per_sample'] = 24; + break; + + case 0xB5: // extension_start_code + $info['video']['codec'] = 'MPEG-2'; + + $bitstream = getid3_lib::BigEndian2Bin(substr($MPEGstreamData, $StartCodeOffset + 4, 8)); // 48 bits for Sequence Extension ID; 61 bits for Sequence Display Extension ID; 59 bits for Sequence Scalable Extension ID + $bitstreamoffset = 0; + + $info['mpeg']['video']['raw']['extension_start_code_identifier'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 4); // 4 bits for extension_start_code_identifier +//echo $info['mpeg']['video']['raw']['extension_start_code_identifier'].'
      '; + switch ($info['mpeg']['video']['raw']['extension_start_code_identifier']) { + case 1: // 0001 Sequence Extension ID + $info['mpeg']['video']['raw']['profile_and_level_indication'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 8); // 8 bits for profile_and_level_indication + $info['mpeg']['video']['raw']['progressive_sequence'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 1); // 1 bit flag: progressive_sequence + $info['mpeg']['video']['raw']['chroma_format'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 2); // 2 bits for chroma_format + $info['mpeg']['video']['raw']['horizontal_size_extension'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 2); // 2 bits for horizontal_size_extension + $info['mpeg']['video']['raw']['vertical_size_extension'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 2); // 2 bits for vertical_size_extension + $info['mpeg']['video']['raw']['bit_rate_extension'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 12); // 12 bits for bit_rate_extension + $marker_bit = self::readBitsFromStream($bitstream, $bitstreamoffset, 1); // The term "marker_bit" indicates a one bit field in which the value zero is forbidden. These marker bits are introduced at several points in the syntax to avoid start code emulation. + $info['mpeg']['video']['raw']['vbv_buffer_size_extension'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 8); // 8 bits for vbv_buffer_size_extension + $info['mpeg']['video']['raw']['low_delay'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 1); // 1 bit flag: low_delay + $info['mpeg']['video']['raw']['frame_rate_extension_n'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 2); // 2 bits for frame_rate_extension_n + $info['mpeg']['video']['raw']['frame_rate_extension_d'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 5); // 5 bits for frame_rate_extension_d + + $info['video']['resolution_x'] = ($info['mpeg']['video']['raw']['horizontal_size_extension'] << 12) | $info['mpeg']['video']['raw']['horizontal_size_value']; + $info['video']['resolution_y'] = ($info['mpeg']['video']['raw']['vertical_size_extension'] << 12) | $info['mpeg']['video']['raw']['vertical_size_value']; + $info['video']['interlaced'] = !$info['mpeg']['video']['raw']['progressive_sequence']; + $info['mpeg']['video']['interlaced'] = !$info['mpeg']['video']['raw']['progressive_sequence']; + $info['mpeg']['video']['chroma_format'] = self::chromaFormatTextLookup($info['mpeg']['video']['raw']['chroma_format']); + break; + + case 2: // 0010 Sequence Display Extension ID + $info['mpeg']['video']['raw']['video_format'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 3); // 3 bits for video_format + $info['mpeg']['video']['raw']['colour_description'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 1); // 1 bit flag: colour_description + if ($info['mpeg']['video']['raw']['colour_description']) { + $info['mpeg']['video']['raw']['colour_primaries'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 8); // 8 bits for colour_primaries + $info['mpeg']['video']['raw']['transfer_characteristics'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 8); // 8 bits for transfer_characteristics + $info['mpeg']['video']['raw']['matrix_coefficients'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 8); // 8 bits for matrix_coefficients + } + $info['mpeg']['video']['raw']['display_horizontal_size'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 14); // 14 bits for display_horizontal_size + $marker_bit = self::readBitsFromStream($bitstream, $bitstreamoffset, 1); // The term "marker_bit" indicates a one bit field in which the value zero is forbidden. These marker bits are introduced at several points in the syntax to avoid start code emulation. + $info['mpeg']['video']['raw']['display_vertical_size'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 14); // 14 bits for display_vertical_size + + $info['mpeg']['video']['video_format'] = self::videoFormatTextLookup($info['mpeg']['video']['raw']['video_format']); + break; + + case 3: // 0011 Quant Matrix Extension ID + break; + + case 5: // 0101 Sequence Scalable Extension ID + $info['mpeg']['video']['raw']['scalable_mode'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 2); // 2 bits for scalable_mode + $info['mpeg']['video']['raw']['layer_id'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 4); // 4 bits for layer_id + if ($info['mpeg']['video']['raw']['scalable_mode'] == 1) { // "spatial scalability" + $info['mpeg']['video']['raw']['lower_layer_prediction_horizontal_size'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 14); // 14 bits for lower_layer_prediction_horizontal_size + $marker_bit = self::readBitsFromStream($bitstream, $bitstreamoffset, 1); // The term "marker_bit" indicates a one bit field in which the value zero is forbidden. These marker bits are introduced at several points in the syntax to avoid start code emulation. + $info['mpeg']['video']['raw']['lower_layer_prediction_vertical_size'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 14); // 14 bits for lower_layer_prediction_vertical_size + $info['mpeg']['video']['raw']['horizontal_subsampling_factor_m'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 5); // 5 bits for horizontal_subsampling_factor_m + $info['mpeg']['video']['raw']['horizontal_subsampling_factor_n'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 5); // 5 bits for horizontal_subsampling_factor_n + $info['mpeg']['video']['raw']['vertical_subsampling_factor_m'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 5); // 5 bits for vertical_subsampling_factor_m + $info['mpeg']['video']['raw']['vertical_subsampling_factor_n'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 5); // 5 bits for vertical_subsampling_factor_n + } elseif ($info['mpeg']['video']['raw']['scalable_mode'] == 3) { // "temporal scalability" + $info['mpeg']['video']['raw']['picture_mux_enable'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 1); // 1 bit flag: picture_mux_enable + if ($info['mpeg']['video']['raw']['picture_mux_enable']) { + $info['mpeg']['video']['raw']['mux_to_progressive_sequence'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 1); // 1 bit flag: mux_to_progressive_sequence + } + $info['mpeg']['video']['raw']['picture_mux_order'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 3); // 3 bits for picture_mux_order + $info['mpeg']['video']['raw']['picture_mux_factor'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 3); // 3 bits for picture_mux_factor + } + + $info['mpeg']['video']['scalable_mode'] = self::scalableModeTextLookup($info['mpeg']['video']['raw']['scalable_mode']); + break; + + case 7: // 0111 Picture Display Extension ID + break; + + case 8: // 1000 Picture Coding Extension ID + $info['mpeg']['video']['raw']['f_code_00'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 4); // 4 bits for f_code[0][0] (forward horizontal) + $info['mpeg']['video']['raw']['f_code_01'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 4); // 4 bits for f_code[0][1] (forward vertical) + $info['mpeg']['video']['raw']['f_code_10'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 4); // 4 bits for f_code[1][0] (backward horizontal) + $info['mpeg']['video']['raw']['f_code_11'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 4); // 4 bits for f_code[1][1] (backward vertical) + $info['mpeg']['video']['raw']['intra_dc_precision'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 2); // 2 bits for intra_dc_precision + $info['mpeg']['video']['raw']['picture_structure'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 2); // 2 bits for picture_structure + $info['mpeg']['video']['raw']['top_field_first'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 1); // 1 bit flag: top_field_first + $info['mpeg']['video']['raw']['frame_pred_frame_dct'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 1); // 1 bit flag: frame_pred_frame_dct + $info['mpeg']['video']['raw']['concealment_motion_vectors'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 1); // 1 bit flag: concealment_motion_vectors + $info['mpeg']['video']['raw']['q_scale_type'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 1); // 1 bit flag: q_scale_type + $info['mpeg']['video']['raw']['intra_vlc_format'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 1); // 1 bit flag: intra_vlc_format + $info['mpeg']['video']['raw']['alternate_scan'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 1); // 1 bit flag: alternate_scan + $info['mpeg']['video']['raw']['repeat_first_field'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 1); // 1 bit flag: repeat_first_field + $info['mpeg']['video']['raw']['chroma_420_type'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 1); // 1 bit flag: chroma_420_type + $info['mpeg']['video']['raw']['progressive_frame'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 1); // 1 bit flag: progressive_frame + $info['mpeg']['video']['raw']['composite_display_flag'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 1); // 1 bit flag: composite_display_flag + if ($info['mpeg']['video']['raw']['composite_display_flag']) { + $info['mpeg']['video']['raw']['v_axis'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 1); // 1 bit flag: v_axis + $info['mpeg']['video']['raw']['field_sequence'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 3); // 3 bits for field_sequence + $info['mpeg']['video']['raw']['sub_carrier'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 1); // 1 bit flag: sub_carrier + $info['mpeg']['video']['raw']['burst_amplitude'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 7); // 7 bits for burst_amplitude + $info['mpeg']['video']['raw']['sub_carrier_phase'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 8); // 8 bits for sub_carrier_phase + } + + $info['mpeg']['video']['intra_dc_precision_bits'] = $info['mpeg']['video']['raw']['intra_dc_precision'] + 8; + $info['mpeg']['video']['picture_structure'] = self::pictureStructureTextLookup($info['mpeg']['video']['raw']['picture_structure']); + break; + + case 9: // 1001 Picture Spatial Scalable Extension ID + break; + case 10: // 1010 Picture Temporal Scalable Extension ID + break; + + default: + $this->warning('Unexpected $info[mpeg][video][raw][extension_start_code_identifier] value of '.$info['mpeg']['video']['raw']['extension_start_code_identifier']); + break; + } + break; + + + case 0xB8: // group_of_pictures_header + $GOPcounter++; + if ($info['mpeg']['video']['bitrate_mode'] == 'vbr') { + $bitstream = getid3_lib::BigEndian2Bin(substr($MPEGstreamData, $StartCodeOffset + 4, 4)); // 27 bits needed for group_of_pictures_header + $bitstreamoffset = 0; + + $GOPheader = array(); + + $GOPheader['byte_offset'] = $MPEGstreamBaseOffset + $StartCodeOffset; + $GOPheader['drop_frame_flag'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 1); // 1 bit flag: drop_frame_flag + $GOPheader['time_code_hours'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 5); // 5 bits for time_code_hours + $GOPheader['time_code_minutes'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 6); // 6 bits for time_code_minutes + $marker_bit = self::readBitsFromStream($bitstream, $bitstreamoffset, 1); // The term "marker_bit" indicates a one bit field in which the value zero is forbidden. These marker bits are introduced at several points in the syntax to avoid start code emulation. + $GOPheader['time_code_seconds'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 6); // 6 bits for time_code_seconds + $GOPheader['time_code_pictures'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 6); // 6 bits for time_code_pictures + $GOPheader['closed_gop'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 1); // 1 bit flag: closed_gop + $GOPheader['broken_link'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 1); // 1 bit flag: broken_link + + $time_code_separator = ($GOPheader['drop_frame_flag'] ? ';' : ':'); // While non-drop time code is displayed with colons separating the digit pairs"HH:MM:SS:FF"drop frame is usually represented with a semi-colon (;) or period (.) as the divider between all the digit pairs"HH;MM;SS;FF", "HH.MM.SS.FF" + $GOPheader['time_code'] = sprintf('%02d'.$time_code_separator.'%02d'.$time_code_separator.'%02d'.$time_code_separator.'%02d', $GOPheader['time_code_hours'], $GOPheader['time_code_minutes'], $GOPheader['time_code_seconds'], $GOPheader['time_code_pictures']); + + $info['mpeg']['group_of_pictures'][] = $GOPheader; + } + break; + + case 0xC0: // audio stream + case 0xC1: // audio stream + case 0xC2: // audio stream + case 0xC3: // audio stream + case 0xC4: // audio stream + case 0xC5: // audio stream + case 0xC6: // audio stream + case 0xC7: // audio stream + case 0xC8: // audio stream + case 0xC9: // audio stream + case 0xCA: // audio stream + case 0xCB: // audio stream + case 0xCC: // audio stream + case 0xCD: // audio stream + case 0xCE: // audio stream + case 0xCF: // audio stream + case 0xD0: // audio stream + case 0xD1: // audio stream + case 0xD2: // audio stream + case 0xD3: // audio stream + case 0xD4: // audio stream + case 0xD5: // audio stream + case 0xD6: // audio stream + case 0xD7: // audio stream + case 0xD8: // audio stream + case 0xD9: // audio stream + case 0xDA: // audio stream + case 0xDB: // audio stream + case 0xDC: // audio stream + case 0xDD: // audio stream + case 0xDE: // audio stream + case 0xDF: // audio stream + //case 0xE0: // video stream + //case 0xE1: // video stream + //case 0xE2: // video stream + //case 0xE3: // video stream + //case 0xE4: // video stream + //case 0xE5: // video stream + //case 0xE6: // video stream + //case 0xE7: // video stream + //case 0xE8: // video stream + //case 0xE9: // video stream + //case 0xEA: // video stream + //case 0xEB: // video stream + //case 0xEC: // video stream + //case 0xED: // video stream + //case 0xEE: // video stream + //case 0xEF: // video stream + if (isset($ParsedAVchannels[$StartCodeValue])) { + break; + } + $ParsedAVchannels[$StartCodeValue] = $StartCodeValue; + // http://en.wikipedia.org/wiki/Packetized_elementary_stream + // http://dvd.sourceforge.net/dvdinfo/pes-hdr.html +/* + $PackedElementaryStream = array(); + if ($StartCodeValue >= 0xE0) { + $PackedElementaryStream['stream_type'] = 'video'; + $PackedElementaryStream['stream_id'] = $StartCodeValue - 0xE0; + } else { + $PackedElementaryStream['stream_type'] = 'audio'; + $PackedElementaryStream['stream_id'] = $StartCodeValue - 0xC0; + } + $PackedElementaryStream['packet_length'] = getid3_lib::BigEndian2Int(substr($MPEGstreamData, $StartCodeOffset + 4, 2)); + + $bitstream = getid3_lib::BigEndian2Bin(substr($MPEGstreamData, $StartCodeOffset + 6, 3)); // more may be needed below + $bitstreamoffset = 0; + + $PackedElementaryStream['marker_bits'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 2); // 2 bits for marker_bits -- should be "10" = 2 +echo 'marker_bits = '.$PackedElementaryStream['marker_bits'].'
      '; + $PackedElementaryStream['scrambling_control'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 2); // 2 bits for scrambling_control -- 00 implies not scrambled + $PackedElementaryStream['priority'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 1); // 1 bit flag: priority + $PackedElementaryStream['data_alignment_indicator'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 1); // 1 bit flag: data_alignment_indicator -- 1 indicates that the PES packet header is immediately followed by the video start code or audio syncword + $PackedElementaryStream['copyright'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 1); // 1 bit flag: copyright -- 1 implies copyrighted + $PackedElementaryStream['original_or_copy'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 1); // 1 bit flag: original_or_copy -- 1 implies original + $PackedElementaryStream['pts_flag'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 1); // 1 bit flag: pts_flag -- Presentation Time Stamp + $PackedElementaryStream['dts_flag'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 1); // 1 bit flag: dts_flag -- Decode Time Stamp + $PackedElementaryStream['escr_flag'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 1); // 1 bit flag: escr_flag -- Elementary Stream Clock Reference + $PackedElementaryStream['es_rate_flag'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 1); // 1 bit flag: es_rate_flag -- Elementary Stream [data] Rate + $PackedElementaryStream['dsm_trick_mode_flag'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 1); // 1 bit flag: dsm_trick_mode_flag -- DSM trick mode - not used by DVD + $PackedElementaryStream['additional_copy_info_flag'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 1); // 1 bit flag: additional_copy_info_flag + $PackedElementaryStream['crc_flag'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 1); // 1 bit flag: crc_flag + $PackedElementaryStream['extension_flag'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 1); // 1 bit flag: extension_flag + $PackedElementaryStream['pes_remain_header_length'] = self::readBitsFromStream($bitstream, $bitstreamoffset, 8); // 1 bit flag: priority + + $additional_header_bytes = 0; + $additional_header_bytes += ($PackedElementaryStream['pts_flag'] ? 5 : 0); + $additional_header_bytes += ($PackedElementaryStream['dts_flag'] ? 5 : 0); + $additional_header_bytes += ($PackedElementaryStream['escr_flag'] ? 6 : 0); + $additional_header_bytes += ($PackedElementaryStream['es_rate_flag'] ? 3 : 0); + $additional_header_bytes += ($PackedElementaryStream['additional_copy_info_flag'] ? 1 : 0); + $additional_header_bytes += ($PackedElementaryStream['crc_flag'] ? 2 : 0); + $additional_header_bytes += ($PackedElementaryStream['extension_flag'] ? 1 : 0); +$PackedElementaryStream['additional_header_bytes'] = $additional_header_bytes; + $bitstream .= getid3_lib::BigEndian2Bin(substr($MPEGstreamData, $StartCodeOffset + 9, $additional_header_bytes)); + + $info['mpeg']['packed_elementary_streams'][$PackedElementaryStream['stream_type']][$PackedElementaryStream['stream_id']][] = $PackedElementaryStream; +*/ + $getid3_temp = new getID3(); + $getid3_temp->openfile($this->getid3->filename); + $getid3_temp->info = $info; + $getid3_mp3 = new getid3_mp3($getid3_temp); + for ($i = 0; $i <= 7; $i++) { + // some files have the MPEG-audio header 8 bytes after the end of the $00 $00 $01 $C0 signature, some have it up to 13 bytes (or more?) after + // I have no idea why or what the difference is, so this is a stupid hack. + // If anybody has any better idea of what's going on, please let me know - info@getid3.org + $getid3_temp->info = $info; // only overwrite real data if valid header found +//echo 'audio at? '.($MPEGstreamBaseOffset + $StartCodeOffset + 4 + 8 + $i).'
      '; + if ($getid3_mp3->decodeMPEGaudioHeader($MPEGstreamBaseOffset + $StartCodeOffset + 4 + 8 + $i, $getid3_temp->info, false)) { +//echo 'yes!
      '; + $info = $getid3_temp->info; + $info['audio']['bitrate_mode'] = 'cbr'; + $info['audio']['lossless'] = false; + break; + } + } + unset($getid3_temp, $getid3_mp3); + break; + + case 0xBC: // Program Stream Map + case 0xBD: // Private stream 1 (non MPEG audio, subpictures) + case 0xBE: // Padding stream + case 0xBF: // Private stream 2 (navigation data) + case 0xF0: // ECM stream + case 0xF1: // EMM stream + case 0xF2: // DSM-CC stream + case 0xF3: // ISO/IEC_13522_stream + case 0xF4: // ITU-I Rec. H.222.1 type A + case 0xF5: // ITU-I Rec. H.222.1 type B + case 0xF6: // ITU-I Rec. H.222.1 type C + case 0xF7: // ITU-I Rec. H.222.1 type D + case 0xF8: // ITU-I Rec. H.222.1 type E + case 0xF9: // ancilliary stream + case 0xFA: // ISO/IEC 14496-1 SL-packtized stream + case 0xFB: // ISO/IEC 14496-1 FlexMux stream + case 0xFC: // metadata stream + case 0xFD: // extended stream ID + case 0xFE: // reserved data stream + case 0xFF: // program stream directory + // ignore + break; + + default: + // ignore + break; + } + } while (true); + + + +// // Temporary hack to account for interleaving overhead: +// if (!empty($info['video']['bitrate']) && !empty($info['audio']['bitrate'])) { +// $info['playtime_seconds'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / ($info['video']['bitrate'] + $info['audio']['bitrate']); +// +// // Interleaved MPEG audio/video files have a certain amount of overhead that varies +// // by both video and audio bitrates, and not in any sensible, linear/logarithmic pattern +// // Use interpolated lookup tables to approximately guess how much is overhead, because +// // playtime is calculated as filesize / total-bitrate +// $info['playtime_seconds'] *= self::systemNonOverheadPercentage($info['video']['bitrate'], $info['audio']['bitrate']); +// +// //switch ($info['video']['bitrate']) { +// // case('5000000'): +// // $multiplier = 0.93292642112380355828048824319889; +// // break; +// // case('5500000'): +// // $multiplier = 0.93582895375200989965359777343219; +// // break; +// // case('6000000'): +// // $multiplier = 0.93796247714820932532911373859139; +// // break; +// // case('7000000'): +// // $multiplier = 0.9413264083635103463010117778776; +// // break; +// // default: +// // $multiplier = 1; +// // break; +// //} +// //$info['playtime_seconds'] *= $multiplier; +// //$this->warning('Interleaved MPEG audio/video playtime may be inaccurate. With current hack should be within a few seconds of accurate. Report to info@getid3.org if off by more than 10 seconds.'); +// if ($info['video']['bitrate'] < 50000) { +// $this->warning('Interleaved MPEG audio/video playtime may be slightly inaccurate for video bitrates below 100kbps. Except in extreme low-bitrate situations, error should be less than 1%. Report to info@getid3.org if greater than this.'); +// } +// } +// +/* +$time_prev = 0; +$byte_prev = 0; +$vbr_bitrates = array(); +foreach ($info['mpeg']['group_of_pictures'] as $gopkey => $gopdata) { + $time_this = ($gopdata['time_code_hours'] * 3600) + ($gopdata['time_code_minutes'] * 60) + $gopdata['time_code_seconds'] + ($gopdata['time_code_seconds'] / 30); + $byte_this = $gopdata['byte_offset']; + if ($gopkey > 0) { + if ($time_this > $time_prev) { + $bytedelta = $byte_this - $byte_prev; + $timedelta = $time_this - $time_prev; + $this_bitrate = ($bytedelta * 8) / $timedelta; +echo $gopkey.': ('.number_format($time_prev, 2).'-'.number_format($time_this, 2).') '.number_format($bytedelta).' bytes over '.number_format($timedelta, 3).' seconds = '.number_format($this_bitrate / 1000, 2).'kbps
      '; + $time_prev = $time_this; + $byte_prev = $byte_this; + $vbr_bitrates[] = $this_bitrate; + } + } +} +echo 'average_File_bitrate = '.number_format(array_sum($vbr_bitrates) / count($vbr_bitrates), 1).'
      '; +*/ +//echo '
      '.print_r($FramesByGOP, true).'
      '; + if (!empty($info['mpeg']['video']['bitrate_mode']) && ($info['mpeg']['video']['bitrate_mode'] == 'vbr')) { + $last_GOP_id = max(array_keys($FramesByGOP)); + $frames_in_last_GOP = count($FramesByGOP[$last_GOP_id]); + $gopdata = &$info['mpeg']['group_of_pictures'][$last_GOP_id]; + $info['playtime_seconds'] = ($gopdata['time_code_hours'] * 3600) + ($gopdata['time_code_minutes'] * 60) + $gopdata['time_code_seconds'] + (($gopdata['time_code_pictures'] + $frames_in_last_GOP + 1) / $info['mpeg']['video']['frame_rate']); + if (!isset($info['video']['bitrate'])) { + $overall_bitrate = ($info['avdataend'] - $info['avdataoffset']) * 8 / $info['playtime_seconds']; + $info['video']['bitrate'] = $overall_bitrate - (isset($info['audio']['bitrate']) ? $info['audio']['bitrate'] : 0); + } + unset($info['mpeg']['group_of_pictures']); + } + + return true; + } + + private function readBitsFromStream(&$bitstream, &$bitstreamoffset, $bits_to_read, $return_singlebit_as_boolean=true) { + $return = bindec(substr($bitstream, $bitstreamoffset, $bits_to_read)); + $bitstreamoffset += $bits_to_read; + if (($bits_to_read == 1) && $return_singlebit_as_boolean) { + $return = (bool) $return; + } + return $return; + } + + + public static function systemNonOverheadPercentage($VideoBitrate, $AudioBitrate) { + $OverheadPercentage = 0; + + $AudioBitrate = max(min($AudioBitrate / 1000, 384), 32); // limit to range of 32kbps - 384kbps (should be only legal bitrates, but maybe VBR?) + $VideoBitrate = max(min($VideoBitrate / 1000, 10000), 10); // limit to range of 10kbps - 10Mbps (beyond that curves flatten anyways, no big loss) + + + //OMBB[audiobitrate] = array(video-10kbps, video-100kbps, video-1000kbps, video-10000kbps) + $OverheadMultiplierByBitrate[32] = array(0, 0.9676287944368530, 0.9802276264360310, 0.9844916183244460, 0.9852821845179940); + $OverheadMultiplierByBitrate[48] = array(0, 0.9779100089209830, 0.9787770035359320, 0.9846738664076130, 0.9852683013799960); + $OverheadMultiplierByBitrate[56] = array(0, 0.9731249855367600, 0.9776624308938040, 0.9832606361852130, 0.9843922606633340); + $OverheadMultiplierByBitrate[64] = array(0, 0.9755642683275760, 0.9795256705493390, 0.9836573009193170, 0.9851122539404470); + $OverheadMultiplierByBitrate[96] = array(0, 0.9788025247497290, 0.9798553314148700, 0.9822956869792560, 0.9834815119124690); + $OverheadMultiplierByBitrate[128] = array(0, 0.9816940050925480, 0.9821675936072120, 0.9829756927470870, 0.9839763420152050); + $OverheadMultiplierByBitrate[160] = array(0, 0.9825894094561180, 0.9820913399073960, 0.9823907143253970, 0.9832821783651570); + $OverheadMultiplierByBitrate[192] = array(0, 0.9832038474336260, 0.9825731694317960, 0.9821028622712400, 0.9828262076447620); + $OverheadMultiplierByBitrate[224] = array(0, 0.9836516298538770, 0.9824718601823890, 0.9818302180625380, 0.9823735101626480); + $OverheadMultiplierByBitrate[256] = array(0, 0.9845863022094920, 0.9837229411967540, 0.9824521662210830, 0.9828645172100790); + $OverheadMultiplierByBitrate[320] = array(0, 0.9849565280263180, 0.9837683142805110, 0.9822885275960400, 0.9824424382727190); + $OverheadMultiplierByBitrate[384] = array(0, 0.9856094774357600, 0.9844573394432720, 0.9825970399837330, 0.9824673808303890); + + $BitrateToUseMin = 32; + $BitrateToUseMax = 32; + $previousBitrate = 32; + foreach ($OverheadMultiplierByBitrate as $key => $value) { + if ($AudioBitrate >= $previousBitrate) { + $BitrateToUseMin = $previousBitrate; + } + if ($AudioBitrate < $key) { + $BitrateToUseMax = $key; + break; + } + $previousBitrate = $key; + } + $FactorA = ($BitrateToUseMax - $AudioBitrate) / ($BitrateToUseMax - $BitrateToUseMin); + + $VideoBitrateLog10 = log10($VideoBitrate); + $VideoFactorMin1 = $OverheadMultiplierByBitrate[$BitrateToUseMin][floor($VideoBitrateLog10)]; + $VideoFactorMin2 = $OverheadMultiplierByBitrate[$BitrateToUseMax][floor($VideoBitrateLog10)]; + $VideoFactorMax1 = $OverheadMultiplierByBitrate[$BitrateToUseMin][ceil($VideoBitrateLog10)]; + $VideoFactorMax2 = $OverheadMultiplierByBitrate[$BitrateToUseMax][ceil($VideoBitrateLog10)]; + $FactorV = $VideoBitrateLog10 - floor($VideoBitrateLog10); + + $OverheadPercentage = $VideoFactorMin1 * $FactorA * $FactorV; + $OverheadPercentage += $VideoFactorMin2 * (1 - $FactorA) * $FactorV; + $OverheadPercentage += $VideoFactorMax1 * $FactorA * (1 - $FactorV); + $OverheadPercentage += $VideoFactorMax2 * (1 - $FactorA) * (1 - $FactorV); + + return $OverheadPercentage; + } + + + public static function videoFramerateLookup($rawframerate) { + $lookup = array(0, 23.976, 24, 25, 29.97, 30, 50, 59.94, 60); + return (isset($lookup[$rawframerate]) ? (float) $lookup[$rawframerate] : (float) 0); + } + + public static function videoAspectRatioLookup($rawaspectratio) { + $lookup = array(0, 1, 0.6735, 0.7031, 0.7615, 0.8055, 0.8437, 0.8935, 0.9157, 0.9815, 1.0255, 1.0695, 1.0950, 1.1575, 1.2015, 0); + return (isset($lookup[$rawaspectratio]) ? (float) $lookup[$rawaspectratio] : (float) 0); + } + + public static function videoAspectRatioTextLookup($rawaspectratio) { + $lookup = array('forbidden', 'square pixels', '0.6735', '16:9, 625 line, PAL', '0.7615', '0.8055', '16:9, 525 line, NTSC', '0.8935', '4:3, 625 line, PAL, CCIR601', '0.9815', '1.0255', '1.0695', '4:3, 525 line, NTSC, CCIR601', '1.1575', '1.2015', 'reserved'); + return (isset($lookup[$rawaspectratio]) ? $lookup[$rawaspectratio] : ''); + } + + public static function videoFormatTextLookup($video_format) { + // ISO/IEC 13818-2, section 6.3.6, Table 6-6. Meaning of video_format + $lookup = array('component', 'PAL', 'NTSC', 'SECAM', 'MAC', 'Unspecified video format', 'reserved(6)', 'reserved(7)'); + return (isset($lookup[$video_format]) ? $lookup[$video_format] : ''); + } + + public static function scalableModeTextLookup($scalable_mode) { + // ISO/IEC 13818-2, section 6.3.8, Table 6-10. Definition of scalable_mode + $lookup = array('data partitioning', 'spatial scalability', 'SNR scalability', 'temporal scalability'); + return (isset($lookup[$scalable_mode]) ? $lookup[$scalable_mode] : ''); + } + + public static function pictureStructureTextLookup($picture_structure) { + // ISO/IEC 13818-2, section 6.3.11, Table 6-14 Meaning of picture_structure + $lookup = array('reserved', 'Top Field', 'Bottom Field', 'Frame picture'); + return (isset($lookup[$picture_structure]) ? $lookup[$picture_structure] : ''); + } + + public static function chromaFormatTextLookup($chroma_format) { + // ISO/IEC 13818-2, section 6.3.11, Table 6-14 Meaning of picture_structure + $lookup = array('reserved', '4:2:0', '4:2:2', '4:4:4'); + return (isset($lookup[$chroma_format]) ? $lookup[$chroma_format] : ''); + } + +} \ No newline at end of file diff --git a/www/rompr/getid3/module.audio-video.nsv.php b/www/rompr/getid3/module.audio-video.nsv.php new file mode 100644 index 0000000..eab601b --- /dev/null +++ b/www/rompr/getid3/module.audio-video.nsv.php @@ -0,0 +1,224 @@ + // +// available at http://getid3.sourceforge.net // +// or http://www.getid3.org // +// also https://github.com/JamesHeinrich/getID3 // +///////////////////////////////////////////////////////////////// +// See readme.txt for more details // +///////////////////////////////////////////////////////////////// +// // +// module.audio.nsv.php // +// module for analyzing Nullsoft NSV files // +// dependencies: NONE // +// /// +///////////////////////////////////////////////////////////////// + + +class getid3_nsv extends getid3_handler +{ + + public function Analyze() { + $info = &$this->getid3->info; + + $this->fseek($info['avdataoffset']); + $NSVheader = $this->fread(4); + + switch ($NSVheader) { + case 'NSVs': + if ($this->getNSVsHeaderFilepointer(0)) { + $info['fileformat'] = 'nsv'; + $info['audio']['dataformat'] = 'nsv'; + $info['video']['dataformat'] = 'nsv'; + $info['audio']['lossless'] = false; + $info['video']['lossless'] = false; + } + break; + + case 'NSVf': + if ($this->getNSVfHeaderFilepointer(0)) { + $info['fileformat'] = 'nsv'; + $info['audio']['dataformat'] = 'nsv'; + $info['video']['dataformat'] = 'nsv'; + $info['audio']['lossless'] = false; + $info['video']['lossless'] = false; + $this->getNSVsHeaderFilepointer($info['nsv']['NSVf']['header_length']); + } + break; + + default: + $this->error('Expecting "NSVs" or "NSVf" at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes($NSVheader).'"'); + return false; + break; + } + + if (!isset($info['nsv']['NSVf'])) { + $this->warning('NSVf header not present - cannot calculate playtime or bitrate'); + } + + return true; + } + + public function getNSVsHeaderFilepointer($fileoffset) { + $info = &$this->getid3->info; + $this->fseek($fileoffset); + $NSVsheader = $this->fread(28); + $offset = 0; + + $info['nsv']['NSVs']['identifier'] = substr($NSVsheader, $offset, 4); + $offset += 4; + + if ($info['nsv']['NSVs']['identifier'] != 'NSVs') { + $this->error('expected "NSVs" at offset ('.$fileoffset.'), found "'.$info['nsv']['NSVs']['identifier'].'" instead'); + unset($info['nsv']['NSVs']); + return false; + } + + $info['nsv']['NSVs']['offset'] = $fileoffset; + + $info['nsv']['NSVs']['video_codec'] = substr($NSVsheader, $offset, 4); + $offset += 4; + $info['nsv']['NSVs']['audio_codec'] = substr($NSVsheader, $offset, 4); + $offset += 4; + $info['nsv']['NSVs']['resolution_x'] = getid3_lib::LittleEndian2Int(substr($NSVsheader, $offset, 2)); + $offset += 2; + $info['nsv']['NSVs']['resolution_y'] = getid3_lib::LittleEndian2Int(substr($NSVsheader, $offset, 2)); + $offset += 2; + + $info['nsv']['NSVs']['framerate_index'] = getid3_lib::LittleEndian2Int(substr($NSVsheader, $offset, 1)); + $offset += 1; + //$info['nsv']['NSVs']['unknown1b'] = getid3_lib::LittleEndian2Int(substr($NSVsheader, $offset, 1)); + $offset += 1; + //$info['nsv']['NSVs']['unknown1c'] = getid3_lib::LittleEndian2Int(substr($NSVsheader, $offset, 1)); + $offset += 1; + //$info['nsv']['NSVs']['unknown1d'] = getid3_lib::LittleEndian2Int(substr($NSVsheader, $offset, 1)); + $offset += 1; + //$info['nsv']['NSVs']['unknown2a'] = getid3_lib::LittleEndian2Int(substr($NSVsheader, $offset, 1)); + $offset += 1; + //$info['nsv']['NSVs']['unknown2b'] = getid3_lib::LittleEndian2Int(substr($NSVsheader, $offset, 1)); + $offset += 1; + //$info['nsv']['NSVs']['unknown2c'] = getid3_lib::LittleEndian2Int(substr($NSVsheader, $offset, 1)); + $offset += 1; + //$info['nsv']['NSVs']['unknown2d'] = getid3_lib::LittleEndian2Int(substr($NSVsheader, $offset, 1)); + $offset += 1; + + switch ($info['nsv']['NSVs']['audio_codec']) { + case 'PCM ': + $info['nsv']['NSVs']['bits_channel'] = getid3_lib::LittleEndian2Int(substr($NSVsheader, $offset, 1)); + $offset += 1; + $info['nsv']['NSVs']['channels'] = getid3_lib::LittleEndian2Int(substr($NSVsheader, $offset, 1)); + $offset += 1; + $info['nsv']['NSVs']['sample_rate'] = getid3_lib::LittleEndian2Int(substr($NSVsheader, $offset, 2)); + $offset += 2; + + $info['audio']['sample_rate'] = $info['nsv']['NSVs']['sample_rate']; + break; + + case 'MP3 ': + case 'NONE': + default: + //$info['nsv']['NSVs']['unknown3'] = getid3_lib::LittleEndian2Int(substr($NSVsheader, $offset, 4)); + $offset += 4; + break; + } + + $info['video']['resolution_x'] = $info['nsv']['NSVs']['resolution_x']; + $info['video']['resolution_y'] = $info['nsv']['NSVs']['resolution_y']; + $info['nsv']['NSVs']['frame_rate'] = $this->NSVframerateLookup($info['nsv']['NSVs']['framerate_index']); + $info['video']['frame_rate'] = $info['nsv']['NSVs']['frame_rate']; + $info['video']['bits_per_sample'] = 24; + $info['video']['pixel_aspect_ratio'] = (float) 1; + + return true; + } + + public function getNSVfHeaderFilepointer($fileoffset, $getTOCoffsets=false) { + $info = &$this->getid3->info; + $this->fseek($fileoffset); + $NSVfheader = $this->fread(28); + $offset = 0; + + $info['nsv']['NSVf']['identifier'] = substr($NSVfheader, $offset, 4); + $offset += 4; + + if ($info['nsv']['NSVf']['identifier'] != 'NSVf') { + $this->error('expected "NSVf" at offset ('.$fileoffset.'), found "'.$info['nsv']['NSVf']['identifier'].'" instead'); + unset($info['nsv']['NSVf']); + return false; + } + + $info['nsv']['NSVs']['offset'] = $fileoffset; + + $info['nsv']['NSVf']['header_length'] = getid3_lib::LittleEndian2Int(substr($NSVfheader, $offset, 4)); + $offset += 4; + $info['nsv']['NSVf']['file_size'] = getid3_lib::LittleEndian2Int(substr($NSVfheader, $offset, 4)); + $offset += 4; + + if ($info['nsv']['NSVf']['file_size'] > $info['avdataend']) { + $this->warning('truncated file - NSVf header indicates '.$info['nsv']['NSVf']['file_size'].' bytes, file actually '.$info['avdataend'].' bytes'); + } + + $info['nsv']['NSVf']['playtime_ms'] = getid3_lib::LittleEndian2Int(substr($NSVfheader, $offset, 4)); + $offset += 4; + $info['nsv']['NSVf']['meta_size'] = getid3_lib::LittleEndian2Int(substr($NSVfheader, $offset, 4)); + $offset += 4; + $info['nsv']['NSVf']['TOC_entries_1'] = getid3_lib::LittleEndian2Int(substr($NSVfheader, $offset, 4)); + $offset += 4; + $info['nsv']['NSVf']['TOC_entries_2'] = getid3_lib::LittleEndian2Int(substr($NSVfheader, $offset, 4)); + $offset += 4; + + if ($info['nsv']['NSVf']['playtime_ms'] == 0) { + $this->error('Corrupt NSV file: NSVf.playtime_ms == zero'); + return false; + } + + $NSVfheader .= $this->fread($info['nsv']['NSVf']['meta_size'] + (4 * $info['nsv']['NSVf']['TOC_entries_1']) + (4 * $info['nsv']['NSVf']['TOC_entries_2'])); + $NSVfheaderlength = strlen($NSVfheader); + $info['nsv']['NSVf']['metadata'] = substr($NSVfheader, $offset, $info['nsv']['NSVf']['meta_size']); + $offset += $info['nsv']['NSVf']['meta_size']; + + if ($getTOCoffsets) { + $TOCcounter = 0; + while ($TOCcounter < $info['nsv']['NSVf']['TOC_entries_1']) { + if ($TOCcounter < $info['nsv']['NSVf']['TOC_entries_1']) { + $info['nsv']['NSVf']['TOC_1'][$TOCcounter] = getid3_lib::LittleEndian2Int(substr($NSVfheader, $offset, 4)); + $offset += 4; + $TOCcounter++; + } + } + } + + if (trim($info['nsv']['NSVf']['metadata']) != '') { + $info['nsv']['NSVf']['metadata'] = str_replace('`', "\x01", $info['nsv']['NSVf']['metadata']); + $CommentPairArray = explode("\x01".' ', $info['nsv']['NSVf']['metadata']); + foreach ($CommentPairArray as $CommentPair) { + if (strstr($CommentPair, '='."\x01")) { + list($key, $value) = explode('='."\x01", $CommentPair, 2); + $info['nsv']['comments'][strtolower($key)][] = trim(str_replace("\x01", '', $value)); + } + } + } + + $info['playtime_seconds'] = $info['nsv']['NSVf']['playtime_ms'] / 1000; + $info['bitrate'] = ($info['nsv']['NSVf']['file_size'] * 8) / $info['playtime_seconds']; + + return true; + } + + + public static function NSVframerateLookup($framerateindex) { + if ($framerateindex <= 127) { + return (float) $framerateindex; + } + static $NSVframerateLookup = array(); + if (empty($NSVframerateLookup)) { + $NSVframerateLookup[129] = (float) 29.970; + $NSVframerateLookup[131] = (float) 23.976; + $NSVframerateLookup[133] = (float) 14.985; + $NSVframerateLookup[197] = (float) 59.940; + $NSVframerateLookup[199] = (float) 47.952; + } + return (isset($NSVframerateLookup[$framerateindex]) ? $NSVframerateLookup[$framerateindex] : false); + } + +} diff --git a/www/rompr/getid3/module.audio-video.quicktime.php b/www/rompr/getid3/module.audio-video.quicktime.php new file mode 100644 index 0000000..3651c4f --- /dev/null +++ b/www/rompr/getid3/module.audio-video.quicktime.php @@ -0,0 +1,2689 @@ + // +// available at http://getid3.sourceforge.net // +// or http://www.getid3.org // +// also https://github.com/JamesHeinrich/getID3 // +///////////////////////////////////////////////////////////////// +// See readme.txt for more details // +///////////////////////////////////////////////////////////////// +// // +// module.audio-video.quicktime.php // +// module for analyzing Quicktime and MP3-in-MP4 files // +// dependencies: module.audio.mp3.php // +// dependencies: module.tag.id3v2.php // +// /// +///////////////////////////////////////////////////////////////// + +getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio.mp3.php', __FILE__, true); +getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.tag.id3v2.php', __FILE__, true); // needed for ISO 639-2 language code lookup + +class getid3_quicktime extends getid3_handler +{ + + public $ReturnAtomData = true; + public $ParseAllPossibleAtoms = false; + + public function Analyze() { + $info = &$this->getid3->info; + + $info['fileformat'] = 'quicktime'; + $info['quicktime']['hinting'] = false; + $info['quicktime']['controller'] = 'standard'; // may be overridden if 'ctyp' atom is present + + $this->fseek($info['avdataoffset']); + + $offset = 0; + $atomcounter = 0; + $atom_data_read_buffer_size = max($this->getid3->option_fread_buffer_size * 1024, ($info['php_memory_limit'] ? round($info['php_memory_limit'] / 4) : 1024)); // set read buffer to 25% of PHP memory limit (if one is specified), otherwise use option_fread_buffer_size [default: 32MB] + while ($offset < $info['avdataend']) { + if (!getid3_lib::intValueSupported($offset)) { + $this->error('Unable to parse atom at offset '.$offset.' because beyond '.round(PHP_INT_MAX / 1073741824).'GB limit of PHP filesystem functions'); + break; + } + $this->fseek($offset); + $AtomHeader = $this->fread(8); + + $atomsize = getid3_lib::BigEndian2Int(substr($AtomHeader, 0, 4)); + $atomname = substr($AtomHeader, 4, 4); + + // 64-bit MOV patch by jlegateØktnc*com + if ($atomsize == 1) { + $atomsize = getid3_lib::BigEndian2Int($this->fread(8)); + } + + $info['quicktime'][$atomname]['name'] = $atomname; + $info['quicktime'][$atomname]['size'] = $atomsize; + $info['quicktime'][$atomname]['offset'] = $offset; + + if (($offset + $atomsize) > $info['avdataend']) { + $this->error('Atom at offset '.$offset.' claims to go beyond end-of-file (length: '.$atomsize.' bytes)'); + return false; + } + + if ($atomsize == 0) { + // Furthermore, for historical reasons the list of atoms is optionally + // terminated by a 32-bit integer set to 0. If you are writing a program + // to read user data atoms, you should allow for the terminating 0. + break; + } + $atomHierarchy = array(); + $info['quicktime'][$atomname] = $this->QuicktimeParseAtom($atomname, $atomsize, $this->fread(min($atomsize, $atom_data_read_buffer_size)), $offset, $atomHierarchy, $this->ParseAllPossibleAtoms); + + $offset += $atomsize; + $atomcounter++; + } + + if (!empty($info['avdataend_tmp'])) { + // this value is assigned to a temp value and then erased because + // otherwise any atoms beyond the 'mdat' atom would not get parsed + $info['avdataend'] = $info['avdataend_tmp']; + unset($info['avdataend_tmp']); + } + + if (!empty($info['quicktime']['comments']['chapters']) && is_array($info['quicktime']['comments']['chapters']) && (count($info['quicktime']['comments']['chapters']) > 0)) { + $durations = $this->quicktime_time_to_sample_table($info); + for ($i = 0; $i < count($info['quicktime']['comments']['chapters']); $i++) { + $bookmark = array(); + $bookmark['title'] = $info['quicktime']['comments']['chapters'][$i]; + if (isset($durations[$i])) { + $bookmark['duration_sample'] = $durations[$i]['sample_duration']; + if ($i > 0) { + $bookmark['start_sample'] = $info['quicktime']['bookmarks'][($i - 1)]['start_sample'] + $info['quicktime']['bookmarks'][($i - 1)]['duration_sample']; + } else { + $bookmark['start_sample'] = 0; + } + if ($time_scale = $this->quicktime_bookmark_time_scale($info)) { + $bookmark['duration_seconds'] = $bookmark['duration_sample'] / $time_scale; + $bookmark['start_seconds'] = $bookmark['start_sample'] / $time_scale; + } + } + $info['quicktime']['bookmarks'][] = $bookmark; + } + } + + if (isset($info['quicktime']['temp_meta_key_names'])) { + unset($info['quicktime']['temp_meta_key_names']); + } + + if (!empty($info['quicktime']['comments']['location.ISO6709'])) { + // https://en.wikipedia.org/wiki/ISO_6709 + foreach ($info['quicktime']['comments']['location.ISO6709'] as $ISO6709string) { + $latitude = false; + $longitude = false; + $altitude = false; + if (preg_match('#^([\\+\\-])([0-9]{2}|[0-9]{4}|[0-9]{6})(\\.[0-9]+)?([\\+\\-])([0-9]{3}|[0-9]{5}|[0-9]{7})(\\.[0-9]+)?(([\\+\\-])([0-9]{3}|[0-9]{5}|[0-9]{7})(\\.[0-9]+)?)?/$#', $ISO6709string, $matches)) { + @list($dummy, $lat_sign, $lat_deg, $lat_deg_dec, $lon_sign, $lon_deg, $lon_deg_dec, $dummy, $alt_sign, $alt_deg, $alt_deg_dec) = $matches; + + if (strlen($lat_deg) == 2) { // [+-]DD.D + $latitude = floatval(ltrim($lat_deg, '0').$lat_deg_dec); + } elseif (strlen($lat_deg) == 4) { // [+-]DDMM.M + $latitude = floatval(ltrim(substr($lat_deg, 0, 2), '0')) + floatval(ltrim(substr($lat_deg, 2, 2), '0').$lat_deg_dec / 60); + } elseif (strlen($lat_deg) == 6) { // [+-]DDMMSS.S + $latitude = floatval(ltrim(substr($lat_deg, 0, 2), '0')) + floatval(ltrim(substr($lat_deg, 2, 2), '0') / 60) + floatval(ltrim(substr($lat_deg, 4, 2), '0').$lat_deg_dec / 3600); + } + + if (strlen($lon_deg) == 3) { // [+-]DDD.D + $longitude = floatval(ltrim($lon_deg, '0').$lon_deg_dec); + } elseif (strlen($lon_deg) == 5) { // [+-]DDDMM.M + $longitude = floatval(ltrim(substr($lon_deg, 0, 2), '0')) + floatval(ltrim(substr($lon_deg, 2, 2), '0').$lon_deg_dec / 60); + } elseif (strlen($lon_deg) == 7) { // [+-]DDDMMSS.S + $longitude = floatval(ltrim(substr($lon_deg, 0, 2), '0')) + floatval(ltrim(substr($lon_deg, 2, 2), '0') / 60) + floatval(ltrim(substr($lon_deg, 4, 2), '0').$lon_deg_dec / 3600); + } + + if (strlen($alt_deg) == 3) { // [+-]DDD.D + $altitude = floatval(ltrim($alt_deg, '0').$alt_deg_dec); + } elseif (strlen($alt_deg) == 5) { // [+-]DDDMM.M + $altitude = floatval(ltrim(substr($alt_deg, 0, 2), '0')) + floatval(ltrim(substr($alt_deg, 2, 2), '0').$alt_deg_dec / 60); + } elseif (strlen($alt_deg) == 7) { // [+-]DDDMMSS.S + $altitude = floatval(ltrim(substr($alt_deg, 0, 2), '0')) + floatval(ltrim(substr($alt_deg, 2, 2), '0') / 60) + floatval(ltrim(substr($alt_deg, 4, 2), '0').$alt_deg_dec / 3600); + } + + if ($latitude !== false) { + $info['quicktime']['comments']['gps_latitude'][] = (($lat_sign == '-') ? -1 : 1) * floatval($latitude); + } + if ($longitude !== false) { + $info['quicktime']['comments']['gps_longitude'][] = (($lon_sign == '-') ? -1 : 1) * floatval($longitude); + } + if ($altitude !== false) { + $info['quicktime']['comments']['gps_altitude'][] = (($alt_sign == '-') ? -1 : 1) * floatval($altitude); + } + } + if ($latitude === false) { + $this->warning('location.ISO6709 string not parsed correctly: "'.$ISO6709string.'", please submit as a bug'); + } + break; + } + } + + if (!isset($info['bitrate']) && isset($info['playtime_seconds'])) { + $info['bitrate'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / $info['playtime_seconds']; + } + if (isset($info['bitrate']) && !isset($info['audio']['bitrate']) && !isset($info['quicktime']['video'])) { + $info['audio']['bitrate'] = $info['bitrate']; + } + if (!empty($info['playtime_seconds']) && !isset($info['video']['frame_rate']) && !empty($info['quicktime']['stts_framecount'])) { + foreach ($info['quicktime']['stts_framecount'] as $key => $samples_count) { + $samples_per_second = $samples_count / $info['playtime_seconds']; + if ($samples_per_second > 240) { + // has to be audio samples + } else { + $info['video']['frame_rate'] = $samples_per_second; + break; + } + } + } + if ($info['audio']['dataformat'] == 'mp4') { + $info['fileformat'] = 'mp4'; + if (empty($info['video']['resolution_x'])) { + $info['mime_type'] = 'audio/mp4'; + unset($info['video']['dataformat']); + } else { + $info['mime_type'] = 'video/mp4'; + } + } + + if (!$this->ReturnAtomData) { + unset($info['quicktime']['moov']); + } + + if (empty($info['audio']['dataformat']) && !empty($info['quicktime']['audio'])) { + $info['audio']['dataformat'] = 'quicktime'; + } + if (empty($info['video']['dataformat']) && !empty($info['quicktime']['video'])) { + $info['video']['dataformat'] = 'quicktime'; + } + if (isset($info['video']) && ($info['mime_type'] == 'audio/mp4') && empty($info['video']['resolution_x']) && empty($info['video']['resolution_y'])) { + unset($info['video']); + } + + return true; + } + + public function QuicktimeParseAtom($atomname, $atomsize, $atom_data, $baseoffset, &$atomHierarchy, $ParseAllPossibleAtoms) { + // http://developer.apple.com/techpubs/quicktime/qtdevdocs/APIREF/INDEX/atomalphaindex.htm + // https://code.google.com/p/mp4v2/wiki/iTunesMetadata + + $info = &$this->getid3->info; + + $atom_parent = end($atomHierarchy); // not array_pop($atomHierarchy); see http://www.getid3.org/phpBB3/viewtopic.php?t=1717 + array_push($atomHierarchy, $atomname); + $atom_structure['hierarchy'] = implode(' ', $atomHierarchy); + $atom_structure['name'] = $atomname; + $atom_structure['size'] = $atomsize; + $atom_structure['offset'] = $baseoffset; + switch ($atomname) { + case 'moov': // MOVie container atom + case 'trak': // TRAcK container atom + case 'clip': // CLIPping container atom + case 'matt': // track MATTe container atom + case 'edts': // EDiTS container atom + case 'tref': // Track REFerence container atom + case 'mdia': // MeDIA container atom + case 'minf': // Media INFormation container atom + case 'dinf': // Data INFormation container atom + case 'udta': // User DaTA container atom + case 'cmov': // Compressed MOVie container atom + case 'rmra': // Reference Movie Record Atom + case 'rmda': // Reference Movie Descriptor Atom + case 'gmhd': // Generic Media info HeaDer atom (seen on QTVR) + $atom_structure['subatoms'] = $this->QuicktimeParseContainerAtom($atom_data, $baseoffset + 8, $atomHierarchy, $ParseAllPossibleAtoms); + break; + + case 'ilst': // Item LiST container atom + if ($atom_structure['subatoms'] = $this->QuicktimeParseContainerAtom($atom_data, $baseoffset + 8, $atomHierarchy, $ParseAllPossibleAtoms)) { + // some "ilst" atoms contain data atoms that have a numeric name, and the data is far more accessible if the returned array is compacted + $allnumericnames = true; + foreach ($atom_structure['subatoms'] as $subatomarray) { + if (!is_integer($subatomarray['name']) || (count($subatomarray['subatoms']) != 1)) { + $allnumericnames = false; + break; + } + } + if ($allnumericnames) { + $newData = array(); + foreach ($atom_structure['subatoms'] as $subatomarray) { + foreach ($subatomarray['subatoms'] as $newData_subatomarray) { + unset($newData_subatomarray['hierarchy'], $newData_subatomarray['name']); + $newData[$subatomarray['name']] = $newData_subatomarray; + break; + } + } + $atom_structure['data'] = $newData; + unset($atom_structure['subatoms']); + } + } + break; + + case "\x00\x00\x00\x01": + case "\x00\x00\x00\x02": + case "\x00\x00\x00\x03": + case "\x00\x00\x00\x04": + case "\x00\x00\x00\x05": + $atomname = getid3_lib::BigEndian2Int($atomname); + $atom_structure['name'] = $atomname; + $atom_structure['subatoms'] = $this->QuicktimeParseContainerAtom($atom_data, $baseoffset + 8, $atomHierarchy, $ParseAllPossibleAtoms); + break; + + case 'stbl': // Sample TaBLe container atom + $atom_structure['subatoms'] = $this->QuicktimeParseContainerAtom($atom_data, $baseoffset + 8, $atomHierarchy, $ParseAllPossibleAtoms); + $isVideo = false; + $framerate = 0; + $framecount = 0; + foreach ($atom_structure['subatoms'] as $key => $value_array) { + if (isset($value_array['sample_description_table'])) { + foreach ($value_array['sample_description_table'] as $key2 => $value_array2) { + if (isset($value_array2['data_format'])) { + switch ($value_array2['data_format']) { + case 'avc1': + case 'mp4v': + // video data + $isVideo = true; + break; + case 'mp4a': + // audio data + break; + } + } + } + } elseif (isset($value_array['time_to_sample_table'])) { + foreach ($value_array['time_to_sample_table'] as $key2 => $value_array2) { + if (isset($value_array2['sample_count']) && isset($value_array2['sample_duration']) && ($value_array2['sample_duration'] > 0)) { + $framerate = round($info['quicktime']['time_scale'] / $value_array2['sample_duration'], 3); + $framecount = $value_array2['sample_count']; + } + } + } + } + if ($isVideo && $framerate) { + $info['quicktime']['video']['frame_rate'] = $framerate; + $info['video']['frame_rate'] = $info['quicktime']['video']['frame_rate']; + } + if ($isVideo && $framecount) { + $info['quicktime']['video']['frame_count'] = $framecount; + } + break; + + + case "\xA9".'alb': // ALBum + case "\xA9".'ART': // + case "\xA9".'art': // ARTist + case "\xA9".'aut': // + case "\xA9".'cmt': // CoMmenT + case "\xA9".'com': // COMposer + case "\xA9".'cpy': // + case "\xA9".'day': // content created year + case "\xA9".'dir': // + case "\xA9".'ed1': // + case "\xA9".'ed2': // + case "\xA9".'ed3': // + case "\xA9".'ed4': // + case "\xA9".'ed5': // + case "\xA9".'ed6': // + case "\xA9".'ed7': // + case "\xA9".'ed8': // + case "\xA9".'ed9': // + case "\xA9".'enc': // + case "\xA9".'fmt': // + case "\xA9".'gen': // GENre + case "\xA9".'grp': // GRouPing + case "\xA9".'hst': // + case "\xA9".'inf': // + case "\xA9".'lyr': // LYRics + case "\xA9".'mak': // + case "\xA9".'mod': // + case "\xA9".'nam': // full NAMe + case "\xA9".'ope': // + case "\xA9".'PRD': // + case "\xA9".'prf': // + case "\xA9".'req': // + case "\xA9".'src': // + case "\xA9".'swr': // + case "\xA9".'too': // encoder + case "\xA9".'trk': // TRacK + case "\xA9".'url': // + case "\xA9".'wrn': // + case "\xA9".'wrt': // WRiTer + case '----': // itunes specific + case 'aART': // Album ARTist + case 'akID': // iTunes store account type + case 'apID': // Purchase Account + case 'atID': // + case 'catg': // CaTeGory + case 'cmID': // + case 'cnID': // + case 'covr': // COVeR artwork + case 'cpil': // ComPILation + case 'cprt': // CoPyRighT + case 'desc': // DESCription + case 'disk': // DISK number + case 'egid': // Episode Global ID + case 'geID': // + case 'gnre': // GeNRE + case 'hdvd': // HD ViDeo + case 'keyw': // KEYWord + case 'ldes': // Long DEScription + case 'pcst': // PodCaST + case 'pgap': // GAPless Playback + case 'plID': // + case 'purd': // PURchase Date + case 'purl': // Podcast URL + case 'rati': // + case 'rndu': // + case 'rpdu': // + case 'rtng': // RaTiNG + case 'sfID': // iTunes store country + case 'soaa': // SOrt Album Artist + case 'soal': // SOrt ALbum + case 'soar': // SOrt ARtist + case 'soco': // SOrt COmposer + case 'sonm': // SOrt NaMe + case 'sosn': // SOrt Show Name + case 'stik': // + case 'tmpo': // TeMPO (BPM) + case 'trkn': // TRacK Number + case 'tven': // tvEpisodeID + case 'tves': // TV EpiSode + case 'tvnn': // TV Network Name + case 'tvsh': // TV SHow Name + case 'tvsn': // TV SeasoN + if ($atom_parent == 'udta') { + // User data atom handler + $atom_structure['data_length'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 2)); + $atom_structure['language_id'] = getid3_lib::BigEndian2Int(substr($atom_data, 2, 2)); + $atom_structure['data'] = substr($atom_data, 4); + + $atom_structure['language'] = $this->QuicktimeLanguageLookup($atom_structure['language_id']); + if (empty($info['comments']['language']) || (!in_array($atom_structure['language'], $info['comments']['language']))) { + $info['comments']['language'][] = $atom_structure['language']; + } + } else { + // Apple item list box atom handler + $atomoffset = 0; + if (substr($atom_data, 2, 2) == "\x10\xB5") { + // not sure what it means, but observed on iPhone4 data. + // Each $atom_data has 2 bytes of datasize, plus 0x10B5, then data + while ($atomoffset < strlen($atom_data)) { + $boxsmallsize = getid3_lib::BigEndian2Int(substr($atom_data, $atomoffset, 2)); + $boxsmalltype = substr($atom_data, $atomoffset + 2, 2); + $boxsmalldata = substr($atom_data, $atomoffset + 4, $boxsmallsize); + if ($boxsmallsize <= 1) { + $this->warning('Invalid QuickTime atom smallbox size "'.$boxsmallsize.'" in atom "'.preg_replace('#[^a-zA-Z0-9 _\\-]#', '?', $atomname).'" at offset: '.($atom_structure['offset'] + $atomoffset)); + $atom_structure['data'] = null; + $atomoffset = strlen($atom_data); + break; + } + switch ($boxsmalltype) { + case "\x10\xB5": + $atom_structure['data'] = $boxsmalldata; + break; + default: + $this->warning('Unknown QuickTime smallbox type: "'.preg_replace('#[^a-zA-Z0-9 _\\-]#', '?', $boxsmalltype).'" ('.trim(getid3_lib::PrintHexBytes($boxsmalltype)).') at offset '.$baseoffset); + $atom_structure['data'] = $atom_data; + break; + } + $atomoffset += (4 + $boxsmallsize); + } + } else { + while ($atomoffset < strlen($atom_data)) { + $boxsize = getid3_lib::BigEndian2Int(substr($atom_data, $atomoffset, 4)); + $boxtype = substr($atom_data, $atomoffset + 4, 4); + $boxdata = substr($atom_data, $atomoffset + 8, $boxsize - 8); + if ($boxsize <= 1) { + $this->warning('Invalid QuickTime atom box size "'.$boxsize.'" in atom "'.preg_replace('#[^a-zA-Z0-9 _\\-]#', '?', $atomname).'" at offset: '.($atom_structure['offset'] + $atomoffset)); + $atom_structure['data'] = null; + $atomoffset = strlen($atom_data); + break; + } + $atomoffset += $boxsize; + + switch ($boxtype) { + case 'mean': + case 'name': + $atom_structure[$boxtype] = substr($boxdata, 4); + break; + + case 'data': + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($boxdata, 0, 1)); + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($boxdata, 1, 3)); + switch ($atom_structure['flags_raw']) { + case 0: // data flag + case 21: // tmpo/cpil flag + switch ($atomname) { + case 'cpil': + case 'hdvd': + case 'pcst': + case 'pgap': + // 8-bit integer (boolean) + $atom_structure['data'] = getid3_lib::BigEndian2Int(substr($boxdata, 8, 1)); + break; + + case 'tmpo': + // 16-bit integer + $atom_structure['data'] = getid3_lib::BigEndian2Int(substr($boxdata, 8, 2)); + break; + + case 'disk': + case 'trkn': + // binary + $num = getid3_lib::BigEndian2Int(substr($boxdata, 10, 2)); + $num_total = getid3_lib::BigEndian2Int(substr($boxdata, 12, 2)); + $atom_structure['data'] = empty($num) ? '' : $num; + $atom_structure['data'] .= empty($num_total) ? '' : '/'.$num_total; + break; + + case 'gnre': + // enum + $GenreID = getid3_lib::BigEndian2Int(substr($boxdata, 8, 4)); + $atom_structure['data'] = getid3_id3v1::LookupGenreName($GenreID - 1); + break; + + case 'rtng': + // 8-bit integer + $atom_structure[$atomname] = getid3_lib::BigEndian2Int(substr($boxdata, 8, 1)); + $atom_structure['data'] = $this->QuicktimeContentRatingLookup($atom_structure[$atomname]); + break; + + case 'stik': + // 8-bit integer (enum) + $atom_structure[$atomname] = getid3_lib::BigEndian2Int(substr($boxdata, 8, 1)); + $atom_structure['data'] = $this->QuicktimeSTIKLookup($atom_structure[$atomname]); + break; + + case 'sfID': + // 32-bit integer + $atom_structure[$atomname] = getid3_lib::BigEndian2Int(substr($boxdata, 8, 4)); + $atom_structure['data'] = $this->QuicktimeStoreFrontCodeLookup($atom_structure[$atomname]); + break; + + case 'egid': + case 'purl': + $atom_structure['data'] = substr($boxdata, 8); + break; + + case 'plID': + // 64-bit integer + $atom_structure['data'] = getid3_lib::BigEndian2Int(substr($boxdata, 8, 8)); + break; + + case 'covr': + $atom_structure['data'] = substr($boxdata, 8); + // not a foolproof check, but better than nothing + if (preg_match('#^\\xFF\\xD8\\xFF#', $atom_structure['data'])) { + $atom_structure['image_mime'] = 'image/jpeg'; + } elseif (preg_match('#^\\x89\\x50\\x4E\\x47\\x0D\\x0A\\x1A\\x0A#', $atom_structure['data'])) { + $atom_structure['image_mime'] = 'image/png'; + } elseif (preg_match('#^GIF#', $atom_structure['data'])) { + $atom_structure['image_mime'] = 'image/gif'; + } + break; + + case 'atID': + case 'cnID': + case 'geID': + case 'tves': + case 'tvsn': + default: + // 32-bit integer + $atom_structure['data'] = getid3_lib::BigEndian2Int(substr($boxdata, 8, 4)); + } + break; + + case 1: // text flag + case 13: // image flag + default: + $atom_structure['data'] = substr($boxdata, 8); + if ($atomname == 'covr') { + // not a foolproof check, but better than nothing + if (preg_match('#^\\xFF\\xD8\\xFF#', $atom_structure['data'])) { + $atom_structure['image_mime'] = 'image/jpeg'; + } elseif (preg_match('#^\\x89\\x50\\x4E\\x47\\x0D\\x0A\\x1A\\x0A#', $atom_structure['data'])) { + $atom_structure['image_mime'] = 'image/png'; + } elseif (preg_match('#^GIF#', $atom_structure['data'])) { + $atom_structure['image_mime'] = 'image/gif'; + } + } + break; + + } + break; + + default: + $this->warning('Unknown QuickTime box type: "'.preg_replace('#[^a-zA-Z0-9 _\\-]#', '?', $boxtype).'" ('.trim(getid3_lib::PrintHexBytes($boxtype)).') at offset '.$baseoffset); + $atom_structure['data'] = $atom_data; + + } + } + } + } + $this->CopyToAppropriateCommentsSection($atomname, $atom_structure['data'], $atom_structure['name']); + break; + + + case 'play': // auto-PLAY atom + $atom_structure['autoplay'] = (bool) getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); + + $info['quicktime']['autoplay'] = $atom_structure['autoplay']; + break; + + + case 'WLOC': // Window LOCation atom + $atom_structure['location_x'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 2)); + $atom_structure['location_y'] = getid3_lib::BigEndian2Int(substr($atom_data, 2, 2)); + break; + + + case 'LOOP': // LOOPing atom + case 'SelO': // play SELection Only atom + case 'AllF': // play ALL Frames atom + $atom_structure['data'] = getid3_lib::BigEndian2Int($atom_data); + break; + + + case 'name': // + case 'MCPS': // Media Cleaner PRo + case '@PRM': // adobe PReMiere version + case '@PRQ': // adobe PRemiere Quicktime version + $atom_structure['data'] = $atom_data; + break; + + + case 'cmvd': // Compressed MooV Data atom + // Code by ubergeekØubergeek*tv based on information from + // http://developer.apple.com/quicktime/icefloe/dispatch012.html + $atom_structure['unCompressedSize'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 4)); + + $CompressedFileData = substr($atom_data, 4); + if ($UncompressedHeader = @gzuncompress($CompressedFileData)) { + $atom_structure['subatoms'] = $this->QuicktimeParseContainerAtom($UncompressedHeader, 0, $atomHierarchy, $ParseAllPossibleAtoms); + } else { + $this->warning('Error decompressing compressed MOV atom at offset '.$atom_structure['offset']); + } + break; + + + case 'dcom': // Data COMpression atom + $atom_structure['compression_id'] = $atom_data; + $atom_structure['compression_text'] = $this->QuicktimeDCOMLookup($atom_data); + break; + + + case 'rdrf': // Reference movie Data ReFerence atom + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); + $atom_structure['flags']['internal_data'] = (bool) ($atom_structure['flags_raw'] & 0x000001); + + $atom_structure['reference_type_name'] = substr($atom_data, 4, 4); + $atom_structure['reference_length'] = getid3_lib::BigEndian2Int(substr($atom_data, 8, 4)); + switch ($atom_structure['reference_type_name']) { + case 'url ': + $atom_structure['url'] = $this->NoNullString(substr($atom_data, 12)); + break; + + case 'alis': + $atom_structure['file_alias'] = substr($atom_data, 12); + break; + + case 'rsrc': + $atom_structure['resource_alias'] = substr($atom_data, 12); + break; + + default: + $atom_structure['data'] = substr($atom_data, 12); + break; + } + break; + + + case 'rmqu': // Reference Movie QUality atom + $atom_structure['movie_quality'] = getid3_lib::BigEndian2Int($atom_data); + break; + + + case 'rmcs': // Reference Movie Cpu Speed atom + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 + $atom_structure['cpu_speed_rating'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 2)); + break; + + + case 'rmvc': // Reference Movie Version Check atom + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 + $atom_structure['gestalt_selector'] = substr($atom_data, 4, 4); + $atom_structure['gestalt_value_mask'] = getid3_lib::BigEndian2Int(substr($atom_data, 8, 4)); + $atom_structure['gestalt_value'] = getid3_lib::BigEndian2Int(substr($atom_data, 12, 4)); + $atom_structure['gestalt_check_type'] = getid3_lib::BigEndian2Int(substr($atom_data, 14, 2)); + break; + + + case 'rmcd': // Reference Movie Component check atom + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 + $atom_structure['component_type'] = substr($atom_data, 4, 4); + $atom_structure['component_subtype'] = substr($atom_data, 8, 4); + $atom_structure['component_manufacturer'] = substr($atom_data, 12, 4); + $atom_structure['component_flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 16, 4)); + $atom_structure['component_flags_mask'] = getid3_lib::BigEndian2Int(substr($atom_data, 20, 4)); + $atom_structure['component_min_version'] = getid3_lib::BigEndian2Int(substr($atom_data, 24, 4)); + break; + + + case 'rmdr': // Reference Movie Data Rate atom + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 + $atom_structure['data_rate'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); + + $atom_structure['data_rate_bps'] = $atom_structure['data_rate'] * 10; + break; + + + case 'rmla': // Reference Movie Language Atom + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 + $atom_structure['language_id'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 2)); + + $atom_structure['language'] = $this->QuicktimeLanguageLookup($atom_structure['language_id']); + if (empty($info['comments']['language']) || (!in_array($atom_structure['language'], $info['comments']['language']))) { + $info['comments']['language'][] = $atom_structure['language']; + } + break; + + + case 'rmla': // Reference Movie Language Atom + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 + $atom_structure['track_id'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 2)); + break; + + + case 'ptv ': // Print To Video - defines a movie's full screen mode + // http://developer.apple.com/documentation/QuickTime/APIREF/SOURCESIV/at_ptv-_pg.htm + $atom_structure['display_size_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 2)); + $atom_structure['reserved_1'] = getid3_lib::BigEndian2Int(substr($atom_data, 2, 2)); // hardcoded: 0x0000 + $atom_structure['reserved_2'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 2)); // hardcoded: 0x0000 + $atom_structure['slide_show_flag'] = getid3_lib::BigEndian2Int(substr($atom_data, 6, 1)); + $atom_structure['play_on_open_flag'] = getid3_lib::BigEndian2Int(substr($atom_data, 7, 1)); + + $atom_structure['flags']['play_on_open'] = (bool) $atom_structure['play_on_open_flag']; + $atom_structure['flags']['slide_show'] = (bool) $atom_structure['slide_show_flag']; + + $ptv_lookup[0] = 'normal'; + $ptv_lookup[1] = 'double'; + $ptv_lookup[2] = 'half'; + $ptv_lookup[3] = 'full'; + $ptv_lookup[4] = 'current'; + if (isset($ptv_lookup[$atom_structure['display_size_raw']])) { + $atom_structure['display_size'] = $ptv_lookup[$atom_structure['display_size_raw']]; + } else { + $this->warning('unknown "ptv " display constant ('.$atom_structure['display_size_raw'].')'); + } + break; + + + case 'stsd': // Sample Table Sample Description atom + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 + $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); + + // see: https://github.com/JamesHeinrich/getID3/issues/111 + // Some corrupt files have been known to have high bits set in the number_entries field + // This field shouldn't really need to be 32-bits, values stores are likely in the range 1-100000 + // Workaround: mask off the upper byte and throw a warning if it's nonzero + if ($atom_structure['number_entries'] > 0x000FFFFF) { + if ($atom_structure['number_entries'] > 0x00FFFFFF) { + $this->warning('"stsd" atom contains improbably large number_entries (0x'.getid3_lib::PrintHexBytes(substr($atom_data, 4, 4), true, false).' = '.$atom_structure['number_entries'].'), probably in error. Ignoring upper byte and interpreting this as 0x'.getid3_lib::PrintHexBytes(substr($atom_data, 5, 3), true, false).' = '.($atom_structure['number_entries'] & 0x00FFFFFF)); + $atom_structure['number_entries'] = ($atom_structure['number_entries'] & 0x00FFFFFF); + } else { + $this->warning('"stsd" atom contains improbably large number_entries (0x'.getid3_lib::PrintHexBytes(substr($atom_data, 4, 4), true, false).' = '.$atom_structure['number_entries'].'), probably in error. Please report this to info@getid3.org referencing bug report #111'); + } + } + + $stsdEntriesDataOffset = 8; + for ($i = 0; $i < $atom_structure['number_entries']; $i++) { + $atom_structure['sample_description_table'][$i]['size'] = getid3_lib::BigEndian2Int(substr($atom_data, $stsdEntriesDataOffset, 4)); + $stsdEntriesDataOffset += 4; + $atom_structure['sample_description_table'][$i]['data_format'] = substr($atom_data, $stsdEntriesDataOffset, 4); + $stsdEntriesDataOffset += 4; + $atom_structure['sample_description_table'][$i]['reserved'] = getid3_lib::BigEndian2Int(substr($atom_data, $stsdEntriesDataOffset, 6)); + $stsdEntriesDataOffset += 6; + $atom_structure['sample_description_table'][$i]['reference_index'] = getid3_lib::BigEndian2Int(substr($atom_data, $stsdEntriesDataOffset, 2)); + $stsdEntriesDataOffset += 2; + $atom_structure['sample_description_table'][$i]['data'] = substr($atom_data, $stsdEntriesDataOffset, ($atom_structure['sample_description_table'][$i]['size'] - 4 - 4 - 6 - 2)); + $stsdEntriesDataOffset += ($atom_structure['sample_description_table'][$i]['size'] - 4 - 4 - 6 - 2); + + $atom_structure['sample_description_table'][$i]['encoder_version'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 0, 2)); + $atom_structure['sample_description_table'][$i]['encoder_revision'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 2, 2)); + $atom_structure['sample_description_table'][$i]['encoder_vendor'] = substr($atom_structure['sample_description_table'][$i]['data'], 4, 4); + + switch ($atom_structure['sample_description_table'][$i]['encoder_vendor']) { + + case "\x00\x00\x00\x00": + // audio tracks + $atom_structure['sample_description_table'][$i]['audio_channels'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 8, 2)); + $atom_structure['sample_description_table'][$i]['audio_bit_depth'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 10, 2)); + $atom_structure['sample_description_table'][$i]['audio_compression_id'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 12, 2)); + $atom_structure['sample_description_table'][$i]['audio_packet_size'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 14, 2)); + $atom_structure['sample_description_table'][$i]['audio_sample_rate'] = getid3_lib::FixedPoint16_16(substr($atom_structure['sample_description_table'][$i]['data'], 16, 4)); + + // video tracks + // http://developer.apple.com/library/mac/#documentation/QuickTime/QTFF/QTFFChap3/qtff3.html + $atom_structure['sample_description_table'][$i]['temporal_quality'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 8, 4)); + $atom_structure['sample_description_table'][$i]['spatial_quality'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 12, 4)); + $atom_structure['sample_description_table'][$i]['width'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 16, 2)); + $atom_structure['sample_description_table'][$i]['height'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 18, 2)); + $atom_structure['sample_description_table'][$i]['resolution_x'] = getid3_lib::FixedPoint16_16(substr($atom_structure['sample_description_table'][$i]['data'], 24, 4)); + $atom_structure['sample_description_table'][$i]['resolution_y'] = getid3_lib::FixedPoint16_16(substr($atom_structure['sample_description_table'][$i]['data'], 28, 4)); + $atom_structure['sample_description_table'][$i]['data_size'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 32, 4)); + $atom_structure['sample_description_table'][$i]['frame_count'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 36, 2)); + $atom_structure['sample_description_table'][$i]['compressor_name'] = substr($atom_structure['sample_description_table'][$i]['data'], 38, 4); + $atom_structure['sample_description_table'][$i]['pixel_depth'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 42, 2)); + $atom_structure['sample_description_table'][$i]['color_table_id'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 44, 2)); + + switch ($atom_structure['sample_description_table'][$i]['data_format']) { + case '2vuY': + case 'avc1': + case 'cvid': + case 'dvc ': + case 'dvcp': + case 'gif ': + case 'h263': + case 'jpeg': + case 'kpcd': + case 'mjpa': + case 'mjpb': + case 'mp4v': + case 'png ': + case 'raw ': + case 'rle ': + case 'rpza': + case 'smc ': + case 'SVQ1': + case 'SVQ3': + case 'tiff': + case 'v210': + case 'v216': + case 'v308': + case 'v408': + case 'v410': + case 'yuv2': + $info['fileformat'] = 'mp4'; + $info['video']['fourcc'] = $atom_structure['sample_description_table'][$i]['data_format']; +// http://www.getid3.org/phpBB3/viewtopic.php?t=1550 +//if ((!empty($atom_structure['sample_description_table'][$i]['width']) && !empty($atom_structure['sample_description_table'][$i]['width'])) && (empty($info['video']['resolution_x']) || empty($info['video']['resolution_y']) || (number_format($info['video']['resolution_x'], 6) != number_format(round($info['video']['resolution_x']), 6)) || (number_format($info['video']['resolution_y'], 6) != number_format(round($info['video']['resolution_y']), 6)))) { // ugly check for floating point numbers +if (!empty($atom_structure['sample_description_table'][$i]['width']) && !empty($atom_structure['sample_description_table'][$i]['height'])) { + // assume that values stored here are more important than values stored in [tkhd] atom + $info['video']['resolution_x'] = $atom_structure['sample_description_table'][$i]['width']; + $info['video']['resolution_y'] = $atom_structure['sample_description_table'][$i]['height']; + $info['quicktime']['video']['resolution_x'] = $info['video']['resolution_x']; + $info['quicktime']['video']['resolution_y'] = $info['video']['resolution_y']; +} + break; + + case 'qtvr': + $info['video']['dataformat'] = 'quicktimevr'; + break; + + case 'mp4a': + default: + $info['quicktime']['audio']['codec'] = $this->QuicktimeAudioCodecLookup($atom_structure['sample_description_table'][$i]['data_format']); + $info['quicktime']['audio']['sample_rate'] = $atom_structure['sample_description_table'][$i]['audio_sample_rate']; + $info['quicktime']['audio']['channels'] = $atom_structure['sample_description_table'][$i]['audio_channels']; + $info['quicktime']['audio']['bit_depth'] = $atom_structure['sample_description_table'][$i]['audio_bit_depth']; + $info['audio']['codec'] = $info['quicktime']['audio']['codec']; + $info['audio']['sample_rate'] = $info['quicktime']['audio']['sample_rate']; + $info['audio']['channels'] = $info['quicktime']['audio']['channels']; + $info['audio']['bits_per_sample'] = $info['quicktime']['audio']['bit_depth']; + switch ($atom_structure['sample_description_table'][$i]['data_format']) { + case 'raw ': // PCM + case 'alac': // Apple Lossless Audio Codec + $info['audio']['lossless'] = true; + break; + default: + $info['audio']['lossless'] = false; + break; + } + break; + } + break; + + default: + switch ($atom_structure['sample_description_table'][$i]['data_format']) { + case 'mp4s': + $info['fileformat'] = 'mp4'; + break; + + default: + // video atom + $atom_structure['sample_description_table'][$i]['video_temporal_quality'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 8, 4)); + $atom_structure['sample_description_table'][$i]['video_spatial_quality'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 12, 4)); + $atom_structure['sample_description_table'][$i]['video_frame_width'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 16, 2)); + $atom_structure['sample_description_table'][$i]['video_frame_height'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 18, 2)); + $atom_structure['sample_description_table'][$i]['video_resolution_x'] = getid3_lib::FixedPoint16_16(substr($atom_structure['sample_description_table'][$i]['data'], 20, 4)); + $atom_structure['sample_description_table'][$i]['video_resolution_y'] = getid3_lib::FixedPoint16_16(substr($atom_structure['sample_description_table'][$i]['data'], 24, 4)); + $atom_structure['sample_description_table'][$i]['video_data_size'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 28, 4)); + $atom_structure['sample_description_table'][$i]['video_frame_count'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 32, 2)); + $atom_structure['sample_description_table'][$i]['video_encoder_name_len'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 34, 1)); + $atom_structure['sample_description_table'][$i]['video_encoder_name'] = substr($atom_structure['sample_description_table'][$i]['data'], 35, $atom_structure['sample_description_table'][$i]['video_encoder_name_len']); + $atom_structure['sample_description_table'][$i]['video_pixel_color_depth'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 66, 2)); + $atom_structure['sample_description_table'][$i]['video_color_table_id'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 68, 2)); + + $atom_structure['sample_description_table'][$i]['video_pixel_color_type'] = (($atom_structure['sample_description_table'][$i]['video_pixel_color_depth'] > 32) ? 'grayscale' : 'color'); + $atom_structure['sample_description_table'][$i]['video_pixel_color_name'] = $this->QuicktimeColorNameLookup($atom_structure['sample_description_table'][$i]['video_pixel_color_depth']); + + if ($atom_structure['sample_description_table'][$i]['video_pixel_color_name'] != 'invalid') { + $info['quicktime']['video']['codec_fourcc'] = $atom_structure['sample_description_table'][$i]['data_format']; + $info['quicktime']['video']['codec_fourcc_lookup'] = $this->QuicktimeVideoCodecLookup($atom_structure['sample_description_table'][$i]['data_format']); + $info['quicktime']['video']['codec'] = (($atom_structure['sample_description_table'][$i]['video_encoder_name_len'] > 0) ? $atom_structure['sample_description_table'][$i]['video_encoder_name'] : $atom_structure['sample_description_table'][$i]['data_format']); + $info['quicktime']['video']['color_depth'] = $atom_structure['sample_description_table'][$i]['video_pixel_color_depth']; + $info['quicktime']['video']['color_depth_name'] = $atom_structure['sample_description_table'][$i]['video_pixel_color_name']; + + $info['video']['codec'] = $info['quicktime']['video']['codec']; + $info['video']['bits_per_sample'] = $info['quicktime']['video']['color_depth']; + } + $info['video']['lossless'] = false; + $info['video']['pixel_aspect_ratio'] = (float) 1; + break; + } + break; + } + switch (strtolower($atom_structure['sample_description_table'][$i]['data_format'])) { + case 'mp4a': + $info['audio']['dataformat'] = 'mp4'; + $info['quicktime']['audio']['codec'] = 'mp4'; + break; + + case '3ivx': + case '3iv1': + case '3iv2': + $info['video']['dataformat'] = '3ivx'; + break; + + case 'xvid': + $info['video']['dataformat'] = 'xvid'; + break; + + case 'mp4v': + $info['video']['dataformat'] = 'mpeg4'; + break; + + case 'divx': + case 'div1': + case 'div2': + case 'div3': + case 'div4': + case 'div5': + case 'div6': + $info['video']['dataformat'] = 'divx'; + break; + + default: + // do nothing + break; + } + unset($atom_structure['sample_description_table'][$i]['data']); + } + break; + + + case 'stts': // Sample Table Time-to-Sample atom + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 + $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); + $sttsEntriesDataOffset = 8; + //$FrameRateCalculatorArray = array(); + $frames_count = 0; + + $max_stts_entries_to_scan = ($info['php_memory_limit'] ? min(floor($this->getid3->memory_limit / 10000), $atom_structure['number_entries']) : $atom_structure['number_entries']); + if ($max_stts_entries_to_scan < $atom_structure['number_entries']) { + $this->warning('QuickTime atom "stts" has '.$atom_structure['number_entries'].' but only scanning the first '.$max_stts_entries_to_scan.' entries due to limited PHP memory available ('.floor($atom_structure['number_entries'] / 1048576).'MB).'); + } + for ($i = 0; $i < $max_stts_entries_to_scan; $i++) { + $atom_structure['time_to_sample_table'][$i]['sample_count'] = getid3_lib::BigEndian2Int(substr($atom_data, $sttsEntriesDataOffset, 4)); + $sttsEntriesDataOffset += 4; + $atom_structure['time_to_sample_table'][$i]['sample_duration'] = getid3_lib::BigEndian2Int(substr($atom_data, $sttsEntriesDataOffset, 4)); + $sttsEntriesDataOffset += 4; + + $frames_count += $atom_structure['time_to_sample_table'][$i]['sample_count']; + + // THIS SECTION REPLACED WITH CODE IN "stbl" ATOM + //if (!empty($info['quicktime']['time_scale']) && ($atom_structure['time_to_sample_table'][$i]['sample_duration'] > 0)) { + // $stts_new_framerate = $info['quicktime']['time_scale'] / $atom_structure['time_to_sample_table'][$i]['sample_duration']; + // if ($stts_new_framerate <= 60) { + // // some atoms have durations of "1" giving a very large framerate, which probably is not right + // $info['video']['frame_rate'] = max($info['video']['frame_rate'], $stts_new_framerate); + // } + //} + // + //$FrameRateCalculatorArray[($info['quicktime']['time_scale'] / $atom_structure['time_to_sample_table'][$i]['sample_duration'])] += $atom_structure['time_to_sample_table'][$i]['sample_count']; + } + $info['quicktime']['stts_framecount'][] = $frames_count; + //$sttsFramesTotal = 0; + //$sttsSecondsTotal = 0; + //foreach ($FrameRateCalculatorArray as $frames_per_second => $frame_count) { + // if (($frames_per_second > 60) || ($frames_per_second < 1)) { + // // not video FPS information, probably audio information + // $sttsFramesTotal = 0; + // $sttsSecondsTotal = 0; + // break; + // } + // $sttsFramesTotal += $frame_count; + // $sttsSecondsTotal += $frame_count / $frames_per_second; + //} + //if (($sttsFramesTotal > 0) && ($sttsSecondsTotal > 0)) { + // if (($sttsFramesTotal / $sttsSecondsTotal) > $info['video']['frame_rate']) { + // $info['video']['frame_rate'] = $sttsFramesTotal / $sttsSecondsTotal; + // } + //} + break; + + + case 'stss': // Sample Table Sync Sample (key frames) atom + if ($ParseAllPossibleAtoms) { + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 + $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); + $stssEntriesDataOffset = 8; + for ($i = 0; $i < $atom_structure['number_entries']; $i++) { + $atom_structure['time_to_sample_table'][$i] = getid3_lib::BigEndian2Int(substr($atom_data, $stssEntriesDataOffset, 4)); + $stssEntriesDataOffset += 4; + } + } + break; + + + case 'stsc': // Sample Table Sample-to-Chunk atom + if ($ParseAllPossibleAtoms) { + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 + $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); + $stscEntriesDataOffset = 8; + for ($i = 0; $i < $atom_structure['number_entries']; $i++) { + $atom_structure['sample_to_chunk_table'][$i]['first_chunk'] = getid3_lib::BigEndian2Int(substr($atom_data, $stscEntriesDataOffset, 4)); + $stscEntriesDataOffset += 4; + $atom_structure['sample_to_chunk_table'][$i]['samples_per_chunk'] = getid3_lib::BigEndian2Int(substr($atom_data, $stscEntriesDataOffset, 4)); + $stscEntriesDataOffset += 4; + $atom_structure['sample_to_chunk_table'][$i]['sample_description'] = getid3_lib::BigEndian2Int(substr($atom_data, $stscEntriesDataOffset, 4)); + $stscEntriesDataOffset += 4; + } + } + break; + + + case 'stsz': // Sample Table SiZe atom + if ($ParseAllPossibleAtoms) { + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 + $atom_structure['sample_size'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); + $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data, 8, 4)); + $stszEntriesDataOffset = 12; + if ($atom_structure['sample_size'] == 0) { + for ($i = 0; $i < $atom_structure['number_entries']; $i++) { + $atom_structure['sample_size_table'][$i] = getid3_lib::BigEndian2Int(substr($atom_data, $stszEntriesDataOffset, 4)); + $stszEntriesDataOffset += 4; + } + } + } + break; + + + case 'stco': // Sample Table Chunk Offset atom + if ($ParseAllPossibleAtoms) { + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 + $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); + $stcoEntriesDataOffset = 8; + for ($i = 0; $i < $atom_structure['number_entries']; $i++) { + $atom_structure['chunk_offset_table'][$i] = getid3_lib::BigEndian2Int(substr($atom_data, $stcoEntriesDataOffset, 4)); + $stcoEntriesDataOffset += 4; + } + } + break; + + + case 'co64': // Chunk Offset 64-bit (version of "stco" that supports > 2GB files) + if ($ParseAllPossibleAtoms) { + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 + $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); + $stcoEntriesDataOffset = 8; + for ($i = 0; $i < $atom_structure['number_entries']; $i++) { + $atom_structure['chunk_offset_table'][$i] = getid3_lib::BigEndian2Int(substr($atom_data, $stcoEntriesDataOffset, 8)); + $stcoEntriesDataOffset += 8; + } + } + break; + + + case 'dref': // Data REFerence atom + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 + $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); + $drefDataOffset = 8; + for ($i = 0; $i < $atom_structure['number_entries']; $i++) { + $atom_structure['data_references'][$i]['size'] = getid3_lib::BigEndian2Int(substr($atom_data, $drefDataOffset, 4)); + $drefDataOffset += 4; + $atom_structure['data_references'][$i]['type'] = substr($atom_data, $drefDataOffset, 4); + $drefDataOffset += 4; + $atom_structure['data_references'][$i]['version'] = getid3_lib::BigEndian2Int(substr($atom_data, $drefDataOffset, 1)); + $drefDataOffset += 1; + $atom_structure['data_references'][$i]['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, $drefDataOffset, 3)); // hardcoded: 0x0000 + $drefDataOffset += 3; + $atom_structure['data_references'][$i]['data'] = substr($atom_data, $drefDataOffset, ($atom_structure['data_references'][$i]['size'] - 4 - 4 - 1 - 3)); + $drefDataOffset += ($atom_structure['data_references'][$i]['size'] - 4 - 4 - 1 - 3); + + $atom_structure['data_references'][$i]['flags']['self_reference'] = (bool) ($atom_structure['data_references'][$i]['flags_raw'] & 0x001); + } + break; + + + case 'gmin': // base Media INformation atom + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 + $atom_structure['graphics_mode'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 2)); + $atom_structure['opcolor_red'] = getid3_lib::BigEndian2Int(substr($atom_data, 6, 2)); + $atom_structure['opcolor_green'] = getid3_lib::BigEndian2Int(substr($atom_data, 8, 2)); + $atom_structure['opcolor_blue'] = getid3_lib::BigEndian2Int(substr($atom_data, 10, 2)); + $atom_structure['balance'] = getid3_lib::BigEndian2Int(substr($atom_data, 12, 2)); + $atom_structure['reserved'] = getid3_lib::BigEndian2Int(substr($atom_data, 14, 2)); + break; + + + case 'smhd': // Sound Media information HeaDer atom + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 + $atom_structure['balance'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 2)); + $atom_structure['reserved'] = getid3_lib::BigEndian2Int(substr($atom_data, 6, 2)); + break; + + + case 'vmhd': // Video Media information HeaDer atom + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); + $atom_structure['graphics_mode'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 2)); + $atom_structure['opcolor_red'] = getid3_lib::BigEndian2Int(substr($atom_data, 6, 2)); + $atom_structure['opcolor_green'] = getid3_lib::BigEndian2Int(substr($atom_data, 8, 2)); + $atom_structure['opcolor_blue'] = getid3_lib::BigEndian2Int(substr($atom_data, 10, 2)); + + $atom_structure['flags']['no_lean_ahead'] = (bool) ($atom_structure['flags_raw'] & 0x001); + break; + + + case 'hdlr': // HanDLeR reference atom + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 + $atom_structure['component_type'] = substr($atom_data, 4, 4); + $atom_structure['component_subtype'] = substr($atom_data, 8, 4); + $atom_structure['component_manufacturer'] = substr($atom_data, 12, 4); + $atom_structure['component_flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 16, 4)); + $atom_structure['component_flags_mask'] = getid3_lib::BigEndian2Int(substr($atom_data, 20, 4)); + $atom_structure['component_name'] = $this->Pascal2String(substr($atom_data, 24)); + + if (($atom_structure['component_subtype'] == 'STpn') && ($atom_structure['component_manufacturer'] == 'zzzz')) { + $info['video']['dataformat'] = 'quicktimevr'; + } + break; + + + case 'mdhd': // MeDia HeaDer atom + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 + $atom_structure['creation_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); + $atom_structure['modify_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 8, 4)); + $atom_structure['time_scale'] = getid3_lib::BigEndian2Int(substr($atom_data, 12, 4)); + $atom_structure['duration'] = getid3_lib::BigEndian2Int(substr($atom_data, 16, 4)); + $atom_structure['language_id'] = getid3_lib::BigEndian2Int(substr($atom_data, 20, 2)); + $atom_structure['quality'] = getid3_lib::BigEndian2Int(substr($atom_data, 22, 2)); + + if ($atom_structure['time_scale'] == 0) { + $this->error('Corrupt Quicktime file: mdhd.time_scale == zero'); + return false; + } + $info['quicktime']['time_scale'] = ((isset($info['quicktime']['time_scale']) && ($info['quicktime']['time_scale'] < 1000)) ? max($info['quicktime']['time_scale'], $atom_structure['time_scale']) : $atom_structure['time_scale']); + + $atom_structure['creation_time_unix'] = getid3_lib::DateMac2Unix($atom_structure['creation_time']); + $atom_structure['modify_time_unix'] = getid3_lib::DateMac2Unix($atom_structure['modify_time']); + $atom_structure['playtime_seconds'] = $atom_structure['duration'] / $atom_structure['time_scale']; + $atom_structure['language'] = $this->QuicktimeLanguageLookup($atom_structure['language_id']); + if (empty($info['comments']['language']) || (!in_array($atom_structure['language'], $info['comments']['language']))) { + $info['comments']['language'][] = $atom_structure['language']; + } + break; + + + case 'pnot': // Preview atom + $atom_structure['modification_date'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 4)); // "standard Macintosh format" + $atom_structure['version_number'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 2)); // hardcoded: 0x00 + $atom_structure['atom_type'] = substr($atom_data, 6, 4); // usually: 'PICT' + $atom_structure['atom_index'] = getid3_lib::BigEndian2Int(substr($atom_data, 10, 2)); // usually: 0x01 + + $atom_structure['modification_date_unix'] = getid3_lib::DateMac2Unix($atom_structure['modification_date']); + break; + + + case 'crgn': // Clipping ReGioN atom + $atom_structure['region_size'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 2)); // The Region size, Region boundary box, + $atom_structure['boundary_box'] = getid3_lib::BigEndian2Int(substr($atom_data, 2, 8)); // and Clipping region data fields + $atom_structure['clipping_data'] = substr($atom_data, 10); // constitute a QuickDraw region. + break; + + + case 'load': // track LOAD settings atom + $atom_structure['preload_start_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 4)); + $atom_structure['preload_duration'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); + $atom_structure['preload_flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 8, 4)); + $atom_structure['default_hints_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 12, 4)); + + $atom_structure['default_hints']['double_buffer'] = (bool) ($atom_structure['default_hints_raw'] & 0x0020); + $atom_structure['default_hints']['high_quality'] = (bool) ($atom_structure['default_hints_raw'] & 0x0100); + break; + + + case 'tmcd': // TiMe CoDe atom + case 'chap': // CHAPter list atom + case 'sync': // SYNChronization atom + case 'scpt': // tranSCriPT atom + case 'ssrc': // non-primary SouRCe atom + for ($i = 0; $i < strlen($atom_data); $i += 4) { + @$atom_structure['track_id'][] = getid3_lib::BigEndian2Int(substr($atom_data, $i, 4)); + } + break; + + + case 'elst': // Edit LiST atom + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 + $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); + for ($i = 0; $i < $atom_structure['number_entries']; $i++ ) { + $atom_structure['edit_list'][$i]['track_duration'] = getid3_lib::BigEndian2Int(substr($atom_data, 8 + ($i * 12) + 0, 4)); + $atom_structure['edit_list'][$i]['media_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 8 + ($i * 12) + 4, 4)); + $atom_structure['edit_list'][$i]['media_rate'] = getid3_lib::FixedPoint16_16(substr($atom_data, 8 + ($i * 12) + 8, 4)); + } + break; + + + case 'kmat': // compressed MATte atom + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 + $atom_structure['matte_data_raw'] = substr($atom_data, 4); + break; + + + case 'ctab': // Color TABle atom + $atom_structure['color_table_seed'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 4)); // hardcoded: 0x00000000 + $atom_structure['color_table_flags'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 2)); // hardcoded: 0x8000 + $atom_structure['color_table_size'] = getid3_lib::BigEndian2Int(substr($atom_data, 6, 2)) + 1; + for ($colortableentry = 0; $colortableentry < $atom_structure['color_table_size']; $colortableentry++) { + $atom_structure['color_table'][$colortableentry]['alpha'] = getid3_lib::BigEndian2Int(substr($atom_data, 8 + ($colortableentry * 8) + 0, 2)); + $atom_structure['color_table'][$colortableentry]['red'] = getid3_lib::BigEndian2Int(substr($atom_data, 8 + ($colortableentry * 8) + 2, 2)); + $atom_structure['color_table'][$colortableentry]['green'] = getid3_lib::BigEndian2Int(substr($atom_data, 8 + ($colortableentry * 8) + 4, 2)); + $atom_structure['color_table'][$colortableentry]['blue'] = getid3_lib::BigEndian2Int(substr($atom_data, 8 + ($colortableentry * 8) + 6, 2)); + } + break; + + + case 'mvhd': // MoVie HeaDer atom + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); + $atom_structure['creation_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); + $atom_structure['modify_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 8, 4)); + $atom_structure['time_scale'] = getid3_lib::BigEndian2Int(substr($atom_data, 12, 4)); + $atom_structure['duration'] = getid3_lib::BigEndian2Int(substr($atom_data, 16, 4)); + $atom_structure['preferred_rate'] = getid3_lib::FixedPoint16_16(substr($atom_data, 20, 4)); + $atom_structure['preferred_volume'] = getid3_lib::FixedPoint8_8(substr($atom_data, 24, 2)); + $atom_structure['reserved'] = substr($atom_data, 26, 10); + $atom_structure['matrix_a'] = getid3_lib::FixedPoint16_16(substr($atom_data, 36, 4)); + $atom_structure['matrix_b'] = getid3_lib::FixedPoint16_16(substr($atom_data, 40, 4)); + $atom_structure['matrix_u'] = getid3_lib::FixedPoint2_30(substr($atom_data, 44, 4)); + $atom_structure['matrix_c'] = getid3_lib::FixedPoint16_16(substr($atom_data, 48, 4)); + $atom_structure['matrix_d'] = getid3_lib::FixedPoint16_16(substr($atom_data, 52, 4)); + $atom_structure['matrix_v'] = getid3_lib::FixedPoint2_30(substr($atom_data, 56, 4)); + $atom_structure['matrix_x'] = getid3_lib::FixedPoint16_16(substr($atom_data, 60, 4)); + $atom_structure['matrix_y'] = getid3_lib::FixedPoint16_16(substr($atom_data, 64, 4)); + $atom_structure['matrix_w'] = getid3_lib::FixedPoint2_30(substr($atom_data, 68, 4)); + $atom_structure['preview_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 72, 4)); + $atom_structure['preview_duration'] = getid3_lib::BigEndian2Int(substr($atom_data, 76, 4)); + $atom_structure['poster_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 80, 4)); + $atom_structure['selection_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 84, 4)); + $atom_structure['selection_duration'] = getid3_lib::BigEndian2Int(substr($atom_data, 88, 4)); + $atom_structure['current_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 92, 4)); + $atom_structure['next_track_id'] = getid3_lib::BigEndian2Int(substr($atom_data, 96, 4)); + + if ($atom_structure['time_scale'] == 0) { + $this->error('Corrupt Quicktime file: mvhd.time_scale == zero'); + return false; + } + $atom_structure['creation_time_unix'] = getid3_lib::DateMac2Unix($atom_structure['creation_time']); + $atom_structure['modify_time_unix'] = getid3_lib::DateMac2Unix($atom_structure['modify_time']); + $info['quicktime']['time_scale'] = ((isset($info['quicktime']['time_scale']) && ($info['quicktime']['time_scale'] < 1000)) ? max($info['quicktime']['time_scale'], $atom_structure['time_scale']) : $atom_structure['time_scale']); + $info['quicktime']['display_scale'] = $atom_structure['matrix_a']; + $info['playtime_seconds'] = $atom_structure['duration'] / $atom_structure['time_scale']; + break; + + + case 'tkhd': // TracK HeaDer atom + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); + $atom_structure['creation_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); + $atom_structure['modify_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 8, 4)); + $atom_structure['trackid'] = getid3_lib::BigEndian2Int(substr($atom_data, 12, 4)); + $atom_structure['reserved1'] = getid3_lib::BigEndian2Int(substr($atom_data, 16, 4)); + $atom_structure['duration'] = getid3_lib::BigEndian2Int(substr($atom_data, 20, 4)); + $atom_structure['reserved2'] = getid3_lib::BigEndian2Int(substr($atom_data, 24, 8)); + $atom_structure['layer'] = getid3_lib::BigEndian2Int(substr($atom_data, 32, 2)); + $atom_structure['alternate_group'] = getid3_lib::BigEndian2Int(substr($atom_data, 34, 2)); + $atom_structure['volume'] = getid3_lib::FixedPoint8_8(substr($atom_data, 36, 2)); + $atom_structure['reserved3'] = getid3_lib::BigEndian2Int(substr($atom_data, 38, 2)); +// http://developer.apple.com/library/mac/#documentation/QuickTime/RM/MovieBasics/MTEditing/K-Chapter/11MatrixFunctions.html +// http://developer.apple.com/library/mac/#documentation/QuickTime/qtff/QTFFChap4/qtff4.html#//apple_ref/doc/uid/TP40000939-CH206-18737 + $atom_structure['matrix_a'] = getid3_lib::FixedPoint16_16(substr($atom_data, 40, 4)); + $atom_structure['matrix_b'] = getid3_lib::FixedPoint16_16(substr($atom_data, 44, 4)); + $atom_structure['matrix_u'] = getid3_lib::FixedPoint2_30(substr($atom_data, 48, 4)); + $atom_structure['matrix_c'] = getid3_lib::FixedPoint16_16(substr($atom_data, 52, 4)); + $atom_structure['matrix_d'] = getid3_lib::FixedPoint16_16(substr($atom_data, 56, 4)); + $atom_structure['matrix_v'] = getid3_lib::FixedPoint2_30(substr($atom_data, 60, 4)); + $atom_structure['matrix_x'] = getid3_lib::FixedPoint16_16(substr($atom_data, 64, 4)); + $atom_structure['matrix_y'] = getid3_lib::FixedPoint16_16(substr($atom_data, 68, 4)); + $atom_structure['matrix_w'] = getid3_lib::FixedPoint2_30(substr($atom_data, 72, 4)); + $atom_structure['width'] = getid3_lib::FixedPoint16_16(substr($atom_data, 76, 4)); + $atom_structure['height'] = getid3_lib::FixedPoint16_16(substr($atom_data, 80, 4)); + $atom_structure['flags']['enabled'] = (bool) ($atom_structure['flags_raw'] & 0x0001); + $atom_structure['flags']['in_movie'] = (bool) ($atom_structure['flags_raw'] & 0x0002); + $atom_structure['flags']['in_preview'] = (bool) ($atom_structure['flags_raw'] & 0x0004); + $atom_structure['flags']['in_poster'] = (bool) ($atom_structure['flags_raw'] & 0x0008); + $atom_structure['creation_time_unix'] = getid3_lib::DateMac2Unix($atom_structure['creation_time']); + $atom_structure['modify_time_unix'] = getid3_lib::DateMac2Unix($atom_structure['modify_time']); + + if ($atom_structure['flags']['enabled'] == 1) { + if (!isset($info['video']['resolution_x']) || !isset($info['video']['resolution_y'])) { + $info['video']['resolution_x'] = $atom_structure['width']; + $info['video']['resolution_y'] = $atom_structure['height']; + } + $info['video']['resolution_x'] = max($info['video']['resolution_x'], $atom_structure['width']); + $info['video']['resolution_y'] = max($info['video']['resolution_y'], $atom_structure['height']); + $info['quicktime']['video']['resolution_x'] = $info['video']['resolution_x']; + $info['quicktime']['video']['resolution_y'] = $info['video']['resolution_y']; + } else { + // see: http://www.getid3.org/phpBB3/viewtopic.php?t=1295 + //if (isset($info['video']['resolution_x'])) { unset($info['video']['resolution_x']); } + //if (isset($info['video']['resolution_y'])) { unset($info['video']['resolution_y']); } + //if (isset($info['quicktime']['video'])) { unset($info['quicktime']['video']); } + } + break; + + + case 'iods': // Initial Object DeScriptor atom + // http://www.koders.com/c/fid1FAB3E762903DC482D8A246D4A4BF9F28E049594.aspx?s=windows.h + // http://libquicktime.sourcearchive.com/documentation/1.0.2plus-pdebian/iods_8c-source.html + $offset = 0; + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1)); + $offset += 1; + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 3)); + $offset += 3; + $atom_structure['mp4_iod_tag'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1)); + $offset += 1; + $atom_structure['length'] = $this->quicktime_read_mp4_descr_length($atom_data, $offset); + //$offset already adjusted by quicktime_read_mp4_descr_length() + $atom_structure['object_descriptor_id'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 2)); + $offset += 2; + $atom_structure['od_profile_level'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1)); + $offset += 1; + $atom_structure['scene_profile_level'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1)); + $offset += 1; + $atom_structure['audio_profile_id'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1)); + $offset += 1; + $atom_structure['video_profile_id'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1)); + $offset += 1; + $atom_structure['graphics_profile_level'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1)); + $offset += 1; + + $atom_structure['num_iods_tracks'] = ($atom_structure['length'] - 7) / 6; // 6 bytes would only be right if all tracks use 1-byte length fields + for ($i = 0; $i < $atom_structure['num_iods_tracks']; $i++) { + $atom_structure['track'][$i]['ES_ID_IncTag'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1)); + $offset += 1; + $atom_structure['track'][$i]['length'] = $this->quicktime_read_mp4_descr_length($atom_data, $offset); + //$offset already adjusted by quicktime_read_mp4_descr_length() + $atom_structure['track'][$i]['track_id'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 4)); + $offset += 4; + } + + $atom_structure['audio_profile_name'] = $this->QuicktimeIODSaudioProfileName($atom_structure['audio_profile_id']); + $atom_structure['video_profile_name'] = $this->QuicktimeIODSvideoProfileName($atom_structure['video_profile_id']); + break; + + case 'ftyp': // FileTYPe (?) atom (for MP4 it seems) + $atom_structure['signature'] = substr($atom_data, 0, 4); + $atom_structure['unknown_1'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); + $atom_structure['fourcc'] = substr($atom_data, 8, 4); + break; + + case 'mdat': // Media DATa atom + // 'mdat' contains the actual data for the audio/video, possibly also subtitles + +/* due to lack of known documentation, this is a kludge implementation. If you know of documentation on how mdat is properly structed, please send it to info@getid3.org */ + + // first, skip any 'wide' padding, and second 'mdat' header (with specified size of zero?) + $mdat_offset = 0; + while (true) { + if (substr($atom_data, $mdat_offset, 8) == "\x00\x00\x00\x08".'wide') { + $mdat_offset += 8; + } elseif (substr($atom_data, $mdat_offset, 8) == "\x00\x00\x00\x00".'mdat') { + $mdat_offset += 8; + } else { + break; + } + } + + // check to see if it looks like chapter titles, in the form of unterminated strings with a leading 16-bit size field + while (($mdat_offset < (strlen($atom_data) - 8)) + && ($chapter_string_length = getid3_lib::BigEndian2Int(substr($atom_data, $mdat_offset, 2))) + && ($chapter_string_length < 1000) + && ($chapter_string_length <= (strlen($atom_data) - $mdat_offset - 2)) + && preg_match('#^([\x00-\xFF]{2})([\x20-\xFF]+)$#', substr($atom_data, $mdat_offset, $chapter_string_length + 2), $chapter_matches)) { + list($dummy, $chapter_string_length_hex, $chapter_string) = $chapter_matches; + $mdat_offset += (2 + $chapter_string_length); + @$info['quicktime']['comments']['chapters'][] = $chapter_string; + + // "encd" atom specifies encoding. In theory could be anything, almost always UTF-8, but may be UTF-16 with BOM (not currently handled) + if (substr($atom_data, $mdat_offset, 12) == "\x00\x00\x00\x0C\x65\x6E\x63\x64\x00\x00\x01\x00") { // UTF-8 + $mdat_offset += 12; + } + } + + + if (($atomsize > 8) && (!isset($info['avdataend_tmp']) || ($info['quicktime'][$atomname]['size'] > ($info['avdataend_tmp'] - $info['avdataoffset'])))) { + + $info['avdataoffset'] = $atom_structure['offset'] + 8; // $info['quicktime'][$atomname]['offset'] + 8; + $OldAVDataEnd = $info['avdataend']; + $info['avdataend'] = $atom_structure['offset'] + $atom_structure['size']; // $info['quicktime'][$atomname]['offset'] + $info['quicktime'][$atomname]['size']; + + $getid3_temp = new getID3(); + $getid3_temp->openfile($this->getid3->filename); + $getid3_temp->info['avdataoffset'] = $info['avdataoffset']; + $getid3_temp->info['avdataend'] = $info['avdataend']; + $getid3_mp3 = new getid3_mp3($getid3_temp); + if ($getid3_mp3->MPEGaudioHeaderValid($getid3_mp3->MPEGaudioHeaderDecode($this->fread(4)))) { + $getid3_mp3->getOnlyMPEGaudioInfo($getid3_temp->info['avdataoffset'], false); + if (!empty($getid3_temp->info['warning'])) { + foreach ($getid3_temp->info['warning'] as $value) { + $this->warning($value); + } + } + if (!empty($getid3_temp->info['mpeg'])) { + $info['mpeg'] = $getid3_temp->info['mpeg']; + if (isset($info['mpeg']['audio'])) { + $info['audio']['dataformat'] = 'mp3'; + $info['audio']['codec'] = (!empty($info['mpeg']['audio']['encoder']) ? $info['mpeg']['audio']['encoder'] : (!empty($info['mpeg']['audio']['codec']) ? $info['mpeg']['audio']['codec'] : (!empty($info['mpeg']['audio']['LAME']) ? 'LAME' :'mp3'))); + $info['audio']['sample_rate'] = $info['mpeg']['audio']['sample_rate']; + $info['audio']['channels'] = $info['mpeg']['audio']['channels']; + $info['audio']['bitrate'] = $info['mpeg']['audio']['bitrate']; + $info['audio']['bitrate_mode'] = strtolower($info['mpeg']['audio']['bitrate_mode']); + $info['bitrate'] = $info['audio']['bitrate']; + } + } + } + unset($getid3_mp3, $getid3_temp); + $info['avdataend'] = $OldAVDataEnd; + unset($OldAVDataEnd); + + } + + unset($mdat_offset, $chapter_string_length, $chapter_matches); + break; + + case 'free': // FREE space atom + case 'skip': // SKIP atom + case 'wide': // 64-bit expansion placeholder atom + // 'free', 'skip' and 'wide' are just padding, contains no useful data at all + + // When writing QuickTime files, it is sometimes necessary to update an atom's size. + // It is impossible to update a 32-bit atom to a 64-bit atom since the 32-bit atom + // is only 8 bytes in size, and the 64-bit atom requires 16 bytes. Therefore, QuickTime + // puts an 8-byte placeholder atom before any atoms it may have to update the size of. + // In this way, if the atom needs to be converted from a 32-bit to a 64-bit atom, the + // placeholder atom can be overwritten to obtain the necessary 8 extra bytes. + // The placeholder atom has a type of kWideAtomPlaceholderType ( 'wide' ). + break; + + + case 'nsav': // NoSAVe atom + // http://developer.apple.com/technotes/tn/tn2038.html + $atom_structure['data'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 4)); + break; + + case 'ctyp': // Controller TYPe atom (seen on QTVR) + // http://homepages.slingshot.co.nz/~helmboy/quicktime/formats/qtm-layout.txt + // some controller names are: + // 0x00 + 'std' for linear movie + // 'none' for no controls + $atom_structure['ctyp'] = substr($atom_data, 0, 4); + $info['quicktime']['controller'] = $atom_structure['ctyp']; + switch ($atom_structure['ctyp']) { + case 'qtvr': + $info['video']['dataformat'] = 'quicktimevr'; + break; + } + break; + + case 'pano': // PANOrama track (seen on QTVR) + $atom_structure['pano'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 4)); + break; + + case 'hint': // HINT track + case 'hinf': // + case 'hinv': // + case 'hnti': // + $info['quicktime']['hinting'] = true; + break; + + case 'imgt': // IMaGe Track reference (kQTVRImageTrackRefType) (seen on QTVR) + for ($i = 0; $i < ($atom_structure['size'] - 8); $i += 4) { + $atom_structure['imgt'][] = getid3_lib::BigEndian2Int(substr($atom_data, $i, 4)); + } + break; + + + // Observed-but-not-handled atom types are just listed here to prevent warnings being generated + case 'FXTC': // Something to do with Adobe After Effects (?) + case 'PrmA': + case 'code': + case 'FIEL': // this is NOT "fiel" (Field Ordering) as describe here: http://developer.apple.com/documentation/QuickTime/QTFF/QTFFChap3/chapter_4_section_2.html + case 'tapt': // TrackApertureModeDimensionsAID - http://developer.apple.com/documentation/QuickTime/Reference/QT7-1_Update_Reference/Constants/Constants.html + // tapt seems to be used to compute the video size [http://www.getid3.org/phpBB3/viewtopic.php?t=838] + // * http://lists.apple.com/archives/quicktime-api/2006/Aug/msg00014.html + // * http://handbrake.fr/irclogs/handbrake-dev/handbrake-dev20080128_pg2.html + case 'ctts':// STCompositionOffsetAID - http://developer.apple.com/documentation/QuickTime/Reference/QTRef_Constants/Reference/reference.html + case 'cslg':// STCompositionShiftLeastGreatestAID - http://developer.apple.com/documentation/QuickTime/Reference/QTRef_Constants/Reference/reference.html + case 'sdtp':// STSampleDependencyAID - http://developer.apple.com/documentation/QuickTime/Reference/QTRef_Constants/Reference/reference.html + case 'stps':// STPartialSyncSampleAID - http://developer.apple.com/documentation/QuickTime/Reference/QTRef_Constants/Reference/reference.html + //$atom_structure['data'] = $atom_data; + break; + + case "\xA9".'xyz': // GPS latitude+longitude+altitude + $atom_structure['data'] = $atom_data; + if (preg_match('#([\\+\\-][0-9\\.]+)([\\+\\-][0-9\\.]+)([\\+\\-][0-9\\.]+)?/$#i', $atom_data, $matches)) { + @list($all, $latitude, $longitude, $altitude) = $matches; + $info['quicktime']['comments']['gps_latitude'][] = floatval($latitude); + $info['quicktime']['comments']['gps_longitude'][] = floatval($longitude); + if (!empty($altitude)) { + $info['quicktime']['comments']['gps_altitude'][] = floatval($altitude); + } + } else { + $this->warning('QuickTime atom "©xyz" data does not match expected data pattern at offset '.$baseoffset.'. Please report as getID3() bug.'); + } + break; + + case 'NCDT': + // http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Nikon.html + // Nikon-specific QuickTime tags found in the NCDT atom of MOV videos from some Nikon cameras such as the Coolpix S8000 and D5100 + $atom_structure['subatoms'] = $this->QuicktimeParseContainerAtom($atom_data, $baseoffset + 4, $atomHierarchy, $ParseAllPossibleAtoms); + break; + case 'NCTH': // Nikon Camera THumbnail image + case 'NCVW': // Nikon Camera preVieW image + // http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Nikon.html + if (preg_match('/^\xFF\xD8\xFF/', $atom_data)) { + $atom_structure['data'] = $atom_data; + $atom_structure['image_mime'] = 'image/jpeg'; + $atom_structure['description'] = (($atomname == 'NCTH') ? 'Nikon Camera Thumbnail Image' : (($atomname == 'NCVW') ? 'Nikon Camera Preview Image' : 'Nikon preview image')); + $info['quicktime']['comments']['picture'][] = array('image_mime'=>$atom_structure['image_mime'], 'data'=>$atom_data, 'description'=>$atom_structure['description']); + } + break; + case 'NCTG': // Nikon - http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Nikon.html#NCTG + $atom_structure['data'] = $this->QuicktimeParseNikonNCTG($atom_data); + break; + case 'NCHD': // Nikon:MakerNoteVersion - http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Nikon.html + case 'NCDB': // Nikon - http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Nikon.html + case 'CNCV': // Canon:CompressorVersion - http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Canon.html + $atom_structure['data'] = $atom_data; + break; + + case "\x00\x00\x00\x00": + // some kind of metacontainer, may contain a big data dump such as: + // mdta keys \005 mdtacom.apple.quicktime.make (mdtacom.apple.quicktime.creationdate ,mdtacom.apple.quicktime.location.ISO6709 $mdtacom.apple.quicktime.software !mdtacom.apple.quicktime.model ilst \01D \001 \015data \001DE\010Apple 0 \002 (data \001DE\0102011-05-11T17:54:04+0200 2 \003 *data \001DE\010+52.4936+013.3897+040.247/ \01D \004 \015data \001DE\0104.3.1 \005 \018data \001DE\010iPhone 4 + // http://www.geocities.com/xhelmboyx/quicktime/formats/qti-layout.txt + + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); + $atom_structure['subatoms'] = $this->QuicktimeParseContainerAtom(substr($atom_data, 4), $baseoffset + 8, $atomHierarchy, $ParseAllPossibleAtoms); + //$atom_structure['subatoms'] = $this->QuicktimeParseContainerAtom($atom_data, $baseoffset + 8, $atomHierarchy, $ParseAllPossibleAtoms); + break; + + case 'meta': // METAdata atom + // https://developer.apple.com/library/mac/documentation/QuickTime/QTFF/Metadata/Metadata.html + + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); + $atom_structure['subatoms'] = $this->QuicktimeParseContainerAtom($atom_data, $baseoffset + 8, $atomHierarchy, $ParseAllPossibleAtoms); + break; + + case 'data': // metaDATA atom + static $metaDATAkey = 1; // real ugly, but so is the QuickTime structure that stores keys and values in different multinested locations that are hard to relate to each other + // seems to be 2 bytes language code (ASCII), 2 bytes unknown (set to 0x10B5 in sample I have), remainder is useful data + $atom_structure['language'] = substr($atom_data, 4 + 0, 2); + $atom_structure['unknown'] = getid3_lib::BigEndian2Int(substr($atom_data, 4 + 2, 2)); + $atom_structure['data'] = substr($atom_data, 4 + 4); + $atom_structure['key_name'] = @$info['quicktime']['temp_meta_key_names'][$metaDATAkey++]; + + if ($atom_structure['key_name'] && $atom_structure['data']) { + @$info['quicktime']['comments'][str_replace('com.apple.quicktime.', '', $atom_structure['key_name'])][] = $atom_structure['data']; + } + break; + + case 'keys': // KEYS that may be present in the metadata atom. + // https://developer.apple.com/library/mac/documentation/QuickTime/QTFF/Metadata/Metadata.html#//apple_ref/doc/uid/TP40000939-CH1-SW21 + // The metadata item keys atom holds a list of the metadata keys that may be present in the metadata atom. + // This list is indexed starting with 1; 0 is a reserved index value. The metadata item keys atom is a full atom with an atom type of "keys". + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); + $atom_structure['entry_count'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); + $keys_atom_offset = 8; + for ($i = 1; $i <= $atom_structure['entry_count']; $i++) { + $atom_structure['keys'][$i]['key_size'] = getid3_lib::BigEndian2Int(substr($atom_data, $keys_atom_offset + 0, 4)); + $atom_structure['keys'][$i]['key_namespace'] = substr($atom_data, $keys_atom_offset + 4, 4); + $atom_structure['keys'][$i]['key_value'] = substr($atom_data, $keys_atom_offset + 8, $atom_structure['keys'][$i]['key_size'] - 8); + $keys_atom_offset += $atom_structure['keys'][$i]['key_size']; // key_size includes the 4+4 bytes for key_size and key_namespace + + $info['quicktime']['temp_meta_key_names'][$i] = $atom_structure['keys'][$i]['key_value']; + } + break; + + case 'gps ': + // https://dashcamtalk.com/forum/threads/script-to-extract-gps-data-from-novatek-mp4.20808/page-2#post-291730 + // The 'gps ' contains simple look up table made up of 8byte rows, that point to the 'free' atoms that contains the actual GPS data. + // The first row is version/metadata/notsure, I skip that. + // The following rows consist of 4byte address (absolute) and 4byte size (0x1000), these point to the GPS data in the file. + + $GPS_rowsize = 8; // 4 bytes for offset, 4 bytes for size + if (strlen($atom_data) > 0) { + if ((strlen($atom_data) % $GPS_rowsize) == 0) { + $atom_structure['gps_toc'] = array(); + foreach (str_split($atom_data, $GPS_rowsize) as $counter => $datapair) { + $atom_structure['gps_toc'][] = unpack('Noffset/Nsize', substr($atom_data, $counter * $GPS_rowsize, $GPS_rowsize)); + } + + $atom_structure['gps_entries'] = array(); + $previous_offset = $this->ftell(); + foreach ($atom_structure['gps_toc'] as $key => $gps_pointer) { + if ($key == 0) { + // "The first row is version/metadata/notsure, I skip that." + continue; + } + $this->fseek($gps_pointer['offset']); + $GPS_free_data = $this->fread($gps_pointer['size']); + + /* + // 2017-05-10: I see some of the data, notably the Hour-Minute-Second, but cannot reconcile the rest of the data. However, the NMEA "GPRMC" line is there and relatively easy to parse, so I'm using that instead + + // https://dashcamtalk.com/forum/threads/script-to-extract-gps-data-from-novatek-mp4.20808/page-2#post-291730 + // The structure of the GPS data atom (the 'free' atoms mentioned above) is following: + // hour,minute,second,year,month,day,active,latitude_b,longitude_b,unknown2,latitude,longitude,speed = struct.unpack_from(' 90) ? 1900 : 2000); // complete lack of foresight: datestamps are stored with 2-digit years, take best guess + $GPS_this_GPRMC['timestamp'] = $year.'-'.$month.'-'.$day.' '.$hour.':'.$minute.':'.$second.$ms; + + $GPS_this_GPRMC['active'] = ($GPS_this_GPRMC['raw']['status'] == 'A'); // A=Active,V=Void + + foreach (array('latitude','longitude') as $latlon) { + preg_match('#^([0-9]{1,3})([0-9]{2}\\.[0-9]+)$#', $GPS_this_GPRMC['raw'][$latlon], $matches); + list($dummy, $deg, $min) = $matches; + $GPS_this_GPRMC[$latlon] = $deg + ($min / 60); + } + $GPS_this_GPRMC['latitude'] *= (($GPS_this_GPRMC['raw']['latitude_direction'] == 'S') ? -1 : 1); + $GPS_this_GPRMC['longitude'] *= (($GPS_this_GPRMC['raw']['longitude_direction'] == 'W') ? -1 : 1); + + $GPS_this_GPRMC['heading'] = $GPS_this_GPRMC['raw']['angle']; + $GPS_this_GPRMC['speed_knot'] = $GPS_this_GPRMC['raw']['knots']; + $GPS_this_GPRMC['speed_kmh'] = $GPS_this_GPRMC['raw']['knots'] * 1.852; + if ($GPS_this_GPRMC['raw']['variation']) { + $GPS_this_GPRMC['variation'] = $GPS_this_GPRMC['raw']['variation']; + $GPS_this_GPRMC['variation'] *= (($GPS_this_GPRMC['raw']['variation_direction'] == 'W') ? -1 : 1); + } + + $atom_structure['gps_entries'][$key] = $GPS_this_GPRMC; + + @$info['quicktime']['gps_track'][$GPS_this_GPRMC['timestamp']] = array( + 'latitude' => $GPS_this_GPRMC['latitude'], + 'longitude' => $GPS_this_GPRMC['longitude'], + 'speed_kmh' => $GPS_this_GPRMC['speed_kmh'], + 'heading' => $GPS_this_GPRMC['heading'], + ); + + } else { + $this->warning('Unhandled GPS format in "free" atom at offset '.$gps_pointer['offset']); + } + } + $this->fseek($previous_offset); + + } else { + $this->warning('QuickTime atom "'.$atomname.'" is not mod-8 bytes long ('.$atomsize.' bytes) at offset '.$baseoffset); + } + } else { + $this->warning('QuickTime atom "'.$atomname.'" is zero bytes long at offset '.$baseoffset); + } + break; + + case 'loci':// 3GP location (El Loco) + $loffset = 0; + $info['quicktime']['comments']['gps_flags'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 4)); + $info['quicktime']['comments']['gps_lang'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 2)); + $info['quicktime']['comments']['gps_location'] = $this->LociString(substr($atom_data, 6), $loffset); + $loci_data = substr($atom_data, 6 + $loffset); + $info['quicktime']['comments']['gps_role'] = getid3_lib::BigEndian2Int(substr($loci_data, 0, 1)); + $info['quicktime']['comments']['gps_longitude'] = getid3_lib::FixedPoint16_16(substr($loci_data, 1, 4)); + $info['quicktime']['comments']['gps_latitude'] = getid3_lib::FixedPoint16_16(substr($loci_data, 5, 4)); + $info['quicktime']['comments']['gps_altitude'] = getid3_lib::FixedPoint16_16(substr($loci_data, 9, 4)); + $info['quicktime']['comments']['gps_body'] = $this->LociString(substr($loci_data, 13 ), $loffset); + $info['quicktime']['comments']['gps_notes'] = $this->LociString(substr($loci_data, 13 + $loffset), $loffset); + break; + + case 'chpl': // CHaPter List + // https://www.adobe.com/content/dam/Adobe/en/devnet/flv/pdfs/video_file_format_spec_v10.pdf + $chpl_version = getid3_lib::BigEndian2Int(substr($atom_data, 4, 1)); // Expected to be 0 + $chpl_flags = getid3_lib::BigEndian2Int(substr($atom_data, 5, 3)); // Reserved, set to 0 + $chpl_count = getid3_lib::BigEndian2Int(substr($atom_data, 8, 1)); + $chpl_offset = 9; + for ($i = 0; $i < $chpl_count; $i++) { + if (($chpl_offset + 9) >= strlen($atom_data)) { + $this->warning('QuickTime chapter '.$i.' extends beyond end of "chpl" atom'); + break; + } + $info['quicktime']['chapters'][$i]['timestamp'] = getid3_lib::BigEndian2Int(substr($atom_data, $chpl_offset, 8)) / 10000000; // timestamps are stored as 100-nanosecond units + $chpl_offset += 8; + $chpl_title_size = getid3_lib::BigEndian2Int(substr($atom_data, $chpl_offset, 1)); + $chpl_offset += 1; + $info['quicktime']['chapters'][$i]['title'] = substr($atom_data, $chpl_offset, $chpl_title_size); + $chpl_offset += $chpl_title_size; + } + break; + + default: + $this->warning('Unknown QuickTime atom type: "'.preg_replace('#[^a-zA-Z0-9 _\\-]#', '?', $atomname).'" ('.trim(getid3_lib::PrintHexBytes($atomname)).') at offset '.$baseoffset); + $atom_structure['data'] = $atom_data; + break; + } + array_pop($atomHierarchy); + return $atom_structure; + } + + public function QuicktimeParseContainerAtom($atom_data, $baseoffset, &$atomHierarchy, $ParseAllPossibleAtoms) { +//echo 'QuicktimeParseContainerAtom('.substr($atom_data, 4, 4).') @ '.$baseoffset.'

      '; + $atom_structure = false; + $subatomoffset = 0; + $subatomcounter = 0; + if ((strlen($atom_data) == 4) && (getid3_lib::BigEndian2Int($atom_data) == 0x00000000)) { + return false; + } + while ($subatomoffset < strlen($atom_data)) { + $subatomsize = getid3_lib::BigEndian2Int(substr($atom_data, $subatomoffset + 0, 4)); + $subatomname = substr($atom_data, $subatomoffset + 4, 4); + $subatomdata = substr($atom_data, $subatomoffset + 8, $subatomsize - 8); + if ($subatomsize == 0) { + // Furthermore, for historical reasons the list of atoms is optionally + // terminated by a 32-bit integer set to 0. If you are writing a program + // to read user data atoms, you should allow for the terminating 0. + if (strlen($atom_data) > 12) { + $subatomoffset += 4; + continue; + } + return $atom_structure; + } + + $atom_structure[$subatomcounter] = $this->QuicktimeParseAtom($subatomname, $subatomsize, $subatomdata, $baseoffset + $subatomoffset, $atomHierarchy, $ParseAllPossibleAtoms); + + $subatomoffset += $subatomsize; + $subatomcounter++; + } + return $atom_structure; + } + + + public function quicktime_read_mp4_descr_length($data, &$offset) { + // http://libquicktime.sourcearchive.com/documentation/2:1.0.2plus-pdebian-2build1/esds_8c-source.html + $num_bytes = 0; + $length = 0; + do { + $b = ord(substr($data, $offset++, 1)); + $length = ($length << 7) | ($b & 0x7F); + } while (($b & 0x80) && ($num_bytes++ < 4)); + return $length; + } + + + public function QuicktimeLanguageLookup($languageid) { + // http://developer.apple.com/library/mac/#documentation/QuickTime/QTFF/QTFFChap4/qtff4.html#//apple_ref/doc/uid/TP40000939-CH206-34353 + static $QuicktimeLanguageLookup = array(); + if (empty($QuicktimeLanguageLookup)) { + $QuicktimeLanguageLookup[0] = 'English'; + $QuicktimeLanguageLookup[1] = 'French'; + $QuicktimeLanguageLookup[2] = 'German'; + $QuicktimeLanguageLookup[3] = 'Italian'; + $QuicktimeLanguageLookup[4] = 'Dutch'; + $QuicktimeLanguageLookup[5] = 'Swedish'; + $QuicktimeLanguageLookup[6] = 'Spanish'; + $QuicktimeLanguageLookup[7] = 'Danish'; + $QuicktimeLanguageLookup[8] = 'Portuguese'; + $QuicktimeLanguageLookup[9] = 'Norwegian'; + $QuicktimeLanguageLookup[10] = 'Hebrew'; + $QuicktimeLanguageLookup[11] = 'Japanese'; + $QuicktimeLanguageLookup[12] = 'Arabic'; + $QuicktimeLanguageLookup[13] = 'Finnish'; + $QuicktimeLanguageLookup[14] = 'Greek'; + $QuicktimeLanguageLookup[15] = 'Icelandic'; + $QuicktimeLanguageLookup[16] = 'Maltese'; + $QuicktimeLanguageLookup[17] = 'Turkish'; + $QuicktimeLanguageLookup[18] = 'Croatian'; + $QuicktimeLanguageLookup[19] = 'Chinese (Traditional)'; + $QuicktimeLanguageLookup[20] = 'Urdu'; + $QuicktimeLanguageLookup[21] = 'Hindi'; + $QuicktimeLanguageLookup[22] = 'Thai'; + $QuicktimeLanguageLookup[23] = 'Korean'; + $QuicktimeLanguageLookup[24] = 'Lithuanian'; + $QuicktimeLanguageLookup[25] = 'Polish'; + $QuicktimeLanguageLookup[26] = 'Hungarian'; + $QuicktimeLanguageLookup[27] = 'Estonian'; + $QuicktimeLanguageLookup[28] = 'Lettish'; + $QuicktimeLanguageLookup[28] = 'Latvian'; + $QuicktimeLanguageLookup[29] = 'Saamisk'; + $QuicktimeLanguageLookup[29] = 'Lappish'; + $QuicktimeLanguageLookup[30] = 'Faeroese'; + $QuicktimeLanguageLookup[31] = 'Farsi'; + $QuicktimeLanguageLookup[31] = 'Persian'; + $QuicktimeLanguageLookup[32] = 'Russian'; + $QuicktimeLanguageLookup[33] = 'Chinese (Simplified)'; + $QuicktimeLanguageLookup[34] = 'Flemish'; + $QuicktimeLanguageLookup[35] = 'Irish'; + $QuicktimeLanguageLookup[36] = 'Albanian'; + $QuicktimeLanguageLookup[37] = 'Romanian'; + $QuicktimeLanguageLookup[38] = 'Czech'; + $QuicktimeLanguageLookup[39] = 'Slovak'; + $QuicktimeLanguageLookup[40] = 'Slovenian'; + $QuicktimeLanguageLookup[41] = 'Yiddish'; + $QuicktimeLanguageLookup[42] = 'Serbian'; + $QuicktimeLanguageLookup[43] = 'Macedonian'; + $QuicktimeLanguageLookup[44] = 'Bulgarian'; + $QuicktimeLanguageLookup[45] = 'Ukrainian'; + $QuicktimeLanguageLookup[46] = 'Byelorussian'; + $QuicktimeLanguageLookup[47] = 'Uzbek'; + $QuicktimeLanguageLookup[48] = 'Kazakh'; + $QuicktimeLanguageLookup[49] = 'Azerbaijani'; + $QuicktimeLanguageLookup[50] = 'AzerbaijanAr'; + $QuicktimeLanguageLookup[51] = 'Armenian'; + $QuicktimeLanguageLookup[52] = 'Georgian'; + $QuicktimeLanguageLookup[53] = 'Moldavian'; + $QuicktimeLanguageLookup[54] = 'Kirghiz'; + $QuicktimeLanguageLookup[55] = 'Tajiki'; + $QuicktimeLanguageLookup[56] = 'Turkmen'; + $QuicktimeLanguageLookup[57] = 'Mongolian'; + $QuicktimeLanguageLookup[58] = 'MongolianCyr'; + $QuicktimeLanguageLookup[59] = 'Pashto'; + $QuicktimeLanguageLookup[60] = 'Kurdish'; + $QuicktimeLanguageLookup[61] = 'Kashmiri'; + $QuicktimeLanguageLookup[62] = 'Sindhi'; + $QuicktimeLanguageLookup[63] = 'Tibetan'; + $QuicktimeLanguageLookup[64] = 'Nepali'; + $QuicktimeLanguageLookup[65] = 'Sanskrit'; + $QuicktimeLanguageLookup[66] = 'Marathi'; + $QuicktimeLanguageLookup[67] = 'Bengali'; + $QuicktimeLanguageLookup[68] = 'Assamese'; + $QuicktimeLanguageLookup[69] = 'Gujarati'; + $QuicktimeLanguageLookup[70] = 'Punjabi'; + $QuicktimeLanguageLookup[71] = 'Oriya'; + $QuicktimeLanguageLookup[72] = 'Malayalam'; + $QuicktimeLanguageLookup[73] = 'Kannada'; + $QuicktimeLanguageLookup[74] = 'Tamil'; + $QuicktimeLanguageLookup[75] = 'Telugu'; + $QuicktimeLanguageLookup[76] = 'Sinhalese'; + $QuicktimeLanguageLookup[77] = 'Burmese'; + $QuicktimeLanguageLookup[78] = 'Khmer'; + $QuicktimeLanguageLookup[79] = 'Lao'; + $QuicktimeLanguageLookup[80] = 'Vietnamese'; + $QuicktimeLanguageLookup[81] = 'Indonesian'; + $QuicktimeLanguageLookup[82] = 'Tagalog'; + $QuicktimeLanguageLookup[83] = 'MalayRoman'; + $QuicktimeLanguageLookup[84] = 'MalayArabic'; + $QuicktimeLanguageLookup[85] = 'Amharic'; + $QuicktimeLanguageLookup[86] = 'Tigrinya'; + $QuicktimeLanguageLookup[87] = 'Galla'; + $QuicktimeLanguageLookup[87] = 'Oromo'; + $QuicktimeLanguageLookup[88] = 'Somali'; + $QuicktimeLanguageLookup[89] = 'Swahili'; + $QuicktimeLanguageLookup[90] = 'Ruanda'; + $QuicktimeLanguageLookup[91] = 'Rundi'; + $QuicktimeLanguageLookup[92] = 'Chewa'; + $QuicktimeLanguageLookup[93] = 'Malagasy'; + $QuicktimeLanguageLookup[94] = 'Esperanto'; + $QuicktimeLanguageLookup[128] = 'Welsh'; + $QuicktimeLanguageLookup[129] = 'Basque'; + $QuicktimeLanguageLookup[130] = 'Catalan'; + $QuicktimeLanguageLookup[131] = 'Latin'; + $QuicktimeLanguageLookup[132] = 'Quechua'; + $QuicktimeLanguageLookup[133] = 'Guarani'; + $QuicktimeLanguageLookup[134] = 'Aymara'; + $QuicktimeLanguageLookup[135] = 'Tatar'; + $QuicktimeLanguageLookup[136] = 'Uighur'; + $QuicktimeLanguageLookup[137] = 'Dzongkha'; + $QuicktimeLanguageLookup[138] = 'JavaneseRom'; + $QuicktimeLanguageLookup[32767] = 'Unspecified'; + } + if (($languageid > 138) && ($languageid < 32767)) { + /* + ISO Language Codes - http://www.loc.gov/standards/iso639-2/php/code_list.php + Because the language codes specified by ISO 639-2/T are three characters long, they must be packed to fit into a 16-bit field. + The packing algorithm must map each of the three characters, which are always lowercase, into a 5-bit integer and then concatenate + these integers into the least significant 15 bits of a 16-bit integer, leaving the 16-bit integer's most significant bit set to zero. + + One algorithm for performing this packing is to treat each ISO character as a 16-bit integer. Subtract 0x60 from the first character + and multiply by 2^10 (0x400), subtract 0x60 from the second character and multiply by 2^5 (0x20), subtract 0x60 from the third character, + and add the three 16-bit values. This will result in a single 16-bit value with the three codes correctly packed into the 15 least + significant bits and the most significant bit set to zero. + */ + $iso_language_id = ''; + $iso_language_id .= chr((($languageid & 0x7C00) >> 10) + 0x60); + $iso_language_id .= chr((($languageid & 0x03E0) >> 5) + 0x60); + $iso_language_id .= chr((($languageid & 0x001F) >> 0) + 0x60); + $QuicktimeLanguageLookup[$languageid] = getid3_id3v2::LanguageLookup($iso_language_id); + } + return (isset($QuicktimeLanguageLookup[$languageid]) ? $QuicktimeLanguageLookup[$languageid] : 'invalid'); + } + + public function QuicktimeVideoCodecLookup($codecid) { + static $QuicktimeVideoCodecLookup = array(); + if (empty($QuicktimeVideoCodecLookup)) { + $QuicktimeVideoCodecLookup['.SGI'] = 'SGI'; + $QuicktimeVideoCodecLookup['3IV1'] = '3ivx MPEG-4 v1'; + $QuicktimeVideoCodecLookup['3IV2'] = '3ivx MPEG-4 v2'; + $QuicktimeVideoCodecLookup['3IVX'] = '3ivx MPEG-4'; + $QuicktimeVideoCodecLookup['8BPS'] = 'Planar RGB'; + $QuicktimeVideoCodecLookup['avc1'] = 'H.264/MPEG-4 AVC'; + $QuicktimeVideoCodecLookup['avr '] = 'AVR-JPEG'; + $QuicktimeVideoCodecLookup['b16g'] = '16Gray'; + $QuicktimeVideoCodecLookup['b32a'] = '32AlphaGray'; + $QuicktimeVideoCodecLookup['b48r'] = '48RGB'; + $QuicktimeVideoCodecLookup['b64a'] = '64ARGB'; + $QuicktimeVideoCodecLookup['base'] = 'Base'; + $QuicktimeVideoCodecLookup['clou'] = 'Cloud'; + $QuicktimeVideoCodecLookup['cmyk'] = 'CMYK'; + $QuicktimeVideoCodecLookup['cvid'] = 'Cinepak'; + $QuicktimeVideoCodecLookup['dmb1'] = 'OpenDML JPEG'; + $QuicktimeVideoCodecLookup['dvc '] = 'DVC-NTSC'; + $QuicktimeVideoCodecLookup['dvcp'] = 'DVC-PAL'; + $QuicktimeVideoCodecLookup['dvpn'] = 'DVCPro-NTSC'; + $QuicktimeVideoCodecLookup['dvpp'] = 'DVCPro-PAL'; + $QuicktimeVideoCodecLookup['fire'] = 'Fire'; + $QuicktimeVideoCodecLookup['flic'] = 'FLC'; + $QuicktimeVideoCodecLookup['gif '] = 'GIF'; + $QuicktimeVideoCodecLookup['h261'] = 'H261'; + $QuicktimeVideoCodecLookup['h263'] = 'H263'; + $QuicktimeVideoCodecLookup['IV41'] = 'Indeo4'; + $QuicktimeVideoCodecLookup['jpeg'] = 'JPEG'; + $QuicktimeVideoCodecLookup['kpcd'] = 'PhotoCD'; + $QuicktimeVideoCodecLookup['mjpa'] = 'Motion JPEG-A'; + $QuicktimeVideoCodecLookup['mjpb'] = 'Motion JPEG-B'; + $QuicktimeVideoCodecLookup['msvc'] = 'Microsoft Video1'; + $QuicktimeVideoCodecLookup['myuv'] = 'MPEG YUV420'; + $QuicktimeVideoCodecLookup['path'] = 'Vector'; + $QuicktimeVideoCodecLookup['png '] = 'PNG'; + $QuicktimeVideoCodecLookup['PNTG'] = 'MacPaint'; + $QuicktimeVideoCodecLookup['qdgx'] = 'QuickDrawGX'; + $QuicktimeVideoCodecLookup['qdrw'] = 'QuickDraw'; + $QuicktimeVideoCodecLookup['raw '] = 'RAW'; + $QuicktimeVideoCodecLookup['ripl'] = 'WaterRipple'; + $QuicktimeVideoCodecLookup['rpza'] = 'Video'; + $QuicktimeVideoCodecLookup['smc '] = 'Graphics'; + $QuicktimeVideoCodecLookup['SVQ1'] = 'Sorenson Video 1'; + $QuicktimeVideoCodecLookup['SVQ1'] = 'Sorenson Video 3'; + $QuicktimeVideoCodecLookup['syv9'] = 'Sorenson YUV9'; + $QuicktimeVideoCodecLookup['tga '] = 'Targa'; + $QuicktimeVideoCodecLookup['tiff'] = 'TIFF'; + $QuicktimeVideoCodecLookup['WRAW'] = 'Windows RAW'; + $QuicktimeVideoCodecLookup['WRLE'] = 'BMP'; + $QuicktimeVideoCodecLookup['y420'] = 'YUV420'; + $QuicktimeVideoCodecLookup['yuv2'] = 'ComponentVideo'; + $QuicktimeVideoCodecLookup['yuvs'] = 'ComponentVideoUnsigned'; + $QuicktimeVideoCodecLookup['yuvu'] = 'ComponentVideoSigned'; + } + return (isset($QuicktimeVideoCodecLookup[$codecid]) ? $QuicktimeVideoCodecLookup[$codecid] : ''); + } + + public function QuicktimeAudioCodecLookup($codecid) { + static $QuicktimeAudioCodecLookup = array(); + if (empty($QuicktimeAudioCodecLookup)) { + $QuicktimeAudioCodecLookup['.mp3'] = 'Fraunhofer MPEG Layer-III alias'; + $QuicktimeAudioCodecLookup['aac '] = 'ISO/IEC 14496-3 AAC'; + $QuicktimeAudioCodecLookup['agsm'] = 'Apple GSM 10:1'; + $QuicktimeAudioCodecLookup['alac'] = 'Apple Lossless Audio Codec'; + $QuicktimeAudioCodecLookup['alaw'] = 'A-law 2:1'; + $QuicktimeAudioCodecLookup['conv'] = 'Sample Format'; + $QuicktimeAudioCodecLookup['dvca'] = 'DV'; + $QuicktimeAudioCodecLookup['dvi '] = 'DV 4:1'; + $QuicktimeAudioCodecLookup['eqal'] = 'Frequency Equalizer'; + $QuicktimeAudioCodecLookup['fl32'] = '32-bit Floating Point'; + $QuicktimeAudioCodecLookup['fl64'] = '64-bit Floating Point'; + $QuicktimeAudioCodecLookup['ima4'] = 'Interactive Multimedia Association 4:1'; + $QuicktimeAudioCodecLookup['in24'] = '24-bit Integer'; + $QuicktimeAudioCodecLookup['in32'] = '32-bit Integer'; + $QuicktimeAudioCodecLookup['lpc '] = 'LPC 23:1'; + $QuicktimeAudioCodecLookup['MAC3'] = 'Macintosh Audio Compression/Expansion (MACE) 3:1'; + $QuicktimeAudioCodecLookup['MAC6'] = 'Macintosh Audio Compression/Expansion (MACE) 6:1'; + $QuicktimeAudioCodecLookup['mixb'] = '8-bit Mixer'; + $QuicktimeAudioCodecLookup['mixw'] = '16-bit Mixer'; + $QuicktimeAudioCodecLookup['mp4a'] = 'ISO/IEC 14496-3 AAC'; + $QuicktimeAudioCodecLookup['MS'."\x00\x02"] = 'Microsoft ADPCM'; + $QuicktimeAudioCodecLookup['MS'."\x00\x11"] = 'DV IMA'; + $QuicktimeAudioCodecLookup['MS'."\x00\x55"] = 'Fraunhofer MPEG Layer III'; + $QuicktimeAudioCodecLookup['NONE'] = 'No Encoding'; + $QuicktimeAudioCodecLookup['Qclp'] = 'Qualcomm PureVoice'; + $QuicktimeAudioCodecLookup['QDM2'] = 'QDesign Music 2'; + $QuicktimeAudioCodecLookup['QDMC'] = 'QDesign Music 1'; + $QuicktimeAudioCodecLookup['ratb'] = '8-bit Rate'; + $QuicktimeAudioCodecLookup['ratw'] = '16-bit Rate'; + $QuicktimeAudioCodecLookup['raw '] = 'raw PCM'; + $QuicktimeAudioCodecLookup['sour'] = 'Sound Source'; + $QuicktimeAudioCodecLookup['sowt'] = 'signed/two\'s complement (Little Endian)'; + $QuicktimeAudioCodecLookup['str1'] = 'Iomega MPEG layer II'; + $QuicktimeAudioCodecLookup['str2'] = 'Iomega MPEG *layer II'; + $QuicktimeAudioCodecLookup['str3'] = 'Iomega MPEG **layer II'; + $QuicktimeAudioCodecLookup['str4'] = 'Iomega MPEG ***layer II'; + $QuicktimeAudioCodecLookup['twos'] = 'signed/two\'s complement (Big Endian)'; + $QuicktimeAudioCodecLookup['ulaw'] = 'mu-law 2:1'; + } + return (isset($QuicktimeAudioCodecLookup[$codecid]) ? $QuicktimeAudioCodecLookup[$codecid] : ''); + } + + public function QuicktimeDCOMLookup($compressionid) { + static $QuicktimeDCOMLookup = array(); + if (empty($QuicktimeDCOMLookup)) { + $QuicktimeDCOMLookup['zlib'] = 'ZLib Deflate'; + $QuicktimeDCOMLookup['adec'] = 'Apple Compression'; + } + return (isset($QuicktimeDCOMLookup[$compressionid]) ? $QuicktimeDCOMLookup[$compressionid] : ''); + } + + public function QuicktimeColorNameLookup($colordepthid) { + static $QuicktimeColorNameLookup = array(); + if (empty($QuicktimeColorNameLookup)) { + $QuicktimeColorNameLookup[1] = '2-color (monochrome)'; + $QuicktimeColorNameLookup[2] = '4-color'; + $QuicktimeColorNameLookup[4] = '16-color'; + $QuicktimeColorNameLookup[8] = '256-color'; + $QuicktimeColorNameLookup[16] = 'thousands (16-bit color)'; + $QuicktimeColorNameLookup[24] = 'millions (24-bit color)'; + $QuicktimeColorNameLookup[32] = 'millions+ (32-bit color)'; + $QuicktimeColorNameLookup[33] = 'black & white'; + $QuicktimeColorNameLookup[34] = '4-gray'; + $QuicktimeColorNameLookup[36] = '16-gray'; + $QuicktimeColorNameLookup[40] = '256-gray'; + } + return (isset($QuicktimeColorNameLookup[$colordepthid]) ? $QuicktimeColorNameLookup[$colordepthid] : 'invalid'); + } + + public function QuicktimeSTIKLookup($stik) { + static $QuicktimeSTIKLookup = array(); + if (empty($QuicktimeSTIKLookup)) { + $QuicktimeSTIKLookup[0] = 'Movie'; + $QuicktimeSTIKLookup[1] = 'Normal'; + $QuicktimeSTIKLookup[2] = 'Audiobook'; + $QuicktimeSTIKLookup[5] = 'Whacked Bookmark'; + $QuicktimeSTIKLookup[6] = 'Music Video'; + $QuicktimeSTIKLookup[9] = 'Short Film'; + $QuicktimeSTIKLookup[10] = 'TV Show'; + $QuicktimeSTIKLookup[11] = 'Booklet'; + $QuicktimeSTIKLookup[14] = 'Ringtone'; + $QuicktimeSTIKLookup[21] = 'Podcast'; + } + return (isset($QuicktimeSTIKLookup[$stik]) ? $QuicktimeSTIKLookup[$stik] : 'invalid'); + } + + public function QuicktimeIODSaudioProfileName($audio_profile_id) { + static $QuicktimeIODSaudioProfileNameLookup = array(); + if (empty($QuicktimeIODSaudioProfileNameLookup)) { + $QuicktimeIODSaudioProfileNameLookup = array( + 0x00 => 'ISO Reserved (0x00)', + 0x01 => 'Main Audio Profile @ Level 1', + 0x02 => 'Main Audio Profile @ Level 2', + 0x03 => 'Main Audio Profile @ Level 3', + 0x04 => 'Main Audio Profile @ Level 4', + 0x05 => 'Scalable Audio Profile @ Level 1', + 0x06 => 'Scalable Audio Profile @ Level 2', + 0x07 => 'Scalable Audio Profile @ Level 3', + 0x08 => 'Scalable Audio Profile @ Level 4', + 0x09 => 'Speech Audio Profile @ Level 1', + 0x0A => 'Speech Audio Profile @ Level 2', + 0x0B => 'Synthetic Audio Profile @ Level 1', + 0x0C => 'Synthetic Audio Profile @ Level 2', + 0x0D => 'Synthetic Audio Profile @ Level 3', + 0x0E => 'High Quality Audio Profile @ Level 1', + 0x0F => 'High Quality Audio Profile @ Level 2', + 0x10 => 'High Quality Audio Profile @ Level 3', + 0x11 => 'High Quality Audio Profile @ Level 4', + 0x12 => 'High Quality Audio Profile @ Level 5', + 0x13 => 'High Quality Audio Profile @ Level 6', + 0x14 => 'High Quality Audio Profile @ Level 7', + 0x15 => 'High Quality Audio Profile @ Level 8', + 0x16 => 'Low Delay Audio Profile @ Level 1', + 0x17 => 'Low Delay Audio Profile @ Level 2', + 0x18 => 'Low Delay Audio Profile @ Level 3', + 0x19 => 'Low Delay Audio Profile @ Level 4', + 0x1A => 'Low Delay Audio Profile @ Level 5', + 0x1B => 'Low Delay Audio Profile @ Level 6', + 0x1C => 'Low Delay Audio Profile @ Level 7', + 0x1D => 'Low Delay Audio Profile @ Level 8', + 0x1E => 'Natural Audio Profile @ Level 1', + 0x1F => 'Natural Audio Profile @ Level 2', + 0x20 => 'Natural Audio Profile @ Level 3', + 0x21 => 'Natural Audio Profile @ Level 4', + 0x22 => 'Mobile Audio Internetworking Profile @ Level 1', + 0x23 => 'Mobile Audio Internetworking Profile @ Level 2', + 0x24 => 'Mobile Audio Internetworking Profile @ Level 3', + 0x25 => 'Mobile Audio Internetworking Profile @ Level 4', + 0x26 => 'Mobile Audio Internetworking Profile @ Level 5', + 0x27 => 'Mobile Audio Internetworking Profile @ Level 6', + 0x28 => 'AAC Profile @ Level 1', + 0x29 => 'AAC Profile @ Level 2', + 0x2A => 'AAC Profile @ Level 4', + 0x2B => 'AAC Profile @ Level 5', + 0x2C => 'High Efficiency AAC Profile @ Level 2', + 0x2D => 'High Efficiency AAC Profile @ Level 3', + 0x2E => 'High Efficiency AAC Profile @ Level 4', + 0x2F => 'High Efficiency AAC Profile @ Level 5', + 0xFE => 'Not part of MPEG-4 audio profiles', + 0xFF => 'No audio capability required', + ); + } + return (isset($QuicktimeIODSaudioProfileNameLookup[$audio_profile_id]) ? $QuicktimeIODSaudioProfileNameLookup[$audio_profile_id] : 'ISO Reserved / User Private'); + } + + + public function QuicktimeIODSvideoProfileName($video_profile_id) { + static $QuicktimeIODSvideoProfileNameLookup = array(); + if (empty($QuicktimeIODSvideoProfileNameLookup)) { + $QuicktimeIODSvideoProfileNameLookup = array( + 0x00 => 'Reserved (0x00) Profile', + 0x01 => 'Simple Profile @ Level 1', + 0x02 => 'Simple Profile @ Level 2', + 0x03 => 'Simple Profile @ Level 3', + 0x08 => 'Simple Profile @ Level 0', + 0x10 => 'Simple Scalable Profile @ Level 0', + 0x11 => 'Simple Scalable Profile @ Level 1', + 0x12 => 'Simple Scalable Profile @ Level 2', + 0x15 => 'AVC/H264 Profile', + 0x21 => 'Core Profile @ Level 1', + 0x22 => 'Core Profile @ Level 2', + 0x32 => 'Main Profile @ Level 2', + 0x33 => 'Main Profile @ Level 3', + 0x34 => 'Main Profile @ Level 4', + 0x42 => 'N-bit Profile @ Level 2', + 0x51 => 'Scalable Texture Profile @ Level 1', + 0x61 => 'Simple Face Animation Profile @ Level 1', + 0x62 => 'Simple Face Animation Profile @ Level 2', + 0x63 => 'Simple FBA Profile @ Level 1', + 0x64 => 'Simple FBA Profile @ Level 2', + 0x71 => 'Basic Animated Texture Profile @ Level 1', + 0x72 => 'Basic Animated Texture Profile @ Level 2', + 0x81 => 'Hybrid Profile @ Level 1', + 0x82 => 'Hybrid Profile @ Level 2', + 0x91 => 'Advanced Real Time Simple Profile @ Level 1', + 0x92 => 'Advanced Real Time Simple Profile @ Level 2', + 0x93 => 'Advanced Real Time Simple Profile @ Level 3', + 0x94 => 'Advanced Real Time Simple Profile @ Level 4', + 0xA1 => 'Core Scalable Profile @ Level1', + 0xA2 => 'Core Scalable Profile @ Level2', + 0xA3 => 'Core Scalable Profile @ Level3', + 0xB1 => 'Advanced Coding Efficiency Profile @ Level 1', + 0xB2 => 'Advanced Coding Efficiency Profile @ Level 2', + 0xB3 => 'Advanced Coding Efficiency Profile @ Level 3', + 0xB4 => 'Advanced Coding Efficiency Profile @ Level 4', + 0xC1 => 'Advanced Core Profile @ Level 1', + 0xC2 => 'Advanced Core Profile @ Level 2', + 0xD1 => 'Advanced Scalable Texture @ Level1', + 0xD2 => 'Advanced Scalable Texture @ Level2', + 0xE1 => 'Simple Studio Profile @ Level 1', + 0xE2 => 'Simple Studio Profile @ Level 2', + 0xE3 => 'Simple Studio Profile @ Level 3', + 0xE4 => 'Simple Studio Profile @ Level 4', + 0xE5 => 'Core Studio Profile @ Level 1', + 0xE6 => 'Core Studio Profile @ Level 2', + 0xE7 => 'Core Studio Profile @ Level 3', + 0xE8 => 'Core Studio Profile @ Level 4', + 0xF0 => 'Advanced Simple Profile @ Level 0', + 0xF1 => 'Advanced Simple Profile @ Level 1', + 0xF2 => 'Advanced Simple Profile @ Level 2', + 0xF3 => 'Advanced Simple Profile @ Level 3', + 0xF4 => 'Advanced Simple Profile @ Level 4', + 0xF5 => 'Advanced Simple Profile @ Level 5', + 0xF7 => 'Advanced Simple Profile @ Level 3b', + 0xF8 => 'Fine Granularity Scalable Profile @ Level 0', + 0xF9 => 'Fine Granularity Scalable Profile @ Level 1', + 0xFA => 'Fine Granularity Scalable Profile @ Level 2', + 0xFB => 'Fine Granularity Scalable Profile @ Level 3', + 0xFC => 'Fine Granularity Scalable Profile @ Level 4', + 0xFD => 'Fine Granularity Scalable Profile @ Level 5', + 0xFE => 'Not part of MPEG-4 Visual profiles', + 0xFF => 'No visual capability required', + ); + } + return (isset($QuicktimeIODSvideoProfileNameLookup[$video_profile_id]) ? $QuicktimeIODSvideoProfileNameLookup[$video_profile_id] : 'ISO Reserved Profile'); + } + + + public function QuicktimeContentRatingLookup($rtng) { + static $QuicktimeContentRatingLookup = array(); + if (empty($QuicktimeContentRatingLookup)) { + $QuicktimeContentRatingLookup[0] = 'None'; + $QuicktimeContentRatingLookup[2] = 'Clean'; + $QuicktimeContentRatingLookup[4] = 'Explicit'; + } + return (isset($QuicktimeContentRatingLookup[$rtng]) ? $QuicktimeContentRatingLookup[$rtng] : 'invalid'); + } + + public function QuicktimeStoreAccountTypeLookup($akid) { + static $QuicktimeStoreAccountTypeLookup = array(); + if (empty($QuicktimeStoreAccountTypeLookup)) { + $QuicktimeStoreAccountTypeLookup[0] = 'iTunes'; + $QuicktimeStoreAccountTypeLookup[1] = 'AOL'; + } + return (isset($QuicktimeStoreAccountTypeLookup[$akid]) ? $QuicktimeStoreAccountTypeLookup[$akid] : 'invalid'); + } + + public function QuicktimeStoreFrontCodeLookup($sfid) { + static $QuicktimeStoreFrontCodeLookup = array(); + if (empty($QuicktimeStoreFrontCodeLookup)) { + $QuicktimeStoreFrontCodeLookup[143460] = 'Australia'; + $QuicktimeStoreFrontCodeLookup[143445] = 'Austria'; + $QuicktimeStoreFrontCodeLookup[143446] = 'Belgium'; + $QuicktimeStoreFrontCodeLookup[143455] = 'Canada'; + $QuicktimeStoreFrontCodeLookup[143458] = 'Denmark'; + $QuicktimeStoreFrontCodeLookup[143447] = 'Finland'; + $QuicktimeStoreFrontCodeLookup[143442] = 'France'; + $QuicktimeStoreFrontCodeLookup[143443] = 'Germany'; + $QuicktimeStoreFrontCodeLookup[143448] = 'Greece'; + $QuicktimeStoreFrontCodeLookup[143449] = 'Ireland'; + $QuicktimeStoreFrontCodeLookup[143450] = 'Italy'; + $QuicktimeStoreFrontCodeLookup[143462] = 'Japan'; + $QuicktimeStoreFrontCodeLookup[143451] = 'Luxembourg'; + $QuicktimeStoreFrontCodeLookup[143452] = 'Netherlands'; + $QuicktimeStoreFrontCodeLookup[143461] = 'New Zealand'; + $QuicktimeStoreFrontCodeLookup[143457] = 'Norway'; + $QuicktimeStoreFrontCodeLookup[143453] = 'Portugal'; + $QuicktimeStoreFrontCodeLookup[143454] = 'Spain'; + $QuicktimeStoreFrontCodeLookup[143456] = 'Sweden'; + $QuicktimeStoreFrontCodeLookup[143459] = 'Switzerland'; + $QuicktimeStoreFrontCodeLookup[143444] = 'United Kingdom'; + $QuicktimeStoreFrontCodeLookup[143441] = 'United States'; + } + return (isset($QuicktimeStoreFrontCodeLookup[$sfid]) ? $QuicktimeStoreFrontCodeLookup[$sfid] : 'invalid'); + } + + public function QuicktimeParseNikonNCTG($atom_data) { + // http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Nikon.html#NCTG + // Nikon-specific QuickTime tags found in the NCDT atom of MOV videos from some Nikon cameras such as the Coolpix S8000 and D5100 + // Data is stored as records of: + // * 4 bytes record type + // * 2 bytes size of data field type: + // 0x0001 = flag (size field *= 1-byte) + // 0x0002 = char (size field *= 1-byte) + // 0x0003 = DWORD+ (size field *= 2-byte), values are stored CDAB + // 0x0004 = QWORD+ (size field *= 4-byte), values are stored EFGHABCD + // 0x0005 = float (size field *= 8-byte), values are stored aaaabbbb where value is aaaa/bbbb; possibly multiple sets of values appended together + // 0x0007 = bytes (size field *= 1-byte), values are stored as ?????? + // 0x0008 = ????? (size field *= 2-byte), values are stored as ?????? + // * 2 bytes data size field + // * ? bytes data (string data may be null-padded; datestamp fields are in the format "2011:05:25 20:24:15") + // all integers are stored BigEndian + + $NCTGtagName = array( + 0x00000001 => 'Make', + 0x00000002 => 'Model', + 0x00000003 => 'Software', + 0x00000011 => 'CreateDate', + 0x00000012 => 'DateTimeOriginal', + 0x00000013 => 'FrameCount', + 0x00000016 => 'FrameRate', + 0x00000022 => 'FrameWidth', + 0x00000023 => 'FrameHeight', + 0x00000032 => 'AudioChannels', + 0x00000033 => 'AudioBitsPerSample', + 0x00000034 => 'AudioSampleRate', + 0x02000001 => 'MakerNoteVersion', + 0x02000005 => 'WhiteBalance', + 0x0200000b => 'WhiteBalanceFineTune', + 0x0200001e => 'ColorSpace', + 0x02000023 => 'PictureControlData', + 0x02000024 => 'WorldTime', + 0x02000032 => 'UnknownInfo', + 0x02000083 => 'LensType', + 0x02000084 => 'Lens', + ); + + $offset = 0; + $datalength = strlen($atom_data); + $parsed = array(); + while ($offset < $datalength) { +//echo getid3_lib::PrintHexBytes(substr($atom_data, $offset, 4)).'
      '; + $record_type = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 4)); $offset += 4; + $data_size_type = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 2)); $offset += 2; + $data_size = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 2)); $offset += 2; + switch ($data_size_type) { + case 0x0001: // 0x0001 = flag (size field *= 1-byte) + $data = getid3_lib::BigEndian2Int(substr($atom_data, $offset, $data_size * 1)); + $offset += ($data_size * 1); + break; + case 0x0002: // 0x0002 = char (size field *= 1-byte) + $data = substr($atom_data, $offset, $data_size * 1); + $offset += ($data_size * 1); + $data = rtrim($data, "\x00"); + break; + case 0x0003: // 0x0003 = DWORD+ (size field *= 2-byte), values are stored CDAB + $data = ''; + for ($i = $data_size - 1; $i >= 0; $i--) { + $data .= substr($atom_data, $offset + ($i * 2), 2); + } + $data = getid3_lib::BigEndian2Int($data); + $offset += ($data_size * 2); + break; + case 0x0004: // 0x0004 = QWORD+ (size field *= 4-byte), values are stored EFGHABCD + $data = ''; + for ($i = $data_size - 1; $i >= 0; $i--) { + $data .= substr($atom_data, $offset + ($i * 4), 4); + } + $data = getid3_lib::BigEndian2Int($data); + $offset += ($data_size * 4); + break; + case 0x0005: // 0x0005 = float (size field *= 8-byte), values are stored aaaabbbb where value is aaaa/bbbb; possibly multiple sets of values appended together + $data = array(); + for ($i = 0; $i < $data_size; $i++) { + $numerator = getid3_lib::BigEndian2Int(substr($atom_data, $offset + ($i * 8) + 0, 4)); + $denomninator = getid3_lib::BigEndian2Int(substr($atom_data, $offset + ($i * 8) + 4, 4)); + if ($denomninator == 0) { + $data[$i] = false; + } else { + $data[$i] = (double) $numerator / $denomninator; + } + } + $offset += (8 * $data_size); + if (count($data) == 1) { + $data = $data[0]; + } + break; + case 0x0007: // 0x0007 = bytes (size field *= 1-byte), values are stored as ?????? + $data = substr($atom_data, $offset, $data_size * 1); + $offset += ($data_size * 1); + break; + case 0x0008: // 0x0008 = ????? (size field *= 2-byte), values are stored as ?????? + $data = substr($atom_data, $offset, $data_size * 2); + $offset += ($data_size * 2); + break; + default: +echo 'QuicktimeParseNikonNCTG()::unknown $data_size_type: '.$data_size_type.'
      '; + break 2; + } + + switch ($record_type) { + case 0x00000011: // CreateDate + case 0x00000012: // DateTimeOriginal + $data = strtotime($data); + break; + case 0x0200001e: // ColorSpace + switch ($data) { + case 1: + $data = 'sRGB'; + break; + case 2: + $data = 'Adobe RGB'; + break; + } + break; + case 0x02000023: // PictureControlData + $PictureControlAdjust = array(0=>'default', 1=>'quick', 2=>'full'); + $FilterEffect = array(0x80=>'off', 0x81=>'yellow', 0x82=>'orange', 0x83=>'red', 0x84=>'green', 0xff=>'n/a'); + $ToningEffect = array(0x80=>'b&w', 0x81=>'sepia', 0x82=>'cyanotype', 0x83=>'red', 0x84=>'yellow', 0x85=>'green', 0x86=>'blue-green', 0x87=>'blue', 0x88=>'purple-blue', 0x89=>'red-purple', 0xff=>'n/a'); + $data = array( + 'PictureControlVersion' => substr($data, 0, 4), + 'PictureControlName' => rtrim(substr($data, 4, 20), "\x00"), + 'PictureControlBase' => rtrim(substr($data, 24, 20), "\x00"), + //'?' => substr($data, 44, 4), + 'PictureControlAdjust' => $PictureControlAdjust[ord(substr($data, 48, 1))], + 'PictureControlQuickAdjust' => ord(substr($data, 49, 1)), + 'Sharpness' => ord(substr($data, 50, 1)), + 'Contrast' => ord(substr($data, 51, 1)), + 'Brightness' => ord(substr($data, 52, 1)), + 'Saturation' => ord(substr($data, 53, 1)), + 'HueAdjustment' => ord(substr($data, 54, 1)), + 'FilterEffect' => $FilterEffect[ord(substr($data, 55, 1))], + 'ToningEffect' => $ToningEffect[ord(substr($data, 56, 1))], + 'ToningSaturation' => ord(substr($data, 57, 1)), + ); + break; + case 0x02000024: // WorldTime + // http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Nikon.html#WorldTime + // timezone is stored as offset from GMT in minutes + $timezone = getid3_lib::BigEndian2Int(substr($data, 0, 2)); + if ($timezone & 0x8000) { + $timezone = 0 - (0x10000 - $timezone); + } + $timezone /= 60; + + $dst = (bool) getid3_lib::BigEndian2Int(substr($data, 2, 1)); + switch (getid3_lib::BigEndian2Int(substr($data, 3, 1))) { + case 2: + $datedisplayformat = 'D/M/Y'; break; + case 1: + $datedisplayformat = 'M/D/Y'; break; + case 0: + default: + $datedisplayformat = 'Y/M/D'; break; + } + + $data = array('timezone'=>floatval($timezone), 'dst'=>$dst, 'display'=>$datedisplayformat); + break; + case 0x02000083: // LensType + $data = array( + //'_' => $data, + 'mf' => (bool) ($data & 0x01), + 'd' => (bool) ($data & 0x02), + 'g' => (bool) ($data & 0x04), + 'vr' => (bool) ($data & 0x08), + ); + break; + } + $tag_name = (isset($NCTGtagName[$record_type]) ? $NCTGtagName[$record_type] : '0x'.str_pad(dechex($record_type), 8, '0', STR_PAD_LEFT)); + $parsed[$tag_name] = $data; + } + return $parsed; + } + + + public function CopyToAppropriateCommentsSection($keyname, $data, $boxname='') { + static $handyatomtranslatorarray = array(); + if (empty($handyatomtranslatorarray)) { + // http://www.geocities.com/xhelmboyx/quicktime/formats/qtm-layout.txt + // http://www.geocities.com/xhelmboyx/quicktime/formats/mp4-layout.txt + // http://atomicparsley.sourceforge.net/mpeg-4files.html + // https://code.google.com/p/mp4v2/wiki/iTunesMetadata + $handyatomtranslatorarray["\xA9".'alb'] = 'album'; // iTunes 4.0 + $handyatomtranslatorarray["\xA9".'ART'] = 'artist'; + $handyatomtranslatorarray["\xA9".'art'] = 'artist'; // iTunes 4.0 + $handyatomtranslatorarray["\xA9".'aut'] = 'author'; + $handyatomtranslatorarray["\xA9".'cmt'] = 'comment'; // iTunes 4.0 + $handyatomtranslatorarray["\xA9".'com'] = 'comment'; + $handyatomtranslatorarray["\xA9".'cpy'] = 'copyright'; + $handyatomtranslatorarray["\xA9".'day'] = 'creation_date'; // iTunes 4.0 + $handyatomtranslatorarray["\xA9".'dir'] = 'director'; + $handyatomtranslatorarray["\xA9".'ed1'] = 'edit1'; + $handyatomtranslatorarray["\xA9".'ed2'] = 'edit2'; + $handyatomtranslatorarray["\xA9".'ed3'] = 'edit3'; + $handyatomtranslatorarray["\xA9".'ed4'] = 'edit4'; + $handyatomtranslatorarray["\xA9".'ed5'] = 'edit5'; + $handyatomtranslatorarray["\xA9".'ed6'] = 'edit6'; + $handyatomtranslatorarray["\xA9".'ed7'] = 'edit7'; + $handyatomtranslatorarray["\xA9".'ed8'] = 'edit8'; + $handyatomtranslatorarray["\xA9".'ed9'] = 'edit9'; + $handyatomtranslatorarray["\xA9".'enc'] = 'encoded_by'; + $handyatomtranslatorarray["\xA9".'fmt'] = 'format'; + $handyatomtranslatorarray["\xA9".'gen'] = 'genre'; // iTunes 4.0 + $handyatomtranslatorarray["\xA9".'grp'] = 'grouping'; // iTunes 4.2 + $handyatomtranslatorarray["\xA9".'hst'] = 'host_computer'; + $handyatomtranslatorarray["\xA9".'inf'] = 'information'; + $handyatomtranslatorarray["\xA9".'lyr'] = 'lyrics'; // iTunes 5.0 + $handyatomtranslatorarray["\xA9".'mak'] = 'make'; + $handyatomtranslatorarray["\xA9".'mod'] = 'model'; + $handyatomtranslatorarray["\xA9".'nam'] = 'title'; // iTunes 4.0 + $handyatomtranslatorarray["\xA9".'ope'] = 'composer'; + $handyatomtranslatorarray["\xA9".'prd'] = 'producer'; + $handyatomtranslatorarray["\xA9".'PRD'] = 'product'; + $handyatomtranslatorarray["\xA9".'prf'] = 'performers'; + $handyatomtranslatorarray["\xA9".'req'] = 'system_requirements'; + $handyatomtranslatorarray["\xA9".'src'] = 'source_credit'; + $handyatomtranslatorarray["\xA9".'swr'] = 'software'; + $handyatomtranslatorarray["\xA9".'too'] = 'encoding_tool'; // iTunes 4.0 + $handyatomtranslatorarray["\xA9".'trk'] = 'track'; + $handyatomtranslatorarray["\xA9".'url'] = 'url'; + $handyatomtranslatorarray["\xA9".'wrn'] = 'warning'; + $handyatomtranslatorarray["\xA9".'wrt'] = 'composer'; + $handyatomtranslatorarray['aART'] = 'album_artist'; + $handyatomtranslatorarray['apID'] = 'purchase_account'; + $handyatomtranslatorarray['catg'] = 'category'; // iTunes 4.9 + $handyatomtranslatorarray['covr'] = 'picture'; // iTunes 4.0 + $handyatomtranslatorarray['cpil'] = 'compilation'; // iTunes 4.0 + $handyatomtranslatorarray['cprt'] = 'copyright'; // iTunes 4.0? + $handyatomtranslatorarray['desc'] = 'description'; // iTunes 5.0 + $handyatomtranslatorarray['disk'] = 'disc_number'; // iTunes 4.0 + $handyatomtranslatorarray['egid'] = 'episode_guid'; // iTunes 4.9 + $handyatomtranslatorarray['gnre'] = 'genre'; // iTunes 4.0 + $handyatomtranslatorarray['hdvd'] = 'hd_video'; // iTunes 4.0 + $handyatomtranslatorarray['ldes'] = 'description_long'; // + $handyatomtranslatorarray['keyw'] = 'keyword'; // iTunes 4.9 + $handyatomtranslatorarray['pcst'] = 'podcast'; // iTunes 4.9 + $handyatomtranslatorarray['pgap'] = 'gapless_playback'; // iTunes 7.0 + $handyatomtranslatorarray['purd'] = 'purchase_date'; // iTunes 6.0.2 + $handyatomtranslatorarray['purl'] = 'podcast_url'; // iTunes 4.9 + $handyatomtranslatorarray['rtng'] = 'rating'; // iTunes 4.0 + $handyatomtranslatorarray['soaa'] = 'sort_album_artist'; // + $handyatomtranslatorarray['soal'] = 'sort_album'; // + $handyatomtranslatorarray['soar'] = 'sort_artist'; // + $handyatomtranslatorarray['soco'] = 'sort_composer'; // + $handyatomtranslatorarray['sonm'] = 'sort_title'; // + $handyatomtranslatorarray['sosn'] = 'sort_show'; // + $handyatomtranslatorarray['stik'] = 'stik'; // iTunes 4.9 + $handyatomtranslatorarray['tmpo'] = 'bpm'; // iTunes 4.0 + $handyatomtranslatorarray['trkn'] = 'track_number'; // iTunes 4.0 + $handyatomtranslatorarray['tven'] = 'tv_episode_id'; // + $handyatomtranslatorarray['tves'] = 'tv_episode'; // iTunes 6.0 + $handyatomtranslatorarray['tvnn'] = 'tv_network_name'; // iTunes 6.0 + $handyatomtranslatorarray['tvsh'] = 'tv_show_name'; // iTunes 6.0 + $handyatomtranslatorarray['tvsn'] = 'tv_season'; // iTunes 6.0 + + // boxnames: + /* + $handyatomtranslatorarray['iTunSMPB'] = 'iTunSMPB'; + $handyatomtranslatorarray['iTunNORM'] = 'iTunNORM'; + $handyatomtranslatorarray['Encoding Params'] = 'Encoding Params'; + $handyatomtranslatorarray['replaygain_track_gain'] = 'replaygain_track_gain'; + $handyatomtranslatorarray['replaygain_track_peak'] = 'replaygain_track_peak'; + $handyatomtranslatorarray['replaygain_track_minmax'] = 'replaygain_track_minmax'; + $handyatomtranslatorarray['MusicIP PUID'] = 'MusicIP PUID'; + $handyatomtranslatorarray['MusicBrainz Artist Id'] = 'MusicBrainz Artist Id'; + $handyatomtranslatorarray['MusicBrainz Album Id'] = 'MusicBrainz Album Id'; + $handyatomtranslatorarray['MusicBrainz Album Artist Id'] = 'MusicBrainz Album Artist Id'; + $handyatomtranslatorarray['MusicBrainz Track Id'] = 'MusicBrainz Track Id'; + $handyatomtranslatorarray['MusicBrainz Disc Id'] = 'MusicBrainz Disc Id'; + + // http://age.hobba.nl/audio/tag_frame_reference.html + $handyatomtranslatorarray['PLAY_COUNTER'] = 'play_counter'; // Foobar2000 - http://www.getid3.org/phpBB3/viewtopic.php?t=1355 + $handyatomtranslatorarray['MEDIATYPE'] = 'mediatype'; // Foobar2000 - http://www.getid3.org/phpBB3/viewtopic.php?t=1355 + */ + } + $info = &$this->getid3->info; + $comment_key = ''; + if ($boxname && ($boxname != $keyname)) { + $comment_key = (isset($handyatomtranslatorarray[$boxname]) ? $handyatomtranslatorarray[$boxname] : $boxname); + } elseif (isset($handyatomtranslatorarray[$keyname])) { + $comment_key = $handyatomtranslatorarray[$keyname]; + } + if ($comment_key) { + if ($comment_key == 'picture') { + if (!is_array($data)) { + $image_mime = ''; + if (preg_match('#^\x89\x50\x4E\x47\x0D\x0A\x1A\x0A#', $data)) { + $image_mime = 'image/png'; + } elseif (preg_match('#^\xFF\xD8\xFF#', $data)) { + $image_mime = 'image/jpeg'; + } elseif (preg_match('#^GIF#', $data)) { + $image_mime = 'image/gif'; + } elseif (preg_match('#^BM#', $data)) { + $image_mime = 'image/bmp'; + } + $data = array('data'=>$data, 'image_mime'=>$image_mime); + } + } + $gooddata = array($data); + if ($comment_key == 'genre') { + // some other taggers separate multiple genres with semicolon, e.g. "Heavy Metal;Thrash Metal;Metal" + $gooddata = explode(';', $data); + } + foreach ($gooddata as $data) { + $info['quicktime']['comments'][$comment_key][] = $data; + } + } + return true; + } + + public function LociString($lstring, &$count) { + // Loci strings are UTF-8 or UTF-16 and null (x00/x0000) terminated. UTF-16 has a BOM + // Also need to return the number of bytes the string occupied so additional fields can be extracted + $len = strlen($lstring); + if ($len == 0) { + $count = 0; + return ''; + } + if ($lstring[0] == "\x00") { + $count = 1; + return ''; + } + //check for BOM + if ($len > 2 && (($lstring[0] == "\xFE" && $lstring[1] == "\xFF") || ($lstring[0] == "\xFF" && $lstring[1] == "\xFE"))) { + //UTF-16 + if (preg_match('/(.*)\x00/', $lstring, $lmatches)){ + $count = strlen($lmatches[1]) * 2 + 2; //account for 2 byte characters and trailing \x0000 + return getid3_lib::iconv_fallback_utf16_utf8($lmatches[1]); + } else { + return ''; + } + } else { + //UTF-8 + if (preg_match('/(.*)\x00/', $lstring, $lmatches)){ + $count = strlen($lmatches[1]) + 1; //account for trailing \x00 + return $lmatches[1]; + }else { + return ''; + } + + } + } + + public function NoNullString($nullterminatedstring) { + // remove the single null terminator on null terminated strings + if (substr($nullterminatedstring, strlen($nullterminatedstring) - 1, 1) === "\x00") { + return substr($nullterminatedstring, 0, strlen($nullterminatedstring) - 1); + } + return $nullterminatedstring; + } + + public function Pascal2String($pascalstring) { + // Pascal strings have 1 unsigned byte at the beginning saying how many chars (1-255) are in the string + return substr($pascalstring, 1); + } + + + /* + // helper functions for m4b audiobook chapters + // code by Steffen Hartmann 2015-Nov-08 + */ + public function search_tag_by_key($info, $tag, $history, &$result) { + foreach ($info as $key => $value) { + $key_history = $history.'/'.$key; + if ($key === $tag) { + $result[] = array($key_history, $info); + } else { + if (is_array($value)) { + $this->search_tag_by_key($value, $tag, $key_history, $result); + } + } + } + } + + public function search_tag_by_pair($info, $k, $v, $history, &$result) { + foreach ($info as $key => $value) { + $key_history = $history.'/'.$key; + if (($key === $k) && ($value === $v)) { + $result[] = array($key_history, $info); + } else { + if (is_array($value)) { + $this->search_tag_by_pair($value, $k, $v, $key_history, $result); + } + } + } + } + + public function quicktime_time_to_sample_table($info) { + $res = array(); + $this->search_tag_by_pair($info['quicktime']['moov'], 'name', 'stbl', 'quicktime/moov', $res); + foreach ($res as $value) { + $stbl_res = array(); + $this->search_tag_by_pair($value[1], 'data_format', 'text', $value[0], $stbl_res); + if (count($stbl_res) > 0) { + $stts_res = array(); + $this->search_tag_by_key($value[1], 'time_to_sample_table', $value[0], $stts_res); + if (count($stts_res) > 0) { + return $stts_res[0][1]['time_to_sample_table']; + } + } + } + return array(); + } + + function quicktime_bookmark_time_scale($info) { + $time_scale = ''; + $ts_prefix_len = 0; + $res = array(); + $this->search_tag_by_pair($info['quicktime']['moov'], 'name', 'stbl', 'quicktime/moov', $res); + foreach ($res as $value) { + $stbl_res = array(); + $this->search_tag_by_pair($value[1], 'data_format', 'text', $value[0], $stbl_res); + if (count($stbl_res) > 0) { + $ts_res = array(); + $this->search_tag_by_key($info['quicktime']['moov'], 'time_scale', 'quicktime/moov', $ts_res); + foreach ($ts_res as $value) { + $prefix = substr($value[0], 0, -12); + if ((substr($stbl_res[0][0], 0, strlen($prefix)) === $prefix) && ($ts_prefix_len < strlen($prefix))) { + $time_scale = $value[1]['time_scale']; + $ts_prefix_len = strlen($prefix); + } + } + } + } + return $time_scale; + } + /* + // END helper functions for m4b audiobook chapters + */ + + +} diff --git a/www/rompr/getid3/module.audio-video.real.php b/www/rompr/getid3/module.audio-video.real.php new file mode 100644 index 0000000..280d43c --- /dev/null +++ b/www/rompr/getid3/module.audio-video.real.php @@ -0,0 +1,528 @@ + // +// available at http://getid3.sourceforge.net // +// or http://www.getid3.org // +// also https://github.com/JamesHeinrich/getID3 // +///////////////////////////////////////////////////////////////// +// See readme.txt for more details // +///////////////////////////////////////////////////////////////// +// // +// module.audio-video.real.php // +// module for analyzing Real Audio/Video files // +// dependencies: module.audio-video.riff.php // +// /// +///////////////////////////////////////////////////////////////// + +getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio-video.riff.php', __FILE__, true); + +class getid3_real extends getid3_handler +{ + + public function Analyze() { + $info = &$this->getid3->info; + + $info['fileformat'] = 'real'; + $info['bitrate'] = 0; + $info['playtime_seconds'] = 0; + + $this->fseek($info['avdataoffset']); + $ChunkCounter = 0; + while ($this->ftell() < $info['avdataend']) { + $ChunkData = $this->fread(8); + $ChunkName = substr($ChunkData, 0, 4); + $ChunkSize = getid3_lib::BigEndian2Int(substr($ChunkData, 4, 4)); + + if ($ChunkName == '.ra'."\xFD") { + $ChunkData .= $this->fread($ChunkSize - 8); + if ($this->ParseOldRAheader(substr($ChunkData, 0, 128), $info['real']['old_ra_header'])) { + $info['audio']['dataformat'] = 'real'; + $info['audio']['lossless'] = false; + $info['audio']['sample_rate'] = $info['real']['old_ra_header']['sample_rate']; + $info['audio']['bits_per_sample'] = $info['real']['old_ra_header']['bits_per_sample']; + $info['audio']['channels'] = $info['real']['old_ra_header']['channels']; + + $info['playtime_seconds'] = 60 * ($info['real']['old_ra_header']['audio_bytes'] / $info['real']['old_ra_header']['bytes_per_minute']); + $info['audio']['bitrate'] = 8 * ($info['real']['old_ra_header']['audio_bytes'] / $info['playtime_seconds']); + $info['audio']['codec'] = $this->RealAudioCodecFourCClookup($info['real']['old_ra_header']['fourcc'], $info['audio']['bitrate']); + + foreach ($info['real']['old_ra_header']['comments'] as $key => $valuearray) { + if (strlen(trim($valuearray[0])) > 0) { + $info['real']['comments'][$key][] = trim($valuearray[0]); + } + } + return true; + } + $this->error('There was a problem parsing this RealAudio file. Please submit it for analysis to info@getid3.org'); + unset($info['bitrate']); + unset($info['playtime_seconds']); + return false; + } + + // shortcut + $info['real']['chunks'][$ChunkCounter] = array(); + $thisfile_real_chunks_currentchunk = &$info['real']['chunks'][$ChunkCounter]; + + $thisfile_real_chunks_currentchunk['name'] = $ChunkName; + $thisfile_real_chunks_currentchunk['offset'] = $this->ftell() - 8; + $thisfile_real_chunks_currentchunk['length'] = $ChunkSize; + if (($thisfile_real_chunks_currentchunk['offset'] + $thisfile_real_chunks_currentchunk['length']) > $info['avdataend']) { + $this->warning('Chunk "'.$thisfile_real_chunks_currentchunk['name'].'" at offset '.$thisfile_real_chunks_currentchunk['offset'].' claims to be '.$thisfile_real_chunks_currentchunk['length'].' bytes long, which is beyond end of file'); + return false; + } + + if ($ChunkSize > ($this->getid3->fread_buffer_size() + 8)) { + + $ChunkData .= $this->fread($this->getid3->fread_buffer_size() - 8); + $this->fseek($thisfile_real_chunks_currentchunk['offset'] + $ChunkSize); + + } elseif(($ChunkSize - 8) > 0) { + + $ChunkData .= $this->fread($ChunkSize - 8); + + } + $offset = 8; + + switch ($ChunkName) { + + case '.RMF': // RealMedia File Header + $thisfile_real_chunks_currentchunk['object_version'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 2)); + $offset += 2; + switch ($thisfile_real_chunks_currentchunk['object_version']) { + + case 0: + $thisfile_real_chunks_currentchunk['file_version'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 4)); + $offset += 4; + $thisfile_real_chunks_currentchunk['headers_count'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 4)); + $offset += 4; + break; + + default: + //$this->warning('Expected .RMF-object_version to be "0", actual value is "'.$thisfile_real_chunks_currentchunk['object_version'].'" (should not be a problem)'); + break; + + } + break; + + + case 'PROP': // Properties Header + $thisfile_real_chunks_currentchunk['object_version'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 2)); + $offset += 2; + if ($thisfile_real_chunks_currentchunk['object_version'] == 0) { + $thisfile_real_chunks_currentchunk['max_bit_rate'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 4)); + $offset += 4; + $thisfile_real_chunks_currentchunk['avg_bit_rate'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 4)); + $offset += 4; + $thisfile_real_chunks_currentchunk['max_packet_size'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 4)); + $offset += 4; + $thisfile_real_chunks_currentchunk['avg_packet_size'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 4)); + $offset += 4; + $thisfile_real_chunks_currentchunk['num_packets'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 4)); + $offset += 4; + $thisfile_real_chunks_currentchunk['duration'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 4)); + $offset += 4; + $thisfile_real_chunks_currentchunk['preroll'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 4)); + $offset += 4; + $thisfile_real_chunks_currentchunk['index_offset'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 4)); + $offset += 4; + $thisfile_real_chunks_currentchunk['data_offset'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 4)); + $offset += 4; + $thisfile_real_chunks_currentchunk['num_streams'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 2)); + $offset += 2; + $thisfile_real_chunks_currentchunk['flags_raw'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 2)); + $offset += 2; + $info['playtime_seconds'] = $thisfile_real_chunks_currentchunk['duration'] / 1000; + if ($thisfile_real_chunks_currentchunk['duration'] > 0) { + $info['bitrate'] += $thisfile_real_chunks_currentchunk['avg_bit_rate']; + } + $thisfile_real_chunks_currentchunk['flags']['save_enabled'] = (bool) ($thisfile_real_chunks_currentchunk['flags_raw'] & 0x0001); + $thisfile_real_chunks_currentchunk['flags']['perfect_play'] = (bool) ($thisfile_real_chunks_currentchunk['flags_raw'] & 0x0002); + $thisfile_real_chunks_currentchunk['flags']['live_broadcast'] = (bool) ($thisfile_real_chunks_currentchunk['flags_raw'] & 0x0004); + } + break; + + case 'MDPR': // Media Properties Header + $thisfile_real_chunks_currentchunk['object_version'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 2)); + $offset += 2; + if ($thisfile_real_chunks_currentchunk['object_version'] == 0) { + $thisfile_real_chunks_currentchunk['stream_number'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 2)); + $offset += 2; + $thisfile_real_chunks_currentchunk['max_bit_rate'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 4)); + $offset += 4; + $thisfile_real_chunks_currentchunk['avg_bit_rate'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 4)); + $offset += 4; + $thisfile_real_chunks_currentchunk['max_packet_size'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 4)); + $offset += 4; + $thisfile_real_chunks_currentchunk['avg_packet_size'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 4)); + $offset += 4; + $thisfile_real_chunks_currentchunk['start_time'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 4)); + $offset += 4; + $thisfile_real_chunks_currentchunk['preroll'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 4)); + $offset += 4; + $thisfile_real_chunks_currentchunk['duration'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 4)); + $offset += 4; + $thisfile_real_chunks_currentchunk['stream_name_size'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 1)); + $offset += 1; + $thisfile_real_chunks_currentchunk['stream_name'] = substr($ChunkData, $offset, $thisfile_real_chunks_currentchunk['stream_name_size']); + $offset += $thisfile_real_chunks_currentchunk['stream_name_size']; + $thisfile_real_chunks_currentchunk['mime_type_size'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 1)); + $offset += 1; + $thisfile_real_chunks_currentchunk['mime_type'] = substr($ChunkData, $offset, $thisfile_real_chunks_currentchunk['mime_type_size']); + $offset += $thisfile_real_chunks_currentchunk['mime_type_size']; + $thisfile_real_chunks_currentchunk['type_specific_len'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 4)); + $offset += 4; + $thisfile_real_chunks_currentchunk['type_specific_data'] = substr($ChunkData, $offset, $thisfile_real_chunks_currentchunk['type_specific_len']); + $offset += $thisfile_real_chunks_currentchunk['type_specific_len']; + + // shortcut + $thisfile_real_chunks_currentchunk_typespecificdata = &$thisfile_real_chunks_currentchunk['type_specific_data']; + + switch ($thisfile_real_chunks_currentchunk['mime_type']) { + case 'video/x-pn-realvideo': + case 'video/x-pn-multirate-realvideo': + // http://www.freelists.org/archives/matroska-devel/07-2003/msg00010.html + + // shortcut + $thisfile_real_chunks_currentchunk['video_info'] = array(); + $thisfile_real_chunks_currentchunk_videoinfo = &$thisfile_real_chunks_currentchunk['video_info']; + + $thisfile_real_chunks_currentchunk_videoinfo['dwSize'] = getid3_lib::BigEndian2Int(substr($thisfile_real_chunks_currentchunk_typespecificdata, 0, 4)); + $thisfile_real_chunks_currentchunk_videoinfo['fourcc1'] = substr($thisfile_real_chunks_currentchunk_typespecificdata, 4, 4); + $thisfile_real_chunks_currentchunk_videoinfo['fourcc2'] = substr($thisfile_real_chunks_currentchunk_typespecificdata, 8, 4); + $thisfile_real_chunks_currentchunk_videoinfo['width'] = getid3_lib::BigEndian2Int(substr($thisfile_real_chunks_currentchunk_typespecificdata, 12, 2)); + $thisfile_real_chunks_currentchunk_videoinfo['height'] = getid3_lib::BigEndian2Int(substr($thisfile_real_chunks_currentchunk_typespecificdata, 14, 2)); + $thisfile_real_chunks_currentchunk_videoinfo['bits_per_sample'] = getid3_lib::BigEndian2Int(substr($thisfile_real_chunks_currentchunk_typespecificdata, 16, 2)); + //$thisfile_real_chunks_currentchunk_videoinfo['unknown1'] = getid3_lib::BigEndian2Int(substr($thisfile_real_chunks_currentchunk_typespecificdata, 18, 2)); + //$thisfile_real_chunks_currentchunk_videoinfo['unknown2'] = getid3_lib::BigEndian2Int(substr($thisfile_real_chunks_currentchunk_typespecificdata, 20, 2)); + $thisfile_real_chunks_currentchunk_videoinfo['frames_per_second'] = getid3_lib::BigEndian2Int(substr($thisfile_real_chunks_currentchunk_typespecificdata, 22, 2)); + //$thisfile_real_chunks_currentchunk_videoinfo['unknown3'] = getid3_lib::BigEndian2Int(substr($thisfile_real_chunks_currentchunk_typespecificdata, 24, 2)); + //$thisfile_real_chunks_currentchunk_videoinfo['unknown4'] = getid3_lib::BigEndian2Int(substr($thisfile_real_chunks_currentchunk_typespecificdata, 26, 2)); + //$thisfile_real_chunks_currentchunk_videoinfo['unknown5'] = getid3_lib::BigEndian2Int(substr($thisfile_real_chunks_currentchunk_typespecificdata, 28, 2)); + //$thisfile_real_chunks_currentchunk_videoinfo['unknown6'] = getid3_lib::BigEndian2Int(substr($thisfile_real_chunks_currentchunk_typespecificdata, 30, 2)); + //$thisfile_real_chunks_currentchunk_videoinfo['unknown7'] = getid3_lib::BigEndian2Int(substr($thisfile_real_chunks_currentchunk_typespecificdata, 32, 2)); + //$thisfile_real_chunks_currentchunk_videoinfo['unknown8'] = getid3_lib::BigEndian2Int(substr($thisfile_real_chunks_currentchunk_typespecificdata, 34, 2)); + //$thisfile_real_chunks_currentchunk_videoinfo['unknown9'] = getid3_lib::BigEndian2Int(substr($thisfile_real_chunks_currentchunk_typespecificdata, 36, 2)); + + $thisfile_real_chunks_currentchunk_videoinfo['codec'] = getid3_riff::fourccLookup($thisfile_real_chunks_currentchunk_videoinfo['fourcc2']); + + $info['video']['resolution_x'] = $thisfile_real_chunks_currentchunk_videoinfo['width']; + $info['video']['resolution_y'] = $thisfile_real_chunks_currentchunk_videoinfo['height']; + $info['video']['frame_rate'] = (float) $thisfile_real_chunks_currentchunk_videoinfo['frames_per_second']; + $info['video']['codec'] = $thisfile_real_chunks_currentchunk_videoinfo['codec']; + $info['video']['bits_per_sample'] = $thisfile_real_chunks_currentchunk_videoinfo['bits_per_sample']; + break; + + case 'audio/x-pn-realaudio': + case 'audio/x-pn-multirate-realaudio': + $this->ParseOldRAheader($thisfile_real_chunks_currentchunk_typespecificdata, $thisfile_real_chunks_currentchunk['parsed_audio_data']); + + $info['audio']['sample_rate'] = $thisfile_real_chunks_currentchunk['parsed_audio_data']['sample_rate']; + $info['audio']['bits_per_sample'] = $thisfile_real_chunks_currentchunk['parsed_audio_data']['bits_per_sample']; + $info['audio']['channels'] = $thisfile_real_chunks_currentchunk['parsed_audio_data']['channels']; + if (!empty($info['audio']['dataformat'])) { + foreach ($info['audio'] as $key => $value) { + if ($key != 'streams') { + $info['audio']['streams'][$thisfile_real_chunks_currentchunk['stream_number']][$key] = $value; + } + } + } + break; + + case 'logical-fileinfo': + // shortcut + $thisfile_real_chunks_currentchunk['logical_fileinfo'] = array(); + $thisfile_real_chunks_currentchunk_logicalfileinfo = &$thisfile_real_chunks_currentchunk['logical_fileinfo']; + + $thisfile_real_chunks_currentchunk_logicalfileinfo_offset = 0; + $thisfile_real_chunks_currentchunk_logicalfileinfo['logical_fileinfo_length'] = getid3_lib::BigEndian2Int(substr($thisfile_real_chunks_currentchunk_typespecificdata, $thisfile_real_chunks_currentchunk_logicalfileinfo_offset, 4)); + $thisfile_real_chunks_currentchunk_logicalfileinfo_offset += 4; + + //$thisfile_real_chunks_currentchunk_logicalfileinfo['unknown1'] = getid3_lib::BigEndian2Int(substr($thisfile_real_chunks_currentchunk_typespecificdata, $thisfile_real_chunks_currentchunk_logicalfileinfo_offset, 4)); + $thisfile_real_chunks_currentchunk_logicalfileinfo_offset += 4; + + $thisfile_real_chunks_currentchunk_logicalfileinfo['num_tags'] = getid3_lib::BigEndian2Int(substr($thisfile_real_chunks_currentchunk_typespecificdata, $thisfile_real_chunks_currentchunk_logicalfileinfo_offset, 4)); + $thisfile_real_chunks_currentchunk_logicalfileinfo_offset += 4; + + //$thisfile_real_chunks_currentchunk_logicalfileinfo['unknown2'] = getid3_lib::BigEndian2Int(substr($thisfile_real_chunks_currentchunk_typespecificdata, $thisfile_real_chunks_currentchunk_logicalfileinfo_offset, 4)); + $thisfile_real_chunks_currentchunk_logicalfileinfo_offset += 4; + + //$thisfile_real_chunks_currentchunk_logicalfileinfo['d'] = getid3_lib::BigEndian2Int(substr($thisfile_real_chunks_currentchunk_typespecificdata, $thisfile_real_chunks_currentchunk_logicalfileinfo_offset, 1)); + + //$thisfile_real_chunks_currentchunk_logicalfileinfo['one_type'] = getid3_lib::BigEndian2Int(substr($thisfile_real_chunks_currentchunk_typespecificdata, $thisfile_real_chunks_currentchunk_logicalfileinfo_offset, 4)); + //$thisfile_real_chunks_currentchunk_logicalfileinfo_thislength = getid3_lib::BigEndian2Int(substr($thisfile_real_chunks_currentchunk_typespecificdata, 4 + $thisfile_real_chunks_currentchunk_logicalfileinfo_offset, 2)); + //$thisfile_real_chunks_currentchunk_logicalfileinfo['one'] = substr($thisfile_real_chunks_currentchunk_typespecificdata, 6 + $thisfile_real_chunks_currentchunk_logicalfileinfo_offset, $thisfile_real_chunks_currentchunk_logicalfileinfo_thislength); + //$thisfile_real_chunks_currentchunk_logicalfileinfo_offset += (6 + $thisfile_real_chunks_currentchunk_logicalfileinfo_thislength); + + break; + + } + + + if (empty($info['playtime_seconds'])) { + $info['playtime_seconds'] = max($info['playtime_seconds'], ($thisfile_real_chunks_currentchunk['duration'] + $thisfile_real_chunks_currentchunk['start_time']) / 1000); + } + if ($thisfile_real_chunks_currentchunk['duration'] > 0) { + switch ($thisfile_real_chunks_currentchunk['mime_type']) { + case 'audio/x-pn-realaudio': + case 'audio/x-pn-multirate-realaudio': + $info['audio']['bitrate'] = (isset($info['audio']['bitrate']) ? $info['audio']['bitrate'] : 0) + $thisfile_real_chunks_currentchunk['avg_bit_rate']; + $info['audio']['codec'] = $this->RealAudioCodecFourCClookup($thisfile_real_chunks_currentchunk['parsed_audio_data']['fourcc'], $info['audio']['bitrate']); + $info['audio']['dataformat'] = 'real'; + $info['audio']['lossless'] = false; + break; + + case 'video/x-pn-realvideo': + case 'video/x-pn-multirate-realvideo': + $info['video']['bitrate'] = (isset($info['video']['bitrate']) ? $info['video']['bitrate'] : 0) + $thisfile_real_chunks_currentchunk['avg_bit_rate']; + $info['video']['bitrate_mode'] = 'cbr'; + $info['video']['dataformat'] = 'real'; + $info['video']['lossless'] = false; + $info['video']['pixel_aspect_ratio'] = (float) 1; + break; + + case 'audio/x-ralf-mpeg4-generic': + $info['audio']['bitrate'] = (isset($info['audio']['bitrate']) ? $info['audio']['bitrate'] : 0) + $thisfile_real_chunks_currentchunk['avg_bit_rate']; + $info['audio']['codec'] = 'RealAudio Lossless'; + $info['audio']['dataformat'] = 'real'; + $info['audio']['lossless'] = true; + break; + } + $info['bitrate'] = (isset($info['video']['bitrate']) ? $info['video']['bitrate'] : 0) + (isset($info['audio']['bitrate']) ? $info['audio']['bitrate'] : 0); + } + } + break; + + case 'CONT': // Content Description Header (text comments) + $thisfile_real_chunks_currentchunk['object_version'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 2)); + $offset += 2; + if ($thisfile_real_chunks_currentchunk['object_version'] == 0) { + $thisfile_real_chunks_currentchunk['title_len'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 2)); + $offset += 2; + $thisfile_real_chunks_currentchunk['title'] = (string) substr($ChunkData, $offset, $thisfile_real_chunks_currentchunk['title_len']); + $offset += $thisfile_real_chunks_currentchunk['title_len']; + + $thisfile_real_chunks_currentchunk['artist_len'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 2)); + $offset += 2; + $thisfile_real_chunks_currentchunk['artist'] = (string) substr($ChunkData, $offset, $thisfile_real_chunks_currentchunk['artist_len']); + $offset += $thisfile_real_chunks_currentchunk['artist_len']; + + $thisfile_real_chunks_currentchunk['copyright_len'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 2)); + $offset += 2; + $thisfile_real_chunks_currentchunk['copyright'] = (string) substr($ChunkData, $offset, $thisfile_real_chunks_currentchunk['copyright_len']); + $offset += $thisfile_real_chunks_currentchunk['copyright_len']; + + $thisfile_real_chunks_currentchunk['comment_len'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 2)); + $offset += 2; + $thisfile_real_chunks_currentchunk['comment'] = (string) substr($ChunkData, $offset, $thisfile_real_chunks_currentchunk['comment_len']); + $offset += $thisfile_real_chunks_currentchunk['comment_len']; + + + $commentkeystocopy = array('title'=>'title', 'artist'=>'artist', 'copyright'=>'copyright', 'comment'=>'comment'); + foreach ($commentkeystocopy as $key => $val) { + if ($thisfile_real_chunks_currentchunk[$key]) { + $info['real']['comments'][$val][] = trim($thisfile_real_chunks_currentchunk[$key]); + } + } + + } + break; + + + case 'DATA': // Data Chunk Header + // do nothing + break; + + case 'INDX': // Index Section Header + $thisfile_real_chunks_currentchunk['object_version'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 2)); + $offset += 2; + if ($thisfile_real_chunks_currentchunk['object_version'] == 0) { + $thisfile_real_chunks_currentchunk['num_indices'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 4)); + $offset += 4; + $thisfile_real_chunks_currentchunk['stream_number'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 2)); + $offset += 2; + $thisfile_real_chunks_currentchunk['next_index_header'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 4)); + $offset += 4; + + if ($thisfile_real_chunks_currentchunk['next_index_header'] == 0) { + // last index chunk found, ignore rest of file + break 2; + } else { + // non-last index chunk, seek to next index chunk (skipping actual index data) + $this->fseek($thisfile_real_chunks_currentchunk['next_index_header']); + } + } + break; + + default: + $this->warning('Unhandled RealMedia chunk "'.$ChunkName.'" at offset '.$thisfile_real_chunks_currentchunk['offset']); + break; + } + $ChunkCounter++; + } + + if (!empty($info['audio']['streams'])) { + $info['audio']['bitrate'] = 0; + foreach ($info['audio']['streams'] as $key => $valuearray) { + $info['audio']['bitrate'] += $valuearray['bitrate']; + } + } + + return true; + } + + + public function ParseOldRAheader($OldRAheaderData, &$ParsedArray) { + // http://www.freelists.org/archives/matroska-devel/07-2003/msg00010.html + + $ParsedArray = array(); + $ParsedArray['magic'] = substr($OldRAheaderData, 0, 4); + if ($ParsedArray['magic'] != '.ra'."\xFD") { + return false; + } + $ParsedArray['version1'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 4, 2)); + + if ($ParsedArray['version1'] < 3) { + + return false; + + } elseif ($ParsedArray['version1'] == 3) { + + $ParsedArray['fourcc1'] = '.ra3'; + $ParsedArray['bits_per_sample'] = 16; // hard-coded for old versions? + $ParsedArray['sample_rate'] = 8000; // hard-coded for old versions? + + $ParsedArray['header_size'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 6, 2)); + $ParsedArray['channels'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 8, 2)); // always 1 (?) + //$ParsedArray['unknown1'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 10, 2)); + //$ParsedArray['unknown2'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 12, 2)); + //$ParsedArray['unknown3'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 14, 2)); + $ParsedArray['bytes_per_minute'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 16, 2)); + $ParsedArray['audio_bytes'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 18, 4)); + $ParsedArray['comments_raw'] = substr($OldRAheaderData, 22, $ParsedArray['header_size'] - 22 + 1); // not including null terminator + + $commentoffset = 0; + $commentlength = getid3_lib::BigEndian2Int(substr($ParsedArray['comments_raw'], $commentoffset++, 1)); + $ParsedArray['comments']['title'][] = substr($ParsedArray['comments_raw'], $commentoffset, $commentlength); + $commentoffset += $commentlength; + + $commentlength = getid3_lib::BigEndian2Int(substr($ParsedArray['comments_raw'], $commentoffset++, 1)); + $ParsedArray['comments']['artist'][] = substr($ParsedArray['comments_raw'], $commentoffset, $commentlength); + $commentoffset += $commentlength; + + $commentlength = getid3_lib::BigEndian2Int(substr($ParsedArray['comments_raw'], $commentoffset++, 1)); + $ParsedArray['comments']['copyright'][] = substr($ParsedArray['comments_raw'], $commentoffset, $commentlength); + $commentoffset += $commentlength; + + $commentoffset++; // final null terminator (?) + $commentoffset++; // fourcc length (?) should be 4 + $ParsedArray['fourcc'] = substr($OldRAheaderData, 23 + $commentoffset, 4); + + } elseif ($ParsedArray['version1'] <= 5) { + + //$ParsedArray['unknown1'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 6, 2)); + $ParsedArray['fourcc1'] = substr($OldRAheaderData, 8, 4); + $ParsedArray['file_size'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 12, 4)); + $ParsedArray['version2'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 16, 2)); + $ParsedArray['header_size'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 18, 4)); + $ParsedArray['codec_flavor_id'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 22, 2)); + $ParsedArray['coded_frame_size'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 24, 4)); + $ParsedArray['audio_bytes'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 28, 4)); + $ParsedArray['bytes_per_minute'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 32, 4)); + //$ParsedArray['unknown5'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 36, 4)); + $ParsedArray['sub_packet_h'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 40, 2)); + $ParsedArray['frame_size'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 42, 2)); + $ParsedArray['sub_packet_size'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 44, 2)); + //$ParsedArray['unknown6'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 46, 2)); + + switch ($ParsedArray['version1']) { + + case 4: + $ParsedArray['sample_rate'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 48, 2)); + //$ParsedArray['unknown8'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 50, 2)); + $ParsedArray['bits_per_sample'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 52, 2)); + $ParsedArray['channels'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 54, 2)); + $ParsedArray['length_fourcc2'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 56, 1)); + $ParsedArray['fourcc2'] = substr($OldRAheaderData, 57, 4); + $ParsedArray['length_fourcc3'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 61, 1)); + $ParsedArray['fourcc3'] = substr($OldRAheaderData, 62, 4); + //$ParsedArray['unknown9'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 66, 1)); + //$ParsedArray['unknown10'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 67, 2)); + $ParsedArray['comments_raw'] = substr($OldRAheaderData, 69, $ParsedArray['header_size'] - 69 + 16); + + $commentoffset = 0; + $commentlength = getid3_lib::BigEndian2Int(substr($ParsedArray['comments_raw'], $commentoffset++, 1)); + $ParsedArray['comments']['title'][] = substr($ParsedArray['comments_raw'], $commentoffset, $commentlength); + $commentoffset += $commentlength; + + $commentlength = getid3_lib::BigEndian2Int(substr($ParsedArray['comments_raw'], $commentoffset++, 1)); + $ParsedArray['comments']['artist'][] = substr($ParsedArray['comments_raw'], $commentoffset, $commentlength); + $commentoffset += $commentlength; + + $commentlength = getid3_lib::BigEndian2Int(substr($ParsedArray['comments_raw'], $commentoffset++, 1)); + $ParsedArray['comments']['copyright'][] = substr($ParsedArray['comments_raw'], $commentoffset, $commentlength); + $commentoffset += $commentlength; + break; + + case 5: + $ParsedArray['sample_rate'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 48, 4)); + $ParsedArray['sample_rate2'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 52, 4)); + $ParsedArray['bits_per_sample'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 56, 4)); + $ParsedArray['channels'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 60, 2)); + $ParsedArray['genr'] = substr($OldRAheaderData, 62, 4); + $ParsedArray['fourcc3'] = substr($OldRAheaderData, 66, 4); + $ParsedArray['comments'] = array(); + break; + } + $ParsedArray['fourcc'] = $ParsedArray['fourcc3']; + + } + foreach ($ParsedArray['comments'] as $key => $value) { + if ($ParsedArray['comments'][$key][0] === false) { + $ParsedArray['comments'][$key][0] = ''; + } + } + + return true; + } + + public function RealAudioCodecFourCClookup($fourcc, $bitrate) { + static $RealAudioCodecFourCClookup = array(); + if (empty($RealAudioCodecFourCClookup)) { + // http://www.its.msstate.edu/net/real/reports/config/tags.stats + // http://www.freelists.org/archives/matroska-devel/06-2003/fullthread18.html + + $RealAudioCodecFourCClookup['14_4'][8000] = 'RealAudio v2 (14.4kbps)'; + $RealAudioCodecFourCClookup['14.4'][8000] = 'RealAudio v2 (14.4kbps)'; + $RealAudioCodecFourCClookup['lpcJ'][8000] = 'RealAudio v2 (14.4kbps)'; + $RealAudioCodecFourCClookup['28_8'][15200] = 'RealAudio v2 (28.8kbps)'; + $RealAudioCodecFourCClookup['28.8'][15200] = 'RealAudio v2 (28.8kbps)'; + $RealAudioCodecFourCClookup['sipr'][4933] = 'RealAudio v4 (5kbps Voice)'; + $RealAudioCodecFourCClookup['sipr'][6444] = 'RealAudio v4 (6.5kbps Voice)'; + $RealAudioCodecFourCClookup['sipr'][8444] = 'RealAudio v4 (8.5kbps Voice)'; + $RealAudioCodecFourCClookup['sipr'][16000] = 'RealAudio v4 (16kbps Wideband)'; + $RealAudioCodecFourCClookup['dnet'][8000] = 'RealAudio v3 (8kbps Music)'; + $RealAudioCodecFourCClookup['dnet'][16000] = 'RealAudio v3 (16kbps Music Low Response)'; + $RealAudioCodecFourCClookup['dnet'][15963] = 'RealAudio v3 (16kbps Music Mid/High Response)'; + $RealAudioCodecFourCClookup['dnet'][20000] = 'RealAudio v3 (20kbps Music Stereo)'; + $RealAudioCodecFourCClookup['dnet'][32000] = 'RealAudio v3 (32kbps Music Mono)'; + $RealAudioCodecFourCClookup['dnet'][31951] = 'RealAudio v3 (32kbps Music Stereo)'; + $RealAudioCodecFourCClookup['dnet'][39965] = 'RealAudio v3 (40kbps Music Mono)'; + $RealAudioCodecFourCClookup['dnet'][40000] = 'RealAudio v3 (40kbps Music Stereo)'; + $RealAudioCodecFourCClookup['dnet'][79947] = 'RealAudio v3 (80kbps Music Mono)'; + $RealAudioCodecFourCClookup['dnet'][80000] = 'RealAudio v3 (80kbps Music Stereo)'; + + $RealAudioCodecFourCClookup['dnet'][0] = 'RealAudio v3'; + $RealAudioCodecFourCClookup['sipr'][0] = 'RealAudio v4'; + $RealAudioCodecFourCClookup['cook'][0] = 'RealAudio G2'; + $RealAudioCodecFourCClookup['atrc'][0] = 'RealAudio 8'; + } + $roundbitrate = intval(round($bitrate)); + if (isset($RealAudioCodecFourCClookup[$fourcc][$roundbitrate])) { + return $RealAudioCodecFourCClookup[$fourcc][$roundbitrate]; + } elseif (isset($RealAudioCodecFourCClookup[$fourcc][0])) { + return $RealAudioCodecFourCClookup[$fourcc][0]; + } + return $fourcc; + } + +} diff --git a/www/rompr/getid3/module.audio-video.riff.php b/www/rompr/getid3/module.audio-video.riff.php new file mode 100644 index 0000000..fcf965c --- /dev/null +++ b/www/rompr/getid3/module.audio-video.riff.php @@ -0,0 +1,2639 @@ + // +// available at http://getid3.sourceforge.net // +// or http://www.getid3.org // +// also https://github.com/JamesHeinrich/getID3 // +///////////////////////////////////////////////////////////////// +// See readme.txt for more details // +///////////////////////////////////////////////////////////////// +// // +// module.audio-video.riff.php // +// module for analyzing RIFF files // +// multiple formats supported by this module: // +// Wave, AVI, AIFF/AIFC, (MP3,AC3)/RIFF, Wavpack v3, 8SVX // +// dependencies: module.audio.mp3.php // +// module.audio.ac3.php // +// module.audio.dts.php // +// /// +///////////////////////////////////////////////////////////////// + +/** +* @todo Parse AC-3/DTS audio inside WAVE correctly +* @todo Rewrite RIFF parser totally +*/ + +getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio.mp3.php', __FILE__, true); +getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio.ac3.php', __FILE__, true); +getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio.dts.php', __FILE__, true); + +class getid3_riff extends getid3_handler { + + protected $container = 'riff'; // default + + public function Analyze() { + $info = &$this->getid3->info; + + // initialize these values to an empty array, otherwise they default to NULL + // and you can't append array values to a NULL value + $info['riff'] = array('raw'=>array()); + + // Shortcuts + $thisfile_riff = &$info['riff']; + $thisfile_riff_raw = &$thisfile_riff['raw']; + $thisfile_audio = &$info['audio']; + $thisfile_video = &$info['video']; + $thisfile_audio_dataformat = &$thisfile_audio['dataformat']; + $thisfile_riff_audio = &$thisfile_riff['audio']; + $thisfile_riff_video = &$thisfile_riff['video']; + + $Original['avdataoffset'] = $info['avdataoffset']; + $Original['avdataend'] = $info['avdataend']; + + $this->fseek($info['avdataoffset']); + $RIFFheader = $this->fread(12); + $offset = $this->ftell(); + $RIFFtype = substr($RIFFheader, 0, 4); + $RIFFsize = substr($RIFFheader, 4, 4); + $RIFFsubtype = substr($RIFFheader, 8, 4); + + switch ($RIFFtype) { + + case 'FORM': // AIFF, AIFC + //$info['fileformat'] = 'aiff'; + $this->container = 'aiff'; + $thisfile_riff['header_size'] = $this->EitherEndian2Int($RIFFsize); + $thisfile_riff[$RIFFsubtype] = $this->ParseRIFF($offset, ($offset + $thisfile_riff['header_size'] - 4)); + break; + + case 'RIFF': // AVI, WAV, etc + case 'SDSS': // SDSS is identical to RIFF, just renamed. Used by SmartSound QuickTracks (www.smartsound.com) + case 'RMP3': // RMP3 is identical to RIFF, just renamed. Used by [unknown program] when creating RIFF-MP3s + //$info['fileformat'] = 'riff'; + $this->container = 'riff'; + $thisfile_riff['header_size'] = $this->EitherEndian2Int($RIFFsize); + if ($RIFFsubtype == 'RMP3') { + // RMP3 is identical to WAVE, just renamed. Used by [unknown program] when creating RIFF-MP3s + $RIFFsubtype = 'WAVE'; + } + if ($RIFFsubtype != 'AMV ') { + // AMV files are RIFF-AVI files with parts of the spec deliberately broken, such as chunk size fields hardcoded to zero (because players known in hardware that these fields are always a certain size + // Handled separately in ParseRIFFAMV() + $thisfile_riff[$RIFFsubtype] = $this->ParseRIFF($offset, ($offset + $thisfile_riff['header_size'] - 4)); + } + if (($info['avdataend'] - $info['filesize']) == 1) { + // LiteWave appears to incorrectly *not* pad actual output file + // to nearest WORD boundary so may appear to be short by one + // byte, in which case - skip warning + $info['avdataend'] = $info['filesize']; + } + + $nextRIFFoffset = $Original['avdataoffset'] + 8 + $thisfile_riff['header_size']; // 8 = "RIFF" + 32-bit offset + while ($nextRIFFoffset < min($info['filesize'], $info['avdataend'])) { + try { + $this->fseek($nextRIFFoffset); + } catch (getid3_exception $e) { + if ($e->getCode() == 10) { + //$this->warning('RIFF parser: '.$e->getMessage()); + $this->error('AVI extends beyond '.round(PHP_INT_MAX / 1073741824).'GB and PHP filesystem functions cannot read that far, playtime may be wrong'); + $this->warning('[avdataend] value may be incorrect, multiple AVIX chunks may be present'); + break; + } else { + throw $e; + } + } + $nextRIFFheader = $this->fread(12); + if ($nextRIFFoffset == ($info['avdataend'] - 1)) { + if (substr($nextRIFFheader, 0, 1) == "\x00") { + // RIFF padded to WORD boundary, we're actually already at the end + break; + } + } + $nextRIFFheaderID = substr($nextRIFFheader, 0, 4); + $nextRIFFsize = $this->EitherEndian2Int(substr($nextRIFFheader, 4, 4)); + $nextRIFFtype = substr($nextRIFFheader, 8, 4); + $chunkdata = array(); + $chunkdata['offset'] = $nextRIFFoffset + 8; + $chunkdata['size'] = $nextRIFFsize; + $nextRIFFoffset = $chunkdata['offset'] + $chunkdata['size']; + + switch ($nextRIFFheaderID) { + case 'RIFF': + $chunkdata['chunks'] = $this->ParseRIFF($chunkdata['offset'] + 4, $nextRIFFoffset); + if (!isset($thisfile_riff[$nextRIFFtype])) { + $thisfile_riff[$nextRIFFtype] = array(); + } + $thisfile_riff[$nextRIFFtype][] = $chunkdata; + break; + + case 'AMV ': + unset($info['riff']); + $info['amv'] = $this->ParseRIFFAMV($chunkdata['offset'] + 4, $nextRIFFoffset); + break; + + case 'JUNK': + // ignore + $thisfile_riff[$nextRIFFheaderID][] = $chunkdata; + break; + + case 'IDVX': + $info['divxtag']['comments'] = self::ParseDIVXTAG($this->fread($chunkdata['size'])); + break; + + default: + if ($info['filesize'] == ($chunkdata['offset'] - 8 + 128)) { + $DIVXTAG = $nextRIFFheader.$this->fread(128 - 12); + if (substr($DIVXTAG, -7) == 'DIVXTAG') { + // DIVXTAG is supposed to be inside an IDVX chunk in a LIST chunk, but some bad encoders just slap it on the end of a file + $this->warning('Found wrongly-structured DIVXTAG at offset '.($this->ftell() - 128).', parsing anyway'); + $info['divxtag']['comments'] = self::ParseDIVXTAG($DIVXTAG); + break 2; + } + } + $this->warning('Expecting "RIFF|JUNK|IDVX" at '.$nextRIFFoffset.', found "'.$nextRIFFheaderID.'" ('.getid3_lib::PrintHexBytes($nextRIFFheaderID).') - skipping rest of file'); + break 2; + + } + + } + if ($RIFFsubtype == 'WAVE') { + $thisfile_riff_WAVE = &$thisfile_riff['WAVE']; + } + break; + + default: + $this->error('Cannot parse RIFF (this is maybe not a RIFF / WAV / AVI file?) - expecting "FORM|RIFF|SDSS|RMP3" found "'.$RIFFsubtype.'" instead'); + //unset($info['fileformat']); + return false; + } + + $streamindex = 0; + switch ($RIFFsubtype) { + + // http://en.wikipedia.org/wiki/Wav + case 'WAVE': + $info['fileformat'] = 'wav'; + + if (empty($thisfile_audio['bitrate_mode'])) { + $thisfile_audio['bitrate_mode'] = 'cbr'; + } + if (empty($thisfile_audio_dataformat)) { + $thisfile_audio_dataformat = 'wav'; + } + + if (isset($thisfile_riff_WAVE['data'][0]['offset'])) { + $info['avdataoffset'] = $thisfile_riff_WAVE['data'][0]['offset'] + 8; + $info['avdataend'] = $info['avdataoffset'] + $thisfile_riff_WAVE['data'][0]['size']; + } + if (isset($thisfile_riff_WAVE['fmt '][0]['data'])) { + + $thisfile_riff_audio[$streamindex] = self::parseWAVEFORMATex($thisfile_riff_WAVE['fmt '][0]['data']); + $thisfile_audio['wformattag'] = $thisfile_riff_audio[$streamindex]['raw']['wFormatTag']; + if (!isset($thisfile_riff_audio[$streamindex]['bitrate']) || ($thisfile_riff_audio[$streamindex]['bitrate'] == 0)) { + $this->error('Corrupt RIFF file: bitrate_audio == zero'); + return false; + } + $thisfile_riff_raw['fmt '] = $thisfile_riff_audio[$streamindex]['raw']; + unset($thisfile_riff_audio[$streamindex]['raw']); + $thisfile_audio['streams'][$streamindex] = $thisfile_riff_audio[$streamindex]; + + $thisfile_audio = getid3_lib::array_merge_noclobber($thisfile_audio, $thisfile_riff_audio[$streamindex]); + if (substr($thisfile_audio['codec'], 0, strlen('unknown: 0x')) == 'unknown: 0x') { + $this->warning('Audio codec = '.$thisfile_audio['codec']); + } + $thisfile_audio['bitrate'] = $thisfile_riff_audio[$streamindex]['bitrate']; + + if (empty($info['playtime_seconds'])) { // may already be set (e.g. DTS-WAV) + $info['playtime_seconds'] = (float) ((($info['avdataend'] - $info['avdataoffset']) * 8) / $thisfile_audio['bitrate']); + } + + $thisfile_audio['lossless'] = false; + if (isset($thisfile_riff_WAVE['data'][0]['offset']) && isset($thisfile_riff_raw['fmt ']['wFormatTag'])) { + switch ($thisfile_riff_raw['fmt ']['wFormatTag']) { + + case 0x0001: // PCM + $thisfile_audio['lossless'] = true; + break; + + case 0x2000: // AC-3 + $thisfile_audio_dataformat = 'ac3'; + break; + + default: + // do nothing + break; + + } + } + $thisfile_audio['streams'][$streamindex]['wformattag'] = $thisfile_audio['wformattag']; + $thisfile_audio['streams'][$streamindex]['bitrate_mode'] = $thisfile_audio['bitrate_mode']; + $thisfile_audio['streams'][$streamindex]['lossless'] = $thisfile_audio['lossless']; + $thisfile_audio['streams'][$streamindex]['dataformat'] = $thisfile_audio_dataformat; + } + + if (isset($thisfile_riff_WAVE['rgad'][0]['data'])) { + + // shortcuts + $rgadData = &$thisfile_riff_WAVE['rgad'][0]['data']; + $thisfile_riff_raw['rgad'] = array('track'=>array(), 'album'=>array()); + $thisfile_riff_raw_rgad = &$thisfile_riff_raw['rgad']; + $thisfile_riff_raw_rgad_track = &$thisfile_riff_raw_rgad['track']; + $thisfile_riff_raw_rgad_album = &$thisfile_riff_raw_rgad['album']; + + $thisfile_riff_raw_rgad['fPeakAmplitude'] = getid3_lib::LittleEndian2Float(substr($rgadData, 0, 4)); + $thisfile_riff_raw_rgad['nRadioRgAdjust'] = $this->EitherEndian2Int(substr($rgadData, 4, 2)); + $thisfile_riff_raw_rgad['nAudiophileRgAdjust'] = $this->EitherEndian2Int(substr($rgadData, 6, 2)); + + $nRadioRgAdjustBitstring = str_pad(getid3_lib::Dec2Bin($thisfile_riff_raw_rgad['nRadioRgAdjust']), 16, '0', STR_PAD_LEFT); + $nAudiophileRgAdjustBitstring = str_pad(getid3_lib::Dec2Bin($thisfile_riff_raw_rgad['nAudiophileRgAdjust']), 16, '0', STR_PAD_LEFT); + $thisfile_riff_raw_rgad_track['name'] = getid3_lib::Bin2Dec(substr($nRadioRgAdjustBitstring, 0, 3)); + $thisfile_riff_raw_rgad_track['originator'] = getid3_lib::Bin2Dec(substr($nRadioRgAdjustBitstring, 3, 3)); + $thisfile_riff_raw_rgad_track['signbit'] = getid3_lib::Bin2Dec(substr($nRadioRgAdjustBitstring, 6, 1)); + $thisfile_riff_raw_rgad_track['adjustment'] = getid3_lib::Bin2Dec(substr($nRadioRgAdjustBitstring, 7, 9)); + $thisfile_riff_raw_rgad_album['name'] = getid3_lib::Bin2Dec(substr($nAudiophileRgAdjustBitstring, 0, 3)); + $thisfile_riff_raw_rgad_album['originator'] = getid3_lib::Bin2Dec(substr($nAudiophileRgAdjustBitstring, 3, 3)); + $thisfile_riff_raw_rgad_album['signbit'] = getid3_lib::Bin2Dec(substr($nAudiophileRgAdjustBitstring, 6, 1)); + $thisfile_riff_raw_rgad_album['adjustment'] = getid3_lib::Bin2Dec(substr($nAudiophileRgAdjustBitstring, 7, 9)); + + $thisfile_riff['rgad']['peakamplitude'] = $thisfile_riff_raw_rgad['fPeakAmplitude']; + if (($thisfile_riff_raw_rgad_track['name'] != 0) && ($thisfile_riff_raw_rgad_track['originator'] != 0)) { + $thisfile_riff['rgad']['track']['name'] = getid3_lib::RGADnameLookup($thisfile_riff_raw_rgad_track['name']); + $thisfile_riff['rgad']['track']['originator'] = getid3_lib::RGADoriginatorLookup($thisfile_riff_raw_rgad_track['originator']); + $thisfile_riff['rgad']['track']['adjustment'] = getid3_lib::RGADadjustmentLookup($thisfile_riff_raw_rgad_track['adjustment'], $thisfile_riff_raw_rgad_track['signbit']); + } + if (($thisfile_riff_raw_rgad_album['name'] != 0) && ($thisfile_riff_raw_rgad_album['originator'] != 0)) { + $thisfile_riff['rgad']['album']['name'] = getid3_lib::RGADnameLookup($thisfile_riff_raw_rgad_album['name']); + $thisfile_riff['rgad']['album']['originator'] = getid3_lib::RGADoriginatorLookup($thisfile_riff_raw_rgad_album['originator']); + $thisfile_riff['rgad']['album']['adjustment'] = getid3_lib::RGADadjustmentLookup($thisfile_riff_raw_rgad_album['adjustment'], $thisfile_riff_raw_rgad_album['signbit']); + } + } + + if (isset($thisfile_riff_WAVE['fact'][0]['data'])) { + $thisfile_riff_raw['fact']['NumberOfSamples'] = $this->EitherEndian2Int(substr($thisfile_riff_WAVE['fact'][0]['data'], 0, 4)); + + // This should be a good way of calculating exact playtime, + // but some sample files have had incorrect number of samples, + // so cannot use this method + + // if (!empty($thisfile_riff_raw['fmt ']['nSamplesPerSec'])) { + // $info['playtime_seconds'] = (float) $thisfile_riff_raw['fact']['NumberOfSamples'] / $thisfile_riff_raw['fmt ']['nSamplesPerSec']; + // } + } + if (!empty($thisfile_riff_raw['fmt ']['nAvgBytesPerSec'])) { + $thisfile_audio['bitrate'] = getid3_lib::CastAsInt($thisfile_riff_raw['fmt ']['nAvgBytesPerSec'] * 8); + } + + if (isset($thisfile_riff_WAVE['bext'][0]['data'])) { + // shortcut + $thisfile_riff_WAVE_bext_0 = &$thisfile_riff_WAVE['bext'][0]; + + $thisfile_riff_WAVE_bext_0['title'] = trim(substr($thisfile_riff_WAVE_bext_0['data'], 0, 256)); + $thisfile_riff_WAVE_bext_0['author'] = trim(substr($thisfile_riff_WAVE_bext_0['data'], 256, 32)); + $thisfile_riff_WAVE_bext_0['reference'] = trim(substr($thisfile_riff_WAVE_bext_0['data'], 288, 32)); + $thisfile_riff_WAVE_bext_0['origin_date'] = substr($thisfile_riff_WAVE_bext_0['data'], 320, 10); + $thisfile_riff_WAVE_bext_0['origin_time'] = substr($thisfile_riff_WAVE_bext_0['data'], 330, 8); + $thisfile_riff_WAVE_bext_0['time_reference'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE_bext_0['data'], 338, 8)); + $thisfile_riff_WAVE_bext_0['bwf_version'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE_bext_0['data'], 346, 1)); + $thisfile_riff_WAVE_bext_0['reserved'] = substr($thisfile_riff_WAVE_bext_0['data'], 347, 254); + $thisfile_riff_WAVE_bext_0['coding_history'] = explode("\r\n", trim(substr($thisfile_riff_WAVE_bext_0['data'], 601))); + if (preg_match('#^([0-9]{4}).([0-9]{2}).([0-9]{2})$#', $thisfile_riff_WAVE_bext_0['origin_date'], $matches_bext_date)) { + if (preg_match('#^([0-9]{2}).([0-9]{2}).([0-9]{2})$#', $thisfile_riff_WAVE_bext_0['origin_time'], $matches_bext_time)) { + list($dummy, $bext_timestamp['year'], $bext_timestamp['month'], $bext_timestamp['day']) = $matches_bext_date; + list($dummy, $bext_timestamp['hour'], $bext_timestamp['minute'], $bext_timestamp['second']) = $matches_bext_time; + $thisfile_riff_WAVE_bext_0['origin_date_unix'] = gmmktime($bext_timestamp['hour'], $bext_timestamp['minute'], $bext_timestamp['second'], $bext_timestamp['month'], $bext_timestamp['day'], $bext_timestamp['year']); + } else { + $this->warning('RIFF.WAVE.BEXT.origin_time is invalid'); + } + } else { + $this->warning('RIFF.WAVE.BEXT.origin_date is invalid'); + } + $thisfile_riff['comments']['author'][] = $thisfile_riff_WAVE_bext_0['author']; + $thisfile_riff['comments']['title'][] = $thisfile_riff_WAVE_bext_0['title']; + } + + if (isset($thisfile_riff_WAVE['MEXT'][0]['data'])) { + // shortcut + $thisfile_riff_WAVE_MEXT_0 = &$thisfile_riff_WAVE['MEXT'][0]; + + $thisfile_riff_WAVE_MEXT_0['raw']['sound_information'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE_MEXT_0['data'], 0, 2)); + $thisfile_riff_WAVE_MEXT_0['flags']['homogenous'] = (bool) ($thisfile_riff_WAVE_MEXT_0['raw']['sound_information'] & 0x0001); + if ($thisfile_riff_WAVE_MEXT_0['flags']['homogenous']) { + $thisfile_riff_WAVE_MEXT_0['flags']['padding'] = ($thisfile_riff_WAVE_MEXT_0['raw']['sound_information'] & 0x0002) ? false : true; + $thisfile_riff_WAVE_MEXT_0['flags']['22_or_44'] = (bool) ($thisfile_riff_WAVE_MEXT_0['raw']['sound_information'] & 0x0004); + $thisfile_riff_WAVE_MEXT_0['flags']['free_format'] = (bool) ($thisfile_riff_WAVE_MEXT_0['raw']['sound_information'] & 0x0008); + + $thisfile_riff_WAVE_MEXT_0['nominal_frame_size'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE_MEXT_0['data'], 2, 2)); + } + $thisfile_riff_WAVE_MEXT_0['anciliary_data_length'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE_MEXT_0['data'], 6, 2)); + $thisfile_riff_WAVE_MEXT_0['raw']['anciliary_data_def'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE_MEXT_0['data'], 8, 2)); + $thisfile_riff_WAVE_MEXT_0['flags']['anciliary_data_left'] = (bool) ($thisfile_riff_WAVE_MEXT_0['raw']['anciliary_data_def'] & 0x0001); + $thisfile_riff_WAVE_MEXT_0['flags']['anciliary_data_free'] = (bool) ($thisfile_riff_WAVE_MEXT_0['raw']['anciliary_data_def'] & 0x0002); + $thisfile_riff_WAVE_MEXT_0['flags']['anciliary_data_right'] = (bool) ($thisfile_riff_WAVE_MEXT_0['raw']['anciliary_data_def'] & 0x0004); + } + + if (isset($thisfile_riff_WAVE['cart'][0]['data'])) { + // shortcut + $thisfile_riff_WAVE_cart_0 = &$thisfile_riff_WAVE['cart'][0]; + + $thisfile_riff_WAVE_cart_0['version'] = substr($thisfile_riff_WAVE_cart_0['data'], 0, 4); + $thisfile_riff_WAVE_cart_0['title'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 4, 64)); + $thisfile_riff_WAVE_cart_0['artist'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 68, 64)); + $thisfile_riff_WAVE_cart_0['cut_id'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 132, 64)); + $thisfile_riff_WAVE_cart_0['client_id'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 196, 64)); + $thisfile_riff_WAVE_cart_0['category'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 260, 64)); + $thisfile_riff_WAVE_cart_0['classification'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 324, 64)); + $thisfile_riff_WAVE_cart_0['out_cue'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 388, 64)); + $thisfile_riff_WAVE_cart_0['start_date'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 452, 10)); + $thisfile_riff_WAVE_cart_0['start_time'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 462, 8)); + $thisfile_riff_WAVE_cart_0['end_date'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 470, 10)); + $thisfile_riff_WAVE_cart_0['end_time'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 480, 8)); + $thisfile_riff_WAVE_cart_0['producer_app_id'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 488, 64)); + $thisfile_riff_WAVE_cart_0['producer_app_version'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 552, 64)); + $thisfile_riff_WAVE_cart_0['user_defined_text'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 616, 64)); + $thisfile_riff_WAVE_cart_0['zero_db_reference'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE_cart_0['data'], 680, 4), true); + for ($i = 0; $i < 8; $i++) { + $thisfile_riff_WAVE_cart_0['post_time'][$i]['usage_fourcc'] = substr($thisfile_riff_WAVE_cart_0['data'], 684 + ($i * 8), 4); + $thisfile_riff_WAVE_cart_0['post_time'][$i]['timer_value'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE_cart_0['data'], 684 + ($i * 8) + 4, 4)); + } + $thisfile_riff_WAVE_cart_0['url'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 748, 1024)); + $thisfile_riff_WAVE_cart_0['tag_text'] = explode("\r\n", trim(substr($thisfile_riff_WAVE_cart_0['data'], 1772))); + $thisfile_riff['comments']['tag_text'][] = substr($thisfile_riff_WAVE_cart_0['data'], 1772); + + $thisfile_riff['comments']['artist'][] = $thisfile_riff_WAVE_cart_0['artist']; + $thisfile_riff['comments']['title'][] = $thisfile_riff_WAVE_cart_0['title']; + } + + if (isset($thisfile_riff_WAVE['SNDM'][0]['data'])) { + // SoundMiner metadata + + // shortcuts + $thisfile_riff_WAVE_SNDM_0 = &$thisfile_riff_WAVE['SNDM'][0]; + $thisfile_riff_WAVE_SNDM_0_data = &$thisfile_riff_WAVE_SNDM_0['data']; + $SNDM_startoffset = 0; + $SNDM_endoffset = $thisfile_riff_WAVE_SNDM_0['size']; + + while ($SNDM_startoffset < $SNDM_endoffset) { + $SNDM_thisTagOffset = 0; + $SNDM_thisTagSize = getid3_lib::BigEndian2Int(substr($thisfile_riff_WAVE_SNDM_0_data, $SNDM_startoffset + $SNDM_thisTagOffset, 4)); + $SNDM_thisTagOffset += 4; + $SNDM_thisTagKey = substr($thisfile_riff_WAVE_SNDM_0_data, $SNDM_startoffset + $SNDM_thisTagOffset, 4); + $SNDM_thisTagOffset += 4; + $SNDM_thisTagDataSize = getid3_lib::BigEndian2Int(substr($thisfile_riff_WAVE_SNDM_0_data, $SNDM_startoffset + $SNDM_thisTagOffset, 2)); + $SNDM_thisTagOffset += 2; + $SNDM_thisTagDataFlags = getid3_lib::BigEndian2Int(substr($thisfile_riff_WAVE_SNDM_0_data, $SNDM_startoffset + $SNDM_thisTagOffset, 2)); + $SNDM_thisTagOffset += 2; + $SNDM_thisTagDataText = substr($thisfile_riff_WAVE_SNDM_0_data, $SNDM_startoffset + $SNDM_thisTagOffset, $SNDM_thisTagDataSize); + $SNDM_thisTagOffset += $SNDM_thisTagDataSize; + + if ($SNDM_thisTagSize != (4 + 4 + 2 + 2 + $SNDM_thisTagDataSize)) { + $this->warning('RIFF.WAVE.SNDM.data contains tag not expected length (expected: '.$SNDM_thisTagSize.', found: '.(4 + 4 + 2 + 2 + $SNDM_thisTagDataSize).') at offset '.$SNDM_startoffset.' (file offset '.($thisfile_riff_WAVE_SNDM_0['offset'] + $SNDM_startoffset).')'); + break; + } elseif ($SNDM_thisTagSize <= 0) { + $this->warning('RIFF.WAVE.SNDM.data contains zero-size tag at offset '.$SNDM_startoffset.' (file offset '.($thisfile_riff_WAVE_SNDM_0['offset'] + $SNDM_startoffset).')'); + break; + } + $SNDM_startoffset += $SNDM_thisTagSize; + + $thisfile_riff_WAVE_SNDM_0['parsed_raw'][$SNDM_thisTagKey] = $SNDM_thisTagDataText; + if ($parsedkey = self::waveSNDMtagLookup($SNDM_thisTagKey)) { + $thisfile_riff_WAVE_SNDM_0['parsed'][$parsedkey] = $SNDM_thisTagDataText; + } else { + $this->warning('RIFF.WAVE.SNDM contains unknown tag "'.$SNDM_thisTagKey.'" at offset '.$SNDM_startoffset.' (file offset '.($thisfile_riff_WAVE_SNDM_0['offset'] + $SNDM_startoffset).')'); + } + } + + $tagmapping = array( + 'tracktitle'=>'title', + 'category' =>'genre', + 'cdtitle' =>'album', + 'tracktitle'=>'title', + ); + foreach ($tagmapping as $fromkey => $tokey) { + if (isset($thisfile_riff_WAVE_SNDM_0['parsed'][$fromkey])) { + $thisfile_riff['comments'][$tokey][] = $thisfile_riff_WAVE_SNDM_0['parsed'][$fromkey]; + } + } + } + + if (isset($thisfile_riff_WAVE['iXML'][0]['data'])) { + // requires functions simplexml_load_string and get_object_vars + if ($parsedXML = getid3_lib::XML2array($thisfile_riff_WAVE['iXML'][0]['data'])) { + $thisfile_riff_WAVE['iXML'][0]['parsed'] = $parsedXML; + if (isset($parsedXML['SPEED']['MASTER_SPEED'])) { + @list($numerator, $denominator) = explode('/', $parsedXML['SPEED']['MASTER_SPEED']); + $thisfile_riff_WAVE['iXML'][0]['master_speed'] = $numerator / ($denominator ? $denominator : 1000); + } + if (isset($parsedXML['SPEED']['TIMECODE_RATE'])) { + @list($numerator, $denominator) = explode('/', $parsedXML['SPEED']['TIMECODE_RATE']); + $thisfile_riff_WAVE['iXML'][0]['timecode_rate'] = $numerator / ($denominator ? $denominator : 1000); + } + if (isset($parsedXML['SPEED']['TIMESTAMP_SAMPLES_SINCE_MIDNIGHT_LO']) && !empty($parsedXML['SPEED']['TIMESTAMP_SAMPLE_RATE']) && !empty($thisfile_riff_WAVE['iXML'][0]['timecode_rate'])) { + $samples_since_midnight = floatval(ltrim($parsedXML['SPEED']['TIMESTAMP_SAMPLES_SINCE_MIDNIGHT_HI'].$parsedXML['SPEED']['TIMESTAMP_SAMPLES_SINCE_MIDNIGHT_LO'], '0')); + $timestamp_sample_rate = (is_array($parsedXML['SPEED']['TIMESTAMP_SAMPLE_RATE']) ? max($parsedXML['SPEED']['TIMESTAMP_SAMPLE_RATE']) : $parsedXML['SPEED']['TIMESTAMP_SAMPLE_RATE']); // XML could possibly contain more than one TIMESTAMP_SAMPLE_RATE tag, returning as array instead of integer [why? does it make sense? perhaps doesn't matter but getID3 needs to deal with it] - see https://github.com/JamesHeinrich/getID3/issues/105 + $thisfile_riff_WAVE['iXML'][0]['timecode_seconds'] = $samples_since_midnight / $timestamp_sample_rate; + $h = floor( $thisfile_riff_WAVE['iXML'][0]['timecode_seconds'] / 3600); + $m = floor(($thisfile_riff_WAVE['iXML'][0]['timecode_seconds'] - ($h * 3600)) / 60); + $s = floor( $thisfile_riff_WAVE['iXML'][0]['timecode_seconds'] - ($h * 3600) - ($m * 60)); + $f = ($thisfile_riff_WAVE['iXML'][0]['timecode_seconds'] - ($h * 3600) - ($m * 60) - $s) * $thisfile_riff_WAVE['iXML'][0]['timecode_rate']; + $thisfile_riff_WAVE['iXML'][0]['timecode_string'] = sprintf('%02d:%02d:%02d:%05.2f', $h, $m, $s, $f); + $thisfile_riff_WAVE['iXML'][0]['timecode_string_round'] = sprintf('%02d:%02d:%02d:%02d', $h, $m, $s, round($f)); + unset($samples_since_midnight, $timestamp_sample_rate, $h, $m, $s, $f); + } + unset($parsedXML); + } + } + + + + if (!isset($thisfile_audio['bitrate']) && isset($thisfile_riff_audio[$streamindex]['bitrate'])) { + $thisfile_audio['bitrate'] = $thisfile_riff_audio[$streamindex]['bitrate']; + $info['playtime_seconds'] = (float) ((($info['avdataend'] - $info['avdataoffset']) * 8) / $thisfile_audio['bitrate']); + } + + if (!empty($info['wavpack'])) { + $thisfile_audio_dataformat = 'wavpack'; + $thisfile_audio['bitrate_mode'] = 'vbr'; + $thisfile_audio['encoder'] = 'WavPack v'.$info['wavpack']['version']; + + // Reset to the way it was - RIFF parsing will have messed this up + $info['avdataend'] = $Original['avdataend']; + $thisfile_audio['bitrate'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / $info['playtime_seconds']; + + $this->fseek($info['avdataoffset'] - 44); + $RIFFdata = $this->fread(44); + $OrignalRIFFheaderSize = getid3_lib::LittleEndian2Int(substr($RIFFdata, 4, 4)) + 8; + $OrignalRIFFdataSize = getid3_lib::LittleEndian2Int(substr($RIFFdata, 40, 4)) + 44; + + if ($OrignalRIFFheaderSize > $OrignalRIFFdataSize) { + $info['avdataend'] -= ($OrignalRIFFheaderSize - $OrignalRIFFdataSize); + $this->fseek($info['avdataend']); + $RIFFdata .= $this->fread($OrignalRIFFheaderSize - $OrignalRIFFdataSize); + } + + // move the data chunk after all other chunks (if any) + // so that the RIFF parser doesn't see EOF when trying + // to skip over the data chunk + $RIFFdata = substr($RIFFdata, 0, 36).substr($RIFFdata, 44).substr($RIFFdata, 36, 8); + $getid3_riff = new getid3_riff($this->getid3); + $getid3_riff->ParseRIFFdata($RIFFdata); + unset($getid3_riff); + } + + if (isset($thisfile_riff_raw['fmt ']['wFormatTag'])) { + switch ($thisfile_riff_raw['fmt ']['wFormatTag']) { + case 0x0001: // PCM + if (!empty($info['ac3'])) { + // Dolby Digital WAV files masquerade as PCM-WAV, but they're not + $thisfile_audio['wformattag'] = 0x2000; + $thisfile_audio['codec'] = self::wFormatTagLookup($thisfile_audio['wformattag']); + $thisfile_audio['lossless'] = false; + $thisfile_audio['bitrate'] = $info['ac3']['bitrate']; + $thisfile_audio['sample_rate'] = $info['ac3']['sample_rate']; + } + if (!empty($info['dts'])) { + // Dolby DTS files masquerade as PCM-WAV, but they're not + $thisfile_audio['wformattag'] = 0x2001; + $thisfile_audio['codec'] = self::wFormatTagLookup($thisfile_audio['wformattag']); + $thisfile_audio['lossless'] = false; + $thisfile_audio['bitrate'] = $info['dts']['bitrate']; + $thisfile_audio['sample_rate'] = $info['dts']['sample_rate']; + } + break; + case 0x08AE: // ClearJump LiteWave + $thisfile_audio['bitrate_mode'] = 'vbr'; + $thisfile_audio_dataformat = 'litewave'; + + //typedef struct tagSLwFormat { + // WORD m_wCompFormat; // low byte defines compression method, high byte is compression flags + // DWORD m_dwScale; // scale factor for lossy compression + // DWORD m_dwBlockSize; // number of samples in encoded blocks + // WORD m_wQuality; // alias for the scale factor + // WORD m_wMarkDistance; // distance between marks in bytes + // WORD m_wReserved; + // + // //following paramters are ignored if CF_FILESRC is not set + // DWORD m_dwOrgSize; // original file size in bytes + // WORD m_bFactExists; // indicates if 'fact' chunk exists in the original file + // DWORD m_dwRiffChunkSize; // riff chunk size in the original file + // + // PCMWAVEFORMAT m_OrgWf; // original wave format + // }SLwFormat, *PSLwFormat; + + // shortcut + $thisfile_riff['litewave']['raw'] = array(); + $riff_litewave = &$thisfile_riff['litewave']; + $riff_litewave_raw = &$riff_litewave['raw']; + + $flags = array( + 'compression_method' => 1, + 'compression_flags' => 1, + 'm_dwScale' => 4, + 'm_dwBlockSize' => 4, + 'm_wQuality' => 2, + 'm_wMarkDistance' => 2, + 'm_wReserved' => 2, + 'm_dwOrgSize' => 4, + 'm_bFactExists' => 2, + 'm_dwRiffChunkSize' => 4, + ); + $litewave_offset = 18; + foreach ($flags as $flag => $length) { + $riff_litewave_raw[$flag] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE['fmt '][0]['data'], $litewave_offset, $length)); + $litewave_offset += $length; + } + + //$riff_litewave['quality_factor'] = intval(round((2000 - $riff_litewave_raw['m_dwScale']) / 20)); + $riff_litewave['quality_factor'] = $riff_litewave_raw['m_wQuality']; + + $riff_litewave['flags']['raw_source'] = ($riff_litewave_raw['compression_flags'] & 0x01) ? false : true; + $riff_litewave['flags']['vbr_blocksize'] = ($riff_litewave_raw['compression_flags'] & 0x02) ? false : true; + $riff_litewave['flags']['seekpoints'] = (bool) ($riff_litewave_raw['compression_flags'] & 0x04); + + $thisfile_audio['lossless'] = (($riff_litewave_raw['m_wQuality'] == 100) ? true : false); + $thisfile_audio['encoder_options'] = '-q'.$riff_litewave['quality_factor']; + break; + + default: + break; + } + } + if ($info['avdataend'] > $info['filesize']) { + switch (!empty($thisfile_audio_dataformat) ? $thisfile_audio_dataformat : '') { + case 'wavpack': // WavPack + case 'lpac': // LPAC + case 'ofr': // OptimFROG + case 'ofs': // OptimFROG DualStream + // lossless compressed audio formats that keep original RIFF headers - skip warning + break; + + case 'litewave': + if (($info['avdataend'] - $info['filesize']) == 1) { + // LiteWave appears to incorrectly *not* pad actual output file + // to nearest WORD boundary so may appear to be short by one + // byte, in which case - skip warning + } else { + // Short by more than one byte, throw warning + $this->warning('Probably truncated file - expecting '.$thisfile_riff[$RIFFsubtype]['data'][0]['size'].' bytes of data, only found '.($info['filesize'] - $info['avdataoffset']).' (short by '.($thisfile_riff[$RIFFsubtype]['data'][0]['size'] - ($info['filesize'] - $info['avdataoffset'])).' bytes)'); + $info['avdataend'] = $info['filesize']; + } + break; + + default: + if ((($info['avdataend'] - $info['filesize']) == 1) && (($thisfile_riff[$RIFFsubtype]['data'][0]['size'] % 2) == 0) && ((($info['filesize'] - $info['avdataoffset']) % 2) == 1)) { + // output file appears to be incorrectly *not* padded to nearest WORD boundary + // Output less severe warning + $this->warning('File should probably be padded to nearest WORD boundary, but it is not (expecting '.$thisfile_riff[$RIFFsubtype]['data'][0]['size'].' bytes of data, only found '.($info['filesize'] - $info['avdataoffset']).' therefore short by '.($thisfile_riff[$RIFFsubtype]['data'][0]['size'] - ($info['filesize'] - $info['avdataoffset'])).' bytes)'); + $info['avdataend'] = $info['filesize']; + } else { + // Short by more than one byte, throw warning + $this->warning('Probably truncated file - expecting '.$thisfile_riff[$RIFFsubtype]['data'][0]['size'].' bytes of data, only found '.($info['filesize'] - $info['avdataoffset']).' (short by '.($thisfile_riff[$RIFFsubtype]['data'][0]['size'] - ($info['filesize'] - $info['avdataoffset'])).' bytes)'); + $info['avdataend'] = $info['filesize']; + } + break; + } + } + if (!empty($info['mpeg']['audio']['LAME']['audio_bytes'])) { + if ((($info['avdataend'] - $info['avdataoffset']) - $info['mpeg']['audio']['LAME']['audio_bytes']) == 1) { + $info['avdataend']--; + $this->warning('Extra null byte at end of MP3 data assumed to be RIFF padding and therefore ignored'); + } + } + if (isset($thisfile_audio_dataformat) && ($thisfile_audio_dataformat == 'ac3')) { + unset($thisfile_audio['bits_per_sample']); + if (!empty($info['ac3']['bitrate']) && ($info['ac3']['bitrate'] != $thisfile_audio['bitrate'])) { + $thisfile_audio['bitrate'] = $info['ac3']['bitrate']; + } + } + break; + + // http://en.wikipedia.org/wiki/Audio_Video_Interleave + case 'AVI ': + $info['fileformat'] = 'avi'; + $info['mime_type'] = 'video/avi'; + + $thisfile_video['bitrate_mode'] = 'vbr'; // maybe not, but probably + $thisfile_video['dataformat'] = 'avi'; + + if (isset($thisfile_riff[$RIFFsubtype]['movi']['offset'])) { + $info['avdataoffset'] = $thisfile_riff[$RIFFsubtype]['movi']['offset'] + 8; + if (isset($thisfile_riff['AVIX'])) { + $info['avdataend'] = $thisfile_riff['AVIX'][(count($thisfile_riff['AVIX']) - 1)]['chunks']['movi']['offset'] + $thisfile_riff['AVIX'][(count($thisfile_riff['AVIX']) - 1)]['chunks']['movi']['size']; + } else { + $info['avdataend'] = $thisfile_riff['AVI ']['movi']['offset'] + $thisfile_riff['AVI ']['movi']['size']; + } + if ($info['avdataend'] > $info['filesize']) { + $this->warning('Probably truncated file - expecting '.($info['avdataend'] - $info['avdataoffset']).' bytes of data, only found '.($info['filesize'] - $info['avdataoffset']).' (short by '.($info['avdataend'] - $info['filesize']).' bytes)'); + $info['avdataend'] = $info['filesize']; + } + } + + if (isset($thisfile_riff['AVI ']['hdrl']['strl']['indx'])) { + //$bIndexType = array( + // 0x00 => 'AVI_INDEX_OF_INDEXES', + // 0x01 => 'AVI_INDEX_OF_CHUNKS', + // 0x80 => 'AVI_INDEX_IS_DATA', + //); + //$bIndexSubtype = array( + // 0x01 => array( + // 0x01 => 'AVI_INDEX_2FIELD', + // ), + //); + foreach ($thisfile_riff['AVI ']['hdrl']['strl']['indx'] as $streamnumber => $steamdataarray) { + $ahsisd = &$thisfile_riff['AVI ']['hdrl']['strl']['indx'][$streamnumber]['data']; + + $thisfile_riff_raw['indx'][$streamnumber]['wLongsPerEntry'] = $this->EitherEndian2Int(substr($ahsisd, 0, 2)); + $thisfile_riff_raw['indx'][$streamnumber]['bIndexSubType'] = $this->EitherEndian2Int(substr($ahsisd, 2, 1)); + $thisfile_riff_raw['indx'][$streamnumber]['bIndexType'] = $this->EitherEndian2Int(substr($ahsisd, 3, 1)); + $thisfile_riff_raw['indx'][$streamnumber]['nEntriesInUse'] = $this->EitherEndian2Int(substr($ahsisd, 4, 4)); + $thisfile_riff_raw['indx'][$streamnumber]['dwChunkId'] = substr($ahsisd, 8, 4); + $thisfile_riff_raw['indx'][$streamnumber]['dwReserved'] = $this->EitherEndian2Int(substr($ahsisd, 12, 4)); + + //$thisfile_riff_raw['indx'][$streamnumber]['bIndexType_name'] = $bIndexType[$thisfile_riff_raw['indx'][$streamnumber]['bIndexType']]; + //$thisfile_riff_raw['indx'][$streamnumber]['bIndexSubType_name'] = $bIndexSubtype[$thisfile_riff_raw['indx'][$streamnumber]['bIndexType']][$thisfile_riff_raw['indx'][$streamnumber]['bIndexSubType']]; + + unset($ahsisd); + } + } + if (isset($thisfile_riff['AVI ']['hdrl']['avih'][$streamindex]['data'])) { + $avihData = $thisfile_riff['AVI ']['hdrl']['avih'][$streamindex]['data']; + + // shortcut + $thisfile_riff_raw['avih'] = array(); + $thisfile_riff_raw_avih = &$thisfile_riff_raw['avih']; + + $thisfile_riff_raw_avih['dwMicroSecPerFrame'] = $this->EitherEndian2Int(substr($avihData, 0, 4)); // frame display rate (or 0L) + if ($thisfile_riff_raw_avih['dwMicroSecPerFrame'] == 0) { + $this->error('Corrupt RIFF file: avih.dwMicroSecPerFrame == zero'); + return false; + } + + $flags = array( + 'dwMaxBytesPerSec', // max. transfer rate + 'dwPaddingGranularity', // pad to multiples of this size; normally 2K. + 'dwFlags', // the ever-present flags + 'dwTotalFrames', // # frames in file + 'dwInitialFrames', // + 'dwStreams', // + 'dwSuggestedBufferSize', // + 'dwWidth', // + 'dwHeight', // + 'dwScale', // + 'dwRate', // + 'dwStart', // + 'dwLength', // + ); + $avih_offset = 4; + foreach ($flags as $flag) { + $thisfile_riff_raw_avih[$flag] = $this->EitherEndian2Int(substr($avihData, $avih_offset, 4)); + $avih_offset += 4; + } + + $flags = array( + 'hasindex' => 0x00000010, + 'mustuseindex' => 0x00000020, + 'interleaved' => 0x00000100, + 'trustcktype' => 0x00000800, + 'capturedfile' => 0x00010000, + 'copyrighted' => 0x00020010, + ); + foreach ($flags as $flag => $value) { + $thisfile_riff_raw_avih['flags'][$flag] = (bool) ($thisfile_riff_raw_avih['dwFlags'] & $value); + } + + // shortcut + $thisfile_riff_video[$streamindex] = array(); + $thisfile_riff_video_current = &$thisfile_riff_video[$streamindex]; + + if ($thisfile_riff_raw_avih['dwWidth'] > 0) { + $thisfile_riff_video_current['frame_width'] = $thisfile_riff_raw_avih['dwWidth']; + $thisfile_video['resolution_x'] = $thisfile_riff_video_current['frame_width']; + } + if ($thisfile_riff_raw_avih['dwHeight'] > 0) { + $thisfile_riff_video_current['frame_height'] = $thisfile_riff_raw_avih['dwHeight']; + $thisfile_video['resolution_y'] = $thisfile_riff_video_current['frame_height']; + } + if ($thisfile_riff_raw_avih['dwTotalFrames'] > 0) { + $thisfile_riff_video_current['total_frames'] = $thisfile_riff_raw_avih['dwTotalFrames']; + $thisfile_video['total_frames'] = $thisfile_riff_video_current['total_frames']; + } + + $thisfile_riff_video_current['frame_rate'] = round(1000000 / $thisfile_riff_raw_avih['dwMicroSecPerFrame'], 3); + $thisfile_video['frame_rate'] = $thisfile_riff_video_current['frame_rate']; + } + if (isset($thisfile_riff['AVI ']['hdrl']['strl']['strh'][0]['data'])) { + if (is_array($thisfile_riff['AVI ']['hdrl']['strl']['strh'])) { + for ($i = 0; $i < count($thisfile_riff['AVI ']['hdrl']['strl']['strh']); $i++) { + if (isset($thisfile_riff['AVI ']['hdrl']['strl']['strh'][$i]['data'])) { + $strhData = $thisfile_riff['AVI ']['hdrl']['strl']['strh'][$i]['data']; + $strhfccType = substr($strhData, 0, 4); + + if (isset($thisfile_riff['AVI ']['hdrl']['strl']['strf'][$i]['data'])) { + $strfData = $thisfile_riff['AVI ']['hdrl']['strl']['strf'][$i]['data']; + + // shortcut + $thisfile_riff_raw_strf_strhfccType_streamindex = &$thisfile_riff_raw['strf'][$strhfccType][$streamindex]; + + switch ($strhfccType) { + case 'auds': + $thisfile_audio['bitrate_mode'] = 'cbr'; + $thisfile_audio_dataformat = 'wav'; + if (isset($thisfile_riff_audio) && is_array($thisfile_riff_audio)) { + $streamindex = count($thisfile_riff_audio); + } + + $thisfile_riff_audio[$streamindex] = self::parseWAVEFORMATex($strfData); + $thisfile_audio['wformattag'] = $thisfile_riff_audio[$streamindex]['raw']['wFormatTag']; + + // shortcut + $thisfile_audio['streams'][$streamindex] = $thisfile_riff_audio[$streamindex]; + $thisfile_audio_streams_currentstream = &$thisfile_audio['streams'][$streamindex]; + + if ($thisfile_audio_streams_currentstream['bits_per_sample'] == 0) { + unset($thisfile_audio_streams_currentstream['bits_per_sample']); + } + $thisfile_audio_streams_currentstream['wformattag'] = $thisfile_audio_streams_currentstream['raw']['wFormatTag']; + unset($thisfile_audio_streams_currentstream['raw']); + + // shortcut + $thisfile_riff_raw['strf'][$strhfccType][$streamindex] = $thisfile_riff_audio[$streamindex]['raw']; + + unset($thisfile_riff_audio[$streamindex]['raw']); + $thisfile_audio = getid3_lib::array_merge_noclobber($thisfile_audio, $thisfile_riff_audio[$streamindex]); + + $thisfile_audio['lossless'] = false; + switch ($thisfile_riff_raw_strf_strhfccType_streamindex['wFormatTag']) { + case 0x0001: // PCM + $thisfile_audio_dataformat = 'wav'; + $thisfile_audio['lossless'] = true; + break; + + case 0x0050: // MPEG Layer 2 or Layer 1 + $thisfile_audio_dataformat = 'mp2'; // Assume Layer-2 + break; + + case 0x0055: // MPEG Layer 3 + $thisfile_audio_dataformat = 'mp3'; + break; + + case 0x00FF: // AAC + $thisfile_audio_dataformat = 'aac'; + break; + + case 0x0161: // Windows Media v7 / v8 / v9 + case 0x0162: // Windows Media Professional v9 + case 0x0163: // Windows Media Lossess v9 + $thisfile_audio_dataformat = 'wma'; + break; + + case 0x2000: // AC-3 + $thisfile_audio_dataformat = 'ac3'; + break; + + case 0x2001: // DTS + $thisfile_audio_dataformat = 'dts'; + break; + + default: + $thisfile_audio_dataformat = 'wav'; + break; + } + $thisfile_audio_streams_currentstream['dataformat'] = $thisfile_audio_dataformat; + $thisfile_audio_streams_currentstream['lossless'] = $thisfile_audio['lossless']; + $thisfile_audio_streams_currentstream['bitrate_mode'] = $thisfile_audio['bitrate_mode']; + break; + + + case 'iavs': + case 'vids': + // shortcut + $thisfile_riff_raw['strh'][$i] = array(); + $thisfile_riff_raw_strh_current = &$thisfile_riff_raw['strh'][$i]; + + $thisfile_riff_raw_strh_current['fccType'] = substr($strhData, 0, 4); // same as $strhfccType; + $thisfile_riff_raw_strh_current['fccHandler'] = substr($strhData, 4, 4); + $thisfile_riff_raw_strh_current['dwFlags'] = $this->EitherEndian2Int(substr($strhData, 8, 4)); // Contains AVITF_* flags + $thisfile_riff_raw_strh_current['wPriority'] = $this->EitherEndian2Int(substr($strhData, 12, 2)); + $thisfile_riff_raw_strh_current['wLanguage'] = $this->EitherEndian2Int(substr($strhData, 14, 2)); + $thisfile_riff_raw_strh_current['dwInitialFrames'] = $this->EitherEndian2Int(substr($strhData, 16, 4)); + $thisfile_riff_raw_strh_current['dwScale'] = $this->EitherEndian2Int(substr($strhData, 20, 4)); + $thisfile_riff_raw_strh_current['dwRate'] = $this->EitherEndian2Int(substr($strhData, 24, 4)); + $thisfile_riff_raw_strh_current['dwStart'] = $this->EitherEndian2Int(substr($strhData, 28, 4)); + $thisfile_riff_raw_strh_current['dwLength'] = $this->EitherEndian2Int(substr($strhData, 32, 4)); + $thisfile_riff_raw_strh_current['dwSuggestedBufferSize'] = $this->EitherEndian2Int(substr($strhData, 36, 4)); + $thisfile_riff_raw_strh_current['dwQuality'] = $this->EitherEndian2Int(substr($strhData, 40, 4)); + $thisfile_riff_raw_strh_current['dwSampleSize'] = $this->EitherEndian2Int(substr($strhData, 44, 4)); + $thisfile_riff_raw_strh_current['rcFrame'] = $this->EitherEndian2Int(substr($strhData, 48, 4)); + + $thisfile_riff_video_current['codec'] = self::fourccLookup($thisfile_riff_raw_strh_current['fccHandler']); + $thisfile_video['fourcc'] = $thisfile_riff_raw_strh_current['fccHandler']; + if (!$thisfile_riff_video_current['codec'] && isset($thisfile_riff_raw_strf_strhfccType_streamindex['fourcc']) && self::fourccLookup($thisfile_riff_raw_strf_strhfccType_streamindex['fourcc'])) { + $thisfile_riff_video_current['codec'] = self::fourccLookup($thisfile_riff_raw_strf_strhfccType_streamindex['fourcc']); + $thisfile_video['fourcc'] = $thisfile_riff_raw_strf_strhfccType_streamindex['fourcc']; + } + $thisfile_video['codec'] = $thisfile_riff_video_current['codec']; + $thisfile_video['pixel_aspect_ratio'] = (float) 1; + switch ($thisfile_riff_raw_strh_current['fccHandler']) { + case 'HFYU': // Huffman Lossless Codec + case 'IRAW': // Intel YUV Uncompressed + case 'YUY2': // Uncompressed YUV 4:2:2 + $thisfile_video['lossless'] = true; + break; + + default: + $thisfile_video['lossless'] = false; + break; + } + + switch ($strhfccType) { + case 'vids': + $thisfile_riff_raw_strf_strhfccType_streamindex = self::ParseBITMAPINFOHEADER(substr($strfData, 0, 40), ($this->container == 'riff')); + $thisfile_video['bits_per_sample'] = $thisfile_riff_raw_strf_strhfccType_streamindex['biBitCount']; + + if ($thisfile_riff_video_current['codec'] == 'DV') { + $thisfile_riff_video_current['dv_type'] = 2; + } + break; + + case 'iavs': + $thisfile_riff_video_current['dv_type'] = 1; + break; + } + break; + + default: + $this->warning('Unhandled fccType for stream ('.$i.'): "'.$strhfccType.'"'); + break; + + } + } + } + + if (isset($thisfile_riff_raw_strf_strhfccType_streamindex['fourcc'])) { + + $thisfile_video['fourcc'] = $thisfile_riff_raw_strf_strhfccType_streamindex['fourcc']; + if (self::fourccLookup($thisfile_video['fourcc'])) { + $thisfile_riff_video_current['codec'] = self::fourccLookup($thisfile_video['fourcc']); + $thisfile_video['codec'] = $thisfile_riff_video_current['codec']; + } + + switch ($thisfile_riff_raw_strf_strhfccType_streamindex['fourcc']) { + case 'HFYU': // Huffman Lossless Codec + case 'IRAW': // Intel YUV Uncompressed + case 'YUY2': // Uncompressed YUV 4:2:2 + $thisfile_video['lossless'] = true; + //$thisfile_video['bits_per_sample'] = 24; + break; + + default: + $thisfile_video['lossless'] = false; + //$thisfile_video['bits_per_sample'] = 24; + break; + } + + } + } + } + } + break; + + + case 'AMV ': + $info['fileformat'] = 'amv'; + $info['mime_type'] = 'video/amv'; + + $thisfile_video['bitrate_mode'] = 'vbr'; // it's MJPEG, presumably contant-quality encoding, thereby VBR + $thisfile_video['dataformat'] = 'mjpeg'; + $thisfile_video['codec'] = 'mjpeg'; + $thisfile_video['lossless'] = false; + $thisfile_video['bits_per_sample'] = 24; + + $thisfile_audio['dataformat'] = 'adpcm'; + $thisfile_audio['lossless'] = false; + break; + + + // http://en.wikipedia.org/wiki/CD-DA + case 'CDDA': + $info['fileformat'] = 'cda'; + unset($info['mime_type']); + + $thisfile_audio_dataformat = 'cda'; + + $info['avdataoffset'] = 44; + + if (isset($thisfile_riff['CDDA']['fmt '][0]['data'])) { + // shortcut + $thisfile_riff_CDDA_fmt_0 = &$thisfile_riff['CDDA']['fmt '][0]; + + $thisfile_riff_CDDA_fmt_0['unknown1'] = $this->EitherEndian2Int(substr($thisfile_riff_CDDA_fmt_0['data'], 0, 2)); + $thisfile_riff_CDDA_fmt_0['track_num'] = $this->EitherEndian2Int(substr($thisfile_riff_CDDA_fmt_0['data'], 2, 2)); + $thisfile_riff_CDDA_fmt_0['disc_id'] = $this->EitherEndian2Int(substr($thisfile_riff_CDDA_fmt_0['data'], 4, 4)); + $thisfile_riff_CDDA_fmt_0['start_offset_frame'] = $this->EitherEndian2Int(substr($thisfile_riff_CDDA_fmt_0['data'], 8, 4)); + $thisfile_riff_CDDA_fmt_0['playtime_frames'] = $this->EitherEndian2Int(substr($thisfile_riff_CDDA_fmt_0['data'], 12, 4)); + $thisfile_riff_CDDA_fmt_0['unknown6'] = $this->EitherEndian2Int(substr($thisfile_riff_CDDA_fmt_0['data'], 16, 4)); + $thisfile_riff_CDDA_fmt_0['unknown7'] = $this->EitherEndian2Int(substr($thisfile_riff_CDDA_fmt_0['data'], 20, 4)); + + $thisfile_riff_CDDA_fmt_0['start_offset_seconds'] = (float) $thisfile_riff_CDDA_fmt_0['start_offset_frame'] / 75; + $thisfile_riff_CDDA_fmt_0['playtime_seconds'] = (float) $thisfile_riff_CDDA_fmt_0['playtime_frames'] / 75; + $info['comments']['track'] = $thisfile_riff_CDDA_fmt_0['track_num']; + $info['playtime_seconds'] = $thisfile_riff_CDDA_fmt_0['playtime_seconds']; + + // hardcoded data for CD-audio + $thisfile_audio['lossless'] = true; + $thisfile_audio['sample_rate'] = 44100; + $thisfile_audio['channels'] = 2; + $thisfile_audio['bits_per_sample'] = 16; + $thisfile_audio['bitrate'] = $thisfile_audio['sample_rate'] * $thisfile_audio['channels'] * $thisfile_audio['bits_per_sample']; + $thisfile_audio['bitrate_mode'] = 'cbr'; + } + break; + + // http://en.wikipedia.org/wiki/AIFF + case 'AIFF': + case 'AIFC': + $info['fileformat'] = 'aiff'; + $info['mime_type'] = 'audio/x-aiff'; + + $thisfile_audio['bitrate_mode'] = 'cbr'; + $thisfile_audio_dataformat = 'aiff'; + $thisfile_audio['lossless'] = true; + + if (isset($thisfile_riff[$RIFFsubtype]['SSND'][0]['offset'])) { + $info['avdataoffset'] = $thisfile_riff[$RIFFsubtype]['SSND'][0]['offset'] + 8; + $info['avdataend'] = $info['avdataoffset'] + $thisfile_riff[$RIFFsubtype]['SSND'][0]['size']; + if ($info['avdataend'] > $info['filesize']) { + if (($info['avdataend'] == ($info['filesize'] + 1)) && (($info['filesize'] % 2) == 1)) { + // structures rounded to 2-byte boundary, but dumb encoders + // forget to pad end of file to make this actually work + } else { + $this->warning('Probable truncated AIFF file: expecting '.$thisfile_riff[$RIFFsubtype]['SSND'][0]['size'].' bytes of audio data, only '.($info['filesize'] - $info['avdataoffset']).' bytes found'); + } + $info['avdataend'] = $info['filesize']; + } + } + + if (isset($thisfile_riff[$RIFFsubtype]['COMM'][0]['data'])) { + + // shortcut + $thisfile_riff_RIFFsubtype_COMM_0_data = &$thisfile_riff[$RIFFsubtype]['COMM'][0]['data']; + + $thisfile_riff_audio['channels'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_COMM_0_data, 0, 2), true); + $thisfile_riff_audio['total_samples'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_COMM_0_data, 2, 4), false); + $thisfile_riff_audio['bits_per_sample'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_COMM_0_data, 6, 2), true); + $thisfile_riff_audio['sample_rate'] = (int) getid3_lib::BigEndian2Float(substr($thisfile_riff_RIFFsubtype_COMM_0_data, 8, 10)); + + if ($thisfile_riff[$RIFFsubtype]['COMM'][0]['size'] > 18) { + $thisfile_riff_audio['codec_fourcc'] = substr($thisfile_riff_RIFFsubtype_COMM_0_data, 18, 4); + $CodecNameSize = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_COMM_0_data, 22, 1), false); + $thisfile_riff_audio['codec_name'] = substr($thisfile_riff_RIFFsubtype_COMM_0_data, 23, $CodecNameSize); + switch ($thisfile_riff_audio['codec_name']) { + case 'NONE': + $thisfile_audio['codec'] = 'Pulse Code Modulation (PCM)'; + $thisfile_audio['lossless'] = true; + break; + + case '': + switch ($thisfile_riff_audio['codec_fourcc']) { + // http://developer.apple.com/qa/snd/snd07.html + case 'sowt': + $thisfile_riff_audio['codec_name'] = 'Two\'s Compliment Little-Endian PCM'; + $thisfile_audio['lossless'] = true; + break; + + case 'twos': + $thisfile_riff_audio['codec_name'] = 'Two\'s Compliment Big-Endian PCM'; + $thisfile_audio['lossless'] = true; + break; + + default: + break; + } + break; + + default: + $thisfile_audio['codec'] = $thisfile_riff_audio['codec_name']; + $thisfile_audio['lossless'] = false; + break; + } + } + + $thisfile_audio['channels'] = $thisfile_riff_audio['channels']; + if ($thisfile_riff_audio['bits_per_sample'] > 0) { + $thisfile_audio['bits_per_sample'] = $thisfile_riff_audio['bits_per_sample']; + } + $thisfile_audio['sample_rate'] = $thisfile_riff_audio['sample_rate']; + if ($thisfile_audio['sample_rate'] == 0) { + $this->error('Corrupted AIFF file: sample_rate == zero'); + return false; + } + $info['playtime_seconds'] = $thisfile_riff_audio['total_samples'] / $thisfile_audio['sample_rate']; + } + + if (isset($thisfile_riff[$RIFFsubtype]['COMT'])) { + $offset = 0; + $CommentCount = getid3_lib::BigEndian2Int(substr($thisfile_riff[$RIFFsubtype]['COMT'][0]['data'], $offset, 2), false); + $offset += 2; + for ($i = 0; $i < $CommentCount; $i++) { + $info['comments_raw'][$i]['timestamp'] = getid3_lib::BigEndian2Int(substr($thisfile_riff[$RIFFsubtype]['COMT'][0]['data'], $offset, 4), false); + $offset += 4; + $info['comments_raw'][$i]['marker_id'] = getid3_lib::BigEndian2Int(substr($thisfile_riff[$RIFFsubtype]['COMT'][0]['data'], $offset, 2), true); + $offset += 2; + $CommentLength = getid3_lib::BigEndian2Int(substr($thisfile_riff[$RIFFsubtype]['COMT'][0]['data'], $offset, 2), false); + $offset += 2; + $info['comments_raw'][$i]['comment'] = substr($thisfile_riff[$RIFFsubtype]['COMT'][0]['data'], $offset, $CommentLength); + $offset += $CommentLength; + + $info['comments_raw'][$i]['timestamp_unix'] = getid3_lib::DateMac2Unix($info['comments_raw'][$i]['timestamp']); + $thisfile_riff['comments']['comment'][] = $info['comments_raw'][$i]['comment']; + } + } + + $CommentsChunkNames = array('NAME'=>'title', 'author'=>'artist', '(c) '=>'copyright', 'ANNO'=>'comment'); + foreach ($CommentsChunkNames as $key => $value) { + if (isset($thisfile_riff[$RIFFsubtype][$key][0]['data'])) { + $thisfile_riff['comments'][$value][] = $thisfile_riff[$RIFFsubtype][$key][0]['data']; + } + } +/* + if (isset($thisfile_riff[$RIFFsubtype]['ID3 '])) { + getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.tag.id3v2.php', __FILE__, true); + $getid3_temp = new getID3(); + $getid3_temp->openfile($this->getid3->filename); + $getid3_id3v2 = new getid3_id3v2($getid3_temp); + $getid3_id3v2->StartingOffset = $thisfile_riff[$RIFFsubtype]['ID3 '][0]['offset'] + 8; + if ($thisfile_riff[$RIFFsubtype]['ID3 '][0]['valid'] = $getid3_id3v2->Analyze()) { + $info['id3v2'] = $getid3_temp->info['id3v2']; + } + unset($getid3_temp, $getid3_id3v2); + } +*/ + break; + + // http://en.wikipedia.org/wiki/8SVX + case '8SVX': + $info['fileformat'] = '8svx'; + $info['mime_type'] = 'audio/8svx'; + + $thisfile_audio['bitrate_mode'] = 'cbr'; + $thisfile_audio_dataformat = '8svx'; + $thisfile_audio['bits_per_sample'] = 8; + $thisfile_audio['channels'] = 1; // overridden below, if need be + + if (isset($thisfile_riff[$RIFFsubtype]['BODY'][0]['offset'])) { + $info['avdataoffset'] = $thisfile_riff[$RIFFsubtype]['BODY'][0]['offset'] + 8; + $info['avdataend'] = $info['avdataoffset'] + $thisfile_riff[$RIFFsubtype]['BODY'][0]['size']; + if ($info['avdataend'] > $info['filesize']) { + $this->warning('Probable truncated AIFF file: expecting '.$thisfile_riff[$RIFFsubtype]['BODY'][0]['size'].' bytes of audio data, only '.($info['filesize'] - $info['avdataoffset']).' bytes found'); + } + } + + if (isset($thisfile_riff[$RIFFsubtype]['VHDR'][0]['offset'])) { + // shortcut + $thisfile_riff_RIFFsubtype_VHDR_0 = &$thisfile_riff[$RIFFsubtype]['VHDR'][0]; + + $thisfile_riff_RIFFsubtype_VHDR_0['oneShotHiSamples'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 0, 4)); + $thisfile_riff_RIFFsubtype_VHDR_0['repeatHiSamples'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 4, 4)); + $thisfile_riff_RIFFsubtype_VHDR_0['samplesPerHiCycle'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 8, 4)); + $thisfile_riff_RIFFsubtype_VHDR_0['samplesPerSec'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 12, 2)); + $thisfile_riff_RIFFsubtype_VHDR_0['ctOctave'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 14, 1)); + $thisfile_riff_RIFFsubtype_VHDR_0['sCompression'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 15, 1)); + $thisfile_riff_RIFFsubtype_VHDR_0['Volume'] = getid3_lib::FixedPoint16_16(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 16, 4)); + + $thisfile_audio['sample_rate'] = $thisfile_riff_RIFFsubtype_VHDR_0['samplesPerSec']; + + switch ($thisfile_riff_RIFFsubtype_VHDR_0['sCompression']) { + case 0: + $thisfile_audio['codec'] = 'Pulse Code Modulation (PCM)'; + $thisfile_audio['lossless'] = true; + $ActualBitsPerSample = 8; + break; + + case 1: + $thisfile_audio['codec'] = 'Fibonacci-delta encoding'; + $thisfile_audio['lossless'] = false; + $ActualBitsPerSample = 4; + break; + + default: + $this->warning('Unexpected sCompression value in 8SVX.VHDR chunk - expecting 0 or 1, found "'.sCompression.'"'); + break; + } + } + + if (isset($thisfile_riff[$RIFFsubtype]['CHAN'][0]['data'])) { + $ChannelsIndex = getid3_lib::BigEndian2Int(substr($thisfile_riff[$RIFFsubtype]['CHAN'][0]['data'], 0, 4)); + switch ($ChannelsIndex) { + case 6: // Stereo + $thisfile_audio['channels'] = 2; + break; + + case 2: // Left channel only + case 4: // Right channel only + $thisfile_audio['channels'] = 1; + break; + + default: + $this->warning('Unexpected value in 8SVX.CHAN chunk - expecting 2 or 4 or 6, found "'.$ChannelsIndex.'"'); + break; + } + + } + + $CommentsChunkNames = array('NAME'=>'title', 'author'=>'artist', '(c) '=>'copyright', 'ANNO'=>'comment'); + foreach ($CommentsChunkNames as $key => $value) { + if (isset($thisfile_riff[$RIFFsubtype][$key][0]['data'])) { + $thisfile_riff['comments'][$value][] = $thisfile_riff[$RIFFsubtype][$key][0]['data']; + } + } + + $thisfile_audio['bitrate'] = $thisfile_audio['sample_rate'] * $ActualBitsPerSample * $thisfile_audio['channels']; + if (!empty($thisfile_audio['bitrate'])) { + $info['playtime_seconds'] = ($info['avdataend'] - $info['avdataoffset']) / ($thisfile_audio['bitrate'] / 8); + } + break; + + case 'CDXA': + $info['fileformat'] = 'vcd'; // Asume Video CD + $info['mime_type'] = 'video/mpeg'; + + if (!empty($thisfile_riff['CDXA']['data'][0]['size'])) { + getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio-video.mpeg.php', __FILE__, true); + + $getid3_temp = new getID3(); + $getid3_temp->openfile($this->getid3->filename); + $getid3_mpeg = new getid3_mpeg($getid3_temp); + $getid3_mpeg->Analyze(); + if (empty($getid3_temp->info['error'])) { + $info['audio'] = $getid3_temp->info['audio']; + $info['video'] = $getid3_temp->info['video']; + $info['mpeg'] = $getid3_temp->info['mpeg']; + $info['warning'] = $getid3_temp->info['warning']; + } + unset($getid3_temp, $getid3_mpeg); + } + break; + + case 'WEBP': + // https://developers.google.com/speed/webp/docs/riff_container + // https://tools.ietf.org/html/rfc6386 + // https://chromium.googlesource.com/webm/libwebp/+/master/doc/webp-lossless-bitstream-spec.txt + $info['fileformat'] = 'webp'; + $info['mime_type'] = 'image/webp'; + + if (!empty($thisfile_riff['WEBP']['VP8 '][0]['size'])) { + $old_offset = $this->ftell(); + $this->fseek($thisfile_riff['WEBP']['VP8 '][0]['offset'] + 8); // 4 bytes "VP8 " + 4 bytes chunk size + $WEBP_VP8_header = $this->fread(10); + $this->fseek($old_offset); + if (substr($WEBP_VP8_header, 3, 3) == "\x9D\x01\x2A") { + $thisfile_riff['WEBP']['VP8 '][0]['keyframe'] = !(getid3_lib::LittleEndian2Int(substr($WEBP_VP8_header, 0, 3)) & 0x800000); + $thisfile_riff['WEBP']['VP8 '][0]['version'] = (getid3_lib::LittleEndian2Int(substr($WEBP_VP8_header, 0, 3)) & 0x700000) >> 20; + $thisfile_riff['WEBP']['VP8 '][0]['show_frame'] = (getid3_lib::LittleEndian2Int(substr($WEBP_VP8_header, 0, 3)) & 0x080000); + $thisfile_riff['WEBP']['VP8 '][0]['data_bytes'] = (getid3_lib::LittleEndian2Int(substr($WEBP_VP8_header, 0, 3)) & 0x07FFFF) >> 0; + + $thisfile_riff['WEBP']['VP8 '][0]['scale_x'] = (getid3_lib::LittleEndian2Int(substr($WEBP_VP8_header, 6, 2)) & 0xC000) >> 14; + $thisfile_riff['WEBP']['VP8 '][0]['width'] = (getid3_lib::LittleEndian2Int(substr($WEBP_VP8_header, 6, 2)) & 0x3FFF); + $thisfile_riff['WEBP']['VP8 '][0]['scale_y'] = (getid3_lib::LittleEndian2Int(substr($WEBP_VP8_header, 8, 2)) & 0xC000) >> 14; + $thisfile_riff['WEBP']['VP8 '][0]['height'] = (getid3_lib::LittleEndian2Int(substr($WEBP_VP8_header, 8, 2)) & 0x3FFF); + + $info['video']['resolution_x'] = $thisfile_riff['WEBP']['VP8 '][0]['width']; + $info['video']['resolution_y'] = $thisfile_riff['WEBP']['VP8 '][0]['height']; + } else { + $this->error('Expecting 9D 01 2A at offset '.($thisfile_riff['WEBP']['VP8 '][0]['offset'] + 8 + 3).', found "'.getid3_lib::PrintHexBytes(substr($WEBP_VP8_header, 3, 3)).'"'); + } + + } + if (!empty($thisfile_riff['WEBP']['VP8L'][0]['size'])) { + $old_offset = $this->ftell(); + $this->fseek($thisfile_riff['WEBP']['VP8L'][0]['offset'] + 8); // 4 bytes "VP8L" + 4 bytes chunk size + $WEBP_VP8L_header = $this->fread(10); + $this->fseek($old_offset); + if (substr($WEBP_VP8L_header, 0, 1) == "\x2F") { + $width_height_flags = getid3_lib::LittleEndian2Bin(substr($WEBP_VP8L_header, 1, 4)); + $thisfile_riff['WEBP']['VP8L'][0]['width'] = bindec(substr($width_height_flags, 18, 14)) + 1; + $thisfile_riff['WEBP']['VP8L'][0]['height'] = bindec(substr($width_height_flags, 4, 14)) + 1; + $thisfile_riff['WEBP']['VP8L'][0]['alpha_is_used'] = (bool) bindec(substr($width_height_flags, 3, 1)); + $thisfile_riff['WEBP']['VP8L'][0]['version'] = bindec(substr($width_height_flags, 0, 3)); + + $info['video']['resolution_x'] = $thisfile_riff['WEBP']['VP8L'][0]['width']; + $info['video']['resolution_y'] = $thisfile_riff['WEBP']['VP8L'][0]['height']; + } else { + $this->error('Expecting 2F at offset '.($thisfile_riff['WEBP']['VP8L'][0]['offset'] + 8).', found "'.getid3_lib::PrintHexBytes(substr($WEBP_VP8L_header, 0, 1)).'"'); + } + + } + break; + + default: + $this->error('Unknown RIFF type: expecting one of (WAVE|RMP3|AVI |CDDA|AIFF|AIFC|8SVX|CDXA|WEBP), found "'.$RIFFsubtype.'" instead'); + //unset($info['fileformat']); + } + + switch ($RIFFsubtype) { + case 'WAVE': + case 'AIFF': + case 'AIFC': + $ID3v2_key_good = 'id3 '; + $ID3v2_keys_bad = array('ID3 ', 'tag '); + foreach ($ID3v2_keys_bad as $ID3v2_key_bad) { + if (isset($thisfile_riff[$RIFFsubtype][$ID3v2_key_bad]) && !array_key_exists($ID3v2_key_good, $thisfile_riff[$RIFFsubtype])) { + $thisfile_riff[$RIFFsubtype][$ID3v2_key_good] = $thisfile_riff[$RIFFsubtype][$ID3v2_key_bad]; + $this->warning('mapping "'.$ID3v2_key_bad.'" chunk to "'.$ID3v2_key_good.'"'); + } + } + + if (isset($thisfile_riff[$RIFFsubtype]['id3 '])) { + getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.tag.id3v2.php', __FILE__, true); + + $getid3_temp = new getID3(); + $getid3_temp->openfile($this->getid3->filename); + $getid3_id3v2 = new getid3_id3v2($getid3_temp); + $getid3_id3v2->StartingOffset = $thisfile_riff[$RIFFsubtype]['id3 '][0]['offset'] + 8; + if ($thisfile_riff[$RIFFsubtype]['id3 '][0]['valid'] = $getid3_id3v2->Analyze()) { + $info['id3v2'] = $getid3_temp->info['id3v2']; + } + unset($getid3_temp, $getid3_id3v2); + } + break; + } + + if (isset($thisfile_riff_WAVE['DISP']) && is_array($thisfile_riff_WAVE['DISP'])) { + $thisfile_riff['comments']['title'][] = trim(substr($thisfile_riff_WAVE['DISP'][count($thisfile_riff_WAVE['DISP']) - 1]['data'], 4)); + } + if (isset($thisfile_riff_WAVE['INFO']) && is_array($thisfile_riff_WAVE['INFO'])) { + self::parseComments($thisfile_riff_WAVE['INFO'], $thisfile_riff['comments']); + } + if (isset($thisfile_riff['AVI ']['INFO']) && is_array($thisfile_riff['AVI ']['INFO'])) { + self::parseComments($thisfile_riff['AVI ']['INFO'], $thisfile_riff['comments']); + } + + if (empty($thisfile_audio['encoder']) && !empty($info['mpeg']['audio']['LAME']['short_version'])) { + $thisfile_audio['encoder'] = $info['mpeg']['audio']['LAME']['short_version']; + } + + if (!isset($info['playtime_seconds'])) { + $info['playtime_seconds'] = 0; + } + if (isset($thisfile_riff_raw['strh'][0]['dwLength']) && isset($thisfile_riff_raw['avih']['dwMicroSecPerFrame'])) { + // needed for >2GB AVIs where 'avih' chunk only lists number of frames in that chunk, not entire movie + $info['playtime_seconds'] = $thisfile_riff_raw['strh'][0]['dwLength'] * ($thisfile_riff_raw['avih']['dwMicroSecPerFrame'] / 1000000); + } elseif (isset($thisfile_riff_raw['avih']['dwTotalFrames']) && isset($thisfile_riff_raw['avih']['dwMicroSecPerFrame'])) { + $info['playtime_seconds'] = $thisfile_riff_raw['avih']['dwTotalFrames'] * ($thisfile_riff_raw['avih']['dwMicroSecPerFrame'] / 1000000); + } + + if ($info['playtime_seconds'] > 0) { + if (isset($thisfile_riff_audio) && isset($thisfile_riff_video)) { + + if (!isset($info['bitrate'])) { + $info['bitrate'] = ((($info['avdataend'] - $info['avdataoffset']) / $info['playtime_seconds']) * 8); + } + + } elseif (isset($thisfile_riff_audio) && !isset($thisfile_riff_video)) { + + if (!isset($thisfile_audio['bitrate'])) { + $thisfile_audio['bitrate'] = ((($info['avdataend'] - $info['avdataoffset']) / $info['playtime_seconds']) * 8); + } + + } elseif (!isset($thisfile_riff_audio) && isset($thisfile_riff_video)) { + + if (!isset($thisfile_video['bitrate'])) { + $thisfile_video['bitrate'] = ((($info['avdataend'] - $info['avdataoffset']) / $info['playtime_seconds']) * 8); + } + + } + } + + + if (isset($thisfile_riff_video) && isset($thisfile_audio['bitrate']) && ($thisfile_audio['bitrate'] > 0) && ($info['playtime_seconds'] > 0)) { + + $info['bitrate'] = ((($info['avdataend'] - $info['avdataoffset']) / $info['playtime_seconds']) * 8); + $thisfile_audio['bitrate'] = 0; + $thisfile_video['bitrate'] = $info['bitrate']; + foreach ($thisfile_riff_audio as $channelnumber => $audioinfoarray) { + $thisfile_video['bitrate'] -= $audioinfoarray['bitrate']; + $thisfile_audio['bitrate'] += $audioinfoarray['bitrate']; + } + if ($thisfile_video['bitrate'] <= 0) { + unset($thisfile_video['bitrate']); + } + if ($thisfile_audio['bitrate'] <= 0) { + unset($thisfile_audio['bitrate']); + } + } + + if (isset($info['mpeg']['audio'])) { + $thisfile_audio_dataformat = 'mp'.$info['mpeg']['audio']['layer']; + $thisfile_audio['sample_rate'] = $info['mpeg']['audio']['sample_rate']; + $thisfile_audio['channels'] = $info['mpeg']['audio']['channels']; + $thisfile_audio['bitrate'] = $info['mpeg']['audio']['bitrate']; + $thisfile_audio['bitrate_mode'] = strtolower($info['mpeg']['audio']['bitrate_mode']); + if (!empty($info['mpeg']['audio']['codec'])) { + $thisfile_audio['codec'] = $info['mpeg']['audio']['codec'].' '.$thisfile_audio['codec']; + } + if (!empty($thisfile_audio['streams'])) { + foreach ($thisfile_audio['streams'] as $streamnumber => $streamdata) { + if ($streamdata['dataformat'] == $thisfile_audio_dataformat) { + $thisfile_audio['streams'][$streamnumber]['sample_rate'] = $thisfile_audio['sample_rate']; + $thisfile_audio['streams'][$streamnumber]['channels'] = $thisfile_audio['channels']; + $thisfile_audio['streams'][$streamnumber]['bitrate'] = $thisfile_audio['bitrate']; + $thisfile_audio['streams'][$streamnumber]['bitrate_mode'] = $thisfile_audio['bitrate_mode']; + $thisfile_audio['streams'][$streamnumber]['codec'] = $thisfile_audio['codec']; + } + } + } + $getid3_mp3 = new getid3_mp3($this->getid3); + $thisfile_audio['encoder_options'] = $getid3_mp3->GuessEncoderOptions(); + unset($getid3_mp3); + } + + + if (!empty($thisfile_riff_raw['fmt ']['wBitsPerSample']) && ($thisfile_riff_raw['fmt ']['wBitsPerSample'] > 0)) { + switch ($thisfile_audio_dataformat) { + case 'ac3': + // ignore bits_per_sample + break; + + default: + $thisfile_audio['bits_per_sample'] = $thisfile_riff_raw['fmt ']['wBitsPerSample']; + break; + } + } + + + if (empty($thisfile_riff_raw)) { + unset($thisfile_riff['raw']); + } + if (empty($thisfile_riff_audio)) { + unset($thisfile_riff['audio']); + } + if (empty($thisfile_riff_video)) { + unset($thisfile_riff['video']); + } + + return true; + } + + public function ParseRIFFAMV($startoffset, $maxoffset) { + // AMV files are RIFF-AVI files with parts of the spec deliberately broken, such as chunk size fields hardcoded to zero (because players known in hardware that these fields are always a certain size + + // https://code.google.com/p/amv-codec-tools/wiki/AmvDocumentation + //typedef struct _amvmainheader { + //FOURCC fcc; // 'amvh' + //DWORD cb; + //DWORD dwMicroSecPerFrame; + //BYTE reserve[28]; + //DWORD dwWidth; + //DWORD dwHeight; + //DWORD dwSpeed; + //DWORD reserve0; + //DWORD reserve1; + //BYTE bTimeSec; + //BYTE bTimeMin; + //WORD wTimeHour; + //} AMVMAINHEADER; + + $info = &$this->getid3->info; + $RIFFchunk = false; + + try { + + $this->fseek($startoffset); + $maxoffset = min($maxoffset, $info['avdataend']); + $AMVheader = $this->fread(284); + if (substr($AMVheader, 0, 8) != 'hdrlamvh') { + throw new Exception('expecting "hdrlamv" at offset '.($startoffset + 0).', found "'.substr($AMVheader, 0, 8).'"'); + } + if (substr($AMVheader, 8, 4) != "\x38\x00\x00\x00") { // "amvh" chunk size, hardcoded to 0x38 = 56 bytes + throw new Exception('expecting "0x38000000" at offset '.($startoffset + 8).', found "'.getid3_lib::PrintHexBytes(substr($AMVheader, 8, 4)).'"'); + } + $RIFFchunk = array(); + $RIFFchunk['amvh']['us_per_frame'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 12, 4)); + $RIFFchunk['amvh']['reserved28'] = substr($AMVheader, 16, 28); // null? reserved? + $RIFFchunk['amvh']['resolution_x'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 44, 4)); + $RIFFchunk['amvh']['resolution_y'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 48, 4)); + $RIFFchunk['amvh']['frame_rate_int'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 52, 4)); + $RIFFchunk['amvh']['reserved0'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 56, 4)); // 1? reserved? + $RIFFchunk['amvh']['reserved1'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 60, 4)); // 0? reserved? + $RIFFchunk['amvh']['runtime_sec'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 64, 1)); + $RIFFchunk['amvh']['runtime_min'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 65, 1)); + $RIFFchunk['amvh']['runtime_hrs'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 66, 2)); + + $info['video']['frame_rate'] = 1000000 / $RIFFchunk['amvh']['us_per_frame']; + $info['video']['resolution_x'] = $RIFFchunk['amvh']['resolution_x']; + $info['video']['resolution_y'] = $RIFFchunk['amvh']['resolution_y']; + $info['playtime_seconds'] = ($RIFFchunk['amvh']['runtime_hrs'] * 3600) + ($RIFFchunk['amvh']['runtime_min'] * 60) + $RIFFchunk['amvh']['runtime_sec']; + + // the rest is all hardcoded(?) and does not appear to be useful until you get to audio info at offset 256, even then everything is probably hardcoded + + if (substr($AMVheader, 68, 20) != 'LIST'."\x00\x00\x00\x00".'strlstrh'."\x38\x00\x00\x00") { + throw new Exception('expecting "LIST<0x00000000>strlstrh<0x38000000>" at offset '.($startoffset + 68).', found "'.getid3_lib::PrintHexBytes(substr($AMVheader, 68, 20)).'"'); + } + // followed by 56 bytes of null: substr($AMVheader, 88, 56) -> 144 + if (substr($AMVheader, 144, 8) != 'strf'."\x24\x00\x00\x00") { + throw new Exception('expecting "strf<0x24000000>" at offset '.($startoffset + 144).', found "'.getid3_lib::PrintHexBytes(substr($AMVheader, 144, 8)).'"'); + } + // followed by 36 bytes of null: substr($AMVheader, 144, 36) -> 180 + + if (substr($AMVheader, 188, 20) != 'LIST'."\x00\x00\x00\x00".'strlstrh'."\x30\x00\x00\x00") { + throw new Exception('expecting "LIST<0x00000000>strlstrh<0x30000000>" at offset '.($startoffset + 188).', found "'.getid3_lib::PrintHexBytes(substr($AMVheader, 188, 20)).'"'); + } + // followed by 48 bytes of null: substr($AMVheader, 208, 48) -> 256 + if (substr($AMVheader, 256, 8) != 'strf'."\x14\x00\x00\x00") { + throw new Exception('expecting "strf<0x14000000>" at offset '.($startoffset + 256).', found "'.getid3_lib::PrintHexBytes(substr($AMVheader, 256, 8)).'"'); + } + // followed by 20 bytes of a modified WAVEFORMATEX: + // typedef struct { + // WORD wFormatTag; //(Fixme: this is equal to PCM's 0x01 format code) + // WORD nChannels; //(Fixme: this is always 1) + // DWORD nSamplesPerSec; //(Fixme: for all known sample files this is equal to 22050) + // DWORD nAvgBytesPerSec; //(Fixme: for all known sample files this is equal to 44100) + // WORD nBlockAlign; //(Fixme: this seems to be 2 in AMV files, is this correct ?) + // WORD wBitsPerSample; //(Fixme: this seems to be 16 in AMV files instead of the expected 4) + // WORD cbSize; //(Fixme: this seems to be 0 in AMV files) + // WORD reserved; + // } WAVEFORMATEX; + $RIFFchunk['strf']['wformattag'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 264, 2)); + $RIFFchunk['strf']['nchannels'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 266, 2)); + $RIFFchunk['strf']['nsamplespersec'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 268, 4)); + $RIFFchunk['strf']['navgbytespersec'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 272, 4)); + $RIFFchunk['strf']['nblockalign'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 276, 2)); + $RIFFchunk['strf']['wbitspersample'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 278, 2)); + $RIFFchunk['strf']['cbsize'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 280, 2)); + $RIFFchunk['strf']['reserved'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 282, 2)); + + + $info['audio']['lossless'] = false; + $info['audio']['sample_rate'] = $RIFFchunk['strf']['nsamplespersec']; + $info['audio']['channels'] = $RIFFchunk['strf']['nchannels']; + $info['audio']['bits_per_sample'] = $RIFFchunk['strf']['wbitspersample']; + $info['audio']['bitrate'] = $info['audio']['sample_rate'] * $info['audio']['channels'] * $info['audio']['bits_per_sample']; + $info['audio']['bitrate_mode'] = 'cbr'; + + + } catch (getid3_exception $e) { + if ($e->getCode() == 10) { + $this->warning('RIFFAMV parser: '.$e->getMessage()); + } else { + throw $e; + } + } + + return $RIFFchunk; + } + + + public function ParseRIFF($startoffset, $maxoffset) { + $info = &$this->getid3->info; + + $RIFFchunk = false; + $FoundAllChunksWeNeed = false; + + try { + $this->fseek($startoffset); + $maxoffset = min($maxoffset, $info['avdataend']); + while ($this->ftell() < $maxoffset) { + $chunknamesize = $this->fread(8); + //$chunkname = substr($chunknamesize, 0, 4); + $chunkname = str_replace("\x00", '_', substr($chunknamesize, 0, 4)); // note: chunk names of 4 null bytes do appear to be legal (has been observed inside INFO and PRMI chunks, for example), but makes traversing array keys more difficult + $chunksize = $this->EitherEndian2Int(substr($chunknamesize, 4, 4)); + //if (strlen(trim($chunkname, "\x00")) < 4) { + if (strlen($chunkname) < 4) { + $this->error('Expecting chunk name at offset '.($this->ftell() - 8).' but found nothing. Aborting RIFF parsing.'); + break; + } + if (($chunksize == 0) && ($chunkname != 'JUNK')) { + $this->warning('Chunk ('.$chunkname.') size at offset '.($this->ftell() - 4).' is zero. Aborting RIFF parsing.'); + break; + } + if (($chunksize % 2) != 0) { + // all structures are packed on word boundaries + $chunksize++; + } + + switch ($chunkname) { + case 'LIST': + $listname = $this->fread(4); + if (preg_match('#^(movi|rec )$#i', $listname)) { + $RIFFchunk[$listname]['offset'] = $this->ftell() - 4; + $RIFFchunk[$listname]['size'] = $chunksize; + + if (!$FoundAllChunksWeNeed) { + $WhereWeWere = $this->ftell(); + $AudioChunkHeader = $this->fread(12); + $AudioChunkStreamNum = substr($AudioChunkHeader, 0, 2); + $AudioChunkStreamType = substr($AudioChunkHeader, 2, 2); + $AudioChunkSize = getid3_lib::LittleEndian2Int(substr($AudioChunkHeader, 4, 4)); + + if ($AudioChunkStreamType == 'wb') { + $FirstFourBytes = substr($AudioChunkHeader, 8, 4); + if (preg_match('/^\xFF[\xE2-\xE7\xF2-\xF7\xFA-\xFF][\x00-\xEB]/s', $FirstFourBytes)) { + // MP3 + if (getid3_mp3::MPEGaudioHeaderBytesValid($FirstFourBytes)) { + $getid3_temp = new getID3(); + $getid3_temp->openfile($this->getid3->filename); + $getid3_temp->info['avdataoffset'] = $this->ftell() - 4; + $getid3_temp->info['avdataend'] = $this->ftell() + $AudioChunkSize; + $getid3_mp3 = new getid3_mp3($getid3_temp, __CLASS__); + $getid3_mp3->getOnlyMPEGaudioInfo($getid3_temp->info['avdataoffset'], false); + if (isset($getid3_temp->info['mpeg']['audio'])) { + $info['mpeg']['audio'] = $getid3_temp->info['mpeg']['audio']; + $info['audio'] = $getid3_temp->info['audio']; + $info['audio']['dataformat'] = 'mp'.$info['mpeg']['audio']['layer']; + $info['audio']['sample_rate'] = $info['mpeg']['audio']['sample_rate']; + $info['audio']['channels'] = $info['mpeg']['audio']['channels']; + $info['audio']['bitrate'] = $info['mpeg']['audio']['bitrate']; + $info['audio']['bitrate_mode'] = strtolower($info['mpeg']['audio']['bitrate_mode']); + //$info['bitrate'] = $info['audio']['bitrate']; + } + unset($getid3_temp, $getid3_mp3); + } + + } elseif (strpos($FirstFourBytes, getid3_ac3::syncword) === 0) { + + // AC3 + $getid3_temp = new getID3(); + $getid3_temp->openfile($this->getid3->filename); + $getid3_temp->info['avdataoffset'] = $this->ftell() - 4; + $getid3_temp->info['avdataend'] = $this->ftell() + $AudioChunkSize; + $getid3_ac3 = new getid3_ac3($getid3_temp); + $getid3_ac3->Analyze(); + if (empty($getid3_temp->info['error'])) { + $info['audio'] = $getid3_temp->info['audio']; + $info['ac3'] = $getid3_temp->info['ac3']; + if (!empty($getid3_temp->info['warning'])) { + foreach ($getid3_temp->info['warning'] as $key => $value) { + $this->warning($value); + } + } + } + unset($getid3_temp, $getid3_ac3); + } + } + $FoundAllChunksWeNeed = true; + $this->fseek($WhereWeWere); + } + $this->fseek($chunksize - 4, SEEK_CUR); + + } else { + + if (!isset($RIFFchunk[$listname])) { + $RIFFchunk[$listname] = array(); + } + $LISTchunkParent = $listname; + $LISTchunkMaxOffset = $this->ftell() - 4 + $chunksize; + if ($parsedChunk = $this->ParseRIFF($this->ftell(), $LISTchunkMaxOffset)) { + $RIFFchunk[$listname] = array_merge_recursive($RIFFchunk[$listname], $parsedChunk); + } + + } + break; + + default: + if (preg_match('#^[0-9]{2}(wb|pc|dc|db)$#', $chunkname)) { + $this->fseek($chunksize, SEEK_CUR); + break; + } + $thisindex = 0; + if (isset($RIFFchunk[$chunkname]) && is_array($RIFFchunk[$chunkname])) { + $thisindex = count($RIFFchunk[$chunkname]); + } + $RIFFchunk[$chunkname][$thisindex]['offset'] = $this->ftell() - 8; + $RIFFchunk[$chunkname][$thisindex]['size'] = $chunksize; + switch ($chunkname) { + case 'data': + $info['avdataoffset'] = $this->ftell(); + $info['avdataend'] = $info['avdataoffset'] + $chunksize; + + $testData = $this->fread(36); + if ($testData === '') { + break; + } + if (preg_match('/^\xFF[\xE2-\xE7\xF2-\xF7\xFA-\xFF][\x00-\xEB]/s', substr($testData, 0, 4))) { + + // Probably is MP3 data + if (getid3_mp3::MPEGaudioHeaderBytesValid(substr($testData, 0, 4))) { + $getid3_temp = new getID3(); + $getid3_temp->openfile($this->getid3->filename); + $getid3_temp->info['avdataoffset'] = $info['avdataoffset']; + $getid3_temp->info['avdataend'] = $info['avdataend']; + $getid3_mp3 = new getid3_mp3($getid3_temp, __CLASS__); + $getid3_mp3->getOnlyMPEGaudioInfo($info['avdataoffset'], false); + if (empty($getid3_temp->info['error'])) { + $info['audio'] = $getid3_temp->info['audio']; + $info['mpeg'] = $getid3_temp->info['mpeg']; + } + unset($getid3_temp, $getid3_mp3); + } + + } elseif (($isRegularAC3 = (substr($testData, 0, 2) == getid3_ac3::syncword)) || substr($testData, 8, 2) == strrev(getid3_ac3::syncword)) { + + // This is probably AC-3 data + $getid3_temp = new getID3(); + if ($isRegularAC3) { + $getid3_temp->openfile($this->getid3->filename); + $getid3_temp->info['avdataoffset'] = $info['avdataoffset']; + $getid3_temp->info['avdataend'] = $info['avdataend']; + } + $getid3_ac3 = new getid3_ac3($getid3_temp); + if ($isRegularAC3) { + $getid3_ac3->Analyze(); + } else { + // Dolby Digital WAV + // AC-3 content, but not encoded in same format as normal AC-3 file + // For one thing, byte order is swapped + $ac3_data = ''; + for ($i = 0; $i < 28; $i += 2) { + $ac3_data .= substr($testData, 8 + $i + 1, 1); + $ac3_data .= substr($testData, 8 + $i + 0, 1); + } + $getid3_ac3->AnalyzeString($ac3_data); + } + + if (empty($getid3_temp->info['error'])) { + $info['audio'] = $getid3_temp->info['audio']; + $info['ac3'] = $getid3_temp->info['ac3']; + if (!empty($getid3_temp->info['warning'])) { + foreach ($getid3_temp->info['warning'] as $newerror) { + $this->warning('getid3_ac3() says: ['.$newerror.']'); + } + } + } + unset($getid3_temp, $getid3_ac3); + + } elseif (preg_match('/^('.implode('|', array_map('preg_quote', getid3_dts::$syncwords)).')/', $testData)) { + + // This is probably DTS data + $getid3_temp = new getID3(); + $getid3_temp->openfile($this->getid3->filename); + $getid3_temp->info['avdataoffset'] = $info['avdataoffset']; + $getid3_dts = new getid3_dts($getid3_temp); + $getid3_dts->Analyze(); + if (empty($getid3_temp->info['error'])) { + $info['audio'] = $getid3_temp->info['audio']; + $info['dts'] = $getid3_temp->info['dts']; + $info['playtime_seconds'] = $getid3_temp->info['playtime_seconds']; // may not match RIFF calculations since DTS-WAV often used 14/16 bit-word packing + if (!empty($getid3_temp->info['warning'])) { + foreach ($getid3_temp->info['warning'] as $newerror) { + $this->warning('getid3_dts() says: ['.$newerror.']'); + } + } + } + + unset($getid3_temp, $getid3_dts); + + } elseif (substr($testData, 0, 4) == 'wvpk') { + + // This is WavPack data + $info['wavpack']['offset'] = $info['avdataoffset']; + $info['wavpack']['size'] = getid3_lib::LittleEndian2Int(substr($testData, 4, 4)); + $this->parseWavPackHeader(substr($testData, 8, 28)); + + } else { + // This is some other kind of data (quite possibly just PCM) + // do nothing special, just skip it + } + $nextoffset = $info['avdataend']; + $this->fseek($nextoffset); + break; + + case 'iXML': + case 'bext': + case 'cart': + case 'fmt ': + case 'strh': + case 'strf': + case 'indx': + case 'MEXT': + case 'DISP': + // always read data in + case 'JUNK': + // should be: never read data in + // but some programs write their version strings in a JUNK chunk (e.g. VirtualDub, AVIdemux, etc) + if ($chunksize < 1048576) { + if ($chunksize > 0) { + $RIFFchunk[$chunkname][$thisindex]['data'] = $this->fread($chunksize); + if ($chunkname == 'JUNK') { + if (preg_match('#^([\\x20-\\x7F]+)#', $RIFFchunk[$chunkname][$thisindex]['data'], $matches)) { + // only keep text characters [chr(32)-chr(127)] + $info['riff']['comments']['junk'][] = trim($matches[1]); + } + // but if nothing there, ignore + // remove the key in either case + unset($RIFFchunk[$chunkname][$thisindex]['data']); + } + } + } else { + $this->warning('Chunk "'.$chunkname.'" at offset '.$this->ftell().' is unexpectedly larger than 1MB (claims to be '.number_format($chunksize).' bytes), skipping data'); + $this->fseek($chunksize, SEEK_CUR); + } + break; + + //case 'IDVX': + // $info['divxtag']['comments'] = self::ParseDIVXTAG($this->fread($chunksize)); + // break; + + default: + if (!empty($LISTchunkParent) && (($RIFFchunk[$chunkname][$thisindex]['offset'] + $RIFFchunk[$chunkname][$thisindex]['size']) <= $LISTchunkMaxOffset)) { + $RIFFchunk[$LISTchunkParent][$chunkname][$thisindex]['offset'] = $RIFFchunk[$chunkname][$thisindex]['offset']; + $RIFFchunk[$LISTchunkParent][$chunkname][$thisindex]['size'] = $RIFFchunk[$chunkname][$thisindex]['size']; + unset($RIFFchunk[$chunkname][$thisindex]['offset']); + unset($RIFFchunk[$chunkname][$thisindex]['size']); + if (isset($RIFFchunk[$chunkname][$thisindex]) && empty($RIFFchunk[$chunkname][$thisindex])) { + unset($RIFFchunk[$chunkname][$thisindex]); + } + if (isset($RIFFchunk[$chunkname]) && empty($RIFFchunk[$chunkname])) { + unset($RIFFchunk[$chunkname]); + } + $RIFFchunk[$LISTchunkParent][$chunkname][$thisindex]['data'] = $this->fread($chunksize); + } elseif ($chunksize < 2048) { + // only read data in if smaller than 2kB + $RIFFchunk[$chunkname][$thisindex]['data'] = $this->fread($chunksize); + } else { + $this->fseek($chunksize, SEEK_CUR); + } + break; + } + break; + } + } + + } catch (getid3_exception $e) { + if ($e->getCode() == 10) { + $this->warning('RIFF parser: '.$e->getMessage()); + } else { + throw $e; + } + } + + return $RIFFchunk; + } + + public function ParseRIFFdata(&$RIFFdata) { + $info = &$this->getid3->info; + if ($RIFFdata) { + $tempfile = tempnam(GETID3_TEMP_DIR, 'getID3'); + $fp_temp = fopen($tempfile, 'wb'); + $RIFFdataLength = strlen($RIFFdata); + $NewLengthString = getid3_lib::LittleEndian2String($RIFFdataLength, 4); + for ($i = 0; $i < 4; $i++) { + $RIFFdata[($i + 4)] = $NewLengthString[$i]; + } + fwrite($fp_temp, $RIFFdata); + fclose($fp_temp); + + $getid3_temp = new getID3(); + $getid3_temp->openfile($tempfile); + $getid3_temp->info['filesize'] = $RIFFdataLength; + $getid3_temp->info['filenamepath'] = $info['filenamepath']; + $getid3_temp->info['tags'] = $info['tags']; + $getid3_temp->info['warning'] = $info['warning']; + $getid3_temp->info['error'] = $info['error']; + $getid3_temp->info['comments'] = $info['comments']; + $getid3_temp->info['audio'] = (isset($info['audio']) ? $info['audio'] : array()); + $getid3_temp->info['video'] = (isset($info['video']) ? $info['video'] : array()); + $getid3_riff = new getid3_riff($getid3_temp); + $getid3_riff->Analyze(); + + $info['riff'] = $getid3_temp->info['riff']; + $info['warning'] = $getid3_temp->info['warning']; + $info['error'] = $getid3_temp->info['error']; + $info['tags'] = $getid3_temp->info['tags']; + $info['comments'] = $getid3_temp->info['comments']; + unset($getid3_riff, $getid3_temp); + unlink($tempfile); + } + return false; + } + + public static function parseComments(&$RIFFinfoArray, &$CommentsTargetArray) { + $RIFFinfoKeyLookup = array( + 'IARL'=>'archivallocation', + 'IART'=>'artist', + 'ICDS'=>'costumedesigner', + 'ICMS'=>'commissionedby', + 'ICMT'=>'comment', + 'ICNT'=>'country', + 'ICOP'=>'copyright', + 'ICRD'=>'creationdate', + 'IDIM'=>'dimensions', + 'IDIT'=>'digitizationdate', + 'IDPI'=>'resolution', + 'IDST'=>'distributor', + 'IEDT'=>'editor', + 'IENG'=>'engineers', + 'IFRM'=>'accountofparts', + 'IGNR'=>'genre', + 'IKEY'=>'keywords', + 'ILGT'=>'lightness', + 'ILNG'=>'language', + 'IMED'=>'orignalmedium', + 'IMUS'=>'composer', + 'INAM'=>'title', + 'IPDS'=>'productiondesigner', + 'IPLT'=>'palette', + 'IPRD'=>'product', + 'IPRO'=>'producer', + 'IPRT'=>'part', + 'IRTD'=>'rating', + 'ISBJ'=>'subject', + 'ISFT'=>'software', + 'ISGN'=>'secondarygenre', + 'ISHP'=>'sharpness', + 'ISRC'=>'sourcesupplier', + 'ISRF'=>'digitizationsource', + 'ISTD'=>'productionstudio', + 'ISTR'=>'starring', + 'ITCH'=>'encoded_by', + 'IWEB'=>'url', + 'IWRI'=>'writer', + '____'=>'comment', + ); + foreach ($RIFFinfoKeyLookup as $key => $value) { + if (isset($RIFFinfoArray[$key])) { + foreach ($RIFFinfoArray[$key] as $commentid => $commentdata) { + if (trim($commentdata['data']) != '') { + if (isset($CommentsTargetArray[$value])) { + $CommentsTargetArray[$value][] = trim($commentdata['data']); + } else { + $CommentsTargetArray[$value] = array(trim($commentdata['data'])); + } + } + } + } + } + return true; + } + + public static function parseWAVEFORMATex($WaveFormatExData) { + // shortcut + $WaveFormatEx['raw'] = array(); + $WaveFormatEx_raw = &$WaveFormatEx['raw']; + + $WaveFormatEx_raw['wFormatTag'] = substr($WaveFormatExData, 0, 2); + $WaveFormatEx_raw['nChannels'] = substr($WaveFormatExData, 2, 2); + $WaveFormatEx_raw['nSamplesPerSec'] = substr($WaveFormatExData, 4, 4); + $WaveFormatEx_raw['nAvgBytesPerSec'] = substr($WaveFormatExData, 8, 4); + $WaveFormatEx_raw['nBlockAlign'] = substr($WaveFormatExData, 12, 2); + $WaveFormatEx_raw['wBitsPerSample'] = substr($WaveFormatExData, 14, 2); + if (strlen($WaveFormatExData) > 16) { + $WaveFormatEx_raw['cbSize'] = substr($WaveFormatExData, 16, 2); + } + $WaveFormatEx_raw = array_map('getid3_lib::LittleEndian2Int', $WaveFormatEx_raw); + + $WaveFormatEx['codec'] = self::wFormatTagLookup($WaveFormatEx_raw['wFormatTag']); + $WaveFormatEx['channels'] = $WaveFormatEx_raw['nChannels']; + $WaveFormatEx['sample_rate'] = $WaveFormatEx_raw['nSamplesPerSec']; + $WaveFormatEx['bitrate'] = $WaveFormatEx_raw['nAvgBytesPerSec'] * 8; + $WaveFormatEx['bits_per_sample'] = $WaveFormatEx_raw['wBitsPerSample']; + + return $WaveFormatEx; + } + + public function parseWavPackHeader($WavPackChunkData) { + // typedef struct { + // char ckID [4]; + // long ckSize; + // short version; + // short bits; // added for version 2.00 + // short flags, shift; // added for version 3.00 + // long total_samples, crc, crc2; + // char extension [4], extra_bc, extras [3]; + // } WavpackHeader; + + // shortcut + $info = &$this->getid3->info; + $info['wavpack'] = array(); + $thisfile_wavpack = &$info['wavpack']; + + $thisfile_wavpack['version'] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 0, 2)); + if ($thisfile_wavpack['version'] >= 2) { + $thisfile_wavpack['bits'] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 2, 2)); + } + if ($thisfile_wavpack['version'] >= 3) { + $thisfile_wavpack['flags_raw'] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 4, 2)); + $thisfile_wavpack['shift'] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 6, 2)); + $thisfile_wavpack['total_samples'] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 8, 4)); + $thisfile_wavpack['crc1'] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 12, 4)); + $thisfile_wavpack['crc2'] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 16, 4)); + $thisfile_wavpack['extension'] = substr($WavPackChunkData, 20, 4); + $thisfile_wavpack['extra_bc'] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 24, 1)); + for ($i = 0; $i <= 2; $i++) { + $thisfile_wavpack['extras'][] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 25 + $i, 1)); + } + + // shortcut + $thisfile_wavpack['flags'] = array(); + $thisfile_wavpack_flags = &$thisfile_wavpack['flags']; + + $thisfile_wavpack_flags['mono'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x000001); + $thisfile_wavpack_flags['fast_mode'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x000002); + $thisfile_wavpack_flags['raw_mode'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x000004); + $thisfile_wavpack_flags['calc_noise'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x000008); + $thisfile_wavpack_flags['high_quality'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x000010); + $thisfile_wavpack_flags['3_byte_samples'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x000020); + $thisfile_wavpack_flags['over_20_bits'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x000040); + $thisfile_wavpack_flags['use_wvc'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x000080); + $thisfile_wavpack_flags['noiseshaping'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x000100); + $thisfile_wavpack_flags['very_fast_mode'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x000200); + $thisfile_wavpack_flags['new_high_quality'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x000400); + $thisfile_wavpack_flags['cancel_extreme'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x000800); + $thisfile_wavpack_flags['cross_decorrelation'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x001000); + $thisfile_wavpack_flags['new_decorrelation'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x002000); + $thisfile_wavpack_flags['joint_stereo'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x004000); + $thisfile_wavpack_flags['extra_decorrelation'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x008000); + $thisfile_wavpack_flags['override_noiseshape'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x010000); + $thisfile_wavpack_flags['override_jointstereo'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x020000); + $thisfile_wavpack_flags['copy_source_filetime'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x040000); + $thisfile_wavpack_flags['create_exe'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x080000); + } + + return true; + } + + public static function ParseBITMAPINFOHEADER($BITMAPINFOHEADER, $littleEndian=true) { + + $parsed['biSize'] = substr($BITMAPINFOHEADER, 0, 4); // number of bytes required by the BITMAPINFOHEADER structure + $parsed['biWidth'] = substr($BITMAPINFOHEADER, 4, 4); // width of the bitmap in pixels + $parsed['biHeight'] = substr($BITMAPINFOHEADER, 8, 4); // height of the bitmap in pixels. If biHeight is positive, the bitmap is a 'bottom-up' DIB and its origin is the lower left corner. If biHeight is negative, the bitmap is a 'top-down' DIB and its origin is the upper left corner + $parsed['biPlanes'] = substr($BITMAPINFOHEADER, 12, 2); // number of color planes on the target device. In most cases this value must be set to 1 + $parsed['biBitCount'] = substr($BITMAPINFOHEADER, 14, 2); // Specifies the number of bits per pixels + $parsed['biSizeImage'] = substr($BITMAPINFOHEADER, 20, 4); // size of the bitmap data section of the image (the actual pixel data, excluding BITMAPINFOHEADER and RGBQUAD structures) + $parsed['biXPelsPerMeter'] = substr($BITMAPINFOHEADER, 24, 4); // horizontal resolution, in pixels per metre, of the target device + $parsed['biYPelsPerMeter'] = substr($BITMAPINFOHEADER, 28, 4); // vertical resolution, in pixels per metre, of the target device + $parsed['biClrUsed'] = substr($BITMAPINFOHEADER, 32, 4); // actual number of color indices in the color table used by the bitmap. If this value is zero, the bitmap uses the maximum number of colors corresponding to the value of the biBitCount member for the compression mode specified by biCompression + $parsed['biClrImportant'] = substr($BITMAPINFOHEADER, 36, 4); // number of color indices that are considered important for displaying the bitmap. If this value is zero, all colors are important + $parsed = array_map('getid3_lib::'.($littleEndian ? 'Little' : 'Big').'Endian2Int', $parsed); + + $parsed['fourcc'] = substr($BITMAPINFOHEADER, 16, 4); // compression identifier + + return $parsed; + } + + public static function ParseDIVXTAG($DIVXTAG, $raw=false) { + // structure from "IDivX" source, Form1.frm, by "Greg Frazier of Daemonic Software Group", email: gfrazier@icestorm.net, web: http://dsg.cjb.net/ + // source available at http://files.divx-digest.com/download/c663efe7ef8ad2e90bf4af4d3ea6188a/on0SWN2r/edit/IDivX.zip + // 'Byte Layout: '1111111111111111 + // '32 for Movie - 1 '1111111111111111 + // '28 for Author - 6 '6666666666666666 + // '4 for year - 2 '6666666666662222 + // '3 for genre - 3 '7777777777777777 + // '48 for Comments - 7 '7777777777777777 + // '1 for Rating - 4 '7777777777777777 + // '5 for Future Additions - 0 '333400000DIVXTAG + // '128 bytes total + + static $DIVXTAGgenre = array( + 0 => 'Action', + 1 => 'Action/Adventure', + 2 => 'Adventure', + 3 => 'Adult', + 4 => 'Anime', + 5 => 'Cartoon', + 6 => 'Claymation', + 7 => 'Comedy', + 8 => 'Commercial', + 9 => 'Documentary', + 10 => 'Drama', + 11 => 'Home Video', + 12 => 'Horror', + 13 => 'Infomercial', + 14 => 'Interactive', + 15 => 'Mystery', + 16 => 'Music Video', + 17 => 'Other', + 18 => 'Religion', + 19 => 'Sci Fi', + 20 => 'Thriller', + 21 => 'Western', + ), + $DIVXTAGrating = array( + 0 => 'Unrated', + 1 => 'G', + 2 => 'PG', + 3 => 'PG-13', + 4 => 'R', + 5 => 'NC-17', + ); + + $parsed['title'] = trim(substr($DIVXTAG, 0, 32)); + $parsed['artist'] = trim(substr($DIVXTAG, 32, 28)); + $parsed['year'] = intval(trim(substr($DIVXTAG, 60, 4))); + $parsed['comment'] = trim(substr($DIVXTAG, 64, 48)); + $parsed['genre_id'] = intval(trim(substr($DIVXTAG, 112, 3))); + $parsed['rating_id'] = ord(substr($DIVXTAG, 115, 1)); + //$parsed['padding'] = substr($DIVXTAG, 116, 5); // 5-byte null + //$parsed['magic'] = substr($DIVXTAG, 121, 7); // "DIVXTAG" + + $parsed['genre'] = (isset($DIVXTAGgenre[$parsed['genre_id']]) ? $DIVXTAGgenre[$parsed['genre_id']] : $parsed['genre_id']); + $parsed['rating'] = (isset($DIVXTAGrating[$parsed['rating_id']]) ? $DIVXTAGrating[$parsed['rating_id']] : $parsed['rating_id']); + + if (!$raw) { + unset($parsed['genre_id'], $parsed['rating_id']); + foreach ($parsed as $key => $value) { + if (!$value === '') { + unset($parsed['key']); + } + } + } + + foreach ($parsed as $tag => $value) { + $parsed[$tag] = array($value); + } + + return $parsed; + } + + public static function waveSNDMtagLookup($tagshortname) { + $begin = __LINE__; + + /** This is not a comment! + + ©kwd keywords + ©BPM bpm + ©trt tracktitle + ©des description + ©gen category + ©fin featuredinstrument + ©LID longid + ©bex bwdescription + ©pub publisher + ©cdt cdtitle + ©alb library + ©com composer + + */ + + return getid3_lib::EmbeddedLookup($tagshortname, $begin, __LINE__, __FILE__, 'riff-sndm'); + } + + public static function wFormatTagLookup($wFormatTag) { + + $begin = __LINE__; + + /** This is not a comment! + + 0x0000 Microsoft Unknown Wave Format + 0x0001 Pulse Code Modulation (PCM) + 0x0002 Microsoft ADPCM + 0x0003 IEEE Float + 0x0004 Compaq Computer VSELP + 0x0005 IBM CVSD + 0x0006 Microsoft A-Law + 0x0007 Microsoft mu-Law + 0x0008 Microsoft DTS + 0x0010 OKI ADPCM + 0x0011 Intel DVI/IMA ADPCM + 0x0012 Videologic MediaSpace ADPCM + 0x0013 Sierra Semiconductor ADPCM + 0x0014 Antex Electronics G.723 ADPCM + 0x0015 DSP Solutions DigiSTD + 0x0016 DSP Solutions DigiFIX + 0x0017 Dialogic OKI ADPCM + 0x0018 MediaVision ADPCM + 0x0019 Hewlett-Packard CU + 0x0020 Yamaha ADPCM + 0x0021 Speech Compression Sonarc + 0x0022 DSP Group TrueSpeech + 0x0023 Echo Speech EchoSC1 + 0x0024 Audiofile AF36 + 0x0025 Audio Processing Technology APTX + 0x0026 AudioFile AF10 + 0x0027 Prosody 1612 + 0x0028 LRC + 0x0030 Dolby AC2 + 0x0031 Microsoft GSM 6.10 + 0x0032 MSNAudio + 0x0033 Antex Electronics ADPCME + 0x0034 Control Resources VQLPC + 0x0035 DSP Solutions DigiREAL + 0x0036 DSP Solutions DigiADPCM + 0x0037 Control Resources CR10 + 0x0038 Natural MicroSystems VBXADPCM + 0x0039 Crystal Semiconductor IMA ADPCM + 0x003A EchoSC3 + 0x003B Rockwell ADPCM + 0x003C Rockwell Digit LK + 0x003D Xebec + 0x0040 Antex Electronics G.721 ADPCM + 0x0041 G.728 CELP + 0x0042 MSG723 + 0x0050 MPEG Layer-2 or Layer-1 + 0x0052 RT24 + 0x0053 PAC + 0x0055 MPEG Layer-3 + 0x0059 Lucent G.723 + 0x0060 Cirrus + 0x0061 ESPCM + 0x0062 Voxware + 0x0063 Canopus Atrac + 0x0064 G.726 ADPCM + 0x0065 G.722 ADPCM + 0x0066 DSAT + 0x0067 DSAT Display + 0x0069 Voxware Byte Aligned + 0x0070 Voxware AC8 + 0x0071 Voxware AC10 + 0x0072 Voxware AC16 + 0x0073 Voxware AC20 + 0x0074 Voxware MetaVoice + 0x0075 Voxware MetaSound + 0x0076 Voxware RT29HW + 0x0077 Voxware VR12 + 0x0078 Voxware VR18 + 0x0079 Voxware TQ40 + 0x0080 Softsound + 0x0081 Voxware TQ60 + 0x0082 MSRT24 + 0x0083 G.729A + 0x0084 MVI MV12 + 0x0085 DF G.726 + 0x0086 DF GSM610 + 0x0088 ISIAudio + 0x0089 Onlive + 0x0091 SBC24 + 0x0092 Dolby AC3 SPDIF + 0x0093 MediaSonic G.723 + 0x0094 Aculab PLC Prosody 8kbps + 0x0097 ZyXEL ADPCM + 0x0098 Philips LPCBB + 0x0099 Packed + 0x00FF AAC + 0x0100 Rhetorex ADPCM + 0x0101 IBM mu-law + 0x0102 IBM A-law + 0x0103 IBM AVC Adaptive Differential Pulse Code Modulation (ADPCM) + 0x0111 Vivo G.723 + 0x0112 Vivo Siren + 0x0123 Digital G.723 + 0x0125 Sanyo LD ADPCM + 0x0130 Sipro Lab Telecom ACELP NET + 0x0131 Sipro Lab Telecom ACELP 4800 + 0x0132 Sipro Lab Telecom ACELP 8V3 + 0x0133 Sipro Lab Telecom G.729 + 0x0134 Sipro Lab Telecom G.729A + 0x0135 Sipro Lab Telecom Kelvin + 0x0140 Windows Media Video V8 + 0x0150 Qualcomm PureVoice + 0x0151 Qualcomm HalfRate + 0x0155 Ring Zero Systems TUB GSM + 0x0160 Microsoft Audio 1 + 0x0161 Windows Media Audio V7 / V8 / V9 + 0x0162 Windows Media Audio Professional V9 + 0x0163 Windows Media Audio Lossless V9 + 0x0200 Creative Labs ADPCM + 0x0202 Creative Labs Fastspeech8 + 0x0203 Creative Labs Fastspeech10 + 0x0210 UHER Informatic GmbH ADPCM + 0x0220 Quarterdeck + 0x0230 I-link Worldwide VC + 0x0240 Aureal RAW Sport + 0x0250 Interactive Products HSX + 0x0251 Interactive Products RPELP + 0x0260 Consistent Software CS2 + 0x0270 Sony SCX + 0x0300 Fujitsu FM Towns Snd + 0x0400 BTV Digital + 0x0401 Intel Music Coder + 0x0450 QDesign Music + 0x0680 VME VMPCM + 0x0681 AT&T Labs TPC + 0x08AE ClearJump LiteWave + 0x1000 Olivetti GSM + 0x1001 Olivetti ADPCM + 0x1002 Olivetti CELP + 0x1003 Olivetti SBC + 0x1004 Olivetti OPR + 0x1100 Lernout & Hauspie Codec (0x1100) + 0x1101 Lernout & Hauspie CELP Codec (0x1101) + 0x1102 Lernout & Hauspie SBC Codec (0x1102) + 0x1103 Lernout & Hauspie SBC Codec (0x1103) + 0x1104 Lernout & Hauspie SBC Codec (0x1104) + 0x1400 Norris + 0x1401 AT&T ISIAudio + 0x1500 Soundspace Music Compression + 0x181C VoxWare RT24 Speech + 0x1FC4 NCT Soft ALF2CD (www.nctsoft.com) + 0x2000 Dolby AC3 + 0x2001 Dolby DTS + 0x2002 WAVE_FORMAT_14_4 + 0x2003 WAVE_FORMAT_28_8 + 0x2004 WAVE_FORMAT_COOK + 0x2005 WAVE_FORMAT_DNET + 0x674F Ogg Vorbis 1 + 0x6750 Ogg Vorbis 2 + 0x6751 Ogg Vorbis 3 + 0x676F Ogg Vorbis 1+ + 0x6770 Ogg Vorbis 2+ + 0x6771 Ogg Vorbis 3+ + 0x7A21 GSM-AMR (CBR, no SID) + 0x7A22 GSM-AMR (VBR, including SID) + 0xFFFE WAVE_FORMAT_EXTENSIBLE + 0xFFFF WAVE_FORMAT_DEVELOPMENT + + */ + + return getid3_lib::EmbeddedLookup('0x'.str_pad(strtoupper(dechex($wFormatTag)), 4, '0', STR_PAD_LEFT), $begin, __LINE__, __FILE__, 'riff-wFormatTag'); + } + + public static function fourccLookup($fourcc) { + + $begin = __LINE__; + + /** This is not a comment! + + swot http://developer.apple.com/qa/snd/snd07.html + ____ No Codec (____) + _BIT BI_BITFIELDS (Raw RGB) + _JPG JPEG compressed + _PNG PNG compressed W3C/ISO/IEC (RFC-2083) + _RAW Full Frames (Uncompressed) + _RGB Raw RGB Bitmap + _RL4 RLE 4bpp RGB + _RL8 RLE 8bpp RGB + 3IV1 3ivx MPEG-4 v1 + 3IV2 3ivx MPEG-4 v2 + 3IVX 3ivx MPEG-4 + AASC Autodesk Animator + ABYR Kensington ?ABYR? + AEMI Array Microsystems VideoONE MPEG1-I Capture + AFLC Autodesk Animator FLC + AFLI Autodesk Animator FLI + AMPG Array Microsystems VideoONE MPEG + ANIM Intel RDX (ANIM) + AP41 AngelPotion Definitive + ASV1 Asus Video v1 + ASV2 Asus Video v2 + ASVX Asus Video 2.0 (audio) + AUR2 AuraVision Aura 2 Codec - YUV 4:2:2 + AURA AuraVision Aura 1 Codec - YUV 4:1:1 + AVDJ Independent JPEG Group\'s codec (AVDJ) + AVRN Independent JPEG Group\'s codec (AVRN) + AYUV 4:4:4 YUV (AYUV) + AZPR Quicktime Apple Video (AZPR) + BGR Raw RGB32 + BLZ0 Blizzard DivX MPEG-4 + BTVC Conexant Composite Video + BINK RAD Game Tools Bink Video + BT20 Conexant Prosumer Video + BTCV Conexant Composite Video Codec + BW10 Data Translation Broadway MPEG Capture + CC12 Intel YUV12 + CDVC Canopus DV + CFCC Digital Processing Systems DPS Perception + CGDI Microsoft Office 97 Camcorder Video + CHAM Winnov Caviara Champagne + CJPG Creative WebCam JPEG + CLJR Cirrus Logic YUV 4:1:1 + CMYK Common Data Format in Printing (Colorgraph) + CPLA Weitek 4:2:0 YUV Planar + CRAM Microsoft Video 1 (CRAM) + cvid Radius Cinepak + CVID Radius Cinepak + CWLT Microsoft Color WLT DIB + CYUV Creative Labs YUV + CYUY ATI YUV + D261 H.261 + D263 H.263 + DIB Device Independent Bitmap + DIV1 FFmpeg OpenDivX + DIV2 Microsoft MPEG-4 v1/v2 + DIV3 DivX ;-) MPEG-4 v3.x Low-Motion + DIV4 DivX ;-) MPEG-4 v3.x Fast-Motion + DIV5 DivX MPEG-4 v5.x + DIV6 DivX ;-) (MS MPEG-4 v3.x) + DIVX DivX MPEG-4 v4 (OpenDivX / Project Mayo) + divx DivX MPEG-4 + DMB1 Matrox Rainbow Runner hardware MJPEG + DMB2 Paradigm MJPEG + DSVD ?DSVD? + DUCK Duck TrueMotion 1.0 + DPS0 DPS/Leitch Reality Motion JPEG + DPSC DPS/Leitch PAR Motion JPEG + DV25 Matrox DVCPRO codec + DV50 Matrox DVCPRO50 codec + DVC IEC 61834 and SMPTE 314M (DVC/DV Video) + DVCP IEC 61834 and SMPTE 314M (DVC/DV Video) + DVHD IEC Standard DV 1125 lines @ 30fps / 1250 lines @ 25fps + DVMA Darim Vision DVMPEG (dummy for MPEG compressor) (www.darvision.com) + DVSL IEC Standard DV compressed in SD (SDL) + DVAN ?DVAN? + DVE2 InSoft DVE-2 Videoconferencing + dvsd IEC 61834 and SMPTE 314M DVC/DV Video + DVSD IEC 61834 and SMPTE 314M DVC/DV Video + DVX1 Lucent DVX1000SP Video Decoder + DVX2 Lucent DVX2000S Video Decoder + DVX3 Lucent DVX3000S Video Decoder + DX50 DivX v5 + DXT1 Microsoft DirectX Compressed Texture (DXT1) + DXT2 Microsoft DirectX Compressed Texture (DXT2) + DXT3 Microsoft DirectX Compressed Texture (DXT3) + DXT4 Microsoft DirectX Compressed Texture (DXT4) + DXT5 Microsoft DirectX Compressed Texture (DXT5) + DXTC Microsoft DirectX Compressed Texture (DXTC) + DXTn Microsoft DirectX Compressed Texture (DXTn) + EM2V Etymonix MPEG-2 I-frame (www.etymonix.com) + EKQ0 Elsa ?EKQ0? + ELK0 Elsa ?ELK0? + ESCP Eidos Escape + ETV1 eTreppid Video ETV1 + ETV2 eTreppid Video ETV2 + ETVC eTreppid Video ETVC + FLIC Autodesk FLI/FLC Animation + FLV1 Sorenson Spark + FLV4 On2 TrueMotion VP6 + FRWT Darim Vision Forward Motion JPEG (www.darvision.com) + FRWU Darim Vision Forward Uncompressed (www.darvision.com) + FLJP D-Vision Field Encoded Motion JPEG + FPS1 FRAPS v1 + FRWA SoftLab-Nsk Forward Motion JPEG w/ alpha channel + FRWD SoftLab-Nsk Forward Motion JPEG + FVF1 Iterated Systems Fractal Video Frame + GLZW Motion LZW (gabest@freemail.hu) + GPEG Motion JPEG (gabest@freemail.hu) + GWLT Microsoft Greyscale WLT DIB + H260 Intel ITU H.260 Videoconferencing + H261 Intel ITU H.261 Videoconferencing + H262 Intel ITU H.262 Videoconferencing + H263 Intel ITU H.263 Videoconferencing + H264 Intel ITU H.264 Videoconferencing + H265 Intel ITU H.265 Videoconferencing + H266 Intel ITU H.266 Videoconferencing + H267 Intel ITU H.267 Videoconferencing + H268 Intel ITU H.268 Videoconferencing + H269 Intel ITU H.269 Videoconferencing + HFYU Huffman Lossless Codec + HMCR Rendition Motion Compensation Format (HMCR) + HMRR Rendition Motion Compensation Format (HMRR) + I263 FFmpeg I263 decoder + IF09 Indeo YVU9 ("YVU9 with additional delta-frame info after the U plane") + IUYV Interlaced version of UYVY (www.leadtools.com) + IY41 Interlaced version of Y41P (www.leadtools.com) + IYU1 12 bit format used in mode 2 of the IEEE 1394 Digital Camera 1.04 spec IEEE standard + IYU2 24 bit format used in mode 2 of the IEEE 1394 Digital Camera 1.04 spec IEEE standard + IYUV Planar YUV format (8-bpp Y plane, followed by 8-bpp 2×2 U and V planes) + i263 Intel ITU H.263 Videoconferencing (i263) + I420 Intel Indeo 4 + IAN Intel Indeo 4 (RDX) + ICLB InSoft CellB Videoconferencing + IGOR Power DVD + IJPG Intergraph JPEG + ILVC Intel Layered Video + ILVR ITU-T H.263+ + IPDV I-O Data Device Giga AVI DV Codec + IR21 Intel Indeo 2.1 + IRAW Intel YUV Uncompressed + IV30 Intel Indeo 3.0 + IV31 Intel Indeo 3.1 + IV32 Ligos Indeo 3.2 + IV33 Ligos Indeo 3.3 + IV34 Ligos Indeo 3.4 + IV35 Ligos Indeo 3.5 + IV36 Ligos Indeo 3.6 + IV37 Ligos Indeo 3.7 + IV38 Ligos Indeo 3.8 + IV39 Ligos Indeo 3.9 + IV40 Ligos Indeo Interactive 4.0 + IV41 Ligos Indeo Interactive 4.1 + IV42 Ligos Indeo Interactive 4.2 + IV43 Ligos Indeo Interactive 4.3 + IV44 Ligos Indeo Interactive 4.4 + IV45 Ligos Indeo Interactive 4.5 + IV46 Ligos Indeo Interactive 4.6 + IV47 Ligos Indeo Interactive 4.7 + IV48 Ligos Indeo Interactive 4.8 + IV49 Ligos Indeo Interactive 4.9 + IV50 Ligos Indeo Interactive 5.0 + JBYR Kensington ?JBYR? + JPEG Still Image JPEG DIB + JPGL Pegasus Lossless Motion JPEG + KMVC Team17 Software Karl Morton\'s Video Codec + LSVM Vianet Lighting Strike Vmail (Streaming) (www.vianet.com) + LEAD LEAD Video Codec + Ljpg LEAD MJPEG Codec + MDVD Alex MicroDVD Video (hacked MS MPEG-4) (www.tiasoft.de) + MJPA Morgan Motion JPEG (MJPA) (www.morgan-multimedia.com) + MJPB Morgan Motion JPEG (MJPB) (www.morgan-multimedia.com) + MMES Matrox MPEG-2 I-frame + MP2v Microsoft S-Mpeg 4 version 1 (MP2v) + MP42 Microsoft S-Mpeg 4 version 2 (MP42) + MP43 Microsoft S-Mpeg 4 version 3 (MP43) + MP4S Microsoft S-Mpeg 4 version 3 (MP4S) + MP4V FFmpeg MPEG-4 + MPG1 FFmpeg MPEG 1/2 + MPG2 FFmpeg MPEG 1/2 + MPG3 FFmpeg DivX ;-) (MS MPEG-4 v3) + MPG4 Microsoft MPEG-4 + MPGI Sigma Designs MPEG + MPNG PNG images decoder + MSS1 Microsoft Windows Screen Video + MSZH LCL (Lossless Codec Library) (www.geocities.co.jp/Playtown-Denei/2837/LRC.htm) + M261 Microsoft H.261 + M263 Microsoft H.263 + M4S2 Microsoft Fully Compliant MPEG-4 v2 simple profile (M4S2) + m4s2 Microsoft Fully Compliant MPEG-4 v2 simple profile (m4s2) + MC12 ATI Motion Compensation Format (MC12) + MCAM ATI Motion Compensation Format (MCAM) + MJ2C Morgan Multimedia Motion JPEG2000 + mJPG IBM Motion JPEG w/ Huffman Tables + MJPG Microsoft Motion JPEG DIB + MP42 Microsoft MPEG-4 (low-motion) + MP43 Microsoft MPEG-4 (fast-motion) + MP4S Microsoft MPEG-4 (MP4S) + mp4s Microsoft MPEG-4 (mp4s) + MPEG Chromatic Research MPEG-1 Video I-Frame + MPG4 Microsoft MPEG-4 Video High Speed Compressor + MPGI Sigma Designs MPEG + MRCA FAST Multimedia Martin Regen Codec + MRLE Microsoft Run Length Encoding + MSVC Microsoft Video 1 + MTX1 Matrox ?MTX1? + MTX2 Matrox ?MTX2? + MTX3 Matrox ?MTX3? + MTX4 Matrox ?MTX4? + MTX5 Matrox ?MTX5? + MTX6 Matrox ?MTX6? + MTX7 Matrox ?MTX7? + MTX8 Matrox ?MTX8? + MTX9 Matrox ?MTX9? + MV12 Motion Pixels Codec (old) + MWV1 Aware Motion Wavelets + nAVI SMR Codec (hack of Microsoft MPEG-4) (IRC #shadowrealm) + NT00 NewTek LightWave HDTV YUV w/ Alpha (www.newtek.com) + NUV1 NuppelVideo + NTN1 Nogatech Video Compression 1 + NVS0 nVidia GeForce Texture (NVS0) + NVS1 nVidia GeForce Texture (NVS1) + NVS2 nVidia GeForce Texture (NVS2) + NVS3 nVidia GeForce Texture (NVS3) + NVS4 nVidia GeForce Texture (NVS4) + NVS5 nVidia GeForce Texture (NVS5) + NVT0 nVidia GeForce Texture (NVT0) + NVT1 nVidia GeForce Texture (NVT1) + NVT2 nVidia GeForce Texture (NVT2) + NVT3 nVidia GeForce Texture (NVT3) + NVT4 nVidia GeForce Texture (NVT4) + NVT5 nVidia GeForce Texture (NVT5) + PIXL MiroXL, Pinnacle PCTV + PDVC I-O Data Device Digital Video Capture DV codec + PGVV Radius Video Vision + PHMO IBM Photomotion + PIM1 MPEG Realtime (Pinnacle Cards) + PIM2 Pegasus Imaging ?PIM2? + PIMJ Pegasus Imaging Lossless JPEG + PVEZ Horizons Technology PowerEZ + PVMM PacketVideo Corporation MPEG-4 + PVW2 Pegasus Imaging Wavelet Compression + Q1.0 Q-Team\'s QPEG 1.0 (www.q-team.de) + Q1.1 Q-Team\'s QPEG 1.1 (www.q-team.de) + QPEG Q-Team QPEG 1.0 + qpeq Q-Team QPEG 1.1 + RGB Raw BGR32 + RGBA Raw RGB w/ Alpha + RMP4 REALmagic MPEG-4 (unauthorized XVID copy) (www.sigmadesigns.com) + ROQV Id RoQ File Video Decoder + RPZA Quicktime Apple Video (RPZA) + RUD0 Rududu video codec (http://rududu.ifrance.com/rududu/) + RV10 RealVideo 1.0 (aka RealVideo 5.0) + RV13 RealVideo 1.0 (RV13) + RV20 RealVideo G2 + RV30 RealVideo 8 + RV40 RealVideo 9 + RGBT Raw RGB w/ Transparency + RLE Microsoft Run Length Encoder + RLE4 Run Length Encoded (4bpp, 16-color) + RLE8 Run Length Encoded (8bpp, 256-color) + RT21 Intel Indeo RealTime Video 2.1 + rv20 RealVideo G2 + rv30 RealVideo 8 + RVX Intel RDX (RVX ) + SMC Apple Graphics (SMC ) + SP54 Logitech Sunplus Sp54 Codec for Mustek GSmart Mini 2 + SPIG Radius Spigot + SVQ3 Sorenson Video 3 (Apple Quicktime 5) + s422 Tekram VideoCap C210 YUV 4:2:2 + SDCC Sun Communication Digital Camera Codec + SFMC CrystalNet Surface Fitting Method + SMSC Radius SMSC + SMSD Radius SMSD + smsv WorldConnect Wavelet Video + SPIG Radius Spigot + SPLC Splash Studios ACM Audio Codec (www.splashstudios.net) + SQZ2 Microsoft VXTreme Video Codec V2 + STVA ST Microelectronics CMOS Imager Data (Bayer) + STVB ST Microelectronics CMOS Imager Data (Nudged Bayer) + STVC ST Microelectronics CMOS Imager Data (Bunched) + STVX ST Microelectronics CMOS Imager Data (Extended CODEC Data Format) + STVY ST Microelectronics CMOS Imager Data (Extended CODEC Data Format with Correction Data) + SV10 Sorenson Video R1 + SVQ1 Sorenson Video + T420 Toshiba YUV 4:2:0 + TM2A Duck TrueMotion Archiver 2.0 (www.duck.com) + TVJP Pinnacle/Truevision Targa 2000 board (TVJP) + TVMJ Pinnacle/Truevision Targa 2000 board (TVMJ) + TY0N Tecomac Low-Bit Rate Codec (www.tecomac.com) + TY2C Trident Decompression Driver + TLMS TeraLogic Motion Intraframe Codec (TLMS) + TLST TeraLogic Motion Intraframe Codec (TLST) + TM20 Duck TrueMotion 2.0 + TM2X Duck TrueMotion 2X + TMIC TeraLogic Motion Intraframe Codec (TMIC) + TMOT Horizons Technology TrueMotion S + tmot Horizons TrueMotion Video Compression + TR20 Duck TrueMotion RealTime 2.0 + TSCC TechSmith Screen Capture Codec + TV10 Tecomac Low-Bit Rate Codec + TY2N Trident ?TY2N? + U263 UB Video H.263/H.263+/H.263++ Decoder + UMP4 UB Video MPEG 4 (www.ubvideo.com) + UYNV Nvidia UYVY packed 4:2:2 + UYVP Evans & Sutherland YCbCr 4:2:2 extended precision + UCOD eMajix.com ClearVideo + ULTI IBM Ultimotion + UYVY UYVY packed 4:2:2 + V261 Lucent VX2000S + VIFP VFAPI Reader Codec (www.yks.ne.jp/~hori/) + VIV1 FFmpeg H263+ decoder + VIV2 Vivo H.263 + VQC2 Vector-quantised codec 2 (research) http://eprints.ecs.soton.ac.uk/archive/00001310/01/VTC97-js.pdf) + VTLP Alaris VideoGramPiX + VYU9 ATI YUV (VYU9) + VYUY ATI YUV (VYUY) + V261 Lucent VX2000S + V422 Vitec Multimedia 24-bit YUV 4:2:2 Format + V655 Vitec Multimedia 16-bit YUV 4:2:2 Format + VCR1 ATI Video Codec 1 + VCR2 ATI Video Codec 2 + VCR3 ATI VCR 3.0 + VCR4 ATI VCR 4.0 + VCR5 ATI VCR 5.0 + VCR6 ATI VCR 6.0 + VCR7 ATI VCR 7.0 + VCR8 ATI VCR 8.0 + VCR9 ATI VCR 9.0 + VDCT Vitec Multimedia Video Maker Pro DIB + VDOM VDOnet VDOWave + VDOW VDOnet VDOLive (H.263) + VDTZ Darim Vison VideoTizer YUV + VGPX Alaris VideoGramPiX + VIDS Vitec Multimedia YUV 4:2:2 CCIR 601 for V422 + VIVO Vivo H.263 v2.00 + vivo Vivo H.263 + VIXL Miro/Pinnacle Video XL + VLV1 VideoLogic/PURE Digital Videologic Capture + VP30 On2 VP3.0 + VP31 On2 VP3.1 + VP6F On2 TrueMotion VP6 + VX1K Lucent VX1000S Video Codec + VX2K Lucent VX2000S Video Codec + VXSP Lucent VX1000SP Video Codec + WBVC Winbond W9960 + WHAM Microsoft Video 1 (WHAM) + WINX Winnov Software Compression + WJPG AverMedia Winbond JPEG + WMV1 Windows Media Video V7 + WMV2 Windows Media Video V8 + WMV3 Windows Media Video V9 + WNV1 Winnov Hardware Compression + XYZP Extended PAL format XYZ palette (www.riff.org) + x263 Xirlink H.263 + XLV0 NetXL Video Decoder + XMPG Xing MPEG (I-Frame only) + XVID XviD MPEG-4 (www.xvid.org) + XXAN ?XXAN? + YU92 Intel YUV (YU92) + YUNV Nvidia Uncompressed YUV 4:2:2 + YUVP Extended PAL format YUV palette (www.riff.org) + Y211 YUV 2:1:1 Packed + Y411 YUV 4:1:1 Packed + Y41B Weitek YUV 4:1:1 Planar + Y41P Brooktree PC1 YUV 4:1:1 Packed + Y41T Brooktree PC1 YUV 4:1:1 with transparency + Y42B Weitek YUV 4:2:2 Planar + Y42T Brooktree UYUV 4:2:2 with transparency + Y422 ADS Technologies Copy of UYVY used in Pyro WebCam firewire camera + Y800 Simple, single Y plane for monochrome images + Y8 Grayscale video + YC12 Intel YUV 12 codec + YUV8 Winnov Caviar YUV8 + YUV9 Intel YUV9 + YUY2 Uncompressed YUV 4:2:2 + YUYV Canopus YUV + YV12 YVU12 Planar + YVU9 Intel YVU9 Planar (8-bpp Y plane, followed by 8-bpp 4x4 U and V planes) + YVYU YVYU 4:2:2 Packed + ZLIB Lossless Codec Library zlib compression (www.geocities.co.jp/Playtown-Denei/2837/LRC.htm) + ZPEG Metheus Video Zipper + + */ + + return getid3_lib::EmbeddedLookup($fourcc, $begin, __LINE__, __FILE__, 'riff-fourcc'); + } + + private function EitherEndian2Int($byteword, $signed=false) { + if ($this->container == 'riff') { + return getid3_lib::LittleEndian2Int($byteword, $signed); + } + return getid3_lib::BigEndian2Int($byteword, false, $signed); + } + +} \ No newline at end of file diff --git a/www/rompr/getid3/module.audio-video.swf.php b/www/rompr/getid3/module.audio-video.swf.php new file mode 100644 index 0000000..178f439 --- /dev/null +++ b/www/rompr/getid3/module.audio-video.swf.php @@ -0,0 +1,140 @@ + // +// available at http://getid3.sourceforge.net // +// or http://www.getid3.org // +// also https://github.com/JamesHeinrich/getID3 // +///////////////////////////////////////////////////////////////// +// See readme.txt for more details // +///////////////////////////////////////////////////////////////// +// // +// module.audio-video.swf.php // +// module for analyzing Shockwave Flash files // +// dependencies: NONE // +// /// +///////////////////////////////////////////////////////////////// + + +class getid3_swf extends getid3_handler +{ + public $ReturnAllTagData = false; + + public function Analyze() { + $info = &$this->getid3->info; + + $info['fileformat'] = 'swf'; + $info['video']['dataformat'] = 'swf'; + + // http://www.openswf.org/spec/SWFfileformat.html + + $this->fseek($info['avdataoffset']); + + $SWFfileData = $this->fread($info['avdataend'] - $info['avdataoffset']); // 8 + 2 + 2 + max(9) bytes NOT including Frame_Size RECT data + + $info['swf']['header']['signature'] = substr($SWFfileData, 0, 3); + switch ($info['swf']['header']['signature']) { + case 'FWS': + $info['swf']['header']['compressed'] = false; + break; + + case 'CWS': + $info['swf']['header']['compressed'] = true; + break; + + default: + $this->error('Expecting "FWS" or "CWS" at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes($info['swf']['header']['signature']).'"'); + unset($info['swf']); + unset($info['fileformat']); + return false; + break; + } + $info['swf']['header']['version'] = getid3_lib::LittleEndian2Int(substr($SWFfileData, 3, 1)); + $info['swf']['header']['length'] = getid3_lib::LittleEndian2Int(substr($SWFfileData, 4, 4)); + + if ($info['swf']['header']['compressed']) { + $SWFHead = substr($SWFfileData, 0, 8); + $SWFfileData = substr($SWFfileData, 8); + if ($decompressed = @gzuncompress($SWFfileData)) { + $SWFfileData = $SWFHead.$decompressed; + } else { + $this->error('Error decompressing compressed SWF data ('.strlen($SWFfileData).' bytes compressed, should be '.($info['swf']['header']['length'] - 8).' bytes uncompressed)'); + return false; + } + } + + $FrameSizeBitsPerValue = (ord(substr($SWFfileData, 8, 1)) & 0xF8) >> 3; + $FrameSizeDataLength = ceil((5 + (4 * $FrameSizeBitsPerValue)) / 8); + $FrameSizeDataString = str_pad(decbin(ord(substr($SWFfileData, 8, 1)) & 0x07), 3, '0', STR_PAD_LEFT); + for ($i = 1; $i < $FrameSizeDataLength; $i++) { + $FrameSizeDataString .= str_pad(decbin(ord(substr($SWFfileData, 8 + $i, 1))), 8, '0', STR_PAD_LEFT); + } + list($X1, $X2, $Y1, $Y2) = explode("\n", wordwrap($FrameSizeDataString, $FrameSizeBitsPerValue, "\n", 1)); + $info['swf']['header']['frame_width'] = getid3_lib::Bin2Dec($X2); + $info['swf']['header']['frame_height'] = getid3_lib::Bin2Dec($Y2); + + // http://www-lehre.informatik.uni-osnabrueck.de/~fbstark/diplom/docs/swf/Flash_Uncovered.htm + // Next in the header is the frame rate, which is kind of weird. + // It is supposed to be stored as a 16bit integer, but the first byte + // (or last depending on how you look at it) is completely ignored. + // Example: 0x000C -> 0x0C -> 12 So the frame rate is 12 fps. + + // Byte at (8 + $FrameSizeDataLength) is always zero and ignored + $info['swf']['header']['frame_rate'] = getid3_lib::LittleEndian2Int(substr($SWFfileData, 9 + $FrameSizeDataLength, 1)); + $info['swf']['header']['frame_count'] = getid3_lib::LittleEndian2Int(substr($SWFfileData, 10 + $FrameSizeDataLength, 2)); + + $info['video']['frame_rate'] = $info['swf']['header']['frame_rate']; + $info['video']['resolution_x'] = intval(round($info['swf']['header']['frame_width'] / 20)); + $info['video']['resolution_y'] = intval(round($info['swf']['header']['frame_height'] / 20)); + $info['video']['pixel_aspect_ratio'] = (float) 1; + + if (($info['swf']['header']['frame_count'] > 0) && ($info['swf']['header']['frame_rate'] > 0)) { + $info['playtime_seconds'] = $info['swf']['header']['frame_count'] / $info['swf']['header']['frame_rate']; + } +//echo __LINE__.'='.number_format(microtime(true) - $start_time, 3).'
      '; + + + // SWF tags + + $CurrentOffset = 12 + $FrameSizeDataLength; + $SWFdataLength = strlen($SWFfileData); + + while ($CurrentOffset < $SWFdataLength) { +//echo __LINE__.'='.number_format(microtime(true) - $start_time, 3).'
      '; + + $TagIDTagLength = getid3_lib::LittleEndian2Int(substr($SWFfileData, $CurrentOffset, 2)); + $TagID = ($TagIDTagLength & 0xFFFC) >> 6; + $TagLength = ($TagIDTagLength & 0x003F); + $CurrentOffset += 2; + if ($TagLength == 0x3F) { + $TagLength = getid3_lib::LittleEndian2Int(substr($SWFfileData, $CurrentOffset, 4)); + $CurrentOffset += 4; + } + + unset($TagData); + $TagData['offset'] = $CurrentOffset; + $TagData['size'] = $TagLength; + $TagData['id'] = $TagID; + $TagData['data'] = substr($SWFfileData, $CurrentOffset, $TagLength); + switch ($TagID) { + case 0: // end of movie + break 2; + + case 9: // Set background color + //$info['swf']['tags'][] = $TagData; + $info['swf']['bgcolor'] = strtoupper(str_pad(dechex(getid3_lib::BigEndian2Int($TagData['data'])), 6, '0', STR_PAD_LEFT)); + break; + + default: + if ($this->ReturnAllTagData) { + $info['swf']['tags'][] = $TagData; + } + break; + } + + $CurrentOffset += $TagLength; + } + + return true; + } + +} diff --git a/www/rompr/getid3/module.audio-video.ts.php b/www/rompr/getid3/module.audio-video.ts.php new file mode 100644 index 0000000..3362024 --- /dev/null +++ b/www/rompr/getid3/module.audio-video.ts.php @@ -0,0 +1,79 @@ + // +// available at http://getid3.sourceforge.net // +// or http://www.getid3.org // +// also https://github.com/JamesHeinrich/getID3 // +///////////////////////////////////////////////////////////////// +// See readme.txt for more details // +///////////////////////////////////////////////////////////////// +// // +// module.audio-video.ts.php // +// module for analyzing MPEG Transport Stream (.ts) files // +// dependencies: NONE // +// /// +///////////////////////////////////////////////////////////////// + + +class getid3_ts extends getid3_handler +{ + + public function Analyze() { + $info = &$this->getid3->info; + + $this->fseek($info['avdataoffset']); + $TSheader = $this->fread(19); + $magic = "\x47"; + if (substr($TSheader, 0, 1) != $magic) { + $this->error('Expecting "'.getid3_lib::PrintHexBytes($magic).'" at '.$info['avdataoffset'].', found '.getid3_lib::PrintHexBytes(substr($TSheader, 0, 1)).' instead.'); + return false; + } + $info['fileformat'] = 'ts'; + + // http://en.wikipedia.org/wiki/.ts + + $offset = 0; + $info['ts']['packet']['sync'] = getid3_lib::BigEndian2Int(substr($TSheader, $offset, 1)); $offset += 1; + $pid_flags_raw = getid3_lib::BigEndian2Int(substr($TSheader, $offset, 2)); $offset += 2; + $SAC_raw = getid3_lib::BigEndian2Int(substr($TSheader, $offset, 1)); $offset += 1; + $info['ts']['packet']['flags']['transport_error_indicator'] = (bool) ($pid_flags_raw & 0x8000); // Set by demodulator if can't correct errors in the stream, to tell the demultiplexer that the packet has an uncorrectable error + $info['ts']['packet']['flags']['payload_unit_start_indicator'] = (bool) ($pid_flags_raw & 0x4000); // 1 means start of PES data or PSI otherwise zero only. + $info['ts']['packet']['flags']['transport_high_priority'] = (bool) ($pid_flags_raw & 0x2000); // 1 means higher priority than other packets with the same PID. + $info['ts']['packet']['packet_id'] = ($pid_flags_raw & 0x1FFF) >> 0; + + $info['ts']['packet']['raw']['scrambling_control'] = ($SAC_raw & 0xC0) >> 6; + $info['ts']['packet']['flags']['adaption_field_exists'] = (bool) ($SAC_raw & 0x20); + $info['ts']['packet']['flags']['payload_exists'] = (bool) ($SAC_raw & 0x10); + $info['ts']['packet']['continuity_counter'] = ($SAC_raw & 0x0F) >> 0; // Incremented only when a payload is present + $info['ts']['packet']['scrambling_control'] = $this->TSscramblingControlLookup($info['ts']['packet']['raw']['scrambling_control']); + + if ($info['ts']['packet']['flags']['adaption_field_exists']) { + $AdaptionField_raw = getid3_lib::BigEndian2Int(substr($TSheader, $offset, 2)); $offset += 2; + $info['ts']['packet']['adaption']['field_length'] = ($AdaptionField_raw & 0xFF00) >> 8; // Number of bytes in the adaptation field immediately following this byte + $info['ts']['packet']['adaption']['flags']['discontinuity'] = (bool) ($AdaptionField_raw & 0x0080); // Set to 1 if current TS packet is in a discontinuity state with respect to either the continuity counter or the program clock reference + $info['ts']['packet']['adaption']['flags']['random_access'] = (bool) ($AdaptionField_raw & 0x0040); // Set to 1 if the PES packet in this TS packet starts a video/audio sequence + $info['ts']['packet']['adaption']['flags']['high_priority'] = (bool) ($AdaptionField_raw & 0x0020); // 1 = higher priority + $info['ts']['packet']['adaption']['flags']['pcr'] = (bool) ($AdaptionField_raw & 0x0010); // 1 means adaptation field does contain a PCR field + $info['ts']['packet']['adaption']['flags']['opcr'] = (bool) ($AdaptionField_raw & 0x0008); // 1 means adaptation field does contain an OPCR field + $info['ts']['packet']['adaption']['flags']['splice_point'] = (bool) ($AdaptionField_raw & 0x0004); // 1 means presence of splice countdown field in adaptation field + $info['ts']['packet']['adaption']['flags']['private_data'] = (bool) ($AdaptionField_raw & 0x0002); // 1 means presence of private data bytes in adaptation field + $info['ts']['packet']['adaption']['flags']['extension'] = (bool) ($AdaptionField_raw & 0x0001); // 1 means presence of adaptation field extension + if ($info['ts']['packet']['adaption']['flags']['pcr']) { + $info['ts']['packet']['adaption']['raw']['pcr'] = getid3_lib::BigEndian2Int(substr($TSheader, $offset, 6)); $offset += 6; + } + if ($info['ts']['packet']['adaption']['flags']['opcr']) { + $info['ts']['packet']['adaption']['raw']['opcr'] = getid3_lib::BigEndian2Int(substr($TSheader, $offset, 6)); $offset += 6; + } + } + +$this->error('MPEG Transport Stream (.ts) parsing not enabled in this version of getID3() ['.$this->getid3->version().']'); +return false; + + } + + + public function TSscramblingControlLookup($raw) { + $TSscramblingControlLookup = array(0x00=>'not scrambled', 0x01=>'reserved', 0x02=>'scrambled, even key', 0x03=>'scrambled, odd key'); + return (isset($TSscramblingControlLookup[$raw]) ? $TSscramblingControlLookup[$raw] : 'invalid'); + } +} diff --git a/www/rompr/getid3/module.audio.aa.php b/www/rompr/getid3/module.audio.aa.php new file mode 100644 index 0000000..889fd58 --- /dev/null +++ b/www/rompr/getid3/module.audio.aa.php @@ -0,0 +1,59 @@ + // +// available at http://getid3.sourceforge.net // +// or http://www.getid3.org // +// also https://github.com/JamesHeinrich/getID3 // +///////////////////////////////////////////////////////////////// +// See readme.txt for more details // +///////////////////////////////////////////////////////////////// +// // +// module.audio.aa.php // +// module for analyzing Audible Audiobook files // +// dependencies: NONE // +// /// +///////////////////////////////////////////////////////////////// + + +class getid3_aa extends getid3_handler +{ + + public function Analyze() { + $info = &$this->getid3->info; + + $this->fseek($info['avdataoffset']); + $AAheader = $this->fread(8); + + $magic = "\x57\x90\x75\x36"; + if (substr($AAheader, 4, 4) != $magic) { + $this->error('Expecting "'.getid3_lib::PrintHexBytes($magic).'" at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes(substr($AAheader, 4, 4)).'"'); + return false; + } + + // shortcut + $info['aa'] = array(); + $thisfile_aa = &$info['aa']; + + $info['fileformat'] = 'aa'; + $info['audio']['dataformat'] = 'aa'; +$this->error('Audible Audiobook (.aa) parsing not enabled in this version of getID3() ['.$this->getid3->version().']'); +return false; + $info['audio']['bitrate_mode'] = 'cbr'; // is it? + $thisfile_aa['encoding'] = 'ISO-8859-1'; + + $thisfile_aa['filesize'] = getid3_lib::BigEndian2Int(substr($AUheader, 0, 4)); + if ($thisfile_aa['filesize'] > ($info['avdataend'] - $info['avdataoffset'])) { + $this->warning('Possible truncated file - expecting "'.$thisfile_aa['filesize'].'" bytes of data, only found '.($info['avdataend'] - $info['avdataoffset']).' bytes"'); + } + + $info['audio']['bits_per_sample'] = 16; // is it? + $info['audio']['sample_rate'] = $thisfile_aa['sample_rate']; + $info['audio']['channels'] = $thisfile_aa['channels']; + + //$info['playtime_seconds'] = 0; + //$info['audio']['bitrate'] = 0; + + return true; + } + +} diff --git a/www/rompr/getid3/module.audio.aac.php b/www/rompr/getid3/module.audio.aac.php new file mode 100644 index 0000000..59d79de --- /dev/null +++ b/www/rompr/getid3/module.audio.aac.php @@ -0,0 +1,513 @@ + // +// available at http://getid3.sourceforge.net // +// or http://www.getid3.org // +// also https://github.com/JamesHeinrich/getID3 // +///////////////////////////////////////////////////////////////// +// See readme.txt for more details // +///////////////////////////////////////////////////////////////// +// // +// module.audio.aac.php // +// module for analyzing AAC Audio files // +// dependencies: NONE // +// /// +///////////////////////////////////////////////////////////////// + + +class getid3_aac extends getid3_handler +{ + public function Analyze() { + $info = &$this->getid3->info; + $this->fseek($info['avdataoffset']); + if ($this->fread(4) == 'ADIF') { + $this->getAACADIFheaderFilepointer(); + } else { + $this->getAACADTSheaderFilepointer(); + } + return true; + } + + + + public function getAACADIFheaderFilepointer() { + $info = &$this->getid3->info; + $info['fileformat'] = 'aac'; + $info['audio']['dataformat'] = 'aac'; + $info['audio']['lossless'] = false; + + $this->fseek($info['avdataoffset']); + $AACheader = $this->fread(1024); + $offset = 0; + + if (substr($AACheader, 0, 4) == 'ADIF') { + + // http://faac.sourceforge.net/wiki/index.php?page=ADIF + + // http://libmpeg.org/mpeg4/doc/w2203tfs.pdf + // adif_header() { + // adif_id 32 + // copyright_id_present 1 + // if( copyright_id_present ) + // copyright_id 72 + // original_copy 1 + // home 1 + // bitstream_type 1 + // bitrate 23 + // num_program_config_elements 4 + // for (i = 0; i < num_program_config_elements + 1; i++ ) { + // if( bitstream_type == '0' ) + // adif_buffer_fullness 20 + // program_config_element() + // } + // } + + $AACheaderBitstream = getid3_lib::BigEndian2Bin($AACheader); + $bitoffset = 0; + + $info['aac']['header_type'] = 'ADIF'; + $bitoffset += 32; + $info['aac']['header']['mpeg_version'] = 4; + + $info['aac']['header']['copyright'] = (bool) (substr($AACheaderBitstream, $bitoffset, 1) == '1'); + $bitoffset += 1; + if ($info['aac']['header']['copyright']) { + $info['aac']['header']['copyright_id'] = getid3_lib::Bin2String(substr($AACheaderBitstream, $bitoffset, 72)); + $bitoffset += 72; + } + $info['aac']['header']['original_copy'] = (bool) (substr($AACheaderBitstream, $bitoffset, 1) == '1'); + $bitoffset += 1; + $info['aac']['header']['home'] = (bool) (substr($AACheaderBitstream, $bitoffset, 1) == '1'); + $bitoffset += 1; + $info['aac']['header']['is_vbr'] = (bool) (substr($AACheaderBitstream, $bitoffset, 1) == '1'); + $bitoffset += 1; + if ($info['aac']['header']['is_vbr']) { + $info['audio']['bitrate_mode'] = 'vbr'; + $info['aac']['header']['bitrate_max'] = getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 23)); + $bitoffset += 23; + } else { + $info['audio']['bitrate_mode'] = 'cbr'; + $info['aac']['header']['bitrate'] = getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 23)); + $bitoffset += 23; + $info['audio']['bitrate'] = $info['aac']['header']['bitrate']; + } + if ($info['audio']['bitrate'] == 0) { + $this->error('Corrupt AAC file: bitrate_audio == zero'); + return false; + } + $info['aac']['header']['num_program_configs'] = 1 + getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 4)); + $bitoffset += 4; + + for ($i = 0; $i < $info['aac']['header']['num_program_configs']; $i++) { + // http://www.audiocoding.com/wiki/index.php?page=program_config_element + + // buffer_fullness 20 + + // element_instance_tag 4 + // object_type 2 + // sampling_frequency_index 4 + // num_front_channel_elements 4 + // num_side_channel_elements 4 + // num_back_channel_elements 4 + // num_lfe_channel_elements 2 + // num_assoc_data_elements 3 + // num_valid_cc_elements 4 + // mono_mixdown_present 1 + // mono_mixdown_element_number 4 if mono_mixdown_present == 1 + // stereo_mixdown_present 1 + // stereo_mixdown_element_number 4 if stereo_mixdown_present == 1 + // matrix_mixdown_idx_present 1 + // matrix_mixdown_idx 2 if matrix_mixdown_idx_present == 1 + // pseudo_surround_enable 1 if matrix_mixdown_idx_present == 1 + // for (i = 0; i < num_front_channel_elements; i++) { + // front_element_is_cpe[i] 1 + // front_element_tag_select[i] 4 + // } + // for (i = 0; i < num_side_channel_elements; i++) { + // side_element_is_cpe[i] 1 + // side_element_tag_select[i] 4 + // } + // for (i = 0; i < num_back_channel_elements; i++) { + // back_element_is_cpe[i] 1 + // back_element_tag_select[i] 4 + // } + // for (i = 0; i < num_lfe_channel_elements; i++) { + // lfe_element_tag_select[i] 4 + // } + // for (i = 0; i < num_assoc_data_elements; i++) { + // assoc_data_element_tag_select[i] 4 + // } + // for (i = 0; i < num_valid_cc_elements; i++) { + // cc_element_is_ind_sw[i] 1 + // valid_cc_element_tag_select[i] 4 + // } + // byte_alignment() VAR + // comment_field_bytes 8 + // for (i = 0; i < comment_field_bytes; i++) { + // comment_field_data[i] 8 + // } + + if (!$info['aac']['header']['is_vbr']) { + $info['aac']['program_configs'][$i]['buffer_fullness'] = getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 20)); + $bitoffset += 20; + } + $info['aac']['program_configs'][$i]['element_instance_tag'] = getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 4)); + $bitoffset += 4; + $info['aac']['program_configs'][$i]['object_type'] = getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 2)); + $bitoffset += 2; + $info['aac']['program_configs'][$i]['sampling_frequency_index'] = getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 4)); + $bitoffset += 4; + $info['aac']['program_configs'][$i]['num_front_channel_elements'] = getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 4)); + $bitoffset += 4; + $info['aac']['program_configs'][$i]['num_side_channel_elements'] = getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 4)); + $bitoffset += 4; + $info['aac']['program_configs'][$i]['num_back_channel_elements'] = getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 4)); + $bitoffset += 4; + $info['aac']['program_configs'][$i]['num_lfe_channel_elements'] = getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 2)); + $bitoffset += 2; + $info['aac']['program_configs'][$i]['num_assoc_data_elements'] = getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 3)); + $bitoffset += 3; + $info['aac']['program_configs'][$i]['num_valid_cc_elements'] = getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 4)); + $bitoffset += 4; + $info['aac']['program_configs'][$i]['mono_mixdown_present'] = (bool) getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 1)); + $bitoffset += 1; + if ($info['aac']['program_configs'][$i]['mono_mixdown_present']) { + $info['aac']['program_configs'][$i]['mono_mixdown_element_number'] = getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 4)); + $bitoffset += 4; + } + $info['aac']['program_configs'][$i]['stereo_mixdown_present'] = (bool) getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 1)); + $bitoffset += 1; + if ($info['aac']['program_configs'][$i]['stereo_mixdown_present']) { + $info['aac']['program_configs'][$i]['stereo_mixdown_element_number'] = getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 4)); + $bitoffset += 4; + } + $info['aac']['program_configs'][$i]['matrix_mixdown_idx_present'] = (bool) getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 1)); + $bitoffset += 1; + if ($info['aac']['program_configs'][$i]['matrix_mixdown_idx_present']) { + $info['aac']['program_configs'][$i]['matrix_mixdown_idx'] = getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 2)); + $bitoffset += 2; + $info['aac']['program_configs'][$i]['pseudo_surround_enable'] = (bool) getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 1)); + $bitoffset += 1; + } + for ($j = 0; $j < $info['aac']['program_configs'][$i]['num_front_channel_elements']; $j++) { + $info['aac']['program_configs'][$i]['front_element_is_cpe'][$j] = (bool) getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 1)); + $bitoffset += 1; + $info['aac']['program_configs'][$i]['front_element_tag_select'][$j] = getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 4)); + $bitoffset += 4; + } + for ($j = 0; $j < $info['aac']['program_configs'][$i]['num_side_channel_elements']; $j++) { + $info['aac']['program_configs'][$i]['side_element_is_cpe'][$j] = (bool) getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 1)); + $bitoffset += 1; + $info['aac']['program_configs'][$i]['side_element_tag_select'][$j] = getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 4)); + $bitoffset += 4; + } + for ($j = 0; $j < $info['aac']['program_configs'][$i]['num_back_channel_elements']; $j++) { + $info['aac']['program_configs'][$i]['back_element_is_cpe'][$j] = (bool) getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 1)); + $bitoffset += 1; + $info['aac']['program_configs'][$i]['back_element_tag_select'][$j] = getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 4)); + $bitoffset += 4; + } + for ($j = 0; $j < $info['aac']['program_configs'][$i]['num_lfe_channel_elements']; $j++) { + $info['aac']['program_configs'][$i]['lfe_element_tag_select'][$j] = getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 4)); + $bitoffset += 4; + } + for ($j = 0; $j < $info['aac']['program_configs'][$i]['num_assoc_data_elements']; $j++) { + $info['aac']['program_configs'][$i]['assoc_data_element_tag_select'][$j] = getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 4)); + $bitoffset += 4; + } + for ($j = 0; $j < $info['aac']['program_configs'][$i]['num_valid_cc_elements']; $j++) { + $info['aac']['program_configs'][$i]['cc_element_is_ind_sw'][$j] = (bool) getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 1)); + $bitoffset += 1; + $info['aac']['program_configs'][$i]['valid_cc_element_tag_select'][$j] = getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 4)); + $bitoffset += 4; + } + + $bitoffset = ceil($bitoffset / 8) * 8; + + $info['aac']['program_configs'][$i]['comment_field_bytes'] = getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 8)); + $bitoffset += 8; + $info['aac']['program_configs'][$i]['comment_field'] = getid3_lib::Bin2String(substr($AACheaderBitstream, $bitoffset, 8 * $info['aac']['program_configs'][$i]['comment_field_bytes'])); + $bitoffset += 8 * $info['aac']['program_configs'][$i]['comment_field_bytes']; + + + $info['aac']['header']['profile'] = self::AACprofileLookup($info['aac']['program_configs'][$i]['object_type'], $info['aac']['header']['mpeg_version']); + $info['aac']['program_configs'][$i]['sampling_frequency'] = self::AACsampleRateLookup($info['aac']['program_configs'][$i]['sampling_frequency_index']); + $info['audio']['sample_rate'] = $info['aac']['program_configs'][$i]['sampling_frequency']; + $info['audio']['channels'] = self::AACchannelCountCalculate($info['aac']['program_configs'][$i]); + if ($info['aac']['program_configs'][$i]['comment_field']) { + $info['aac']['comments'][] = $info['aac']['program_configs'][$i]['comment_field']; + } + } + $info['playtime_seconds'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / $info['audio']['bitrate']; + + $info['audio']['encoder_options'] = $info['aac']['header_type'].' '.$info['aac']['header']['profile']; + + + + return true; + + } else { + + unset($info['fileformat']); + unset($info['aac']); + $this->error('AAC-ADIF synch not found at offset '.$info['avdataoffset'].' (expected "ADIF", found "'.substr($AACheader, 0, 4).'" instead)'); + return false; + + } + + } + + + public function getAACADTSheaderFilepointer($MaxFramesToScan=1000000, $ReturnExtendedInfo=false) { + $info = &$this->getid3->info; + + // based loosely on code from AACfile by Jurgen Faul + // http://jfaul.de/atl or http://j-faul.virtualave.net/atl/atl.html + + + // http://faac.sourceforge.net/wiki/index.php?page=ADTS // dead link + // http://wiki.multimedia.cx/index.php?title=ADTS + + // * ADTS Fixed Header: these don't change from frame to frame + // syncword 12 always: '111111111111' + // ID 1 0: MPEG-4, 1: MPEG-2 + // MPEG layer 2 If you send AAC in MPEG-TS, set to 0 + // protection_absent 1 0: CRC present; 1: no CRC + // profile 2 0: AAC Main; 1: AAC LC (Low Complexity); 2: AAC SSR (Scalable Sample Rate); 3: AAC LTP (Long Term Prediction) + // sampling_frequency_index 4 15 not allowed + // private_bit 1 usually 0 + // channel_configuration 3 + // original/copy 1 0: original; 1: copy + // home 1 usually 0 + // emphasis 2 only if ID == 0 (ie MPEG-4) // not present in some documentation? + + // * ADTS Variable Header: these can change from frame to frame + // copyright_identification_bit 1 + // copyright_identification_start 1 + // aac_frame_length 13 length of the frame including header (in bytes) + // adts_buffer_fullness 11 0x7FF indicates VBR + // no_raw_data_blocks_in_frame 2 + + // * ADTS Error check + // crc_check 16 only if protection_absent == 0 + + $byteoffset = $info['avdataoffset']; + $framenumber = 0; + + // Init bit pattern array + static $decbin = array(); + + // Populate $bindec + for ($i = 0; $i < 256; $i++) { + $decbin[chr($i)] = str_pad(decbin($i), 8, '0', STR_PAD_LEFT); + } + + // used to calculate bitrate below + $BitrateCache = array(); + + + while (true) { + // breaks out when end-of-file encountered, or invalid data found, + // or MaxFramesToScan frames have been scanned + + if (!getid3_lib::intValueSupported($byteoffset)) { + $this->warning('Unable to parse AAC file beyond '.$this->ftell().' (PHP does not support file operations beyond '.round(PHP_INT_MAX / 1073741824).'GB)'); + return false; + } + $this->fseek($byteoffset); + + // First get substring + $substring = $this->fread(9); // header is 7 bytes (or 9 if CRC is present) + $substringlength = strlen($substring); + if ($substringlength != 9) { + $this->error('Failed to read 7 bytes at offset '.($this->ftell() - $substringlength).' (only read '.$substringlength.' bytes)'); + return false; + } + // this would be easier with 64-bit math, but split it up to allow for 32-bit: + $header1 = getid3_lib::BigEndian2Int(substr($substring, 0, 2)); + $header2 = getid3_lib::BigEndian2Int(substr($substring, 2, 4)); + $header3 = getid3_lib::BigEndian2Int(substr($substring, 6, 1)); + + $info['aac']['header']['raw']['syncword'] = ($header1 & 0xFFF0) >> 4; + if ($info['aac']['header']['raw']['syncword'] != 0x0FFF) { + $this->error('Synch pattern (0x0FFF) not found at offset '.($this->ftell() - $substringlength).' (found 0x0'.strtoupper(dechex($info['aac']['header']['raw']['syncword'])).' instead)'); + //if ($info['fileformat'] == 'aac') { + // return true; + //} + unset($info['aac']); + return false; + } + + // Gather info for first frame only - this takes time to do 1000 times! + if ($framenumber == 0) { + $info['aac']['header_type'] = 'ADTS'; + $info['fileformat'] = 'aac'; + $info['audio']['dataformat'] = 'aac'; + + $info['aac']['header']['raw']['mpeg_version'] = ($header1 & 0x0008) >> 3; + $info['aac']['header']['raw']['mpeg_layer'] = ($header1 & 0x0006) >> 1; + $info['aac']['header']['raw']['protection_absent'] = ($header1 & 0x0001) >> 0; + + $info['aac']['header']['raw']['profile_code'] = ($header2 & 0xC0000000) >> 30; + $info['aac']['header']['raw']['sample_rate_code'] = ($header2 & 0x3C000000) >> 26; + $info['aac']['header']['raw']['private_stream'] = ($header2 & 0x02000000) >> 25; + $info['aac']['header']['raw']['channels_code'] = ($header2 & 0x01C00000) >> 22; + $info['aac']['header']['raw']['original'] = ($header2 & 0x00200000) >> 21; + $info['aac']['header']['raw']['home'] = ($header2 & 0x00100000) >> 20; + $info['aac']['header']['raw']['copyright_stream'] = ($header2 & 0x00080000) >> 19; + $info['aac']['header']['raw']['copyright_start'] = ($header2 & 0x00040000) >> 18; + $info['aac']['header']['raw']['frame_length'] = ($header2 & 0x0003FFE0) >> 5; + + $info['aac']['header']['mpeg_version'] = ($info['aac']['header']['raw']['mpeg_version'] ? 2 : 4); + $info['aac']['header']['crc_present'] = ($info['aac']['header']['raw']['protection_absent'] ? false: true); + $info['aac']['header']['profile'] = self::AACprofileLookup($info['aac']['header']['raw']['profile_code'], $info['aac']['header']['mpeg_version']); + $info['aac']['header']['sample_frequency'] = self::AACsampleRateLookup($info['aac']['header']['raw']['sample_rate_code']); + $info['aac']['header']['private'] = (bool) $info['aac']['header']['raw']['private_stream']; + $info['aac']['header']['original'] = (bool) $info['aac']['header']['raw']['original']; + $info['aac']['header']['home'] = (bool) $info['aac']['header']['raw']['home']; + $info['aac']['header']['channels'] = (($info['aac']['header']['raw']['channels_code'] == 7) ? 8 : $info['aac']['header']['raw']['channels_code']); + if ($ReturnExtendedInfo) { + $info['aac'][$framenumber]['copyright_id_bit'] = (bool) $info['aac']['header']['raw']['copyright_stream']; + $info['aac'][$framenumber]['copyright_id_start'] = (bool) $info['aac']['header']['raw']['copyright_start']; + } + + if ($info['aac']['header']['raw']['mpeg_layer'] != 0) { + $this->warning('Layer error - expected "0", found "'.$info['aac']['header']['raw']['mpeg_layer'].'" instead'); + } + if ($info['aac']['header']['sample_frequency'] == 0) { + $this->error('Corrupt AAC file: sample_frequency == zero'); + return false; + } + + $info['audio']['sample_rate'] = $info['aac']['header']['sample_frequency']; + $info['audio']['channels'] = $info['aac']['header']['channels']; + } + + $FrameLength = ($header2 & 0x0003FFE0) >> 5; + + if (!isset($BitrateCache[$FrameLength])) { + $BitrateCache[$FrameLength] = ($info['aac']['header']['sample_frequency'] / 1024) * $FrameLength * 8; + } + getid3_lib::safe_inc($info['aac']['bitrate_distribution'][$BitrateCache[$FrameLength]], 1); + + $info['aac'][$framenumber]['aac_frame_length'] = $FrameLength; + + $info['aac'][$framenumber]['adts_buffer_fullness'] = (($header2 & 0x0000001F) << 6) & (($header3 & 0xFC) >> 2); + if ($info['aac'][$framenumber]['adts_buffer_fullness'] == 0x07FF) { + $info['audio']['bitrate_mode'] = 'vbr'; + } else { + $info['audio']['bitrate_mode'] = 'cbr'; + } + $info['aac'][$framenumber]['num_raw_data_blocks'] = (($header3 & 0x03) >> 0); + + if ($info['aac']['header']['crc_present']) { + //$info['aac'][$framenumber]['crc'] = getid3_lib::BigEndian2Int(substr($substring, 7, 2); + } + + if (!$ReturnExtendedInfo) { + unset($info['aac'][$framenumber]); + } + + /* + $rounded_precision = 5000; + $info['aac']['bitrate_distribution_rounded'] = array(); + foreach ($info['aac']['bitrate_distribution'] as $bitrate => $count) { + $rounded_bitrate = round($bitrate / $rounded_precision) * $rounded_precision; + getid3_lib::safe_inc($info['aac']['bitrate_distribution_rounded'][$rounded_bitrate], $count); + } + ksort($info['aac']['bitrate_distribution_rounded']); + */ + + $byteoffset += $FrameLength; + if ((++$framenumber < $MaxFramesToScan) && (($byteoffset + 10) < $info['avdataend'])) { + + // keep scanning + + } else { + + $info['aac']['frames'] = $framenumber; + $info['playtime_seconds'] = ($info['avdataend'] / $byteoffset) * (($framenumber * 1024) / $info['aac']['header']['sample_frequency']); // (1 / % of file scanned) * (samples / (samples/sec)) = seconds + if ($info['playtime_seconds'] == 0) { + $this->error('Corrupt AAC file: playtime_seconds == zero'); + return false; + } + $info['audio']['bitrate'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / $info['playtime_seconds']; + ksort($info['aac']['bitrate_distribution']); + + $info['audio']['encoder_options'] = $info['aac']['header_type'].' '.$info['aac']['header']['profile']; + + return true; + + } + } + // should never get here. + } + + public static function AACsampleRateLookup($samplerateid) { + static $AACsampleRateLookup = array(); + if (empty($AACsampleRateLookup)) { + $AACsampleRateLookup[0] = 96000; + $AACsampleRateLookup[1] = 88200; + $AACsampleRateLookup[2] = 64000; + $AACsampleRateLookup[3] = 48000; + $AACsampleRateLookup[4] = 44100; + $AACsampleRateLookup[5] = 32000; + $AACsampleRateLookup[6] = 24000; + $AACsampleRateLookup[7] = 22050; + $AACsampleRateLookup[8] = 16000; + $AACsampleRateLookup[9] = 12000; + $AACsampleRateLookup[10] = 11025; + $AACsampleRateLookup[11] = 8000; + $AACsampleRateLookup[12] = 0; + $AACsampleRateLookup[13] = 0; + $AACsampleRateLookup[14] = 0; + $AACsampleRateLookup[15] = 0; + } + return (isset($AACsampleRateLookup[$samplerateid]) ? $AACsampleRateLookup[$samplerateid] : 'invalid'); + } + + public static function AACprofileLookup($profileid, $mpegversion) { + static $AACprofileLookup = array(); + if (empty($AACprofileLookup)) { + $AACprofileLookup[2][0] = 'Main profile'; + $AACprofileLookup[2][1] = 'Low Complexity profile (LC)'; + $AACprofileLookup[2][2] = 'Scalable Sample Rate profile (SSR)'; + $AACprofileLookup[2][3] = '(reserved)'; + $AACprofileLookup[4][0] = 'AAC_MAIN'; + $AACprofileLookup[4][1] = 'AAC_LC'; + $AACprofileLookup[4][2] = 'AAC_SSR'; + $AACprofileLookup[4][3] = 'AAC_LTP'; + } + return (isset($AACprofileLookup[$mpegversion][$profileid]) ? $AACprofileLookup[$mpegversion][$profileid] : 'invalid'); + } + + public static function AACchannelCountCalculate($program_configs) { + $channels = 0; + for ($i = 0; $i < $program_configs['num_front_channel_elements']; $i++) { + $channels++; + if ($program_configs['front_element_is_cpe'][$i]) { + // each front element is channel pair (CPE = Channel Pair Element) + $channels++; + } + } + for ($i = 0; $i < $program_configs['num_side_channel_elements']; $i++) { + $channels++; + if ($program_configs['side_element_is_cpe'][$i]) { + // each side element is channel pair (CPE = Channel Pair Element) + $channels++; + } + } + for ($i = 0; $i < $program_configs['num_back_channel_elements']; $i++) { + $channels++; + if ($program_configs['back_element_is_cpe'][$i]) { + // each back element is channel pair (CPE = Channel Pair Element) + $channels++; + } + } + for ($i = 0; $i < $program_configs['num_lfe_channel_elements']; $i++) { + $channels++; + } + return $channels; + } + +} diff --git a/www/rompr/getid3/module.audio.ac3.php b/www/rompr/getid3/module.audio.ac3.php new file mode 100644 index 0000000..6834d92 --- /dev/null +++ b/www/rompr/getid3/module.audio.ac3.php @@ -0,0 +1,735 @@ + // +// available at http://getid3.sourceforge.net // +// or http://www.getid3.org // +// also https://github.com/JamesHeinrich/getID3 // +///////////////////////////////////////////////////////////////// +// See readme.txt for more details // +///////////////////////////////////////////////////////////////// +// // +// module.audio.ac3.php // +// module for analyzing AC-3 (aka Dolby Digital) audio files // +// dependencies: NONE // +// /// +///////////////////////////////////////////////////////////////// + + +class getid3_ac3 extends getid3_handler +{ + private $AC3header = array(); + private $BSIoffset = 0; + + const syncword = 0x0B77; + + public function Analyze() { + $info = &$this->getid3->info; + + ///AH + $info['ac3']['raw']['bsi'] = array(); + $thisfile_ac3 = &$info['ac3']; + $thisfile_ac3_raw = &$thisfile_ac3['raw']; + $thisfile_ac3_raw_bsi = &$thisfile_ac3_raw['bsi']; + + + // http://www.atsc.org/standards/a_52a.pdf + + $info['fileformat'] = 'ac3'; + + // An AC-3 serial coded audio bit stream is made up of a sequence of synchronization frames + // Each synchronization frame contains 6 coded audio blocks (AB), each of which represent 256 + // new audio samples per channel. A synchronization information (SI) header at the beginning + // of each frame contains information needed to acquire and maintain synchronization. A + // bit stream information (BSI) header follows SI, and contains parameters describing the coded + // audio service. The coded audio blocks may be followed by an auxiliary data (Aux) field. At the + // end of each frame is an error check field that includes a CRC word for error detection. An + // additional CRC word is located in the SI header, the use of which, by a decoder, is optional. + // + // syncinfo() | bsi() | AB0 | AB1 | AB2 | AB3 | AB4 | AB5 | Aux | CRC + + // syncinfo() { + // syncword 16 + // crc1 16 + // fscod 2 + // frmsizecod 6 + // } /* end of syncinfo */ + + $this->fseek($info['avdataoffset']); + $tempAC3header = $this->fread(100); // should be enough to cover all data, there are some variable-length fields...? + $this->AC3header['syncinfo'] = getid3_lib::BigEndian2Int(substr($tempAC3header, 0, 2)); + $this->AC3header['bsi'] = getid3_lib::BigEndian2Bin(substr($tempAC3header, 2)); + $thisfile_ac3_raw_bsi['bsid'] = (getid3_lib::LittleEndian2Int(substr($tempAC3header, 5, 1)) & 0xF8) >> 3; // AC3 and E-AC3 put the "bsid" version identifier in the same place, but unfortnately the 4 bytes between the syncword and the version identifier are interpreted differently, so grab it here so the following code structure can make sense + unset($tempAC3header); + + if ($this->AC3header['syncinfo'] !== self::syncword) { + if (!$this->isDependencyFor('matroska')) { + unset($info['fileformat'], $info['ac3']); + return $this->error('Expecting "'.dechex(self::syncword).'" at offset '.$info['avdataoffset'].', found "'.dechex($this->AC3header['syncinfo']).'"'); + } + } + + $info['audio']['dataformat'] = 'ac3'; + $info['audio']['bitrate_mode'] = 'cbr'; + $info['audio']['lossless'] = false; + + if ($thisfile_ac3_raw_bsi['bsid'] <= 8) { + + $thisfile_ac3_raw_bsi['crc1'] = getid3_lib::Bin2Dec($this->readHeaderBSI(16)); + $thisfile_ac3_raw_bsi['fscod'] = $this->readHeaderBSI(2); // 5.4.1.3 + $thisfile_ac3_raw_bsi['frmsizecod'] = $this->readHeaderBSI(6); // 5.4.1.4 + if ($thisfile_ac3_raw_bsi['frmsizecod'] > 37) { // binary: 100101 - see Table 5.18 Frame Size Code Table (1 word = 16 bits) + $this->warning('Unexpected ac3.bsi.frmsizecod value: '.$thisfile_ac3_raw_bsi['frmsizecod'].', bitrate not set correctly'); + } + + $thisfile_ac3_raw_bsi['bsid'] = $this->readHeaderBSI(5); // we already know this from pre-parsing the version identifier, but re-read it to let the bitstream flow as intended + $thisfile_ac3_raw_bsi['bsmod'] = $this->readHeaderBSI(3); + $thisfile_ac3_raw_bsi['acmod'] = $this->readHeaderBSI(3); + + if ($thisfile_ac3_raw_bsi['acmod'] & 0x01) { + // If the lsb of acmod is a 1, center channel is in use and cmixlev follows in the bit stream. + $thisfile_ac3_raw_bsi['cmixlev'] = $this->readHeaderBSI(2); + $thisfile_ac3['center_mix_level'] = self::centerMixLevelLookup($thisfile_ac3_raw_bsi['cmixlev']); + } + + if ($thisfile_ac3_raw_bsi['acmod'] & 0x04) { + // If the msb of acmod is a 1, surround channels are in use and surmixlev follows in the bit stream. + $thisfile_ac3_raw_bsi['surmixlev'] = $this->readHeaderBSI(2); + $thisfile_ac3['surround_mix_level'] = self::surroundMixLevelLookup($thisfile_ac3_raw_bsi['surmixlev']); + } + + if ($thisfile_ac3_raw_bsi['acmod'] == 0x02) { + // When operating in the two channel mode, this 2-bit code indicates whether or not the program has been encoded in Dolby Surround. + $thisfile_ac3_raw_bsi['dsurmod'] = $this->readHeaderBSI(2); + $thisfile_ac3['dolby_surround_mode'] = self::dolbySurroundModeLookup($thisfile_ac3_raw_bsi['dsurmod']); + } + + $thisfile_ac3_raw_bsi['flags']['lfeon'] = (bool) $this->readHeaderBSI(1); + + // This indicates how far the average dialogue level is below digital 100 percent. Valid values are 1-31. + // The value of 0 is reserved. The values of 1 to 31 are interpreted as -1 dB to -31 dB with respect to digital 100 percent. + $thisfile_ac3_raw_bsi['dialnorm'] = $this->readHeaderBSI(5); // 5.4.2.8 dialnorm: Dialogue Normalization, 5 Bits + + $thisfile_ac3_raw_bsi['flags']['compr'] = (bool) $this->readHeaderBSI(1); // 5.4.2.9 compre: Compression Gain Word Exists, 1 Bit + if ($thisfile_ac3_raw_bsi['flags']['compr']) { + $thisfile_ac3_raw_bsi['compr'] = $this->readHeaderBSI(8); // 5.4.2.10 compr: Compression Gain Word, 8 Bits + $thisfile_ac3['heavy_compression'] = self::heavyCompression($thisfile_ac3_raw_bsi['compr']); + } + + $thisfile_ac3_raw_bsi['flags']['langcod'] = (bool) $this->readHeaderBSI(1); // 5.4.2.11 langcode: Language Code Exists, 1 Bit + if ($thisfile_ac3_raw_bsi['flags']['langcod']) { + $thisfile_ac3_raw_bsi['langcod'] = $this->readHeaderBSI(8); // 5.4.2.12 langcod: Language Code, 8 Bits + } + + $thisfile_ac3_raw_bsi['flags']['audprodinfo'] = (bool) $this->readHeaderBSI(1); // 5.4.2.13 audprodie: Audio Production Information Exists, 1 Bit + if ($thisfile_ac3_raw_bsi['flags']['audprodinfo']) { + $thisfile_ac3_raw_bsi['mixlevel'] = $this->readHeaderBSI(5); // 5.4.2.14 mixlevel: Mixing Level, 5 Bits + $thisfile_ac3_raw_bsi['roomtyp'] = $this->readHeaderBSI(2); // 5.4.2.15 roomtyp: Room Type, 2 Bits + + $thisfile_ac3['mixing_level'] = (80 + $thisfile_ac3_raw_bsi['mixlevel']).'dB'; + $thisfile_ac3['room_type'] = self::roomTypeLookup($thisfile_ac3_raw_bsi['roomtyp']); + } + + + $thisfile_ac3_raw_bsi['dialnorm2'] = $this->readHeaderBSI(5); // 5.4.2.16 dialnorm2: Dialogue Normalization, ch2, 5 Bits + $thisfile_ac3['dialogue_normalization2'] = '-'.$thisfile_ac3_raw_bsi['dialnorm2'].'dB'; // This indicates how far the average dialogue level is below digital 100 percent. Valid values are 1-31. The value of 0 is reserved. The values of 1 to 31 are interpreted as -1 dB to -31 dB with respect to digital 100 percent. + + $thisfile_ac3_raw_bsi['flags']['compr2'] = (bool) $this->readHeaderBSI(1); // 5.4.2.17 compr2e: Compression Gain Word Exists, ch2, 1 Bit + if ($thisfile_ac3_raw_bsi['flags']['compr2']) { + $thisfile_ac3_raw_bsi['compr2'] = $this->readHeaderBSI(8); // 5.4.2.18 compr2: Compression Gain Word, ch2, 8 Bits + $thisfile_ac3['heavy_compression2'] = self::heavyCompression($thisfile_ac3_raw_bsi['compr2']); + } + + $thisfile_ac3_raw_bsi['flags']['langcod2'] = (bool) $this->readHeaderBSI(1); // 5.4.2.19 langcod2e: Language Code Exists, ch2, 1 Bit + if ($thisfile_ac3_raw_bsi['flags']['langcod2']) { + $thisfile_ac3_raw_bsi['langcod2'] = $this->readHeaderBSI(8); // 5.4.2.20 langcod2: Language Code, ch2, 8 Bits + } + + $thisfile_ac3_raw_bsi['flags']['audprodinfo2'] = (bool) $this->readHeaderBSI(1); // 5.4.2.21 audprodi2e: Audio Production Information Exists, ch2, 1 Bit + if ($thisfile_ac3_raw_bsi['flags']['audprodinfo2']) { + $thisfile_ac3_raw_bsi['mixlevel2'] = $this->readHeaderBSI(5); // 5.4.2.22 mixlevel2: Mixing Level, ch2, 5 Bits + $thisfile_ac3_raw_bsi['roomtyp2'] = $this->readHeaderBSI(2); // 5.4.2.23 roomtyp2: Room Type, ch2, 2 Bits + + $thisfile_ac3['mixing_level2'] = (80 + $thisfile_ac3_raw_bsi['mixlevel2']).'dB'; + $thisfile_ac3['room_type2'] = self::roomTypeLookup($thisfile_ac3_raw_bsi['roomtyp2']); + } + + $thisfile_ac3_raw_bsi['copyright'] = (bool) $this->readHeaderBSI(1); // 5.4.2.24 copyrightb: Copyright Bit, 1 Bit + + $thisfile_ac3_raw_bsi['original'] = (bool) $this->readHeaderBSI(1); // 5.4.2.25 origbs: Original Bit Stream, 1 Bit + + $thisfile_ac3_raw_bsi['flags']['timecod1'] = $this->readHeaderBSI(2); // 5.4.2.26 timecod1e, timcode2e: Time Code (first and second) Halves Exist, 2 Bits + if ($thisfile_ac3_raw_bsi['flags']['timecod1'] & 0x01) { + $thisfile_ac3_raw_bsi['timecod1'] = $this->readHeaderBSI(14); // 5.4.2.27 timecod1: Time code first half, 14 bits + $thisfile_ac3['timecode1'] = 0; + $thisfile_ac3['timecode1'] += (($thisfile_ac3_raw_bsi['timecod1'] & 0x3E00) >> 9) * 3600; // The first 5 bits of this 14-bit field represent the time in hours, with valid values of 023 + $thisfile_ac3['timecode1'] += (($thisfile_ac3_raw_bsi['timecod1'] & 0x01F8) >> 3) * 60; // The next 6 bits represent the time in minutes, with valid values of 059 + $thisfile_ac3['timecode1'] += (($thisfile_ac3_raw_bsi['timecod1'] & 0x0003) >> 0) * 8; // The final 3 bits represents the time in 8 second increments, with valid values of 07 (representing 0, 8, 16, ... 56 seconds) + } + if ($thisfile_ac3_raw_bsi['flags']['timecod1'] & 0x02) { + $thisfile_ac3_raw_bsi['timecod2'] = $this->readHeaderBSI(14); // 5.4.2.28 timecod2: Time code second half, 14 bits + $thisfile_ac3['timecode2'] = 0; + $thisfile_ac3['timecode2'] += (($thisfile_ac3_raw_bsi['timecod2'] & 0x3800) >> 11) * 1; // The first 3 bits of this 14-bit field represent the time in seconds, with valid values from 07 (representing 0-7 seconds) + $thisfile_ac3['timecode2'] += (($thisfile_ac3_raw_bsi['timecod2'] & 0x07C0) >> 6) * (1 / 30); // The next 5 bits represents the time in frames, with valid values from 029 (one frame = 1/30th of a second) + $thisfile_ac3['timecode2'] += (($thisfile_ac3_raw_bsi['timecod2'] & 0x003F) >> 0) * ((1 / 30) / 60); // The final 6 bits represents fractions of 1/64 of a frame, with valid values from 063 + } + + $thisfile_ac3_raw_bsi['flags']['addbsi'] = (bool) $this->readHeaderBSI(1); + if ($thisfile_ac3_raw_bsi['flags']['addbsi']) { + $thisfile_ac3_raw_bsi['addbsi_length'] = $this->readHeaderBSI(6) + 1; // This 6-bit code, which exists only if addbside is a 1, indicates the length in bytes of additional bit stream information. The valid range of addbsil is 063, indicating 164 additional bytes, respectively. + + $this->AC3header['bsi'] .= getid3_lib::BigEndian2Bin($this->fread($thisfile_ac3_raw_bsi['addbsi_length'])); + + $thisfile_ac3_raw_bsi['addbsi_data'] = substr($this->AC3header['bsi'], $this->BSIoffset, $thisfile_ac3_raw_bsi['addbsi_length'] * 8); + $this->BSIoffset += $thisfile_ac3_raw_bsi['addbsi_length'] * 8; + } + + + } elseif ($thisfile_ac3_raw_bsi['bsid'] <= 16) { // E-AC3 + + +$this->error('E-AC3 parsing is incomplete and experimental in this version of getID3 ('.$this->getid3->version().'). Notably the bitrate calculations are wrong -- value might (or not) be correct, but it is not calculated correctly. Email info@getid3.org if you know how to calculate EAC3 bitrate correctly.'); + $info['audio']['dataformat'] = 'eac3'; + + $thisfile_ac3_raw_bsi['strmtyp'] = $this->readHeaderBSI(2); + $thisfile_ac3_raw_bsi['substreamid'] = $this->readHeaderBSI(3); + $thisfile_ac3_raw_bsi['frmsiz'] = $this->readHeaderBSI(11); + $thisfile_ac3_raw_bsi['fscod'] = $this->readHeaderBSI(2); + if ($thisfile_ac3_raw_bsi['fscod'] == 3) { + $thisfile_ac3_raw_bsi['fscod2'] = $this->readHeaderBSI(2); + $thisfile_ac3_raw_bsi['numblkscod'] = 3; // six blocks per syncframe + } else { + $thisfile_ac3_raw_bsi['numblkscod'] = $this->readHeaderBSI(2); + } + $thisfile_ac3['bsi']['blocks_per_sync_frame'] = self::blocksPerSyncFrame($thisfile_ac3_raw_bsi['numblkscod']); + $thisfile_ac3_raw_bsi['acmod'] = $this->readHeaderBSI(3); + $thisfile_ac3_raw_bsi['flags']['lfeon'] = (bool) $this->readHeaderBSI(1); + $thisfile_ac3_raw_bsi['bsid'] = $this->readHeaderBSI(5); // we already know this from pre-parsing the version identifier, but re-read it to let the bitstream flow as intended + $thisfile_ac3_raw_bsi['dialnorm'] = $this->readHeaderBSI(5); + $thisfile_ac3_raw_bsi['flags']['compr'] = (bool) $this->readHeaderBSI(1); + if ($thisfile_ac3_raw_bsi['flags']['compr']) { + $thisfile_ac3_raw_bsi['compr'] = $this->readHeaderBSI(8); + } + if ($thisfile_ac3_raw_bsi['acmod'] == 0) { // if 1+1 mode (dual mono, so some items need a second value) + $thisfile_ac3_raw_bsi['dialnorm2'] = $this->readHeaderBSI(5); + $thisfile_ac3_raw_bsi['flags']['compr2'] = (bool) $this->readHeaderBSI(1); + if ($thisfile_ac3_raw_bsi['flags']['compr2']) { + $thisfile_ac3_raw_bsi['compr2'] = $this->readHeaderBSI(8); + } + } + if ($thisfile_ac3_raw_bsi['strmtyp'] == 1) { // if dependent stream + $thisfile_ac3_raw_bsi['flags']['chanmap'] = (bool) $this->readHeaderBSI(1); + if ($thisfile_ac3_raw_bsi['flags']['chanmap']) { + $thisfile_ac3_raw_bsi['chanmap'] = $this->readHeaderBSI(8); + } + } + $thisfile_ac3_raw_bsi['flags']['mixmdat'] = (bool) $this->readHeaderBSI(1); + if ($thisfile_ac3_raw_bsi['flags']['mixmdat']) { // Mixing metadata + if ($thisfile_ac3_raw_bsi['acmod'] > 2) { // if more than 2 channels + $thisfile_ac3_raw_bsi['dmixmod'] = $this->readHeaderBSI(2); + } + if (($thisfile_ac3_raw_bsi['acmod'] & 0x01) && ($thisfile_ac3_raw_bsi['acmod'] > 2)) { // if three front channels exist + $thisfile_ac3_raw_bsi['ltrtcmixlev'] = $this->readHeaderBSI(3); + $thisfile_ac3_raw_bsi['lorocmixlev'] = $this->readHeaderBSI(3); + } + if ($thisfile_ac3_raw_bsi['acmod'] & 0x04) { // if a surround channel exists + $thisfile_ac3_raw_bsi['ltrtsurmixlev'] = $this->readHeaderBSI(3); + $thisfile_ac3_raw_bsi['lorosurmixlev'] = $this->readHeaderBSI(3); + } + if ($thisfile_ac3_raw_bsi['flags']['lfeon']) { // if the LFE channel exists + $thisfile_ac3_raw_bsi['flags']['lfemixlevcod'] = (bool) $this->readHeaderBSI(1); + if ($thisfile_ac3_raw_bsi['flags']['lfemixlevcod']) { + $thisfile_ac3_raw_bsi['lfemixlevcod'] = $this->readHeaderBSI(5); + } + } + if ($thisfile_ac3_raw_bsi['strmtyp'] == 0) { // if independent stream + $thisfile_ac3_raw_bsi['flags']['pgmscl'] = (bool) $this->readHeaderBSI(1); + if ($thisfile_ac3_raw_bsi['flags']['pgmscl']) { + $thisfile_ac3_raw_bsi['pgmscl'] = $this->readHeaderBSI(6); + } + if ($thisfile_ac3_raw_bsi['acmod'] == 0) { // if 1+1 mode (dual mono, so some items need a second value) + $thisfile_ac3_raw_bsi['flags']['pgmscl2'] = (bool) $this->readHeaderBSI(1); + if ($thisfile_ac3_raw_bsi['flags']['pgmscl2']) { + $thisfile_ac3_raw_bsi['pgmscl2'] = $this->readHeaderBSI(6); + } + } + $thisfile_ac3_raw_bsi['flags']['extpgmscl'] = (bool) $this->readHeaderBSI(1); + if ($thisfile_ac3_raw_bsi['flags']['extpgmscl']) { + $thisfile_ac3_raw_bsi['extpgmscl'] = $this->readHeaderBSI(6); + } + $thisfile_ac3_raw_bsi['mixdef'] = $this->readHeaderBSI(2); + if ($thisfile_ac3_raw_bsi['mixdef'] == 1) { // mixing option 2 + $thisfile_ac3_raw_bsi['premixcmpsel'] = (bool) $this->readHeaderBSI(1); + $thisfile_ac3_raw_bsi['drcsrc'] = (bool) $this->readHeaderBSI(1); + $thisfile_ac3_raw_bsi['premixcmpscl'] = $this->readHeaderBSI(3); + } elseif ($thisfile_ac3_raw_bsi['mixdef'] == 2) { // mixing option 3 + $thisfile_ac3_raw_bsi['mixdata'] = $this->readHeaderBSI(12); + } elseif ($thisfile_ac3_raw_bsi['mixdef'] == 3) { // mixing option 4 + $mixdefbitsread = 0; + $thisfile_ac3_raw_bsi['mixdeflen'] = $this->readHeaderBSI(5); $mixdefbitsread += 5; + $thisfile_ac3_raw_bsi['flags']['mixdata2'] = (bool) $this->readHeaderBSI(1); $mixdefbitsread += 1; + if ($thisfile_ac3_raw_bsi['flags']['mixdata2']) { + $thisfile_ac3_raw_bsi['premixcmpsel'] = (bool) $this->readHeaderBSI(1); $mixdefbitsread += 1; + $thisfile_ac3_raw_bsi['drcsrc'] = (bool) $this->readHeaderBSI(1); $mixdefbitsread += 1; + $thisfile_ac3_raw_bsi['premixcmpscl'] = $this->readHeaderBSI(3); $mixdefbitsread += 3; + $thisfile_ac3_raw_bsi['flags']['extpgmlscl'] = (bool) $this->readHeaderBSI(1); $mixdefbitsread += 1; + if ($thisfile_ac3_raw_bsi['flags']['extpgmlscl']) { + $thisfile_ac3_raw_bsi['extpgmlscl'] = $this->readHeaderBSI(4); $mixdefbitsread += 4; + } + $thisfile_ac3_raw_bsi['flags']['extpgmcscl'] = (bool) $this->readHeaderBSI(1); $mixdefbitsread += 1; + if ($thisfile_ac3_raw_bsi['flags']['extpgmcscl']) { + $thisfile_ac3_raw_bsi['extpgmcscl'] = $this->readHeaderBSI(4); $mixdefbitsread += 4; + } + $thisfile_ac3_raw_bsi['flags']['extpgmrscl'] = (bool) $this->readHeaderBSI(1); $mixdefbitsread += 1; + if ($thisfile_ac3_raw_bsi['flags']['extpgmrscl']) { + $thisfile_ac3_raw_bsi['extpgmrscl'] = $this->readHeaderBSI(4); + } + $thisfile_ac3_raw_bsi['flags']['extpgmlsscl'] = (bool) $this->readHeaderBSI(1); $mixdefbitsread += 1; + if ($thisfile_ac3_raw_bsi['flags']['extpgmlsscl']) { + $thisfile_ac3_raw_bsi['extpgmlsscl'] = $this->readHeaderBSI(4); $mixdefbitsread += 4; + } + $thisfile_ac3_raw_bsi['flags']['extpgmrsscl'] = (bool) $this->readHeaderBSI(1); $mixdefbitsread += 1; + if ($thisfile_ac3_raw_bsi['flags']['extpgmrsscl']) { + $thisfile_ac3_raw_bsi['extpgmrsscl'] = $this->readHeaderBSI(4); $mixdefbitsread += 4; + } + $thisfile_ac3_raw_bsi['flags']['extpgmlfescl'] = (bool) $this->readHeaderBSI(1); $mixdefbitsread += 1; + if ($thisfile_ac3_raw_bsi['flags']['extpgmlfescl']) { + $thisfile_ac3_raw_bsi['extpgmlfescl'] = $this->readHeaderBSI(4); $mixdefbitsread += 4; + } + $thisfile_ac3_raw_bsi['flags']['dmixscl'] = (bool) $this->readHeaderBSI(1); $mixdefbitsread += 1; + if ($thisfile_ac3_raw_bsi['flags']['dmixscl']) { + $thisfile_ac3_raw_bsi['dmixscl'] = $this->readHeaderBSI(4); $mixdefbitsread += 4; + } + $thisfile_ac3_raw_bsi['flags']['addch'] = (bool) $this->readHeaderBSI(1); $mixdefbitsread += 1; + if ($thisfile_ac3_raw_bsi['flags']['addch']) { + $thisfile_ac3_raw_bsi['flags']['extpgmaux1scl'] = (bool) $this->readHeaderBSI(1); $mixdefbitsread += 1; + if ($thisfile_ac3_raw_bsi['flags']['extpgmaux1scl']) { + $thisfile_ac3_raw_bsi['extpgmaux1scl'] = $this->readHeaderBSI(4); $mixdefbitsread += 4; + } + $thisfile_ac3_raw_bsi['flags']['extpgmaux2scl'] = (bool) $this->readHeaderBSI(1); $mixdefbitsread += 1; + if ($thisfile_ac3_raw_bsi['flags']['extpgmaux2scl']) { + $thisfile_ac3_raw_bsi['extpgmaux2scl'] = $this->readHeaderBSI(4); $mixdefbitsread += 4; + } + } + } + $thisfile_ac3_raw_bsi['flags']['mixdata3'] = (bool) $this->readHeaderBSI(1); $mixdefbitsread += 1; + if ($thisfile_ac3_raw_bsi['flags']['mixdata3']) { + $thisfile_ac3_raw_bsi['spchdat'] = $this->readHeaderBSI(5); $mixdefbitsread += 5; + $thisfile_ac3_raw_bsi['flags']['addspchdat'] = (bool) $this->readHeaderBSI(1); $mixdefbitsread += 1; + if ($thisfile_ac3_raw_bsi['flags']['addspchdat']) { + $thisfile_ac3_raw_bsi['spchdat1'] = $this->readHeaderBSI(5); $mixdefbitsread += 5; + $thisfile_ac3_raw_bsi['spchan1att'] = $this->readHeaderBSI(2); $mixdefbitsread += 2; + $thisfile_ac3_raw_bsi['flags']['addspchdat1'] = (bool) $this->readHeaderBSI(1); $mixdefbitsread += 1; + if ($thisfile_ac3_raw_bsi['flags']['addspchdat1']) { + $thisfile_ac3_raw_bsi['spchdat2'] = $this->readHeaderBSI(5); $mixdefbitsread += 5; + $thisfile_ac3_raw_bsi['spchan2att'] = $this->readHeaderBSI(3); $mixdefbitsread += 3; + } + } + } + $mixdata_bits = (8 * ($thisfile_ac3_raw_bsi['mixdeflen'] + 2)) - $mixdefbitsread; + $mixdata_fill = (($mixdata_bits % 8) ? 8 - ($mixdata_bits % 8) : 0); + $thisfile_ac3_raw_bsi['mixdata'] = $this->readHeaderBSI($mixdata_bits); + $thisfile_ac3_raw_bsi['mixdatafill'] = $this->readHeaderBSI($mixdata_fill); + unset($mixdefbitsread, $mixdata_bits, $mixdata_fill); + } + if ($thisfile_ac3_raw_bsi['acmod'] < 2) { // if mono or dual mono source + $thisfile_ac3_raw_bsi['flags']['paninfo'] = (bool) $this->readHeaderBSI(1); + if ($thisfile_ac3_raw_bsi['flags']['paninfo']) { + $thisfile_ac3_raw_bsi['panmean'] = $this->readHeaderBSI(8); + $thisfile_ac3_raw_bsi['paninfo'] = $this->readHeaderBSI(6); + } + if ($thisfile_ac3_raw_bsi['acmod'] == 0) { // if 1+1 mode (dual mono, so some items need a second value) + $thisfile_ac3_raw_bsi['flags']['paninfo2'] = (bool) $this->readHeaderBSI(1); + if ($thisfile_ac3_raw_bsi['flags']['paninfo2']) { + $thisfile_ac3_raw_bsi['panmean2'] = $this->readHeaderBSI(8); + $thisfile_ac3_raw_bsi['paninfo2'] = $this->readHeaderBSI(6); + } + } + } + $thisfile_ac3_raw_bsi['flags']['frmmixcfginfo'] = (bool) $this->readHeaderBSI(1); + if ($thisfile_ac3_raw_bsi['flags']['frmmixcfginfo']) { // mixing configuration information + if ($thisfile_ac3_raw_bsi['numblkscod'] == 0) { + $thisfile_ac3_raw_bsi['blkmixcfginfo'][0] = $this->readHeaderBSI(5); + } else { + for ($blk = 0; $blk < $thisfile_ac3_raw_bsi['numblkscod']; $blk++) { + $thisfile_ac3_raw_bsi['flags']['blkmixcfginfo'.$blk] = (bool) $this->readHeaderBSI(1); + if ($thisfile_ac3_raw_bsi['flags']['blkmixcfginfo'.$blk]) { // mixing configuration information + $thisfile_ac3_raw_bsi['blkmixcfginfo'][$blk] = $this->readHeaderBSI(5); + } + } + } + } + } + } + $thisfile_ac3_raw_bsi['flags']['infomdat'] = (bool) $this->readHeaderBSI(1); + if ($thisfile_ac3_raw_bsi['flags']['infomdat']) { // Informational metadata + $thisfile_ac3_raw_bsi['bsmod'] = $this->readHeaderBSI(3); + $thisfile_ac3_raw_bsi['flags']['copyrightb'] = (bool) $this->readHeaderBSI(1); + $thisfile_ac3_raw_bsi['flags']['origbs'] = (bool) $this->readHeaderBSI(1); + if ($thisfile_ac3_raw_bsi['acmod'] == 2) { // if in 2/0 mode + $thisfile_ac3_raw_bsi['dsurmod'] = $this->readHeaderBSI(2); + $thisfile_ac3_raw_bsi['dheadphonmod'] = $this->readHeaderBSI(2); + } + if ($thisfile_ac3_raw_bsi['acmod'] >= 6) { // if both surround channels exist + $thisfile_ac3_raw_bsi['dsurexmod'] = $this->readHeaderBSI(2); + } + $thisfile_ac3_raw_bsi['flags']['audprodi'] = (bool) $this->readHeaderBSI(1); + if ($thisfile_ac3_raw_bsi['flags']['audprodi']) { + $thisfile_ac3_raw_bsi['mixlevel'] = $this->readHeaderBSI(5); + $thisfile_ac3_raw_bsi['roomtyp'] = $this->readHeaderBSI(2); + $thisfile_ac3_raw_bsi['flags']['adconvtyp'] = (bool) $this->readHeaderBSI(1); + } + if ($thisfile_ac3_raw_bsi['acmod'] == 0) { // if 1+1 mode (dual mono, so some items need a second value) + $thisfile_ac3_raw_bsi['flags']['audprodi2'] = (bool) $this->readHeaderBSI(1); + if ($thisfile_ac3_raw_bsi['flags']['audprodi2']) { + $thisfile_ac3_raw_bsi['mixlevel2'] = $this->readHeaderBSI(5); + $thisfile_ac3_raw_bsi['roomtyp2'] = $this->readHeaderBSI(2); + $thisfile_ac3_raw_bsi['flags']['adconvtyp2'] = (bool) $this->readHeaderBSI(1); + } + } + if ($thisfile_ac3_raw_bsi['fscod'] < 3) { // if not half sample rate + $thisfile_ac3_raw_bsi['flags']['sourcefscod'] = (bool) $this->readHeaderBSI(1); + } + } + if (($thisfile_ac3_raw_bsi['strmtyp'] == 0) && ($thisfile_ac3_raw_bsi['numblkscod'] != 3)) { // if both surround channels exist + $thisfile_ac3_raw_bsi['flags']['convsync'] = (bool) $this->readHeaderBSI(1); + } + if ($thisfile_ac3_raw_bsi['strmtyp'] == 2) { // if bit stream converted from AC-3 + if ($thisfile_ac3_raw_bsi['numblkscod'] != 3) { // 6 blocks per syncframe + $thisfile_ac3_raw_bsi['flags']['blkid'] = 1; + } else { + $thisfile_ac3_raw_bsi['flags']['blkid'] = (bool) $this->readHeaderBSI(1); + } + if ($thisfile_ac3_raw_bsi['flags']['blkid']) { + $thisfile_ac3_raw_bsi['frmsizecod'] = $this->readHeaderBSI(6); + } + } + $thisfile_ac3_raw_bsi['flags']['addbsi'] = (bool) $this->readHeaderBSI(1); + if ($thisfile_ac3_raw_bsi['flags']['addbsi']) { + $thisfile_ac3_raw_bsi['addbsil'] = $this->readHeaderBSI(6); + $thisfile_ac3_raw_bsi['addbsi'] = $this->readHeaderBSI(($thisfile_ac3_raw_bsi['addbsil'] + 1) * 8); + } + + } else { + + $this->error('Bit stream identification is version '.$thisfile_ac3_raw_bsi['bsid'].', but getID3() only understands up to version 16. Please submit a support ticket with a sample file.'); + unset($info['ac3']); + return false; + + } + + if (isset($thisfile_ac3_raw_bsi['fscod2'])) { + $thisfile_ac3['sample_rate'] = self::sampleRateCodeLookup2($thisfile_ac3_raw_bsi['fscod2']); + } else { + $thisfile_ac3['sample_rate'] = self::sampleRateCodeLookup($thisfile_ac3_raw_bsi['fscod']); + } + if ($thisfile_ac3_raw_bsi['fscod'] <= 3) { + $info['audio']['sample_rate'] = $thisfile_ac3['sample_rate']; + } else { + $this->warning('Unexpected ac3.bsi.fscod value: '.$thisfile_ac3_raw_bsi['fscod']); + } + if (isset($thisfile_ac3_raw_bsi['frmsizecod'])) { + $thisfile_ac3['frame_length'] = self::frameSizeLookup($thisfile_ac3_raw_bsi['frmsizecod'], $thisfile_ac3_raw_bsi['fscod']); + $thisfile_ac3['bitrate'] = self::bitrateLookup($thisfile_ac3_raw_bsi['frmsizecod']); + } elseif (!empty($thisfile_ac3_raw_bsi['frmsiz'])) { +// this isn't right, but it's (usually) close, roughly 5% less than it should be. +// but WHERE is the actual bitrate value stored in EAC3?? email info@getid3.org if you know! + $thisfile_ac3['bitrate'] = ($thisfile_ac3_raw_bsi['frmsiz'] + 1) * 16 * 30; // The frmsiz field shall contain a value one less than the overall size of the coded syncframe in 16-bit words. That is, this field may assume a value ranging from 0 to 2047, and these values correspond to syncframe sizes ranging from 1 to 2048. +// kludge-fix to make it approximately the expected value, still not "right": +$thisfile_ac3['bitrate'] = round(($thisfile_ac3['bitrate'] * 1.05) / 16000) * 16000; + } + $info['audio']['bitrate'] = $thisfile_ac3['bitrate']; + + if (isset($thisfile_ac3_raw_bsi['bsmod']) && isset($thisfile_ac3_raw_bsi['acmod'])) { + $thisfile_ac3['service_type'] = self::serviceTypeLookup($thisfile_ac3_raw_bsi['bsmod'], $thisfile_ac3_raw_bsi['acmod']); + } + $ac3_coding_mode = self::audioCodingModeLookup($thisfile_ac3_raw_bsi['acmod']); + foreach($ac3_coding_mode as $key => $value) { + $thisfile_ac3[$key] = $value; + } + switch ($thisfile_ac3_raw_bsi['acmod']) { + case 0: + case 1: + $info['audio']['channelmode'] = 'mono'; + break; + case 3: + case 4: + $info['audio']['channelmode'] = 'stereo'; + break; + default: + $info['audio']['channelmode'] = 'surround'; + break; + } + $info['audio']['channels'] = $thisfile_ac3['num_channels']; + + $thisfile_ac3['lfe_enabled'] = $thisfile_ac3_raw_bsi['flags']['lfeon']; + if ($thisfile_ac3_raw_bsi['flags']['lfeon']) { + $info['audio']['channels'] .= '.1'; + } + + $thisfile_ac3['channels_enabled'] = self::channelsEnabledLookup($thisfile_ac3_raw_bsi['acmod'], $thisfile_ac3_raw_bsi['flags']['lfeon']); + $thisfile_ac3['dialogue_normalization'] = '-'.$thisfile_ac3_raw_bsi['dialnorm'].'dB'; + + return true; + } + + private function readHeaderBSI($length) { + $data = substr($this->AC3header['bsi'], $this->BSIoffset, $length); + $this->BSIoffset += $length; + + return bindec($data); + } + + public static function sampleRateCodeLookup($fscod) { + static $sampleRateCodeLookup = array( + 0 => 48000, + 1 => 44100, + 2 => 32000, + 3 => 'reserved' // If the reserved code is indicated, the decoder should not attempt to decode audio and should mute. + ); + return (isset($sampleRateCodeLookup[$fscod]) ? $sampleRateCodeLookup[$fscod] : false); + } + + public static function sampleRateCodeLookup2($fscod2) { + static $sampleRateCodeLookup2 = array( + 0 => 24000, + 1 => 22050, + 2 => 16000, + 3 => 'reserved' // If the reserved code is indicated, the decoder should not attempt to decode audio and should mute. + ); + return (isset($sampleRateCodeLookup2[$fscod2]) ? $sampleRateCodeLookup2[$fscod2] : false); + } + + public static function serviceTypeLookup($bsmod, $acmod) { + static $serviceTypeLookup = array(); + if (empty($serviceTypeLookup)) { + for ($i = 0; $i <= 7; $i++) { + $serviceTypeLookup[0][$i] = 'main audio service: complete main (CM)'; + $serviceTypeLookup[1][$i] = 'main audio service: music and effects (ME)'; + $serviceTypeLookup[2][$i] = 'associated service: visually impaired (VI)'; + $serviceTypeLookup[3][$i] = 'associated service: hearing impaired (HI)'; + $serviceTypeLookup[4][$i] = 'associated service: dialogue (D)'; + $serviceTypeLookup[5][$i] = 'associated service: commentary (C)'; + $serviceTypeLookup[6][$i] = 'associated service: emergency (E)'; + } + + $serviceTypeLookup[7][1] = 'associated service: voice over (VO)'; + for ($i = 2; $i <= 7; $i++) { + $serviceTypeLookup[7][$i] = 'main audio service: karaoke'; + } + } + return (isset($serviceTypeLookup[$bsmod][$acmod]) ? $serviceTypeLookup[$bsmod][$acmod] : false); + } + + public static function audioCodingModeLookup($acmod) { + // array(channel configuration, # channels (not incl LFE), channel order) + static $audioCodingModeLookup = array ( + 0 => array('channel_config'=>'1+1', 'num_channels'=>2, 'channel_order'=>'Ch1,Ch2'), + 1 => array('channel_config'=>'1/0', 'num_channels'=>1, 'channel_order'=>'C'), + 2 => array('channel_config'=>'2/0', 'num_channels'=>2, 'channel_order'=>'L,R'), + 3 => array('channel_config'=>'3/0', 'num_channels'=>3, 'channel_order'=>'L,C,R'), + 4 => array('channel_config'=>'2/1', 'num_channels'=>3, 'channel_order'=>'L,R,S'), + 5 => array('channel_config'=>'3/1', 'num_channels'=>4, 'channel_order'=>'L,C,R,S'), + 6 => array('channel_config'=>'2/2', 'num_channels'=>4, 'channel_order'=>'L,R,SL,SR'), + 7 => array('channel_config'=>'3/2', 'num_channels'=>5, 'channel_order'=>'L,C,R,SL,SR'), + ); + return (isset($audioCodingModeLookup[$acmod]) ? $audioCodingModeLookup[$acmod] : false); + } + + public static function centerMixLevelLookup($cmixlev) { + static $centerMixLevelLookup; + if (empty($centerMixLevelLookup)) { + $centerMixLevelLookup = array( + 0 => pow(2, -3.0 / 6), // 0.707 (-3.0 dB) + 1 => pow(2, -4.5 / 6), // 0.595 (-4.5 dB) + 2 => pow(2, -6.0 / 6), // 0.500 (-6.0 dB) + 3 => 'reserved' + ); + } + return (isset($centerMixLevelLookup[$cmixlev]) ? $centerMixLevelLookup[$cmixlev] : false); + } + + public static function surroundMixLevelLookup($surmixlev) { + static $surroundMixLevelLookup; + if (empty($surroundMixLevelLookup)) { + $surroundMixLevelLookup = array( + 0 => pow(2, -3.0 / 6), + 1 => pow(2, -6.0 / 6), + 2 => 0, + 3 => 'reserved' + ); + } + return (isset($surroundMixLevelLookup[$surmixlev]) ? $surroundMixLevelLookup[$surmixlev] : false); + } + + public static function dolbySurroundModeLookup($dsurmod) { + static $dolbySurroundModeLookup = array( + 0 => 'not indicated', + 1 => 'Not Dolby Surround encoded', + 2 => 'Dolby Surround encoded', + 3 => 'reserved' + ); + return (isset($dolbySurroundModeLookup[$dsurmod]) ? $dolbySurroundModeLookup[$dsurmod] : false); + } + + public static function channelsEnabledLookup($acmod, $lfeon) { + $lookup = array( + 'ch1'=>(bool) ($acmod == 0), + 'ch2'=>(bool) ($acmod == 0), + 'left'=>(bool) ($acmod > 1), + 'right'=>(bool) ($acmod > 1), + 'center'=>(bool) ($acmod & 0x01), + 'surround_mono'=>false, + 'surround_left'=>false, + 'surround_right'=>false, + 'lfe'=>$lfeon); + switch ($acmod) { + case 4: + case 5: + $lookup['surround_mono'] = true; + break; + case 6: + case 7: + $lookup['surround_left'] = true; + $lookup['surround_right'] = true; + break; + } + return $lookup; + } + + public static function heavyCompression($compre) { + // The first four bits indicate gain changes in 6.02dB increments which can be + // implemented with an arithmetic shift operation. The following four bits + // indicate linear gain changes, and require a 5-bit multiply. + // We will represent the two 4-bit fields of compr as follows: + // X0 X1 X2 X3 . Y4 Y5 Y6 Y7 + // The meaning of the X values is most simply described by considering X to represent a 4-bit + // signed integer with values from -8 to +7. The gain indicated by X is then (X + 1) * 6.02 dB. The + // following table shows this in detail. + + // Meaning of 4 msb of compr + // 7 +48.16 dB + // 6 +42.14 dB + // 5 +36.12 dB + // 4 +30.10 dB + // 3 +24.08 dB + // 2 +18.06 dB + // 1 +12.04 dB + // 0 +6.02 dB + // -1 0 dB + // -2 -6.02 dB + // -3 -12.04 dB + // -4 -18.06 dB + // -5 -24.08 dB + // -6 -30.10 dB + // -7 -36.12 dB + // -8 -42.14 dB + + $fourbit = str_pad(decbin(($compre & 0xF0) >> 4), 4, '0', STR_PAD_LEFT); + if ($fourbit{0} == '1') { + $log_gain = -8 + bindec(substr($fourbit, 1)); + } else { + $log_gain = bindec(substr($fourbit, 1)); + } + $log_gain = ($log_gain + 1) * getid3_lib::RGADamplitude2dB(2); + + // The value of Y is a linear representation of a gain change of up to -6 dB. Y is considered to + // be an unsigned fractional integer, with a leading value of 1, or: 0.1 Y4 Y5 Y6 Y7 (base 2). Y can + // represent values between 0.111112 (or 31/32) and 0.100002 (or 1/2). Thus, Y can represent gain + // changes from -0.28 dB to -6.02 dB. + + $lin_gain = (16 + ($compre & 0x0F)) / 32; + + // The combination of X and Y values allows compr to indicate gain changes from + // 48.16 - 0.28 = +47.89 dB, to + // -42.14 - 6.02 = -48.16 dB. + + return $log_gain - $lin_gain; + } + + public static function roomTypeLookup($roomtyp) { + static $roomTypeLookup = array( + 0 => 'not indicated', + 1 => 'large room, X curve monitor', + 2 => 'small room, flat monitor', + 3 => 'reserved' + ); + return (isset($roomTypeLookup[$roomtyp]) ? $roomTypeLookup[$roomtyp] : false); + } + + public static function frameSizeLookup($frmsizecod, $fscod) { + // LSB is whether padding is used or not + $padding = (bool) ($frmsizecod & 0x01); + $framesizeid = ($frmsizecod & 0x3E) >> 1; + + static $frameSizeLookup = array(); + if (empty($frameSizeLookup)) { + $frameSizeLookup = array ( + 0 => array( 128, 138, 192), // 32 kbps + 1 => array( 160, 174, 240), // 40 kbps + 2 => array( 192, 208, 288), // 48 kbps + 3 => array( 224, 242, 336), // 56 kbps + 4 => array( 256, 278, 384), // 64 kbps + 5 => array( 320, 348, 480), // 80 kbps + 6 => array( 384, 416, 576), // 96 kbps + 7 => array( 448, 486, 672), // 112 kbps + 8 => array( 512, 556, 768), // 128 kbps + 9 => array( 640, 696, 960), // 160 kbps + 10 => array( 768, 834, 1152), // 192 kbps + 11 => array( 896, 974, 1344), // 224 kbps + 12 => array(1024, 1114, 1536), // 256 kbps + 13 => array(1280, 1392, 1920), // 320 kbps + 14 => array(1536, 1670, 2304), // 384 kbps + 15 => array(1792, 1950, 2688), // 448 kbps + 16 => array(2048, 2228, 3072), // 512 kbps + 17 => array(2304, 2506, 3456), // 576 kbps + 18 => array(2560, 2786, 3840) // 640 kbps + ); + } + if (($fscod == 1) && $padding) { + // frame lengths are padded by 1 word (16 bits) at 44100 + $frameSizeLookup[$frmsizecod] += 2; + } + return (isset($frameSizeLookup[$framesizeid][$fscod]) ? $frameSizeLookup[$framesizeid][$fscod] : false); + } + + public static function bitrateLookup($frmsizecod) { + // LSB is whether padding is used or not + $padding = (bool) ($frmsizecod & 0x01); + $framesizeid = ($frmsizecod & 0x3E) >> 1; + + static $bitrateLookup = array( + 0 => 32000, + 1 => 40000, + 2 => 48000, + 3 => 56000, + 4 => 64000, + 5 => 80000, + 6 => 96000, + 7 => 112000, + 8 => 128000, + 9 => 160000, + 10 => 192000, + 11 => 224000, + 12 => 256000, + 13 => 320000, + 14 => 384000, + 15 => 448000, + 16 => 512000, + 17 => 576000, + 18 => 640000, + ); + return (isset($bitrateLookup[$framesizeid]) ? $bitrateLookup[$framesizeid] : false); + } + + public static function blocksPerSyncFrame($numblkscod) { + static $blocksPerSyncFrameLookup = array( + 0 => 1, + 1 => 2, + 2 => 3, + 3 => 6, + ); + return (isset($blocksPerSyncFrameLookup[$numblkscod]) ? $blocksPerSyncFrameLookup[$numblkscod] : false); + } + + +} diff --git a/www/rompr/getid3/module.audio.amr.php b/www/rompr/getid3/module.audio.amr.php new file mode 100755 index 0000000..ff50579 --- /dev/null +++ b/www/rompr/getid3/module.audio.amr.php @@ -0,0 +1,96 @@ + // +// available at http://getid3.sourceforge.net // +// or http://www.getid3.org // +// also https://github.com/JamesHeinrich/getID3 // +///////////////////////////////////////////////////////////////// +// See readme.txt for more details // +///////////////////////////////////////////////////////////////// +// // +// module.audio.aa.php // +// module for analyzing Audible Audiobook files // +// dependencies: NONE // +// /// +///////////////////////////////////////////////////////////////// + + +class getid3_amr extends getid3_handler +{ + + public function Analyze() { + $info = &$this->getid3->info; + + $this->fseek($info['avdataoffset']); + $AMRheader = $this->fread(6); + + $magic = '#!AMR'."\x0A"; + if (substr($AMRheader, 0, 6) != $magic) { + $this->error('Expecting "'.getid3_lib::PrintHexBytes($magic).'" at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes(substr($AMRheader, 0, 6)).'"'); + return false; + } + + // shortcut + $info['amr'] = array(); + $thisfile_amr = &$info['amr']; + + $info['fileformat'] = 'amr'; + $info['audio']['dataformat'] = 'amr'; + $info['audio']['bitrate_mode'] = 'vbr'; // within a small predefined range: 4.75kbps to 12.2kbps + $info['audio']['bits_per_sample'] = 13; // http://en.wikipedia.org/wiki/Adaptive_Multi-Rate_audio_codec: "Sampling frequency 8 kHz/13-bit (160 samples for 20 ms frames), filtered to 200–3400 Hz" + $info['audio']['sample_rate'] = 8000; // http://en.wikipedia.org/wiki/Adaptive_Multi-Rate_audio_codec: "Sampling frequency 8 kHz/13-bit (160 samples for 20 ms frames), filtered to 200–3400 Hz" + $info['audio']['channels'] = 1; + $thisfile_amr['frame_mode_count'] = array(0=>0, 1=>0, 2=>0, 3=>0, 4=>0, 5=>0, 6=>0, 7=>0); + + $buffer = ''; + do { + if ((strlen($buffer) < $this->getid3->fread_buffer_size()) && !feof($this->getid3->fp)) { + $buffer .= $this->fread($this->getid3->fread_buffer_size() * 2); + } + $AMR_frame_header = ord(substr($buffer, 0, 1)); + $codec_mode_request = ($AMR_frame_header & 0x78) >> 3; // The 2nd bit through 5th bit (counting the most significant bit as the first bit) comprise the CMR (Codec Mode Request), values 0-7 being valid for AMR. The top bit of the CMR can actually be ignored, though it is used when AMR forms RTP payloads. The lower 3-bits of the header are reserved and are not used. Viewing the header from most significant bit to least significant bit, the encoding is XCCCCXXX, where Xs are reserved (typically 0) and the Cs are the CMR. + if ($codec_mode_request > 7) { + break; + } + $thisfile_amr['frame_mode_count'][$codec_mode_request]++; + $buffer = substr($buffer, $this->amr_mode_bytes_per_frame($codec_mode_request)); + } while (strlen($buffer) > 0); + + $info['playtime_seconds'] = array_sum($thisfile_amr['frame_mode_count']) * 0.020; // each frame contain 160 samples and is 20 milliseconds long + $info['audio']['bitrate'] = (8 * ($info['avdataend'] - $info['avdataoffset'])) / $info['playtime_seconds']; // bitrate could be calculated from average bitrate by distributation of frame types. That would give effective audio bitrate, this gives overall file bitrate which will be a little bit higher since every frame will waste 8 bits for header, plus a few bits for octet padding + $info['bitrate'] = $info['audio']['bitrate']; + + return true; + } + + + public function amr_mode_bitrate($key) { + static $amr_mode_bitrate = array( + 0 => 4750, + 1 => 5150, + 2 => 5900, + 3 => 6700, + 4 => 7400, + 5 => 7950, + 6 => 10200, + 7 => 12200, + ); + return (isset($amr_mode_bitrate[$key]) ? $amr_mode_bitrate[$key] : false); + } + + public function amr_mode_bytes_per_frame($key) { + static $amr_mode_bitrate = array( + 0 => 13, // 1-byte frame header + 95 bits [padded to: 12 bytes] audio data + 1 => 14, // 1-byte frame header + 103 bits [padded to: 13 bytes] audio data + 2 => 16, // 1-byte frame header + 118 bits [padded to: 15 bytes] audio data + 3 => 18, // 1-byte frame header + 134 bits [padded to: 17 bytes] audio data + 4 => 20, // 1-byte frame header + 148 bits [padded to: 19 bytes] audio data + 5 => 21, // 1-byte frame header + 159 bits [padded to: 20 bytes] audio data + 6 => 27, // 1-byte frame header + 204 bits [padded to: 26 bytes] audio data + 7 => 32, // 1-byte frame header + 244 bits [padded to: 31 bytes] audio data + ); + return (isset($amr_mode_bitrate[$key]) ? $amr_mode_bitrate[$key] : false); + } + + +} diff --git a/www/rompr/getid3/module.audio.au.php b/www/rompr/getid3/module.audio.au.php new file mode 100644 index 0000000..075ee8c --- /dev/null +++ b/www/rompr/getid3/module.audio.au.php @@ -0,0 +1,163 @@ + // +// available at http://getid3.sourceforge.net // +// or http://www.getid3.org // +// also https://github.com/JamesHeinrich/getID3 // +///////////////////////////////////////////////////////////////// +// See readme.txt for more details // +///////////////////////////////////////////////////////////////// +// // +// module.audio.au.php // +// module for analyzing AU files // +// dependencies: NONE // +// /// +///////////////////////////////////////////////////////////////// + + +class getid3_au extends getid3_handler +{ + + public function Analyze() { + $info = &$this->getid3->info; + + $this->fseek($info['avdataoffset']); + $AUheader = $this->fread(8); + + $magic = '.snd'; + if (substr($AUheader, 0, 4) != $magic) { + $this->error('Expecting "'.getid3_lib::PrintHexBytes($magic).'" (".snd") at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes(substr($AUheader, 0, 4)).'"'); + return false; + } + + // shortcut + $info['au'] = array(); + $thisfile_au = &$info['au']; + + $info['fileformat'] = 'au'; + $info['audio']['dataformat'] = 'au'; + $info['audio']['bitrate_mode'] = 'cbr'; + $thisfile_au['encoding'] = 'ISO-8859-1'; + + $thisfile_au['header_length'] = getid3_lib::BigEndian2Int(substr($AUheader, 4, 4)); + $AUheader .= $this->fread($thisfile_au['header_length'] - 8); + $info['avdataoffset'] += $thisfile_au['header_length']; + + $thisfile_au['data_size'] = getid3_lib::BigEndian2Int(substr($AUheader, 8, 4)); + $thisfile_au['data_format_id'] = getid3_lib::BigEndian2Int(substr($AUheader, 12, 4)); + $thisfile_au['sample_rate'] = getid3_lib::BigEndian2Int(substr($AUheader, 16, 4)); + $thisfile_au['channels'] = getid3_lib::BigEndian2Int(substr($AUheader, 20, 4)); + $thisfile_au['comments']['comment'][] = trim(substr($AUheader, 24)); + + $thisfile_au['data_format'] = $this->AUdataFormatNameLookup($thisfile_au['data_format_id']); + $thisfile_au['used_bits_per_sample'] = $this->AUdataFormatUsedBitsPerSampleLookup($thisfile_au['data_format_id']); + if ($thisfile_au['bits_per_sample'] = $this->AUdataFormatBitsPerSampleLookup($thisfile_au['data_format_id'])) { + $info['audio']['bits_per_sample'] = $thisfile_au['bits_per_sample']; + } else { + unset($thisfile_au['bits_per_sample']); + } + + $info['audio']['sample_rate'] = $thisfile_au['sample_rate']; + $info['audio']['channels'] = $thisfile_au['channels']; + + if (($info['avdataoffset'] + $thisfile_au['data_size']) > $info['avdataend']) { + $this->warning('Possible truncated file - expecting "'.$thisfile_au['data_size'].'" bytes of audio data, only found '.($info['avdataend'] - $info['avdataoffset']).' bytes"'); + } + + $info['playtime_seconds'] = $thisfile_au['data_size'] / ($thisfile_au['sample_rate'] * $thisfile_au['channels'] * ($thisfile_au['used_bits_per_sample'] / 8)); + $info['audio']['bitrate'] = ($thisfile_au['data_size'] * 8) / $info['playtime_seconds']; + + return true; + } + + public function AUdataFormatNameLookup($id) { + static $AUdataFormatNameLookup = array( + 0 => 'unspecified format', + 1 => '8-bit mu-law', + 2 => '8-bit linear', + 3 => '16-bit linear', + 4 => '24-bit linear', + 5 => '32-bit linear', + 6 => 'floating-point', + 7 => 'double-precision float', + 8 => 'fragmented sampled data', + 9 => 'SUN_FORMAT_NESTED', + 10 => 'DSP program', + 11 => '8-bit fixed-point', + 12 => '16-bit fixed-point', + 13 => '24-bit fixed-point', + 14 => '32-bit fixed-point', + + 16 => 'non-audio display data', + 17 => 'SND_FORMAT_MULAW_SQUELCH', + 18 => '16-bit linear with emphasis', + 19 => '16-bit linear with compression', + 20 => '16-bit linear with emphasis + compression', + 21 => 'Music Kit DSP commands', + 22 => 'SND_FORMAT_DSP_COMMANDS_SAMPLES', + 23 => 'CCITT g.721 4-bit ADPCM', + 24 => 'CCITT g.722 ADPCM', + 25 => 'CCITT g.723 3-bit ADPCM', + 26 => 'CCITT g.723 5-bit ADPCM', + 27 => 'A-Law 8-bit' + ); + return (isset($AUdataFormatNameLookup[$id]) ? $AUdataFormatNameLookup[$id] : false); + } + + public function AUdataFormatBitsPerSampleLookup($id) { + static $AUdataFormatBitsPerSampleLookup = array( + 1 => 8, + 2 => 8, + 3 => 16, + 4 => 24, + 5 => 32, + 6 => 32, + 7 => 64, + + 11 => 8, + 12 => 16, + 13 => 24, + 14 => 32, + + 18 => 16, + 19 => 16, + 20 => 16, + + 23 => 16, + + 25 => 16, + 26 => 16, + 27 => 8 + ); + return (isset($AUdataFormatBitsPerSampleLookup[$id]) ? $AUdataFormatBitsPerSampleLookup[$id] : false); + } + + public function AUdataFormatUsedBitsPerSampleLookup($id) { + static $AUdataFormatUsedBitsPerSampleLookup = array( + 1 => 8, + 2 => 8, + 3 => 16, + 4 => 24, + 5 => 32, + 6 => 32, + 7 => 64, + + 11 => 8, + 12 => 16, + 13 => 24, + 14 => 32, + + 18 => 16, + 19 => 16, + 20 => 16, + + 23 => 4, + + 25 => 3, + 26 => 5, + 27 => 8, + ); + return (isset($AUdataFormatUsedBitsPerSampleLookup[$id]) ? $AUdataFormatUsedBitsPerSampleLookup[$id] : false); + } + +} diff --git a/www/rompr/getid3/module.audio.avr.php b/www/rompr/getid3/module.audio.avr.php new file mode 100644 index 0000000..98666cf --- /dev/null +++ b/www/rompr/getid3/module.audio.avr.php @@ -0,0 +1,125 @@ + // +// available at http://getid3.sourceforge.net // +// or http://www.getid3.org // +// also https://github.com/JamesHeinrich/getID3 // +///////////////////////////////////////////////////////////////// +// See readme.txt for more details // +///////////////////////////////////////////////////////////////// +// // +// module.audio.avr.php // +// module for analyzing AVR Audio files // +// dependencies: NONE // +// /// +///////////////////////////////////////////////////////////////// + + +class getid3_avr extends getid3_handler +{ + + public function Analyze() { + $info = &$this->getid3->info; + + // http://cui.unige.ch/OSG/info/AudioFormats/ap11.html + // http://www.btinternet.com/~AnthonyJ/Atari/programming/avr_format.html + // offset type length name comments + // --------------------------------------------------------------------- + // 0 char 4 ID format ID == "2BIT" + // 4 char 8 name sample name (unused space filled with 0) + // 12 short 1 mono/stereo 0=mono, -1 (0xFFFF)=stereo + // With stereo, samples are alternated, + // the first voice is the left : + // (LRLRLRLRLRLRLRLRLR...) + // 14 short 1 resolution 8, 12 or 16 (bits) + // 16 short 1 signed or not 0=unsigned, -1 (0xFFFF)=signed + // 18 short 1 loop or not 0=no loop, -1 (0xFFFF)=loop on + // 20 short 1 MIDI note 0xFFnn, where 0 <= nn <= 127 + // 0xFFFF means "no MIDI note defined" + // 22 byte 1 Replay speed Frequence in the Replay software + // 0=5.485 Khz, 1=8.084 Khz, 2=10.971 Khz, + // 3=16.168 Khz, 4=21.942 Khz, 5=32.336 Khz + // 6=43.885 Khz, 7=47.261 Khz + // -1 (0xFF)=no defined Frequence + // 23 byte 3 sample rate in Hertz + // 26 long 1 size in bytes (2 * bytes in stereo) + // 30 long 1 loop begin 0 for no loop + // 34 long 1 loop size equal to 'size' for no loop + // 38 short 2 Reserved, MIDI keyboard split */ + // 40 short 2 Reserved, sample compression */ + // 42 short 2 Reserved */ + // 44 char 20; Additional filename space, used if (name[7] != 0) + // 64 byte 64 user data + // 128 bytes ? sample data (12 bits samples are coded on 16 bits: + // 0000 xxxx xxxx xxxx) + // --------------------------------------------------------------------- + + // Note that all values are in motorola (big-endian) format, and that long is + // assumed to be 4 bytes, and short 2 bytes. + // When reading the samples, you should handle both signed and unsigned data, + // and be prepared to convert 16->8 bit, or mono->stereo if needed. To convert + // 8-bit data between signed/unsigned just add 127 to the sample values. + // Simularly for 16-bit data you should add 32769 + + $info['fileformat'] = 'avr'; + + $this->fseek($info['avdataoffset']); + $AVRheader = $this->fread(128); + + $info['avr']['raw']['magic'] = substr($AVRheader, 0, 4); + $magic = '2BIT'; + if ($info['avr']['raw']['magic'] != $magic) { + $this->error('Expecting "'.getid3_lib::PrintHexBytes($magic).'" at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes($info['avr']['raw']['magic']).'"'); + unset($info['fileformat']); + unset($info['avr']); + return false; + } + $info['avdataoffset'] += 128; + + $info['avr']['sample_name'] = rtrim(substr($AVRheader, 4, 8)); + $info['avr']['raw']['mono'] = getid3_lib::BigEndian2Int(substr($AVRheader, 12, 2)); + $info['avr']['bits_per_sample'] = getid3_lib::BigEndian2Int(substr($AVRheader, 14, 2)); + $info['avr']['raw']['signed'] = getid3_lib::BigEndian2Int(substr($AVRheader, 16, 2)); + $info['avr']['raw']['loop'] = getid3_lib::BigEndian2Int(substr($AVRheader, 18, 2)); + $info['avr']['raw']['midi'] = getid3_lib::BigEndian2Int(substr($AVRheader, 20, 2)); + $info['avr']['raw']['replay_freq'] = getid3_lib::BigEndian2Int(substr($AVRheader, 22, 1)); + $info['avr']['sample_rate'] = getid3_lib::BigEndian2Int(substr($AVRheader, 23, 3)); + $info['avr']['sample_length'] = getid3_lib::BigEndian2Int(substr($AVRheader, 26, 4)); + $info['avr']['loop_start'] = getid3_lib::BigEndian2Int(substr($AVRheader, 30, 4)); + $info['avr']['loop_end'] = getid3_lib::BigEndian2Int(substr($AVRheader, 34, 4)); + $info['avr']['midi_split'] = getid3_lib::BigEndian2Int(substr($AVRheader, 38, 2)); + $info['avr']['sample_compression'] = getid3_lib::BigEndian2Int(substr($AVRheader, 40, 2)); + $info['avr']['reserved'] = getid3_lib::BigEndian2Int(substr($AVRheader, 42, 2)); + $info['avr']['sample_name_extra'] = rtrim(substr($AVRheader, 44, 20)); + $info['avr']['comment'] = rtrim(substr($AVRheader, 64, 64)); + + $info['avr']['flags']['stereo'] = (($info['avr']['raw']['mono'] == 0) ? false : true); + $info['avr']['flags']['signed'] = (($info['avr']['raw']['signed'] == 0) ? false : true); + $info['avr']['flags']['loop'] = (($info['avr']['raw']['loop'] == 0) ? false : true); + + $info['avr']['midi_notes'] = array(); + if (($info['avr']['raw']['midi'] & 0xFF00) != 0xFF00) { + $info['avr']['midi_notes'][] = ($info['avr']['raw']['midi'] & 0xFF00) >> 8; + } + if (($info['avr']['raw']['midi'] & 0x00FF) != 0x00FF) { + $info['avr']['midi_notes'][] = ($info['avr']['raw']['midi'] & 0x00FF); + } + + if (($info['avdataend'] - $info['avdataoffset']) != ($info['avr']['sample_length'] * (($info['avr']['bits_per_sample'] == 8) ? 1 : 2))) { + $this->warning('Probable truncated file: expecting '.($info['avr']['sample_length'] * (($info['avr']['bits_per_sample'] == 8) ? 1 : 2)).' bytes of audio data, found '.($info['avdataend'] - $info['avdataoffset'])); + } + + $info['audio']['dataformat'] = 'avr'; + $info['audio']['lossless'] = true; + $info['audio']['bitrate_mode'] = 'cbr'; + $info['audio']['bits_per_sample'] = $info['avr']['bits_per_sample']; + $info['audio']['sample_rate'] = $info['avr']['sample_rate']; + $info['audio']['channels'] = ($info['avr']['flags']['stereo'] ? 2 : 1); + $info['playtime_seconds'] = ($info['avr']['sample_length'] / $info['audio']['channels']) / $info['avr']['sample_rate']; + $info['audio']['bitrate'] = ($info['avr']['sample_length'] * (($info['avr']['bits_per_sample'] == 8) ? 8 : 16)) / $info['playtime_seconds']; + + + return true; + } + +} diff --git a/www/rompr/getid3/module.audio.bonk.php b/www/rompr/getid3/module.audio.bonk.php new file mode 100644 index 0000000..f314a9f --- /dev/null +++ b/www/rompr/getid3/module.audio.bonk.php @@ -0,0 +1,228 @@ + // +// available at http://getid3.sourceforge.net // +// or http://www.getid3.org // +// also https://github.com/JamesHeinrich/getID3 // +///////////////////////////////////////////////////////////////// +// See readme.txt for more details // +///////////////////////////////////////////////////////////////// +// // +// module.audio.la.php // +// module for analyzing BONK audio files // +// dependencies: module.tag.id3v2.php (optional) // +// /// +///////////////////////////////////////////////////////////////// + + +class getid3_bonk extends getid3_handler +{ + public function Analyze() { + $info = &$this->getid3->info; + + // shortcut + $info['bonk'] = array(); + $thisfile_bonk = &$info['bonk']; + + $thisfile_bonk['dataoffset'] = $info['avdataoffset']; + $thisfile_bonk['dataend'] = $info['avdataend']; + + if (!getid3_lib::intValueSupported($thisfile_bonk['dataend'])) { + + $this->warning('Unable to parse BONK file from end (v0.6+ preferred method) because PHP filesystem functions only support up to '.round(PHP_INT_MAX / 1073741824).'GB'); + + } else { + + // scan-from-end method, for v0.6 and higher + $this->fseek($thisfile_bonk['dataend'] - 8); + $PossibleBonkTag = $this->fread(8); + while ($this->BonkIsValidTagName(substr($PossibleBonkTag, 4, 4), true)) { + $BonkTagSize = getid3_lib::LittleEndian2Int(substr($PossibleBonkTag, 0, 4)); + $this->fseek(0 - $BonkTagSize, SEEK_CUR); + $BonkTagOffset = $this->ftell(); + $TagHeaderTest = $this->fread(5); + if (($TagHeaderTest{0} != "\x00") || (substr($PossibleBonkTag, 4, 4) != strtolower(substr($PossibleBonkTag, 4, 4)))) { + $this->error('Expecting "'.getid3_lib::PrintHexBytes("\x00".strtoupper(substr($PossibleBonkTag, 4, 4))).'" at offset '.$BonkTagOffset.', found "'.getid3_lib::PrintHexBytes($TagHeaderTest).'"'); + return false; + } + $BonkTagName = substr($TagHeaderTest, 1, 4); + + $thisfile_bonk[$BonkTagName]['size'] = $BonkTagSize; + $thisfile_bonk[$BonkTagName]['offset'] = $BonkTagOffset; + $this->HandleBonkTags($BonkTagName); + $NextTagEndOffset = $BonkTagOffset - 8; + if ($NextTagEndOffset < $thisfile_bonk['dataoffset']) { + if (empty($info['audio']['encoder'])) { + $info['audio']['encoder'] = 'Extended BONK v0.9+'; + } + return true; + } + $this->fseek($NextTagEndOffset); + $PossibleBonkTag = $this->fread(8); + } + + } + + // seek-from-beginning method for v0.4 and v0.5 + if (empty($thisfile_bonk['BONK'])) { + $this->fseek($thisfile_bonk['dataoffset']); + do { + $TagHeaderTest = $this->fread(5); + switch ($TagHeaderTest) { + case "\x00".'BONK': + if (empty($info['audio']['encoder'])) { + $info['audio']['encoder'] = 'BONK v0.4'; + } + break; + + case "\x00".'INFO': + $info['audio']['encoder'] = 'Extended BONK v0.5'; + break; + + default: + break 2; + } + $BonkTagName = substr($TagHeaderTest, 1, 4); + $thisfile_bonk[$BonkTagName]['size'] = $thisfile_bonk['dataend'] - $thisfile_bonk['dataoffset']; + $thisfile_bonk[$BonkTagName]['offset'] = $thisfile_bonk['dataoffset']; + $this->HandleBonkTags($BonkTagName); + + } while (true); + } + + // parse META block for v0.6 - v0.8 + if (empty($thisfile_bonk['INFO']) && isset($thisfile_bonk['META']['tags']['info'])) { + $this->fseek($thisfile_bonk['META']['tags']['info']); + $TagHeaderTest = $this->fread(5); + if ($TagHeaderTest == "\x00".'INFO') { + $info['audio']['encoder'] = 'Extended BONK v0.6 - v0.8'; + + $BonkTagName = substr($TagHeaderTest, 1, 4); + $thisfile_bonk[$BonkTagName]['size'] = $thisfile_bonk['dataend'] - $thisfile_bonk['dataoffset']; + $thisfile_bonk[$BonkTagName]['offset'] = $thisfile_bonk['dataoffset']; + $this->HandleBonkTags($BonkTagName); + } + } + + if (empty($info['audio']['encoder'])) { + $info['audio']['encoder'] = 'Extended BONK v0.9+'; + } + if (empty($thisfile_bonk['BONK'])) { + unset($info['bonk']); + } + return true; + + } + + public function HandleBonkTags($BonkTagName) { + $info = &$this->getid3->info; + switch ($BonkTagName) { + case 'BONK': + // shortcut + $thisfile_bonk_BONK = &$info['bonk']['BONK']; + + $BonkData = "\x00".'BONK'.$this->fread(17); + $thisfile_bonk_BONK['version'] = getid3_lib::LittleEndian2Int(substr($BonkData, 5, 1)); + $thisfile_bonk_BONK['number_samples'] = getid3_lib::LittleEndian2Int(substr($BonkData, 6, 4)); + $thisfile_bonk_BONK['sample_rate'] = getid3_lib::LittleEndian2Int(substr($BonkData, 10, 4)); + + $thisfile_bonk_BONK['channels'] = getid3_lib::LittleEndian2Int(substr($BonkData, 14, 1)); + $thisfile_bonk_BONK['lossless'] = (bool) getid3_lib::LittleEndian2Int(substr($BonkData, 15, 1)); + $thisfile_bonk_BONK['joint_stereo'] = (bool) getid3_lib::LittleEndian2Int(substr($BonkData, 16, 1)); + $thisfile_bonk_BONK['number_taps'] = getid3_lib::LittleEndian2Int(substr($BonkData, 17, 2)); + $thisfile_bonk_BONK['downsampling_ratio'] = getid3_lib::LittleEndian2Int(substr($BonkData, 19, 1)); + $thisfile_bonk_BONK['samples_per_packet'] = getid3_lib::LittleEndian2Int(substr($BonkData, 20, 2)); + + $info['avdataoffset'] = $thisfile_bonk_BONK['offset'] + 5 + 17; + $info['avdataend'] = $thisfile_bonk_BONK['offset'] + $thisfile_bonk_BONK['size']; + + $info['fileformat'] = 'bonk'; + $info['audio']['dataformat'] = 'bonk'; + $info['audio']['bitrate_mode'] = 'vbr'; // assumed + $info['audio']['channels'] = $thisfile_bonk_BONK['channels']; + $info['audio']['sample_rate'] = $thisfile_bonk_BONK['sample_rate']; + $info['audio']['channelmode'] = ($thisfile_bonk_BONK['joint_stereo'] ? 'joint stereo' : 'stereo'); + $info['audio']['lossless'] = $thisfile_bonk_BONK['lossless']; + $info['audio']['codec'] = 'bonk'; + + $info['playtime_seconds'] = $thisfile_bonk_BONK['number_samples'] / ($thisfile_bonk_BONK['sample_rate'] * $thisfile_bonk_BONK['channels']); + if ($info['playtime_seconds'] > 0) { + $info['audio']['bitrate'] = (($info['bonk']['dataend'] - $info['bonk']['dataoffset']) * 8) / $info['playtime_seconds']; + } + break; + + case 'INFO': + // shortcut + $thisfile_bonk_INFO = &$info['bonk']['INFO']; + + $thisfile_bonk_INFO['version'] = getid3_lib::LittleEndian2Int($this->fread(1)); + $thisfile_bonk_INFO['entries_count'] = 0; + $NextInfoDataPair = $this->fread(5); + if (!$this->BonkIsValidTagName(substr($NextInfoDataPair, 1, 4))) { + while (!feof($this->getid3->fp)) { + //$CurrentSeekInfo['offset'] = getid3_lib::LittleEndian2Int(substr($NextInfoDataPair, 0, 4)); + //$CurrentSeekInfo['nextbit'] = getid3_lib::LittleEndian2Int(substr($NextInfoDataPair, 4, 1)); + //$thisfile_bonk_INFO[] = $CurrentSeekInfo; + + $NextInfoDataPair = $this->fread(5); + if ($this->BonkIsValidTagName(substr($NextInfoDataPair, 1, 4))) { + $this->fseek(-5, SEEK_CUR); + break; + } + $thisfile_bonk_INFO['entries_count']++; + } + } + break; + + case 'META': + $BonkData = "\x00".'META'.$this->fread($info['bonk']['META']['size'] - 5); + $info['bonk']['META']['version'] = getid3_lib::LittleEndian2Int(substr($BonkData, 5, 1)); + + $MetaTagEntries = floor(((strlen($BonkData) - 8) - 6) / 8); // BonkData - xxxxmeta - ØMETA + $offset = 6; + for ($i = 0; $i < $MetaTagEntries; $i++) { + $MetaEntryTagName = substr($BonkData, $offset, 4); + $offset += 4; + $MetaEntryTagOffset = getid3_lib::LittleEndian2Int(substr($BonkData, $offset, 4)); + $offset += 4; + $info['bonk']['META']['tags'][$MetaEntryTagName] = $MetaEntryTagOffset; + } + break; + + case ' ID3': + $info['audio']['encoder'] = 'Extended BONK v0.9+'; + + // ID3v2 checking is optional + if (class_exists('getid3_id3v2')) { + $getid3_temp = new getID3(); + $getid3_temp->openfile($this->getid3->filename); + $getid3_id3v2 = new getid3_id3v2($getid3_temp); + $getid3_id3v2->StartingOffset = $info['bonk'][' ID3']['offset'] + 2; + $info['bonk'][' ID3']['valid'] = $getid3_id3v2->Analyze(); + if ($info['bonk'][' ID3']['valid']) { + $info['id3v2'] = $getid3_temp->info['id3v2']; + } + unset($getid3_temp, $getid3_id3v2); + } + break; + + default: + $this->warning('Unexpected Bonk tag "'.$BonkTagName.'" at offset '.$info['bonk'][$BonkTagName]['offset']); + break; + + } + } + + public static function BonkIsValidTagName($PossibleBonkTag, $ignorecase=false) { + static $BonkIsValidTagName = array('BONK', 'INFO', ' ID3', 'META'); + foreach ($BonkIsValidTagName as $validtagname) { + if ($validtagname == $PossibleBonkTag) { + return true; + } elseif ($ignorecase && (strtolower($validtagname) == strtolower($PossibleBonkTag))) { + return true; + } + } + return false; + } + +} diff --git a/www/rompr/getid3/module.audio.dsf.php b/www/rompr/getid3/module.audio.dsf.php new file mode 100755 index 0000000..50be37c --- /dev/null +++ b/www/rompr/getid3/module.audio.dsf.php @@ -0,0 +1,133 @@ + // +// available at http://getid3.sourceforge.net // +// or http://www.getid3.org // +// also https://github.com/JamesHeinrich/getID3 // +///////////////////////////////////////////////////////////////// +// See readme.txt for more details // +///////////////////////////////////////////////////////////////// +// // +// module.audio.dsf.php // +// module for analyzing dsf/DSF Audio files // +// dependencies: module.tag.id3v2.php // +// /// +///////////////////////////////////////////////////////////////// + +getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.tag.id3v2.php', __FILE__, true); + +class getid3_dsf extends getid3_handler +{ + + public function Analyze() { + $info = &$this->getid3->info; + + $info['fileformat'] = 'dsf'; + $info['audio']['dataformat'] = 'dsf'; + $info['audio']['lossless'] = true; + $info['audio']['bitrate_mode'] = 'cbr'; + + $this->fseek($info['avdataoffset']); + $dsfheader = $this->fread(28 + 12); + + $headeroffset = 0; + $info['dsf']['dsd']['magic'] = substr($dsfheader, $headeroffset, 4); + $headeroffset += 4; + $magic = 'DSD '; + if ($info['dsf']['dsd']['magic'] != $magic) { + $this->error('Expecting "'.getid3_lib::PrintHexBytes($magic).'" at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes($info['dsf']['dsd']['magic']).'"'); + unset($info['fileformat']); + unset($info['audio']); + unset($info['dsf']); + return false; + } + $info['dsf']['dsd']['dsd_chunk_size'] = getid3_lib::LittleEndian2Int(substr($dsfheader, $headeroffset, 8)); // should be 28 + $headeroffset += 8; + $info['dsf']['dsd']['dsf_file_size'] = getid3_lib::LittleEndian2Int(substr($dsfheader, $headeroffset, 8)); + $headeroffset += 8; + $info['dsf']['dsd']['meta_chunk_offset'] = getid3_lib::LittleEndian2Int(substr($dsfheader, $headeroffset, 8)); + $headeroffset += 8; + + + $info['dsf']['fmt']['magic'] = substr($dsfheader, $headeroffset, 4); + $headeroffset += 4; + $magic = 'fmt '; + if ($info['dsf']['fmt']['magic'] != $magic) { + $this->error('Expecting "'.getid3_lib::PrintHexBytes($magic).'" at offset '.$headeroffset.', found "'.getid3_lib::PrintHexBytes($info['dsf']['fmt']['magic']).'"'); + return false; + } + $info['dsf']['fmt']['fmt_chunk_size'] = getid3_lib::LittleEndian2Int(substr($dsfheader, $headeroffset, 8)); // usually 52 bytes + $headeroffset += 8; + $dsfheader .= $this->fread($info['dsf']['fmt']['fmt_chunk_size'] - 12 + 12); // we have already read the entire DSD chunk, plus 12 bytes of FMT. We now want to read the size of FMT, plus 12 bytes into the next chunk to get magic and size. + if (strlen($dsfheader) != ($info['dsf']['dsd']['dsd_chunk_size'] + $info['dsf']['fmt']['fmt_chunk_size'] + 12)) { + $this->error('Expecting '.($info['dsf']['dsd']['dsd_chunk_size'] + $info['dsf']['fmt']['fmt_chunk_size']).' bytes header, found '.strlen($dsfheader).' bytes'); + return false; + } + $info['dsf']['fmt']['format_version'] = getid3_lib::LittleEndian2Int(substr($dsfheader, $headeroffset, 4)); // usually "1" + $headeroffset += 4; + $info['dsf']['fmt']['format_id'] = getid3_lib::LittleEndian2Int(substr($dsfheader, $headeroffset, 4)); // usually "0" = "DSD Raw" + $headeroffset += 4; + $info['dsf']['fmt']['channel_type_id'] = getid3_lib::LittleEndian2Int(substr($dsfheader, $headeroffset, 4)); + $headeroffset += 4; + $info['dsf']['fmt']['channels'] = getid3_lib::LittleEndian2Int(substr($dsfheader, $headeroffset, 4)); + $headeroffset += 4; + $info['dsf']['fmt']['sample_rate'] = getid3_lib::LittleEndian2Int(substr($dsfheader, $headeroffset, 4)); + $headeroffset += 4; + $info['dsf']['fmt']['bits_per_sample'] = getid3_lib::LittleEndian2Int(substr($dsfheader, $headeroffset, 4)); + $headeroffset += 4; + $info['dsf']['fmt']['sample_count'] = getid3_lib::LittleEndian2Int(substr($dsfheader, $headeroffset, 8)); + $headeroffset += 8; + $info['dsf']['fmt']['channel_block_size'] = getid3_lib::LittleEndian2Int(substr($dsfheader, $headeroffset, 4)); + $headeroffset += 4; + $info['dsf']['fmt']['reserved'] = getid3_lib::LittleEndian2Int(substr($dsfheader, $headeroffset, 4)); // zero-filled + $headeroffset += 4; + + + $info['dsf']['data']['magic'] = substr($dsfheader, $headeroffset, 4); + $headeroffset += 4; + $magic = 'data'; + if ($info['dsf']['data']['magic'] != $magic) { + $this->error('Expecting "'.getid3_lib::PrintHexBytes($magic).'" at offset '.$headeroffset.', found "'.getid3_lib::PrintHexBytes($info['dsf']['data']['magic']).'"'); + return false; + } + $info['dsf']['data']['data_chunk_size'] = getid3_lib::LittleEndian2Int(substr($dsfheader, $headeroffset, 8)); + $headeroffset += 8; + $info['avdataoffset'] = $headeroffset; + $info['avdataend'] = $info['avdataoffset'] + $info['dsf']['data']['data_chunk_size']; + + + if ($info['dsf']['dsd']['meta_chunk_offset'] > 0) { + $getid3_id3v2 = new getid3_id3v2($this->getid3); + $getid3_id3v2->StartingOffset = $info['dsf']['dsd']['meta_chunk_offset']; + $getid3_id3v2->Analyze(); + unset($getid3_id3v2); + } + + + $info['dsf']['fmt']['channel_type'] = $this->DSFchannelTypeLookup($info['dsf']['fmt']['channel_type_id']); + $info['audio']['channelmode'] = $info['dsf']['fmt']['channel_type']; + $info['audio']['bits_per_sample'] = $info['dsf']['fmt']['bits_per_sample']; + $info['audio']['sample_rate'] = $info['dsf']['fmt']['sample_rate']; + $info['audio']['channels'] = $info['dsf']['fmt']['channels']; + $info['audio']['bitrate'] = $info['audio']['bits_per_sample'] * $info['audio']['sample_rate'] * $info['audio']['channels']; + $info['playtime_seconds'] = ($info['dsf']['data']['data_chunk_size'] * 8) / $info['audio']['bitrate']; + + return true; + } + + + public static function DSFchannelTypeLookup($channel_type_id) { + static $DSFchannelTypeLookup = array( + // interleaving order: + 1 => 'mono', // 1: Mono + 2 => 'stereo', // 1: Front-Left; 2: Front-Right + 3 => '3-channel', // 1: Front-Left; 2: Front-Right; 3: Center + 4 => 'quad', // 1: Front-Left; 2: Front-Right; 3: Back-Left; 4: Back-Right + 5 => '4-channel', // 1: Front-Left; 2: Front-Right; 3: Center; 4: Low-Frequency + 6 => '5-channel', // 1: Front-Left; 2: Front-Right; 3: Center; 4: Back-Left 5: Back-Right + 7 => '5.1', // 1: Front-Left; 2: Front-Right; 3: Center; 4: Low-Frequency; 5: Back-Left; 6: Back-Right + ); + return (isset($DSFchannelTypeLookup[$channel_type_id]) ? $DSFchannelTypeLookup[$channel_type_id] : ''); + } + +} diff --git a/www/rompr/getid3/module.audio.dss.php b/www/rompr/getid3/module.audio.dss.php new file mode 100644 index 0000000..6bd9668 --- /dev/null +++ b/www/rompr/getid3/module.audio.dss.php @@ -0,0 +1,99 @@ + // +// available at http://getid3.sourceforge.net // +// or http://www.getid3.org // +// also https://github.com/JamesHeinrich/getID3 // +///////////////////////////////////////////////////////////////// +// See readme.txt for more details // +///////////////////////////////////////////////////////////////// +// // +// module.audio.dss.php // +// module for analyzing Digital Speech Standard (DSS) files // +// dependencies: NONE // +// /// +///////////////////////////////////////////////////////////////// + + +class getid3_dss extends getid3_handler +{ + + public function Analyze() { + $info = &$this->getid3->info; + + $this->fseek($info['avdataoffset']); + $DSSheader = $this->fread(1540); + + if (!preg_match('#^[\\x02-\\x06]ds[s2]#', $DSSheader)) { + $this->error('Expecting "[02-06] 64 73 [73|32]" at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes(substr($DSSheader, 0, 4)).'"'); + return false; + } + + // some structure information taken from http://cpansearch.perl.org/src/RGIBSON/Audio-DSS-0.02/lib/Audio/DSS.pm + $info['encoding'] = 'ISO-8859-1'; // not certain, but assumed + $info['dss'] = array(); + + $info['fileformat'] = 'dss'; + $info['mime_type'] = 'audio/x-'.substr($DSSheader, 1, 3); // "audio/x-dss" or "audio/x-ds2" + $info['audio']['dataformat'] = substr($DSSheader, 1, 3); // "dss" or "ds2" + $info['audio']['bitrate_mode'] = 'cbr'; + + $info['dss']['version'] = ord(substr($DSSheader, 0, 1)); + $info['dss']['hardware'] = trim(substr($DSSheader, 12, 16)); // identification string for hardware used to create the file, e.g. "DPM 9600", "DS2400" + $info['dss']['unknown1'] = getid3_lib::LittleEndian2Int(substr($DSSheader, 28, 4)); + // 32-37 = "FE FF FE FF F7 FF" in all the sample files I've seen + $info['dss']['date_create_unix'] = $this->DSSdateStringToUnixDate(substr($DSSheader, 38, 12)); + $info['dss']['date_complete_unix'] = $this->DSSdateStringToUnixDate(substr($DSSheader, 50, 12)); + $info['dss']['playtime_sec'] = intval((substr($DSSheader, 62, 2) * 3600) + (substr($DSSheader, 64, 2) * 60) + substr($DSSheader, 66, 2)); // approximate file playtime in HHMMSS + if ($info['dss']['version'] <= 3) { + $info['dss']['playtime_ms'] = getid3_lib::LittleEndian2Int(substr($DSSheader, 512, 4)); // exact file playtime in milliseconds. Has also been observed at offset 530 in one sample file, with something else (unknown) at offset 512 + $info['dss']['priority'] = ord(substr($DSSheader, 793, 1)); + $info['dss']['comments'] = trim(substr($DSSheader, 798, 100)); + $info['dss']['sample_rate_index'] = ord(substr($DSSheader, 1538, 1)); // this isn't certain, this may or may not be where the sample rate info is stored, but it seems consistent on my small selection of sample files + $info['audio']['sample_rate'] = $this->DSSsampleRateLookup($info['dss']['sample_rate_index']); + } else { + $this->getid3->warning('DSS above version 3 not fully supported in this version of getID3. Any additional documentation or format specifications would be welcome. This file is version '.$info['dss']['version']); + } + + $info['audio']['bits_per_sample'] = 16; // maybe, maybe not -- most compressed audio formats don't have a fixed bits-per-sample value, but this is a reasonable approximation + $info['audio']['channels'] = 1; + + if (!empty($info['dss']['playtime_ms']) && (floor($info['dss']['playtime_ms'] / 1000) == $info['dss']['playtime_sec'])) { // *should* just be playtime_ms / 1000 but at least one sample file has playtime_ms at offset 530 instead of offset 512, so safety check + $info['playtime_seconds'] = $info['dss']['playtime_ms'] / 1000; + } else { + $info['playtime_seconds'] = $info['dss']['playtime_sec']; + if (!empty($info['dss']['playtime_ms'])) { + $this->getid3->warning('playtime_ms ('.number_format($info['dss']['playtime_ms'] / 1000, 3).') does not match playtime_sec ('.number_format($info['dss']['playtime_sec']).') - using playtime_sec value'); + } + } + $info['audio']['bitrate'] = ($info['filesize'] * 8) / $info['playtime_seconds']; + + return true; + } + + public function DSSdateStringToUnixDate($datestring) { + $y = substr($datestring, 0, 2); + $m = substr($datestring, 2, 2); + $d = substr($datestring, 4, 2); + $h = substr($datestring, 6, 2); + $i = substr($datestring, 8, 2); + $s = substr($datestring, 10, 2); + $y += (($y < 95) ? 2000 : 1900); + return mktime($h, $i, $s, $m, $d, $y); + } + + public function DSSsampleRateLookup($sample_rate_index) { + static $dssSampleRateLookup = array( + 0x0A => 16000, + 0x0C => 11025, + 0x0D => 12000, + 0x15 => 8000, + ); + if (!array_key_exists($sample_rate_index, $dssSampleRateLookup)) { + $this->getid3->warning('unknown sample_rate_index: 0x'.strtoupper(dechex($sample_rate_index))); + return false; + } + return $dssSampleRateLookup[$sample_rate_index]; + } + +} diff --git a/www/rompr/getid3/module.audio.dts.php b/www/rompr/getid3/module.audio.dts.php new file mode 100644 index 0000000..bdc78f0 --- /dev/null +++ b/www/rompr/getid3/module.audio.dts.php @@ -0,0 +1,291 @@ + // +// available at http://getid3.sourceforge.net // +// or http://www.getid3.org // +// also https://github.com/JamesHeinrich/getID3 // +///////////////////////////////////////////////////////////////// +// See readme.txt for more details // +///////////////////////////////////////////////////////////////// +// // +// module.audio.dts.php // +// module for analyzing DTS Audio files // +// dependencies: NONE // +// // +///////////////////////////////////////////////////////////////// + + +/** +* @tutorial http://wiki.multimedia.cx/index.php?title=DTS +*/ +class getid3_dts extends getid3_handler +{ + /** + * Default DTS syncword used in native .cpt or .dts formats + */ + const syncword = "\x7F\xFE\x80\x01"; + + private $readBinDataOffset = 0; + + /** + * Possible syncwords indicating bitstream encoding + */ + public static $syncwords = array( + 0 => "\x7F\xFE\x80\x01", // raw big-endian + 1 => "\xFE\x7F\x01\x80", // raw little-endian + 2 => "\x1F\xFF\xE8\x00", // 14-bit big-endian + 3 => "\xFF\x1F\x00\xE8"); // 14-bit little-endian + + public function Analyze() { + $info = &$this->getid3->info; + $info['fileformat'] = 'dts'; + + $this->fseek($info['avdataoffset']); + $DTSheader = $this->fread(20); // we only need 2 words magic + 6 words frame header, but these words may be normal 16-bit words OR 14-bit words with 2 highest bits set to zero, so 8 words can be either 8*16/8 = 16 bytes OR 8*16*(16/14)/8 = 18.3 bytes + + // check syncword + $sync = substr($DTSheader, 0, 4); + if (($encoding = array_search($sync, self::$syncwords)) !== false) { + + $info['dts']['raw']['magic'] = $sync; + $this->readBinDataOffset = 32; + + } elseif ($this->isDependencyFor('matroska')) { + + // Matroska contains DTS without syncword encoded as raw big-endian format + $encoding = 0; + $this->readBinDataOffset = 0; + + } else { + + unset($info['fileformat']); + return $this->error('Expecting "'.implode('| ', array_map('getid3_lib::PrintHexBytes', self::$syncwords)).'" at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes($sync).'"'); + + } + + // decode header + $fhBS = ''; + for ($word_offset = 0; $word_offset <= strlen($DTSheader); $word_offset += 2) { + switch ($encoding) { + case 0: // raw big-endian + $fhBS .= getid3_lib::BigEndian2Bin( substr($DTSheader, $word_offset, 2) ); + break; + case 1: // raw little-endian + $fhBS .= getid3_lib::BigEndian2Bin(strrev(substr($DTSheader, $word_offset, 2))); + break; + case 2: // 14-bit big-endian + $fhBS .= substr(getid3_lib::BigEndian2Bin( substr($DTSheader, $word_offset, 2) ), 2, 14); + break; + case 3: // 14-bit little-endian + $fhBS .= substr(getid3_lib::BigEndian2Bin(strrev(substr($DTSheader, $word_offset, 2))), 2, 14); + break; + } + } + + $info['dts']['raw']['frame_type'] = $this->readBinData($fhBS, 1); + $info['dts']['raw']['deficit_samples'] = $this->readBinData($fhBS, 5); + $info['dts']['flags']['crc_present'] = (bool) $this->readBinData($fhBS, 1); + $info['dts']['raw']['pcm_sample_blocks'] = $this->readBinData($fhBS, 7); + $info['dts']['raw']['frame_byte_size'] = $this->readBinData($fhBS, 14); + $info['dts']['raw']['channel_arrangement'] = $this->readBinData($fhBS, 6); + $info['dts']['raw']['sample_frequency'] = $this->readBinData($fhBS, 4); + $info['dts']['raw']['bitrate'] = $this->readBinData($fhBS, 5); + $info['dts']['flags']['embedded_downmix'] = (bool) $this->readBinData($fhBS, 1); + $info['dts']['flags']['dynamicrange'] = (bool) $this->readBinData($fhBS, 1); + $info['dts']['flags']['timestamp'] = (bool) $this->readBinData($fhBS, 1); + $info['dts']['flags']['auxdata'] = (bool) $this->readBinData($fhBS, 1); + $info['dts']['flags']['hdcd'] = (bool) $this->readBinData($fhBS, 1); + $info['dts']['raw']['extension_audio'] = $this->readBinData($fhBS, 3); + $info['dts']['flags']['extended_coding'] = (bool) $this->readBinData($fhBS, 1); + $info['dts']['flags']['audio_sync_insertion'] = (bool) $this->readBinData($fhBS, 1); + $info['dts']['raw']['lfe_effects'] = $this->readBinData($fhBS, 2); + $info['dts']['flags']['predictor_history'] = (bool) $this->readBinData($fhBS, 1); + if ($info['dts']['flags']['crc_present']) { + $info['dts']['raw']['crc16'] = $this->readBinData($fhBS, 16); + } + $info['dts']['flags']['mri_perfect_reconst'] = (bool) $this->readBinData($fhBS, 1); + $info['dts']['raw']['encoder_soft_version'] = $this->readBinData($fhBS, 4); + $info['dts']['raw']['copy_history'] = $this->readBinData($fhBS, 2); + $info['dts']['raw']['bits_per_sample'] = $this->readBinData($fhBS, 2); + $info['dts']['flags']['surround_es'] = (bool) $this->readBinData($fhBS, 1); + $info['dts']['flags']['front_sum_diff'] = (bool) $this->readBinData($fhBS, 1); + $info['dts']['flags']['surround_sum_diff'] = (bool) $this->readBinData($fhBS, 1); + $info['dts']['raw']['dialog_normalization'] = $this->readBinData($fhBS, 4); + + + $info['dts']['bitrate'] = self::bitrateLookup($info['dts']['raw']['bitrate']); + $info['dts']['bits_per_sample'] = self::bitPerSampleLookup($info['dts']['raw']['bits_per_sample']); + $info['dts']['sample_rate'] = self::sampleRateLookup($info['dts']['raw']['sample_frequency']); + $info['dts']['dialog_normalization'] = self::dialogNormalization($info['dts']['raw']['dialog_normalization'], $info['dts']['raw']['encoder_soft_version']); + $info['dts']['flags']['lossless'] = (($info['dts']['raw']['bitrate'] == 31) ? true : false); + $info['dts']['bitrate_mode'] = (($info['dts']['raw']['bitrate'] == 30) ? 'vbr' : 'cbr'); + $info['dts']['channels'] = self::numChannelsLookup($info['dts']['raw']['channel_arrangement']); + $info['dts']['channel_arrangement'] = self::channelArrangementLookup($info['dts']['raw']['channel_arrangement']); + + $info['audio']['dataformat'] = 'dts'; + $info['audio']['lossless'] = $info['dts']['flags']['lossless']; + $info['audio']['bitrate_mode'] = $info['dts']['bitrate_mode']; + $info['audio']['bits_per_sample'] = $info['dts']['bits_per_sample']; + $info['audio']['sample_rate'] = $info['dts']['sample_rate']; + $info['audio']['channels'] = $info['dts']['channels']; + $info['audio']['bitrate'] = $info['dts']['bitrate']; + if (isset($info['avdataend']) && !empty($info['dts']['bitrate']) && is_numeric($info['dts']['bitrate'])) { + $info['playtime_seconds'] = ($info['avdataend'] - $info['avdataoffset']) / ($info['dts']['bitrate'] / 8); + if (($encoding == 2) || ($encoding == 3)) { + // 14-bit data packed into 16-bit words, so the playtime is wrong because only (14/16) of the bytes in the data portion of the file are used at the specified bitrate + $info['playtime_seconds'] *= (14 / 16); + } + } + return true; + } + + private function readBinData($bin, $length) { + $data = substr($bin, $this->readBinDataOffset, $length); + $this->readBinDataOffset += $length; + + return bindec($data); + } + + public static function bitrateLookup($index) { + static $lookup = array( + 0 => 32000, + 1 => 56000, + 2 => 64000, + 3 => 96000, + 4 => 112000, + 5 => 128000, + 6 => 192000, + 7 => 224000, + 8 => 256000, + 9 => 320000, + 10 => 384000, + 11 => 448000, + 12 => 512000, + 13 => 576000, + 14 => 640000, + 15 => 768000, + 16 => 960000, + 17 => 1024000, + 18 => 1152000, + 19 => 1280000, + 20 => 1344000, + 21 => 1408000, + 22 => 1411200, + 23 => 1472000, + 24 => 1536000, + 25 => 1920000, + 26 => 2048000, + 27 => 3072000, + 28 => 3840000, + 29 => 'open', + 30 => 'variable', + 31 => 'lossless', + ); + return (isset($lookup[$index]) ? $lookup[$index] : false); + } + + public static function sampleRateLookup($index) { + static $lookup = array( + 0 => 'invalid', + 1 => 8000, + 2 => 16000, + 3 => 32000, + 4 => 'invalid', + 5 => 'invalid', + 6 => 11025, + 7 => 22050, + 8 => 44100, + 9 => 'invalid', + 10 => 'invalid', + 11 => 12000, + 12 => 24000, + 13 => 48000, + 14 => 'invalid', + 15 => 'invalid', + ); + return (isset($lookup[$index]) ? $lookup[$index] : false); + } + + public static function bitPerSampleLookup($index) { + static $lookup = array( + 0 => 16, + 1 => 20, + 2 => 24, + 3 => 24, + ); + return (isset($lookup[$index]) ? $lookup[$index] : false); + } + + public static function numChannelsLookup($index) { + switch ($index) { + case 0: + return 1; + break; + case 1: + case 2: + case 3: + case 4: + return 2; + break; + case 5: + case 6: + return 3; + break; + case 7: + case 8: + return 4; + break; + case 9: + return 5; + break; + case 10: + case 11: + case 12: + return 6; + break; + case 13: + return 7; + break; + case 14: + case 15: + return 8; + break; + } + return false; + } + + public static function channelArrangementLookup($index) { + static $lookup = array( + 0 => 'A', + 1 => 'A + B (dual mono)', + 2 => 'L + R (stereo)', + 3 => '(L+R) + (L-R) (sum-difference)', + 4 => 'LT + RT (left and right total)', + 5 => 'C + L + R', + 6 => 'L + R + S', + 7 => 'C + L + R + S', + 8 => 'L + R + SL + SR', + 9 => 'C + L + R + SL + SR', + 10 => 'CL + CR + L + R + SL + SR', + 11 => 'C + L + R+ LR + RR + OV', + 12 => 'CF + CR + LF + RF + LR + RR', + 13 => 'CL + C + CR + L + R + SL + SR', + 14 => 'CL + CR + L + R + SL1 + SL2 + SR1 + SR2', + 15 => 'CL + C+ CR + L + R + SL + S + SR', + ); + return (isset($lookup[$index]) ? $lookup[$index] : 'user-defined'); + } + + public static function dialogNormalization($index, $version) { + switch ($version) { + case 7: + return 0 - $index; + break; + case 6: + return 0 - 16 - $index; + break; + } + return false; + } + +} diff --git a/www/rompr/getid3/module.audio.flac.php b/www/rompr/getid3/module.audio.flac.php new file mode 100644 index 0000000..348cce3 --- /dev/null +++ b/www/rompr/getid3/module.audio.flac.php @@ -0,0 +1,453 @@ + // +// available at http://getid3.sourceforge.net // +// or http://www.getid3.org // +// also https://github.com/JamesHeinrich/getID3 // +///////////////////////////////////////////////////////////////// +// See readme.txt for more details // +///////////////////////////////////////////////////////////////// +// // +// module.audio.flac.php // +// module for analyzing FLAC and OggFLAC audio files // +// dependencies: module.audio.ogg.php // +// /// +///////////////////////////////////////////////////////////////// + + +getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio.ogg.php', __FILE__, true); + +/** +* @tutorial http://flac.sourceforge.net/format.html +*/ +class getid3_flac extends getid3_handler +{ + const syncword = 'fLaC'; + + public function Analyze() { + $info = &$this->getid3->info; + + $this->fseek($info['avdataoffset']); + $StreamMarker = $this->fread(4); + if ($StreamMarker != self::syncword) { + return $this->error('Expecting "'.getid3_lib::PrintHexBytes(self::syncword).'" at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes($StreamMarker).'"'); + } + $info['fileformat'] = 'flac'; + $info['audio']['dataformat'] = 'flac'; + $info['audio']['bitrate_mode'] = 'vbr'; + $info['audio']['lossless'] = true; + + // parse flac container + return $this->parseMETAdata(); + } + + public function parseMETAdata() { + $info = &$this->getid3->info; + do { + $BlockOffset = $this->ftell(); + $BlockHeader = $this->fread(4); + $LBFBT = getid3_lib::BigEndian2Int(substr($BlockHeader, 0, 1)); + $LastBlockFlag = (bool) ($LBFBT & 0x80); + $BlockType = ($LBFBT & 0x7F); + $BlockLength = getid3_lib::BigEndian2Int(substr($BlockHeader, 1, 3)); + $BlockTypeText = self::metaBlockTypeLookup($BlockType); + + if (($BlockOffset + 4 + $BlockLength) > $info['avdataend']) { + $this->error('METADATA_BLOCK_HEADER.BLOCK_TYPE ('.$BlockTypeText.') at offset '.$BlockOffset.' extends beyond end of file'); + break; + } + if ($BlockLength < 1) { + $this->error('METADATA_BLOCK_HEADER.BLOCK_LENGTH ('.$BlockLength.') at offset '.$BlockOffset.' is invalid'); + break; + } + + $info['flac'][$BlockTypeText]['raw'] = array(); + $BlockTypeText_raw = &$info['flac'][$BlockTypeText]['raw']; + + $BlockTypeText_raw['offset'] = $BlockOffset; + $BlockTypeText_raw['last_meta_block'] = $LastBlockFlag; + $BlockTypeText_raw['block_type'] = $BlockType; + $BlockTypeText_raw['block_type_text'] = $BlockTypeText; + $BlockTypeText_raw['block_length'] = $BlockLength; + if ($BlockTypeText_raw['block_type'] != 0x06) { // do not read attachment data automatically + $BlockTypeText_raw['block_data'] = $this->fread($BlockLength); + } + + switch ($BlockTypeText) { + case 'STREAMINFO': // 0x00 + if (!$this->parseSTREAMINFO($BlockTypeText_raw['block_data'])) { + return false; + } + break; + + case 'PADDING': // 0x01 + unset($info['flac']['PADDING']); // ignore + break; + + case 'APPLICATION': // 0x02 + if (!$this->parseAPPLICATION($BlockTypeText_raw['block_data'])) { + return false; + } + break; + + case 'SEEKTABLE': // 0x03 + if (!$this->parseSEEKTABLE($BlockTypeText_raw['block_data'])) { + return false; + } + break; + + case 'VORBIS_COMMENT': // 0x04 + if (!$this->parseVORBIS_COMMENT($BlockTypeText_raw['block_data'])) { + return false; + } + break; + + case 'CUESHEET': // 0x05 + if (!$this->parseCUESHEET($BlockTypeText_raw['block_data'])) { + return false; + } + break; + + case 'PICTURE': // 0x06 + if (!$this->parsePICTURE()) { + return false; + } + break; + + default: + $this->warning('Unhandled METADATA_BLOCK_HEADER.BLOCK_TYPE ('.$BlockType.') at offset '.$BlockOffset); + } + + unset($info['flac'][$BlockTypeText]['raw']); + $info['avdataoffset'] = $this->ftell(); + } + while ($LastBlockFlag === false); + + // handle tags + if (!empty($info['flac']['VORBIS_COMMENT']['comments'])) { + $info['flac']['comments'] = $info['flac']['VORBIS_COMMENT']['comments']; + } + if (!empty($info['flac']['VORBIS_COMMENT']['vendor'])) { + $info['audio']['encoder'] = str_replace('reference ', '', $info['flac']['VORBIS_COMMENT']['vendor']); + } + + // copy attachments to 'comments' array if nesesary + if (isset($info['flac']['PICTURE']) && ($this->getid3->option_save_attachments !== getID3::ATTACHMENTS_NONE)) { + foreach ($info['flac']['PICTURE'] as $entry) { + if (!empty($entry['data'])) { + if (!isset($info['flac']['comments']['picture'])) { + $info['flac']['comments']['picture'] = array(); + } + $comments_picture_data = array(); + foreach (array('data', 'image_mime', 'image_width', 'image_height', 'imagetype', 'picturetype', 'description', 'datalength') as $picture_key) { + if (isset($entry[$picture_key])) { + $comments_picture_data[$picture_key] = $entry[$picture_key]; + } + } + $info['flac']['comments']['picture'][] = $comments_picture_data; + unset($comments_picture_data); + } + } + } + + if (isset($info['flac']['STREAMINFO'])) { + if (!$this->isDependencyFor('matroska')) { + $info['flac']['compressed_audio_bytes'] = $info['avdataend'] - $info['avdataoffset']; + } + $info['flac']['uncompressed_audio_bytes'] = $info['flac']['STREAMINFO']['samples_stream'] * $info['flac']['STREAMINFO']['channels'] * ($info['flac']['STREAMINFO']['bits_per_sample'] / 8); + if ($info['flac']['uncompressed_audio_bytes'] == 0) { + return $this->error('Corrupt FLAC file: uncompressed_audio_bytes == zero'); + } + if (!empty($info['flac']['compressed_audio_bytes'])) { + $info['flac']['compression_ratio'] = $info['flac']['compressed_audio_bytes'] / $info['flac']['uncompressed_audio_bytes']; + } + } + + // set md5_data_source - built into flac 0.5+ + if (isset($info['flac']['STREAMINFO']['audio_signature'])) { + + if ($info['flac']['STREAMINFO']['audio_signature'] === str_repeat("\x00", 16)) { + $this->warning('FLAC STREAMINFO.audio_signature is null (known issue with libOggFLAC)'); + } + else { + $info['md5_data_source'] = ''; + $md5 = $info['flac']['STREAMINFO']['audio_signature']; + for ($i = 0; $i < strlen($md5); $i++) { + $info['md5_data_source'] .= str_pad(dechex(ord($md5[$i])), 2, '00', STR_PAD_LEFT); + } + if (!preg_match('/^[0-9a-f]{32}$/', $info['md5_data_source'])) { + unset($info['md5_data_source']); + } + } + } + + if (isset($info['flac']['STREAMINFO']['bits_per_sample'])) { + $info['audio']['bits_per_sample'] = $info['flac']['STREAMINFO']['bits_per_sample']; + if ($info['audio']['bits_per_sample'] == 8) { + // special case + // must invert sign bit on all data bytes before MD5'ing to match FLAC's calculated value + // MD5sum calculates on unsigned bytes, but FLAC calculated MD5 on 8-bit audio data as signed + $this->warning('FLAC calculates MD5 data strangely on 8-bit audio, so the stored md5_data_source value will not match the decoded WAV file'); + } + } + + return true; + } + + private function parseSTREAMINFO($BlockData) { + $info = &$this->getid3->info; + + $info['flac']['STREAMINFO'] = array(); + $streaminfo = &$info['flac']['STREAMINFO']; + + $streaminfo['min_block_size'] = getid3_lib::BigEndian2Int(substr($BlockData, 0, 2)); + $streaminfo['max_block_size'] = getid3_lib::BigEndian2Int(substr($BlockData, 2, 2)); + $streaminfo['min_frame_size'] = getid3_lib::BigEndian2Int(substr($BlockData, 4, 3)); + $streaminfo['max_frame_size'] = getid3_lib::BigEndian2Int(substr($BlockData, 7, 3)); + + $SRCSBSS = getid3_lib::BigEndian2Bin(substr($BlockData, 10, 8)); + $streaminfo['sample_rate'] = getid3_lib::Bin2Dec(substr($SRCSBSS, 0, 20)); + $streaminfo['channels'] = getid3_lib::Bin2Dec(substr($SRCSBSS, 20, 3)) + 1; + $streaminfo['bits_per_sample'] = getid3_lib::Bin2Dec(substr($SRCSBSS, 23, 5)) + 1; + $streaminfo['samples_stream'] = getid3_lib::Bin2Dec(substr($SRCSBSS, 28, 36)); + + $streaminfo['audio_signature'] = substr($BlockData, 18, 16); + + if (!empty($streaminfo['sample_rate'])) { + + $info['audio']['bitrate_mode'] = 'vbr'; + $info['audio']['sample_rate'] = $streaminfo['sample_rate']; + $info['audio']['channels'] = $streaminfo['channels']; + $info['audio']['bits_per_sample'] = $streaminfo['bits_per_sample']; + $info['playtime_seconds'] = $streaminfo['samples_stream'] / $streaminfo['sample_rate']; + if ($info['playtime_seconds'] > 0) { + if (!$this->isDependencyFor('matroska')) { + $info['audio']['bitrate'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / $info['playtime_seconds']; + } + else { + $this->warning('Cannot determine audio bitrate because total stream size is unknown'); + } + } + + } else { + return $this->error('Corrupt METAdata block: STREAMINFO'); + } + + return true; + } + + private function parseAPPLICATION($BlockData) { + $info = &$this->getid3->info; + + $ApplicationID = getid3_lib::BigEndian2Int(substr($BlockData, 0, 4)); + $info['flac']['APPLICATION'][$ApplicationID]['name'] = self::applicationIDLookup($ApplicationID); + $info['flac']['APPLICATION'][$ApplicationID]['data'] = substr($BlockData, 4); + + return true; + } + + private function parseSEEKTABLE($BlockData) { + $info = &$this->getid3->info; + + $offset = 0; + $BlockLength = strlen($BlockData); + $placeholderpattern = str_repeat("\xFF", 8); + while ($offset < $BlockLength) { + $SampleNumberString = substr($BlockData, $offset, 8); + $offset += 8; + if ($SampleNumberString == $placeholderpattern) { + + // placeholder point + getid3_lib::safe_inc($info['flac']['SEEKTABLE']['placeholders'], 1); + $offset += 10; + + } else { + + $SampleNumber = getid3_lib::BigEndian2Int($SampleNumberString); + $info['flac']['SEEKTABLE'][$SampleNumber]['offset'] = getid3_lib::BigEndian2Int(substr($BlockData, $offset, 8)); + $offset += 8; + $info['flac']['SEEKTABLE'][$SampleNumber]['samples'] = getid3_lib::BigEndian2Int(substr($BlockData, $offset, 2)); + $offset += 2; + + } + } + + return true; + } + + private function parseVORBIS_COMMENT($BlockData) { + $info = &$this->getid3->info; + + $getid3_ogg = new getid3_ogg($this->getid3); + if ($this->isDependencyFor('matroska')) { + $getid3_ogg->setStringMode($this->data_string); + } + $getid3_ogg->ParseVorbisComments(); + if (isset($info['ogg'])) { + unset($info['ogg']['comments_raw']); + $info['flac']['VORBIS_COMMENT'] = $info['ogg']; + unset($info['ogg']); + } + + unset($getid3_ogg); + + return true; + } + + private function parseCUESHEET($BlockData) { + $info = &$this->getid3->info; + $offset = 0; + $info['flac']['CUESHEET']['media_catalog_number'] = trim(substr($BlockData, $offset, 128), "\0"); + $offset += 128; + $info['flac']['CUESHEET']['lead_in_samples'] = getid3_lib::BigEndian2Int(substr($BlockData, $offset, 8)); + $offset += 8; + $info['flac']['CUESHEET']['flags']['is_cd'] = (bool) (getid3_lib::BigEndian2Int(substr($BlockData, $offset, 1)) & 0x80); + $offset += 1; + + $offset += 258; // reserved + + $info['flac']['CUESHEET']['number_tracks'] = getid3_lib::BigEndian2Int(substr($BlockData, $offset, 1)); + $offset += 1; + + for ($track = 0; $track < $info['flac']['CUESHEET']['number_tracks']; $track++) { + $TrackSampleOffset = getid3_lib::BigEndian2Int(substr($BlockData, $offset, 8)); + $offset += 8; + $TrackNumber = getid3_lib::BigEndian2Int(substr($BlockData, $offset, 1)); + $offset += 1; + + $info['flac']['CUESHEET']['tracks'][$TrackNumber]['sample_offset'] = $TrackSampleOffset; + + $info['flac']['CUESHEET']['tracks'][$TrackNumber]['isrc'] = substr($BlockData, $offset, 12); + $offset += 12; + + $TrackFlagsRaw = getid3_lib::BigEndian2Int(substr($BlockData, $offset, 1)); + $offset += 1; + $info['flac']['CUESHEET']['tracks'][$TrackNumber]['flags']['is_audio'] = (bool) ($TrackFlagsRaw & 0x80); + $info['flac']['CUESHEET']['tracks'][$TrackNumber]['flags']['pre_emphasis'] = (bool) ($TrackFlagsRaw & 0x40); + + $offset += 13; // reserved + + $info['flac']['CUESHEET']['tracks'][$TrackNumber]['index_points'] = getid3_lib::BigEndian2Int(substr($BlockData, $offset, 1)); + $offset += 1; + + for ($index = 0; $index < $info['flac']['CUESHEET']['tracks'][$TrackNumber]['index_points']; $index++) { + $IndexSampleOffset = getid3_lib::BigEndian2Int(substr($BlockData, $offset, 8)); + $offset += 8; + $IndexNumber = getid3_lib::BigEndian2Int(substr($BlockData, $offset, 1)); + $offset += 1; + + $offset += 3; // reserved + + $info['flac']['CUESHEET']['tracks'][$TrackNumber]['indexes'][$IndexNumber] = $IndexSampleOffset; + } + } + + return true; + } + + /** + * Parse METADATA_BLOCK_PICTURE flac structure and extract attachment + * External usage: audio.ogg + */ + public function parsePICTURE() { + $info = &$this->getid3->info; + + $picture['typeid'] = getid3_lib::BigEndian2Int($this->fread(4)); + $picture['picturetype'] = self::pictureTypeLookup($picture['typeid']); + $picture['image_mime'] = $this->fread(getid3_lib::BigEndian2Int($this->fread(4))); + $descr_length = getid3_lib::BigEndian2Int($this->fread(4)); + if ($descr_length) { + $picture['description'] = $this->fread($descr_length); + } + $picture['image_width'] = getid3_lib::BigEndian2Int($this->fread(4)); + $picture['image_height'] = getid3_lib::BigEndian2Int($this->fread(4)); + $picture['color_depth'] = getid3_lib::BigEndian2Int($this->fread(4)); + $picture['colors_indexed'] = getid3_lib::BigEndian2Int($this->fread(4)); + $picture['datalength'] = getid3_lib::BigEndian2Int($this->fread(4)); + + if ($picture['image_mime'] == '-->') { + $picture['data'] = $this->fread($picture['datalength']); + } else { + $picture['data'] = $this->saveAttachment( + str_replace('/', '_', $picture['picturetype']).'_'.$this->ftell(), + $this->ftell(), + $picture['datalength'], + $picture['image_mime']); + } + + $info['flac']['PICTURE'][] = $picture; + + return true; + } + + public static function metaBlockTypeLookup($blocktype) { + static $lookup = array( + 0 => 'STREAMINFO', + 1 => 'PADDING', + 2 => 'APPLICATION', + 3 => 'SEEKTABLE', + 4 => 'VORBIS_COMMENT', + 5 => 'CUESHEET', + 6 => 'PICTURE', + ); + return (isset($lookup[$blocktype]) ? $lookup[$blocktype] : 'reserved'); + } + + public static function applicationIDLookup($applicationid) { + // http://flac.sourceforge.net/id.html + static $lookup = array( + 0x41544348 => 'FlacFile', // "ATCH" + 0x42534F4C => 'beSolo', // "BSOL" + 0x42554753 => 'Bugs Player', // "BUGS" + 0x43756573 => 'GoldWave cue points (specification)', // "Cues" + 0x46696361 => 'CUE Splitter', // "Fica" + 0x46746F6C => 'flac-tools', // "Ftol" + 0x4D4F5442 => 'MOTB MetaCzar', // "MOTB" + 0x4D505345 => 'MP3 Stream Editor', // "MPSE" + 0x4D754D4C => 'MusicML: Music Metadata Language', // "MuML" + 0x52494646 => 'Sound Devices RIFF chunk storage', // "RIFF" + 0x5346464C => 'Sound Font FLAC', // "SFFL" + 0x534F4E59 => 'Sony Creative Software', // "SONY" + 0x5351455A => 'flacsqueeze', // "SQEZ" + 0x54745776 => 'TwistedWave', // "TtWv" + 0x55495453 => 'UITS Embedding tools', // "UITS" + 0x61696666 => 'FLAC AIFF chunk storage', // "aiff" + 0x696D6167 => 'flac-image application for storing arbitrary files in APPLICATION metadata blocks', // "imag" + 0x7065656D => 'Parseable Embedded Extensible Metadata (specification)', // "peem" + 0x71667374 => 'QFLAC Studio', // "qfst" + 0x72696666 => 'FLAC RIFF chunk storage', // "riff" + 0x74756E65 => 'TagTuner', // "tune" + 0x78626174 => 'XBAT', // "xbat" + 0x786D6364 => 'xmcd', // "xmcd" + ); + return (isset($lookup[$applicationid]) ? $lookup[$applicationid] : 'reserved'); + } + + public static function pictureTypeLookup($type_id) { + static $lookup = array ( + 0 => 'Other', + 1 => '32x32 pixels \'file icon\' (PNG only)', + 2 => 'Other file icon', + 3 => 'Cover (front)', + 4 => 'Cover (back)', + 5 => 'Leaflet page', + 6 => 'Media (e.g. label side of CD)', + 7 => 'Lead artist/lead performer/soloist', + 8 => 'Artist/performer', + 9 => 'Conductor', + 10 => 'Band/Orchestra', + 11 => 'Composer', + 12 => 'Lyricist/text writer', + 13 => 'Recording Location', + 14 => 'During recording', + 15 => 'During performance', + 16 => 'Movie/video screen capture', + 17 => 'A bright coloured fish', + 18 => 'Illustration', + 19 => 'Band/artist logotype', + 20 => 'Publisher/Studio logotype', + ); + return (isset($lookup[$type_id]) ? $lookup[$type_id] : 'reserved'); + } + +} diff --git a/www/rompr/getid3/module.audio.la.php b/www/rompr/getid3/module.audio.la.php new file mode 100644 index 0000000..f46c9aa --- /dev/null +++ b/www/rompr/getid3/module.audio.la.php @@ -0,0 +1,226 @@ + // +// available at http://getid3.sourceforge.net // +// or http://www.getid3.org // +// also https://github.com/JamesHeinrich/getID3 // +///////////////////////////////////////////////////////////////// +// See readme.txt for more details // +///////////////////////////////////////////////////////////////// +// // +// module.audio.la.php // +// module for analyzing LA (LosslessAudio) audio files // +// dependencies: module.audio.riff.php // +// /// +///////////////////////////////////////////////////////////////// + +getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio-video.riff.php', __FILE__, true); + +class getid3_la extends getid3_handler +{ + + public function Analyze() { + $info = &$this->getid3->info; + + $offset = 0; + $this->fseek($info['avdataoffset']); + $rawdata = $this->fread($this->getid3->fread_buffer_size()); + + switch (substr($rawdata, $offset, 4)) { + case 'LA02': + case 'LA03': + case 'LA04': + $info['fileformat'] = 'la'; + $info['audio']['dataformat'] = 'la'; + $info['audio']['lossless'] = true; + + $info['la']['version_major'] = (int) substr($rawdata, $offset + 2, 1); + $info['la']['version_minor'] = (int) substr($rawdata, $offset + 3, 1); + $info['la']['version'] = (float) $info['la']['version_major'] + ($info['la']['version_minor'] / 10); + $offset += 4; + + $info['la']['uncompressed_size'] = getid3_lib::LittleEndian2Int(substr($rawdata, $offset, 4)); + $offset += 4; + if ($info['la']['uncompressed_size'] == 0) { + $this->error('Corrupt LA file: uncompressed_size == zero'); + return false; + } + + $WAVEchunk = substr($rawdata, $offset, 4); + if ($WAVEchunk !== 'WAVE') { + $this->error('Expected "WAVE" ('.getid3_lib::PrintHexBytes('WAVE').') at offset '.$offset.', found "'.$WAVEchunk.'" ('.getid3_lib::PrintHexBytes($WAVEchunk).') instead.'); + return false; + } + $offset += 4; + + $info['la']['fmt_size'] = 24; + if ($info['la']['version'] >= 0.3) { + + $info['la']['fmt_size'] = getid3_lib::LittleEndian2Int(substr($rawdata, $offset, 4)); + $info['la']['header_size'] = 49 + $info['la']['fmt_size'] - 24; + $offset += 4; + + } else { + + // version 0.2 didn't support additional data blocks + $info['la']['header_size'] = 41; + + } + + $fmt_chunk = substr($rawdata, $offset, 4); + if ($fmt_chunk !== 'fmt ') { + $this->error('Expected "fmt " ('.getid3_lib::PrintHexBytes('fmt ').') at offset '.$offset.', found "'.$fmt_chunk.'" ('.getid3_lib::PrintHexBytes($fmt_chunk).') instead.'); + return false; + } + $offset += 4; + $fmt_size = getid3_lib::LittleEndian2Int(substr($rawdata, $offset, 4)); + $offset += 4; + + $info['la']['raw']['format'] = getid3_lib::LittleEndian2Int(substr($rawdata, $offset, 2)); + $offset += 2; + + $info['la']['channels'] = getid3_lib::LittleEndian2Int(substr($rawdata, $offset, 2)); + $offset += 2; + if ($info['la']['channels'] == 0) { + $this->error('Corrupt LA file: channels == zero'); + return false; + } + + $info['la']['sample_rate'] = getid3_lib::LittleEndian2Int(substr($rawdata, $offset, 4)); + $offset += 4; + if ($info['la']['sample_rate'] == 0) { + $this->error('Corrupt LA file: sample_rate == zero'); + return false; + } + + $info['la']['bytes_per_second'] = getid3_lib::LittleEndian2Int(substr($rawdata, $offset, 4)); + $offset += 4; + $info['la']['bytes_per_sample'] = getid3_lib::LittleEndian2Int(substr($rawdata, $offset, 2)); + $offset += 2; + $info['la']['bits_per_sample'] = getid3_lib::LittleEndian2Int(substr($rawdata, $offset, 2)); + $offset += 2; + + $info['la']['samples'] = getid3_lib::LittleEndian2Int(substr($rawdata, $offset, 4)); + $offset += 4; + + $info['la']['raw']['flags'] = getid3_lib::LittleEndian2Int(substr($rawdata, $offset, 1)); + $offset += 1; + $info['la']['flags']['seekable'] = (bool) ($info['la']['raw']['flags'] & 0x01); + if ($info['la']['version'] >= 0.4) { + $info['la']['flags']['high_compression'] = (bool) ($info['la']['raw']['flags'] & 0x02); + } + + $info['la']['original_crc'] = getid3_lib::LittleEndian2Int(substr($rawdata, $offset, 4)); + $offset += 4; + + // mikeØbevin*de + // Basically, the blocksize/seekevery are 61440/19 in La0.4 and 73728/16 + // in earlier versions. A seekpoint is added every blocksize * seekevery + // samples, so 4 * int(totalSamples / (blockSize * seekEvery)) should + // give the number of bytes used for the seekpoints. Of course, if seeking + // is disabled, there are no seekpoints stored. + if ($info['la']['version'] >= 0.4) { + $info['la']['blocksize'] = 61440; + $info['la']['seekevery'] = 19; + } else { + $info['la']['blocksize'] = 73728; + $info['la']['seekevery'] = 16; + } + + $info['la']['seekpoint_count'] = 0; + if ($info['la']['flags']['seekable']) { + $info['la']['seekpoint_count'] = floor($info['la']['samples'] / ($info['la']['blocksize'] * $info['la']['seekevery'])); + + for ($i = 0; $i < $info['la']['seekpoint_count']; $i++) { + $info['la']['seekpoints'][] = getid3_lib::LittleEndian2Int(substr($rawdata, $offset, 4)); + $offset += 4; + } + } + + if ($info['la']['version'] >= 0.3) { + + // Following the main header information, the program outputs all of the + // seekpoints. Following these is what I called the 'footer start', + // i.e. the position immediately after the La audio data is finished. + $info['la']['footerstart'] = getid3_lib::LittleEndian2Int(substr($rawdata, $offset, 4)); + $offset += 4; + + if ($info['la']['footerstart'] > $info['filesize']) { + $this->warning('FooterStart value points to offset '.$info['la']['footerstart'].' which is beyond end-of-file ('.$info['filesize'].')'); + $info['la']['footerstart'] = $info['filesize']; + } + + } else { + + // La v0.2 didn't have FooterStart value + $info['la']['footerstart'] = $info['avdataend']; + + } + + if ($info['la']['footerstart'] < $info['avdataend']) { + if ($RIFFtempfilename = tempnam(GETID3_TEMP_DIR, 'id3')) { + if ($RIFF_fp = fopen($RIFFtempfilename, 'w+b')) { + $RIFFdata = 'WAVE'; + if ($info['la']['version'] == 0.2) { + $RIFFdata .= substr($rawdata, 12, 24); + } else { + $RIFFdata .= substr($rawdata, 16, 24); + } + if ($info['la']['footerstart'] < $info['avdataend']) { + $this->fseek($info['la']['footerstart']); + $RIFFdata .= $this->fread($info['avdataend'] - $info['la']['footerstart']); + } + $RIFFdata = 'RIFF'.getid3_lib::LittleEndian2String(strlen($RIFFdata), 4, false).$RIFFdata; + fwrite($RIFF_fp, $RIFFdata, strlen($RIFFdata)); + fclose($RIFF_fp); + + $getid3_temp = new getID3(); + $getid3_temp->openfile($RIFFtempfilename); + $getid3_riff = new getid3_riff($getid3_temp); + $getid3_riff->Analyze(); + + if (empty($getid3_temp->info['error'])) { + $info['riff'] = $getid3_temp->info['riff']; + } else { + $this->warning('Error parsing RIFF portion of La file: '.implode($getid3_temp->info['error'])); + } + unset($getid3_temp, $getid3_riff); + } + unlink($RIFFtempfilename); + } + } + + // $info['avdataoffset'] should be zero to begin with, but just in case it's not, include the addition anyway + $info['avdataend'] = $info['avdataoffset'] + $info['la']['footerstart']; + $info['avdataoffset'] = $info['avdataoffset'] + $offset; + + $info['la']['compression_ratio'] = (float) (($info['avdataend'] - $info['avdataoffset']) / $info['la']['uncompressed_size']); + $info['playtime_seconds'] = (float) ($info['la']['samples'] / $info['la']['sample_rate']) / $info['la']['channels']; + if ($info['playtime_seconds'] == 0) { + $this->error('Corrupt LA file: playtime_seconds == zero'); + return false; + } + + $info['audio']['bitrate'] = ($info['avdataend'] - $info['avdataoffset']) * 8 / $info['playtime_seconds']; + //$info['audio']['codec'] = $info['la']['codec']; + $info['audio']['bits_per_sample'] = $info['la']['bits_per_sample']; + break; + + default: + if (substr($rawdata, $offset, 2) == 'LA') { + $this->error('This version of getID3() ['.$this->getid3->version().'] does not support LA version '.substr($rawdata, $offset + 2, 1).'.'.substr($rawdata, $offset + 3, 1).' which this appears to be - check http://getid3.sourceforge.net for updates.'); + } else { + $this->error('Not a LA (Lossless-Audio) file'); + } + return false; + break; + } + + $info['audio']['channels'] = $info['la']['channels']; + $info['audio']['sample_rate'] = (int) $info['la']['sample_rate']; + $info['audio']['encoder'] = 'LA v'.$info['la']['version']; + + return true; + } + +} diff --git a/www/rompr/getid3/module.audio.lpac.php b/www/rompr/getid3/module.audio.lpac.php new file mode 100644 index 0000000..447cc2d --- /dev/null +++ b/www/rompr/getid3/module.audio.lpac.php @@ -0,0 +1,128 @@ + // +// available at http://getid3.sourceforge.net // +// or http://www.getid3.org // +// also https://github.com/JamesHeinrich/getID3 // +///////////////////////////////////////////////////////////////// +// See readme.txt for more details // +///////////////////////////////////////////////////////////////// +// // +// module.audio.lpac.php // +// module for analyzing LPAC Audio files // +// dependencies: module.audio-video.riff.php // +// /// +///////////////////////////////////////////////////////////////// + +getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio-video.riff.php', __FILE__, true); + +class getid3_lpac extends getid3_handler +{ + + public function Analyze() { + $info = &$this->getid3->info; + + $this->fseek($info['avdataoffset']); + $LPACheader = $this->fread(14); + if (substr($LPACheader, 0, 4) != 'LPAC') { + $this->error('Expected "LPAC" at offset '.$info['avdataoffset'].', found "'.$StreamMarker.'"'); + return false; + } + $info['avdataoffset'] += 14; + + $info['fileformat'] = 'lpac'; + $info['audio']['dataformat'] = 'lpac'; + $info['audio']['lossless'] = true; + $info['audio']['bitrate_mode'] = 'vbr'; + + $info['lpac']['file_version'] = getid3_lib::BigEndian2Int(substr($LPACheader, 4, 1)); + $flags['audio_type'] = getid3_lib::BigEndian2Int(substr($LPACheader, 5, 1)); + $info['lpac']['total_samples']= getid3_lib::BigEndian2Int(substr($LPACheader, 6, 4)); + $flags['parameters'] = getid3_lib::BigEndian2Int(substr($LPACheader, 10, 4)); + + $info['lpac']['flags']['is_wave'] = (bool) ($flags['audio_type'] & 0x40); + $info['lpac']['flags']['stereo'] = (bool) ($flags['audio_type'] & 0x04); + $info['lpac']['flags']['24_bit'] = (bool) ($flags['audio_type'] & 0x02); + $info['lpac']['flags']['16_bit'] = (bool) ($flags['audio_type'] & 0x01); + + if ($info['lpac']['flags']['24_bit'] && $info['lpac']['flags']['16_bit']) { + $this->warning('24-bit and 16-bit flags cannot both be set'); + } + + $info['lpac']['flags']['fast_compress'] = (bool) ($flags['parameters'] & 0x40000000); + $info['lpac']['flags']['random_access'] = (bool) ($flags['parameters'] & 0x08000000); + $info['lpac']['block_length'] = pow(2, (($flags['parameters'] & 0x07000000) >> 24)) * 256; + $info['lpac']['flags']['adaptive_prediction_order'] = (bool) ($flags['parameters'] & 0x00800000); + $info['lpac']['flags']['adaptive_quantization'] = (bool) ($flags['parameters'] & 0x00400000); + $info['lpac']['flags']['joint_stereo'] = (bool) ($flags['parameters'] & 0x00040000); + $info['lpac']['quantization'] = ($flags['parameters'] & 0x00001F00) >> 8; + $info['lpac']['max_prediction_order'] = ($flags['parameters'] & 0x0000003F); + + if ($info['lpac']['flags']['fast_compress'] && ($info['lpac']['max_prediction_order'] != 3)) { + $this->warning('max_prediction_order expected to be "3" if fast_compress is true, actual value is "'.$info['lpac']['max_prediction_order'].'"'); + } + switch ($info['lpac']['file_version']) { + case 6: + if ($info['lpac']['flags']['adaptive_quantization']) { + $this->warning('adaptive_quantization expected to be false in LPAC file stucture v6, actually true'); + } + if ($info['lpac']['quantization'] != 20) { + $this->warning('Quantization expected to be 20 in LPAC file stucture v6, actually '.$info['lpac']['flags']['Q']); + } + break; + + default: + //$this->warning('This version of getID3() ['.$this->getid3->version().'] only supports LPAC file format version 6, this file is version '.$info['lpac']['file_version'].' - please report to info@getid3.org'); + break; + } + + $getid3_temp = new getID3(); + $getid3_temp->openfile($this->getid3->filename); + $getid3_temp->info = $info; + $getid3_riff = new getid3_riff($getid3_temp); + $getid3_riff->Analyze(); + $info['avdataoffset'] = $getid3_temp->info['avdataoffset']; + $info['riff'] = $getid3_temp->info['riff']; + $info['error'] = $getid3_temp->info['error']; + $info['warning'] = $getid3_temp->info['warning']; + $info['lpac']['comments']['comment'] = $getid3_temp->info['comments']; + $info['audio']['sample_rate'] = $getid3_temp->info['audio']['sample_rate']; + unset($getid3_temp, $getid3_riff); + + $info['audio']['channels'] = ($info['lpac']['flags']['stereo'] ? 2 : 1); + + if ($info['lpac']['flags']['24_bit']) { + $info['audio']['bits_per_sample'] = $info['riff']['audio'][0]['bits_per_sample']; + } elseif ($info['lpac']['flags']['16_bit']) { + $info['audio']['bits_per_sample'] = 16; + } else { + $info['audio']['bits_per_sample'] = 8; + } + + if ($info['lpac']['flags']['fast_compress']) { + // fast + $info['audio']['encoder_options'] = '-1'; + } else { + switch ($info['lpac']['max_prediction_order']) { + case 20: // simple + $info['audio']['encoder_options'] = '-2'; + break; + case 30: // medium + $info['audio']['encoder_options'] = '-3'; + break; + case 40: // high + $info['audio']['encoder_options'] = '-4'; + break; + case 60: // extrahigh + $info['audio']['encoder_options'] = '-5'; + break; + } + } + + $info['playtime_seconds'] = $info['lpac']['total_samples'] / $info['audio']['sample_rate']; + $info['audio']['bitrate'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / $info['playtime_seconds']; + + return true; + } + +} diff --git a/www/rompr/getid3/module.audio.midi.php b/www/rompr/getid3/module.audio.midi.php new file mode 100644 index 0000000..359aca2 --- /dev/null +++ b/www/rompr/getid3/module.audio.midi.php @@ -0,0 +1,530 @@ + // +// available at http://getid3.sourceforge.net // +// or http://www.getid3.org // +// also https://github.com/JamesHeinrich/getID3 // +///////////////////////////////////////////////////////////////// +// See readme.txt for more details // +///////////////////////////////////////////////////////////////// +// // +// module.audio.midi.php // +// module for Midi Audio files // +// dependencies: NONE // +// /// +///////////////////////////////////////////////////////////////// + +define('GETID3_MIDI_MAGIC_MTHD', 'MThd'); // MIDI file header magic +define('GETID3_MIDI_MAGIC_MTRK', 'MTrk'); // MIDI track header magic + +class getid3_midi extends getid3_handler +{ + public $scanwholefile = true; + + public function Analyze() { + $info = &$this->getid3->info; + + // shortcut + $info['midi']['raw'] = array(); + $thisfile_midi = &$info['midi']; + $thisfile_midi_raw = &$thisfile_midi['raw']; + + $info['fileformat'] = 'midi'; + $info['audio']['dataformat'] = 'midi'; + + $this->fseek($info['avdataoffset']); + $MIDIdata = $this->fread($this->getid3->fread_buffer_size()); + $offset = 0; + $MIDIheaderID = substr($MIDIdata, $offset, 4); // 'MThd' + if ($MIDIheaderID != GETID3_MIDI_MAGIC_MTHD) { + $this->error('Expecting "'.getid3_lib::PrintHexBytes(GETID3_MIDI_MAGIC_MTHD).'" at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes($MIDIheaderID).'"'); + unset($info['fileformat']); + return false; + } + $offset += 4; + $thisfile_midi_raw['headersize'] = getid3_lib::BigEndian2Int(substr($MIDIdata, $offset, 4)); + $offset += 4; + $thisfile_midi_raw['fileformat'] = getid3_lib::BigEndian2Int(substr($MIDIdata, $offset, 2)); + $offset += 2; + $thisfile_midi_raw['tracks'] = getid3_lib::BigEndian2Int(substr($MIDIdata, $offset, 2)); + $offset += 2; + $thisfile_midi_raw['ticksperqnote'] = getid3_lib::BigEndian2Int(substr($MIDIdata, $offset, 2)); + $offset += 2; + + for ($i = 0; $i < $thisfile_midi_raw['tracks']; $i++) { + while ((strlen($MIDIdata) - $offset) < 8) { + if ($buffer = $this->fread($this->getid3->fread_buffer_size())) { + $MIDIdata .= $buffer; + } else { + $this->warning('only processed '.($i - 1).' of '.$thisfile_midi_raw['tracks'].' tracks'); + $this->error('Unabled to read more file data at '.$this->ftell().' (trying to seek to : '.$offset.'), was expecting at least 8 more bytes'); + return false; + } + } + $trackID = substr($MIDIdata, $offset, 4); + $offset += 4; + if ($trackID == GETID3_MIDI_MAGIC_MTRK) { + $tracksize = getid3_lib::BigEndian2Int(substr($MIDIdata, $offset, 4)); + $offset += 4; + //$thisfile_midi['tracks'][$i]['size'] = $tracksize; + $trackdataarray[$i] = substr($MIDIdata, $offset, $tracksize); + $offset += $tracksize; + } else { + $this->error('Expecting "'.getid3_lib::PrintHexBytes(GETID3_MIDI_MAGIC_MTRK).'" at '.($offset - 4).', found "'.getid3_lib::PrintHexBytes($trackID).'" instead'); + return false; + } + } + + if (!isset($trackdataarray) || !is_array($trackdataarray)) { + $this->error('Cannot find MIDI track information'); + unset($thisfile_midi); + unset($info['fileformat']); + return false; + } + + if ($this->scanwholefile) { // this can take quite a long time, so have the option to bypass it if speed is very important + $thisfile_midi['totalticks'] = 0; + $info['playtime_seconds'] = 0; + $CurrentMicroSecondsPerBeat = 500000; // 120 beats per minute; 60,000,000 microseconds per minute -> 500,000 microseconds per beat + $CurrentBeatsPerMinute = 120; // 120 beats per minute; 60,000,000 microseconds per minute -> 500,000 microseconds per beat + $MicroSecondsPerQuarterNoteAfter = array (); + + foreach ($trackdataarray as $tracknumber => $trackdata) { + + $eventsoffset = 0; + $LastIssuedMIDIcommand = 0; + $LastIssuedMIDIchannel = 0; + $CumulativeDeltaTime = 0; + $TicksAtCurrentBPM = 0; + while ($eventsoffset < strlen($trackdata)) { + $eventid = 0; + if (isset($MIDIevents[$tracknumber]) && is_array($MIDIevents[$tracknumber])) { + $eventid = count($MIDIevents[$tracknumber]); + } + $deltatime = 0; + for ($i = 0; $i < 4; $i++) { + $deltatimebyte = ord(substr($trackdata, $eventsoffset++, 1)); + $deltatime = ($deltatime << 7) + ($deltatimebyte & 0x7F); + if ($deltatimebyte & 0x80) { + // another byte follows + } else { + break; + } + } + $CumulativeDeltaTime += $deltatime; + $TicksAtCurrentBPM += $deltatime; + $MIDIevents[$tracknumber][$eventid]['deltatime'] = $deltatime; + $MIDI_event_channel = ord(substr($trackdata, $eventsoffset++, 1)); + if ($MIDI_event_channel & 0x80) { + // OK, normal event - MIDI command has MSB set + $LastIssuedMIDIcommand = $MIDI_event_channel >> 4; + $LastIssuedMIDIchannel = $MIDI_event_channel & 0x0F; + } else { + // running event - assume last command + $eventsoffset--; + } + $MIDIevents[$tracknumber][$eventid]['eventid'] = $LastIssuedMIDIcommand; + $MIDIevents[$tracknumber][$eventid]['channel'] = $LastIssuedMIDIchannel; + if ($MIDIevents[$tracknumber][$eventid]['eventid'] == 0x08) { // Note off (key is released) + + $notenumber = ord(substr($trackdata, $eventsoffset++, 1)); + $velocity = ord(substr($trackdata, $eventsoffset++, 1)); + + } elseif ($MIDIevents[$tracknumber][$eventid]['eventid'] == 0x09) { // Note on (key is pressed) + + $notenumber = ord(substr($trackdata, $eventsoffset++, 1)); + $velocity = ord(substr($trackdata, $eventsoffset++, 1)); + + } elseif ($MIDIevents[$tracknumber][$eventid]['eventid'] == 0x0A) { // Key after-touch + + $notenumber = ord(substr($trackdata, $eventsoffset++, 1)); + $velocity = ord(substr($trackdata, $eventsoffset++, 1)); + + } elseif ($MIDIevents[$tracknumber][$eventid]['eventid'] == 0x0B) { // Control Change + + $controllernum = ord(substr($trackdata, $eventsoffset++, 1)); + $newvalue = ord(substr($trackdata, $eventsoffset++, 1)); + + } elseif ($MIDIevents[$tracknumber][$eventid]['eventid'] == 0x0C) { // Program (patch) change + + $newprogramnum = ord(substr($trackdata, $eventsoffset++, 1)); + + $thisfile_midi_raw['track'][$tracknumber]['instrumentid'] = $newprogramnum; + if ($tracknumber == 10) { + $thisfile_midi_raw['track'][$tracknumber]['instrument'] = $this->GeneralMIDIpercussionLookup($newprogramnum); + } else { + $thisfile_midi_raw['track'][$tracknumber]['instrument'] = $this->GeneralMIDIinstrumentLookup($newprogramnum); + } + + } elseif ($MIDIevents[$tracknumber][$eventid]['eventid'] == 0x0D) { // Channel after-touch + + $channelnumber = ord(substr($trackdata, $eventsoffset++, 1)); + + } elseif ($MIDIevents[$tracknumber][$eventid]['eventid'] == 0x0E) { // Pitch wheel change (2000H is normal or no change) + + $changeLSB = ord(substr($trackdata, $eventsoffset++, 1)); + $changeMSB = ord(substr($trackdata, $eventsoffset++, 1)); + $pitchwheelchange = (($changeMSB & 0x7F) << 7) & ($changeLSB & 0x7F); + + } elseif (($MIDIevents[$tracknumber][$eventid]['eventid'] == 0x0F) && ($MIDIevents[$tracknumber][$eventid]['channel'] == 0x0F)) { + + $METAeventCommand = ord(substr($trackdata, $eventsoffset++, 1)); + $METAeventLength = ord(substr($trackdata, $eventsoffset++, 1)); + $METAeventData = substr($trackdata, $eventsoffset, $METAeventLength); + $eventsoffset += $METAeventLength; + switch ($METAeventCommand) { + case 0x00: // Set track sequence number + $track_sequence_number = getid3_lib::BigEndian2Int(substr($METAeventData, 0, $METAeventLength)); + //$thisfile_midi_raw['events'][$tracknumber][$eventid]['seqno'] = $track_sequence_number; + break; + + case 0x01: // Text: generic + $text_generic = substr($METAeventData, 0, $METAeventLength); + //$thisfile_midi_raw['events'][$tracknumber][$eventid]['text'] = $text_generic; + $thisfile_midi['comments']['comment'][] = $text_generic; + break; + + case 0x02: // Text: copyright + $text_copyright = substr($METAeventData, 0, $METAeventLength); + //$thisfile_midi_raw['events'][$tracknumber][$eventid]['copyright'] = $text_copyright; + $thisfile_midi['comments']['copyright'][] = $text_copyright; + break; + + case 0x03: // Text: track name + $text_trackname = substr($METAeventData, 0, $METAeventLength); + $thisfile_midi_raw['track'][$tracknumber]['name'] = $text_trackname; + break; + + case 0x04: // Text: track instrument name + $text_instrument = substr($METAeventData, 0, $METAeventLength); + //$thisfile_midi_raw['events'][$tracknumber][$eventid]['instrument'] = $text_instrument; + break; + + case 0x05: // Text: lyrics + $text_lyrics = substr($METAeventData, 0, $METAeventLength); + //$thisfile_midi_raw['events'][$tracknumber][$eventid]['lyrics'] = $text_lyrics; + if (!isset($thisfile_midi['lyrics'])) { + $thisfile_midi['lyrics'] = ''; + } + $thisfile_midi['lyrics'] .= $text_lyrics."\n"; + break; + + case 0x06: // Text: marker + $text_marker = substr($METAeventData, 0, $METAeventLength); + //$thisfile_midi_raw['events'][$tracknumber][$eventid]['marker'] = $text_marker; + break; + + case 0x07: // Text: cue point + $text_cuepoint = substr($METAeventData, 0, $METAeventLength); + //$thisfile_midi_raw['events'][$tracknumber][$eventid]['cuepoint'] = $text_cuepoint; + break; + + case 0x2F: // End Of Track + //$thisfile_midi_raw['events'][$tracknumber][$eventid]['EOT'] = $CumulativeDeltaTime; + break; + + case 0x51: // Tempo: microseconds / quarter note + $CurrentMicroSecondsPerBeat = getid3_lib::BigEndian2Int(substr($METAeventData, 0, $METAeventLength)); + if ($CurrentMicroSecondsPerBeat == 0) { + $this->error('Corrupt MIDI file: CurrentMicroSecondsPerBeat == zero'); + return false; + } + $thisfile_midi_raw['events'][$tracknumber][$CumulativeDeltaTime]['us_qnote'] = $CurrentMicroSecondsPerBeat; + $CurrentBeatsPerMinute = (1000000 / $CurrentMicroSecondsPerBeat) * 60; + $MicroSecondsPerQuarterNoteAfter[$CumulativeDeltaTime] = $CurrentMicroSecondsPerBeat; + $TicksAtCurrentBPM = 0; + break; + + case 0x58: // Time signature + $timesig_numerator = getid3_lib::BigEndian2Int($METAeventData{0}); + $timesig_denominator = pow(2, getid3_lib::BigEndian2Int($METAeventData{1})); // $02 -> x/4, $03 -> x/8, etc + $timesig_32inqnote = getid3_lib::BigEndian2Int($METAeventData{2}); // number of 32nd notes to the quarter note + //$thisfile_midi_raw['events'][$tracknumber][$eventid]['timesig_32inqnote'] = $timesig_32inqnote; + //$thisfile_midi_raw['events'][$tracknumber][$eventid]['timesig_numerator'] = $timesig_numerator; + //$thisfile_midi_raw['events'][$tracknumber][$eventid]['timesig_denominator'] = $timesig_denominator; + //$thisfile_midi_raw['events'][$tracknumber][$eventid]['timesig_text'] = $timesig_numerator.'/'.$timesig_denominator; + $thisfile_midi['timesignature'][] = $timesig_numerator.'/'.$timesig_denominator; + break; + + case 0x59: // Keysignature + $keysig_sharpsflats = getid3_lib::BigEndian2Int($METAeventData{0}); + if ($keysig_sharpsflats & 0x80) { + // (-7 -> 7 flats, 0 ->key of C, 7 -> 7 sharps) + $keysig_sharpsflats -= 256; + } + + $keysig_majorminor = getid3_lib::BigEndian2Int($METAeventData{1}); // 0 -> major, 1 -> minor + $keysigs = array(-7=>'Cb', -6=>'Gb', -5=>'Db', -4=>'Ab', -3=>'Eb', -2=>'Bb', -1=>'F', 0=>'C', 1=>'G', 2=>'D', 3=>'A', 4=>'E', 5=>'B', 6=>'F#', 7=>'C#'); + //$thisfile_midi_raw['events'][$tracknumber][$eventid]['keysig_sharps'] = (($keysig_sharpsflats > 0) ? abs($keysig_sharpsflats) : 0); + //$thisfile_midi_raw['events'][$tracknumber][$eventid]['keysig_flats'] = (($keysig_sharpsflats < 0) ? abs($keysig_sharpsflats) : 0); + //$thisfile_midi_raw['events'][$tracknumber][$eventid]['keysig_minor'] = (bool) $keysig_majorminor; + //$thisfile_midi_raw['events'][$tracknumber][$eventid]['keysig_text'] = $keysigs[$keysig_sharpsflats].' '.($thisfile_midi_raw['events'][$tracknumber][$eventid]['keysig_minor'] ? 'minor' : 'major'); + + // $keysigs[$keysig_sharpsflats] gets an int key (correct) - $keysigs["$keysig_sharpsflats"] gets a string key (incorrect) + $thisfile_midi['keysignature'][] = $keysigs[$keysig_sharpsflats].' '.((bool) $keysig_majorminor ? 'minor' : 'major'); + break; + + case 0x7F: // Sequencer specific information + $custom_data = substr($METAeventData, 0, $METAeventLength); + break; + + default: + $this->warning('Unhandled META Event Command: '.$METAeventCommand); + break; + } + + } else { + + $this->warning('Unhandled MIDI Event ID: '.$MIDIevents[$tracknumber][$eventid]['eventid'].' + Channel ID: '.$MIDIevents[$tracknumber][$eventid]['channel']); + + } + } + if (($tracknumber > 0) || (count($trackdataarray) == 1)) { + $thisfile_midi['totalticks'] = max($thisfile_midi['totalticks'], $CumulativeDeltaTime); + } + } + $previoustickoffset = null; + + ksort($MicroSecondsPerQuarterNoteAfter); + foreach ($MicroSecondsPerQuarterNoteAfter as $tickoffset => $microsecondsperbeat) { + if (is_null($previoustickoffset)) { + $prevmicrosecondsperbeat = $microsecondsperbeat; + $previoustickoffset = $tickoffset; + continue; + } + if ($thisfile_midi['totalticks'] > $tickoffset) { + + if ($thisfile_midi_raw['ticksperqnote'] == 0) { + $this->error('Corrupt MIDI file: ticksperqnote == zero'); + return false; + } + + $info['playtime_seconds'] += (($tickoffset - $previoustickoffset) / $thisfile_midi_raw['ticksperqnote']) * ($prevmicrosecondsperbeat / 1000000); + + $prevmicrosecondsperbeat = $microsecondsperbeat; + $previoustickoffset = $tickoffset; + } + } + if ($thisfile_midi['totalticks'] > $previoustickoffset) { + + if ($thisfile_midi_raw['ticksperqnote'] == 0) { + $this->error('Corrupt MIDI file: ticksperqnote == zero'); + return false; + } + + $info['playtime_seconds'] += (($thisfile_midi['totalticks'] - $previoustickoffset) / $thisfile_midi_raw['ticksperqnote']) * ($microsecondsperbeat / 1000000); + + } + } + + + if (!empty($info['playtime_seconds'])) { + $info['bitrate'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / $info['playtime_seconds']; + } + + if (!empty($thisfile_midi['lyrics'])) { + $thisfile_midi['comments']['lyrics'][] = $thisfile_midi['lyrics']; + } + + return true; + } + + public function GeneralMIDIinstrumentLookup($instrumentid) { + + $begin = __LINE__; + + /** This is not a comment! + + 0 Acoustic Grand + 1 Bright Acoustic + 2 Electric Grand + 3 Honky-Tonk + 4 Electric Piano 1 + 5 Electric Piano 2 + 6 Harpsichord + 7 Clavier + 8 Celesta + 9 Glockenspiel + 10 Music Box + 11 Vibraphone + 12 Marimba + 13 Xylophone + 14 Tubular Bells + 15 Dulcimer + 16 Drawbar Organ + 17 Percussive Organ + 18 Rock Organ + 19 Church Organ + 20 Reed Organ + 21 Accordian + 22 Harmonica + 23 Tango Accordian + 24 Acoustic Guitar (nylon) + 25 Acoustic Guitar (steel) + 26 Electric Guitar (jazz) + 27 Electric Guitar (clean) + 28 Electric Guitar (muted) + 29 Overdriven Guitar + 30 Distortion Guitar + 31 Guitar Harmonics + 32 Acoustic Bass + 33 Electric Bass (finger) + 34 Electric Bass (pick) + 35 Fretless Bass + 36 Slap Bass 1 + 37 Slap Bass 2 + 38 Synth Bass 1 + 39 Synth Bass 2 + 40 Violin + 41 Viola + 42 Cello + 43 Contrabass + 44 Tremolo Strings + 45 Pizzicato Strings + 46 Orchestral Strings + 47 Timpani + 48 String Ensemble 1 + 49 String Ensemble 2 + 50 SynthStrings 1 + 51 SynthStrings 2 + 52 Choir Aahs + 53 Voice Oohs + 54 Synth Voice + 55 Orchestra Hit + 56 Trumpet + 57 Trombone + 58 Tuba + 59 Muted Trumpet + 60 French Horn + 61 Brass Section + 62 SynthBrass 1 + 63 SynthBrass 2 + 64 Soprano Sax + 65 Alto Sax + 66 Tenor Sax + 67 Baritone Sax + 68 Oboe + 69 English Horn + 70 Bassoon + 71 Clarinet + 72 Piccolo + 73 Flute + 74 Recorder + 75 Pan Flute + 76 Blown Bottle + 77 Shakuhachi + 78 Whistle + 79 Ocarina + 80 Lead 1 (square) + 81 Lead 2 (sawtooth) + 82 Lead 3 (calliope) + 83 Lead 4 (chiff) + 84 Lead 5 (charang) + 85 Lead 6 (voice) + 86 Lead 7 (fifths) + 87 Lead 8 (bass + lead) + 88 Pad 1 (new age) + 89 Pad 2 (warm) + 90 Pad 3 (polysynth) + 91 Pad 4 (choir) + 92 Pad 5 (bowed) + 93 Pad 6 (metallic) + 94 Pad 7 (halo) + 95 Pad 8 (sweep) + 96 FX 1 (rain) + 97 FX 2 (soundtrack) + 98 FX 3 (crystal) + 99 FX 4 (atmosphere) + 100 FX 5 (brightness) + 101 FX 6 (goblins) + 102 FX 7 (echoes) + 103 FX 8 (sci-fi) + 104 Sitar + 105 Banjo + 106 Shamisen + 107 Koto + 108 Kalimba + 109 Bagpipe + 110 Fiddle + 111 Shanai + 112 Tinkle Bell + 113 Agogo + 114 Steel Drums + 115 Woodblock + 116 Taiko Drum + 117 Melodic Tom + 118 Synth Drum + 119 Reverse Cymbal + 120 Guitar Fret Noise + 121 Breath Noise + 122 Seashore + 123 Bird Tweet + 124 Telephone Ring + 125 Helicopter + 126 Applause + 127 Gunshot + + */ + + return getid3_lib::EmbeddedLookup($instrumentid, $begin, __LINE__, __FILE__, 'GeneralMIDIinstrument'); + } + + public function GeneralMIDIpercussionLookup($instrumentid) { + + $begin = __LINE__; + + /** This is not a comment! + + 35 Acoustic Bass Drum + 36 Bass Drum 1 + 37 Side Stick + 38 Acoustic Snare + 39 Hand Clap + 40 Electric Snare + 41 Low Floor Tom + 42 Closed Hi-Hat + 43 High Floor Tom + 44 Pedal Hi-Hat + 45 Low Tom + 46 Open Hi-Hat + 47 Low-Mid Tom + 48 Hi-Mid Tom + 49 Crash Cymbal 1 + 50 High Tom + 51 Ride Cymbal 1 + 52 Chinese Cymbal + 53 Ride Bell + 54 Tambourine + 55 Splash Cymbal + 56 Cowbell + 57 Crash Cymbal 2 + 59 Ride Cymbal 2 + 60 Hi Bongo + 61 Low Bongo + 62 Mute Hi Conga + 63 Open Hi Conga + 64 Low Conga + 65 High Timbale + 66 Low Timbale + 67 High Agogo + 68 Low Agogo + 69 Cabasa + 70 Maracas + 71 Short Whistle + 72 Long Whistle + 73 Short Guiro + 74 Long Guiro + 75 Claves + 76 Hi Wood Block + 77 Low Wood Block + 78 Mute Cuica + 79 Open Cuica + 80 Mute Triangle + 81 Open Triangle + + */ + + return getid3_lib::EmbeddedLookup($instrumentid, $begin, __LINE__, __FILE__, 'GeneralMIDIpercussion'); + } + +} diff --git a/www/rompr/getid3/module.audio.mod.php b/www/rompr/getid3/module.audio.mod.php new file mode 100644 index 0000000..4b888ec --- /dev/null +++ b/www/rompr/getid3/module.audio.mod.php @@ -0,0 +1,99 @@ + // +// available at http://getid3.sourceforge.net // +// or http://www.getid3.org // +// also https://github.com/JamesHeinrich/getID3 // +///////////////////////////////////////////////////////////////// +// See readme.txt for more details // +///////////////////////////////////////////////////////////////// +// // +// module.audio.mod.php // +// module for analyzing MOD Audio files // +// dependencies: NONE // +// /// +///////////////////////////////////////////////////////////////// + + +class getid3_mod extends getid3_handler +{ + + public function Analyze() { + $info = &$this->getid3->info; + $this->fseek($info['avdataoffset']); + $fileheader = $this->fread(1088); + if (preg_match('#^IMPM#', $fileheader)) { + return $this->getITheaderFilepointer(); + } elseif (preg_match('#^Extended Module#', $fileheader)) { + return $this->getXMheaderFilepointer(); + } elseif (preg_match('#^.{44}SCRM#', $fileheader)) { + return $this->getS3MheaderFilepointer(); + } elseif (preg_match('#^.{1080}(M\\.K\\.|M!K!|FLT4|FLT8|[5-9]CHN|[1-3][0-9]CH)#', $fileheader)) { + return $this->getMODheaderFilepointer(); + } + $this->error('This is not a known type of MOD file'); + return false; + } + + + public function getMODheaderFilepointer() { + $info = &$this->getid3->info; + $this->fseek($info['avdataoffset'] + 1080); + $FormatID = $this->fread(4); + if (!preg_match('#^(M.K.|[5-9]CHN|[1-3][0-9]CH)$#', $FormatID)) { + $this->error('This is not a known type of MOD file'); + return false; + } + + $info['fileformat'] = 'mod'; + + $this->error('MOD parsing not enabled in this version of getID3() ['.$this->getid3->version().']'); + return false; + } + + public function getXMheaderFilepointer() { + $info = &$this->getid3->info; + $this->fseek($info['avdataoffset']); + $FormatID = $this->fread(15); + if (!preg_match('#^Extended Module$#', $FormatID)) { + $this->error('This is not a known type of XM-MOD file'); + return false; + } + + $info['fileformat'] = 'xm'; + + $this->error('XM-MOD parsing not enabled in this version of getID3() ['.$this->getid3->version().']'); + return false; + } + + public function getS3MheaderFilepointer() { + $info = &$this->getid3->info; + $this->fseek($info['avdataoffset'] + 44); + $FormatID = $this->fread(4); + if (!preg_match('#^SCRM$#', $FormatID)) { + $this->error('This is not a ScreamTracker MOD file'); + return false; + } + + $info['fileformat'] = 's3m'; + + $this->error('ScreamTracker parsing not enabled in this version of getID3() ['.$this->getid3->version().']'); + return false; + } + + public function getITheaderFilepointer() { + $info = &$this->getid3->info; + $this->fseek($info['avdataoffset']); + $FormatID = $this->fread(4); + if (!preg_match('#^IMPM$#', $FormatID)) { + $this->error('This is not an ImpulseTracker MOD file'); + return false; + } + + $info['fileformat'] = 'it'; + + $this->error('ImpulseTracker parsing not enabled in this version of getID3() ['.$this->getid3->version().']'); + return false; + } + +} diff --git a/www/rompr/getid3/module.audio.monkey.php b/www/rompr/getid3/module.audio.monkey.php new file mode 100644 index 0000000..afa2eaf --- /dev/null +++ b/www/rompr/getid3/module.audio.monkey.php @@ -0,0 +1,204 @@ + // +// available at http://getid3.sourceforge.net // +// or http://www.getid3.org // +// also https://github.com/JamesHeinrich/getID3 // +///////////////////////////////////////////////////////////////// +// See readme.txt for more details // +///////////////////////////////////////////////////////////////// +// // +// module.audio.monkey.php // +// module for analyzing Monkey's Audio files // +// dependencies: NONE // +// /// +///////////////////////////////////////////////////////////////// + + +class getid3_monkey extends getid3_handler +{ + + public function Analyze() { + $info = &$this->getid3->info; + + // based loosely on code from TMonkey by Jurgen Faul + // http://jfaul.de/atl or http://j-faul.virtualave.net/atl/atl.html + + $info['fileformat'] = 'mac'; + $info['audio']['dataformat'] = 'mac'; + $info['audio']['bitrate_mode'] = 'vbr'; + $info['audio']['lossless'] = true; + + $info['monkeys_audio']['raw'] = array(); + $thisfile_monkeysaudio = &$info['monkeys_audio']; + $thisfile_monkeysaudio_raw = &$thisfile_monkeysaudio['raw']; + + $this->fseek($info['avdataoffset']); + $MACheaderData = $this->fread(74); + + $thisfile_monkeysaudio_raw['magic'] = substr($MACheaderData, 0, 4); + $magic = 'MAC '; + if ($thisfile_monkeysaudio_raw['magic'] != $magic) { + $this->error('Expecting "'.getid3_lib::PrintHexBytes($magic).'" at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes($thisfile_monkeysaudio_raw['magic']).'"'); + unset($info['fileformat']); + return false; + } + $thisfile_monkeysaudio_raw['nVersion'] = getid3_lib::LittleEndian2Int(substr($MACheaderData, 4, 2)); // appears to be uint32 in 3.98+ + + if ($thisfile_monkeysaudio_raw['nVersion'] < 3980) { + $thisfile_monkeysaudio_raw['nCompressionLevel'] = getid3_lib::LittleEndian2Int(substr($MACheaderData, 6, 2)); + $thisfile_monkeysaudio_raw['nFormatFlags'] = getid3_lib::LittleEndian2Int(substr($MACheaderData, 8, 2)); + $thisfile_monkeysaudio_raw['nChannels'] = getid3_lib::LittleEndian2Int(substr($MACheaderData, 10, 2)); + $thisfile_monkeysaudio_raw['nSampleRate'] = getid3_lib::LittleEndian2Int(substr($MACheaderData, 12, 4)); + $thisfile_monkeysaudio_raw['nHeaderDataBytes'] = getid3_lib::LittleEndian2Int(substr($MACheaderData, 16, 4)); + $thisfile_monkeysaudio_raw['nWAVTerminatingBytes'] = getid3_lib::LittleEndian2Int(substr($MACheaderData, 20, 4)); + $thisfile_monkeysaudio_raw['nTotalFrames'] = getid3_lib::LittleEndian2Int(substr($MACheaderData, 24, 4)); + $thisfile_monkeysaudio_raw['nFinalFrameSamples'] = getid3_lib::LittleEndian2Int(substr($MACheaderData, 28, 4)); + $thisfile_monkeysaudio_raw['nPeakLevel'] = getid3_lib::LittleEndian2Int(substr($MACheaderData, 32, 4)); + $thisfile_monkeysaudio_raw['nSeekElements'] = getid3_lib::LittleEndian2Int(substr($MACheaderData, 38, 2)); + $offset = 8; + } else { + $offset = 8; + // APE_DESCRIPTOR + $thisfile_monkeysaudio_raw['nDescriptorBytes'] = getid3_lib::LittleEndian2Int(substr($MACheaderData, $offset, 4)); + $offset += 4; + $thisfile_monkeysaudio_raw['nHeaderBytes'] = getid3_lib::LittleEndian2Int(substr($MACheaderData, $offset, 4)); + $offset += 4; + $thisfile_monkeysaudio_raw['nSeekTableBytes'] = getid3_lib::LittleEndian2Int(substr($MACheaderData, $offset, 4)); + $offset += 4; + $thisfile_monkeysaudio_raw['nHeaderDataBytes'] = getid3_lib::LittleEndian2Int(substr($MACheaderData, $offset, 4)); + $offset += 4; + $thisfile_monkeysaudio_raw['nAPEFrameDataBytes'] = getid3_lib::LittleEndian2Int(substr($MACheaderData, $offset, 4)); + $offset += 4; + $thisfile_monkeysaudio_raw['nAPEFrameDataBytesHigh'] = getid3_lib::LittleEndian2Int(substr($MACheaderData, $offset, 4)); + $offset += 4; + $thisfile_monkeysaudio_raw['nTerminatingDataBytes'] = getid3_lib::LittleEndian2Int(substr($MACheaderData, $offset, 4)); + $offset += 4; + $thisfile_monkeysaudio_raw['cFileMD5'] = substr($MACheaderData, $offset, 16); + $offset += 16; + + // APE_HEADER + $thisfile_monkeysaudio_raw['nCompressionLevel'] = getid3_lib::LittleEndian2Int(substr($MACheaderData, $offset, 2)); + $offset += 2; + $thisfile_monkeysaudio_raw['nFormatFlags'] = getid3_lib::LittleEndian2Int(substr($MACheaderData, $offset, 2)); + $offset += 2; + $thisfile_monkeysaudio_raw['nBlocksPerFrame'] = getid3_lib::LittleEndian2Int(substr($MACheaderData, $offset, 4)); + $offset += 4; + $thisfile_monkeysaudio_raw['nFinalFrameBlocks'] = getid3_lib::LittleEndian2Int(substr($MACheaderData, $offset, 4)); + $offset += 4; + $thisfile_monkeysaudio_raw['nTotalFrames'] = getid3_lib::LittleEndian2Int(substr($MACheaderData, $offset, 4)); + $offset += 4; + $thisfile_monkeysaudio_raw['nBitsPerSample'] = getid3_lib::LittleEndian2Int(substr($MACheaderData, $offset, 2)); + $offset += 2; + $thisfile_monkeysaudio_raw['nChannels'] = getid3_lib::LittleEndian2Int(substr($MACheaderData, $offset, 2)); + $offset += 2; + $thisfile_monkeysaudio_raw['nSampleRate'] = getid3_lib::LittleEndian2Int(substr($MACheaderData, $offset, 4)); + $offset += 4; + } + + $thisfile_monkeysaudio['flags']['8-bit'] = (bool) ($thisfile_monkeysaudio_raw['nFormatFlags'] & 0x0001); + $thisfile_monkeysaudio['flags']['crc-32'] = (bool) ($thisfile_monkeysaudio_raw['nFormatFlags'] & 0x0002); + $thisfile_monkeysaudio['flags']['peak_level'] = (bool) ($thisfile_monkeysaudio_raw['nFormatFlags'] & 0x0004); + $thisfile_monkeysaudio['flags']['24-bit'] = (bool) ($thisfile_monkeysaudio_raw['nFormatFlags'] & 0x0008); + $thisfile_monkeysaudio['flags']['seek_elements'] = (bool) ($thisfile_monkeysaudio_raw['nFormatFlags'] & 0x0010); + $thisfile_monkeysaudio['flags']['no_wav_header'] = (bool) ($thisfile_monkeysaudio_raw['nFormatFlags'] & 0x0020); + $thisfile_monkeysaudio['version'] = $thisfile_monkeysaudio_raw['nVersion'] / 1000; + $thisfile_monkeysaudio['compression'] = $this->MonkeyCompressionLevelNameLookup($thisfile_monkeysaudio_raw['nCompressionLevel']); + if ($thisfile_monkeysaudio_raw['nVersion'] < 3980) { + $thisfile_monkeysaudio['samples_per_frame'] = $this->MonkeySamplesPerFrame($thisfile_monkeysaudio_raw['nVersion'], $thisfile_monkeysaudio_raw['nCompressionLevel']); + } + $thisfile_monkeysaudio['bits_per_sample'] = ($thisfile_monkeysaudio['flags']['24-bit'] ? 24 : ($thisfile_monkeysaudio['flags']['8-bit'] ? 8 : 16)); + $thisfile_monkeysaudio['channels'] = $thisfile_monkeysaudio_raw['nChannels']; + $info['audio']['channels'] = $thisfile_monkeysaudio['channels']; + $thisfile_monkeysaudio['sample_rate'] = $thisfile_monkeysaudio_raw['nSampleRate']; + if ($thisfile_monkeysaudio['sample_rate'] == 0) { + $this->error('Corrupt MAC file: frequency == zero'); + return false; + } + $info['audio']['sample_rate'] = $thisfile_monkeysaudio['sample_rate']; + if ($thisfile_monkeysaudio['flags']['peak_level']) { + $thisfile_monkeysaudio['peak_level'] = $thisfile_monkeysaudio_raw['nPeakLevel']; + $thisfile_monkeysaudio['peak_ratio'] = $thisfile_monkeysaudio['peak_level'] / pow(2, $thisfile_monkeysaudio['bits_per_sample'] - 1); + } + if ($thisfile_monkeysaudio_raw['nVersion'] >= 3980) { + $thisfile_monkeysaudio['samples'] = (($thisfile_monkeysaudio_raw['nTotalFrames'] - 1) * $thisfile_monkeysaudio_raw['nBlocksPerFrame']) + $thisfile_monkeysaudio_raw['nFinalFrameBlocks']; + } else { + $thisfile_monkeysaudio['samples'] = (($thisfile_monkeysaudio_raw['nTotalFrames'] - 1) * $thisfile_monkeysaudio['samples_per_frame']) + $thisfile_monkeysaudio_raw['nFinalFrameSamples']; + } + $thisfile_monkeysaudio['playtime'] = $thisfile_monkeysaudio['samples'] / $thisfile_monkeysaudio['sample_rate']; + if ($thisfile_monkeysaudio['playtime'] == 0) { + $this->error('Corrupt MAC file: playtime == zero'); + return false; + } + $info['playtime_seconds'] = $thisfile_monkeysaudio['playtime']; + $thisfile_monkeysaudio['compressed_size'] = $info['avdataend'] - $info['avdataoffset']; + $thisfile_monkeysaudio['uncompressed_size'] = $thisfile_monkeysaudio['samples'] * $thisfile_monkeysaudio['channels'] * ($thisfile_monkeysaudio['bits_per_sample'] / 8); + if ($thisfile_monkeysaudio['uncompressed_size'] == 0) { + $this->error('Corrupt MAC file: uncompressed_size == zero'); + return false; + } + $thisfile_monkeysaudio['compression_ratio'] = $thisfile_monkeysaudio['compressed_size'] / ($thisfile_monkeysaudio['uncompressed_size'] + $thisfile_monkeysaudio_raw['nHeaderDataBytes']); + $thisfile_monkeysaudio['bitrate'] = (($thisfile_monkeysaudio['samples'] * $thisfile_monkeysaudio['channels'] * $thisfile_monkeysaudio['bits_per_sample']) / $thisfile_monkeysaudio['playtime']) * $thisfile_monkeysaudio['compression_ratio']; + $info['audio']['bitrate'] = $thisfile_monkeysaudio['bitrate']; + + // add size of MAC header to avdataoffset + if ($thisfile_monkeysaudio_raw['nVersion'] >= 3980) { + $info['avdataoffset'] += $thisfile_monkeysaudio_raw['nDescriptorBytes']; + $info['avdataoffset'] += $thisfile_monkeysaudio_raw['nHeaderBytes']; + $info['avdataoffset'] += $thisfile_monkeysaudio_raw['nSeekTableBytes']; + $info['avdataoffset'] += $thisfile_monkeysaudio_raw['nHeaderDataBytes']; + + $info['avdataend'] -= $thisfile_monkeysaudio_raw['nTerminatingDataBytes']; + } else { + $info['avdataoffset'] += $offset; + } + + if ($thisfile_monkeysaudio_raw['nVersion'] >= 3980) { + if ($thisfile_monkeysaudio_raw['cFileMD5'] === str_repeat("\x00", 16)) { + //$this->warning('cFileMD5 is null'); + } else { + $info['md5_data_source'] = ''; + $md5 = $thisfile_monkeysaudio_raw['cFileMD5']; + for ($i = 0; $i < strlen($md5); $i++) { + $info['md5_data_source'] .= str_pad(dechex(ord($md5{$i})), 2, '00', STR_PAD_LEFT); + } + if (!preg_match('/^[0-9a-f]{32}$/', $info['md5_data_source'])) { + unset($info['md5_data_source']); + } + } + } + + + + $info['audio']['bits_per_sample'] = $thisfile_monkeysaudio['bits_per_sample']; + $info['audio']['encoder'] = 'MAC v'.number_format($thisfile_monkeysaudio['version'], 2); + $info['audio']['encoder_options'] = ucfirst($thisfile_monkeysaudio['compression']).' compression'; + + return true; + } + + public function MonkeyCompressionLevelNameLookup($compressionlevel) { + static $MonkeyCompressionLevelNameLookup = array( + 0 => 'unknown', + 1000 => 'fast', + 2000 => 'normal', + 3000 => 'high', + 4000 => 'extra-high', + 5000 => 'insane' + ); + return (isset($MonkeyCompressionLevelNameLookup[$compressionlevel]) ? $MonkeyCompressionLevelNameLookup[$compressionlevel] : 'invalid'); + } + + public function MonkeySamplesPerFrame($versionid, $compressionlevel) { + if ($versionid >= 3950) { + return 73728 * 4; + } elseif ($versionid >= 3900) { + return 73728; + } elseif (($versionid >= 3800) && ($compressionlevel == 4000)) { + return 73728; + } else { + return 9216; + } + } + +} diff --git a/www/rompr/getid3/module.audio.mp3.php b/www/rompr/getid3/module.audio.mp3.php new file mode 100644 index 0000000..ed2d844 --- /dev/null +++ b/www/rompr/getid3/module.audio.mp3.php @@ -0,0 +1,2023 @@ + // +// available at http://getid3.sourceforge.net // +// or http://www.getid3.org // +// also https://github.com/JamesHeinrich/getID3 // +///////////////////////////////////////////////////////////////// +// See readme.txt for more details // +///////////////////////////////////////////////////////////////// +// // +// module.audio.mp3.php // +// module for analyzing MP3 files // +// dependencies: NONE // +// /// +///////////////////////////////////////////////////////////////// + + +// number of frames to scan to determine if MPEG-audio sequence is valid +// Lower this number to 5-20 for faster scanning +// Increase this number to 50+ for most accurate detection of valid VBR/CBR +// mpeg-audio streams +define('GETID3_MP3_VALID_CHECK_FRAMES', 35); + + +class getid3_mp3 extends getid3_handler +{ + + public $allow_bruteforce = false; // forces getID3() to scan the file byte-by-byte and log all the valid audio frame headers - extremely slow, unrecommended, but may provide data from otherwise-unusuable files + + public function Analyze() { + $info = &$this->getid3->info; + + $initialOffset = $info['avdataoffset']; + + if (!$this->getOnlyMPEGaudioInfo($info['avdataoffset'])) { + if ($this->allow_bruteforce) { + $this->error('Rescanning file in BruteForce mode'); + $this->getOnlyMPEGaudioInfoBruteForce($this->getid3->fp, $info); + } + } + + + if (isset($info['mpeg']['audio']['bitrate_mode'])) { + $info['audio']['bitrate_mode'] = strtolower($info['mpeg']['audio']['bitrate_mode']); + } + + if (((isset($info['id3v2']['headerlength']) && ($info['avdataoffset'] > $info['id3v2']['headerlength'])) || (!isset($info['id3v2']) && ($info['avdataoffset'] > 0) && ($info['avdataoffset'] != $initialOffset)))) { + + $synchoffsetwarning = 'Unknown data before synch '; + if (isset($info['id3v2']['headerlength'])) { + $synchoffsetwarning .= '(ID3v2 header ends at '.$info['id3v2']['headerlength'].', then '.($info['avdataoffset'] - $info['id3v2']['headerlength']).' bytes garbage, '; + } elseif ($initialOffset > 0) { + $synchoffsetwarning .= '(should be at '.$initialOffset.', '; + } else { + $synchoffsetwarning .= '(should be at beginning of file, '; + } + $synchoffsetwarning .= 'synch detected at '.$info['avdataoffset'].')'; + if (isset($info['audio']['bitrate_mode']) && ($info['audio']['bitrate_mode'] == 'cbr')) { + + if (!empty($info['id3v2']['headerlength']) && (($info['avdataoffset'] - $info['id3v2']['headerlength']) == $info['mpeg']['audio']['framelength'])) { + + $synchoffsetwarning .= '. This is a known problem with some versions of LAME (3.90-3.92) DLL in CBR mode.'; + $info['audio']['codec'] = 'LAME'; + $CurrentDataLAMEversionString = 'LAME3.'; + + } elseif (empty($info['id3v2']['headerlength']) && ($info['avdataoffset'] == $info['mpeg']['audio']['framelength'])) { + + $synchoffsetwarning .= '. This is a known problem with some versions of LAME (3.90 - 3.92) DLL in CBR mode.'; + $info['audio']['codec'] = 'LAME'; + $CurrentDataLAMEversionString = 'LAME3.'; + + } + + } + $this->warning($synchoffsetwarning); + + } + + if (isset($info['mpeg']['audio']['LAME'])) { + $info['audio']['codec'] = 'LAME'; + if (!empty($info['mpeg']['audio']['LAME']['long_version'])) { + $info['audio']['encoder'] = rtrim($info['mpeg']['audio']['LAME']['long_version'], "\x00"); + } elseif (!empty($info['mpeg']['audio']['LAME']['short_version'])) { + $info['audio']['encoder'] = rtrim($info['mpeg']['audio']['LAME']['short_version'], "\x00"); + } + } + + $CurrentDataLAMEversionString = (!empty($CurrentDataLAMEversionString) ? $CurrentDataLAMEversionString : (isset($info['audio']['encoder']) ? $info['audio']['encoder'] : '')); + if (!empty($CurrentDataLAMEversionString) && (substr($CurrentDataLAMEversionString, 0, 6) == 'LAME3.') && !preg_match('[0-9\)]', substr($CurrentDataLAMEversionString, -1))) { + // a version number of LAME that does not end with a number like "LAME3.92" + // or with a closing parenthesis like "LAME3.88 (alpha)" + // or a version of LAME with the LAMEtag-not-filled-in-DLL-mode bug (3.90-3.92) + + // not sure what the actual last frame length will be, but will be less than or equal to 1441 + $PossiblyLongerLAMEversion_FrameLength = 1441; + + // Not sure what version of LAME this is - look in padding of last frame for longer version string + $PossibleLAMEversionStringOffset = $info['avdataend'] - $PossiblyLongerLAMEversion_FrameLength; + $this->fseek($PossibleLAMEversionStringOffset); + $PossiblyLongerLAMEversion_Data = $this->fread($PossiblyLongerLAMEversion_FrameLength); + switch (substr($CurrentDataLAMEversionString, -1)) { + case 'a': + case 'b': + // "LAME3.94a" will have a longer version string of "LAME3.94 (alpha)" for example + // need to trim off "a" to match longer string + $CurrentDataLAMEversionString = substr($CurrentDataLAMEversionString, 0, -1); + break; + } + if (($PossiblyLongerLAMEversion_String = strstr($PossiblyLongerLAMEversion_Data, $CurrentDataLAMEversionString)) !== false) { + if (substr($PossiblyLongerLAMEversion_String, 0, strlen($CurrentDataLAMEversionString)) == $CurrentDataLAMEversionString) { + $PossiblyLongerLAMEversion_NewString = substr($PossiblyLongerLAMEversion_String, 0, strspn($PossiblyLongerLAMEversion_String, 'LAME0123456789., (abcdefghijklmnopqrstuvwxyzJFSOND)')); //"LAME3.90.3" "LAME3.87 (beta 1, Sep 27 2000)" "LAME3.88 (beta)" + if (empty($info['audio']['encoder']) || (strlen($PossiblyLongerLAMEversion_NewString) > strlen($info['audio']['encoder']))) { + $info['audio']['encoder'] = $PossiblyLongerLAMEversion_NewString; + } + } + } + } + if (!empty($info['audio']['encoder'])) { + $info['audio']['encoder'] = rtrim($info['audio']['encoder'], "\x00 "); + } + + switch (isset($info['mpeg']['audio']['layer']) ? $info['mpeg']['audio']['layer'] : '') { + case 1: + case 2: + $info['audio']['dataformat'] = 'mp'.$info['mpeg']['audio']['layer']; + break; + } + if (isset($info['fileformat']) && ($info['fileformat'] == 'mp3')) { + switch ($info['audio']['dataformat']) { + case 'mp1': + case 'mp2': + case 'mp3': + $info['fileformat'] = $info['audio']['dataformat']; + break; + + default: + $this->warning('Expecting [audio][dataformat] to be mp1/mp2/mp3 when fileformat == mp3, [audio][dataformat] actually "'.$info['audio']['dataformat'].'"'); + break; + } + } + + if (empty($info['fileformat'])) { + unset($info['fileformat']); + unset($info['audio']['bitrate_mode']); + unset($info['avdataoffset']); + unset($info['avdataend']); + return false; + } + + $info['mime_type'] = 'audio/mpeg'; + $info['audio']['lossless'] = false; + + // Calculate playtime + if (!isset($info['playtime_seconds']) && isset($info['audio']['bitrate']) && ($info['audio']['bitrate'] > 0)) { + $info['playtime_seconds'] = ($info['avdataend'] - $info['avdataoffset']) * 8 / $info['audio']['bitrate']; + } + + $info['audio']['encoder_options'] = $this->GuessEncoderOptions(); + + return true; + } + + + public function GuessEncoderOptions() { + // shortcuts + $info = &$this->getid3->info; + if (!empty($info['mpeg']['audio'])) { + $thisfile_mpeg_audio = &$info['mpeg']['audio']; + if (!empty($thisfile_mpeg_audio['LAME'])) { + $thisfile_mpeg_audio_lame = &$thisfile_mpeg_audio['LAME']; + } + } + + $encoder_options = ''; + static $NamedPresetBitrates = array(16, 24, 40, 56, 112, 128, 160, 192, 256); + + if (isset($thisfile_mpeg_audio['VBR_method']) && ($thisfile_mpeg_audio['VBR_method'] == 'Fraunhofer') && !empty($thisfile_mpeg_audio['VBR_quality'])) { + + $encoder_options = 'VBR q'.$thisfile_mpeg_audio['VBR_quality']; + + } elseif (!empty($thisfile_mpeg_audio_lame['preset_used']) && (!in_array($thisfile_mpeg_audio_lame['preset_used_id'], $NamedPresetBitrates))) { + + $encoder_options = $thisfile_mpeg_audio_lame['preset_used']; + + } elseif (!empty($thisfile_mpeg_audio_lame['vbr_quality'])) { + + static $KnownEncoderValues = array(); + if (empty($KnownEncoderValues)) { + + //$KnownEncoderValues[abrbitrate_minbitrate][vbr_quality][raw_vbr_method][raw_noise_shaping][raw_stereo_mode][ath_type][lowpass_frequency] = 'preset name'; + $KnownEncoderValues[0xFF][58][1][1][3][2][20500] = '--alt-preset insane'; // 3.90, 3.90.1, 3.92 + $KnownEncoderValues[0xFF][58][1][1][3][2][20600] = '--alt-preset insane'; // 3.90.2, 3.90.3, 3.91 + $KnownEncoderValues[0xFF][57][1][1][3][4][20500] = '--alt-preset insane'; // 3.94, 3.95 + $KnownEncoderValues['**'][78][3][2][3][2][19500] = '--alt-preset extreme'; // 3.90, 3.90.1, 3.92 + $KnownEncoderValues['**'][78][3][2][3][2][19600] = '--alt-preset extreme'; // 3.90.2, 3.91 + $KnownEncoderValues['**'][78][3][1][3][2][19600] = '--alt-preset extreme'; // 3.90.3 + $KnownEncoderValues['**'][78][4][2][3][2][19500] = '--alt-preset fast extreme'; // 3.90, 3.90.1, 3.92 + $KnownEncoderValues['**'][78][4][2][3][2][19600] = '--alt-preset fast extreme'; // 3.90.2, 3.90.3, 3.91 + $KnownEncoderValues['**'][78][3][2][3][4][19000] = '--alt-preset standard'; // 3.90, 3.90.1, 3.90.2, 3.91, 3.92 + $KnownEncoderValues['**'][78][3][1][3][4][19000] = '--alt-preset standard'; // 3.90.3 + $KnownEncoderValues['**'][78][4][2][3][4][19000] = '--alt-preset fast standard'; // 3.90, 3.90.1, 3.90.2, 3.91, 3.92 + $KnownEncoderValues['**'][78][4][1][3][4][19000] = '--alt-preset fast standard'; // 3.90.3 + $KnownEncoderValues['**'][88][4][1][3][3][19500] = '--r3mix'; // 3.90, 3.90.1, 3.92 + $KnownEncoderValues['**'][88][4][1][3][3][19600] = '--r3mix'; // 3.90.2, 3.90.3, 3.91 + $KnownEncoderValues['**'][67][4][1][3][4][18000] = '--r3mix'; // 3.94, 3.95 + $KnownEncoderValues['**'][68][3][2][3][4][18000] = '--alt-preset medium'; // 3.90.3 + $KnownEncoderValues['**'][68][4][2][3][4][18000] = '--alt-preset fast medium'; // 3.90.3 + + $KnownEncoderValues[0xFF][99][1][1][1][2][0] = '--preset studio'; // 3.90, 3.90.1, 3.90.2, 3.91, 3.92 + $KnownEncoderValues[0xFF][58][2][1][3][2][20600] = '--preset studio'; // 3.90.3, 3.93.1 + $KnownEncoderValues[0xFF][58][2][1][3][2][20500] = '--preset studio'; // 3.93 + $KnownEncoderValues[0xFF][57][2][1][3][4][20500] = '--preset studio'; // 3.94, 3.95 + $KnownEncoderValues[0xC0][88][1][1][1][2][0] = '--preset cd'; // 3.90, 3.90.1, 3.90.2, 3.91, 3.92 + $KnownEncoderValues[0xC0][58][2][2][3][2][19600] = '--preset cd'; // 3.90.3, 3.93.1 + $KnownEncoderValues[0xC0][58][2][2][3][2][19500] = '--preset cd'; // 3.93 + $KnownEncoderValues[0xC0][57][2][1][3][4][19500] = '--preset cd'; // 3.94, 3.95 + $KnownEncoderValues[0xA0][78][1][1][3][2][18000] = '--preset hifi'; // 3.90, 3.90.1, 3.90.2, 3.91, 3.92 + $KnownEncoderValues[0xA0][58][2][2][3][2][18000] = '--preset hifi'; // 3.90.3, 3.93, 3.93.1 + $KnownEncoderValues[0xA0][57][2][1][3][4][18000] = '--preset hifi'; // 3.94, 3.95 + $KnownEncoderValues[0x80][67][1][1][3][2][18000] = '--preset tape'; // 3.90, 3.90.1, 3.90.2, 3.91, 3.92 + $KnownEncoderValues[0x80][67][1][1][3][2][15000] = '--preset radio'; // 3.90, 3.90.1, 3.90.2, 3.91, 3.92 + $KnownEncoderValues[0x70][67][1][1][3][2][15000] = '--preset fm'; // 3.90, 3.90.1, 3.90.2, 3.91, 3.92 + $KnownEncoderValues[0x70][58][2][2][3][2][16000] = '--preset tape/radio/fm'; // 3.90.3, 3.93, 3.93.1 + $KnownEncoderValues[0x70][57][2][1][3][4][16000] = '--preset tape/radio/fm'; // 3.94, 3.95 + $KnownEncoderValues[0x38][58][2][2][0][2][10000] = '--preset voice'; // 3.90.3, 3.93, 3.93.1 + $KnownEncoderValues[0x38][57][2][1][0][4][15000] = '--preset voice'; // 3.94, 3.95 + $KnownEncoderValues[0x38][57][2][1][0][4][16000] = '--preset voice'; // 3.94a14 + $KnownEncoderValues[0x28][65][1][1][0][2][7500] = '--preset mw-us'; // 3.90, 3.90.1, 3.92 + $KnownEncoderValues[0x28][65][1][1][0][2][7600] = '--preset mw-us'; // 3.90.2, 3.91 + $KnownEncoderValues[0x28][58][2][2][0][2][7000] = '--preset mw-us'; // 3.90.3, 3.93, 3.93.1 + $KnownEncoderValues[0x28][57][2][1][0][4][10500] = '--preset mw-us'; // 3.94, 3.95 + $KnownEncoderValues[0x28][57][2][1][0][4][11200] = '--preset mw-us'; // 3.94a14 + $KnownEncoderValues[0x28][57][2][1][0][4][8800] = '--preset mw-us'; // 3.94a15 + $KnownEncoderValues[0x18][58][2][2][0][2][4000] = '--preset phon+/lw/mw-eu/sw'; // 3.90.3, 3.93.1 + $KnownEncoderValues[0x18][58][2][2][0][2][3900] = '--preset phon+/lw/mw-eu/sw'; // 3.93 + $KnownEncoderValues[0x18][57][2][1][0][4][5900] = '--preset phon+/lw/mw-eu/sw'; // 3.94, 3.95 + $KnownEncoderValues[0x18][57][2][1][0][4][6200] = '--preset phon+/lw/mw-eu/sw'; // 3.94a14 + $KnownEncoderValues[0x18][57][2][1][0][4][3200] = '--preset phon+/lw/mw-eu/sw'; // 3.94a15 + $KnownEncoderValues[0x10][58][2][2][0][2][3800] = '--preset phone'; // 3.90.3, 3.93.1 + $KnownEncoderValues[0x10][58][2][2][0][2][3700] = '--preset phone'; // 3.93 + $KnownEncoderValues[0x10][57][2][1][0][4][5600] = '--preset phone'; // 3.94, 3.95 + } + + if (isset($KnownEncoderValues[$thisfile_mpeg_audio_lame['raw']['abrbitrate_minbitrate']][$thisfile_mpeg_audio_lame['vbr_quality']][$thisfile_mpeg_audio_lame['raw']['vbr_method']][$thisfile_mpeg_audio_lame['raw']['noise_shaping']][$thisfile_mpeg_audio_lame['raw']['stereo_mode']][$thisfile_mpeg_audio_lame['ath_type']][$thisfile_mpeg_audio_lame['lowpass_frequency']])) { + + $encoder_options = $KnownEncoderValues[$thisfile_mpeg_audio_lame['raw']['abrbitrate_minbitrate']][$thisfile_mpeg_audio_lame['vbr_quality']][$thisfile_mpeg_audio_lame['raw']['vbr_method']][$thisfile_mpeg_audio_lame['raw']['noise_shaping']][$thisfile_mpeg_audio_lame['raw']['stereo_mode']][$thisfile_mpeg_audio_lame['ath_type']][$thisfile_mpeg_audio_lame['lowpass_frequency']]; + + } elseif (isset($KnownEncoderValues['**'][$thisfile_mpeg_audio_lame['vbr_quality']][$thisfile_mpeg_audio_lame['raw']['vbr_method']][$thisfile_mpeg_audio_lame['raw']['noise_shaping']][$thisfile_mpeg_audio_lame['raw']['stereo_mode']][$thisfile_mpeg_audio_lame['ath_type']][$thisfile_mpeg_audio_lame['lowpass_frequency']])) { + + $encoder_options = $KnownEncoderValues['**'][$thisfile_mpeg_audio_lame['vbr_quality']][$thisfile_mpeg_audio_lame['raw']['vbr_method']][$thisfile_mpeg_audio_lame['raw']['noise_shaping']][$thisfile_mpeg_audio_lame['raw']['stereo_mode']][$thisfile_mpeg_audio_lame['ath_type']][$thisfile_mpeg_audio_lame['lowpass_frequency']]; + + } elseif ($info['audio']['bitrate_mode'] == 'vbr') { + + // http://gabriel.mp3-tech.org/mp3infotag.html + // int Quality = (100 - 10 * gfp->VBR_q - gfp->quality)h + + + $LAME_V_value = 10 - ceil($thisfile_mpeg_audio_lame['vbr_quality'] / 10); + $LAME_q_value = 100 - $thisfile_mpeg_audio_lame['vbr_quality'] - ($LAME_V_value * 10); + $encoder_options = '-V'.$LAME_V_value.' -q'.$LAME_q_value; + + } elseif ($info['audio']['bitrate_mode'] == 'cbr') { + + $encoder_options = strtoupper($info['audio']['bitrate_mode']).ceil($info['audio']['bitrate'] / 1000); + + } else { + + $encoder_options = strtoupper($info['audio']['bitrate_mode']); + + } + + } elseif (!empty($thisfile_mpeg_audio_lame['bitrate_abr'])) { + + $encoder_options = 'ABR'.$thisfile_mpeg_audio_lame['bitrate_abr']; + + } elseif (!empty($info['audio']['bitrate'])) { + + if ($info['audio']['bitrate_mode'] == 'cbr') { + $encoder_options = strtoupper($info['audio']['bitrate_mode']).ceil($info['audio']['bitrate'] / 1000); + } else { + $encoder_options = strtoupper($info['audio']['bitrate_mode']); + } + + } + if (!empty($thisfile_mpeg_audio_lame['bitrate_min'])) { + $encoder_options .= ' -b'.$thisfile_mpeg_audio_lame['bitrate_min']; + } + + if (!empty($thisfile_mpeg_audio_lame['encoding_flags']['nogap_prev']) || !empty($thisfile_mpeg_audio_lame['encoding_flags']['nogap_next'])) { + $encoder_options .= ' --nogap'; + } + + if (!empty($thisfile_mpeg_audio_lame['lowpass_frequency'])) { + $ExplodedOptions = explode(' ', $encoder_options, 4); + if ($ExplodedOptions[0] == '--r3mix') { + $ExplodedOptions[1] = 'r3mix'; + } + switch ($ExplodedOptions[0]) { + case '--preset': + case '--alt-preset': + case '--r3mix': + if ($ExplodedOptions[1] == 'fast') { + $ExplodedOptions[1] .= ' '.$ExplodedOptions[2]; + } + switch ($ExplodedOptions[1]) { + case 'portable': + case 'medium': + case 'standard': + case 'extreme': + case 'insane': + case 'fast portable': + case 'fast medium': + case 'fast standard': + case 'fast extreme': + case 'fast insane': + case 'r3mix': + static $ExpectedLowpass = array( + 'insane|20500' => 20500, + 'insane|20600' => 20600, // 3.90.2, 3.90.3, 3.91 + 'medium|18000' => 18000, + 'fast medium|18000' => 18000, + 'extreme|19500' => 19500, // 3.90, 3.90.1, 3.92, 3.95 + 'extreme|19600' => 19600, // 3.90.2, 3.90.3, 3.91, 3.93.1 + 'fast extreme|19500' => 19500, // 3.90, 3.90.1, 3.92, 3.95 + 'fast extreme|19600' => 19600, // 3.90.2, 3.90.3, 3.91, 3.93.1 + 'standard|19000' => 19000, + 'fast standard|19000' => 19000, + 'r3mix|19500' => 19500, // 3.90, 3.90.1, 3.92 + 'r3mix|19600' => 19600, // 3.90.2, 3.90.3, 3.91 + 'r3mix|18000' => 18000, // 3.94, 3.95 + ); + if (!isset($ExpectedLowpass[$ExplodedOptions[1].'|'.$thisfile_mpeg_audio_lame['lowpass_frequency']]) && ($thisfile_mpeg_audio_lame['lowpass_frequency'] < 22050) && (round($thisfile_mpeg_audio_lame['lowpass_frequency'] / 1000) < round($thisfile_mpeg_audio['sample_rate'] / 2000))) { + $encoder_options .= ' --lowpass '.$thisfile_mpeg_audio_lame['lowpass_frequency']; + } + break; + + default: + break; + } + break; + } + } + + if (isset($thisfile_mpeg_audio_lame['raw']['source_sample_freq'])) { + if (($thisfile_mpeg_audio['sample_rate'] == 44100) && ($thisfile_mpeg_audio_lame['raw']['source_sample_freq'] != 1)) { + $encoder_options .= ' --resample 44100'; + } elseif (($thisfile_mpeg_audio['sample_rate'] == 48000) && ($thisfile_mpeg_audio_lame['raw']['source_sample_freq'] != 2)) { + $encoder_options .= ' --resample 48000'; + } elseif ($thisfile_mpeg_audio['sample_rate'] < 44100) { + switch ($thisfile_mpeg_audio_lame['raw']['source_sample_freq']) { + case 0: // <= 32000 + // may or may not be same as source frequency - ignore + break; + case 1: // 44100 + case 2: // 48000 + case 3: // 48000+ + $ExplodedOptions = explode(' ', $encoder_options, 4); + switch ($ExplodedOptions[0]) { + case '--preset': + case '--alt-preset': + switch ($ExplodedOptions[1]) { + case 'fast': + case 'portable': + case 'medium': + case 'standard': + case 'extreme': + case 'insane': + $encoder_options .= ' --resample '.$thisfile_mpeg_audio['sample_rate']; + break; + + default: + static $ExpectedResampledRate = array( + 'phon+/lw/mw-eu/sw|16000' => 16000, + 'mw-us|24000' => 24000, // 3.95 + 'mw-us|32000' => 32000, // 3.93 + 'mw-us|16000' => 16000, // 3.92 + 'phone|16000' => 16000, + 'phone|11025' => 11025, // 3.94a15 + 'radio|32000' => 32000, // 3.94a15 + 'fm/radio|32000' => 32000, // 3.92 + 'fm|32000' => 32000, // 3.90 + 'voice|32000' => 32000); + if (!isset($ExpectedResampledRate[$ExplodedOptions[1].'|'.$thisfile_mpeg_audio['sample_rate']])) { + $encoder_options .= ' --resample '.$thisfile_mpeg_audio['sample_rate']; + } + break; + } + break; + + case '--r3mix': + default: + $encoder_options .= ' --resample '.$thisfile_mpeg_audio['sample_rate']; + break; + } + break; + } + } + } + if (empty($encoder_options) && !empty($info['audio']['bitrate']) && !empty($info['audio']['bitrate_mode'])) { + //$encoder_options = strtoupper($info['audio']['bitrate_mode']).ceil($info['audio']['bitrate'] / 1000); + $encoder_options = strtoupper($info['audio']['bitrate_mode']); + } + + return $encoder_options; + } + + + public function decodeMPEGaudioHeader($offset, &$info, $recursivesearch=true, $ScanAsCBR=false, $FastMPEGheaderScan=false) { + static $MPEGaudioVersionLookup; + static $MPEGaudioLayerLookup; + static $MPEGaudioBitrateLookup; + static $MPEGaudioFrequencyLookup; + static $MPEGaudioChannelModeLookup; + static $MPEGaudioModeExtensionLookup; + static $MPEGaudioEmphasisLookup; + if (empty($MPEGaudioVersionLookup)) { + $MPEGaudioVersionLookup = self::MPEGaudioVersionArray(); + $MPEGaudioLayerLookup = self::MPEGaudioLayerArray(); + $MPEGaudioBitrateLookup = self::MPEGaudioBitrateArray(); + $MPEGaudioFrequencyLookup = self::MPEGaudioFrequencyArray(); + $MPEGaudioChannelModeLookup = self::MPEGaudioChannelModeArray(); + $MPEGaudioModeExtensionLookup = self::MPEGaudioModeExtensionArray(); + $MPEGaudioEmphasisLookup = self::MPEGaudioEmphasisArray(); + } + + if ($this->fseek($offset) != 0) { + $this->error('decodeMPEGaudioHeader() failed to seek to next offset at '.$offset); + return false; + } + //$headerstring = $this->fread(1441); // worst-case max length = 32kHz @ 320kbps layer 3 = 1441 bytes/frame + $headerstring = $this->fread(226); // LAME header at offset 36 + 190 bytes of Xing/LAME data + + // MP3 audio frame structure: + // $aa $aa $aa $aa [$bb $bb] $cc... + // where $aa..$aa is the four-byte mpeg-audio header (below) + // $bb $bb is the optional 2-byte CRC + // and $cc... is the audio data + + $head4 = substr($headerstring, 0, 4); + $head4_key = getid3_lib::PrintHexBytes($head4, true, false, false); + static $MPEGaudioHeaderDecodeCache = array(); + if (isset($MPEGaudioHeaderDecodeCache[$head4_key])) { + $MPEGheaderRawArray = $MPEGaudioHeaderDecodeCache[$head4_key]; + } else { + $MPEGheaderRawArray = self::MPEGaudioHeaderDecode($head4); + $MPEGaudioHeaderDecodeCache[$head4_key] = $MPEGheaderRawArray; + } + + static $MPEGaudioHeaderValidCache = array(); + if (!isset($MPEGaudioHeaderValidCache[$head4_key])) { // Not in cache + //$MPEGaudioHeaderValidCache[$head4_key] = self::MPEGaudioHeaderValid($MPEGheaderRawArray, false, true); // allow badly-formatted freeformat (from LAME 3.90 - 3.93.1) + $MPEGaudioHeaderValidCache[$head4_key] = self::MPEGaudioHeaderValid($MPEGheaderRawArray, false, false); + } + + // shortcut + if (!isset($info['mpeg']['audio'])) { + $info['mpeg']['audio'] = array(); + } + $thisfile_mpeg_audio = &$info['mpeg']['audio']; + + + if ($MPEGaudioHeaderValidCache[$head4_key]) { + $thisfile_mpeg_audio['raw'] = $MPEGheaderRawArray; + } else { + $this->error('Invalid MPEG audio header ('.getid3_lib::PrintHexBytes($head4).') at offset '.$offset); + return false; + } + + if (!$FastMPEGheaderScan) { + $thisfile_mpeg_audio['version'] = $MPEGaudioVersionLookup[$thisfile_mpeg_audio['raw']['version']]; + $thisfile_mpeg_audio['layer'] = $MPEGaudioLayerLookup[$thisfile_mpeg_audio['raw']['layer']]; + + $thisfile_mpeg_audio['channelmode'] = $MPEGaudioChannelModeLookup[$thisfile_mpeg_audio['raw']['channelmode']]; + $thisfile_mpeg_audio['channels'] = (($thisfile_mpeg_audio['channelmode'] == 'mono') ? 1 : 2); + $thisfile_mpeg_audio['sample_rate'] = $MPEGaudioFrequencyLookup[$thisfile_mpeg_audio['version']][$thisfile_mpeg_audio['raw']['sample_rate']]; + $thisfile_mpeg_audio['protection'] = !$thisfile_mpeg_audio['raw']['protection']; + $thisfile_mpeg_audio['private'] = (bool) $thisfile_mpeg_audio['raw']['private']; + $thisfile_mpeg_audio['modeextension'] = $MPEGaudioModeExtensionLookup[$thisfile_mpeg_audio['layer']][$thisfile_mpeg_audio['raw']['modeextension']]; + $thisfile_mpeg_audio['copyright'] = (bool) $thisfile_mpeg_audio['raw']['copyright']; + $thisfile_mpeg_audio['original'] = (bool) $thisfile_mpeg_audio['raw']['original']; + $thisfile_mpeg_audio['emphasis'] = $MPEGaudioEmphasisLookup[$thisfile_mpeg_audio['raw']['emphasis']]; + + $info['audio']['channels'] = $thisfile_mpeg_audio['channels']; + $info['audio']['sample_rate'] = $thisfile_mpeg_audio['sample_rate']; + + if ($thisfile_mpeg_audio['protection']) { + $thisfile_mpeg_audio['crc'] = getid3_lib::BigEndian2Int(substr($headerstring, 4, 2)); + } + } + + if ($thisfile_mpeg_audio['raw']['bitrate'] == 15) { + // http://www.hydrogenaudio.org/?act=ST&f=16&t=9682&st=0 + $this->warning('Invalid bitrate index (15), this is a known bug in free-format MP3s encoded by LAME v3.90 - 3.93.1'); + $thisfile_mpeg_audio['raw']['bitrate'] = 0; + } + $thisfile_mpeg_audio['padding'] = (bool) $thisfile_mpeg_audio['raw']['padding']; + $thisfile_mpeg_audio['bitrate'] = $MPEGaudioBitrateLookup[$thisfile_mpeg_audio['version']][$thisfile_mpeg_audio['layer']][$thisfile_mpeg_audio['raw']['bitrate']]; + + if (($thisfile_mpeg_audio['bitrate'] == 'free') && ($offset == $info['avdataoffset'])) { + // only skip multiple frame check if free-format bitstream found at beginning of file + // otherwise is quite possibly simply corrupted data + $recursivesearch = false; + } + + // For Layer 2 there are some combinations of bitrate and mode which are not allowed. + if (!$FastMPEGheaderScan && ($thisfile_mpeg_audio['layer'] == '2')) { + + $info['audio']['dataformat'] = 'mp2'; + switch ($thisfile_mpeg_audio['channelmode']) { + + case 'mono': + if (($thisfile_mpeg_audio['bitrate'] == 'free') || ($thisfile_mpeg_audio['bitrate'] <= 192000)) { + // these are ok + } else { + $this->error($thisfile_mpeg_audio['bitrate'].'kbps not allowed in Layer 2, '.$thisfile_mpeg_audio['channelmode'].'.'); + return false; + } + break; + + case 'stereo': + case 'joint stereo': + case 'dual channel': + if (($thisfile_mpeg_audio['bitrate'] == 'free') || ($thisfile_mpeg_audio['bitrate'] == 64000) || ($thisfile_mpeg_audio['bitrate'] >= 96000)) { + // these are ok + } else { + $this->error(intval(round($thisfile_mpeg_audio['bitrate'] / 1000)).'kbps not allowed in Layer 2, '.$thisfile_mpeg_audio['channelmode'].'.'); + return false; + } + break; + + } + + } + + + if ($info['audio']['sample_rate'] > 0) { + $thisfile_mpeg_audio['framelength'] = self::MPEGaudioFrameLength($thisfile_mpeg_audio['bitrate'], $thisfile_mpeg_audio['version'], $thisfile_mpeg_audio['layer'], (int) $thisfile_mpeg_audio['padding'], $info['audio']['sample_rate']); + } + + $nextframetestoffset = $offset + 1; + if ($thisfile_mpeg_audio['bitrate'] != 'free') { + + $info['audio']['bitrate'] = $thisfile_mpeg_audio['bitrate']; + + if (isset($thisfile_mpeg_audio['framelength'])) { + $nextframetestoffset = $offset + $thisfile_mpeg_audio['framelength']; + } else { + $this->error('Frame at offset('.$offset.') is has an invalid frame length.'); + return false; + } + + } + + $ExpectedNumberOfAudioBytes = 0; + + //////////////////////////////////////////////////////////////////////////////////// + // Variable-bitrate headers + + if (substr($headerstring, 4 + 32, 4) == 'VBRI') { + // Fraunhofer VBR header is hardcoded 'VBRI' at offset 0x24 (36) + // specs taken from http://minnie.tuhs.org/pipermail/mp3encoder/2001-January/001800.html + + $thisfile_mpeg_audio['bitrate_mode'] = 'vbr'; + $thisfile_mpeg_audio['VBR_method'] = 'Fraunhofer'; + $info['audio']['codec'] = 'Fraunhofer'; + + $SideInfoData = substr($headerstring, 4 + 2, 32); + + $FraunhoferVBROffset = 36; + + $thisfile_mpeg_audio['VBR_encoder_version'] = getid3_lib::BigEndian2Int(substr($headerstring, $FraunhoferVBROffset + 4, 2)); // VbriVersion + $thisfile_mpeg_audio['VBR_encoder_delay'] = getid3_lib::BigEndian2Int(substr($headerstring, $FraunhoferVBROffset + 6, 2)); // VbriDelay + $thisfile_mpeg_audio['VBR_quality'] = getid3_lib::BigEndian2Int(substr($headerstring, $FraunhoferVBROffset + 8, 2)); // VbriQuality + $thisfile_mpeg_audio['VBR_bytes'] = getid3_lib::BigEndian2Int(substr($headerstring, $FraunhoferVBROffset + 10, 4)); // VbriStreamBytes + $thisfile_mpeg_audio['VBR_frames'] = getid3_lib::BigEndian2Int(substr($headerstring, $FraunhoferVBROffset + 14, 4)); // VbriStreamFrames + $thisfile_mpeg_audio['VBR_seek_offsets'] = getid3_lib::BigEndian2Int(substr($headerstring, $FraunhoferVBROffset + 18, 2)); // VbriTableSize + $thisfile_mpeg_audio['VBR_seek_scale'] = getid3_lib::BigEndian2Int(substr($headerstring, $FraunhoferVBROffset + 20, 2)); // VbriTableScale + $thisfile_mpeg_audio['VBR_entry_bytes'] = getid3_lib::BigEndian2Int(substr($headerstring, $FraunhoferVBROffset + 22, 2)); // VbriEntryBytes + $thisfile_mpeg_audio['VBR_entry_frames'] = getid3_lib::BigEndian2Int(substr($headerstring, $FraunhoferVBROffset + 24, 2)); // VbriEntryFrames + + $ExpectedNumberOfAudioBytes = $thisfile_mpeg_audio['VBR_bytes']; + + $previousbyteoffset = $offset; + for ($i = 0; $i < $thisfile_mpeg_audio['VBR_seek_offsets']; $i++) { + $Fraunhofer_OffsetN = getid3_lib::BigEndian2Int(substr($headerstring, $FraunhoferVBROffset, $thisfile_mpeg_audio['VBR_entry_bytes'])); + $FraunhoferVBROffset += $thisfile_mpeg_audio['VBR_entry_bytes']; + $thisfile_mpeg_audio['VBR_offsets_relative'][$i] = ($Fraunhofer_OffsetN * $thisfile_mpeg_audio['VBR_seek_scale']); + $thisfile_mpeg_audio['VBR_offsets_absolute'][$i] = ($Fraunhofer_OffsetN * $thisfile_mpeg_audio['VBR_seek_scale']) + $previousbyteoffset; + $previousbyteoffset += $Fraunhofer_OffsetN; + } + + + } else { + + // Xing VBR header is hardcoded 'Xing' at a offset 0x0D (13), 0x15 (21) or 0x24 (36) + // depending on MPEG layer and number of channels + + $VBRidOffset = self::XingVBRidOffset($thisfile_mpeg_audio['version'], $thisfile_mpeg_audio['channelmode']); + $SideInfoData = substr($headerstring, 4 + 2, $VBRidOffset - 4); + + if ((substr($headerstring, $VBRidOffset, strlen('Xing')) == 'Xing') || (substr($headerstring, $VBRidOffset, strlen('Info')) == 'Info')) { + // 'Xing' is traditional Xing VBR frame + // 'Info' is LAME-encoded CBR (This was done to avoid CBR files to be recognized as traditional Xing VBR files by some decoders.) + // 'Info' *can* legally be used to specify a VBR file as well, however. + + // http://www.multiweb.cz/twoinches/MP3inside.htm + //00..03 = "Xing" or "Info" + //04..07 = Flags: + // 0x01 Frames Flag set if value for number of frames in file is stored + // 0x02 Bytes Flag set if value for filesize in bytes is stored + // 0x04 TOC Flag set if values for TOC are stored + // 0x08 VBR Scale Flag set if values for VBR scale is stored + //08..11 Frames: Number of frames in file (including the first Xing/Info one) + //12..15 Bytes: File length in Bytes + //16..115 TOC (Table of Contents): + // Contains of 100 indexes (one Byte length) for easier lookup in file. Approximately solves problem with moving inside file. + // Each Byte has a value according this formula: + // (TOC[i] / 256) * fileLenInBytes + // So if song lasts eg. 240 sec. and you want to jump to 60. sec. (and file is 5 000 000 Bytes length) you can use: + // TOC[(60/240)*100] = TOC[25] + // and corresponding Byte in file is then approximately at: + // (TOC[25]/256) * 5000000 + //116..119 VBR Scale + + + // should be safe to leave this at 'vbr' and let it be overriden to 'cbr' if a CBR preset/mode is used by LAME +// if (substr($headerstring, $VBRidOffset, strlen('Info')) == 'Xing') { + $thisfile_mpeg_audio['bitrate_mode'] = 'vbr'; + $thisfile_mpeg_audio['VBR_method'] = 'Xing'; +// } else { +// $ScanAsCBR = true; +// $thisfile_mpeg_audio['bitrate_mode'] = 'cbr'; +// } + + $thisfile_mpeg_audio['xing_flags_raw'] = getid3_lib::BigEndian2Int(substr($headerstring, $VBRidOffset + 4, 4)); + + $thisfile_mpeg_audio['xing_flags']['frames'] = (bool) ($thisfile_mpeg_audio['xing_flags_raw'] & 0x00000001); + $thisfile_mpeg_audio['xing_flags']['bytes'] = (bool) ($thisfile_mpeg_audio['xing_flags_raw'] & 0x00000002); + $thisfile_mpeg_audio['xing_flags']['toc'] = (bool) ($thisfile_mpeg_audio['xing_flags_raw'] & 0x00000004); + $thisfile_mpeg_audio['xing_flags']['vbr_scale'] = (bool) ($thisfile_mpeg_audio['xing_flags_raw'] & 0x00000008); + + if ($thisfile_mpeg_audio['xing_flags']['frames']) { + $thisfile_mpeg_audio['VBR_frames'] = getid3_lib::BigEndian2Int(substr($headerstring, $VBRidOffset + 8, 4)); + //$thisfile_mpeg_audio['VBR_frames']--; // don't count header Xing/Info frame + } + if ($thisfile_mpeg_audio['xing_flags']['bytes']) { + $thisfile_mpeg_audio['VBR_bytes'] = getid3_lib::BigEndian2Int(substr($headerstring, $VBRidOffset + 12, 4)); + } + + //if (($thisfile_mpeg_audio['bitrate'] == 'free') && !empty($thisfile_mpeg_audio['VBR_frames']) && !empty($thisfile_mpeg_audio['VBR_bytes'])) { + //if (!empty($thisfile_mpeg_audio['VBR_frames']) && !empty($thisfile_mpeg_audio['VBR_bytes'])) { + if (!empty($thisfile_mpeg_audio['VBR_frames'])) { + $used_filesize = 0; + if (!empty($thisfile_mpeg_audio['VBR_bytes'])) { + $used_filesize = $thisfile_mpeg_audio['VBR_bytes']; + } elseif (!empty($info['filesize'])) { + $used_filesize = $info['filesize']; + $used_filesize -= intval(@$info['id3v2']['headerlength']); + $used_filesize -= (isset($info['id3v1']) ? 128 : 0); + $used_filesize -= (isset($info['tag_offset_end']) ? $info['tag_offset_end'] - $info['tag_offset_start'] : 0); + $this->warning('MP3.Xing header missing VBR_bytes, assuming MPEG audio portion of file is '.number_format($used_filesize).' bytes'); + } + + $framelengthfloat = $used_filesize / $thisfile_mpeg_audio['VBR_frames']; + + if ($thisfile_mpeg_audio['layer'] == '1') { + // BitRate = (((FrameLengthInBytes / 4) - Padding) * SampleRate) / 12 + //$info['audio']['bitrate'] = ((($framelengthfloat / 4) - intval($thisfile_mpeg_audio['padding'])) * $thisfile_mpeg_audio['sample_rate']) / 12; + $info['audio']['bitrate'] = ($framelengthfloat / 4) * $thisfile_mpeg_audio['sample_rate'] * (2 / $info['audio']['channels']) / 12; + } else { + // Bitrate = ((FrameLengthInBytes - Padding) * SampleRate) / 144 + //$info['audio']['bitrate'] = (($framelengthfloat - intval($thisfile_mpeg_audio['padding'])) * $thisfile_mpeg_audio['sample_rate']) / 144; + $info['audio']['bitrate'] = $framelengthfloat * $thisfile_mpeg_audio['sample_rate'] * (2 / $info['audio']['channels']) / 144; + } + $thisfile_mpeg_audio['framelength'] = floor($framelengthfloat); + } + + if ($thisfile_mpeg_audio['xing_flags']['toc']) { + $LAMEtocData = substr($headerstring, $VBRidOffset + 16, 100); + for ($i = 0; $i < 100; $i++) { + $thisfile_mpeg_audio['toc'][$i] = ord($LAMEtocData{$i}); + } + } + if ($thisfile_mpeg_audio['xing_flags']['vbr_scale']) { + $thisfile_mpeg_audio['VBR_scale'] = getid3_lib::BigEndian2Int(substr($headerstring, $VBRidOffset + 116, 4)); + } + + + // http://gabriel.mp3-tech.org/mp3infotag.html + if (substr($headerstring, $VBRidOffset + 120, 4) == 'LAME') { + + // shortcut + $thisfile_mpeg_audio['LAME'] = array(); + $thisfile_mpeg_audio_lame = &$thisfile_mpeg_audio['LAME']; + + + $thisfile_mpeg_audio_lame['long_version'] = substr($headerstring, $VBRidOffset + 120, 20); + $thisfile_mpeg_audio_lame['short_version'] = substr($thisfile_mpeg_audio_lame['long_version'], 0, 9); + + if ($thisfile_mpeg_audio_lame['short_version'] >= 'LAME3.90') { + + // extra 11 chars are not part of version string when LAMEtag present + unset($thisfile_mpeg_audio_lame['long_version']); + + // It the LAME tag was only introduced in LAME v3.90 + // http://www.hydrogenaudio.org/?act=ST&f=15&t=9933 + + // Offsets of various bytes in http://gabriel.mp3-tech.org/mp3infotag.html + // are assuming a 'Xing' identifier offset of 0x24, which is the case for + // MPEG-1 non-mono, but not for other combinations + $LAMEtagOffsetContant = $VBRidOffset - 0x24; + + // shortcuts + $thisfile_mpeg_audio_lame['RGAD'] = array('track'=>array(), 'album'=>array()); + $thisfile_mpeg_audio_lame_RGAD = &$thisfile_mpeg_audio_lame['RGAD']; + $thisfile_mpeg_audio_lame_RGAD_track = &$thisfile_mpeg_audio_lame_RGAD['track']; + $thisfile_mpeg_audio_lame_RGAD_album = &$thisfile_mpeg_audio_lame_RGAD['album']; + $thisfile_mpeg_audio_lame['raw'] = array(); + $thisfile_mpeg_audio_lame_raw = &$thisfile_mpeg_audio_lame['raw']; + + // byte $9B VBR Quality + // This field is there to indicate a quality level, although the scale was not precised in the original Xing specifications. + // Actually overwrites original Xing bytes + unset($thisfile_mpeg_audio['VBR_scale']); + $thisfile_mpeg_audio_lame['vbr_quality'] = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0x9B, 1)); + + // bytes $9C-$A4 Encoder short VersionString + $thisfile_mpeg_audio_lame['short_version'] = substr($headerstring, $LAMEtagOffsetContant + 0x9C, 9); + + // byte $A5 Info Tag revision + VBR method + $LAMEtagRevisionVBRmethod = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xA5, 1)); + + $thisfile_mpeg_audio_lame['tag_revision'] = ($LAMEtagRevisionVBRmethod & 0xF0) >> 4; + $thisfile_mpeg_audio_lame_raw['vbr_method'] = $LAMEtagRevisionVBRmethod & 0x0F; + $thisfile_mpeg_audio_lame['vbr_method'] = self::LAMEvbrMethodLookup($thisfile_mpeg_audio_lame_raw['vbr_method']); + $thisfile_mpeg_audio['bitrate_mode'] = substr($thisfile_mpeg_audio_lame['vbr_method'], 0, 3); // usually either 'cbr' or 'vbr', but truncates 'vbr-old / vbr-rh' to 'vbr' + + // byte $A6 Lowpass filter value + $thisfile_mpeg_audio_lame['lowpass_frequency'] = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xA6, 1)) * 100; + + // bytes $A7-$AE Replay Gain + // http://privatewww.essex.ac.uk/~djmrob/replaygain/rg_data_format.html + // bytes $A7-$AA : 32 bit floating point "Peak signal amplitude" + if ($thisfile_mpeg_audio_lame['short_version'] >= 'LAME3.94b') { + // LAME 3.94a16 and later - 9.23 fixed point + // ie 0x0059E2EE / (2^23) = 5890798 / 8388608 = 0.7022378444671630859375 + $thisfile_mpeg_audio_lame_RGAD['peak_amplitude'] = (float) ((getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xA7, 4))) / 8388608); + } else { + // LAME 3.94a15 and earlier - 32-bit floating point + // Actually 3.94a16 will fall in here too and be WRONG, but is hard to detect 3.94a16 vs 3.94a15 + $thisfile_mpeg_audio_lame_RGAD['peak_amplitude'] = getid3_lib::LittleEndian2Float(substr($headerstring, $LAMEtagOffsetContant + 0xA7, 4)); + } + if ($thisfile_mpeg_audio_lame_RGAD['peak_amplitude'] == 0) { + unset($thisfile_mpeg_audio_lame_RGAD['peak_amplitude']); + } else { + $thisfile_mpeg_audio_lame_RGAD['peak_db'] = getid3_lib::RGADamplitude2dB($thisfile_mpeg_audio_lame_RGAD['peak_amplitude']); + } + + $thisfile_mpeg_audio_lame_raw['RGAD_track'] = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xAB, 2)); + $thisfile_mpeg_audio_lame_raw['RGAD_album'] = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xAD, 2)); + + + if ($thisfile_mpeg_audio_lame_raw['RGAD_track'] != 0) { + + $thisfile_mpeg_audio_lame_RGAD_track['raw']['name'] = ($thisfile_mpeg_audio_lame_raw['RGAD_track'] & 0xE000) >> 13; + $thisfile_mpeg_audio_lame_RGAD_track['raw']['originator'] = ($thisfile_mpeg_audio_lame_raw['RGAD_track'] & 0x1C00) >> 10; + $thisfile_mpeg_audio_lame_RGAD_track['raw']['sign_bit'] = ($thisfile_mpeg_audio_lame_raw['RGAD_track'] & 0x0200) >> 9; + $thisfile_mpeg_audio_lame_RGAD_track['raw']['gain_adjust'] = $thisfile_mpeg_audio_lame_raw['RGAD_track'] & 0x01FF; + $thisfile_mpeg_audio_lame_RGAD_track['name'] = getid3_lib::RGADnameLookup($thisfile_mpeg_audio_lame_RGAD_track['raw']['name']); + $thisfile_mpeg_audio_lame_RGAD_track['originator'] = getid3_lib::RGADoriginatorLookup($thisfile_mpeg_audio_lame_RGAD_track['raw']['originator']); + $thisfile_mpeg_audio_lame_RGAD_track['gain_db'] = getid3_lib::RGADadjustmentLookup($thisfile_mpeg_audio_lame_RGAD_track['raw']['gain_adjust'], $thisfile_mpeg_audio_lame_RGAD_track['raw']['sign_bit']); + + if (!empty($thisfile_mpeg_audio_lame_RGAD['peak_amplitude'])) { + $info['replay_gain']['track']['peak'] = $thisfile_mpeg_audio_lame_RGAD['peak_amplitude']; + } + $info['replay_gain']['track']['originator'] = $thisfile_mpeg_audio_lame_RGAD_track['originator']; + $info['replay_gain']['track']['adjustment'] = $thisfile_mpeg_audio_lame_RGAD_track['gain_db']; + } else { + unset($thisfile_mpeg_audio_lame_RGAD['track']); + } + if ($thisfile_mpeg_audio_lame_raw['RGAD_album'] != 0) { + + $thisfile_mpeg_audio_lame_RGAD_album['raw']['name'] = ($thisfile_mpeg_audio_lame_raw['RGAD_album'] & 0xE000) >> 13; + $thisfile_mpeg_audio_lame_RGAD_album['raw']['originator'] = ($thisfile_mpeg_audio_lame_raw['RGAD_album'] & 0x1C00) >> 10; + $thisfile_mpeg_audio_lame_RGAD_album['raw']['sign_bit'] = ($thisfile_mpeg_audio_lame_raw['RGAD_album'] & 0x0200) >> 9; + $thisfile_mpeg_audio_lame_RGAD_album['raw']['gain_adjust'] = $thisfile_mpeg_audio_lame_raw['RGAD_album'] & 0x01FF; + $thisfile_mpeg_audio_lame_RGAD_album['name'] = getid3_lib::RGADnameLookup($thisfile_mpeg_audio_lame_RGAD_album['raw']['name']); + $thisfile_mpeg_audio_lame_RGAD_album['originator'] = getid3_lib::RGADoriginatorLookup($thisfile_mpeg_audio_lame_RGAD_album['raw']['originator']); + $thisfile_mpeg_audio_lame_RGAD_album['gain_db'] = getid3_lib::RGADadjustmentLookup($thisfile_mpeg_audio_lame_RGAD_album['raw']['gain_adjust'], $thisfile_mpeg_audio_lame_RGAD_album['raw']['sign_bit']); + + if (!empty($thisfile_mpeg_audio_lame_RGAD['peak_amplitude'])) { + $info['replay_gain']['album']['peak'] = $thisfile_mpeg_audio_lame_RGAD['peak_amplitude']; + } + $info['replay_gain']['album']['originator'] = $thisfile_mpeg_audio_lame_RGAD_album['originator']; + $info['replay_gain']['album']['adjustment'] = $thisfile_mpeg_audio_lame_RGAD_album['gain_db']; + } else { + unset($thisfile_mpeg_audio_lame_RGAD['album']); + } + if (empty($thisfile_mpeg_audio_lame_RGAD)) { + unset($thisfile_mpeg_audio_lame['RGAD']); + } + + + // byte $AF Encoding flags + ATH Type + $EncodingFlagsATHtype = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xAF, 1)); + $thisfile_mpeg_audio_lame['encoding_flags']['nspsytune'] = (bool) ($EncodingFlagsATHtype & 0x10); + $thisfile_mpeg_audio_lame['encoding_flags']['nssafejoint'] = (bool) ($EncodingFlagsATHtype & 0x20); + $thisfile_mpeg_audio_lame['encoding_flags']['nogap_next'] = (bool) ($EncodingFlagsATHtype & 0x40); + $thisfile_mpeg_audio_lame['encoding_flags']['nogap_prev'] = (bool) ($EncodingFlagsATHtype & 0x80); + $thisfile_mpeg_audio_lame['ath_type'] = $EncodingFlagsATHtype & 0x0F; + + // byte $B0 if ABR {specified bitrate} else {minimal bitrate} + $thisfile_mpeg_audio_lame['raw']['abrbitrate_minbitrate'] = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xB0, 1)); + if ($thisfile_mpeg_audio_lame_raw['vbr_method'] == 2) { // Average BitRate (ABR) + $thisfile_mpeg_audio_lame['bitrate_abr'] = $thisfile_mpeg_audio_lame['raw']['abrbitrate_minbitrate']; + } elseif ($thisfile_mpeg_audio_lame_raw['vbr_method'] == 1) { // Constant BitRate (CBR) + // ignore + } elseif ($thisfile_mpeg_audio_lame['raw']['abrbitrate_minbitrate'] > 0) { // Variable BitRate (VBR) - minimum bitrate + $thisfile_mpeg_audio_lame['bitrate_min'] = $thisfile_mpeg_audio_lame['raw']['abrbitrate_minbitrate']; + } + + // bytes $B1-$B3 Encoder delays + $EncoderDelays = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xB1, 3)); + $thisfile_mpeg_audio_lame['encoder_delay'] = ($EncoderDelays & 0xFFF000) >> 12; + $thisfile_mpeg_audio_lame['end_padding'] = $EncoderDelays & 0x000FFF; + + // byte $B4 Misc + $MiscByte = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xB4, 1)); + $thisfile_mpeg_audio_lame_raw['noise_shaping'] = ($MiscByte & 0x03); + $thisfile_mpeg_audio_lame_raw['stereo_mode'] = ($MiscByte & 0x1C) >> 2; + $thisfile_mpeg_audio_lame_raw['not_optimal_quality'] = ($MiscByte & 0x20) >> 5; + $thisfile_mpeg_audio_lame_raw['source_sample_freq'] = ($MiscByte & 0xC0) >> 6; + $thisfile_mpeg_audio_lame['noise_shaping'] = $thisfile_mpeg_audio_lame_raw['noise_shaping']; + $thisfile_mpeg_audio_lame['stereo_mode'] = self::LAMEmiscStereoModeLookup($thisfile_mpeg_audio_lame_raw['stereo_mode']); + $thisfile_mpeg_audio_lame['not_optimal_quality'] = (bool) $thisfile_mpeg_audio_lame_raw['not_optimal_quality']; + $thisfile_mpeg_audio_lame['source_sample_freq'] = self::LAMEmiscSourceSampleFrequencyLookup($thisfile_mpeg_audio_lame_raw['source_sample_freq']); + + // byte $B5 MP3 Gain + $thisfile_mpeg_audio_lame_raw['mp3_gain'] = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xB5, 1), false, true); + $thisfile_mpeg_audio_lame['mp3_gain_db'] = (getid3_lib::RGADamplitude2dB(2) / 4) * $thisfile_mpeg_audio_lame_raw['mp3_gain']; + $thisfile_mpeg_audio_lame['mp3_gain_factor'] = pow(2, ($thisfile_mpeg_audio_lame['mp3_gain_db'] / 6)); + + // bytes $B6-$B7 Preset and surround info + $PresetSurroundBytes = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xB6, 2)); + // Reserved = ($PresetSurroundBytes & 0xC000); + $thisfile_mpeg_audio_lame_raw['surround_info'] = ($PresetSurroundBytes & 0x3800); + $thisfile_mpeg_audio_lame['surround_info'] = self::LAMEsurroundInfoLookup($thisfile_mpeg_audio_lame_raw['surround_info']); + $thisfile_mpeg_audio_lame['preset_used_id'] = ($PresetSurroundBytes & 0x07FF); + $thisfile_mpeg_audio_lame['preset_used'] = self::LAMEpresetUsedLookup($thisfile_mpeg_audio_lame); + if (!empty($thisfile_mpeg_audio_lame['preset_used_id']) && empty($thisfile_mpeg_audio_lame['preset_used'])) { + $this->warning('Unknown LAME preset used ('.$thisfile_mpeg_audio_lame['preset_used_id'].') - please report to info@getid3.org'); + } + if (($thisfile_mpeg_audio_lame['short_version'] == 'LAME3.90.') && !empty($thisfile_mpeg_audio_lame['preset_used_id'])) { + // this may change if 3.90.4 ever comes out + $thisfile_mpeg_audio_lame['short_version'] = 'LAME3.90.3'; + } + + // bytes $B8-$BB MusicLength + $thisfile_mpeg_audio_lame['audio_bytes'] = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xB8, 4)); + $ExpectedNumberOfAudioBytes = (($thisfile_mpeg_audio_lame['audio_bytes'] > 0) ? $thisfile_mpeg_audio_lame['audio_bytes'] : $thisfile_mpeg_audio['VBR_bytes']); + + // bytes $BC-$BD MusicCRC + $thisfile_mpeg_audio_lame['music_crc'] = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xBC, 2)); + + // bytes $BE-$BF CRC-16 of Info Tag + $thisfile_mpeg_audio_lame['lame_tag_crc'] = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xBE, 2)); + + + // LAME CBR + if ($thisfile_mpeg_audio_lame_raw['vbr_method'] == 1) { + + $thisfile_mpeg_audio['bitrate_mode'] = 'cbr'; + $thisfile_mpeg_audio['bitrate'] = self::ClosestStandardMP3Bitrate($thisfile_mpeg_audio['bitrate']); + $info['audio']['bitrate'] = $thisfile_mpeg_audio['bitrate']; + //if (empty($thisfile_mpeg_audio['bitrate']) || (!empty($thisfile_mpeg_audio_lame['bitrate_min']) && ($thisfile_mpeg_audio_lame['bitrate_min'] != 255))) { + // $thisfile_mpeg_audio['bitrate'] = $thisfile_mpeg_audio_lame['bitrate_min']; + //} + + } + + } + } + + } else { + + // not Fraunhofer or Xing VBR methods, most likely CBR (but could be VBR with no header) + $thisfile_mpeg_audio['bitrate_mode'] = 'cbr'; + if ($recursivesearch) { + $thisfile_mpeg_audio['bitrate_mode'] = 'vbr'; + if ($this->RecursiveFrameScanning($offset, $nextframetestoffset, true)) { + $recursivesearch = false; + $thisfile_mpeg_audio['bitrate_mode'] = 'cbr'; + } + if ($thisfile_mpeg_audio['bitrate_mode'] == 'vbr') { + $this->warning('VBR file with no VBR header. Bitrate values calculated from actual frame bitrates.'); + } + } + + } + + } + + if (($ExpectedNumberOfAudioBytes > 0) && ($ExpectedNumberOfAudioBytes != ($info['avdataend'] - $info['avdataoffset']))) { + if ($ExpectedNumberOfAudioBytes > ($info['avdataend'] - $info['avdataoffset'])) { + if ($this->isDependencyFor('matroska') || $this->isDependencyFor('riff')) { + // ignore, audio data is broken into chunks so will always be data "missing" + } + elseif (($ExpectedNumberOfAudioBytes - ($info['avdataend'] - $info['avdataoffset'])) == 1) { + $this->warning('Last byte of data truncated (this is a known bug in Meracl ID3 Tag Writer before v1.3.5)'); + } + else { + $this->warning('Probable truncated file: expecting '.$ExpectedNumberOfAudioBytes.' bytes of audio data, only found '.($info['avdataend'] - $info['avdataoffset']).' (short by '.($ExpectedNumberOfAudioBytes - ($info['avdataend'] - $info['avdataoffset'])).' bytes)'); + } + } else { + if ((($info['avdataend'] - $info['avdataoffset']) - $ExpectedNumberOfAudioBytes) == 1) { + // $prenullbytefileoffset = $this->ftell(); + // $this->fseek($info['avdataend']); + // $PossibleNullByte = $this->fread(1); + // $this->fseek($prenullbytefileoffset); + // if ($PossibleNullByte === "\x00") { + $info['avdataend']--; + // $this->warning('Extra null byte at end of MP3 data assumed to be RIFF padding and therefore ignored'); + // } else { + // $this->warning('Too much data in file: expecting '.$ExpectedNumberOfAudioBytes.' bytes of audio data, found '.($info['avdataend'] - $info['avdataoffset']).' ('.(($info['avdataend'] - $info['avdataoffset']) - $ExpectedNumberOfAudioBytes).' bytes too many)'); + // } + } else { + $this->warning('Too much data in file: expecting '.$ExpectedNumberOfAudioBytes.' bytes of audio data, found '.($info['avdataend'] - $info['avdataoffset']).' ('.(($info['avdataend'] - $info['avdataoffset']) - $ExpectedNumberOfAudioBytes).' bytes too many)'); + } + } + } + + if (($thisfile_mpeg_audio['bitrate'] == 'free') && empty($info['audio']['bitrate'])) { + if (($offset == $info['avdataoffset']) && empty($thisfile_mpeg_audio['VBR_frames'])) { + $framebytelength = $this->FreeFormatFrameLength($offset, true); + if ($framebytelength > 0) { + $thisfile_mpeg_audio['framelength'] = $framebytelength; + if ($thisfile_mpeg_audio['layer'] == '1') { + // BitRate = (((FrameLengthInBytes / 4) - Padding) * SampleRate) / 12 + $info['audio']['bitrate'] = ((($framebytelength / 4) - intval($thisfile_mpeg_audio['padding'])) * $thisfile_mpeg_audio['sample_rate']) / 12; + } else { + // Bitrate = ((FrameLengthInBytes - Padding) * SampleRate) / 144 + $info['audio']['bitrate'] = (($framebytelength - intval($thisfile_mpeg_audio['padding'])) * $thisfile_mpeg_audio['sample_rate']) / 144; + } + } else { + $this->error('Error calculating frame length of free-format MP3 without Xing/LAME header'); + } + } + } + + if (isset($thisfile_mpeg_audio['VBR_frames']) ? $thisfile_mpeg_audio['VBR_frames'] : '') { + switch ($thisfile_mpeg_audio['bitrate_mode']) { + case 'vbr': + case 'abr': + $bytes_per_frame = 1152; + if (($thisfile_mpeg_audio['version'] == '1') && ($thisfile_mpeg_audio['layer'] == 1)) { + $bytes_per_frame = 384; + } elseif ((($thisfile_mpeg_audio['version'] == '2') || ($thisfile_mpeg_audio['version'] == '2.5')) && ($thisfile_mpeg_audio['layer'] == 3)) { + $bytes_per_frame = 576; + } + $thisfile_mpeg_audio['VBR_bitrate'] = (isset($thisfile_mpeg_audio['VBR_bytes']) ? (($thisfile_mpeg_audio['VBR_bytes'] / $thisfile_mpeg_audio['VBR_frames']) * 8) * ($info['audio']['sample_rate'] / $bytes_per_frame) : 0); + if ($thisfile_mpeg_audio['VBR_bitrate'] > 0) { + $info['audio']['bitrate'] = $thisfile_mpeg_audio['VBR_bitrate']; + $thisfile_mpeg_audio['bitrate'] = $thisfile_mpeg_audio['VBR_bitrate']; // to avoid confusion + } + break; + } + } + + // End variable-bitrate headers + //////////////////////////////////////////////////////////////////////////////////// + + if ($recursivesearch) { + + if (!$this->RecursiveFrameScanning($offset, $nextframetestoffset, $ScanAsCBR)) { + return false; + } + + } + + + //if (false) { + // // experimental side info parsing section - not returning anything useful yet + // + // $SideInfoBitstream = getid3_lib::BigEndian2Bin($SideInfoData); + // $SideInfoOffset = 0; + // + // if ($thisfile_mpeg_audio['version'] == '1') { + // if ($thisfile_mpeg_audio['channelmode'] == 'mono') { + // // MPEG-1 (mono) + // $thisfile_mpeg_audio['side_info']['main_data_begin'] = substr($SideInfoBitstream, $SideInfoOffset, 9); + // $SideInfoOffset += 9; + // $SideInfoOffset += 5; + // } else { + // // MPEG-1 (stereo, joint-stereo, dual-channel) + // $thisfile_mpeg_audio['side_info']['main_data_begin'] = substr($SideInfoBitstream, $SideInfoOffset, 9); + // $SideInfoOffset += 9; + // $SideInfoOffset += 3; + // } + // } else { // 2 or 2.5 + // if ($thisfile_mpeg_audio['channelmode'] == 'mono') { + // // MPEG-2, MPEG-2.5 (mono) + // $thisfile_mpeg_audio['side_info']['main_data_begin'] = substr($SideInfoBitstream, $SideInfoOffset, 8); + // $SideInfoOffset += 8; + // $SideInfoOffset += 1; + // } else { + // // MPEG-2, MPEG-2.5 (stereo, joint-stereo, dual-channel) + // $thisfile_mpeg_audio['side_info']['main_data_begin'] = substr($SideInfoBitstream, $SideInfoOffset, 8); + // $SideInfoOffset += 8; + // $SideInfoOffset += 2; + // } + // } + // + // if ($thisfile_mpeg_audio['version'] == '1') { + // for ($channel = 0; $channel < $info['audio']['channels']; $channel++) { + // for ($scfsi_band = 0; $scfsi_band < 4; $scfsi_band++) { + // $thisfile_mpeg_audio['scfsi'][$channel][$scfsi_band] = substr($SideInfoBitstream, $SideInfoOffset, 1); + // $SideInfoOffset += 2; + // } + // } + // } + // for ($granule = 0; $granule < (($thisfile_mpeg_audio['version'] == '1') ? 2 : 1); $granule++) { + // for ($channel = 0; $channel < $info['audio']['channels']; $channel++) { + // $thisfile_mpeg_audio['part2_3_length'][$granule][$channel] = substr($SideInfoBitstream, $SideInfoOffset, 12); + // $SideInfoOffset += 12; + // $thisfile_mpeg_audio['big_values'][$granule][$channel] = substr($SideInfoBitstream, $SideInfoOffset, 9); + // $SideInfoOffset += 9; + // $thisfile_mpeg_audio['global_gain'][$granule][$channel] = substr($SideInfoBitstream, $SideInfoOffset, 8); + // $SideInfoOffset += 8; + // if ($thisfile_mpeg_audio['version'] == '1') { + // $thisfile_mpeg_audio['scalefac_compress'][$granule][$channel] = substr($SideInfoBitstream, $SideInfoOffset, 4); + // $SideInfoOffset += 4; + // } else { + // $thisfile_mpeg_audio['scalefac_compress'][$granule][$channel] = substr($SideInfoBitstream, $SideInfoOffset, 9); + // $SideInfoOffset += 9; + // } + // $thisfile_mpeg_audio['window_switching_flag'][$granule][$channel] = substr($SideInfoBitstream, $SideInfoOffset, 1); + // $SideInfoOffset += 1; + // + // if ($thisfile_mpeg_audio['window_switching_flag'][$granule][$channel] == '1') { + // + // $thisfile_mpeg_audio['block_type'][$granule][$channel] = substr($SideInfoBitstream, $SideInfoOffset, 2); + // $SideInfoOffset += 2; + // $thisfile_mpeg_audio['mixed_block_flag'][$granule][$channel] = substr($SideInfoBitstream, $SideInfoOffset, 1); + // $SideInfoOffset += 1; + // + // for ($region = 0; $region < 2; $region++) { + // $thisfile_mpeg_audio['table_select'][$granule][$channel][$region] = substr($SideInfoBitstream, $SideInfoOffset, 5); + // $SideInfoOffset += 5; + // } + // $thisfile_mpeg_audio['table_select'][$granule][$channel][2] = 0; + // + // for ($window = 0; $window < 3; $window++) { + // $thisfile_mpeg_audio['subblock_gain'][$granule][$channel][$window] = substr($SideInfoBitstream, $SideInfoOffset, 3); + // $SideInfoOffset += 3; + // } + // + // } else { + // + // for ($region = 0; $region < 3; $region++) { + // $thisfile_mpeg_audio['table_select'][$granule][$channel][$region] = substr($SideInfoBitstream, $SideInfoOffset, 5); + // $SideInfoOffset += 5; + // } + // + // $thisfile_mpeg_audio['region0_count'][$granule][$channel] = substr($SideInfoBitstream, $SideInfoOffset, 4); + // $SideInfoOffset += 4; + // $thisfile_mpeg_audio['region1_count'][$granule][$channel] = substr($SideInfoBitstream, $SideInfoOffset, 3); + // $SideInfoOffset += 3; + // $thisfile_mpeg_audio['block_type'][$granule][$channel] = 0; + // } + // + // if ($thisfile_mpeg_audio['version'] == '1') { + // $thisfile_mpeg_audio['preflag'][$granule][$channel] = substr($SideInfoBitstream, $SideInfoOffset, 1); + // $SideInfoOffset += 1; + // } + // $thisfile_mpeg_audio['scalefac_scale'][$granule][$channel] = substr($SideInfoBitstream, $SideInfoOffset, 1); + // $SideInfoOffset += 1; + // $thisfile_mpeg_audio['count1table_select'][$granule][$channel] = substr($SideInfoBitstream, $SideInfoOffset, 1); + // $SideInfoOffset += 1; + // } + // } + //} + + return true; + } + + public function RecursiveFrameScanning(&$offset, &$nextframetestoffset, $ScanAsCBR) { + $info = &$this->getid3->info; + $firstframetestarray = array('error' => array(), 'warning'=> array(), 'avdataend' => $info['avdataend'], 'avdataoffset' => $info['avdataoffset']); + $this->decodeMPEGaudioHeader($offset, $firstframetestarray, false); + + for ($i = 0; $i < GETID3_MP3_VALID_CHECK_FRAMES; $i++) { + // check next GETID3_MP3_VALID_CHECK_FRAMES frames for validity, to make sure we haven't run across a false synch + if (($nextframetestoffset + 4) >= $info['avdataend']) { + // end of file + return true; + } + + $nextframetestarray = array('error' => array(), 'warning' => array(), 'avdataend' => $info['avdataend'], 'avdataoffset'=>$info['avdataoffset']); + if ($this->decodeMPEGaudioHeader($nextframetestoffset, $nextframetestarray, false)) { + if ($ScanAsCBR) { + // force CBR mode, used for trying to pick out invalid audio streams with valid(?) VBR headers, or VBR streams with no VBR header + if (!isset($nextframetestarray['mpeg']['audio']['bitrate']) || !isset($firstframetestarray['mpeg']['audio']['bitrate']) || ($nextframetestarray['mpeg']['audio']['bitrate'] != $firstframetestarray['mpeg']['audio']['bitrate'])) { + return false; + } + } + + + // next frame is OK, get ready to check the one after that + if (isset($nextframetestarray['mpeg']['audio']['framelength']) && ($nextframetestarray['mpeg']['audio']['framelength'] > 0)) { + $nextframetestoffset += $nextframetestarray['mpeg']['audio']['framelength']; + } else { + $this->error('Frame at offset ('.$offset.') is has an invalid frame length.'); + return false; + } + + } elseif (!empty($firstframetestarray['mpeg']['audio']['framelength']) && (($nextframetestoffset + $firstframetestarray['mpeg']['audio']['framelength']) > $info['avdataend'])) { + + // it's not the end of the file, but there's not enough data left for another frame, so assume it's garbage/padding and return OK + return true; + + } else { + + // next frame is not valid, note the error and fail, so scanning can contiue for a valid frame sequence + $this->warning('Frame at offset ('.$offset.') is valid, but the next one at ('.$nextframetestoffset.') is not.'); + + return false; + } + } + return true; + } + + public function FreeFormatFrameLength($offset, $deepscan=false) { + $info = &$this->getid3->info; + + $this->fseek($offset); + $MPEGaudioData = $this->fread(32768); + + $SyncPattern1 = substr($MPEGaudioData, 0, 4); + // may be different pattern due to padding + $SyncPattern2 = $SyncPattern1{0}.$SyncPattern1{1}.chr(ord($SyncPattern1{2}) | 0x02).$SyncPattern1{3}; + if ($SyncPattern2 === $SyncPattern1) { + $SyncPattern2 = $SyncPattern1{0}.$SyncPattern1{1}.chr(ord($SyncPattern1{2}) & 0xFD).$SyncPattern1{3}; + } + + $framelength = false; + $framelength1 = strpos($MPEGaudioData, $SyncPattern1, 4); + $framelength2 = strpos($MPEGaudioData, $SyncPattern2, 4); + if ($framelength1 > 4) { + $framelength = $framelength1; + } + if (($framelength2 > 4) && ($framelength2 < $framelength1)) { + $framelength = $framelength2; + } + if (!$framelength) { + + // LAME 3.88 has a different value for modeextension on the first frame vs the rest + $framelength1 = strpos($MPEGaudioData, substr($SyncPattern1, 0, 3), 4); + $framelength2 = strpos($MPEGaudioData, substr($SyncPattern2, 0, 3), 4); + + if ($framelength1 > 4) { + $framelength = $framelength1; + } + if (($framelength2 > 4) && ($framelength2 < $framelength1)) { + $framelength = $framelength2; + } + if (!$framelength) { + $this->error('Cannot find next free-format synch pattern ('.getid3_lib::PrintHexBytes($SyncPattern1).' or '.getid3_lib::PrintHexBytes($SyncPattern2).') after offset '.$offset); + return false; + } else { + $this->warning('ModeExtension varies between first frame and other frames (known free-format issue in LAME 3.88)'); + $info['audio']['codec'] = 'LAME'; + $info['audio']['encoder'] = 'LAME3.88'; + $SyncPattern1 = substr($SyncPattern1, 0, 3); + $SyncPattern2 = substr($SyncPattern2, 0, 3); + } + } + + if ($deepscan) { + + $ActualFrameLengthValues = array(); + $nextoffset = $offset + $framelength; + while ($nextoffset < ($info['avdataend'] - 6)) { + $this->fseek($nextoffset - 1); + $NextSyncPattern = $this->fread(6); + if ((substr($NextSyncPattern, 1, strlen($SyncPattern1)) == $SyncPattern1) || (substr($NextSyncPattern, 1, strlen($SyncPattern2)) == $SyncPattern2)) { + // good - found where expected + $ActualFrameLengthValues[] = $framelength; + } elseif ((substr($NextSyncPattern, 0, strlen($SyncPattern1)) == $SyncPattern1) || (substr($NextSyncPattern, 0, strlen($SyncPattern2)) == $SyncPattern2)) { + // ok - found one byte earlier than expected (last frame wasn't padded, first frame was) + $ActualFrameLengthValues[] = ($framelength - 1); + $nextoffset--; + } elseif ((substr($NextSyncPattern, 2, strlen($SyncPattern1)) == $SyncPattern1) || (substr($NextSyncPattern, 2, strlen($SyncPattern2)) == $SyncPattern2)) { + // ok - found one byte later than expected (last frame was padded, first frame wasn't) + $ActualFrameLengthValues[] = ($framelength + 1); + $nextoffset++; + } else { + $this->error('Did not find expected free-format sync pattern at offset '.$nextoffset); + return false; + } + $nextoffset += $framelength; + } + if (count($ActualFrameLengthValues) > 0) { + $framelength = intval(round(array_sum($ActualFrameLengthValues) / count($ActualFrameLengthValues))); + } + } + return $framelength; + } + + public function getOnlyMPEGaudioInfoBruteForce() { + $MPEGaudioHeaderDecodeCache = array(); + $MPEGaudioHeaderValidCache = array(); + $MPEGaudioHeaderLengthCache = array(); + $MPEGaudioVersionLookup = self::MPEGaudioVersionArray(); + $MPEGaudioLayerLookup = self::MPEGaudioLayerArray(); + $MPEGaudioBitrateLookup = self::MPEGaudioBitrateArray(); + $MPEGaudioFrequencyLookup = self::MPEGaudioFrequencyArray(); + $MPEGaudioChannelModeLookup = self::MPEGaudioChannelModeArray(); + $MPEGaudioModeExtensionLookup = self::MPEGaudioModeExtensionArray(); + $MPEGaudioEmphasisLookup = self::MPEGaudioEmphasisArray(); + $LongMPEGversionLookup = array(); + $LongMPEGlayerLookup = array(); + $LongMPEGbitrateLookup = array(); + $LongMPEGpaddingLookup = array(); + $LongMPEGfrequencyLookup = array(); + $Distribution['bitrate'] = array(); + $Distribution['frequency'] = array(); + $Distribution['layer'] = array(); + $Distribution['version'] = array(); + $Distribution['padding'] = array(); + + $info = &$this->getid3->info; + $this->fseek($info['avdataoffset']); + + $max_frames_scan = 5000; + $frames_scanned = 0; + + $previousvalidframe = $info['avdataoffset']; + while ($this->ftell() < $info['avdataend']) { + set_time_limit(30); + $head4 = $this->fread(4); + if (strlen($head4) < 4) { + break; + } + if ($head4{0} != "\xFF") { + for ($i = 1; $i < 4; $i++) { + if ($head4{$i} == "\xFF") { + $this->fseek($i - 4, SEEK_CUR); + continue 2; + } + } + continue; + } + if (!isset($MPEGaudioHeaderDecodeCache[$head4])) { + $MPEGaudioHeaderDecodeCache[$head4] = self::MPEGaudioHeaderDecode($head4); + } + if (!isset($MPEGaudioHeaderValidCache[$head4])) { + $MPEGaudioHeaderValidCache[$head4] = self::MPEGaudioHeaderValid($MPEGaudioHeaderDecodeCache[$head4], false, false); + } + if ($MPEGaudioHeaderValidCache[$head4]) { + + if (!isset($MPEGaudioHeaderLengthCache[$head4])) { + $LongMPEGversionLookup[$head4] = $MPEGaudioVersionLookup[$MPEGaudioHeaderDecodeCache[$head4]['version']]; + $LongMPEGlayerLookup[$head4] = $MPEGaudioLayerLookup[$MPEGaudioHeaderDecodeCache[$head4]['layer']]; + $LongMPEGbitrateLookup[$head4] = $MPEGaudioBitrateLookup[$LongMPEGversionLookup[$head4]][$LongMPEGlayerLookup[$head4]][$MPEGaudioHeaderDecodeCache[$head4]['bitrate']]; + $LongMPEGpaddingLookup[$head4] = (bool) $MPEGaudioHeaderDecodeCache[$head4]['padding']; + $LongMPEGfrequencyLookup[$head4] = $MPEGaudioFrequencyLookup[$LongMPEGversionLookup[$head4]][$MPEGaudioHeaderDecodeCache[$head4]['sample_rate']]; + $MPEGaudioHeaderLengthCache[$head4] = self::MPEGaudioFrameLength( + $LongMPEGbitrateLookup[$head4], + $LongMPEGversionLookup[$head4], + $LongMPEGlayerLookup[$head4], + $LongMPEGpaddingLookup[$head4], + $LongMPEGfrequencyLookup[$head4]); + } + if ($MPEGaudioHeaderLengthCache[$head4] > 4) { + $WhereWeWere = $this->ftell(); + $this->fseek($MPEGaudioHeaderLengthCache[$head4] - 4, SEEK_CUR); + $next4 = $this->fread(4); + if ($next4{0} == "\xFF") { + if (!isset($MPEGaudioHeaderDecodeCache[$next4])) { + $MPEGaudioHeaderDecodeCache[$next4] = self::MPEGaudioHeaderDecode($next4); + } + if (!isset($MPEGaudioHeaderValidCache[$next4])) { + $MPEGaudioHeaderValidCache[$next4] = self::MPEGaudioHeaderValid($MPEGaudioHeaderDecodeCache[$next4], false, false); + } + if ($MPEGaudioHeaderValidCache[$next4]) { + $this->fseek(-4, SEEK_CUR); + + getid3_lib::safe_inc($Distribution['bitrate'][$LongMPEGbitrateLookup[$head4]]); + getid3_lib::safe_inc($Distribution['layer'][$LongMPEGlayerLookup[$head4]]); + getid3_lib::safe_inc($Distribution['version'][$LongMPEGversionLookup[$head4]]); + getid3_lib::safe_inc($Distribution['padding'][intval($LongMPEGpaddingLookup[$head4])]); + getid3_lib::safe_inc($Distribution['frequency'][$LongMPEGfrequencyLookup[$head4]]); + if ($max_frames_scan && (++$frames_scanned >= $max_frames_scan)) { + $pct_data_scanned = ($this->ftell() - $info['avdataoffset']) / ($info['avdataend'] - $info['avdataoffset']); + $this->warning('too many MPEG audio frames to scan, only scanned first '.$max_frames_scan.' frames ('.number_format($pct_data_scanned * 100, 1).'% of file) and extrapolated distribution, playtime and bitrate may be incorrect.'); + foreach ($Distribution as $key1 => $value1) { + foreach ($value1 as $key2 => $value2) { + $Distribution[$key1][$key2] = round($value2 / $pct_data_scanned); + } + } + break; + } + continue; + } + } + unset($next4); + $this->fseek($WhereWeWere - 3); + } + + } + } + foreach ($Distribution as $key => $value) { + ksort($Distribution[$key], SORT_NUMERIC); + } + ksort($Distribution['version'], SORT_STRING); + $info['mpeg']['audio']['bitrate_distribution'] = $Distribution['bitrate']; + $info['mpeg']['audio']['frequency_distribution'] = $Distribution['frequency']; + $info['mpeg']['audio']['layer_distribution'] = $Distribution['layer']; + $info['mpeg']['audio']['version_distribution'] = $Distribution['version']; + $info['mpeg']['audio']['padding_distribution'] = $Distribution['padding']; + if (count($Distribution['version']) > 1) { + $this->error('Corrupt file - more than one MPEG version detected'); + } + if (count($Distribution['layer']) > 1) { + $this->error('Corrupt file - more than one MPEG layer detected'); + } + if (count($Distribution['frequency']) > 1) { + $this->error('Corrupt file - more than one MPEG sample rate detected'); + } + + + $bittotal = 0; + foreach ($Distribution['bitrate'] as $bitratevalue => $bitratecount) { + if ($bitratevalue != 'free') { + $bittotal += ($bitratevalue * $bitratecount); + } + } + $info['mpeg']['audio']['frame_count'] = array_sum($Distribution['bitrate']); + if ($info['mpeg']['audio']['frame_count'] == 0) { + $this->error('no MPEG audio frames found'); + return false; + } + $info['mpeg']['audio']['bitrate'] = ($bittotal / $info['mpeg']['audio']['frame_count']); + $info['mpeg']['audio']['bitrate_mode'] = ((count($Distribution['bitrate']) > 0) ? 'vbr' : 'cbr'); + $info['mpeg']['audio']['sample_rate'] = getid3_lib::array_max($Distribution['frequency'], true); + + $info['audio']['bitrate'] = $info['mpeg']['audio']['bitrate']; + $info['audio']['bitrate_mode'] = $info['mpeg']['audio']['bitrate_mode']; + $info['audio']['sample_rate'] = $info['mpeg']['audio']['sample_rate']; + $info['audio']['dataformat'] = 'mp'.getid3_lib::array_max($Distribution['layer'], true); + $info['fileformat'] = $info['audio']['dataformat']; + + return true; + } + + + public function getOnlyMPEGaudioInfo($avdataoffset, $BitrateHistogram=false) { + // looks for synch, decodes MPEG audio header + + $info = &$this->getid3->info; + + static $MPEGaudioVersionLookup; + static $MPEGaudioLayerLookup; + static $MPEGaudioBitrateLookup; + if (empty($MPEGaudioVersionLookup)) { + $MPEGaudioVersionLookup = self::MPEGaudioVersionArray(); + $MPEGaudioLayerLookup = self::MPEGaudioLayerArray(); + $MPEGaudioBitrateLookup = self::MPEGaudioBitrateArray(); + + } + + $this->fseek($avdataoffset); + $sync_seek_buffer_size = min(128 * 1024, $info['avdataend'] - $avdataoffset); + if ($sync_seek_buffer_size <= 0) { + $this->error('Invalid $sync_seek_buffer_size at offset '.$avdataoffset); + return false; + } + $header = $this->fread($sync_seek_buffer_size); + $sync_seek_buffer_size = strlen($header); + $SynchSeekOffset = 0; + while ($SynchSeekOffset < $sync_seek_buffer_size) { + if ((($avdataoffset + $SynchSeekOffset) < $info['avdataend']) && !feof($this->getid3->fp)) { + + if ($SynchSeekOffset > $sync_seek_buffer_size) { + // if a synch's not found within the first 128k bytes, then give up + $this->error('Could not find valid MPEG audio synch within the first '.round($sync_seek_buffer_size / 1024).'kB'); + if (isset($info['audio']['bitrate'])) { + unset($info['audio']['bitrate']); + } + if (isset($info['mpeg']['audio'])) { + unset($info['mpeg']['audio']); + } + if (empty($info['mpeg'])) { + unset($info['mpeg']); + } + return false; + + } elseif (feof($this->getid3->fp)) { + + $this->error('Could not find valid MPEG audio synch before end of file'); + if (isset($info['audio']['bitrate'])) { + unset($info['audio']['bitrate']); + } + if (isset($info['mpeg']['audio'])) { + unset($info['mpeg']['audio']); + } + if (isset($info['mpeg']) && (!is_array($info['mpeg']) || (count($info['mpeg']) == 0))) { + unset($info['mpeg']); + } + return false; + } + } + + if (($SynchSeekOffset + 1) >= strlen($header)) { + $this->error('Could not find valid MPEG synch before end of file'); + return false; + } + + if (($header{$SynchSeekOffset} == "\xFF") && ($header{($SynchSeekOffset + 1)} > "\xE0")) { // synch detected + if (!isset($FirstFrameThisfileInfo) && !isset($info['mpeg']['audio'])) { + $FirstFrameThisfileInfo = $info; + $FirstFrameAVDataOffset = $avdataoffset + $SynchSeekOffset; + if (!$this->decodeMPEGaudioHeader($FirstFrameAVDataOffset, $FirstFrameThisfileInfo, false)) { + // if this is the first valid MPEG-audio frame, save it in case it's a VBR header frame and there's + // garbage between this frame and a valid sequence of MPEG-audio frames, to be restored below + unset($FirstFrameThisfileInfo); + } + } + + $dummy = $info; // only overwrite real data if valid header found + if ($this->decodeMPEGaudioHeader($avdataoffset + $SynchSeekOffset, $dummy, true)) { + $info = $dummy; + $info['avdataoffset'] = $avdataoffset + $SynchSeekOffset; + switch (isset($info['fileformat']) ? $info['fileformat'] : '') { + case '': + case 'id3': + case 'ape': + case 'mp3': + $info['fileformat'] = 'mp3'; + $info['audio']['dataformat'] = 'mp3'; + break; + } + if (isset($FirstFrameThisfileInfo['mpeg']['audio']['bitrate_mode']) && ($FirstFrameThisfileInfo['mpeg']['audio']['bitrate_mode'] == 'vbr')) { + if (!(abs($info['audio']['bitrate'] - $FirstFrameThisfileInfo['audio']['bitrate']) <= 1)) { + // If there is garbage data between a valid VBR header frame and a sequence + // of valid MPEG-audio frames the VBR data is no longer discarded. + $info = $FirstFrameThisfileInfo; + $info['avdataoffset'] = $FirstFrameAVDataOffset; + $info['fileformat'] = 'mp3'; + $info['audio']['dataformat'] = 'mp3'; + $dummy = $info; + unset($dummy['mpeg']['audio']); + $GarbageOffsetStart = $FirstFrameAVDataOffset + $FirstFrameThisfileInfo['mpeg']['audio']['framelength']; + $GarbageOffsetEnd = $avdataoffset + $SynchSeekOffset; + if ($this->decodeMPEGaudioHeader($GarbageOffsetEnd, $dummy, true, true)) { + $info = $dummy; + $info['avdataoffset'] = $GarbageOffsetEnd; + $this->warning('apparently-valid VBR header not used because could not find '.GETID3_MP3_VALID_CHECK_FRAMES.' consecutive MPEG-audio frames immediately after VBR header (garbage data for '.($GarbageOffsetEnd - $GarbageOffsetStart).' bytes between '.$GarbageOffsetStart.' and '.$GarbageOffsetEnd.'), but did find valid CBR stream starting at '.$GarbageOffsetEnd); + } else { + $this->warning('using data from VBR header even though could not find '.GETID3_MP3_VALID_CHECK_FRAMES.' consecutive MPEG-audio frames immediately after VBR header (garbage data for '.($GarbageOffsetEnd - $GarbageOffsetStart).' bytes between '.$GarbageOffsetStart.' and '.$GarbageOffsetEnd.')'); + } + } + } + if (isset($info['mpeg']['audio']['bitrate_mode']) && ($info['mpeg']['audio']['bitrate_mode'] == 'vbr') && !isset($info['mpeg']['audio']['VBR_method'])) { + // VBR file with no VBR header + $BitrateHistogram = true; + } + + if ($BitrateHistogram) { + + $info['mpeg']['audio']['stereo_distribution'] = array('stereo'=>0, 'joint stereo'=>0, 'dual channel'=>0, 'mono'=>0); + $info['mpeg']['audio']['version_distribution'] = array('1'=>0, '2'=>0, '2.5'=>0); + + if ($info['mpeg']['audio']['version'] == '1') { + if ($info['mpeg']['audio']['layer'] == 3) { + $info['mpeg']['audio']['bitrate_distribution'] = array('free'=>0, 32000=>0, 40000=>0, 48000=>0, 56000=>0, 64000=>0, 80000=>0, 96000=>0, 112000=>0, 128000=>0, 160000=>0, 192000=>0, 224000=>0, 256000=>0, 320000=>0); + } elseif ($info['mpeg']['audio']['layer'] == 2) { + $info['mpeg']['audio']['bitrate_distribution'] = array('free'=>0, 32000=>0, 48000=>0, 56000=>0, 64000=>0, 80000=>0, 96000=>0, 112000=>0, 128000=>0, 160000=>0, 192000=>0, 224000=>0, 256000=>0, 320000=>0, 384000=>0); + } elseif ($info['mpeg']['audio']['layer'] == 1) { + $info['mpeg']['audio']['bitrate_distribution'] = array('free'=>0, 32000=>0, 64000=>0, 96000=>0, 128000=>0, 160000=>0, 192000=>0, 224000=>0, 256000=>0, 288000=>0, 320000=>0, 352000=>0, 384000=>0, 416000=>0, 448000=>0); + } + } elseif ($info['mpeg']['audio']['layer'] == 1) { + $info['mpeg']['audio']['bitrate_distribution'] = array('free'=>0, 32000=>0, 48000=>0, 56000=>0, 64000=>0, 80000=>0, 96000=>0, 112000=>0, 128000=>0, 144000=>0, 160000=>0, 176000=>0, 192000=>0, 224000=>0, 256000=>0); + } else { + $info['mpeg']['audio']['bitrate_distribution'] = array('free'=>0, 8000=>0, 16000=>0, 24000=>0, 32000=>0, 40000=>0, 48000=>0, 56000=>0, 64000=>0, 80000=>0, 96000=>0, 112000=>0, 128000=>0, 144000=>0, 160000=>0); + } + + $dummy = array('error'=>$info['error'], 'warning'=>$info['warning'], 'avdataend'=>$info['avdataend'], 'avdataoffset'=>$info['avdataoffset']); + $synchstartoffset = $info['avdataoffset']; + $this->fseek($info['avdataoffset']); + + // you can play with these numbers: + $max_frames_scan = 50000; + $max_scan_segments = 10; + + // don't play with these numbers: + $FastMode = false; + $SynchErrorsFound = 0; + $frames_scanned = 0; + $this_scan_segment = 0; + $frames_scan_per_segment = ceil($max_frames_scan / $max_scan_segments); + $pct_data_scanned = 0; + for ($current_segment = 0; $current_segment < $max_scan_segments; $current_segment++) { + $frames_scanned_this_segment = 0; + if ($this->ftell() >= $info['avdataend']) { + break; + } + $scan_start_offset[$current_segment] = max($this->ftell(), $info['avdataoffset'] + round($current_segment * (($info['avdataend'] - $info['avdataoffset']) / $max_scan_segments))); + if ($current_segment > 0) { + $this->fseek($scan_start_offset[$current_segment]); + $buffer_4k = $this->fread(4096); + for ($j = 0; $j < (strlen($buffer_4k) - 4); $j++) { + if (($buffer_4k{$j} == "\xFF") && ($buffer_4k{($j + 1)} > "\xE0")) { // synch detected + if ($this->decodeMPEGaudioHeader($scan_start_offset[$current_segment] + $j, $dummy, false, false, $FastMode)) { + $calculated_next_offset = $scan_start_offset[$current_segment] + $j + $dummy['mpeg']['audio']['framelength']; + if ($this->decodeMPEGaudioHeader($calculated_next_offset, $dummy, false, false, $FastMode)) { + $scan_start_offset[$current_segment] += $j; + break; + } + } + } + } + } + $synchstartoffset = $scan_start_offset[$current_segment]; + while ($this->decodeMPEGaudioHeader($synchstartoffset, $dummy, false, false, $FastMode)) { + $FastMode = true; + $thisframebitrate = $MPEGaudioBitrateLookup[$MPEGaudioVersionLookup[$dummy['mpeg']['audio']['raw']['version']]][$MPEGaudioLayerLookup[$dummy['mpeg']['audio']['raw']['layer']]][$dummy['mpeg']['audio']['raw']['bitrate']]; + + if (empty($dummy['mpeg']['audio']['framelength'])) { + $SynchErrorsFound++; + $synchstartoffset++; + } else { + getid3_lib::safe_inc($info['mpeg']['audio']['bitrate_distribution'][$thisframebitrate]); + getid3_lib::safe_inc($info['mpeg']['audio']['stereo_distribution'][$dummy['mpeg']['audio']['channelmode']]); + getid3_lib::safe_inc($info['mpeg']['audio']['version_distribution'][$dummy['mpeg']['audio']['version']]); + $synchstartoffset += $dummy['mpeg']['audio']['framelength']; + } + $frames_scanned++; + if ($frames_scan_per_segment && (++$frames_scanned_this_segment >= $frames_scan_per_segment)) { + $this_pct_scanned = ($this->ftell() - $scan_start_offset[$current_segment]) / ($info['avdataend'] - $info['avdataoffset']); + if (($current_segment == 0) && (($this_pct_scanned * $max_scan_segments) >= 1)) { + // file likely contains < $max_frames_scan, just scan as one segment + $max_scan_segments = 1; + $frames_scan_per_segment = $max_frames_scan; + } else { + $pct_data_scanned += $this_pct_scanned; + break; + } + } + } + } + if ($pct_data_scanned > 0) { + $this->warning('too many MPEG audio frames to scan, only scanned '.$frames_scanned.' frames in '.$max_scan_segments.' segments ('.number_format($pct_data_scanned * 100, 1).'% of file) and extrapolated distribution, playtime and bitrate may be incorrect.'); + foreach ($info['mpeg']['audio'] as $key1 => $value1) { + if (!preg_match('#_distribution$#i', $key1)) { + continue; + } + foreach ($value1 as $key2 => $value2) { + $info['mpeg']['audio'][$key1][$key2] = round($value2 / $pct_data_scanned); + } + } + } + + if ($SynchErrorsFound > 0) { + $this->warning('Found '.$SynchErrorsFound.' synch errors in histogram analysis'); + //return false; + } + + $bittotal = 0; + $framecounter = 0; + foreach ($info['mpeg']['audio']['bitrate_distribution'] as $bitratevalue => $bitratecount) { + $framecounter += $bitratecount; + if ($bitratevalue != 'free') { + $bittotal += ($bitratevalue * $bitratecount); + } + } + if ($framecounter == 0) { + $this->error('Corrupt MP3 file: framecounter == zero'); + return false; + } + $info['mpeg']['audio']['frame_count'] = getid3_lib::CastAsInt($framecounter); + $info['mpeg']['audio']['bitrate'] = ($bittotal / $framecounter); + + $info['audio']['bitrate'] = $info['mpeg']['audio']['bitrate']; + + + // Definitively set VBR vs CBR, even if the Xing/LAME/VBRI header says differently + $distinct_bitrates = 0; + foreach ($info['mpeg']['audio']['bitrate_distribution'] as $bitrate_value => $bitrate_count) { + if ($bitrate_count > 0) { + $distinct_bitrates++; + } + } + if ($distinct_bitrates > 1) { + $info['mpeg']['audio']['bitrate_mode'] = 'vbr'; + } else { + $info['mpeg']['audio']['bitrate_mode'] = 'cbr'; + } + $info['audio']['bitrate_mode'] = $info['mpeg']['audio']['bitrate_mode']; + + } + + break; // exit while() + } + } + + $SynchSeekOffset++; + if (($avdataoffset + $SynchSeekOffset) >= $info['avdataend']) { + // end of file/data + + if (empty($info['mpeg']['audio'])) { + + $this->error('could not find valid MPEG synch before end of file'); + if (isset($info['audio']['bitrate'])) { + unset($info['audio']['bitrate']); + } + if (isset($info['mpeg']['audio'])) { + unset($info['mpeg']['audio']); + } + if (isset($info['mpeg']) && (!is_array($info['mpeg']) || empty($info['mpeg']))) { + unset($info['mpeg']); + } + return false; + + } + break; + } + + } + $info['audio']['channels'] = $info['mpeg']['audio']['channels']; + $info['audio']['channelmode'] = $info['mpeg']['audio']['channelmode']; + $info['audio']['sample_rate'] = $info['mpeg']['audio']['sample_rate']; + return true; + } + + + public static function MPEGaudioVersionArray() { + static $MPEGaudioVersion = array('2.5', false, '2', '1'); + return $MPEGaudioVersion; + } + + public static function MPEGaudioLayerArray() { + static $MPEGaudioLayer = array(false, 3, 2, 1); + return $MPEGaudioLayer; + } + + public static function MPEGaudioBitrateArray() { + static $MPEGaudioBitrate; + if (empty($MPEGaudioBitrate)) { + $MPEGaudioBitrate = array ( + '1' => array (1 => array('free', 32000, 64000, 96000, 128000, 160000, 192000, 224000, 256000, 288000, 320000, 352000, 384000, 416000, 448000), + 2 => array('free', 32000, 48000, 56000, 64000, 80000, 96000, 112000, 128000, 160000, 192000, 224000, 256000, 320000, 384000), + 3 => array('free', 32000, 40000, 48000, 56000, 64000, 80000, 96000, 112000, 128000, 160000, 192000, 224000, 256000, 320000) + ), + + '2' => array (1 => array('free', 32000, 48000, 56000, 64000, 80000, 96000, 112000, 128000, 144000, 160000, 176000, 192000, 224000, 256000), + 2 => array('free', 8000, 16000, 24000, 32000, 40000, 48000, 56000, 64000, 80000, 96000, 112000, 128000, 144000, 160000), + ) + ); + $MPEGaudioBitrate['2'][3] = $MPEGaudioBitrate['2'][2]; + $MPEGaudioBitrate['2.5'] = $MPEGaudioBitrate['2']; + } + return $MPEGaudioBitrate; + } + + public static function MPEGaudioFrequencyArray() { + static $MPEGaudioFrequency; + if (empty($MPEGaudioFrequency)) { + $MPEGaudioFrequency = array ( + '1' => array(44100, 48000, 32000), + '2' => array(22050, 24000, 16000), + '2.5' => array(11025, 12000, 8000) + ); + } + return $MPEGaudioFrequency; + } + + public static function MPEGaudioChannelModeArray() { + static $MPEGaudioChannelMode = array('stereo', 'joint stereo', 'dual channel', 'mono'); + return $MPEGaudioChannelMode; + } + + public static function MPEGaudioModeExtensionArray() { + static $MPEGaudioModeExtension; + if (empty($MPEGaudioModeExtension)) { + $MPEGaudioModeExtension = array ( + 1 => array('4-31', '8-31', '12-31', '16-31'), + 2 => array('4-31', '8-31', '12-31', '16-31'), + 3 => array('', 'IS', 'MS', 'IS+MS') + ); + } + return $MPEGaudioModeExtension; + } + + public static function MPEGaudioEmphasisArray() { + static $MPEGaudioEmphasis = array('none', '50/15ms', false, 'CCIT J.17'); + return $MPEGaudioEmphasis; + } + + public static function MPEGaudioHeaderBytesValid($head4, $allowBitrate15=false) { + return self::MPEGaudioHeaderValid(self::MPEGaudioHeaderDecode($head4), false, $allowBitrate15); + } + + public static function MPEGaudioHeaderValid($rawarray, $echoerrors=false, $allowBitrate15=false) { + if (($rawarray['synch'] & 0x0FFE) != 0x0FFE) { + return false; + } + + static $MPEGaudioVersionLookup; + static $MPEGaudioLayerLookup; + static $MPEGaudioBitrateLookup; + static $MPEGaudioFrequencyLookup; + static $MPEGaudioChannelModeLookup; + static $MPEGaudioModeExtensionLookup; + static $MPEGaudioEmphasisLookup; + if (empty($MPEGaudioVersionLookup)) { + $MPEGaudioVersionLookup = self::MPEGaudioVersionArray(); + $MPEGaudioLayerLookup = self::MPEGaudioLayerArray(); + $MPEGaudioBitrateLookup = self::MPEGaudioBitrateArray(); + $MPEGaudioFrequencyLookup = self::MPEGaudioFrequencyArray(); + $MPEGaudioChannelModeLookup = self::MPEGaudioChannelModeArray(); + $MPEGaudioModeExtensionLookup = self::MPEGaudioModeExtensionArray(); + $MPEGaudioEmphasisLookup = self::MPEGaudioEmphasisArray(); + } + + if (isset($MPEGaudioVersionLookup[$rawarray['version']])) { + $decodedVersion = $MPEGaudioVersionLookup[$rawarray['version']]; + } else { + echo ($echoerrors ? "\n".'invalid Version ('.$rawarray['version'].')' : ''); + return false; + } + if (isset($MPEGaudioLayerLookup[$rawarray['layer']])) { + $decodedLayer = $MPEGaudioLayerLookup[$rawarray['layer']]; + } else { + echo ($echoerrors ? "\n".'invalid Layer ('.$rawarray['layer'].')' : ''); + return false; + } + if (!isset($MPEGaudioBitrateLookup[$decodedVersion][$decodedLayer][$rawarray['bitrate']])) { + echo ($echoerrors ? "\n".'invalid Bitrate ('.$rawarray['bitrate'].')' : ''); + if ($rawarray['bitrate'] == 15) { + // known issue in LAME 3.90 - 3.93.1 where free-format has bitrate ID of 15 instead of 0 + // let it go through here otherwise file will not be identified + if (!$allowBitrate15) { + return false; + } + } else { + return false; + } + } + if (!isset($MPEGaudioFrequencyLookup[$decodedVersion][$rawarray['sample_rate']])) { + echo ($echoerrors ? "\n".'invalid Frequency ('.$rawarray['sample_rate'].')' : ''); + return false; + } + if (!isset($MPEGaudioChannelModeLookup[$rawarray['channelmode']])) { + echo ($echoerrors ? "\n".'invalid ChannelMode ('.$rawarray['channelmode'].')' : ''); + return false; + } + if (!isset($MPEGaudioModeExtensionLookup[$decodedLayer][$rawarray['modeextension']])) { + echo ($echoerrors ? "\n".'invalid Mode Extension ('.$rawarray['modeextension'].')' : ''); + return false; + } + if (!isset($MPEGaudioEmphasisLookup[$rawarray['emphasis']])) { + echo ($echoerrors ? "\n".'invalid Emphasis ('.$rawarray['emphasis'].')' : ''); + return false; + } + // These are just either set or not set, you can't mess that up :) + // $rawarray['protection']; + // $rawarray['padding']; + // $rawarray['private']; + // $rawarray['copyright']; + // $rawarray['original']; + + return true; + } + + public static function MPEGaudioHeaderDecode($Header4Bytes) { + // AAAA AAAA AAAB BCCD EEEE FFGH IIJJ KLMM + // A - Frame sync (all bits set) + // B - MPEG Audio version ID + // C - Layer description + // D - Protection bit + // E - Bitrate index + // F - Sampling rate frequency index + // G - Padding bit + // H - Private bit + // I - Channel Mode + // J - Mode extension (Only if Joint stereo) + // K - Copyright + // L - Original + // M - Emphasis + + if (strlen($Header4Bytes) != 4) { + return false; + } + + $MPEGrawHeader['synch'] = (getid3_lib::BigEndian2Int(substr($Header4Bytes, 0, 2)) & 0xFFE0) >> 4; + $MPEGrawHeader['version'] = (ord($Header4Bytes{1}) & 0x18) >> 3; // BB + $MPEGrawHeader['layer'] = (ord($Header4Bytes{1}) & 0x06) >> 1; // CC + $MPEGrawHeader['protection'] = (ord($Header4Bytes{1}) & 0x01); // D + $MPEGrawHeader['bitrate'] = (ord($Header4Bytes{2}) & 0xF0) >> 4; // EEEE + $MPEGrawHeader['sample_rate'] = (ord($Header4Bytes{2}) & 0x0C) >> 2; // FF + $MPEGrawHeader['padding'] = (ord($Header4Bytes{2}) & 0x02) >> 1; // G + $MPEGrawHeader['private'] = (ord($Header4Bytes{2}) & 0x01); // H + $MPEGrawHeader['channelmode'] = (ord($Header4Bytes{3}) & 0xC0) >> 6; // II + $MPEGrawHeader['modeextension'] = (ord($Header4Bytes{3}) & 0x30) >> 4; // JJ + $MPEGrawHeader['copyright'] = (ord($Header4Bytes{3}) & 0x08) >> 3; // K + $MPEGrawHeader['original'] = (ord($Header4Bytes{3}) & 0x04) >> 2; // L + $MPEGrawHeader['emphasis'] = (ord($Header4Bytes{3}) & 0x03); // MM + + return $MPEGrawHeader; + } + + public static function MPEGaudioFrameLength(&$bitrate, &$version, &$layer, $padding, &$samplerate) { + static $AudioFrameLengthCache = array(); + + if (!isset($AudioFrameLengthCache[$bitrate][$version][$layer][$padding][$samplerate])) { + $AudioFrameLengthCache[$bitrate][$version][$layer][$padding][$samplerate] = false; + if ($bitrate != 'free') { + + if ($version == '1') { + + if ($layer == '1') { + + // For Layer I slot is 32 bits long + $FrameLengthCoefficient = 48; + $SlotLength = 4; + + } else { // Layer 2 / 3 + + // for Layer 2 and Layer 3 slot is 8 bits long. + $FrameLengthCoefficient = 144; + $SlotLength = 1; + + } + + } else { // MPEG-2 / MPEG-2.5 + + if ($layer == '1') { + + // For Layer I slot is 32 bits long + $FrameLengthCoefficient = 24; + $SlotLength = 4; + + } elseif ($layer == '2') { + + // for Layer 2 and Layer 3 slot is 8 bits long. + $FrameLengthCoefficient = 144; + $SlotLength = 1; + + } else { // layer 3 + + // for Layer 2 and Layer 3 slot is 8 bits long. + $FrameLengthCoefficient = 72; + $SlotLength = 1; + + } + + } + + // FrameLengthInBytes = ((Coefficient * BitRate) / SampleRate) + Padding + if ($samplerate > 0) { + $NewFramelength = ($FrameLengthCoefficient * $bitrate) / $samplerate; + $NewFramelength = floor($NewFramelength / $SlotLength) * $SlotLength; // round to next-lower multiple of SlotLength (1 byte for Layer 2/3, 4 bytes for Layer I) + if ($padding) { + $NewFramelength += $SlotLength; + } + $AudioFrameLengthCache[$bitrate][$version][$layer][$padding][$samplerate] = (int) $NewFramelength; + } + } + } + return $AudioFrameLengthCache[$bitrate][$version][$layer][$padding][$samplerate]; + } + + public static function ClosestStandardMP3Bitrate($bit_rate) { + static $standard_bit_rates = array (320000, 256000, 224000, 192000, 160000, 128000, 112000, 96000, 80000, 64000, 56000, 48000, 40000, 32000, 24000, 16000, 8000); + static $bit_rate_table = array (0=>'-'); + $round_bit_rate = intval(round($bit_rate, -3)); + if (!isset($bit_rate_table[$round_bit_rate])) { + if ($round_bit_rate > max($standard_bit_rates)) { + $bit_rate_table[$round_bit_rate] = round($bit_rate, 2 - strlen($bit_rate)); + } else { + $bit_rate_table[$round_bit_rate] = max($standard_bit_rates); + foreach ($standard_bit_rates as $standard_bit_rate) { + if ($round_bit_rate >= $standard_bit_rate + (($bit_rate_table[$round_bit_rate] - $standard_bit_rate) / 2)) { + break; + } + $bit_rate_table[$round_bit_rate] = $standard_bit_rate; + } + } + } + return $bit_rate_table[$round_bit_rate]; + } + + public static function XingVBRidOffset($version, $channelmode) { + static $XingVBRidOffsetCache = array(); + if (empty($XingVBRidOffset)) { + $XingVBRidOffset = array ( + '1' => array ('mono' => 0x15, // 4 + 17 = 21 + 'stereo' => 0x24, // 4 + 32 = 36 + 'joint stereo' => 0x24, + 'dual channel' => 0x24 + ), + + '2' => array ('mono' => 0x0D, // 4 + 9 = 13 + 'stereo' => 0x15, // 4 + 17 = 21 + 'joint stereo' => 0x15, + 'dual channel' => 0x15 + ), + + '2.5' => array ('mono' => 0x15, + 'stereo' => 0x15, + 'joint stereo' => 0x15, + 'dual channel' => 0x15 + ) + ); + } + return $XingVBRidOffset[$version][$channelmode]; + } + + public static function LAMEvbrMethodLookup($VBRmethodID) { + static $LAMEvbrMethodLookup = array( + 0x00 => 'unknown', + 0x01 => 'cbr', + 0x02 => 'abr', + 0x03 => 'vbr-old / vbr-rh', + 0x04 => 'vbr-new / vbr-mtrh', + 0x05 => 'vbr-mt', + 0x06 => 'vbr (full vbr method 4)', + 0x08 => 'cbr (constant bitrate 2 pass)', + 0x09 => 'abr (2 pass)', + 0x0F => 'reserved' + ); + return (isset($LAMEvbrMethodLookup[$VBRmethodID]) ? $LAMEvbrMethodLookup[$VBRmethodID] : ''); + } + + public static function LAMEmiscStereoModeLookup($StereoModeID) { + static $LAMEmiscStereoModeLookup = array( + 0 => 'mono', + 1 => 'stereo', + 2 => 'dual mono', + 3 => 'joint stereo', + 4 => 'forced stereo', + 5 => 'auto', + 6 => 'intensity stereo', + 7 => 'other' + ); + return (isset($LAMEmiscStereoModeLookup[$StereoModeID]) ? $LAMEmiscStereoModeLookup[$StereoModeID] : ''); + } + + public static function LAMEmiscSourceSampleFrequencyLookup($SourceSampleFrequencyID) { + static $LAMEmiscSourceSampleFrequencyLookup = array( + 0 => '<= 32 kHz', + 1 => '44.1 kHz', + 2 => '48 kHz', + 3 => '> 48kHz' + ); + return (isset($LAMEmiscSourceSampleFrequencyLookup[$SourceSampleFrequencyID]) ? $LAMEmiscSourceSampleFrequencyLookup[$SourceSampleFrequencyID] : ''); + } + + public static function LAMEsurroundInfoLookup($SurroundInfoID) { + static $LAMEsurroundInfoLookup = array( + 0 => 'no surround info', + 1 => 'DPL encoding', + 2 => 'DPL2 encoding', + 3 => 'Ambisonic encoding' + ); + return (isset($LAMEsurroundInfoLookup[$SurroundInfoID]) ? $LAMEsurroundInfoLookup[$SurroundInfoID] : 'reserved'); + } + + public static function LAMEpresetUsedLookup($LAMEtag) { + + if ($LAMEtag['preset_used_id'] == 0) { + // no preset used (LAME >=3.93) + // no preset recorded (LAME <3.93) + return ''; + } + $LAMEpresetUsedLookup = array(); + + ///// THIS PART CANNOT BE STATIC . + for ($i = 8; $i <= 320; $i++) { + switch ($LAMEtag['vbr_method']) { + case 'cbr': + $LAMEpresetUsedLookup[$i] = '--alt-preset '.$LAMEtag['vbr_method'].' '.$i; + break; + case 'abr': + default: // other VBR modes shouldn't be here(?) + $LAMEpresetUsedLookup[$i] = '--alt-preset '.$i; + break; + } + } + + // named old-style presets (studio, phone, voice, etc) are handled in GuessEncoderOptions() + + // named alt-presets + $LAMEpresetUsedLookup[1000] = '--r3mix'; + $LAMEpresetUsedLookup[1001] = '--alt-preset standard'; + $LAMEpresetUsedLookup[1002] = '--alt-preset extreme'; + $LAMEpresetUsedLookup[1003] = '--alt-preset insane'; + $LAMEpresetUsedLookup[1004] = '--alt-preset fast standard'; + $LAMEpresetUsedLookup[1005] = '--alt-preset fast extreme'; + $LAMEpresetUsedLookup[1006] = '--alt-preset medium'; + $LAMEpresetUsedLookup[1007] = '--alt-preset fast medium'; + + // LAME 3.94 additions/changes + $LAMEpresetUsedLookup[1010] = '--preset portable'; // 3.94a15 Oct 21 2003 + $LAMEpresetUsedLookup[1015] = '--preset radio'; // 3.94a15 Oct 21 2003 + + $LAMEpresetUsedLookup[320] = '--preset insane'; // 3.94a15 Nov 12 2003 + $LAMEpresetUsedLookup[410] = '-V9'; + $LAMEpresetUsedLookup[420] = '-V8'; + $LAMEpresetUsedLookup[440] = '-V6'; + $LAMEpresetUsedLookup[430] = '--preset radio'; // 3.94a15 Nov 12 2003 + $LAMEpresetUsedLookup[450] = '--preset '.(($LAMEtag['raw']['vbr_method'] == 4) ? 'fast ' : '').'portable'; // 3.94a15 Nov 12 2003 + $LAMEpresetUsedLookup[460] = '--preset '.(($LAMEtag['raw']['vbr_method'] == 4) ? 'fast ' : '').'medium'; // 3.94a15 Nov 12 2003 + $LAMEpresetUsedLookup[470] = '--r3mix'; // 3.94b1 Dec 18 2003 + $LAMEpresetUsedLookup[480] = '--preset '.(($LAMEtag['raw']['vbr_method'] == 4) ? 'fast ' : '').'standard'; // 3.94a15 Nov 12 2003 + $LAMEpresetUsedLookup[490] = '-V1'; + $LAMEpresetUsedLookup[500] = '--preset '.(($LAMEtag['raw']['vbr_method'] == 4) ? 'fast ' : '').'extreme'; // 3.94a15 Nov 12 2003 + + return (isset($LAMEpresetUsedLookup[$LAMEtag['preset_used_id']]) ? $LAMEpresetUsedLookup[$LAMEtag['preset_used_id']] : 'new/unknown preset: '.$LAMEtag['preset_used_id'].' - report to info@getid3.org'); + } + +} diff --git a/www/rompr/getid3/module.audio.mpc.php b/www/rompr/getid3/module.audio.mpc.php new file mode 100644 index 0000000..14e829d --- /dev/null +++ b/www/rompr/getid3/module.audio.mpc.php @@ -0,0 +1,507 @@ + // +// available at http://getid3.sourceforge.net // +// or http://www.getid3.org // +// also https://github.com/JamesHeinrich/getID3 // +///////////////////////////////////////////////////////////////// +// See readme.txt for more details // +///////////////////////////////////////////////////////////////// +// // +// module.audio.mpc.php // +// module for analyzing Musepack/MPEG+ Audio files // +// dependencies: NONE // +// /// +///////////////////////////////////////////////////////////////// + + +class getid3_mpc extends getid3_handler +{ + + public function Analyze() { + $info = &$this->getid3->info; + + $info['mpc']['header'] = array(); + $thisfile_mpc_header = &$info['mpc']['header']; + + $info['fileformat'] = 'mpc'; + $info['audio']['dataformat'] = 'mpc'; + $info['audio']['bitrate_mode'] = 'vbr'; + $info['audio']['channels'] = 2; // up to SV7 the format appears to have been hardcoded for stereo only + $info['audio']['lossless'] = false; + + $this->fseek($info['avdataoffset']); + $MPCheaderData = $this->fread(4); + $info['mpc']['header']['preamble'] = substr($MPCheaderData, 0, 4); // should be 'MPCK' (SV8) or 'MP+' (SV7), otherwise possible stream data (SV4-SV6) + if (preg_match('#^MPCK#', $info['mpc']['header']['preamble'])) { + + // this is SV8 + return $this->ParseMPCsv8(); + + } elseif (preg_match('#^MP\+#', $info['mpc']['header']['preamble'])) { + + // this is SV7 + return $this->ParseMPCsv7(); + + } elseif (preg_match('/^[\x00\x01\x10\x11\x40\x41\x50\x51\x80\x81\x90\x91\xC0\xC1\xD0\xD1][\x20-37][\x00\x20\x40\x60\x80\xA0\xC0\xE0]/s', $MPCheaderData)) { + + // this is SV4 - SV6, handle seperately + return $this->ParseMPCsv6(); + + } else { + + $this->error('Expecting "MP+" or "MPCK" at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes(substr($MPCheaderData, 0, 4)).'"'); + unset($info['fileformat']); + unset($info['mpc']); + return false; + + } + return false; + } + + + public function ParseMPCsv8() { + // this is SV8 + // http://trac.musepack.net/trac/wiki/SV8Specification + + $info = &$this->getid3->info; + $thisfile_mpc_header = &$info['mpc']['header']; + + $keyNameSize = 2; + $maxHandledPacketLength = 9; // specs say: "n*8; 0 < n < 10" + + $offset = $this->ftell(); + while ($offset < $info['avdataend']) { + $thisPacket = array(); + $thisPacket['offset'] = $offset; + $packet_offset = 0; + + // Size is a variable-size field, could be 1-4 bytes (possibly more?) + // read enough data in and figure out the exact size later + $MPCheaderData = $this->fread($keyNameSize + $maxHandledPacketLength); + $packet_offset += $keyNameSize; + $thisPacket['key'] = substr($MPCheaderData, 0, $keyNameSize); + $thisPacket['key_name'] = $this->MPCsv8PacketName($thisPacket['key']); + if ($thisPacket['key'] == $thisPacket['key_name']) { + $this->error('Found unexpected key value "'.$thisPacket['key'].'" at offset '.$thisPacket['offset']); + return false; + } + $packetLength = 0; + $thisPacket['packet_size'] = $this->SV8variableLengthInteger(substr($MPCheaderData, $keyNameSize), $packetLength); // includes keyname and packet_size field + if ($thisPacket['packet_size'] === false) { + $this->error('Did not find expected packet length within '.$maxHandledPacketLength.' bytes at offset '.($thisPacket['offset'] + $keyNameSize)); + return false; + } + $packet_offset += $packetLength; + $offset += $thisPacket['packet_size']; + + switch ($thisPacket['key']) { + case 'SH': // Stream Header + $moreBytesToRead = $thisPacket['packet_size'] - $keyNameSize - $maxHandledPacketLength; + if ($moreBytesToRead > 0) { + $MPCheaderData .= $this->fread($moreBytesToRead); + } + $thisPacket['crc'] = getid3_lib::BigEndian2Int(substr($MPCheaderData, $packet_offset, 4)); + $packet_offset += 4; + $thisPacket['stream_version'] = getid3_lib::BigEndian2Int(substr($MPCheaderData, $packet_offset, 1)); + $packet_offset += 1; + + $packetLength = 0; + $thisPacket['sample_count'] = $this->SV8variableLengthInteger(substr($MPCheaderData, $packet_offset, $maxHandledPacketLength), $packetLength); + $packet_offset += $packetLength; + + $packetLength = 0; + $thisPacket['beginning_silence'] = $this->SV8variableLengthInteger(substr($MPCheaderData, $packet_offset, $maxHandledPacketLength), $packetLength); + $packet_offset += $packetLength; + + $otherUsefulData = getid3_lib::BigEndian2Int(substr($MPCheaderData, $packet_offset, 2)); + $packet_offset += 2; + $thisPacket['sample_frequency_raw'] = (($otherUsefulData & 0xE000) >> 13); + $thisPacket['max_bands_used'] = (($otherUsefulData & 0x1F00) >> 8); + $thisPacket['channels'] = (($otherUsefulData & 0x00F0) >> 4) + 1; + $thisPacket['ms_used'] = (bool) (($otherUsefulData & 0x0008) >> 3); + $thisPacket['audio_block_frames'] = (($otherUsefulData & 0x0007) >> 0); + $thisPacket['sample_frequency'] = $this->MPCfrequencyLookup($thisPacket['sample_frequency_raw']); + + $thisfile_mpc_header['mid_side_stereo'] = $thisPacket['ms_used']; + $thisfile_mpc_header['sample_rate'] = $thisPacket['sample_frequency']; + $thisfile_mpc_header['samples'] = $thisPacket['sample_count']; + $thisfile_mpc_header['stream_version_major'] = $thisPacket['stream_version']; + + $info['audio']['channels'] = $thisPacket['channels']; + $info['audio']['sample_rate'] = $thisPacket['sample_frequency']; + $info['playtime_seconds'] = $thisPacket['sample_count'] / $thisPacket['sample_frequency']; + $info['audio']['bitrate'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / $info['playtime_seconds']; + break; + + case 'RG': // Replay Gain + $moreBytesToRead = $thisPacket['packet_size'] - $keyNameSize - $maxHandledPacketLength; + if ($moreBytesToRead > 0) { + $MPCheaderData .= $this->fread($moreBytesToRead); + } + $thisPacket['replaygain_version'] = getid3_lib::BigEndian2Int(substr($MPCheaderData, $packet_offset, 1)); + $packet_offset += 1; + $thisPacket['replaygain_title_gain'] = getid3_lib::BigEndian2Int(substr($MPCheaderData, $packet_offset, 2)); + $packet_offset += 2; + $thisPacket['replaygain_title_peak'] = getid3_lib::BigEndian2Int(substr($MPCheaderData, $packet_offset, 2)); + $packet_offset += 2; + $thisPacket['replaygain_album_gain'] = getid3_lib::BigEndian2Int(substr($MPCheaderData, $packet_offset, 2)); + $packet_offset += 2; + $thisPacket['replaygain_album_peak'] = getid3_lib::BigEndian2Int(substr($MPCheaderData, $packet_offset, 2)); + $packet_offset += 2; + + if ($thisPacket['replaygain_title_gain']) { $info['replay_gain']['title']['gain'] = $thisPacket['replaygain_title_gain']; } + if ($thisPacket['replaygain_title_peak']) { $info['replay_gain']['title']['peak'] = $thisPacket['replaygain_title_peak']; } + if ($thisPacket['replaygain_album_gain']) { $info['replay_gain']['album']['gain'] = $thisPacket['replaygain_album_gain']; } + if ($thisPacket['replaygain_album_peak']) { $info['replay_gain']['album']['peak'] = $thisPacket['replaygain_album_peak']; } + break; + + case 'EI': // Encoder Info + $moreBytesToRead = $thisPacket['packet_size'] - $keyNameSize - $maxHandledPacketLength; + if ($moreBytesToRead > 0) { + $MPCheaderData .= $this->fread($moreBytesToRead); + } + $profile_pns = getid3_lib::BigEndian2Int(substr($MPCheaderData, $packet_offset, 1)); + $packet_offset += 1; + $quality_int = (($profile_pns & 0xF0) >> 4); + $quality_dec = (($profile_pns & 0x0E) >> 3); + $thisPacket['quality'] = (float) $quality_int + ($quality_dec / 8); + $thisPacket['pns_tool'] = (bool) (($profile_pns & 0x01) >> 0); + $thisPacket['version_major'] = getid3_lib::BigEndian2Int(substr($MPCheaderData, $packet_offset, 1)); + $packet_offset += 1; + $thisPacket['version_minor'] = getid3_lib::BigEndian2Int(substr($MPCheaderData, $packet_offset, 1)); + $packet_offset += 1; + $thisPacket['version_build'] = getid3_lib::BigEndian2Int(substr($MPCheaderData, $packet_offset, 1)); + $packet_offset += 1; + $thisPacket['version'] = $thisPacket['version_major'].'.'.$thisPacket['version_minor'].'.'.$thisPacket['version_build']; + + $info['audio']['encoder'] = 'MPC v'.$thisPacket['version'].' ('.(($thisPacket['version_minor'] % 2) ? 'unstable' : 'stable').')'; + $thisfile_mpc_header['encoder_version'] = $info['audio']['encoder']; + //$thisfile_mpc_header['quality'] = (float) ($thisPacket['quality'] / 1.5875); // values can range from 0.000 to 15.875, mapped to qualities of 0.0 to 10.0 + $thisfile_mpc_header['quality'] = (float) ($thisPacket['quality'] - 5); // values can range from 0.000 to 15.875, of which 0..4 are "reserved/experimental", and 5..15 are mapped to qualities of 0.0 to 10.0 + break; + + case 'SO': // Seek Table Offset + $packetLength = 0; + $thisPacket['seek_table_offset'] = $thisPacket['offset'] + $this->SV8variableLengthInteger(substr($MPCheaderData, $packet_offset, $maxHandledPacketLength), $packetLength); + $packet_offset += $packetLength; + break; + + case 'ST': // Seek Table + case 'SE': // Stream End + case 'AP': // Audio Data + // nothing useful here, just skip this packet + $thisPacket = array(); + break; + + default: + $this->error('Found unhandled key type "'.$thisPacket['key'].'" at offset '.$thisPacket['offset']); + return false; + break; + } + if (!empty($thisPacket)) { + $info['mpc']['packets'][] = $thisPacket; + } + $this->fseek($offset); + } + $thisfile_mpc_header['size'] = $offset; + return true; + } + + public function ParseMPCsv7() { + // this is SV7 + // http://www.uni-jena.de/~pfk/mpp/sv8/header.html + + $info = &$this->getid3->info; + $thisfile_mpc_header = &$info['mpc']['header']; + $offset = 0; + + $thisfile_mpc_header['size'] = 28; + $MPCheaderData = $info['mpc']['header']['preamble']; + $MPCheaderData .= $this->fread($thisfile_mpc_header['size'] - strlen($info['mpc']['header']['preamble'])); + $offset = strlen('MP+'); + + $StreamVersionByte = getid3_lib::LittleEndian2Int(substr($MPCheaderData, $offset, 1)); + $offset += 1; + $thisfile_mpc_header['stream_version_major'] = ($StreamVersionByte & 0x0F) >> 0; + $thisfile_mpc_header['stream_version_minor'] = ($StreamVersionByte & 0xF0) >> 4; // should always be 0, subversions no longer exist in SV8 + $thisfile_mpc_header['frame_count'] = getid3_lib::LittleEndian2Int(substr($MPCheaderData, $offset, 4)); + $offset += 4; + + if ($thisfile_mpc_header['stream_version_major'] != 7) { + $this->error('Only Musepack SV7 supported (this file claims to be v'.$thisfile_mpc_header['stream_version_major'].')'); + return false; + } + + $FlagsDWORD1 = getid3_lib::LittleEndian2Int(substr($MPCheaderData, $offset, 4)); + $offset += 4; + $thisfile_mpc_header['intensity_stereo'] = (bool) (($FlagsDWORD1 & 0x80000000) >> 31); + $thisfile_mpc_header['mid_side_stereo'] = (bool) (($FlagsDWORD1 & 0x40000000) >> 30); + $thisfile_mpc_header['max_subband'] = ($FlagsDWORD1 & 0x3F000000) >> 24; + $thisfile_mpc_header['raw']['profile'] = ($FlagsDWORD1 & 0x00F00000) >> 20; + $thisfile_mpc_header['begin_loud'] = (bool) (($FlagsDWORD1 & 0x00080000) >> 19); + $thisfile_mpc_header['end_loud'] = (bool) (($FlagsDWORD1 & 0x00040000) >> 18); + $thisfile_mpc_header['raw']['sample_rate'] = ($FlagsDWORD1 & 0x00030000) >> 16; + $thisfile_mpc_header['max_level'] = ($FlagsDWORD1 & 0x0000FFFF); + + $thisfile_mpc_header['raw']['title_peak'] = getid3_lib::LittleEndian2Int(substr($MPCheaderData, $offset, 2)); + $offset += 2; + $thisfile_mpc_header['raw']['title_gain'] = getid3_lib::LittleEndian2Int(substr($MPCheaderData, $offset, 2), true); + $offset += 2; + + $thisfile_mpc_header['raw']['album_peak'] = getid3_lib::LittleEndian2Int(substr($MPCheaderData, $offset, 2)); + $offset += 2; + $thisfile_mpc_header['raw']['album_gain'] = getid3_lib::LittleEndian2Int(substr($MPCheaderData, $offset, 2), true); + $offset += 2; + + $FlagsDWORD2 = getid3_lib::LittleEndian2Int(substr($MPCheaderData, $offset, 4)); + $offset += 4; + $thisfile_mpc_header['true_gapless'] = (bool) (($FlagsDWORD2 & 0x80000000) >> 31); + $thisfile_mpc_header['last_frame_length'] = ($FlagsDWORD2 & 0x7FF00000) >> 20; + + + $thisfile_mpc_header['raw']['not_sure_what'] = getid3_lib::LittleEndian2Int(substr($MPCheaderData, $offset, 3)); + $offset += 3; + $thisfile_mpc_header['raw']['encoder_version'] = getid3_lib::LittleEndian2Int(substr($MPCheaderData, $offset, 1)); + $offset += 1; + + $thisfile_mpc_header['profile'] = $this->MPCprofileNameLookup($thisfile_mpc_header['raw']['profile']); + $thisfile_mpc_header['sample_rate'] = $this->MPCfrequencyLookup($thisfile_mpc_header['raw']['sample_rate']); + if ($thisfile_mpc_header['sample_rate'] == 0) { + $this->error('Corrupt MPC file: frequency == zero'); + return false; + } + $info['audio']['sample_rate'] = $thisfile_mpc_header['sample_rate']; + $thisfile_mpc_header['samples'] = ((($thisfile_mpc_header['frame_count'] - 1) * 1152) + $thisfile_mpc_header['last_frame_length']) * $info['audio']['channels']; + + $info['playtime_seconds'] = ($thisfile_mpc_header['samples'] / $info['audio']['channels']) / $info['audio']['sample_rate']; + if ($info['playtime_seconds'] == 0) { + $this->error('Corrupt MPC file: playtime_seconds == zero'); + return false; + } + + // add size of file header to avdataoffset - calc bitrate correctly + MD5 data + $info['avdataoffset'] += $thisfile_mpc_header['size']; + + $info['audio']['bitrate'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / $info['playtime_seconds']; + + $thisfile_mpc_header['title_peak'] = $thisfile_mpc_header['raw']['title_peak']; + $thisfile_mpc_header['title_peak_db'] = $this->MPCpeakDBLookup($thisfile_mpc_header['title_peak']); + if ($thisfile_mpc_header['raw']['title_gain'] < 0) { + $thisfile_mpc_header['title_gain_db'] = (float) (32768 + $thisfile_mpc_header['raw']['title_gain']) / -100; + } else { + $thisfile_mpc_header['title_gain_db'] = (float) $thisfile_mpc_header['raw']['title_gain'] / 100; + } + + $thisfile_mpc_header['album_peak'] = $thisfile_mpc_header['raw']['album_peak']; + $thisfile_mpc_header['album_peak_db'] = $this->MPCpeakDBLookup($thisfile_mpc_header['album_peak']); + if ($thisfile_mpc_header['raw']['album_gain'] < 0) { + $thisfile_mpc_header['album_gain_db'] = (float) (32768 + $thisfile_mpc_header['raw']['album_gain']) / -100; + } else { + $thisfile_mpc_header['album_gain_db'] = (float) $thisfile_mpc_header['raw']['album_gain'] / 100;; + } + $thisfile_mpc_header['encoder_version'] = $this->MPCencoderVersionLookup($thisfile_mpc_header['raw']['encoder_version']); + + $info['replay_gain']['track']['adjustment'] = $thisfile_mpc_header['title_gain_db']; + $info['replay_gain']['album']['adjustment'] = $thisfile_mpc_header['album_gain_db']; + + if ($thisfile_mpc_header['title_peak'] > 0) { + $info['replay_gain']['track']['peak'] = $thisfile_mpc_header['title_peak']; + } elseif (round($thisfile_mpc_header['max_level'] * 1.18) > 0) { + $info['replay_gain']['track']['peak'] = getid3_lib::CastAsInt(round($thisfile_mpc_header['max_level'] * 1.18)); // why? I don't know - see mppdec.c + } + if ($thisfile_mpc_header['album_peak'] > 0) { + $info['replay_gain']['album']['peak'] = $thisfile_mpc_header['album_peak']; + } + + //$info['audio']['encoder'] = 'SV'.$thisfile_mpc_header['stream_version_major'].'.'.$thisfile_mpc_header['stream_version_minor'].', '.$thisfile_mpc_header['encoder_version']; + $info['audio']['encoder'] = $thisfile_mpc_header['encoder_version']; + $info['audio']['encoder_options'] = $thisfile_mpc_header['profile']; + $thisfile_mpc_header['quality'] = (float) ($thisfile_mpc_header['raw']['profile'] - 5); // values can range from 0 to 15, of which 0..4 are "reserved/experimental", and 5..15 are mapped to qualities of 0.0 to 10.0 + + return true; + } + + public function ParseMPCsv6() { + // this is SV4 - SV6 + + $info = &$this->getid3->info; + $thisfile_mpc_header = &$info['mpc']['header']; + $offset = 0; + + $thisfile_mpc_header['size'] = 8; + $this->fseek($info['avdataoffset']); + $MPCheaderData = $this->fread($thisfile_mpc_header['size']); + + // add size of file header to avdataoffset - calc bitrate correctly + MD5 data + $info['avdataoffset'] += $thisfile_mpc_header['size']; + + // Most of this code adapted from Jurgen Faul's MPEGplus source code - thanks Jurgen! :) + $HeaderDWORD[0] = getid3_lib::LittleEndian2Int(substr($MPCheaderData, 0, 4)); + $HeaderDWORD[1] = getid3_lib::LittleEndian2Int(substr($MPCheaderData, 4, 4)); + + + // DDDD DDDD CCCC CCCC BBBB BBBB AAAA AAAA + // aaaa aaaa abcd dddd dddd deee eeff ffff + // + // a = bitrate = anything + // b = IS = anything + // c = MS = anything + // d = streamversion = 0000000004 or 0000000005 or 0000000006 + // e = maxband = anything + // f = blocksize = 000001 for SV5+, anything(?) for SV4 + + $thisfile_mpc_header['target_bitrate'] = (($HeaderDWORD[0] & 0xFF800000) >> 23); + $thisfile_mpc_header['intensity_stereo'] = (bool) (($HeaderDWORD[0] & 0x00400000) >> 22); + $thisfile_mpc_header['mid_side_stereo'] = (bool) (($HeaderDWORD[0] & 0x00200000) >> 21); + $thisfile_mpc_header['stream_version_major'] = ($HeaderDWORD[0] & 0x001FF800) >> 11; + $thisfile_mpc_header['stream_version_minor'] = 0; // no sub-version numbers before SV7 + $thisfile_mpc_header['max_band'] = ($HeaderDWORD[0] & 0x000007C0) >> 6; // related to lowpass frequency, not sure how it translates exactly + $thisfile_mpc_header['block_size'] = ($HeaderDWORD[0] & 0x0000003F); + + switch ($thisfile_mpc_header['stream_version_major']) { + case 4: + $thisfile_mpc_header['frame_count'] = ($HeaderDWORD[1] >> 16); + break; + + case 5: + case 6: + $thisfile_mpc_header['frame_count'] = $HeaderDWORD[1]; + break; + + default: + $info['error'] = 'Expecting 4, 5 or 6 in version field, found '.$thisfile_mpc_header['stream_version_major'].' instead'; + unset($info['mpc']); + return false; + break; + } + + if (($thisfile_mpc_header['stream_version_major'] > 4) && ($thisfile_mpc_header['block_size'] != 1)) { + $this->warning('Block size expected to be 1, actual value found: '.$thisfile_mpc_header['block_size']); + } + + $thisfile_mpc_header['sample_rate'] = 44100; // AB: used by all files up to SV7 + $info['audio']['sample_rate'] = $thisfile_mpc_header['sample_rate']; + $thisfile_mpc_header['samples'] = $thisfile_mpc_header['frame_count'] * 1152 * $info['audio']['channels']; + + if ($thisfile_mpc_header['target_bitrate'] == 0) { + $info['audio']['bitrate_mode'] = 'vbr'; + } else { + $info['audio']['bitrate_mode'] = 'cbr'; + } + + $info['mpc']['bitrate'] = ($info['avdataend'] - $info['avdataoffset']) * 8 * 44100 / $thisfile_mpc_header['frame_count'] / 1152; + $info['audio']['bitrate'] = $info['mpc']['bitrate']; + $info['audio']['encoder'] = 'SV'.$thisfile_mpc_header['stream_version_major']; + + return true; + } + + + public function MPCprofileNameLookup($profileid) { + static $MPCprofileNameLookup = array( + 0 => 'no profile', + 1 => 'Experimental', + 2 => 'unused', + 3 => 'unused', + 4 => 'unused', + 5 => 'below Telephone (q = 0.0)', + 6 => 'below Telephone (q = 1.0)', + 7 => 'Telephone (q = 2.0)', + 8 => 'Thumb (q = 3.0)', + 9 => 'Radio (q = 4.0)', + 10 => 'Standard (q = 5.0)', + 11 => 'Extreme (q = 6.0)', + 12 => 'Insane (q = 7.0)', + 13 => 'BrainDead (q = 8.0)', + 14 => 'above BrainDead (q = 9.0)', + 15 => 'above BrainDead (q = 10.0)' + ); + return (isset($MPCprofileNameLookup[$profileid]) ? $MPCprofileNameLookup[$profileid] : 'invalid'); + } + + public function MPCfrequencyLookup($frequencyid) { + static $MPCfrequencyLookup = array( + 0 => 44100, + 1 => 48000, + 2 => 37800, + 3 => 32000 + ); + return (isset($MPCfrequencyLookup[$frequencyid]) ? $MPCfrequencyLookup[$frequencyid] : 'invalid'); + } + + public function MPCpeakDBLookup($intvalue) { + if ($intvalue > 0) { + return ((log10($intvalue) / log10(2)) - 15) * 6; + } + return false; + } + + public function MPCencoderVersionLookup($encoderversion) { + //Encoder version * 100 (106 = 1.06) + //EncoderVersion % 10 == 0 Release (1.0) + //EncoderVersion % 2 == 0 Beta (1.06) + //EncoderVersion % 2 == 1 Alpha (1.05a...z) + + if ($encoderversion == 0) { + // very old version, not known exactly which + return 'Buschmann v1.7.0-v1.7.9 or Klemm v0.90-v1.05'; + } + + if (($encoderversion % 10) == 0) { + + // release version + return number_format($encoderversion / 100, 2); + + } elseif (($encoderversion % 2) == 0) { + + // beta version + return number_format($encoderversion / 100, 2).' beta'; + + } + + // alpha version + return number_format($encoderversion / 100, 2).' alpha'; + } + + public function SV8variableLengthInteger($data, &$packetLength, $maxHandledPacketLength=9) { + $packet_size = 0; + for ($packetLength = 1; $packetLength <= $maxHandledPacketLength; $packetLength++) { + // variable-length size field: + // bits, big-endian + // 0xxx xxxx - value 0 to 2^7-1 + // 1xxx xxxx 0xxx xxxx - value 0 to 2^14-1 + // 1xxx xxxx 1xxx xxxx 0xxx xxxx - value 0 to 2^21-1 + // 1xxx xxxx 1xxx xxxx 1xxx xxxx 0xxx xxxx - value 0 to 2^28-1 + // ... + $thisbyte = ord(substr($data, ($packetLength - 1), 1)); + // look through bytes until find a byte with MSB==0 + $packet_size = ($packet_size << 7); + $packet_size = ($packet_size | ($thisbyte & 0x7F)); + if (($thisbyte & 0x80) === 0) { + break; + } + if ($packetLength >= $maxHandledPacketLength) { + return false; + } + } + return $packet_size; + } + + public function MPCsv8PacketName($packetKey) { + static $MPCsv8PacketName = array(); + if (empty($MPCsv8PacketName)) { + $MPCsv8PacketName = array( + 'AP' => 'Audio Packet', + 'CT' => 'Chapter Tag', + 'EI' => 'Encoder Info', + 'RG' => 'Replay Gain', + 'SE' => 'Stream End', + 'SH' => 'Stream Header', + 'SO' => 'Seek Table Offset', + 'ST' => 'Seek Table', + ); + } + return (isset($MPCsv8PacketName[$packetKey]) ? $MPCsv8PacketName[$packetKey] : $packetKey); + } +} diff --git a/www/rompr/getid3/module.audio.ogg.php b/www/rompr/getid3/module.audio.ogg.php new file mode 100644 index 0000000..e41c96c --- /dev/null +++ b/www/rompr/getid3/module.audio.ogg.php @@ -0,0 +1,840 @@ + // +// available at http://getid3.sourceforge.net // +// or http://www.getid3.org // +// also https://github.com/JamesHeinrich/getID3 // +///////////////////////////////////////////////////////////////// +// See readme.txt for more details // +///////////////////////////////////////////////////////////////// +// // +// module.audio.ogg.php // +// module for analyzing Ogg Vorbis, OggFLAC and Speex files // +// dependencies: module.audio.flac.php // +// /// +///////////////////////////////////////////////////////////////// + +getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio.flac.php', __FILE__, true); + +class getid3_ogg extends getid3_handler +{ + // http://xiph.org/vorbis/doc/Vorbis_I_spec.html + public function Analyze() { + $info = &$this->getid3->info; + + $info['fileformat'] = 'ogg'; + + // Warn about illegal tags - only vorbiscomments are allowed + if (isset($info['id3v2'])) { + $this->warning('Illegal ID3v2 tag present.'); + } + if (isset($info['id3v1'])) { + $this->warning('Illegal ID3v1 tag present.'); + } + if (isset($info['ape'])) { + $this->warning('Illegal APE tag present.'); + } + + + // Page 1 - Stream Header + + $this->fseek($info['avdataoffset']); + + $oggpageinfo = $this->ParseOggPageHeader(); + $info['ogg']['pageheader'][$oggpageinfo['page_seqno']] = $oggpageinfo; + + if ($this->ftell() >= $this->getid3->fread_buffer_size()) { + $this->error('Could not find start of Ogg page in the first '.$this->getid3->fread_buffer_size().' bytes (this might not be an Ogg-Vorbis file?)'); + unset($info['fileformat']); + unset($info['ogg']); + return false; + } + + $filedata = $this->fread($oggpageinfo['page_length']); + $filedataoffset = 0; + + if (substr($filedata, 0, 4) == 'fLaC') { + + $info['audio']['dataformat'] = 'flac'; + $info['audio']['bitrate_mode'] = 'vbr'; + $info['audio']['lossless'] = true; + + } elseif (substr($filedata, 1, 6) == 'vorbis') { + + $this->ParseVorbisPageHeader($filedata, $filedataoffset, $oggpageinfo); + + } elseif (substr($filedata, 0, 8) == 'OpusHead') { + + if( $this->ParseOpusPageHeader($filedata, $filedataoffset, $oggpageinfo) == false ) { + return false; + } + + } elseif (substr($filedata, 0, 8) == 'Speex ') { + + // http://www.speex.org/manual/node10.html + + $info['audio']['dataformat'] = 'speex'; + $info['mime_type'] = 'audio/speex'; + $info['audio']['bitrate_mode'] = 'abr'; + $info['audio']['lossless'] = false; + + $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['speex_string'] = substr($filedata, $filedataoffset, 8); // hard-coded to 'Speex ' + $filedataoffset += 8; + $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['speex_version'] = substr($filedata, $filedataoffset, 20); + $filedataoffset += 20; + $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['speex_version_id'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); + $filedataoffset += 4; + $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['header_size'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); + $filedataoffset += 4; + $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['rate'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); + $filedataoffset += 4; + $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['mode'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); + $filedataoffset += 4; + $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['mode_bitstream_version'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); + $filedataoffset += 4; + $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['nb_channels'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); + $filedataoffset += 4; + $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['bitrate'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); + $filedataoffset += 4; + $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['framesize'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); + $filedataoffset += 4; + $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['vbr'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); + $filedataoffset += 4; + $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['frames_per_packet'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); + $filedataoffset += 4; + $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['extra_headers'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); + $filedataoffset += 4; + $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['reserved1'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); + $filedataoffset += 4; + $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['reserved2'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); + $filedataoffset += 4; + + $info['speex']['speex_version'] = trim($info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['speex_version']); + $info['speex']['sample_rate'] = $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['rate']; + $info['speex']['channels'] = $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['nb_channels']; + $info['speex']['vbr'] = (bool) $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['vbr']; + $info['speex']['band_type'] = $this->SpeexBandModeLookup($info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['mode']); + + $info['audio']['sample_rate'] = $info['speex']['sample_rate']; + $info['audio']['channels'] = $info['speex']['channels']; + if ($info['speex']['vbr']) { + $info['audio']['bitrate_mode'] = 'vbr'; + } + + } elseif (substr($filedata, 0, 7) == "\x80".'theora') { + + // http://www.theora.org/doc/Theora.pdf (section 6.2) + + $info['ogg']['pageheader']['theora']['theora_magic'] = substr($filedata, $filedataoffset, 7); // hard-coded to "\x80.'theora' + $filedataoffset += 7; + $info['ogg']['pageheader']['theora']['version_major'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 1)); + $filedataoffset += 1; + $info['ogg']['pageheader']['theora']['version_minor'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 1)); + $filedataoffset += 1; + $info['ogg']['pageheader']['theora']['version_revision'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 1)); + $filedataoffset += 1; + $info['ogg']['pageheader']['theora']['frame_width_macroblocks'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 2)); + $filedataoffset += 2; + $info['ogg']['pageheader']['theora']['frame_height_macroblocks'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 2)); + $filedataoffset += 2; + $info['ogg']['pageheader']['theora']['resolution_x'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 3)); + $filedataoffset += 3; + $info['ogg']['pageheader']['theora']['resolution_y'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 3)); + $filedataoffset += 3; + $info['ogg']['pageheader']['theora']['picture_offset_x'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 1)); + $filedataoffset += 1; + $info['ogg']['pageheader']['theora']['picture_offset_y'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 1)); + $filedataoffset += 1; + $info['ogg']['pageheader']['theora']['frame_rate_numerator'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 4)); + $filedataoffset += 4; + $info['ogg']['pageheader']['theora']['frame_rate_denominator'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 4)); + $filedataoffset += 4; + $info['ogg']['pageheader']['theora']['pixel_aspect_numerator'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 3)); + $filedataoffset += 3; + $info['ogg']['pageheader']['theora']['pixel_aspect_denominator'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 3)); + $filedataoffset += 3; + $info['ogg']['pageheader']['theora']['color_space_id'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 1)); + $filedataoffset += 1; + $info['ogg']['pageheader']['theora']['nominal_bitrate'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 3)); + $filedataoffset += 3; + $info['ogg']['pageheader']['theora']['flags'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 2)); + $filedataoffset += 2; + + $info['ogg']['pageheader']['theora']['quality'] = ($info['ogg']['pageheader']['theora']['flags'] & 0xFC00) >> 10; + $info['ogg']['pageheader']['theora']['kfg_shift'] = ($info['ogg']['pageheader']['theora']['flags'] & 0x03E0) >> 5; + $info['ogg']['pageheader']['theora']['pixel_format_id'] = ($info['ogg']['pageheader']['theora']['flags'] & 0x0018) >> 3; + $info['ogg']['pageheader']['theora']['reserved'] = ($info['ogg']['pageheader']['theora']['flags'] & 0x0007) >> 0; // should be 0 + $info['ogg']['pageheader']['theora']['color_space'] = self::TheoraColorSpace($info['ogg']['pageheader']['theora']['color_space_id']); + $info['ogg']['pageheader']['theora']['pixel_format'] = self::TheoraPixelFormat($info['ogg']['pageheader']['theora']['pixel_format_id']); + + $info['video']['dataformat'] = 'theora'; + $info['mime_type'] = 'video/ogg'; + //$info['audio']['bitrate_mode'] = 'abr'; + //$info['audio']['lossless'] = false; + $info['video']['resolution_x'] = $info['ogg']['pageheader']['theora']['resolution_x']; + $info['video']['resolution_y'] = $info['ogg']['pageheader']['theora']['resolution_y']; + if ($info['ogg']['pageheader']['theora']['frame_rate_denominator'] > 0) { + $info['video']['frame_rate'] = (float) $info['ogg']['pageheader']['theora']['frame_rate_numerator'] / $info['ogg']['pageheader']['theora']['frame_rate_denominator']; + } + if ($info['ogg']['pageheader']['theora']['pixel_aspect_denominator'] > 0) { + $info['video']['pixel_aspect_ratio'] = (float) $info['ogg']['pageheader']['theora']['pixel_aspect_numerator'] / $info['ogg']['pageheader']['theora']['pixel_aspect_denominator']; + } +$this->warning('Ogg Theora (v3) not fully supported in this version of getID3 ['.$this->getid3->version().'] -- bitrate, playtime and all audio data are currently unavailable'); + + + } elseif (substr($filedata, 0, 8) == "fishead\x00") { + + // Ogg Skeleton version 3.0 Format Specification + // http://xiph.org/ogg/doc/skeleton.html + $filedataoffset += 8; + $info['ogg']['skeleton']['fishead']['raw']['version_major'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 2)); + $filedataoffset += 2; + $info['ogg']['skeleton']['fishead']['raw']['version_minor'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 2)); + $filedataoffset += 2; + $info['ogg']['skeleton']['fishead']['raw']['presentationtime_numerator'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 8)); + $filedataoffset += 8; + $info['ogg']['skeleton']['fishead']['raw']['presentationtime_denominator'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 8)); + $filedataoffset += 8; + $info['ogg']['skeleton']['fishead']['raw']['basetime_numerator'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 8)); + $filedataoffset += 8; + $info['ogg']['skeleton']['fishead']['raw']['basetime_denominator'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 8)); + $filedataoffset += 8; + $info['ogg']['skeleton']['fishead']['raw']['utc'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 20)); + $filedataoffset += 20; + + $info['ogg']['skeleton']['fishead']['version'] = $info['ogg']['skeleton']['fishead']['raw']['version_major'].'.'.$info['ogg']['skeleton']['fishead']['raw']['version_minor']; + $info['ogg']['skeleton']['fishead']['presentationtime'] = $info['ogg']['skeleton']['fishead']['raw']['presentationtime_numerator'] / $info['ogg']['skeleton']['fishead']['raw']['presentationtime_denominator']; + $info['ogg']['skeleton']['fishead']['basetime'] = $info['ogg']['skeleton']['fishead']['raw']['basetime_numerator'] / $info['ogg']['skeleton']['fishead']['raw']['basetime_denominator']; + $info['ogg']['skeleton']['fishead']['utc'] = $info['ogg']['skeleton']['fishead']['raw']['utc']; + + + $counter = 0; + do { + $oggpageinfo = $this->ParseOggPageHeader(); + $info['ogg']['pageheader'][$oggpageinfo['page_seqno'].'.'.$counter++] = $oggpageinfo; + $filedata = $this->fread($oggpageinfo['page_length']); + $this->fseek($oggpageinfo['page_end_offset']); + + if (substr($filedata, 0, 8) == "fisbone\x00") { + + $filedataoffset = 8; + $info['ogg']['skeleton']['fisbone']['raw']['message_header_offset'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); + $filedataoffset += 4; + $info['ogg']['skeleton']['fisbone']['raw']['serial_number'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); + $filedataoffset += 4; + $info['ogg']['skeleton']['fisbone']['raw']['number_header_packets'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); + $filedataoffset += 4; + $info['ogg']['skeleton']['fisbone']['raw']['granulerate_numerator'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 8)); + $filedataoffset += 8; + $info['ogg']['skeleton']['fisbone']['raw']['granulerate_denominator'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 8)); + $filedataoffset += 8; + $info['ogg']['skeleton']['fisbone']['raw']['basegranule'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 8)); + $filedataoffset += 8; + $info['ogg']['skeleton']['fisbone']['raw']['preroll'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); + $filedataoffset += 4; + $info['ogg']['skeleton']['fisbone']['raw']['granuleshift'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 1)); + $filedataoffset += 1; + $info['ogg']['skeleton']['fisbone']['raw']['padding'] = substr($filedata, $filedataoffset, 3); + $filedataoffset += 3; + + } elseif (substr($filedata, 1, 6) == 'theora') { + + $info['video']['dataformat'] = 'theora1'; + $this->error('Ogg Theora (v1) not correctly handled in this version of getID3 ['.$this->getid3->version().']'); + //break; + + } elseif (substr($filedata, 1, 6) == 'vorbis') { + + $this->ParseVorbisPageHeader($filedata, $filedataoffset, $oggpageinfo); + + } else { + $this->error('unexpected'); + //break; + } + //} while ($oggpageinfo['page_seqno'] == 0); + } while (($oggpageinfo['page_seqno'] == 0) && (substr($filedata, 0, 8) != "fisbone\x00")); + + $this->fseek($oggpageinfo['page_start_offset']); + + $this->error('Ogg Skeleton not correctly handled in this version of getID3 ['.$this->getid3->version().']'); + //return false; + + } else { + + $this->error('Expecting either "Speex ", "OpusHead" or "vorbis" identifier strings, found "'.substr($filedata, 0, 8).'"'); + unset($info['ogg']); + unset($info['mime_type']); + return false; + + } + + // Page 2 - Comment Header + $oggpageinfo = $this->ParseOggPageHeader(); + $info['ogg']['pageheader'][$oggpageinfo['page_seqno']] = $oggpageinfo; + + switch ($info['audio']['dataformat']) { + case 'vorbis': + $filedata = $this->fread($info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['page_length']); + $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['packet_type'] = getid3_lib::LittleEndian2Int(substr($filedata, 0, 1)); + $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['stream_type'] = substr($filedata, 1, 6); // hard-coded to 'vorbis' + + $this->ParseVorbisComments(); + break; + + case 'flac': + $flac = new getid3_flac($this->getid3); + if (!$flac->parseMETAdata()) { + $this->error('Failed to parse FLAC headers'); + return false; + } + unset($flac); + break; + + case 'speex': + $this->fseek($info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['page_length'], SEEK_CUR); + $this->ParseVorbisComments(); + break; + + case 'opus': + $filedata = $this->fread($info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['page_length']); + $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['stream_type'] = substr($filedata, 0, 8); // hard-coded to 'OpusTags' + if(substr($filedata, 0, 8) != 'OpusTags') { + $this->error('Expected "OpusTags" as header but got "'.substr($filedata, 0, 8).'"'); + return false; + } + + $this->ParseVorbisComments(); + break; + + } + + // Last Page - Number of Samples + if (!getid3_lib::intValueSupported($info['avdataend'])) { + + $this->warning('Unable to parse Ogg end chunk file (PHP does not support file operations beyond '.round(PHP_INT_MAX / 1073741824).'GB)'); + + } else { + + $this->fseek(max($info['avdataend'] - $this->getid3->fread_buffer_size(), 0)); + $LastChunkOfOgg = strrev($this->fread($this->getid3->fread_buffer_size())); + if ($LastOggSpostion = strpos($LastChunkOfOgg, 'SggO')) { + $this->fseek($info['avdataend'] - ($LastOggSpostion + strlen('SggO'))); + $info['avdataend'] = $this->ftell(); + $info['ogg']['pageheader']['eos'] = $this->ParseOggPageHeader(); + $info['ogg']['samples'] = $info['ogg']['pageheader']['eos']['pcm_abs_position']; + if ($info['ogg']['samples'] == 0) { + $this->error('Corrupt Ogg file: eos.number of samples == zero'); + return false; + } + if (!empty($info['audio']['sample_rate'])) { + $info['ogg']['bitrate_average'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / ($info['ogg']['samples'] / $info['audio']['sample_rate']); + } + } + + } + + if (!empty($info['ogg']['bitrate_average'])) { + $info['audio']['bitrate'] = $info['ogg']['bitrate_average']; + } elseif (!empty($info['ogg']['bitrate_nominal'])) { + $info['audio']['bitrate'] = $info['ogg']['bitrate_nominal']; + } elseif (!empty($info['ogg']['bitrate_min']) && !empty($info['ogg']['bitrate_max'])) { + $info['audio']['bitrate'] = ($info['ogg']['bitrate_min'] + $info['ogg']['bitrate_max']) / 2; + } + if (isset($info['audio']['bitrate']) && !isset($info['playtime_seconds'])) { + if ($info['audio']['bitrate'] == 0) { + $this->error('Corrupt Ogg file: bitrate_audio == zero'); + return false; + } + $info['playtime_seconds'] = (float) ((($info['avdataend'] - $info['avdataoffset']) * 8) / $info['audio']['bitrate']); + } + + if (isset($info['ogg']['vendor'])) { + $info['audio']['encoder'] = preg_replace('/^Encoded with /', '', $info['ogg']['vendor']); + + // Vorbis only + if ($info['audio']['dataformat'] == 'vorbis') { + + // Vorbis 1.0 starts with Xiph.Org + if (preg_match('/^Xiph.Org/', $info['audio']['encoder'])) { + + if ($info['audio']['bitrate_mode'] == 'abr') { + + // Set -b 128 on abr files + $info['audio']['encoder_options'] = '-b '.round($info['ogg']['bitrate_nominal'] / 1000); + + } elseif (($info['audio']['bitrate_mode'] == 'vbr') && ($info['audio']['channels'] == 2) && ($info['audio']['sample_rate'] >= 44100) && ($info['audio']['sample_rate'] <= 48000)) { + // Set -q N on vbr files + $info['audio']['encoder_options'] = '-q '.$this->get_quality_from_nominal_bitrate($info['ogg']['bitrate_nominal']); + + } + } + + if (empty($info['audio']['encoder_options']) && !empty($info['ogg']['bitrate_nominal'])) { + $info['audio']['encoder_options'] = 'Nominal bitrate: '.intval(round($info['ogg']['bitrate_nominal'] / 1000)).'kbps'; + } + } + } + + return true; + } + + public function ParseVorbisPageHeader(&$filedata, &$filedataoffset, &$oggpageinfo) { + $info = &$this->getid3->info; + $info['audio']['dataformat'] = 'vorbis'; + $info['audio']['lossless'] = false; + + $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['packet_type'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 1)); + $filedataoffset += 1; + $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['stream_type'] = substr($filedata, $filedataoffset, 6); // hard-coded to 'vorbis' + $filedataoffset += 6; + $info['ogg']['bitstreamversion'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); + $filedataoffset += 4; + $info['ogg']['numberofchannels'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 1)); + $filedataoffset += 1; + $info['audio']['channels'] = $info['ogg']['numberofchannels']; + $info['ogg']['samplerate'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); + $filedataoffset += 4; + if ($info['ogg']['samplerate'] == 0) { + $this->error('Corrupt Ogg file: sample rate == zero'); + return false; + } + $info['audio']['sample_rate'] = $info['ogg']['samplerate']; + $info['ogg']['samples'] = 0; // filled in later + $info['ogg']['bitrate_average'] = 0; // filled in later + $info['ogg']['bitrate_max'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); + $filedataoffset += 4; + $info['ogg']['bitrate_nominal'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); + $filedataoffset += 4; + $info['ogg']['bitrate_min'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); + $filedataoffset += 4; + $info['ogg']['blocksize_small'] = pow(2, getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 1)) & 0x0F); + $info['ogg']['blocksize_large'] = pow(2, (getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 1)) & 0xF0) >> 4); + $info['ogg']['stop_bit'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 1)); // must be 1, marks end of packet + + $info['audio']['bitrate_mode'] = 'vbr'; // overridden if actually abr + if ($info['ogg']['bitrate_max'] == 0xFFFFFFFF) { + unset($info['ogg']['bitrate_max']); + $info['audio']['bitrate_mode'] = 'abr'; + } + if ($info['ogg']['bitrate_nominal'] == 0xFFFFFFFF) { + unset($info['ogg']['bitrate_nominal']); + } + if ($info['ogg']['bitrate_min'] == 0xFFFFFFFF) { + unset($info['ogg']['bitrate_min']); + $info['audio']['bitrate_mode'] = 'abr'; + } + return true; + } + + // http://tools.ietf.org/html/draft-ietf-codec-oggopus-03 + public function ParseOpusPageHeader(&$filedata, &$filedataoffset, &$oggpageinfo) { + $info = &$this->getid3->info; + $info['audio']['dataformat'] = 'opus'; + $info['mime_type'] = 'audio/ogg; codecs=opus'; + + /** @todo find a usable way to detect abr (vbr that is padded to be abr) */ + $info['audio']['bitrate_mode'] = 'vbr'; + + $info['audio']['lossless'] = false; + + $info['ogg']['pageheader']['opus']['opus_magic'] = substr($filedata, $filedataoffset, 8); // hard-coded to 'OpusHead' + $filedataoffset += 8; + $info['ogg']['pageheader']['opus']['version'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 1)); + $filedataoffset += 1; + + if ($info['ogg']['pageheader']['opus']['version'] < 1 || $info['ogg']['pageheader']['opus']['version'] > 15) { + $this->error('Unknown opus version number (only accepting 1-15)'); + return false; + } + + $info['ogg']['pageheader']['opus']['out_channel_count'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 1)); + $filedataoffset += 1; + + if ($info['ogg']['pageheader']['opus']['out_channel_count'] == 0) { + $this->error('Invalid channel count in opus header (must not be zero)'); + return false; + } + + $info['ogg']['pageheader']['opus']['pre_skip'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 2)); + $filedataoffset += 2; + + $info['ogg']['pageheader']['opus']['sample_rate'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); + $filedataoffset += 4; + + //$info['ogg']['pageheader']['opus']['output_gain'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 2)); + //$filedataoffset += 2; + + //$info['ogg']['pageheader']['opus']['channel_mapping_family'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 1)); + //$filedataoffset += 1; + + $info['opus']['opus_version'] = $info['ogg']['pageheader']['opus']['version']; + $info['opus']['sample_rate'] = $info['ogg']['pageheader']['opus']['sample_rate']; + $info['opus']['out_channel_count'] = $info['ogg']['pageheader']['opus']['out_channel_count']; + + $info['audio']['channels'] = $info['opus']['out_channel_count']; + $info['audio']['sample_rate'] = $info['opus']['sample_rate']; + return true; + } + + + public function ParseOggPageHeader() { + // http://xiph.org/ogg/vorbis/doc/framing.html + $oggheader['page_start_offset'] = $this->ftell(); // where we started from in the file + + $filedata = $this->fread($this->getid3->fread_buffer_size()); + $filedataoffset = 0; + while ((substr($filedata, $filedataoffset++, 4) != 'OggS')) { + if (($this->ftell() - $oggheader['page_start_offset']) >= $this->getid3->fread_buffer_size()) { + // should be found before here + return false; + } + if ((($filedataoffset + 28) > strlen($filedata)) || (strlen($filedata) < 28)) { + if ($this->feof() || (($filedata .= $this->fread($this->getid3->fread_buffer_size())) === false)) { + // get some more data, unless eof, in which case fail + return false; + } + } + } + $filedataoffset += strlen('OggS') - 1; // page, delimited by 'OggS' + + $oggheader['stream_structver'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 1)); + $filedataoffset += 1; + $oggheader['flags_raw'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 1)); + $filedataoffset += 1; + $oggheader['flags']['fresh'] = (bool) ($oggheader['flags_raw'] & 0x01); // fresh packet + $oggheader['flags']['bos'] = (bool) ($oggheader['flags_raw'] & 0x02); // first page of logical bitstream (bos) + $oggheader['flags']['eos'] = (bool) ($oggheader['flags_raw'] & 0x04); // last page of logical bitstream (eos) + + $oggheader['pcm_abs_position'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 8)); + $filedataoffset += 8; + $oggheader['stream_serialno'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); + $filedataoffset += 4; + $oggheader['page_seqno'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); + $filedataoffset += 4; + $oggheader['page_checksum'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); + $filedataoffset += 4; + $oggheader['page_segments'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 1)); + $filedataoffset += 1; + $oggheader['page_length'] = 0; + for ($i = 0; $i < $oggheader['page_segments']; $i++) { + $oggheader['segment_table'][$i] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 1)); + $filedataoffset += 1; + $oggheader['page_length'] += $oggheader['segment_table'][$i]; + } + $oggheader['header_end_offset'] = $oggheader['page_start_offset'] + $filedataoffset; + $oggheader['page_end_offset'] = $oggheader['header_end_offset'] + $oggheader['page_length']; + $this->fseek($oggheader['header_end_offset']); + + return $oggheader; + } + + // http://xiph.org/vorbis/doc/Vorbis_I_spec.html#x1-810005 + public function ParseVorbisComments() { + $info = &$this->getid3->info; + + $OriginalOffset = $this->ftell(); + $commentdataoffset = 0; + $VorbisCommentPage = 1; + + switch ($info['audio']['dataformat']) { + case 'vorbis': + case 'speex': + case 'opus': + $CommentStartOffset = $info['ogg']['pageheader'][$VorbisCommentPage]['page_start_offset']; // Second Ogg page, after header block + $this->fseek($CommentStartOffset); + $commentdataoffset = 27 + $info['ogg']['pageheader'][$VorbisCommentPage]['page_segments']; + $commentdata = $this->fread(self::OggPageSegmentLength($info['ogg']['pageheader'][$VorbisCommentPage], 1) + $commentdataoffset); + + if ($info['audio']['dataformat'] == 'vorbis') { + $commentdataoffset += (strlen('vorbis') + 1); + } + else if ($info['audio']['dataformat'] == 'opus') { + $commentdataoffset += strlen('OpusTags'); + } + + break; + + case 'flac': + $CommentStartOffset = $info['flac']['VORBIS_COMMENT']['raw']['offset'] + 4; + $this->fseek($CommentStartOffset); + $commentdata = $this->fread($info['flac']['VORBIS_COMMENT']['raw']['block_length']); + break; + + default: + return false; + break; + } + + $VendorSize = getid3_lib::LittleEndian2Int(substr($commentdata, $commentdataoffset, 4)); + $commentdataoffset += 4; + + $info['ogg']['vendor'] = substr($commentdata, $commentdataoffset, $VendorSize); + $commentdataoffset += $VendorSize; + + $CommentsCount = getid3_lib::LittleEndian2Int(substr($commentdata, $commentdataoffset, 4)); + $commentdataoffset += 4; + $info['avdataoffset'] = $CommentStartOffset + $commentdataoffset; + + $basicfields = array('TITLE', 'ARTIST', 'ALBUM', 'TRACKNUMBER', 'GENRE', 'DATE', 'DESCRIPTION', 'COMMENT'); + $ThisFileInfo_ogg_comments_raw = &$info['ogg']['comments_raw']; + for ($i = 0; $i < $CommentsCount; $i++) { + + if ($i >= 10000) { + // https://github.com/owncloud/music/issues/212#issuecomment-43082336 + $this->warning('Unexpectedly large number ('.$CommentsCount.') of Ogg comments - breaking after reading '.$i.' comments'); + break; + } + + $ThisFileInfo_ogg_comments_raw[$i]['dataoffset'] = $CommentStartOffset + $commentdataoffset; + + if ($this->ftell() < ($ThisFileInfo_ogg_comments_raw[$i]['dataoffset'] + 4)) { + if ($oggpageinfo = $this->ParseOggPageHeader()) { + $info['ogg']['pageheader'][$oggpageinfo['page_seqno']] = $oggpageinfo; + + $VorbisCommentPage++; + + // First, save what we haven't read yet + $AsYetUnusedData = substr($commentdata, $commentdataoffset); + + // Then take that data off the end + $commentdata = substr($commentdata, 0, $commentdataoffset); + + // Add [headerlength] bytes of dummy data for the Ogg Page Header, just to keep absolute offsets correct + $commentdata .= str_repeat("\x00", 27 + $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['page_segments']); + $commentdataoffset += (27 + $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['page_segments']); + + // Finally, stick the unused data back on the end + $commentdata .= $AsYetUnusedData; + + //$commentdata .= $this->fread($info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['page_length']); + $commentdata .= $this->fread($this->OggPageSegmentLength($info['ogg']['pageheader'][$VorbisCommentPage], 1)); + } + + } + $ThisFileInfo_ogg_comments_raw[$i]['size'] = getid3_lib::LittleEndian2Int(substr($commentdata, $commentdataoffset, 4)); + + // replace avdataoffset with position just after the last vorbiscomment + $info['avdataoffset'] = $ThisFileInfo_ogg_comments_raw[$i]['dataoffset'] + $ThisFileInfo_ogg_comments_raw[$i]['size'] + 4; + + $commentdataoffset += 4; + while ((strlen($commentdata) - $commentdataoffset) < $ThisFileInfo_ogg_comments_raw[$i]['size']) { + if (($ThisFileInfo_ogg_comments_raw[$i]['size'] > $info['avdataend']) || ($ThisFileInfo_ogg_comments_raw[$i]['size'] < 0)) { + $this->warning('Invalid Ogg comment size (comment #'.$i.', claims to be '.number_format($ThisFileInfo_ogg_comments_raw[$i]['size']).' bytes) - aborting reading comments'); + break 2; + } + + $VorbisCommentPage++; + + $oggpageinfo = $this->ParseOggPageHeader(); + $info['ogg']['pageheader'][$oggpageinfo['page_seqno']] = $oggpageinfo; + + // First, save what we haven't read yet + $AsYetUnusedData = substr($commentdata, $commentdataoffset); + + // Then take that data off the end + $commentdata = substr($commentdata, 0, $commentdataoffset); + + // Add [headerlength] bytes of dummy data for the Ogg Page Header, just to keep absolute offsets correct + $commentdata .= str_repeat("\x00", 27 + $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['page_segments']); + $commentdataoffset += (27 + $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['page_segments']); + + // Finally, stick the unused data back on the end + $commentdata .= $AsYetUnusedData; + + //$commentdata .= $this->fread($info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['page_length']); + if (!isset($info['ogg']['pageheader'][$VorbisCommentPage])) { + $this->warning('undefined Vorbis Comment page "'.$VorbisCommentPage.'" at offset '.$this->ftell()); + break; + } + $readlength = self::OggPageSegmentLength($info['ogg']['pageheader'][$VorbisCommentPage], 1); + if ($readlength <= 0) { + $this->warning('invalid length Vorbis Comment page "'.$VorbisCommentPage.'" at offset '.$this->ftell()); + break; + } + $commentdata .= $this->fread($readlength); + + //$filebaseoffset += $oggpageinfo['header_end_offset'] - $oggpageinfo['page_start_offset']; + } + $ThisFileInfo_ogg_comments_raw[$i]['offset'] = $commentdataoffset; + $commentstring = substr($commentdata, $commentdataoffset, $ThisFileInfo_ogg_comments_raw[$i]['size']); + $commentdataoffset += $ThisFileInfo_ogg_comments_raw[$i]['size']; + + if (!$commentstring) { + + // no comment? + $this->warning('Blank Ogg comment ['.$i.']'); + + } elseif (strstr($commentstring, '=')) { + + $commentexploded = explode('=', $commentstring, 2); + $ThisFileInfo_ogg_comments_raw[$i]['key'] = strtoupper($commentexploded[0]); + $ThisFileInfo_ogg_comments_raw[$i]['value'] = (isset($commentexploded[1]) ? $commentexploded[1] : ''); + + if ($ThisFileInfo_ogg_comments_raw[$i]['key'] == 'METADATA_BLOCK_PICTURE') { + + // http://wiki.xiph.org/VorbisComment#METADATA_BLOCK_PICTURE + // The unencoded format is that of the FLAC picture block. The fields are stored in big endian order as in FLAC, picture data is stored according to the relevant standard. + // http://flac.sourceforge.net/format.html#metadata_block_picture + $flac = new getid3_flac($this->getid3); + $flac->setStringMode(base64_decode($ThisFileInfo_ogg_comments_raw[$i]['value'])); + $flac->parsePICTURE(); + $info['ogg']['comments']['picture'][] = $flac->getid3->info['flac']['PICTURE'][0]; + unset($flac); + + } elseif ($ThisFileInfo_ogg_comments_raw[$i]['key'] == 'COVERART') { + + $data = base64_decode($ThisFileInfo_ogg_comments_raw[$i]['value']); + $this->notice('Found deprecated COVERART tag, it should be replaced in honor of METADATA_BLOCK_PICTURE structure'); + /** @todo use 'coverartmime' where available */ + $imageinfo = getid3_lib::GetDataImageSize($data); + if ($imageinfo === false || !isset($imageinfo['mime'])) { + $this->warning('COVERART vorbiscomment tag contains invalid image'); + continue; + } + + $ogg = new self($this->getid3); + $ogg->setStringMode($data); + $info['ogg']['comments']['picture'][] = array( + 'image_mime' => $imageinfo['mime'], + 'datalength' => strlen($data), + 'picturetype' => 'cover art', + 'image_height' => $imageinfo['height'], + 'image_width' => $imageinfo['width'], + 'data' => $ogg->saveAttachment('coverart', 0, strlen($data), $imageinfo['mime']), + ); + unset($ogg); + + } else { + + $info['ogg']['comments'][strtolower($ThisFileInfo_ogg_comments_raw[$i]['key'])][] = $ThisFileInfo_ogg_comments_raw[$i]['value']; + + } + + } else { + + $this->warning('[known problem with CDex >= v1.40, < v1.50b7] Invalid Ogg comment name/value pair ['.$i.']: '.$commentstring); + + } + unset($ThisFileInfo_ogg_comments_raw[$i]); + } + unset($ThisFileInfo_ogg_comments_raw); + + + // Replay Gain Adjustment + // http://privatewww.essex.ac.uk/~djmrob/replaygain/ + if (isset($info['ogg']['comments']) && is_array($info['ogg']['comments'])) { + foreach ($info['ogg']['comments'] as $index => $commentvalue) { + switch ($index) { + case 'rg_audiophile': + case 'replaygain_album_gain': + $info['replay_gain']['album']['adjustment'] = (double) $commentvalue[0]; + unset($info['ogg']['comments'][$index]); + break; + + case 'rg_radio': + case 'replaygain_track_gain': + $info['replay_gain']['track']['adjustment'] = (double) $commentvalue[0]; + unset($info['ogg']['comments'][$index]); + break; + + case 'replaygain_album_peak': + $info['replay_gain']['album']['peak'] = (double) $commentvalue[0]; + unset($info['ogg']['comments'][$index]); + break; + + case 'rg_peak': + case 'replaygain_track_peak': + $info['replay_gain']['track']['peak'] = (double) $commentvalue[0]; + unset($info['ogg']['comments'][$index]); + break; + + case 'replaygain_reference_loudness': + $info['replay_gain']['reference_volume'] = (double) $commentvalue[0]; + unset($info['ogg']['comments'][$index]); + break; + + default: + // do nothing + break; + } + } + } + + $this->fseek($OriginalOffset); + + return true; + } + + public static function SpeexBandModeLookup($mode) { + static $SpeexBandModeLookup = array(); + if (empty($SpeexBandModeLookup)) { + $SpeexBandModeLookup[0] = 'narrow'; + $SpeexBandModeLookup[1] = 'wide'; + $SpeexBandModeLookup[2] = 'ultra-wide'; + } + return (isset($SpeexBandModeLookup[$mode]) ? $SpeexBandModeLookup[$mode] : null); + } + + + public static function OggPageSegmentLength($OggInfoArray, $SegmentNumber=1) { + for ($i = 0; $i < $SegmentNumber; $i++) { + $segmentlength = 0; + foreach ($OggInfoArray['segment_table'] as $key => $value) { + $segmentlength += $value; + if ($value < 255) { + break; + } + } + } + return $segmentlength; + } + + + public static function get_quality_from_nominal_bitrate($nominal_bitrate) { + + // decrease precision + $nominal_bitrate = $nominal_bitrate / 1000; + + if ($nominal_bitrate < 128) { + // q-1 to q4 + $qval = ($nominal_bitrate - 64) / 16; + } elseif ($nominal_bitrate < 256) { + // q4 to q8 + $qval = $nominal_bitrate / 32; + } elseif ($nominal_bitrate < 320) { + // q8 to q9 + $qval = ($nominal_bitrate + 256) / 64; + } else { + // q9 to q10 + $qval = ($nominal_bitrate + 1300) / 180; + } + //return $qval; // 5.031324 + //return intval($qval); // 5 + return round($qval, 1); // 5 or 4.9 + } + + public static function TheoraColorSpace($colorspace_id) { + // http://www.theora.org/doc/Theora.pdf (table 6.3) + static $TheoraColorSpaceLookup = array(); + if (empty($TheoraColorSpaceLookup)) { + $TheoraColorSpaceLookup[0] = 'Undefined'; + $TheoraColorSpaceLookup[1] = 'Rec. 470M'; + $TheoraColorSpaceLookup[2] = 'Rec. 470BG'; + $TheoraColorSpaceLookup[3] = 'Reserved'; + } + return (isset($TheoraColorSpaceLookup[$colorspace_id]) ? $TheoraColorSpaceLookup[$colorspace_id] : null); + } + + public static function TheoraPixelFormat($pixelformat_id) { + // http://www.theora.org/doc/Theora.pdf (table 6.4) + static $TheoraPixelFormatLookup = array(); + if (empty($TheoraPixelFormatLookup)) { + $TheoraPixelFormatLookup[0] = '4:2:0'; + $TheoraPixelFormatLookup[1] = 'Reserved'; + $TheoraPixelFormatLookup[2] = '4:2:2'; + $TheoraPixelFormatLookup[3] = '4:4:4'; + } + return (isset($TheoraPixelFormatLookup[$pixelformat_id]) ? $TheoraPixelFormatLookup[$pixelformat_id] : null); + } + +} diff --git a/www/rompr/getid3/module.audio.optimfrog.php b/www/rompr/getid3/module.audio.optimfrog.php new file mode 100644 index 0000000..50e0ffd --- /dev/null +++ b/www/rompr/getid3/module.audio.optimfrog.php @@ -0,0 +1,427 @@ + // +// available at http://getid3.sourceforge.net // +// or http://www.getid3.org // +// also https://github.com/JamesHeinrich/getID3 // +///////////////////////////////////////////////////////////////// +// See readme.txt for more details // +///////////////////////////////////////////////////////////////// +// // +// module.audio.optimfrog.php // +// module for analyzing OptimFROG audio files // +// dependencies: module.audio.riff.php // +// /// +///////////////////////////////////////////////////////////////// + +getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio-video.riff.php', __FILE__, true); + +class getid3_optimfrog extends getid3_handler +{ + + public function Analyze() { + $info = &$this->getid3->info; + + $info['fileformat'] = 'ofr'; + $info['audio']['dataformat'] = 'ofr'; + $info['audio']['bitrate_mode'] = 'vbr'; + $info['audio']['lossless'] = true; + + $this->fseek($info['avdataoffset']); + $OFRheader = $this->fread(8); + if (substr($OFRheader, 0, 5) == '*RIFF') { + + return $this->ParseOptimFROGheader42(); + + } elseif (substr($OFRheader, 0, 3) == 'OFR') { + + return $this->ParseOptimFROGheader45(); + + } + + $this->error('Expecting "*RIFF" or "OFR " at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes($OFRheader).'"'); + unset($info['fileformat']); + return false; + } + + + public function ParseOptimFROGheader42() { + // for fileformat of v4.21 and older + + $info = &$this->getid3->info; + $this->fseek($info['avdataoffset']); + $OptimFROGheaderData = $this->fread(45); + $info['avdataoffset'] = 45; + + $OptimFROGencoderVersion_raw = getid3_lib::LittleEndian2Int(substr($OptimFROGheaderData, 0, 1)); + $OptimFROGencoderVersion_major = floor($OptimFROGencoderVersion_raw / 10); + $OptimFROGencoderVersion_minor = $OptimFROGencoderVersion_raw - ($OptimFROGencoderVersion_major * 10); + $RIFFdata = substr($OptimFROGheaderData, 1, 44); + $OrignalRIFFheaderSize = getid3_lib::LittleEndian2Int(substr($RIFFdata, 4, 4)) + 8; + $OrignalRIFFdataSize = getid3_lib::LittleEndian2Int(substr($RIFFdata, 40, 4)) + 44; + + if ($OrignalRIFFheaderSize > $OrignalRIFFdataSize) { + $info['avdataend'] -= ($OrignalRIFFheaderSize - $OrignalRIFFdataSize); + $this->fseek($info['avdataend']); + $RIFFdata .= $this->fread($OrignalRIFFheaderSize - $OrignalRIFFdataSize); + } + + // move the data chunk after all other chunks (if any) + // so that the RIFF parser doesn't see EOF when trying + // to skip over the data chunk + $RIFFdata = substr($RIFFdata, 0, 36).substr($RIFFdata, 44).substr($RIFFdata, 36, 8); + + $getid3_temp = new getID3(); + $getid3_temp->openfile($this->getid3->filename); + $getid3_temp->info['avdataoffset'] = $info['avdataoffset']; + $getid3_temp->info['avdataend'] = $info['avdataend']; + $getid3_riff = new getid3_riff($getid3_temp); + $getid3_riff->ParseRIFFdata($RIFFdata); + $info['riff'] = $getid3_temp->info['riff']; + + $info['audio']['encoder'] = 'OptimFROG '.$OptimFROGencoderVersion_major.'.'.$OptimFROGencoderVersion_minor; + $info['audio']['channels'] = $info['riff']['audio'][0]['channels']; + $info['audio']['sample_rate'] = $info['riff']['audio'][0]['sample_rate']; + $info['audio']['bits_per_sample'] = $info['riff']['audio'][0]['bits_per_sample']; + $info['playtime_seconds'] = $OrignalRIFFdataSize / ($info['audio']['channels'] * $info['audio']['sample_rate'] * ($info['audio']['bits_per_sample'] / 8)); + $info['audio']['bitrate'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / $info['playtime_seconds']; + + unset($getid3_riff, $getid3_temp, $RIFFdata); + + return true; + } + + + public function ParseOptimFROGheader45() { + // for fileformat of v4.50a and higher + + $info = &$this->getid3->info; + $RIFFdata = ''; + $this->fseek($info['avdataoffset']); + while (!feof($this->getid3->fp) && ($this->ftell() < $info['avdataend'])) { + $BlockOffset = $this->ftell(); + $BlockData = $this->fread(8); + $offset = 8; + $BlockName = substr($BlockData, 0, 4); + $BlockSize = getid3_lib::LittleEndian2Int(substr($BlockData, 4, 4)); + + if ($BlockName == 'OFRX') { + $BlockName = 'OFR '; + } + if (!isset($info['ofr'][$BlockName])) { + $info['ofr'][$BlockName] = array(); + } + $thisfile_ofr_thisblock = &$info['ofr'][$BlockName]; + + switch ($BlockName) { + case 'OFR ': + + // shortcut + $thisfile_ofr_thisblock['offset'] = $BlockOffset; + $thisfile_ofr_thisblock['size'] = $BlockSize; + + $info['audio']['encoder'] = 'OptimFROG 4.50 alpha'; + switch ($BlockSize) { + case 12: + case 15: + // good + break; + + default: + $this->warning('"'.$BlockName.'" contains more data than expected (expected 12 or 15 bytes, found '.$BlockSize.' bytes)'); + break; + } + $BlockData .= $this->fread($BlockSize); + + $thisfile_ofr_thisblock['total_samples'] = getid3_lib::LittleEndian2Int(substr($BlockData, $offset, 6)); + $offset += 6; + $thisfile_ofr_thisblock['raw']['sample_type'] = getid3_lib::LittleEndian2Int(substr($BlockData, $offset, 1)); + $thisfile_ofr_thisblock['sample_type'] = $this->OptimFROGsampleTypeLookup($thisfile_ofr_thisblock['raw']['sample_type']); + $offset += 1; + $thisfile_ofr_thisblock['channel_config'] = getid3_lib::LittleEndian2Int(substr($BlockData, $offset, 1)); + $thisfile_ofr_thisblock['channels'] = $thisfile_ofr_thisblock['channel_config']; + $offset += 1; + $thisfile_ofr_thisblock['sample_rate'] = getid3_lib::LittleEndian2Int(substr($BlockData, $offset, 4)); + $offset += 4; + + if ($BlockSize > 12) { + + // OFR 4.504b or higher + $thisfile_ofr_thisblock['channels'] = $this->OptimFROGchannelConfigNumChannelsLookup($thisfile_ofr_thisblock['channel_config']); + $thisfile_ofr_thisblock['raw']['encoder_id'] = getid3_lib::LittleEndian2Int(substr($BlockData, $offset, 2)); + $thisfile_ofr_thisblock['encoder'] = $this->OptimFROGencoderNameLookup($thisfile_ofr_thisblock['raw']['encoder_id']); + $offset += 2; + $thisfile_ofr_thisblock['raw']['compression'] = getid3_lib::LittleEndian2Int(substr($BlockData, $offset, 1)); + $thisfile_ofr_thisblock['compression'] = $this->OptimFROGcompressionLookup($thisfile_ofr_thisblock['raw']['compression']); + $thisfile_ofr_thisblock['speedup'] = $this->OptimFROGspeedupLookup($thisfile_ofr_thisblock['raw']['compression']); + $offset += 1; + + $info['audio']['encoder'] = 'OptimFROG '.$thisfile_ofr_thisblock['encoder']; + $info['audio']['encoder_options'] = '--mode '.$thisfile_ofr_thisblock['compression']; + + if ((($thisfile_ofr_thisblock['raw']['encoder_id'] & 0xF0) >> 4) == 7) { // v4.507 + if (strtolower(getid3_lib::fileextension($info['filename'])) == 'ofs') { + // OptimFROG DualStream format is lossy, but as of v4.507 there is no way to tell the difference + // between lossless and lossy other than the file extension. + $info['audio']['dataformat'] = 'ofs'; + $info['audio']['lossless'] = true; + } + } + + } + + $info['audio']['channels'] = $thisfile_ofr_thisblock['channels']; + $info['audio']['sample_rate'] = $thisfile_ofr_thisblock['sample_rate']; + $info['audio']['bits_per_sample'] = $this->OptimFROGbitsPerSampleTypeLookup($thisfile_ofr_thisblock['raw']['sample_type']); + break; + + + case 'COMP': + // unlike other block types, there CAN be multiple COMP blocks + + $COMPdata['offset'] = $BlockOffset; + $COMPdata['size'] = $BlockSize; + + if ($info['avdataoffset'] == 0) { + $info['avdataoffset'] = $BlockOffset; + } + + // Only interested in first 14 bytes (only first 12 needed for v4.50 alpha), not actual audio data + $BlockData .= $this->fread(14); + $this->fseek($BlockSize - 14, SEEK_CUR); + + $COMPdata['crc_32'] = getid3_lib::LittleEndian2Int(substr($BlockData, $offset, 4)); + $offset += 4; + $COMPdata['sample_count'] = getid3_lib::LittleEndian2Int(substr($BlockData, $offset, 4)); + $offset += 4; + $COMPdata['raw']['sample_type'] = getid3_lib::LittleEndian2Int(substr($BlockData, $offset, 1)); + $COMPdata['sample_type'] = $this->OptimFROGsampleTypeLookup($COMPdata['raw']['sample_type']); + $offset += 1; + $COMPdata['raw']['channel_configuration'] = getid3_lib::LittleEndian2Int(substr($BlockData, $offset, 1)); + $COMPdata['channel_configuration'] = $this->OptimFROGchannelConfigurationLookup($COMPdata['raw']['channel_configuration']); + $offset += 1; + $COMPdata['raw']['algorithm_id'] = getid3_lib::LittleEndian2Int(substr($BlockData, $offset, 2)); + //$COMPdata['algorithm'] = OptimFROGalgorithmNameLookup($COMPdata['raw']['algorithm_id']); + $offset += 2; + + if ($info['ofr']['OFR ']['size'] > 12) { + + // OFR 4.504b or higher + $COMPdata['raw']['encoder_id'] = getid3_lib::LittleEndian2Int(substr($BlockData, $offset, 2)); + $COMPdata['encoder'] = $this->OptimFROGencoderNameLookup($COMPdata['raw']['encoder_id']); + $offset += 2; + + } + + if ($COMPdata['crc_32'] == 0x454E4F4E) { + // ASCII value of 'NONE' - placeholder value in v4.50a + $COMPdata['crc_32'] = false; + } + + $thisfile_ofr_thisblock[] = $COMPdata; + break; + + case 'HEAD': + $thisfile_ofr_thisblock['offset'] = $BlockOffset; + $thisfile_ofr_thisblock['size'] = $BlockSize; + + $RIFFdata .= $this->fread($BlockSize); + break; + + case 'TAIL': + $thisfile_ofr_thisblock['offset'] = $BlockOffset; + $thisfile_ofr_thisblock['size'] = $BlockSize; + + if ($BlockSize > 0) { + $RIFFdata .= $this->fread($BlockSize); + } + break; + + case 'RECV': + // block contains no useful meta data - simply note and skip + + $thisfile_ofr_thisblock['offset'] = $BlockOffset; + $thisfile_ofr_thisblock['size'] = $BlockSize; + + $this->fseek($BlockSize, SEEK_CUR); + break; + + + case 'APET': + // APEtag v2 + + $thisfile_ofr_thisblock['offset'] = $BlockOffset; + $thisfile_ofr_thisblock['size'] = $BlockSize; + $this->warning('APEtag processing inside OptimFROG not supported in this version ('.$this->getid3->version().') of getID3()'); + + $this->fseek($BlockSize, SEEK_CUR); + break; + + + case 'MD5 ': + // APEtag v2 + + $thisfile_ofr_thisblock['offset'] = $BlockOffset; + $thisfile_ofr_thisblock['size'] = $BlockSize; + + if ($BlockSize == 16) { + + $thisfile_ofr_thisblock['md5_binary'] = $this->fread($BlockSize); + $thisfile_ofr_thisblock['md5_string'] = getid3_lib::PrintHexBytes($thisfile_ofr_thisblock['md5_binary'], true, false, false); + $info['md5_data_source'] = $thisfile_ofr_thisblock['md5_string']; + + } else { + + $this->warning('Expecting block size of 16 in "MD5 " chunk, found '.$BlockSize.' instead'); + $this->fseek($BlockSize, SEEK_CUR); + + } + break; + + + default: + $thisfile_ofr_thisblock['offset'] = $BlockOffset; + $thisfile_ofr_thisblock['size'] = $BlockSize; + + $this->warning('Unhandled OptimFROG block type "'.$BlockName.'" at offset '.$thisfile_ofr_thisblock['offset']); + $this->fseek($BlockSize, SEEK_CUR); + break; + } + } + if (isset($info['ofr']['TAIL']['offset'])) { + $info['avdataend'] = $info['ofr']['TAIL']['offset']; + } + + $info['playtime_seconds'] = (float) $info['ofr']['OFR ']['total_samples'] / ($info['audio']['channels'] * $info['audio']['sample_rate']); + $info['audio']['bitrate'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / $info['playtime_seconds']; + + // move the data chunk after all other chunks (if any) + // so that the RIFF parser doesn't see EOF when trying + // to skip over the data chunk + $RIFFdata = substr($RIFFdata, 0, 36).substr($RIFFdata, 44).substr($RIFFdata, 36, 8); + + $getid3_temp = new getID3(); + $getid3_temp->openfile($this->getid3->filename); + $getid3_temp->info['avdataoffset'] = $info['avdataoffset']; + $getid3_temp->info['avdataend'] = $info['avdataend']; + $getid3_riff = new getid3_riff($getid3_temp); + $getid3_riff->ParseRIFFdata($RIFFdata); + $info['riff'] = $getid3_temp->info['riff']; + + unset($getid3_riff, $getid3_temp, $RIFFdata); + + return true; + } + + + public static function OptimFROGsampleTypeLookup($SampleType) { + static $OptimFROGsampleTypeLookup = array( + 0 => 'unsigned int (8-bit)', + 1 => 'signed int (8-bit)', + 2 => 'unsigned int (16-bit)', + 3 => 'signed int (16-bit)', + 4 => 'unsigned int (24-bit)', + 5 => 'signed int (24-bit)', + 6 => 'unsigned int (32-bit)', + 7 => 'signed int (32-bit)', + 8 => 'float 0.24 (32-bit)', + 9 => 'float 16.8 (32-bit)', + 10 => 'float 24.0 (32-bit)' + ); + return (isset($OptimFROGsampleTypeLookup[$SampleType]) ? $OptimFROGsampleTypeLookup[$SampleType] : false); + } + + public static function OptimFROGbitsPerSampleTypeLookup($SampleType) { + static $OptimFROGbitsPerSampleTypeLookup = array( + 0 => 8, + 1 => 8, + 2 => 16, + 3 => 16, + 4 => 24, + 5 => 24, + 6 => 32, + 7 => 32, + 8 => 32, + 9 => 32, + 10 => 32 + ); + return (isset($OptimFROGbitsPerSampleTypeLookup[$SampleType]) ? $OptimFROGbitsPerSampleTypeLookup[$SampleType] : false); + } + + public static function OptimFROGchannelConfigurationLookup($ChannelConfiguration) { + static $OptimFROGchannelConfigurationLookup = array( + 0 => 'mono', + 1 => 'stereo' + ); + return (isset($OptimFROGchannelConfigurationLookup[$ChannelConfiguration]) ? $OptimFROGchannelConfigurationLookup[$ChannelConfiguration] : false); + } + + public static function OptimFROGchannelConfigNumChannelsLookup($ChannelConfiguration) { + static $OptimFROGchannelConfigNumChannelsLookup = array( + 0 => 1, + 1 => 2 + ); + return (isset($OptimFROGchannelConfigNumChannelsLookup[$ChannelConfiguration]) ? $OptimFROGchannelConfigNumChannelsLookup[$ChannelConfiguration] : false); + } + + + + // static function OptimFROGalgorithmNameLookup($AlgorithID) { + // static $OptimFROGalgorithmNameLookup = array(); + // return (isset($OptimFROGalgorithmNameLookup[$AlgorithID]) ? $OptimFROGalgorithmNameLookup[$AlgorithID] : false); + // } + + + public static function OptimFROGencoderNameLookup($EncoderID) { + // version = (encoderID >> 4) + 4500 + // system = encoderID & 0xF + + $EncoderVersion = number_format(((($EncoderID & 0xF0) >> 4) + 4500) / 1000, 3); + $EncoderSystemID = ($EncoderID & 0x0F); + + static $OptimFROGencoderSystemLookup = array( + 0x00 => 'Windows console', + 0x01 => 'Linux console', + 0x0F => 'unknown' + ); + return $EncoderVersion.' ('.(isset($OptimFROGencoderSystemLookup[$EncoderSystemID]) ? $OptimFROGencoderSystemLookup[$EncoderSystemID] : 'undefined encoder type (0x'.dechex($EncoderSystemID).')').')'; + } + + public static function OptimFROGcompressionLookup($CompressionID) { + // mode = compression >> 3 + // speedup = compression & 0x07 + + $CompressionModeID = ($CompressionID & 0xF8) >> 3; + //$CompressionSpeedupID = ($CompressionID & 0x07); + + static $OptimFROGencoderModeLookup = array( + 0x00 => 'fast', + 0x01 => 'normal', + 0x02 => 'high', + 0x03 => 'extra', // extranew (some versions) + 0x04 => 'best', // bestnew (some versions) + 0x05 => 'ultra', + 0x06 => 'insane', + 0x07 => 'highnew', + 0x08 => 'extranew', + 0x09 => 'bestnew' + ); + return (isset($OptimFROGencoderModeLookup[$CompressionModeID]) ? $OptimFROGencoderModeLookup[$CompressionModeID] : 'undefined mode (0x'.str_pad(dechex($CompressionModeID), 2, '0', STR_PAD_LEFT).')'); + } + + public static function OptimFROGspeedupLookup($CompressionID) { + // mode = compression >> 3 + // speedup = compression & 0x07 + + //$CompressionModeID = ($CompressionID & 0xF8) >> 3; + $CompressionSpeedupID = ($CompressionID & 0x07); + + static $OptimFROGencoderSpeedupLookup = array( + 0x00 => '1x', + 0x01 => '2x', + 0x02 => '4x' + ); + return (isset($OptimFROGencoderSpeedupLookup[$CompressionSpeedupID]) ? $OptimFROGencoderSpeedupLookup[$CompressionSpeedupID] : 'undefined mode (0x'.dechex($CompressionSpeedupID)); + } + +} diff --git a/www/rompr/getid3/module.audio.rkau.php b/www/rompr/getid3/module.audio.rkau.php new file mode 100644 index 0000000..d7c2f09 --- /dev/null +++ b/www/rompr/getid3/module.audio.rkau.php @@ -0,0 +1,93 @@ + // +// available at http://getid3.sourceforge.net // +// or http://www.getid3.org // +// also https://github.com/JamesHeinrich/getID3 // +///////////////////////////////////////////////////////////////// +// See readme.txt for more details // +///////////////////////////////////////////////////////////////// +// // +// module.audio.shorten.php // +// module for analyzing Shorten Audio files // +// dependencies: NONE // +// /// +///////////////////////////////////////////////////////////////// + + +class getid3_rkau extends getid3_handler +{ + + public function Analyze() { + $info = &$this->getid3->info; + + $this->fseek($info['avdataoffset']); + $RKAUHeader = $this->fread(20); + $magic = 'RKA'; + if (substr($RKAUHeader, 0, 3) != $magic) { + $this->error('Expecting "'.getid3_lib::PrintHexBytes($magic).'" at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes(substr($RKAUHeader, 0, 3)).'"'); + return false; + } + + $info['fileformat'] = 'rkau'; + $info['audio']['dataformat'] = 'rkau'; + $info['audio']['bitrate_mode'] = 'vbr'; + + $info['rkau']['raw']['version'] = getid3_lib::LittleEndian2Int(substr($RKAUHeader, 3, 1)); + $info['rkau']['version'] = '1.'.str_pad($info['rkau']['raw']['version'] & 0x0F, 2, '0', STR_PAD_LEFT); + if (($info['rkau']['version'] > 1.07) || ($info['rkau']['version'] < 1.06)) { + $this->error('This version of getID3() ['.$this->getid3->version().'] can only parse RKAU files v1.06 and 1.07 (this file is v'.$info['rkau']['version'].')'); + unset($info['rkau']); + return false; + } + + $info['rkau']['source_bytes'] = getid3_lib::LittleEndian2Int(substr($RKAUHeader, 4, 4)); + $info['rkau']['sample_rate'] = getid3_lib::LittleEndian2Int(substr($RKAUHeader, 8, 4)); + $info['rkau']['channels'] = getid3_lib::LittleEndian2Int(substr($RKAUHeader, 12, 1)); + $info['rkau']['bits_per_sample'] = getid3_lib::LittleEndian2Int(substr($RKAUHeader, 13, 1)); + + $info['rkau']['raw']['quality'] = getid3_lib::LittleEndian2Int(substr($RKAUHeader, 14, 1)); + $this->RKAUqualityLookup($info['rkau']); + + $info['rkau']['raw']['flags'] = getid3_lib::LittleEndian2Int(substr($RKAUHeader, 15, 1)); + $info['rkau']['flags']['joint_stereo'] = (bool) (!($info['rkau']['raw']['flags'] & 0x01)); + $info['rkau']['flags']['streaming'] = (bool) ($info['rkau']['raw']['flags'] & 0x02); + $info['rkau']['flags']['vrq_lossy_mode'] = (bool) ($info['rkau']['raw']['flags'] & 0x04); + + if ($info['rkau']['flags']['streaming']) { + $info['avdataoffset'] += 20; + $info['rkau']['compressed_bytes'] = getid3_lib::LittleEndian2Int(substr($RKAUHeader, 16, 4)); + } else { + $info['avdataoffset'] += 16; + $info['rkau']['compressed_bytes'] = $info['avdataend'] - $info['avdataoffset'] - 1; + } + // Note: compressed_bytes does not always equal what appears to be the actual number of compressed bytes, + // sometimes it's more, sometimes less. No idea why(?) + + $info['audio']['lossless'] = $info['rkau']['lossless']; + $info['audio']['channels'] = $info['rkau']['channels']; + $info['audio']['bits_per_sample'] = $info['rkau']['bits_per_sample']; + $info['audio']['sample_rate'] = $info['rkau']['sample_rate']; + + $info['playtime_seconds'] = $info['rkau']['source_bytes'] / ($info['rkau']['sample_rate'] * $info['rkau']['channels'] * ($info['rkau']['bits_per_sample'] / 8)); + $info['audio']['bitrate'] = ($info['rkau']['compressed_bytes'] * 8) / $info['playtime_seconds']; + + return true; + + } + + + public function RKAUqualityLookup(&$RKAUdata) { + $level = ($RKAUdata['raw']['quality'] & 0xF0) >> 4; + $quality = $RKAUdata['raw']['quality'] & 0x0F; + + $RKAUdata['lossless'] = (($quality == 0) ? true : false); + $RKAUdata['compression_level'] = $level + 1; + if (!$RKAUdata['lossless']) { + $RKAUdata['quality_setting'] = $quality; + } + + return true; + } + +} diff --git a/www/rompr/getid3/module.audio.shorten.php b/www/rompr/getid3/module.audio.shorten.php new file mode 100644 index 0000000..8d5c5d4 --- /dev/null +++ b/www/rompr/getid3/module.audio.shorten.php @@ -0,0 +1,182 @@ + // +// available at http://getid3.sourceforge.net // +// or http://www.getid3.org // +// also https://github.com/JamesHeinrich/getID3 // +///////////////////////////////////////////////////////////////// +// See readme.txt for more details // +///////////////////////////////////////////////////////////////// +// // +// module.audio.shorten.php // +// module for analyzing Shorten Audio files // +// dependencies: NONE // +// /// +///////////////////////////////////////////////////////////////// + + +class getid3_shorten extends getid3_handler +{ + + public function Analyze() { + $info = &$this->getid3->info; + + $this->fseek($info['avdataoffset']); + + $ShortenHeader = $this->fread(8); + $magic = 'ajkg'; + if (substr($ShortenHeader, 0, 4) != $magic) { + $this->error('Expecting "'.getid3_lib::PrintHexBytes($magic).'" at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes(substr($ShortenHeader, 0, 4)).'"'); + return false; + } + $info['fileformat'] = 'shn'; + $info['audio']['dataformat'] = 'shn'; + $info['audio']['lossless'] = true; + $info['audio']['bitrate_mode'] = 'vbr'; + + $info['shn']['version'] = getid3_lib::LittleEndian2Int(substr($ShortenHeader, 4, 1)); + + $this->fseek($info['avdataend'] - 12); + $SeekTableSignatureTest = $this->fread(12); + $info['shn']['seektable']['present'] = (bool) (substr($SeekTableSignatureTest, 4, 8) == 'SHNAMPSK'); + if ($info['shn']['seektable']['present']) { + $info['shn']['seektable']['length'] = getid3_lib::LittleEndian2Int(substr($SeekTableSignatureTest, 0, 4)); + $info['shn']['seektable']['offset'] = $info['avdataend'] - $info['shn']['seektable']['length']; + $this->fseek($info['shn']['seektable']['offset']); + $SeekTableMagic = $this->fread(4); + $magic = 'SEEK'; + if ($SeekTableMagic != $magic) { + + $this->error('Expecting "'.getid3_lib::PrintHexBytes($magic).'" at offset '.$info['shn']['seektable']['offset'].', found "'.getid3_lib::PrintHexBytes($SeekTableMagic).'"'); + return false; + + } else { + + // typedef struct tag_TSeekEntry + // { + // unsigned long SampleNumber; + // unsigned long SHNFileByteOffset; + // unsigned long SHNLastBufferReadPosition; + // unsigned short SHNByteGet; + // unsigned short SHNBufferOffset; + // unsigned short SHNFileBitOffset; + // unsigned long SHNGBuffer; + // unsigned short SHNBitShift; + // long CBuf0[3]; + // long CBuf1[3]; + // long Offset0[4]; + // long Offset1[4]; + // }TSeekEntry; + + $SeekTableData = $this->fread($info['shn']['seektable']['length'] - 16); + $info['shn']['seektable']['entry_count'] = floor(strlen($SeekTableData) / 80); + //$info['shn']['seektable']['entries'] = array(); + //$SeekTableOffset = 0; + //for ($i = 0; $i < $info['shn']['seektable']['entry_count']; $i++) { + // $SeekTableEntry['sample_number'] = getid3_lib::LittleEndian2Int(substr($SeekTableData, $SeekTableOffset, 4)); + // $SeekTableOffset += 4; + // $SeekTableEntry['shn_file_byte_offset'] = getid3_lib::LittleEndian2Int(substr($SeekTableData, $SeekTableOffset, 4)); + // $SeekTableOffset += 4; + // $SeekTableEntry['shn_last_buffer_read_position'] = getid3_lib::LittleEndian2Int(substr($SeekTableData, $SeekTableOffset, 4)); + // $SeekTableOffset += 4; + // $SeekTableEntry['shn_byte_get'] = getid3_lib::LittleEndian2Int(substr($SeekTableData, $SeekTableOffset, 2)); + // $SeekTableOffset += 2; + // $SeekTableEntry['shn_buffer_offset'] = getid3_lib::LittleEndian2Int(substr($SeekTableData, $SeekTableOffset, 2)); + // $SeekTableOffset += 2; + // $SeekTableEntry['shn_file_bit_offset'] = getid3_lib::LittleEndian2Int(substr($SeekTableData, $SeekTableOffset, 2)); + // $SeekTableOffset += 2; + // $SeekTableEntry['shn_gbuffer'] = getid3_lib::LittleEndian2Int(substr($SeekTableData, $SeekTableOffset, 4)); + // $SeekTableOffset += 4; + // $SeekTableEntry['shn_bit_shift'] = getid3_lib::LittleEndian2Int(substr($SeekTableData, $SeekTableOffset, 2)); + // $SeekTableOffset += 2; + // for ($j = 0; $j < 3; $j++) { + // $SeekTableEntry['cbuf0'][$j] = getid3_lib::LittleEndian2Int(substr($SeekTableData, $SeekTableOffset, 4)); + // $SeekTableOffset += 4; + // } + // for ($j = 0; $j < 3; $j++) { + // $SeekTableEntry['cbuf1'][$j] = getid3_lib::LittleEndian2Int(substr($SeekTableData, $SeekTableOffset, 4)); + // $SeekTableOffset += 4; + // } + // for ($j = 0; $j < 4; $j++) { + // $SeekTableEntry['offset0'][$j] = getid3_lib::LittleEndian2Int(substr($SeekTableData, $SeekTableOffset, 4)); + // $SeekTableOffset += 4; + // } + // for ($j = 0; $j < 4; $j++) { + // $SeekTableEntry['offset1'][$j] = getid3_lib::LittleEndian2Int(substr($SeekTableData, $SeekTableOffset, 4)); + // $SeekTableOffset += 4; + // } + // + // $info['shn']['seektable']['entries'][] = $SeekTableEntry; + //} + + } + + } + + if (preg_match('#(1|ON)#i', ini_get('safe_mode'))) { + $this->error('PHP running in Safe Mode - backtick operator not available, cannot run shntool to analyze Shorten files'); + return false; + } + + if (GETID3_OS_ISWINDOWS) { + + $RequiredFiles = array('shorten.exe', 'cygwin1.dll', 'head.exe'); + foreach ($RequiredFiles as $required_file) { + if (!is_readable(GETID3_HELPERAPPSDIR.$required_file)) { + $this->error(GETID3_HELPERAPPSDIR.$required_file.' does not exist'); + return false; + } + } + $commandline = GETID3_HELPERAPPSDIR.'shorten.exe -x "'.$info['filenamepath'].'" - | '.GETID3_HELPERAPPSDIR.'head.exe -c 64'; + $commandline = str_replace('/', '\\', $commandline); + + } else { + + static $shorten_present; + if (!isset($shorten_present)) { + $shorten_present = file_exists('/usr/local/bin/shorten') || `which shorten`; + } + if (!$shorten_present) { + $this->error('shorten binary was not found in path or /usr/local/bin'); + return false; + } + $commandline = (file_exists('/usr/local/bin/shorten') ? '/usr/local/bin/' : '' ) . 'shorten -x '.escapeshellarg($info['filenamepath']).' - | head -c 64'; + + } + + $output = `$commandline`; + + if (!empty($output) && (substr($output, 12, 4) == 'fmt ')) { + + getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio-video.riff.php', __FILE__, true); + + $fmt_size = getid3_lib::LittleEndian2Int(substr($output, 16, 4)); + $DecodedWAVFORMATEX = getid3_riff::parseWAVEFORMATex(substr($output, 20, $fmt_size)); + $info['audio']['channels'] = $DecodedWAVFORMATEX['channels']; + $info['audio']['bits_per_sample'] = $DecodedWAVFORMATEX['bits_per_sample']; + $info['audio']['sample_rate'] = $DecodedWAVFORMATEX['sample_rate']; + + if (substr($output, 20 + $fmt_size, 4) == 'data') { + + $info['playtime_seconds'] = getid3_lib::LittleEndian2Int(substr($output, 20 + 4 + $fmt_size, 4)) / $DecodedWAVFORMATEX['raw']['nAvgBytesPerSec']; + + } else { + + $this->error('shorten failed to decode DATA chunk to expected location, cannot determine playtime'); + return false; + + } + + $info['audio']['bitrate'] = (($info['avdataend'] - $info['avdataoffset']) / $info['playtime_seconds']) * 8; + + } else { + + $this->error('shorten failed to decode file to WAV for parsing'); + return false; + + } + + return true; + } + +} diff --git a/www/rompr/getid3/module.audio.tta.php b/www/rompr/getid3/module.audio.tta.php new file mode 100644 index 0000000..78d27b0 --- /dev/null +++ b/www/rompr/getid3/module.audio.tta.php @@ -0,0 +1,107 @@ + // +// available at http://getid3.sourceforge.net // +// or http://www.getid3.org // +// also https://github.com/JamesHeinrich/getID3 // +///////////////////////////////////////////////////////////////// +// See readme.txt for more details // +///////////////////////////////////////////////////////////////// +// // +// module.audio.tta.php // +// module for analyzing TTA Audio files // +// dependencies: NONE // +// /// +///////////////////////////////////////////////////////////////// + + +class getid3_tta extends getid3_handler +{ + + public function Analyze() { + $info = &$this->getid3->info; + + $info['fileformat'] = 'tta'; + $info['audio']['dataformat'] = 'tta'; + $info['audio']['lossless'] = true; + $info['audio']['bitrate_mode'] = 'vbr'; + + $this->fseek($info['avdataoffset']); + $ttaheader = $this->fread(26); + + $info['tta']['magic'] = substr($ttaheader, 0, 3); + $magic = 'TTA'; + if ($info['tta']['magic'] != $magic) { + $this->error('Expecting "'.getid3_lib::PrintHexBytes($magic).'" at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes($info['tta']['magic']).'"'); + unset($info['fileformat']); + unset($info['audio']); + unset($info['tta']); + return false; + } + + switch ($ttaheader{3}) { + case "\x01": // TTA v1.x + case "\x02": // TTA v1.x + case "\x03": // TTA v1.x + // "It was the demo-version of the TTA encoder. There is no released format with such header. TTA encoder v1 is not supported about a year." + $info['tta']['major_version'] = 1; + $info['avdataoffset'] += 16; + + $info['tta']['compression_level'] = ord($ttaheader{3}); + $info['tta']['channels'] = getid3_lib::LittleEndian2Int(substr($ttaheader, 4, 2)); + $info['tta']['bits_per_sample'] = getid3_lib::LittleEndian2Int(substr($ttaheader, 6, 2)); + $info['tta']['sample_rate'] = getid3_lib::LittleEndian2Int(substr($ttaheader, 8, 4)); + $info['tta']['samples_per_channel'] = getid3_lib::LittleEndian2Int(substr($ttaheader, 12, 4)); + + $info['audio']['encoder_options'] = '-e'.$info['tta']['compression_level']; + $info['playtime_seconds'] = $info['tta']['samples_per_channel'] / $info['tta']['sample_rate']; + break; + + case '2': // TTA v2.x + // "I have hurried to release the TTA 2.0 encoder. Format documentation is removed from our site. This format still in development. Please wait the TTA2 format, encoder v4." + $info['tta']['major_version'] = 2; + $info['avdataoffset'] += 20; + + $info['tta']['compression_level'] = getid3_lib::LittleEndian2Int(substr($ttaheader, 4, 2)); + $info['tta']['audio_format'] = getid3_lib::LittleEndian2Int(substr($ttaheader, 6, 2)); + $info['tta']['channels'] = getid3_lib::LittleEndian2Int(substr($ttaheader, 8, 2)); + $info['tta']['bits_per_sample'] = getid3_lib::LittleEndian2Int(substr($ttaheader, 10, 2)); + $info['tta']['sample_rate'] = getid3_lib::LittleEndian2Int(substr($ttaheader, 12, 4)); + $info['tta']['data_length'] = getid3_lib::LittleEndian2Int(substr($ttaheader, 16, 4)); + + $info['audio']['encoder_options'] = '-e'.$info['tta']['compression_level']; + $info['playtime_seconds'] = $info['tta']['data_length'] / $info['tta']['sample_rate']; + break; + + case '1': // TTA v3.x + // "This is a first stable release of the TTA format. It will be supported by the encoders v3 or higher." + $info['tta']['major_version'] = 3; + $info['avdataoffset'] += 26; + + $info['tta']['audio_format'] = getid3_lib::LittleEndian2Int(substr($ttaheader, 4, 2)); // getid3_riff::wFormatTagLookup() + $info['tta']['channels'] = getid3_lib::LittleEndian2Int(substr($ttaheader, 6, 2)); + $info['tta']['bits_per_sample'] = getid3_lib::LittleEndian2Int(substr($ttaheader, 8, 2)); + $info['tta']['sample_rate'] = getid3_lib::LittleEndian2Int(substr($ttaheader, 10, 4)); + $info['tta']['data_length'] = getid3_lib::LittleEndian2Int(substr($ttaheader, 14, 4)); + $info['tta']['crc32_footer'] = substr($ttaheader, 18, 4); + $info['tta']['seek_point'] = getid3_lib::LittleEndian2Int(substr($ttaheader, 22, 4)); + + $info['playtime_seconds'] = $info['tta']['data_length'] / $info['tta']['sample_rate']; + break; + + default: + $this->error('This version of getID3() ['.$this->getid3->version().'] only knows how to handle TTA v1 and v2 - it may not work correctly with this file which appears to be TTA v'.$ttaheader{3}); + return false; + break; + } + + $info['audio']['encoder'] = 'TTA v'.$info['tta']['major_version']; + $info['audio']['bits_per_sample'] = $info['tta']['bits_per_sample']; + $info['audio']['sample_rate'] = $info['tta']['sample_rate']; + $info['audio']['channels'] = $info['tta']['channels']; + $info['audio']['bitrate'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / $info['playtime_seconds']; + + return true; + } + +} diff --git a/www/rompr/getid3/module.audio.voc.php b/www/rompr/getid3/module.audio.voc.php new file mode 100644 index 0000000..3803d8a --- /dev/null +++ b/www/rompr/getid3/module.audio.voc.php @@ -0,0 +1,205 @@ + // +// available at http://getid3.sourceforge.net // +// or http://www.getid3.org // +// also https://github.com/JamesHeinrich/getID3 // +///////////////////////////////////////////////////////////////// +// See readme.txt for more details // +///////////////////////////////////////////////////////////////// +// // +// module.audio.voc.php // +// module for analyzing Creative VOC Audio files // +// dependencies: NONE // +// /// +///////////////////////////////////////////////////////////////// + + +class getid3_voc extends getid3_handler +{ + + public function Analyze() { + $info = &$this->getid3->info; + + $OriginalAVdataOffset = $info['avdataoffset']; + $this->fseek($info['avdataoffset']); + $VOCheader = $this->fread(26); + + $magic = 'Creative Voice File'; + if (substr($VOCheader, 0, 19) != $magic) { + $this->error('Expecting "'.getid3_lib::PrintHexBytes($magic).'" at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes(substr($VOCheader, 0, 19)).'"'); + return false; + } + + // shortcuts + $thisfile_audio = &$info['audio']; + $info['voc'] = array(); + $thisfile_voc = &$info['voc']; + + $info['fileformat'] = 'voc'; + $thisfile_audio['dataformat'] = 'voc'; + $thisfile_audio['bitrate_mode'] = 'cbr'; + $thisfile_audio['lossless'] = true; + $thisfile_audio['channels'] = 1; // might be overriden below + $thisfile_audio['bits_per_sample'] = 8; // might be overriden below + + // byte # Description + // ------ ------------------------------------------ + // 00-12 'Creative Voice File' + // 13 1A (eof to abort printing of file) + // 14-15 Offset of first datablock in .voc file (std 1A 00 in Intel Notation) + // 16-17 Version number (minor,major) (VOC-HDR puts 0A 01) + // 18-19 2's Comp of Ver. # + 1234h (VOC-HDR puts 29 11) + + $thisfile_voc['header']['datablock_offset'] = getid3_lib::LittleEndian2Int(substr($VOCheader, 20, 2)); + $thisfile_voc['header']['minor_version'] = getid3_lib::LittleEndian2Int(substr($VOCheader, 22, 1)); + $thisfile_voc['header']['major_version'] = getid3_lib::LittleEndian2Int(substr($VOCheader, 23, 1)); + + do { + + $BlockOffset = $this->ftell(); + $BlockData = $this->fread(4); + $BlockType = ord($BlockData{0}); + $BlockSize = getid3_lib::LittleEndian2Int(substr($BlockData, 1, 3)); + $ThisBlock = array(); + + getid3_lib::safe_inc($thisfile_voc['blocktypes'][$BlockType], 1); + switch ($BlockType) { + case 0: // Terminator + // do nothing, we'll break out of the loop down below + break; + + case 1: // Sound data + $BlockData .= $this->fread(2); + if ($info['avdataoffset'] <= $OriginalAVdataOffset) { + $info['avdataoffset'] = $this->ftell(); + } + $this->fseek($BlockSize - 2, SEEK_CUR); + + $ThisBlock['sample_rate_id'] = getid3_lib::LittleEndian2Int(substr($BlockData, 4, 1)); + $ThisBlock['compression_type'] = getid3_lib::LittleEndian2Int(substr($BlockData, 5, 1)); + + $ThisBlock['compression_name'] = $this->VOCcompressionTypeLookup($ThisBlock['compression_type']); + if ($ThisBlock['compression_type'] <= 3) { + $thisfile_voc['compressed_bits_per_sample'] = getid3_lib::CastAsInt(str_replace('-bit', '', $ThisBlock['compression_name'])); + } + + // Less accurate sample_rate calculation than the Extended block (#8) data (but better than nothing if Extended Block is not available) + if (empty($thisfile_audio['sample_rate'])) { + // SR byte = 256 - (1000000 / sample_rate) + $thisfile_audio['sample_rate'] = getid3_lib::trunc((1000000 / (256 - $ThisBlock['sample_rate_id'])) / $thisfile_audio['channels']); + } + break; + + case 2: // Sound continue + case 3: // Silence + case 4: // Marker + case 6: // Repeat + case 7: // End repeat + // nothing useful, just skip + $this->fseek($BlockSize, SEEK_CUR); + break; + + case 8: // Extended + $BlockData .= $this->fread(4); + + //00-01 Time Constant: + // Mono: 65536 - (256000000 / sample_rate) + // Stereo: 65536 - (256000000 / (sample_rate * 2)) + $ThisBlock['time_constant'] = getid3_lib::LittleEndian2Int(substr($BlockData, 4, 2)); + $ThisBlock['pack_method'] = getid3_lib::LittleEndian2Int(substr($BlockData, 6, 1)); + $ThisBlock['stereo'] = (bool) getid3_lib::LittleEndian2Int(substr($BlockData, 7, 1)); + + $thisfile_audio['channels'] = ($ThisBlock['stereo'] ? 2 : 1); + $thisfile_audio['sample_rate'] = getid3_lib::trunc((256000000 / (65536 - $ThisBlock['time_constant'])) / $thisfile_audio['channels']); + break; + + case 9: // data block that supersedes blocks 1 and 8. Used for stereo, 16 bit + $BlockData .= $this->fread(12); + if ($info['avdataoffset'] <= $OriginalAVdataOffset) { + $info['avdataoffset'] = $this->ftell(); + } + $this->fseek($BlockSize - 12, SEEK_CUR); + + $ThisBlock['sample_rate'] = getid3_lib::LittleEndian2Int(substr($BlockData, 4, 4)); + $ThisBlock['bits_per_sample'] = getid3_lib::LittleEndian2Int(substr($BlockData, 8, 1)); + $ThisBlock['channels'] = getid3_lib::LittleEndian2Int(substr($BlockData, 9, 1)); + $ThisBlock['wFormat'] = getid3_lib::LittleEndian2Int(substr($BlockData, 10, 2)); + + $ThisBlock['compression_name'] = $this->VOCwFormatLookup($ThisBlock['wFormat']); + if ($this->VOCwFormatActualBitsPerSampleLookup($ThisBlock['wFormat'])) { + $thisfile_voc['compressed_bits_per_sample'] = $this->VOCwFormatActualBitsPerSampleLookup($ThisBlock['wFormat']); + } + + $thisfile_audio['sample_rate'] = $ThisBlock['sample_rate']; + $thisfile_audio['bits_per_sample'] = $ThisBlock['bits_per_sample']; + $thisfile_audio['channels'] = $ThisBlock['channels']; + break; + + default: + $this->warning('Unhandled block type "'.$BlockType.'" at offset '.$BlockOffset); + $this->fseek($BlockSize, SEEK_CUR); + break; + } + + if (!empty($ThisBlock)) { + $ThisBlock['block_offset'] = $BlockOffset; + $ThisBlock['block_size'] = $BlockSize; + $ThisBlock['block_type_id'] = $BlockType; + $thisfile_voc['blocks'][] = $ThisBlock; + } + + } while (!feof($this->getid3->fp) && ($BlockType != 0)); + + // Terminator block doesn't have size field, so seek back 3 spaces + $this->fseek(-3, SEEK_CUR); + + ksort($thisfile_voc['blocktypes']); + + if (!empty($thisfile_voc['compressed_bits_per_sample'])) { + $info['playtime_seconds'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / ($thisfile_voc['compressed_bits_per_sample'] * $thisfile_audio['channels'] * $thisfile_audio['sample_rate']); + $thisfile_audio['bitrate'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / $info['playtime_seconds']; + } + + return true; + } + + public function VOCcompressionTypeLookup($index) { + static $VOCcompressionTypeLookup = array( + 0 => '8-bit', + 1 => '4-bit', + 2 => '2.6-bit', + 3 => '2-bit' + ); + return (isset($VOCcompressionTypeLookup[$index]) ? $VOCcompressionTypeLookup[$index] : 'Multi DAC ('.($index - 3).') channels'); + } + + public function VOCwFormatLookup($index) { + static $VOCwFormatLookup = array( + 0x0000 => '8-bit unsigned PCM', + 0x0001 => 'Creative 8-bit to 4-bit ADPCM', + 0x0002 => 'Creative 8-bit to 3-bit ADPCM', + 0x0003 => 'Creative 8-bit to 2-bit ADPCM', + 0x0004 => '16-bit signed PCM', + 0x0006 => 'CCITT a-Law', + 0x0007 => 'CCITT u-Law', + 0x2000 => 'Creative 16-bit to 4-bit ADPCM' + ); + return (isset($VOCwFormatLookup[$index]) ? $VOCwFormatLookup[$index] : false); + } + + public function VOCwFormatActualBitsPerSampleLookup($index) { + static $VOCwFormatLookup = array( + 0x0000 => 8, + 0x0001 => 4, + 0x0002 => 3, + 0x0003 => 2, + 0x0004 => 16, + 0x0006 => 8, + 0x0007 => 8, + 0x2000 => 4 + ); + return (isset($VOCwFormatLookup[$index]) ? $VOCwFormatLookup[$index] : false); + } + +} diff --git a/www/rompr/getid3/module.audio.vqf.php b/www/rompr/getid3/module.audio.vqf.php new file mode 100644 index 0000000..a6a391c --- /dev/null +++ b/www/rompr/getid3/module.audio.vqf.php @@ -0,0 +1,160 @@ + // +// available at http://getid3.sourceforge.net // +// or http://www.getid3.org // +// also https://github.com/JamesHeinrich/getID3 // +///////////////////////////////////////////////////////////////// +// See readme.txt for more details // +///////////////////////////////////////////////////////////////// +// // +// module.audio.vqf.php // +// module for analyzing VQF audio files // +// dependencies: NONE // +// /// +///////////////////////////////////////////////////////////////// + + +class getid3_vqf extends getid3_handler +{ + public function Analyze() { + $info = &$this->getid3->info; + + // based loosely on code from TTwinVQ by Jurgen Faul + // http://jfaul.de/atl or http://j-faul.virtualave.net/atl/atl.html + + $info['fileformat'] = 'vqf'; + $info['audio']['dataformat'] = 'vqf'; + $info['audio']['bitrate_mode'] = 'cbr'; + $info['audio']['lossless'] = false; + + // shortcut + $info['vqf']['raw'] = array(); + $thisfile_vqf = &$info['vqf']; + $thisfile_vqf_raw = &$thisfile_vqf['raw']; + + $this->fseek($info['avdataoffset']); + $VQFheaderData = $this->fread(16); + + $offset = 0; + $thisfile_vqf_raw['header_tag'] = substr($VQFheaderData, $offset, 4); + $magic = 'TWIN'; + if ($thisfile_vqf_raw['header_tag'] != $magic) { + $this->error('Expecting "'.getid3_lib::PrintHexBytes($magic).'" at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes($thisfile_vqf_raw['header_tag']).'"'); + unset($info['vqf']); + unset($info['fileformat']); + return false; + } + $offset += 4; + $thisfile_vqf_raw['version'] = substr($VQFheaderData, $offset, 8); + $offset += 8; + $thisfile_vqf_raw['size'] = getid3_lib::BigEndian2Int(substr($VQFheaderData, $offset, 4)); + $offset += 4; + + while ($this->ftell() < $info['avdataend']) { + + $ChunkBaseOffset = $this->ftell(); + $chunkoffset = 0; + $ChunkData = $this->fread(8); + $ChunkName = substr($ChunkData, $chunkoffset, 4); + if ($ChunkName == 'DATA') { + $info['avdataoffset'] = $ChunkBaseOffset; + break; + } + $chunkoffset += 4; + $ChunkSize = getid3_lib::BigEndian2Int(substr($ChunkData, $chunkoffset, 4)); + $chunkoffset += 4; + if ($ChunkSize > ($info['avdataend'] - $this->ftell())) { + $this->error('Invalid chunk size ('.$ChunkSize.') for chunk "'.$ChunkName.'" at offset '.$ChunkBaseOffset); + break; + } + if ($ChunkSize > 0) { + $ChunkData .= $this->fread($ChunkSize); + } + + switch ($ChunkName) { + case 'COMM': + // shortcut + $thisfile_vqf['COMM'] = array(); + $thisfile_vqf_COMM = &$thisfile_vqf['COMM']; + + $thisfile_vqf_COMM['channel_mode'] = getid3_lib::BigEndian2Int(substr($ChunkData, $chunkoffset, 4)); + $chunkoffset += 4; + $thisfile_vqf_COMM['bitrate'] = getid3_lib::BigEndian2Int(substr($ChunkData, $chunkoffset, 4)); + $chunkoffset += 4; + $thisfile_vqf_COMM['sample_rate'] = getid3_lib::BigEndian2Int(substr($ChunkData, $chunkoffset, 4)); + $chunkoffset += 4; + $thisfile_vqf_COMM['security_level'] = getid3_lib::BigEndian2Int(substr($ChunkData, $chunkoffset, 4)); + $chunkoffset += 4; + + $info['audio']['channels'] = $thisfile_vqf_COMM['channel_mode'] + 1; + $info['audio']['sample_rate'] = $this->VQFchannelFrequencyLookup($thisfile_vqf_COMM['sample_rate']); + $info['audio']['bitrate'] = $thisfile_vqf_COMM['bitrate'] * 1000; + $info['audio']['encoder_options'] = 'CBR' . ceil($info['audio']['bitrate']/1000); + + if ($info['audio']['bitrate'] == 0) { + $this->error('Corrupt VQF file: bitrate_audio == zero'); + return false; + } + break; + + case 'NAME': + case 'AUTH': + case '(c) ': + case 'FILE': + case 'COMT': + case 'ALBM': + $thisfile_vqf['comments'][$this->VQFcommentNiceNameLookup($ChunkName)][] = trim(substr($ChunkData, 8)); + break; + + case 'DSIZ': + $thisfile_vqf['DSIZ'] = getid3_lib::BigEndian2Int(substr($ChunkData, 8, 4)); + break; + + default: + $this->warning('Unhandled chunk type "'.$ChunkName.'" at offset '.$ChunkBaseOffset); + break; + } + } + + $info['playtime_seconds'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / $info['audio']['bitrate']; + + if (isset($thisfile_vqf['DSIZ']) && (($thisfile_vqf['DSIZ'] != ($info['avdataend'] - $info['avdataoffset'] - strlen('DATA'))))) { + switch ($thisfile_vqf['DSIZ']) { + case 0: + case 1: + $this->warning('Invalid DSIZ value "'.$thisfile_vqf['DSIZ'].'". This is known to happen with VQF files encoded by Ahead Nero, and seems to be its way of saying this is TwinVQF v'.($thisfile_vqf['DSIZ'] + 1).'.0'); + $info['audio']['encoder'] = 'Ahead Nero'; + break; + + default: + $this->warning('Probable corrupted file - should be '.$thisfile_vqf['DSIZ'].' bytes, actually '.($info['avdataend'] - $info['avdataoffset'] - strlen('DATA'))); + break; + } + } + + return true; + } + + public function VQFchannelFrequencyLookup($frequencyid) { + static $VQFchannelFrequencyLookup = array( + 11 => 11025, + 22 => 22050, + 44 => 44100 + ); + return (isset($VQFchannelFrequencyLookup[$frequencyid]) ? $VQFchannelFrequencyLookup[$frequencyid] : $frequencyid * 1000); + } + + public function VQFcommentNiceNameLookup($shortname) { + static $VQFcommentNiceNameLookup = array( + 'NAME' => 'title', + 'AUTH' => 'artist', + '(c) ' => 'copyright', + 'FILE' => 'filename', + 'COMT' => 'comment', + 'ALBM' => 'album' + ); + return (isset($VQFcommentNiceNameLookup[$shortname]) ? $VQFcommentNiceNameLookup[$shortname] : $shortname); + } + +} diff --git a/www/rompr/getid3/module.audio.wavpack.php b/www/rompr/getid3/module.audio.wavpack.php new file mode 100644 index 0000000..b54c179 --- /dev/null +++ b/www/rompr/getid3/module.audio.wavpack.php @@ -0,0 +1,398 @@ + // +// available at http://getid3.sourceforge.net // +// or http://www.getid3.org // +// also https://github.com/JamesHeinrich/getID3 // +///////////////////////////////////////////////////////////////// +// See readme.txt for more details // +///////////////////////////////////////////////////////////////// +// // +// module.audio.wavpack.php // +// module for analyzing WavPack v4.0+ Audio files // +// dependencies: NONE // +// /// +///////////////////////////////////////////////////////////////// + + +class getid3_wavpack extends getid3_handler +{ + + public function Analyze() { + $info = &$this->getid3->info; + + $this->fseek($info['avdataoffset']); + + while (true) { + + $wavpackheader = $this->fread(32); + + if ($this->ftell() >= $info['avdataend']) { + break; + } elseif (feof($this->getid3->fp)) { + break; + } elseif ( + isset($info['wavpack']['blockheader']['total_samples']) && + isset($info['wavpack']['blockheader']['block_samples']) && + ($info['wavpack']['blockheader']['total_samples'] > 0) && + ($info['wavpack']['blockheader']['block_samples'] > 0) && + (!isset($info['wavpack']['riff_trailer_size']) || ($info['wavpack']['riff_trailer_size'] <= 0)) && + ((isset($info['wavpack']['config_flags']['md5_checksum']) && ($info['wavpack']['config_flags']['md5_checksum'] === false)) || !empty($info['md5_data_source']))) { + break; + } + + $blockheader_offset = $this->ftell() - 32; + $blockheader_magic = substr($wavpackheader, 0, 4); + $blockheader_size = getid3_lib::LittleEndian2Int(substr($wavpackheader, 4, 4)); + + $magic = 'wvpk'; + if ($blockheader_magic != $magic) { + $this->error('Expecting "'.getid3_lib::PrintHexBytes($magic).'" at offset '.$blockheader_offset.', found "'.getid3_lib::PrintHexBytes($blockheader_magic).'"'); + switch (isset($info['audio']['dataformat']) ? $info['audio']['dataformat'] : '') { + case 'wavpack': + case 'wvc': + break; + default: + unset($info['fileformat']); + unset($info['audio']); + unset($info['wavpack']); + break; + } + return false; + } + + if (empty($info['wavpack']['blockheader']['block_samples']) || + empty($info['wavpack']['blockheader']['total_samples']) || + ($info['wavpack']['blockheader']['block_samples'] <= 0) || + ($info['wavpack']['blockheader']['total_samples'] <= 0)) { + // Also, it is possible that the first block might not have + // any samples (block_samples == 0) and in this case you should skip blocks + // until you find one with samples because the other information (like + // total_samples) are not guaranteed to be correct until (block_samples > 0) + + // Finally, I have defined a format for files in which the length is not known + // (for example when raw files are created using pipes). In these cases + // total_samples will be -1 and you must seek to the final block to determine + // the total number of samples. + + + $info['audio']['dataformat'] = 'wavpack'; + $info['fileformat'] = 'wavpack'; + $info['audio']['lossless'] = true; + $info['audio']['bitrate_mode'] = 'vbr'; + + $info['wavpack']['blockheader']['offset'] = $blockheader_offset; + $info['wavpack']['blockheader']['magic'] = $blockheader_magic; + $info['wavpack']['blockheader']['size'] = $blockheader_size; + + if ($info['wavpack']['blockheader']['size'] >= 0x100000) { + $this->error('Expecting WavPack block size less than "0x100000", found "'.$info['wavpack']['blockheader']['size'].'" at offset '.$info['wavpack']['blockheader']['offset']); + switch (isset($info['audio']['dataformat']) ? $info['audio']['dataformat'] : '') { + case 'wavpack': + case 'wvc': + break; + default: + unset($info['fileformat']); + unset($info['audio']); + unset($info['wavpack']); + break; + } + return false; + } + + $info['wavpack']['blockheader']['minor_version'] = ord($wavpackheader{8}); + $info['wavpack']['blockheader']['major_version'] = ord($wavpackheader{9}); + + if (($info['wavpack']['blockheader']['major_version'] != 4) || + (($info['wavpack']['blockheader']['minor_version'] < 4) && + ($info['wavpack']['blockheader']['minor_version'] > 16))) { + $this->error('Expecting WavPack version between "4.2" and "4.16", found version "'.$info['wavpack']['blockheader']['major_version'].'.'.$info['wavpack']['blockheader']['minor_version'].'" at offset '.$info['wavpack']['blockheader']['offset']); + switch (isset($info['audio']['dataformat']) ? $info['audio']['dataformat'] : '') { + case 'wavpack': + case 'wvc': + break; + default: + unset($info['fileformat']); + unset($info['audio']); + unset($info['wavpack']); + break; + } + return false; + } + + $info['wavpack']['blockheader']['track_number'] = ord($wavpackheader{10}); // unused + $info['wavpack']['blockheader']['index_number'] = ord($wavpackheader{11}); // unused + $info['wavpack']['blockheader']['total_samples'] = getid3_lib::LittleEndian2Int(substr($wavpackheader, 12, 4)); + $info['wavpack']['blockheader']['block_index'] = getid3_lib::LittleEndian2Int(substr($wavpackheader, 16, 4)); + $info['wavpack']['blockheader']['block_samples'] = getid3_lib::LittleEndian2Int(substr($wavpackheader, 20, 4)); + $info['wavpack']['blockheader']['flags_raw'] = getid3_lib::LittleEndian2Int(substr($wavpackheader, 24, 4)); + $info['wavpack']['blockheader']['crc'] = getid3_lib::LittleEndian2Int(substr($wavpackheader, 28, 4)); + + $info['wavpack']['blockheader']['flags']['bytes_per_sample'] = 1 + ($info['wavpack']['blockheader']['flags_raw'] & 0x00000003); + $info['wavpack']['blockheader']['flags']['mono'] = (bool) ($info['wavpack']['blockheader']['flags_raw'] & 0x00000004); + $info['wavpack']['blockheader']['flags']['hybrid'] = (bool) ($info['wavpack']['blockheader']['flags_raw'] & 0x00000008); + $info['wavpack']['blockheader']['flags']['joint_stereo'] = (bool) ($info['wavpack']['blockheader']['flags_raw'] & 0x00000010); + $info['wavpack']['blockheader']['flags']['cross_decorrelation'] = (bool) ($info['wavpack']['blockheader']['flags_raw'] & 0x00000020); + $info['wavpack']['blockheader']['flags']['hybrid_noiseshape'] = (bool) ($info['wavpack']['blockheader']['flags_raw'] & 0x00000040); + $info['wavpack']['blockheader']['flags']['ieee_32bit_float'] = (bool) ($info['wavpack']['blockheader']['flags_raw'] & 0x00000080); + $info['wavpack']['blockheader']['flags']['int_32bit'] = (bool) ($info['wavpack']['blockheader']['flags_raw'] & 0x00000100); + $info['wavpack']['blockheader']['flags']['hybrid_bitrate_noise'] = (bool) ($info['wavpack']['blockheader']['flags_raw'] & 0x00000200); + $info['wavpack']['blockheader']['flags']['hybrid_balance_noise'] = (bool) ($info['wavpack']['blockheader']['flags_raw'] & 0x00000400); + $info['wavpack']['blockheader']['flags']['multichannel_initial'] = (bool) ($info['wavpack']['blockheader']['flags_raw'] & 0x00000800); + $info['wavpack']['blockheader']['flags']['multichannel_final'] = (bool) ($info['wavpack']['blockheader']['flags_raw'] & 0x00001000); + + $info['audio']['lossless'] = !$info['wavpack']['blockheader']['flags']['hybrid']; + } + + while (!feof($this->getid3->fp) && ($this->ftell() < ($blockheader_offset + $blockheader_size + 8))) { + + $metablock = array('offset'=>$this->ftell()); + $metablockheader = $this->fread(2); + if (feof($this->getid3->fp)) { + break; + } + $metablock['id'] = ord($metablockheader{0}); + $metablock['function_id'] = ($metablock['id'] & 0x3F); + $metablock['function_name'] = $this->WavPackMetablockNameLookup($metablock['function_id']); + + // The 0x20 bit in the id of the meta subblocks (which is defined as + // ID_OPTIONAL_DATA) is a permanent part of the id. The idea is that + // if a decoder encounters an id that it does not know about, it uses + // that "ID_OPTIONAL_DATA" flag to determine what to do. If it is set + // then the decoder simply ignores the metadata, but if it is zero + // then the decoder should quit because it means that an understanding + // of the metadata is required to correctly decode the audio. + $metablock['non_decoder'] = (bool) ($metablock['id'] & 0x20); + + $metablock['padded_data'] = (bool) ($metablock['id'] & 0x40); + $metablock['large_block'] = (bool) ($metablock['id'] & 0x80); + if ($metablock['large_block']) { + $metablockheader .= $this->fread(2); + } + $metablock['size'] = getid3_lib::LittleEndian2Int(substr($metablockheader, 1)) * 2; // size is stored in words + $metablock['data'] = null; + + if ($metablock['size'] > 0) { + + switch ($metablock['function_id']) { + case 0x21: // ID_RIFF_HEADER + case 0x22: // ID_RIFF_TRAILER + case 0x23: // ID_REPLAY_GAIN + case 0x24: // ID_CUESHEET + case 0x25: // ID_CONFIG_BLOCK + case 0x26: // ID_MD5_CHECKSUM + $metablock['data'] = $this->fread($metablock['size']); + + if ($metablock['padded_data']) { + // padded to the nearest even byte + $metablock['size']--; + $metablock['data'] = substr($metablock['data'], 0, -1); + } + break; + + case 0x00: // ID_DUMMY + case 0x01: // ID_ENCODER_INFO + case 0x02: // ID_DECORR_TERMS + case 0x03: // ID_DECORR_WEIGHTS + case 0x04: // ID_DECORR_SAMPLES + case 0x05: // ID_ENTROPY_VARS + case 0x06: // ID_HYBRID_PROFILE + case 0x07: // ID_SHAPING_WEIGHTS + case 0x08: // ID_FLOAT_INFO + case 0x09: // ID_INT32_INFO + case 0x0A: // ID_WV_BITSTREAM + case 0x0B: // ID_WVC_BITSTREAM + case 0x0C: // ID_WVX_BITSTREAM + case 0x0D: // ID_CHANNEL_INFO + $this->fseek($metablock['offset'] + ($metablock['large_block'] ? 4 : 2) + $metablock['size']); + break; + + default: + $this->warning('Unexpected metablock type "0x'.str_pad(dechex($metablock['function_id']), 2, '0', STR_PAD_LEFT).'" at offset '.$metablock['offset']); + $this->fseek($metablock['offset'] + ($metablock['large_block'] ? 4 : 2) + $metablock['size']); + break; + } + + switch ($metablock['function_id']) { + case 0x21: // ID_RIFF_HEADER + getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio-video.riff.php', __FILE__, true); + $original_wav_filesize = getid3_lib::LittleEndian2Int(substr($metablock['data'], 4, 4)); + + $getid3_temp = new getID3(); + $getid3_temp->openfile($this->getid3->filename); + $getid3_riff = new getid3_riff($getid3_temp); + $getid3_riff->ParseRIFFdata($metablock['data']); + $metablock['riff'] = $getid3_temp->info['riff']; + $info['audio']['sample_rate'] = $getid3_temp->info['riff']['raw']['fmt ']['nSamplesPerSec']; + unset($getid3_riff, $getid3_temp); + + $metablock['riff']['original_filesize'] = $original_wav_filesize; + $info['wavpack']['riff_trailer_size'] = $original_wav_filesize - $metablock['riff']['WAVE']['data'][0]['size'] - $metablock['riff']['header_size']; + $info['playtime_seconds'] = $info['wavpack']['blockheader']['total_samples'] / $info['audio']['sample_rate']; + + // Safe RIFF header in case there's a RIFF footer later + $metablockRIFFheader = $metablock['data']; + break; + + + case 0x22: // ID_RIFF_TRAILER + $metablockRIFFfooter = $metablockRIFFheader.$metablock['data']; + getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio-video.riff.php', __FILE__, true); + + $startoffset = $metablock['offset'] + ($metablock['large_block'] ? 4 : 2); + $getid3_temp = new getID3(); + $getid3_temp->openfile($this->getid3->filename); + $getid3_temp->info['avdataend'] = $info['avdataend']; + //$getid3_temp->info['fileformat'] = 'riff'; + $getid3_riff = new getid3_riff($getid3_temp); + $metablock['riff'] = $getid3_riff->ParseRIFF($startoffset, $startoffset + $metablock['size']); + + if (!empty($metablock['riff']['INFO'])) { + getid3_riff::parseComments($metablock['riff']['INFO'], $metablock['comments']); + $info['tags']['riff'] = $metablock['comments']; + } + unset($getid3_temp, $getid3_riff); + break; + + + case 0x23: // ID_REPLAY_GAIN + $this->warning('WavPack "Replay Gain" contents not yet handled by getID3() in metablock at offset '.$metablock['offset']); + break; + + + case 0x24: // ID_CUESHEET + $this->warning('WavPack "Cuesheet" contents not yet handled by getID3() in metablock at offset '.$metablock['offset']); + break; + + + case 0x25: // ID_CONFIG_BLOCK + $metablock['flags_raw'] = getid3_lib::LittleEndian2Int(substr($metablock['data'], 0, 3)); + + $metablock['flags']['adobe_mode'] = (bool) ($metablock['flags_raw'] & 0x000001); // "adobe" mode for 32-bit floats + $metablock['flags']['fast_flag'] = (bool) ($metablock['flags_raw'] & 0x000002); // fast mode + $metablock['flags']['very_fast_flag'] = (bool) ($metablock['flags_raw'] & 0x000004); // double fast + $metablock['flags']['high_flag'] = (bool) ($metablock['flags_raw'] & 0x000008); // high quality mode + $metablock['flags']['very_high_flag'] = (bool) ($metablock['flags_raw'] & 0x000010); // double high (not used yet) + $metablock['flags']['bitrate_kbps'] = (bool) ($metablock['flags_raw'] & 0x000020); // bitrate is kbps, not bits / sample + $metablock['flags']['auto_shaping'] = (bool) ($metablock['flags_raw'] & 0x000040); // automatic noise shaping + $metablock['flags']['shape_override'] = (bool) ($metablock['flags_raw'] & 0x000080); // shaping mode specified + $metablock['flags']['joint_override'] = (bool) ($metablock['flags_raw'] & 0x000100); // joint-stereo mode specified + $metablock['flags']['copy_time'] = (bool) ($metablock['flags_raw'] & 0x000200); // copy file-time from source + $metablock['flags']['create_exe'] = (bool) ($metablock['flags_raw'] & 0x000400); // create executable + $metablock['flags']['create_wvc'] = (bool) ($metablock['flags_raw'] & 0x000800); // create correction file + $metablock['flags']['optimize_wvc'] = (bool) ($metablock['flags_raw'] & 0x001000); // maximize bybrid compression + $metablock['flags']['quality_mode'] = (bool) ($metablock['flags_raw'] & 0x002000); // psychoacoustic quality mode + $metablock['flags']['raw_flag'] = (bool) ($metablock['flags_raw'] & 0x004000); // raw mode (not implemented yet) + $metablock['flags']['calc_noise'] = (bool) ($metablock['flags_raw'] & 0x008000); // calc noise in hybrid mode + $metablock['flags']['lossy_mode'] = (bool) ($metablock['flags_raw'] & 0x010000); // obsolete (for information) + $metablock['flags']['extra_mode'] = (bool) ($metablock['flags_raw'] & 0x020000); // extra processing mode + $metablock['flags']['skip_wvx'] = (bool) ($metablock['flags_raw'] & 0x040000); // no wvx stream w/ floats & big ints + $metablock['flags']['md5_checksum'] = (bool) ($metablock['flags_raw'] & 0x080000); // compute & store MD5 signature + $metablock['flags']['quiet_mode'] = (bool) ($metablock['flags_raw'] & 0x100000); // don't report progress % + + $info['wavpack']['config_flags'] = $metablock['flags']; + + + $info['audio']['encoder_options'] = ''; + if ($info['wavpack']['blockheader']['flags']['hybrid']) { + $info['audio']['encoder_options'] .= ' -b???'; + } + $info['audio']['encoder_options'] .= ($metablock['flags']['adobe_mode'] ? ' -a' : ''); + $info['audio']['encoder_options'] .= ($metablock['flags']['optimize_wvc'] ? ' -cc' : ''); + $info['audio']['encoder_options'] .= ($metablock['flags']['create_exe'] ? ' -e' : ''); + $info['audio']['encoder_options'] .= ($metablock['flags']['fast_flag'] ? ' -f' : ''); + $info['audio']['encoder_options'] .= ($metablock['flags']['joint_override'] ? ' -j?' : ''); + $info['audio']['encoder_options'] .= ($metablock['flags']['high_flag'] ? ' -h' : ''); + $info['audio']['encoder_options'] .= ($metablock['flags']['md5_checksum'] ? ' -m' : ''); + $info['audio']['encoder_options'] .= ($metablock['flags']['calc_noise'] ? ' -n' : ''); + $info['audio']['encoder_options'] .= ($metablock['flags']['shape_override'] ? ' -s?' : ''); + $info['audio']['encoder_options'] .= ($metablock['flags']['extra_mode'] ? ' -x?' : ''); + if (!empty($info['audio']['encoder_options'])) { + $info['audio']['encoder_options'] = trim($info['audio']['encoder_options']); + } elseif (isset($info['audio']['encoder_options'])) { + unset($info['audio']['encoder_options']); + } + break; + + + case 0x26: // ID_MD5_CHECKSUM + if (strlen($metablock['data']) == 16) { + $info['md5_data_source'] = strtolower(getid3_lib::PrintHexBytes($metablock['data'], true, false, false)); + } else { + $this->warning('Expecting 16 bytes of WavPack "MD5 Checksum" in metablock at offset '.$metablock['offset'].', but found '.strlen($metablock['data']).' bytes'); + } + break; + + + case 0x00: // ID_DUMMY + case 0x01: // ID_ENCODER_INFO + case 0x02: // ID_DECORR_TERMS + case 0x03: // ID_DECORR_WEIGHTS + case 0x04: // ID_DECORR_SAMPLES + case 0x05: // ID_ENTROPY_VARS + case 0x06: // ID_HYBRID_PROFILE + case 0x07: // ID_SHAPING_WEIGHTS + case 0x08: // ID_FLOAT_INFO + case 0x09: // ID_INT32_INFO + case 0x0A: // ID_WV_BITSTREAM + case 0x0B: // ID_WVC_BITSTREAM + case 0x0C: // ID_WVX_BITSTREAM + case 0x0D: // ID_CHANNEL_INFO + unset($metablock); + break; + } + + } + if (!empty($metablock)) { + $info['wavpack']['metablocks'][] = $metablock; + } + + } + + } + + $info['audio']['encoder'] = 'WavPack v'.$info['wavpack']['blockheader']['major_version'].'.'.str_pad($info['wavpack']['blockheader']['minor_version'], 2, '0', STR_PAD_LEFT); + $info['audio']['bits_per_sample'] = $info['wavpack']['blockheader']['flags']['bytes_per_sample'] * 8; + $info['audio']['channels'] = ($info['wavpack']['blockheader']['flags']['mono'] ? 1 : 2); + + if (!empty($info['playtime_seconds'])) { + + $info['audio']['bitrate'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / $info['playtime_seconds']; + + } else { + + $info['audio']['dataformat'] = 'wvc'; + + } + + return true; + } + + + public function WavPackMetablockNameLookup(&$id) { + static $WavPackMetablockNameLookup = array( + 0x00 => 'Dummy', + 0x01 => 'Encoder Info', + 0x02 => 'Decorrelation Terms', + 0x03 => 'Decorrelation Weights', + 0x04 => 'Decorrelation Samples', + 0x05 => 'Entropy Variables', + 0x06 => 'Hybrid Profile', + 0x07 => 'Shaping Weights', + 0x08 => 'Float Info', + 0x09 => 'Int32 Info', + 0x0A => 'WV Bitstream', + 0x0B => 'WVC Bitstream', + 0x0C => 'WVX Bitstream', + 0x0D => 'Channel Info', + 0x21 => 'RIFF header', + 0x22 => 'RIFF trailer', + 0x23 => 'Replay Gain', + 0x24 => 'Cuesheet', + 0x25 => 'Config Block', + 0x26 => 'MD5 Checksum', + ); + return (isset($WavPackMetablockNameLookup[$id]) ? $WavPackMetablockNameLookup[$id] : ''); + } + +} diff --git a/www/rompr/getid3/module.graphic.bmp.php b/www/rompr/getid3/module.graphic.bmp.php new file mode 100755 index 0000000..90cbb38 --- /dev/null +++ b/www/rompr/getid3/module.graphic.bmp.php @@ -0,0 +1,688 @@ + // +// available at http://getid3.sourceforge.net // +// or http://www.getid3.org // +// also https://github.com/JamesHeinrich/getID3 // +///////////////////////////////////////////////////////////////// +// See readme.txt for more details // +///////////////////////////////////////////////////////////////// +// // +// module.graphic.bmp.php // +// module for analyzing BMP Image files // +// dependencies: NONE // +// /// +///////////////////////////////////////////////////////////////// + + +class getid3_bmp extends getid3_handler +{ + public $ExtractPalette = false; + public $ExtractData = false; + + public function Analyze() { + $info = &$this->getid3->info; + + // shortcuts + $info['bmp']['header']['raw'] = array(); + $thisfile_bmp = &$info['bmp']; + $thisfile_bmp_header = &$thisfile_bmp['header']; + $thisfile_bmp_header_raw = &$thisfile_bmp_header['raw']; + + // BITMAPFILEHEADER [14 bytes] - http://msdn.microsoft.com/library/en-us/gdi/bitmaps_62uq.asp + // all versions + // WORD bfType; + // DWORD bfSize; + // WORD bfReserved1; + // WORD bfReserved2; + // DWORD bfOffBits; + + $this->fseek($info['avdataoffset']); + $offset = 0; + $BMPheader = $this->fread(14 + 40); + + $thisfile_bmp_header_raw['identifier'] = substr($BMPheader, $offset, 2); + $offset += 2; + + $magic = 'BM'; + if ($thisfile_bmp_header_raw['identifier'] != $magic) { + $this->error('Expecting "'.getid3_lib::PrintHexBytes($magic).'" at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes($thisfile_bmp_header_raw['identifier']).'"'); + unset($info['fileformat']); + unset($info['bmp']); + return false; + } + + $thisfile_bmp_header_raw['filesize'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4)); + $offset += 4; + $thisfile_bmp_header_raw['reserved1'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 2)); + $offset += 2; + $thisfile_bmp_header_raw['reserved2'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 2)); + $offset += 2; + $thisfile_bmp_header_raw['data_offset'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4)); + $offset += 4; + $thisfile_bmp_header_raw['header_size'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4)); + $offset += 4; + + + // check if the hardcoded-to-1 "planes" is at offset 22 or 26 + $planes22 = getid3_lib::LittleEndian2Int(substr($BMPheader, 22, 2)); + $planes26 = getid3_lib::LittleEndian2Int(substr($BMPheader, 26, 2)); + if (($planes22 == 1) && ($planes26 != 1)) { + $thisfile_bmp['type_os'] = 'OS/2'; + $thisfile_bmp['type_version'] = 1; + } elseif (($planes26 == 1) && ($planes22 != 1)) { + $thisfile_bmp['type_os'] = 'Windows'; + $thisfile_bmp['type_version'] = 1; + } elseif ($thisfile_bmp_header_raw['header_size'] == 12) { + $thisfile_bmp['type_os'] = 'OS/2'; + $thisfile_bmp['type_version'] = 1; + } elseif ($thisfile_bmp_header_raw['header_size'] == 40) { + $thisfile_bmp['type_os'] = 'Windows'; + $thisfile_bmp['type_version'] = 1; + } elseif ($thisfile_bmp_header_raw['header_size'] == 84) { + $thisfile_bmp['type_os'] = 'Windows'; + $thisfile_bmp['type_version'] = 4; + } elseif ($thisfile_bmp_header_raw['header_size'] == 100) { + $thisfile_bmp['type_os'] = 'Windows'; + $thisfile_bmp['type_version'] = 5; + } else { + $this->error('Unknown BMP subtype (or not a BMP file)'); + unset($info['fileformat']); + unset($info['bmp']); + return false; + } + + $info['fileformat'] = 'bmp'; + $info['video']['dataformat'] = 'bmp'; + $info['video']['lossless'] = true; + $info['video']['pixel_aspect_ratio'] = (float) 1; + + if ($thisfile_bmp['type_os'] == 'OS/2') { + + // OS/2-format BMP + // http://netghost.narod.ru/gff/graphics/summary/os2bmp.htm + + // DWORD Size; /* Size of this structure in bytes */ + // DWORD Width; /* Bitmap width in pixels */ + // DWORD Height; /* Bitmap height in pixel */ + // WORD NumPlanes; /* Number of bit planes (color depth) */ + // WORD BitsPerPixel; /* Number of bits per pixel per plane */ + + $thisfile_bmp_header_raw['width'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 2)); + $offset += 2; + $thisfile_bmp_header_raw['height'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 2)); + $offset += 2; + $thisfile_bmp_header_raw['planes'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 2)); + $offset += 2; + $thisfile_bmp_header_raw['bits_per_pixel'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 2)); + $offset += 2; + + $info['video']['resolution_x'] = $thisfile_bmp_header_raw['width']; + $info['video']['resolution_y'] = $thisfile_bmp_header_raw['height']; + $info['video']['codec'] = 'BI_RGB '.$thisfile_bmp_header_raw['bits_per_pixel'].'-bit'; + $info['video']['bits_per_sample'] = $thisfile_bmp_header_raw['bits_per_pixel']; + + if ($thisfile_bmp['type_version'] >= 2) { + // DWORD Compression; /* Bitmap compression scheme */ + // DWORD ImageDataSize; /* Size of bitmap data in bytes */ + // DWORD XResolution; /* X resolution of display device */ + // DWORD YResolution; /* Y resolution of display device */ + // DWORD ColorsUsed; /* Number of color table indices used */ + // DWORD ColorsImportant; /* Number of important color indices */ + // WORD Units; /* Type of units used to measure resolution */ + // WORD Reserved; /* Pad structure to 4-byte boundary */ + // WORD Recording; /* Recording algorithm */ + // WORD Rendering; /* Halftoning algorithm used */ + // DWORD Size1; /* Reserved for halftoning algorithm use */ + // DWORD Size2; /* Reserved for halftoning algorithm use */ + // DWORD ColorEncoding; /* Color model used in bitmap */ + // DWORD Identifier; /* Reserved for application use */ + + $thisfile_bmp_header_raw['compression'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4)); + $offset += 4; + $thisfile_bmp_header_raw['bmp_data_size'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4)); + $offset += 4; + $thisfile_bmp_header_raw['resolution_h'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4)); + $offset += 4; + $thisfile_bmp_header_raw['resolution_v'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4)); + $offset += 4; + $thisfile_bmp_header_raw['colors_used'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4)); + $offset += 4; + $thisfile_bmp_header_raw['colors_important'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4)); + $offset += 4; + $thisfile_bmp_header_raw['resolution_units'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 2)); + $offset += 2; + $thisfile_bmp_header_raw['reserved1'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 2)); + $offset += 2; + $thisfile_bmp_header_raw['recording'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 2)); + $offset += 2; + $thisfile_bmp_header_raw['rendering'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 2)); + $offset += 2; + $thisfile_bmp_header_raw['size1'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4)); + $offset += 4; + $thisfile_bmp_header_raw['size2'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4)); + $offset += 4; + $thisfile_bmp_header_raw['color_encoding'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4)); + $offset += 4; + $thisfile_bmp_header_raw['identifier'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4)); + $offset += 4; + + $thisfile_bmp_header['compression'] = $this->BMPcompressionOS2Lookup($thisfile_bmp_header_raw['compression']); + + $info['video']['codec'] = $thisfile_bmp_header['compression'].' '.$thisfile_bmp_header_raw['bits_per_pixel'].'-bit'; + } + + } elseif ($thisfile_bmp['type_os'] == 'Windows') { + + // Windows-format BMP + + // BITMAPINFOHEADER - [40 bytes] http://msdn.microsoft.com/library/en-us/gdi/bitmaps_1rw2.asp + // all versions + // DWORD biSize; + // LONG biWidth; + // LONG biHeight; + // WORD biPlanes; + // WORD biBitCount; + // DWORD biCompression; + // DWORD biSizeImage; + // LONG biXPelsPerMeter; + // LONG biYPelsPerMeter; + // DWORD biClrUsed; + // DWORD biClrImportant; + + // possibly integrate this section and module.audio-video.riff.php::ParseBITMAPINFOHEADER() ? + + $thisfile_bmp_header_raw['width'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4), true); + $offset += 4; + $thisfile_bmp_header_raw['height'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4), true); + $offset += 4; + $thisfile_bmp_header_raw['planes'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 2)); + $offset += 2; + $thisfile_bmp_header_raw['bits_per_pixel'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 2)); + $offset += 2; + $thisfile_bmp_header_raw['compression'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4)); + $offset += 4; + $thisfile_bmp_header_raw['bmp_data_size'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4)); + $offset += 4; + $thisfile_bmp_header_raw['resolution_h'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4), true); + $offset += 4; + $thisfile_bmp_header_raw['resolution_v'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4), true); + $offset += 4; + $thisfile_bmp_header_raw['colors_used'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4)); + $offset += 4; + $thisfile_bmp_header_raw['colors_important'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4)); + $offset += 4; + + $thisfile_bmp_header['compression'] = $this->BMPcompressionWindowsLookup($thisfile_bmp_header_raw['compression']); + $info['video']['resolution_x'] = $thisfile_bmp_header_raw['width']; + $info['video']['resolution_y'] = $thisfile_bmp_header_raw['height']; + $info['video']['codec'] = $thisfile_bmp_header['compression'].' '.$thisfile_bmp_header_raw['bits_per_pixel'].'-bit'; + $info['video']['bits_per_sample'] = $thisfile_bmp_header_raw['bits_per_pixel']; + + if (($thisfile_bmp['type_version'] >= 4) || ($thisfile_bmp_header_raw['compression'] == 3)) { + // should only be v4+, but BMPs with type_version==1 and BI_BITFIELDS compression have been seen + $BMPheader .= $this->fread(44); + + // BITMAPV4HEADER - [44 bytes] - http://msdn.microsoft.com/library/en-us/gdi/bitmaps_2k1e.asp + // Win95+, WinNT4.0+ + // DWORD bV4RedMask; + // DWORD bV4GreenMask; + // DWORD bV4BlueMask; + // DWORD bV4AlphaMask; + // DWORD bV4CSType; + // CIEXYZTRIPLE bV4Endpoints; + // DWORD bV4GammaRed; + // DWORD bV4GammaGreen; + // DWORD bV4GammaBlue; + $thisfile_bmp_header_raw['red_mask'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4)); + $offset += 4; + $thisfile_bmp_header_raw['green_mask'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4)); + $offset += 4; + $thisfile_bmp_header_raw['blue_mask'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4)); + $offset += 4; + $thisfile_bmp_header_raw['alpha_mask'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4)); + $offset += 4; + $thisfile_bmp_header_raw['cs_type'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4)); + $offset += 4; + $thisfile_bmp_header_raw['ciexyz_red'] = substr($BMPheader, $offset, 4); + $offset += 4; + $thisfile_bmp_header_raw['ciexyz_green'] = substr($BMPheader, $offset, 4); + $offset += 4; + $thisfile_bmp_header_raw['ciexyz_blue'] = substr($BMPheader, $offset, 4); + $offset += 4; + $thisfile_bmp_header_raw['gamma_red'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4)); + $offset += 4; + $thisfile_bmp_header_raw['gamma_green'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4)); + $offset += 4; + $thisfile_bmp_header_raw['gamma_blue'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4)); + $offset += 4; + + $thisfile_bmp_header['ciexyz_red'] = getid3_lib::FixedPoint2_30(strrev($thisfile_bmp_header_raw['ciexyz_red'])); + $thisfile_bmp_header['ciexyz_green'] = getid3_lib::FixedPoint2_30(strrev($thisfile_bmp_header_raw['ciexyz_green'])); + $thisfile_bmp_header['ciexyz_blue'] = getid3_lib::FixedPoint2_30(strrev($thisfile_bmp_header_raw['ciexyz_blue'])); + } + + if ($thisfile_bmp['type_version'] >= 5) { + $BMPheader .= $this->fread(16); + + // BITMAPV5HEADER - [16 bytes] - http://msdn.microsoft.com/library/en-us/gdi/bitmaps_7c36.asp + // Win98+, Win2000+ + // DWORD bV5Intent; + // DWORD bV5ProfileData; + // DWORD bV5ProfileSize; + // DWORD bV5Reserved; + $thisfile_bmp_header_raw['intent'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4)); + $offset += 4; + $thisfile_bmp_header_raw['profile_data_offset'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4)); + $offset += 4; + $thisfile_bmp_header_raw['profile_data_size'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4)); + $offset += 4; + $thisfile_bmp_header_raw['reserved3'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4)); + $offset += 4; + } + + } else { + + $this->error('Unknown BMP format in header.'); + return false; + + } + + + if ($this->ExtractPalette || $this->ExtractData) { + $PaletteEntries = 0; + if ($thisfile_bmp_header_raw['bits_per_pixel'] < 16) { + $PaletteEntries = pow(2, $thisfile_bmp_header_raw['bits_per_pixel']); + } elseif (isset($thisfile_bmp_header_raw['colors_used']) && ($thisfile_bmp_header_raw['colors_used'] > 0) && ($thisfile_bmp_header_raw['colors_used'] <= 256)) { + $PaletteEntries = $thisfile_bmp_header_raw['colors_used']; + } + if ($PaletteEntries > 0) { + $BMPpalette = $this->fread(4 * $PaletteEntries); + $paletteoffset = 0; + for ($i = 0; $i < $PaletteEntries; $i++) { + // RGBQUAD - http://msdn.microsoft.com/library/en-us/gdi/bitmaps_5f8y.asp + // BYTE rgbBlue; + // BYTE rgbGreen; + // BYTE rgbRed; + // BYTE rgbReserved; + $blue = getid3_lib::LittleEndian2Int(substr($BMPpalette, $paletteoffset++, 1)); + $green = getid3_lib::LittleEndian2Int(substr($BMPpalette, $paletteoffset++, 1)); + $red = getid3_lib::LittleEndian2Int(substr($BMPpalette, $paletteoffset++, 1)); + if (($thisfile_bmp['type_os'] == 'OS/2') && ($thisfile_bmp['type_version'] == 1)) { + // no padding byte + } else { + $paletteoffset++; // padding byte + } + $thisfile_bmp['palette'][$i] = (($red << 16) | ($green << 8) | $blue); + } + } + } + + if ($this->ExtractData) { + $this->fseek($thisfile_bmp_header_raw['data_offset']); + $RowByteLength = ceil(($thisfile_bmp_header_raw['width'] * ($thisfile_bmp_header_raw['bits_per_pixel'] / 8)) / 4) * 4; // round up to nearest DWORD boundry + $BMPpixelData = $this->fread($thisfile_bmp_header_raw['height'] * $RowByteLength); + $pixeldataoffset = 0; + $thisfile_bmp_header_raw['compression'] = (isset($thisfile_bmp_header_raw['compression']) ? $thisfile_bmp_header_raw['compression'] : ''); + switch ($thisfile_bmp_header_raw['compression']) { + + case 0: // BI_RGB + switch ($thisfile_bmp_header_raw['bits_per_pixel']) { + case 1: + for ($row = ($thisfile_bmp_header_raw['height'] - 1); $row >= 0; $row--) { + for ($col = 0; $col < $thisfile_bmp_header_raw['width']; $col = $col) { + $paletteindexbyte = ord($BMPpixelData{$pixeldataoffset++}); + for ($i = 7; $i >= 0; $i--) { + $paletteindex = ($paletteindexbyte & (0x01 << $i)) >> $i; + $thisfile_bmp['data'][$row][$col] = $thisfile_bmp['palette'][$paletteindex]; + $col++; + } + } + while (($pixeldataoffset % 4) != 0) { + // lines are padded to nearest DWORD + $pixeldataoffset++; + } + } + break; + + case 4: + for ($row = ($thisfile_bmp_header_raw['height'] - 1); $row >= 0; $row--) { + for ($col = 0; $col < $thisfile_bmp_header_raw['width']; $col = $col) { + $paletteindexbyte = ord($BMPpixelData{$pixeldataoffset++}); + for ($i = 1; $i >= 0; $i--) { + $paletteindex = ($paletteindexbyte & (0x0F << (4 * $i))) >> (4 * $i); + $thisfile_bmp['data'][$row][$col] = $thisfile_bmp['palette'][$paletteindex]; + $col++; + } + } + while (($pixeldataoffset % 4) != 0) { + // lines are padded to nearest DWORD + $pixeldataoffset++; + } + } + break; + + case 8: + for ($row = ($thisfile_bmp_header_raw['height'] - 1); $row >= 0; $row--) { + for ($col = 0; $col < $thisfile_bmp_header_raw['width']; $col++) { + $paletteindex = ord($BMPpixelData{$pixeldataoffset++}); + $thisfile_bmp['data'][$row][$col] = $thisfile_bmp['palette'][$paletteindex]; + } + while (($pixeldataoffset % 4) != 0) { + // lines are padded to nearest DWORD + $pixeldataoffset++; + } + } + break; + + case 24: + for ($row = ($thisfile_bmp_header_raw['height'] - 1); $row >= 0; $row--) { + for ($col = 0; $col < $thisfile_bmp_header_raw['width']; $col++) { + $thisfile_bmp['data'][$row][$col] = (ord($BMPpixelData{$pixeldataoffset+2}) << 16) | (ord($BMPpixelData{$pixeldataoffset+1}) << 8) | ord($BMPpixelData{$pixeldataoffset}); + $pixeldataoffset += 3; + } + while (($pixeldataoffset % 4) != 0) { + // lines are padded to nearest DWORD + $pixeldataoffset++; + } + } + break; + + case 32: + for ($row = ($thisfile_bmp_header_raw['height'] - 1); $row >= 0; $row--) { + for ($col = 0; $col < $thisfile_bmp_header_raw['width']; $col++) { + $thisfile_bmp['data'][$row][$col] = (ord($BMPpixelData{$pixeldataoffset+3}) << 24) | (ord($BMPpixelData{$pixeldataoffset+2}) << 16) | (ord($BMPpixelData{$pixeldataoffset+1}) << 8) | ord($BMPpixelData{$pixeldataoffset}); + $pixeldataoffset += 4; + } + while (($pixeldataoffset % 4) != 0) { + // lines are padded to nearest DWORD + $pixeldataoffset++; + } + } + break; + + case 16: + // ? + break; + + default: + $this->error('Unknown bits-per-pixel value ('.$thisfile_bmp_header_raw['bits_per_pixel'].') - cannot read pixel data'); + break; + } + break; + + + case 1: // BI_RLE8 - http://msdn.microsoft.com/library/en-us/gdi/bitmaps_6x0u.asp + switch ($thisfile_bmp_header_raw['bits_per_pixel']) { + case 8: + $pixelcounter = 0; + while ($pixeldataoffset < strlen($BMPpixelData)) { + $firstbyte = getid3_lib::LittleEndian2Int(substr($BMPpixelData, $pixeldataoffset++, 1)); + $secondbyte = getid3_lib::LittleEndian2Int(substr($BMPpixelData, $pixeldataoffset++, 1)); + if ($firstbyte == 0) { + + // escaped/absolute mode - the first byte of the pair can be set to zero to + // indicate an escape character that denotes the end of a line, the end of + // a bitmap, or a delta, depending on the value of the second byte. + switch ($secondbyte) { + case 0: + // end of line + // no need for special processing, just ignore + break; + + case 1: + // end of bitmap + $pixeldataoffset = strlen($BMPpixelData); // force to exit loop just in case + break; + + case 2: + // delta - The 2 bytes following the escape contain unsigned values + // indicating the horizontal and vertical offsets of the next pixel + // from the current position. + $colincrement = getid3_lib::LittleEndian2Int(substr($BMPpixelData, $pixeldataoffset++, 1)); + $rowincrement = getid3_lib::LittleEndian2Int(substr($BMPpixelData, $pixeldataoffset++, 1)); + $col = ($pixelcounter % $thisfile_bmp_header_raw['width']) + $colincrement; + $row = ($thisfile_bmp_header_raw['height'] - 1 - (($pixelcounter - $col) / $thisfile_bmp_header_raw['width'])) - $rowincrement; + $pixelcounter = ($row * $thisfile_bmp_header_raw['width']) + $col; + break; + + default: + // In absolute mode, the first byte is zero and the second byte is a + // value in the range 03H through FFH. The second byte represents the + // number of bytes that follow, each of which contains the color index + // of a single pixel. Each run must be aligned on a word boundary. + for ($i = 0; $i < $secondbyte; $i++) { + $paletteindex = getid3_lib::LittleEndian2Int(substr($BMPpixelData, $pixeldataoffset++, 1)); + $col = $pixelcounter % $thisfile_bmp_header_raw['width']; + $row = $thisfile_bmp_header_raw['height'] - 1 - (($pixelcounter - $col) / $thisfile_bmp_header_raw['width']); + $thisfile_bmp['data'][$row][$col] = $thisfile_bmp['palette'][$paletteindex]; + $pixelcounter++; + } + while (($pixeldataoffset % 2) != 0) { + // Each run must be aligned on a word boundary. + $pixeldataoffset++; + } + break; + } + + } else { + + // encoded mode - the first byte specifies the number of consecutive pixels + // to be drawn using the color index contained in the second byte. + for ($i = 0; $i < $firstbyte; $i++) { + $col = $pixelcounter % $thisfile_bmp_header_raw['width']; + $row = $thisfile_bmp_header_raw['height'] - 1 - (($pixelcounter - $col) / $thisfile_bmp_header_raw['width']); + $thisfile_bmp['data'][$row][$col] = $thisfile_bmp['palette'][$secondbyte]; + $pixelcounter++; + } + + } + } + break; + + default: + $this->error('Unknown bits-per-pixel value ('.$thisfile_bmp_header_raw['bits_per_pixel'].') - cannot read pixel data'); + break; + } + break; + + + + case 2: // BI_RLE4 - http://msdn.microsoft.com/library/en-us/gdi/bitmaps_6x0u.asp + switch ($thisfile_bmp_header_raw['bits_per_pixel']) { + case 4: + $pixelcounter = 0; + while ($pixeldataoffset < strlen($BMPpixelData)) { + $firstbyte = getid3_lib::LittleEndian2Int(substr($BMPpixelData, $pixeldataoffset++, 1)); + $secondbyte = getid3_lib::LittleEndian2Int(substr($BMPpixelData, $pixeldataoffset++, 1)); + if ($firstbyte == 0) { + + // escaped/absolute mode - the first byte of the pair can be set to zero to + // indicate an escape character that denotes the end of a line, the end of + // a bitmap, or a delta, depending on the value of the second byte. + switch ($secondbyte) { + case 0: + // end of line + // no need for special processing, just ignore + break; + + case 1: + // end of bitmap + $pixeldataoffset = strlen($BMPpixelData); // force to exit loop just in case + break; + + case 2: + // delta - The 2 bytes following the escape contain unsigned values + // indicating the horizontal and vertical offsets of the next pixel + // from the current position. + $colincrement = getid3_lib::LittleEndian2Int(substr($BMPpixelData, $pixeldataoffset++, 1)); + $rowincrement = getid3_lib::LittleEndian2Int(substr($BMPpixelData, $pixeldataoffset++, 1)); + $col = ($pixelcounter % $thisfile_bmp_header_raw['width']) + $colincrement; + $row = ($thisfile_bmp_header_raw['height'] - 1 - (($pixelcounter - $col) / $thisfile_bmp_header_raw['width'])) - $rowincrement; + $pixelcounter = ($row * $thisfile_bmp_header_raw['width']) + $col; + break; + + default: + // In absolute mode, the first byte is zero. The second byte contains the number + // of color indexes that follow. Subsequent bytes contain color indexes in their + // high- and low-order 4 bits, one color index for each pixel. In absolute mode, + // each run must be aligned on a word boundary. + unset($paletteindexes); + for ($i = 0; $i < ceil($secondbyte / 2); $i++) { + $paletteindexbyte = getid3_lib::LittleEndian2Int(substr($BMPpixelData, $pixeldataoffset++, 1)); + $paletteindexes[] = ($paletteindexbyte & 0xF0) >> 4; + $paletteindexes[] = ($paletteindexbyte & 0x0F); + } + while (($pixeldataoffset % 2) != 0) { + // Each run must be aligned on a word boundary. + $pixeldataoffset++; + } + + foreach ($paletteindexes as $paletteindex) { + $col = $pixelcounter % $thisfile_bmp_header_raw['width']; + $row = $thisfile_bmp_header_raw['height'] - 1 - (($pixelcounter - $col) / $thisfile_bmp_header_raw['width']); + $thisfile_bmp['data'][$row][$col] = $thisfile_bmp['palette'][$paletteindex]; + $pixelcounter++; + } + break; + } + + } else { + + // encoded mode - the first byte of the pair contains the number of pixels to be + // drawn using the color indexes in the second byte. The second byte contains two + // color indexes, one in its high-order 4 bits and one in its low-order 4 bits. + // The first of the pixels is drawn using the color specified by the high-order + // 4 bits, the second is drawn using the color in the low-order 4 bits, the third + // is drawn using the color in the high-order 4 bits, and so on, until all the + // pixels specified by the first byte have been drawn. + $paletteindexes[0] = ($secondbyte & 0xF0) >> 4; + $paletteindexes[1] = ($secondbyte & 0x0F); + for ($i = 0; $i < $firstbyte; $i++) { + $col = $pixelcounter % $thisfile_bmp_header_raw['width']; + $row = $thisfile_bmp_header_raw['height'] - 1 - (($pixelcounter - $col) / $thisfile_bmp_header_raw['width']); + $thisfile_bmp['data'][$row][$col] = $thisfile_bmp['palette'][$paletteindexes[($i % 2)]]; + $pixelcounter++; + } + + } + } + break; + + default: + $this->error('Unknown bits-per-pixel value ('.$thisfile_bmp_header_raw['bits_per_pixel'].') - cannot read pixel data'); + break; + } + break; + + + case 3: // BI_BITFIELDS + switch ($thisfile_bmp_header_raw['bits_per_pixel']) { + case 16: + case 32: + $redshift = 0; + $greenshift = 0; + $blueshift = 0; + while ((($thisfile_bmp_header_raw['red_mask'] >> $redshift) & 0x01) == 0) { + $redshift++; + } + while ((($thisfile_bmp_header_raw['green_mask'] >> $greenshift) & 0x01) == 0) { + $greenshift++; + } + while ((($thisfile_bmp_header_raw['blue_mask'] >> $blueshift) & 0x01) == 0) { + $blueshift++; + } + for ($row = ($thisfile_bmp_header_raw['height'] - 1); $row >= 0; $row--) { + for ($col = 0; $col < $thisfile_bmp_header_raw['width']; $col++) { + $pixelvalue = getid3_lib::LittleEndian2Int(substr($BMPpixelData, $pixeldataoffset, $thisfile_bmp_header_raw['bits_per_pixel'] / 8)); + $pixeldataoffset += $thisfile_bmp_header_raw['bits_per_pixel'] / 8; + + $red = intval(round(((($pixelvalue & $thisfile_bmp_header_raw['red_mask']) >> $redshift) / ($thisfile_bmp_header_raw['red_mask'] >> $redshift)) * 255)); + $green = intval(round(((($pixelvalue & $thisfile_bmp_header_raw['green_mask']) >> $greenshift) / ($thisfile_bmp_header_raw['green_mask'] >> $greenshift)) * 255)); + $blue = intval(round(((($pixelvalue & $thisfile_bmp_header_raw['blue_mask']) >> $blueshift) / ($thisfile_bmp_header_raw['blue_mask'] >> $blueshift)) * 255)); + $thisfile_bmp['data'][$row][$col] = (($red << 16) | ($green << 8) | ($blue)); + } + while (($pixeldataoffset % 4) != 0) { + // lines are padded to nearest DWORD + $pixeldataoffset++; + } + } + break; + + default: + $this->error('Unknown bits-per-pixel value ('.$thisfile_bmp_header_raw['bits_per_pixel'].') - cannot read pixel data'); + break; + } + break; + + + default: // unhandled compression type + $this->error('Unknown/unhandled compression type value ('.$thisfile_bmp_header_raw['compression'].') - cannot decompress pixel data'); + break; + } + } + + return true; + } + + + public function PlotBMP(&$BMPinfo) { + $starttime = time(); + if (!isset($BMPinfo['bmp']['data']) || !is_array($BMPinfo['bmp']['data'])) { + echo 'ERROR: no pixel data
      '; + return false; + } + set_time_limit(intval(round($BMPinfo['resolution_x'] * $BMPinfo['resolution_y'] / 10000))); + if ($im = ImageCreateTrueColor($BMPinfo['resolution_x'], $BMPinfo['resolution_y'])) { + for ($row = 0; $row < $BMPinfo['resolution_y']; $row++) { + for ($col = 0; $col < $BMPinfo['resolution_x']; $col++) { + if (isset($BMPinfo['bmp']['data'][$row][$col])) { + $red = ($BMPinfo['bmp']['data'][$row][$col] & 0x00FF0000) >> 16; + $green = ($BMPinfo['bmp']['data'][$row][$col] & 0x0000FF00) >> 8; + $blue = ($BMPinfo['bmp']['data'][$row][$col] & 0x000000FF); + $pixelcolor = ImageColorAllocate($im, $red, $green, $blue); + ImageSetPixel($im, $col, $row, $pixelcolor); + } else { + //echo 'ERROR: no data for pixel '.$row.' x '.$col.'
      '; + //return false; + } + } + } + if (headers_sent()) { + echo 'plotted '.($BMPinfo['resolution_x'] * $BMPinfo['resolution_y']).' pixels in '.(time() - $starttime).' seconds
      '; + ImageDestroy($im); + exit; + } else { + header('Content-type: image/png'); + ImagePNG($im); + ImageDestroy($im); + return true; + } + } + return false; + } + + public function BMPcompressionWindowsLookup($compressionid) { + static $BMPcompressionWindowsLookup = array( + 0 => 'BI_RGB', + 1 => 'BI_RLE8', + 2 => 'BI_RLE4', + 3 => 'BI_BITFIELDS', + 4 => 'BI_JPEG', + 5 => 'BI_PNG' + ); + return (isset($BMPcompressionWindowsLookup[$compressionid]) ? $BMPcompressionWindowsLookup[$compressionid] : 'invalid'); + } + + public function BMPcompressionOS2Lookup($compressionid) { + static $BMPcompressionOS2Lookup = array( + 0 => 'BI_RGB', + 1 => 'BI_RLE8', + 2 => 'BI_RLE4', + 3 => 'Huffman 1D', + 4 => 'BI_RLE24', + ); + return (isset($BMPcompressionOS2Lookup[$compressionid]) ? $BMPcompressionOS2Lookup[$compressionid] : 'invalid'); + } + +} diff --git a/www/rompr/getid3/module.graphic.efax.php b/www/rompr/getid3/module.graphic.efax.php new file mode 100755 index 0000000..8c62854 --- /dev/null +++ b/www/rompr/getid3/module.graphic.efax.php @@ -0,0 +1,51 @@ + // +// available at http://getid3.sourceforge.net // +// or http://www.getid3.org // +// also https://github.com/JamesHeinrich/getID3 // +///////////////////////////////////////////////////////////////// +// See readme.txt for more details // +///////////////////////////////////////////////////////////////// +// // +// module.archive.efax.php // +// module for analyzing eFax files // +// dependencies: NONE // +// /// +///////////////////////////////////////////////////////////////// + + +class getid3_efax extends getid3_handler +{ + + public function Analyze() { + $info = &$this->getid3->info; + + $this->fseek($info['avdataoffset']); + $efaxheader = $this->fread(1024); + + $info['efax']['header']['magic'] = substr($efaxheader, 0, 2); + if ($info['efax']['header']['magic'] != "\xDC\xFE") { + $this->error('Invalid eFax byte order identifier (expecting DC FE, found '.getid3_lib::PrintHexBytes($info['efax']['header']['magic']).') at offset '.$info['avdataoffset']); + return false; + } + $info['fileformat'] = 'efax'; + + $info['efax']['header']['filesize'] = getid3_lib::LittleEndian2Int(substr($efaxheader, 2, 4)); + if ($info['efax']['header']['filesize'] != $info['filesize']) { + $this->error('Probable '.(($info['efax']['header']['filesize'] > $info['filesize']) ? 'truncated' : 'corrupt').' file, expecting '.$info['efax']['header']['filesize'].' bytes, found '.$info['filesize'].' bytes'); + } + $info['efax']['header']['software1'] = rtrim(substr($efaxheader, 26, 32), "\x00"); + $info['efax']['header']['software2'] = rtrim(substr($efaxheader, 58, 32), "\x00"); + $info['efax']['header']['software3'] = rtrim(substr($efaxheader, 90, 32), "\x00"); + + $info['efax']['header']['pages'] = getid3_lib::LittleEndian2Int(substr($efaxheader, 198, 2)); + $info['efax']['header']['data_bytes'] = getid3_lib::LittleEndian2Int(substr($efaxheader, 202, 4)); + +$this->error('eFax parsing not enabled in this version of getID3() ['.$this->getid3->version().']'); +return false; + + return true; + } + +} diff --git a/www/rompr/getid3/module.graphic.gif.php b/www/rompr/getid3/module.graphic.gif.php new file mode 100755 index 0000000..c73c0ff --- /dev/null +++ b/www/rompr/getid3/module.graphic.gif.php @@ -0,0 +1,195 @@ + // +// available at http://getid3.sourceforge.net // +// or http://www.getid3.org // +// also https://github.com/JamesHeinrich/getID3 // +///////////////////////////////////////////////////////////////// +// See readme.txt for more details // +///////////////////////////////////////////////////////////////// +// // +// module.graphic.gif.php // +// module for analyzing GIF Image files // +// dependencies: NONE // +// /// +///////////////////////////////////////////////////////////////// + +// https://www.w3.org/Graphics/GIF/spec-gif89a.txt +// http://www.matthewflickinger.com/lab/whatsinagif/bits_and_bytes.asp + +class getid3_gif extends getid3_handler +{ + + public function Analyze() { + $info = &$this->getid3->info; + + $info['fileformat'] = 'gif'; + $info['video']['dataformat'] = 'gif'; + $info['video']['lossless'] = true; + $info['video']['pixel_aspect_ratio'] = (float) 1; + + $this->fseek($info['avdataoffset']); + $GIFheader = $this->fread(13); + $offset = 0; + + $info['gif']['header']['raw']['identifier'] = substr($GIFheader, $offset, 3); + $offset += 3; + + $magic = 'GIF'; + if ($info['gif']['header']['raw']['identifier'] != $magic) { + $this->error('Expecting "'.getid3_lib::PrintHexBytes($magic).'" at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes($info['gif']['header']['raw']['identifier']).'"'); + unset($info['fileformat']); + unset($info['gif']); + return false; + } + + $info['gif']['header']['raw']['version'] = substr($GIFheader, $offset, 3); + $offset += 3; + $info['gif']['header']['raw']['width'] = getid3_lib::LittleEndian2Int(substr($GIFheader, $offset, 2)); + $offset += 2; + $info['gif']['header']['raw']['height'] = getid3_lib::LittleEndian2Int(substr($GIFheader, $offset, 2)); + $offset += 2; + $info['gif']['header']['raw']['flags'] = getid3_lib::LittleEndian2Int(substr($GIFheader, $offset, 1)); + $offset += 1; + $info['gif']['header']['raw']['bg_color_index'] = getid3_lib::LittleEndian2Int(substr($GIFheader, $offset, 1)); + $offset += 1; + $info['gif']['header']['raw']['aspect_ratio'] = getid3_lib::LittleEndian2Int(substr($GIFheader, $offset, 1)); + $offset += 1; + + $info['video']['resolution_x'] = $info['gif']['header']['raw']['width']; + $info['video']['resolution_y'] = $info['gif']['header']['raw']['height']; + $info['gif']['version'] = $info['gif']['header']['raw']['version']; + $info['gif']['header']['flags']['global_color_table'] = (bool) ($info['gif']['header']['raw']['flags'] & 0x80); + if ($info['gif']['header']['raw']['flags'] & 0x80) { + // Number of bits per primary color available to the original image, minus 1 + $info['gif']['header']['bits_per_pixel'] = 3 * ((($info['gif']['header']['raw']['flags'] & 0x70) >> 4) + 1); + } else { + $info['gif']['header']['bits_per_pixel'] = 0; + } + $info['gif']['header']['flags']['global_color_sorted'] = (bool) ($info['gif']['header']['raw']['flags'] & 0x40); + if ($info['gif']['header']['flags']['global_color_table']) { + // the number of bytes contained in the Global Color Table. To determine that + // actual size of the color table, raise 2 to [the value of the field + 1] + $info['gif']['header']['global_color_size'] = pow(2, ($info['gif']['header']['raw']['flags'] & 0x07) + 1); + $info['video']['bits_per_sample'] = ($info['gif']['header']['raw']['flags'] & 0x07) + 1; + } else { + $info['gif']['header']['global_color_size'] = 0; + } + if ($info['gif']['header']['raw']['aspect_ratio'] != 0) { + // Aspect Ratio = (Pixel Aspect Ratio + 15) / 64 + $info['gif']['header']['aspect_ratio'] = ($info['gif']['header']['raw']['aspect_ratio'] + 15) / 64; + } + + if ($info['gif']['header']['flags']['global_color_table']) { + $GIFcolorTable = $this->fread(3 * $info['gif']['header']['global_color_size']); + $offset = 0; + for ($i = 0; $i < $info['gif']['header']['global_color_size']; $i++) { + $red = getid3_lib::LittleEndian2Int(substr($GIFcolorTable, $offset++, 1)); + $green = getid3_lib::LittleEndian2Int(substr($GIFcolorTable, $offset++, 1)); + $blue = getid3_lib::LittleEndian2Int(substr($GIFcolorTable, $offset++, 1)); + $info['gif']['global_color_table'][$i] = (($red << 16) | ($green << 8) | ($blue)); + } + } + + // Image Descriptor + while (!feof($this->getid3->fp)) { + $NextBlockTest = $this->fread(1); + switch ($NextBlockTest) { + +/* + case ',': // ',' - Image separator character + $ImageDescriptorData = $NextBlockTest.$this->fread(9); + $ImageDescriptor = array(); + $ImageDescriptor['image_left'] = getid3_lib::LittleEndian2Int(substr($ImageDescriptorData, 1, 2)); + $ImageDescriptor['image_top'] = getid3_lib::LittleEndian2Int(substr($ImageDescriptorData, 3, 2)); + $ImageDescriptor['image_width'] = getid3_lib::LittleEndian2Int(substr($ImageDescriptorData, 5, 2)); + $ImageDescriptor['image_height'] = getid3_lib::LittleEndian2Int(substr($ImageDescriptorData, 7, 2)); + $ImageDescriptor['flags_raw'] = getid3_lib::LittleEndian2Int(substr($ImageDescriptorData, 9, 1)); + $ImageDescriptor['flags']['use_local_color_map'] = (bool) ($ImageDescriptor['flags_raw'] & 0x80); + $ImageDescriptor['flags']['image_interlaced'] = (bool) ($ImageDescriptor['flags_raw'] & 0x40); + $info['gif']['image_descriptor'][] = $ImageDescriptor; + + if ($ImageDescriptor['flags']['use_local_color_map']) { + + $this->warning('This version of getID3() cannot parse local color maps for GIFs'); + return true; + + } + $RasterData = array(); + $RasterData['code_size'] = getid3_lib::LittleEndian2Int($this->fread(1)); + $RasterData['block_byte_count'] = getid3_lib::LittleEndian2Int($this->fread(1)); + $info['gif']['raster_data'][count($info['gif']['image_descriptor']) - 1] = $RasterData; + + $CurrentCodeSize = $RasterData['code_size'] + 1; + for ($i = 0; $i < pow(2, $RasterData['code_size']); $i++) { + $DefaultDataLookupTable[$i] = chr($i); + } + $DefaultDataLookupTable[pow(2, $RasterData['code_size']) + 0] = ''; // Clear Code + $DefaultDataLookupTable[pow(2, $RasterData['code_size']) + 1] = ''; // End Of Image Code + + $NextValue = $this->GetLSBits($CurrentCodeSize); + echo 'Clear Code: '.$NextValue.'
      '; + + $NextValue = $this->GetLSBits($CurrentCodeSize); + echo 'First Color: '.$NextValue.'
      '; + + $Prefix = $NextValue; + $i = 0; + while ($i++ < 20) { + $NextValue = $this->GetLSBits($CurrentCodeSize); + echo $NextValue.'
      '; + } + echo 'escaping
      '; + return true; + break; +*/ + + case '!': + // GIF Extension Block + $ExtensionBlockData = $NextBlockTest.$this->fread(2); + $ExtensionBlock = array(); + $ExtensionBlock['function_code'] = getid3_lib::LittleEndian2Int(substr($ExtensionBlockData, 1, 1)); + $ExtensionBlock['byte_length'] = getid3_lib::LittleEndian2Int(substr($ExtensionBlockData, 2, 1)); + $ExtensionBlock['data'] = (($ExtensionBlock['byte_length'] > 0) ? $this->fread($ExtensionBlock['byte_length']) : null); + + if (substr($ExtensionBlock['data'], 0, 11) == 'NETSCAPE2.0') { // Netscape Application Block (NAB) + $ExtensionBlock['data'] .= $this->fread(4); + if (substr($ExtensionBlock['data'], 11, 2) == "\x03\x01") { + $info['gif']['animation']['animated'] = true; + $info['gif']['animation']['loop_count'] = getid3_lib::LittleEndian2Int(substr($ExtensionBlock['data'], 13, 2)); + } else { + $this->warning('Expecting 03 01 at offset '.($this->ftell() - 4).', found "'.getid3_lib::PrintHexBytes(substr($ExtensionBlock['data'], 11, 2)).'"'); + } + } + + $info['gif']['extension_blocks'][] = $ExtensionBlock; + break; + + case ';': + $info['gif']['terminator_offset'] = $this->ftell() - 1; + // GIF Terminator + break; + + default: + break; + + + } + } + + return true; + } + + + public function GetLSBits($bits) { + static $bitbuffer = ''; + while (strlen($bitbuffer) < $bits) { + $bitbuffer = str_pad(decbin(ord($this->fread(1))), 8, '0', STR_PAD_LEFT).$bitbuffer; + } + $value = bindec(substr($bitbuffer, 0 - $bits)); + $bitbuffer = substr($bitbuffer, 0, 0 - $bits); + + return $value; + } + +} diff --git a/www/rompr/getid3/module.graphic.jpg.php b/www/rompr/getid3/module.graphic.jpg.php new file mode 100755 index 0000000..76edf14 --- /dev/null +++ b/www/rompr/getid3/module.graphic.jpg.php @@ -0,0 +1,349 @@ + // +// available at http://getid3.sourceforge.net // +// or http://www.getid3.org // +// also https://github.com/JamesHeinrich/getID3 // +///////////////////////////////////////////////////////////////// +// See readme.txt for more details // +///////////////////////////////////////////////////////////////// +// // +// module.graphic.jpg.php // +// module for analyzing JPEG Image files // +// dependencies: PHP compiled with --enable-exif (optional) // +// module.tag.xmp.php (optional) // +// /// +///////////////////////////////////////////////////////////////// + + +class getid3_jpg extends getid3_handler +{ + + + public function Analyze() { + $info = &$this->getid3->info; + + $info['fileformat'] = 'jpg'; + $info['video']['dataformat'] = 'jpg'; + $info['video']['lossless'] = false; + $info['video']['bits_per_sample'] = 24; + $info['video']['pixel_aspect_ratio'] = (float) 1; + + $this->fseek($info['avdataoffset']); + + $imageinfo = array(); + //list($width, $height, $type) = getid3_lib::GetDataImageSize($this->fread($info['filesize']), $imageinfo); + list($width, $height, $type) = getimagesize($info['filenamepath'], $imageinfo); // http://www.getid3.org/phpBB3/viewtopic.php?t=1474 + + + if (isset($imageinfo['APP13'])) { + // http://php.net/iptcparse + // http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/IPTC.html + $iptc_parsed = iptcparse($imageinfo['APP13']); + if (is_array($iptc_parsed)) { + foreach ($iptc_parsed as $iptc_key_raw => $iptc_values) { + list($iptc_record, $iptc_tagkey) = explode('#', $iptc_key_raw); + $iptc_tagkey = intval(ltrim($iptc_tagkey, '0')); + foreach ($iptc_values as $key => $value) { + $IPTCrecordName = $this->IPTCrecordName($iptc_record); + $IPTCrecordTagName = $this->IPTCrecordTagName($iptc_record, $iptc_tagkey); + if (isset($info['iptc']['comments'][$IPTCrecordName][$IPTCrecordTagName])) { + $info['iptc']['comments'][$IPTCrecordName][$IPTCrecordTagName][] = $value; + } else { + $info['iptc']['comments'][$IPTCrecordName][$IPTCrecordTagName] = array($value); + } + } + } + } + } + + $returnOK = false; + switch ($type) { + case IMG_JPG: + $info['video']['resolution_x'] = $width; + $info['video']['resolution_y'] = $height; + + if (isset($imageinfo['APP1'])) { + if (function_exists('exif_read_data')) { + if (substr($imageinfo['APP1'], 0, 4) == 'Exif') { +//$this->warning('known issue: https://bugs.php.net/bug.php?id=62523'); +//return false; + set_error_handler(function($errno, $errstr, $errfile, $errline, array $errcontext) { + if (!(error_reporting() & $errno)) { + // error is not specified in the error_reporting setting, so we ignore it + return false; + } + + $errcontext['info']['warning'][] = 'Error parsing EXIF data ('.$errstr.')'; + }); + + $info['jpg']['exif'] = exif_read_data($info['filenamepath'], null, true, false); + + restore_error_handler(); + } else { + $this->warning('exif_read_data() cannot parse non-EXIF data in APP1 (expected "Exif", found "'.substr($imageinfo['APP1'], 0, 4).'")'); + } + } else { + $this->warning('EXIF parsing only available when '.(GETID3_OS_ISWINDOWS ? 'php_exif.dll enabled' : 'compiled with --enable-exif')); + } + } + $returnOK = true; + break; + + default: + break; + } + + + $cast_as_appropriate_keys = array('EXIF', 'IFD0', 'THUMBNAIL'); + foreach ($cast_as_appropriate_keys as $exif_key) { + if (isset($info['jpg']['exif'][$exif_key])) { + foreach ($info['jpg']['exif'][$exif_key] as $key => $value) { + $info['jpg']['exif'][$exif_key][$key] = $this->CastAsAppropriate($value); + } + } + } + + + if (isset($info['jpg']['exif']['GPS'])) { + + if (isset($info['jpg']['exif']['GPS']['GPSVersion'])) { + for ($i = 0; $i < 4; $i++) { + $version_subparts[$i] = ord(substr($info['jpg']['exif']['GPS']['GPSVersion'], $i, 1)); + } + $info['jpg']['exif']['GPS']['computed']['version'] = 'v'.implode('.', $version_subparts); + } + + if (isset($info['jpg']['exif']['GPS']['GPSDateStamp'])) { + $explodedGPSDateStamp = explode(':', $info['jpg']['exif']['GPS']['GPSDateStamp']); + $computed_time[5] = (isset($explodedGPSDateStamp[0]) ? $explodedGPSDateStamp[0] : ''); + $computed_time[3] = (isset($explodedGPSDateStamp[1]) ? $explodedGPSDateStamp[1] : ''); + $computed_time[4] = (isset($explodedGPSDateStamp[2]) ? $explodedGPSDateStamp[2] : ''); + + $computed_time = array(0=>0, 1=>0, 2=>0, 3=>0, 4=>0, 5=>0); + if (isset($info['jpg']['exif']['GPS']['GPSTimeStamp']) && is_array($info['jpg']['exif']['GPS']['GPSTimeStamp'])) { + foreach ($info['jpg']['exif']['GPS']['GPSTimeStamp'] as $key => $value) { + $computed_time[$key] = getid3_lib::DecimalizeFraction($value); + } + } + $info['jpg']['exif']['GPS']['computed']['timestamp'] = gmmktime($computed_time[0], $computed_time[1], $computed_time[2], $computed_time[3], $computed_time[4], $computed_time[5]); + } + + if (isset($info['jpg']['exif']['GPS']['GPSLatitude']) && is_array($info['jpg']['exif']['GPS']['GPSLatitude'])) { + $direction_multiplier = ((isset($info['jpg']['exif']['GPS']['GPSLatitudeRef']) && ($info['jpg']['exif']['GPS']['GPSLatitudeRef'] == 'S')) ? -1 : 1); + foreach ($info['jpg']['exif']['GPS']['GPSLatitude'] as $key => $value) { + $computed_latitude[$key] = getid3_lib::DecimalizeFraction($value); + } + $info['jpg']['exif']['GPS']['computed']['latitude'] = $direction_multiplier * ($computed_latitude[0] + ($computed_latitude[1] / 60) + ($computed_latitude[2] / 3600)); + } + + if (isset($info['jpg']['exif']['GPS']['GPSLongitude']) && is_array($info['jpg']['exif']['GPS']['GPSLongitude'])) { + $direction_multiplier = ((isset($info['jpg']['exif']['GPS']['GPSLongitudeRef']) && ($info['jpg']['exif']['GPS']['GPSLongitudeRef'] == 'W')) ? -1 : 1); + foreach ($info['jpg']['exif']['GPS']['GPSLongitude'] as $key => $value) { + $computed_longitude[$key] = getid3_lib::DecimalizeFraction($value); + } + $info['jpg']['exif']['GPS']['computed']['longitude'] = $direction_multiplier * ($computed_longitude[0] + ($computed_longitude[1] / 60) + ($computed_longitude[2] / 3600)); + } + if (isset($info['jpg']['exif']['GPS']['GPSAltitudeRef'])) { + $info['jpg']['exif']['GPS']['GPSAltitudeRef'] = ord($info['jpg']['exif']['GPS']['GPSAltitudeRef']); // 0 = above sea level; 1 = below sea level + } + if (isset($info['jpg']['exif']['GPS']['GPSAltitude'])) { + $direction_multiplier = (!empty($info['jpg']['exif']['GPS']['GPSAltitudeRef']) ? -1 : 1); // 0 = above sea level; 1 = below sea level + $info['jpg']['exif']['GPS']['computed']['altitude'] = $direction_multiplier * getid3_lib::DecimalizeFraction($info['jpg']['exif']['GPS']['GPSAltitude']); + } + + } + + + getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.tag.xmp.php', __FILE__, true); + if (isset($info['filenamepath'])) { + $image_xmp = new Image_XMP($info['filenamepath']); + $xmp_raw = $image_xmp->getAllTags(); + foreach ($xmp_raw as $key => $value) { + if (strpos($key, ':')) { + list($subsection, $tagname) = explode(':', $key); + $info['xmp'][$subsection][$tagname] = $this->CastAsAppropriate($value); + } else { + $this->warning('XMP: expecting ":", found "'.$key.'"'); + } + } + } + + if (!$returnOK) { + unset($info['fileformat']); + return false; + } + return true; + } + + + public function CastAsAppropriate($value) { + if (is_array($value)) { + return $value; + } elseif (preg_match('#^[0-9]+/[0-9]+$#', $value)) { + return getid3_lib::DecimalizeFraction($value); + } elseif (preg_match('#^[0-9]+$#', $value)) { + return getid3_lib::CastAsInt($value); + } elseif (preg_match('#^[0-9\.]+$#', $value)) { + return (float) $value; + } + return $value; + } + + + public function IPTCrecordName($iptc_record) { + // http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/IPTC.html + static $IPTCrecordName = array(); + if (empty($IPTCrecordName)) { + $IPTCrecordName = array( + 1 => 'IPTCEnvelope', + 2 => 'IPTCApplication', + 3 => 'IPTCNewsPhoto', + 7 => 'IPTCPreObjectData', + 8 => 'IPTCObjectData', + 9 => 'IPTCPostObjectData', + ); + } + return (isset($IPTCrecordName[$iptc_record]) ? $IPTCrecordName[$iptc_record] : ''); + } + + + public function IPTCrecordTagName($iptc_record, $iptc_tagkey) { + // http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/IPTC.html + static $IPTCrecordTagName = array(); + if (empty($IPTCrecordTagName)) { + $IPTCrecordTagName = array( + 1 => array( // IPTC EnvelopeRecord Tags + 0 => 'EnvelopeRecordVersion', + 5 => 'Destination', + 20 => 'FileFormat', + 22 => 'FileVersion', + 30 => 'ServiceIdentifier', + 40 => 'EnvelopeNumber', + 50 => 'ProductID', + 60 => 'EnvelopePriority', + 70 => 'DateSent', + 80 => 'TimeSent', + 90 => 'CodedCharacterSet', + 100 => 'UniqueObjectName', + 120 => 'ARMIdentifier', + 122 => 'ARMVersion', + ), + 2 => array( // IPTC ApplicationRecord Tags + 0 => 'ApplicationRecordVersion', + 3 => 'ObjectTypeReference', + 4 => 'ObjectAttributeReference', + 5 => 'ObjectName', + 7 => 'EditStatus', + 8 => 'EditorialUpdate', + 10 => 'Urgency', + 12 => 'SubjectReference', + 15 => 'Category', + 20 => 'SupplementalCategories', + 22 => 'FixtureIdentifier', + 25 => 'Keywords', + 26 => 'ContentLocationCode', + 27 => 'ContentLocationName', + 30 => 'ReleaseDate', + 35 => 'ReleaseTime', + 37 => 'ExpirationDate', + 38 => 'ExpirationTime', + 40 => 'SpecialInstructions', + 42 => 'ActionAdvised', + 45 => 'ReferenceService', + 47 => 'ReferenceDate', + 50 => 'ReferenceNumber', + 55 => 'DateCreated', + 60 => 'TimeCreated', + 62 => 'DigitalCreationDate', + 63 => 'DigitalCreationTime', + 65 => 'OriginatingProgram', + 70 => 'ProgramVersion', + 75 => 'ObjectCycle', + 80 => 'By-line', + 85 => 'By-lineTitle', + 90 => 'City', + 92 => 'Sub-location', + 95 => 'Province-State', + 100 => 'Country-PrimaryLocationCode', + 101 => 'Country-PrimaryLocationName', + 103 => 'OriginalTransmissionReference', + 105 => 'Headline', + 110 => 'Credit', + 115 => 'Source', + 116 => 'CopyrightNotice', + 118 => 'Contact', + 120 => 'Caption-Abstract', + 121 => 'LocalCaption', + 122 => 'Writer-Editor', + 125 => 'RasterizedCaption', + 130 => 'ImageType', + 131 => 'ImageOrientation', + 135 => 'LanguageIdentifier', + 150 => 'AudioType', + 151 => 'AudioSamplingRate', + 152 => 'AudioSamplingResolution', + 153 => 'AudioDuration', + 154 => 'AudioOutcue', + 184 => 'JobID', + 185 => 'MasterDocumentID', + 186 => 'ShortDocumentID', + 187 => 'UniqueDocumentID', + 188 => 'OwnerID', + 200 => 'ObjectPreviewFileFormat', + 201 => 'ObjectPreviewFileVersion', + 202 => 'ObjectPreviewData', + 221 => 'Prefs', + 225 => 'ClassifyState', + 228 => 'SimilarityIndex', + 230 => 'DocumentNotes', + 231 => 'DocumentHistory', + 232 => 'ExifCameraInfo', + ), + 3 => array( // IPTC NewsPhoto Tags + 0 => 'NewsPhotoVersion', + 10 => 'IPTCPictureNumber', + 20 => 'IPTCImageWidth', + 30 => 'IPTCImageHeight', + 40 => 'IPTCPixelWidth', + 50 => 'IPTCPixelHeight', + 55 => 'SupplementalType', + 60 => 'ColorRepresentation', + 64 => 'InterchangeColorSpace', + 65 => 'ColorSequence', + 66 => 'ICC_Profile', + 70 => 'ColorCalibrationMatrix', + 80 => 'LookupTable', + 84 => 'NumIndexEntries', + 85 => 'ColorPalette', + 86 => 'IPTCBitsPerSample', + 90 => 'SampleStructure', + 100 => 'ScanningDirection', + 102 => 'IPTCImageRotation', + 110 => 'DataCompressionMethod', + 120 => 'QuantizationMethod', + 125 => 'EndPoints', + 130 => 'ExcursionTolerance', + 135 => 'BitsPerComponent', + 140 => 'MaximumDensityRange', + 145 => 'GammaCompensatedValue', + ), + 7 => array( // IPTC PreObjectData Tags + 10 => 'SizeMode', + 20 => 'MaxSubfileSize', + 90 => 'ObjectSizeAnnounced', + 95 => 'MaximumObjectSize', + ), + 8 => array( // IPTC ObjectData Tags + 10 => 'SubFile', + ), + 9 => array( // IPTC PostObjectData Tags + 10 => 'ConfirmedObjectSize', + ), + ); + + } + return (isset($IPTCrecordTagName[$iptc_record][$iptc_tagkey]) ? $IPTCrecordTagName[$iptc_record][$iptc_tagkey] : $iptc_tagkey); + } + +} diff --git a/www/rompr/getid3/module.graphic.pcd.php b/www/rompr/getid3/module.graphic.pcd.php new file mode 100755 index 0000000..c1efaa2 --- /dev/null +++ b/www/rompr/getid3/module.graphic.pcd.php @@ -0,0 +1,133 @@ + // +// available at http://getid3.sourceforge.net // +// or http://www.getid3.org // +// also https://github.com/JamesHeinrich/getID3 // +///////////////////////////////////////////////////////////////// +// See readme.txt for more details // +///////////////////////////////////////////////////////////////// +// // +// module.graphic.pcd.php // +// module for analyzing PhotoCD (PCD) Image files // +// dependencies: NONE // +// /// +///////////////////////////////////////////////////////////////// + + +class getid3_pcd extends getid3_handler +{ + public $ExtractData = 0; + + public function Analyze() { + $info = &$this->getid3->info; + + $info['fileformat'] = 'pcd'; + $info['video']['dataformat'] = 'pcd'; + $info['video']['lossless'] = false; + + + $this->fseek($info['avdataoffset'] + 72); + + $PCDflags = $this->fread(1); + $PCDisVertical = ((ord($PCDflags) & 0x01) ? true : false); + + + if ($PCDisVertical) { + $info['video']['resolution_x'] = 3072; + $info['video']['resolution_y'] = 2048; + } else { + $info['video']['resolution_x'] = 2048; + $info['video']['resolution_y'] = 3072; + } + + + if ($this->ExtractData > 3) { + + $this->error('Cannot extract PSD image data for detail levels above BASE (level-3) because encrypted with Kodak-proprietary compression/encryption.'); + + } elseif ($this->ExtractData > 0) { + + $PCD_levels[1] = array( 192, 128, 0x02000); // BASE/16 + $PCD_levels[2] = array( 384, 256, 0x0B800); // BASE/4 + $PCD_levels[3] = array( 768, 512, 0x30000); // BASE + //$PCD_levels[4] = array(1536, 1024, ??); // BASE*4 - encrypted with Kodak-proprietary compression/encryption + //$PCD_levels[5] = array(3072, 2048, ??); // BASE*16 - encrypted with Kodak-proprietary compression/encryption + //$PCD_levels[6] = array(6144, 4096, ??); // BASE*64 - encrypted with Kodak-proprietary compression/encryption; PhotoCD-Pro only + + list($PCD_width, $PCD_height, $PCD_dataOffset) = $PCD_levels[3]; + + $this->fseek($info['avdataoffset'] + $PCD_dataOffset); + + for ($y = 0; $y < $PCD_height; $y += 2) { + // The image-data of these subtypes start at the respective offsets of 02000h, 0b800h and 30000h. + // To decode the YcbYr to the more usual RGB-code, three lines of data have to be read, each + // consisting of ‘w’ bytes, where ‘w’ is the width of the image-subtype. The first ‘w’ bytes and + // the first half of the third ‘w’ bytes contain data for the first RGB-line, the second ‘w’ bytes + // and the second half of the third ‘w’ bytes contain data for a second RGB-line. + + $PCD_data_Y1 = $this->fread($PCD_width); + $PCD_data_Y2 = $this->fread($PCD_width); + $PCD_data_Cb = $this->fread(intval(round($PCD_width / 2))); + $PCD_data_Cr = $this->fread(intval(round($PCD_width / 2))); + + for ($x = 0; $x < $PCD_width; $x++) { + if ($PCDisVertical) { + $info['pcd']['data'][$PCD_width - $x][$y] = $this->YCbCr2RGB(ord($PCD_data_Y1{$x}), ord($PCD_data_Cb{floor($x / 2)}), ord($PCD_data_Cr{floor($x / 2)})); + $info['pcd']['data'][$PCD_width - $x][$y + 1] = $this->YCbCr2RGB(ord($PCD_data_Y2{$x}), ord($PCD_data_Cb{floor($x / 2)}), ord($PCD_data_Cr{floor($x / 2)})); + } else { + $info['pcd']['data'][$y][$x] = $this->YCbCr2RGB(ord($PCD_data_Y1{$x}), ord($PCD_data_Cb{floor($x / 2)}), ord($PCD_data_Cr{floor($x / 2)})); + $info['pcd']['data'][$y + 1][$x] = $this->YCbCr2RGB(ord($PCD_data_Y2{$x}), ord($PCD_data_Cb{floor($x / 2)}), ord($PCD_data_Cr{floor($x / 2)})); + } + } + } + + // Example for plotting extracted data + //getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio.ac3.php', __FILE__, true); + //if ($PCDisVertical) { + // $BMPinfo['resolution_x'] = $PCD_height; + // $BMPinfo['resolution_y'] = $PCD_width; + //} else { + // $BMPinfo['resolution_x'] = $PCD_width; + // $BMPinfo['resolution_y'] = $PCD_height; + //} + //$BMPinfo['bmp']['data'] = $info['pcd']['data']; + //getid3_bmp::PlotBMP($BMPinfo); + //exit; + + } + + } + + public function YCbCr2RGB($Y, $Cb, $Cr) { + static $YCbCr_constants = array(); + if (empty($YCbCr_constants)) { + $YCbCr_constants['red']['Y'] = 0.0054980 * 256; + $YCbCr_constants['red']['Cb'] = 0.0000000 * 256; + $YCbCr_constants['red']['Cr'] = 0.0051681 * 256; + $YCbCr_constants['green']['Y'] = 0.0054980 * 256; + $YCbCr_constants['green']['Cb'] = -0.0015446 * 256; + $YCbCr_constants['green']['Cr'] = -0.0026325 * 256; + $YCbCr_constants['blue']['Y'] = 0.0054980 * 256; + $YCbCr_constants['blue']['Cb'] = 0.0079533 * 256; + $YCbCr_constants['blue']['Cr'] = 0.0000000 * 256; + } + + $RGBcolor = array('red'=>0, 'green'=>0, 'blue'=>0); + foreach ($RGBcolor as $rgbname => $dummy) { + $RGBcolor[$rgbname] = max(0, + min(255, + intval( + round( + ($YCbCr_constants[$rgbname]['Y'] * $Y) + + ($YCbCr_constants[$rgbname]['Cb'] * ($Cb - 156)) + + ($YCbCr_constants[$rgbname]['Cr'] * ($Cr - 137)) + ) + ) + ) + ); + } + return (($RGBcolor['red'] * 65536) + ($RGBcolor['green'] * 256) + $RGBcolor['blue']); + } + +} diff --git a/www/rompr/getid3/module.graphic.png.php b/www/rompr/getid3/module.graphic.png.php new file mode 100755 index 0000000..365d0d4 --- /dev/null +++ b/www/rompr/getid3/module.graphic.png.php @@ -0,0 +1,571 @@ + // +// available at http://getid3.sourceforge.net // +// or http://www.getid3.org // +// also https://github.com/JamesHeinrich/getID3 // +///////////////////////////////////////////////////////////////// +// See readme.txt for more details // +///////////////////////////////////////////////////////////////// +// // +// module.graphic.png.php // +// module for analyzing PNG Image files // +// dependencies: NONE // +// /// +///////////////////////////////////////////////////////////////// + + +class getid3_png extends getid3_handler +{ + public $max_data_bytes = 10000000; // if data chunk is larger than this do not read it completely (getID3 only needs the first few dozen bytes for parsing) + + public function Analyze() { + + $info = &$this->getid3->info; + + // shortcut + $info['png'] = array(); + $thisfile_png = &$info['png']; + + $info['fileformat'] = 'png'; + $info['video']['dataformat'] = 'png'; + $info['video']['lossless'] = false; + + $this->fseek($info['avdataoffset']); + $PNGfiledata = $this->fread($this->getid3->fread_buffer_size()); + $offset = 0; + + $PNGidentifier = substr($PNGfiledata, $offset, 8); // $89 $50 $4E $47 $0D $0A $1A $0A + $offset += 8; + + if ($PNGidentifier != "\x89\x50\x4E\x47\x0D\x0A\x1A\x0A") { + $this->error('First 8 bytes of file ('.getid3_lib::PrintHexBytes($PNGidentifier).') did not match expected PNG identifier'); + unset($info['fileformat']); + return false; + } + + while ((($this->ftell() - (strlen($PNGfiledata) - $offset)) < $info['filesize'])) { + $chunk['data_length'] = getid3_lib::BigEndian2Int(substr($PNGfiledata, $offset, 4)); + if ($chunk['data_length'] === false) { + $this->error('Failed to read data_length at offset '.$offset); + return false; + } + $offset += 4; + $truncated_data = false; + while (((strlen($PNGfiledata) - $offset) < ($chunk['data_length'] + 4)) && ($this->ftell() < $info['filesize'])) { + if (strlen($PNGfiledata) < $this->max_data_bytes) { + $PNGfiledata .= $this->fread($this->getid3->fread_buffer_size()); + } else { + $this->warning('At offset '.$offset.' chunk "'.substr($PNGfiledata, $offset, 4).'" exceeded max_data_bytes value of '.$this->max_data_bytes.', data chunk will be truncated at '.(strlen($PNGfiledata) - 8).' bytes'); + break; + } + } + $chunk['type_text'] = substr($PNGfiledata, $offset, 4); + $offset += 4; + $chunk['type_raw'] = getid3_lib::BigEndian2Int($chunk['type_text']); + $chunk['data'] = substr($PNGfiledata, $offset, $chunk['data_length']); + $offset += $chunk['data_length']; + $chunk['crc'] = getid3_lib::BigEndian2Int(substr($PNGfiledata, $offset, 4)); + $offset += 4; + + $chunk['flags']['ancilliary'] = (bool) ($chunk['type_raw'] & 0x20000000); + $chunk['flags']['private'] = (bool) ($chunk['type_raw'] & 0x00200000); + $chunk['flags']['reserved'] = (bool) ($chunk['type_raw'] & 0x00002000); + $chunk['flags']['safe_to_copy'] = (bool) ($chunk['type_raw'] & 0x00000020); + + // shortcut + $thisfile_png[$chunk['type_text']] = array(); + $thisfile_png_chunk_type_text = &$thisfile_png[$chunk['type_text']]; + + switch ($chunk['type_text']) { + + case 'IHDR': // Image Header + $thisfile_png_chunk_type_text['header'] = $chunk; + $thisfile_png_chunk_type_text['width'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 0, 4)); + $thisfile_png_chunk_type_text['height'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 4, 4)); + $thisfile_png_chunk_type_text['raw']['bit_depth'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 8, 1)); + $thisfile_png_chunk_type_text['raw']['color_type'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 9, 1)); + $thisfile_png_chunk_type_text['raw']['compression_method'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 10, 1)); + $thisfile_png_chunk_type_text['raw']['filter_method'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 11, 1)); + $thisfile_png_chunk_type_text['raw']['interlace_method'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 12, 1)); + + $thisfile_png_chunk_type_text['compression_method_text'] = $this->PNGcompressionMethodLookup($thisfile_png_chunk_type_text['raw']['compression_method']); + $thisfile_png_chunk_type_text['color_type']['palette'] = (bool) ($thisfile_png_chunk_type_text['raw']['color_type'] & 0x01); + $thisfile_png_chunk_type_text['color_type']['true_color'] = (bool) ($thisfile_png_chunk_type_text['raw']['color_type'] & 0x02); + $thisfile_png_chunk_type_text['color_type']['alpha'] = (bool) ($thisfile_png_chunk_type_text['raw']['color_type'] & 0x04); + + $info['video']['resolution_x'] = $thisfile_png_chunk_type_text['width']; + $info['video']['resolution_y'] = $thisfile_png_chunk_type_text['height']; + + $info['video']['bits_per_sample'] = $this->IHDRcalculateBitsPerSample($thisfile_png_chunk_type_text['raw']['color_type'], $thisfile_png_chunk_type_text['raw']['bit_depth']); + break; + + + case 'PLTE': // Palette + $thisfile_png_chunk_type_text['header'] = $chunk; + $paletteoffset = 0; + for ($i = 0; $i <= 255; $i++) { + //$thisfile_png_chunk_type_text['red'][$i] = getid3_lib::BigEndian2Int(substr($chunk['data'], $paletteoffset++, 1)); + //$thisfile_png_chunk_type_text['green'][$i] = getid3_lib::BigEndian2Int(substr($chunk['data'], $paletteoffset++, 1)); + //$thisfile_png_chunk_type_text['blue'][$i] = getid3_lib::BigEndian2Int(substr($chunk['data'], $paletteoffset++, 1)); + $red = getid3_lib::BigEndian2Int(substr($chunk['data'], $paletteoffset++, 1)); + $green = getid3_lib::BigEndian2Int(substr($chunk['data'], $paletteoffset++, 1)); + $blue = getid3_lib::BigEndian2Int(substr($chunk['data'], $paletteoffset++, 1)); + $thisfile_png_chunk_type_text[$i] = (($red << 16) | ($green << 8) | ($blue)); + } + break; + + + case 'tRNS': // Transparency + $thisfile_png_chunk_type_text['header'] = $chunk; + switch ($thisfile_png['IHDR']['raw']['color_type']) { + case 0: + $thisfile_png_chunk_type_text['transparent_color_gray'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 0, 2)); + break; + + case 2: + $thisfile_png_chunk_type_text['transparent_color_red'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 0, 2)); + $thisfile_png_chunk_type_text['transparent_color_green'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 2, 2)); + $thisfile_png_chunk_type_text['transparent_color_blue'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 4, 2)); + break; + + case 3: + for ($i = 0; $i < strlen($chunk['data']); $i++) { + $thisfile_png_chunk_type_text['palette_opacity'][$i] = getid3_lib::BigEndian2Int(substr($chunk['data'], $i, 1)); + } + break; + + case 4: + case 6: + $this->error('Invalid color_type in tRNS chunk: '.$thisfile_png['IHDR']['raw']['color_type']); + + default: + $this->warning('Unhandled color_type in tRNS chunk: '.$thisfile_png['IHDR']['raw']['color_type']); + break; + } + break; + + + case 'gAMA': // Image Gamma + $thisfile_png_chunk_type_text['header'] = $chunk; + $thisfile_png_chunk_type_text['gamma'] = getid3_lib::BigEndian2Int($chunk['data']) / 100000; + break; + + + case 'cHRM': // Primary Chromaticities + $thisfile_png_chunk_type_text['header'] = $chunk; + $thisfile_png_chunk_type_text['white_x'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 0, 4)) / 100000; + $thisfile_png_chunk_type_text['white_y'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 4, 4)) / 100000; + $thisfile_png_chunk_type_text['red_y'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 8, 4)) / 100000; + $thisfile_png_chunk_type_text['red_y'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 12, 4)) / 100000; + $thisfile_png_chunk_type_text['green_y'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 16, 4)) / 100000; + $thisfile_png_chunk_type_text['green_y'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 20, 4)) / 100000; + $thisfile_png_chunk_type_text['blue_y'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 24, 4)) / 100000; + $thisfile_png_chunk_type_text['blue_y'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 28, 4)) / 100000; + break; + + + case 'sRGB': // Standard RGB Color Space + $thisfile_png_chunk_type_text['header'] = $chunk; + $thisfile_png_chunk_type_text['reindering_intent'] = getid3_lib::BigEndian2Int($chunk['data']); + $thisfile_png_chunk_type_text['reindering_intent_text'] = $this->PNGsRGBintentLookup($thisfile_png_chunk_type_text['reindering_intent']); + break; + + + case 'iCCP': // Embedded ICC Profile + $thisfile_png_chunk_type_text['header'] = $chunk; + list($profilename, $compressiondata) = explode("\x00", $chunk['data'], 2); + $thisfile_png_chunk_type_text['profile_name'] = $profilename; + $thisfile_png_chunk_type_text['compression_method'] = getid3_lib::BigEndian2Int(substr($compressiondata, 0, 1)); + $thisfile_png_chunk_type_text['compression_profile'] = substr($compressiondata, 1); + + $thisfile_png_chunk_type_text['compression_method_text'] = $this->PNGcompressionMethodLookup($thisfile_png_chunk_type_text['compression_method']); + break; + + + case 'tEXt': // Textual Data + $thisfile_png_chunk_type_text['header'] = $chunk; + list($keyword, $text) = explode("\x00", $chunk['data'], 2); + $thisfile_png_chunk_type_text['keyword'] = $keyword; + $thisfile_png_chunk_type_text['text'] = $text; + + $thisfile_png['comments'][$thisfile_png_chunk_type_text['keyword']][] = $thisfile_png_chunk_type_text['text']; + break; + + + case 'zTXt': // Compressed Textual Data + $thisfile_png_chunk_type_text['header'] = $chunk; + list($keyword, $otherdata) = explode("\x00", $chunk['data'], 2); + $thisfile_png_chunk_type_text['keyword'] = $keyword; + $thisfile_png_chunk_type_text['compression_method'] = getid3_lib::BigEndian2Int(substr($otherdata, 0, 1)); + $thisfile_png_chunk_type_text['compressed_text'] = substr($otherdata, 1); + $thisfile_png_chunk_type_text['compression_method_text'] = $this->PNGcompressionMethodLookup($thisfile_png_chunk_type_text['compression_method']); + switch ($thisfile_png_chunk_type_text['compression_method']) { + case 0: + $thisfile_png_chunk_type_text['text'] = gzuncompress($thisfile_png_chunk_type_text['compressed_text']); + break; + + default: + // unknown compression method + break; + } + + if (isset($thisfile_png_chunk_type_text['text'])) { + $thisfile_png['comments'][$thisfile_png_chunk_type_text['keyword']][] = $thisfile_png_chunk_type_text['text']; + } + break; + + + case 'iTXt': // International Textual Data + $thisfile_png_chunk_type_text['header'] = $chunk; + list($keyword, $otherdata) = explode("\x00", $chunk['data'], 2); + $thisfile_png_chunk_type_text['keyword'] = $keyword; + $thisfile_png_chunk_type_text['compression'] = (bool) getid3_lib::BigEndian2Int(substr($otherdata, 0, 1)); + $thisfile_png_chunk_type_text['compression_method'] = getid3_lib::BigEndian2Int(substr($otherdata, 1, 1)); + $thisfile_png_chunk_type_text['compression_method_text'] = $this->PNGcompressionMethodLookup($thisfile_png_chunk_type_text['compression_method']); + list($languagetag, $translatedkeyword, $text) = explode("\x00", substr($otherdata, 2), 3); + $thisfile_png_chunk_type_text['language_tag'] = $languagetag; + $thisfile_png_chunk_type_text['translated_keyword'] = $translatedkeyword; + + if ($thisfile_png_chunk_type_text['compression']) { + + switch ($thisfile_png_chunk_type_text['compression_method']) { + case 0: + $thisfile_png_chunk_type_text['text'] = gzuncompress($text); + break; + + default: + // unknown compression method + break; + } + + } else { + + $thisfile_png_chunk_type_text['text'] = $text; + + } + + if (isset($thisfile_png_chunk_type_text['text'])) { + $thisfile_png['comments'][$thisfile_png_chunk_type_text['keyword']][] = $thisfile_png_chunk_type_text['text']; + } + break; + + + case 'bKGD': // Background Color + $thisfile_png_chunk_type_text['header'] = $chunk; + switch ($thisfile_png['IHDR']['raw']['color_type']) { + case 0: + case 4: + $thisfile_png_chunk_type_text['background_gray'] = getid3_lib::BigEndian2Int($chunk['data']); + break; + + case 2: + case 6: + $thisfile_png_chunk_type_text['background_red'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 0 * $thisfile_png['IHDR']['raw']['bit_depth'], $thisfile_png['IHDR']['raw']['bit_depth'])); + $thisfile_png_chunk_type_text['background_green'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 1 * $thisfile_png['IHDR']['raw']['bit_depth'], $thisfile_png['IHDR']['raw']['bit_depth'])); + $thisfile_png_chunk_type_text['background_blue'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 2 * $thisfile_png['IHDR']['raw']['bit_depth'], $thisfile_png['IHDR']['raw']['bit_depth'])); + break; + + case 3: + $thisfile_png_chunk_type_text['background_index'] = getid3_lib::BigEndian2Int($chunk['data']); + break; + + default: + break; + } + break; + + + case 'pHYs': // Physical Pixel Dimensions + $thisfile_png_chunk_type_text['header'] = $chunk; + $thisfile_png_chunk_type_text['pixels_per_unit_x'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 0, 4)); + $thisfile_png_chunk_type_text['pixels_per_unit_y'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 4, 4)); + $thisfile_png_chunk_type_text['unit_specifier'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 8, 1)); + $thisfile_png_chunk_type_text['unit'] = $this->PNGpHYsUnitLookup($thisfile_png_chunk_type_text['unit_specifier']); + break; + + + case 'sBIT': // Significant Bits + $thisfile_png_chunk_type_text['header'] = $chunk; + switch ($thisfile_png['IHDR']['raw']['color_type']) { + case 0: + $thisfile_png_chunk_type_text['significant_bits_gray'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 0, 1)); + break; + + case 2: + case 3: + $thisfile_png_chunk_type_text['significant_bits_red'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 0, 1)); + $thisfile_png_chunk_type_text['significant_bits_green'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 1, 1)); + $thisfile_png_chunk_type_text['significant_bits_blue'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 2, 1)); + break; + + case 4: + $thisfile_png_chunk_type_text['significant_bits_gray'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 0, 1)); + $thisfile_png_chunk_type_text['significant_bits_alpha'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 1, 1)); + break; + + case 6: + $thisfile_png_chunk_type_text['significant_bits_red'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 0, 1)); + $thisfile_png_chunk_type_text['significant_bits_green'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 1, 1)); + $thisfile_png_chunk_type_text['significant_bits_blue'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 2, 1)); + $thisfile_png_chunk_type_text['significant_bits_alpha'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 3, 1)); + break; + + default: + break; + } + break; + + + case 'sPLT': // Suggested Palette + $thisfile_png_chunk_type_text['header'] = $chunk; + list($palettename, $otherdata) = explode("\x00", $chunk['data'], 2); + $thisfile_png_chunk_type_text['palette_name'] = $palettename; + $sPLToffset = 0; + $thisfile_png_chunk_type_text['sample_depth_bits'] = getid3_lib::BigEndian2Int(substr($otherdata, $sPLToffset, 1)); + $sPLToffset += 1; + $thisfile_png_chunk_type_text['sample_depth_bytes'] = $thisfile_png_chunk_type_text['sample_depth_bits'] / 8; + $paletteCounter = 0; + while ($sPLToffset < strlen($otherdata)) { + $thisfile_png_chunk_type_text['red'][$paletteCounter] = getid3_lib::BigEndian2Int(substr($otherdata, $sPLToffset, $thisfile_png_chunk_type_text['sample_depth_bytes'])); + $sPLToffset += $thisfile_png_chunk_type_text['sample_depth_bytes']; + $thisfile_png_chunk_type_text['green'][$paletteCounter] = getid3_lib::BigEndian2Int(substr($otherdata, $sPLToffset, $thisfile_png_chunk_type_text['sample_depth_bytes'])); + $sPLToffset += $thisfile_png_chunk_type_text['sample_depth_bytes']; + $thisfile_png_chunk_type_text['blue'][$paletteCounter] = getid3_lib::BigEndian2Int(substr($otherdata, $sPLToffset, $thisfile_png_chunk_type_text['sample_depth_bytes'])); + $sPLToffset += $thisfile_png_chunk_type_text['sample_depth_bytes']; + $thisfile_png_chunk_type_text['alpha'][$paletteCounter] = getid3_lib::BigEndian2Int(substr($otherdata, $sPLToffset, $thisfile_png_chunk_type_text['sample_depth_bytes'])); + $sPLToffset += $thisfile_png_chunk_type_text['sample_depth_bytes']; + $thisfile_png_chunk_type_text['frequency'][$paletteCounter] = getid3_lib::BigEndian2Int(substr($otherdata, $sPLToffset, 2)); + $sPLToffset += 2; + $paletteCounter++; + } + break; + + + case 'hIST': // Palette Histogram + $thisfile_png_chunk_type_text['header'] = $chunk; + $hISTcounter = 0; + while ($hISTcounter < strlen($chunk['data'])) { + $thisfile_png_chunk_type_text[$hISTcounter] = getid3_lib::BigEndian2Int(substr($chunk['data'], $hISTcounter / 2, 2)); + $hISTcounter += 2; + } + break; + + + case 'tIME': // Image Last-Modification Time + $thisfile_png_chunk_type_text['header'] = $chunk; + $thisfile_png_chunk_type_text['year'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 0, 2)); + $thisfile_png_chunk_type_text['month'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 2, 1)); + $thisfile_png_chunk_type_text['day'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 3, 1)); + $thisfile_png_chunk_type_text['hour'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 4, 1)); + $thisfile_png_chunk_type_text['minute'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 5, 1)); + $thisfile_png_chunk_type_text['second'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 6, 1)); + $thisfile_png_chunk_type_text['unix'] = gmmktime($thisfile_png_chunk_type_text['hour'], $thisfile_png_chunk_type_text['minute'], $thisfile_png_chunk_type_text['second'], $thisfile_png_chunk_type_text['month'], $thisfile_png_chunk_type_text['day'], $thisfile_png_chunk_type_text['year']); + break; + + + case 'oFFs': // Image Offset + $thisfile_png_chunk_type_text['header'] = $chunk; + $thisfile_png_chunk_type_text['position_x'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 0, 4), false, true); + $thisfile_png_chunk_type_text['position_y'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 4, 4), false, true); + $thisfile_png_chunk_type_text['unit_specifier'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 8, 1)); + $thisfile_png_chunk_type_text['unit'] = $this->PNGoFFsUnitLookup($thisfile_png_chunk_type_text['unit_specifier']); + break; + + + case 'pCAL': // Calibration Of Pixel Values + $thisfile_png_chunk_type_text['header'] = $chunk; + list($calibrationname, $otherdata) = explode("\x00", $chunk['data'], 2); + $thisfile_png_chunk_type_text['calibration_name'] = $calibrationname; + $pCALoffset = 0; + $thisfile_png_chunk_type_text['original_zero'] = getid3_lib::BigEndian2Int(substr($chunk['data'], $pCALoffset, 4), false, true); + $pCALoffset += 4; + $thisfile_png_chunk_type_text['original_max'] = getid3_lib::BigEndian2Int(substr($chunk['data'], $pCALoffset, 4), false, true); + $pCALoffset += 4; + $thisfile_png_chunk_type_text['equation_type'] = getid3_lib::BigEndian2Int(substr($chunk['data'], $pCALoffset, 1)); + $pCALoffset += 1; + $thisfile_png_chunk_type_text['equation_type_text'] = $this->PNGpCALequationTypeLookup($thisfile_png_chunk_type_text['equation_type']); + $thisfile_png_chunk_type_text['parameter_count'] = getid3_lib::BigEndian2Int(substr($chunk['data'], $pCALoffset, 1)); + $pCALoffset += 1; + $thisfile_png_chunk_type_text['parameters'] = explode("\x00", substr($chunk['data'], $pCALoffset)); + break; + + + case 'sCAL': // Physical Scale Of Image Subject + $thisfile_png_chunk_type_text['header'] = $chunk; + $thisfile_png_chunk_type_text['unit_specifier'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 0, 1)); + $thisfile_png_chunk_type_text['unit'] = $this->PNGsCALUnitLookup($thisfile_png_chunk_type_text['unit_specifier']); + list($pixelwidth, $pixelheight) = explode("\x00", substr($chunk['data'], 1)); + $thisfile_png_chunk_type_text['pixel_width'] = $pixelwidth; + $thisfile_png_chunk_type_text['pixel_height'] = $pixelheight; + break; + + + case 'gIFg': // GIF Graphic Control Extension + $gIFgCounter = 0; + if (isset($thisfile_png_chunk_type_text) && is_array($thisfile_png_chunk_type_text)) { + $gIFgCounter = count($thisfile_png_chunk_type_text); + } + $thisfile_png_chunk_type_text[$gIFgCounter]['header'] = $chunk; + $thisfile_png_chunk_type_text[$gIFgCounter]['disposal_method'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 0, 1)); + $thisfile_png_chunk_type_text[$gIFgCounter]['user_input_flag'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 1, 1)); + $thisfile_png_chunk_type_text[$gIFgCounter]['delay_time'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 2, 2)); + break; + + + case 'gIFx': // GIF Application Extension + $gIFxCounter = 0; + if (isset($thisfile_png_chunk_type_text) && is_array($thisfile_png_chunk_type_text)) { + $gIFxCounter = count($thisfile_png_chunk_type_text); + } + $thisfile_png_chunk_type_text[$gIFxCounter]['header'] = $chunk; + $thisfile_png_chunk_type_text[$gIFxCounter]['application_identifier'] = substr($chunk['data'], 0, 8); + $thisfile_png_chunk_type_text[$gIFxCounter]['authentication_code'] = substr($chunk['data'], 8, 3); + $thisfile_png_chunk_type_text[$gIFxCounter]['application_data'] = substr($chunk['data'], 11); + break; + + + case 'IDAT': // Image Data + $idatinformationfieldindex = 0; + if (isset($thisfile_png['IDAT']) && is_array($thisfile_png['IDAT'])) { + $idatinformationfieldindex = count($thisfile_png['IDAT']); + } + unset($chunk['data']); + $thisfile_png_chunk_type_text[$idatinformationfieldindex]['header'] = $chunk; + break; + + case 'IEND': // Image Trailer + $thisfile_png_chunk_type_text['header'] = $chunk; + break; + + case 'acTL': // Animation Control chunk + // https://wiki.mozilla.org/APNG_Specification#.60acTL.60:_The_Animation_Control_Chunk + $thisfile_png['animation']['num_frames'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 0, 4)); // Number of frames + $thisfile_png['animation']['num_plays'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 4, 4)); // Number of times to loop this APNG. 0 indicates infinite looping. + + unset($chunk['data']); + $thisfile_png_chunk_type_text['header'] = $chunk; + break; + + case 'fcTL': // Frame Control chunk + // https://wiki.mozilla.org/APNG_Specification#.60fcTL.60:_The_Frame_Control_Chunk + $fcTL = array(); + $fcTL['sequence_number'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 0, 4)); // Sequence number of the animation chunk, starting from 0 + $fcTL['width'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 4, 4)); // Width of the following frame + $fcTL['height'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 8, 4)); // Height of the following frame + $fcTL['x_offset'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 12, 4)); // X position at which to render the following frame + $fcTL['y_offset'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 16, 4)); // Y position at which to render the following frame + $fcTL['delay_num'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 20, 2)); // Frame delay fraction numerator + $fcTL['delay_den'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 22, 2)); // Frame delay fraction numerator + $fcTL['dispose_op'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 23, 1)); // Type of frame area disposal to be done after rendering this frame + $fcTL['blend_op'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 23, 1)); // Type of frame area rendering for this frame + if ($fcTL['delay_den']) { + $fcTL['delay'] = $fcTL['delay_num'] / $fcTL['delay_den']; + } + $thisfile_png['animation']['fcTL'][$fcTL['sequence_number']] = $fcTL; + + unset($chunk['data']); + $thisfile_png_chunk_type_text['header'] = $chunk; + break; + + case 'fdAT': // Frame Data chunk + // https://wiki.mozilla.org/APNG_Specification#.60fcTL.60:_The_Frame_Control_Chunk + // "The `fdAT` chunk has the same purpose as an `IDAT` chunk. It has the same structure as an `IDAT` chunk, except preceded by a sequence number." + unset($chunk['data']); + $thisfile_png_chunk_type_text['header'] = $chunk; + break; + + default: + //unset($chunk['data']); + $thisfile_png_chunk_type_text['header'] = $chunk; + $this->warning('Unhandled chunk type: '.$chunk['type_text']); + break; + } + } + if (!empty($thisfile_png['animation']['num_frames']) && !empty($thisfile_png['animation']['fcTL'])) { + $info['video']['dataformat'] = 'apng'; + $info['playtime_seconds'] = 0; + foreach ($thisfile_png['animation']['fcTL'] as $seqno => $fcTL) { + $info['playtime_seconds'] += $fcTL['delay']; + } + } + return true; + } + + public function PNGsRGBintentLookup($sRGB) { + static $PNGsRGBintentLookup = array( + 0 => 'Perceptual', + 1 => 'Relative colorimetric', + 2 => 'Saturation', + 3 => 'Absolute colorimetric' + ); + return (isset($PNGsRGBintentLookup[$sRGB]) ? $PNGsRGBintentLookup[$sRGB] : 'invalid'); + } + + public function PNGcompressionMethodLookup($compressionmethod) { + static $PNGcompressionMethodLookup = array( + 0 => 'deflate/inflate' + ); + return (isset($PNGcompressionMethodLookup[$compressionmethod]) ? $PNGcompressionMethodLookup[$compressionmethod] : 'invalid'); + } + + public function PNGpHYsUnitLookup($unitid) { + static $PNGpHYsUnitLookup = array( + 0 => 'unknown', + 1 => 'meter' + ); + return (isset($PNGpHYsUnitLookup[$unitid]) ? $PNGpHYsUnitLookup[$unitid] : 'invalid'); + } + + public function PNGoFFsUnitLookup($unitid) { + static $PNGoFFsUnitLookup = array( + 0 => 'pixel', + 1 => 'micrometer' + ); + return (isset($PNGoFFsUnitLookup[$unitid]) ? $PNGoFFsUnitLookup[$unitid] : 'invalid'); + } + + public function PNGpCALequationTypeLookup($equationtype) { + static $PNGpCALequationTypeLookup = array( + 0 => 'Linear mapping', + 1 => 'Base-e exponential mapping', + 2 => 'Arbitrary-base exponential mapping', + 3 => 'Hyperbolic mapping' + ); + return (isset($PNGpCALequationTypeLookup[$equationtype]) ? $PNGpCALequationTypeLookup[$equationtype] : 'invalid'); + } + + public function PNGsCALUnitLookup($unitid) { + static $PNGsCALUnitLookup = array( + 0 => 'meter', + 1 => 'radian' + ); + return (isset($PNGsCALUnitLookup[$unitid]) ? $PNGsCALUnitLookup[$unitid] : 'invalid'); + } + + public function IHDRcalculateBitsPerSample($color_type, $bit_depth) { + switch ($color_type) { + case 0: // Each pixel is a grayscale sample. + return $bit_depth; + break; + + case 2: // Each pixel is an R,G,B triple + return 3 * $bit_depth; + break; + + case 3: // Each pixel is a palette index; a PLTE chunk must appear. + return $bit_depth; + break; + + case 4: // Each pixel is a grayscale sample, followed by an alpha sample. + return 2 * $bit_depth; + break; + + case 6: // Each pixel is an R,G,B triple, followed by an alpha sample. + return 4 * $bit_depth; + break; + } + return false; + } + +} diff --git a/www/rompr/getid3/module.graphic.svg.php b/www/rompr/getid3/module.graphic.svg.php new file mode 100755 index 0000000..e4502aa --- /dev/null +++ b/www/rompr/getid3/module.graphic.svg.php @@ -0,0 +1,102 @@ + // +// available at http://getid3.sourceforge.net // +// or http://www.getid3.org // +// also https://github.com/JamesHeinrich/getID3 // +///////////////////////////////////////////////////////////////// +// See readme.txt for more details // +///////////////////////////////////////////////////////////////// +// // +// module.graphic.svg.php // +// module for analyzing SVG Image files // +// dependencies: NONE // +// /// +///////////////////////////////////////////////////////////////// + + +class getid3_svg extends getid3_handler +{ + + + public function Analyze() { + $info = &$this->getid3->info; + + $this->fseek($info['avdataoffset']); + + $SVGheader = $this->fread(4096); + if (preg_match('#\<\?xml([^\>]+)\?\>#i', $SVGheader, $matches)) { + $info['svg']['xml']['raw'] = $matches; + } + if (preg_match('#\<\!DOCTYPE([^\>]+)\>#i', $SVGheader, $matches)) { + $info['svg']['doctype']['raw'] = $matches; + } + if (preg_match('#\]+)\>#i', $SVGheader, $matches)) { + $info['svg']['svg']['raw'] = $matches; + } + if (isset($info['svg']['svg']['raw'])) { + + $sections_to_fix = array('xml', 'doctype', 'svg'); + foreach ($sections_to_fix as $section_to_fix) { + if (!isset($info['svg'][$section_to_fix])) { + continue; + } + $section_data = array(); + while (preg_match('/ "([^"]+)"/', $info['svg'][$section_to_fix]['raw'][1], $matches)) { + $section_data[] = $matches[1]; + $info['svg'][$section_to_fix]['raw'][1] = str_replace($matches[0], '', $info['svg'][$section_to_fix]['raw'][1]); + } + while (preg_match('/([^\s]+)="([^"]+)"/', $info['svg'][$section_to_fix]['raw'][1], $matches)) { + $section_data[] = $matches[0]; + $info['svg'][$section_to_fix]['raw'][1] = str_replace($matches[0], '', $info['svg'][$section_to_fix]['raw'][1]); + } + $section_data = array_merge($section_data, preg_split('/[\s,]+/', $info['svg'][$section_to_fix]['raw'][1])); + foreach ($section_data as $keyvaluepair) { + $keyvaluepair = trim($keyvaluepair); + if ($keyvaluepair) { + $keyvalueexploded = explode('=', $keyvaluepair); + $key = (isset($keyvalueexploded[0]) ? $keyvalueexploded[0] : ''); + $value = (isset($keyvalueexploded[1]) ? $keyvalueexploded[1] : ''); + $info['svg'][$section_to_fix]['sections'][$key] = trim($value, '"'); + } + } + } + + $info['fileformat'] = 'svg'; + $info['video']['dataformat'] = 'svg'; + $info['video']['lossless'] = true; + //$info['video']['bits_per_sample'] = 24; + $info['video']['pixel_aspect_ratio'] = (float) 1; + + if (!empty($info['svg']['svg']['sections']['width'])) { + $info['svg']['width'] = intval($info['svg']['svg']['sections']['width']); + } + if (!empty($info['svg']['svg']['sections']['height'])) { + $info['svg']['height'] = intval($info['svg']['svg']['sections']['height']); + } + if (!empty($info['svg']['svg']['sections']['version'])) { + $info['svg']['version'] = $info['svg']['svg']['sections']['version']; + } + if (!isset($info['svg']['version']) && isset($info['svg']['doctype']['sections'])) { + foreach ($info['svg']['doctype']['sections'] as $key => $value) { + if (preg_match('#//W3C//DTD SVG ([0-9\.]+)//#i', $key, $matches)) { + $info['svg']['version'] = $matches[1]; + break; + } + } + } + + if (!empty($info['svg']['width'])) { + $info['video']['resolution_x'] = $info['svg']['width']; + } + if (!empty($info['svg']['height'])) { + $info['video']['resolution_y'] = $info['svg']['height']; + } + + return true; + } + $this->error('Did not find expected tag'); + return false; + } + +} diff --git a/www/rompr/getid3/module.graphic.tiff.php b/www/rompr/getid3/module.graphic.tiff.php new file mode 100755 index 0000000..90dcb5c --- /dev/null +++ b/www/rompr/getid3/module.graphic.tiff.php @@ -0,0 +1,225 @@ + // +// available at http://getid3.sourceforge.net // +// or http://www.getid3.org // +// also https://github.com/JamesHeinrich/getID3 // +///////////////////////////////////////////////////////////////// +// See readme.txt for more details // +///////////////////////////////////////////////////////////////// +// // +// module.archive.tiff.php // +// module for analyzing TIFF files // +// dependencies: NONE // +// /// +///////////////////////////////////////////////////////////////// + + +class getid3_tiff extends getid3_handler +{ + + public function Analyze() { + $info = &$this->getid3->info; + + $this->fseek($info['avdataoffset']); + $TIFFheader = $this->fread(4); + + switch (substr($TIFFheader, 0, 2)) { + case 'II': + $info['tiff']['byte_order'] = 'Intel'; + break; + case 'MM': + $info['tiff']['byte_order'] = 'Motorola'; + break; + default: + $this->error('Invalid TIFF byte order identifier ('.substr($TIFFheader, 0, 2).') at offset '.$info['avdataoffset']); + return false; + break; + } + + $info['fileformat'] = 'tiff'; + $info['video']['dataformat'] = 'tiff'; + $info['video']['lossless'] = true; + $info['tiff']['ifd'] = array(); + $CurrentIFD = array(); + + $FieldTypeByteLength = array(1=>1, 2=>1, 3=>2, 4=>4, 5=>8); + + $nextIFDoffset = $this->TIFFendian2Int($this->fread(4), $info['tiff']['byte_order']); + + while ($nextIFDoffset > 0) { + + $CurrentIFD['offset'] = $nextIFDoffset; + + $this->fseek($info['avdataoffset'] + $nextIFDoffset); + $CurrentIFD['fieldcount'] = $this->TIFFendian2Int($this->fread(2), $info['tiff']['byte_order']); + + for ($i = 0; $i < $CurrentIFD['fieldcount']; $i++) { + $CurrentIFD['fields'][$i]['raw']['tag'] = $this->TIFFendian2Int($this->fread(2), $info['tiff']['byte_order']); + $CurrentIFD['fields'][$i]['raw']['type'] = $this->TIFFendian2Int($this->fread(2), $info['tiff']['byte_order']); + $CurrentIFD['fields'][$i]['raw']['length'] = $this->TIFFendian2Int($this->fread(4), $info['tiff']['byte_order']); + $CurrentIFD['fields'][$i]['raw']['offset'] = $this->fread(4); + + switch ($CurrentIFD['fields'][$i]['raw']['type']) { + case 1: // BYTE An 8-bit unsigned integer. + if ($CurrentIFD['fields'][$i]['raw']['length'] <= 4) { + $CurrentIFD['fields'][$i]['value'] = $this->TIFFendian2Int(substr($CurrentIFD['fields'][$i]['raw']['offset'], 0, 1), $info['tiff']['byte_order']); + } else { + $CurrentIFD['fields'][$i]['offset'] = $this->TIFFendian2Int($CurrentIFD['fields'][$i]['raw']['offset'], $info['tiff']['byte_order']); + } + break; + + case 2: // ASCII 8-bit bytes that store ASCII codes; the last byte must be null. + if ($CurrentIFD['fields'][$i]['raw']['length'] <= 4) { + $CurrentIFD['fields'][$i]['value'] = substr($CurrentIFD['fields'][$i]['raw']['offset'], 3); + } else { + $CurrentIFD['fields'][$i]['offset'] = $this->TIFFendian2Int($CurrentIFD['fields'][$i]['raw']['offset'], $info['tiff']['byte_order']); + } + break; + + case 3: // SHORT A 16-bit (2-byte) unsigned integer. + if ($CurrentIFD['fields'][$i]['raw']['length'] <= 2) { + $CurrentIFD['fields'][$i]['value'] = $this->TIFFendian2Int(substr($CurrentIFD['fields'][$i]['raw']['offset'], 0, 2), $info['tiff']['byte_order']); + } else { + $CurrentIFD['fields'][$i]['offset'] = $this->TIFFendian2Int($CurrentIFD['fields'][$i]['raw']['offset'], $info['tiff']['byte_order']); + } + break; + + case 4: // LONG A 32-bit (4-byte) unsigned integer. + if ($CurrentIFD['fields'][$i]['raw']['length'] <= 1) { + $CurrentIFD['fields'][$i]['value'] = $this->TIFFendian2Int($CurrentIFD['fields'][$i]['raw']['offset'], $info['tiff']['byte_order']); + } else { + $CurrentIFD['fields'][$i]['offset'] = $this->TIFFendian2Int($CurrentIFD['fields'][$i]['raw']['offset'], $info['tiff']['byte_order']); + } + break; + + case 5: // RATIONAL Two LONG_s: the first represents the numerator of a fraction, the second the denominator. + break; + } + } + + $info['tiff']['ifd'][] = $CurrentIFD; + $CurrentIFD = array(); + $nextIFDoffset = $this->TIFFendian2Int($this->fread(4), $info['tiff']['byte_order']); + + } + + foreach ($info['tiff']['ifd'] as $IFDid => $IFDarray) { + foreach ($IFDarray['fields'] as $key => $fieldarray) { + switch ($fieldarray['raw']['tag']) { + case 256: // ImageWidth + case 257: // ImageLength + case 258: // BitsPerSample + case 259: // Compression + if (!isset($fieldarray['value'])) { + $this->fseek($fieldarray['offset']); + $info['tiff']['ifd'][$IFDid]['fields'][$key]['raw']['data'] = $this->fread($fieldarray['raw']['length'] * $FieldTypeByteLength[$fieldarray['raw']['type']]); + + } + break; + + case 270: // ImageDescription + case 271: // Make + case 272: // Model + case 305: // Software + case 306: // DateTime + case 315: // Artist + case 316: // HostComputer + if (isset($fieldarray['value'])) { + $info['tiff']['ifd'][$IFDid]['fields'][$key]['raw']['data'] = $fieldarray['value']; + } else { + $this->fseek($fieldarray['offset']); + $info['tiff']['ifd'][$IFDid]['fields'][$key]['raw']['data'] = $this->fread($fieldarray['raw']['length'] * $FieldTypeByteLength[$fieldarray['raw']['type']]); + + } + break; + } + switch ($fieldarray['raw']['tag']) { + case 256: // ImageWidth + $info['video']['resolution_x'] = $fieldarray['value']; + break; + + case 257: // ImageLength + $info['video']['resolution_y'] = $fieldarray['value']; + break; + + case 258: // BitsPerSample + if (isset($fieldarray['value'])) { + $info['video']['bits_per_sample'] = $fieldarray['value']; + } else { + $info['video']['bits_per_sample'] = 0; + for ($i = 0; $i < $fieldarray['raw']['length']; $i++) { + $info['video']['bits_per_sample'] += $this->TIFFendian2Int(substr($info['tiff']['ifd'][$IFDid]['fields'][$key]['raw']['data'], $i * $FieldTypeByteLength[$fieldarray['raw']['type']], $FieldTypeByteLength[$fieldarray['raw']['type']]), $info['tiff']['byte_order']); + } + } + break; + + case 259: // Compression + $info['video']['codec'] = $this->TIFFcompressionMethod($fieldarray['value']); + break; + + case 270: // ImageDescription + case 271: // Make + case 272: // Model + case 305: // Software + case 306: // DateTime + case 315: // Artist + case 316: // HostComputer + $TIFFcommentName = $this->TIFFcommentName($fieldarray['raw']['tag']); + if (isset($info['tiff']['comments'][$TIFFcommentName])) { + $info['tiff']['comments'][$TIFFcommentName][] = $info['tiff']['ifd'][$IFDid]['fields'][$key]['raw']['data']; + } else { + $info['tiff']['comments'][$TIFFcommentName] = array($info['tiff']['ifd'][$IFDid]['fields'][$key]['raw']['data']); + } + break; + + default: + break; + } + } + } + + return true; + } + + + public function TIFFendian2Int($bytestring, $byteorder) { + if ($byteorder == 'Intel') { + return getid3_lib::LittleEndian2Int($bytestring); + } elseif ($byteorder == 'Motorola') { + return getid3_lib::BigEndian2Int($bytestring); + } + return false; + } + + public function TIFFcompressionMethod($id) { + static $TIFFcompressionMethod = array(); + if (empty($TIFFcompressionMethod)) { + $TIFFcompressionMethod = array( + 1 => 'Uncompressed', + 2 => 'Huffman', + 3 => 'Fax - CCITT 3', + 5 => 'LZW', + 32773 => 'PackBits', + ); + } + return (isset($TIFFcompressionMethod[$id]) ? $TIFFcompressionMethod[$id] : 'unknown/invalid ('.$id.')'); + } + + public function TIFFcommentName($id) { + static $TIFFcommentName = array(); + if (empty($TIFFcommentName)) { + $TIFFcommentName = array( + 270 => 'imagedescription', + 271 => 'make', + 272 => 'model', + 305 => 'software', + 306 => 'datetime', + 315 => 'artist', + 316 => 'hostcomputer', + ); + } + return (isset($TIFFcommentName[$id]) ? $TIFFcommentName[$id] : 'unknown/invalid ('.$id.')'); + } + +} diff --git a/www/rompr/getid3/module.misc.cue.php b/www/rompr/getid3/module.misc.cue.php new file mode 100644 index 0000000..9c42799 --- /dev/null +++ b/www/rompr/getid3/module.misc.cue.php @@ -0,0 +1,312 @@ + // +// available at http://getid3.sourceforge.net // +// or http://www.getid3.org // +// also https://github.com/JamesHeinrich/getID3 // +///////////////////////////////////////////////////////////////// +// See readme.txt for more details // +///////////////////////////////////////////////////////////////// +// // +// module.misc.cue.php // +// module for analyzing CUEsheet files // +// dependencies: NONE // +// // +///////////////////////////////////////////////////////////////// +// // +// Module originally written [2009-Mar-25] by // +// Nigel Barnes // +// Minor reformatting and similar small changes to integrate // +// into getID3 by James Heinrich // +// /// +///////////////////////////////////////////////////////////////// + +/* + * CueSheet parser by Nigel Barnes. + * + * This is a PHP conversion of CueSharp 0.5 by Wyatt O'Day (wyday.com/cuesharp) + */ + +/** + * A CueSheet class used to open and parse cuesheets. + * + */ +class getid3_cue extends getid3_handler +{ + public $cuesheet = array(); + + public function Analyze() { + $info = &$this->getid3->info; + + $info['fileformat'] = 'cue'; + $this->readCueSheetFilename($info['filenamepath']); + $info['cue'] = $this->cuesheet; + return true; + } + + + + public function readCueSheetFilename($filename) + { + $filedata = file_get_contents($filename); + return $this->readCueSheet($filedata); + } + /** + * Parses a cue sheet file. + * + * @param string $filename - The filename for the cue sheet to open. + */ + public function readCueSheet(&$filedata) + { + $cue_lines = array(); + foreach (explode("\n", str_replace("\r", null, $filedata)) as $line) + { + if ( (strlen($line) > 0) && ($line[0] != '#')) + { + $cue_lines[] = trim($line); + } + } + $this->parseCueSheet($cue_lines); + + return $this->cuesheet; + } + + /** + * Parses the cue sheet array. + * + * @param array $file - The cuesheet as an array of each line. + */ + public function parseCueSheet($file) + { + //-1 means still global, all others are track specific + $track_on = -1; + + for ($i=0; $i < count($file); $i++) + { + list($key) = explode(' ', strtolower($file[$i]), 2); + switch ($key) + { + case 'catalog': + case 'cdtextfile': + case 'isrc': + case 'performer': + case 'songwriter': + case 'title': + $this->parseString($file[$i], $track_on); + break; + case 'file': + $currentFile = $this->parseFile($file[$i]); + break; + case 'flags': + $this->parseFlags($file[$i], $track_on); + break; + case 'index': + case 'postgap': + case 'pregap': + $this->parseIndex($file[$i], $track_on); + break; + case 'rem': + $this->parseComment($file[$i], $track_on); + break; + case 'track': + $track_on++; + $this->parseTrack($file[$i], $track_on); + if (isset($currentFile)) // if there's a file + { + $this->cuesheet['tracks'][$track_on]['datafile'] = $currentFile; + } + break; + default: + //save discarded junk and place string[] with track it was found in + $this->parseGarbage($file[$i], $track_on); + break; + } + } + } + + /** + * Parses the REM command. + * + * @param string $line - The line in the cue file that contains the TRACK command. + * @param integer $track_on - The track currently processing. + */ + public function parseComment($line, $track_on) + { + $explodedline = explode(' ', $line, 3); + $comment_REM = (isset($explodedline[0]) ? $explodedline[0] : ''); + $comment_type = (isset($explodedline[1]) ? $explodedline[1] : ''); + $comment_data = (isset($explodedline[2]) ? $explodedline[2] : ''); + if (($comment_REM == 'REM') && $comment_type) { + $comment_type = strtolower($comment_type); + $commment_data = trim($comment_data, ' "'); + if ($track_on != -1) { + $this->cuesheet['tracks'][$track_on]['comments'][$comment_type][] = $comment_data; + } else { + $this->cuesheet['comments'][$comment_type][] = $comment_data; + } + } + } + + /** + * Parses the FILE command. + * + * @param string $line - The line in the cue file that contains the FILE command. + * @return array - Array of FILENAME and TYPE of file.. + */ + public function parseFile($line) + { + $line = substr($line, strpos($line, ' ') + 1); + $type = strtolower(substr($line, strrpos($line, ' '))); + + //remove type + $line = substr($line, 0, strrpos($line, ' ') - 1); + + //if quotes around it, remove them. + $line = trim($line, '"'); + + return array('filename'=>$line, 'type'=>$type); + } + + /** + * Parses the FLAG command. + * + * @param string $line - The line in the cue file that contains the TRACK command. + * @param integer $track_on - The track currently processing. + */ + public function parseFlags($line, $track_on) + { + if ($track_on != -1) + { + foreach (explode(' ', strtolower($line)) as $type) + { + switch ($type) + { + case 'flags': + // first entry in this line + $this->cuesheet['tracks'][$track_on]['flags'] = array( + '4ch' => false, + 'data' => false, + 'dcp' => false, + 'pre' => false, + 'scms' => false, + ); + break; + case 'data': + case 'dcp': + case '4ch': + case 'pre': + case 'scms': + $this->cuesheet['tracks'][$track_on]['flags'][$type] = true; + break; + default: + break; + } + } + } + } + + /** + * Collect any unidentified data. + * + * @param string $line - The line in the cue file that contains the TRACK command. + * @param integer $track_on - The track currently processing. + */ + public function parseGarbage($line, $track_on) + { + if ( strlen($line) > 0 ) + { + if ($track_on == -1) + { + $this->cuesheet['garbage'][] = $line; + } + else + { + $this->cuesheet['tracks'][$track_on]['garbage'][] = $line; + } + } + } + + /** + * Parses the INDEX command of a TRACK. + * + * @param string $line - The line in the cue file that contains the TRACK command. + * @param integer $track_on - The track currently processing. + */ + public function parseIndex($line, $track_on) + { + $type = strtolower(substr($line, 0, strpos($line, ' '))); + $line = substr($line, strpos($line, ' ') + 1); + + if ($type == 'index') + { + //read the index number + $number = intval(substr($line, 0, strpos($line, ' '))); + $line = substr($line, strpos($line, ' ') + 1); + } + + //extract the minutes, seconds, and frames + $explodedline = explode(':', $line); + $minutes = (isset($explodedline[0]) ? $explodedline[0] : ''); + $seconds = (isset($explodedline[1]) ? $explodedline[1] : ''); + $frames = (isset($explodedline[2]) ? $explodedline[2] : ''); + + switch ($type) { + case 'index': + $this->cuesheet['tracks'][$track_on][$type][$number] = array('minutes'=>intval($minutes), 'seconds'=>intval($seconds), 'frames'=>intval($frames)); + break; + case 'pregap': + case 'postgap': + $this->cuesheet['tracks'][$track_on][$type] = array('minutes'=>intval($minutes), 'seconds'=>intval($seconds), 'frames'=>intval($frames)); + break; + } + } + + public function parseString($line, $track_on) + { + $category = strtolower(substr($line, 0, strpos($line, ' '))); + $line = substr($line, strpos($line, ' ') + 1); + + //get rid of the quotes + $line = trim($line, '"'); + + switch ($category) + { + case 'catalog': + case 'cdtextfile': + case 'isrc': + case 'performer': + case 'songwriter': + case 'title': + if ($track_on == -1) + { + $this->cuesheet[$category] = $line; + } + else + { + $this->cuesheet['tracks'][$track_on][$category] = $line; + } + break; + default: + break; + } + } + + /** + * Parses the TRACK command. + * + * @param string $line - The line in the cue file that contains the TRACK command. + * @param integer $track_on - The track currently processing. + */ + public function parseTrack($line, $track_on) + { + $line = substr($line, strpos($line, ' ') + 1); + $track = ltrim(substr($line, 0, strpos($line, ' ')), '0'); + + //find the data type. + $datatype = strtolower(substr($line, strpos($line, ' ') + 1)); + + $this->cuesheet['tracks'][$track_on] = array('track_number'=>$track, 'datatype'=>$datatype); + } + +} + diff --git a/www/rompr/getid3/module.misc.exe.php b/www/rompr/getid3/module.misc.exe.php new file mode 100755 index 0000000..4f04ad7 --- /dev/null +++ b/www/rompr/getid3/module.misc.exe.php @@ -0,0 +1,59 @@ + // +// available at http://getid3.sourceforge.net // +// or http://www.getid3.org // +// also https://github.com/JamesHeinrich/getID3 // +///////////////////////////////////////////////////////////////// +// See readme.txt for more details // +///////////////////////////////////////////////////////////////// +// // +// module.misc.exe.php // +// module for analyzing EXE files // +// dependencies: NONE // +// /// +///////////////////////////////////////////////////////////////// + + +class getid3_exe extends getid3_handler +{ + + public function Analyze() { + $info = &$this->getid3->info; + + $this->fseek($info['avdataoffset']); + $EXEheader = $this->fread(28); + + $magic = 'MZ'; + if (substr($EXEheader, 0, 2) != $magic) { + $this->error('Expecting "'.getid3_lib::PrintHexBytes($magic).'" at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes(substr($EXEheader, 0, 2)).'"'); + return false; + } + + $info['fileformat'] = 'exe'; + $info['exe']['mz']['magic'] = 'MZ'; + + $info['exe']['mz']['raw']['last_page_size'] = getid3_lib::LittleEndian2Int(substr($EXEheader, 2, 2)); + $info['exe']['mz']['raw']['page_count'] = getid3_lib::LittleEndian2Int(substr($EXEheader, 4, 2)); + $info['exe']['mz']['raw']['relocation_count'] = getid3_lib::LittleEndian2Int(substr($EXEheader, 6, 2)); + $info['exe']['mz']['raw']['header_paragraphs'] = getid3_lib::LittleEndian2Int(substr($EXEheader, 8, 2)); + $info['exe']['mz']['raw']['min_memory_paragraphs'] = getid3_lib::LittleEndian2Int(substr($EXEheader, 10, 2)); + $info['exe']['mz']['raw']['max_memory_paragraphs'] = getid3_lib::LittleEndian2Int(substr($EXEheader, 12, 2)); + $info['exe']['mz']['raw']['initial_ss'] = getid3_lib::LittleEndian2Int(substr($EXEheader, 14, 2)); + $info['exe']['mz']['raw']['initial_sp'] = getid3_lib::LittleEndian2Int(substr($EXEheader, 16, 2)); + $info['exe']['mz']['raw']['checksum'] = getid3_lib::LittleEndian2Int(substr($EXEheader, 18, 2)); + $info['exe']['mz']['raw']['cs_ip'] = getid3_lib::LittleEndian2Int(substr($EXEheader, 20, 4)); + $info['exe']['mz']['raw']['relocation_table_offset'] = getid3_lib::LittleEndian2Int(substr($EXEheader, 24, 2)); + $info['exe']['mz']['raw']['overlay_number'] = getid3_lib::LittleEndian2Int(substr($EXEheader, 26, 2)); + + $info['exe']['mz']['byte_size'] = (($info['exe']['mz']['raw']['page_count'] - 1)) * 512 + $info['exe']['mz']['raw']['last_page_size']; + $info['exe']['mz']['header_size'] = $info['exe']['mz']['raw']['header_paragraphs'] * 16; + $info['exe']['mz']['memory_minimum'] = $info['exe']['mz']['raw']['min_memory_paragraphs'] * 16; + $info['exe']['mz']['memory_recommended'] = $info['exe']['mz']['raw']['max_memory_paragraphs'] * 16; + +$this->error('EXE parsing not enabled in this version of getID3() ['.$this->getid3->version().']'); +return false; + + } + +} diff --git a/www/rompr/getid3/module.misc.iso.php b/www/rompr/getid3/module.misc.iso.php new file mode 100755 index 0000000..0477285 --- /dev/null +++ b/www/rompr/getid3/module.misc.iso.php @@ -0,0 +1,388 @@ + // +// available at http://getid3.sourceforge.net // +// or http://www.getid3.org // +// also https://github.com/JamesHeinrich/getID3 // +///////////////////////////////////////////////////////////////// +// See readme.txt for more details // +///////////////////////////////////////////////////////////////// +// // +// module.misc.iso.php // +// module for analyzing ISO files // +// dependencies: NONE // +// /// +///////////////////////////////////////////////////////////////// + + +class getid3_iso extends getid3_handler +{ + + public function Analyze() { + $info = &$this->getid3->info; + + $info['fileformat'] = 'iso'; + + for ($i = 16; $i <= 19; $i++) { + $this->fseek(2048 * $i); + $ISOheader = $this->fread(2048); + if (substr($ISOheader, 1, 5) == 'CD001') { + switch (ord($ISOheader{0})) { + case 1: + $info['iso']['primary_volume_descriptor']['offset'] = 2048 * $i; + $this->ParsePrimaryVolumeDescriptor($ISOheader); + break; + + case 2: + $info['iso']['supplementary_volume_descriptor']['offset'] = 2048 * $i; + $this->ParseSupplementaryVolumeDescriptor($ISOheader); + break; + + default: + // skip + break; + } + } + } + + $this->ParsePathTable(); + + $info['iso']['files'] = array(); + foreach ($info['iso']['path_table']['directories'] as $directorynum => $directorydata) { + $info['iso']['directories'][$directorynum] = $this->ParseDirectoryRecord($directorydata); + } + + return true; + } + + + public function ParsePrimaryVolumeDescriptor(&$ISOheader) { + // ISO integer values are stored *BOTH* Little-Endian AND Big-Endian format!! + // ie 12345 == 0x3039 is stored as $39 $30 $30 $39 in a 4-byte field + + // shortcuts + $info = &$this->getid3->info; + $info['iso']['primary_volume_descriptor']['raw'] = array(); + $thisfile_iso_primaryVD = &$info['iso']['primary_volume_descriptor']; + $thisfile_iso_primaryVD_raw = &$thisfile_iso_primaryVD['raw']; + + $thisfile_iso_primaryVD_raw['volume_descriptor_type'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 0, 1)); + $thisfile_iso_primaryVD_raw['standard_identifier'] = substr($ISOheader, 1, 5); + if ($thisfile_iso_primaryVD_raw['standard_identifier'] != 'CD001') { + $this->error('Expected "CD001" at offset ('.($thisfile_iso_primaryVD['offset'] + 1).'), found "'.$thisfile_iso_primaryVD_raw['standard_identifier'].'" instead'); + unset($info['fileformat']); + unset($info['iso']); + return false; + } + + + $thisfile_iso_primaryVD_raw['volume_descriptor_version'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 6, 1)); + //$thisfile_iso_primaryVD_raw['unused_1'] = substr($ISOheader, 7, 1); + $thisfile_iso_primaryVD_raw['system_identifier'] = substr($ISOheader, 8, 32); + $thisfile_iso_primaryVD_raw['volume_identifier'] = substr($ISOheader, 40, 32); + //$thisfile_iso_primaryVD_raw['unused_2'] = substr($ISOheader, 72, 8); + $thisfile_iso_primaryVD_raw['volume_space_size'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 80, 4)); + //$thisfile_iso_primaryVD_raw['unused_3'] = substr($ISOheader, 88, 32); + $thisfile_iso_primaryVD_raw['volume_set_size'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 120, 2)); + $thisfile_iso_primaryVD_raw['volume_sequence_number'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 124, 2)); + $thisfile_iso_primaryVD_raw['logical_block_size'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 128, 2)); + $thisfile_iso_primaryVD_raw['path_table_size'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 132, 4)); + $thisfile_iso_primaryVD_raw['path_table_l_location'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 140, 2)); + $thisfile_iso_primaryVD_raw['path_table_l_opt_location'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 144, 2)); + $thisfile_iso_primaryVD_raw['path_table_m_location'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 148, 2)); + $thisfile_iso_primaryVD_raw['path_table_m_opt_location'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 152, 2)); + $thisfile_iso_primaryVD_raw['root_directory_record'] = substr($ISOheader, 156, 34); + $thisfile_iso_primaryVD_raw['volume_set_identifier'] = substr($ISOheader, 190, 128); + $thisfile_iso_primaryVD_raw['publisher_identifier'] = substr($ISOheader, 318, 128); + $thisfile_iso_primaryVD_raw['data_preparer_identifier'] = substr($ISOheader, 446, 128); + $thisfile_iso_primaryVD_raw['application_identifier'] = substr($ISOheader, 574, 128); + $thisfile_iso_primaryVD_raw['copyright_file_identifier'] = substr($ISOheader, 702, 37); + $thisfile_iso_primaryVD_raw['abstract_file_identifier'] = substr($ISOheader, 739, 37); + $thisfile_iso_primaryVD_raw['bibliographic_file_identifier'] = substr($ISOheader, 776, 37); + $thisfile_iso_primaryVD_raw['volume_creation_date_time'] = substr($ISOheader, 813, 17); + $thisfile_iso_primaryVD_raw['volume_modification_date_time'] = substr($ISOheader, 830, 17); + $thisfile_iso_primaryVD_raw['volume_expiration_date_time'] = substr($ISOheader, 847, 17); + $thisfile_iso_primaryVD_raw['volume_effective_date_time'] = substr($ISOheader, 864, 17); + $thisfile_iso_primaryVD_raw['file_structure_version'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 881, 1)); + //$thisfile_iso_primaryVD_raw['unused_4'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 882, 1)); + $thisfile_iso_primaryVD_raw['application_data'] = substr($ISOheader, 883, 512); + //$thisfile_iso_primaryVD_raw['unused_5'] = substr($ISOheader, 1395, 653); + + $thisfile_iso_primaryVD['system_identifier'] = trim($thisfile_iso_primaryVD_raw['system_identifier']); + $thisfile_iso_primaryVD['volume_identifier'] = trim($thisfile_iso_primaryVD_raw['volume_identifier']); + $thisfile_iso_primaryVD['volume_set_identifier'] = trim($thisfile_iso_primaryVD_raw['volume_set_identifier']); + $thisfile_iso_primaryVD['publisher_identifier'] = trim($thisfile_iso_primaryVD_raw['publisher_identifier']); + $thisfile_iso_primaryVD['data_preparer_identifier'] = trim($thisfile_iso_primaryVD_raw['data_preparer_identifier']); + $thisfile_iso_primaryVD['application_identifier'] = trim($thisfile_iso_primaryVD_raw['application_identifier']); + $thisfile_iso_primaryVD['copyright_file_identifier'] = trim($thisfile_iso_primaryVD_raw['copyright_file_identifier']); + $thisfile_iso_primaryVD['abstract_file_identifier'] = trim($thisfile_iso_primaryVD_raw['abstract_file_identifier']); + $thisfile_iso_primaryVD['bibliographic_file_identifier'] = trim($thisfile_iso_primaryVD_raw['bibliographic_file_identifier']); + $thisfile_iso_primaryVD['volume_creation_date_time'] = $this->ISOtimeText2UNIXtime($thisfile_iso_primaryVD_raw['volume_creation_date_time']); + $thisfile_iso_primaryVD['volume_modification_date_time'] = $this->ISOtimeText2UNIXtime($thisfile_iso_primaryVD_raw['volume_modification_date_time']); + $thisfile_iso_primaryVD['volume_expiration_date_time'] = $this->ISOtimeText2UNIXtime($thisfile_iso_primaryVD_raw['volume_expiration_date_time']); + $thisfile_iso_primaryVD['volume_effective_date_time'] = $this->ISOtimeText2UNIXtime($thisfile_iso_primaryVD_raw['volume_effective_date_time']); + + if (($thisfile_iso_primaryVD_raw['volume_space_size'] * 2048) > $info['filesize']) { + $this->error('Volume Space Size ('.($thisfile_iso_primaryVD_raw['volume_space_size'] * 2048).' bytes) is larger than the file size ('.$info['filesize'].' bytes) (truncated file?)'); + } + + return true; + } + + + public function ParseSupplementaryVolumeDescriptor(&$ISOheader) { + // ISO integer values are stored Both-Endian format!! + // ie 12345 == 0x3039 is stored as $39 $30 $30 $39 in a 4-byte field + + // shortcuts + $info = &$this->getid3->info; + $info['iso']['supplementary_volume_descriptor']['raw'] = array(); + $thisfile_iso_supplementaryVD = &$info['iso']['supplementary_volume_descriptor']; + $thisfile_iso_supplementaryVD_raw = &$thisfile_iso_supplementaryVD['raw']; + + $thisfile_iso_supplementaryVD_raw['volume_descriptor_type'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 0, 1)); + $thisfile_iso_supplementaryVD_raw['standard_identifier'] = substr($ISOheader, 1, 5); + if ($thisfile_iso_supplementaryVD_raw['standard_identifier'] != 'CD001') { + $this->error('Expected "CD001" at offset ('.($thisfile_iso_supplementaryVD['offset'] + 1).'), found "'.$thisfile_iso_supplementaryVD_raw['standard_identifier'].'" instead'); + unset($info['fileformat']); + unset($info['iso']); + return false; + } + + $thisfile_iso_supplementaryVD_raw['volume_descriptor_version'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 6, 1)); + //$thisfile_iso_supplementaryVD_raw['unused_1'] = substr($ISOheader, 7, 1); + $thisfile_iso_supplementaryVD_raw['system_identifier'] = substr($ISOheader, 8, 32); + $thisfile_iso_supplementaryVD_raw['volume_identifier'] = substr($ISOheader, 40, 32); + //$thisfile_iso_supplementaryVD_raw['unused_2'] = substr($ISOheader, 72, 8); + $thisfile_iso_supplementaryVD_raw['volume_space_size'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 80, 4)); + if ($thisfile_iso_supplementaryVD_raw['volume_space_size'] == 0) { + // Supplementary Volume Descriptor not used + //unset($thisfile_iso_supplementaryVD); + //return false; + } + + //$thisfile_iso_supplementaryVD_raw['unused_3'] = substr($ISOheader, 88, 32); + $thisfile_iso_supplementaryVD_raw['volume_set_size'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 120, 2)); + $thisfile_iso_supplementaryVD_raw['volume_sequence_number'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 124, 2)); + $thisfile_iso_supplementaryVD_raw['logical_block_size'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 128, 2)); + $thisfile_iso_supplementaryVD_raw['path_table_size'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 132, 4)); + $thisfile_iso_supplementaryVD_raw['path_table_l_location'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 140, 2)); + $thisfile_iso_supplementaryVD_raw['path_table_l_opt_location'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 144, 2)); + $thisfile_iso_supplementaryVD_raw['path_table_m_location'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 148, 2)); + $thisfile_iso_supplementaryVD_raw['path_table_m_opt_location'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 152, 2)); + $thisfile_iso_supplementaryVD_raw['root_directory_record'] = substr($ISOheader, 156, 34); + $thisfile_iso_supplementaryVD_raw['volume_set_identifier'] = substr($ISOheader, 190, 128); + $thisfile_iso_supplementaryVD_raw['publisher_identifier'] = substr($ISOheader, 318, 128); + $thisfile_iso_supplementaryVD_raw['data_preparer_identifier'] = substr($ISOheader, 446, 128); + $thisfile_iso_supplementaryVD_raw['application_identifier'] = substr($ISOheader, 574, 128); + $thisfile_iso_supplementaryVD_raw['copyright_file_identifier'] = substr($ISOheader, 702, 37); + $thisfile_iso_supplementaryVD_raw['abstract_file_identifier'] = substr($ISOheader, 739, 37); + $thisfile_iso_supplementaryVD_raw['bibliographic_file_identifier'] = substr($ISOheader, 776, 37); + $thisfile_iso_supplementaryVD_raw['volume_creation_date_time'] = substr($ISOheader, 813, 17); + $thisfile_iso_supplementaryVD_raw['volume_modification_date_time'] = substr($ISOheader, 830, 17); + $thisfile_iso_supplementaryVD_raw['volume_expiration_date_time'] = substr($ISOheader, 847, 17); + $thisfile_iso_supplementaryVD_raw['volume_effective_date_time'] = substr($ISOheader, 864, 17); + $thisfile_iso_supplementaryVD_raw['file_structure_version'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 881, 1)); + //$thisfile_iso_supplementaryVD_raw['unused_4'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 882, 1)); + $thisfile_iso_supplementaryVD_raw['application_data'] = substr($ISOheader, 883, 512); + //$thisfile_iso_supplementaryVD_raw['unused_5'] = substr($ISOheader, 1395, 653); + + $thisfile_iso_supplementaryVD['system_identifier'] = trim($thisfile_iso_supplementaryVD_raw['system_identifier']); + $thisfile_iso_supplementaryVD['volume_identifier'] = trim($thisfile_iso_supplementaryVD_raw['volume_identifier']); + $thisfile_iso_supplementaryVD['volume_set_identifier'] = trim($thisfile_iso_supplementaryVD_raw['volume_set_identifier']); + $thisfile_iso_supplementaryVD['publisher_identifier'] = trim($thisfile_iso_supplementaryVD_raw['publisher_identifier']); + $thisfile_iso_supplementaryVD['data_preparer_identifier'] = trim($thisfile_iso_supplementaryVD_raw['data_preparer_identifier']); + $thisfile_iso_supplementaryVD['application_identifier'] = trim($thisfile_iso_supplementaryVD_raw['application_identifier']); + $thisfile_iso_supplementaryVD['copyright_file_identifier'] = trim($thisfile_iso_supplementaryVD_raw['copyright_file_identifier']); + $thisfile_iso_supplementaryVD['abstract_file_identifier'] = trim($thisfile_iso_supplementaryVD_raw['abstract_file_identifier']); + $thisfile_iso_supplementaryVD['bibliographic_file_identifier'] = trim($thisfile_iso_supplementaryVD_raw['bibliographic_file_identifier']); + $thisfile_iso_supplementaryVD['volume_creation_date_time'] = $this->ISOtimeText2UNIXtime($thisfile_iso_supplementaryVD_raw['volume_creation_date_time']); + $thisfile_iso_supplementaryVD['volume_modification_date_time'] = $this->ISOtimeText2UNIXtime($thisfile_iso_supplementaryVD_raw['volume_modification_date_time']); + $thisfile_iso_supplementaryVD['volume_expiration_date_time'] = $this->ISOtimeText2UNIXtime($thisfile_iso_supplementaryVD_raw['volume_expiration_date_time']); + $thisfile_iso_supplementaryVD['volume_effective_date_time'] = $this->ISOtimeText2UNIXtime($thisfile_iso_supplementaryVD_raw['volume_effective_date_time']); + + if (($thisfile_iso_supplementaryVD_raw['volume_space_size'] * $thisfile_iso_supplementaryVD_raw['logical_block_size']) > $info['filesize']) { + $this->error('Volume Space Size ('.($thisfile_iso_supplementaryVD_raw['volume_space_size'] * $thisfile_iso_supplementaryVD_raw['logical_block_size']).' bytes) is larger than the file size ('.$info['filesize'].' bytes) (truncated file?)'); + } + + return true; + } + + + public function ParsePathTable() { + $info = &$this->getid3->info; + if (!isset($info['iso']['supplementary_volume_descriptor']['raw']['path_table_l_location']) && !isset($info['iso']['primary_volume_descriptor']['raw']['path_table_l_location'])) { + return false; + } + if (isset($info['iso']['supplementary_volume_descriptor']['raw']['path_table_l_location'])) { + $PathTableLocation = $info['iso']['supplementary_volume_descriptor']['raw']['path_table_l_location']; + $PathTableSize = $info['iso']['supplementary_volume_descriptor']['raw']['path_table_size']; + $TextEncoding = 'UTF-16BE'; // Big-Endian Unicode + } else { + $PathTableLocation = $info['iso']['primary_volume_descriptor']['raw']['path_table_l_location']; + $PathTableSize = $info['iso']['primary_volume_descriptor']['raw']['path_table_size']; + $TextEncoding = 'ISO-8859-1'; // Latin-1 + } + + if (($PathTableLocation * 2048) > $info['filesize']) { + $this->error('Path Table Location specifies an offset ('.($PathTableLocation * 2048).') beyond the end-of-file ('.$info['filesize'].')'); + return false; + } + + $info['iso']['path_table']['offset'] = $PathTableLocation * 2048; + $this->fseek($info['iso']['path_table']['offset']); + $info['iso']['path_table']['raw'] = $this->fread($PathTableSize); + + $offset = 0; + $pathcounter = 1; + while ($offset < $PathTableSize) { + // shortcut + $info['iso']['path_table']['directories'][$pathcounter] = array(); + $thisfile_iso_pathtable_directories_current = &$info['iso']['path_table']['directories'][$pathcounter]; + + $thisfile_iso_pathtable_directories_current['length'] = getid3_lib::LittleEndian2Int(substr($info['iso']['path_table']['raw'], $offset, 1)); + $offset += 1; + $thisfile_iso_pathtable_directories_current['extended_length'] = getid3_lib::LittleEndian2Int(substr($info['iso']['path_table']['raw'], $offset, 1)); + $offset += 1; + $thisfile_iso_pathtable_directories_current['location_logical'] = getid3_lib::LittleEndian2Int(substr($info['iso']['path_table']['raw'], $offset, 4)); + $offset += 4; + $thisfile_iso_pathtable_directories_current['parent_directory'] = getid3_lib::LittleEndian2Int(substr($info['iso']['path_table']['raw'], $offset, 2)); + $offset += 2; + $thisfile_iso_pathtable_directories_current['name'] = substr($info['iso']['path_table']['raw'], $offset, $thisfile_iso_pathtable_directories_current['length']); + $offset += $thisfile_iso_pathtable_directories_current['length'] + ($thisfile_iso_pathtable_directories_current['length'] % 2); + + $thisfile_iso_pathtable_directories_current['name_ascii'] = getid3_lib::iconv_fallback($TextEncoding, $info['encoding'], $thisfile_iso_pathtable_directories_current['name']); + + $thisfile_iso_pathtable_directories_current['location_bytes'] = $thisfile_iso_pathtable_directories_current['location_logical'] * 2048; + if ($pathcounter == 1) { + $thisfile_iso_pathtable_directories_current['full_path'] = '/'; + } else { + $thisfile_iso_pathtable_directories_current['full_path'] = $info['iso']['path_table']['directories'][$thisfile_iso_pathtable_directories_current['parent_directory']]['full_path'].$thisfile_iso_pathtable_directories_current['name_ascii'].'/'; + } + $FullPathArray[] = $thisfile_iso_pathtable_directories_current['full_path']; + + $pathcounter++; + } + + return true; + } + + + public function ParseDirectoryRecord($directorydata) { + $info = &$this->getid3->info; + if (isset($info['iso']['supplementary_volume_descriptor'])) { + $TextEncoding = 'UTF-16BE'; // Big-Endian Unicode + } else { + $TextEncoding = 'ISO-8859-1'; // Latin-1 + } + + $this->fseek($directorydata['location_bytes']); + $DirectoryRecordData = $this->fread(1); + + while (ord($DirectoryRecordData{0}) > 33) { + + $DirectoryRecordData .= $this->fread(ord($DirectoryRecordData{0}) - 1); + + $ThisDirectoryRecord['raw']['length'] = getid3_lib::LittleEndian2Int(substr($DirectoryRecordData, 0, 1)); + $ThisDirectoryRecord['raw']['extended_attribute_length'] = getid3_lib::LittleEndian2Int(substr($DirectoryRecordData, 1, 1)); + $ThisDirectoryRecord['raw']['offset_logical'] = getid3_lib::LittleEndian2Int(substr($DirectoryRecordData, 2, 4)); + $ThisDirectoryRecord['raw']['filesize'] = getid3_lib::LittleEndian2Int(substr($DirectoryRecordData, 10, 4)); + $ThisDirectoryRecord['raw']['recording_date_time'] = substr($DirectoryRecordData, 18, 7); + $ThisDirectoryRecord['raw']['file_flags'] = getid3_lib::LittleEndian2Int(substr($DirectoryRecordData, 25, 1)); + $ThisDirectoryRecord['raw']['file_unit_size'] = getid3_lib::LittleEndian2Int(substr($DirectoryRecordData, 26, 1)); + $ThisDirectoryRecord['raw']['interleave_gap_size'] = getid3_lib::LittleEndian2Int(substr($DirectoryRecordData, 27, 1)); + $ThisDirectoryRecord['raw']['volume_sequence_number'] = getid3_lib::LittleEndian2Int(substr($DirectoryRecordData, 28, 2)); + $ThisDirectoryRecord['raw']['file_identifier_length'] = getid3_lib::LittleEndian2Int(substr($DirectoryRecordData, 32, 1)); + $ThisDirectoryRecord['raw']['file_identifier'] = substr($DirectoryRecordData, 33, $ThisDirectoryRecord['raw']['file_identifier_length']); + + $ThisDirectoryRecord['file_identifier_ascii'] = getid3_lib::iconv_fallback($TextEncoding, $info['encoding'], $ThisDirectoryRecord['raw']['file_identifier']); + + $ThisDirectoryRecord['filesize'] = $ThisDirectoryRecord['raw']['filesize']; + $ThisDirectoryRecord['offset_bytes'] = $ThisDirectoryRecord['raw']['offset_logical'] * 2048; + $ThisDirectoryRecord['file_flags']['hidden'] = (bool) ($ThisDirectoryRecord['raw']['file_flags'] & 0x01); + $ThisDirectoryRecord['file_flags']['directory'] = (bool) ($ThisDirectoryRecord['raw']['file_flags'] & 0x02); + $ThisDirectoryRecord['file_flags']['associated'] = (bool) ($ThisDirectoryRecord['raw']['file_flags'] & 0x04); + $ThisDirectoryRecord['file_flags']['extended'] = (bool) ($ThisDirectoryRecord['raw']['file_flags'] & 0x08); + $ThisDirectoryRecord['file_flags']['permissions'] = (bool) ($ThisDirectoryRecord['raw']['file_flags'] & 0x10); + $ThisDirectoryRecord['file_flags']['multiple'] = (bool) ($ThisDirectoryRecord['raw']['file_flags'] & 0x80); + $ThisDirectoryRecord['recording_timestamp'] = $this->ISOtime2UNIXtime($ThisDirectoryRecord['raw']['recording_date_time']); + + if ($ThisDirectoryRecord['file_flags']['directory']) { + $ThisDirectoryRecord['filename'] = $directorydata['full_path']; + } else { + $ThisDirectoryRecord['filename'] = $directorydata['full_path'].$this->ISOstripFilenameVersion($ThisDirectoryRecord['file_identifier_ascii']); + $info['iso']['files'] = getid3_lib::array_merge_clobber($info['iso']['files'], getid3_lib::CreateDeepArray($ThisDirectoryRecord['filename'], '/', $ThisDirectoryRecord['filesize'])); + } + + $DirectoryRecord[] = $ThisDirectoryRecord; + $DirectoryRecordData = $this->fread(1); + } + + return $DirectoryRecord; + } + + public function ISOstripFilenameVersion($ISOfilename) { + // convert 'filename.ext;1' to 'filename.ext' + if (!strstr($ISOfilename, ';')) { + return $ISOfilename; + } else { + return substr($ISOfilename, 0, strpos($ISOfilename, ';')); + } + } + + public function ISOtimeText2UNIXtime($ISOtime) { + + $UNIXyear = (int) substr($ISOtime, 0, 4); + $UNIXmonth = (int) substr($ISOtime, 4, 2); + $UNIXday = (int) substr($ISOtime, 6, 2); + $UNIXhour = (int) substr($ISOtime, 8, 2); + $UNIXminute = (int) substr($ISOtime, 10, 2); + $UNIXsecond = (int) substr($ISOtime, 12, 2); + + if (!$UNIXyear) { + return false; + } + return gmmktime($UNIXhour, $UNIXminute, $UNIXsecond, $UNIXmonth, $UNIXday, $UNIXyear); + } + + public function ISOtime2UNIXtime($ISOtime) { + // Represented by seven bytes: + // 1: Number of years since 1900 + // 2: Month of the year from 1 to 12 + // 3: Day of the Month from 1 to 31 + // 4: Hour of the day from 0 to 23 + // 5: Minute of the hour from 0 to 59 + // 6: second of the minute from 0 to 59 + // 7: Offset from Greenwich Mean Time in number of 15 minute intervals from -48 (West) to +52 (East) + + $UNIXyear = ord($ISOtime{0}) + 1900; + $UNIXmonth = ord($ISOtime{1}); + $UNIXday = ord($ISOtime{2}); + $UNIXhour = ord($ISOtime{3}); + $UNIXminute = ord($ISOtime{4}); + $UNIXsecond = ord($ISOtime{5}); + $GMToffset = $this->TwosCompliment2Decimal(ord($ISOtime{5})); + + return gmmktime($UNIXhour, $UNIXminute, $UNIXsecond, $UNIXmonth, $UNIXday, $UNIXyear); + } + + public function TwosCompliment2Decimal($BinaryValue) { + // http://sandbox.mc.edu/~bennet/cs110/tc/tctod.html + // First check if the number is negative or positive by looking at the sign bit. + // If it is positive, simply convert it to decimal. + // If it is negative, make it positive by inverting the bits and adding one. + // Then, convert the result to decimal. + // The negative of this number is the value of the original binary. + + if ($BinaryValue & 0x80) { + + // negative number + return (0 - ((~$BinaryValue & 0xFF) + 1)); + } else { + // positive number + return $BinaryValue; + } + } + + +} diff --git a/www/rompr/getid3/module.misc.msoffice.php b/www/rompr/getid3/module.misc.msoffice.php new file mode 100755 index 0000000..099e6fc --- /dev/null +++ b/www/rompr/getid3/module.misc.msoffice.php @@ -0,0 +1,38 @@ + // +// available at http://getid3.sourceforge.net // +// or http://www.getid3.org // +// also https://github.com/JamesHeinrich/getID3 // +///////////////////////////////////////////////////////////////// +// See readme.txt for more details // +///////////////////////////////////////////////////////////////// +// // +// module.misc.msoffice.php // +// module for analyzing MS Office (.doc, .xls, etc) files // +// dependencies: NONE // +// /// +///////////////////////////////////////////////////////////////// + + +class getid3_msoffice extends getid3_handler +{ + + public function Analyze() { + $info = &$this->getid3->info; + + $this->fseek($info['avdataoffset']); + $DOCFILEheader = $this->fread(8); + $magic = "\xD0\xCF\x11\xE0\xA1\xB1\x1A\xE1"; + if (substr($DOCFILEheader, 0, 8) != $magic) { + $this->error('Expecting "'.getid3_lib::PrintHexBytes($magic).'" at '.$info['avdataoffset'].', found '.getid3_lib::PrintHexBytes(substr($DOCFILEheader, 0, 8)).' instead.'); + return false; + } + $info['fileformat'] = 'msoffice'; + +$this->error('MS Office (.doc, .xls, etc) parsing not enabled in this version of getID3() ['.$this->getid3->version().']'); +return false; + + } + +} diff --git a/www/rompr/getid3/module.misc.par2.php b/www/rompr/getid3/module.misc.par2.php new file mode 100755 index 0000000..2312bb8 --- /dev/null +++ b/www/rompr/getid3/module.misc.par2.php @@ -0,0 +1,31 @@ + // +// available at http://getid3.sourceforge.net // +// or http://www.getid3.org // +// also https://github.com/JamesHeinrich/getID3 // +///////////////////////////////////////////////////////////////// +// See readme.txt for more details // +///////////////////////////////////////////////////////////////// +// // +// module.misc.par2.php // +// module for analyzing PAR2 files // +// dependencies: NONE // +// /// +///////////////////////////////////////////////////////////////// + + +class getid3_par2 extends getid3_handler +{ + + public function Analyze() { + $info = &$this->getid3->info; + + $info['fileformat'] = 'par2'; + + $this->error('PAR2 parsing not enabled in this version of getID3()'); + return false; + + } + +} diff --git a/www/rompr/getid3/module.misc.pdf.php b/www/rompr/getid3/module.misc.pdf.php new file mode 100755 index 0000000..e8d25cb --- /dev/null +++ b/www/rompr/getid3/module.misc.pdf.php @@ -0,0 +1,31 @@ + // +// available at http://getid3.sourceforge.net // +// or http://www.getid3.org // +// also https://github.com/JamesHeinrich/getID3 // +///////////////////////////////////////////////////////////////// +// See readme.txt for more details // +///////////////////////////////////////////////////////////////// +// // +// module.misc.pdf.php // +// module for analyzing PDF files // +// dependencies: NONE // +// /// +///////////////////////////////////////////////////////////////// + + +class getid3_pdf extends getid3_handler +{ + + public function Analyze() { + $info = &$this->getid3->info; + + $info['fileformat'] = 'pdf'; + + $this->error('PDF parsing not enabled in this version of getID3() ['.$this->getid3->version().']'); + return false; + + } + +} diff --git a/www/rompr/getid3/module.tag.apetag.php b/www/rompr/getid3/module.tag.apetag.php new file mode 100644 index 0000000..eb081b4 --- /dev/null +++ b/www/rompr/getid3/module.tag.apetag.php @@ -0,0 +1,416 @@ + // +// available at http://getid3.sourceforge.net // +// or http://www.getid3.org // +// also https://github.com/JamesHeinrich/getID3 // +///////////////////////////////////////////////////////////////// +// See readme.txt for more details // +///////////////////////////////////////////////////////////////// +// // +// module.tag.apetag.php // +// module for analyzing APE tags // +// dependencies: NONE // +// /// +///////////////////////////////////////////////////////////////// + +class getid3_apetag extends getid3_handler +{ + public $inline_attachments = true; // true: return full data for all attachments; false: return no data for all attachments; integer: return data for attachments <= than this; string: save as file to this directory + public $overrideendoffset = 0; + + public function Analyze() { + $info = &$this->getid3->info; + + if (!getid3_lib::intValueSupported($info['filesize'])) { + $this->warning('Unable to check for APEtags because file is larger than '.round(PHP_INT_MAX / 1073741824).'GB'); + return false; + } + + $id3v1tagsize = 128; + $apetagheadersize = 32; + $lyrics3tagsize = 10; + + if ($this->overrideendoffset == 0) { + + $this->fseek(0 - $id3v1tagsize - $apetagheadersize - $lyrics3tagsize, SEEK_END); + $APEfooterID3v1 = $this->fread($id3v1tagsize + $apetagheadersize + $lyrics3tagsize); + + //if (preg_match('/APETAGEX.{24}TAG.{125}$/i', $APEfooterID3v1)) { + if (substr($APEfooterID3v1, strlen($APEfooterID3v1) - $id3v1tagsize - $apetagheadersize, 8) == 'APETAGEX') { + + // APE tag found before ID3v1 + $info['ape']['tag_offset_end'] = $info['filesize'] - $id3v1tagsize; + + //} elseif (preg_match('/APETAGEX.{24}$/i', $APEfooterID3v1)) { + } elseif (substr($APEfooterID3v1, strlen($APEfooterID3v1) - $apetagheadersize, 8) == 'APETAGEX') { + + // APE tag found, no ID3v1 + $info['ape']['tag_offset_end'] = $info['filesize']; + + } + + } else { + + $this->fseek($this->overrideendoffset - $apetagheadersize); + if ($this->fread(8) == 'APETAGEX') { + $info['ape']['tag_offset_end'] = $this->overrideendoffset; + } + + } + if (!isset($info['ape']['tag_offset_end'])) { + + // APE tag not found + unset($info['ape']); + return false; + + } + + // shortcut + $thisfile_ape = &$info['ape']; + + $this->fseek($thisfile_ape['tag_offset_end'] - $apetagheadersize); + $APEfooterData = $this->fread(32); + if (!($thisfile_ape['footer'] = $this->parseAPEheaderFooter($APEfooterData))) { + $this->error('Error parsing APE footer at offset '.$thisfile_ape['tag_offset_end']); + return false; + } + + if (isset($thisfile_ape['footer']['flags']['header']) && $thisfile_ape['footer']['flags']['header']) { + $this->fseek($thisfile_ape['tag_offset_end'] - $thisfile_ape['footer']['raw']['tagsize'] - $apetagheadersize); + $thisfile_ape['tag_offset_start'] = $this->ftell(); + $APEtagData = $this->fread($thisfile_ape['footer']['raw']['tagsize'] + $apetagheadersize); + } else { + $thisfile_ape['tag_offset_start'] = $thisfile_ape['tag_offset_end'] - $thisfile_ape['footer']['raw']['tagsize']; + $this->fseek($thisfile_ape['tag_offset_start']); + $APEtagData = $this->fread($thisfile_ape['footer']['raw']['tagsize']); + } + $info['avdataend'] = $thisfile_ape['tag_offset_start']; + + if (isset($info['id3v1']['tag_offset_start']) && ($info['id3v1']['tag_offset_start'] < $thisfile_ape['tag_offset_end'])) { + $this->warning('ID3v1 tag information ignored since it appears to be a false synch in APEtag data'); + unset($info['id3v1']); + foreach ($info['warning'] as $key => $value) { + if ($value == 'Some ID3v1 fields do not use NULL characters for padding') { + unset($info['warning'][$key]); + sort($info['warning']); + break; + } + } + } + + $offset = 0; + if (isset($thisfile_ape['footer']['flags']['header']) && $thisfile_ape['footer']['flags']['header']) { + if ($thisfile_ape['header'] = $this->parseAPEheaderFooter(substr($APEtagData, 0, $apetagheadersize))) { + $offset += $apetagheadersize; + } else { + $this->error('Error parsing APE header at offset '.$thisfile_ape['tag_offset_start']); + return false; + } + } + + // shortcut + $info['replay_gain'] = array(); + $thisfile_replaygain = &$info['replay_gain']; + + for ($i = 0; $i < $thisfile_ape['footer']['raw']['tag_items']; $i++) { + $value_size = getid3_lib::LittleEndian2Int(substr($APEtagData, $offset, 4)); + $offset += 4; + $item_flags = getid3_lib::LittleEndian2Int(substr($APEtagData, $offset, 4)); + $offset += 4; + if (strstr(substr($APEtagData, $offset), "\x00") === false) { + $this->error('Cannot find null-byte (0x00) separator between ItemKey #'.$i.' and value. ItemKey starts '.$offset.' bytes into the APE tag, at file offset '.($thisfile_ape['tag_offset_start'] + $offset)); + return false; + } + $ItemKeyLength = strpos($APEtagData, "\x00", $offset) - $offset; + $item_key = strtolower(substr($APEtagData, $offset, $ItemKeyLength)); + + // shortcut + $thisfile_ape['items'][$item_key] = array(); + $thisfile_ape_items_current = &$thisfile_ape['items'][$item_key]; + + $thisfile_ape_items_current['offset'] = $thisfile_ape['tag_offset_start'] + $offset; + + $offset += ($ItemKeyLength + 1); // skip 0x00 terminator + $thisfile_ape_items_current['data'] = substr($APEtagData, $offset, $value_size); + $offset += $value_size; + + $thisfile_ape_items_current['flags'] = $this->parseAPEtagFlags($item_flags); + switch ($thisfile_ape_items_current['flags']['item_contents_raw']) { + case 0: // UTF-8 + case 2: // Locator (URL, filename, etc), UTF-8 encoded + $thisfile_ape_items_current['data'] = explode("\x00", $thisfile_ape_items_current['data']); + break; + + case 1: // binary data + default: + break; + } + + switch (strtolower($item_key)) { + // http://wiki.hydrogenaud.io/index.php?title=ReplayGain#MP3Gain + case 'replaygain_track_gain': + if (preg_match('#^[\\-\\+][0-9\\.,]{8}$#', $thisfile_ape_items_current['data'][0])) { + $thisfile_replaygain['track']['adjustment'] = (float) str_replace(',', '.', $thisfile_ape_items_current['data'][0]); // float casting will see "0,95" as zero! + $thisfile_replaygain['track']['originator'] = 'unspecified'; + } else { + $this->warning('MP3gainTrackGain value in APEtag appears invalid: "'.$thisfile_ape_items_current['data'][0].'"'); + } + break; + + case 'replaygain_track_peak': + if (preg_match('#^[0-9\\.,]{8}$#', $thisfile_ape_items_current['data'][0])) { + $thisfile_replaygain['track']['peak'] = (float) str_replace(',', '.', $thisfile_ape_items_current['data'][0]); // float casting will see "0,95" as zero! + $thisfile_replaygain['track']['originator'] = 'unspecified'; + if ($thisfile_replaygain['track']['peak'] <= 0) { + $this->warning('ReplayGain Track peak from APEtag appears invalid: '.$thisfile_replaygain['track']['peak'].' (original value = "'.$thisfile_ape_items_current['data'][0].'")'); + } + } else { + $this->warning('MP3gainTrackPeak value in APEtag appears invalid: "'.$thisfile_ape_items_current['data'][0].'"'); + } + break; + + case 'replaygain_album_gain': + if (preg_match('#^[\\-\\+][0-9\\.,]{8}$#', $thisfile_ape_items_current['data'][0])) { + $thisfile_replaygain['album']['adjustment'] = (float) str_replace(',', '.', $thisfile_ape_items_current['data'][0]); // float casting will see "0,95" as zero! + $thisfile_replaygain['album']['originator'] = 'unspecified'; + } else { + $this->warning('MP3gainAlbumGain value in APEtag appears invalid: "'.$thisfile_ape_items_current['data'][0].'"'); + } + break; + + case 'replaygain_album_peak': + if (preg_match('#^[0-9\\.,]{8}$#', $thisfile_ape_items_current['data'][0])) { + $thisfile_replaygain['album']['peak'] = (float) str_replace(',', '.', $thisfile_ape_items_current['data'][0]); // float casting will see "0,95" as zero! + $thisfile_replaygain['album']['originator'] = 'unspecified'; + if ($thisfile_replaygain['album']['peak'] <= 0) { + $this->warning('ReplayGain Album peak from APEtag appears invalid: '.$thisfile_replaygain['album']['peak'].' (original value = "'.$thisfile_ape_items_current['data'][0].'")'); + } + } else { + $this->warning('MP3gainAlbumPeak value in APEtag appears invalid: "'.$thisfile_ape_items_current['data'][0].'"'); + } + break; + + case 'mp3gain_undo': + if (preg_match('#^[\\-\\+][0-9]{3},[\\-\\+][0-9]{3},[NW]$#', $thisfile_ape_items_current['data'][0])) { + list($mp3gain_undo_left, $mp3gain_undo_right, $mp3gain_undo_wrap) = explode(',', $thisfile_ape_items_current['data'][0]); + $thisfile_replaygain['mp3gain']['undo_left'] = intval($mp3gain_undo_left); + $thisfile_replaygain['mp3gain']['undo_right'] = intval($mp3gain_undo_right); + $thisfile_replaygain['mp3gain']['undo_wrap'] = (($mp3gain_undo_wrap == 'Y') ? true : false); + } else { + $this->warning('MP3gainUndo value in APEtag appears invalid: "'.$thisfile_ape_items_current['data'][0].'"'); + } + break; + + case 'mp3gain_minmax': + if (preg_match('#^[0-9]{3},[0-9]{3}$#', $thisfile_ape_items_current['data'][0])) { + list($mp3gain_globalgain_min, $mp3gain_globalgain_max) = explode(',', $thisfile_ape_items_current['data'][0]); + $thisfile_replaygain['mp3gain']['globalgain_track_min'] = intval($mp3gain_globalgain_min); + $thisfile_replaygain['mp3gain']['globalgain_track_max'] = intval($mp3gain_globalgain_max); + } else { + $this->warning('MP3gainMinMax value in APEtag appears invalid: "'.$thisfile_ape_items_current['data'][0].'"'); + } + break; + + case 'mp3gain_album_minmax': + if (preg_match('#^[0-9]{3},[0-9]{3}$#', $thisfile_ape_items_current['data'][0])) { + list($mp3gain_globalgain_album_min, $mp3gain_globalgain_album_max) = explode(',', $thisfile_ape_items_current['data'][0]); + $thisfile_replaygain['mp3gain']['globalgain_album_min'] = intval($mp3gain_globalgain_album_min); + $thisfile_replaygain['mp3gain']['globalgain_album_max'] = intval($mp3gain_globalgain_album_max); + } else { + $this->warning('MP3gainAlbumMinMax value in APEtag appears invalid: "'.$thisfile_ape_items_current['data'][0].'"'); + } + break; + + case 'tracknumber': + if (is_array($thisfile_ape_items_current['data'])) { + foreach ($thisfile_ape_items_current['data'] as $comment) { + $thisfile_ape['comments']['track'][] = $comment; + } + } + break; + + case 'cover art (artist)': + case 'cover art (back)': + case 'cover art (band logo)': + case 'cover art (band)': + case 'cover art (colored fish)': + case 'cover art (composer)': + case 'cover art (conductor)': + case 'cover art (front)': + case 'cover art (icon)': + case 'cover art (illustration)': + case 'cover art (lead)': + case 'cover art (leaflet)': + case 'cover art (lyricist)': + case 'cover art (media)': + case 'cover art (movie scene)': + case 'cover art (other icon)': + case 'cover art (other)': + case 'cover art (performance)': + case 'cover art (publisher logo)': + case 'cover art (recording)': + case 'cover art (studio)': + // list of possible cover arts from http://taglib-sharp.sourcearchive.com/documentation/2.0.3.0-2/Ape_2Tag_8cs-source.html + if (is_array($thisfile_ape_items_current['data'])) { + $this->warning('APEtag "'.$item_key.'" should be flagged as Binary data, but was incorrectly flagged as UTF-8'); + $thisfile_ape_items_current['data'] = implode("\x00", $thisfile_ape_items_current['data']); + } + list($thisfile_ape_items_current['filename'], $thisfile_ape_items_current['data']) = explode("\x00", $thisfile_ape_items_current['data'], 2); + $thisfile_ape_items_current['data_offset'] = $thisfile_ape_items_current['offset'] + strlen($thisfile_ape_items_current['filename']."\x00"); + $thisfile_ape_items_current['data_length'] = strlen($thisfile_ape_items_current['data']); + + do { + $thisfile_ape_items_current['image_mime'] = ''; + $imageinfo = array(); + $imagechunkcheck = getid3_lib::GetDataImageSize($thisfile_ape_items_current['data'], $imageinfo); + if (($imagechunkcheck === false) || !isset($imagechunkcheck[2])) { + $this->warning('APEtag "'.$item_key.'" contains invalid image data'); + break; + } + $thisfile_ape_items_current['image_mime'] = image_type_to_mime_type($imagechunkcheck[2]); + + if ($this->inline_attachments === false) { + // skip entirely + unset($thisfile_ape_items_current['data']); + break; + } + if ($this->inline_attachments === true) { + // great + } elseif (is_int($this->inline_attachments)) { + if ($this->inline_attachments < $thisfile_ape_items_current['data_length']) { + // too big, skip + $this->warning('attachment at '.$thisfile_ape_items_current['offset'].' is too large to process inline ('.number_format($thisfile_ape_items_current['data_length']).' bytes)'); + unset($thisfile_ape_items_current['data']); + break; + } + } elseif (is_string($this->inline_attachments)) { + $this->inline_attachments = rtrim(str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $this->inline_attachments), DIRECTORY_SEPARATOR); + if (!is_dir($this->inline_attachments) || !getID3::is_writable($this->inline_attachments)) { + // cannot write, skip + $this->warning('attachment at '.$thisfile_ape_items_current['offset'].' cannot be saved to "'.$this->inline_attachments.'" (not writable)'); + unset($thisfile_ape_items_current['data']); + break; + } + } + // if we get this far, must be OK + if (is_string($this->inline_attachments)) { + $destination_filename = $this->inline_attachments.DIRECTORY_SEPARATOR.md5($info['filenamepath']).'_'.$thisfile_ape_items_current['data_offset']; + if (!file_exists($destination_filename) || getID3::is_writable($destination_filename)) { + file_put_contents($destination_filename, $thisfile_ape_items_current['data']); + } else { + $this->warning('attachment at '.$thisfile_ape_items_current['offset'].' cannot be saved to "'.$destination_filename.'" (not writable)'); + } + $thisfile_ape_items_current['data_filename'] = $destination_filename; + unset($thisfile_ape_items_current['data']); + } else { + if (!isset($info['ape']['comments']['picture'])) { + $info['ape']['comments']['picture'] = array(); + } + $comments_picture_data = array(); + foreach (array('data', 'image_mime', 'image_width', 'image_height', 'imagetype', 'picturetype', 'description', 'datalength') as $picture_key) { + if (isset($thisfile_ape_items_current[$picture_key])) { + $comments_picture_data[$picture_key] = $thisfile_ape_items_current[$picture_key]; + } + } + $info['ape']['comments']['picture'][] = $comments_picture_data; + unset($comments_picture_data); + } + } while (false); + break; + + default: + if (is_array($thisfile_ape_items_current['data'])) { + foreach ($thisfile_ape_items_current['data'] as $comment) { + $thisfile_ape['comments'][strtolower($item_key)][] = $comment; + } + } + break; + } + + } + if (empty($thisfile_replaygain)) { + unset($info['replay_gain']); + } + return true; + } + + public function parseAPEheaderFooter($APEheaderFooterData) { + // http://www.uni-jena.de/~pfk/mpp/sv8/apeheader.html + + // shortcut + $headerfooterinfo['raw'] = array(); + $headerfooterinfo_raw = &$headerfooterinfo['raw']; + + $headerfooterinfo_raw['footer_tag'] = substr($APEheaderFooterData, 0, 8); + if ($headerfooterinfo_raw['footer_tag'] != 'APETAGEX') { + return false; + } + $headerfooterinfo_raw['version'] = getid3_lib::LittleEndian2Int(substr($APEheaderFooterData, 8, 4)); + $headerfooterinfo_raw['tagsize'] = getid3_lib::LittleEndian2Int(substr($APEheaderFooterData, 12, 4)); + $headerfooterinfo_raw['tag_items'] = getid3_lib::LittleEndian2Int(substr($APEheaderFooterData, 16, 4)); + $headerfooterinfo_raw['global_flags'] = getid3_lib::LittleEndian2Int(substr($APEheaderFooterData, 20, 4)); + $headerfooterinfo_raw['reserved'] = substr($APEheaderFooterData, 24, 8); + + $headerfooterinfo['tag_version'] = $headerfooterinfo_raw['version'] / 1000; + if ($headerfooterinfo['tag_version'] >= 2) { + $headerfooterinfo['flags'] = $this->parseAPEtagFlags($headerfooterinfo_raw['global_flags']); + } + return $headerfooterinfo; + } + + public function parseAPEtagFlags($rawflagint) { + // "Note: APE Tags 1.0 do not use any of the APE Tag flags. + // All are set to zero on creation and ignored on reading." + // http://wiki.hydrogenaud.io/index.php?title=Ape_Tags_Flags + $flags['header'] = (bool) ($rawflagint & 0x80000000); + $flags['footer'] = (bool) ($rawflagint & 0x40000000); + $flags['this_is_header'] = (bool) ($rawflagint & 0x20000000); + $flags['item_contents_raw'] = ($rawflagint & 0x00000006) >> 1; + $flags['read_only'] = (bool) ($rawflagint & 0x00000001); + + $flags['item_contents'] = $this->APEcontentTypeFlagLookup($flags['item_contents_raw']); + + return $flags; + } + + public function APEcontentTypeFlagLookup($contenttypeid) { + static $APEcontentTypeFlagLookup = array( + 0 => 'utf-8', + 1 => 'binary', + 2 => 'external', + 3 => 'reserved' + ); + return (isset($APEcontentTypeFlagLookup[$contenttypeid]) ? $APEcontentTypeFlagLookup[$contenttypeid] : 'invalid'); + } + + public function APEtagItemIsUTF8Lookup($itemkey) { + static $APEtagItemIsUTF8Lookup = array( + 'title', + 'subtitle', + 'artist', + 'album', + 'debut album', + 'publisher', + 'conductor', + 'track', + 'composer', + 'comment', + 'copyright', + 'publicationright', + 'file', + 'year', + 'record date', + 'record location', + 'genre', + 'media', + 'related', + 'isrc', + 'abstract', + 'language', + 'bibliography' + ); + return in_array(strtolower($itemkey), $APEtagItemIsUTF8Lookup); + } + +} diff --git a/www/rompr/getid3/module.tag.id3v1.php b/www/rompr/getid3/module.tag.id3v1.php new file mode 100644 index 0000000..d160e9b --- /dev/null +++ b/www/rompr/getid3/module.tag.id3v1.php @@ -0,0 +1,381 @@ + // +// available at http://getid3.sourceforge.net // +// or http://www.getid3.org // +// also https://github.com/JamesHeinrich/getID3 // +///////////////////////////////////////////////////////////////// +// See readme.txt for more details // +///////////////////////////////////////////////////////////////// +// // +// module.tag.id3v1.php // +// module for analyzing ID3v1 tags // +// dependencies: NONE // +// /// +///////////////////////////////////////////////////////////////// + + +class getid3_id3v1 extends getid3_handler +{ + + public function Analyze() { + $info = &$this->getid3->info; + + if (!getid3_lib::intValueSupported($info['filesize'])) { + $this->warning('Unable to check for ID3v1 because file is larger than '.round(PHP_INT_MAX / 1073741824).'GB'); + return false; + } + + $this->fseek(-256, SEEK_END); + $preid3v1 = $this->fread(128); + $id3v1tag = $this->fread(128); + + if (substr($id3v1tag, 0, 3) == 'TAG') { + + $info['avdataend'] = $info['filesize'] - 128; + + $ParsedID3v1['title'] = $this->cutfield(substr($id3v1tag, 3, 30)); + $ParsedID3v1['artist'] = $this->cutfield(substr($id3v1tag, 33, 30)); + $ParsedID3v1['album'] = $this->cutfield(substr($id3v1tag, 63, 30)); + $ParsedID3v1['year'] = $this->cutfield(substr($id3v1tag, 93, 4)); + $ParsedID3v1['comment'] = substr($id3v1tag, 97, 30); // can't remove nulls yet, track detection depends on them + $ParsedID3v1['genreid'] = ord(substr($id3v1tag, 127, 1)); + + // If second-last byte of comment field is null and last byte of comment field is non-null + // then this is ID3v1.1 and the comment field is 28 bytes long and the 30th byte is the track number + if (($id3v1tag{125} === "\x00") && ($id3v1tag{126} !== "\x00")) { + $ParsedID3v1['track'] = ord(substr($ParsedID3v1['comment'], 29, 1)); + $ParsedID3v1['comment'] = substr($ParsedID3v1['comment'], 0, 28); + } + $ParsedID3v1['comment'] = $this->cutfield($ParsedID3v1['comment']); + + $ParsedID3v1['genre'] = $this->LookupGenreName($ParsedID3v1['genreid']); + if (!empty($ParsedID3v1['genre'])) { + unset($ParsedID3v1['genreid']); + } + if (isset($ParsedID3v1['genre']) && (empty($ParsedID3v1['genre']) || ($ParsedID3v1['genre'] == 'Unknown'))) { + unset($ParsedID3v1['genre']); + } + + foreach ($ParsedID3v1 as $key => $value) { + $ParsedID3v1['comments'][$key][0] = $value; + } + // ID3v1 encoding detection hack START + // ID3v1 is defined as always using ISO-8859-1 encoding, but it is not uncommon to find files tagged with ID3v1 using Windows-1251 or other character sets + // Since ID3v1 has no concept of character sets there is no certain way to know we have the correct non-ISO-8859-1 character set, but we can guess + $ID3v1encoding = 'ISO-8859-1'; + foreach ($ParsedID3v1['comments'] as $tag_key => $valuearray) { + foreach ($valuearray as $key => $value) { + if (preg_match('#^[\\x00-\\x40\\xA8\\B8\\x80-\\xFF]+$#', $value)) { + foreach (array('Windows-1251', 'KOI8-R') as $id3v1_bad_encoding) { + if (function_exists('mb_convert_encoding') && @mb_convert_encoding($value, $id3v1_bad_encoding, $id3v1_bad_encoding) === $value) { + $ID3v1encoding = $id3v1_bad_encoding; + break 3; + } elseif (function_exists('iconv') && @iconv($id3v1_bad_encoding, $id3v1_bad_encoding, $value) === $value) { + $ID3v1encoding = $id3v1_bad_encoding; + break 3; + } + } + } + } + } + // ID3v1 encoding detection hack END + + // ID3v1 data is supposed to be padded with NULL characters, but some taggers pad with spaces + $GoodFormatID3v1tag = $this->GenerateID3v1Tag( + $ParsedID3v1['title'], + $ParsedID3v1['artist'], + $ParsedID3v1['album'], + $ParsedID3v1['year'], + (isset($ParsedID3v1['genre']) ? $this->LookupGenreID($ParsedID3v1['genre']) : false), + $ParsedID3v1['comment'], + (!empty($ParsedID3v1['track']) ? $ParsedID3v1['track'] : '')); + $ParsedID3v1['padding_valid'] = true; + if ($id3v1tag !== $GoodFormatID3v1tag) { + $ParsedID3v1['padding_valid'] = false; + $this->warning('Some ID3v1 fields do not use NULL characters for padding'); + } + + $ParsedID3v1['tag_offset_end'] = $info['filesize']; + $ParsedID3v1['tag_offset_start'] = $ParsedID3v1['tag_offset_end'] - 128; + + $info['id3v1'] = $ParsedID3v1; + $info['id3v1']['encoding'] = $ID3v1encoding; + } + + if (substr($preid3v1, 0, 3) == 'TAG') { + // The way iTunes handles tags is, well, brain-damaged. + // It completely ignores v1 if ID3v2 is present. + // This goes as far as adding a new v1 tag *even if there already is one* + + // A suspected double-ID3v1 tag has been detected, but it could be that + // the "TAG" identifier is a legitimate part of an APE or Lyrics3 tag + if (substr($preid3v1, 96, 8) == 'APETAGEX') { + // an APE tag footer was found before the last ID3v1, assume false "TAG" synch + } elseif (substr($preid3v1, 119, 6) == 'LYRICS') { + // a Lyrics3 tag footer was found before the last ID3v1, assume false "TAG" synch + } else { + // APE and Lyrics3 footers not found - assume double ID3v1 + $this->warning('Duplicate ID3v1 tag detected - this has been known to happen with iTunes'); + $info['avdataend'] -= 128; + } + } + + return true; + } + + public static function cutfield($str) { + return trim(substr($str, 0, strcspn($str, "\x00"))); + } + + public static function ArrayOfGenres($allowSCMPXextended=false) { + static $GenreLookup = array( + 0 => 'Blues', + 1 => 'Classic Rock', + 2 => 'Country', + 3 => 'Dance', + 4 => 'Disco', + 5 => 'Funk', + 6 => 'Grunge', + 7 => 'Hip-Hop', + 8 => 'Jazz', + 9 => 'Metal', + 10 => 'New Age', + 11 => 'Oldies', + 12 => 'Other', + 13 => 'Pop', + 14 => 'R&B', + 15 => 'Rap', + 16 => 'Reggae', + 17 => 'Rock', + 18 => 'Techno', + 19 => 'Industrial', + 20 => 'Alternative', + 21 => 'Ska', + 22 => 'Death Metal', + 23 => 'Pranks', + 24 => 'Soundtrack', + 25 => 'Euro-Techno', + 26 => 'Ambient', + 27 => 'Trip-Hop', + 28 => 'Vocal', + 29 => 'Jazz+Funk', + 30 => 'Fusion', + 31 => 'Trance', + 32 => 'Classical', + 33 => 'Instrumental', + 34 => 'Acid', + 35 => 'House', + 36 => 'Game', + 37 => 'Sound Clip', + 38 => 'Gospel', + 39 => 'Noise', + 40 => 'Alt. Rock', + 41 => 'Bass', + 42 => 'Soul', + 43 => 'Punk', + 44 => 'Space', + 45 => 'Meditative', + 46 => 'Instrumental Pop', + 47 => 'Instrumental Rock', + 48 => 'Ethnic', + 49 => 'Gothic', + 50 => 'Darkwave', + 51 => 'Techno-Industrial', + 52 => 'Electronic', + 53 => 'Pop-Folk', + 54 => 'Eurodance', + 55 => 'Dream', + 56 => 'Southern Rock', + 57 => 'Comedy', + 58 => 'Cult', + 59 => 'Gangsta Rap', + 60 => 'Top 40', + 61 => 'Christian Rap', + 62 => 'Pop/Funk', + 63 => 'Jungle', + 64 => 'Native American', + 65 => 'Cabaret', + 66 => 'New Wave', + 67 => 'Psychedelic', + 68 => 'Rave', + 69 => 'Showtunes', + 70 => 'Trailer', + 71 => 'Lo-Fi', + 72 => 'Tribal', + 73 => 'Acid Punk', + 74 => 'Acid Jazz', + 75 => 'Polka', + 76 => 'Retro', + 77 => 'Musical', + 78 => 'Rock & Roll', + 79 => 'Hard Rock', + 80 => 'Folk', + 81 => 'Folk/Rock', + 82 => 'National Folk', + 83 => 'Swing', + 84 => 'Fast-Fusion', + 85 => 'Bebob', + 86 => 'Latin', + 87 => 'Revival', + 88 => 'Celtic', + 89 => 'Bluegrass', + 90 => 'Avantgarde', + 91 => 'Gothic Rock', + 92 => 'Progressive Rock', + 93 => 'Psychedelic Rock', + 94 => 'Symphonic Rock', + 95 => 'Slow Rock', + 96 => 'Big Band', + 97 => 'Chorus', + 98 => 'Easy Listening', + 99 => 'Acoustic', + 100 => 'Humour', + 101 => 'Speech', + 102 => 'Chanson', + 103 => 'Opera', + 104 => 'Chamber Music', + 105 => 'Sonata', + 106 => 'Symphony', + 107 => 'Booty Bass', + 108 => 'Primus', + 109 => 'Porn Groove', + 110 => 'Satire', + 111 => 'Slow Jam', + 112 => 'Club', + 113 => 'Tango', + 114 => 'Samba', + 115 => 'Folklore', + 116 => 'Ballad', + 117 => 'Power Ballad', + 118 => 'Rhythmic Soul', + 119 => 'Freestyle', + 120 => 'Duet', + 121 => 'Punk Rock', + 122 => 'Drum Solo', + 123 => 'A Cappella', + 124 => 'Euro-House', + 125 => 'Dance Hall', + 126 => 'Goa', + 127 => 'Drum & Bass', + 128 => 'Club-House', + 129 => 'Hardcore', + 130 => 'Terror', + 131 => 'Indie', + 132 => 'BritPop', + 133 => 'Negerpunk', + 134 => 'Polsk Punk', + 135 => 'Beat', + 136 => 'Christian Gangsta Rap', + 137 => 'Heavy Metal', + 138 => 'Black Metal', + 139 => 'Crossover', + 140 => 'Contemporary Christian', + 141 => 'Christian Rock', + 142 => 'Merengue', + 143 => 'Salsa', + 144 => 'Thrash Metal', + 145 => 'Anime', + 146 => 'JPop', + 147 => 'Synthpop', + + 255 => 'Unknown', + + 'CR' => 'Cover', + 'RX' => 'Remix' + ); + + static $GenreLookupSCMPX = array(); + if ($allowSCMPXextended && empty($GenreLookupSCMPX)) { + $GenreLookupSCMPX = $GenreLookup; + // http://www.geocities.co.jp/SiliconValley-Oakland/3664/alittle.html#GenreExtended + // Extended ID3v1 genres invented by SCMPX + // Note that 255 "Japanese Anime" conflicts with standard "Unknown" + $GenreLookupSCMPX[240] = 'Sacred'; + $GenreLookupSCMPX[241] = 'Northern Europe'; + $GenreLookupSCMPX[242] = 'Irish & Scottish'; + $GenreLookupSCMPX[243] = 'Scotland'; + $GenreLookupSCMPX[244] = 'Ethnic Europe'; + $GenreLookupSCMPX[245] = 'Enka'; + $GenreLookupSCMPX[246] = 'Children\'s Song'; + $GenreLookupSCMPX[247] = 'Japanese Sky'; + $GenreLookupSCMPX[248] = 'Japanese Heavy Rock'; + $GenreLookupSCMPX[249] = 'Japanese Doom Rock'; + $GenreLookupSCMPX[250] = 'Japanese J-POP'; + $GenreLookupSCMPX[251] = 'Japanese Seiyu'; + $GenreLookupSCMPX[252] = 'Japanese Ambient Techno'; + $GenreLookupSCMPX[253] = 'Japanese Moemoe'; + $GenreLookupSCMPX[254] = 'Japanese Tokusatsu'; + //$GenreLookupSCMPX[255] = 'Japanese Anime'; + } + + return ($allowSCMPXextended ? $GenreLookupSCMPX : $GenreLookup); + } + + public static function LookupGenreName($genreid, $allowSCMPXextended=true) { + switch ($genreid) { + case 'RX': + case 'CR': + break; + default: + if (!is_numeric($genreid)) { + return false; + } + $genreid = intval($genreid); // to handle 3 or '3' or '03' + break; + } + $GenreLookup = self::ArrayOfGenres($allowSCMPXextended); + return (isset($GenreLookup[$genreid]) ? $GenreLookup[$genreid] : false); + } + + public static function LookupGenreID($genre, $allowSCMPXextended=false) { + $GenreLookup = self::ArrayOfGenres($allowSCMPXextended); + $LowerCaseNoSpaceSearchTerm = strtolower(str_replace(' ', '', $genre)); + foreach ($GenreLookup as $key => $value) { + if (strtolower(str_replace(' ', '', $value)) == $LowerCaseNoSpaceSearchTerm) { + return $key; + } + } + return false; + } + + public static function StandardiseID3v1GenreName($OriginalGenre) { + if (($GenreID = self::LookupGenreID($OriginalGenre)) !== false) { + return self::LookupGenreName($GenreID); + } + return $OriginalGenre; + } + + public static function GenerateID3v1Tag($title, $artist, $album, $year, $genreid, $comment, $track='') { + $ID3v1Tag = 'TAG'; + $ID3v1Tag .= str_pad(trim(substr($title, 0, 30)), 30, "\x00", STR_PAD_RIGHT); + $ID3v1Tag .= str_pad(trim(substr($artist, 0, 30)), 30, "\x00", STR_PAD_RIGHT); + $ID3v1Tag .= str_pad(trim(substr($album, 0, 30)), 30, "\x00", STR_PAD_RIGHT); + $ID3v1Tag .= str_pad(trim(substr($year, 0, 4)), 4, "\x00", STR_PAD_LEFT); + if (!empty($track) && ($track > 0) && ($track <= 255)) { + $ID3v1Tag .= str_pad(trim(substr($comment, 0, 28)), 28, "\x00", STR_PAD_RIGHT); + $ID3v1Tag .= "\x00"; + if (gettype($track) == 'string') { + $track = (int) $track; + } + $ID3v1Tag .= chr($track); + } else { + $ID3v1Tag .= str_pad(trim(substr($comment, 0, 30)), 30, "\x00", STR_PAD_RIGHT); + } + if (($genreid < 0) || ($genreid > 147)) { + $genreid = 255; // 'unknown' genre + } + switch (gettype($genreid)) { + case 'string': + case 'integer': + $ID3v1Tag .= chr(intval($genreid)); + break; + default: + $ID3v1Tag .= chr(255); // 'unknown' genre + break; + } + + return $ID3v1Tag; + } + +} diff --git a/www/rompr/getid3/module.tag.id3v2.php b/www/rompr/getid3/module.tag.id3v2.php new file mode 100644 index 0000000..139238a --- /dev/null +++ b/www/rompr/getid3/module.tag.id3v2.php @@ -0,0 +1,3742 @@ + // +// available at http://getid3.sourceforge.net // +// or http://www.getid3.org // +// also https://github.com/JamesHeinrich/getID3 // +///////////////////////////////////////////////////////////////// +// See readme.txt for more details // +///////////////////////////////////////////////////////////////// +/// // +// module.tag.id3v2.php // +// module for analyzing ID3v2 tags // +// dependencies: module.tag.id3v1.php // +// /// +///////////////////////////////////////////////////////////////// + +getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.tag.id3v1.php', __FILE__, true); + +class getid3_id3v2 extends getid3_handler +{ + public $StartingOffset = 0; + + public function Analyze() { + $info = &$this->getid3->info; + + // Overall tag structure: + // +-----------------------------+ + // | Header (10 bytes) | + // +-----------------------------+ + // | Extended Header | + // | (variable length, OPTIONAL) | + // +-----------------------------+ + // | Frames (variable length) | + // +-----------------------------+ + // | Padding | + // | (variable length, OPTIONAL) | + // +-----------------------------+ + // | Footer (10 bytes, OPTIONAL) | + // +-----------------------------+ + + // Header + // ID3v2/file identifier "ID3" + // ID3v2 version $04 00 + // ID3v2 flags (%ab000000 in v2.2, %abc00000 in v2.3, %abcd0000 in v2.4.x) + // ID3v2 size 4 * %0xxxxxxx + + + // shortcuts + $info['id3v2']['header'] = true; + $thisfile_id3v2 = &$info['id3v2']; + $thisfile_id3v2['flags'] = array(); + $thisfile_id3v2_flags = &$thisfile_id3v2['flags']; + + + $this->fseek($this->StartingOffset); + $header = $this->fread(10); + if (substr($header, 0, 3) == 'ID3' && strlen($header) == 10) { + + $thisfile_id3v2['majorversion'] = ord($header{3}); + $thisfile_id3v2['minorversion'] = ord($header{4}); + + // shortcut + $id3v2_majorversion = &$thisfile_id3v2['majorversion']; + + } else { + + unset($info['id3v2']); + return false; + + } + + if ($id3v2_majorversion > 4) { // this script probably won't correctly parse ID3v2.5.x and above (if it ever exists) + + $this->error('this script only parses up to ID3v2.4.x - this tag is ID3v2.'.$id3v2_majorversion.'.'.$thisfile_id3v2['minorversion']); + return false; + + } + + $id3_flags = ord($header{5}); + switch ($id3v2_majorversion) { + case 2: + // %ab000000 in v2.2 + $thisfile_id3v2_flags['unsynch'] = (bool) ($id3_flags & 0x80); // a - Unsynchronisation + $thisfile_id3v2_flags['compression'] = (bool) ($id3_flags & 0x40); // b - Compression + break; + + case 3: + // %abc00000 in v2.3 + $thisfile_id3v2_flags['unsynch'] = (bool) ($id3_flags & 0x80); // a - Unsynchronisation + $thisfile_id3v2_flags['exthead'] = (bool) ($id3_flags & 0x40); // b - Extended header + $thisfile_id3v2_flags['experim'] = (bool) ($id3_flags & 0x20); // c - Experimental indicator + break; + + case 4: + // %abcd0000 in v2.4 + $thisfile_id3v2_flags['unsynch'] = (bool) ($id3_flags & 0x80); // a - Unsynchronisation + $thisfile_id3v2_flags['exthead'] = (bool) ($id3_flags & 0x40); // b - Extended header + $thisfile_id3v2_flags['experim'] = (bool) ($id3_flags & 0x20); // c - Experimental indicator + $thisfile_id3v2_flags['isfooter'] = (bool) ($id3_flags & 0x10); // d - Footer present + break; + } + + $thisfile_id3v2['headerlength'] = getid3_lib::BigEndian2Int(substr($header, 6, 4), 1) + 10; // length of ID3v2 tag in 10-byte header doesn't include 10-byte header length + + $thisfile_id3v2['tag_offset_start'] = $this->StartingOffset; + $thisfile_id3v2['tag_offset_end'] = $thisfile_id3v2['tag_offset_start'] + $thisfile_id3v2['headerlength']; + + + + // create 'encoding' key - used by getid3::HandleAllTags() + // in ID3v2 every field can have it's own encoding type + // so force everything to UTF-8 so it can be handled consistantly + $thisfile_id3v2['encoding'] = 'UTF-8'; + + + // Frames + + // All ID3v2 frames consists of one frame header followed by one or more + // fields containing the actual information. The header is always 10 + // bytes and laid out as follows: + // + // Frame ID $xx xx xx xx (four characters) + // Size 4 * %0xxxxxxx + // Flags $xx xx + + $sizeofframes = $thisfile_id3v2['headerlength'] - 10; // not including 10-byte initial header + if (!empty($thisfile_id3v2['exthead']['length'])) { + $sizeofframes -= ($thisfile_id3v2['exthead']['length'] + 4); + } + if (!empty($thisfile_id3v2_flags['isfooter'])) { + $sizeofframes -= 10; // footer takes last 10 bytes of ID3v2 header, after frame data, before audio + } + if ($sizeofframes > 0) { + + $framedata = $this->fread($sizeofframes); // read all frames from file into $framedata variable + + // if entire frame data is unsynched, de-unsynch it now (ID3v2.3.x) + if (!empty($thisfile_id3v2_flags['unsynch']) && ($id3v2_majorversion <= 3)) { + $framedata = $this->DeUnsynchronise($framedata); + } + // [in ID3v2.4.0] Unsynchronisation [S:6.1] is done on frame level, instead + // of on tag level, making it easier to skip frames, increasing the streamability + // of the tag. The unsynchronisation flag in the header [S:3.1] indicates that + // there exists an unsynchronised frame, while the new unsynchronisation flag in + // the frame header [S:4.1.2] indicates unsynchronisation. + + + //$framedataoffset = 10 + ($thisfile_id3v2['exthead']['length'] ? $thisfile_id3v2['exthead']['length'] + 4 : 0); // how many bytes into the stream - start from after the 10-byte header (and extended header length+4, if present) + $framedataoffset = 10; // how many bytes into the stream - start from after the 10-byte header + + + // Extended Header + if (!empty($thisfile_id3v2_flags['exthead'])) { + $extended_header_offset = 0; + + if ($id3v2_majorversion == 3) { + + // v2.3 definition: + //Extended header size $xx xx xx xx // 32-bit integer + //Extended Flags $xx xx + // %x0000000 %00000000 // v2.3 + // x - CRC data present + //Size of padding $xx xx xx xx + + $thisfile_id3v2['exthead']['length'] = getid3_lib::BigEndian2Int(substr($framedata, $extended_header_offset, 4), 0); + $extended_header_offset += 4; + + $thisfile_id3v2['exthead']['flag_bytes'] = 2; + $thisfile_id3v2['exthead']['flag_raw'] = getid3_lib::BigEndian2Int(substr($framedata, $extended_header_offset, $thisfile_id3v2['exthead']['flag_bytes'])); + $extended_header_offset += $thisfile_id3v2['exthead']['flag_bytes']; + + $thisfile_id3v2['exthead']['flags']['crc'] = (bool) ($thisfile_id3v2['exthead']['flag_raw'] & 0x8000); + + $thisfile_id3v2['exthead']['padding_size'] = getid3_lib::BigEndian2Int(substr($framedata, $extended_header_offset, 4)); + $extended_header_offset += 4; + + if ($thisfile_id3v2['exthead']['flags']['crc']) { + $thisfile_id3v2['exthead']['flag_data']['crc'] = getid3_lib::BigEndian2Int(substr($framedata, $extended_header_offset, 4)); + $extended_header_offset += 4; + } + $extended_header_offset += $thisfile_id3v2['exthead']['padding_size']; + + } elseif ($id3v2_majorversion == 4) { + + // v2.4 definition: + //Extended header size 4 * %0xxxxxxx // 28-bit synchsafe integer + //Number of flag bytes $01 + //Extended Flags $xx + // %0bcd0000 // v2.4 + // b - Tag is an update + // Flag data length $00 + // c - CRC data present + // Flag data length $05 + // Total frame CRC 5 * %0xxxxxxx + // d - Tag restrictions + // Flag data length $01 + + $thisfile_id3v2['exthead']['length'] = getid3_lib::BigEndian2Int(substr($framedata, $extended_header_offset, 4), true); + $extended_header_offset += 4; + + $thisfile_id3v2['exthead']['flag_bytes'] = getid3_lib::BigEndian2Int(substr($framedata, $extended_header_offset, 1)); // should always be 1 + $extended_header_offset += 1; + + $thisfile_id3v2['exthead']['flag_raw'] = getid3_lib::BigEndian2Int(substr($framedata, $extended_header_offset, $thisfile_id3v2['exthead']['flag_bytes'])); + $extended_header_offset += $thisfile_id3v2['exthead']['flag_bytes']; + + $thisfile_id3v2['exthead']['flags']['update'] = (bool) ($thisfile_id3v2['exthead']['flag_raw'] & 0x40); + $thisfile_id3v2['exthead']['flags']['crc'] = (bool) ($thisfile_id3v2['exthead']['flag_raw'] & 0x20); + $thisfile_id3v2['exthead']['flags']['restrictions'] = (bool) ($thisfile_id3v2['exthead']['flag_raw'] & 0x10); + + if ($thisfile_id3v2['exthead']['flags']['update']) { + $ext_header_chunk_length = getid3_lib::BigEndian2Int(substr($framedata, $extended_header_offset, 1)); // should be 0 + $extended_header_offset += 1; + } + + if ($thisfile_id3v2['exthead']['flags']['crc']) { + $ext_header_chunk_length = getid3_lib::BigEndian2Int(substr($framedata, $extended_header_offset, 1)); // should be 5 + $extended_header_offset += 1; + $thisfile_id3v2['exthead']['flag_data']['crc'] = getid3_lib::BigEndian2Int(substr($framedata, $extended_header_offset, $ext_header_chunk_length), true, false); + $extended_header_offset += $ext_header_chunk_length; + } + + if ($thisfile_id3v2['exthead']['flags']['restrictions']) { + $ext_header_chunk_length = getid3_lib::BigEndian2Int(substr($framedata, $extended_header_offset, 1)); // should be 1 + $extended_header_offset += 1; + + // %ppqrrstt + $restrictions_raw = getid3_lib::BigEndian2Int(substr($framedata, $extended_header_offset, 1)); + $extended_header_offset += 1; + $thisfile_id3v2['exthead']['flags']['restrictions']['tagsize'] = ($restrictions_raw & 0xC0) >> 6; // p - Tag size restrictions + $thisfile_id3v2['exthead']['flags']['restrictions']['textenc'] = ($restrictions_raw & 0x20) >> 5; // q - Text encoding restrictions + $thisfile_id3v2['exthead']['flags']['restrictions']['textsize'] = ($restrictions_raw & 0x18) >> 3; // r - Text fields size restrictions + $thisfile_id3v2['exthead']['flags']['restrictions']['imgenc'] = ($restrictions_raw & 0x04) >> 2; // s - Image encoding restrictions + $thisfile_id3v2['exthead']['flags']['restrictions']['imgsize'] = ($restrictions_raw & 0x03) >> 0; // t - Image size restrictions + + $thisfile_id3v2['exthead']['flags']['restrictions_text']['tagsize'] = $this->LookupExtendedHeaderRestrictionsTagSizeLimits($thisfile_id3v2['exthead']['flags']['restrictions']['tagsize']); + $thisfile_id3v2['exthead']['flags']['restrictions_text']['textenc'] = $this->LookupExtendedHeaderRestrictionsTextEncodings($thisfile_id3v2['exthead']['flags']['restrictions']['textenc']); + $thisfile_id3v2['exthead']['flags']['restrictions_text']['textsize'] = $this->LookupExtendedHeaderRestrictionsTextFieldSize($thisfile_id3v2['exthead']['flags']['restrictions']['textsize']); + $thisfile_id3v2['exthead']['flags']['restrictions_text']['imgenc'] = $this->LookupExtendedHeaderRestrictionsImageEncoding($thisfile_id3v2['exthead']['flags']['restrictions']['imgenc']); + $thisfile_id3v2['exthead']['flags']['restrictions_text']['imgsize'] = $this->LookupExtendedHeaderRestrictionsImageSizeSize($thisfile_id3v2['exthead']['flags']['restrictions']['imgsize']); + } + + if ($thisfile_id3v2['exthead']['length'] != $extended_header_offset) { + $this->warning('ID3v2.4 extended header length mismatch (expecting '.intval($thisfile_id3v2['exthead']['length']).', found '.intval($extended_header_offset).')'); + } + } + + $framedataoffset += $extended_header_offset; + $framedata = substr($framedata, $extended_header_offset); + } // end extended header + + + while (isset($framedata) && (strlen($framedata) > 0)) { // cycle through until no more frame data is left to parse + if (strlen($framedata) <= $this->ID3v2HeaderLength($id3v2_majorversion)) { + // insufficient room left in ID3v2 header for actual data - must be padding + $thisfile_id3v2['padding']['start'] = $framedataoffset; + $thisfile_id3v2['padding']['length'] = strlen($framedata); + $thisfile_id3v2['padding']['valid'] = true; + for ($i = 0; $i < $thisfile_id3v2['padding']['length']; $i++) { + if ($framedata{$i} != "\x00") { + $thisfile_id3v2['padding']['valid'] = false; + $thisfile_id3v2['padding']['errorpos'] = $thisfile_id3v2['padding']['start'] + $i; + $this->warning('Invalid ID3v2 padding found at offset '.$thisfile_id3v2['padding']['errorpos'].' (the remaining '.($thisfile_id3v2['padding']['length'] - $i).' bytes are considered invalid)'); + break; + } + } + break; // skip rest of ID3v2 header + } + if ($id3v2_majorversion == 2) { + // Frame ID $xx xx xx (three characters) + // Size $xx xx xx (24-bit integer) + // Flags $xx xx + + $frame_header = substr($framedata, 0, 6); // take next 6 bytes for header + $framedata = substr($framedata, 6); // and leave the rest in $framedata + $frame_name = substr($frame_header, 0, 3); + $frame_size = getid3_lib::BigEndian2Int(substr($frame_header, 3, 3), 0); + $frame_flags = 0; // not used for anything in ID3v2.2, just set to avoid E_NOTICEs + + } elseif ($id3v2_majorversion > 2) { + + // Frame ID $xx xx xx xx (four characters) + // Size $xx xx xx xx (32-bit integer in v2.3, 28-bit synchsafe in v2.4+) + // Flags $xx xx + + $frame_header = substr($framedata, 0, 10); // take next 10 bytes for header + $framedata = substr($framedata, 10); // and leave the rest in $framedata + + $frame_name = substr($frame_header, 0, 4); + if ($id3v2_majorversion == 3) { + $frame_size = getid3_lib::BigEndian2Int(substr($frame_header, 4, 4), 0); // 32-bit integer + } else { // ID3v2.4+ + $frame_size = getid3_lib::BigEndian2Int(substr($frame_header, 4, 4), 1); // 32-bit synchsafe integer (28-bit value) + } + + if ($frame_size < (strlen($framedata) + 4)) { + $nextFrameID = substr($framedata, $frame_size, 4); + if ($this->IsValidID3v2FrameName($nextFrameID, $id3v2_majorversion)) { + // next frame is OK + } elseif (($frame_name == "\x00".'MP3') || ($frame_name == "\x00\x00".'MP') || ($frame_name == ' MP3') || ($frame_name == 'MP3e')) { + // MP3ext known broken frames - "ok" for the purposes of this test + } elseif (($id3v2_majorversion == 4) && ($this->IsValidID3v2FrameName(substr($framedata, getid3_lib::BigEndian2Int(substr($frame_header, 4, 4), 0), 4), 3))) { + $this->warning('ID3v2 tag written as ID3v2.4, but with non-synchsafe integers (ID3v2.3 style). Older versions of (Helium2; iTunes) are known culprits of this. Tag has been parsed as ID3v2.3'); + $id3v2_majorversion = 3; + $frame_size = getid3_lib::BigEndian2Int(substr($frame_header, 4, 4), 0); // 32-bit integer + } + } + + + $frame_flags = getid3_lib::BigEndian2Int(substr($frame_header, 8, 2)); + } + + if ((($id3v2_majorversion == 2) && ($frame_name == "\x00\x00\x00")) || ($frame_name == "\x00\x00\x00\x00")) { + // padding encountered + + $thisfile_id3v2['padding']['start'] = $framedataoffset; + $thisfile_id3v2['padding']['length'] = strlen($frame_header) + strlen($framedata); + $thisfile_id3v2['padding']['valid'] = true; + + $len = strlen($framedata); + for ($i = 0; $i < $len; $i++) { + if ($framedata{$i} != "\x00") { + $thisfile_id3v2['padding']['valid'] = false; + $thisfile_id3v2['padding']['errorpos'] = $thisfile_id3v2['padding']['start'] + $i; + $this->warning('Invalid ID3v2 padding found at offset '.$thisfile_id3v2['padding']['errorpos'].' (the remaining '.($thisfile_id3v2['padding']['length'] - $i).' bytes are considered invalid)'); + break; + } + } + break; // skip rest of ID3v2 header + } + + if ($iTunesBrokenFrameNameFixed = self::ID3v22iTunesBrokenFrameName($frame_name)) { + $this->warning('error parsing "'.$frame_name.'" ('.$framedataoffset.' bytes into the ID3v2.'.$id3v2_majorversion.' tag). (ERROR: IsValidID3v2FrameName("'.str_replace("\x00", ' ', $frame_name).'", '.$id3v2_majorversion.'))). [Note: this particular error has been known to happen with tags edited by iTunes (versions "X v2.0.3", "v3.0.1", "v7.0.0.70" are known-guilty, probably others too)]. Translated frame name from "'.str_replace("\x00", ' ', $frame_name).'" to "'.$iTunesBrokenFrameNameFixed.'" for parsing.'); + $frame_name = $iTunesBrokenFrameNameFixed; + } + if (($frame_size <= strlen($framedata)) && ($this->IsValidID3v2FrameName($frame_name, $id3v2_majorversion))) { + + unset($parsedFrame); + $parsedFrame['frame_name'] = $frame_name; + $parsedFrame['frame_flags_raw'] = $frame_flags; + $parsedFrame['data'] = substr($framedata, 0, $frame_size); + $parsedFrame['datalength'] = getid3_lib::CastAsInt($frame_size); + $parsedFrame['dataoffset'] = $framedataoffset; + + $this->ParseID3v2Frame($parsedFrame); + $thisfile_id3v2[$frame_name][] = $parsedFrame; + + $framedata = substr($framedata, $frame_size); + + } else { // invalid frame length or FrameID + + if ($frame_size <= strlen($framedata)) { + + if ($this->IsValidID3v2FrameName(substr($framedata, $frame_size, 4), $id3v2_majorversion)) { + + // next frame is valid, just skip the current frame + $framedata = substr($framedata, $frame_size); + $this->warning('Next ID3v2 frame is valid, skipping current frame.'); + + } else { + + // next frame is invalid too, abort processing + //unset($framedata); + $framedata = null; + $this->error('Next ID3v2 frame is also invalid, aborting processing.'); + + } + + } elseif ($frame_size == strlen($framedata)) { + + // this is the last frame, just skip + $this->warning('This was the last ID3v2 frame.'); + + } else { + + // next frame is invalid too, abort processing + //unset($framedata); + $framedata = null; + $this->warning('Invalid ID3v2 frame size, aborting.'); + + } + if (!$this->IsValidID3v2FrameName($frame_name, $id3v2_majorversion)) { + + switch ($frame_name) { + case "\x00\x00".'MP': + case "\x00".'MP3': + case ' MP3': + case 'MP3e': + case "\x00".'MP': + case ' MP': + case 'MP3': + $this->warning('error parsing "'.$frame_name.'" ('.$framedataoffset.' bytes into the ID3v2.'.$id3v2_majorversion.' tag). (ERROR: !IsValidID3v2FrameName("'.str_replace("\x00", ' ', $frame_name).'", '.$id3v2_majorversion.'))). [Note: this particular error has been known to happen with tags edited by "MP3ext (www.mutschler.de/mp3ext/)"]'); + break; + + default: + $this->warning('error parsing "'.$frame_name.'" ('.$framedataoffset.' bytes into the ID3v2.'.$id3v2_majorversion.' tag). (ERROR: !IsValidID3v2FrameName("'.str_replace("\x00", ' ', $frame_name).'", '.$id3v2_majorversion.'))).'); + break; + } + + } elseif (!isset($framedata) || ($frame_size > strlen($framedata))) { + + $this->error('error parsing "'.$frame_name.'" ('.$framedataoffset.' bytes into the ID3v2.'.$id3v2_majorversion.' tag). (ERROR: $frame_size ('.$frame_size.') > strlen($framedata) ('.(isset($framedata) ? strlen($framedata) : 'null').')).'); + + } else { + + $this->error('error parsing "'.$frame_name.'" ('.$framedataoffset.' bytes into the ID3v2.'.$id3v2_majorversion.' tag).'); + + } + + } + $framedataoffset += ($frame_size + $this->ID3v2HeaderLength($id3v2_majorversion)); + + } + + } + + + // Footer + + // The footer is a copy of the header, but with a different identifier. + // ID3v2 identifier "3DI" + // ID3v2 version $04 00 + // ID3v2 flags %abcd0000 + // ID3v2 size 4 * %0xxxxxxx + + if (isset($thisfile_id3v2_flags['isfooter']) && $thisfile_id3v2_flags['isfooter']) { + $footer = $this->fread(10); + if (substr($footer, 0, 3) == '3DI') { + $thisfile_id3v2['footer'] = true; + $thisfile_id3v2['majorversion_footer'] = ord($footer{3}); + $thisfile_id3v2['minorversion_footer'] = ord($footer{4}); + } + if ($thisfile_id3v2['majorversion_footer'] <= 4) { + $id3_flags = ord(substr($footer{5})); + $thisfile_id3v2_flags['unsynch_footer'] = (bool) ($id3_flags & 0x80); + $thisfile_id3v2_flags['extfoot_footer'] = (bool) ($id3_flags & 0x40); + $thisfile_id3v2_flags['experim_footer'] = (bool) ($id3_flags & 0x20); + $thisfile_id3v2_flags['isfooter_footer'] = (bool) ($id3_flags & 0x10); + + $thisfile_id3v2['footerlength'] = getid3_lib::BigEndian2Int(substr($footer, 6, 4), 1); + } + } // end footer + + if (isset($thisfile_id3v2['comments']['genre'])) { + $genres = array(); + foreach ($thisfile_id3v2['comments']['genre'] as $key => $value) { + foreach ($this->ParseID3v2GenreString($value) as $genre) { + $genres[] = $genre; + } + } + $thisfile_id3v2['comments']['genre'] = array_unique($genres); + unset($key, $value, $genres, $genre); + } + + if (isset($thisfile_id3v2['comments']['track'])) { + foreach ($thisfile_id3v2['comments']['track'] as $key => $value) { + if (strstr($value, '/')) { + list($thisfile_id3v2['comments']['tracknum'][$key], $thisfile_id3v2['comments']['totaltracks'][$key]) = explode('/', $thisfile_id3v2['comments']['track'][$key]); + } + } + } + + if (!isset($thisfile_id3v2['comments']['year']) && !empty($thisfile_id3v2['comments']['recording_time'][0]) && preg_match('#^([0-9]{4})#', trim($thisfile_id3v2['comments']['recording_time'][0]), $matches)) { + $thisfile_id3v2['comments']['year'] = array($matches[1]); + } + + + if (!empty($thisfile_id3v2['TXXX'])) { + // MediaMonkey does this, maybe others: write a blank RGAD frame, but put replay-gain adjustment values in TXXX frames + foreach ($thisfile_id3v2['TXXX'] as $txxx_array) { + switch ($txxx_array['description']) { + case 'replaygain_track_gain': + if (empty($info['replay_gain']['track']['adjustment']) && !empty($txxx_array['data'])) { + $info['replay_gain']['track']['adjustment'] = floatval(trim(str_replace('dB', '', $txxx_array['data']))); + } + break; + case 'replaygain_track_peak': + if (empty($info['replay_gain']['track']['peak']) && !empty($txxx_array['data'])) { + $info['replay_gain']['track']['peak'] = floatval($txxx_array['data']); + } + break; + case 'replaygain_album_gain': + if (empty($info['replay_gain']['album']['adjustment']) && !empty($txxx_array['data'])) { + $info['replay_gain']['album']['adjustment'] = floatval(trim(str_replace('dB', '', $txxx_array['data']))); + } + break; + } + } + } + + + // Set avdataoffset + $info['avdataoffset'] = $thisfile_id3v2['headerlength']; + if (isset($thisfile_id3v2['footer'])) { + $info['avdataoffset'] += 10; + } + + return true; + } + + + public function ParseID3v2GenreString($genrestring) { + // Parse genres into arrays of genreName and genreID + // ID3v2.2.x, ID3v2.3.x: '(21)' or '(4)Eurodisco' or '(51)(39)' or '(55)((I think...)' + // ID3v2.4.x: '21' $00 'Eurodisco' $00 + $clean_genres = array(); + + // hack-fixes for some badly-written ID3v2.3 taggers, while trying not to break correctly-written tags + if (($this->getid3->info['id3v2']['majorversion'] == 3) && !preg_match('#[\x00]#', $genrestring)) { + // note: MusicBrainz Picard incorrectly stores plaintext genres separated by "/" when writing in ID3v2.3 mode, hack-fix here: + // replace / with NULL, then replace back the two ID3v1 genres that legitimately have "/" as part of the single genre name + if (preg_match('#/#', $genrestring)) { + $genrestring = str_replace('/', "\x00", $genrestring); + $genrestring = str_replace('Pop'."\x00".'Funk', 'Pop/Funk', $genrestring); + $genrestring = str_replace('Rock'."\x00".'Rock', 'Folk/Rock', $genrestring); + } + + // some other taggers separate multiple genres with semicolon, e.g. "Heavy Metal;Thrash Metal;Metal" + if (preg_match('#;#', $genrestring)) { + $genrestring = str_replace(';', "\x00", $genrestring); + } + } + + + if (strpos($genrestring, "\x00") === false) { + $genrestring = preg_replace('#\(([0-9]{1,3})\)#', '$1'."\x00", $genrestring); + } + + $genre_elements = explode("\x00", $genrestring); + foreach ($genre_elements as $element) { + $element = trim($element); + if ($element) { + if (preg_match('#^[0-9]{1,3}#', $element)) { + $clean_genres[] = getid3_id3v1::LookupGenreName($element); + } else { + $clean_genres[] = str_replace('((', '(', $element); + } + } + } + return $clean_genres; + } + + + public function ParseID3v2Frame(&$parsedFrame) { + + // shortcuts + $info = &$this->getid3->info; + $id3v2_majorversion = $info['id3v2']['majorversion']; + + $parsedFrame['framenamelong'] = $this->FrameNameLongLookup($parsedFrame['frame_name']); + if (empty($parsedFrame['framenamelong'])) { + unset($parsedFrame['framenamelong']); + } + $parsedFrame['framenameshort'] = $this->FrameNameShortLookup($parsedFrame['frame_name']); + if (empty($parsedFrame['framenameshort'])) { + unset($parsedFrame['framenameshort']); + } + + if ($id3v2_majorversion >= 3) { // frame flags are not part of the ID3v2.2 standard + if ($id3v2_majorversion == 3) { + // Frame Header Flags + // %abc00000 %ijk00000 + $parsedFrame['flags']['TagAlterPreservation'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x8000); // a - Tag alter preservation + $parsedFrame['flags']['FileAlterPreservation'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x4000); // b - File alter preservation + $parsedFrame['flags']['ReadOnly'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x2000); // c - Read only + $parsedFrame['flags']['compression'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x0080); // i - Compression + $parsedFrame['flags']['Encryption'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x0040); // j - Encryption + $parsedFrame['flags']['GroupingIdentity'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x0020); // k - Grouping identity + + } elseif ($id3v2_majorversion == 4) { + // Frame Header Flags + // %0abc0000 %0h00kmnp + $parsedFrame['flags']['TagAlterPreservation'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x4000); // a - Tag alter preservation + $parsedFrame['flags']['FileAlterPreservation'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x2000); // b - File alter preservation + $parsedFrame['flags']['ReadOnly'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x1000); // c - Read only + $parsedFrame['flags']['GroupingIdentity'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x0040); // h - Grouping identity + $parsedFrame['flags']['compression'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x0008); // k - Compression + $parsedFrame['flags']['Encryption'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x0004); // m - Encryption + $parsedFrame['flags']['Unsynchronisation'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x0002); // n - Unsynchronisation + $parsedFrame['flags']['DataLengthIndicator'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x0001); // p - Data length indicator + + // Frame-level de-unsynchronisation - ID3v2.4 + if ($parsedFrame['flags']['Unsynchronisation']) { + $parsedFrame['data'] = $this->DeUnsynchronise($parsedFrame['data']); + } + + if ($parsedFrame['flags']['DataLengthIndicator']) { + $parsedFrame['data_length_indicator'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], 0, 4), 1); + $parsedFrame['data'] = substr($parsedFrame['data'], 4); + } + } + + // Frame-level de-compression + if ($parsedFrame['flags']['compression']) { + $parsedFrame['decompressed_size'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], 0, 4)); + if (!function_exists('gzuncompress')) { + $this->warning('gzuncompress() support required to decompress ID3v2 frame "'.$parsedFrame['frame_name'].'"'); + } else { + if ($decompresseddata = @gzuncompress(substr($parsedFrame['data'], 4))) { + //if ($decompresseddata = @gzuncompress($parsedFrame['data'])) { + $parsedFrame['data'] = $decompresseddata; + unset($decompresseddata); + } else { + $this->warning('gzuncompress() failed on compressed contents of ID3v2 frame "'.$parsedFrame['frame_name'].'"'); + } + } + } + } + + if (!empty($parsedFrame['flags']['DataLengthIndicator'])) { + if ($parsedFrame['data_length_indicator'] != strlen($parsedFrame['data'])) { + $this->warning('ID3v2 frame "'.$parsedFrame['frame_name'].'" should be '.$parsedFrame['data_length_indicator'].' bytes long according to DataLengthIndicator, but found '.strlen($parsedFrame['data']).' bytes of data'); + } + } + + if (isset($parsedFrame['datalength']) && ($parsedFrame['datalength'] == 0)) { + + $warning = 'Frame "'.$parsedFrame['frame_name'].'" at offset '.$parsedFrame['dataoffset'].' has no data portion'; + switch ($parsedFrame['frame_name']) { + case 'WCOM': + $warning .= ' (this is known to happen with files tagged by RioPort)'; + break; + + default: + break; + } + $this->warning($warning); + + } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'UFID')) || // 4.1 UFID Unique file identifier + (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'UFI'))) { // 4.1 UFI Unique file identifier + // There may be more than one 'UFID' frame in a tag, + // but only one with the same 'Owner identifier'. + //
      + // Owner identifier $00 + // Identifier + $exploded = explode("\x00", $parsedFrame['data'], 2); + $parsedFrame['ownerid'] = (isset($exploded[0]) ? $exploded[0] : ''); + $parsedFrame['data'] = (isset($exploded[1]) ? $exploded[1] : ''); + + } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'TXXX')) || // 4.2.2 TXXX User defined text information frame + (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'TXX'))) { // 4.2.2 TXX User defined text information frame + // There may be more than one 'TXXX' frame in each tag, + // but only one with the same description. + //
      + // Text encoding $xx + // Description $00 (00) + // Value + + $frame_offset = 0; + $frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1)); + $frame_textencoding_terminator = $this->TextEncodingTerminatorLookup($frame_textencoding); + if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) { + $this->warning('Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding'); + $frame_textencoding_terminator = "\x00"; + } + $frame_terminatorpos = strpos($parsedFrame['data'], $frame_textencoding_terminator, $frame_offset); + if (ord(substr($parsedFrame['data'], $frame_terminatorpos + strlen($frame_textencoding_terminator), 1)) === 0) { + $frame_terminatorpos++; // strpos() fooled because 2nd byte of Unicode chars are often 0x00 + } + $frame_description = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); + if (in_array($frame_description, array("\x00", "\x00\x00", "\xFF\xFE", "\xFE\xFF"))) { + // if description only contains a BOM or terminator then make it blank + $frame_description = ''; + } + $parsedFrame['encodingid'] = $frame_textencoding; + $parsedFrame['encoding'] = $this->TextEncodingNameLookup($frame_textencoding); + + $parsedFrame['description'] = trim(getid3_lib::iconv_fallback($parsedFrame['encoding'], $info['id3v2']['encoding'], $frame_description)); + $parsedFrame['data'] = substr($parsedFrame['data'], $frame_terminatorpos + strlen($frame_textencoding_terminator)); + if (!empty($parsedFrame['framenameshort']) && !empty($parsedFrame['data'])) { + $commentkey = ($parsedFrame['description'] ? $parsedFrame['description'] : (isset($info['id3v2']['comments'][$parsedFrame['framenameshort']]) ? count($info['id3v2']['comments'][$parsedFrame['framenameshort']]) : 0)); + if (!isset($info['id3v2']['comments'][$parsedFrame['framenameshort']]) || !array_key_exists($commentkey, $info['id3v2']['comments'][$parsedFrame['framenameshort']])) { + $info['id3v2']['comments'][$parsedFrame['framenameshort']][$commentkey] = trim(getid3_lib::iconv_fallback($parsedFrame['encoding'], $info['id3v2']['encoding'], $parsedFrame['data'])); + } else { + $info['id3v2']['comments'][$parsedFrame['framenameshort']][] = trim(getid3_lib::iconv_fallback($parsedFrame['encoding'], $info['id3v2']['encoding'], $parsedFrame['data'])); + } + } + //unset($parsedFrame['data']); do not unset, may be needed elsewhere, e.g. for replaygain + + + } elseif ($parsedFrame['frame_name']{0} == 'T') { // 4.2. T??[?] Text information frame + // There may only be one text information frame of its kind in an tag. + //
      + // Text encoding $xx + // Information + + $frame_offset = 0; + $frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1)); + if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) { + $this->warning('Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding'); + } + + $parsedFrame['data'] = (string) substr($parsedFrame['data'], $frame_offset); + + $parsedFrame['encodingid'] = $frame_textencoding; + $parsedFrame['encoding'] = $this->TextEncodingNameLookup($frame_textencoding); + + if (!empty($parsedFrame['framenameshort']) && !empty($parsedFrame['data'])) { + // ID3v2.3 specs say that TPE1 (and others) can contain multiple artist values separated with / + // This of course breaks when an artist name contains slash character, e.g. "AC/DC" + // MP3tag (maybe others) implement alternative system where multiple artists are null-separated, which makes more sense + // getID3 will split null-separated artists into multiple artists and leave slash-separated ones to the user + switch ($parsedFrame['encoding']) { + case 'UTF-16': + case 'UTF-16BE': + case 'UTF-16LE': + $wordsize = 2; + break; + case 'ISO-8859-1': + case 'UTF-8': + default: + $wordsize = 1; + break; + } + $Txxx_elements = array(); + $Txxx_elements_start_offset = 0; + for ($i = 0; $i < strlen($parsedFrame['data']); $i += $wordsize) { + if (substr($parsedFrame['data'], $i, $wordsize) == str_repeat("\x00", $wordsize)) { + $Txxx_elements[] = substr($parsedFrame['data'], $Txxx_elements_start_offset, $i - $Txxx_elements_start_offset); + $Txxx_elements_start_offset = $i + $wordsize; + } + } + $Txxx_elements[] = substr($parsedFrame['data'], $Txxx_elements_start_offset, $i - $Txxx_elements_start_offset); + foreach ($Txxx_elements as $Txxx_element) { + $string = getid3_lib::iconv_fallback($parsedFrame['encoding'], $info['id3v2']['encoding'], $Txxx_element); + if (!empty($string)) { + $info['id3v2']['comments'][$parsedFrame['framenameshort']][] = $string; + } + } + unset($string, $wordsize, $i, $Txxx_elements, $Txxx_element, $Txxx_elements_start_offset); + } + + } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'WXXX')) || // 4.3.2 WXXX User defined URL link frame + (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'WXX'))) { // 4.3.2 WXX User defined URL link frame + // There may be more than one 'WXXX' frame in each tag, + // but only one with the same description + //
      + // Text encoding $xx + // Description $00 (00) + // URL + + $frame_offset = 0; + $frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1)); + $frame_textencoding_terminator = $this->TextEncodingTerminatorLookup($frame_textencoding); + if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) { + $this->warning('Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding'); + $frame_textencoding_terminator = "\x00"; + } + $frame_terminatorpos = strpos($parsedFrame['data'], $frame_textencoding_terminator, $frame_offset); + if (ord(substr($parsedFrame['data'], $frame_terminatorpos + strlen($frame_textencoding_terminator), 1)) === 0) { + $frame_terminatorpos++; // strpos() fooled because 2nd byte of Unicode chars are often 0x00 + } + $frame_description = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); + if (in_array($frame_description, array("\x00", "\x00\x00", "\xFF\xFE", "\xFE\xFF"))) { + // if description only contains a BOM or terminator then make it blank + $frame_description = ''; + } + $parsedFrame['data'] = substr($parsedFrame['data'], $frame_terminatorpos + strlen($frame_textencoding_terminator)); + + $frame_terminatorpos = strpos($parsedFrame['data'], $frame_textencoding_terminator); + if (ord(substr($parsedFrame['data'], $frame_terminatorpos + strlen($frame_textencoding_terminator), 1)) === 0) { + $frame_terminatorpos++; // strpos() fooled because 2nd byte of Unicode chars are often 0x00 + } + if ($frame_terminatorpos) { + // there are null bytes after the data - this is not according to spec + // only use data up to first null byte + $frame_urldata = (string) substr($parsedFrame['data'], 0, $frame_terminatorpos); + } else { + // no null bytes following data, just use all data + $frame_urldata = (string) $parsedFrame['data']; + } + + $parsedFrame['encodingid'] = $frame_textencoding; + $parsedFrame['encoding'] = $this->TextEncodingNameLookup($frame_textencoding); + + $parsedFrame['url'] = $frame_urldata; // always ISO-8859-1 + $parsedFrame['description'] = $frame_description; // according to the frame text encoding + if (!empty($parsedFrame['framenameshort']) && $parsedFrame['url']) { + $info['id3v2']['comments'][$parsedFrame['framenameshort']][] = getid3_lib::iconv_fallback('ISO-8859-1', $info['id3v2']['encoding'], $parsedFrame['url']); + } + unset($parsedFrame['data']); + + + } elseif ($parsedFrame['frame_name']{0} == 'W') { // 4.3. W??? URL link frames + // There may only be one URL link frame of its kind in a tag, + // except when stated otherwise in the frame description + //
      + // URL + + $parsedFrame['url'] = trim($parsedFrame['data']); // always ISO-8859-1 + if (!empty($parsedFrame['framenameshort']) && $parsedFrame['url']) { + $info['id3v2']['comments'][$parsedFrame['framenameshort']][] = getid3_lib::iconv_fallback('ISO-8859-1', $info['id3v2']['encoding'], $parsedFrame['url']); + } + unset($parsedFrame['data']); + + + } elseif ((($id3v2_majorversion == 3) && ($parsedFrame['frame_name'] == 'IPLS')) || // 4.4 IPLS Involved people list (ID3v2.3 only) + (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'IPL'))) { // 4.4 IPL Involved people list (ID3v2.2 only) + // http://id3.org/id3v2.3.0#sec4.4 + // There may only be one 'IPL' frame in each tag + //
      + // Text encoding $xx + // People list strings + + $frame_offset = 0; + $frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1)); + if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) { + $this->warning('Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding'); + } + $parsedFrame['encodingid'] = $frame_textencoding; + $parsedFrame['encoding'] = $this->TextEncodingNameLookup($parsedFrame['encodingid']); + $parsedFrame['data_raw'] = (string) substr($parsedFrame['data'], $frame_offset); + + // http://www.getid3.org/phpBB3/viewtopic.php?t=1369 + // "this tag typically contains null terminated strings, which are associated in pairs" + // "there are users that use the tag incorrectly" + $IPLS_parts = array(); + if (strpos($parsedFrame['data_raw'], "\x00") !== false) { + $IPLS_parts_unsorted = array(); + if (((strlen($parsedFrame['data_raw']) % 2) == 0) && ((substr($parsedFrame['data_raw'], 0, 2) == "\xFF\xFE") || (substr($parsedFrame['data_raw'], 0, 2) == "\xFE\xFF"))) { + // UTF-16, be careful looking for null bytes since most 2-byte characters may contain one; you need to find twin null bytes, and on even padding + $thisILPS = ''; + for ($i = 0; $i < strlen($parsedFrame['data_raw']); $i += 2) { + $twobytes = substr($parsedFrame['data_raw'], $i, 2); + if ($twobytes === "\x00\x00") { + $IPLS_parts_unsorted[] = getid3_lib::iconv_fallback($parsedFrame['encoding'], $info['id3v2']['encoding'], $thisILPS); + $thisILPS = ''; + } else { + $thisILPS .= $twobytes; + } + } + if (strlen($thisILPS) > 2) { // 2-byte BOM + $IPLS_parts_unsorted[] = getid3_lib::iconv_fallback($parsedFrame['encoding'], $info['id3v2']['encoding'], $thisILPS); + } + } else { + // ISO-8859-1 or UTF-8 or other single-byte-null character set + $IPLS_parts_unsorted = explode("\x00", $parsedFrame['data_raw']); + } + if (count($IPLS_parts_unsorted) == 1) { + // just a list of names, e.g. "Dino Baptiste, Jimmy Copley, John Gordon, Bernie Marsden, Sharon Watson" + foreach ($IPLS_parts_unsorted as $key => $value) { + $IPLS_parts_sorted = preg_split('#[;,\\r\\n\\t]#', $value); + $position = ''; + foreach ($IPLS_parts_sorted as $person) { + $IPLS_parts[] = array('position'=>$position, 'person'=>$person); + } + } + } elseif ((count($IPLS_parts_unsorted) % 2) == 0) { + $position = ''; + $person = ''; + foreach ($IPLS_parts_unsorted as $key => $value) { + if (($key % 2) == 0) { + $position = $value; + } else { + $person = $value; + $IPLS_parts[] = array('position'=>$position, 'person'=>$person); + $position = ''; + $person = ''; + } + } + } else { + foreach ($IPLS_parts_unsorted as $key => $value) { + $IPLS_parts[] = array($value); + } + } + + } else { + $IPLS_parts = preg_split('#[;,\\r\\n\\t]#', $parsedFrame['data_raw']); + } + $parsedFrame['data'] = $IPLS_parts; + + if (!empty($parsedFrame['framenameshort']) && !empty($parsedFrame['data'])) { + $info['id3v2']['comments'][$parsedFrame['framenameshort']][] = $parsedFrame['data']; + } + + + } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'MCDI')) || // 4.4 MCDI Music CD identifier + (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'MCI'))) { // 4.5 MCI Music CD identifier + // There may only be one 'MCDI' frame in each tag + //
      + // CD TOC + + if (!empty($parsedFrame['framenameshort']) && !empty($parsedFrame['data'])) { + $info['id3v2']['comments'][$parsedFrame['framenameshort']][] = $parsedFrame['data']; + } + + + } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'ETCO')) || // 4.5 ETCO Event timing codes + (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'ETC'))) { // 4.6 ETC Event timing codes + // There may only be one 'ETCO' frame in each tag + //
      + // Time stamp format $xx + // Where time stamp format is: + // $01 (32-bit value) MPEG frames from beginning of file + // $02 (32-bit value) milliseconds from beginning of file + // Followed by a list of key events in the following format: + // Type of event $xx + // Time stamp $xx (xx ...) + // The 'Time stamp' is set to zero if directly at the beginning of the sound + // or after the previous event. All events MUST be sorted in chronological order. + + $frame_offset = 0; + $parsedFrame['timestampformat'] = ord(substr($parsedFrame['data'], $frame_offset++, 1)); + + while ($frame_offset < strlen($parsedFrame['data'])) { + $parsedFrame['typeid'] = substr($parsedFrame['data'], $frame_offset++, 1); + $parsedFrame['type'] = $this->ETCOEventLookup($parsedFrame['typeid']); + $parsedFrame['timestamp'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 4)); + $frame_offset += 4; + } + unset($parsedFrame['data']); + + + } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'MLLT')) || // 4.6 MLLT MPEG location lookup table + (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'MLL'))) { // 4.7 MLL MPEG location lookup table + // There may only be one 'MLLT' frame in each tag + //
      + // MPEG frames between reference $xx xx + // Bytes between reference $xx xx xx + // Milliseconds between reference $xx xx xx + // Bits for bytes deviation $xx + // Bits for milliseconds dev. $xx + // Then for every reference the following data is included; + // Deviation in bytes %xxx.... + // Deviation in milliseconds %xxx.... + + $frame_offset = 0; + $parsedFrame['framesbetweenreferences'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], 0, 2)); + $parsedFrame['bytesbetweenreferences'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], 2, 3)); + $parsedFrame['msbetweenreferences'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], 5, 3)); + $parsedFrame['bitsforbytesdeviation'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], 8, 1)); + $parsedFrame['bitsformsdeviation'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], 9, 1)); + $parsedFrame['data'] = substr($parsedFrame['data'], 10); + while ($frame_offset < strlen($parsedFrame['data'])) { + $deviationbitstream .= getid3_lib::BigEndian2Bin(substr($parsedFrame['data'], $frame_offset++, 1)); + } + $reference_counter = 0; + while (strlen($deviationbitstream) > 0) { + $parsedFrame[$reference_counter]['bytedeviation'] = bindec(substr($deviationbitstream, 0, $parsedFrame['bitsforbytesdeviation'])); + $parsedFrame[$reference_counter]['msdeviation'] = bindec(substr($deviationbitstream, $parsedFrame['bitsforbytesdeviation'], $parsedFrame['bitsformsdeviation'])); + $deviationbitstream = substr($deviationbitstream, $parsedFrame['bitsforbytesdeviation'] + $parsedFrame['bitsformsdeviation']); + $reference_counter++; + } + unset($parsedFrame['data']); + + + } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'SYTC')) || // 4.7 SYTC Synchronised tempo codes + (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'STC'))) { // 4.8 STC Synchronised tempo codes + // There may only be one 'SYTC' frame in each tag + //
      + // Time stamp format $xx + // Tempo data + // Where time stamp format is: + // $01 (32-bit value) MPEG frames from beginning of file + // $02 (32-bit value) milliseconds from beginning of file + + $frame_offset = 0; + $parsedFrame['timestampformat'] = ord(substr($parsedFrame['data'], $frame_offset++, 1)); + $timestamp_counter = 0; + while ($frame_offset < strlen($parsedFrame['data'])) { + $parsedFrame[$timestamp_counter]['tempo'] = ord(substr($parsedFrame['data'], $frame_offset++, 1)); + if ($parsedFrame[$timestamp_counter]['tempo'] == 255) { + $parsedFrame[$timestamp_counter]['tempo'] += ord(substr($parsedFrame['data'], $frame_offset++, 1)); + } + $parsedFrame[$timestamp_counter]['timestamp'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 4)); + $frame_offset += 4; + $timestamp_counter++; + } + unset($parsedFrame['data']); + + + } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'USLT')) || // 4.8 USLT Unsynchronised lyric/text transcription + (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'ULT'))) { // 4.9 ULT Unsynchronised lyric/text transcription + // There may be more than one 'Unsynchronised lyrics/text transcription' frame + // in each tag, but only one with the same language and content descriptor. + //
      + // Text encoding $xx + // Language $xx xx xx + // Content descriptor $00 (00) + // Lyrics/text + + $frame_offset = 0; + $frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1)); + $frame_textencoding_terminator = $this->TextEncodingTerminatorLookup($frame_textencoding); + if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) { + $this->warning('Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding'); + $frame_textencoding_terminator = "\x00"; + } + $frame_language = substr($parsedFrame['data'], $frame_offset, 3); + $frame_offset += 3; + $frame_terminatorpos = strpos($parsedFrame['data'], $frame_textencoding_terminator, $frame_offset); + if (ord(substr($parsedFrame['data'], $frame_terminatorpos + strlen($frame_textencoding_terminator), 1)) === 0) { + $frame_terminatorpos++; // strpos() fooled because 2nd byte of Unicode chars are often 0x00 + } + $frame_description = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); + if (in_array($frame_description, array("\x00", "\x00\x00", "\xFF\xFE", "\xFE\xFF"))) { + // if description only contains a BOM or terminator then make it blank + $frame_description = ''; + } + $parsedFrame['data'] = substr($parsedFrame['data'], $frame_terminatorpos + strlen($frame_textencoding_terminator)); + + $parsedFrame['encodingid'] = $frame_textencoding; + $parsedFrame['encoding'] = $this->TextEncodingNameLookup($frame_textencoding); + + $parsedFrame['language'] = $frame_language; + $parsedFrame['languagename'] = $this->LanguageLookup($frame_language, false); + $parsedFrame['description'] = $frame_description; + if (!empty($parsedFrame['framenameshort']) && !empty($parsedFrame['data'])) { + $info['id3v2']['comments'][$parsedFrame['framenameshort']][] = getid3_lib::iconv_fallback($parsedFrame['encoding'], $info['id3v2']['encoding'], $parsedFrame['data']); + } + unset($parsedFrame['data']); + + + } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'SYLT')) || // 4.9 SYLT Synchronised lyric/text + (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'SLT'))) { // 4.10 SLT Synchronised lyric/text + // There may be more than one 'SYLT' frame in each tag, + // but only one with the same language and content descriptor. + //
      + // Text encoding $xx + // Language $xx xx xx + // Time stamp format $xx + // $01 (32-bit value) MPEG frames from beginning of file + // $02 (32-bit value) milliseconds from beginning of file + // Content type $xx + // Content descriptor $00 (00) + // Terminated text to be synced (typically a syllable) + // Sync identifier (terminator to above string) $00 (00) + // Time stamp $xx (xx ...) + + $frame_offset = 0; + $frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1)); + $frame_textencoding_terminator = $this->TextEncodingTerminatorLookup($frame_textencoding); + if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) { + $this->warning('Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding'); + $frame_textencoding_terminator = "\x00"; + } + $frame_language = substr($parsedFrame['data'], $frame_offset, 3); + $frame_offset += 3; + $parsedFrame['timestampformat'] = ord(substr($parsedFrame['data'], $frame_offset++, 1)); + $parsedFrame['contenttypeid'] = ord(substr($parsedFrame['data'], $frame_offset++, 1)); + $parsedFrame['contenttype'] = $this->SYTLContentTypeLookup($parsedFrame['contenttypeid']); + $parsedFrame['encodingid'] = $frame_textencoding; + $parsedFrame['encoding'] = $this->TextEncodingNameLookup($frame_textencoding); + + $parsedFrame['language'] = $frame_language; + $parsedFrame['languagename'] = $this->LanguageLookup($frame_language, false); + + $timestampindex = 0; + $frame_remainingdata = substr($parsedFrame['data'], $frame_offset); + while (strlen($frame_remainingdata)) { + $frame_offset = 0; + $frame_terminatorpos = strpos($frame_remainingdata, $frame_textencoding_terminator); + if ($frame_terminatorpos === false) { + $frame_remainingdata = ''; + } else { + if (ord(substr($frame_remainingdata, $frame_terminatorpos + strlen($frame_textencoding_terminator), 1)) === 0) { + $frame_terminatorpos++; // strpos() fooled because 2nd byte of Unicode chars are often 0x00 + } + $parsedFrame['lyrics'][$timestampindex]['data'] = substr($frame_remainingdata, $frame_offset, $frame_terminatorpos - $frame_offset); + + $frame_remainingdata = substr($frame_remainingdata, $frame_terminatorpos + strlen($frame_textencoding_terminator)); + if (($timestampindex == 0) && (ord($frame_remainingdata{0}) != 0)) { + // timestamp probably omitted for first data item + } else { + $parsedFrame['lyrics'][$timestampindex]['timestamp'] = getid3_lib::BigEndian2Int(substr($frame_remainingdata, 0, 4)); + $frame_remainingdata = substr($frame_remainingdata, 4); + } + $timestampindex++; + } + } + unset($parsedFrame['data']); + + + } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'COMM')) || // 4.10 COMM Comments + (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'COM'))) { // 4.11 COM Comments + // There may be more than one comment frame in each tag, + // but only one with the same language and content descriptor. + //
      + // Text encoding $xx + // Language $xx xx xx + // Short content descrip. $00 (00) + // The actual text + + if (strlen($parsedFrame['data']) < 5) { + + $this->warning('Invalid data (too short) for "'.$parsedFrame['frame_name'].'" frame at offset '.$parsedFrame['dataoffset']); + + } else { + + $frame_offset = 0; + $frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1)); + $frame_textencoding_terminator = $this->TextEncodingTerminatorLookup($frame_textencoding); + if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) { + $this->warning('Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding'); + $frame_textencoding_terminator = "\x00"; + } + $frame_language = substr($parsedFrame['data'], $frame_offset, 3); + $frame_offset += 3; + $frame_terminatorpos = strpos($parsedFrame['data'], $frame_textencoding_terminator, $frame_offset); + if (ord(substr($parsedFrame['data'], $frame_terminatorpos + strlen($frame_textencoding_terminator), 1)) === 0) { + $frame_terminatorpos++; // strpos() fooled because 2nd byte of Unicode chars are often 0x00 + } + $frame_description = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); + if (in_array($frame_description, array("\x00", "\x00\x00", "\xFF\xFE", "\xFE\xFF"))) { + // if description only contains a BOM or terminator then make it blank + $frame_description = ''; + } + $frame_text = (string) substr($parsedFrame['data'], $frame_terminatorpos + strlen($frame_textencoding_terminator)); + + $parsedFrame['encodingid'] = $frame_textencoding; + $parsedFrame['encoding'] = $this->TextEncodingNameLookup($frame_textencoding); + + $parsedFrame['language'] = $frame_language; + $parsedFrame['languagename'] = $this->LanguageLookup($frame_language, false); + $parsedFrame['description'] = $frame_description; + $parsedFrame['data'] = $frame_text; + if (!empty($parsedFrame['framenameshort']) && !empty($parsedFrame['data'])) { + $commentkey = ($parsedFrame['description'] ? $parsedFrame['description'] : (!empty($info['id3v2']['comments'][$parsedFrame['framenameshort']]) ? count($info['id3v2']['comments'][$parsedFrame['framenameshort']]) : 0)); + if (!isset($info['id3v2']['comments'][$parsedFrame['framenameshort']]) || !array_key_exists($commentkey, $info['id3v2']['comments'][$parsedFrame['framenameshort']])) { + $info['id3v2']['comments'][$parsedFrame['framenameshort']][$commentkey] = getid3_lib::iconv_fallback($parsedFrame['encoding'], $info['id3v2']['encoding'], $parsedFrame['data']); + } else { + $info['id3v2']['comments'][$parsedFrame['framenameshort']][] = getid3_lib::iconv_fallback($parsedFrame['encoding'], $info['id3v2']['encoding'], $parsedFrame['data']); + } + } + + } + + } elseif (($id3v2_majorversion >= 4) && ($parsedFrame['frame_name'] == 'RVA2')) { // 4.11 RVA2 Relative volume adjustment (2) (ID3v2.4+ only) + // There may be more than one 'RVA2' frame in each tag, + // but only one with the same identification string + //
      + // Identification $00 + // The 'identification' string is used to identify the situation and/or + // device where this adjustment should apply. The following is then + // repeated for every channel: + // Type of channel $xx + // Volume adjustment $xx xx + // Bits representing peak $xx + // Peak volume $xx (xx ...) + + $frame_terminatorpos = strpos($parsedFrame['data'], "\x00"); + $frame_idstring = substr($parsedFrame['data'], 0, $frame_terminatorpos); + if (ord($frame_idstring) === 0) { + $frame_idstring = ''; + } + $frame_remainingdata = substr($parsedFrame['data'], $frame_terminatorpos + strlen("\x00")); + $parsedFrame['description'] = $frame_idstring; + $RVA2channelcounter = 0; + while (strlen($frame_remainingdata) >= 5) { + $frame_offset = 0; + $frame_channeltypeid = ord(substr($frame_remainingdata, $frame_offset++, 1)); + $parsedFrame[$RVA2channelcounter]['channeltypeid'] = $frame_channeltypeid; + $parsedFrame[$RVA2channelcounter]['channeltype'] = $this->RVA2ChannelTypeLookup($frame_channeltypeid); + $parsedFrame[$RVA2channelcounter]['volumeadjust'] = getid3_lib::BigEndian2Int(substr($frame_remainingdata, $frame_offset, 2), false, true); // 16-bit signed + $frame_offset += 2; + $parsedFrame[$RVA2channelcounter]['bitspeakvolume'] = ord(substr($frame_remainingdata, $frame_offset++, 1)); + if (($parsedFrame[$RVA2channelcounter]['bitspeakvolume'] < 1) || ($parsedFrame[$RVA2channelcounter]['bitspeakvolume'] > 4)) { + $this->warning('ID3v2::RVA2 frame['.$RVA2channelcounter.'] contains invalid '.$parsedFrame[$RVA2channelcounter]['bitspeakvolume'].'-byte bits-representing-peak value'); + break; + } + $frame_bytespeakvolume = ceil($parsedFrame[$RVA2channelcounter]['bitspeakvolume'] / 8); + $parsedFrame[$RVA2channelcounter]['peakvolume'] = getid3_lib::BigEndian2Int(substr($frame_remainingdata, $frame_offset, $frame_bytespeakvolume)); + $frame_remainingdata = substr($frame_remainingdata, $frame_offset + $frame_bytespeakvolume); + $RVA2channelcounter++; + } + unset($parsedFrame['data']); + + + } elseif ((($id3v2_majorversion == 3) && ($parsedFrame['frame_name'] == 'RVAD')) || // 4.12 RVAD Relative volume adjustment (ID3v2.3 only) + (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'RVA'))) { // 4.12 RVA Relative volume adjustment (ID3v2.2 only) + // There may only be one 'RVA' frame in each tag + //
      + // ID3v2.2 => Increment/decrement %000000ba + // ID3v2.3 => Increment/decrement %00fedcba + // Bits used for volume descr. $xx + // Relative volume change, right $xx xx (xx ...) // a + // Relative volume change, left $xx xx (xx ...) // b + // Peak volume right $xx xx (xx ...) + // Peak volume left $xx xx (xx ...) + // ID3v2.3 only, optional (not present in ID3v2.2): + // Relative volume change, right back $xx xx (xx ...) // c + // Relative volume change, left back $xx xx (xx ...) // d + // Peak volume right back $xx xx (xx ...) + // Peak volume left back $xx xx (xx ...) + // ID3v2.3 only, optional (not present in ID3v2.2): + // Relative volume change, center $xx xx (xx ...) // e + // Peak volume center $xx xx (xx ...) + // ID3v2.3 only, optional (not present in ID3v2.2): + // Relative volume change, bass $xx xx (xx ...) // f + // Peak volume bass $xx xx (xx ...) + + $frame_offset = 0; + $frame_incrdecrflags = getid3_lib::BigEndian2Bin(substr($parsedFrame['data'], $frame_offset++, 1)); + $parsedFrame['incdec']['right'] = (bool) substr($frame_incrdecrflags, 6, 1); + $parsedFrame['incdec']['left'] = (bool) substr($frame_incrdecrflags, 7, 1); + $parsedFrame['bitsvolume'] = ord(substr($parsedFrame['data'], $frame_offset++, 1)); + $frame_bytesvolume = ceil($parsedFrame['bitsvolume'] / 8); + $parsedFrame['volumechange']['right'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume)); + if ($parsedFrame['incdec']['right'] === false) { + $parsedFrame['volumechange']['right'] *= -1; + } + $frame_offset += $frame_bytesvolume; + $parsedFrame['volumechange']['left'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume)); + if ($parsedFrame['incdec']['left'] === false) { + $parsedFrame['volumechange']['left'] *= -1; + } + $frame_offset += $frame_bytesvolume; + $parsedFrame['peakvolume']['right'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume)); + $frame_offset += $frame_bytesvolume; + $parsedFrame['peakvolume']['left'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume)); + $frame_offset += $frame_bytesvolume; + if ($id3v2_majorversion == 3) { + $parsedFrame['data'] = substr($parsedFrame['data'], $frame_offset); + if (strlen($parsedFrame['data']) > 0) { + $parsedFrame['incdec']['rightrear'] = (bool) substr($frame_incrdecrflags, 4, 1); + $parsedFrame['incdec']['leftrear'] = (bool) substr($frame_incrdecrflags, 5, 1); + $parsedFrame['volumechange']['rightrear'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume)); + if ($parsedFrame['incdec']['rightrear'] === false) { + $parsedFrame['volumechange']['rightrear'] *= -1; + } + $frame_offset += $frame_bytesvolume; + $parsedFrame['volumechange']['leftrear'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume)); + if ($parsedFrame['incdec']['leftrear'] === false) { + $parsedFrame['volumechange']['leftrear'] *= -1; + } + $frame_offset += $frame_bytesvolume; + $parsedFrame['peakvolume']['rightrear'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume)); + $frame_offset += $frame_bytesvolume; + $parsedFrame['peakvolume']['leftrear'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume)); + $frame_offset += $frame_bytesvolume; + } + $parsedFrame['data'] = substr($parsedFrame['data'], $frame_offset); + if (strlen($parsedFrame['data']) > 0) { + $parsedFrame['incdec']['center'] = (bool) substr($frame_incrdecrflags, 3, 1); + $parsedFrame['volumechange']['center'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume)); + if ($parsedFrame['incdec']['center'] === false) { + $parsedFrame['volumechange']['center'] *= -1; + } + $frame_offset += $frame_bytesvolume; + $parsedFrame['peakvolume']['center'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume)); + $frame_offset += $frame_bytesvolume; + } + $parsedFrame['data'] = substr($parsedFrame['data'], $frame_offset); + if (strlen($parsedFrame['data']) > 0) { + $parsedFrame['incdec']['bass'] = (bool) substr($frame_incrdecrflags, 2, 1); + $parsedFrame['volumechange']['bass'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume)); + if ($parsedFrame['incdec']['bass'] === false) { + $parsedFrame['volumechange']['bass'] *= -1; + } + $frame_offset += $frame_bytesvolume; + $parsedFrame['peakvolume']['bass'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume)); + $frame_offset += $frame_bytesvolume; + } + } + unset($parsedFrame['data']); + + + } elseif (($id3v2_majorversion >= 4) && ($parsedFrame['frame_name'] == 'EQU2')) { // 4.12 EQU2 Equalisation (2) (ID3v2.4+ only) + // There may be more than one 'EQU2' frame in each tag, + // but only one with the same identification string + //
      + // Interpolation method $xx + // $00 Band + // $01 Linear + // Identification $00 + // The following is then repeated for every adjustment point + // Frequency $xx xx + // Volume adjustment $xx xx + + $frame_offset = 0; + $frame_interpolationmethod = ord(substr($parsedFrame['data'], $frame_offset++, 1)); + $frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset); + $frame_idstring = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); + if (ord($frame_idstring) === 0) { + $frame_idstring = ''; + } + $parsedFrame['description'] = $frame_idstring; + $frame_remainingdata = substr($parsedFrame['data'], $frame_terminatorpos + strlen("\x00")); + while (strlen($frame_remainingdata)) { + $frame_frequency = getid3_lib::BigEndian2Int(substr($frame_remainingdata, 0, 2)) / 2; + $parsedFrame['data'][$frame_frequency] = getid3_lib::BigEndian2Int(substr($frame_remainingdata, 2, 2), false, true); + $frame_remainingdata = substr($frame_remainingdata, 4); + } + $parsedFrame['interpolationmethod'] = $frame_interpolationmethod; + unset($parsedFrame['data']); + + + } elseif ((($id3v2_majorversion == 3) && ($parsedFrame['frame_name'] == 'EQUA')) || // 4.12 EQUA Equalisation (ID3v2.3 only) + (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'EQU'))) { // 4.13 EQU Equalisation (ID3v2.2 only) + // There may only be one 'EQUA' frame in each tag + //
      + // Adjustment bits $xx + // This is followed by 2 bytes + ('adjustment bits' rounded up to the + // nearest byte) for every equalisation band in the following format, + // giving a frequency range of 0 - 32767Hz: + // Increment/decrement %x (MSB of the Frequency) + // Frequency (lower 15 bits) + // Adjustment $xx (xx ...) + + $frame_offset = 0; + $parsedFrame['adjustmentbits'] = substr($parsedFrame['data'], $frame_offset++, 1); + $frame_adjustmentbytes = ceil($parsedFrame['adjustmentbits'] / 8); + + $frame_remainingdata = (string) substr($parsedFrame['data'], $frame_offset); + while (strlen($frame_remainingdata) > 0) { + $frame_frequencystr = getid3_lib::BigEndian2Bin(substr($frame_remainingdata, 0, 2)); + $frame_incdec = (bool) substr($frame_frequencystr, 0, 1); + $frame_frequency = bindec(substr($frame_frequencystr, 1, 15)); + $parsedFrame[$frame_frequency]['incdec'] = $frame_incdec; + $parsedFrame[$frame_frequency]['adjustment'] = getid3_lib::BigEndian2Int(substr($frame_remainingdata, 2, $frame_adjustmentbytes)); + if ($parsedFrame[$frame_frequency]['incdec'] === false) { + $parsedFrame[$frame_frequency]['adjustment'] *= -1; + } + $frame_remainingdata = substr($frame_remainingdata, 2 + $frame_adjustmentbytes); + } + unset($parsedFrame['data']); + + + } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'RVRB')) || // 4.13 RVRB Reverb + (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'REV'))) { // 4.14 REV Reverb + // There may only be one 'RVRB' frame in each tag. + //
      + // Reverb left (ms) $xx xx + // Reverb right (ms) $xx xx + // Reverb bounces, left $xx + // Reverb bounces, right $xx + // Reverb feedback, left to left $xx + // Reverb feedback, left to right $xx + // Reverb feedback, right to right $xx + // Reverb feedback, right to left $xx + // Premix left to right $xx + // Premix right to left $xx + + $frame_offset = 0; + $parsedFrame['left'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 2)); + $frame_offset += 2; + $parsedFrame['right'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 2)); + $frame_offset += 2; + $parsedFrame['bouncesL'] = ord(substr($parsedFrame['data'], $frame_offset++, 1)); + $parsedFrame['bouncesR'] = ord(substr($parsedFrame['data'], $frame_offset++, 1)); + $parsedFrame['feedbackLL'] = ord(substr($parsedFrame['data'], $frame_offset++, 1)); + $parsedFrame['feedbackLR'] = ord(substr($parsedFrame['data'], $frame_offset++, 1)); + $parsedFrame['feedbackRR'] = ord(substr($parsedFrame['data'], $frame_offset++, 1)); + $parsedFrame['feedbackRL'] = ord(substr($parsedFrame['data'], $frame_offset++, 1)); + $parsedFrame['premixLR'] = ord(substr($parsedFrame['data'], $frame_offset++, 1)); + $parsedFrame['premixRL'] = ord(substr($parsedFrame['data'], $frame_offset++, 1)); + unset($parsedFrame['data']); + + + } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'APIC')) || // 4.14 APIC Attached picture + (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'PIC'))) { // 4.15 PIC Attached picture + // There may be several pictures attached to one file, + // each in their individual 'APIC' frame, but only one + // with the same content descriptor + //
      + // Text encoding $xx + // ID3v2.3+ => MIME type $00 + // ID3v2.2 => Image format $xx xx xx + // Picture type $xx + // Description $00 (00) + // Picture data + + $frame_offset = 0; + $frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1)); + $frame_textencoding_terminator = $this->TextEncodingTerminatorLookup($frame_textencoding); + if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) { + $this->warning('Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding'); + $frame_textencoding_terminator = "\x00"; + } + + if ($id3v2_majorversion == 2 && strlen($parsedFrame['data']) > $frame_offset) { + $frame_imagetype = substr($parsedFrame['data'], $frame_offset, 3); + if (strtolower($frame_imagetype) == 'ima') { + // complete hack for mp3Rage (www.chaoticsoftware.com) that puts ID3v2.3-formatted + // MIME type instead of 3-char ID3v2.2-format image type (thanks xbhoffØpacbell*net) + $frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset); + $frame_mimetype = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); + if (ord($frame_mimetype) === 0) { + $frame_mimetype = ''; + } + $frame_imagetype = strtoupper(str_replace('image/', '', strtolower($frame_mimetype))); + if ($frame_imagetype == 'JPEG') { + $frame_imagetype = 'JPG'; + } + $frame_offset = $frame_terminatorpos + strlen("\x00"); + } else { + $frame_offset += 3; + } + } + if ($id3v2_majorversion > 2 && strlen($parsedFrame['data']) > $frame_offset) { + $frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset); + $frame_mimetype = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); + if (ord($frame_mimetype) === 0) { + $frame_mimetype = ''; + } + $frame_offset = $frame_terminatorpos + strlen("\x00"); + } + + $frame_picturetype = ord(substr($parsedFrame['data'], $frame_offset++, 1)); + + if ($frame_offset >= $parsedFrame['datalength']) { + $this->warning('data portion of APIC frame is missing at offset '.($parsedFrame['dataoffset'] + 8 + $frame_offset)); + } else { + $frame_terminatorpos = strpos($parsedFrame['data'], $frame_textencoding_terminator, $frame_offset); + if (ord(substr($parsedFrame['data'], $frame_terminatorpos + strlen($frame_textencoding_terminator), 1)) === 0) { + $frame_terminatorpos++; // strpos() fooled because 2nd byte of Unicode chars are often 0x00 + } + $frame_description = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); + if (in_array($frame_description, array("\x00", "\x00\x00", "\xFF\xFE", "\xFE\xFF"))) { + // if description only contains a BOM or terminator then make it blank + $frame_description = ''; + } + $parsedFrame['encodingid'] = $frame_textencoding; + $parsedFrame['encoding'] = $this->TextEncodingNameLookup($frame_textencoding); + + if ($id3v2_majorversion == 2) { + $parsedFrame['imagetype'] = $frame_imagetype; + } else { + $parsedFrame['mime'] = $frame_mimetype; + } + $parsedFrame['picturetypeid'] = $frame_picturetype; + $parsedFrame['picturetype'] = $this->APICPictureTypeLookup($frame_picturetype); + $parsedFrame['description'] = $frame_description; + $parsedFrame['data'] = substr($parsedFrame['data'], $frame_terminatorpos + strlen($frame_textencoding_terminator)); + $parsedFrame['datalength'] = strlen($parsedFrame['data']); + + $parsedFrame['image_mime'] = ''; + $imageinfo = array(); + if ($imagechunkcheck = getid3_lib::GetDataImageSize($parsedFrame['data'], $imageinfo)) { + if (($imagechunkcheck[2] >= 1) && ($imagechunkcheck[2] <= 3)) { + $parsedFrame['image_mime'] = 'image/'.getid3_lib::ImageTypesLookup($imagechunkcheck[2]); + if ($imagechunkcheck[0]) { + $parsedFrame['image_width'] = $imagechunkcheck[0]; + } + if ($imagechunkcheck[1]) { + $parsedFrame['image_height'] = $imagechunkcheck[1]; + } + } + } + + do { + if ($this->getid3->option_save_attachments === false) { + // skip entirely + unset($parsedFrame['data']); + break; + } + if ($this->getid3->option_save_attachments === true) { + // great +/* + } elseif (is_int($this->getid3->option_save_attachments)) { + if ($this->getid3->option_save_attachments < $parsedFrame['data_length']) { + // too big, skip + $this->warning('attachment at '.$frame_offset.' is too large to process inline ('.number_format($parsedFrame['data_length']).' bytes)'); + unset($parsedFrame['data']); + break; + } +*/ + } elseif (is_string($this->getid3->option_save_attachments)) { + $dir = rtrim(str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $this->getid3->option_save_attachments), DIRECTORY_SEPARATOR); + if (!is_dir($dir) || !getID3::is_writable($dir)) { + // cannot write, skip + $this->warning('attachment at '.$frame_offset.' cannot be saved to "'.$dir.'" (not writable)'); + unset($parsedFrame['data']); + break; + } + } + // if we get this far, must be OK + if (is_string($this->getid3->option_save_attachments)) { + $destination_filename = $dir.DIRECTORY_SEPARATOR.md5($info['filenamepath']).'_'.$frame_offset; + if (!file_exists($destination_filename) || getID3::is_writable($destination_filename)) { + file_put_contents($destination_filename, $parsedFrame['data']); + } else { + $this->warning('attachment at '.$frame_offset.' cannot be saved to "'.$destination_filename.'" (not writable)'); + } + $parsedFrame['data_filename'] = $destination_filename; + unset($parsedFrame['data']); + } else { + if (!empty($parsedFrame['framenameshort']) && !empty($parsedFrame['data'])) { + if (!isset($info['id3v2']['comments']['picture'])) { + $info['id3v2']['comments']['picture'] = array(); + } + $comments_picture_data = array(); + foreach (array('data', 'image_mime', 'image_width', 'image_height', 'imagetype', 'picturetype', 'description', 'datalength') as $picture_key) { + if (isset($parsedFrame[$picture_key])) { + $comments_picture_data[$picture_key] = $parsedFrame[$picture_key]; + } + } + $info['id3v2']['comments']['picture'][] = $comments_picture_data; + unset($comments_picture_data); + } + } + } while (false); + } + + } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'GEOB')) || // 4.15 GEOB General encapsulated object + (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'GEO'))) { // 4.16 GEO General encapsulated object + // There may be more than one 'GEOB' frame in each tag, + // but only one with the same content descriptor + //
      + // Text encoding $xx + // MIME type $00 + // Filename $00 (00) + // Content description $00 (00) + // Encapsulated object + + $frame_offset = 0; + $frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1)); + $frame_textencoding_terminator = $this->TextEncodingTerminatorLookup($frame_textencoding); + if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) { + $this->warning('Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding'); + $frame_textencoding_terminator = "\x00"; + } + $frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset); + $frame_mimetype = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); + if (ord($frame_mimetype) === 0) { + $frame_mimetype = ''; + } + $frame_offset = $frame_terminatorpos + strlen("\x00"); + + $frame_terminatorpos = strpos($parsedFrame['data'], $frame_textencoding_terminator, $frame_offset); + if (ord(substr($parsedFrame['data'], $frame_terminatorpos + strlen($frame_textencoding_terminator), 1)) === 0) { + $frame_terminatorpos++; // strpos() fooled because 2nd byte of Unicode chars are often 0x00 + } + $frame_filename = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); + if (ord($frame_filename) === 0) { + $frame_filename = ''; + } + $frame_offset = $frame_terminatorpos + strlen($frame_textencoding_terminator); + + $frame_terminatorpos = strpos($parsedFrame['data'], $frame_textencoding_terminator, $frame_offset); + if (ord(substr($parsedFrame['data'], $frame_terminatorpos + strlen($frame_textencoding_terminator), 1)) === 0) { + $frame_terminatorpos++; // strpos() fooled because 2nd byte of Unicode chars are often 0x00 + } + $frame_description = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); + if (in_array($frame_description, array("\x00", "\x00\x00", "\xFF\xFE", "\xFE\xFF"))) { + // if description only contains a BOM or terminator then make it blank + $frame_description = ''; + } + $frame_offset = $frame_terminatorpos + strlen($frame_textencoding_terminator); + + $parsedFrame['objectdata'] = (string) substr($parsedFrame['data'], $frame_offset); + $parsedFrame['encodingid'] = $frame_textencoding; + $parsedFrame['encoding'] = $this->TextEncodingNameLookup($frame_textencoding); + + $parsedFrame['mime'] = $frame_mimetype; + $parsedFrame['filename'] = $frame_filename; + $parsedFrame['description'] = $frame_description; + unset($parsedFrame['data']); + + + } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'PCNT')) || // 4.16 PCNT Play counter + (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'CNT'))) { // 4.17 CNT Play counter + // There may only be one 'PCNT' frame in each tag. + // When the counter reaches all one's, one byte is inserted in + // front of the counter thus making the counter eight bits bigger + //
      + // Counter $xx xx xx xx (xx ...) + + $parsedFrame['data'] = getid3_lib::BigEndian2Int($parsedFrame['data']); + + + } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'POPM')) || // 4.17 POPM Popularimeter + (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'POP'))) { // 4.18 POP Popularimeter + // There may be more than one 'POPM' frame in each tag, + // but only one with the same email address + //
      + // Email to user $00 + // Rating $xx + // Counter $xx xx xx xx (xx ...) + + $frame_offset = 0; + $frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset); + $frame_emailaddress = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); + if (ord($frame_emailaddress) === 0) { + $frame_emailaddress = ''; + } + $frame_offset = $frame_terminatorpos + strlen("\x00"); + $frame_rating = ord(substr($parsedFrame['data'], $frame_offset++, 1)); + $parsedFrame['counter'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset)); + $parsedFrame['email'] = $frame_emailaddress; + $parsedFrame['rating'] = $frame_rating; + unset($parsedFrame['data']); + + + } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'RBUF')) || // 4.18 RBUF Recommended buffer size + (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'BUF'))) { // 4.19 BUF Recommended buffer size + // There may only be one 'RBUF' frame in each tag + //
      + // Buffer size $xx xx xx + // Embedded info flag %0000000x + // Offset to next tag $xx xx xx xx + + $frame_offset = 0; + $parsedFrame['buffersize'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 3)); + $frame_offset += 3; + + $frame_embeddedinfoflags = getid3_lib::BigEndian2Bin(substr($parsedFrame['data'], $frame_offset++, 1)); + $parsedFrame['flags']['embededinfo'] = (bool) substr($frame_embeddedinfoflags, 7, 1); + $parsedFrame['nexttagoffset'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 4)); + unset($parsedFrame['data']); + + + } elseif (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'CRM')) { // 4.20 Encrypted meta frame (ID3v2.2 only) + // There may be more than one 'CRM' frame in a tag, + // but only one with the same 'owner identifier' + //
      + // Owner identifier $00 (00) + // Content/explanation $00 (00) + // Encrypted datablock + + $frame_offset = 0; + $frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset); + $frame_ownerid = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); + $frame_offset = $frame_terminatorpos + strlen("\x00"); + + $frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset); + $frame_description = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); + if (in_array($frame_description, array("\x00", "\x00\x00", "\xFF\xFE", "\xFE\xFF"))) { + // if description only contains a BOM or terminator then make it blank + $frame_description = ''; + } + $frame_offset = $frame_terminatorpos + strlen("\x00"); + + $parsedFrame['ownerid'] = $frame_ownerid; + $parsedFrame['data'] = (string) substr($parsedFrame['data'], $frame_offset); + $parsedFrame['description'] = $frame_description; + unset($parsedFrame['data']); + + + } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'AENC')) || // 4.19 AENC Audio encryption + (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'CRA'))) { // 4.21 CRA Audio encryption + // There may be more than one 'AENC' frames in a tag, + // but only one with the same 'Owner identifier' + //
      + // Owner identifier $00 + // Preview start $xx xx + // Preview length $xx xx + // Encryption info + + $frame_offset = 0; + $frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset); + $frame_ownerid = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); + if (ord($frame_ownerid) === 0) { + $frame_ownerid = ''; + } + $frame_offset = $frame_terminatorpos + strlen("\x00"); + $parsedFrame['ownerid'] = $frame_ownerid; + $parsedFrame['previewstart'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 2)); + $frame_offset += 2; + $parsedFrame['previewlength'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 2)); + $frame_offset += 2; + $parsedFrame['encryptioninfo'] = (string) substr($parsedFrame['data'], $frame_offset); + unset($parsedFrame['data']); + + + } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'LINK')) || // 4.20 LINK Linked information + (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'LNK'))) { // 4.22 LNK Linked information + // There may be more than one 'LINK' frame in a tag, + // but only one with the same contents + //
      + // ID3v2.3+ => Frame identifier $xx xx xx xx + // ID3v2.2 => Frame identifier $xx xx xx + // URL $00 + // ID and additional data + + $frame_offset = 0; + if ($id3v2_majorversion == 2) { + $parsedFrame['frameid'] = substr($parsedFrame['data'], $frame_offset, 3); + $frame_offset += 3; + } else { + $parsedFrame['frameid'] = substr($parsedFrame['data'], $frame_offset, 4); + $frame_offset += 4; + } + + $frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset); + $frame_url = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); + if (ord($frame_url) === 0) { + $frame_url = ''; + } + $frame_offset = $frame_terminatorpos + strlen("\x00"); + $parsedFrame['url'] = $frame_url; + + $parsedFrame['additionaldata'] = (string) substr($parsedFrame['data'], $frame_offset); + if (!empty($parsedFrame['framenameshort']) && $parsedFrame['url']) { + $info['id3v2']['comments'][$parsedFrame['framenameshort']][] = getid3_lib::iconv_fallback_iso88591_utf8($parsedFrame['url']); + } + unset($parsedFrame['data']); + + + } elseif (($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'POSS')) { // 4.21 POSS Position synchronisation frame (ID3v2.3+ only) + // There may only be one 'POSS' frame in each tag + //
      + // Time stamp format $xx + // Position $xx (xx ...) + + $frame_offset = 0; + $parsedFrame['timestampformat'] = ord(substr($parsedFrame['data'], $frame_offset++, 1)); + $parsedFrame['position'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset)); + unset($parsedFrame['data']); + + + } elseif (($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'USER')) { // 4.22 USER Terms of use (ID3v2.3+ only) + // There may be more than one 'Terms of use' frame in a tag, + // but only one with the same 'Language' + //
      + // Text encoding $xx + // Language $xx xx xx + // The actual text + + $frame_offset = 0; + $frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1)); + if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) { + $this->warning('Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding'); + } + $frame_language = substr($parsedFrame['data'], $frame_offset, 3); + $frame_offset += 3; + $parsedFrame['language'] = $frame_language; + $parsedFrame['languagename'] = $this->LanguageLookup($frame_language, false); + $parsedFrame['encodingid'] = $frame_textencoding; + $parsedFrame['encoding'] = $this->TextEncodingNameLookup($frame_textencoding); + + $parsedFrame['data'] = (string) substr($parsedFrame['data'], $frame_offset); + if (!empty($parsedFrame['framenameshort']) && !empty($parsedFrame['data'])) { + $info['id3v2']['comments'][$parsedFrame['framenameshort']][] = getid3_lib::iconv_fallback($parsedFrame['encoding'], $info['id3v2']['encoding'], $parsedFrame['data']); + } + unset($parsedFrame['data']); + + + } elseif (($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'OWNE')) { // 4.23 OWNE Ownership frame (ID3v2.3+ only) + // There may only be one 'OWNE' frame in a tag + //
      + // Text encoding $xx + // Price paid $00 + // Date of purch. + // Seller + + $frame_offset = 0; + $frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1)); + if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) { + $this->warning('Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding'); + } + $parsedFrame['encodingid'] = $frame_textencoding; + $parsedFrame['encoding'] = $this->TextEncodingNameLookup($frame_textencoding); + + $frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset); + $frame_pricepaid = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); + $frame_offset = $frame_terminatorpos + strlen("\x00"); + + $parsedFrame['pricepaid']['currencyid'] = substr($frame_pricepaid, 0, 3); + $parsedFrame['pricepaid']['currency'] = $this->LookupCurrencyUnits($parsedFrame['pricepaid']['currencyid']); + $parsedFrame['pricepaid']['value'] = substr($frame_pricepaid, 3); + + $parsedFrame['purchasedate'] = substr($parsedFrame['data'], $frame_offset, 8); + if ($this->IsValidDateStampString($parsedFrame['purchasedate'])) { + $parsedFrame['purchasedateunix'] = mktime (0, 0, 0, substr($parsedFrame['purchasedate'], 4, 2), substr($parsedFrame['purchasedate'], 6, 2), substr($parsedFrame['purchasedate'], 0, 4)); + } + $frame_offset += 8; + + $parsedFrame['seller'] = (string) substr($parsedFrame['data'], $frame_offset); + unset($parsedFrame['data']); + + + } elseif (($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'COMR')) { // 4.24 COMR Commercial frame (ID3v2.3+ only) + // There may be more than one 'commercial frame' in a tag, + // but no two may be identical + //
      + // Text encoding $xx + // Price string $00 + // Valid until + // Contact URL $00 + // Received as $xx + // Name of seller $00 (00) + // Description $00 (00) + // Picture MIME type $00 + // Seller logo + + $frame_offset = 0; + $frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1)); + $frame_textencoding_terminator = $this->TextEncodingTerminatorLookup($frame_textencoding); + if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) { + $this->warning('Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding'); + $frame_textencoding_terminator = "\x00"; + } + + $frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset); + $frame_pricestring = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); + $frame_offset = $frame_terminatorpos + strlen("\x00"); + $frame_rawpricearray = explode('/', $frame_pricestring); + foreach ($frame_rawpricearray as $key => $val) { + $frame_currencyid = substr($val, 0, 3); + $parsedFrame['price'][$frame_currencyid]['currency'] = $this->LookupCurrencyUnits($frame_currencyid); + $parsedFrame['price'][$frame_currencyid]['value'] = substr($val, 3); + } + + $frame_datestring = substr($parsedFrame['data'], $frame_offset, 8); + $frame_offset += 8; + + $frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset); + $frame_contacturl = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); + $frame_offset = $frame_terminatorpos + strlen("\x00"); + + $frame_receivedasid = ord(substr($parsedFrame['data'], $frame_offset++, 1)); + + $frame_terminatorpos = strpos($parsedFrame['data'], $frame_textencoding_terminator, $frame_offset); + if (ord(substr($parsedFrame['data'], $frame_terminatorpos + strlen($frame_textencoding_terminator), 1)) === 0) { + $frame_terminatorpos++; // strpos() fooled because 2nd byte of Unicode chars are often 0x00 + } + $frame_sellername = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); + if (ord($frame_sellername) === 0) { + $frame_sellername = ''; + } + $frame_offset = $frame_terminatorpos + strlen($frame_textencoding_terminator); + + $frame_terminatorpos = strpos($parsedFrame['data'], $frame_textencoding_terminator, $frame_offset); + if (ord(substr($parsedFrame['data'], $frame_terminatorpos + strlen($frame_textencoding_terminator), 1)) === 0) { + $frame_terminatorpos++; // strpos() fooled because 2nd byte of Unicode chars are often 0x00 + } + $frame_description = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); + if (in_array($frame_description, array("\x00", "\x00\x00", "\xFF\xFE", "\xFE\xFF"))) { + // if description only contains a BOM or terminator then make it blank + $frame_description = ''; + } + $frame_offset = $frame_terminatorpos + strlen($frame_textencoding_terminator); + + $frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset); + $frame_mimetype = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); + $frame_offset = $frame_terminatorpos + strlen("\x00"); + + $frame_sellerlogo = substr($parsedFrame['data'], $frame_offset); + + $parsedFrame['encodingid'] = $frame_textencoding; + $parsedFrame['encoding'] = $this->TextEncodingNameLookup($frame_textencoding); + + $parsedFrame['pricevaliduntil'] = $frame_datestring; + $parsedFrame['contacturl'] = $frame_contacturl; + $parsedFrame['receivedasid'] = $frame_receivedasid; + $parsedFrame['receivedas'] = $this->COMRReceivedAsLookup($frame_receivedasid); + $parsedFrame['sellername'] = $frame_sellername; + $parsedFrame['description'] = $frame_description; + $parsedFrame['mime'] = $frame_mimetype; + $parsedFrame['logo'] = $frame_sellerlogo; + unset($parsedFrame['data']); + + + } elseif (($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'ENCR')) { // 4.25 ENCR Encryption method registration (ID3v2.3+ only) + // There may be several 'ENCR' frames in a tag, + // but only one containing the same symbol + // and only one containing the same owner identifier + //
      + // Owner identifier $00 + // Method symbol $xx + // Encryption data + + $frame_offset = 0; + $frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset); + $frame_ownerid = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); + if (ord($frame_ownerid) === 0) { + $frame_ownerid = ''; + } + $frame_offset = $frame_terminatorpos + strlen("\x00"); + + $parsedFrame['ownerid'] = $frame_ownerid; + $parsedFrame['methodsymbol'] = ord(substr($parsedFrame['data'], $frame_offset++, 1)); + $parsedFrame['data'] = (string) substr($parsedFrame['data'], $frame_offset); + + + } elseif (($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'GRID')) { // 4.26 GRID Group identification registration (ID3v2.3+ only) + + // There may be several 'GRID' frames in a tag, + // but only one containing the same symbol + // and only one containing the same owner identifier + //
      + // Owner identifier $00 + // Group symbol $xx + // Group dependent data + + $frame_offset = 0; + $frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset); + $frame_ownerid = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); + if (ord($frame_ownerid) === 0) { + $frame_ownerid = ''; + } + $frame_offset = $frame_terminatorpos + strlen("\x00"); + + $parsedFrame['ownerid'] = $frame_ownerid; + $parsedFrame['groupsymbol'] = ord(substr($parsedFrame['data'], $frame_offset++, 1)); + $parsedFrame['data'] = (string) substr($parsedFrame['data'], $frame_offset); + + + } elseif (($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'PRIV')) { // 4.27 PRIV Private frame (ID3v2.3+ only) + // The tag may contain more than one 'PRIV' frame + // but only with different contents + //
      + // Owner identifier $00 + // The private data + + $frame_offset = 0; + $frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset); + $frame_ownerid = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); + if (ord($frame_ownerid) === 0) { + $frame_ownerid = ''; + } + $frame_offset = $frame_terminatorpos + strlen("\x00"); + + $parsedFrame['ownerid'] = $frame_ownerid; + $parsedFrame['data'] = (string) substr($parsedFrame['data'], $frame_offset); + + + } elseif (($id3v2_majorversion >= 4) && ($parsedFrame['frame_name'] == 'SIGN')) { // 4.28 SIGN Signature frame (ID3v2.4+ only) + // There may be more than one 'signature frame' in a tag, + // but no two may be identical + //
      + // Group symbol $xx + // Signature + + $frame_offset = 0; + $parsedFrame['groupsymbol'] = ord(substr($parsedFrame['data'], $frame_offset++, 1)); + $parsedFrame['data'] = (string) substr($parsedFrame['data'], $frame_offset); + + + } elseif (($id3v2_majorversion >= 4) && ($parsedFrame['frame_name'] == 'SEEK')) { // 4.29 SEEK Seek frame (ID3v2.4+ only) + // There may only be one 'seek frame' in a tag + //
      + // Minimum offset to next tag $xx xx xx xx + + $frame_offset = 0; + $parsedFrame['data'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 4)); + + + } elseif (($id3v2_majorversion >= 4) && ($parsedFrame['frame_name'] == 'ASPI')) { // 4.30 ASPI Audio seek point index (ID3v2.4+ only) + // There may only be one 'audio seek point index' frame in a tag + //
      + // Indexed data start (S) $xx xx xx xx + // Indexed data length (L) $xx xx xx xx + // Number of index points (N) $xx xx + // Bits per index point (b) $xx + // Then for every index point the following data is included: + // Fraction at index (Fi) $xx (xx) + + $frame_offset = 0; + $parsedFrame['datastart'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 4)); + $frame_offset += 4; + $parsedFrame['indexeddatalength'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 4)); + $frame_offset += 4; + $parsedFrame['indexpoints'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 2)); + $frame_offset += 2; + $parsedFrame['bitsperpoint'] = ord(substr($parsedFrame['data'], $frame_offset++, 1)); + $frame_bytesperpoint = ceil($parsedFrame['bitsperpoint'] / 8); + for ($i = 0; $i < $parsedFrame['indexpoints']; $i++) { + $parsedFrame['indexes'][$i] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesperpoint)); + $frame_offset += $frame_bytesperpoint; + } + unset($parsedFrame['data']); + + } elseif (($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'RGAD')) { // Replay Gain Adjustment + // http://privatewww.essex.ac.uk/~djmrob/replaygain/file_format_id3v2.html + // There may only be one 'RGAD' frame in a tag + //
      + // Peak Amplitude $xx $xx $xx $xx + // Radio Replay Gain Adjustment %aaabbbcd %dddddddd + // Audiophile Replay Gain Adjustment %aaabbbcd %dddddddd + // a - name code + // b - originator code + // c - sign bit + // d - replay gain adjustment + + $frame_offset = 0; + $parsedFrame['peakamplitude'] = getid3_lib::BigEndian2Float(substr($parsedFrame['data'], $frame_offset, 4)); + $frame_offset += 4; + $rg_track_adjustment = getid3_lib::Dec2Bin(substr($parsedFrame['data'], $frame_offset, 2)); + $frame_offset += 2; + $rg_album_adjustment = getid3_lib::Dec2Bin(substr($parsedFrame['data'], $frame_offset, 2)); + $frame_offset += 2; + $parsedFrame['raw']['track']['name'] = getid3_lib::Bin2Dec(substr($rg_track_adjustment, 0, 3)); + $parsedFrame['raw']['track']['originator'] = getid3_lib::Bin2Dec(substr($rg_track_adjustment, 3, 3)); + $parsedFrame['raw']['track']['signbit'] = getid3_lib::Bin2Dec(substr($rg_track_adjustment, 6, 1)); + $parsedFrame['raw']['track']['adjustment'] = getid3_lib::Bin2Dec(substr($rg_track_adjustment, 7, 9)); + $parsedFrame['raw']['album']['name'] = getid3_lib::Bin2Dec(substr($rg_album_adjustment, 0, 3)); + $parsedFrame['raw']['album']['originator'] = getid3_lib::Bin2Dec(substr($rg_album_adjustment, 3, 3)); + $parsedFrame['raw']['album']['signbit'] = getid3_lib::Bin2Dec(substr($rg_album_adjustment, 6, 1)); + $parsedFrame['raw']['album']['adjustment'] = getid3_lib::Bin2Dec(substr($rg_album_adjustment, 7, 9)); + $parsedFrame['track']['name'] = getid3_lib::RGADnameLookup($parsedFrame['raw']['track']['name']); + $parsedFrame['track']['originator'] = getid3_lib::RGADoriginatorLookup($parsedFrame['raw']['track']['originator']); + $parsedFrame['track']['adjustment'] = getid3_lib::RGADadjustmentLookup($parsedFrame['raw']['track']['adjustment'], $parsedFrame['raw']['track']['signbit']); + $parsedFrame['album']['name'] = getid3_lib::RGADnameLookup($parsedFrame['raw']['album']['name']); + $parsedFrame['album']['originator'] = getid3_lib::RGADoriginatorLookup($parsedFrame['raw']['album']['originator']); + $parsedFrame['album']['adjustment'] = getid3_lib::RGADadjustmentLookup($parsedFrame['raw']['album']['adjustment'], $parsedFrame['raw']['album']['signbit']); + + $info['replay_gain']['track']['peak'] = $parsedFrame['peakamplitude']; + $info['replay_gain']['track']['originator'] = $parsedFrame['track']['originator']; + $info['replay_gain']['track']['adjustment'] = $parsedFrame['track']['adjustment']; + $info['replay_gain']['album']['originator'] = $parsedFrame['album']['originator']; + $info['replay_gain']['album']['adjustment'] = $parsedFrame['album']['adjustment']; + + unset($parsedFrame['data']); + + } elseif (($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'CHAP')) { // CHAP Chapters frame (ID3v2.3+ only) + // http://id3.org/id3v2-chapters-1.0 + // (10 bytes) + // Element ID $00 + // Start time $xx xx xx xx + // End time $xx xx xx xx + // Start offset $xx xx xx xx + // End offset $xx xx xx xx + // + + $frame_offset = 0; + @list($parsedFrame['element_id']) = explode("\x00", $parsedFrame['data'], 2); + $frame_offset += strlen($parsedFrame['element_id']."\x00"); + $parsedFrame['time_begin'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 4)); + $frame_offset += 4; + $parsedFrame['time_end'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 4)); + $frame_offset += 4; + if (substr($parsedFrame['data'], $frame_offset, 4) != "\xFF\xFF\xFF\xFF") { + // "If these bytes are all set to 0xFF then the value should be ignored and the start time value should be utilized." + $parsedFrame['offset_begin'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 4)); + } + $frame_offset += 4; + if (substr($parsedFrame['data'], $frame_offset, 4) != "\xFF\xFF\xFF\xFF") { + // "If these bytes are all set to 0xFF then the value should be ignored and the start time value should be utilized." + $parsedFrame['offset_end'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 4)); + } + $frame_offset += 4; + + if ($frame_offset < strlen($parsedFrame['data'])) { + $parsedFrame['subframes'] = array(); + while ($frame_offset < strlen($parsedFrame['data'])) { + // + $subframe = array(); + $subframe['name'] = substr($parsedFrame['data'], $frame_offset, 4); + $frame_offset += 4; + $subframe['size'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 4)); + $frame_offset += 4; + $subframe['flags_raw'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 2)); + $frame_offset += 2; + if ($subframe['size'] > (strlen($parsedFrame['data']) - $frame_offset)) { + $this->warning('CHAP subframe "'.$subframe['name'].'" at frame offset '.$frame_offset.' claims to be "'.$subframe['size'].'" bytes, which is more than the available data ('.(strlen($parsedFrame['data']) - $frame_offset).' bytes)'); + break; + } + $subframe_rawdata = substr($parsedFrame['data'], $frame_offset, $subframe['size']); + $frame_offset += $subframe['size']; + + $subframe['encodingid'] = ord(substr($subframe_rawdata, 0, 1)); + $subframe['text'] = substr($subframe_rawdata, 1); + $subframe['encoding'] = $this->TextEncodingNameLookup($subframe['encodingid']); + $encoding_converted_text = trim(getid3_lib::iconv_fallback($subframe['encoding'], $info['encoding'], $subframe['text']));; + switch (substr($encoding_converted_text, 0, 2)) { + case "\xFF\xFE": + case "\xFE\xFF": + switch (strtoupper($info['id3v2']['encoding'])) { + case 'ISO-8859-1': + case 'UTF-8': + $encoding_converted_text = substr($encoding_converted_text, 2); + // remove unwanted byte-order-marks + break; + default: + // ignore + break; + } + break; + default: + // do not remove BOM + break; + } + + if (($subframe['name'] == 'TIT2') || ($subframe['name'] == 'TIT3')) { + if ($subframe['name'] == 'TIT2') { + $parsedFrame['chapter_name'] = $encoding_converted_text; + } elseif ($subframe['name'] == 'TIT3') { + $parsedFrame['chapter_description'] = $encoding_converted_text; + } + $parsedFrame['subframes'][] = $subframe; + } else { + $this->warning('ID3v2.CHAP subframe "'.$subframe['name'].'" not handled (only TIT2 and TIT3)'); + } + } + unset($subframe_rawdata, $subframe, $encoding_converted_text); + } + + $id3v2_chapter_entry = array(); + foreach (array('id', 'time_begin', 'time_end', 'offset_begin', 'offset_end', 'chapter_name', 'chapter_description') as $id3v2_chapter_key) { + if (isset($parsedFrame[$id3v2_chapter_key])) { + $id3v2_chapter_entry[$id3v2_chapter_key] = $parsedFrame[$id3v2_chapter_key]; + } + } + if (!isset($info['id3v2']['chapters'])) { + $info['id3v2']['chapters'] = array(); + } + $info['id3v2']['chapters'][] = $id3v2_chapter_entry; + unset($id3v2_chapter_entry, $id3v2_chapter_key); + + + } elseif (($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'CTOC')) { // CTOC Chapters Table Of Contents frame (ID3v2.3+ only) + // http://id3.org/id3v2-chapters-1.0 + // (10 bytes) + // Element ID $00 + // CTOC flags %xx + // Entry count $xx + // Child Element ID $00 /* zero or more child CHAP or CTOC entries */ + // + + $frame_offset = 0; + @list($parsedFrame['element_id']) = explode("\x00", $parsedFrame['data'], 2); + $frame_offset += strlen($parsedFrame['element_id']."\x00"); + $ctoc_flags_raw = ord(substr($parsedFrame['data'], $frame_offset, 1)); + $frame_offset += 1; + $parsedFrame['entry_count'] = ord(substr($parsedFrame['data'], $frame_offset, 1)); + $frame_offset += 1; + + $terminator_position = null; + for ($i = 0; $i < $parsedFrame['entry_count']; $i++) { + $terminator_position = strpos($parsedFrame['data'], "\x00", $frame_offset); + $parsedFrame['child_element_ids'][$i] = substr($parsedFrame['data'], $frame_offset, $terminator_position - $frame_offset); + $frame_offset = $terminator_position + 1; + } + + $parsedFrame['ctoc_flags']['ordered'] = (bool) ($ctoc_flags_raw & 0x01); + $parsedFrame['ctoc_flags']['top_level'] = (bool) ($ctoc_flags_raw & 0x03); + + unset($ctoc_flags_raw, $terminator_position); + + if ($frame_offset < strlen($parsedFrame['data'])) { + $parsedFrame['subframes'] = array(); + while ($frame_offset < strlen($parsedFrame['data'])) { + // + $subframe = array(); + $subframe['name'] = substr($parsedFrame['data'], $frame_offset, 4); + $frame_offset += 4; + $subframe['size'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 4)); + $frame_offset += 4; + $subframe['flags_raw'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 2)); + $frame_offset += 2; + if ($subframe['size'] > (strlen($parsedFrame['data']) - $frame_offset)) { + $this->warning('CTOS subframe "'.$subframe['name'].'" at frame offset '.$frame_offset.' claims to be "'.$subframe['size'].'" bytes, which is more than the available data ('.(strlen($parsedFrame['data']) - $frame_offset).' bytes)'); + break; + } + $subframe_rawdata = substr($parsedFrame['data'], $frame_offset, $subframe['size']); + $frame_offset += $subframe['size']; + + $subframe['encodingid'] = ord(substr($subframe_rawdata, 0, 1)); + $subframe['text'] = substr($subframe_rawdata, 1); + $subframe['encoding'] = $this->TextEncodingNameLookup($subframe['encodingid']); + $encoding_converted_text = trim(getid3_lib::iconv_fallback($subframe['encoding'], $info['encoding'], $subframe['text']));; + switch (substr($encoding_converted_text, 0, 2)) { + case "\xFF\xFE": + case "\xFE\xFF": + switch (strtoupper($info['id3v2']['encoding'])) { + case 'ISO-8859-1': + case 'UTF-8': + $encoding_converted_text = substr($encoding_converted_text, 2); + // remove unwanted byte-order-marks + break; + default: + // ignore + break; + } + break; + default: + // do not remove BOM + break; + } + + if (($subframe['name'] == 'TIT2') || ($subframe['name'] == 'TIT3')) { + if ($subframe['name'] == 'TIT2') { + $parsedFrame['toc_name'] = $encoding_converted_text; + } elseif ($subframe['name'] == 'TIT3') { + $parsedFrame['toc_description'] = $encoding_converted_text; + } + $parsedFrame['subframes'][] = $subframe; + } else { + $this->warning('ID3v2.CTOC subframe "'.$subframe['name'].'" not handled (only TIT2 and TIT3)'); + } + } + unset($subframe_rawdata, $subframe, $encoding_converted_text); + } + + } + + return true; + } + + + public function DeUnsynchronise($data) { + return str_replace("\xFF\x00", "\xFF", $data); + } + + public function LookupExtendedHeaderRestrictionsTagSizeLimits($index) { + static $LookupExtendedHeaderRestrictionsTagSizeLimits = array( + 0x00 => 'No more than 128 frames and 1 MB total tag size', + 0x01 => 'No more than 64 frames and 128 KB total tag size', + 0x02 => 'No more than 32 frames and 40 KB total tag size', + 0x03 => 'No more than 32 frames and 4 KB total tag size', + ); + return (isset($LookupExtendedHeaderRestrictionsTagSizeLimits[$index]) ? $LookupExtendedHeaderRestrictionsTagSizeLimits[$index] : ''); + } + + public function LookupExtendedHeaderRestrictionsTextEncodings($index) { + static $LookupExtendedHeaderRestrictionsTextEncodings = array( + 0x00 => 'No restrictions', + 0x01 => 'Strings are only encoded with ISO-8859-1 or UTF-8', + ); + return (isset($LookupExtendedHeaderRestrictionsTextEncodings[$index]) ? $LookupExtendedHeaderRestrictionsTextEncodings[$index] : ''); + } + + public function LookupExtendedHeaderRestrictionsTextFieldSize($index) { + static $LookupExtendedHeaderRestrictionsTextFieldSize = array( + 0x00 => 'No restrictions', + 0x01 => 'No string is longer than 1024 characters', + 0x02 => 'No string is longer than 128 characters', + 0x03 => 'No string is longer than 30 characters', + ); + return (isset($LookupExtendedHeaderRestrictionsTextFieldSize[$index]) ? $LookupExtendedHeaderRestrictionsTextFieldSize[$index] : ''); + } + + public function LookupExtendedHeaderRestrictionsImageEncoding($index) { + static $LookupExtendedHeaderRestrictionsImageEncoding = array( + 0x00 => 'No restrictions', + 0x01 => 'Images are encoded only with PNG or JPEG', + ); + return (isset($LookupExtendedHeaderRestrictionsImageEncoding[$index]) ? $LookupExtendedHeaderRestrictionsImageEncoding[$index] : ''); + } + + public function LookupExtendedHeaderRestrictionsImageSizeSize($index) { + static $LookupExtendedHeaderRestrictionsImageSizeSize = array( + 0x00 => 'No restrictions', + 0x01 => 'All images are 256x256 pixels or smaller', + 0x02 => 'All images are 64x64 pixels or smaller', + 0x03 => 'All images are exactly 64x64 pixels, unless required otherwise', + ); + return (isset($LookupExtendedHeaderRestrictionsImageSizeSize[$index]) ? $LookupExtendedHeaderRestrictionsImageSizeSize[$index] : ''); + } + + public function LookupCurrencyUnits($currencyid) { + + $begin = __LINE__; + + /** This is not a comment! + + + AED Dirhams + AFA Afghanis + ALL Leke + AMD Drams + ANG Guilders + AOA Kwanza + ARS Pesos + ATS Schillings + AUD Dollars + AWG Guilders + AZM Manats + BAM Convertible Marka + BBD Dollars + BDT Taka + BEF Francs + BGL Leva + BHD Dinars + BIF Francs + BMD Dollars + BND Dollars + BOB Bolivianos + BRL Brazil Real + BSD Dollars + BTN Ngultrum + BWP Pulas + BYR Rubles + BZD Dollars + CAD Dollars + CDF Congolese Francs + CHF Francs + CLP Pesos + CNY Yuan Renminbi + COP Pesos + CRC Colones + CUP Pesos + CVE Escudos + CYP Pounds + CZK Koruny + DEM Deutsche Marks + DJF Francs + DKK Kroner + DOP Pesos + DZD Algeria Dinars + EEK Krooni + EGP Pounds + ERN Nakfa + ESP Pesetas + ETB Birr + EUR Euro + FIM Markkaa + FJD Dollars + FKP Pounds + FRF Francs + GBP Pounds + GEL Lari + GGP Pounds + GHC Cedis + GIP Pounds + GMD Dalasi + GNF Francs + GRD Drachmae + GTQ Quetzales + GYD Dollars + HKD Dollars + HNL Lempiras + HRK Kuna + HTG Gourdes + HUF Forints + IDR Rupiahs + IEP Pounds + ILS New Shekels + IMP Pounds + INR Rupees + IQD Dinars + IRR Rials + ISK Kronur + ITL Lire + JEP Pounds + JMD Dollars + JOD Dinars + JPY Yen + KES Shillings + KGS Soms + KHR Riels + KMF Francs + KPW Won + KWD Dinars + KYD Dollars + KZT Tenge + LAK Kips + LBP Pounds + LKR Rupees + LRD Dollars + LSL Maloti + LTL Litai + LUF Francs + LVL Lati + LYD Dinars + MAD Dirhams + MDL Lei + MGF Malagasy Francs + MKD Denars + MMK Kyats + MNT Tugriks + MOP Patacas + MRO Ouguiyas + MTL Liri + MUR Rupees + MVR Rufiyaa + MWK Kwachas + MXN Pesos + MYR Ringgits + MZM Meticais + NAD Dollars + NGN Nairas + NIO Gold Cordobas + NLG Guilders + NOK Krone + NPR Nepal Rupees + NZD Dollars + OMR Rials + PAB Balboa + PEN Nuevos Soles + PGK Kina + PHP Pesos + PKR Rupees + PLN Zlotych + PTE Escudos + PYG Guarani + QAR Rials + ROL Lei + RUR Rubles + RWF Rwanda Francs + SAR Riyals + SBD Dollars + SCR Rupees + SDD Dinars + SEK Kronor + SGD Dollars + SHP Pounds + SIT Tolars + SKK Koruny + SLL Leones + SOS Shillings + SPL Luigini + SRG Guilders + STD Dobras + SVC Colones + SYP Pounds + SZL Emalangeni + THB Baht + TJR Rubles + TMM Manats + TND Dinars + TOP Pa'anga + TRL Liras + TTD Dollars + TVD Tuvalu Dollars + TWD New Dollars + TZS Shillings + UAH Hryvnia + UGX Shillings + USD Dollars + UYU Pesos + UZS Sums + VAL Lire + VEB Bolivares + VND Dong + VUV Vatu + WST Tala + XAF Francs + XAG Ounces + XAU Ounces + XCD Dollars + XDR Special Drawing Rights + XPD Ounces + XPF Francs + XPT Ounces + YER Rials + YUM New Dinars + ZAR Rand + ZMK Kwacha + ZWD Zimbabwe Dollars + + */ + + return getid3_lib::EmbeddedLookup($currencyid, $begin, __LINE__, __FILE__, 'id3v2-currency-units'); + } + + + public function LookupCurrencyCountry($currencyid) { + + $begin = __LINE__; + + /** This is not a comment! + + AED United Arab Emirates + AFA Afghanistan + ALL Albania + AMD Armenia + ANG Netherlands Antilles + AOA Angola + ARS Argentina + ATS Austria + AUD Australia + AWG Aruba + AZM Azerbaijan + BAM Bosnia and Herzegovina + BBD Barbados + BDT Bangladesh + BEF Belgium + BGL Bulgaria + BHD Bahrain + BIF Burundi + BMD Bermuda + BND Brunei Darussalam + BOB Bolivia + BRL Brazil + BSD Bahamas + BTN Bhutan + BWP Botswana + BYR Belarus + BZD Belize + CAD Canada + CDF Congo/Kinshasa + CHF Switzerland + CLP Chile + CNY China + COP Colombia + CRC Costa Rica + CUP Cuba + CVE Cape Verde + CYP Cyprus + CZK Czech Republic + DEM Germany + DJF Djibouti + DKK Denmark + DOP Dominican Republic + DZD Algeria + EEK Estonia + EGP Egypt + ERN Eritrea + ESP Spain + ETB Ethiopia + EUR Euro Member Countries + FIM Finland + FJD Fiji + FKP Falkland Islands (Malvinas) + FRF France + GBP United Kingdom + GEL Georgia + GGP Guernsey + GHC Ghana + GIP Gibraltar + GMD Gambia + GNF Guinea + GRD Greece + GTQ Guatemala + GYD Guyana + HKD Hong Kong + HNL Honduras + HRK Croatia + HTG Haiti + HUF Hungary + IDR Indonesia + IEP Ireland (Eire) + ILS Israel + IMP Isle of Man + INR India + IQD Iraq + IRR Iran + ISK Iceland + ITL Italy + JEP Jersey + JMD Jamaica + JOD Jordan + JPY Japan + KES Kenya + KGS Kyrgyzstan + KHR Cambodia + KMF Comoros + KPW Korea + KWD Kuwait + KYD Cayman Islands + KZT Kazakstan + LAK Laos + LBP Lebanon + LKR Sri Lanka + LRD Liberia + LSL Lesotho + LTL Lithuania + LUF Luxembourg + LVL Latvia + LYD Libya + MAD Morocco + MDL Moldova + MGF Madagascar + MKD Macedonia + MMK Myanmar (Burma) + MNT Mongolia + MOP Macau + MRO Mauritania + MTL Malta + MUR Mauritius + MVR Maldives (Maldive Islands) + MWK Malawi + MXN Mexico + MYR Malaysia + MZM Mozambique + NAD Namibia + NGN Nigeria + NIO Nicaragua + NLG Netherlands (Holland) + NOK Norway + NPR Nepal + NZD New Zealand + OMR Oman + PAB Panama + PEN Peru + PGK Papua New Guinea + PHP Philippines + PKR Pakistan + PLN Poland + PTE Portugal + PYG Paraguay + QAR Qatar + ROL Romania + RUR Russia + RWF Rwanda + SAR Saudi Arabia + SBD Solomon Islands + SCR Seychelles + SDD Sudan + SEK Sweden + SGD Singapore + SHP Saint Helena + SIT Slovenia + SKK Slovakia + SLL Sierra Leone + SOS Somalia + SPL Seborga + SRG Suriname + STD São Tome and Principe + SVC El Salvador + SYP Syria + SZL Swaziland + THB Thailand + TJR Tajikistan + TMM Turkmenistan + TND Tunisia + TOP Tonga + TRL Turkey + TTD Trinidad and Tobago + TVD Tuvalu + TWD Taiwan + TZS Tanzania + UAH Ukraine + UGX Uganda + USD United States of America + UYU Uruguay + UZS Uzbekistan + VAL Vatican City + VEB Venezuela + VND Viet Nam + VUV Vanuatu + WST Samoa + XAF Communauté Financière Africaine + XAG Silver + XAU Gold + XCD East Caribbean + XDR International Monetary Fund + XPD Palladium + XPF Comptoirs Français du Pacifique + XPT Platinum + YER Yemen + YUM Yugoslavia + ZAR South Africa + ZMK Zambia + ZWD Zimbabwe + + */ + + return getid3_lib::EmbeddedLookup($currencyid, $begin, __LINE__, __FILE__, 'id3v2-currency-country'); + } + + + + public static function LanguageLookup($languagecode, $casesensitive=false) { + + if (!$casesensitive) { + $languagecode = strtolower($languagecode); + } + + // http://www.id3.org/id3v2.4.0-structure.txt + // [4. ID3v2 frame overview] + // The three byte language field, present in several frames, is used to + // describe the language of the frame's content, according to ISO-639-2 + // [ISO-639-2]. The language should be represented in lower case. If the + // language is not known the string "XXX" should be used. + + + // ISO 639-2 - http://www.id3.org/iso639-2.html + + $begin = __LINE__; + + /** This is not a comment! + + XXX unknown + xxx unknown + aar Afar + abk Abkhazian + ace Achinese + ach Acoli + ada Adangme + afa Afro-Asiatic (Other) + afh Afrihili + afr Afrikaans + aka Akan + akk Akkadian + alb Albanian + ale Aleut + alg Algonquian Languages + amh Amharic + ang English, Old (ca. 450-1100) + apa Apache Languages + ara Arabic + arc Aramaic + arm Armenian + arn Araucanian + arp Arapaho + art Artificial (Other) + arw Arawak + asm Assamese + ath Athapascan Languages + ava Avaric + ave Avestan + awa Awadhi + aym Aymara + aze Azerbaijani + bad Banda + bai Bamileke Languages + bak Bashkir + bal Baluchi + bam Bambara + ban Balinese + baq Basque + bas Basa + bat Baltic (Other) + bej Beja + bel Byelorussian + bem Bemba + ben Bengali + ber Berber (Other) + bho Bhojpuri + bih Bihari + bik Bikol + bin Bini + bis Bislama + bla Siksika + bnt Bantu (Other) + bod Tibetan + bra Braj + bre Breton + bua Buriat + bug Buginese + bul Bulgarian + bur Burmese + cad Caddo + cai Central American Indian (Other) + car Carib + cat Catalan + cau Caucasian (Other) + ceb Cebuano + cel Celtic (Other) + ces Czech + cha Chamorro + chb Chibcha + che Chechen + chg Chagatai + chi Chinese + chm Mari + chn Chinook jargon + cho Choctaw + chr Cherokee + chu Church Slavic + chv Chuvash + chy Cheyenne + cop Coptic + cor Cornish + cos Corsican + cpe Creoles and Pidgins, English-based (Other) + cpf Creoles and Pidgins, French-based (Other) + cpp Creoles and Pidgins, Portuguese-based (Other) + cre Cree + crp Creoles and Pidgins (Other) + cus Cushitic (Other) + cym Welsh + cze Czech + dak Dakota + dan Danish + del Delaware + deu German + din Dinka + div Divehi + doi Dogri + dra Dravidian (Other) + dua Duala + dum Dutch, Middle (ca. 1050-1350) + dut Dutch + dyu Dyula + dzo Dzongkha + efi Efik + egy Egyptian (Ancient) + eka Ekajuk + ell Greek, Modern (1453-) + elx Elamite + eng English + enm English, Middle (ca. 1100-1500) + epo Esperanto + esk Eskimo (Other) + esl Spanish + est Estonian + eus Basque + ewe Ewe + ewo Ewondo + fan Fang + fao Faroese + fas Persian + fat Fanti + fij Fijian + fin Finnish + fiu Finno-Ugrian (Other) + fon Fon + fra French + fre French + frm French, Middle (ca. 1400-1600) + fro French, Old (842- ca. 1400) + fry Frisian + ful Fulah + gaa Ga + gae Gaelic (Scots) + gai Irish + gay Gayo + gdh Gaelic (Scots) + gem Germanic (Other) + geo Georgian + ger German + gez Geez + gil Gilbertese + glg Gallegan + gmh German, Middle High (ca. 1050-1500) + goh German, Old High (ca. 750-1050) + gon Gondi + got Gothic + grb Grebo + grc Greek, Ancient (to 1453) + gre Greek, Modern (1453-) + grn Guarani + guj Gujarati + hai Haida + hau Hausa + haw Hawaiian + heb Hebrew + her Herero + hil Hiligaynon + him Himachali + hin Hindi + hmo Hiri Motu + hun Hungarian + hup Hupa + hye Armenian + iba Iban + ibo Igbo + ice Icelandic + ijo Ijo + iku Inuktitut + ilo Iloko + ina Interlingua (International Auxiliary language Association) + inc Indic (Other) + ind Indonesian + ine Indo-European (Other) + ine Interlingue + ipk Inupiak + ira Iranian (Other) + iri Irish + iro Iroquoian uages + isl Icelandic + ita Italian + jav Javanese + jaw Javanese + jpn Japanese + jpr Judeo-Persian + jrb Judeo-Arabic + kaa Kara-Kalpak + kab Kabyle + kac Kachin + kal Greenlandic + kam Kamba + kan Kannada + kar Karen + kas Kashmiri + kat Georgian + kau Kanuri + kaw Kawi + kaz Kazakh + kha Khasi + khi Khoisan (Other) + khm Khmer + kho Khotanese + kik Kikuyu + kin Kinyarwanda + kir Kirghiz + kok Konkani + kom Komi + kon Kongo + kor Korean + kpe Kpelle + kro Kru + kru Kurukh + kua Kuanyama + kum Kumyk + kur Kurdish + kus Kusaie + kut Kutenai + lad Ladino + lah Lahnda + lam Lamba + lao Lao + lat Latin + lav Latvian + lez Lezghian + lin Lingala + lit Lithuanian + lol Mongo + loz Lozi + ltz Letzeburgesch + lub Luba-Katanga + lug Ganda + lui Luiseno + lun Lunda + luo Luo (Kenya and Tanzania) + mac Macedonian + mad Madurese + mag Magahi + mah Marshall + mai Maithili + mak Macedonian + mak Makasar + mal Malayalam + man Mandingo + mao Maori + map Austronesian (Other) + mar Marathi + mas Masai + max Manx + may Malay + men Mende + mga Irish, Middle (900 - 1200) + mic Micmac + min Minangkabau + mis Miscellaneous (Other) + mkh Mon-Kmer (Other) + mlg Malagasy + mlt Maltese + mni Manipuri + mno Manobo Languages + moh Mohawk + mol Moldavian + mon Mongolian + mos Mossi + mri Maori + msa Malay + mul Multiple Languages + mun Munda Languages + mus Creek + mwr Marwari + mya Burmese + myn Mayan Languages + nah Aztec + nai North American Indian (Other) + nau Nauru + nav Navajo + nbl Ndebele, South + nde Ndebele, North + ndo Ndongo + nep Nepali + new Newari + nic Niger-Kordofanian (Other) + niu Niuean + nla Dutch + nno Norwegian (Nynorsk) + non Norse, Old + nor Norwegian + nso Sotho, Northern + nub Nubian Languages + nya Nyanja + nym Nyamwezi + nyn Nyankole + nyo Nyoro + nzi Nzima + oci Langue d'Oc (post 1500) + oji Ojibwa + ori Oriya + orm Oromo + osa Osage + oss Ossetic + ota Turkish, Ottoman (1500 - 1928) + oto Otomian Languages + paa Papuan-Australian (Other) + pag Pangasinan + pal Pahlavi + pam Pampanga + pan Panjabi + pap Papiamento + pau Palauan + peo Persian, Old (ca 600 - 400 B.C.) + per Persian + phn Phoenician + pli Pali + pol Polish + pon Ponape + por Portuguese + pra Prakrit uages + pro Provencal, Old (to 1500) + pus Pushto + que Quechua + raj Rajasthani + rar Rarotongan + roa Romance (Other) + roh Rhaeto-Romance + rom Romany + ron Romanian + rum Romanian + run Rundi + rus Russian + sad Sandawe + sag Sango + sah Yakut + sai South American Indian (Other) + sal Salishan Languages + sam Samaritan Aramaic + san Sanskrit + sco Scots + scr Serbo-Croatian + sel Selkup + sem Semitic (Other) + sga Irish, Old (to 900) + shn Shan + sid Sidamo + sin Singhalese + sio Siouan Languages + sit Sino-Tibetan (Other) + sla Slavic (Other) + slk Slovak + slo Slovak + slv Slovenian + smi Sami Languages + smo Samoan + sna Shona + snd Sindhi + sog Sogdian + som Somali + son Songhai + sot Sotho, Southern + spa Spanish + sqi Albanian + srd Sardinian + srr Serer + ssa Nilo-Saharan (Other) + ssw Siswant + ssw Swazi + suk Sukuma + sun Sudanese + sus Susu + sux Sumerian + sve Swedish + swa Swahili + swe Swedish + syr Syriac + tah Tahitian + tam Tamil + tat Tatar + tel Telugu + tem Timne + ter Tereno + tgk Tajik + tgl Tagalog + tha Thai + tib Tibetan + tig Tigre + tir Tigrinya + tiv Tivi + tli Tlingit + tmh Tamashek + tog Tonga (Nyasa) + ton Tonga (Tonga Islands) + tru Truk + tsi Tsimshian + tsn Tswana + tso Tsonga + tuk Turkmen + tum Tumbuka + tur Turkish + tut Altaic (Other) + twi Twi + tyv Tuvinian + uga Ugaritic + uig Uighur + ukr Ukrainian + umb Umbundu + und Undetermined + urd Urdu + uzb Uzbek + vai Vai + ven Venda + vie Vietnamese + vol Volapük + vot Votic + wak Wakashan Languages + wal Walamo + war Waray + was Washo + wel Welsh + wen Sorbian Languages + wol Wolof + xho Xhosa + yao Yao + yap Yap + yid Yiddish + yor Yoruba + zap Zapotec + zen Zenaga + zha Zhuang + zho Chinese + zul Zulu + zun Zuni + + */ + + return getid3_lib::EmbeddedLookup($languagecode, $begin, __LINE__, __FILE__, 'id3v2-languagecode'); + } + + + public static function ETCOEventLookup($index) { + if (($index >= 0x17) && ($index <= 0xDF)) { + return 'reserved for future use'; + } + if (($index >= 0xE0) && ($index <= 0xEF)) { + return 'not predefined synch 0-F'; + } + if (($index >= 0xF0) && ($index <= 0xFC)) { + return 'reserved for future use'; + } + + static $EventLookup = array( + 0x00 => 'padding (has no meaning)', + 0x01 => 'end of initial silence', + 0x02 => 'intro start', + 0x03 => 'main part start', + 0x04 => 'outro start', + 0x05 => 'outro end', + 0x06 => 'verse start', + 0x07 => 'refrain start', + 0x08 => 'interlude start', + 0x09 => 'theme start', + 0x0A => 'variation start', + 0x0B => 'key change', + 0x0C => 'time change', + 0x0D => 'momentary unwanted noise (Snap, Crackle & Pop)', + 0x0E => 'sustained noise', + 0x0F => 'sustained noise end', + 0x10 => 'intro end', + 0x11 => 'main part end', + 0x12 => 'verse end', + 0x13 => 'refrain end', + 0x14 => 'theme end', + 0x15 => 'profanity', + 0x16 => 'profanity end', + 0xFD => 'audio end (start of silence)', + 0xFE => 'audio file ends', + 0xFF => 'one more byte of events follows' + ); + + return (isset($EventLookup[$index]) ? $EventLookup[$index] : ''); + } + + public static function SYTLContentTypeLookup($index) { + static $SYTLContentTypeLookup = array( + 0x00 => 'other', + 0x01 => 'lyrics', + 0x02 => 'text transcription', + 0x03 => 'movement/part name', // (e.g. 'Adagio') + 0x04 => 'events', // (e.g. 'Don Quijote enters the stage') + 0x05 => 'chord', // (e.g. 'Bb F Fsus') + 0x06 => 'trivia/\'pop up\' information', + 0x07 => 'URLs to webpages', + 0x08 => 'URLs to images' + ); + + return (isset($SYTLContentTypeLookup[$index]) ? $SYTLContentTypeLookup[$index] : ''); + } + + public static function APICPictureTypeLookup($index, $returnarray=false) { + static $APICPictureTypeLookup = array( + 0x00 => 'Other', + 0x01 => '32x32 pixels \'file icon\' (PNG only)', + 0x02 => 'Other file icon', + 0x03 => 'Cover (front)', + 0x04 => 'Cover (back)', + 0x05 => 'Leaflet page', + 0x06 => 'Media (e.g. label side of CD)', + 0x07 => 'Lead artist/lead performer/soloist', + 0x08 => 'Artist/performer', + 0x09 => 'Conductor', + 0x0A => 'Band/Orchestra', + 0x0B => 'Composer', + 0x0C => 'Lyricist/text writer', + 0x0D => 'Recording Location', + 0x0E => 'During recording', + 0x0F => 'During performance', + 0x10 => 'Movie/video screen capture', + 0x11 => 'A bright coloured fish', + 0x12 => 'Illustration', + 0x13 => 'Band/artist logotype', + 0x14 => 'Publisher/Studio logotype' + ); + if ($returnarray) { + return $APICPictureTypeLookup; + } + return (isset($APICPictureTypeLookup[$index]) ? $APICPictureTypeLookup[$index] : ''); + } + + public static function COMRReceivedAsLookup($index) { + static $COMRReceivedAsLookup = array( + 0x00 => 'Other', + 0x01 => 'Standard CD album with other songs', + 0x02 => 'Compressed audio on CD', + 0x03 => 'File over the Internet', + 0x04 => 'Stream over the Internet', + 0x05 => 'As note sheets', + 0x06 => 'As note sheets in a book with other sheets', + 0x07 => 'Music on other media', + 0x08 => 'Non-musical merchandise' + ); + + return (isset($COMRReceivedAsLookup[$index]) ? $COMRReceivedAsLookup[$index] : ''); + } + + public static function RVA2ChannelTypeLookup($index) { + static $RVA2ChannelTypeLookup = array( + 0x00 => 'Other', + 0x01 => 'Master volume', + 0x02 => 'Front right', + 0x03 => 'Front left', + 0x04 => 'Back right', + 0x05 => 'Back left', + 0x06 => 'Front centre', + 0x07 => 'Back centre', + 0x08 => 'Subwoofer' + ); + + return (isset($RVA2ChannelTypeLookup[$index]) ? $RVA2ChannelTypeLookup[$index] : ''); + } + + public static function FrameNameLongLookup($framename) { + + $begin = __LINE__; + + /** This is not a comment! + + AENC Audio encryption + APIC Attached picture + ASPI Audio seek point index + BUF Recommended buffer size + CNT Play counter + COM Comments + COMM Comments + COMR Commercial frame + CRA Audio encryption + CRM Encrypted meta frame + ENCR Encryption method registration + EQU Equalisation + EQU2 Equalisation (2) + EQUA Equalisation + ETC Event timing codes + ETCO Event timing codes + GEO General encapsulated object + GEOB General encapsulated object + GRID Group identification registration + IPL Involved people list + IPLS Involved people list + LINK Linked information + LNK Linked information + MCDI Music CD identifier + MCI Music CD Identifier + MLL MPEG location lookup table + MLLT MPEG location lookup table + OWNE Ownership frame + PCNT Play counter + PIC Attached picture + POP Popularimeter + POPM Popularimeter + POSS Position synchronisation frame + PRIV Private frame + RBUF Recommended buffer size + REV Reverb + RVA Relative volume adjustment + RVA2 Relative volume adjustment (2) + RVAD Relative volume adjustment + RVRB Reverb + SEEK Seek frame + SIGN Signature frame + SLT Synchronised lyric/text + STC Synced tempo codes + SYLT Synchronised lyric/text + SYTC Synchronised tempo codes + TAL Album/Movie/Show title + TALB Album/Movie/Show title + TBP BPM (Beats Per Minute) + TBPM BPM (beats per minute) + TCM Composer + TCMP Part of a compilation + TCO Content type + TCOM Composer + TCON Content type + TCOP Copyright message + TCP Part of a compilation + TCR Copyright message + TDA Date + TDAT Date + TDEN Encoding time + TDLY Playlist delay + TDOR Original release time + TDRC Recording time + TDRL Release time + TDTG Tagging time + TDY Playlist delay + TEN Encoded by + TENC Encoded by + TEXT Lyricist/Text writer + TFLT File type + TFT File type + TIM Time + TIME Time + TIPL Involved people list + TIT1 Content group description + TIT2 Title/songname/content description + TIT3 Subtitle/Description refinement + TKE Initial key + TKEY Initial key + TLA Language(s) + TLAN Language(s) + TLE Length + TLEN Length + TMCL Musician credits list + TMED Media type + TMOO Mood + TMT Media type + TOA Original artist(s)/performer(s) + TOAL Original album/movie/show title + TOF Original filename + TOFN Original filename + TOL Original Lyricist(s)/text writer(s) + TOLY Original lyricist(s)/text writer(s) + TOPE Original artist(s)/performer(s) + TOR Original release year + TORY Original release year + TOT Original album/Movie/Show title + TOWN File owner/licensee + TP1 Lead artist(s)/Lead performer(s)/Soloist(s)/Performing group + TP2 Band/Orchestra/Accompaniment + TP3 Conductor/Performer refinement + TP4 Interpreted, remixed, or otherwise modified by + TPA Part of a set + TPB Publisher + TPE1 Lead performer(s)/Soloist(s) + TPE2 Band/orchestra/accompaniment + TPE3 Conductor/performer refinement + TPE4 Interpreted, remixed, or otherwise modified by + TPOS Part of a set + TPRO Produced notice + TPUB Publisher + TRC ISRC (International Standard Recording Code) + TRCK Track number/Position in set + TRD Recording dates + TRDA Recording dates + TRK Track number/Position in set + TRSN Internet radio station name + TRSO Internet radio station owner + TS2 Album-Artist sort order + TSA Album sort order + TSC Composer sort order + TSI Size + TSIZ Size + TSO2 Album-Artist sort order + TSOA Album sort order + TSOC Composer sort order + TSOP Performer sort order + TSOT Title sort order + TSP Performer sort order + TSRC ISRC (international standard recording code) + TSS Software/hardware and settings used for encoding + TSSE Software/Hardware and settings used for encoding + TSST Set subtitle + TST Title sort order + TT1 Content group description + TT2 Title/Songname/Content description + TT3 Subtitle/Description refinement + TXT Lyricist/text writer + TXX User defined text information frame + TXXX User defined text information frame + TYE Year + TYER Year + UFI Unique file identifier + UFID Unique file identifier + ULT Unsychronised lyric/text transcription + USER Terms of use + USLT Unsynchronised lyric/text transcription + WAF Official audio file webpage + WAR Official artist/performer webpage + WAS Official audio source webpage + WCM Commercial information + WCOM Commercial information + WCOP Copyright/Legal information + WCP Copyright/Legal information + WOAF Official audio file webpage + WOAR Official artist/performer webpage + WOAS Official audio source webpage + WORS Official Internet radio station homepage + WPAY Payment + WPB Publishers official webpage + WPUB Publishers official webpage + WXX User defined URL link frame + WXXX User defined URL link frame + TFEA Featured Artist + TSTU Recording Studio + rgad Replay Gain Adjustment + + */ + + return getid3_lib::EmbeddedLookup($framename, $begin, __LINE__, __FILE__, 'id3v2-framename_long'); + + // Last three: + // from Helium2 [www.helium2.com] + // from http://privatewww.essex.ac.uk/~djmrob/replaygain/file_format_id3v2.html + } + + + public static function FrameNameShortLookup($framename) { + + $begin = __LINE__; + + /** This is not a comment! + + AENC audio_encryption + APIC attached_picture + ASPI audio_seek_point_index + BUF recommended_buffer_size + CNT play_counter + COM comment + COMM comment + COMR commercial_frame + CRA audio_encryption + CRM encrypted_meta_frame + ENCR encryption_method_registration + EQU equalisation + EQU2 equalisation + EQUA equalisation + ETC event_timing_codes + ETCO event_timing_codes + GEO general_encapsulated_object + GEOB general_encapsulated_object + GRID group_identification_registration + IPL involved_people_list + IPLS involved_people_list + LINK linked_information + LNK linked_information + MCDI music_cd_identifier + MCI music_cd_identifier + MLL mpeg_location_lookup_table + MLLT mpeg_location_lookup_table + OWNE ownership_frame + PCNT play_counter + PIC attached_picture + POP popularimeter + POPM popularimeter + POSS position_synchronisation_frame + PRIV private_frame + RBUF recommended_buffer_size + REV reverb + RVA relative_volume_adjustment + RVA2 relative_volume_adjustment + RVAD relative_volume_adjustment + RVRB reverb + SEEK seek_frame + SIGN signature_frame + SLT synchronised_lyric + STC synced_tempo_codes + SYLT synchronised_lyric + SYTC synchronised_tempo_codes + TAL album + TALB album + TBP bpm + TBPM bpm + TCM composer + TCMP part_of_a_compilation + TCO genre + TCOM composer + TCON genre + TCOP copyright_message + TCP part_of_a_compilation + TCR copyright_message + TDA date + TDAT date + TDEN encoding_time + TDLY playlist_delay + TDOR original_release_time + TDRC recording_time + TDRL release_time + TDTG tagging_time + TDY playlist_delay + TEN encoded_by + TENC encoded_by + TEXT lyricist + TFLT file_type + TFT file_type + TIM time + TIME time + TIPL involved_people_list + TIT1 content_group_description + TIT2 title + TIT3 subtitle + TKE initial_key + TKEY initial_key + TLA language + TLAN language + TLE length + TLEN length + TMCL musician_credits_list + TMED media_type + TMOO mood + TMT media_type + TOA original_artist + TOAL original_album + TOF original_filename + TOFN original_filename + TOL original_lyricist + TOLY original_lyricist + TOPE original_artist + TOR original_year + TORY original_year + TOT original_album + TOWN file_owner + TP1 artist + TP2 band + TP3 conductor + TP4 remixer + TPA part_of_a_set + TPB publisher + TPE1 artist + TPE2 band + TPE3 conductor + TPE4 remixer + TPOS part_of_a_set + TPRO produced_notice + TPUB publisher + TRC isrc + TRCK track_number + TRD recording_dates + TRDA recording_dates + TRK track_number + TRSN internet_radio_station_name + TRSO internet_radio_station_owner + TS2 album_artist_sort_order + TSA album_sort_order + TSC composer_sort_order + TSI size + TSIZ size + TSO2 album_artist_sort_order + TSOA album_sort_order + TSOC composer_sort_order + TSOP performer_sort_order + TSOT title_sort_order + TSP performer_sort_order + TSRC isrc + TSS encoder_settings + TSSE encoder_settings + TSST set_subtitle + TST title_sort_order + TT1 content_group_description + TT2 title + TT3 subtitle + TXT lyricist + TXX text + TXXX text + TYE year + TYER year + UFI unique_file_identifier + UFID unique_file_identifier + ULT unsychronised_lyric + USER terms_of_use + USLT unsynchronised_lyric + WAF url_file + WAR url_artist + WAS url_source + WCM commercial_information + WCOM commercial_information + WCOP copyright + WCP copyright + WOAF url_file + WOAR url_artist + WOAS url_source + WORS url_station + WPAY url_payment + WPB url_publisher + WPUB url_publisher + WXX url_user + WXXX url_user + TFEA featured_artist + TSTU recording_studio + rgad replay_gain_adjustment + + */ + + return getid3_lib::EmbeddedLookup($framename, $begin, __LINE__, __FILE__, 'id3v2-framename_short'); + } + + public static function TextEncodingTerminatorLookup($encoding) { + // http://www.id3.org/id3v2.4.0-structure.txt + // Frames that allow different types of text encoding contains a text encoding description byte. Possible encodings: + static $TextEncodingTerminatorLookup = array( + 0 => "\x00", // $00 ISO-8859-1. Terminated with $00. + 1 => "\x00\x00", // $01 UTF-16 encoded Unicode with BOM. All strings in the same frame SHALL have the same byteorder. Terminated with $00 00. + 2 => "\x00\x00", // $02 UTF-16BE encoded Unicode without BOM. Terminated with $00 00. + 3 => "\x00", // $03 UTF-8 encoded Unicode. Terminated with $00. + 255 => "\x00\x00" + ); + return (isset($TextEncodingTerminatorLookup[$encoding]) ? $TextEncodingTerminatorLookup[$encoding] : "\x00"); + } + + public static function TextEncodingNameLookup($encoding) { + // http://www.id3.org/id3v2.4.0-structure.txt + // Frames that allow different types of text encoding contains a text encoding description byte. Possible encodings: + static $TextEncodingNameLookup = array( + 0 => 'ISO-8859-1', // $00 ISO-8859-1. Terminated with $00. + 1 => 'UTF-16', // $01 UTF-16 encoded Unicode with BOM. All strings in the same frame SHALL have the same byteorder. Terminated with $00 00. + 2 => 'UTF-16BE', // $02 UTF-16BE encoded Unicode without BOM. Terminated with $00 00. + 3 => 'UTF-8', // $03 UTF-8 encoded Unicode. Terminated with $00. + 255 => 'UTF-16BE' + ); + return (isset($TextEncodingNameLookup[$encoding]) ? $TextEncodingNameLookup[$encoding] : 'ISO-8859-1'); + } + + public static function IsValidID3v2FrameName($framename, $id3v2majorversion) { + switch ($id3v2majorversion) { + case 2: + return preg_match('#[A-Z][A-Z0-9]{2}#', $framename); + break; + + case 3: + case 4: + return preg_match('#[A-Z][A-Z0-9]{3}#', $framename); + break; + } + return false; + } + + public static function IsANumber($numberstring, $allowdecimal=false, $allownegative=false) { + for ($i = 0; $i < strlen($numberstring); $i++) { + if ((chr($numberstring{$i}) < chr('0')) || (chr($numberstring{$i}) > chr('9'))) { + if (($numberstring{$i} == '.') && $allowdecimal) { + // allowed + } elseif (($numberstring{$i} == '-') && $allownegative && ($i == 0)) { + // allowed + } else { + return false; + } + } + } + return true; + } + + public static function IsValidDateStampString($datestamp) { + if (strlen($datestamp) != 8) { + return false; + } + if (!self::IsANumber($datestamp, false)) { + return false; + } + $year = substr($datestamp, 0, 4); + $month = substr($datestamp, 4, 2); + $day = substr($datestamp, 6, 2); + if (($year == 0) || ($month == 0) || ($day == 0)) { + return false; + } + if ($month > 12) { + return false; + } + if ($day > 31) { + return false; + } + if (($day > 30) && (($month == 4) || ($month == 6) || ($month == 9) || ($month == 11))) { + return false; + } + if (($day > 29) && ($month == 2)) { + return false; + } + return true; + } + + public static function ID3v2HeaderLength($majorversion) { + return (($majorversion == 2) ? 6 : 10); + } + + public static function ID3v22iTunesBrokenFrameName($frame_name) { + // iTunes (multiple versions) has been known to write ID3v2.3 style frames + // but use ID3v2.2 frame names, right-padded using either [space] or [null] + // to make them fit in the 4-byte frame name space of the ID3v2.3 frame. + // This function will detect and translate the corrupt frame name into ID3v2.3 standard. + static $ID3v22_iTunes_BrokenFrames = array( + 'BUF' => 'RBUF', // Recommended buffer size + 'CNT' => 'PCNT', // Play counter + 'COM' => 'COMM', // Comments + 'CRA' => 'AENC', // Audio encryption + 'EQU' => 'EQUA', // Equalisation + 'ETC' => 'ETCO', // Event timing codes + 'GEO' => 'GEOB', // General encapsulated object + 'IPL' => 'IPLS', // Involved people list + 'LNK' => 'LINK', // Linked information + 'MCI' => 'MCDI', // Music CD identifier + 'MLL' => 'MLLT', // MPEG location lookup table + 'PIC' => 'APIC', // Attached picture + 'POP' => 'POPM', // Popularimeter + 'REV' => 'RVRB', // Reverb + 'RVA' => 'RVAD', // Relative volume adjustment + 'SLT' => 'SYLT', // Synchronised lyric/text + 'STC' => 'SYTC', // Synchronised tempo codes + 'TAL' => 'TALB', // Album/Movie/Show title + 'TBP' => 'TBPM', // BPM (beats per minute) + 'TCM' => 'TCOM', // Composer + 'TCO' => 'TCON', // Content type + 'TCP' => 'TCMP', // Part of a compilation + 'TCR' => 'TCOP', // Copyright message + 'TDA' => 'TDAT', // Date + 'TDY' => 'TDLY', // Playlist delay + 'TEN' => 'TENC', // Encoded by + 'TFT' => 'TFLT', // File type + 'TIM' => 'TIME', // Time + 'TKE' => 'TKEY', // Initial key + 'TLA' => 'TLAN', // Language(s) + 'TLE' => 'TLEN', // Length + 'TMT' => 'TMED', // Media type + 'TOA' => 'TOPE', // Original artist(s)/performer(s) + 'TOF' => 'TOFN', // Original filename + 'TOL' => 'TOLY', // Original lyricist(s)/text writer(s) + 'TOR' => 'TORY', // Original release year + 'TOT' => 'TOAL', // Original album/movie/show title + 'TP1' => 'TPE1', // Lead performer(s)/Soloist(s) + 'TP2' => 'TPE2', // Band/orchestra/accompaniment + 'TP3' => 'TPE3', // Conductor/performer refinement + 'TP4' => 'TPE4', // Interpreted, remixed, or otherwise modified by + 'TPA' => 'TPOS', // Part of a set + 'TPB' => 'TPUB', // Publisher + 'TRC' => 'TSRC', // ISRC (international standard recording code) + 'TRD' => 'TRDA', // Recording dates + 'TRK' => 'TRCK', // Track number/Position in set + 'TS2' => 'TSO2', // Album-Artist sort order + 'TSA' => 'TSOA', // Album sort order + 'TSC' => 'TSOC', // Composer sort order + 'TSI' => 'TSIZ', // Size + 'TSP' => 'TSOP', // Performer sort order + 'TSS' => 'TSSE', // Software/Hardware and settings used for encoding + 'TST' => 'TSOT', // Title sort order + 'TT1' => 'TIT1', // Content group description + 'TT2' => 'TIT2', // Title/songname/content description + 'TT3' => 'TIT3', // Subtitle/Description refinement + 'TXT' => 'TEXT', // Lyricist/Text writer + 'TXX' => 'TXXX', // User defined text information frame + 'TYE' => 'TYER', // Year + 'UFI' => 'UFID', // Unique file identifier + 'ULT' => 'USLT', // Unsynchronised lyric/text transcription + 'WAF' => 'WOAF', // Official audio file webpage + 'WAR' => 'WOAR', // Official artist/performer webpage + 'WAS' => 'WOAS', // Official audio source webpage + 'WCM' => 'WCOM', // Commercial information + 'WCP' => 'WCOP', // Copyright/Legal information + 'WPB' => 'WPUB', // Publishers official webpage + 'WXX' => 'WXXX', // User defined URL link frame + ); + if (strlen($frame_name) == 4) { + if ((substr($frame_name, 3, 1) == ' ') || (substr($frame_name, 3, 1) == "\x00")) { + if (isset($ID3v22_iTunes_BrokenFrames[substr($frame_name, 0, 3)])) { + return $ID3v22_iTunes_BrokenFrames[substr($frame_name, 0, 3)]; + } + } + } + return false; + } + +} + diff --git a/www/rompr/getid3/module.tag.lyrics3.php b/www/rompr/getid3/module.tag.lyrics3.php new file mode 100644 index 0000000..1645396 --- /dev/null +++ b/www/rompr/getid3/module.tag.lyrics3.php @@ -0,0 +1,298 @@ + // +// available at http://getid3.sourceforge.net // +// or http://www.getid3.org // +// also https://github.com/JamesHeinrich/getID3 // +///////////////////////////////////////////////////////////////// +// See readme.txt for more details // +///////////////////////////////////////////////////////////////// +/// // +// module.tag.lyrics3.php // +// module for analyzing Lyrics3 tags // +// dependencies: module.tag.apetag.php (optional) // +// /// +///////////////////////////////////////////////////////////////// + + +class getid3_lyrics3 extends getid3_handler +{ + + public function Analyze() { + $info = &$this->getid3->info; + + // http://www.volweb.cz/str/tags.htm + + if (!getid3_lib::intValueSupported($info['filesize'])) { + $this->warning('Unable to check for Lyrics3 because file is larger than '.round(PHP_INT_MAX / 1073741824).'GB'); + return false; + } + + $this->fseek((0 - 128 - 9 - 6), SEEK_END); // end - ID3v1 - "LYRICSEND" - [Lyrics3size] + $lyrics3_id3v1 = $this->fread(128 + 9 + 6); + $lyrics3lsz = substr($lyrics3_id3v1, 0, 6); // Lyrics3size + $lyrics3end = substr($lyrics3_id3v1, 6, 9); // LYRICSEND or LYRICS200 + $id3v1tag = substr($lyrics3_id3v1, 15, 128); // ID3v1 + + if ($lyrics3end == 'LYRICSEND') { + // Lyrics3v1, ID3v1, no APE + + $lyrics3size = 5100; + $lyrics3offset = $info['filesize'] - 128 - $lyrics3size; + $lyrics3version = 1; + + } elseif ($lyrics3end == 'LYRICS200') { + // Lyrics3v2, ID3v1, no APE + + // LSZ = lyrics + 'LYRICSBEGIN'; add 6-byte size field; add 'LYRICS200' + $lyrics3size = $lyrics3lsz + 6 + strlen('LYRICS200'); + $lyrics3offset = $info['filesize'] - 128 - $lyrics3size; + $lyrics3version = 2; + + } elseif (substr(strrev($lyrics3_id3v1), 0, 9) == strrev('LYRICSEND')) { + // Lyrics3v1, no ID3v1, no APE + + $lyrics3size = 5100; + $lyrics3offset = $info['filesize'] - $lyrics3size; + $lyrics3version = 1; + $lyrics3offset = $info['filesize'] - $lyrics3size; + + } elseif (substr(strrev($lyrics3_id3v1), 0, 9) == strrev('LYRICS200')) { + + // Lyrics3v2, no ID3v1, no APE + + $lyrics3size = strrev(substr(strrev($lyrics3_id3v1), 9, 6)) + 6 + strlen('LYRICS200'); // LSZ = lyrics + 'LYRICSBEGIN'; add 6-byte size field; add 'LYRICS200' + $lyrics3offset = $info['filesize'] - $lyrics3size; + $lyrics3version = 2; + + } else { + + if (isset($info['ape']['tag_offset_start']) && ($info['ape']['tag_offset_start'] > 15)) { + + $this->fseek($info['ape']['tag_offset_start'] - 15); + $lyrics3lsz = $this->fread(6); + $lyrics3end = $this->fread(9); + + if ($lyrics3end == 'LYRICSEND') { + // Lyrics3v1, APE, maybe ID3v1 + + $lyrics3size = 5100; + $lyrics3offset = $info['ape']['tag_offset_start'] - $lyrics3size; + $info['avdataend'] = $lyrics3offset; + $lyrics3version = 1; + $this->warning('APE tag located after Lyrics3, will probably break Lyrics3 compatability'); + + } elseif ($lyrics3end == 'LYRICS200') { + // Lyrics3v2, APE, maybe ID3v1 + + $lyrics3size = $lyrics3lsz + 6 + strlen('LYRICS200'); // LSZ = lyrics + 'LYRICSBEGIN'; add 6-byte size field; add 'LYRICS200' + $lyrics3offset = $info['ape']['tag_offset_start'] - $lyrics3size; + $lyrics3version = 2; + $this->warning('APE tag located after Lyrics3, will probably break Lyrics3 compatability'); + + } + + } + + } + + if (isset($lyrics3offset)) { + $info['avdataend'] = $lyrics3offset; + $this->getLyrics3Data($lyrics3offset, $lyrics3version, $lyrics3size); + + if (!isset($info['ape'])) { + if (isset($info['lyrics3']['tag_offset_start'])) { + $GETID3_ERRORARRAY = &$info['warning']; + getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.tag.apetag.php', __FILE__, true); + $getid3_temp = new getID3(); + $getid3_temp->openfile($this->getid3->filename); + $getid3_apetag = new getid3_apetag($getid3_temp); + $getid3_apetag->overrideendoffset = $info['lyrics3']['tag_offset_start']; + $getid3_apetag->Analyze(); + if (!empty($getid3_temp->info['ape'])) { + $info['ape'] = $getid3_temp->info['ape']; + } + if (!empty($getid3_temp->info['replay_gain'])) { + $info['replay_gain'] = $getid3_temp->info['replay_gain']; + } + unset($getid3_temp, $getid3_apetag); + } else { + $this->warning('Lyrics3 and APE tags appear to have become entangled (most likely due to updating the APE tags with a non-Lyrics3-aware tagger)'); + } + } + + } + + return true; + } + + public function getLyrics3Data($endoffset, $version, $length) { + // http://www.volweb.cz/str/tags.htm + + $info = &$this->getid3->info; + + if (!getid3_lib::intValueSupported($endoffset)) { + $this->warning('Unable to check for Lyrics3 because file is larger than '.round(PHP_INT_MAX / 1073741824).'GB'); + return false; + } + + $this->fseek($endoffset); + if ($length <= 0) { + return false; + } + $rawdata = $this->fread($length); + + $ParsedLyrics3['raw']['lyrics3version'] = $version; + $ParsedLyrics3['raw']['lyrics3tagsize'] = $length; + $ParsedLyrics3['tag_offset_start'] = $endoffset; + $ParsedLyrics3['tag_offset_end'] = $endoffset + $length - 1; + + if (substr($rawdata, 0, 11) != 'LYRICSBEGIN') { + if (strpos($rawdata, 'LYRICSBEGIN') !== false) { + + $this->warning('"LYRICSBEGIN" expected at '.$endoffset.' but actually found at '.($endoffset + strpos($rawdata, 'LYRICSBEGIN')).' - this is invalid for Lyrics3 v'.$version); + $info['avdataend'] = $endoffset + strpos($rawdata, 'LYRICSBEGIN'); + $rawdata = substr($rawdata, strpos($rawdata, 'LYRICSBEGIN')); + $length = strlen($rawdata); + $ParsedLyrics3['tag_offset_start'] = $info['avdataend']; + $ParsedLyrics3['raw']['lyrics3tagsize'] = $length; + + } else { + + $this->error('"LYRICSBEGIN" expected at '.$endoffset.' but found "'.substr($rawdata, 0, 11).'" instead'); + return false; + + } + + } + + switch ($version) { + + case 1: + if (substr($rawdata, strlen($rawdata) - 9, 9) == 'LYRICSEND') { + $ParsedLyrics3['raw']['LYR'] = trim(substr($rawdata, 11, strlen($rawdata) - 11 - 9)); + $this->Lyrics3LyricsTimestampParse($ParsedLyrics3); + } else { + $this->error('"LYRICSEND" expected at '.($this->ftell() - 11 + $length - 9).' but found "'.substr($rawdata, strlen($rawdata) - 9, 9).'" instead'); + return false; + } + break; + + case 2: + if (substr($rawdata, strlen($rawdata) - 9, 9) == 'LYRICS200') { + $ParsedLyrics3['raw']['unparsed'] = substr($rawdata, 11, strlen($rawdata) - 11 - 9 - 6); // LYRICSBEGIN + LYRICS200 + LSZ + $rawdata = $ParsedLyrics3['raw']['unparsed']; + while (strlen($rawdata) > 0) { + $fieldname = substr($rawdata, 0, 3); + $fieldsize = (int) substr($rawdata, 3, 5); + $ParsedLyrics3['raw'][$fieldname] = substr($rawdata, 8, $fieldsize); + $rawdata = substr($rawdata, 3 + 5 + $fieldsize); + } + + if (isset($ParsedLyrics3['raw']['IND'])) { + $i = 0; + $flagnames = array('lyrics', 'timestamps', 'inhibitrandom'); + foreach ($flagnames as $flagname) { + if (strlen($ParsedLyrics3['raw']['IND']) > $i++) { + $ParsedLyrics3['flags'][$flagname] = $this->IntString2Bool(substr($ParsedLyrics3['raw']['IND'], $i, 1 - 1)); + } + } + } + + $fieldnametranslation = array('ETT'=>'title', 'EAR'=>'artist', 'EAL'=>'album', 'INF'=>'comment', 'AUT'=>'author'); + foreach ($fieldnametranslation as $key => $value) { + if (isset($ParsedLyrics3['raw'][$key])) { + $ParsedLyrics3['comments'][$value][] = trim($ParsedLyrics3['raw'][$key]); + } + } + + if (isset($ParsedLyrics3['raw']['IMG'])) { + $imagestrings = explode("\r\n", $ParsedLyrics3['raw']['IMG']); + foreach ($imagestrings as $key => $imagestring) { + if (strpos($imagestring, '||') !== false) { + $imagearray = explode('||', $imagestring); + $ParsedLyrics3['images'][$key]['filename'] = (isset($imagearray[0]) ? $imagearray[0] : ''); + $ParsedLyrics3['images'][$key]['description'] = (isset($imagearray[1]) ? $imagearray[1] : ''); + $ParsedLyrics3['images'][$key]['timestamp'] = $this->Lyrics3Timestamp2Seconds(isset($imagearray[2]) ? $imagearray[2] : ''); + } + } + } + if (isset($ParsedLyrics3['raw']['LYR'])) { + $this->Lyrics3LyricsTimestampParse($ParsedLyrics3); + } + } else { + $this->error('"LYRICS200" expected at '.($this->ftell() - 11 + $length - 9).' but found "'.substr($rawdata, strlen($rawdata) - 9, 9).'" instead'); + return false; + } + break; + + default: + $this->error('Cannot process Lyrics3 version '.$version.' (only v1 and v2)'); + return false; + break; + } + + + if (isset($info['id3v1']['tag_offset_start']) && ($info['id3v1']['tag_offset_start'] <= $ParsedLyrics3['tag_offset_end'])) { + $this->warning('ID3v1 tag information ignored since it appears to be a false synch in Lyrics3 tag data'); + unset($info['id3v1']); + foreach ($info['warning'] as $key => $value) { + if ($value == 'Some ID3v1 fields do not use NULL characters for padding') { + unset($info['warning'][$key]); + sort($info['warning']); + break; + } + } + } + + $info['lyrics3'] = $ParsedLyrics3; + + return true; + } + + public function Lyrics3Timestamp2Seconds($rawtimestamp) { + if (preg_match('#^\\[([0-9]{2}):([0-9]{2})\\]$#', $rawtimestamp, $regs)) { + return (int) (($regs[1] * 60) + $regs[2]); + } + return false; + } + + public function Lyrics3LyricsTimestampParse(&$Lyrics3data) { + $lyricsarray = explode("\r\n", $Lyrics3data['raw']['LYR']); + foreach ($lyricsarray as $key => $lyricline) { + $regs = array(); + unset($thislinetimestamps); + while (preg_match('#^(\\[[0-9]{2}:[0-9]{2}\\])#', $lyricline, $regs)) { + $thislinetimestamps[] = $this->Lyrics3Timestamp2Seconds($regs[0]); + $lyricline = str_replace($regs[0], '', $lyricline); + } + $notimestamplyricsarray[$key] = $lyricline; + if (isset($thislinetimestamps) && is_array($thislinetimestamps)) { + sort($thislinetimestamps); + foreach ($thislinetimestamps as $timestampkey => $timestamp) { + if (isset($Lyrics3data['synchedlyrics'][$timestamp])) { + // timestamps only have a 1-second resolution, it's possible that multiple lines + // could have the same timestamp, if so, append + $Lyrics3data['synchedlyrics'][$timestamp] .= "\r\n".$lyricline; + } else { + $Lyrics3data['synchedlyrics'][$timestamp] = $lyricline; + } + } + } + } + $Lyrics3data['unsynchedlyrics'] = implode("\r\n", $notimestamplyricsarray); + if (isset($Lyrics3data['synchedlyrics']) && is_array($Lyrics3data['synchedlyrics'])) { + ksort($Lyrics3data['synchedlyrics']); + } + return true; + } + + public function IntString2Bool($char) { + if ($char == '1') { + return true; + } elseif ($char == '0') { + return false; + } + return null; + } +} diff --git a/www/rompr/getid3/module.tag.xmp.php b/www/rompr/getid3/module.tag.xmp.php new file mode 100644 index 0000000..40dd8bd --- /dev/null +++ b/www/rompr/getid3/module.tag.xmp.php @@ -0,0 +1,768 @@ + // +// available at http://getid3.sourceforge.net // +// or http://www.getid3.org // +// also https://github.com/JamesHeinrich/getID3 // +///////////////////////////////////////////////////////////////// +// See readme.txt for more details // +///////////////////////////////////////////////////////////////// +// // +// module.tag.xmp.php // +// module for analyzing XMP metadata (e.g. in JPEG files) // +// dependencies: NONE // +// // +///////////////////////////////////////////////////////////////// +// // +// Module originally written [2009-Mar-26] by // +// Nigel Barnes // +// Bundled into getID3 with permission // +// called by getID3 in module.graphic.jpg.php // +// /// +///////////////////////////////////////////////////////////////// + +/************************************************************************************************** + * SWISScenter Source Nigel Barnes + * + * Provides functions for reading information from the 'APP1' Extensible Metadata + * Platform (XMP) segment of JPEG format files. + * This XMP segment is XML based and contains the Resource Description Framework (RDF) + * data, which itself can contain the Dublin Core Metadata Initiative (DCMI) information. + * + * This code uses segments from the JPEG Metadata Toolkit project by Evan Hunter. + *************************************************************************************************/ +class Image_XMP +{ + /** + * @var string + * The name of the image file that contains the XMP fields to extract and modify. + * @see Image_XMP() + */ + public $_sFilename = null; + + /** + * @var array + * The XMP fields that were extracted from the image or updated by this class. + * @see getAllTags() + */ + public $_aXMP = array(); + + /** + * @var boolean + * True if an APP1 segment was found to contain XMP metadata. + * @see isValid() + */ + public $_bXMPParse = false; + + /** + * Returns the status of XMP parsing during instantiation + * + * You'll normally want to call this method before trying to get XMP fields. + * + * @return boolean + * Returns true if an APP1 segment was found to contain XMP metadata. + */ + public function isValid() + { + return $this->_bXMPParse; + } + + /** + * Get a copy of all XMP tags extracted from the image + * + * @return array - An array of XMP fields as it extracted by the XMPparse() function + */ + public function getAllTags() + { + return $this->_aXMP; + } + + /** + * Reads all the JPEG header segments from an JPEG image file into an array + * + * @param string $filename - the filename of the JPEG file to read + * @return array $headerdata - Array of JPEG header segments + * @return boolean FALSE - if headers could not be read + */ + public function _get_jpeg_header_data($filename) + { + // prevent refresh from aborting file operations and hosing file + ignore_user_abort(true); + + // Attempt to open the jpeg file - the at symbol supresses the error message about + // not being able to open files. The file_exists would have been used, but it + // does not work with files fetched over http or ftp. + if (is_readable($filename) && is_file($filename) && ($filehnd = fopen($filename, 'rb'))) { + // great + } else { + return false; + } + + // Read the first two characters + $data = fread($filehnd, 2); + + // Check that the first two characters are 0xFF 0xD8 (SOI - Start of image) + if ($data != "\xFF\xD8") + { + // No SOI (FF D8) at start of file - This probably isn't a JPEG file - close file and return; + echo '

      This probably is not a JPEG file

      '."\n"; + fclose($filehnd); + return false; + } + + // Read the third character + $data = fread($filehnd, 2); + + // Check that the third character is 0xFF (Start of first segment header) + if ($data{0} != "\xFF") + { + // NO FF found - close file and return - JPEG is probably corrupted + fclose($filehnd); + return false; + } + + // Flag that we havent yet hit the compressed image data + $hit_compressed_image_data = false; + + // Cycle through the file until, one of: 1) an EOI (End of image) marker is hit, + // 2) we have hit the compressed image data (no more headers are allowed after data) + // 3) or end of file is hit + + while (($data{1} != "\xD9") && (!$hit_compressed_image_data) && (!feof($filehnd))) + { + // Found a segment to look at. + // Check that the segment marker is not a Restart marker - restart markers don't have size or data after them + if ((ord($data{1}) < 0xD0) || (ord($data{1}) > 0xD7)) + { + // Segment isn't a Restart marker + // Read the next two bytes (size) + $sizestr = fread($filehnd, 2); + + // convert the size bytes to an integer + $decodedsize = unpack('nsize', $sizestr); + + // Save the start position of the data + $segdatastart = ftell($filehnd); + + // Read the segment data with length indicated by the previously read size + $segdata = fread($filehnd, $decodedsize['size'] - 2); + + // Store the segment information in the output array + $headerdata[] = array( + 'SegType' => ord($data{1}), + 'SegName' => $GLOBALS['JPEG_Segment_Names'][ord($data{1})], + 'SegDataStart' => $segdatastart, + 'SegData' => $segdata, + ); + } + + // If this is a SOS (Start Of Scan) segment, then there is no more header data - the compressed image data follows + if ($data{1} == "\xDA") + { + // Flag that we have hit the compressed image data - exit loop as no more headers available. + $hit_compressed_image_data = true; + } + else + { + // Not an SOS - Read the next two bytes - should be the segment marker for the next segment + $data = fread($filehnd, 2); + + // Check that the first byte of the two is 0xFF as it should be for a marker + if ($data{0} != "\xFF") + { + // NO FF found - close file and return - JPEG is probably corrupted + fclose($filehnd); + return false; + } + } + } + + // Close File + fclose($filehnd); + // Alow the user to abort from now on + ignore_user_abort(false); + + // Return the header data retrieved + return $headerdata; + } + + + /** + * Retrieves XMP information from an APP1 JPEG segment and returns the raw XML text as a string. + * + * @param string $filename - the filename of the JPEG file to read + * @return string $xmp_data - the string of raw XML text + * @return boolean FALSE - if an APP 1 XMP segment could not be found, or if an error occured + */ + public function _get_XMP_text($filename) + { + //Get JPEG header data + $jpeg_header_data = $this->_get_jpeg_header_data($filename); + + //Cycle through the header segments + for ($i = 0; $i < count($jpeg_header_data); $i++) + { + // If we find an APP1 header, + if (strcmp($jpeg_header_data[$i]['SegName'], 'APP1') == 0) + { + // And if it has the Adobe XMP/RDF label (http://ns.adobe.com/xap/1.0/\x00) , + if (strncmp($jpeg_header_data[$i]['SegData'], 'http://ns.adobe.com/xap/1.0/'."\x00", 29) == 0) + { + // Found a XMP/RDF block + // Return the XMP text + $xmp_data = substr($jpeg_header_data[$i]['SegData'], 29); + + return trim($xmp_data); // trim() should not be neccesary, but some files found in the wild with null-terminated block (known samples from Apple Aperture) causes problems elsewhere (see http://www.getid3.org/phpBB3/viewtopic.php?f=4&t=1153) + } + } + } + return false; + } + + /** + * Parses a string containing XMP data (XML), and returns an array + * which contains all the XMP (XML) information. + * + * @param string $xml_text - a string containing the XMP data (XML) to be parsed + * @return array $xmp_array - an array containing all xmp details retrieved. + * @return boolean FALSE - couldn't parse the XMP data + */ + public function read_XMP_array_from_text($xmltext) + { + // Check if there actually is any text to parse + if (trim($xmltext) == '') + { + return false; + } + + // Create an instance of a xml parser to parse the XML text + $xml_parser = xml_parser_create('UTF-8'); + + // Change: Fixed problem that caused the whitespace (especially newlines) to be destroyed when converting xml text to an xml array, as of revision 1.10 + + // We would like to remove unneccessary white space, but this will also + // remove things like newlines ( ) in the XML values, so white space + // will have to be removed later + if (xml_parser_set_option($xml_parser, XML_OPTION_SKIP_WHITE, 0) == false) + { + // Error setting case folding - destroy the parser and return + xml_parser_free($xml_parser); + return false; + } + + // to use XML code correctly we have to turn case folding + // (uppercasing) off. XML is case sensitive and upper + // casing is in reality XML standards violation + if (xml_parser_set_option($xml_parser, XML_OPTION_CASE_FOLDING, 0) == false) + { + // Error setting case folding - destroy the parser and return + xml_parser_free($xml_parser); + return false; + } + + // Parse the XML text into a array structure + if (xml_parse_into_struct($xml_parser, $xmltext, $values, $tags) == 0) + { + // Error Parsing XML - destroy the parser and return + xml_parser_free($xml_parser); + return false; + } + + // Destroy the xml parser + xml_parser_free($xml_parser); + + // Clear the output array + $xmp_array = array(); + + // The XMP data has now been parsed into an array ... + + // Cycle through each of the array elements + $current_property = ''; // current property being processed + $container_index = -1; // -1 = no container open, otherwise index of container content + foreach ($values as $xml_elem) + { + // Syntax and Class names + switch ($xml_elem['tag']) + { + case 'x:xmpmeta': + // only defined attribute is x:xmptk written by Adobe XMP Toolkit; value is the version of the toolkit + break; + + case 'rdf:RDF': + // required element immediately within x:xmpmeta; no data here + break; + + case 'rdf:Description': + switch ($xml_elem['type']) + { + case 'open': + case 'complete': + if (array_key_exists('attributes', $xml_elem)) + { + // rdf:Description may contain wanted attributes + foreach (array_keys($xml_elem['attributes']) as $key) + { + // Check whether we want this details from this attribute +// if (in_array($key, $GLOBALS['XMP_tag_captions'])) + if (true) + { + // Attribute wanted + $xmp_array[$key] = $xml_elem['attributes'][$key]; + } + } + } + case 'cdata': + case 'close': + break; + } + + case 'rdf:ID': + case 'rdf:nodeID': + // Attributes are ignored + break; + + case 'rdf:li': + // Property member + if ($xml_elem['type'] == 'complete') + { + if (array_key_exists('attributes', $xml_elem)) + { + // If Lang Alt (language alternatives) then ensure we take the default language + if (isset($xml_elem['attributes']['xml:lang']) && ($xml_elem['attributes']['xml:lang'] != 'x-default')) + { + break; + } + } + if ($current_property != '') + { + $xmp_array[$current_property][$container_index] = (isset($xml_elem['value']) ? $xml_elem['value'] : ''); + $container_index += 1; + } + //else unidentified attribute!! + } + break; + + case 'rdf:Seq': + case 'rdf:Bag': + case 'rdf:Alt': + // Container found + switch ($xml_elem['type']) + { + case 'open': + $container_index = 0; + break; + case 'close': + $container_index = -1; + break; + case 'cdata': + break; + } + break; + + default: + // Check whether we want the details from this attribute +// if (in_array($xml_elem['tag'], $GLOBALS['XMP_tag_captions'])) + if (true) + { + switch ($xml_elem['type']) + { + case 'open': + // open current element + $current_property = $xml_elem['tag']; + break; + + case 'close': + // close current element + $current_property = ''; + break; + + case 'complete': + // store attribute value + $xmp_array[$xml_elem['tag']] = (isset($xml_elem['attributes']) ? $xml_elem['attributes'] : (isset($xml_elem['value']) ? $xml_elem['value'] : '')); + break; + + case 'cdata': + // ignore + break; + } + } + break; + } + + } + return $xmp_array; + } + + + /** + * Constructor + * + * @param string - Name of the image file to access and extract XMP information from. + */ + public function __construct($sFilename) + { + $this->_sFilename = $sFilename; + + if (is_file($this->_sFilename)) + { + // Get XMP data + $xmp_data = $this->_get_XMP_text($sFilename); + if ($xmp_data) + { + $this->_aXMP = $this->read_XMP_array_from_text($xmp_data); + $this->_bXMPParse = true; + } + } + } + +} + +/** +* Global Variable: XMP_tag_captions +* +* The Property names of all known XMP fields. +* Note: this is a full list with unrequired properties commented out. +*/ +/* +$GLOBALS['XMP_tag_captions'] = array( +// IPTC Core + 'Iptc4xmpCore:CiAdrCity', + 'Iptc4xmpCore:CiAdrCtry', + 'Iptc4xmpCore:CiAdrExtadr', + 'Iptc4xmpCore:CiAdrPcode', + 'Iptc4xmpCore:CiAdrRegion', + 'Iptc4xmpCore:CiEmailWork', + 'Iptc4xmpCore:CiTelWork', + 'Iptc4xmpCore:CiUrlWork', + 'Iptc4xmpCore:CountryCode', + 'Iptc4xmpCore:CreatorContactInfo', + 'Iptc4xmpCore:IntellectualGenre', + 'Iptc4xmpCore:Location', + 'Iptc4xmpCore:Scene', + 'Iptc4xmpCore:SubjectCode', +// Dublin Core Schema + 'dc:contributor', + 'dc:coverage', + 'dc:creator', + 'dc:date', + 'dc:description', + 'dc:format', + 'dc:identifier', + 'dc:language', + 'dc:publisher', + 'dc:relation', + 'dc:rights', + 'dc:source', + 'dc:subject', + 'dc:title', + 'dc:type', +// XMP Basic Schema + 'xmp:Advisory', + 'xmp:BaseURL', + 'xmp:CreateDate', + 'xmp:CreatorTool', + 'xmp:Identifier', + 'xmp:Label', + 'xmp:MetadataDate', + 'xmp:ModifyDate', + 'xmp:Nickname', + 'xmp:Rating', + 'xmp:Thumbnails', + 'xmpidq:Scheme', +// XMP Rights Management Schema + 'xmpRights:Certificate', + 'xmpRights:Marked', + 'xmpRights:Owner', + 'xmpRights:UsageTerms', + 'xmpRights:WebStatement', +// These are not in spec but Photoshop CS seems to use them + 'xap:Advisory', + 'xap:BaseURL', + 'xap:CreateDate', + 'xap:CreatorTool', + 'xap:Identifier', + 'xap:MetadataDate', + 'xap:ModifyDate', + 'xap:Nickname', + 'xap:Rating', + 'xap:Thumbnails', + 'xapidq:Scheme', + 'xapRights:Certificate', + 'xapRights:Copyright', + 'xapRights:Marked', + 'xapRights:Owner', + 'xapRights:UsageTerms', + 'xapRights:WebStatement', +// XMP Media Management Schema + 'xapMM:DerivedFrom', + 'xapMM:DocumentID', + 'xapMM:History', + 'xapMM:InstanceID', + 'xapMM:ManagedFrom', + 'xapMM:Manager', + 'xapMM:ManageTo', + 'xapMM:ManageUI', + 'xapMM:ManagerVariant', + 'xapMM:RenditionClass', + 'xapMM:RenditionParams', + 'xapMM:VersionID', + 'xapMM:Versions', + 'xapMM:LastURL', + 'xapMM:RenditionOf', + 'xapMM:SaveID', +// XMP Basic Job Ticket Schema + 'xapBJ:JobRef', +// XMP Paged-Text Schema + 'xmpTPg:MaxPageSize', + 'xmpTPg:NPages', + 'xmpTPg:Fonts', + 'xmpTPg:Colorants', + 'xmpTPg:PlateNames', +// Adobe PDF Schema + 'pdf:Keywords', + 'pdf:PDFVersion', + 'pdf:Producer', +// Photoshop Schema + 'photoshop:AuthorsPosition', + 'photoshop:CaptionWriter', + 'photoshop:Category', + 'photoshop:City', + 'photoshop:Country', + 'photoshop:Credit', + 'photoshop:DateCreated', + 'photoshop:Headline', + 'photoshop:History', +// Not in XMP spec + 'photoshop:Instructions', + 'photoshop:Source', + 'photoshop:State', + 'photoshop:SupplementalCategories', + 'photoshop:TransmissionReference', + 'photoshop:Urgency', +// EXIF Schemas + 'tiff:ImageWidth', + 'tiff:ImageLength', + 'tiff:BitsPerSample', + 'tiff:Compression', + 'tiff:PhotometricInterpretation', + 'tiff:Orientation', + 'tiff:SamplesPerPixel', + 'tiff:PlanarConfiguration', + 'tiff:YCbCrSubSampling', + 'tiff:YCbCrPositioning', + 'tiff:XResolution', + 'tiff:YResolution', + 'tiff:ResolutionUnit', + 'tiff:TransferFunction', + 'tiff:WhitePoint', + 'tiff:PrimaryChromaticities', + 'tiff:YCbCrCoefficients', + 'tiff:ReferenceBlackWhite', + 'tiff:DateTime', + 'tiff:ImageDescription', + 'tiff:Make', + 'tiff:Model', + 'tiff:Software', + 'tiff:Artist', + 'tiff:Copyright', + 'exif:ExifVersion', + 'exif:FlashpixVersion', + 'exif:ColorSpace', + 'exif:ComponentsConfiguration', + 'exif:CompressedBitsPerPixel', + 'exif:PixelXDimension', + 'exif:PixelYDimension', + 'exif:MakerNote', + 'exif:UserComment', + 'exif:RelatedSoundFile', + 'exif:DateTimeOriginal', + 'exif:DateTimeDigitized', + 'exif:ExposureTime', + 'exif:FNumber', + 'exif:ExposureProgram', + 'exif:SpectralSensitivity', + 'exif:ISOSpeedRatings', + 'exif:OECF', + 'exif:ShutterSpeedValue', + 'exif:ApertureValue', + 'exif:BrightnessValue', + 'exif:ExposureBiasValue', + 'exif:MaxApertureValue', + 'exif:SubjectDistance', + 'exif:MeteringMode', + 'exif:LightSource', + 'exif:Flash', + 'exif:FocalLength', + 'exif:SubjectArea', + 'exif:FlashEnergy', + 'exif:SpatialFrequencyResponse', + 'exif:FocalPlaneXResolution', + 'exif:FocalPlaneYResolution', + 'exif:FocalPlaneResolutionUnit', + 'exif:SubjectLocation', + 'exif:SensingMethod', + 'exif:FileSource', + 'exif:SceneType', + 'exif:CFAPattern', + 'exif:CustomRendered', + 'exif:ExposureMode', + 'exif:WhiteBalance', + 'exif:DigitalZoomRatio', + 'exif:FocalLengthIn35mmFilm', + 'exif:SceneCaptureType', + 'exif:GainControl', + 'exif:Contrast', + 'exif:Saturation', + 'exif:Sharpness', + 'exif:DeviceSettingDescription', + 'exif:SubjectDistanceRange', + 'exif:ImageUniqueID', + 'exif:GPSVersionID', + 'exif:GPSLatitude', + 'exif:GPSLongitude', + 'exif:GPSAltitudeRef', + 'exif:GPSAltitude', + 'exif:GPSTimeStamp', + 'exif:GPSSatellites', + 'exif:GPSStatus', + 'exif:GPSMeasureMode', + 'exif:GPSDOP', + 'exif:GPSSpeedRef', + 'exif:GPSSpeed', + 'exif:GPSTrackRef', + 'exif:GPSTrack', + 'exif:GPSImgDirectionRef', + 'exif:GPSImgDirection', + 'exif:GPSMapDatum', + 'exif:GPSDestLatitude', + 'exif:GPSDestLongitude', + 'exif:GPSDestBearingRef', + 'exif:GPSDestBearing', + 'exif:GPSDestDistanceRef', + 'exif:GPSDestDistance', + 'exif:GPSProcessingMethod', + 'exif:GPSAreaInformation', + 'exif:GPSDifferential', + 'stDim:w', + 'stDim:h', + 'stDim:unit', + 'xapGImg:height', + 'xapGImg:width', + 'xapGImg:format', + 'xapGImg:image', + 'stEvt:action', + 'stEvt:instanceID', + 'stEvt:parameters', + 'stEvt:softwareAgent', + 'stEvt:when', + 'stRef:instanceID', + 'stRef:documentID', + 'stRef:versionID', + 'stRef:renditionClass', + 'stRef:renditionParams', + 'stRef:manager', + 'stRef:managerVariant', + 'stRef:manageTo', + 'stRef:manageUI', + 'stVer:comments', + 'stVer:event', + 'stVer:modifyDate', + 'stVer:modifier', + 'stVer:version', + 'stJob:name', + 'stJob:id', + 'stJob:url', +// Exif Flash + 'exif:Fired', + 'exif:Return', + 'exif:Mode', + 'exif:Function', + 'exif:RedEyeMode', +// Exif OECF/SFR + 'exif:Columns', + 'exif:Rows', + 'exif:Names', + 'exif:Values', +// Exif CFAPattern + 'exif:Columns', + 'exif:Rows', + 'exif:Values', +// Exif DeviceSettings + 'exif:Columns', + 'exif:Rows', + 'exif:Settings', +); +*/ + +/** +* Global Variable: JPEG_Segment_Names +* +* The names of the JPEG segment markers, indexed by their marker number +*/ +$GLOBALS['JPEG_Segment_Names'] = array( + 0x01 => 'TEM', + 0x02 => 'RES', + 0xC0 => 'SOF0', + 0xC1 => 'SOF1', + 0xC2 => 'SOF2', + 0xC3 => 'SOF4', + 0xC4 => 'DHT', + 0xC5 => 'SOF5', + 0xC6 => 'SOF6', + 0xC7 => 'SOF7', + 0xC8 => 'JPG', + 0xC9 => 'SOF9', + 0xCA => 'SOF10', + 0xCB => 'SOF11', + 0xCC => 'DAC', + 0xCD => 'SOF13', + 0xCE => 'SOF14', + 0xCF => 'SOF15', + 0xD0 => 'RST0', + 0xD1 => 'RST1', + 0xD2 => 'RST2', + 0xD3 => 'RST3', + 0xD4 => 'RST4', + 0xD5 => 'RST5', + 0xD6 => 'RST6', + 0xD7 => 'RST7', + 0xD8 => 'SOI', + 0xD9 => 'EOI', + 0xDA => 'SOS', + 0xDB => 'DQT', + 0xDC => 'DNL', + 0xDD => 'DRI', + 0xDE => 'DHP', + 0xDF => 'EXP', + 0xE0 => 'APP0', + 0xE1 => 'APP1', + 0xE2 => 'APP2', + 0xE3 => 'APP3', + 0xE4 => 'APP4', + 0xE5 => 'APP5', + 0xE6 => 'APP6', + 0xE7 => 'APP7', + 0xE8 => 'APP8', + 0xE9 => 'APP9', + 0xEA => 'APP10', + 0xEB => 'APP11', + 0xEC => 'APP12', + 0xED => 'APP13', + 0xEE => 'APP14', + 0xEF => 'APP15', + 0xF0 => 'JPG0', + 0xF1 => 'JPG1', + 0xF2 => 'JPG2', + 0xF3 => 'JPG3', + 0xF4 => 'JPG4', + 0xF5 => 'JPG5', + 0xF6 => 'JPG6', + 0xF7 => 'JPG7', + 0xF8 => 'JPG8', + 0xF9 => 'JPG9', + 0xFA => 'JPG10', + 0xFB => 'JPG11', + 0xFC => 'JPG12', + 0xFD => 'JPG13', + 0xFE => 'COM', +); diff --git a/www/rompr/getid3/write.apetag.php b/www/rompr/getid3/write.apetag.php new file mode 100755 index 0000000..6daaf3a --- /dev/null +++ b/www/rompr/getid3/write.apetag.php @@ -0,0 +1,224 @@ + // +// available at http://getid3.sourceforge.net // +// or http://www.getid3.org // +// also https://github.com/JamesHeinrich/getID3 // +///////////////////////////////////////////////////////////////// +// See readme.txt for more details // +///////////////////////////////////////////////////////////////// +// // +// write.apetag.php // +// module for writing APE tags // +// dependencies: module.tag.apetag.php // +// /// +///////////////////////////////////////////////////////////////// + + +getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.tag.apetag.php', __FILE__, true); + +class getid3_write_apetag +{ + + public $filename; + public $tag_data; + public $always_preserve_replaygain = true; // ReplayGain / MP3gain tags will be copied from old tag even if not passed in data + public $warnings = array(); // any non-critical errors will be stored here + public $errors = array(); // any critical errors will be stored here + + public function __construct() { + return true; + } + + public function WriteAPEtag() { + // NOTE: All data passed to this function must be UTF-8 format + + $getID3 = new getID3; + $ThisFileInfo = $getID3->analyze($this->filename); + + if (isset($ThisFileInfo['ape']['tag_offset_start']) && isset($ThisFileInfo['lyrics3']['tag_offset_end'])) { + if ($ThisFileInfo['ape']['tag_offset_start'] >= $ThisFileInfo['lyrics3']['tag_offset_end']) { + // Current APE tag between Lyrics3 and ID3v1/EOF + // This break Lyrics3 functionality + if (!$this->DeleteAPEtag()) { + return false; + } + $ThisFileInfo = $getID3->analyze($this->filename); + } + } + + if ($this->always_preserve_replaygain) { + $ReplayGainTagsToPreserve = array('mp3gain_minmax', 'mp3gain_album_minmax', 'mp3gain_undo', 'replaygain_track_peak', 'replaygain_track_gain', 'replaygain_album_peak', 'replaygain_album_gain'); + foreach ($ReplayGainTagsToPreserve as $rg_key) { + if (isset($ThisFileInfo['ape']['items'][strtolower($rg_key)]['data'][0]) && !isset($this->tag_data[strtoupper($rg_key)][0])) { + $this->tag_data[strtoupper($rg_key)][0] = $ThisFileInfo['ape']['items'][strtolower($rg_key)]['data'][0]; + } + } + } + + if ($APEtag = $this->GenerateAPEtag()) { + if (getID3::is_writable($this->filename) && is_file($this->filename) && ($fp = fopen($this->filename, 'a+b'))) { + $oldignoreuserabort = ignore_user_abort(true); + flock($fp, LOCK_EX); + + $PostAPEdataOffset = $ThisFileInfo['avdataend']; + if (isset($ThisFileInfo['ape']['tag_offset_end'])) { + $PostAPEdataOffset = max($PostAPEdataOffset, $ThisFileInfo['ape']['tag_offset_end']); + } + if (isset($ThisFileInfo['lyrics3']['tag_offset_start'])) { + $PostAPEdataOffset = max($PostAPEdataOffset, $ThisFileInfo['lyrics3']['tag_offset_start']); + } + fseek($fp, $PostAPEdataOffset); + $PostAPEdata = ''; + if ($ThisFileInfo['filesize'] > $PostAPEdataOffset) { + $PostAPEdata = fread($fp, $ThisFileInfo['filesize'] - $PostAPEdataOffset); + } + + fseek($fp, $PostAPEdataOffset); + if (isset($ThisFileInfo['ape']['tag_offset_start'])) { + fseek($fp, $ThisFileInfo['ape']['tag_offset_start']); + } + ftruncate($fp, ftell($fp)); + fwrite($fp, $APEtag, strlen($APEtag)); + if (!empty($PostAPEdata)) { + fwrite($fp, $PostAPEdata, strlen($PostAPEdata)); + } + flock($fp, LOCK_UN); + fclose($fp); + ignore_user_abort($oldignoreuserabort); + return true; + } + } + return false; + } + + public function DeleteAPEtag() { + $getID3 = new getID3; + $ThisFileInfo = $getID3->analyze($this->filename); + if (isset($ThisFileInfo['ape']['tag_offset_start']) && isset($ThisFileInfo['ape']['tag_offset_end'])) { + if (getID3::is_writable($this->filename) && is_file($this->filename) && ($fp = fopen($this->filename, 'a+b'))) { + + flock($fp, LOCK_EX); + $oldignoreuserabort = ignore_user_abort(true); + + fseek($fp, $ThisFileInfo['ape']['tag_offset_end']); + $DataAfterAPE = ''; + if ($ThisFileInfo['filesize'] > $ThisFileInfo['ape']['tag_offset_end']) { + $DataAfterAPE = fread($fp, $ThisFileInfo['filesize'] - $ThisFileInfo['ape']['tag_offset_end']); + } + + ftruncate($fp, $ThisFileInfo['ape']['tag_offset_start']); + fseek($fp, $ThisFileInfo['ape']['tag_offset_start']); + + if (!empty($DataAfterAPE)) { + fwrite($fp, $DataAfterAPE, strlen($DataAfterAPE)); + } + + flock($fp, LOCK_UN); + fclose($fp); + ignore_user_abort($oldignoreuserabort); + + return true; + } + return false; + } + return true; + } + + + public function GenerateAPEtag() { + // NOTE: All data passed to this function must be UTF-8 format + + $items = array(); + if (!is_array($this->tag_data)) { + return false; + } + foreach ($this->tag_data as $key => $arrayofvalues) { + if (!is_array($arrayofvalues)) { + return false; + } + + $valuestring = ''; + foreach ($arrayofvalues as $value) { + $valuestring .= str_replace("\x00", '', $value)."\x00"; + } + $valuestring = rtrim($valuestring, "\x00"); + + // Length of the assigned value in bytes + $tagitem = getid3_lib::LittleEndian2String(strlen($valuestring), 4); + + //$tagitem .= $this->GenerateAPEtagFlags(true, true, false, 0, false); + $tagitem .= "\x00\x00\x00\x00"; + + $tagitem .= $this->CleanAPEtagItemKey($key)."\x00"; + $tagitem .= $valuestring; + + $items[] = $tagitem; + + } + + return $this->GenerateAPEtagHeaderFooter($items, true).implode('', $items).$this->GenerateAPEtagHeaderFooter($items, false); + } + + public function GenerateAPEtagHeaderFooter(&$items, $isheader=false) { + $tagdatalength = 0; + foreach ($items as $itemdata) { + $tagdatalength += strlen($itemdata); + } + + $APEheader = 'APETAGEX'; + $APEheader .= getid3_lib::LittleEndian2String(2000, 4); + $APEheader .= getid3_lib::LittleEndian2String(32 + $tagdatalength, 4); + $APEheader .= getid3_lib::LittleEndian2String(count($items), 4); + $APEheader .= $this->GenerateAPEtagFlags(true, true, $isheader, 0, false); + $APEheader .= str_repeat("\x00", 8); + + return $APEheader; + } + + public function GenerateAPEtagFlags($header=true, $footer=true, $isheader=false, $encodingid=0, $readonly=false) { + $APEtagFlags = array_fill(0, 4, 0); + if ($header) { + $APEtagFlags[0] |= 0x80; // Tag contains a header + } + if (!$footer) { + $APEtagFlags[0] |= 0x40; // Tag contains no footer + } + if ($isheader) { + $APEtagFlags[0] |= 0x20; // This is the header, not the footer + } + + // 0: Item contains text information coded in UTF-8 + // 1: Item contains binary information °) + // 2: Item is a locator of external stored information °°) + // 3: reserved + $APEtagFlags[3] |= ($encodingid << 1); + + if ($readonly) { + $APEtagFlags[3] |= 0x01; // Tag or Item is Read Only + } + + return chr($APEtagFlags[3]).chr($APEtagFlags[2]).chr($APEtagFlags[1]).chr($APEtagFlags[0]); + } + + public function CleanAPEtagItemKey($itemkey) { + $itemkey = preg_replace("#[^\x20-\x7E]#i", '', $itemkey); + + // http://www.personal.uni-jena.de/~pfk/mpp/sv8/apekey.html + switch (strtoupper($itemkey)) { + case 'EAN/UPC': + case 'ISBN': + case 'LC': + case 'ISRC': + $itemkey = strtoupper($itemkey); + break; + + default: + $itemkey = ucwords($itemkey); + break; + } + return $itemkey; + + } + +} diff --git a/www/rompr/getid3/write.id3v1.php b/www/rompr/getid3/write.id3v1.php new file mode 100755 index 0000000..387abe7 --- /dev/null +++ b/www/rompr/getid3/write.id3v1.php @@ -0,0 +1,137 @@ + // +// available at http://getid3.sourceforge.net // +// or http://www.getid3.org // +// also https://github.com/JamesHeinrich/getID3 // +///////////////////////////////////////////////////////////////// +// See readme.txt for more details // +///////////////////////////////////////////////////////////////// +// // +// write.id3v1.php // +// module for writing ID3v1 tags // +// dependencies: module.tag.id3v1.php // +// /// +///////////////////////////////////////////////////////////////// + +getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.tag.id3v1.php', __FILE__, true); + +class getid3_write_id3v1 +{ + public $filename; + public $filesize; + public $tag_data; + public $warnings = array(); // any non-critical errors will be stored here + public $errors = array(); // any critical errors will be stored here + + public function __construct() { + return true; + } + + public function WriteID3v1() { + // File MUST be writeable - CHMOD(646) at least + if (!empty($this->filename) && is_readable($this->filename) && getID3::is_writable($this->filename) && is_file($this->filename)) { + $this->setRealFileSize(); + if (($this->filesize <= 0) || !getid3_lib::intValueSupported($this->filesize)) { + $this->errors[] = 'Unable to WriteID3v1('.$this->filename.') because filesize ('.$this->filesize.') is larger than '.round(PHP_INT_MAX / 1073741824).'GB'; + return false; + } + if ($fp_source = fopen($this->filename, 'r+b')) { + fseek($fp_source, -128, SEEK_END); + if (fread($fp_source, 3) == 'TAG') { + fseek($fp_source, -128, SEEK_END); // overwrite existing ID3v1 tag + } else { + fseek($fp_source, 0, SEEK_END); // append new ID3v1 tag + } + $this->tag_data['track'] = (isset($this->tag_data['track']) ? $this->tag_data['track'] : (isset($this->tag_data['track_number']) ? $this->tag_data['track_number'] : (isset($this->tag_data['tracknumber']) ? $this->tag_data['tracknumber'] : ''))); + + $new_id3v1_tag_data = getid3_id3v1::GenerateID3v1Tag( + (isset($this->tag_data['title'] ) ? $this->tag_data['title'] : ''), + (isset($this->tag_data['artist'] ) ? $this->tag_data['artist'] : ''), + (isset($this->tag_data['album'] ) ? $this->tag_data['album'] : ''), + (isset($this->tag_data['year'] ) ? $this->tag_data['year'] : ''), + (isset($this->tag_data['genreid']) ? $this->tag_data['genreid'] : ''), + (isset($this->tag_data['comment']) ? $this->tag_data['comment'] : ''), + (isset($this->tag_data['track'] ) ? $this->tag_data['track'] : '')); + fwrite($fp_source, $new_id3v1_tag_data, 128); + fclose($fp_source); + return true; + + } else { + $this->errors[] = 'Could not fopen('.$this->filename.', "r+b")'; + return false; + } + } + $this->errors[] = 'File is not writeable: '.$this->filename; + return false; + } + + public function FixID3v1Padding() { + // ID3v1 data is supposed to be padded with NULL characters, but some taggers incorrectly use spaces + // This function rewrites the ID3v1 tag with correct padding + + // Initialize getID3 engine + $getID3 = new getID3; + $getID3->option_tag_id3v2 = false; + $getID3->option_tag_apetag = false; + $getID3->option_tags_html = false; + $getID3->option_extra_info = false; + $getID3->option_tag_id3v1 = true; + $ThisFileInfo = $getID3->analyze($this->filename); + if (isset($ThisFileInfo['tags']['id3v1'])) { + foreach ($ThisFileInfo['tags']['id3v1'] as $key => $value) { + $id3v1data[$key] = implode(',', $value); + } + $this->tag_data = $id3v1data; + return $this->WriteID3v1(); + } + return false; + } + + public function RemoveID3v1() { + // File MUST be writeable - CHMOD(646) at least + if (!empty($this->filename) && is_readable($this->filename) && getID3::is_writable($this->filename) && is_file($this->filename)) { + $this->setRealFileSize(); + if (($this->filesize <= 0) || !getid3_lib::intValueSupported($this->filesize)) { + $this->errors[] = 'Unable to RemoveID3v1('.$this->filename.') because filesize ('.$this->filesize.') is larger than '.round(PHP_INT_MAX / 1073741824).'GB'; + return false; + } + if ($fp_source = fopen($this->filename, 'r+b')) { + + fseek($fp_source, -128, SEEK_END); + if (fread($fp_source, 3) == 'TAG') { + ftruncate($fp_source, $this->filesize - 128); + } else { + // no ID3v1 tag to begin with - do nothing + } + fclose($fp_source); + return true; + + } else { + $this->errors[] = 'Could not fopen('.$this->filename.', "r+b")'; + } + } else { + $this->errors[] = $this->filename.' is not writeable'; + } + return false; + } + + public function setRealFileSize() { + if (PHP_INT_MAX > 2147483647) { + $this->filesize = filesize($this->filename); + return true; + } + // 32-bit PHP will not return correct values for filesize() if file is >=2GB + // but getID3->analyze() has workarounds to get actual filesize + $getID3 = new getID3; + $getID3->option_tag_id3v1 = false; + $getID3->option_tag_id3v2 = false; + $getID3->option_tag_apetag = false; + $getID3->option_tags_html = false; + $getID3->option_extra_info = false; + $ThisFileInfo = $getID3->analyze($this->filename); + $this->filesize = $ThisFileInfo['filesize']; + return true; + } + +} diff --git a/www/rompr/getid3/write.id3v2.php b/www/rompr/getid3/write.id3v2.php new file mode 100755 index 0000000..cc5c8a1 --- /dev/null +++ b/www/rompr/getid3/write.id3v2.php @@ -0,0 +1,2109 @@ + // +// available at http://getid3.sourceforge.net // +// or http://www.getid3.org // +// also https://github.com/JamesHeinrich/getID3 // +///////////////////////////////////////////////////////////////// +// See readme.txt for more details // +///////////////////////////////////////////////////////////////// +/// // +// write.id3v2.php // +// module for writing ID3v2 tags // +// dependencies: module.tag.id3v2.php // +// /// +///////////////////////////////////////////////////////////////// + +getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.tag.id3v2.php', __FILE__, true); + +class getid3_write_id3v2 +{ + public $filename; + public $tag_data; + public $fread_buffer_size = 32768; // read buffer size in bytes + public $paddedlength = 4096; // minimum length of ID3v2 tag in bytes + public $majorversion = 3; // ID3v2 major version (2, 3 (recommended), 4) + public $minorversion = 0; // ID3v2 minor version - always 0 + public $merge_existing_data = false; // if true, merge new data with existing tags; if false, delete old tag data and only write new tags + public $id3v2_default_encodingid = 0; // default text encoding (ISO-8859-1) if not explicitly passed + public $id3v2_use_unsynchronisation = false; // the specs say it should be TRUE, but most other ID3v2-aware programs are broken if unsynchronization is used, so by default don't use it. + public $warnings = array(); // any non-critical errors will be stored here + public $errors = array(); // any critical errors will be stored here + + public function __construct() { + return true; + } + + public function WriteID3v2() { + // File MUST be writeable - CHMOD(646) at least. It's best if the + // directory is also writeable, because that method is both faster and less susceptible to errors. + + if (!empty($this->filename) && (getID3::is_writable($this->filename) || (!file_exists($this->filename) && getID3::is_writable(dirname($this->filename))))) { + // Initialize getID3 engine + $getID3 = new getID3; + $OldThisFileInfo = $getID3->analyze($this->filename); + if (!getid3_lib::intValueSupported($OldThisFileInfo['filesize'])) { + $this->errors[] = 'Unable to write ID3v2 because file is larger than '.round(PHP_INT_MAX / 1073741824).'GB'; + fclose($fp_source); + return false; + } + if ($this->merge_existing_data) { + // merge with existing data + if (!empty($OldThisFileInfo['id3v2'])) { + $this->tag_data = $this->array_join_merge($OldThisFileInfo['id3v2'], $this->tag_data); + } + } + $this->paddedlength = (isset($OldThisFileInfo['id3v2']['headerlength']) ? max($OldThisFileInfo['id3v2']['headerlength'], $this->paddedlength) : $this->paddedlength); + + if ($NewID3v2Tag = $this->GenerateID3v2Tag()) { + + if (file_exists($this->filename) && getID3::is_writable($this->filename) && isset($OldThisFileInfo['id3v2']['headerlength']) && ($OldThisFileInfo['id3v2']['headerlength'] == strlen($NewID3v2Tag))) { + + // best and fastest method - insert-overwrite existing tag (padded to length of old tag if neccesary) + if (file_exists($this->filename)) { + + if (is_readable($this->filename) && getID3::is_writable($this->filename) && is_file($this->filename) && ($fp = fopen($this->filename, 'r+b'))) { + rewind($fp); + fwrite($fp, $NewID3v2Tag, strlen($NewID3v2Tag)); + fclose($fp); + } else { + $this->errors[] = 'Could not fopen("'.$this->filename.'", "r+b")'; + } + + } else { + + if (getID3::is_writable($this->filename) && is_file($this->filename) && ($fp = fopen($this->filename, 'wb'))) { + rewind($fp); + fwrite($fp, $NewID3v2Tag, strlen($NewID3v2Tag)); + fclose($fp); + } else { + $this->errors[] = 'Could not fopen("'.$this->filename.'", "wb")'; + } + + } + + } else { + + if ($tempfilename = tempnam(GETID3_TEMP_DIR, 'getID3')) { + if (is_readable($this->filename) && is_file($this->filename) && ($fp_source = fopen($this->filename, 'rb'))) { + if (getID3::is_writable($tempfilename) && is_file($tempfilename) && ($fp_temp = fopen($tempfilename, 'wb'))) { + + fwrite($fp_temp, $NewID3v2Tag, strlen($NewID3v2Tag)); + + rewind($fp_source); + if (!empty($OldThisFileInfo['avdataoffset'])) { + fseek($fp_source, $OldThisFileInfo['avdataoffset']); + } + + while ($buffer = fread($fp_source, $this->fread_buffer_size)) { + fwrite($fp_temp, $buffer, strlen($buffer)); + } + + fclose($fp_temp); + fclose($fp_source); + copy($tempfilename, $this->filename); + unlink($tempfilename); + return true; + + } else { + $this->errors[] = 'Could not fopen("'.$tempfilename.'", "wb")'; + } + fclose($fp_source); + + } else { + $this->errors[] = 'Could not fopen("'.$this->filename.'", "rb")'; + } + } + return false; + + } + + } else { + + $this->errors[] = '$this->GenerateID3v2Tag() failed'; + + } + + if (!empty($this->errors)) { + return false; + } + return true; + } else { + $this->errors[] = 'WriteID3v2() failed: !is_writeable('.$this->filename.')'; + } + return false; + } + + public function RemoveID3v2() { + // File MUST be writeable - CHMOD(646) at least. It's best if the + // directory is also writeable, because that method is both faster and less susceptible to errors. + if (getID3::is_writable(dirname($this->filename))) { + + // preferred method - only one copying operation, minimal chance of corrupting + // original file if script is interrupted, but required directory to be writeable + if (is_readable($this->filename) && is_file($this->filename) && ($fp_source = fopen($this->filename, 'rb'))) { + + // Initialize getID3 engine + $getID3 = new getID3; + $OldThisFileInfo = $getID3->analyze($this->filename); + if (!getid3_lib::intValueSupported($OldThisFileInfo['filesize'])) { + $this->errors[] = 'Unable to remove ID3v2 because file is larger than '.round(PHP_INT_MAX / 1073741824).'GB'; + fclose($fp_source); + return false; + } + rewind($fp_source); + if ($OldThisFileInfo['avdataoffset'] !== false) { + fseek($fp_source, $OldThisFileInfo['avdataoffset']); + } + if (getID3::is_writable($this->filename) && is_file($this->filename) && ($fp_temp = fopen($this->filename.'getid3tmp', 'w+b'))) { + while ($buffer = fread($fp_source, $this->fread_buffer_size)) { + fwrite($fp_temp, $buffer, strlen($buffer)); + } + fclose($fp_temp); + } else { + $this->errors[] = 'Could not fopen("'.$this->filename.'getid3tmp", "w+b")'; + } + fclose($fp_source); + } else { + $this->errors[] = 'Could not fopen("'.$this->filename.'", "rb")'; + } + if (file_exists($this->filename)) { + unlink($this->filename); + } + rename($this->filename.'getid3tmp', $this->filename); + + } elseif (getID3::is_writable($this->filename)) { + + // less desirable alternate method - double-copies the file, overwrites original file + // and could corrupt source file if the script is interrupted or an error occurs. + if (is_readable($this->filename) && is_file($this->filename) && ($fp_source = fopen($this->filename, 'rb'))) { + + // Initialize getID3 engine + $getID3 = new getID3; + $OldThisFileInfo = $getID3->analyze($this->filename); + if (!getid3_lib::intValueSupported($OldThisFileInfo['filesize'])) { + $this->errors[] = 'Unable to remove ID3v2 because file is larger than '.round(PHP_INT_MAX / 1073741824).'GB'; + fclose($fp_source); + return false; + } + rewind($fp_source); + if ($OldThisFileInfo['avdataoffset'] !== false) { + fseek($fp_source, $OldThisFileInfo['avdataoffset']); + } + if ($fp_temp = tmpfile()) { + while ($buffer = fread($fp_source, $this->fread_buffer_size)) { + fwrite($fp_temp, $buffer, strlen($buffer)); + } + fclose($fp_source); + if (getID3::is_writable($this->filename) && is_file($this->filename) && ($fp_source = fopen($this->filename, 'wb'))) { + rewind($fp_temp); + while ($buffer = fread($fp_temp, $this->fread_buffer_size)) { + fwrite($fp_source, $buffer, strlen($buffer)); + } + fseek($fp_temp, -128, SEEK_END); + fclose($fp_source); + } else { + $this->errors[] = 'Could not fopen("'.$this->filename.'", "wb")'; + } + fclose($fp_temp); + } else { + $this->errors[] = 'Could not create tmpfile()'; + } + } else { + $this->errors[] = 'Could not fopen("'.$this->filename.'", "rb")'; + } + + } else { + + $this->errors[] = 'Directory and file both not writeable'; + + } + + if (!empty($this->errors)) { + return false; + } + return true; + } + + + public function GenerateID3v2TagFlags($flags) { + switch ($this->majorversion) { + case 4: + // %abcd0000 + $flag = (!empty($flags['unsynchronisation']) ? '1' : '0'); // a - Unsynchronisation + $flag .= (!empty($flags['extendedheader'] ) ? '1' : '0'); // b - Extended header + $flag .= (!empty($flags['experimental'] ) ? '1' : '0'); // c - Experimental indicator + $flag .= (!empty($flags['footer'] ) ? '1' : '0'); // d - Footer present + $flag .= '0000'; + break; + + case 3: + // %abc00000 + $flag = (!empty($flags['unsynchronisation']) ? '1' : '0'); // a - Unsynchronisation + $flag .= (!empty($flags['extendedheader'] ) ? '1' : '0'); // b - Extended header + $flag .= (!empty($flags['experimental'] ) ? '1' : '0'); // c - Experimental indicator + $flag .= '00000'; + break; + + case 2: + // %ab000000 + $flag = (!empty($flags['unsynchronisation']) ? '1' : '0'); // a - Unsynchronisation + $flag .= (!empty($flags['compression'] ) ? '1' : '0'); // b - Compression + $flag .= '000000'; + break; + + default: + return false; + break; + } + return chr(bindec($flag)); + } + + + public function GenerateID3v2FrameFlags($TagAlter=false, $FileAlter=false, $ReadOnly=false, $Compression=false, $Encryption=false, $GroupingIdentity=false, $Unsynchronisation=false, $DataLengthIndicator=false) { + switch ($this->majorversion) { + case 4: + // %0abc0000 %0h00kmnp + $flag1 = '0'; + $flag1 .= $TagAlter ? '1' : '0'; // a - Tag alter preservation (true == discard) + $flag1 .= $FileAlter ? '1' : '0'; // b - File alter preservation (true == discard) + $flag1 .= $ReadOnly ? '1' : '0'; // c - Read only (true == read only) + $flag1 .= '0000'; + + $flag2 = '0'; + $flag2 .= $GroupingIdentity ? '1' : '0'; // h - Grouping identity (true == contains group information) + $flag2 .= '00'; + $flag2 .= $Compression ? '1' : '0'; // k - Compression (true == compressed) + $flag2 .= $Encryption ? '1' : '0'; // m - Encryption (true == encrypted) + $flag2 .= $Unsynchronisation ? '1' : '0'; // n - Unsynchronisation (true == unsynchronised) + $flag2 .= $DataLengthIndicator ? '1' : '0'; // p - Data length indicator (true == data length indicator added) + break; + + case 3: + // %abc00000 %ijk00000 + $flag1 = $TagAlter ? '1' : '0'; // a - Tag alter preservation (true == discard) + $flag1 .= $FileAlter ? '1' : '0'; // b - File alter preservation (true == discard) + $flag1 .= $ReadOnly ? '1' : '0'; // c - Read only (true == read only) + $flag1 .= '00000'; + + $flag2 = $Compression ? '1' : '0'; // i - Compression (true == compressed) + $flag2 .= $Encryption ? '1' : '0'; // j - Encryption (true == encrypted) + $flag2 .= $GroupingIdentity ? '1' : '0'; // k - Grouping identity (true == contains group information) + $flag2 .= '00000'; + break; + + default: + return false; + break; + + } + return chr(bindec($flag1)).chr(bindec($flag2)); + } + + public function GenerateID3v2FrameData($frame_name, $source_data_array) { + if (!getid3_id3v2::IsValidID3v2FrameName($frame_name, $this->majorversion)) { + return false; + } + $framedata = ''; + + if (($this->majorversion < 3) || ($this->majorversion > 4)) { + + $this->errors[] = 'Only ID3v2.3 and ID3v2.4 are supported in GenerateID3v2FrameData()'; + + } else { // $this->majorversion 3 or 4 + + switch ($frame_name) { + case 'UFID': + // 4.1 UFID Unique file identifier + // Owner identifier $00 + // Identifier + if (strlen($source_data_array['data']) > 64) { + $this->errors[] = 'Identifier not allowed to be longer than 64 bytes in '.$frame_name.' (supplied data was '.strlen($source_data_array['data']).' bytes long)'; + } else { + $framedata .= str_replace("\x00", '', $source_data_array['ownerid'])."\x00"; + $framedata .= substr($source_data_array['data'], 0, 64); // max 64 bytes - truncate anything longer + } + break; + + case 'TXXX': + // 4.2.2 TXXX User defined text information frame + // Text encoding $xx + // Description $00 (00) + // Value + $source_data_array['encodingid'] = (isset($source_data_array['encodingid']) ? $source_data_array['encodingid'] : $this->id3v2_default_encodingid); + if (!$this->ID3v2IsValidTextEncoding($source_data_array['encodingid'], $this->majorversion)) { + $this->errors[] = 'Invalid Text Encoding in '.$frame_name.' ('.$source_data_array['encodingid'].') for ID3v2.'.$this->majorversion; + } else { + $framedata .= chr($source_data_array['encodingid']); + $framedata .= $source_data_array['description'].getid3_id3v2::TextEncodingTerminatorLookup($source_data_array['encodingid']); + $framedata .= $source_data_array['data']; + } + break; + + case 'WXXX': + // 4.3.2 WXXX User defined URL link frame + // Text encoding $xx + // Description $00 (00) + // URL + $source_data_array['encodingid'] = (isset($source_data_array['encodingid']) ? $source_data_array['encodingid'] : $this->id3v2_default_encodingid); + if (!$this->ID3v2IsValidTextEncoding($source_data_array['encodingid'], $this->majorversion)) { + $this->errors[] = 'Invalid Text Encoding in '.$frame_name.' ('.$source_data_array['encodingid'].') for ID3v2.'.$this->majorversion; + } elseif (!isset($source_data_array['data']) || !$this->IsValidURL($source_data_array['data'], false, false)) { + //$this->errors[] = 'Invalid URL in '.$frame_name.' ('.$source_data_array['data'].')'; + // probably should be an error, need to rewrite IsValidURL() to handle other encodings + $this->warnings[] = 'Invalid URL in '.$frame_name.' ('.$source_data_array['data'].')'; + } else { + $framedata .= chr($source_data_array['encodingid']); + $framedata .= $source_data_array['description'].getid3_id3v2::TextEncodingTerminatorLookup($source_data_array['encodingid']); + $framedata .= $source_data_array['data']; + } + break; + + case 'IPLS': + // 4.4 IPLS Involved people list (ID3v2.3 only) + // Text encoding $xx + // People list strings + $source_data_array['encodingid'] = (isset($source_data_array['encodingid']) ? $source_data_array['encodingid'] : $this->id3v2_default_encodingid); + if (!$this->ID3v2IsValidTextEncoding($source_data_array['encodingid'], $this->majorversion)) { + $this->errors[] = 'Invalid Text Encoding in '.$frame_name.' ('.$source_data_array['encodingid'].') for ID3v2.'.$this->majorversion; + } else { + $framedata .= chr($source_data_array['encodingid']); + $framedata .= $source_data_array['data']; + } + break; + + case 'MCDI': + // 4.4 MCDI Music CD identifier + // CD TOC + $framedata .= $source_data_array['data']; + break; + + case 'ETCO': + // 4.5 ETCO Event timing codes + // Time stamp format $xx + // Where time stamp format is: + // $01 (32-bit value) MPEG frames from beginning of file + // $02 (32-bit value) milliseconds from beginning of file + // Followed by a list of key events in the following format: + // Type of event $xx + // Time stamp $xx (xx ...) + // The 'Time stamp' is set to zero if directly at the beginning of the sound + // or after the previous event. All events MUST be sorted in chronological order. + if (($source_data_array['timestampformat'] > 2) || ($source_data_array['timestampformat'] < 1)) { + $this->errors[] = 'Invalid Time Stamp Format byte in '.$frame_name.' ('.$source_data_array['timestampformat'].')'; + } else { + $framedata .= chr($source_data_array['timestampformat']); + foreach ($source_data_array as $key => $val) { + if (!$this->ID3v2IsValidETCOevent($val['typeid'])) { + $this->errors[] = 'Invalid Event Type byte in '.$frame_name.' ('.$val['typeid'].')'; + } elseif (($key != 'timestampformat') && ($key != 'flags')) { + if (($val['timestamp'] > 0) && ($previousETCOtimestamp >= $val['timestamp'])) { + // The 'Time stamp' is set to zero if directly at the beginning of the sound + // or after the previous event. All events MUST be sorted in chronological order. + $this->errors[] = 'Out-of-order timestamp in '.$frame_name.' ('.$val['timestamp'].') for Event Type ('.$val['typeid'].')'; + } else { + $framedata .= chr($val['typeid']); + $framedata .= getid3_lib::BigEndian2String($val['timestamp'], 4, false); + } + } + } + } + break; + + case 'MLLT': + // 4.6 MLLT MPEG location lookup table + // MPEG frames between reference $xx xx + // Bytes between reference $xx xx xx + // Milliseconds between reference $xx xx xx + // Bits for bytes deviation $xx + // Bits for milliseconds dev. $xx + // Then for every reference the following data is included; + // Deviation in bytes %xxx.... + // Deviation in milliseconds %xxx.... + if (($source_data_array['framesbetweenreferences'] > 0) && ($source_data_array['framesbetweenreferences'] <= 65535)) { + $framedata .= getid3_lib::BigEndian2String($source_data_array['framesbetweenreferences'], 2, false); + } else { + $this->errors[] = 'Invalid MPEG Frames Between References in '.$frame_name.' ('.$source_data_array['framesbetweenreferences'].')'; + } + if (($source_data_array['bytesbetweenreferences'] > 0) && ($source_data_array['bytesbetweenreferences'] <= 16777215)) { + $framedata .= getid3_lib::BigEndian2String($source_data_array['bytesbetweenreferences'], 3, false); + } else { + $this->errors[] = 'Invalid bytes Between References in '.$frame_name.' ('.$source_data_array['bytesbetweenreferences'].')'; + } + if (($source_data_array['msbetweenreferences'] > 0) && ($source_data_array['msbetweenreferences'] <= 16777215)) { + $framedata .= getid3_lib::BigEndian2String($source_data_array['msbetweenreferences'], 3, false); + } else { + $this->errors[] = 'Invalid Milliseconds Between References in '.$frame_name.' ('.$source_data_array['msbetweenreferences'].')'; + } + if (!$this->IsWithinBitRange($source_data_array['bitsforbytesdeviation'], 8, false)) { + if (($source_data_array['bitsforbytesdeviation'] % 4) == 0) { + $framedata .= chr($source_data_array['bitsforbytesdeviation']); + } else { + $this->errors[] = 'Bits For Bytes Deviation in '.$frame_name.' ('.$source_data_array['bitsforbytesdeviation'].') must be a multiple of 4.'; + } + } else { + $this->errors[] = 'Invalid Bits For Bytes Deviation in '.$frame_name.' ('.$source_data_array['bitsforbytesdeviation'].')'; + } + if (!$this->IsWithinBitRange($source_data_array['bitsformsdeviation'], 8, false)) { + if (($source_data_array['bitsformsdeviation'] % 4) == 0) { + $framedata .= chr($source_data_array['bitsformsdeviation']); + } else { + $this->errors[] = 'Bits For Milliseconds Deviation in '.$frame_name.' ('.$source_data_array['bitsforbytesdeviation'].') must be a multiple of 4.'; + } + } else { + $this->errors[] = 'Invalid Bits For Milliseconds Deviation in '.$frame_name.' ('.$source_data_array['bitsformsdeviation'].')'; + } + foreach ($source_data_array as $key => $val) { + if (($key != 'framesbetweenreferences') && ($key != 'bytesbetweenreferences') && ($key != 'msbetweenreferences') && ($key != 'bitsforbytesdeviation') && ($key != 'bitsformsdeviation') && ($key != 'flags')) { + $unwrittenbitstream .= str_pad(getid3_lib::Dec2Bin($val['bytedeviation']), $source_data_array['bitsforbytesdeviation'], '0', STR_PAD_LEFT); + $unwrittenbitstream .= str_pad(getid3_lib::Dec2Bin($val['msdeviation']), $source_data_array['bitsformsdeviation'], '0', STR_PAD_LEFT); + } + } + for ($i = 0; $i < strlen($unwrittenbitstream); $i += 8) { + $highnibble = bindec(substr($unwrittenbitstream, $i, 4)) << 4; + $lownibble = bindec(substr($unwrittenbitstream, $i + 4, 4)); + $framedata .= chr($highnibble & $lownibble); + } + break; + + case 'SYTC': + // 4.7 SYTC Synchronised tempo codes + // Time stamp format $xx + // Tempo data + // Where time stamp format is: + // $01 (32-bit value) MPEG frames from beginning of file + // $02 (32-bit value) milliseconds from beginning of file + if (($source_data_array['timestampformat'] > 2) || ($source_data_array['timestampformat'] < 1)) { + $this->errors[] = 'Invalid Time Stamp Format byte in '.$frame_name.' ('.$source_data_array['timestampformat'].')'; + } else { + $framedata .= chr($source_data_array['timestampformat']); + foreach ($source_data_array as $key => $val) { + if (!$this->ID3v2IsValidETCOevent($val['typeid'])) { + $this->errors[] = 'Invalid Event Type byte in '.$frame_name.' ('.$val['typeid'].')'; + } elseif (($key != 'timestampformat') && ($key != 'flags')) { + if (($val['tempo'] < 0) || ($val['tempo'] > 510)) { + $this->errors[] = 'Invalid Tempo (max = 510) in '.$frame_name.' ('.$val['tempo'].') at timestamp ('.$val['timestamp'].')'; + } else { + if ($val['tempo'] > 255) { + $framedata .= chr(255); + $val['tempo'] -= 255; + } + $framedata .= chr($val['tempo']); + $framedata .= getid3_lib::BigEndian2String($val['timestamp'], 4, false); + } + } + } + } + break; + + case 'USLT': + // 4.8 USLT Unsynchronised lyric/text transcription + // Text encoding $xx + // Language $xx xx xx + // Content descriptor $00 (00) + // Lyrics/text + $source_data_array['encodingid'] = (isset($source_data_array['encodingid']) ? $source_data_array['encodingid'] : $this->id3v2_default_encodingid); + if (!$this->ID3v2IsValidTextEncoding($source_data_array['encodingid'])) { + $this->errors[] = 'Invalid Text Encoding in '.$frame_name.' ('.$source_data_array['encodingid'].') for ID3v2.'.$this->majorversion; + } elseif (getid3_id3v2::LanguageLookup($source_data_array['language'], true) == '') { + $this->errors[] = 'Invalid Language in '.$frame_name.' ('.$source_data_array['language'].')'; + } else { + $framedata .= chr($source_data_array['encodingid']); + $framedata .= strtolower($source_data_array['language']); + $framedata .= $source_data_array['description'].getid3_id3v2::TextEncodingTerminatorLookup($source_data_array['encodingid']); + $framedata .= $source_data_array['data']; + } + break; + + case 'SYLT': + // 4.9 SYLT Synchronised lyric/text + // Text encoding $xx + // Language $xx xx xx + // Time stamp format $xx + // $01 (32-bit value) MPEG frames from beginning of file + // $02 (32-bit value) milliseconds from beginning of file + // Content type $xx + // Content descriptor $00 (00) + // Terminated text to be synced (typically a syllable) + // Sync identifier (terminator to above string) $00 (00) + // Time stamp $xx (xx ...) + $source_data_array['encodingid'] = (isset($source_data_array['encodingid']) ? $source_data_array['encodingid'] : $this->id3v2_default_encodingid); + if (!$this->ID3v2IsValidTextEncoding($source_data_array['encodingid'])) { + $this->errors[] = 'Invalid Text Encoding in '.$frame_name.' ('.$source_data_array['encodingid'].') for ID3v2.'.$this->majorversion; + } elseif (getid3_id3v2::LanguageLookup($source_data_array['language'], true) == '') { + $this->errors[] = 'Invalid Language in '.$frame_name.' ('.$source_data_array['language'].')'; + } elseif (($source_data_array['timestampformat'] > 2) || ($source_data_array['timestampformat'] < 1)) { + $this->errors[] = 'Invalid Time Stamp Format byte in '.$frame_name.' ('.$source_data_array['timestampformat'].')'; + } elseif (!$this->ID3v2IsValidSYLTtype($source_data_array['contenttypeid'])) { + $this->errors[] = 'Invalid Content Type byte in '.$frame_name.' ('.$source_data_array['contenttypeid'].')'; + } elseif (!is_array($source_data_array['data'])) { + $this->errors[] = 'Invalid Lyric/Timestamp data in '.$frame_name.' (must be an array)'; + } else { + $framedata .= chr($source_data_array['encodingid']); + $framedata .= strtolower($source_data_array['language']); + $framedata .= chr($source_data_array['timestampformat']); + $framedata .= chr($source_data_array['contenttypeid']); + $framedata .= $source_data_array['description'].getid3_id3v2::TextEncodingTerminatorLookup($source_data_array['encodingid']); + ksort($source_data_array['data']); + foreach ($source_data_array['data'] as $key => $val) { + $framedata .= $val['data'].getid3_id3v2::TextEncodingTerminatorLookup($source_data_array['encodingid']); + $framedata .= getid3_lib::BigEndian2String($val['timestamp'], 4, false); + } + } + break; + + case 'COMM': + // 4.10 COMM Comments + // Text encoding $xx + // Language $xx xx xx + // Short content descrip. $00 (00) + // The actual text + $source_data_array['encodingid'] = (isset($source_data_array['encodingid']) ? $source_data_array['encodingid'] : $this->id3v2_default_encodingid); + if (!$this->ID3v2IsValidTextEncoding($source_data_array['encodingid'])) { + $this->errors[] = 'Invalid Text Encoding in '.$frame_name.' ('.$source_data_array['encodingid'].') for ID3v2.'.$this->majorversion; + } elseif (getid3_id3v2::LanguageLookup($source_data_array['language'], true) == '') { + $this->errors[] = 'Invalid Language in '.$frame_name.' ('.$source_data_array['language'].')'; + } else { + $framedata .= chr($source_data_array['encodingid']); + $framedata .= strtolower($source_data_array['language']); + $framedata .= $source_data_array['description'].getid3_id3v2::TextEncodingTerminatorLookup($source_data_array['encodingid']); + $framedata .= $source_data_array['data']; + } + break; + + case 'RVA2': + // 4.11 RVA2 Relative volume adjustment (2) (ID3v2.4+ only) + // Identification $00 + // The 'identification' string is used to identify the situation and/or + // device where this adjustment should apply. The following is then + // repeated for every channel: + // Type of channel $xx + // Volume adjustment $xx xx + // Bits representing peak $xx + // Peak volume $xx (xx ...) + $framedata .= str_replace("\x00", '', $source_data_array['description'])."\x00"; + foreach ($source_data_array as $key => $val) { + if ($key != 'description') { + $framedata .= chr($val['channeltypeid']); + $framedata .= getid3_lib::BigEndian2String($val['volumeadjust'], 2, false, true); // signed 16-bit + if (!$this->IsWithinBitRange($source_data_array['bitspeakvolume'], 8, false)) { + $framedata .= chr($val['bitspeakvolume']); + if ($val['bitspeakvolume'] > 0) { + $framedata .= getid3_lib::BigEndian2String($val['peakvolume'], ceil($val['bitspeakvolume'] / 8), false, false); + } + } else { + $this->errors[] = 'Invalid Bits Representing Peak Volume in '.$frame_name.' ('.$val['bitspeakvolume'].') (range = 0 to 255)'; + } + } + } + break; + + case 'RVAD': + // 4.12 RVAD Relative volume adjustment (ID3v2.3 only) + // Increment/decrement %00fedcba + // Bits used for volume descr. $xx + // Relative volume change, right $xx xx (xx ...) // a + // Relative volume change, left $xx xx (xx ...) // b + // Peak volume right $xx xx (xx ...) + // Peak volume left $xx xx (xx ...) + // Relative volume change, right back $xx xx (xx ...) // c + // Relative volume change, left back $xx xx (xx ...) // d + // Peak volume right back $xx xx (xx ...) + // Peak volume left back $xx xx (xx ...) + // Relative volume change, center $xx xx (xx ...) // e + // Peak volume center $xx xx (xx ...) + // Relative volume change, bass $xx xx (xx ...) // f + // Peak volume bass $xx xx (xx ...) + if (!$this->IsWithinBitRange($source_data_array['bitsvolume'], 8, false)) { + $this->errors[] = 'Invalid Bits For Volume Description byte in '.$frame_name.' ('.$source_data_array['bitsvolume'].') (range = 1 to 255)'; + } else { + $incdecflag .= '00'; + $incdecflag .= $source_data_array['incdec']['right'] ? '1' : '0'; // a - Relative volume change, right + $incdecflag .= $source_data_array['incdec']['left'] ? '1' : '0'; // b - Relative volume change, left + $incdecflag .= $source_data_array['incdec']['rightrear'] ? '1' : '0'; // c - Relative volume change, right back + $incdecflag .= $source_data_array['incdec']['leftrear'] ? '1' : '0'; // d - Relative volume change, left back + $incdecflag .= $source_data_array['incdec']['center'] ? '1' : '0'; // e - Relative volume change, center + $incdecflag .= $source_data_array['incdec']['bass'] ? '1' : '0'; // f - Relative volume change, bass + $framedata .= chr(bindec($incdecflag)); + $framedata .= chr($source_data_array['bitsvolume']); + $framedata .= getid3_lib::BigEndian2String($source_data_array['volumechange']['right'], ceil($source_data_array['bitsvolume'] / 8), false); + $framedata .= getid3_lib::BigEndian2String($source_data_array['volumechange']['left'], ceil($source_data_array['bitsvolume'] / 8), false); + $framedata .= getid3_lib::BigEndian2String($source_data_array['peakvolume']['right'], ceil($source_data_array['bitsvolume'] / 8), false); + $framedata .= getid3_lib::BigEndian2String($source_data_array['peakvolume']['left'], ceil($source_data_array['bitsvolume'] / 8), false); + if ($source_data_array['volumechange']['rightrear'] || $source_data_array['volumechange']['leftrear'] || + $source_data_array['peakvolume']['rightrear'] || $source_data_array['peakvolume']['leftrear'] || + $source_data_array['volumechange']['center'] || $source_data_array['peakvolume']['center'] || + $source_data_array['volumechange']['bass'] || $source_data_array['peakvolume']['bass']) { + $framedata .= getid3_lib::BigEndian2String($source_data_array['volumechange']['rightrear'], ceil($source_data_array['bitsvolume']/8), false); + $framedata .= getid3_lib::BigEndian2String($source_data_array['volumechange']['leftrear'], ceil($source_data_array['bitsvolume']/8), false); + $framedata .= getid3_lib::BigEndian2String($source_data_array['peakvolume']['rightrear'], ceil($source_data_array['bitsvolume']/8), false); + $framedata .= getid3_lib::BigEndian2String($source_data_array['peakvolume']['leftrear'], ceil($source_data_array['bitsvolume']/8), false); + } + if ($source_data_array['volumechange']['center'] || $source_data_array['peakvolume']['center'] || + $source_data_array['volumechange']['bass'] || $source_data_array['peakvolume']['bass']) { + $framedata .= getid3_lib::BigEndian2String($source_data_array['volumechange']['center'], ceil($source_data_array['bitsvolume']/8), false); + $framedata .= getid3_lib::BigEndian2String($source_data_array['peakvolume']['center'], ceil($source_data_array['bitsvolume']/8), false); + } + if ($source_data_array['volumechange']['bass'] || $source_data_array['peakvolume']['bass']) { + $framedata .= getid3_lib::BigEndian2String($source_data_array['volumechange']['bass'], ceil($source_data_array['bitsvolume']/8), false); + $framedata .= getid3_lib::BigEndian2String($source_data_array['peakvolume']['bass'], ceil($source_data_array['bitsvolume']/8), false); + } + } + break; + + case 'EQU2': + // 4.12 EQU2 Equalisation (2) (ID3v2.4+ only) + // Interpolation method $xx + // $00 Band + // $01 Linear + // Identification $00 + // The following is then repeated for every adjustment point + // Frequency $xx xx + // Volume adjustment $xx xx + if (($source_data_array['interpolationmethod'] < 0) || ($source_data_array['interpolationmethod'] > 1)) { + $this->errors[] = 'Invalid Interpolation Method byte in '.$frame_name.' ('.$source_data_array['interpolationmethod'].') (valid = 0 or 1)'; + } else { + $framedata .= chr($source_data_array['interpolationmethod']); + $framedata .= str_replace("\x00", '', $source_data_array['description'])."\x00"; + foreach ($source_data_array['data'] as $key => $val) { + $framedata .= getid3_lib::BigEndian2String(intval(round($key * 2)), 2, false); + $framedata .= getid3_lib::BigEndian2String($val, 2, false, true); // signed 16-bit + } + } + break; + + case 'EQUA': + // 4.12 EQUA Equalisation (ID3v2.3 only) + // Adjustment bits $xx + // This is followed by 2 bytes + ('adjustment bits' rounded up to the + // nearest byte) for every equalisation band in the following format, + // giving a frequency range of 0 - 32767Hz: + // Increment/decrement %x (MSB of the Frequency) + // Frequency (lower 15 bits) + // Adjustment $xx (xx ...) + if (!$this->IsWithinBitRange($source_data_array['bitsvolume'], 8, false)) { + $this->errors[] = 'Invalid Adjustment Bits byte in '.$frame_name.' ('.$source_data_array['bitsvolume'].') (range = 1 to 255)'; + } else { + $framedata .= chr($source_data_array['adjustmentbits']); + foreach ($source_data_array as $key => $val) { + if ($key != 'bitsvolume') { + if (($key > 32767) || ($key < 0)) { + $this->errors[] = 'Invalid Frequency in '.$frame_name.' ('.$key.') (range = 0 to 32767)'; + } else { + if ($val >= 0) { + // put MSB of frequency to 1 if increment, 0 if decrement + $key |= 0x8000; + } + $framedata .= getid3_lib::BigEndian2String($key, 2, false); + $framedata .= getid3_lib::BigEndian2String($val, ceil($source_data_array['adjustmentbits'] / 8), false); + } + } + } + } + break; + + case 'RVRB': + // 4.13 RVRB Reverb + // Reverb left (ms) $xx xx + // Reverb right (ms) $xx xx + // Reverb bounces, left $xx + // Reverb bounces, right $xx + // Reverb feedback, left to left $xx + // Reverb feedback, left to right $xx + // Reverb feedback, right to right $xx + // Reverb feedback, right to left $xx + // Premix left to right $xx + // Premix right to left $xx + if (!$this->IsWithinBitRange($source_data_array['left'], 16, false)) { + $this->errors[] = 'Invalid Reverb Left in '.$frame_name.' ('.$source_data_array['left'].') (range = 0 to 65535)'; + } elseif (!$this->IsWithinBitRange($source_data_array['right'], 16, false)) { + $this->errors[] = 'Invalid Reverb Left in '.$frame_name.' ('.$source_data_array['right'].') (range = 0 to 65535)'; + } elseif (!$this->IsWithinBitRange($source_data_array['bouncesL'], 8, false)) { + $this->errors[] = 'Invalid Reverb Bounces, Left in '.$frame_name.' ('.$source_data_array['bouncesL'].') (range = 0 to 255)'; + } elseif (!$this->IsWithinBitRange($source_data_array['bouncesR'], 8, false)) { + $this->errors[] = 'Invalid Reverb Bounces, Right in '.$frame_name.' ('.$source_data_array['bouncesR'].') (range = 0 to 255)'; + } elseif (!$this->IsWithinBitRange($source_data_array['feedbackLL'], 8, false)) { + $this->errors[] = 'Invalid Reverb Feedback, Left-To-Left in '.$frame_name.' ('.$source_data_array['feedbackLL'].') (range = 0 to 255)'; + } elseif (!$this->IsWithinBitRange($source_data_array['feedbackLR'], 8, false)) { + $this->errors[] = 'Invalid Reverb Feedback, Left-To-Right in '.$frame_name.' ('.$source_data_array['feedbackLR'].') (range = 0 to 255)'; + } elseif (!$this->IsWithinBitRange($source_data_array['feedbackRR'], 8, false)) { + $this->errors[] = 'Invalid Reverb Feedback, Right-To-Right in '.$frame_name.' ('.$source_data_array['feedbackRR'].') (range = 0 to 255)'; + } elseif (!$this->IsWithinBitRange($source_data_array['feedbackRL'], 8, false)) { + $this->errors[] = 'Invalid Reverb Feedback, Right-To-Left in '.$frame_name.' ('.$source_data_array['feedbackRL'].') (range = 0 to 255)'; + } elseif (!$this->IsWithinBitRange($source_data_array['premixLR'], 8, false)) { + $this->errors[] = 'Invalid Premix, Left-To-Right in '.$frame_name.' ('.$source_data_array['premixLR'].') (range = 0 to 255)'; + } elseif (!$this->IsWithinBitRange($source_data_array['premixRL'], 8, false)) { + $this->errors[] = 'Invalid Premix, Right-To-Left in '.$frame_name.' ('.$source_data_array['premixRL'].') (range = 0 to 255)'; + } else { + $framedata .= getid3_lib::BigEndian2String($source_data_array['left'], 2, false); + $framedata .= getid3_lib::BigEndian2String($source_data_array['right'], 2, false); + $framedata .= chr($source_data_array['bouncesL']); + $framedata .= chr($source_data_array['bouncesR']); + $framedata .= chr($source_data_array['feedbackLL']); + $framedata .= chr($source_data_array['feedbackLR']); + $framedata .= chr($source_data_array['feedbackRR']); + $framedata .= chr($source_data_array['feedbackRL']); + $framedata .= chr($source_data_array['premixLR']); + $framedata .= chr($source_data_array['premixRL']); + } + break; + + case 'APIC': + // 4.14 APIC Attached picture + // Text encoding $xx + // MIME type $00 + // Picture type $xx + // Description $00 (00) + // Picture data + $source_data_array['encodingid'] = (isset($source_data_array['encodingid']) ? $source_data_array['encodingid'] : $this->id3v2_default_encodingid); + if (!$this->ID3v2IsValidTextEncoding($source_data_array['encodingid'])) { + $this->errors[] = 'Invalid Text Encoding in '.$frame_name.' ('.$source_data_array['encodingid'].') for ID3v2.'.$this->majorversion; + } elseif (!$this->ID3v2IsValidAPICpicturetype($source_data_array['picturetypeid'])) { + $this->errors[] = 'Invalid Picture Type byte in '.$frame_name.' ('.$source_data_array['picturetypeid'].') for ID3v2.'.$this->majorversion; + } elseif (($this->majorversion >= 3) && (!$this->ID3v2IsValidAPICimageformat($source_data_array['mime']))) { + $this->errors[] = 'Invalid MIME Type in '.$frame_name.' ('.$source_data_array['mime'].') for ID3v2.'.$this->majorversion; + } elseif (($source_data_array['mime'] == '-->') && (!$this->IsValidURL($source_data_array['data'], false, false))) { + //$this->errors[] = 'Invalid URL in '.$frame_name.' ('.$source_data_array['data'].')'; + // probably should be an error, need to rewrite IsValidURL() to handle other encodings + $this->warnings[] = 'Invalid URL in '.$frame_name.' ('.$source_data_array['data'].')'; + } else { + $framedata .= chr($source_data_array['encodingid']); + $framedata .= str_replace("\x00", '', $source_data_array['mime'])."\x00"; + $framedata .= chr($source_data_array['picturetypeid']); + $framedata .= (!empty($source_data_array['description']) ? $source_data_array['description'] : '').getid3_id3v2::TextEncodingTerminatorLookup($source_data_array['encodingid']); + $framedata .= $source_data_array['data']; + } + break; + + case 'GEOB': + // 4.15 GEOB General encapsulated object + // Text encoding $xx + // MIME type $00 + // Filename $00 (00) + // Content description $00 (00) + // Encapsulated object + $source_data_array['encodingid'] = (isset($source_data_array['encodingid']) ? $source_data_array['encodingid'] : $this->id3v2_default_encodingid); + if (!$this->ID3v2IsValidTextEncoding($source_data_array['encodingid'])) { + $this->errors[] = 'Invalid Text Encoding in '.$frame_name.' ('.$source_data_array['encodingid'].') for ID3v2.'.$this->majorversion; + } elseif (!$this->IsValidMIMEstring($source_data_array['mime'])) { + $this->errors[] = 'Invalid MIME Type in '.$frame_name.' ('.$source_data_array['mime'].')'; + } elseif (!$source_data_array['description']) { + $this->errors[] = 'Missing Description in '.$frame_name; + } else { + $framedata .= chr($source_data_array['encodingid']); + $framedata .= str_replace("\x00", '', $source_data_array['mime'])."\x00"; + $framedata .= $source_data_array['filename'].getid3_id3v2::TextEncodingTerminatorLookup($source_data_array['encodingid']); + $framedata .= $source_data_array['description'].getid3_id3v2::TextEncodingTerminatorLookup($source_data_array['encodingid']); + $framedata .= $source_data_array['data']; + } + break; + + case 'PCNT': + // 4.16 PCNT Play counter + // When the counter reaches all one's, one byte is inserted in + // front of the counter thus making the counter eight bits bigger + // Counter $xx xx xx xx (xx ...) + $framedata .= getid3_lib::BigEndian2String($source_data_array['data'], 4, false); + break; + + case 'POPM': + // 4.17 POPM Popularimeter + // When the counter reaches all one's, one byte is inserted in + // front of the counter thus making the counter eight bits bigger + // Email to user $00 + // Rating $xx + // Counter $xx xx xx xx (xx ...) + if (!$this->IsWithinBitRange($source_data_array['rating'], 8, false)) { + $this->errors[] = 'Invalid Rating byte in '.$frame_name.' ('.$source_data_array['rating'].') (range = 0 to 255)'; + } elseif (!$this->IsValidEmail($source_data_array['email'])) { + $this->errors[] = 'Invalid Email in '.$frame_name.' ('.$source_data_array['email'].')'; + } else { + $framedata .= str_replace("\x00", '', $source_data_array['email'])."\x00"; + $framedata .= chr($source_data_array['rating']); + $framedata .= getid3_lib::BigEndian2String($source_data_array['data'], 4, false); + } + break; + + case 'RBUF': + // 4.18 RBUF Recommended buffer size + // Buffer size $xx xx xx + // Embedded info flag %0000000x + // Offset to next tag $xx xx xx xx + if (!$this->IsWithinBitRange($source_data_array['buffersize'], 24, false)) { + $this->errors[] = 'Invalid Buffer Size in '.$frame_name; + } elseif (!$this->IsWithinBitRange($source_data_array['nexttagoffset'], 32, false)) { + $this->errors[] = 'Invalid Offset To Next Tag in '.$frame_name; + } else { + $framedata .= getid3_lib::BigEndian2String($source_data_array['buffersize'], 3, false); + $flag .= '0000000'; + $flag .= $source_data_array['flags']['embededinfo'] ? '1' : '0'; + $framedata .= chr(bindec($flag)); + $framedata .= getid3_lib::BigEndian2String($source_data_array['nexttagoffset'], 4, false); + } + break; + + case 'AENC': + // 4.19 AENC Audio encryption + // Owner identifier $00 + // Preview start $xx xx + // Preview length $xx xx + // Encryption info + if (!$this->IsWithinBitRange($source_data_array['previewstart'], 16, false)) { + $this->errors[] = 'Invalid Preview Start in '.$frame_name.' ('.$source_data_array['previewstart'].')'; + } elseif (!$this->IsWithinBitRange($source_data_array['previewlength'], 16, false)) { + $this->errors[] = 'Invalid Preview Length in '.$frame_name.' ('.$source_data_array['previewlength'].')'; + } else { + $framedata .= str_replace("\x00", '', $source_data_array['ownerid'])."\x00"; + $framedata .= getid3_lib::BigEndian2String($source_data_array['previewstart'], 2, false); + $framedata .= getid3_lib::BigEndian2String($source_data_array['previewlength'], 2, false); + $framedata .= $source_data_array['encryptioninfo']; + } + break; + + case 'LINK': + // 4.20 LINK Linked information + // Frame identifier $xx xx xx xx + // URL $00 + // ID and additional data + if (!getid3_id3v2::IsValidID3v2FrameName($source_data_array['frameid'], $this->majorversion)) { + $this->errors[] = 'Invalid Frame Identifier in '.$frame_name.' ('.$source_data_array['frameid'].')'; + } elseif (!$this->IsValidURL($source_data_array['data'], true, false)) { + //$this->errors[] = 'Invalid URL in '.$frame_name.' ('.$source_data_array['data'].')'; + // probably should be an error, need to rewrite IsValidURL() to handle other encodings + $this->warnings[] = 'Invalid URL in '.$frame_name.' ('.$source_data_array['data'].')'; + } elseif ((($source_data_array['frameid'] == 'AENC') || ($source_data_array['frameid'] == 'APIC') || ($source_data_array['frameid'] == 'GEOB') || ($source_data_array['frameid'] == 'TXXX')) && ($source_data_array['additionaldata'] == '')) { + $this->errors[] = 'Content Descriptor must be specified as additional data for Frame Identifier of '.$source_data_array['frameid'].' in '.$frame_name; + } elseif (($source_data_array['frameid'] == 'USER') && (getid3_id3v2::LanguageLookup($source_data_array['additionaldata'], true) == '')) { + $this->errors[] = 'Language must be specified as additional data for Frame Identifier of '.$source_data_array['frameid'].' in '.$frame_name; + } elseif (($source_data_array['frameid'] == 'PRIV') && ($source_data_array['additionaldata'] == '')) { + $this->errors[] = 'Owner Identifier must be specified as additional data for Frame Identifier of '.$source_data_array['frameid'].' in '.$frame_name; + } elseif ((($source_data_array['frameid'] == 'COMM') || ($source_data_array['frameid'] == 'SYLT') || ($source_data_array['frameid'] == 'USLT')) && ((getid3_id3v2::LanguageLookup(substr($source_data_array['additionaldata'], 0, 3), true) == '') || (substr($source_data_array['additionaldata'], 3) == ''))) { + $this->errors[] = 'Language followed by Content Descriptor must be specified as additional data for Frame Identifier of '.$source_data_array['frameid'].' in '.$frame_name; + } else { + $framedata .= $source_data_array['frameid']; + $framedata .= str_replace("\x00", '', $source_data_array['data'])."\x00"; + switch ($source_data_array['frameid']) { + case 'COMM': + case 'SYLT': + case 'USLT': + case 'PRIV': + case 'USER': + case 'AENC': + case 'APIC': + case 'GEOB': + case 'TXXX': + $framedata .= $source_data_array['additionaldata']; + break; + case 'ASPI': + case 'ETCO': + case 'EQU2': + case 'MCID': + case 'MLLT': + case 'OWNE': + case 'RVA2': + case 'RVRB': + case 'SYTC': + case 'IPLS': + case 'RVAD': + case 'EQUA': + // no additional data required + break; + case 'RBUF': + if ($this->majorversion == 3) { + // no additional data required + } else { + $this->errors[] = $source_data_array['frameid'].' is not a valid Frame Identifier in '.$frame_name.' (in ID3v2.'.$this->majorversion.')'; + } + + default: + if ((substr($source_data_array['frameid'], 0, 1) == 'T') || (substr($source_data_array['frameid'], 0, 1) == 'W')) { + // no additional data required + } else { + $this->errors[] = $source_data_array['frameid'].' is not a valid Frame Identifier in '.$frame_name.' (in ID3v2.'.$this->majorversion.')'; + } + break; + } + } + break; + + case 'POSS': + // 4.21 POSS Position synchronisation frame (ID3v2.3+ only) + // Time stamp format $xx + // Position $xx (xx ...) + if (($source_data_array['timestampformat'] < 1) || ($source_data_array['timestampformat'] > 2)) { + $this->errors[] = 'Invalid Time Stamp Format in '.$frame_name.' ('.$source_data_array['timestampformat'].') (valid = 1 or 2)'; + } elseif (!$this->IsWithinBitRange($source_data_array['position'], 32, false)) { + $this->errors[] = 'Invalid Position in '.$frame_name.' ('.$source_data_array['position'].') (range = 0 to 4294967295)'; + } else { + $framedata .= chr($source_data_array['timestampformat']); + $framedata .= getid3_lib::BigEndian2String($source_data_array['position'], 4, false); + } + break; + + case 'USER': + // 4.22 USER Terms of use (ID3v2.3+ only) + // Text encoding $xx + // Language $xx xx xx + // The actual text + $source_data_array['encodingid'] = (isset($source_data_array['encodingid']) ? $source_data_array['encodingid'] : $this->id3v2_default_encodingid); + if (!$this->ID3v2IsValidTextEncoding($source_data_array['encodingid'])) { + $this->errors[] = 'Invalid Text Encoding in '.$frame_name.' ('.$source_data_array['encodingid'].')'; + } elseif (getid3_id3v2::LanguageLookup($source_data_array['language'], true) == '') { + $this->errors[] = 'Invalid Language in '.$frame_name.' ('.$source_data_array['language'].')'; + } else { + $framedata .= chr($source_data_array['encodingid']); + $framedata .= strtolower($source_data_array['language']); + $framedata .= $source_data_array['data']; + } + break; + + case 'OWNE': + // 4.23 OWNE Ownership frame (ID3v2.3+ only) + // Text encoding $xx + // Price paid $00 + // Date of purch. + // Seller + $source_data_array['encodingid'] = (isset($source_data_array['encodingid']) ? $source_data_array['encodingid'] : $this->id3v2_default_encodingid); + if (!$this->ID3v2IsValidTextEncoding($source_data_array['encodingid'])) { + $this->errors[] = 'Invalid Text Encoding in '.$frame_name.' ('.$source_data_array['encodingid'].')'; + } elseif (!$this->IsANumber($source_data_array['pricepaid']['value'], false)) { + $this->errors[] = 'Invalid Price Paid in '.$frame_name.' ('.$source_data_array['pricepaid']['value'].')'; + } elseif (!$this->IsValidDateStampString($source_data_array['purchasedate'])) { + $this->errors[] = 'Invalid Date Of Purchase in '.$frame_name.' ('.$source_data_array['purchasedate'].') (format = YYYYMMDD)'; + } else { + $framedata .= chr($source_data_array['encodingid']); + $framedata .= str_replace("\x00", '', $source_data_array['pricepaid']['value'])."\x00"; + $framedata .= $source_data_array['purchasedate']; + $framedata .= $source_data_array['seller']; + } + break; + + case 'COMR': + // 4.24 COMR Commercial frame (ID3v2.3+ only) + // Text encoding $xx + // Price string $00 + // Valid until + // Contact URL $00 + // Received as $xx + // Name of seller $00 (00) + // Description $00 (00) + // Picture MIME type $00 + // Seller logo + $source_data_array['encodingid'] = (isset($source_data_array['encodingid']) ? $source_data_array['encodingid'] : $this->id3v2_default_encodingid); + if (!$this->ID3v2IsValidTextEncoding($source_data_array['encodingid'])) { + $this->errors[] = 'Invalid Text Encoding in '.$frame_name.' ('.$source_data_array['encodingid'].')'; + } elseif (!$this->IsValidDateStampString($source_data_array['pricevaliduntil'])) { + $this->errors[] = 'Invalid Valid Until date in '.$frame_name.' ('.$source_data_array['pricevaliduntil'].') (format = YYYYMMDD)'; + } elseif (!$this->IsValidURL($source_data_array['contacturl'], false, true)) { + $this->errors[] = 'Invalid Contact URL in '.$frame_name.' ('.$source_data_array['contacturl'].') (allowed schemes: http, https, ftp, mailto)'; + } elseif (!$this->ID3v2IsValidCOMRreceivedAs($source_data_array['receivedasid'])) { + $this->errors[] = 'Invalid Received As byte in '.$frame_name.' ('.$source_data_array['contacturl'].') (range = 0 to 8)'; + } elseif (!$this->IsValidMIMEstring($source_data_array['mime'])) { + $this->errors[] = 'Invalid MIME Type in '.$frame_name.' ('.$source_data_array['mime'].')'; + } else { + $framedata .= chr($source_data_array['encodingid']); + unset($pricestring); + foreach ($source_data_array['price'] as $key => $val) { + if ($this->ID3v2IsValidPriceString($key.$val['value'])) { + $pricestrings[] = $key.$val['value']; + } else { + $this->errors[] = 'Invalid Price String in '.$frame_name.' ('.$key.$val['value'].')'; + } + } + $framedata .= implode('/', $pricestrings); + $framedata .= $source_data_array['pricevaliduntil']; + $framedata .= str_replace("\x00", '', $source_data_array['contacturl'])."\x00"; + $framedata .= chr($source_data_array['receivedasid']); + $framedata .= $source_data_array['sellername'].getid3_id3v2::TextEncodingTerminatorLookup($source_data_array['encodingid']); + $framedata .= $source_data_array['description'].getid3_id3v2::TextEncodingTerminatorLookup($source_data_array['encodingid']); + $framedata .= $source_data_array['mime']."\x00"; + $framedata .= $source_data_array['logo']; + } + break; + + case 'ENCR': + // 4.25 ENCR Encryption method registration (ID3v2.3+ only) + // Owner identifier $00 + // Method symbol $xx + // Encryption data + if (!$this->IsWithinBitRange($source_data_array['methodsymbol'], 8, false)) { + $this->errors[] = 'Invalid Group Symbol in '.$frame_name.' ('.$source_data_array['methodsymbol'].') (range = 0 to 255)'; + } else { + $framedata .= str_replace("\x00", '', $source_data_array['ownerid'])."\x00"; + $framedata .= ord($source_data_array['methodsymbol']); + $framedata .= $source_data_array['data']; + } + break; + + case 'GRID': + // 4.26 GRID Group identification registration (ID3v2.3+ only) + // Owner identifier $00 + // Group symbol $xx + // Group dependent data + if (!$this->IsWithinBitRange($source_data_array['groupsymbol'], 8, false)) { + $this->errors[] = 'Invalid Group Symbol in '.$frame_name.' ('.$source_data_array['groupsymbol'].') (range = 0 to 255)'; + } else { + $framedata .= str_replace("\x00", '', $source_data_array['ownerid'])."\x00"; + $framedata .= ord($source_data_array['groupsymbol']); + $framedata .= $source_data_array['data']; + } + break; + + case 'PRIV': + // 4.27 PRIV Private frame (ID3v2.3+ only) + // Owner identifier $00 + // The private data + $framedata .= str_replace("\x00", '', $source_data_array['ownerid'])."\x00"; + $framedata .= $source_data_array['data']; + break; + + case 'SIGN': + // 4.28 SIGN Signature frame (ID3v2.4+ only) + // Group symbol $xx + // Signature + if (!$this->IsWithinBitRange($source_data_array['groupsymbol'], 8, false)) { + $this->errors[] = 'Invalid Group Symbol in '.$frame_name.' ('.$source_data_array['groupsymbol'].') (range = 0 to 255)'; + } else { + $framedata .= ord($source_data_array['groupsymbol']); + $framedata .= $source_data_array['data']; + } + break; + + case 'SEEK': + // 4.29 SEEK Seek frame (ID3v2.4+ only) + // Minimum offset to next tag $xx xx xx xx + if (!$this->IsWithinBitRange($source_data_array['data'], 32, false)) { + $this->errors[] = 'Invalid Minimum Offset in '.$frame_name.' ('.$source_data_array['data'].') (range = 0 to 4294967295)'; + } else { + $framedata .= getid3_lib::BigEndian2String($source_data_array['data'], 4, false); + } + break; + + case 'ASPI': + // 4.30 ASPI Audio seek point index (ID3v2.4+ only) + // Indexed data start (S) $xx xx xx xx + // Indexed data length (L) $xx xx xx xx + // Number of index points (N) $xx xx + // Bits per index point (b) $xx + // Then for every index point the following data is included: + // Fraction at index (Fi) $xx (xx) + if (!$this->IsWithinBitRange($source_data_array['datastart'], 32, false)) { + $this->errors[] = 'Invalid Indexed Data Start in '.$frame_name.' ('.$source_data_array['datastart'].') (range = 0 to 4294967295)'; + } elseif (!$this->IsWithinBitRange($source_data_array['datalength'], 32, false)) { + $this->errors[] = 'Invalid Indexed Data Length in '.$frame_name.' ('.$source_data_array['datalength'].') (range = 0 to 4294967295)'; + } elseif (!$this->IsWithinBitRange($source_data_array['indexpoints'], 16, false)) { + $this->errors[] = 'Invalid Number Of Index Points in '.$frame_name.' ('.$source_data_array['indexpoints'].') (range = 0 to 65535)'; + } elseif (!$this->IsWithinBitRange($source_data_array['bitsperpoint'], 8, false)) { + $this->errors[] = 'Invalid Bits Per Index Point in '.$frame_name.' ('.$source_data_array['bitsperpoint'].') (range = 0 to 255)'; + } elseif ($source_data_array['indexpoints'] != count($source_data_array['indexes'])) { + $this->errors[] = 'Number Of Index Points does not match actual supplied data in '.$frame_name; + } else { + $framedata .= getid3_lib::BigEndian2String($source_data_array['datastart'], 4, false); + $framedata .= getid3_lib::BigEndian2String($source_data_array['datalength'], 4, false); + $framedata .= getid3_lib::BigEndian2String($source_data_array['indexpoints'], 2, false); + $framedata .= getid3_lib::BigEndian2String($source_data_array['bitsperpoint'], 1, false); + foreach ($source_data_array['indexes'] as $key => $val) { + $framedata .= getid3_lib::BigEndian2String($val, ceil($source_data_array['bitsperpoint'] / 8), false); + } + } + break; + + case 'RGAD': + // RGAD Replay Gain Adjustment + // http://privatewww.essex.ac.uk/~djmrob/replaygain/ + // Peak Amplitude $xx $xx $xx $xx + // Radio Replay Gain Adjustment %aaabbbcd %dddddddd + // Audiophile Replay Gain Adjustment %aaabbbcd %dddddddd + // a - name code + // b - originator code + // c - sign bit + // d - replay gain adjustment + + if (($source_data_array['track_adjustment'] > 51) || ($source_data_array['track_adjustment'] < -51)) { + $this->errors[] = 'Invalid Track Adjustment in '.$frame_name.' ('.$source_data_array['track_adjustment'].') (range = -51.0 to +51.0)'; + } elseif (($source_data_array['album_adjustment'] > 51) || ($source_data_array['album_adjustment'] < -51)) { + $this->errors[] = 'Invalid Album Adjustment in '.$frame_name.' ('.$source_data_array['album_adjustment'].') (range = -51.0 to +51.0)'; + } elseif (!$this->ID3v2IsValidRGADname($source_data_array['raw']['track_name'])) { + $this->errors[] = 'Invalid Track Name Code in '.$frame_name.' ('.$source_data_array['raw']['track_name'].') (range = 0 to 2)'; + } elseif (!$this->ID3v2IsValidRGADname($source_data_array['raw']['album_name'])) { + $this->errors[] = 'Invalid Album Name Code in '.$frame_name.' ('.$source_data_array['raw']['album_name'].') (range = 0 to 2)'; + } elseif (!$this->ID3v2IsValidRGADoriginator($source_data_array['raw']['track_originator'])) { + $this->errors[] = 'Invalid Track Originator Code in '.$frame_name.' ('.$source_data_array['raw']['track_originator'].') (range = 0 to 3)'; + } elseif (!$this->ID3v2IsValidRGADoriginator($source_data_array['raw']['album_originator'])) { + $this->errors[] = 'Invalid Album Originator Code in '.$frame_name.' ('.$source_data_array['raw']['album_originator'].') (range = 0 to 3)'; + } else { + $framedata .= getid3_lib::Float2String($source_data_array['peakamplitude'], 32); + $framedata .= getid3_lib::RGADgainString($source_data_array['raw']['track_name'], $source_data_array['raw']['track_originator'], $source_data_array['track_adjustment']); + $framedata .= getid3_lib::RGADgainString($source_data_array['raw']['album_name'], $source_data_array['raw']['album_originator'], $source_data_array['album_adjustment']); + } + break; + + default: + if ((($this->majorversion == 2) && (strlen($frame_name) != 3)) || (($this->majorversion > 2) && (strlen($frame_name) != 4))) { + $this->errors[] = 'Invalid frame name "'.$frame_name.'" for ID3v2.'.$this->majorversion; + } elseif ($frame_name{0} == 'T') { + // 4.2. T??? Text information frames + // Text encoding $xx + // Information + $source_data_array['encodingid'] = (isset($source_data_array['encodingid']) ? $source_data_array['encodingid'] : $this->id3v2_default_encodingid); + if (!$this->ID3v2IsValidTextEncoding($source_data_array['encodingid'])) { + $this->errors[] = 'Invalid Text Encoding in '.$frame_name.' ('.$source_data_array['encodingid'].') for ID3v2.'.$this->majorversion; + } else { + $framedata .= chr($source_data_array['encodingid']); + $framedata .= $source_data_array['data']; + } + } elseif ($frame_name{0} == 'W') { + // 4.3. W??? URL link frames + // URL + if (!$this->IsValidURL($source_data_array['data'], false, false)) { + //$this->errors[] = 'Invalid URL in '.$frame_name.' ('.$source_data_array['data'].')'; + // probably should be an error, need to rewrite IsValidURL() to handle other encodings + $this->warnings[] = 'Invalid URL in '.$frame_name.' ('.$source_data_array['data'].')'; + } else { + $framedata .= $source_data_array['data']; + } + } else { + $this->errors[] = $frame_name.' not yet supported in $this->GenerateID3v2FrameData()'; + } + break; + } + } + if (!empty($this->errors)) { + return false; + } + return $framedata; + } + + public function ID3v2FrameIsAllowed($frame_name, $source_data_array) { + static $PreviousFrames = array(); + + if ($frame_name === null) { + // if the writing functions are called multiple times, the static array needs to be + // cleared - this can be done by calling $this->ID3v2FrameIsAllowed(null, '') + $PreviousFrames = array(); + return true; + } + if ($this->majorversion == 4) { + switch ($frame_name) { + case 'UFID': + case 'AENC': + case 'ENCR': + case 'GRID': + if (!isset($source_data_array['ownerid'])) { + $this->errors[] = '[ownerid] not specified for '.$frame_name; + } elseif (in_array($frame_name.$source_data_array['ownerid'], $PreviousFrames)) { + $this->errors[] = 'Only one '.$frame_name.' tag allowed with the same OwnerID ('.$source_data_array['ownerid'].')'; + } else { + $PreviousFrames[] = $frame_name.$source_data_array['ownerid']; + } + break; + + case 'TXXX': + case 'WXXX': + case 'RVA2': + case 'EQU2': + case 'APIC': + case 'GEOB': + if (!isset($source_data_array['description'])) { + $this->errors[] = '[description] not specified for '.$frame_name; + } elseif (in_array($frame_name.$source_data_array['description'], $PreviousFrames)) { + $this->errors[] = 'Only one '.$frame_name.' tag allowed with the same Description ('.$source_data_array['description'].')'; + } else { + $PreviousFrames[] = $frame_name.$source_data_array['description']; + } + break; + + case 'USER': + if (!isset($source_data_array['language'])) { + $this->errors[] = '[language] not specified for '.$frame_name; + } elseif (in_array($frame_name.$source_data_array['language'], $PreviousFrames)) { + $this->errors[] = 'Only one '.$frame_name.' tag allowed with the same Language ('.$source_data_array['language'].')'; + } else { + $PreviousFrames[] = $frame_name.$source_data_array['language']; + } + break; + + case 'USLT': + case 'SYLT': + case 'COMM': + if (!isset($source_data_array['language'])) { + $this->errors[] = '[language] not specified for '.$frame_name; + } elseif (!isset($source_data_array['description'])) { + $this->errors[] = '[description] not specified for '.$frame_name; + } elseif (in_array($frame_name.$source_data_array['language'].$source_data_array['description'], $PreviousFrames)) { + $this->errors[] = 'Only one '.$frame_name.' tag allowed with the same Language + Description ('.$source_data_array['language'].' + '.$source_data_array['description'].')'; + } else { + $PreviousFrames[] = $frame_name.$source_data_array['language'].$source_data_array['description']; + } + break; + + case 'POPM': + if (!isset($source_data_array['email'])) { + $this->errors[] = '[email] not specified for '.$frame_name; + } elseif (in_array($frame_name.$source_data_array['email'], $PreviousFrames)) { + $this->errors[] = 'Only one '.$frame_name.' tag allowed with the same Email ('.$source_data_array['email'].')'; + } else { + $PreviousFrames[] = $frame_name.$source_data_array['email']; + } + break; + + case 'IPLS': + case 'MCDI': + case 'ETCO': + case 'MLLT': + case 'SYTC': + case 'RVRB': + case 'PCNT': + case 'RBUF': + case 'POSS': + case 'OWNE': + case 'SEEK': + case 'ASPI': + case 'RGAD': + if (in_array($frame_name, $PreviousFrames)) { + $this->errors[] = 'Only one '.$frame_name.' tag allowed'; + } else { + $PreviousFrames[] = $frame_name; + } + break; + + case 'LINK': + // this isn't implemented quite right (yet) - it should check the target frame data for compliance + // but right now it just allows one linked frame of each type, to be safe. + if (!isset($source_data_array['frameid'])) { + $this->errors[] = '[frameid] not specified for '.$frame_name; + } elseif (in_array($frame_name.$source_data_array['frameid'], $PreviousFrames)) { + $this->errors[] = 'Only one '.$frame_name.' tag allowed with the same FrameID ('.$source_data_array['frameid'].')'; + } elseif (in_array($source_data_array['frameid'], $PreviousFrames)) { + // no links to singleton tags + $this->errors[] = 'Cannot specify a '.$frame_name.' tag to a singleton tag that already exists ('.$source_data_array['frameid'].')'; + } else { + $PreviousFrames[] = $frame_name.$source_data_array['frameid']; // only one linked tag of this type + $PreviousFrames[] = $source_data_array['frameid']; // no non-linked singleton tags of this type + } + break; + + case 'COMR': + // There may be more than one 'commercial frame' in a tag, but no two may be identical + // Checking isn't implemented at all (yet) - just assumes that it's OK. + break; + + case 'PRIV': + case 'SIGN': + if (!isset($source_data_array['ownerid'])) { + $this->errors[] = '[ownerid] not specified for '.$frame_name; + } elseif (!isset($source_data_array['data'])) { + $this->errors[] = '[data] not specified for '.$frame_name; + } elseif (in_array($frame_name.$source_data_array['ownerid'].$source_data_array['data'], $PreviousFrames)) { + $this->errors[] = 'Only one '.$frame_name.' tag allowed with the same OwnerID + Data ('.$source_data_array['ownerid'].' + '.$source_data_array['data'].')'; + } else { + $PreviousFrames[] = $frame_name.$source_data_array['ownerid'].$source_data_array['data']; + } + break; + + default: + if (($frame_name{0} != 'T') && ($frame_name{0} != 'W')) { + $this->errors[] = 'Frame not allowed in ID3v2.'.$this->majorversion.': '.$frame_name; + } + break; + } + + } elseif ($this->majorversion == 3) { + + switch ($frame_name) { + case 'UFID': + case 'AENC': + case 'ENCR': + case 'GRID': + if (!isset($source_data_array['ownerid'])) { + $this->errors[] = '[ownerid] not specified for '.$frame_name; + } elseif (in_array($frame_name.$source_data_array['ownerid'], $PreviousFrames)) { + $this->errors[] = 'Only one '.$frame_name.' tag allowed with the same OwnerID ('.$source_data_array['ownerid'].')'; + } else { + $PreviousFrames[] = $frame_name.$source_data_array['ownerid']; + } + break; + + case 'TXXX': + case 'WXXX': + case 'APIC': + case 'GEOB': + if (!isset($source_data_array['description'])) { + $this->errors[] = '[description] not specified for '.$frame_name; + } elseif (in_array($frame_name.$source_data_array['description'], $PreviousFrames)) { + $this->errors[] = 'Only one '.$frame_name.' tag allowed with the same Description ('.$source_data_array['description'].')'; + } else { + $PreviousFrames[] = $frame_name.$source_data_array['description']; + } + break; + + case 'USER': + if (!isset($source_data_array['language'])) { + $this->errors[] = '[language] not specified for '.$frame_name; + } elseif (in_array($frame_name.$source_data_array['language'], $PreviousFrames)) { + $this->errors[] = 'Only one '.$frame_name.' tag allowed with the same Language ('.$source_data_array['language'].')'; + } else { + $PreviousFrames[] = $frame_name.$source_data_array['language']; + } + break; + + case 'USLT': + case 'SYLT': + case 'COMM': + if (!isset($source_data_array['language'])) { + $this->errors[] = '[language] not specified for '.$frame_name; + } elseif (!isset($source_data_array['description'])) { + $this->errors[] = '[description] not specified for '.$frame_name; + } elseif (in_array($frame_name.$source_data_array['language'].$source_data_array['description'], $PreviousFrames)) { + $this->errors[] = 'Only one '.$frame_name.' tag allowed with the same Language + Description ('.$source_data_array['language'].' + '.$source_data_array['description'].')'; + } else { + $PreviousFrames[] = $frame_name.$source_data_array['language'].$source_data_array['description']; + } + break; + + case 'POPM': + if (!isset($source_data_array['email'])) { + $this->errors[] = '[email] not specified for '.$frame_name; + } elseif (in_array($frame_name.$source_data_array['email'], $PreviousFrames)) { + $this->errors[] = 'Only one '.$frame_name.' tag allowed with the same Email ('.$source_data_array['email'].')'; + } else { + $PreviousFrames[] = $frame_name.$source_data_array['email']; + } + break; + + case 'IPLS': + case 'MCDI': + case 'ETCO': + case 'MLLT': + case 'SYTC': + case 'RVAD': + case 'EQUA': + case 'RVRB': + case 'PCNT': + case 'RBUF': + case 'POSS': + case 'OWNE': + case 'RGAD': + if (in_array($frame_name, $PreviousFrames)) { + $this->errors[] = 'Only one '.$frame_name.' tag allowed'; + } else { + $PreviousFrames[] = $frame_name; + } + break; + + case 'LINK': + // this isn't implemented quite right (yet) - it should check the target frame data for compliance + // but right now it just allows one linked frame of each type, to be safe. + if (!isset($source_data_array['frameid'])) { + $this->errors[] = '[frameid] not specified for '.$frame_name; + } elseif (in_array($frame_name.$source_data_array['frameid'], $PreviousFrames)) { + $this->errors[] = 'Only one '.$frame_name.' tag allowed with the same FrameID ('.$source_data_array['frameid'].')'; + } elseif (in_array($source_data_array['frameid'], $PreviousFrames)) { + // no links to singleton tags + $this->errors[] = 'Cannot specify a '.$frame_name.' tag to a singleton tag that already exists ('.$source_data_array['frameid'].')'; + } else { + $PreviousFrames[] = $frame_name.$source_data_array['frameid']; // only one linked tag of this type + $PreviousFrames[] = $source_data_array['frameid']; // no non-linked singleton tags of this type + } + break; + + case 'COMR': + // There may be more than one 'commercial frame' in a tag, but no two may be identical + // Checking isn't implemented at all (yet) - just assumes that it's OK. + break; + + case 'PRIV': + if (!isset($source_data_array['ownerid'])) { + $this->errors[] = '[ownerid] not specified for '.$frame_name; + } elseif (!isset($source_data_array['data'])) { + $this->errors[] = '[data] not specified for '.$frame_name; + } elseif (in_array($frame_name.$source_data_array['ownerid'].$source_data_array['data'], $PreviousFrames)) { + $this->errors[] = 'Only one '.$frame_name.' tag allowed with the same OwnerID + Data ('.$source_data_array['ownerid'].' + '.$source_data_array['data'].')'; + } else { + $PreviousFrames[] = $frame_name.$source_data_array['ownerid'].$source_data_array['data']; + } + break; + + default: + if (($frame_name{0} != 'T') && ($frame_name{0} != 'W')) { + $this->errors[] = 'Frame not allowed in ID3v2.'.$this->majorversion.': '.$frame_name; + } + break; + } + + } elseif ($this->majorversion == 2) { + + switch ($frame_name) { + case 'UFI': + case 'CRM': + case 'CRA': + if (!isset($source_data_array['ownerid'])) { + $this->errors[] = '[ownerid] not specified for '.$frame_name; + } elseif (in_array($frame_name.$source_data_array['ownerid'], $PreviousFrames)) { + $this->errors[] = 'Only one '.$frame_name.' tag allowed with the same OwnerID ('.$source_data_array['ownerid'].')'; + } else { + $PreviousFrames[] = $frame_name.$source_data_array['ownerid']; + } + break; + + case 'TXX': + case 'WXX': + case 'PIC': + case 'GEO': + if (!isset($source_data_array['description'])) { + $this->errors[] = '[description] not specified for '.$frame_name; + } elseif (in_array($frame_name.$source_data_array['description'], $PreviousFrames)) { + $this->errors[] = 'Only one '.$frame_name.' tag allowed with the same Description ('.$source_data_array['description'].')'; + } else { + $PreviousFrames[] = $frame_name.$source_data_array['description']; + } + break; + + case 'ULT': + case 'SLT': + case 'COM': + if (!isset($source_data_array['language'])) { + $this->errors[] = '[language] not specified for '.$frame_name; + } elseif (!isset($source_data_array['description'])) { + $this->errors[] = '[description] not specified for '.$frame_name; + } elseif (in_array($frame_name.$source_data_array['language'].$source_data_array['description'], $PreviousFrames)) { + $this->errors[] = 'Only one '.$frame_name.' tag allowed with the same Language + Description ('.$source_data_array['language'].' + '.$source_data_array['description'].')'; + } else { + $PreviousFrames[] = $frame_name.$source_data_array['language'].$source_data_array['description']; + } + break; + + case 'POP': + if (!isset($source_data_array['email'])) { + $this->errors[] = '[email] not specified for '.$frame_name; + } elseif (in_array($frame_name.$source_data_array['email'], $PreviousFrames)) { + $this->errors[] = 'Only one '.$frame_name.' tag allowed with the same Email ('.$source_data_array['email'].')'; + } else { + $PreviousFrames[] = $frame_name.$source_data_array['email']; + } + break; + + case 'IPL': + case 'MCI': + case 'ETC': + case 'MLL': + case 'STC': + case 'RVA': + case 'EQU': + case 'REV': + case 'CNT': + case 'BUF': + if (in_array($frame_name, $PreviousFrames)) { + $this->errors[] = 'Only one '.$frame_name.' tag allowed'; + } else { + $PreviousFrames[] = $frame_name; + } + break; + + case 'LNK': + // this isn't implemented quite right (yet) - it should check the target frame data for compliance + // but right now it just allows one linked frame of each type, to be safe. + if (!isset($source_data_array['frameid'])) { + $this->errors[] = '[frameid] not specified for '.$frame_name; + } elseif (in_array($frame_name.$source_data_array['frameid'], $PreviousFrames)) { + $this->errors[] = 'Only one '.$frame_name.' tag allowed with the same FrameID ('.$source_data_array['frameid'].')'; + } elseif (in_array($source_data_array['frameid'], $PreviousFrames)) { + // no links to singleton tags + $this->errors[] = 'Cannot specify a '.$frame_name.' tag to a singleton tag that already exists ('.$source_data_array['frameid'].')'; + } else { + $PreviousFrames[] = $frame_name.$source_data_array['frameid']; // only one linked tag of this type + $PreviousFrames[] = $source_data_array['frameid']; // no non-linked singleton tags of this type + } + break; + + default: + if (($frame_name{0} != 'T') && ($frame_name{0} != 'W')) { + $this->errors[] = 'Frame not allowed in ID3v2.'.$this->majorversion.': '.$frame_name; + } + break; + } + } + + if (!empty($this->errors)) { + return false; + } + return true; + } + + public function GenerateID3v2Tag($noerrorsonly=true) { + $this->ID3v2FrameIsAllowed(null, ''); // clear static array in case this isn't the first call to $this->GenerateID3v2Tag() + + $tagstring = ''; + if (is_array($this->tag_data)) { + foreach ($this->tag_data as $frame_name => $frame_rawinputdata) { + foreach ($frame_rawinputdata as $irrelevantindex => $source_data_array) { + if (getid3_id3v2::IsValidID3v2FrameName($frame_name, $this->majorversion)) { + unset($frame_length); + unset($frame_flags); + $frame_data = false; + if ($this->ID3v2FrameIsAllowed($frame_name, $source_data_array)) { + if(array_key_exists('description', $source_data_array) && array_key_exists('encodingid', $source_data_array) && array_key_exists('encoding', $this->tag_data)) { + $source_data_array['description'] = getid3_lib::iconv_fallback($this->tag_data['encoding'], $source_data_array['encoding'], $source_data_array['description']); + } + if ($frame_data = $this->GenerateID3v2FrameData($frame_name, $source_data_array)) { + $FrameUnsynchronisation = false; + if ($this->majorversion >= 4) { + // frame-level unsynchronisation + $unsynchdata = $frame_data; + if ($this->id3v2_use_unsynchronisation) { + $unsynchdata = $this->Unsynchronise($frame_data); + } + if (strlen($unsynchdata) != strlen($frame_data)) { + // unsynchronisation needed + $FrameUnsynchronisation = true; + $frame_data = $unsynchdata; + if (isset($TagUnsynchronisation) && $TagUnsynchronisation === false) { + // only set to true if ALL frames are unsynchronised + } else { + $TagUnsynchronisation = true; + } + } else { + if (isset($TagUnsynchronisation)) { + $TagUnsynchronisation = false; + } + } + unset($unsynchdata); + + $frame_length = getid3_lib::BigEndian2String(strlen($frame_data), 4, true); + } else { + $frame_length = getid3_lib::BigEndian2String(strlen($frame_data), 4, false); + } + $frame_flags = $this->GenerateID3v2FrameFlags($this->ID3v2FrameFlagsLookupTagAlter($frame_name), $this->ID3v2FrameFlagsLookupFileAlter($frame_name), false, false, false, false, $FrameUnsynchronisation, false); + } + } else { + $this->errors[] = 'Frame "'.$frame_name.'" is NOT allowed'; + } + if ($frame_data === false) { + $this->errors[] = '$this->GenerateID3v2FrameData() failed for "'.$frame_name.'"'; + if ($noerrorsonly) { + return false; + } else { + unset($frame_name); + } + } + } else { + // ignore any invalid frame names, including 'title', 'header', etc + $this->warnings[] = 'Ignoring invalid ID3v2 frame type: "'.$frame_name.'"'; + unset($frame_name); + unset($frame_length); + unset($frame_flags); + unset($frame_data); + } + if (isset($frame_name) && isset($frame_length) && isset($frame_flags) && isset($frame_data)) { + $tagstring .= $frame_name.$frame_length.$frame_flags.$frame_data; + } + } + } + + if (!isset($TagUnsynchronisation)) { + $TagUnsynchronisation = false; + } + if (($this->majorversion <= 3) && $this->id3v2_use_unsynchronisation) { + // tag-level unsynchronisation + $unsynchdata = $this->Unsynchronise($tagstring); + if (strlen($unsynchdata) != strlen($tagstring)) { + // unsynchronisation needed + $TagUnsynchronisation = true; + $tagstring = $unsynchdata; + } + } + + while ($this->paddedlength < (strlen($tagstring) + getid3_id3v2::ID3v2HeaderLength($this->majorversion))) { + $this->paddedlength += 1024; + } + + $footer = false; // ID3v2 footers not yet supported in getID3() + if (!$footer && ($this->paddedlength > (strlen($tagstring) + getid3_id3v2::ID3v2HeaderLength($this->majorversion)))) { + // pad up to $paddedlength bytes if unpadded tag is shorter than $paddedlength + // "Furthermore it MUST NOT have any padding when a tag footer is added to the tag." + if (($this->paddedlength - strlen($tagstring) - getid3_id3v2::ID3v2HeaderLength($this->majorversion)) > 0) { + $tagstring .= str_repeat("\x00", $this->paddedlength - strlen($tagstring) - getid3_id3v2::ID3v2HeaderLength($this->majorversion)); + } + } + if ($this->id3v2_use_unsynchronisation && (substr($tagstring, strlen($tagstring) - 1, 1) == "\xFF")) { + // special unsynchronisation case: + // if last byte == $FF then appended a $00 + $TagUnsynchronisation = true; + $tagstring .= "\x00"; + } + + $tagheader = 'ID3'; + $tagheader .= chr($this->majorversion); + $tagheader .= chr($this->minorversion); + $tagheader .= $this->GenerateID3v2TagFlags(array('unsynchronisation'=>$TagUnsynchronisation)); + $tagheader .= getid3_lib::BigEndian2String(strlen($tagstring), 4, true); + + return $tagheader.$tagstring; + } + $this->errors[] = 'tag_data is not an array in GenerateID3v2Tag()'; + return false; + } + + public function ID3v2IsValidPriceString($pricestring) { + if (getid3_id3v2::LanguageLookup(substr($pricestring, 0, 3), true) == '') { + return false; + } elseif (!$this->IsANumber(substr($pricestring, 3), true)) { + return false; + } + return true; + } + + public function ID3v2FrameFlagsLookupTagAlter($framename) { + // unfinished + switch ($framename) { + case 'RGAD': + $allow = true; + default: + $allow = false; + break; + } + return $allow; + } + + public function ID3v2FrameFlagsLookupFileAlter($framename) { + // unfinished + switch ($framename) { + case 'RGAD': + return false; + break; + + default: + return false; + break; + } + } + + public function ID3v2IsValidETCOevent($eventid) { + if (($eventid < 0) || ($eventid > 0xFF)) { + // outside range of 1 byte + return false; + } elseif (($eventid >= 0xF0) && ($eventid <= 0xFC)) { + // reserved for future use + return false; + } elseif (($eventid >= 0x17) && ($eventid <= 0xDF)) { + // reserved for future use + return false; + } elseif (($eventid >= 0x0E) && ($eventid <= 0x16) && ($this->majorversion == 2)) { + // not defined in ID3v2.2 + return false; + } elseif (($eventid >= 0x15) && ($eventid <= 0x16) && ($this->majorversion == 3)) { + // not defined in ID3v2.3 + return false; + } + return true; + } + + public function ID3v2IsValidSYLTtype($contenttype) { + if (($contenttype >= 0) && ($contenttype <= 8) && ($this->majorversion == 4)) { + return true; + } elseif (($contenttype >= 0) && ($contenttype <= 6) && ($this->majorversion == 3)) { + return true; + } + return false; + } + + public function ID3v2IsValidRVA2channeltype($channeltype) { + if (($channeltype >= 0) && ($channeltype <= 8) && ($this->majorversion == 4)) { + return true; + } + return false; + } + + public function ID3v2IsValidAPICpicturetype($picturetype) { + if (($picturetype >= 0) && ($picturetype <= 0x14) && ($this->majorversion >= 2) && ($this->majorversion <= 4)) { + return true; + } + return false; + } + + public function ID3v2IsValidAPICimageformat($imageformat) { + if ($imageformat == '-->') { + return true; + } elseif ($this->majorversion == 2) { + if ((strlen($imageformat) == 3) && ($imageformat == strtoupper($imageformat))) { + return true; + } + } elseif (($this->majorversion == 3) || ($this->majorversion == 4)) { + if ($this->IsValidMIMEstring($imageformat)) { + return true; + } + } + return false; + } + + public function ID3v2IsValidCOMRreceivedAs($receivedas) { + if (($this->majorversion >= 3) && ($receivedas >= 0) && ($receivedas <= 8)) { + return true; + } + return false; + } + + public static function ID3v2IsValidRGADname($RGADname) { + if (($RGADname >= 0) && ($RGADname <= 2)) { + return true; + } + return false; + } + + public static function ID3v2IsValidRGADoriginator($RGADoriginator) { + if (($RGADoriginator >= 0) && ($RGADoriginator <= 3)) { + return true; + } + return false; + } + + public function ID3v2IsValidTextEncoding($textencodingbyte) { + // 0 = ISO-8859-1 + // 1 = UTF-16 with BOM + // 2 = UTF-16BE without BOM + // 3 = UTF-8 + static $ID3v2IsValidTextEncoding_cache = array( + 2 => array(true, true), // ID3v2.2 - allow 0=ISO-8859-1, 1=UTF-16 + 3 => array(true, true), // ID3v2.3 - allow 0=ISO-8859-1, 1=UTF-16 + 4 => array(true, true, true, true), // ID3v2.4 - allow 0=ISO-8859-1, 1=UTF-16, 2=UTF-16BE, 3=UTF-8 + ); + return isset($ID3v2IsValidTextEncoding_cache[$this->majorversion][$textencodingbyte]); + } + + public static function Unsynchronise($data) { + // Whenever a false synchronisation is found within the tag, one zeroed + // byte is inserted after the first false synchronisation byte. The + // format of a correct sync that should be altered by ID3 encoders is as + // follows: + // %11111111 111xxxxx + // And should be replaced with: + // %11111111 00000000 111xxxxx + // This has the side effect that all $FF 00 combinations have to be + // altered, so they won't be affected by the decoding process. Therefore + // all the $FF 00 combinations have to be replaced with the $FF 00 00 + // combination during the unsynchronisation. + + $data = str_replace("\xFF\x00", "\xFF\x00\x00", $data); + $unsyncheddata = ''; + $datalength = strlen($data); + for ($i = 0; $i < $datalength; $i++) { + $thischar = $data{$i}; + $unsyncheddata .= $thischar; + if ($thischar == "\xFF") { + $nextchar = ord($data{$i + 1}); + if (($nextchar & 0xE0) == 0xE0) { + // previous byte = 11111111, this byte = 111????? + $unsyncheddata .= "\x00"; + } + } + } + return $unsyncheddata; + } + + public function is_hash($var) { + // written by dev-nullØchristophe*vg + // taken from http://www.php.net/manual/en/function.array-merge-recursive.php + if (is_array($var)) { + $keys = array_keys($var); + $all_num = true; + for ($i = 0; $i < count($keys); $i++) { + if (is_string($keys[$i])) { + return true; + } + } + } + return false; + } + + public function array_join_merge($arr1, $arr2) { + // written by dev-nullØchristophe*vg + // taken from http://www.php.net/manual/en/function.array-merge-recursive.php + if (is_array($arr1) && is_array($arr2)) { + // the same -> merge + $new_array = array(); + + if ($this->is_hash($arr1) && $this->is_hash($arr2)) { + // hashes -> merge based on keys + $keys = array_merge(array_keys($arr1), array_keys($arr2)); + foreach ($keys as $key) { + $new_array[$key] = $this->array_join_merge((isset($arr1[$key]) ? $arr1[$key] : ''), (isset($arr2[$key]) ? $arr2[$key] : '')); + } + } else { + // two real arrays -> merge + $new_array = array_reverse(array_unique(array_reverse(array_merge($arr1, $arr2)))); + } + return $new_array; + } else { + // not the same ... take new one if defined, else the old one stays + return $arr2 ? $arr2 : $arr1; + } + } + + public static function IsValidMIMEstring($mimestring) { + return preg_match('#^.+/.+$#', $mimestring); + } + + public static function IsWithinBitRange($number, $maxbits, $signed=false) { + if ($signed) { + if (($number > (0 - pow(2, $maxbits - 1))) && ($number <= pow(2, $maxbits - 1))) { + return true; + } + } else { + if (($number >= 0) && ($number <= pow(2, $maxbits))) { + return true; + } + } + return false; + } + + public static function IsValidEmail($email) { + if (function_exists('filter_var')) { + return filter_var($email, FILTER_VALIDATE_EMAIL); + } + // VERY crude email validation + return preg_match('#^[^ ]+@[a-z\\-\\.]+\\.[a-z]{2,}$#', $email); + } + + public static function IsValidURL($url, $allowUserPass=false) { + if ($url == '') { + return false; + } + if ($allowUserPass !== true) { + if (strstr($url, '@')) { + // in the format http://user:pass@example.com or http://user@example.com + // but could easily be somebody incorrectly entering an email address in place of a URL + return false; + } + } + // 2016-06-08: relax URL checking to avoid falsely rejecting valid URLs, leave URL validation to the user + // http://www.getid3.org/phpBB3/viewtopic.php?t=1926 + return true; + /* + if ($parts = $this->safe_parse_url($url)) { + if (($parts['scheme'] != 'http') && ($parts['scheme'] != 'https') && ($parts['scheme'] != 'ftp') && ($parts['scheme'] != 'gopher')) { + return false; + } elseif (!preg_match('#^[[:alnum:]]([-.]?[0-9a-z])*\\.[a-z]{2,3}$#i', $parts['host'], $regs) && !preg_match('#^[0-9]{1,3}(\\.[0-9]{1,3}){3}$#', $parts['host'])) { + return false; + } elseif (!preg_match('#^([[:alnum:]-]|[\\_])*$#i', $parts['user'], $regs)) { + return false; + } elseif (!preg_match('#^([[:alnum:]-]|[\\_])*$#i', $parts['pass'], $regs)) { + return false; + } elseif (!preg_match('#^[[:alnum:]/_\\.@~-]*$#i', $parts['path'], $regs)) { + return false; + } elseif (!empty($parts['query']) && !preg_match('#^[[:alnum:]?&=+:;_()%\\#/,\\.-]*$#i', $parts['query'], $regs)) { + return false; + } else { + return true; + } + } + return false; + */ + } + + public static function safe_parse_url($url) { + $parts = @parse_url($url); + $parts['scheme'] = (isset($parts['scheme']) ? $parts['scheme'] : ''); + $parts['host'] = (isset($parts['host']) ? $parts['host'] : ''); + $parts['user'] = (isset($parts['user']) ? $parts['user'] : ''); + $parts['pass'] = (isset($parts['pass']) ? $parts['pass'] : ''); + $parts['path'] = (isset($parts['path']) ? $parts['path'] : ''); + $parts['query'] = (isset($parts['query']) ? $parts['query'] : ''); + return $parts; + } + + public static function ID3v2ShortFrameNameLookup($majorversion, $long_description) { + $long_description = str_replace(' ', '_', strtolower(trim($long_description))); + static $ID3v2ShortFrameNameLookup = array(); + if (empty($ID3v2ShortFrameNameLookup)) { + + // The following are unique to ID3v2.2 + $ID3v2ShortFrameNameLookup[2]['recommended_buffer_size'] = 'BUF'; + $ID3v2ShortFrameNameLookup[2]['comment'] = 'COM'; + $ID3v2ShortFrameNameLookup[2]['audio_encryption'] = 'CRA'; + $ID3v2ShortFrameNameLookup[2]['encrypted_meta_frame'] = 'CRM'; + $ID3v2ShortFrameNameLookup[2]['equalisation'] = 'EQU'; + $ID3v2ShortFrameNameLookup[2]['event_timing_codes'] = 'ETC'; + $ID3v2ShortFrameNameLookup[2]['general_encapsulated_object'] = 'GEO'; + $ID3v2ShortFrameNameLookup[2]['involved_people_list'] = 'IPL'; + $ID3v2ShortFrameNameLookup[2]['linked_information'] = 'LNK'; + $ID3v2ShortFrameNameLookup[2]['music_cd_identifier'] = 'MCI'; + $ID3v2ShortFrameNameLookup[2]['mpeg_location_lookup_table'] = 'MLL'; + $ID3v2ShortFrameNameLookup[2]['attached_picture'] = 'PIC'; + $ID3v2ShortFrameNameLookup[2]['popularimeter'] = 'POP'; + $ID3v2ShortFrameNameLookup[2]['reverb'] = 'REV'; + $ID3v2ShortFrameNameLookup[2]['relative_volume_adjustment'] = 'RVA'; + $ID3v2ShortFrameNameLookup[2]['synchronised_lyric'] = 'SLT'; + $ID3v2ShortFrameNameLookup[2]['synchronised_tempo_codes'] = 'STC'; + $ID3v2ShortFrameNameLookup[2]['album'] = 'TAL'; + $ID3v2ShortFrameNameLookup[2]['beats_per_minute'] = 'TBP'; + $ID3v2ShortFrameNameLookup[2]['bpm'] = 'TBP'; + $ID3v2ShortFrameNameLookup[2]['composer'] = 'TCM'; + $ID3v2ShortFrameNameLookup[2]['genre'] = 'TCO'; + $ID3v2ShortFrameNameLookup[2]['part_of_a_compilation'] = 'TCP'; + $ID3v2ShortFrameNameLookup[2]['copyright_message'] = 'TCR'; + $ID3v2ShortFrameNameLookup[2]['date'] = 'TDA'; + $ID3v2ShortFrameNameLookup[2]['playlist_delay'] = 'TDY'; + $ID3v2ShortFrameNameLookup[2]['encoded_by'] = 'TEN'; + $ID3v2ShortFrameNameLookup[2]['file_type'] = 'TFT'; + $ID3v2ShortFrameNameLookup[2]['time'] = 'TIM'; + $ID3v2ShortFrameNameLookup[2]['initial_key'] = 'TKE'; + $ID3v2ShortFrameNameLookup[2]['language'] = 'TLA'; + $ID3v2ShortFrameNameLookup[2]['length'] = 'TLE'; + $ID3v2ShortFrameNameLookup[2]['media_type'] = 'TMT'; + $ID3v2ShortFrameNameLookup[2]['original_artist'] = 'TOA'; + $ID3v2ShortFrameNameLookup[2]['original_filename'] = 'TOF'; + $ID3v2ShortFrameNameLookup[2]['original_lyricist'] = 'TOL'; + $ID3v2ShortFrameNameLookup[2]['original_year'] = 'TOR'; + $ID3v2ShortFrameNameLookup[2]['original_album'] = 'TOT'; + $ID3v2ShortFrameNameLookup[2]['artist'] = 'TP1'; + $ID3v2ShortFrameNameLookup[2]['band'] = 'TP2'; + $ID3v2ShortFrameNameLookup[2]['conductor'] = 'TP3'; + $ID3v2ShortFrameNameLookup[2]['remixer'] = 'TP4'; + $ID3v2ShortFrameNameLookup[2]['part_of_a_set'] = 'TPA'; + $ID3v2ShortFrameNameLookup[2]['publisher'] = 'TPB'; + $ID3v2ShortFrameNameLookup[2]['isrc'] = 'TRC'; + $ID3v2ShortFrameNameLookup[2]['recording_dates'] = 'TRD'; + $ID3v2ShortFrameNameLookup[2]['tracknumber'] = 'TRK'; + $ID3v2ShortFrameNameLookup[2]['track_number'] = 'TRK'; + $ID3v2ShortFrameNameLookup[2]['album_artist_sort_order'] = 'TS2'; + $ID3v2ShortFrameNameLookup[2]['album_sort_order'] = 'TSA'; + $ID3v2ShortFrameNameLookup[2]['composer_sort_order'] = 'TSC'; + $ID3v2ShortFrameNameLookup[2]['size'] = 'TSI'; + $ID3v2ShortFrameNameLookup[2]['performer_sort_order'] = 'TSP'; + $ID3v2ShortFrameNameLookup[2]['encoder_settings'] = 'TSS'; + $ID3v2ShortFrameNameLookup[2]['title_sort_order'] = 'TST'; + $ID3v2ShortFrameNameLookup[2]['content_group_description'] = 'TT1'; + $ID3v2ShortFrameNameLookup[2]['title'] = 'TT2'; + $ID3v2ShortFrameNameLookup[2]['subtitle'] = 'TT3'; + $ID3v2ShortFrameNameLookup[2]['lyricist'] = 'TXT'; + $ID3v2ShortFrameNameLookup[2]['text'] = 'TXX'; + $ID3v2ShortFrameNameLookup[2]['year'] = 'TYE'; + $ID3v2ShortFrameNameLookup[2]['unique_file_identifier'] = 'UFI'; + $ID3v2ShortFrameNameLookup[2]['unsychronised_lyric'] = 'ULT'; + $ID3v2ShortFrameNameLookup[2]['url_file'] = 'WAF'; + $ID3v2ShortFrameNameLookup[2]['url_artist'] = 'WAR'; + $ID3v2ShortFrameNameLookup[2]['url_source'] = 'WAS'; + $ID3v2ShortFrameNameLookup[2]['commercial_information'] = 'WCM'; + $ID3v2ShortFrameNameLookup[2]['copyright'] = 'WCP'; + $ID3v2ShortFrameNameLookup[2]['url_publisher'] = 'WPB'; + $ID3v2ShortFrameNameLookup[2]['url_user'] = 'WXX'; + + // The following are common to ID3v2.3 and ID3v2.4 + $ID3v2ShortFrameNameLookup[3]['audio_encryption'] = 'AENC'; + $ID3v2ShortFrameNameLookup[3]['attached_picture'] = 'APIC'; + $ID3v2ShortFrameNameLookup[3]['picture'] = 'APIC'; + $ID3v2ShortFrameNameLookup[3]['comment'] = 'COMM'; + $ID3v2ShortFrameNameLookup[3]['commercial_frame'] = 'COMR'; + $ID3v2ShortFrameNameLookup[3]['encryption_method_registration'] = 'ENCR'; + $ID3v2ShortFrameNameLookup[3]['event_timing_codes'] = 'ETCO'; + $ID3v2ShortFrameNameLookup[3]['general_encapsulated_object'] = 'GEOB'; + $ID3v2ShortFrameNameLookup[3]['group_identification_registration'] = 'GRID'; + $ID3v2ShortFrameNameLookup[3]['linked_information'] = 'LINK'; + $ID3v2ShortFrameNameLookup[3]['music_cd_identifier'] = 'MCDI'; + $ID3v2ShortFrameNameLookup[3]['mpeg_location_lookup_table'] = 'MLLT'; + $ID3v2ShortFrameNameLookup[3]['ownership_frame'] = 'OWNE'; + $ID3v2ShortFrameNameLookup[3]['play_counter'] = 'PCNT'; + $ID3v2ShortFrameNameLookup[3]['popularimeter'] = 'POPM'; + $ID3v2ShortFrameNameLookup[3]['position_synchronisation_frame'] = 'POSS'; + $ID3v2ShortFrameNameLookup[3]['private_frame'] = 'PRIV'; + $ID3v2ShortFrameNameLookup[3]['recommended_buffer_size'] = 'RBUF'; + $ID3v2ShortFrameNameLookup[3]['replay_gain_adjustment'] = 'RGAD'; + $ID3v2ShortFrameNameLookup[3]['reverb'] = 'RVRB'; + $ID3v2ShortFrameNameLookup[3]['synchronised_lyric'] = 'SYLT'; + $ID3v2ShortFrameNameLookup[3]['synchronised_tempo_codes'] = 'SYTC'; + $ID3v2ShortFrameNameLookup[3]['album'] = 'TALB'; + $ID3v2ShortFrameNameLookup[3]['beats_per_minute'] = 'TBPM'; + $ID3v2ShortFrameNameLookup[3]['bpm'] = 'TBPM'; + $ID3v2ShortFrameNameLookup[3]['part_of_a_compilation'] = 'TCMP'; + $ID3v2ShortFrameNameLookup[3]['composer'] = 'TCOM'; + $ID3v2ShortFrameNameLookup[3]['genre'] = 'TCON'; + $ID3v2ShortFrameNameLookup[3]['copyright_message'] = 'TCOP'; + $ID3v2ShortFrameNameLookup[3]['playlist_delay'] = 'TDLY'; + $ID3v2ShortFrameNameLookup[3]['encoded_by'] = 'TENC'; + $ID3v2ShortFrameNameLookup[3]['lyricist'] = 'TEXT'; + $ID3v2ShortFrameNameLookup[3]['file_type'] = 'TFLT'; + $ID3v2ShortFrameNameLookup[3]['content_group_description'] = 'TIT1'; + $ID3v2ShortFrameNameLookup[3]['title'] = 'TIT2'; + $ID3v2ShortFrameNameLookup[3]['subtitle'] = 'TIT3'; + $ID3v2ShortFrameNameLookup[3]['initial_key'] = 'TKEY'; + $ID3v2ShortFrameNameLookup[3]['language'] = 'TLAN'; + $ID3v2ShortFrameNameLookup[3]['length'] = 'TLEN'; + $ID3v2ShortFrameNameLookup[3]['media_type'] = 'TMED'; + $ID3v2ShortFrameNameLookup[3]['original_album'] = 'TOAL'; + $ID3v2ShortFrameNameLookup[3]['original_filename'] = 'TOFN'; + $ID3v2ShortFrameNameLookup[3]['original_lyricist'] = 'TOLY'; + $ID3v2ShortFrameNameLookup[3]['original_artist'] = 'TOPE'; + $ID3v2ShortFrameNameLookup[3]['file_owner'] = 'TOWN'; + $ID3v2ShortFrameNameLookup[3]['artist'] = 'TPE1'; + $ID3v2ShortFrameNameLookup[3]['band'] = 'TPE2'; + $ID3v2ShortFrameNameLookup[3]['conductor'] = 'TPE3'; + $ID3v2ShortFrameNameLookup[3]['remixer'] = 'TPE4'; + $ID3v2ShortFrameNameLookup[3]['part_of_a_set'] = 'TPOS'; + $ID3v2ShortFrameNameLookup[3]['publisher'] = 'TPUB'; + $ID3v2ShortFrameNameLookup[3]['tracknumber'] = 'TRCK'; + $ID3v2ShortFrameNameLookup[3]['track_number'] = 'TRCK'; + $ID3v2ShortFrameNameLookup[3]['internet_radio_station_name'] = 'TRSN'; + $ID3v2ShortFrameNameLookup[3]['internet_radio_station_owner'] = 'TRSO'; + $ID3v2ShortFrameNameLookup[3]['album_artist_sort_order'] = 'TSO2'; + $ID3v2ShortFrameNameLookup[3]['album_sort_order'] = 'TSOA'; + $ID3v2ShortFrameNameLookup[3]['composer_sort_order'] = 'TSOC'; + $ID3v2ShortFrameNameLookup[3]['performer_sort_order'] = 'TSOP'; + $ID3v2ShortFrameNameLookup[3]['title_sort_order'] = 'TSOT'; + $ID3v2ShortFrameNameLookup[3]['isrc'] = 'TSRC'; + $ID3v2ShortFrameNameLookup[3]['encoder_settings'] = 'TSSE'; + $ID3v2ShortFrameNameLookup[3]['text'] = 'TXXX'; + $ID3v2ShortFrameNameLookup[3]['unique_file_identifier'] = 'UFID'; + $ID3v2ShortFrameNameLookup[3]['terms_of_use'] = 'USER'; + $ID3v2ShortFrameNameLookup[3]['unsychronised_lyric'] = 'USLT'; + $ID3v2ShortFrameNameLookup[3]['commercial_information'] = 'WCOM'; + $ID3v2ShortFrameNameLookup[3]['copyright'] = 'WCOP'; + $ID3v2ShortFrameNameLookup[3]['url_file'] = 'WOAF'; + $ID3v2ShortFrameNameLookup[3]['url_artist'] = 'WOAR'; + $ID3v2ShortFrameNameLookup[3]['url_source'] = 'WOAS'; + $ID3v2ShortFrameNameLookup[3]['url_station'] = 'WORS'; + $ID3v2ShortFrameNameLookup[3]['url_payment'] = 'WPAY'; + $ID3v2ShortFrameNameLookup[3]['url_publisher'] = 'WPUB'; + $ID3v2ShortFrameNameLookup[3]['url_user'] = 'WXXX'; + + // The above are common to ID3v2.3 and ID3v2.4 + // so copy them to ID3v2.4 before adding specifics for 2.3 and 2.4 + $ID3v2ShortFrameNameLookup[4] = $ID3v2ShortFrameNameLookup[3]; + + // The following are unique to ID3v2.3 + $ID3v2ShortFrameNameLookup[3]['equalisation'] = 'EQUA'; + $ID3v2ShortFrameNameLookup[3]['involved_people_list'] = 'IPLS'; + $ID3v2ShortFrameNameLookup[3]['relative_volume_adjustment'] = 'RVAD'; + $ID3v2ShortFrameNameLookup[3]['date'] = 'TDAT'; + $ID3v2ShortFrameNameLookup[3]['time'] = 'TIME'; + $ID3v2ShortFrameNameLookup[3]['original_year'] = 'TORY'; + $ID3v2ShortFrameNameLookup[3]['recording_dates'] = 'TRDA'; + $ID3v2ShortFrameNameLookup[3]['size'] = 'TSIZ'; + $ID3v2ShortFrameNameLookup[3]['year'] = 'TYER'; + + + // The following are unique to ID3v2.4 + $ID3v2ShortFrameNameLookup[4]['audio_seek_point_index'] = 'ASPI'; + $ID3v2ShortFrameNameLookup[4]['equalisation'] = 'EQU2'; + $ID3v2ShortFrameNameLookup[4]['relative_volume_adjustment'] = 'RVA2'; + $ID3v2ShortFrameNameLookup[4]['seek_frame'] = 'SEEK'; + $ID3v2ShortFrameNameLookup[4]['signature_frame'] = 'SIGN'; + $ID3v2ShortFrameNameLookup[4]['encoding_time'] = 'TDEN'; + $ID3v2ShortFrameNameLookup[4]['original_release_time'] = 'TDOR'; + $ID3v2ShortFrameNameLookup[4]['recording_time'] = 'TDRC'; + $ID3v2ShortFrameNameLookup[4]['release_time'] = 'TDRL'; + $ID3v2ShortFrameNameLookup[4]['tagging_time'] = 'TDTG'; + $ID3v2ShortFrameNameLookup[4]['involved_people_list'] = 'TIPL'; + $ID3v2ShortFrameNameLookup[4]['musician_credits_list'] = 'TMCL'; + $ID3v2ShortFrameNameLookup[4]['mood'] = 'TMOO'; + $ID3v2ShortFrameNameLookup[4]['produced_notice'] = 'TPRO'; + $ID3v2ShortFrameNameLookup[4]['album_sort_order'] = 'TSOA'; + $ID3v2ShortFrameNameLookup[4]['performer_sort_order'] = 'TSOP'; + $ID3v2ShortFrameNameLookup[4]['title_sort_order'] = 'TSOT'; + $ID3v2ShortFrameNameLookup[4]['set_subtitle'] = 'TSST'; + } + return (isset($ID3v2ShortFrameNameLookup[$majorversion][strtolower($long_description)]) ? $ID3v2ShortFrameNameLookup[$majorversion][strtolower($long_description)] : ''); + + } + +} + diff --git a/www/rompr/getid3/write.lyrics3.php b/www/rompr/getid3/write.lyrics3.php new file mode 100755 index 0000000..06fc943 --- /dev/null +++ b/www/rompr/getid3/write.lyrics3.php @@ -0,0 +1,72 @@ + // +// available at http://getid3.sourceforge.net // +// or http://www.getid3.org // +// also https://github.com/JamesHeinrich/getID3 // +///////////////////////////////////////////////////////////////// +// See readme.txt for more details // +///////////////////////////////////////////////////////////////// +// // +// write.lyrics3.php // +// module for writing Lyrics3 tags // +// dependencies: module.tag.lyrics3.php // +// /// +///////////////////////////////////////////////////////////////// + + +class getid3_write_lyrics3 +{ + public $filename; + public $tag_data; + //public $lyrics3_version = 2; // 1 or 2 + public $warnings = array(); // any non-critical errors will be stored here + public $errors = array(); // any critical errors will be stored here + + public function __construct() { + return true; + } + + public function WriteLyrics3() { + $this->errors[] = 'WriteLyrics3() not yet functional - cannot write Lyrics3'; + return false; + } + public function DeleteLyrics3() { + // Initialize getID3 engine + $getID3 = new getID3; + $ThisFileInfo = $getID3->analyze($this->filename); + if (isset($ThisFileInfo['lyrics3']['tag_offset_start']) && isset($ThisFileInfo['lyrics3']['tag_offset_end'])) { + if (is_readable($this->filename) && getID3::is_writable($this->filename) && is_file($this->filename) && ($fp = fopen($this->filename, 'a+b'))) { + + flock($fp, LOCK_EX); + $oldignoreuserabort = ignore_user_abort(true); + + fseek($fp, $ThisFileInfo['lyrics3']['tag_offset_end']); + $DataAfterLyrics3 = ''; + if ($ThisFileInfo['filesize'] > $ThisFileInfo['lyrics3']['tag_offset_end']) { + $DataAfterLyrics3 = fread($fp, $ThisFileInfo['filesize'] - $ThisFileInfo['lyrics3']['tag_offset_end']); + } + + ftruncate($fp, $ThisFileInfo['lyrics3']['tag_offset_start']); + + if (!empty($DataAfterLyrics3)) { + fseek($fp, $ThisFileInfo['lyrics3']['tag_offset_start']); + fwrite($fp, $DataAfterLyrics3, strlen($DataAfterLyrics3)); + } + + flock($fp, LOCK_UN); + fclose($fp); + ignore_user_abort($oldignoreuserabort); + + return true; + + } else { + $this->errors[] = 'Cannot fopen('.$this->filename.', "a+b")'; + return false; + } + } + // no Lyrics3 present + return true; + } + +} diff --git a/www/rompr/getid3/write.metaflac.php b/www/rompr/getid3/write.metaflac.php new file mode 100755 index 0000000..8c2b75d --- /dev/null +++ b/www/rompr/getid3/write.metaflac.php @@ -0,0 +1,162 @@ + // +// available at http://getid3.sourceforge.net // +// or http://www.getid3.org // +// also https://github.com/JamesHeinrich/getID3 // +///////////////////////////////////////////////////////////////// +// See readme.txt for more details // +///////////////////////////////////////////////////////////////// +// // +// write.metaflac.php // +// module for writing metaflac tags // +// dependencies: /helperapps/metaflac.exe // +// /// +///////////////////////////////////////////////////////////////// + + +class getid3_write_metaflac +{ + + public $filename; + public $tag_data; + public $warnings = array(); // any non-critical errors will be stored here + public $errors = array(); // any critical errors will be stored here + + public function __construct() { + return true; + } + + public function WriteMetaFLAC() { + + if (preg_match('#(1|ON)#i', ini_get('safe_mode'))) { + $this->errors[] = 'PHP running in Safe Mode (backtick operator not available) - cannot call metaflac, tags not written'; + return false; + } + + // Create file with new comments + $tempcommentsfilename = tempnam(GETID3_TEMP_DIR, 'getID3'); + if (getID3::is_writable($tempcommentsfilename) && is_file($tempcommentsfilename) && ($fpcomments = fopen($tempcommentsfilename, 'wb'))) { + foreach ($this->tag_data as $key => $value) { + foreach ($value as $commentdata) { + fwrite($fpcomments, $this->CleanmetaflacName($key).'='.$commentdata."\n"); + } + } + fclose($fpcomments); + + } else { + $this->errors[] = 'failed to open temporary tags file, tags not written - fopen("'.$tempcommentsfilename.'", "wb")'; + return false; + } + + $oldignoreuserabort = ignore_user_abort(true); + if (GETID3_OS_ISWINDOWS) { + + if (file_exists(GETID3_HELPERAPPSDIR.'metaflac.exe')) { + //$commandline = '"'.GETID3_HELPERAPPSDIR.'metaflac.exe" --no-utf8-convert --remove-all-tags --import-tags-from="'.$tempcommentsfilename.'" "'.str_replace('/', '\\', $this->filename).'"'; + // metaflac works fine if you copy-paste the above commandline into a command prompt, + // but refuses to work with `backtick` if there are "doublequotes" present around BOTH + // the metaflac pathname and the target filename. For whatever reason...?? + // The solution is simply ensure that the metaflac pathname has no spaces, + // and therefore does not need to be quoted + + // On top of that, if error messages are not always captured properly under Windows + // To at least see if there was a problem, compare file modification timestamps before and after writing + clearstatcache(); + $timestampbeforewriting = filemtime($this->filename); + + $commandline = GETID3_HELPERAPPSDIR.'metaflac.exe --no-utf8-convert --remove-all-tags --import-tags-from='.escapeshellarg($tempcommentsfilename).' '.escapeshellarg($this->filename).' 2>&1'; + $metaflacError = `$commandline`; + + if (empty($metaflacError)) { + clearstatcache(); + if ($timestampbeforewriting == filemtime($this->filename)) { + $metaflacError = 'File modification timestamp has not changed - it looks like the tags were not written'; + } + } + } else { + $metaflacError = 'metaflac.exe not found in '.GETID3_HELPERAPPSDIR; + } + + } else { + + // It's simpler on *nix + $commandline = 'metaflac --no-utf8-convert --remove-all-tags --import-tags-from='.escapeshellarg($tempcommentsfilename).' '.escapeshellarg($this->filename).' 2>&1'; + $metaflacError = `$commandline`; + + } + + // Remove temporary comments file + unlink($tempcommentsfilename); + ignore_user_abort($oldignoreuserabort); + + if (!empty($metaflacError)) { + + $this->errors[] = 'System call to metaflac failed with this message returned: '."\n\n".$metaflacError; + return false; + + } + + return true; + } + + + public function DeleteMetaFLAC() { + + if (preg_match('#(1|ON)#i', ini_get('safe_mode'))) { + $this->errors[] = 'PHP running in Safe Mode (backtick operator not available) - cannot call metaflac, tags not deleted'; + return false; + } + + $oldignoreuserabort = ignore_user_abort(true); + if (GETID3_OS_ISWINDOWS) { + + if (file_exists(GETID3_HELPERAPPSDIR.'metaflac.exe')) { + // To at least see if there was a problem, compare file modification timestamps before and after writing + clearstatcache(); + $timestampbeforewriting = filemtime($this->filename); + + $commandline = GETID3_HELPERAPPSDIR.'metaflac.exe --remove-all-tags "'.$this->filename.'" 2>&1'; + $metaflacError = `$commandline`; + + if (empty($metaflacError)) { + clearstatcache(); + if ($timestampbeforewriting == filemtime($this->filename)) { + $metaflacError = 'File modification timestamp has not changed - it looks like the tags were not deleted'; + } + } + } else { + $metaflacError = 'metaflac.exe not found in '.GETID3_HELPERAPPSDIR; + } + + } else { + + // It's simpler on *nix + $commandline = 'metaflac --remove-all-tags "'.$this->filename.'" 2>&1'; + $metaflacError = `$commandline`; + + } + + ignore_user_abort($oldignoreuserabort); + + if (!empty($metaflacError)) { + $this->errors[] = 'System call to metaflac failed with this message returned: '."\n\n".$metaflacError; + return false; + } + return true; + } + + + public function CleanmetaflacName($originalcommentname) { + // A case-insensitive field name that may consist of ASCII 0x20 through 0x7D, 0x3D ('=') excluded. + // ASCII 0x41 through 0x5A inclusive (A-Z) is to be considered equivalent to ASCII 0x61 through + // 0x7A inclusive (a-z). + + // replace invalid chars with a space, return uppercase text + // Thanks Chris Bolt for improving this function + // note: *reg_replace() replaces nulls with empty string (not space) + return strtoupper(preg_replace('#[^ -<>-}]#', ' ', str_replace("\x00", ' ', $originalcommentname))); + + } + +} diff --git a/www/rompr/getid3/write.php b/www/rompr/getid3/write.php new file mode 100755 index 0000000..4f2d851 --- /dev/null +++ b/www/rompr/getid3/write.php @@ -0,0 +1,653 @@ + // +// available at http://getid3.sourceforge.net // +// or http://www.getid3.org // +// also https://github.com/JamesHeinrich/getID3 // +///////////////////////////////////////////////////////////////// +// See readme.txt for more details // +///////////////////////////////////////////////////////////////// +/// // +// write.php // +// module for writing tags (APEv2, ID3v1, ID3v2) // +// dependencies: getid3.lib.php // +// write.apetag.php (optional) // +// write.id3v1.php (optional) // +// write.id3v2.php (optional) // +// write.vorbiscomment.php (optional) // +// write.metaflac.php (optional) // +// write.lyrics3.php (optional) // +// /// +///////////////////////////////////////////////////////////////// + +if (!defined('GETID3_INCLUDEPATH')) { + throw new Exception('getid3.php MUST be included before calling getid3_writetags'); +} +if (!include_once(GETID3_INCLUDEPATH.'getid3.lib.php')) { + throw new Exception('write.php depends on getid3.lib.php, which is missing.'); +} + + +// NOTES: +// +// You should pass data here with standard field names as follows: +// * TITLE +// * ARTIST +// * ALBUM +// * TRACKNUMBER +// * COMMENT +// * GENRE +// * YEAR +// * ATTACHED_PICTURE (ID3v2 only) +// +// http://www.personal.uni-jena.de/~pfk/mpp/sv8/apekey.html +// The APEv2 Tag Items Keys definition says "TRACK" is correct but foobar2000 uses "TRACKNUMBER" instead +// Pass data here as "TRACKNUMBER" for compatability with all formats + + +class getid3_writetags +{ + // public + public $filename; // absolute filename of file to write tags to + public $tagformats = array(); // array of tag formats to write ('id3v1', 'id3v2.2', 'id2v2.3', 'id3v2.4', 'ape', 'vorbiscomment', 'metaflac', 'real') + public $tag_data = array(array()); // 2-dimensional array of tag data (ex: $data['ARTIST'][0] = 'Elvis') + public $tag_encoding = 'ISO-8859-1'; // text encoding used for tag data ('ISO-8859-1', 'UTF-8', 'UTF-16', 'UTF-16LE', 'UTF-16BE', ) + public $overwrite_tags = true; // if true will erase existing tag data and write only passed data; if false will merge passed data with existing tag data + public $remove_other_tags = false; // if true will erase remove all existing tags and only write those passed in $tagformats; if false will ignore any tags not mentioned in $tagformats + + public $id3v2_tag_language = 'eng'; // ISO-639-2 3-character language code needed for some ID3v2 frames (http://www.id3.org/iso639-2.html) + public $id3v2_paddedlength = 4096; // minimum length of ID3v2 tags (will be padded to this length if tag data is shorter) + + public $warnings = array(); // any non-critical errors will be stored here + public $errors = array(); // any critical errors will be stored here + + // private + private $ThisFileInfo; // analysis of file before writing + + public function __construct() { + return true; + } + + + public function WriteTags() { + + if (empty($this->filename)) { + $this->errors[] = 'filename is undefined in getid3_writetags'; + return false; + } elseif (!file_exists($this->filename)) { + $this->errors[] = 'filename set to non-existant file "'.$this->filename.'" in getid3_writetags'; + return false; + } + + if (!is_array($this->tagformats)) { + $this->errors[] = 'tagformats must be an array in getid3_writetags'; + return false; + } + + $TagFormatsToRemove = array(); + if (filesize($this->filename) == 0) { + + // empty file special case - allow any tag format, don't check existing format + // could be useful if you want to generate tag data for a non-existant file + $this->ThisFileInfo = array('fileformat'=>''); + $AllowedTagFormats = array('id3v1', 'id3v2.2', 'id3v2.3', 'id3v2.4', 'ape', 'lyrics3'); + + } else { + + $getID3 = new getID3; + $getID3->encoding = $this->tag_encoding; + $this->ThisFileInfo = $getID3->analyze($this->filename); + + // check for what file types are allowed on this fileformat + switch (isset($this->ThisFileInfo['fileformat']) ? $this->ThisFileInfo['fileformat'] : '') { + case 'mp3': + case 'mp2': + case 'mp1': + case 'riff': // maybe not officially, but people do it anyway + $AllowedTagFormats = array('id3v1', 'id3v2.2', 'id3v2.3', 'id3v2.4', 'ape', 'lyrics3'); + break; + + case 'mpc': + $AllowedTagFormats = array('ape'); + break; + + case 'flac': + $AllowedTagFormats = array('metaflac'); + break; + + case 'real': + $AllowedTagFormats = array('real'); + break; + + case 'ogg': + switch (isset($this->ThisFileInfo['audio']['dataformat']) ? $this->ThisFileInfo['audio']['dataformat'] : '') { + case 'flac': + //$AllowedTagFormats = array('metaflac'); + $this->errors[] = 'metaflac is not (yet) compatible with OggFLAC files'; + return false; + break; + case 'vorbis': + $AllowedTagFormats = array('vorbiscomment'); + break; + default: + $this->errors[] = 'metaflac is not (yet) compatible with Ogg files other than OggVorbis'; + return false; + break; + } + break; + + default: + $AllowedTagFormats = array(); + break; + } + foreach ($this->tagformats as $requested_tag_format) { + if (!in_array($requested_tag_format, $AllowedTagFormats)) { + $errormessage = 'Tag format "'.$requested_tag_format.'" is not allowed on "'.(isset($this->ThisFileInfo['fileformat']) ? $this->ThisFileInfo['fileformat'] : ''); + $errormessage .= (isset($this->ThisFileInfo['audio']['dataformat']) ? '.'.$this->ThisFileInfo['audio']['dataformat'] : ''); + $errormessage .= '" files'; + $this->errors[] = $errormessage; + return false; + } + } + + // List of other tag formats, removed if requested + if ($this->remove_other_tags) { + foreach ($AllowedTagFormats as $AllowedTagFormat) { + switch ($AllowedTagFormat) { + case 'id3v2.2': + case 'id3v2.3': + case 'id3v2.4': + if (!in_array('id3v2', $TagFormatsToRemove) && !in_array('id3v2.2', $this->tagformats) && !in_array('id3v2.3', $this->tagformats) && !in_array('id3v2.4', $this->tagformats)) { + $TagFormatsToRemove[] = 'id3v2'; + } + break; + + default: + if (!in_array($AllowedTagFormat, $this->tagformats)) { + $TagFormatsToRemove[] = $AllowedTagFormat; + } + break; + } + } + } + } + + $WritingFilesToInclude = array_merge($this->tagformats, $TagFormatsToRemove); + + // Check for required include files and include them + foreach ($WritingFilesToInclude as $tagformat) { + switch ($tagformat) { + case 'ape': + $GETID3_ERRORARRAY = &$this->errors; + getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'write.apetag.php', __FILE__, true); + break; + + case 'id3v1': + case 'lyrics3': + case 'vorbiscomment': + case 'metaflac': + case 'real': + $GETID3_ERRORARRAY = &$this->errors; + getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'write.'.$tagformat.'.php', __FILE__, true); + break; + + case 'id3v2.2': + case 'id3v2.3': + case 'id3v2.4': + case 'id3v2': + $GETID3_ERRORARRAY = &$this->errors; + getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'write.id3v2.php', __FILE__, true); + break; + + default: + $this->errors[] = 'unknown tag format "'.$tagformat.'" in $tagformats in WriteTags()'; + return false; + break; + } + + } + + // Validation of supplied data + if (!is_array($this->tag_data)) { + $this->errors[] = '$this->tag_data is not an array in WriteTags()'; + return false; + } + // convert supplied data array keys to upper case, if they're not already + foreach ($this->tag_data as $tag_key => $tag_array) { + if (strtoupper($tag_key) !== $tag_key) { + $this->tag_data[strtoupper($tag_key)] = $this->tag_data[$tag_key]; + unset($this->tag_data[$tag_key]); + } + } + // convert source data array keys to upper case, if they're not already + if (!empty($this->ThisFileInfo['tags'])) { + foreach ($this->ThisFileInfo['tags'] as $tag_format => $tag_data_array) { + foreach ($tag_data_array as $tag_key => $tag_array) { + if (strtoupper($tag_key) !== $tag_key) { + $this->ThisFileInfo['tags'][$tag_format][strtoupper($tag_key)] = $this->ThisFileInfo['tags'][$tag_format][$tag_key]; + unset($this->ThisFileInfo['tags'][$tag_format][$tag_key]); + } + } + } + } + + // Convert "TRACK" to "TRACKNUMBER" (if needed) for compatability with all formats + if (isset($this->tag_data['TRACK']) && !isset($this->tag_data['TRACKNUMBER'])) { + $this->tag_data['TRACKNUMBER'] = $this->tag_data['TRACK']; + unset($this->tag_data['TRACK']); + } + + // Remove all other tag formats, if requested + if ($this->remove_other_tags) { + $this->DeleteTags($TagFormatsToRemove); + } + + // Write data for each tag format + foreach ($this->tagformats as $tagformat) { + $success = false; // overridden if tag writing is successful + switch ($tagformat) { + case 'ape': + $ape_writer = new getid3_write_apetag; + if (($ape_writer->tag_data = $this->FormatDataForAPE()) !== false) { + $ape_writer->filename = $this->filename; + if (($success = $ape_writer->WriteAPEtag()) === false) { + $this->errors[] = 'WriteAPEtag() failed with message(s):
      • '.str_replace("\n", '
      • ', htmlentities(trim(implode("\n", $ape_writer->errors)))).'
      '; + } + } else { + $this->errors[] = 'FormatDataForAPE() failed'; + } + break; + + case 'id3v1': + $id3v1_writer = new getid3_write_id3v1; + if (($id3v1_writer->tag_data = $this->FormatDataForID3v1()) !== false) { + $id3v1_writer->filename = $this->filename; + if (($success = $id3v1_writer->WriteID3v1()) === false) { + $this->errors[] = 'WriteID3v1() failed with message(s):
      • '.str_replace("\n", '
      • ', htmlentities(trim(implode("\n", $id3v1_writer->errors)))).'
      '; + } + } else { + $this->errors[] = 'FormatDataForID3v1() failed'; + } + break; + + case 'id3v2.2': + case 'id3v2.3': + case 'id3v2.4': + $id3v2_writer = new getid3_write_id3v2; + $id3v2_writer->majorversion = intval(substr($tagformat, -1)); + $id3v2_writer->paddedlength = $this->id3v2_paddedlength; + if (($id3v2_writer->tag_data = $this->FormatDataForID3v2($id3v2_writer->majorversion)) !== false) { + $id3v2_writer->filename = $this->filename; + if (($success = $id3v2_writer->WriteID3v2()) === false) { + $this->errors[] = 'WriteID3v2() failed with message(s):
      • '.str_replace("\n", '
      • ', htmlentities(trim(implode("\n", $id3v2_writer->errors)))).'
      '; + } + } else { + $this->errors[] = 'FormatDataForID3v2() failed'; + } + break; + + case 'vorbiscomment': + $vorbiscomment_writer = new getid3_write_vorbiscomment; + if (($vorbiscomment_writer->tag_data = $this->FormatDataForVorbisComment()) !== false) { + $vorbiscomment_writer->filename = $this->filename; + if (($success = $vorbiscomment_writer->WriteVorbisComment()) === false) { + $this->errors[] = 'WriteVorbisComment() failed with message(s):
      • '.str_replace("\n", '
      • ', htmlentities(trim(implode("\n", $vorbiscomment_writer->errors)))).'
      '; + } + } else { + $this->errors[] = 'FormatDataForVorbisComment() failed'; + } + break; + + case 'metaflac': + $metaflac_writer = new getid3_write_metaflac; + if (($metaflac_writer->tag_data = $this->FormatDataForMetaFLAC()) !== false) { + $metaflac_writer->filename = $this->filename; + if (($success = $metaflac_writer->WriteMetaFLAC()) === false) { + $this->errors[] = 'WriteMetaFLAC() failed with message(s):
      • '.str_replace("\n", '
      • ', htmlentities(trim(implode("\n", $metaflac_writer->errors)))).'
      '; + } + } else { + $this->errors[] = 'FormatDataForMetaFLAC() failed'; + } + break; + + case 'real': + $real_writer = new getid3_write_real; + if (($real_writer->tag_data = $this->FormatDataForReal()) !== false) { + $real_writer->filename = $this->filename; + if (($success = $real_writer->WriteReal()) === false) { + $this->errors[] = 'WriteReal() failed with message(s):
      • '.str_replace("\n", '
      • ', htmlentities(trim(implode("\n", $real_writer->errors)))).'
      '; + } + } else { + $this->errors[] = 'FormatDataForReal() failed'; + } + break; + + default: + $this->errors[] = 'Invalid tag format to write: "'.$tagformat.'"'; + return false; + break; + } + if (!$success) { + return false; + } + } + return true; + + } + + + public function DeleteTags($TagFormatsToDelete) { + foreach ($TagFormatsToDelete as $DeleteTagFormat) { + $success = false; // overridden if tag deletion is successful + switch ($DeleteTagFormat) { + case 'id3v1': + $id3v1_writer = new getid3_write_id3v1; + $id3v1_writer->filename = $this->filename; + if (($success = $id3v1_writer->RemoveID3v1()) === false) { + $this->errors[] = 'RemoveID3v1() failed with message(s):
      • '.trim(implode('
      • ', $id3v1_writer->errors)).'
      '; + } + break; + + case 'id3v2': + $id3v2_writer = new getid3_write_id3v2; + $id3v2_writer->filename = $this->filename; + if (($success = $id3v2_writer->RemoveID3v2()) === false) { + $this->errors[] = 'RemoveID3v2() failed with message(s):
      • '.trim(implode('
      • ', $id3v2_writer->errors)).'
      '; + } + break; + + case 'ape': + $ape_writer = new getid3_write_apetag; + $ape_writer->filename = $this->filename; + if (($success = $ape_writer->DeleteAPEtag()) === false) { + $this->errors[] = 'DeleteAPEtag() failed with message(s):
      • '.trim(implode('
      • ', $ape_writer->errors)).'
      '; + } + break; + + case 'vorbiscomment': + $vorbiscomment_writer = new getid3_write_vorbiscomment; + $vorbiscomment_writer->filename = $this->filename; + if (($success = $vorbiscomment_writer->DeleteVorbisComment()) === false) { + $this->errors[] = 'DeleteVorbisComment() failed with message(s):
      • '.trim(implode('
      • ', $vorbiscomment_writer->errors)).'
      '; + } + break; + + case 'metaflac': + $metaflac_writer = new getid3_write_metaflac; + $metaflac_writer->filename = $this->filename; + if (($success = $metaflac_writer->DeleteMetaFLAC()) === false) { + $this->errors[] = 'DeleteMetaFLAC() failed with message(s):
      • '.trim(implode('
      • ', $metaflac_writer->errors)).'
      '; + } + break; + + case 'lyrics3': + $lyrics3_writer = new getid3_write_lyrics3; + $lyrics3_writer->filename = $this->filename; + if (($success = $lyrics3_writer->DeleteLyrics3()) === false) { + $this->errors[] = 'DeleteLyrics3() failed with message(s):
      • '.trim(implode('
      • ', $lyrics3_writer->errors)).'
      '; + } + break; + + case 'real': + $real_writer = new getid3_write_real; + $real_writer->filename = $this->filename; + if (($success = $real_writer->RemoveReal()) === false) { + $this->errors[] = 'RemoveReal() failed with message(s):
      • '.trim(implode('
      • ', $real_writer->errors)).'
      '; + } + break; + + default: + $this->errors[] = 'Invalid tag format to delete: "'.$tagformat.'"'; + return false; + break; + } + if (!$success) { + return false; + } + } + return true; + } + + + public function MergeExistingTagData($TagFormat, &$tag_data) { + // Merge supplied data with existing data, if requested + if ($this->overwrite_tags) { + // do nothing - ignore previous data + } else { +throw new Exception('$this->overwrite_tags=false is known to be buggy in this version of getID3. Check http://github.com/JamesHeinrich/getID3 for a newer version.'); + if (!isset($this->ThisFileInfo['tags'][$TagFormat])) { + return false; + } + $tag_data = array_merge_recursive($tag_data, $this->ThisFileInfo['tags'][$TagFormat]); + } + return true; + } + + public function FormatDataForAPE() { + $ape_tag_data = array(); + foreach ($this->tag_data as $tag_key => $valuearray) { + switch ($tag_key) { + case 'ATTACHED_PICTURE': + // ATTACHED_PICTURE is ID3v2 only - ignore + $this->warnings[] = '$data['.$tag_key.'] is assumed to be ID3v2 APIC data - NOT written to APE tag'; + break; + + default: + foreach ($valuearray as $key => $value) { + if (is_string($value) || is_numeric($value)) { + $ape_tag_data[$tag_key][$key] = getid3_lib::iconv_fallback($this->tag_encoding, 'UTF-8', $value); + } else { + $this->warnings[] = '$data['.$tag_key.']['.$key.'] is not a string value - all of $data['.$tag_key.'] NOT written to APE tag'; + unset($ape_tag_data[$tag_key]); + break; + } + } + break; + } + } + $this->MergeExistingTagData('ape', $ape_tag_data); + return $ape_tag_data; + } + + + public function FormatDataForID3v1() { + $tag_data_id3v1['genreid'] = 255; + if (!empty($this->tag_data['GENRE'])) { + foreach ($this->tag_data['GENRE'] as $key => $value) { + if (getid3_id3v1::LookupGenreID($value) !== false) { + $tag_data_id3v1['genreid'] = getid3_id3v1::LookupGenreID($value); + break; + } + } + } + $tag_data_id3v1['title'] = getid3_lib::iconv_fallback($this->tag_encoding, 'ISO-8859-1', implode(' ', (isset($this->tag_data['TITLE'] ) ? $this->tag_data['TITLE'] : array()))); + $tag_data_id3v1['artist'] = getid3_lib::iconv_fallback($this->tag_encoding, 'ISO-8859-1', implode(' ', (isset($this->tag_data['ARTIST'] ) ? $this->tag_data['ARTIST'] : array()))); + $tag_data_id3v1['album'] = getid3_lib::iconv_fallback($this->tag_encoding, 'ISO-8859-1', implode(' ', (isset($this->tag_data['ALBUM'] ) ? $this->tag_data['ALBUM'] : array()))); + $tag_data_id3v1['year'] = getid3_lib::iconv_fallback($this->tag_encoding, 'ISO-8859-1', implode(' ', (isset($this->tag_data['YEAR'] ) ? $this->tag_data['YEAR'] : array()))); + $tag_data_id3v1['comment'] = getid3_lib::iconv_fallback($this->tag_encoding, 'ISO-8859-1', implode(' ', (isset($this->tag_data['COMMENT'] ) ? $this->tag_data['COMMENT'] : array()))); + $tag_data_id3v1['track'] = intval(getid3_lib::iconv_fallback($this->tag_encoding, 'ISO-8859-1', implode(' ', (isset($this->tag_data['TRACKNUMBER']) ? $this->tag_data['TRACKNUMBER'] : array())))); + if ($tag_data_id3v1['track'] <= 0) { + $tag_data_id3v1['track'] = ''; + } + + $this->MergeExistingTagData('id3v1', $tag_data_id3v1); + return $tag_data_id3v1; + } + + public function FormatDataForID3v2($id3v2_majorversion) { + $tag_data_id3v2 = array(); + + $ID3v2_text_encoding_lookup[2] = array('ISO-8859-1'=>0, 'UTF-16'=>1); + $ID3v2_text_encoding_lookup[3] = array('ISO-8859-1'=>0, 'UTF-16'=>1); + $ID3v2_text_encoding_lookup[4] = array('ISO-8859-1'=>0, 'UTF-16'=>1, 'UTF-16BE'=>2, 'UTF-8'=>3); + foreach ($this->tag_data as $tag_key => $valuearray) { + $ID3v2_framename = getid3_write_id3v2::ID3v2ShortFrameNameLookup($id3v2_majorversion, $tag_key); + switch ($ID3v2_framename) { + case 'APIC': + foreach ($valuearray as $key => $apic_data_array) { + if (isset($apic_data_array['data']) && + isset($apic_data_array['picturetypeid']) && + isset($apic_data_array['description']) && + isset($apic_data_array['mime'])) { + $tag_data_id3v2['APIC'][] = $apic_data_array; + } else { + $this->errors[] = 'ID3v2 APIC data is not properly structured'; + return false; + } + } + break; + + case 'POPM': + if (isset($valuearray['email']) && + isset($valuearray['rating']) && + isset($valuearray['data'])) { + $tag_data_id3v2['POPM'][] = $valuearray; + } else { + $this->errors[] = 'ID3v2 POPM data is not properly structured'; + return false; + } + break; + + case 'GRID': + if ( + isset($valuearray['groupsymbol']) && + isset($valuearray['ownerid']) && + isset($valuearray['data']) + ) { + $tag_data_id3v2['GRID'][] = $valuearray; + } else { + $this->errors[] = 'ID3v2 GRID data is not properly structured'; + return false; + } + break; + + case 'UFID': + if (isset($valuearray['ownerid']) && + isset($valuearray['data'])) { + $tag_data_id3v2['UFID'][] = $valuearray; + } else { + $this->errors[] = 'ID3v2 UFID data is not properly structured'; + return false; + } + break; + + case 'TXXX': + foreach ($valuearray as $key => $txxx_data_array) { + if (isset($txxx_data_array['description']) && isset($txxx_data_array['data'])) { + $tag_data_id3v2['TXXX'][] = $txxx_data_array; + } else { + $this->errors[] = 'ID3v2 TXXX data is not properly structured'; + return false; + } + } + break; + + case '': + $this->errors[] = 'ID3v2: Skipping "'.$tag_key.'" because cannot match it to a known ID3v2 frame type'; + // some other data type, don't know how to handle it, ignore it + break; + + default: + // most other (text) frames can be copied over as-is + foreach ($valuearray as $key => $value) { + if (isset($ID3v2_text_encoding_lookup[$id3v2_majorversion][$this->tag_encoding])) { + // source encoding is valid in ID3v2 - use it with no conversion + $tag_data_id3v2[$ID3v2_framename][$key]['encodingid'] = $ID3v2_text_encoding_lookup[$id3v2_majorversion][$this->tag_encoding]; + $tag_data_id3v2[$ID3v2_framename][$key]['data'] = $value; + } else { + // source encoding is NOT valid in ID3v2 - convert it to an ID3v2-valid encoding first + if ($id3v2_majorversion < 4) { + // convert data from other encoding to UTF-16 (with BOM) + // note: some software, notably Windows Media Player and iTunes are broken and treat files tagged with UTF-16BE (with BOM) as corrupt + // therefore we force data to UTF-16LE and manually prepend the BOM + $ID3v2_tag_data_converted = false; + if (!$ID3v2_tag_data_converted && ($this->tag_encoding == 'ISO-8859-1')) { + // great, leave data as-is for minimum compatability problems + $tag_data_id3v2[$ID3v2_framename][$key]['encodingid'] = 0; + $tag_data_id3v2[$ID3v2_framename][$key]['data'] = $value; + $ID3v2_tag_data_converted = true; + } + if (!$ID3v2_tag_data_converted && ($this->tag_encoding == 'UTF-8')) { + do { + // if UTF-8 string does not include any characters above chr(127) then it is identical to ISO-8859-1 + for ($i = 0; $i < strlen($value); $i++) { + if (ord($value{$i}) > 127) { + break 2; + } + } + $tag_data_id3v2[$ID3v2_framename][$key]['encodingid'] = 0; + $tag_data_id3v2[$ID3v2_framename][$key]['data'] = $value; + $ID3v2_tag_data_converted = true; + } while (false); + } + if (!$ID3v2_tag_data_converted) { + $tag_data_id3v2[$ID3v2_framename][$key]['encodingid'] = 1; + //$tag_data_id3v2[$ID3v2_framename][$key]['data'] = getid3_lib::iconv_fallback($this->tag_encoding, 'UTF-16', $value); // output is UTF-16LE+BOM or UTF-16BE+BOM depending on system architecture + $tag_data_id3v2[$ID3v2_framename][$key]['data'] = "\xFF\xFE".getid3_lib::iconv_fallback($this->tag_encoding, 'UTF-16LE', $value); // force LittleEndian order version of UTF-16 + $ID3v2_tag_data_converted = true; + } + + } else { + // convert data from other encoding to UTF-8 + $tag_data_id3v2[$ID3v2_framename][$key]['encodingid'] = 3; + $tag_data_id3v2[$ID3v2_framename][$key]['data'] = getid3_lib::iconv_fallback($this->tag_encoding, 'UTF-8', $value); + } + } + + // These values are not needed for all frame types, but if they're not used no matter + $tag_data_id3v2[$ID3v2_framename][$key]['description'] = ''; + $tag_data_id3v2[$ID3v2_framename][$key]['language'] = $this->id3v2_tag_language; + } + break; + } + } + $this->MergeExistingTagData('id3v2', $tag_data_id3v2); + return $tag_data_id3v2; + } + + public function FormatDataForVorbisComment() { + $tag_data_vorbiscomment = $this->tag_data; + + // check for multi-line comment values - split out to multiple comments if neccesary + // and convert data to UTF-8 strings + foreach ($tag_data_vorbiscomment as $tag_key => $valuearray) { + foreach ($valuearray as $key => $value) { + str_replace("\r", "\n", $value); + if (strstr($value, "\n")) { + unset($tag_data_vorbiscomment[$tag_key][$key]); + $multilineexploded = explode("\n", $value); + foreach ($multilineexploded as $newcomment) { + if (strlen(trim($newcomment)) > 0) { + $tag_data_vorbiscomment[$tag_key][] = getid3_lib::iconv_fallback($this->tag_encoding, 'UTF-8', $newcomment); + } + } + } elseif (is_string($value) || is_numeric($value)) { + $tag_data_vorbiscomment[$tag_key][$key] = getid3_lib::iconv_fallback($this->tag_encoding, 'UTF-8', $value); + } else { + $this->warnings[] = '$data['.$tag_key.']['.$key.'] is not a string value - all of $data['.$tag_key.'] NOT written to VorbisComment tag'; + unset($tag_data_vorbiscomment[$tag_key]); + break; + } + } + } + $this->MergeExistingTagData('vorbiscomment', $tag_data_vorbiscomment); + return $tag_data_vorbiscomment; + } + + public function FormatDataForMetaFLAC() { + // FLAC & OggFLAC use VorbisComments same as OggVorbis + // but require metaflac to do the writing rather than vorbiscomment + return $this->FormatDataForVorbisComment(); + } + + public function FormatDataForReal() { + $tag_data_real['title'] = getid3_lib::iconv_fallback($this->tag_encoding, 'ISO-8859-1', implode(' ', (isset($this->tag_data['TITLE'] ) ? $this->tag_data['TITLE'] : array()))); + $tag_data_real['artist'] = getid3_lib::iconv_fallback($this->tag_encoding, 'ISO-8859-1', implode(' ', (isset($this->tag_data['ARTIST'] ) ? $this->tag_data['ARTIST'] : array()))); + $tag_data_real['copyright'] = getid3_lib::iconv_fallback($this->tag_encoding, 'ISO-8859-1', implode(' ', (isset($this->tag_data['COPYRIGHT']) ? $this->tag_data['COPYRIGHT'] : array()))); + $tag_data_real['comment'] = getid3_lib::iconv_fallback($this->tag_encoding, 'ISO-8859-1', implode(' ', (isset($this->tag_data['COMMENT'] ) ? $this->tag_data['COMMENT'] : array()))); + + $this->MergeExistingTagData('real', $tag_data_real); + return $tag_data_real; + } + +} diff --git a/www/rompr/getid3/write.real.php b/www/rompr/getid3/write.real.php new file mode 100755 index 0000000..7f91165 --- /dev/null +++ b/www/rompr/getid3/write.real.php @@ -0,0 +1,274 @@ + // +// available at http://getid3.sourceforge.net // +// or http://www.getid3.org // +// also https://github.com/JamesHeinrich/getID3 // +///////////////////////////////////////////////////////////////// +// See readme.txt for more details // +///////////////////////////////////////////////////////////////// +// // +// write.real.php // +// module for writing RealAudio/RealVideo tags // +// dependencies: module.tag.real.php // +// /// +///////////////////////////////////////////////////////////////// + +class getid3_write_real +{ + public $filename; + public $tag_data = array(); + public $fread_buffer_size = 32768; // read buffer size in bytes + public $warnings = array(); // any non-critical errors will be stored here + public $errors = array(); // any critical errors will be stored here + public $paddedlength = 512; // minimum length of CONT tag in bytes + + public function __construct() { + return true; + } + + public function WriteReal() { + // File MUST be writeable - CHMOD(646) at least + if (getID3::is_writable($this->filename) && is_file($this->filename) && ($fp_source = fopen($this->filename, 'r+b'))) { + + // Initialize getID3 engine + $getID3 = new getID3; + $OldThisFileInfo = $getID3->analyze($this->filename); + if (empty($OldThisFileInfo['real']['chunks']) && !empty($OldThisFileInfo['real']['old_ra_header'])) { + $this->errors[] = 'Cannot write Real tags on old-style file format'; + fclose($fp_source); + return false; + } + + if (empty($OldThisFileInfo['real']['chunks'])) { + $this->errors[] = 'Cannot write Real tags because cannot find DATA chunk in file'; + fclose($fp_source); + return false; + } + foreach ($OldThisFileInfo['real']['chunks'] as $chunknumber => $chunkarray) { + $oldChunkInfo[$chunkarray['name']] = $chunkarray; + } + if (!empty($oldChunkInfo['CONT']['length'])) { + $this->paddedlength = max($oldChunkInfo['CONT']['length'], $this->paddedlength); + } + + $new_CONT_tag_data = $this->GenerateCONTchunk(); + $new_PROP_tag_data = $this->GeneratePROPchunk($OldThisFileInfo['real']['chunks'], $new_CONT_tag_data); + $new__RMF_tag_data = $this->GenerateRMFchunk($OldThisFileInfo['real']['chunks']); + + if (isset($oldChunkInfo['.RMF']['length']) && ($oldChunkInfo['.RMF']['length'] == strlen($new__RMF_tag_data))) { + fseek($fp_source, $oldChunkInfo['.RMF']['offset']); + fwrite($fp_source, $new__RMF_tag_data); + } else { + $this->errors[] = 'new .RMF tag ('.strlen($new__RMF_tag_data).' bytes) different length than old .RMF tag ('.$oldChunkInfo['.RMF']['length'].' bytes)'; + fclose($fp_source); + return false; + } + + if (isset($oldChunkInfo['PROP']['length']) && ($oldChunkInfo['PROP']['length'] == strlen($new_PROP_tag_data))) { + fseek($fp_source, $oldChunkInfo['PROP']['offset']); + fwrite($fp_source, $new_PROP_tag_data); + } else { + $this->errors[] = 'new PROP tag ('.strlen($new_PROP_tag_data).' bytes) different length than old PROP tag ('.$oldChunkInfo['PROP']['length'].' bytes)'; + fclose($fp_source); + return false; + } + + if (isset($oldChunkInfo['CONT']['length']) && ($oldChunkInfo['CONT']['length'] == strlen($new_CONT_tag_data))) { + + // new data length is same as old data length - just overwrite + fseek($fp_source, $oldChunkInfo['CONT']['offset']); + fwrite($fp_source, $new_CONT_tag_data); + fclose($fp_source); + return true; + + } else { + + if (empty($oldChunkInfo['CONT'])) { + // no existing CONT chunk + $BeforeOffset = $oldChunkInfo['DATA']['offset']; + $AfterOffset = $oldChunkInfo['DATA']['offset']; + } else { + // new data is longer than old data + $BeforeOffset = $oldChunkInfo['CONT']['offset']; + $AfterOffset = $oldChunkInfo['CONT']['offset'] + $oldChunkInfo['CONT']['length']; + } + if ($tempfilename = tempnam(GETID3_TEMP_DIR, 'getID3')) { + if (getID3::is_writable($tempfilename) && is_file($tempfilename) && ($fp_temp = fopen($tempfilename, 'wb'))) { + + rewind($fp_source); + fwrite($fp_temp, fread($fp_source, $BeforeOffset)); + fwrite($fp_temp, $new_CONT_tag_data); + fseek($fp_source, $AfterOffset); + while ($buffer = fread($fp_source, $this->fread_buffer_size)) { + fwrite($fp_temp, $buffer, strlen($buffer)); + } + fclose($fp_temp); + + if (copy($tempfilename, $this->filename)) { + unlink($tempfilename); + fclose($fp_source); + return true; + } + unlink($tempfilename); + $this->errors[] = 'FAILED: copy('.$tempfilename.', '.$this->filename.')'; + + } else { + $this->errors[] = 'Could not fopen("'.$tempfilename.'", "wb")'; + } + } + fclose($fp_source); + return false; + + } + + } + $this->errors[] = 'Could not fopen("'.$this->filename.'", "r+b")'; + return false; + } + + public function GenerateRMFchunk(&$chunks) { + $oldCONTexists = false; + foreach ($chunks as $key => $chunk) { + $chunkNameKeys[$chunk['name']] = $key; + if ($chunk['name'] == 'CONT') { + $oldCONTexists = true; + } + } + $newHeadersCount = $chunks[$chunkNameKeys['.RMF']]['headers_count'] + ($oldCONTexists ? 0 : 1); + + $RMFchunk = "\x00\x00"; // object version + $RMFchunk .= getid3_lib::BigEndian2String($chunks[$chunkNameKeys['.RMF']]['file_version'], 4); + $RMFchunk .= getid3_lib::BigEndian2String($newHeadersCount, 4); + + $RMFchunk = '.RMF'.getid3_lib::BigEndian2String(strlen($RMFchunk) + 8, 4).$RMFchunk; // .RMF chunk identifier + chunk length + return $RMFchunk; + } + + public function GeneratePROPchunk(&$chunks, &$new_CONT_tag_data) { + $old_CONT_length = 0; + $old_DATA_offset = 0; + $old_INDX_offset = 0; + foreach ($chunks as $key => $chunk) { + $chunkNameKeys[$chunk['name']] = $key; + if ($chunk['name'] == 'CONT') { + $old_CONT_length = $chunk['length']; + } elseif ($chunk['name'] == 'DATA') { + if (!$old_DATA_offset) { + $old_DATA_offset = $chunk['offset']; + } + } elseif ($chunk['name'] == 'INDX') { + if (!$old_INDX_offset) { + $old_INDX_offset = $chunk['offset']; + } + } + } + $CONTdelta = strlen($new_CONT_tag_data) - $old_CONT_length; + + $PROPchunk = "\x00\x00"; // object version + $PROPchunk .= getid3_lib::BigEndian2String($chunks[$chunkNameKeys['PROP']]['max_bit_rate'], 4); + $PROPchunk .= getid3_lib::BigEndian2String($chunks[$chunkNameKeys['PROP']]['avg_bit_rate'], 4); + $PROPchunk .= getid3_lib::BigEndian2String($chunks[$chunkNameKeys['PROP']]['max_packet_size'], 4); + $PROPchunk .= getid3_lib::BigEndian2String($chunks[$chunkNameKeys['PROP']]['avg_packet_size'], 4); + $PROPchunk .= getid3_lib::BigEndian2String($chunks[$chunkNameKeys['PROP']]['num_packets'], 4); + $PROPchunk .= getid3_lib::BigEndian2String($chunks[$chunkNameKeys['PROP']]['duration'], 4); + $PROPchunk .= getid3_lib::BigEndian2String($chunks[$chunkNameKeys['PROP']]['preroll'], 4); + $PROPchunk .= getid3_lib::BigEndian2String(max(0, $old_INDX_offset + $CONTdelta), 4); + $PROPchunk .= getid3_lib::BigEndian2String(max(0, $old_DATA_offset + $CONTdelta), 4); + $PROPchunk .= getid3_lib::BigEndian2String($chunks[$chunkNameKeys['PROP']]['num_streams'], 2); + $PROPchunk .= getid3_lib::BigEndian2String($chunks[$chunkNameKeys['PROP']]['flags_raw'], 2); + + $PROPchunk = 'PROP'.getid3_lib::BigEndian2String(strlen($PROPchunk) + 8, 4).$PROPchunk; // PROP chunk identifier + chunk length + return $PROPchunk; + } + + public function GenerateCONTchunk() { + foreach ($this->tag_data as $key => $value) { + // limit each value to 0xFFFF bytes + $this->tag_data[$key] = substr($value, 0, 65535); + } + + $CONTchunk = "\x00\x00"; // object version + + $CONTchunk .= getid3_lib::BigEndian2String((!empty($this->tag_data['title']) ? strlen($this->tag_data['title']) : 0), 2); + $CONTchunk .= (!empty($this->tag_data['title']) ? strlen($this->tag_data['title']) : ''); + + $CONTchunk .= getid3_lib::BigEndian2String((!empty($this->tag_data['artist']) ? strlen($this->tag_data['artist']) : 0), 2); + $CONTchunk .= (!empty($this->tag_data['artist']) ? strlen($this->tag_data['artist']) : ''); + + $CONTchunk .= getid3_lib::BigEndian2String((!empty($this->tag_data['copyright']) ? strlen($this->tag_data['copyright']) : 0), 2); + $CONTchunk .= (!empty($this->tag_data['copyright']) ? strlen($this->tag_data['copyright']) : ''); + + $CONTchunk .= getid3_lib::BigEndian2String((!empty($this->tag_data['comment']) ? strlen($this->tag_data['comment']) : 0), 2); + $CONTchunk .= (!empty($this->tag_data['comment']) ? strlen($this->tag_data['comment']) : ''); + + if ($this->paddedlength > (strlen($CONTchunk) + 8)) { + $CONTchunk .= str_repeat("\x00", $this->paddedlength - strlen($CONTchunk) - 8); + } + + $CONTchunk = 'CONT'.getid3_lib::BigEndian2String(strlen($CONTchunk) + 8, 4).$CONTchunk; // CONT chunk identifier + chunk length + + return $CONTchunk; + } + + public function RemoveReal() { + // File MUST be writeable - CHMOD(646) at least + if (getID3::is_writable($this->filename) && is_file($this->filename) && ($fp_source = fopen($this->filename, 'r+b'))) { + + // Initialize getID3 engine + $getID3 = new getID3; + $OldThisFileInfo = $getID3->analyze($this->filename); + if (empty($OldThisFileInfo['real']['chunks']) && !empty($OldThisFileInfo['real']['old_ra_header'])) { + $this->errors[] = 'Cannot remove Real tags from old-style file format'; + fclose($fp_source); + return false; + } + + if (empty($OldThisFileInfo['real']['chunks'])) { + $this->errors[] = 'Cannot remove Real tags because cannot find DATA chunk in file'; + fclose($fp_source); + return false; + } + foreach ($OldThisFileInfo['real']['chunks'] as $chunknumber => $chunkarray) { + $oldChunkInfo[$chunkarray['name']] = $chunkarray; + } + + if (empty($oldChunkInfo['CONT'])) { + // no existing CONT chunk + fclose($fp_source); + return true; + } + + $BeforeOffset = $oldChunkInfo['CONT']['offset']; + $AfterOffset = $oldChunkInfo['CONT']['offset'] + $oldChunkInfo['CONT']['length']; + if ($tempfilename = tempnam(GETID3_TEMP_DIR, 'getID3')) { + if (getID3::is_writable($tempfilename) && is_file($tempfilename) && ($fp_temp = fopen($tempfilename, 'wb'))) { + + rewind($fp_source); + fwrite($fp_temp, fread($fp_source, $BeforeOffset)); + fseek($fp_source, $AfterOffset); + while ($buffer = fread($fp_source, $this->fread_buffer_size)) { + fwrite($fp_temp, $buffer, strlen($buffer)); + } + fclose($fp_temp); + + if (copy($tempfilename, $this->filename)) { + unlink($tempfilename); + fclose($fp_source); + return true; + } + unlink($tempfilename); + $this->errors[] = 'FAILED: copy('.$tempfilename.', '.$this->filename.')'; + + } else { + $this->errors[] = 'Could not fopen("'.$tempfilename.'", "wb")'; + } + } + fclose($fp_source); + return false; + } + $this->errors[] = 'Could not fopen("'.$this->filename.'", "r+b")'; + return false; + } + +} diff --git a/www/rompr/getid3/write.vorbiscomment.php b/www/rompr/getid3/write.vorbiscomment.php new file mode 100755 index 0000000..3f427ef --- /dev/null +++ b/www/rompr/getid3/write.vorbiscomment.php @@ -0,0 +1,120 @@ + // +// available at http://getid3.sourceforge.net // +// or http://www.getid3.org // +// also https://github.com/JamesHeinrich/getID3 // +///////////////////////////////////////////////////////////////// +// See readme.txt for more details // +///////////////////////////////////////////////////////////////// +// // +// write.vorbiscomment.php // +// module for writing VorbisComment tags // +// dependencies: /helperapps/vorbiscomment.exe // +// /// +///////////////////////////////////////////////////////////////// + + +class getid3_write_vorbiscomment +{ + + public $filename; + public $tag_data; + public $warnings = array(); // any non-critical errors will be stored here + public $errors = array(); // any critical errors will be stored here + + public function __construct() { + return true; + } + + public function WriteVorbisComment() { + + if (preg_match('#(1|ON)#i', ini_get('safe_mode'))) { + $this->errors[] = 'PHP running in Safe Mode (backtick operator not available) - cannot call vorbiscomment, tags not written'; + return false; + } + + // Create file with new comments + $tempcommentsfilename = tempnam(GETID3_TEMP_DIR, 'getID3'); + if (getID3::is_writable($tempcommentsfilename) && is_file($tempcommentsfilename) && ($fpcomments = fopen($tempcommentsfilename, 'wb'))) { + + foreach ($this->tag_data as $key => $value) { + foreach ($value as $commentdata) { + fwrite($fpcomments, $this->CleanVorbisCommentName($key).'='.$commentdata."\n"); + } + } + fclose($fpcomments); + + } else { + $this->errors[] = 'failed to open temporary tags file "'.$tempcommentsfilename.'", tags not written'; + return false; + } + + $oldignoreuserabort = ignore_user_abort(true); + if (GETID3_OS_ISWINDOWS) { + + if (file_exists(GETID3_HELPERAPPSDIR.'vorbiscomment.exe')) { + //$commandline = '"'.GETID3_HELPERAPPSDIR.'vorbiscomment.exe" -w --raw -c "'.$tempcommentsfilename.'" "'.str_replace('/', '\\', $this->filename).'"'; + // vorbiscomment works fine if you copy-paste the above commandline into a command prompt, + // but refuses to work with `backtick` if there are "doublequotes" present around BOTH + // the metaflac pathname and the target filename. For whatever reason...?? + // The solution is simply ensure that the metaflac pathname has no spaces, + // and therefore does not need to be quoted + + // On top of that, if error messages are not always captured properly under Windows + // To at least see if there was a problem, compare file modification timestamps before and after writing + clearstatcache(); + $timestampbeforewriting = filemtime($this->filename); + + $commandline = GETID3_HELPERAPPSDIR.'vorbiscomment.exe -w --raw -c "'.$tempcommentsfilename.'" "'.$this->filename.'" 2>&1'; + $VorbiscommentError = `$commandline`; + + if (empty($VorbiscommentError)) { + clearstatcache(); + if ($timestampbeforewriting == filemtime($this->filename)) { + $VorbiscommentError = 'File modification timestamp has not changed - it looks like the tags were not written'; + } + } + } else { + $VorbiscommentError = 'vorbiscomment.exe not found in '.GETID3_HELPERAPPSDIR; + } + + } else { + + $commandline = 'vorbiscomment -w --raw -c "'.$tempcommentsfilename.'" "'.$this->filename.'" 2>&1'; + $VorbiscommentError = `$commandline`; + + } + + // Remove temporary comments file + unlink($tempcommentsfilename); + ignore_user_abort($oldignoreuserabort); + + if (!empty($VorbiscommentError)) { + + $this->errors[] = 'system call to vorbiscomment failed with message: '."\n\n".$VorbiscommentError; + return false; + + } + + return true; + } + + public function DeleteVorbisComment() { + $this->tag_data = array(array()); + return $this->WriteVorbisComment(); + } + + public function CleanVorbisCommentName($originalcommentname) { + // A case-insensitive field name that may consist of ASCII 0x20 through 0x7D, 0x3D ('=') excluded. + // ASCII 0x41 through 0x5A inclusive (A-Z) is to be considered equivalent to ASCII 0x61 through + // 0x7A inclusive (a-z). + + // replace invalid chars with a space, return uppercase text + // Thanks Chris Bolt for improving this function + // note: *reg_replace() replaces nulls with empty string (not space) + return strtoupper(preg_replace('#[^ -<>-}]#', ' ', str_replace("\x00", ' ', $originalcommentname))); + + } + +} diff --git a/www/rompr/getplaylist.php b/www/rompr/getplaylist.php new file mode 100644 index 0000000..cc4010d --- /dev/null +++ b/www/rompr/getplaylist.php @@ -0,0 +1,36 @@ +get_playlist($collection) as $info) { + if ($doneone) { + print ', '; + } else { + $doneone = true; + } + print json_encode($info); +}; +print ']'; +ob_flush(); +logger::trace("GETPLAYLIST", "Playlist Output Is Done"); + +?> diff --git a/www/rompr/gettheme.php b/www/rompr/gettheme.php new file mode 100644 index 0000000..5d54974 --- /dev/null +++ b/www/rompr/gettheme.php @@ -0,0 +1,23 @@ + \ No newline at end of file diff --git a/www/rompr/iconsets/Colourful/0stars.svg b/www/rompr/iconsets/Colourful/0stars.svg new file mode 100644 index 0000000..76704b0 --- /dev/null +++ b/www/rompr/iconsets/Colourful/0stars.svg @@ -0,0 +1,19 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/1stars.svg b/www/rompr/iconsets/Colourful/1stars.svg new file mode 100644 index 0000000..5b0d22d --- /dev/null +++ b/www/rompr/iconsets/Colourful/1stars.svg @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/2stars.svg b/www/rompr/iconsets/Colourful/2stars.svg new file mode 100644 index 0000000..1b84210 --- /dev/null +++ b/www/rompr/iconsets/Colourful/2stars.svg @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/3stars.svg b/www/rompr/iconsets/Colourful/3stars.svg new file mode 100644 index 0000000..bfc46b8 --- /dev/null +++ b/www/rompr/iconsets/Colourful/3stars.svg @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/4stars.svg b/www/rompr/iconsets/Colourful/4stars.svg new file mode 100644 index 0000000..0fb7459 --- /dev/null +++ b/www/rompr/iconsets/Colourful/4stars.svg @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/5stars.svg b/www/rompr/iconsets/Colourful/5stars.svg new file mode 100644 index 0000000..952359c --- /dev/null +++ b/www/rompr/iconsets/Colourful/5stars.svg @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/aac-audio.jpg b/www/rompr/iconsets/Colourful/aac-audio.jpg new file mode 100644 index 0000000..5a3daa1 Binary files /dev/null and b/www/rompr/iconsets/Colourful/aac-audio.jpg differ diff --git a/www/rompr/iconsets/Colourful/add.svg b/www/rompr/iconsets/Colourful/add.svg new file mode 100644 index 0000000..b153788 --- /dev/null +++ b/www/rompr/iconsets/Colourful/add.svg @@ -0,0 +1,22 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/adjustments.css b/www/rompr/iconsets/Colourful/adjustments.css new file mode 100644 index 0000000..52d98b5 --- /dev/null +++ b/www/rompr/iconsets/Colourful/adjustments.css @@ -0,0 +1,247 @@ +#buttons +{ + padding-left:12px; + padding-right:12px; + padding-top:4px; + padding-bottom:6px; +} + +.controlbutton +{ + margin:0px; + padding:0px; + vertical-align:middle; + display:inline-block; + width:56px; + height:56px; +} + +.controlbutton-small +{ + margin:0px; + vertical-align:middle; + display:inline-block; + width:48px; + height:48px; +} + +@media screen and (min-height: 800px) and (max-height: 939px) { + .controlbutton { + width:64px; + height:64px; + } + #buttons { + padding-top:12px; + } + #playbackTime { + margin-top:2px; + font-size:12px; + line-height:14px; + height:14px; + } +} + +@media screen and (min-height: 940px) and (max-height: 1099px) and (min-width: 650px) { + .controlbutton { + width:84px; + height:84px; + } + + .controlbutton-small { + width:64px; + height:64px; + } + + .shiftleft + { + left:-12px; + position:relative; + z-index:250; + } + + .shiftleft2 + { + left:-26px; + position:relative; + } + + .shiftleft3 + { + position:relative; + left:-36px; + z-index:5; + } + + .shiftleft4 + { + position:relative; + left:-48px; + z-index:1; + margin-right:-36px; + } + +} + +@media screen and (min-height: 940px) and (max-height: 1099px) and (min-width: 650px) { + .controlbutton { + width:84px; + height:84px; + } + .controlbutton-small { + width:64px; + height:64px; + } + #buttons { + padding-top:16px; + padding-left:24px; + } + #playbackTime { + margin-top:4px; + font-size:14px; + line-height:16px; + height:16px; + } + .shiftleft + { + left:-12px; + position:relative; + z-index:250; + } + + .shiftleft2 + { + left:-26px; + position:relative; + } + + .shiftleft3 + { + position:relative; + left:-36px; + z-index:5; + } + + .shiftleft4 + { + position:relative; + left:-48px; + z-index:1; + margin-right:-36px; + } +} + +@media screen and (min-height: 1100px) and (min-width: 651px) and (max-width: 749px) { + .controlbutton { + width:84px; + height:84px; + } + .controlbutton-small { + width:64px; + height:64px; + } + #buttons { + padding-top:16px; + padding-left:24px; + } + #playbackTime { + margin-top:4px; + font-size:14px; + line-height:16px; + height:16px; + } + .shiftleft + { + left:-12px; + position:relative; + z-index:250; + } + + .shiftleft2 + { + left:-26px; + position:relative; + } + + .shiftleft3 + { + position:relative; + left:-36px; + z-index:5; + } + + .shiftleft4 + { + position:relative; + left:-48px; + z-index:1; + margin-right:-36px; + } +} + +@media screen and (min-height: 1100px) and (min-width: 720px) { + .controlbutton { + width:90px; + height:90px; + } + .controlbutton-small { + width:70px; + height:70px; + } + #buttons { + padding-top:12px; + padding-left:20px; + } + #progress { + margin-top:8px; + } + #playbackTime { + margin-top:12px; + font-size:16px; + line-height:18px; + height:18px; + } + .shiftleft + { + left:-10px; + position:relative; + z-index:250; + } + + .shiftleft2 + { + left:-22px; + position:relative; + } + + .shiftleft3 + { + position:relative; + left:-34px; + z-index:5; + } + + .shiftleft4 + { + position:relative; + left:-44px; + z-index:1; + margin-right:-36px; + } +} + + +.shiftleft +{ +} + +.shiftleft2 +{ +} + +.shiftleft3 +{ +} + +.shiftleft4 +{ +} diff --git a/www/rompr/iconsets/Colourful/alarmclock_false.svg b/www/rompr/iconsets/Colourful/alarmclock_false.svg new file mode 100644 index 0000000..a4208e0 --- /dev/null +++ b/www/rompr/iconsets/Colourful/alarmclock_false.svg @@ -0,0 +1,77 @@ + + + + + + + + + + + clock + modern + + + + + Chris Kempson + + + + + Chris Kempson + + + + + Chris Kempson + + + + image/svg+xml + + + en + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/alarmclock_true.svg b/www/rompr/iconsets/Colourful/alarmclock_true.svg new file mode 100644 index 0000000..7802417 --- /dev/null +++ b/www/rompr/iconsets/Colourful/alarmclock_true.svg @@ -0,0 +1,77 @@ + + + + + + + + + + + clock + modern + + + + + Chris Kempson + + + + + Chris Kempson + + + + + Chris Kempson + + + + image/svg+xml + + + en + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/allmusic-logo.svg b/www/rompr/iconsets/Colourful/allmusic-logo.svg new file mode 100644 index 0000000..2204bd6 --- /dev/null +++ b/www/rompr/iconsets/Colourful/allmusic-logo.svg @@ -0,0 +1,41 @@ + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Colourful/arrow-decrease.svg b/www/rompr/iconsets/Colourful/arrow-decrease.svg new file mode 100644 index 0000000..aa04836 --- /dev/null +++ b/www/rompr/iconsets/Colourful/arrow-decrease.svg @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/arrow-increase.svg b/www/rompr/iconsets/Colourful/arrow-increase.svg new file mode 100644 index 0000000..61f7221 --- /dev/null +++ b/www/rompr/iconsets/Colourful/arrow-increase.svg @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/arrow-left-double.svg b/www/rompr/iconsets/Colourful/arrow-left-double.svg new file mode 100644 index 0000000..065dcd0 --- /dev/null +++ b/www/rompr/iconsets/Colourful/arrow-left-double.svg @@ -0,0 +1,205 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/arrow-right-double.svg b/www/rompr/iconsets/Colourful/arrow-right-double.svg new file mode 100644 index 0000000..e2f3f36 --- /dev/null +++ b/www/rompr/iconsets/Colourful/arrow-right-double.svg @@ -0,0 +1,205 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/arrow-updown.svg b/www/rompr/iconsets/Colourful/arrow-updown.svg new file mode 100644 index 0000000..6cdaf08 --- /dev/null +++ b/www/rompr/iconsets/Colourful/arrow-updown.svg @@ -0,0 +1,171 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/artist-icon.png b/www/rompr/iconsets/Colourful/artist-icon.png new file mode 100644 index 0000000..a9753f0 Binary files /dev/null and b/www/rompr/iconsets/Colourful/artist-icon.png differ diff --git a/www/rompr/iconsets/Colourful/audiobook.svg b/www/rompr/iconsets/Colourful/audiobook.svg new file mode 100644 index 0000000..3be9a74 --- /dev/null +++ b/www/rompr/iconsets/Colourful/audiobook.svg @@ -0,0 +1,77 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Colourful/backbutton.svg b/www/rompr/iconsets/Colourful/backbutton.svg new file mode 100644 index 0000000..0b03100 --- /dev/null +++ b/www/rompr/iconsets/Colourful/backbutton.svg @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/bbc-logo.svg b/www/rompr/iconsets/Colourful/bbc-logo.svg new file mode 100644 index 0000000..77f259a --- /dev/null +++ b/www/rompr/iconsets/Colourful/bbc-logo.svg @@ -0,0 +1,23 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/blobdown2-hi.svg b/www/rompr/iconsets/Colourful/blobdown2-hi.svg new file mode 100644 index 0000000..ae876b6 --- /dev/null +++ b/www/rompr/iconsets/Colourful/blobdown2-hi.svg @@ -0,0 +1,105 @@ + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/blobdown2.svg b/www/rompr/iconsets/Colourful/blobdown2.svg new file mode 100644 index 0000000..7db181c --- /dev/null +++ b/www/rompr/iconsets/Colourful/blobdown2.svg @@ -0,0 +1,71 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/broadcast-new.svg b/www/rompr/iconsets/Colourful/broadcast-new.svg new file mode 100644 index 0000000..fbafb99 --- /dev/null +++ b/www/rompr/iconsets/Colourful/broadcast-new.svg @@ -0,0 +1,162 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Colourful/calendar.svg b/www/rompr/iconsets/Colourful/calendar.svg new file mode 100644 index 0000000..96d4d52 --- /dev/null +++ b/www/rompr/iconsets/Colourful/calendar.svg @@ -0,0 +1,121 @@ + + + + Svg Vector Icons : http://www.onlinewebfonts.com/icon image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Colourful/cd_case.svg b/www/rompr/iconsets/Colourful/cd_case.svg new file mode 100644 index 0000000..45288dc --- /dev/null +++ b/www/rompr/iconsets/Colourful/cd_case.svg @@ -0,0 +1,655 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + Openclipart + + + + 2013-05-08T16:47:59 + CD-R compact disc-recordable, kompaktinis diskas, Kompaktinė plokštelė + http://openclipart.org/detail/177892/cd-r-compact-disc-recordable-by-keistutis-177892 + + + Keistutis + + + + + CD-R compact disc-recordable + Kompaktinė plokštelė + diskas + + + + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/collection.svg b/www/rompr/iconsets/Colourful/collection.svg new file mode 100644 index 0000000..6678162 --- /dev/null +++ b/www/rompr/iconsets/Colourful/collection.svg @@ -0,0 +1,29 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/compact-disc.svg b/www/rompr/iconsets/Colourful/compact-disc.svg new file mode 100644 index 0000000..3d9c16f --- /dev/null +++ b/www/rompr/iconsets/Colourful/compact-disc.svg @@ -0,0 +1,296 @@ + + + + +]> + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/consume.svg b/www/rompr/iconsets/Colourful/consume.svg new file mode 100644 index 0000000..e485279 --- /dev/null +++ b/www/rompr/iconsets/Colourful/consume.svg @@ -0,0 +1,209 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/consume_off.svg b/www/rompr/iconsets/Colourful/consume_off.svg new file mode 100644 index 0000000..2f9b695 --- /dev/null +++ b/www/rompr/iconsets/Colourful/consume_off.svg @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/crossfade.svg b/www/rompr/iconsets/Colourful/crossfade.svg new file mode 100644 index 0000000..ac4e79f --- /dev/null +++ b/www/rompr/iconsets/Colourful/crossfade.svg @@ -0,0 +1,125 @@ + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/crossfade_off.svg b/www/rompr/iconsets/Colourful/crossfade_off.svg new file mode 100644 index 0000000..7fc9865 --- /dev/null +++ b/www/rompr/iconsets/Colourful/crossfade_off.svg @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/dialog-error.svg b/www/rompr/iconsets/Colourful/dialog-error.svg new file mode 100644 index 0000000..94cecc3 --- /dev/null +++ b/www/rompr/iconsets/Colourful/dialog-error.svg @@ -0,0 +1,113 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/dialog-information.svg b/www/rompr/iconsets/Colourful/dialog-information.svg new file mode 100644 index 0000000..15a9b17 --- /dev/null +++ b/www/rompr/iconsets/Colourful/dialog-information.svg @@ -0,0 +1,404 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/dirble-logo.svg b/www/rompr/iconsets/Colourful/dirble-logo.svg new file mode 100644 index 0000000..7f81358 --- /dev/null +++ b/www/rompr/iconsets/Colourful/dirble-logo.svg @@ -0,0 +1,23 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/discogs-logo.svg b/www/rompr/iconsets/Colourful/discogs-logo.svg new file mode 100644 index 0000000..38f04af --- /dev/null +++ b/www/rompr/iconsets/Colourful/discogs-logo.svg @@ -0,0 +1,98 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/document-save.svg b/www/rompr/iconsets/Colourful/document-save.svg new file mode 100644 index 0000000..4b74edf --- /dev/null +++ b/www/rompr/iconsets/Colourful/document-save.svg @@ -0,0 +1,56 @@ + + + + Floppy 3.5 inch + + + + + + + + + + + + + + image/svg+xml + + Floppy 3.5 inch + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/download-icon.svg b/www/rompr/iconsets/Colourful/download-icon.svg new file mode 100644 index 0000000..c1c87c5 --- /dev/null +++ b/www/rompr/iconsets/Colourful/download-icon.svg @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + Openclipart + + + + 2012-09-10T11:43:42 + arrow, clip art, clipart, down, download, + http://openclipart.org/detail/172272/download-by-dako-172272 + + + DaKo + + + + + arrow + clip art + clipart + down + download + + + + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/edit-clear-list.svg b/www/rompr/iconsets/Colourful/edit-clear-list.svg new file mode 100644 index 0000000..2af421d --- /dev/null +++ b/www/rompr/iconsets/Colourful/edit-clear-list.svg @@ -0,0 +1,704 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/edit-delete.svg b/www/rompr/iconsets/Colourful/edit-delete.svg new file mode 100644 index 0000000..9468987 --- /dev/null +++ b/www/rompr/iconsets/Colourful/edit-delete.svg @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + 2005-10-27 + + + Jean-Victor Balin + + + jean.victor.balin@gmail.com + + + + icon + cancel + cross + + + fr-FR + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/expand-up.svg b/www/rompr/iconsets/Colourful/expand-up.svg new file mode 100644 index 0000000..d711b5d --- /dev/null +++ b/www/rompr/iconsets/Colourful/expand-up.svg @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/facebook-logo.svg b/www/rompr/iconsets/Colourful/facebook-logo.svg new file mode 100644 index 0000000..c09997a --- /dev/null +++ b/www/rompr/iconsets/Colourful/facebook-logo.svg @@ -0,0 +1,13 @@ + + + + + + + diff --git a/www/rompr/iconsets/Colourful/file.svg b/www/rompr/iconsets/Colourful/file.svg new file mode 100644 index 0000000..370e7bf --- /dev/null +++ b/www/rompr/iconsets/Colourful/file.svg @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/flac-audio.svg b/www/rompr/iconsets/Colourful/flac-audio.svg new file mode 100644 index 0000000..5c6f30c --- /dev/null +++ b/www/rompr/iconsets/Colourful/flac-audio.svg @@ -0,0 +1,186 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/folder.svg b/www/rompr/iconsets/Colourful/folder.svg new file mode 100644 index 0000000..812465f --- /dev/null +++ b/www/rompr/iconsets/Colourful/folder.svg @@ -0,0 +1,59 @@ + + + + + + + + + + + hash + icon + + education + + + + + Seth Yastrov + + + + + Seth Yastrov + + + + + Seth Yastrov + + + + image/svg+xml + + + en + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/forwardbutton.svg b/www/rompr/iconsets/Colourful/forwardbutton.svg new file mode 100644 index 0000000..0bd0dea --- /dev/null +++ b/www/rompr/iconsets/Colourful/forwardbutton.svg @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/gmusic-logo.svg b/www/rompr/iconsets/Colourful/gmusic-logo.svg new file mode 100644 index 0000000..acffec1 --- /dev/null +++ b/www/rompr/iconsets/Colourful/gmusic-logo.svg @@ -0,0 +1,91 @@ + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Colourful/headphones.svg b/www/rompr/iconsets/Colourful/headphones.svg new file mode 100644 index 0000000..117df9c --- /dev/null +++ b/www/rompr/iconsets/Colourful/headphones.svg @@ -0,0 +1,140 @@ + + + + + + + + + + image/svg+xml + + + + 21.11.2006 + + + Sarka Slukova + + + + + ZS a MS Machovo namesti + + + CZ + + + sluchatka + headphones + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/icon-new.svg b/www/rompr/iconsets/Colourful/icon-new.svg new file mode 100644 index 0000000..373bf9b --- /dev/null +++ b/www/rompr/iconsets/Colourful/icon-new.svg @@ -0,0 +1,43 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/imdb-logo.svg b/www/rompr/iconsets/Colourful/imdb-logo.svg new file mode 100644 index 0000000..1cc0b7e --- /dev/null +++ b/www/rompr/iconsets/Colourful/imdb-logo.svg @@ -0,0 +1,3 @@ + + +image/svg+xml diff --git a/www/rompr/iconsets/Colourful/internetarchive-logo.svg b/www/rompr/iconsets/Colourful/internetarchive-logo.svg new file mode 100644 index 0000000..317e443 --- /dev/null +++ b/www/rompr/iconsets/Colourful/internetarchive-logo.svg @@ -0,0 +1,2 @@ + +image/svg+xml diff --git a/www/rompr/iconsets/Colourful/lastfm-ban.svg b/www/rompr/iconsets/Colourful/lastfm-ban.svg new file mode 100644 index 0000000..3730107 --- /dev/null +++ b/www/rompr/iconsets/Colourful/lastfm-ban.svg @@ -0,0 +1,20 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/lastfm-love.svg b/www/rompr/iconsets/Colourful/lastfm-love.svg new file mode 100644 index 0000000..d7eda36 --- /dev/null +++ b/www/rompr/iconsets/Colourful/lastfm-love.svg @@ -0,0 +1,66 @@ + + + + + + + + cristal heart + + + heart + valentine + love + + + + + Open Clip Art Library + + + + + roberto u. + + + + + roberto u. + + + + image/svg+xml + + + en + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/lastfm-unlove.svg b/www/rompr/iconsets/Colourful/lastfm-unlove.svg new file mode 100644 index 0000000..c80f513 --- /dev/null +++ b/www/rompr/iconsets/Colourful/lastfm-unlove.svg @@ -0,0 +1,196 @@ + + + + + + + + + cristal heart + + + heart + valentine + love + + + + + Open Clip Art Library + + + + + roberto u. + + + + + roberto u. + + + + image/svg+xml + + + en + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/lastfm.svg b/www/rompr/iconsets/Colourful/lastfm.svg new file mode 100644 index 0000000..658c2c8 --- /dev/null +++ b/www/rompr/iconsets/Colourful/lastfm.svg @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/lyrics.svg b/www/rompr/iconsets/Colourful/lyrics.svg new file mode 100644 index 0000000..bd483a4 --- /dev/null +++ b/www/rompr/iconsets/Colourful/lyrics.svg @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + 14 Jun 08 + + + Jeremy Bennett + + + + + Public Domain + + + + + Jeremy Bennett + + + + + Richard Tallent and Barret Ruttan from the Open Clip Art library + + + A pencil writing on a sticky note. Created for use as a "note" admonition with Docbook and FOP + + + color + icon + office + computer + docbook + admonition + + + en-GB + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/media-playback-pause-highlight.svg b/www/rompr/iconsets/Colourful/media-playback-pause-highlight.svg new file mode 100644 index 0000000..6090ba3 --- /dev/null +++ b/www/rompr/iconsets/Colourful/media-playback-pause-highlight.svg @@ -0,0 +1,90 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/media-playback-pause.svg b/www/rompr/iconsets/Colourful/media-playback-pause.svg new file mode 100644 index 0000000..17815e7 --- /dev/null +++ b/www/rompr/iconsets/Colourful/media-playback-pause.svg @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/media-playback-start-highlight.svg b/www/rompr/iconsets/Colourful/media-playback-start-highlight.svg new file mode 100644 index 0000000..4bd91d5 --- /dev/null +++ b/www/rompr/iconsets/Colourful/media-playback-start-highlight.svg @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/media-playback-start.svg b/www/rompr/iconsets/Colourful/media-playback-start.svg new file mode 100644 index 0000000..56e8865 --- /dev/null +++ b/www/rompr/iconsets/Colourful/media-playback-start.svg @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/media-playback-stop-highlight.svg b/www/rompr/iconsets/Colourful/media-playback-stop-highlight.svg new file mode 100644 index 0000000..cbed3a1 --- /dev/null +++ b/www/rompr/iconsets/Colourful/media-playback-stop-highlight.svg @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/media-playback-stop.svg b/www/rompr/iconsets/Colourful/media-playback-stop.svg new file mode 100644 index 0000000..ae368e7 --- /dev/null +++ b/www/rompr/iconsets/Colourful/media-playback-stop.svg @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/media-skip-backward-highlight.svg b/www/rompr/iconsets/Colourful/media-skip-backward-highlight.svg new file mode 100644 index 0000000..383cd51 --- /dev/null +++ b/www/rompr/iconsets/Colourful/media-skip-backward-highlight.svg @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/media-skip-backward.svg b/www/rompr/iconsets/Colourful/media-skip-backward.svg new file mode 100644 index 0000000..1857146 --- /dev/null +++ b/www/rompr/iconsets/Colourful/media-skip-backward.svg @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/media-skip-forward-highlight.svg b/www/rompr/iconsets/Colourful/media-skip-forward-highlight.svg new file mode 100644 index 0000000..a131e74 --- /dev/null +++ b/www/rompr/iconsets/Colourful/media-skip-forward-highlight.svg @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/media-skip-forward.svg b/www/rompr/iconsets/Colourful/media-skip-forward.svg new file mode 100644 index 0000000..8b53d1d --- /dev/null +++ b/www/rompr/iconsets/Colourful/media-skip-forward.svg @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/movie-1.svg b/www/rompr/iconsets/Colourful/movie-1.svg new file mode 100644 index 0000000..b92f446 --- /dev/null +++ b/www/rompr/iconsets/Colourful/movie-1.svg @@ -0,0 +1,17 @@ + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/mp3-audio.svg b/www/rompr/iconsets/Colourful/mp3-audio.svg new file mode 100644 index 0000000..121f66e --- /dev/null +++ b/www/rompr/iconsets/Colourful/mp3-audio.svg @@ -0,0 +1,63 @@ + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/musicbrainz_logo.svg b/www/rompr/iconsets/Colourful/musicbrainz_logo.svg new file mode 100644 index 0000000..74059f5 --- /dev/null +++ b/www/rompr/iconsets/Colourful/musicbrainz_logo.svg @@ -0,0 +1,263 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Colourful/neverheard.png b/www/rompr/iconsets/Colourful/neverheard.png new file mode 100644 index 0000000..43a6c9a Binary files /dev/null and b/www/rompr/iconsets/Colourful/neverheard.png differ diff --git a/www/rompr/iconsets/Colourful/ogg-audio.svg b/www/rompr/iconsets/Colourful/ogg-audio.svg new file mode 100644 index 0000000..0b2cffb --- /dev/null +++ b/www/rompr/iconsets/Colourful/ogg-audio.svg @@ -0,0 +1,130 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Vorbis + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/output.svg b/www/rompr/iconsets/Colourful/output.svg new file mode 100644 index 0000000..3fa1aac --- /dev/null +++ b/www/rompr/iconsets/Colourful/output.svg @@ -0,0 +1,189 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/output_mute.svg b/www/rompr/iconsets/Colourful/output_mute.svg new file mode 100644 index 0000000..83520c9 --- /dev/null +++ b/www/rompr/iconsets/Colourful/output_mute.svg @@ -0,0 +1,142 @@ + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/parental-advisory.svg b/www/rompr/iconsets/Colourful/parental-advisory.svg new file mode 100644 index 0000000..ea6360a --- /dev/null +++ b/www/rompr/iconsets/Colourful/parental-advisory.svg @@ -0,0 +1,19 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + \ No newline at end of file diff --git a/www/rompr/iconsets/Colourful/playlist.svg b/www/rompr/iconsets/Colourful/playlist.svg new file mode 100644 index 0000000..181cbe0 --- /dev/null +++ b/www/rompr/iconsets/Colourful/playlist.svg @@ -0,0 +1,27 @@ + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/podcast-logo.svg b/www/rompr/iconsets/Colourful/podcast-logo.svg new file mode 100644 index 0000000..d31d215 --- /dev/null +++ b/www/rompr/iconsets/Colourful/podcast-logo.svg @@ -0,0 +1,79 @@ + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Colourful/preferences.svg b/www/rompr/iconsets/Colourful/preferences.svg new file mode 100644 index 0000000..d26bc05 --- /dev/null +++ b/www/rompr/iconsets/Colourful/preferences.svg @@ -0,0 +1,538 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/pushbutton.svg b/www/rompr/iconsets/Colourful/pushbutton.svg new file mode 100644 index 0000000..79bb067 --- /dev/null +++ b/www/rompr/iconsets/Colourful/pushbutton.svg @@ -0,0 +1,63 @@ + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Colourful/random.svg b/www/rompr/iconsets/Colourful/random.svg new file mode 100644 index 0000000..4400290 --- /dev/null +++ b/www/rompr/iconsets/Colourful/random.svg @@ -0,0 +1,91 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/random_off.svg b/www/rompr/iconsets/Colourful/random_off.svg new file mode 100644 index 0000000..36175be --- /dev/null +++ b/www/rompr/iconsets/Colourful/random_off.svg @@ -0,0 +1,116 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/ratandtag.svg b/www/rompr/iconsets/Colourful/ratandtag.svg new file mode 100644 index 0000000..8fe69d3 --- /dev/null +++ b/www/rompr/iconsets/Colourful/ratandtag.svg @@ -0,0 +1,290 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + & + diff --git a/www/rompr/iconsets/Colourful/ratortag.svg b/www/rompr/iconsets/Colourful/ratortag.svg new file mode 100644 index 0000000..001f939 --- /dev/null +++ b/www/rompr/iconsets/Colourful/ratortag.svg @@ -0,0 +1,294 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + / + diff --git a/www/rompr/iconsets/Colourful/refresh.svg b/www/rompr/iconsets/Colourful/refresh.svg new file mode 100644 index 0000000..3767e6d --- /dev/null +++ b/www/rompr/iconsets/Colourful/refresh.svg @@ -0,0 +1,69 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/refresh_off.svg b/www/rompr/iconsets/Colourful/refresh_off.svg new file mode 100644 index 0000000..5253a54 --- /dev/null +++ b/www/rompr/iconsets/Colourful/refresh_off.svg @@ -0,0 +1,248 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/resize.svg b/www/rompr/iconsets/Colourful/resize.svg new file mode 100644 index 0000000..c359544 --- /dev/null +++ b/www/rompr/iconsets/Colourful/resize.svg @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/rss.svg b/www/rompr/iconsets/Colourful/rss.svg new file mode 100644 index 0000000..b325149 --- /dev/null +++ b/www/rompr/iconsets/Colourful/rss.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/shuffle.png b/www/rompr/iconsets/Colourful/shuffle.png new file mode 100644 index 0000000..05b87dd Binary files /dev/null and b/www/rompr/iconsets/Colourful/shuffle.png differ diff --git a/www/rompr/iconsets/Colourful/singlestar.svg b/www/rompr/iconsets/Colourful/singlestar.svg new file mode 100644 index 0000000..5a3b048 --- /dev/null +++ b/www/rompr/iconsets/Colourful/singlestar.svg @@ -0,0 +1,105 @@ + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/sleep.png b/www/rompr/iconsets/Colourful/sleep.png new file mode 100644 index 0000000..b049743 Binary files /dev/null and b/www/rompr/iconsets/Colourful/sleep.png differ diff --git a/www/rompr/iconsets/Colourful/sliders.svg b/www/rompr/iconsets/Colourful/sliders.svg new file mode 100644 index 0000000..eba5789 --- /dev/null +++ b/www/rompr/iconsets/Colourful/sliders.svg @@ -0,0 +1,21 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/smartradio.svg b/www/rompr/iconsets/Colourful/smartradio.svg new file mode 100644 index 0000000..e4c1901 --- /dev/null +++ b/www/rompr/iconsets/Colourful/smartradio.svg @@ -0,0 +1,168 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/soundcloud-logo.svg b/www/rompr/iconsets/Colourful/soundcloud-logo.svg new file mode 100644 index 0000000..04b35e0 --- /dev/null +++ b/www/rompr/iconsets/Colourful/soundcloud-logo.svg @@ -0,0 +1,2 @@ + +image/svg+xml diff --git a/www/rompr/iconsets/Colourful/spinner.svg b/www/rompr/iconsets/Colourful/spinner.svg new file mode 100644 index 0000000..ba8c075 --- /dev/null +++ b/www/rompr/iconsets/Colourful/spinner.svg @@ -0,0 +1,3 @@ + + +image/svg+xml diff --git a/www/rompr/iconsets/Colourful/spotify-logo.svg b/www/rompr/iconsets/Colourful/spotify-logo.svg new file mode 100644 index 0000000..867c9cc --- /dev/null +++ b/www/rompr/iconsets/Colourful/spotify-logo.svg @@ -0,0 +1,2 @@ + +image/svg+xml diff --git a/www/rompr/iconsets/Colourful/stopafter-highlight.svg b/www/rompr/iconsets/Colourful/stopafter-highlight.svg new file mode 100644 index 0000000..58da81b --- /dev/null +++ b/www/rompr/iconsets/Colourful/stopafter-highlight.svg @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/stopafter.svg b/www/rompr/iconsets/Colourful/stopafter.svg new file mode 100644 index 0000000..b7b5886 --- /dev/null +++ b/www/rompr/iconsets/Colourful/stopafter.svg @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/system-search.svg b/www/rompr/iconsets/Colourful/system-search.svg new file mode 100644 index 0000000..1f2fa0d --- /dev/null +++ b/www/rompr/iconsets/Colourful/system-search.svg @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/tag.svg b/www/rompr/iconsets/Colourful/tag.svg new file mode 100644 index 0000000..b4761aa --- /dev/null +++ b/www/rompr/iconsets/Colourful/tag.svg @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/theme.css b/www/rompr/iconsets/Colourful/theme.css new file mode 100644 index 0000000..6225fe4 --- /dev/null +++ b/www/rompr/iconsets/Colourful/theme.css @@ -0,0 +1,246 @@ + + [class^="icon-"], [class*=" icon-"] { + background-size:contain; + background-repeat:no-repeat; + background-position: center; + display:inline-block; +} + +.button-disabled { opacity: 0.1 } + +.clearbox, { + background-image: url('iconsets/Colourful/edit-delete.svg'); + /* dont change the 50%, it ties in with makeHoverWork, makeClearWork, and makeTagMenu */ + background-size: auto 50%; + background-position: right 2px center; + background-repeat: no-repeat; +} + +.combobox-entry, .selectholder { + background-image: url('iconsets/Colourful/blobdown2.svg'); + /* dont change the 50%, it ties in with makeHoverWork, makeClearWork, and makeTagMenu */ + background-size: auto 50%; + background-position: right 2px center; + background-repeat: no-repeat; +} + +.combobox-entry:hover, .selectholder:hover { + background-image: url('iconsets/Colourful/blobdown2-hi.svg'); + /* dont change the 50%, it ties in with makeHoverWork, makeClearWork, and makeTagMenu */ + background-size: auto 50%; + background-position: right 2px center; + background-repeat: no-repeat; +} + +.combo-button { + background-image: url('iconsets/Colourful/blobdown2.svg'); +} + +.icon-play-circled { background-image :url('iconsets/Colourful/media-playback-start.svg') } +.playdiv { background-image :url('iconsets/Colourful/media-playback-start.svg') } +.icon-play-circled:hover { background-image :url('iconsets/Colourful/media-playback-start-highlight.svg') } +.icon-pause-circled { background-image :url('iconsets/Colourful/media-playback-pause.svg') } +.icon-pause-circled:hover { background-image :url('iconsets/Colourful/media-playback-pause-highlight.svg') } +.icon-fast-backward { background-image :url('iconsets/Colourful/media-skip-backward.svg') } +.icon-fast-backward:hover { background-image :url('iconsets/Colourful/media-skip-backward-highlight.svg') } +.icon-fast-forward { background-image :url('iconsets/Colourful/media-skip-forward.svg') } +.icon-fast-forward:hover { background-image :url('iconsets/Colourful/media-skip-forward-highlight.svg') } +.icon-stop-1 { background-image :url('iconsets/Colourful/media-playback-stop.svg') } +.icon-stop-1:hover { background-image :url('iconsets/Colourful/media-playback-stop-highlight.svg') } +.icon-to-end-1 { background-image :url('iconsets/Colourful/stopafter.svg') } +.icon-to-end-1:hover { background-image :url('iconsets/Colourful/stopafter-highlight.svg') } + +.icon-music { background-image: url('iconsets/Colourful/collection.svg') } +.icon-search { background-image: url('iconsets/Colourful/system-search.svg') } +.icon-folder-open-empty { background-image: url('iconsets/Colourful/folder.svg') } +.icon-radio-tower { background-image: url('iconsets/Colourful/broadcast-new.svg') } +.icon-cd { background-image: url('iconsets/Colourful/cd_case.svg') } +.icon-resize-horizontal { background-image: url('iconsets/Colourful/resize.svg') } +.icon-angle-double-left { background-image:url('iconsets/Colourful/arrow-left-double.svg') } +.icon-angle-double-right { background-image:url('iconsets/Colourful/arrow-right-double.svg') } +.icon-menu { background-image: url('iconsets/Colourful/pushbutton.svg') } +.icon-versions { background-image: url('iconsets/Colourful/history.svg') } +.icon-left-circled { background-image: url('iconsets/Colourful/backbutton.svg') } +.icon-right-circled { background-image: url('iconsets/Colourful/forwardbutton.svg') } +.icon-cog-alt { background-image: url('iconsets/Colourful/preferences.svg') } +.icon-trash { background-image: url('iconsets/Colourful/edit-clear-list.svg') } +.icon-wifi { background-image: url('iconsets/Colourful/smartradio.svg') } +.icon-doc-text { background-image: url('iconsets/Colourful/playlist.svg') } +.icon-floppy { background-image: url('iconsets/Colourful/document-save.svg') } +.icon-cancel-circled { background-image: url('iconsets/Colourful/edit-delete.svg') } +.icon-plus { + background-image: url('iconsets/Colourful/add.svg'); + opacity:0.9; +} +.icon-alarm { background-image: url('iconsets/Colourful/alarmclock_false.svg') } +.icon-alarm-on { background-image: url('iconsets/Colourful/alarmclock_true.svg') } +.icon-sleep { background-image: url('iconsets/Colourful/sleep.png') } +.icon-library { background-image: url('iconsets/Colourful/file.svg') } +.icon-lastfm-1 { background-image: url('iconsets/Colourful/lastfm.svg') } +.icon-wikipedia { background-image: url('iconsets/Colourful/wikipedia-logo.svg') } +.icon-musicbrainz { background-image: url('iconsets/Colourful/musicbrainz_logo.svg') } +.icon-discogs { background-image: url('iconsets/Colourful/discogs-logo.svg') } +.icon-doc-text-1 { background-image: url('iconsets/Colourful/lyrics.svg') } +.icon-soundcloud-circled { background-image: url('iconsets/Colourful/soundcloud-logo.svg') } +.icon-youtube-circled { background-image: url('iconsets/Colourful/youtube-logo.svg') } +.icon-gmusic-circled { background-image: url('iconsets/Colourful/gmusic-logo.svg') } +.icon-spotify-circled { background-image: url('iconsets/Colourful/spotify-logo.svg') } +.icon-vkontakte-circled { background-image: url('iconsets/Colourful/vkontakte-logo.svg') } +.icon-podcast-circled { background-image: url('iconsets/Colourful/podcast-logo.svg') } +.icon-audiobook { background-image: url('iconsets/Colourful/audiobook.svg') } +.icon-internetarchive-circled { background-image: url('iconsets/Colourful/internetarchive-logo.svg') } +.icon-increase { background-image: url('iconsets/Colourful/arrow-increase.svg') } +.icon-decrease { background-image: url('iconsets/Colourful/arrow-decrease.svg') } +.icon-attention-1 { background-image: url('iconsets/Colourful/dialog-error.svg') } +.icon-info-circled { background-image: url('iconsets/Colourful/dialog-information.svg') } +.icon-download { background-image: url('iconsets/Colourful/download-icon.svg') } +.icon-sun { background-image: url('iconsets/Colourful/icon-new.svg') } +.icon-headphones { background-image: url('iconsets/Colourful/headphones.svg') } +.icon-unlistened { background-image: url('iconsets/Colourful/unlistened.svg') } +.icon-block { background-image: url('iconsets/Colourful/lastfm-ban.svg') } +.icon-heart { background-image: url('iconsets/Colourful/lastfm-love.svg') } +.icon-heart-broken { background-image: url('iconsets/Colourful/lastfm-unlove.svg') } +.icon-refresh { background-image: url('iconsets/Colourful/refresh.svg') } +.icon-dirble-circled { background-image: url('iconsets/Colourful/dirble-logo.svg') } +.icon-tunein { background-image: url('iconsets/Colourful/../../newimages/tunein-logo.svg') } +.icon-no-response-playbutton { background-image :url('iconsets/Colourful/media-playback-start.svg') } +.icon-tags { background-image: url('iconsets/Colourful/tag.svg') } +.icon-volume-up { background-image: url('iconsets/Colourful/volume.svg') } +.icon-toggle-open { background-image: url('iconsets/Colourful/toggle-open.svg') } +.icon-toggle-closed { background-image: url('iconsets/Colourful/toggle-closed.svg') } +.icon-spin6 { background-image: url('iconsets/Colourful/spinner.svg') } +.icon-output { background-image: url('iconsets/Colourful/output.svg') } +.icon-output-mute { background-image: url('iconsets/Colourful/output_mute.svg') } +.icon-sliders { background-image: url('iconsets/Colourful/sliders.svg') } +.icon-0-stars { background-image: url('iconsets/Colourful/0stars.svg') } +.icon-1-stars { background-image: url('iconsets/Colourful/1stars.svg') } +.icon-2-stars { background-image: url('iconsets/Colourful/2stars.svg') } +.icon-3-stars { background-image: url('iconsets/Colourful/3stars.svg') } +.icon-4-stars { background-image: url('iconsets/Colourful/4stars.svg') } +.icon-5-stars { background-image: url('iconsets/Colourful/5stars.svg') } +.icon-single-star { background-image: url('iconsets/Colourful/singlestar.svg') } +.icon-ratandtag { background-image: url('iconsets/Colourful/ratandtag.svg') } +.icon-ratortag { background-image: url('iconsets/Colourful/ratortag.svg') } +.icon-toggle-on { background-image: url('iconsets/Colourful/togglebutton-new2-on.svg') } +.icon-toggle-off { background-image: url('iconsets/Colourful/togglebutton-new2-off.svg') } + +.icon-random.flow-on { background-image: url('iconsets/Colourful/random.svg') } +.icon-random.flow-off { background-image: url('iconsets/Colourful/random_off.svg') } +.icon-crossfade.flow-on { background-image: url('iconsets/Colourful/crossfade.svg') } +.icon-crossfade.flow-off { background-image: url('iconsets/Colourful/crossfade_off.svg') } +.icon-repeat.flow-on { background-image: url('iconsets/Colourful/refresh.svg') } +.icon-repeat.flow-off { background-image: url('iconsets/Colourful/refresh_off.svg') } +.icon-consume.flow-on { background-image: url('iconsets/Colourful/consume.svg') } +.icon-consume.flow-off { background-image: url('iconsets/Colourful/consume_off.svg') } + +.icon-allrandom { background-image: url('iconsets/Colourful/shuffle.png') } +.icon-neverplayed { background-image: url('iconsets/Colourful/neverheard.png') } +.icon-recentlyplayed { background-image: url('iconsets/Colourful/calendar.svg') } +.icon-artist { background-image: url('iconsets/Colourful/artist-icon.png') } +.icon-mp3-audio { background-image: url('iconsets/Colourful/mp3-audio.svg') } +.icon-aac-audio { background-image: url('iconsets/Colourful/aac-audio.jpg') } +.icon-flac-audio { background-image: url('iconsets/Colourful/flac-audio.svg') } +.icon-wma-audio { background-image: url('iconsets/Colourful/wma-audio.svg') } +.icon-ogg-audio { background-image: url('iconsets/Colourful/ogg-audio.svg') } +.icon-explicit { background-image: url('iconsets/Colourful/parental-advisory.svg') } +.icon-expand-up { background-image: url('iconsets/Colourful/expand-up.svg') } +.icon-rss { background-image: url('iconsets/Colourful/rss.svg') } +.icon-tick { background-image: url('iconsets/Colourful/tick.svg') } +.icon-video { background-image: url('iconsets/Colourful/movie-1.svg') } +.icon-bbc-logo { background-image: url('iconsets/Colourful/bbc-logo.svg') } +.icon-imdb-logo { background-image: url('iconsets/Colourful/imdb-logo.svg') } +.icon-facebook-logo { background-image: url('iconsets/Colourful/facebook-logo.svg') } +.icon-twitter-logo { background-image: url('iconsets/Colourful/twitter-logo.svg') } +.icon-www { background-image: url('iconsets/Colourful/world-wide-web.svg') } +.icon-allmusic { background-image: url('iconsets/Colourful/allmusic-logo.svg') } +.icon-updown { background-image: url('iconsets/Colourful/arrow-updown.svg') } +.icon-snapcast { background-image: url('iconsets/Colourful/../../newimages/snapcast.png') } + +.styledinputs label +{ + display:inline-block; + cursor:pointer; + position:relative; + padding-left:2.5em; + line-height:1.5em; +} + +.styledinputs input[type=radio] +{ + display:none; +} + +.styledinputs input[type=checkbox] +{ + display:none; +} + +.styledinputs label:before +{ + content:""; + display:inline-block; + width:2em; + height:1.5em; + position:absolute; + left:0; + /* bottom:0.2em; */ + background-image: url('iconsets/Colourful/togglebutton-new2-off.svg'); + background-size:contain; + background-position: center; + background-repeat:no-repeat; +} + +.styledinputs input:checked + label:before +{ + background-image: url('iconsets/Colourful/togglebutton-new2-on.svg') !important; +} + +img.notexist,img.notfound +{ + background-image: url('iconsets/Colourful/compact-disc.svg'); + background-size:contain; + display:inline-block; + background-position: center; + background-repeat:no-repeat; +} + +img.stream.notfound, img.stream.notexist +{ + background-image: url('iconsets/Colourful/broadcast-new.svg'); +} + +img.plimage.notfound +{ + background-image: url('iconsets/Colourful/playlist.svg'); +} + +.backmenu +{ + background-image: url('iconsets/Colourful/arrow-left-double.svg'); + background-repeat: no-repeat; + background-size: contain; +} + +button.iconbutton { + height:2em; + width:2em; + background-size: contain; + background-position:center; + border: none !important; + opacity: 0.8; + background-color:transparent; +} + +button.iconbutton:hover { + opacity: 1; +} + +button.searchbutton { + background-image: url('iconsets/Colourful/system-search.svg'); +} + +button.rssbutton { + background-image: url('iconsets/Colourful/rss.svg'); +} + + diff --git a/www/rompr/iconsets/Colourful/tick.svg b/www/rompr/iconsets/Colourful/tick.svg new file mode 100644 index 0000000..d01a8b4 --- /dev/null +++ b/www/rompr/iconsets/Colourful/tick.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/www/rompr/iconsets/Colourful/toggle-closed.svg b/www/rompr/iconsets/Colourful/toggle-closed.svg new file mode 100644 index 0000000..df50770 --- /dev/null +++ b/www/rompr/iconsets/Colourful/toggle-closed.svg @@ -0,0 +1,237 @@ + + + + + + + + + + + + + hash + + action + computer + icons + buttons + + + + + Andy Fitzsimon + + + + + Andy Fitzsimon + + + + + Andy Fitzsimon + + + + image/svg+xml + + + en + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/toggle-open.svg b/www/rompr/iconsets/Colourful/toggle-open.svg new file mode 100644 index 0000000..059bb07 --- /dev/null +++ b/www/rompr/iconsets/Colourful/toggle-open.svg @@ -0,0 +1,237 @@ + + + + + + + + + + + + + hash + + action + computer + icons + buttons + + + + + Andy Fitzsimon + + + + + Andy Fitzsimon + + + + + Andy Fitzsimon + + + + image/svg+xml + + + en + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/togglebutton-new2-off.svg b/www/rompr/iconsets/Colourful/togglebutton-new2-off.svg new file mode 100644 index 0000000..6ac75d3 --- /dev/null +++ b/www/rompr/iconsets/Colourful/togglebutton-new2-off.svg @@ -0,0 +1,232 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Colourful/togglebutton-new2-on.svg b/www/rompr/iconsets/Colourful/togglebutton-new2-on.svg new file mode 100644 index 0000000..981529e --- /dev/null +++ b/www/rompr/iconsets/Colourful/togglebutton-new2-on.svg @@ -0,0 +1,362 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/twitter-logo.svg b/www/rompr/iconsets/Colourful/twitter-logo.svg new file mode 100644 index 0000000..46ef773 --- /dev/null +++ b/www/rompr/iconsets/Colourful/twitter-logo.svg @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/unlistened.svg b/www/rompr/iconsets/Colourful/unlistened.svg new file mode 100644 index 0000000..132ffb1 --- /dev/null +++ b/www/rompr/iconsets/Colourful/unlistened.svg @@ -0,0 +1,3 @@ + + +image/svg+xml diff --git a/www/rompr/iconsets/Colourful/vkontakte-logo.svg b/www/rompr/iconsets/Colourful/vkontakte-logo.svg new file mode 100644 index 0000000..4c058bb --- /dev/null +++ b/www/rompr/iconsets/Colourful/vkontakte-logo.svg @@ -0,0 +1,26 @@ + + + + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/volume.svg b/www/rompr/iconsets/Colourful/volume.svg new file mode 100644 index 0000000..aba68c4 --- /dev/null +++ b/www/rompr/iconsets/Colourful/volume.svg @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/wikipedia-logo.svg b/www/rompr/iconsets/Colourful/wikipedia-logo.svg new file mode 100644 index 0000000..906eff7 --- /dev/null +++ b/www/rompr/iconsets/Colourful/wikipedia-logo.svg @@ -0,0 +1,539 @@ + + + + + + image/svg+xml + + Wikipedia logo version 2 + + + + Wikipedia logo version 2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/wma-audio.svg b/www/rompr/iconsets/Colourful/wma-audio.svg new file mode 100644 index 0000000..ded344f --- /dev/null +++ b/www/rompr/iconsets/Colourful/wma-audio.svg @@ -0,0 +1,41 @@ + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/world-wide-web.svg b/www/rompr/iconsets/Colourful/world-wide-web.svg new file mode 100644 index 0000000..64edb96 --- /dev/null +++ b/www/rompr/iconsets/Colourful/world-wide-web.svg @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Colourful/youtube-logo.svg b/www/rompr/iconsets/Colourful/youtube-logo.svg new file mode 100644 index 0000000..1f553d4 --- /dev/null +++ b/www/rompr/iconsets/Colourful/youtube-logo.svg @@ -0,0 +1,3 @@ + + +image/svg+xml diff --git a/www/rompr/iconsets/Fiery/0stars.svg b/www/rompr/iconsets/Fiery/0stars.svg new file mode 100644 index 0000000..6f5915a --- /dev/null +++ b/www/rompr/iconsets/Fiery/0stars.svg @@ -0,0 +1,179 @@ + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/1stars.svg b/www/rompr/iconsets/Fiery/1stars.svg new file mode 100644 index 0000000..c21548e --- /dev/null +++ b/www/rompr/iconsets/Fiery/1stars.svg @@ -0,0 +1,181 @@ + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/2stars.svg b/www/rompr/iconsets/Fiery/2stars.svg new file mode 100644 index 0000000..49c35df --- /dev/null +++ b/www/rompr/iconsets/Fiery/2stars.svg @@ -0,0 +1,190 @@ + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/3stars.svg b/www/rompr/iconsets/Fiery/3stars.svg new file mode 100644 index 0000000..250eb30 --- /dev/null +++ b/www/rompr/iconsets/Fiery/3stars.svg @@ -0,0 +1,199 @@ + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/4stars.svg b/www/rompr/iconsets/Fiery/4stars.svg new file mode 100644 index 0000000..f75a775 --- /dev/null +++ b/www/rompr/iconsets/Fiery/4stars.svg @@ -0,0 +1,208 @@ + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/5stars.svg b/www/rompr/iconsets/Fiery/5stars.svg new file mode 100644 index 0000000..22c52d6 --- /dev/null +++ b/www/rompr/iconsets/Fiery/5stars.svg @@ -0,0 +1,217 @@ + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/aac-audio.svg b/www/rompr/iconsets/Fiery/aac-audio.svg new file mode 100644 index 0000000..aafe872 --- /dev/null +++ b/www/rompr/iconsets/Fiery/aac-audio.svg @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/add.svg b/www/rompr/iconsets/Fiery/add.svg new file mode 100644 index 0000000..662cbf3 --- /dev/null +++ b/www/rompr/iconsets/Fiery/add.svg @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/adjustments.css b/www/rompr/iconsets/Fiery/adjustments.css new file mode 100644 index 0000000..9b93f77 --- /dev/null +++ b/www/rompr/iconsets/Fiery/adjustments.css @@ -0,0 +1,230 @@ +#buttons +{ + padding-left:12px; + padding-right:12px; + padding-top:4px; + padding-bottom:6px; +} + +.controlbutton +{ + margin:0px; + padding:0px; + vertical-align:middle; + display:inline-block; + width:56px; + height:56px; +} + +.controlbutton-small +{ + margin:0px; + vertical-align:middle; + display:inline-block; + width:48px; + height:48px; +} + +@media screen and (min-height: 800px) and (max-height: 939px) { + .controlbutton { + width:64px; + height:64px; + } + #buttons { + padding-top:12px; + } + #playbackTime { + margin-top:2px; + font-size:12px; + line-height:14px; + height:14px; + } +} + +@media screen and (min-height: 940px) and (max-height: 1099px) and (min-width: 650px) { + .controlbutton { + width:84px; + height:84px; + } + + .controlbutton-small { + width:64px; + height:64px; + } + + .shiftleft + { + left:-12px; + position:relative; + z-index:250; + } + + .shiftleft2 + { + left:-26px; + position:relative; + } + + .shiftleft3 + { + position:relative; + left:-36px; + z-index:5; + } + + .shiftleft4 + { + position:relative; + left:-48px; + z-index:1; + margin-right:-36px; + } + +} + +@media screen and (min-height: 940px) and (max-height: 1099px) and (min-width: 650px) { + .controlbutton { + width:84px; + height:84px; + } + .controlbutton-small { + width:64px; + height:64px; + } + #buttons { + padding-top:16px; + padding-left:24px; + } + #playbackTime { + margin-top:4px; + font-size:14px; + line-height:16px; + height:16px; + } + .shiftleft + { + left:-12px; + position:relative; + z-index:250; + } + + .shiftleft2 + { + left:-24px; + position:relative; + } + + .shiftleft3 + { + position:relative; + left:-36px; + z-index:5; + } + + .shiftleft4 + { + position:relative; + left:-48px; + z-index:1; + margin-right:-36px; + } +} + +@media screen and (min-height: 1100px) and (min-width: 651px) and (max-width: 749px) { + .controlbutton { + width:84px; + height:84px; + } + .controlbutton-small { + width:64px; + height:64px; + } + #buttons { + padding-top:16px; + padding-left:24px; + } + #playbackTime { + margin-top:4px; + font-size:14px; + line-height:16px; + height:16px; + } + .shiftleft + { + left:-12px; + position:relative; + z-index:250; + } + + .shiftleft2 + { + left:-26px; + position:relative; + } + + .shiftleft3 + { + position:relative; + left:-36px; + z-index:5; + } + + .shiftleft4 + { + position:relative; + left:-48px; + z-index:1; + margin-right:-36px; + } +} + +@media screen and (min-height: 1100px) and (min-width: 720px) { + .controlbutton { + width:90px; + height:90px; + } + .controlbutton-small { + width:70px; + height:70px; + } + #buttons { + padding-top:12px; + padding-left:20px; + } + #progress { + margin-top:8px; + } + #playbackTime { + margin-top:12px; + font-size:16px; + line-height:18px; + height:18px; + } + .shiftleft + { + left:-10px; + position:relative; + z-index:250; + } + + .shiftleft2 + { + left:-22px; + position:relative; + } + + .shiftleft3 + { + position:relative; + left:-34px; + z-index:5; + } + + .shiftleft4 + { + position:relative; + left:-44px; + z-index:1; + margin-right:-36px; + } +} diff --git a/www/rompr/iconsets/Fiery/alarmclock_false.svg b/www/rompr/iconsets/Fiery/alarmclock_false.svg new file mode 100644 index 0000000..5226d33 --- /dev/null +++ b/www/rompr/iconsets/Fiery/alarmclock_false.svg @@ -0,0 +1,163 @@ + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/alarmclock_true.svg b/www/rompr/iconsets/Fiery/alarmclock_true.svg new file mode 100644 index 0000000..40cdca0 --- /dev/null +++ b/www/rompr/iconsets/Fiery/alarmclock_true.svg @@ -0,0 +1,163 @@ + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/allmusic-logo.svg b/www/rompr/iconsets/Fiery/allmusic-logo.svg new file mode 100644 index 0000000..9f3575a --- /dev/null +++ b/www/rompr/iconsets/Fiery/allmusic-logo.svg @@ -0,0 +1,517 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/arrow-decrease.svg b/www/rompr/iconsets/Fiery/arrow-decrease.svg new file mode 100644 index 0000000..eab5e6e --- /dev/null +++ b/www/rompr/iconsets/Fiery/arrow-decrease.svg @@ -0,0 +1,114 @@ + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/arrow-increase.svg b/www/rompr/iconsets/Fiery/arrow-increase.svg new file mode 100644 index 0000000..5104b7f --- /dev/null +++ b/www/rompr/iconsets/Fiery/arrow-increase.svg @@ -0,0 +1,114 @@ + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/arrow-left-double.svg b/www/rompr/iconsets/Fiery/arrow-left-double.svg new file mode 100644 index 0000000..235e950 --- /dev/null +++ b/www/rompr/iconsets/Fiery/arrow-left-double.svg @@ -0,0 +1,139 @@ + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/arrow-right-double.svg b/www/rompr/iconsets/Fiery/arrow-right-double.svg new file mode 100644 index 0000000..23dd275 --- /dev/null +++ b/www/rompr/iconsets/Fiery/arrow-right-double.svg @@ -0,0 +1,143 @@ + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/arrow-updown.svg b/www/rompr/iconsets/Fiery/arrow-updown.svg new file mode 100644 index 0000000..852f8c4 --- /dev/null +++ b/www/rompr/iconsets/Fiery/arrow-updown.svg @@ -0,0 +1,128 @@ + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/artist-icon.svg b/www/rompr/iconsets/Fiery/artist-icon.svg new file mode 100644 index 0000000..9a8bea0 --- /dev/null +++ b/www/rompr/iconsets/Fiery/artist-icon.svg @@ -0,0 +1,136 @@ + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/audiobook.svg b/www/rompr/iconsets/Fiery/audiobook.svg new file mode 100644 index 0000000..bbf7fe5 --- /dev/null +++ b/www/rompr/iconsets/Fiery/audiobook.svg @@ -0,0 +1,254 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/backbutton.svg b/www/rompr/iconsets/Fiery/backbutton.svg new file mode 100644 index 0000000..3fb442f --- /dev/null +++ b/www/rompr/iconsets/Fiery/backbutton.svg @@ -0,0 +1,108 @@ + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/bbc-logo.svg b/www/rompr/iconsets/Fiery/bbc-logo.svg new file mode 100644 index 0000000..d6d0cf4 --- /dev/null +++ b/www/rompr/iconsets/Fiery/bbc-logo.svg @@ -0,0 +1,250 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/blobdown3-hi.svg b/www/rompr/iconsets/Fiery/blobdown3-hi.svg new file mode 100644 index 0000000..a47a37c --- /dev/null +++ b/www/rompr/iconsets/Fiery/blobdown3-hi.svg @@ -0,0 +1,102 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/blobdown3.svg b/www/rompr/iconsets/Fiery/blobdown3.svg new file mode 100644 index 0000000..e3e78cf --- /dev/null +++ b/www/rompr/iconsets/Fiery/blobdown3.svg @@ -0,0 +1,102 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/broadcast-new.svg b/www/rompr/iconsets/Fiery/broadcast-new.svg new file mode 100644 index 0000000..d92acaa --- /dev/null +++ b/www/rompr/iconsets/Fiery/broadcast-new.svg @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/calendar.svg b/www/rompr/iconsets/Fiery/calendar.svg new file mode 100644 index 0000000..40a6b52 --- /dev/null +++ b/www/rompr/iconsets/Fiery/calendar.svg @@ -0,0 +1,225 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/cd_case.svg b/www/rompr/iconsets/Fiery/cd_case.svg new file mode 100644 index 0000000..b61474f --- /dev/null +++ b/www/rompr/iconsets/Fiery/cd_case.svg @@ -0,0 +1,291 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/collection.svg b/www/rompr/iconsets/Fiery/collection.svg new file mode 100644 index 0000000..9b3dba0 --- /dev/null +++ b/www/rompr/iconsets/Fiery/collection.svg @@ -0,0 +1,267 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/compact-disc.svg b/www/rompr/iconsets/Fiery/compact-disc.svg new file mode 100644 index 0000000..ab5cdc8 --- /dev/null +++ b/www/rompr/iconsets/Fiery/compact-disc.svg @@ -0,0 +1,82 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Fiery/consume.svg b/www/rompr/iconsets/Fiery/consume.svg new file mode 100644 index 0000000..01d87c6 --- /dev/null +++ b/www/rompr/iconsets/Fiery/consume.svg @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/consume_off.svg b/www/rompr/iconsets/Fiery/consume_off.svg new file mode 100644 index 0000000..d26b2bb --- /dev/null +++ b/www/rompr/iconsets/Fiery/consume_off.svg @@ -0,0 +1,122 @@ + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/crossfade.svg b/www/rompr/iconsets/Fiery/crossfade.svg new file mode 100644 index 0000000..9828c74 --- /dev/null +++ b/www/rompr/iconsets/Fiery/crossfade.svg @@ -0,0 +1,143 @@ + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/crossfade_off.svg b/www/rompr/iconsets/Fiery/crossfade_off.svg new file mode 100644 index 0000000..836f2ba --- /dev/null +++ b/www/rompr/iconsets/Fiery/crossfade_off.svg @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/dialog-error.svg b/www/rompr/iconsets/Fiery/dialog-error.svg new file mode 100644 index 0000000..fbe26c0 --- /dev/null +++ b/www/rompr/iconsets/Fiery/dialog-error.svg @@ -0,0 +1,230 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/dialog-information.svg b/www/rompr/iconsets/Fiery/dialog-information.svg new file mode 100644 index 0000000..e3c04c3 --- /dev/null +++ b/www/rompr/iconsets/Fiery/dialog-information.svg @@ -0,0 +1,242 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/dirble-logo.svg b/www/rompr/iconsets/Fiery/dirble-logo.svg new file mode 100644 index 0000000..8a5c55f --- /dev/null +++ b/www/rompr/iconsets/Fiery/dirble-logo.svg @@ -0,0 +1,249 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/discogs-logo.svg b/www/rompr/iconsets/Fiery/discogs-logo.svg new file mode 100644 index 0000000..9f5a2f5 --- /dev/null +++ b/www/rompr/iconsets/Fiery/discogs-logo.svg @@ -0,0 +1,499 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/document-save.svg b/www/rompr/iconsets/Fiery/document-save.svg new file mode 100644 index 0000000..a393336 --- /dev/null +++ b/www/rompr/iconsets/Fiery/document-save.svg @@ -0,0 +1,278 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/download-icon.svg b/www/rompr/iconsets/Fiery/download-icon.svg new file mode 100644 index 0000000..a755c67 --- /dev/null +++ b/www/rompr/iconsets/Fiery/download-icon.svg @@ -0,0 +1,256 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/edit-clear-list.svg b/www/rompr/iconsets/Fiery/edit-clear-list.svg new file mode 100644 index 0000000..50e5880 --- /dev/null +++ b/www/rompr/iconsets/Fiery/edit-clear-list.svg @@ -0,0 +1,325 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/edit-delete.svg b/www/rompr/iconsets/Fiery/edit-delete.svg new file mode 100644 index 0000000..54cb914 --- /dev/null +++ b/www/rompr/iconsets/Fiery/edit-delete.svg @@ -0,0 +1,105 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/expand-up.svg b/www/rompr/iconsets/Fiery/expand-up.svg new file mode 100644 index 0000000..de37881 --- /dev/null +++ b/www/rompr/iconsets/Fiery/expand-up.svg @@ -0,0 +1,302 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/facebook-logo.svg b/www/rompr/iconsets/Fiery/facebook-logo.svg new file mode 100644 index 0000000..d3ce3d8 --- /dev/null +++ b/www/rompr/iconsets/Fiery/facebook-logo.svg @@ -0,0 +1,159 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/file.svg b/www/rompr/iconsets/Fiery/file.svg new file mode 100644 index 0000000..c3ff204 --- /dev/null +++ b/www/rompr/iconsets/Fiery/file.svg @@ -0,0 +1,260 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/flac-audio.svg b/www/rompr/iconsets/Fiery/flac-audio.svg new file mode 100644 index 0000000..3876d53 --- /dev/null +++ b/www/rompr/iconsets/Fiery/flac-audio.svg @@ -0,0 +1,147 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/folder.svg b/www/rompr/iconsets/Fiery/folder.svg new file mode 100644 index 0000000..7348cd7 --- /dev/null +++ b/www/rompr/iconsets/Fiery/folder.svg @@ -0,0 +1,752 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/forwardbutton.svg b/www/rompr/iconsets/Fiery/forwardbutton.svg new file mode 100644 index 0000000..584dda9 --- /dev/null +++ b/www/rompr/iconsets/Fiery/forwardbutton.svg @@ -0,0 +1,127 @@ + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/gmusic-logo.svg b/www/rompr/iconsets/Fiery/gmusic-logo.svg new file mode 100644 index 0000000..20b42aa --- /dev/null +++ b/www/rompr/iconsets/Fiery/gmusic-logo.svg @@ -0,0 +1,192 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/headphones.svg b/www/rompr/iconsets/Fiery/headphones.svg new file mode 100644 index 0000000..14ae274 --- /dev/null +++ b/www/rompr/iconsets/Fiery/headphones.svg @@ -0,0 +1,709 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/icon-new.svg b/www/rompr/iconsets/Fiery/icon-new.svg new file mode 100644 index 0000000..35b2475 --- /dev/null +++ b/www/rompr/iconsets/Fiery/icon-new.svg @@ -0,0 +1,707 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/imdb-logo.svg b/www/rompr/iconsets/Fiery/imdb-logo.svg new file mode 100644 index 0000000..d2c8221 --- /dev/null +++ b/www/rompr/iconsets/Fiery/imdb-logo.svg @@ -0,0 +1,512 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/internetarchive-logo.svg b/www/rompr/iconsets/Fiery/internetarchive-logo.svg new file mode 100644 index 0000000..8850404 --- /dev/null +++ b/www/rompr/iconsets/Fiery/internetarchive-logo.svg @@ -0,0 +1,431 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/lastfm-ban.svg b/www/rompr/iconsets/Fiery/lastfm-ban.svg new file mode 100644 index 0000000..78e1498 --- /dev/null +++ b/www/rompr/iconsets/Fiery/lastfm-ban.svg @@ -0,0 +1,69 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Fiery/lastfm-love.svg b/www/rompr/iconsets/Fiery/lastfm-love.svg new file mode 100644 index 0000000..7d77930 --- /dev/null +++ b/www/rompr/iconsets/Fiery/lastfm-love.svg @@ -0,0 +1,704 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/lastfm-unlove.svg b/www/rompr/iconsets/Fiery/lastfm-unlove.svg new file mode 100644 index 0000000..c4bfffc --- /dev/null +++ b/www/rompr/iconsets/Fiery/lastfm-unlove.svg @@ -0,0 +1,694 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/lastfm.svg b/www/rompr/iconsets/Fiery/lastfm.svg new file mode 100644 index 0000000..a745d46 --- /dev/null +++ b/www/rompr/iconsets/Fiery/lastfm.svg @@ -0,0 +1,210 @@ + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/lyrics.svg b/www/rompr/iconsets/Fiery/lyrics.svg new file mode 100644 index 0000000..7eb6e24 --- /dev/null +++ b/www/rompr/iconsets/Fiery/lyrics.svg @@ -0,0 +1,694 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/media-playback-pause-highlight.svg b/www/rompr/iconsets/Fiery/media-playback-pause-highlight.svg new file mode 100644 index 0000000..0254689 --- /dev/null +++ b/www/rompr/iconsets/Fiery/media-playback-pause-highlight.svg @@ -0,0 +1,127 @@ + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/media-playback-pause.svg b/www/rompr/iconsets/Fiery/media-playback-pause.svg new file mode 100644 index 0000000..bd9b6bd --- /dev/null +++ b/www/rompr/iconsets/Fiery/media-playback-pause.svg @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/media-playback-start-highlight.svg b/www/rompr/iconsets/Fiery/media-playback-start-highlight.svg new file mode 100644 index 0000000..f9b417d --- /dev/null +++ b/www/rompr/iconsets/Fiery/media-playback-start-highlight.svg @@ -0,0 +1,132 @@ + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/media-playback-start.svg b/www/rompr/iconsets/Fiery/media-playback-start.svg new file mode 100644 index 0000000..6c6f0eb --- /dev/null +++ b/www/rompr/iconsets/Fiery/media-playback-start.svg @@ -0,0 +1,131 @@ + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/media-playback-stop-highlight.svg b/www/rompr/iconsets/Fiery/media-playback-stop-highlight.svg new file mode 100644 index 0000000..143b8ac --- /dev/null +++ b/www/rompr/iconsets/Fiery/media-playback-stop-highlight.svg @@ -0,0 +1,116 @@ + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/media-playback-stop.svg b/www/rompr/iconsets/Fiery/media-playback-stop.svg new file mode 100644 index 0000000..2674a72 --- /dev/null +++ b/www/rompr/iconsets/Fiery/media-playback-stop.svg @@ -0,0 +1,99 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/media-skip-backward-highlight.svg b/www/rompr/iconsets/Fiery/media-skip-backward-highlight.svg new file mode 100644 index 0000000..4025d9d --- /dev/null +++ b/www/rompr/iconsets/Fiery/media-skip-backward-highlight.svg @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/media-skip-backward.svg b/www/rompr/iconsets/Fiery/media-skip-backward.svg new file mode 100644 index 0000000..6114ee5 --- /dev/null +++ b/www/rompr/iconsets/Fiery/media-skip-backward.svg @@ -0,0 +1,102 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/media-skip-forward-highlight.svg b/www/rompr/iconsets/Fiery/media-skip-forward-highlight.svg new file mode 100644 index 0000000..7f6b22b --- /dev/null +++ b/www/rompr/iconsets/Fiery/media-skip-forward-highlight.svg @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/media-skip-forward.svg b/www/rompr/iconsets/Fiery/media-skip-forward.svg new file mode 100644 index 0000000..4b9046f --- /dev/null +++ b/www/rompr/iconsets/Fiery/media-skip-forward.svg @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/movie-1.svg b/www/rompr/iconsets/Fiery/movie-1.svg new file mode 100644 index 0000000..91fba3b --- /dev/null +++ b/www/rompr/iconsets/Fiery/movie-1.svg @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/mp3-audio.svg b/www/rompr/iconsets/Fiery/mp3-audio.svg new file mode 100644 index 0000000..c76cdff --- /dev/null +++ b/www/rompr/iconsets/Fiery/mp3-audio.svg @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/musicbrainz_logo.svg b/www/rompr/iconsets/Fiery/musicbrainz_logo.svg new file mode 100644 index 0000000..8b87be5 --- /dev/null +++ b/www/rompr/iconsets/Fiery/musicbrainz_logo.svg @@ -0,0 +1,272 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/neverheard.svg b/www/rompr/iconsets/Fiery/neverheard.svg new file mode 100644 index 0000000..880ade3 --- /dev/null +++ b/www/rompr/iconsets/Fiery/neverheard.svg @@ -0,0 +1,109 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/ogg-audio.svg b/www/rompr/iconsets/Fiery/ogg-audio.svg new file mode 100644 index 0000000..4459243 --- /dev/null +++ b/www/rompr/iconsets/Fiery/ogg-audio.svg @@ -0,0 +1,118 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/output.svg b/www/rompr/iconsets/Fiery/output.svg new file mode 100644 index 0000000..50e9a72 --- /dev/null +++ b/www/rompr/iconsets/Fiery/output.svg @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/output_mute.svg b/www/rompr/iconsets/Fiery/output_mute.svg new file mode 100644 index 0000000..99dad51 --- /dev/null +++ b/www/rompr/iconsets/Fiery/output_mute.svg @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/parental-advisory.svg b/www/rompr/iconsets/Fiery/parental-advisory.svg new file mode 100644 index 0000000..3091dbb --- /dev/null +++ b/www/rompr/iconsets/Fiery/parental-advisory.svg @@ -0,0 +1,498 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/playlist.svg b/www/rompr/iconsets/Fiery/playlist.svg new file mode 100644 index 0000000..ee2ed7e --- /dev/null +++ b/www/rompr/iconsets/Fiery/playlist.svg @@ -0,0 +1,174 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/podcast-logo.svg b/www/rompr/iconsets/Fiery/podcast-logo.svg new file mode 100644 index 0000000..80727b0 --- /dev/null +++ b/www/rompr/iconsets/Fiery/podcast-logo.svg @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/preferences.svg b/www/rompr/iconsets/Fiery/preferences.svg new file mode 100644 index 0000000..bc275d7 --- /dev/null +++ b/www/rompr/iconsets/Fiery/preferences.svg @@ -0,0 +1,166 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/pushbutton.svg b/www/rompr/iconsets/Fiery/pushbutton.svg new file mode 100644 index 0000000..c32e97f --- /dev/null +++ b/www/rompr/iconsets/Fiery/pushbutton.svg @@ -0,0 +1,131 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/ratandtag.svg b/www/rompr/iconsets/Fiery/ratandtag.svg new file mode 100644 index 0000000..f3b4ca5 --- /dev/null +++ b/www/rompr/iconsets/Fiery/ratandtag.svg @@ -0,0 +1,127 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/ratortag.svg b/www/rompr/iconsets/Fiery/ratortag.svg new file mode 100644 index 0000000..173fd5f --- /dev/null +++ b/www/rompr/iconsets/Fiery/ratortag.svg @@ -0,0 +1,140 @@ + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/refresh.svg b/www/rompr/iconsets/Fiery/refresh.svg new file mode 100644 index 0000000..6947d66 --- /dev/null +++ b/www/rompr/iconsets/Fiery/refresh.svg @@ -0,0 +1,109 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/refresh_off.svg b/www/rompr/iconsets/Fiery/refresh_off.svg new file mode 100644 index 0000000..d1bb2a5 --- /dev/null +++ b/www/rompr/iconsets/Fiery/refresh_off.svg @@ -0,0 +1,109 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/resize.svg b/www/rompr/iconsets/Fiery/resize.svg new file mode 100644 index 0000000..d1b059c --- /dev/null +++ b/www/rompr/iconsets/Fiery/resize.svg @@ -0,0 +1,69 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Fiery/rss.svg b/www/rompr/iconsets/Fiery/rss.svg new file mode 100644 index 0000000..4da0bec --- /dev/null +++ b/www/rompr/iconsets/Fiery/rss.svg @@ -0,0 +1,189 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/shuffle.svg b/www/rompr/iconsets/Fiery/shuffle.svg new file mode 100644 index 0000000..5827866 --- /dev/null +++ b/www/rompr/iconsets/Fiery/shuffle.svg @@ -0,0 +1,154 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/shuffle_off.svg b/www/rompr/iconsets/Fiery/shuffle_off.svg new file mode 100644 index 0000000..0e94eba --- /dev/null +++ b/www/rompr/iconsets/Fiery/shuffle_off.svg @@ -0,0 +1,154 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/singlestar.svg b/www/rompr/iconsets/Fiery/singlestar.svg new file mode 100644 index 0000000..0597d1f --- /dev/null +++ b/www/rompr/iconsets/Fiery/singlestar.svg @@ -0,0 +1,389 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/sleep.svg b/www/rompr/iconsets/Fiery/sleep.svg new file mode 100644 index 0000000..8dcaeec --- /dev/null +++ b/www/rompr/iconsets/Fiery/sleep.svg @@ -0,0 +1,134 @@ + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/sliders.svg b/www/rompr/iconsets/Fiery/sliders.svg new file mode 100644 index 0000000..7d8cbca --- /dev/null +++ b/www/rompr/iconsets/Fiery/sliders.svg @@ -0,0 +1,125 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/smartradio.svg b/www/rompr/iconsets/Fiery/smartradio.svg new file mode 100644 index 0000000..531b8de --- /dev/null +++ b/www/rompr/iconsets/Fiery/smartradio.svg @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/soundcloud-logo.svg b/www/rompr/iconsets/Fiery/soundcloud-logo.svg new file mode 100644 index 0000000..3d43691 --- /dev/null +++ b/www/rompr/iconsets/Fiery/soundcloud-logo.svg @@ -0,0 +1,106 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Fiery/spinner.svg b/www/rompr/iconsets/Fiery/spinner.svg new file mode 100644 index 0000000..78b41cd --- /dev/null +++ b/www/rompr/iconsets/Fiery/spinner.svg @@ -0,0 +1,504 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/spotify-logo.svg b/www/rompr/iconsets/Fiery/spotify-logo.svg new file mode 100644 index 0000000..eb6c482 --- /dev/null +++ b/www/rompr/iconsets/Fiery/spotify-logo.svg @@ -0,0 +1,224 @@ + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/stopafter-highlight.svg b/www/rompr/iconsets/Fiery/stopafter-highlight.svg new file mode 100644 index 0000000..23e203d --- /dev/null +++ b/www/rompr/iconsets/Fiery/stopafter-highlight.svg @@ -0,0 +1,125 @@ + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/stopafter.svg b/www/rompr/iconsets/Fiery/stopafter.svg new file mode 100644 index 0000000..5dd6ced --- /dev/null +++ b/www/rompr/iconsets/Fiery/stopafter.svg @@ -0,0 +1,103 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/system-search.svg b/www/rompr/iconsets/Fiery/system-search.svg new file mode 100644 index 0000000..3528fe2 --- /dev/null +++ b/www/rompr/iconsets/Fiery/system-search.svg @@ -0,0 +1,105 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/tag.svg b/www/rompr/iconsets/Fiery/tag.svg new file mode 100644 index 0000000..70f7210 --- /dev/null +++ b/www/rompr/iconsets/Fiery/tag.svg @@ -0,0 +1,388 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/theme.css b/www/rompr/iconsets/Fiery/theme.css new file mode 100644 index 0000000..90f955b --- /dev/null +++ b/www/rompr/iconsets/Fiery/theme.css @@ -0,0 +1,249 @@ + + [class^="icon-"], [class*=" icon-"] { + background-size:contain; + background-position: center; + background-repeat:no-repeat; + display:inline-block; +} + +[class^="icon-"]:not(.button-disabled):hover, [class*=" icon-"]:not(.button-disabled):hover { + opacity: 1; + background-color: rgba(255,173,0,0.07); +} + +.clearbox { + background-image: url('iconsets/Fiery/edit-delete.svg'); + /* dont change the 50%, it ties in with makeHoverWork, makeClearWork, and makeTagMenu */ + background-size: auto 50%; + background-position: right 2px center; + background-repeat: no-repeat; +} + +.combobox-entry, .selectholder { + background-image: url('iconsets/Fiery/blobdown3.svg'); + /* dont change the 50%, it ties in with makeHoverWork, makeClearWork, and makeTagMenu */ + background-size: auto 50%; + background-position: right 2px center; + background-repeat: no-repeat; +} + +.combobox-entry:hover, .selectholder:hover { + background-image: url('iconsets/Fiery/blobdown3-hi.svg'); + /* dont change the 50%, it ties in with makeHoverWork, makeClearWork, and makeTagMenu */ + background-size: auto 50%; + background-position: right 2px center; + background-repeat: no-repeat; +} + +.combo-button { + background-image: url('iconsets/Fiery/blobdown3.svg'); +} + +.button-disabled { opacity: 0.1 } + +.icon-play-circled { background-image :url('iconsets/Fiery/media-playback-start.svg') } +.playdiv { background-image :url('iconsets/Fiery/media-playback-start.svg') } +.icon-play-circled:hover { background-image :url('iconsets/Fiery/media-playback-start-highlight.svg') } +.icon-pause-circled { background-image :url('iconsets/Fiery/media-playback-pause.svg') } +.icon-pause-circled:hover { background-image :url('iconsets/Fiery/media-playback-pause-highlight.svg') } +.icon-fast-backward { background-image :url('iconsets/Fiery/media-skip-backward.svg') } +.icon-fast-backward:hover { background-image :url('iconsets/Fiery/media-skip-backward-highlight.svg') } +.icon-fast-forward { background-image :url('iconsets/Fiery/media-skip-forward.svg') } +.icon-fast-forward:hover { background-image :url('iconsets/Fiery/media-skip-forward-highlight.svg') } +.icon-stop-1 { background-image :url('iconsets/Fiery/media-playback-stop.svg') } +.icon-stop-1:hover { background-image :url('iconsets/Fiery/media-playback-stop-highlight.svg') } +.icon-to-end-1 { background-image :url('iconsets/Fiery/stopafter.svg') } +.icon-to-end-1:hover { background-image :url('iconsets/Fiery/stopafter-highlight.svg') } + +.icon-music { background-image: url('iconsets/Fiery/collection.svg') } +.icon-search { background-image: url('iconsets/Fiery/system-search.svg') } +.icon-folder-open-empty { background-image: url('iconsets/Fiery/folder.svg') } +.icon-radio-tower { background-image: url('iconsets/Fiery/broadcast-new.svg') } +.icon-cd { background-image: url('iconsets/Fiery/cd_case.svg') } +.icon-resize-horizontal { background-image: url('iconsets/Fiery/resize.svg') } +.icon-angle-double-left { background-image:url('iconsets/Fiery/arrow-left-double.svg') } +.icon-angle-double-right { background-image:url('iconsets/Fiery/arrow-right-double.svg') } +.icon-menu { background-image: url('iconsets/Fiery/pushbutton.svg') } +.icon-versions { background-image: url('iconsets/Fiery/history.svg') } +.icon-left-circled { background-image: url('iconsets/Fiery/backbutton.svg') } +.icon-right-circled { background-image: url('iconsets/Fiery/forwardbutton.svg') } +.icon-cog-alt { background-image: url('iconsets/Fiery/preferences.svg') } +.icon-trash { background-image: url('iconsets/Fiery/edit-clear-list.svg') } +.icon-wifi { background-image: url('iconsets/Fiery/smartradio.svg') } +.icon-doc-text { background-image: url('iconsets/Fiery/playlist.svg') } +.icon-floppy { background-image: url('iconsets/Fiery/document-save.svg') } +.icon-cancel-circled { background-image: url('iconsets/Fiery/edit-delete.svg') } +.icon-plus { + background-image: url('iconsets/Fiery/add.svg'); + opacity:0.7; +} +.icon-alarm { background-image: url('iconsets/Fiery/alarmclock_false.svg') } +.icon-alarm-on { background-image: url('iconsets/Fiery/alarmclock_true.svg') } +.icon-sleep { background-image: url('iconsets/Fiery/sleep.svg') } +.icon-library { background-image: url('iconsets/Fiery/file.svg') } +.icon-lastfm-1 { background-image: url('iconsets/Fiery/lastfm.svg') } +.icon-wikipedia { background-image: url('iconsets/Fiery/wikipedia-logo.svg') } +.icon-musicbrainz { background-image: url('iconsets/Fiery/musicbrainz_logo.svg') } +.icon-discogs { background-image: url('iconsets/Fiery/discogs-logo.svg') } +.icon-doc-text-1 { background-image: url('iconsets/Fiery/lyrics.svg') } +.icon-soundcloud-circled { background-image: url('iconsets/Fiery/soundcloud-logo.svg') } +.icon-youtube-circled { background-image: url('iconsets/Fiery/youtube-logo.svg') } +.icon-gmusic-circled { background-image: url('iconsets/Fiery/gmusic-logo.svg') } +.icon-spotify-circled { background-image: url('iconsets/Fiery/spotify-logo.svg') } +.icon-vkontakte-circled { background-image: url('iconsets/Fiery/vkontakte-logo.svg') } +.icon-podcast-circled { background-image: url('iconsets/Fiery/podcast-logo.svg') } +.icon-audiobook { background-image: url('iconsets/Fiery/audiobook.svg') } +.icon-internetarchive-circled { background-image: url('iconsets/Fiery/internetarchive-logo.svg') } +.icon-increase { background-image: url('iconsets/Fiery/arrow-increase.svg') } +.icon-decrease { background-image: url('iconsets/Fiery/arrow-decrease.svg') } +.icon-attention-1 { background-image: url('iconsets/Fiery/dialog-error.svg') } +.icon-info-circled { background-image: url('iconsets/Fiery/dialog-information.svg') } +.icon-download { background-image: url('iconsets/Fiery/download-icon.svg') } +.icon-sun { background-image: url('iconsets/Fiery/icon-new.svg') } +.icon-headphones { background-image: url('iconsets/Fiery/headphones.svg') } +.icon-unlistened { background-image: url('iconsets/Fiery/headphones.svg') } +.icon-block { background-image: url('iconsets/Fiery/lastfm-ban.svg') } +.icon-heart { background-image: url('iconsets/Fiery/lastfm-love.svg') } +.icon-heart-broken { background-image: url('iconsets/Fiery/lastfm-unlove.svg') } +.icon-refresh { background-image: url('iconsets/Fiery/refresh.svg') } +.icon-dirble-circled { background-image: url('iconsets/Fiery/dirble-logo.svg') } +.icon-tunein { background-image: url('iconsets/Fiery/../../newimages/tunein-logo.svg') } +.icon-no-response-playbutton { background-image :url('iconsets/Fiery/media-playback-start.svg') } +.icon-tags { background-image: url('iconsets/Fiery/tag.svg') } +.icon-volume-up { background-image: url('iconsets/Fiery/volume.svg') } +.icon-toggle-open { background-image: url('iconsets/Fiery/toggle-open.svg') } +.icon-toggle-closed { background-image: url('iconsets/Fiery/toggle-closed.svg') } +.icon-spin6 { background-image: url('iconsets/Fiery/spinner.svg') } +.icon-output { background-image: url('iconsets/Fiery/output.svg') } +.icon-output-mute { background-image: url('iconsets/Fiery/output_mute.svg') } +.icon-sliders { background-image: url('iconsets/Fiery/sliders.svg') } +.icon-0-stars { background-image: url('iconsets/Fiery/0stars.svg') } +.icon-1-stars { background-image: url('iconsets/Fiery/1stars.svg') } +.icon-2-stars { background-image: url('iconsets/Fiery/2stars.svg') } +.icon-3-stars { background-image: url('iconsets/Fiery/3stars.svg') } +.icon-4-stars { background-image: url('iconsets/Fiery/4stars.svg') } +.icon-5-stars { background-image: url('iconsets/Fiery/5stars.svg') } +.icon-single-star { background-image: url('iconsets/Fiery/singlestar.svg') } +.icon-ratandtag { background-image: url('iconsets/Fiery/ratandtag.svg') } +.icon-ratortag { background-image: url('iconsets/Fiery/ratortag.svg') } +.icon-toggle-on { background-image: url('iconsets/Fiery/togglebutton-new2-on.svg') } +.icon-toggle-off { background-image: url('iconsets/Fiery/togglebutton-new2-off.svg') } + +.icon-random.flow-on { background-image: url('iconsets/Fiery/shuffle.svg') } +.icon-random.flow-off { background-image: url('iconsets/Fiery/shuffle_off.svg') } +.icon-crossfade.flow-on { background-image: url('iconsets/Fiery/crossfade.svg') } +.icon-crossfade.flow-off { background-image: url('iconsets/Fiery/crossfade_off.svg') } +.icon-repeat.flow-on { background-image: url('iconsets/Fiery/refresh.svg') } +.icon-repeat.flow-off { background-image: url('iconsets/Fiery/refresh_off.svg') } +.icon-consume.flow-on { background-image: url('iconsets/Fiery/consume.svg') } +.icon-consume.flow-off { background-image: url('iconsets/Fiery/consume_off.svg') } + +.icon-allrandom { background-image: url('iconsets/Fiery/shuffle.svg') } +.icon-neverplayed { background-image: url('iconsets/Fiery/neverheard.svg') } +.icon-recentlyplayed { background-image: url('iconsets/Fiery/calendar.svg') } +.icon-artist { background-image: url('iconsets/Fiery/artist-icon.svg') } +.icon-mp3-audio { background-image: url('iconsets/Fiery/mp3-audio.svg') } +.icon-aac-audio { background-image: url('iconsets/Fiery/aac-audio.svg') } +.icon-flac-audio { background-image: url('iconsets/Fiery/flac-audio.svg') } +.icon-wma-audio { background-image: url('iconsets/Fiery/wma-audio.svg') } +.icon-ogg-audio { background-image: url('iconsets/Fiery/ogg-audio.svg') } +.icon-explicit { background-image: url('iconsets/Fiery/parental-advisory.svg') } +.icon-expand-up { background-image: url('iconsets/Fiery/expand-up.svg') } +.icon-rss { background-image: url('iconsets/Fiery/rss.svg') } +.icon-tick { background-image: url('iconsets/Fiery/tick.svg') } +.icon-video { background-image: url('iconsets/Fiery/movie-1.svg') } +.icon-bbc-logo { background-image: url('iconsets/Fiery/bbc-logo.svg') } +.icon-imdb-logo { background-image: url('iconsets/Fiery/imdb-logo.svg') } +.icon-facebook-logo { background-image: url('iconsets/Fiery/facebook-logo.svg') } +.icon-twitter-logo { background-image: url('iconsets/Fiery/twitter-logo.svg') } +.icon-www { background-image: url('iconsets/Fiery/world-wide-web.svg') } +.icon-allmusic { background-image: url('iconsets/Fiery/allmusic-logo.svg') } +.icon-updown { background-image: url('iconsets/Fiery/arrow-updown.svg') } +.icon-snapcast { background-image: url('iconsets/Fiery/../../newimages/snapcast.png') } + +.styledinputs label +{ + display:inline-block; + cursor:pointer; + position:relative; + padding-left:2em; + line-height:1.5em; +} + +.styledinputs input[type=radio] +{ + display:none; +} + +.styledinputs input[type=checkbox] +{ + display:none; +} + +.styledinputs label:before +{ + content:""; + display:inline-block; + width:1.5em; + height:1.5em; + position:absolute; + left:0; + background-image: url('iconsets/Fiery/togglebutton-new2-off.svg'); + background-size: auto 80%; + background-position: center; + background-repeat:no-repeat; +} + +.styledinputs input:checked + label:before +{ + background-image: url('iconsets/Fiery/togglebutton-new2-on.svg') !important; +} + +img.notexist,img.notfound +{ + background-image: url('iconsets/Fiery/compact-disc.svg'); + background-size:contain; + display:inline-block; + background-position: center; + background-repeat:no-repeat; +} + +img.stream.notfound, img.stream.notexist +{ + background-image: url('iconsets/Fiery/broadcast-new.svg'); +} + +img.plimage.notfound +{ + background-image: url('iconsets/Fiery/playlist.svg'); +} + +.backmenu +{ + background-image: url('iconsets/Fiery/arrow-left-double.svg'); + background-repeat: no-repeat; + background-size: contain; +} + +button.iconbutton { + height:2em; + width:2em; + background-size: contain; + background-position:center; + border: none !important; + opacity: 0.8; + background-color:transparent; +} + +button.iconbutton:hover { + opacity: 1; +} + +button.searchbutton { + background-image: url('iconsets/Fiery/system-search.svg'); +} + +button.rssbutton { + background-image: url('iconsets/Fiery/rss.svg'); +} + diff --git a/www/rompr/iconsets/Fiery/tick.svg b/www/rompr/iconsets/Fiery/tick.svg new file mode 100644 index 0000000..4694ba3 --- /dev/null +++ b/www/rompr/iconsets/Fiery/tick.svg @@ -0,0 +1,397 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/toggle-closed.svg b/www/rompr/iconsets/Fiery/toggle-closed.svg new file mode 100644 index 0000000..6c2ca76 --- /dev/null +++ b/www/rompr/iconsets/Fiery/toggle-closed.svg @@ -0,0 +1,436 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/toggle-open.svg b/www/rompr/iconsets/Fiery/toggle-open.svg new file mode 100644 index 0000000..5c14f5f --- /dev/null +++ b/www/rompr/iconsets/Fiery/toggle-open.svg @@ -0,0 +1,433 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/togglebutton-new2-off.svg b/www/rompr/iconsets/Fiery/togglebutton-new2-off.svg new file mode 100644 index 0000000..80084ca --- /dev/null +++ b/www/rompr/iconsets/Fiery/togglebutton-new2-off.svg @@ -0,0 +1,472 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/togglebutton-new2-on.svg b/www/rompr/iconsets/Fiery/togglebutton-new2-on.svg new file mode 100644 index 0000000..1dce916 --- /dev/null +++ b/www/rompr/iconsets/Fiery/togglebutton-new2-on.svg @@ -0,0 +1,579 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/twitter-logo.svg b/www/rompr/iconsets/Fiery/twitter-logo.svg new file mode 100644 index 0000000..11db3e9 --- /dev/null +++ b/www/rompr/iconsets/Fiery/twitter-logo.svg @@ -0,0 +1,446 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/unlistened.svg b/www/rompr/iconsets/Fiery/unlistened.svg new file mode 100644 index 0000000..e116da8 --- /dev/null +++ b/www/rompr/iconsets/Fiery/unlistened.svg @@ -0,0 +1,69 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Fiery/vkontakte-logo.svg b/www/rompr/iconsets/Fiery/vkontakte-logo.svg new file mode 100644 index 0000000..dd778aa --- /dev/null +++ b/www/rompr/iconsets/Fiery/vkontakte-logo.svg @@ -0,0 +1,489 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/volume.svg b/www/rompr/iconsets/Fiery/volume.svg new file mode 100644 index 0000000..47cd944 --- /dev/null +++ b/www/rompr/iconsets/Fiery/volume.svg @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/wikipedia-logo.svg b/www/rompr/iconsets/Fiery/wikipedia-logo.svg new file mode 100644 index 0000000..6a7cddd --- /dev/null +++ b/www/rompr/iconsets/Fiery/wikipedia-logo.svg @@ -0,0 +1,393 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/wma-audio.svg b/www/rompr/iconsets/Fiery/wma-audio.svg new file mode 100644 index 0000000..0221d3c --- /dev/null +++ b/www/rompr/iconsets/Fiery/wma-audio.svg @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Fiery/world-wide-web.svg b/www/rompr/iconsets/Fiery/world-wide-web.svg new file mode 100644 index 0000000..51f7df6 --- /dev/null +++ b/www/rompr/iconsets/Fiery/world-wide-web.svg @@ -0,0 +1,82 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Fiery/youtube-logo.svg b/www/rompr/iconsets/Fiery/youtube-logo.svg new file mode 100644 index 0000000..614a17e --- /dev/null +++ b/www/rompr/iconsets/Fiery/youtube-logo.svg @@ -0,0 +1,388 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/0stars.svg b/www/rompr/iconsets/Greydient/0stars.svg new file mode 100644 index 0000000..987d2c3 --- /dev/null +++ b/www/rompr/iconsets/Greydient/0stars.svg @@ -0,0 +1,179 @@ + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/1stars.svg b/www/rompr/iconsets/Greydient/1stars.svg new file mode 100644 index 0000000..f0a83b0 --- /dev/null +++ b/www/rompr/iconsets/Greydient/1stars.svg @@ -0,0 +1,181 @@ + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/2stars.svg b/www/rompr/iconsets/Greydient/2stars.svg new file mode 100644 index 0000000..2caf84b --- /dev/null +++ b/www/rompr/iconsets/Greydient/2stars.svg @@ -0,0 +1,190 @@ + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/3stars.svg b/www/rompr/iconsets/Greydient/3stars.svg new file mode 100644 index 0000000..95c291c --- /dev/null +++ b/www/rompr/iconsets/Greydient/3stars.svg @@ -0,0 +1,199 @@ + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/4stars.svg b/www/rompr/iconsets/Greydient/4stars.svg new file mode 100644 index 0000000..5e4d615 --- /dev/null +++ b/www/rompr/iconsets/Greydient/4stars.svg @@ -0,0 +1,208 @@ + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/5stars.svg b/www/rompr/iconsets/Greydient/5stars.svg new file mode 100644 index 0000000..e6015c6 --- /dev/null +++ b/www/rompr/iconsets/Greydient/5stars.svg @@ -0,0 +1,217 @@ + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/aac-audio.svg b/www/rompr/iconsets/Greydient/aac-audio.svg new file mode 100644 index 0000000..621559e --- /dev/null +++ b/www/rompr/iconsets/Greydient/aac-audio.svg @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/add.svg b/www/rompr/iconsets/Greydient/add.svg new file mode 100644 index 0000000..a3f9741 --- /dev/null +++ b/www/rompr/iconsets/Greydient/add.svg @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/adjustments.css b/www/rompr/iconsets/Greydient/adjustments.css new file mode 100644 index 0000000..9b93f77 --- /dev/null +++ b/www/rompr/iconsets/Greydient/adjustments.css @@ -0,0 +1,230 @@ +#buttons +{ + padding-left:12px; + padding-right:12px; + padding-top:4px; + padding-bottom:6px; +} + +.controlbutton +{ + margin:0px; + padding:0px; + vertical-align:middle; + display:inline-block; + width:56px; + height:56px; +} + +.controlbutton-small +{ + margin:0px; + vertical-align:middle; + display:inline-block; + width:48px; + height:48px; +} + +@media screen and (min-height: 800px) and (max-height: 939px) { + .controlbutton { + width:64px; + height:64px; + } + #buttons { + padding-top:12px; + } + #playbackTime { + margin-top:2px; + font-size:12px; + line-height:14px; + height:14px; + } +} + +@media screen and (min-height: 940px) and (max-height: 1099px) and (min-width: 650px) { + .controlbutton { + width:84px; + height:84px; + } + + .controlbutton-small { + width:64px; + height:64px; + } + + .shiftleft + { + left:-12px; + position:relative; + z-index:250; + } + + .shiftleft2 + { + left:-26px; + position:relative; + } + + .shiftleft3 + { + position:relative; + left:-36px; + z-index:5; + } + + .shiftleft4 + { + position:relative; + left:-48px; + z-index:1; + margin-right:-36px; + } + +} + +@media screen and (min-height: 940px) and (max-height: 1099px) and (min-width: 650px) { + .controlbutton { + width:84px; + height:84px; + } + .controlbutton-small { + width:64px; + height:64px; + } + #buttons { + padding-top:16px; + padding-left:24px; + } + #playbackTime { + margin-top:4px; + font-size:14px; + line-height:16px; + height:16px; + } + .shiftleft + { + left:-12px; + position:relative; + z-index:250; + } + + .shiftleft2 + { + left:-24px; + position:relative; + } + + .shiftleft3 + { + position:relative; + left:-36px; + z-index:5; + } + + .shiftleft4 + { + position:relative; + left:-48px; + z-index:1; + margin-right:-36px; + } +} + +@media screen and (min-height: 1100px) and (min-width: 651px) and (max-width: 749px) { + .controlbutton { + width:84px; + height:84px; + } + .controlbutton-small { + width:64px; + height:64px; + } + #buttons { + padding-top:16px; + padding-left:24px; + } + #playbackTime { + margin-top:4px; + font-size:14px; + line-height:16px; + height:16px; + } + .shiftleft + { + left:-12px; + position:relative; + z-index:250; + } + + .shiftleft2 + { + left:-26px; + position:relative; + } + + .shiftleft3 + { + position:relative; + left:-36px; + z-index:5; + } + + .shiftleft4 + { + position:relative; + left:-48px; + z-index:1; + margin-right:-36px; + } +} + +@media screen and (min-height: 1100px) and (min-width: 720px) { + .controlbutton { + width:90px; + height:90px; + } + .controlbutton-small { + width:70px; + height:70px; + } + #buttons { + padding-top:12px; + padding-left:20px; + } + #progress { + margin-top:8px; + } + #playbackTime { + margin-top:12px; + font-size:16px; + line-height:18px; + height:18px; + } + .shiftleft + { + left:-10px; + position:relative; + z-index:250; + } + + .shiftleft2 + { + left:-22px; + position:relative; + } + + .shiftleft3 + { + position:relative; + left:-34px; + z-index:5; + } + + .shiftleft4 + { + position:relative; + left:-44px; + z-index:1; + margin-right:-36px; + } +} diff --git a/www/rompr/iconsets/Greydient/alarmclock_false.svg b/www/rompr/iconsets/Greydient/alarmclock_false.svg new file mode 100644 index 0000000..7c91e53 --- /dev/null +++ b/www/rompr/iconsets/Greydient/alarmclock_false.svg @@ -0,0 +1,163 @@ + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/alarmclock_true.svg b/www/rompr/iconsets/Greydient/alarmclock_true.svg new file mode 100644 index 0000000..64a28f8 --- /dev/null +++ b/www/rompr/iconsets/Greydient/alarmclock_true.svg @@ -0,0 +1,163 @@ + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/allmusic-logo.svg b/www/rompr/iconsets/Greydient/allmusic-logo.svg new file mode 100644 index 0000000..126b63a --- /dev/null +++ b/www/rompr/iconsets/Greydient/allmusic-logo.svg @@ -0,0 +1,517 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/arrow-decrease.svg b/www/rompr/iconsets/Greydient/arrow-decrease.svg new file mode 100644 index 0000000..6686083 --- /dev/null +++ b/www/rompr/iconsets/Greydient/arrow-decrease.svg @@ -0,0 +1,114 @@ + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/arrow-increase.svg b/www/rompr/iconsets/Greydient/arrow-increase.svg new file mode 100644 index 0000000..9e1b54a --- /dev/null +++ b/www/rompr/iconsets/Greydient/arrow-increase.svg @@ -0,0 +1,114 @@ + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/arrow-left-double.svg b/www/rompr/iconsets/Greydient/arrow-left-double.svg new file mode 100644 index 0000000..0e8d36a --- /dev/null +++ b/www/rompr/iconsets/Greydient/arrow-left-double.svg @@ -0,0 +1,139 @@ + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/arrow-right-double.svg b/www/rompr/iconsets/Greydient/arrow-right-double.svg new file mode 100644 index 0000000..8da2b7f --- /dev/null +++ b/www/rompr/iconsets/Greydient/arrow-right-double.svg @@ -0,0 +1,143 @@ + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/arrow-updown.svg b/www/rompr/iconsets/Greydient/arrow-updown.svg new file mode 100644 index 0000000..1517536 --- /dev/null +++ b/www/rompr/iconsets/Greydient/arrow-updown.svg @@ -0,0 +1,128 @@ + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/artist-icon.svg b/www/rompr/iconsets/Greydient/artist-icon.svg new file mode 100644 index 0000000..00ee6d3 --- /dev/null +++ b/www/rompr/iconsets/Greydient/artist-icon.svg @@ -0,0 +1,136 @@ + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/audiobook.svg b/www/rompr/iconsets/Greydient/audiobook.svg new file mode 100644 index 0000000..3a880bc --- /dev/null +++ b/www/rompr/iconsets/Greydient/audiobook.svg @@ -0,0 +1,254 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/backbutton.svg b/www/rompr/iconsets/Greydient/backbutton.svg new file mode 100644 index 0000000..a2ef905 --- /dev/null +++ b/www/rompr/iconsets/Greydient/backbutton.svg @@ -0,0 +1,108 @@ + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/bbc-logo.svg b/www/rompr/iconsets/Greydient/bbc-logo.svg new file mode 100644 index 0000000..dcbd557 --- /dev/null +++ b/www/rompr/iconsets/Greydient/bbc-logo.svg @@ -0,0 +1,250 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/blobdown3-hi.svg b/www/rompr/iconsets/Greydient/blobdown3-hi.svg new file mode 100644 index 0000000..97492bb --- /dev/null +++ b/www/rompr/iconsets/Greydient/blobdown3-hi.svg @@ -0,0 +1,102 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/blobdown3.svg b/www/rompr/iconsets/Greydient/blobdown3.svg new file mode 100644 index 0000000..050a5b2 --- /dev/null +++ b/www/rompr/iconsets/Greydient/blobdown3.svg @@ -0,0 +1,102 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/broadcast-new.svg b/www/rompr/iconsets/Greydient/broadcast-new.svg new file mode 100644 index 0000000..de34851 --- /dev/null +++ b/www/rompr/iconsets/Greydient/broadcast-new.svg @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/calendar.svg b/www/rompr/iconsets/Greydient/calendar.svg new file mode 100644 index 0000000..6cc76d0 --- /dev/null +++ b/www/rompr/iconsets/Greydient/calendar.svg @@ -0,0 +1,225 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/cd_case.svg b/www/rompr/iconsets/Greydient/cd_case.svg new file mode 100644 index 0000000..a2378f7 --- /dev/null +++ b/www/rompr/iconsets/Greydient/cd_case.svg @@ -0,0 +1,291 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/collection.svg b/www/rompr/iconsets/Greydient/collection.svg new file mode 100644 index 0000000..4a2e93d --- /dev/null +++ b/www/rompr/iconsets/Greydient/collection.svg @@ -0,0 +1,267 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/compact-disc.svg b/www/rompr/iconsets/Greydient/compact-disc.svg new file mode 100644 index 0000000..ec70090 --- /dev/null +++ b/www/rompr/iconsets/Greydient/compact-disc.svg @@ -0,0 +1,82 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Greydient/consume.svg b/www/rompr/iconsets/Greydient/consume.svg new file mode 100644 index 0000000..a65cee2 --- /dev/null +++ b/www/rompr/iconsets/Greydient/consume.svg @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/consume_off.svg b/www/rompr/iconsets/Greydient/consume_off.svg new file mode 100644 index 0000000..3288c2d --- /dev/null +++ b/www/rompr/iconsets/Greydient/consume_off.svg @@ -0,0 +1,122 @@ + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/crossfade.svg b/www/rompr/iconsets/Greydient/crossfade.svg new file mode 100644 index 0000000..f325b41 --- /dev/null +++ b/www/rompr/iconsets/Greydient/crossfade.svg @@ -0,0 +1,143 @@ + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/crossfade_off.svg b/www/rompr/iconsets/Greydient/crossfade_off.svg new file mode 100644 index 0000000..3b79bd2 --- /dev/null +++ b/www/rompr/iconsets/Greydient/crossfade_off.svg @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/dialog-error.svg b/www/rompr/iconsets/Greydient/dialog-error.svg new file mode 100644 index 0000000..c58524b --- /dev/null +++ b/www/rompr/iconsets/Greydient/dialog-error.svg @@ -0,0 +1,230 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/dialog-information.svg b/www/rompr/iconsets/Greydient/dialog-information.svg new file mode 100644 index 0000000..42ed429 --- /dev/null +++ b/www/rompr/iconsets/Greydient/dialog-information.svg @@ -0,0 +1,242 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/dirble-logo.svg b/www/rompr/iconsets/Greydient/dirble-logo.svg new file mode 100644 index 0000000..fe09614 --- /dev/null +++ b/www/rompr/iconsets/Greydient/dirble-logo.svg @@ -0,0 +1,249 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/discogs-logo.svg b/www/rompr/iconsets/Greydient/discogs-logo.svg new file mode 100644 index 0000000..fb96fe4 --- /dev/null +++ b/www/rompr/iconsets/Greydient/discogs-logo.svg @@ -0,0 +1,499 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/document-save.svg b/www/rompr/iconsets/Greydient/document-save.svg new file mode 100644 index 0000000..13f689b --- /dev/null +++ b/www/rompr/iconsets/Greydient/document-save.svg @@ -0,0 +1,278 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/download-icon.svg b/www/rompr/iconsets/Greydient/download-icon.svg new file mode 100644 index 0000000..791af6f --- /dev/null +++ b/www/rompr/iconsets/Greydient/download-icon.svg @@ -0,0 +1,256 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/edit-clear-list.svg b/www/rompr/iconsets/Greydient/edit-clear-list.svg new file mode 100644 index 0000000..2a3ad43 --- /dev/null +++ b/www/rompr/iconsets/Greydient/edit-clear-list.svg @@ -0,0 +1,325 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/edit-delete.svg b/www/rompr/iconsets/Greydient/edit-delete.svg new file mode 100644 index 0000000..848b0e5 --- /dev/null +++ b/www/rompr/iconsets/Greydient/edit-delete.svg @@ -0,0 +1,105 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/expand-up.svg b/www/rompr/iconsets/Greydient/expand-up.svg new file mode 100644 index 0000000..d4333a1 --- /dev/null +++ b/www/rompr/iconsets/Greydient/expand-up.svg @@ -0,0 +1,302 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/facebook-logo.svg b/www/rompr/iconsets/Greydient/facebook-logo.svg new file mode 100644 index 0000000..99bb073 --- /dev/null +++ b/www/rompr/iconsets/Greydient/facebook-logo.svg @@ -0,0 +1,159 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/file.svg b/www/rompr/iconsets/Greydient/file.svg new file mode 100644 index 0000000..fad93a0 --- /dev/null +++ b/www/rompr/iconsets/Greydient/file.svg @@ -0,0 +1,260 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/flac-audio.svg b/www/rompr/iconsets/Greydient/flac-audio.svg new file mode 100644 index 0000000..0539ecb --- /dev/null +++ b/www/rompr/iconsets/Greydient/flac-audio.svg @@ -0,0 +1,147 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/folder.svg b/www/rompr/iconsets/Greydient/folder.svg new file mode 100644 index 0000000..8c584f1 --- /dev/null +++ b/www/rompr/iconsets/Greydient/folder.svg @@ -0,0 +1,752 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/forwardbutton.svg b/www/rompr/iconsets/Greydient/forwardbutton.svg new file mode 100644 index 0000000..d4f2656 --- /dev/null +++ b/www/rompr/iconsets/Greydient/forwardbutton.svg @@ -0,0 +1,127 @@ + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/gmusic-logo.svg b/www/rompr/iconsets/Greydient/gmusic-logo.svg new file mode 100644 index 0000000..d6d85b1 --- /dev/null +++ b/www/rompr/iconsets/Greydient/gmusic-logo.svg @@ -0,0 +1,192 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/headphones.svg b/www/rompr/iconsets/Greydient/headphones.svg new file mode 100644 index 0000000..a04a467 --- /dev/null +++ b/www/rompr/iconsets/Greydient/headphones.svg @@ -0,0 +1,709 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/icon-new.svg b/www/rompr/iconsets/Greydient/icon-new.svg new file mode 100644 index 0000000..eb6368c --- /dev/null +++ b/www/rompr/iconsets/Greydient/icon-new.svg @@ -0,0 +1,707 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/imdb-logo.svg b/www/rompr/iconsets/Greydient/imdb-logo.svg new file mode 100644 index 0000000..e3529c7 --- /dev/null +++ b/www/rompr/iconsets/Greydient/imdb-logo.svg @@ -0,0 +1,512 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/internetarchive-logo.svg b/www/rompr/iconsets/Greydient/internetarchive-logo.svg new file mode 100644 index 0000000..a4b0e02 --- /dev/null +++ b/www/rompr/iconsets/Greydient/internetarchive-logo.svg @@ -0,0 +1,431 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/lastfm-ban.svg b/www/rompr/iconsets/Greydient/lastfm-ban.svg new file mode 100644 index 0000000..e8051d7 --- /dev/null +++ b/www/rompr/iconsets/Greydient/lastfm-ban.svg @@ -0,0 +1,69 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Greydient/lastfm-love.svg b/www/rompr/iconsets/Greydient/lastfm-love.svg new file mode 100644 index 0000000..6ade422 --- /dev/null +++ b/www/rompr/iconsets/Greydient/lastfm-love.svg @@ -0,0 +1,704 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/lastfm-unlove.svg b/www/rompr/iconsets/Greydient/lastfm-unlove.svg new file mode 100644 index 0000000..b4656db --- /dev/null +++ b/www/rompr/iconsets/Greydient/lastfm-unlove.svg @@ -0,0 +1,694 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/lastfm.svg b/www/rompr/iconsets/Greydient/lastfm.svg new file mode 100644 index 0000000..57975ed --- /dev/null +++ b/www/rompr/iconsets/Greydient/lastfm.svg @@ -0,0 +1,210 @@ + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/lyrics.svg b/www/rompr/iconsets/Greydient/lyrics.svg new file mode 100644 index 0000000..590c5e3 --- /dev/null +++ b/www/rompr/iconsets/Greydient/lyrics.svg @@ -0,0 +1,694 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/media-playback-pause-highlight.svg b/www/rompr/iconsets/Greydient/media-playback-pause-highlight.svg new file mode 100644 index 0000000..50712e1 --- /dev/null +++ b/www/rompr/iconsets/Greydient/media-playback-pause-highlight.svg @@ -0,0 +1,127 @@ + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/media-playback-pause.svg b/www/rompr/iconsets/Greydient/media-playback-pause.svg new file mode 100644 index 0000000..9eef43f --- /dev/null +++ b/www/rompr/iconsets/Greydient/media-playback-pause.svg @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/media-playback-start-highlight.svg b/www/rompr/iconsets/Greydient/media-playback-start-highlight.svg new file mode 100644 index 0000000..7ce73a0 --- /dev/null +++ b/www/rompr/iconsets/Greydient/media-playback-start-highlight.svg @@ -0,0 +1,132 @@ + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/media-playback-start.svg b/www/rompr/iconsets/Greydient/media-playback-start.svg new file mode 100644 index 0000000..58c3619 --- /dev/null +++ b/www/rompr/iconsets/Greydient/media-playback-start.svg @@ -0,0 +1,131 @@ + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/media-playback-stop-highlight.svg b/www/rompr/iconsets/Greydient/media-playback-stop-highlight.svg new file mode 100644 index 0000000..5ae4a60 --- /dev/null +++ b/www/rompr/iconsets/Greydient/media-playback-stop-highlight.svg @@ -0,0 +1,116 @@ + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/media-playback-stop.svg b/www/rompr/iconsets/Greydient/media-playback-stop.svg new file mode 100644 index 0000000..b3e6d4a --- /dev/null +++ b/www/rompr/iconsets/Greydient/media-playback-stop.svg @@ -0,0 +1,99 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/media-skip-backward-highlight.svg b/www/rompr/iconsets/Greydient/media-skip-backward-highlight.svg new file mode 100644 index 0000000..907d5d6 --- /dev/null +++ b/www/rompr/iconsets/Greydient/media-skip-backward-highlight.svg @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/media-skip-backward.svg b/www/rompr/iconsets/Greydient/media-skip-backward.svg new file mode 100644 index 0000000..0c063b0 --- /dev/null +++ b/www/rompr/iconsets/Greydient/media-skip-backward.svg @@ -0,0 +1,102 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/media-skip-forward-highlight.svg b/www/rompr/iconsets/Greydient/media-skip-forward-highlight.svg new file mode 100644 index 0000000..26b1372 --- /dev/null +++ b/www/rompr/iconsets/Greydient/media-skip-forward-highlight.svg @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/media-skip-forward.svg b/www/rompr/iconsets/Greydient/media-skip-forward.svg new file mode 100644 index 0000000..0d49a29 --- /dev/null +++ b/www/rompr/iconsets/Greydient/media-skip-forward.svg @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/movie-1.svg b/www/rompr/iconsets/Greydient/movie-1.svg new file mode 100644 index 0000000..61591aa --- /dev/null +++ b/www/rompr/iconsets/Greydient/movie-1.svg @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/mp3-audio.svg b/www/rompr/iconsets/Greydient/mp3-audio.svg new file mode 100644 index 0000000..c1f0e31 --- /dev/null +++ b/www/rompr/iconsets/Greydient/mp3-audio.svg @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/musicbrainz_logo.svg b/www/rompr/iconsets/Greydient/musicbrainz_logo.svg new file mode 100644 index 0000000..05d26b2 --- /dev/null +++ b/www/rompr/iconsets/Greydient/musicbrainz_logo.svg @@ -0,0 +1,272 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/neverheard.svg b/www/rompr/iconsets/Greydient/neverheard.svg new file mode 100644 index 0000000..997a8c7 --- /dev/null +++ b/www/rompr/iconsets/Greydient/neverheard.svg @@ -0,0 +1,109 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/ogg-audio.svg b/www/rompr/iconsets/Greydient/ogg-audio.svg new file mode 100644 index 0000000..df42e99 --- /dev/null +++ b/www/rompr/iconsets/Greydient/ogg-audio.svg @@ -0,0 +1,118 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/output.svg b/www/rompr/iconsets/Greydient/output.svg new file mode 100644 index 0000000..61f229d --- /dev/null +++ b/www/rompr/iconsets/Greydient/output.svg @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/output_mute.svg b/www/rompr/iconsets/Greydient/output_mute.svg new file mode 100644 index 0000000..9aed072 --- /dev/null +++ b/www/rompr/iconsets/Greydient/output_mute.svg @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/parental-advisory.svg b/www/rompr/iconsets/Greydient/parental-advisory.svg new file mode 100644 index 0000000..4fb7a18 --- /dev/null +++ b/www/rompr/iconsets/Greydient/parental-advisory.svg @@ -0,0 +1,498 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/playlist.svg b/www/rompr/iconsets/Greydient/playlist.svg new file mode 100644 index 0000000..7b0eb33 --- /dev/null +++ b/www/rompr/iconsets/Greydient/playlist.svg @@ -0,0 +1,174 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/podcast-logo.svg b/www/rompr/iconsets/Greydient/podcast-logo.svg new file mode 100644 index 0000000..eb41de0 --- /dev/null +++ b/www/rompr/iconsets/Greydient/podcast-logo.svg @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/preferences.svg b/www/rompr/iconsets/Greydient/preferences.svg new file mode 100644 index 0000000..16ac42b --- /dev/null +++ b/www/rompr/iconsets/Greydient/preferences.svg @@ -0,0 +1,166 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/pushbutton.svg b/www/rompr/iconsets/Greydient/pushbutton.svg new file mode 100644 index 0000000..c53dc48 --- /dev/null +++ b/www/rompr/iconsets/Greydient/pushbutton.svg @@ -0,0 +1,131 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/ratandtag.svg b/www/rompr/iconsets/Greydient/ratandtag.svg new file mode 100644 index 0000000..1515065 --- /dev/null +++ b/www/rompr/iconsets/Greydient/ratandtag.svg @@ -0,0 +1,127 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/ratortag.svg b/www/rompr/iconsets/Greydient/ratortag.svg new file mode 100644 index 0000000..d04ec1a --- /dev/null +++ b/www/rompr/iconsets/Greydient/ratortag.svg @@ -0,0 +1,140 @@ + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/refresh.svg b/www/rompr/iconsets/Greydient/refresh.svg new file mode 100644 index 0000000..100e150 --- /dev/null +++ b/www/rompr/iconsets/Greydient/refresh.svg @@ -0,0 +1,109 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/refresh_off.svg b/www/rompr/iconsets/Greydient/refresh_off.svg new file mode 100644 index 0000000..5afb062 --- /dev/null +++ b/www/rompr/iconsets/Greydient/refresh_off.svg @@ -0,0 +1,109 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/resize.svg b/www/rompr/iconsets/Greydient/resize.svg new file mode 100644 index 0000000..62e3afa --- /dev/null +++ b/www/rompr/iconsets/Greydient/resize.svg @@ -0,0 +1,69 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Greydient/rss.svg b/www/rompr/iconsets/Greydient/rss.svg new file mode 100644 index 0000000..1bf766a --- /dev/null +++ b/www/rompr/iconsets/Greydient/rss.svg @@ -0,0 +1,189 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/shuffle.svg b/www/rompr/iconsets/Greydient/shuffle.svg new file mode 100644 index 0000000..1d03c2a --- /dev/null +++ b/www/rompr/iconsets/Greydient/shuffle.svg @@ -0,0 +1,154 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/shuffle_off.svg b/www/rompr/iconsets/Greydient/shuffle_off.svg new file mode 100644 index 0000000..664eb19 --- /dev/null +++ b/www/rompr/iconsets/Greydient/shuffle_off.svg @@ -0,0 +1,154 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/singlestar.svg b/www/rompr/iconsets/Greydient/singlestar.svg new file mode 100644 index 0000000..02a5700 --- /dev/null +++ b/www/rompr/iconsets/Greydient/singlestar.svg @@ -0,0 +1,389 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/sleep.svg b/www/rompr/iconsets/Greydient/sleep.svg new file mode 100644 index 0000000..c240881 --- /dev/null +++ b/www/rompr/iconsets/Greydient/sleep.svg @@ -0,0 +1,134 @@ + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/sliders.svg b/www/rompr/iconsets/Greydient/sliders.svg new file mode 100644 index 0000000..71b8d89 --- /dev/null +++ b/www/rompr/iconsets/Greydient/sliders.svg @@ -0,0 +1,125 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/smartradio.svg b/www/rompr/iconsets/Greydient/smartradio.svg new file mode 100644 index 0000000..dc4cbac --- /dev/null +++ b/www/rompr/iconsets/Greydient/smartradio.svg @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/soundcloud-logo.svg b/www/rompr/iconsets/Greydient/soundcloud-logo.svg new file mode 100644 index 0000000..539b452 --- /dev/null +++ b/www/rompr/iconsets/Greydient/soundcloud-logo.svg @@ -0,0 +1,106 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Greydient/spinner.svg b/www/rompr/iconsets/Greydient/spinner.svg new file mode 100644 index 0000000..70e7286 --- /dev/null +++ b/www/rompr/iconsets/Greydient/spinner.svg @@ -0,0 +1,504 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/spotify-logo.svg b/www/rompr/iconsets/Greydient/spotify-logo.svg new file mode 100644 index 0000000..f9be58d --- /dev/null +++ b/www/rompr/iconsets/Greydient/spotify-logo.svg @@ -0,0 +1,224 @@ + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/stopafter-highlight.svg b/www/rompr/iconsets/Greydient/stopafter-highlight.svg new file mode 100644 index 0000000..ff679a9 --- /dev/null +++ b/www/rompr/iconsets/Greydient/stopafter-highlight.svg @@ -0,0 +1,125 @@ + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/stopafter.svg b/www/rompr/iconsets/Greydient/stopafter.svg new file mode 100644 index 0000000..c6a53cd --- /dev/null +++ b/www/rompr/iconsets/Greydient/stopafter.svg @@ -0,0 +1,103 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/system-search.svg b/www/rompr/iconsets/Greydient/system-search.svg new file mode 100644 index 0000000..6146f3d --- /dev/null +++ b/www/rompr/iconsets/Greydient/system-search.svg @@ -0,0 +1,105 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/tag.svg b/www/rompr/iconsets/Greydient/tag.svg new file mode 100644 index 0000000..b28e348 --- /dev/null +++ b/www/rompr/iconsets/Greydient/tag.svg @@ -0,0 +1,388 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/theme.css b/www/rompr/iconsets/Greydient/theme.css new file mode 100644 index 0000000..fa004a8 --- /dev/null +++ b/www/rompr/iconsets/Greydient/theme.css @@ -0,0 +1,249 @@ + + [class^="icon-"], [class*=" icon-"] { + background-size:contain; + background-position: center; + background-repeat:no-repeat; + display:inline-block; +} + +[class^="icon-"]:not(.button-disabled):hover, [class*=" icon-"]:not(.button-disabled):hover { + opacity: 1; + background-color: rgba(255,173,0,0.07); +} + +.clearbox { + background-image: url('iconsets/Greydient/edit-delete.svg'); + /* dont change the 50%, it ties in with makeHoverWork, makeClearWork, and makeTagMenu */ + background-size: auto 50%; + background-position: right 2px center; + background-repeat: no-repeat; +} + +.combobox-entry, .selectholder { + background-image: url('iconsets/Greydient/blobdown3.svg'); + /* dont change the 50%, it ties in with makeHoverWork, makeClearWork, and makeTagMenu */ + background-size: auto 50%; + background-position: right 2px center; + background-repeat: no-repeat; +} + +.combobox-entry:hover, .selectholder:hover { + background-image: url('iconsets/Greydient/blobdown3-hi.svg'); + /* dont change the 50%, it ties in with makeHoverWork, makeClearWork, and makeTagMenu */ + background-size: auto 50%; + background-position: right 2px center; + background-repeat: no-repeat; +} + +.combo-button { + background-image: url('iconsets/Greydient/blobdown3.svg'); +} + +.button-disabled { opacity: 0.1 } + +.icon-play-circled { background-image :url('iconsets/Greydient/media-playback-start.svg') } +.playdiv { background-image :url('iconsets/Greydient/media-playback-start.svg') } +.icon-play-circled:hover { background-image :url('iconsets/Greydient/media-playback-start-highlight.svg') } +.icon-pause-circled { background-image :url('iconsets/Greydient/media-playback-pause.svg') } +.icon-pause-circled:hover { background-image :url('iconsets/Greydient/media-playback-pause-highlight.svg') } +.icon-fast-backward { background-image :url('iconsets/Greydient/media-skip-backward.svg') } +.icon-fast-backward:hover { background-image :url('iconsets/Greydient/media-skip-backward-highlight.svg') } +.icon-fast-forward { background-image :url('iconsets/Greydient/media-skip-forward.svg') } +.icon-fast-forward:hover { background-image :url('iconsets/Greydient/media-skip-forward-highlight.svg') } +.icon-stop-1 { background-image :url('iconsets/Greydient/media-playback-stop.svg') } +.icon-stop-1:hover { background-image :url('iconsets/Greydient/media-playback-stop-highlight.svg') } +.icon-to-end-1 { background-image :url('iconsets/Greydient/stopafter.svg') } +.icon-to-end-1:hover { background-image :url('iconsets/Greydient/stopafter-highlight.svg') } + +.icon-music { background-image: url('iconsets/Greydient/collection.svg') } +.icon-search { background-image: url('iconsets/Greydient/system-search.svg') } +.icon-folder-open-empty { background-image: url('iconsets/Greydient/folder.svg') } +.icon-radio-tower { background-image: url('iconsets/Greydient/broadcast-new.svg') } +.icon-cd { background-image: url('iconsets/Greydient/cd_case.svg') } +.icon-resize-horizontal { background-image: url('iconsets/Greydient/resize.svg') } +.icon-angle-double-left { background-image:url('iconsets/Greydient/arrow-left-double.svg') } +.icon-angle-double-right { background-image:url('iconsets/Greydient/arrow-right-double.svg') } +.icon-menu { background-image: url('iconsets/Greydient/pushbutton.svg') } +.icon-versions { background-image: url('iconsets/Greydient/history.svg') } +.icon-left-circled { background-image: url('iconsets/Greydient/backbutton.svg') } +.icon-right-circled { background-image: url('iconsets/Greydient/forwardbutton.svg') } +.icon-cog-alt { background-image: url('iconsets/Greydient/preferences.svg') } +.icon-trash { background-image: url('iconsets/Greydient/edit-clear-list.svg') } +.icon-wifi { background-image: url('iconsets/Greydient/smartradio.svg') } +.icon-doc-text { background-image: url('iconsets/Greydient/playlist.svg') } +.icon-floppy { background-image: url('iconsets/Greydient/document-save.svg') } +.icon-cancel-circled { background-image: url('iconsets/Greydient/edit-delete.svg') } +.icon-plus { + background-image: url('iconsets/Greydient/add.svg'); + opacity:0.7; +} +.icon-alarm { background-image: url('iconsets/Greydient/alarmclock_false.svg') } +.icon-alarm-on { background-image: url('iconsets/Greydient/alarmclock_true.svg') } +.icon-sleep { background-image: url('iconsets/Greydient/sleep.svg') } +.icon-library { background-image: url('iconsets/Greydient/file.svg') } +.icon-lastfm-1 { background-image: url('iconsets/Greydient/lastfm.svg') } +.icon-wikipedia { background-image: url('iconsets/Greydient/wikipedia-logo.svg') } +.icon-musicbrainz { background-image: url('iconsets/Greydient/musicbrainz_logo.svg') } +.icon-discogs { background-image: url('iconsets/Greydient/discogs-logo.svg') } +.icon-doc-text-1 { background-image: url('iconsets/Greydient/lyrics.svg') } +.icon-soundcloud-circled { background-image: url('iconsets/Greydient/soundcloud-logo.svg') } +.icon-youtube-circled { background-image: url('iconsets/Greydient/youtube-logo.svg') } +.icon-gmusic-circled { background-image: url('iconsets/Greydient/gmusic-logo.svg') } +.icon-spotify-circled { background-image: url('iconsets/Greydient/spotify-logo.svg') } +.icon-vkontakte-circled { background-image: url('iconsets/Greydient/vkontakte-logo.svg') } +.icon-podcast-circled { background-image: url('iconsets/Greydient/podcast-logo.svg') } +.icon-audiobook { background-image: url('iconsets/Greydient/audiobook.svg') } +.icon-internetarchive-circled { background-image: url('iconsets/Greydient/internetarchive-logo.svg') } +.icon-increase { background-image: url('iconsets/Greydient/arrow-increase.svg') } +.icon-decrease { background-image: url('iconsets/Greydient/arrow-decrease.svg') } +.icon-attention-1 { background-image: url('iconsets/Greydient/dialog-error.svg') } +.icon-info-circled { background-image: url('iconsets/Greydient/dialog-information.svg') } +.icon-download { background-image: url('iconsets/Greydient/download-icon.svg') } +.icon-sun { background-image: url('iconsets/Greydient/icon-new.svg') } +.icon-headphones { background-image: url('iconsets/Greydient/headphones.svg') } +.icon-unlistened { background-image: url('iconsets/Greydient/headphones.svg') } +.icon-block { background-image: url('iconsets/Greydient/lastfm-ban.svg') } +.icon-heart { background-image: url('iconsets/Greydient/lastfm-love.svg') } +.icon-heart-broken { background-image: url('iconsets/Greydient/lastfm-unlove.svg') } +.icon-refresh { background-image: url('iconsets/Greydient/refresh.svg') } +.icon-dirble-circled { background-image: url('iconsets/Greydient/dirble-logo.svg') } +.icon-tunein { background-image: url('iconsets/Greydient/../../newimages/tunein-logo.svg') } +.icon-no-response-playbutton { background-image :url('iconsets/Greydient/media-playback-start.svg') } +.icon-tags { background-image: url('iconsets/Greydient/tag.svg') } +.icon-volume-up { background-image: url('iconsets/Greydient/volume.svg') } +.icon-toggle-open { background-image: url('iconsets/Greydient/toggle-open.svg') } +.icon-toggle-closed { background-image: url('iconsets/Greydient/toggle-closed.svg') } +.icon-spin6 { background-image: url('iconsets/Greydient/spinner.svg') } +.icon-output { background-image: url('iconsets/Greydient/output.svg') } +.icon-output-mute { background-image: url('iconsets/Greydient/output_mute.svg') } +.icon-sliders { background-image: url('iconsets/Greydient/sliders.svg') } +.icon-0-stars { background-image: url('iconsets/Greydient/0stars.svg') } +.icon-1-stars { background-image: url('iconsets/Greydient/1stars.svg') } +.icon-2-stars { background-image: url('iconsets/Greydient/2stars.svg') } +.icon-3-stars { background-image: url('iconsets/Greydient/3stars.svg') } +.icon-4-stars { background-image: url('iconsets/Greydient/4stars.svg') } +.icon-5-stars { background-image: url('iconsets/Greydient/5stars.svg') } +.icon-single-star { background-image: url('iconsets/Greydient/singlestar.svg') } +.icon-ratandtag { background-image: url('iconsets/Greydient/ratandtag.svg') } +.icon-ratortag { background-image: url('iconsets/Greydient/ratortag.svg') } +.icon-toggle-on { background-image: url('iconsets/Greydient/togglebutton-new2-on.svg') } +.icon-toggle-off { background-image: url('iconsets/Greydient/togglebutton-new2-off.svg') } + +.icon-random.flow-on { background-image: url('iconsets/Greydient/shuffle.svg') } +.icon-random.flow-off { background-image: url('iconsets/Greydient/shuffle_off.svg') } +.icon-crossfade.flow-on { background-image: url('iconsets/Greydient/crossfade.svg') } +.icon-crossfade.flow-off { background-image: url('iconsets/Greydient/crossfade_off.svg') } +.icon-repeat.flow-on { background-image: url('iconsets/Greydient/refresh.svg') } +.icon-repeat.flow-off { background-image: url('iconsets/Greydient/refresh_off.svg') } +.icon-consume.flow-on { background-image: url('iconsets/Greydient/consume.svg') } +.icon-consume.flow-off { background-image: url('iconsets/Greydient/consume_off.svg') } + +.icon-allrandom { background-image: url('iconsets/Greydient/shuffle.svg') } +.icon-neverplayed { background-image: url('iconsets/Greydient/neverheard.svg') } +.icon-recentlyplayed { background-image: url('iconsets/Greydient/calendar.svg') } +.icon-artist { background-image: url('iconsets/Greydient/artist-icon.svg') } +.icon-mp3-audio { background-image: url('iconsets/Greydient/mp3-audio.svg') } +.icon-aac-audio { background-image: url('iconsets/Greydient/aac-audio.svg') } +.icon-flac-audio { background-image: url('iconsets/Greydient/flac-audio.svg') } +.icon-wma-audio { background-image: url('iconsets/Greydient/wma-audio.svg') } +.icon-ogg-audio { background-image: url('iconsets/Greydient/ogg-audio.svg') } +.icon-explicit { background-image: url('iconsets/Greydient/parental-advisory.svg') } +.icon-expand-up { background-image: url('iconsets/Greydient/expand-up.svg') } +.icon-rss { background-image: url('iconsets/Greydient/rss.svg') } +.icon-tick { background-image: url('iconsets/Greydient/tick.svg') } +.icon-video { background-image: url('iconsets/Greydient/movie-1.svg') } +.icon-bbc-logo { background-image: url('iconsets/Greydient/bbc-logo.svg') } +.icon-imdb-logo { background-image: url('iconsets/Greydient/imdb-logo.svg') } +.icon-facebook-logo { background-image: url('iconsets/Greydient/facebook-logo.svg') } +.icon-twitter-logo { background-image: url('iconsets/Greydient/twitter-logo.svg') } +.icon-www { background-image: url('iconsets/Greydient/world-wide-web.svg') } +.icon-allmusic { background-image: url('iconsets/Greydient/allmusic-logo.svg') } +.icon-updown { background-image: url('iconsets/Greydient/arrow-updown.svg') } +.icon-snapcast { background-image: url('iconsets/Greydient/../../newimages/snapcast.png') } + +.styledinputs label +{ + display:inline-block; + cursor:pointer; + position:relative; + padding-left:2em; + line-height:1.5em; +} + +.styledinputs input[type=radio] +{ + display:none; +} + +.styledinputs input[type=checkbox] +{ + display:none; +} + +.styledinputs label:before +{ + content:""; + display:inline-block; + width:1.5em; + height:1.5em; + position:absolute; + left:0; + background-image: url('iconsets/Greydient/togglebutton-new2-off.svg'); + background-size: auto 80%; + background-position: center; + background-repeat:no-repeat; +} + +.styledinputs input:checked + label:before +{ + background-image: url('iconsets/Greydient/togglebutton-new2-on.svg') !important; +} + +img.notexist,img.notfound +{ + background-image: url('iconsets/Greydient/compact-disc.svg'); + background-size:contain; + display:inline-block; + background-position: center; + background-repeat:no-repeat; +} + +img.stream.notfound, img.stream.notexist +{ + background-image: url('iconsets/Greydient/broadcast-new.svg'); +} + +img.plimage.notfound +{ + background-image: url('iconsets/Greydient/playlist.svg'); +} + +.backmenu +{ + background-image: url('iconsets/Greydient/arrow-left-double.svg'); + background-repeat: no-repeat; + background-size: contain; +} + +button.iconbutton { + height:2em; + width:2em; + background-size: contain; + background-position:center; + border: none !important; + opacity: 0.8; + background-color:transparent; +} + +button.iconbutton:hover { + opacity: 1; +} + +button.searchbutton { + background-image: url('iconsets/Greydient/system-search.svg'); +} + +button.rssbutton { + background-image: url('iconsets/Greydient/rss.svg'); +} + diff --git a/www/rompr/iconsets/Greydient/tick.svg b/www/rompr/iconsets/Greydient/tick.svg new file mode 100644 index 0000000..5843347 --- /dev/null +++ b/www/rompr/iconsets/Greydient/tick.svg @@ -0,0 +1,397 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/toggle-closed.svg b/www/rompr/iconsets/Greydient/toggle-closed.svg new file mode 100644 index 0000000..ccdf438 --- /dev/null +++ b/www/rompr/iconsets/Greydient/toggle-closed.svg @@ -0,0 +1,436 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/toggle-open.svg b/www/rompr/iconsets/Greydient/toggle-open.svg new file mode 100644 index 0000000..b62a526 --- /dev/null +++ b/www/rompr/iconsets/Greydient/toggle-open.svg @@ -0,0 +1,433 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/togglebutton-new2-off.svg b/www/rompr/iconsets/Greydient/togglebutton-new2-off.svg new file mode 100644 index 0000000..5f03209 --- /dev/null +++ b/www/rompr/iconsets/Greydient/togglebutton-new2-off.svg @@ -0,0 +1,472 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/togglebutton-new2-on.svg b/www/rompr/iconsets/Greydient/togglebutton-new2-on.svg new file mode 100644 index 0000000..085bae0 --- /dev/null +++ b/www/rompr/iconsets/Greydient/togglebutton-new2-on.svg @@ -0,0 +1,579 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/twitter-logo.svg b/www/rompr/iconsets/Greydient/twitter-logo.svg new file mode 100644 index 0000000..68fff5e --- /dev/null +++ b/www/rompr/iconsets/Greydient/twitter-logo.svg @@ -0,0 +1,446 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/unlistened.svg b/www/rompr/iconsets/Greydient/unlistened.svg new file mode 100644 index 0000000..2194298 --- /dev/null +++ b/www/rompr/iconsets/Greydient/unlistened.svg @@ -0,0 +1,69 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Greydient/vkontakte-logo.svg b/www/rompr/iconsets/Greydient/vkontakte-logo.svg new file mode 100644 index 0000000..492de19 --- /dev/null +++ b/www/rompr/iconsets/Greydient/vkontakte-logo.svg @@ -0,0 +1,489 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/volume.svg b/www/rompr/iconsets/Greydient/volume.svg new file mode 100644 index 0000000..7a845b8 --- /dev/null +++ b/www/rompr/iconsets/Greydient/volume.svg @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/wikipedia-logo.svg b/www/rompr/iconsets/Greydient/wikipedia-logo.svg new file mode 100644 index 0000000..13fb51c --- /dev/null +++ b/www/rompr/iconsets/Greydient/wikipedia-logo.svg @@ -0,0 +1,393 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/wma-audio.svg b/www/rompr/iconsets/Greydient/wma-audio.svg new file mode 100644 index 0000000..43a702b --- /dev/null +++ b/www/rompr/iconsets/Greydient/wma-audio.svg @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Greydient/world-wide-web.svg b/www/rompr/iconsets/Greydient/world-wide-web.svg new file mode 100644 index 0000000..185b0f0 --- /dev/null +++ b/www/rompr/iconsets/Greydient/world-wide-web.svg @@ -0,0 +1,82 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Greydient/youtube-logo.svg b/www/rompr/iconsets/Greydient/youtube-logo.svg new file mode 100644 index 0000000..ca81dab --- /dev/null +++ b/www/rompr/iconsets/Greydient/youtube-logo.svg @@ -0,0 +1,388 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Dark/0stars.svg b/www/rompr/iconsets/Modern-Dark/0stars.svg new file mode 100644 index 0000000..0753b65 --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/0stars.svg @@ -0,0 +1,19 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Dark/1stars.svg b/www/rompr/iconsets/Modern-Dark/1stars.svg new file mode 100644 index 0000000..5c321d3 --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/1stars.svg @@ -0,0 +1,19 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Dark/2stars.svg b/www/rompr/iconsets/Modern-Dark/2stars.svg new file mode 100644 index 0000000..303edb8 --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/2stars.svg @@ -0,0 +1,19 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Dark/3stars.svg b/www/rompr/iconsets/Modern-Dark/3stars.svg new file mode 100644 index 0000000..6434b86 --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/3stars.svg @@ -0,0 +1,19 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Dark/4stars.svg b/www/rompr/iconsets/Modern-Dark/4stars.svg new file mode 100644 index 0000000..d1cf5f0 --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/4stars.svg @@ -0,0 +1,19 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Dark/5stars.svg b/www/rompr/iconsets/Modern-Dark/5stars.svg new file mode 100644 index 0000000..e0f9aac --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/5stars.svg @@ -0,0 +1,19 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Dark/aac-audio.svg b/www/rompr/iconsets/Modern-Dark/aac-audio.svg new file mode 100644 index 0000000..7e7fd7f --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/aac-audio.svg @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + diff --git a/www/rompr/iconsets/Modern-Dark/add.svg b/www/rompr/iconsets/Modern-Dark/add.svg new file mode 100644 index 0000000..c627351 --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/add.svg @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Dark/adjustments.css b/www/rompr/iconsets/Modern-Dark/adjustments.css new file mode 100644 index 0000000..003e866 --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/adjustments.css @@ -0,0 +1,230 @@ +#buttons +{ + padding-left:12px; + padding-right:12px; + padding-top:4px; + padding-bottom:6px; +} + +.controlbutton +{ + margin:0px; + padding:0px; + vertical-align:middle; + display:inline-block; + width:56px; + height:56px; +} + +.controlbutton-small +{ + margin:0px; + vertical-align:middle; + display:inline-block; + width:48px; + height:48px; +} + +@media screen and (min-height: 800px) and (max-height: 939px) { + .controlbutton { + width:64px; + height:64px; + } + #buttons { + padding-top:12px; + } + #playbackTime { + margin-top:2px; + font-size:12px; + line-height:14px; + height:14px; + } +} + +@media screen and (min-height: 940px) and (max-height: 1099px) and (min-width: 650px) { + .controlbutton { + width:84px; + height:84px; + } + + .controlbutton-small { + width:64px; + height:64px; + } + + .shiftleft + { + left:-12px; + position:relative; + z-index:250; + } + + .shiftleft2 + { + left:-26px; + position:relative; + } + + .shiftleft3 + { + position:relative; + left:-36px; + z-index:5; + } + + .shiftleft4 + { + position:relative; + left:-48px; + z-index:1; + margin-right:-36px; + } + +} + +@media screen and (min-height: 940px) and (max-height: 1099px) and (min-width: 650px) { + .controlbutton { + width:84px; + height:84px; + } + .controlbutton-small { + width:64px; + height:64px; + } + #buttons { + padding-top:16px; + padding-left:24px; + } + #playbackTime { + margin-top:4px; + font-size:14px; + line-height:16px; + height:16px; + } + .shiftleft + { + left:-12px; + position:relative; + z-index:250; + } + + .shiftleft2 + { + left:-26px; + position:relative; + } + + .shiftleft3 + { + position:relative; + left:-36px; + z-index:5; + } + + .shiftleft4 + { + position:relative; + left:-48px; + z-index:1; + margin-right:-36px; + } +} + +@media screen and (min-height: 1100px) and (min-width: 651px) and (max-width: 749px) { + .controlbutton { + width:84px; + height:84px; + } + .controlbutton-small { + width:64px; + height:64px; + } + #buttons { + padding-top:16px; + padding-left:24px; + } + #playbackTime { + margin-top:4px; + font-size:14px; + line-height:16px; + height:16px; + } + .shiftleft + { + left:-12px; + position:relative; + z-index:250; + } + + .shiftleft2 + { + left:-26px; + position:relative; + } + + .shiftleft3 + { + position:relative; + left:-36px; + z-index:5; + } + + .shiftleft4 + { + position:relative; + left:-48px; + z-index:1; + margin-right:-36px; + } +} + +@media screen and (min-height: 1100px) and (min-width: 720px) { + .controlbutton { + width:90px; + height:90px; + } + .controlbutton-small { + width:70px; + height:70px; + } + #buttons { + padding-top:12px; + padding-left:20px; + } + #progress { + margin-top:8px; + } + #playbackTime { + margin-top:12px; + font-size:16px; + line-height:18px; + height:18px; + } + .shiftleft + { + left:-10px; + position:relative; + z-index:250; + } + + .shiftleft2 + { + left:-22px; + position:relative; + } + + .shiftleft3 + { + position:relative; + left:-34px; + z-index:5; + } + + .shiftleft4 + { + position:relative; + left:-44px; + z-index:1; + margin-right:-36px; + } +} diff --git a/www/rompr/iconsets/Modern-Dark/alarmclock_false.svg b/www/rompr/iconsets/Modern-Dark/alarmclock_false.svg new file mode 100644 index 0000000..1007301 --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/alarmclock_false.svg @@ -0,0 +1,3 @@ + + +image/svg+xml diff --git a/www/rompr/iconsets/Modern-Dark/alarmclock_true.svg b/www/rompr/iconsets/Modern-Dark/alarmclock_true.svg new file mode 100644 index 0000000..17d8a97 --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/alarmclock_true.svg @@ -0,0 +1,3 @@ + + +image/svg+xml diff --git a/www/rompr/iconsets/Modern-Dark/allmusic-logo.svg b/www/rompr/iconsets/Modern-Dark/allmusic-logo.svg new file mode 100644 index 0000000..af95aaf --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/allmusic-logo.svg @@ -0,0 +1,40 @@ + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Modern-Dark/arrow-decrease.svg b/www/rompr/iconsets/Modern-Dark/arrow-decrease.svg new file mode 100644 index 0000000..0b80c16 --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/arrow-decrease.svg @@ -0,0 +1,3 @@ + + +image/svg+xml diff --git a/www/rompr/iconsets/Modern-Dark/arrow-increase.svg b/www/rompr/iconsets/Modern-Dark/arrow-increase.svg new file mode 100644 index 0000000..8f1dfb5 --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/arrow-increase.svg @@ -0,0 +1,3 @@ + + +image/svg+xml diff --git a/www/rompr/iconsets/Modern-Dark/arrow-left-double.svg b/www/rompr/iconsets/Modern-Dark/arrow-left-double.svg new file mode 100644 index 0000000..c43b001 --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/arrow-left-double.svg @@ -0,0 +1,14 @@ + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Dark/arrow-right-double.svg b/www/rompr/iconsets/Modern-Dark/arrow-right-double.svg new file mode 100644 index 0000000..17f447b --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/arrow-right-double.svg @@ -0,0 +1,3 @@ + + +image/svg+xml diff --git a/www/rompr/iconsets/Modern-Dark/arrow-updown.svg b/www/rompr/iconsets/Modern-Dark/arrow-updown.svg new file mode 100644 index 0000000..56595af --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/arrow-updown.svg @@ -0,0 +1,48 @@ + + + + + + + + + + + image/svg+xml + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Dark/artist-icon.png b/www/rompr/iconsets/Modern-Dark/artist-icon.png new file mode 100644 index 0000000..930507b Binary files /dev/null and b/www/rompr/iconsets/Modern-Dark/artist-icon.png differ diff --git a/www/rompr/iconsets/Modern-Dark/audiobook.svg b/www/rompr/iconsets/Modern-Dark/audiobook.svg new file mode 100644 index 0000000..4487b7a --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/audiobook.svg @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Dark/backbutton.svg b/www/rompr/iconsets/Modern-Dark/backbutton.svg new file mode 100644 index 0000000..791e563 --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/backbutton.svg @@ -0,0 +1,3 @@ + + +image/svg+xml diff --git a/www/rompr/iconsets/Modern-Dark/bbc-logo.svg b/www/rompr/iconsets/Modern-Dark/bbc-logo.svg new file mode 100644 index 0000000..77f259a --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/bbc-logo.svg @@ -0,0 +1,23 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Dark/blobdown2-hi.svg b/www/rompr/iconsets/Modern-Dark/blobdown2-hi.svg new file mode 100644 index 0000000..5a4e71d --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/blobdown2-hi.svg @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Dark/blobdown2.svg b/www/rompr/iconsets/Modern-Dark/blobdown2.svg new file mode 100644 index 0000000..8c7cb82 --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/blobdown2.svg @@ -0,0 +1,21 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Dark/broadcast-new.svg b/www/rompr/iconsets/Modern-Dark/broadcast-new.svg new file mode 100644 index 0000000..659db84 --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/broadcast-new.svg @@ -0,0 +1,3 @@ + + +image/svg+xml diff --git a/www/rompr/iconsets/Modern-Dark/calendar.svg b/www/rompr/iconsets/Modern-Dark/calendar.svg new file mode 100644 index 0000000..a0545eb --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/calendar.svg @@ -0,0 +1,7 @@ + + + + + Svg Vector Icons : http://www.onlinewebfonts.com/icon + + \ No newline at end of file diff --git a/www/rompr/iconsets/Modern-Dark/cd_case.svg b/www/rompr/iconsets/Modern-Dark/cd_case.svg new file mode 100644 index 0000000..514348c --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/cd_case.svg @@ -0,0 +1,3 @@ + + +image/svg+xml diff --git a/www/rompr/iconsets/Modern-Dark/collection.svg b/www/rompr/iconsets/Modern-Dark/collection.svg new file mode 100644 index 0000000..b8fd2cb --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/collection.svg @@ -0,0 +1,101 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Dark/compact-disc.svg b/www/rompr/iconsets/Modern-Dark/compact-disc.svg new file mode 100644 index 0000000..438901a --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/compact-disc.svg @@ -0,0 +1,98 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Modern-Dark/consume.svg b/www/rompr/iconsets/Modern-Dark/consume.svg new file mode 100644 index 0000000..7de01fc --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/consume.svg @@ -0,0 +1,35 @@ + + + + + + + image/svg+xml + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Dark/consume_off.svg b/www/rompr/iconsets/Modern-Dark/consume_off.svg new file mode 100644 index 0000000..c45ca0b --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/consume_off.svg @@ -0,0 +1,35 @@ + + + + + + + image/svg+xml + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Dark/crossfade.svg b/www/rompr/iconsets/Modern-Dark/crossfade.svg new file mode 100644 index 0000000..ba938f1 --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/crossfade.svg @@ -0,0 +1,135 @@ + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Dark/crossfade_off.svg b/www/rompr/iconsets/Modern-Dark/crossfade_off.svg new file mode 100644 index 0000000..77f541b --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/crossfade_off.svg @@ -0,0 +1,61 @@ + + + + + + + + image/svg+xml + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Dark/dialog-error.svg b/www/rompr/iconsets/Modern-Dark/dialog-error.svg new file mode 100644 index 0000000..9ac2e13 --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/dialog-error.svg @@ -0,0 +1,10 @@ + + + + + + diff --git a/www/rompr/iconsets/Modern-Dark/dialog-information.svg b/www/rompr/iconsets/Modern-Dark/dialog-information.svg new file mode 100644 index 0000000..0c6e153 --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/dialog-information.svg @@ -0,0 +1,3 @@ + + +image/svg+xml diff --git a/www/rompr/iconsets/Modern-Dark/dirble-logo.svg b/www/rompr/iconsets/Modern-Dark/dirble-logo.svg new file mode 100644 index 0000000..856b101 --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/dirble-logo.svg @@ -0,0 +1,204 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Dark/discogs-logo.svg b/www/rompr/iconsets/Modern-Dark/discogs-logo.svg new file mode 100644 index 0000000..88f54a5 --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/discogs-logo.svg @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Dark/document-save.svg b/www/rompr/iconsets/Modern-Dark/document-save.svg new file mode 100644 index 0000000..3aa35f4 --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/document-save.svg @@ -0,0 +1,3 @@ + + +image/svg+xml diff --git a/www/rompr/iconsets/Modern-Dark/download-icon.svg b/www/rompr/iconsets/Modern-Dark/download-icon.svg new file mode 100644 index 0000000..680891d --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/download-icon.svg @@ -0,0 +1,10 @@ + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Dark/edit-clear-list.svg b/www/rompr/iconsets/Modern-Dark/edit-clear-list.svg new file mode 100644 index 0000000..f742979 --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/edit-clear-list.svg @@ -0,0 +1,3 @@ + + +image/svg+xml diff --git a/www/rompr/iconsets/Modern-Dark/edit-delete.svg b/www/rompr/iconsets/Modern-Dark/edit-delete.svg new file mode 100644 index 0000000..5cc8c56 --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/edit-delete.svg @@ -0,0 +1,3 @@ + + +image/svg+xml diff --git a/www/rompr/iconsets/Modern-Dark/expand-up.svg b/www/rompr/iconsets/Modern-Dark/expand-up.svg new file mode 100644 index 0000000..bbe98dc --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/expand-up.svg @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Dark/facebook-logo.svg b/www/rompr/iconsets/Modern-Dark/facebook-logo.svg new file mode 100644 index 0000000..a42b00c --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/facebook-logo.svg @@ -0,0 +1,97 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Dark/file.svg b/www/rompr/iconsets/Modern-Dark/file.svg new file mode 100644 index 0000000..42fbca1 --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/file.svg @@ -0,0 +1,3 @@ + + +image/svg+xml diff --git a/www/rompr/iconsets/Modern-Dark/flac-audio.svg b/www/rompr/iconsets/Modern-Dark/flac-audio.svg new file mode 100644 index 0000000..8f05d61 --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/flac-audio.svg @@ -0,0 +1,103 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Dark/folder.svg b/www/rompr/iconsets/Modern-Dark/folder.svg new file mode 100644 index 0000000..fb98708 --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/folder.svg @@ -0,0 +1,13 @@ + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Dark/forwardbutton.svg b/www/rompr/iconsets/Modern-Dark/forwardbutton.svg new file mode 100644 index 0000000..56ea7a1 --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/forwardbutton.svg @@ -0,0 +1,3 @@ + + +image/svg+xml diff --git a/www/rompr/iconsets/Modern-Dark/gmusic-logo.svg b/www/rompr/iconsets/Modern-Dark/gmusic-logo.svg new file mode 100644 index 0000000..2a6553e --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/gmusic-logo.svg @@ -0,0 +1,21 @@ + + Svg Vector Icons : http://www.onlinewebfonts.com/icon image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Modern-Dark/headphones.svg b/www/rompr/iconsets/Modern-Dark/headphones.svg new file mode 100644 index 0000000..b5d2985 --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/headphones.svg @@ -0,0 +1,16 @@ + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Dark/icon-new.svg b/www/rompr/iconsets/Modern-Dark/icon-new.svg new file mode 100644 index 0000000..78d0c54 --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/icon-new.svg @@ -0,0 +1,3 @@ + + +image/svg+xml diff --git a/www/rompr/iconsets/Modern-Dark/imdb-logo.svg b/www/rompr/iconsets/Modern-Dark/imdb-logo.svg new file mode 100644 index 0000000..5a42a97 --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/imdb-logo.svg @@ -0,0 +1,472 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Dark/internetarchive-logo.svg b/www/rompr/iconsets/Modern-Dark/internetarchive-logo.svg new file mode 100644 index 0000000..c899482 --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/internetarchive-logo.svg @@ -0,0 +1,389 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Dark/lastfm-ban.svg b/www/rompr/iconsets/Modern-Dark/lastfm-ban.svg new file mode 100644 index 0000000..e9922cd --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/lastfm-ban.svg @@ -0,0 +1,3 @@ + + +image/svg+xml diff --git a/www/rompr/iconsets/Modern-Dark/lastfm-love.svg b/www/rompr/iconsets/Modern-Dark/lastfm-love.svg new file mode 100644 index 0000000..440087b --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/lastfm-love.svg @@ -0,0 +1,15 @@ + + + + + + image/svg+xml + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Dark/lastfm-unlove.svg b/www/rompr/iconsets/Modern-Dark/lastfm-unlove.svg new file mode 100644 index 0000000..901d99c --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/lastfm-unlove.svg @@ -0,0 +1,12 @@ + + + + + + diff --git a/www/rompr/iconsets/Modern-Dark/lastfm.svg b/www/rompr/iconsets/Modern-Dark/lastfm.svg new file mode 100644 index 0000000..4dc11f0 --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/lastfm.svg @@ -0,0 +1,3 @@ + + +image/svg+xml diff --git a/www/rompr/iconsets/Modern-Dark/lyrics.svg b/www/rompr/iconsets/Modern-Dark/lyrics.svg new file mode 100644 index 0000000..5f9661a --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/lyrics.svg @@ -0,0 +1,3 @@ + + +image/svg+xml diff --git a/www/rompr/iconsets/Modern-Dark/media-playback-pause-highlight.svg b/www/rompr/iconsets/Modern-Dark/media-playback-pause-highlight.svg new file mode 100644 index 0000000..2e31224 --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/media-playback-pause-highlight.svg @@ -0,0 +1,22 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Dark/media-playback-pause.svg b/www/rompr/iconsets/Modern-Dark/media-playback-pause.svg new file mode 100644 index 0000000..76f50c9 --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/media-playback-pause.svg @@ -0,0 +1,94 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Dark/media-playback-start-highlight.svg b/www/rompr/iconsets/Modern-Dark/media-playback-start-highlight.svg new file mode 100644 index 0000000..9580a81 --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/media-playback-start-highlight.svg @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Dark/media-playback-start.svg b/www/rompr/iconsets/Modern-Dark/media-playback-start.svg new file mode 100644 index 0000000..ad3d81a --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/media-playback-start.svg @@ -0,0 +1,25 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Dark/media-playback-stop-highlight.svg b/www/rompr/iconsets/Modern-Dark/media-playback-stop-highlight.svg new file mode 100644 index 0000000..945fe43 --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/media-playback-stop-highlight.svg @@ -0,0 +1,21 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Dark/media-playback-stop.svg b/www/rompr/iconsets/Modern-Dark/media-playback-stop.svg new file mode 100644 index 0000000..cdd2bac --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/media-playback-stop.svg @@ -0,0 +1,25 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Dark/media-skip-backward-highlight.svg b/www/rompr/iconsets/Modern-Dark/media-skip-backward-highlight.svg new file mode 100644 index 0000000..4a31db9 --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/media-skip-backward-highlight.svg @@ -0,0 +1,24 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Dark/media-skip-backward.svg b/www/rompr/iconsets/Modern-Dark/media-skip-backward.svg new file mode 100644 index 0000000..081386b --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/media-skip-backward.svg @@ -0,0 +1,28 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Dark/media-skip-forward-highlight.svg b/www/rompr/iconsets/Modern-Dark/media-skip-forward-highlight.svg new file mode 100644 index 0000000..3be12a4 --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/media-skip-forward-highlight.svg @@ -0,0 +1,24 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Dark/media-skip-forward.svg b/www/rompr/iconsets/Modern-Dark/media-skip-forward.svg new file mode 100644 index 0000000..a2ee7ee --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/media-skip-forward.svg @@ -0,0 +1,28 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Dark/movie-1.svg b/www/rompr/iconsets/Modern-Dark/movie-1.svg new file mode 100644 index 0000000..401a0ba --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/movie-1.svg @@ -0,0 +1,10 @@ + + + + + + diff --git a/www/rompr/iconsets/Modern-Dark/mp3-audio.svg b/www/rompr/iconsets/Modern-Dark/mp3-audio.svg new file mode 100644 index 0000000..2a6e6ed --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/mp3-audio.svg @@ -0,0 +1,56 @@ + + + + + + + + image/svg+xml + + + + + + + diff --git a/www/rompr/iconsets/Modern-Dark/musicbrainz_logo.svg b/www/rompr/iconsets/Modern-Dark/musicbrainz_logo.svg new file mode 100644 index 0000000..2f35c35 --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/musicbrainz_logo.svg @@ -0,0 +1,156 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Dark/neverheard.png b/www/rompr/iconsets/Modern-Dark/neverheard.png new file mode 100644 index 0000000..3d3c100 Binary files /dev/null and b/www/rompr/iconsets/Modern-Dark/neverheard.png differ diff --git a/www/rompr/iconsets/Modern-Dark/ogg-audio.svg b/www/rompr/iconsets/Modern-Dark/ogg-audio.svg new file mode 100644 index 0000000..0b2cffb --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/ogg-audio.svg @@ -0,0 +1,130 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Vorbis + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Dark/output.svg b/www/rompr/iconsets/Modern-Dark/output.svg new file mode 100644 index 0000000..227661e --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/output.svg @@ -0,0 +1,2 @@ + +image/svg+xml diff --git a/www/rompr/iconsets/Modern-Dark/output_mute.svg b/www/rompr/iconsets/Modern-Dark/output_mute.svg new file mode 100644 index 0000000..3511088 --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/output_mute.svg @@ -0,0 +1,2 @@ + +image/svg+xml diff --git a/www/rompr/iconsets/Modern-Dark/parental-advisory.svg b/www/rompr/iconsets/Modern-Dark/parental-advisory.svg new file mode 100644 index 0000000..ea6360a --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/parental-advisory.svg @@ -0,0 +1,19 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + \ No newline at end of file diff --git a/www/rompr/iconsets/Modern-Dark/playlist.svg b/www/rompr/iconsets/Modern-Dark/playlist.svg new file mode 100644 index 0000000..dcfe94e --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/playlist.svg @@ -0,0 +1,54 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Modern-Dark/podcast-logo.svg b/www/rompr/iconsets/Modern-Dark/podcast-logo.svg new file mode 100644 index 0000000..0844cc6 --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/podcast-logo.svg @@ -0,0 +1,3 @@ + + +image/svg+xml diff --git a/www/rompr/iconsets/Modern-Dark/preferences.svg b/www/rompr/iconsets/Modern-Dark/preferences.svg new file mode 100644 index 0000000..17c5fc6 --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/preferences.svg @@ -0,0 +1,34 @@ + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Dark/pushbutton.svg b/www/rompr/iconsets/Modern-Dark/pushbutton.svg new file mode 100644 index 0000000..cb70180 --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/pushbutton.svg @@ -0,0 +1,9 @@ + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Dark/random.svg b/www/rompr/iconsets/Modern-Dark/random.svg new file mode 100644 index 0000000..a1f6f40 --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/random.svg @@ -0,0 +1,91 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Dark/random_off.svg b/www/rompr/iconsets/Modern-Dark/random_off.svg new file mode 100644 index 0000000..72641c5 --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/random_off.svg @@ -0,0 +1,116 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Dark/ratandtag.svg b/www/rompr/iconsets/Modern-Dark/ratandtag.svg new file mode 100644 index 0000000..14e49dd --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/ratandtag.svg @@ -0,0 +1,84 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Dark/ratortag.svg b/www/rompr/iconsets/Modern-Dark/ratortag.svg new file mode 100644 index 0000000..882d9e9 --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/ratortag.svg @@ -0,0 +1,85 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Dark/refresh.svg b/www/rompr/iconsets/Modern-Dark/refresh.svg new file mode 100644 index 0000000..65884a0 --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/refresh.svg @@ -0,0 +1,21 @@ + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Dark/refresh_off.svg b/www/rompr/iconsets/Modern-Dark/refresh_off.svg new file mode 100644 index 0000000..d131b45 --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/refresh_off.svg @@ -0,0 +1,60 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Modern-Dark/resize.svg b/www/rompr/iconsets/Modern-Dark/resize.svg new file mode 100644 index 0000000..6f05d68 --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/resize.svg @@ -0,0 +1,3 @@ + + +image/svg+xml diff --git a/www/rompr/iconsets/Modern-Dark/rss.svg b/www/rompr/iconsets/Modern-Dark/rss.svg new file mode 100644 index 0000000..d3823cc --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/rss.svg @@ -0,0 +1,122 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Dark/shuffle.png b/www/rompr/iconsets/Modern-Dark/shuffle.png new file mode 100644 index 0000000..396a300 Binary files /dev/null and b/www/rompr/iconsets/Modern-Dark/shuffle.png differ diff --git a/www/rompr/iconsets/Modern-Dark/singlestar.svg b/www/rompr/iconsets/Modern-Dark/singlestar.svg new file mode 100644 index 0000000..bb2715d --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/singlestar.svg @@ -0,0 +1,62 @@ + + + + + + + + + + image/svg+xml + + + + + + + diff --git a/www/rompr/iconsets/Modern-Dark/sleep.png b/www/rompr/iconsets/Modern-Dark/sleep.png new file mode 100644 index 0000000..b049743 Binary files /dev/null and b/www/rompr/iconsets/Modern-Dark/sleep.png differ diff --git a/www/rompr/iconsets/Modern-Dark/sliders.svg b/www/rompr/iconsets/Modern-Dark/sliders.svg new file mode 100644 index 0000000..1f2f21f --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/sliders.svg @@ -0,0 +1,21 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Dark/smartradio.svg b/www/rompr/iconsets/Modern-Dark/smartradio.svg new file mode 100644 index 0000000..642569d --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/smartradio.svg @@ -0,0 +1,19 @@ + + + + + + diff --git a/www/rompr/iconsets/Modern-Dark/soundcloud-logo.svg b/www/rompr/iconsets/Modern-Dark/soundcloud-logo.svg new file mode 100644 index 0000000..c36c8e1 --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/soundcloud-logo.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Dark/spinner.svg b/www/rompr/iconsets/Modern-Dark/spinner.svg new file mode 100644 index 0000000..7198cd1 --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/spinner.svg @@ -0,0 +1,3 @@ + + +image/svg+xml diff --git a/www/rompr/iconsets/Modern-Dark/spotify-logo.svg b/www/rompr/iconsets/Modern-Dark/spotify-logo.svg new file mode 100644 index 0000000..306d5c1 --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/spotify-logo.svg @@ -0,0 +1,16 @@ + + + + + + diff --git a/www/rompr/iconsets/Modern-Dark/stopafter-highlight.svg b/www/rompr/iconsets/Modern-Dark/stopafter-highlight.svg new file mode 100644 index 0000000..16d0fa0 --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/stopafter-highlight.svg @@ -0,0 +1,22 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Dark/stopafter.svg b/www/rompr/iconsets/Modern-Dark/stopafter.svg new file mode 100644 index 0000000..39f1431 --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/stopafter.svg @@ -0,0 +1,22 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Dark/system-search.svg b/www/rompr/iconsets/Modern-Dark/system-search.svg new file mode 100644 index 0000000..3fd7b88 --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/system-search.svg @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/www/rompr/iconsets/Modern-Dark/tag.svg b/www/rompr/iconsets/Modern-Dark/tag.svg new file mode 100644 index 0000000..7444832 --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/tag.svg @@ -0,0 +1,9 @@ + + + + + + diff --git a/www/rompr/iconsets/Modern-Dark/theme.css b/www/rompr/iconsets/Modern-Dark/theme.css new file mode 100644 index 0000000..5393b56 --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/theme.css @@ -0,0 +1,245 @@ + + [class^="icon-"], [class*=" icon-"] { + background-size:contain; + background-position: center; + background-repeat:no-repeat; + display:inline-block; +} + +.button-disabled { opacity: 0.1 } + +.clearbox { + background-image: url('iconsets/Modern-Dark/edit-delete.svg'); + /* dont change the 50%, it ties in with makeHoverWork, makeClearWork, and makeTagMenu */ + background-size: auto 50%; + background-position: right 2px center; + background-repeat: no-repeat; +} + +.combobox-entry, .selectholder { + background-image: url('iconsets/Modern-Dark/blobdown2.svg'); + /* dont change the 50%, it ties in with makeHoverWork, makeClearWork, and makeTagMenu */ + background-size: auto 50%; + background-position: right 2px center; + background-repeat: no-repeat; +} + +.combobox-entry:hover, .selectholder:hover { + background-image: url('iconsets/Modern-Dark/blobdown2-hi.svg'); + /* dont change the 50%, it ties in with makeHoverWork, makeClearWork, and makeTagMenu */ + background-size: auto 50%; + background-position: right 2px center; + background-repeat: no-repeat; +} + +.combo-button { + background-image: url('iconsets/Modern-Dark/blobdown2.svg'); +} + +.icon-play-circled { background-image :url('iconsets/Modern-Dark/media-playback-start.svg') } +.playdiv { background-image :url('iconsets/Modern-Dark/media-playback-start.svg') } +.icon-play-circled:hover { background-image :url('iconsets/Modern-Dark/media-playback-start-highlight.svg') } +.icon-pause-circled { background-image :url('iconsets/Modern-Dark/media-playback-pause.svg') } +.icon-pause-circled:hover { background-image :url('iconsets/Modern-Dark/media-playback-pause-highlight.svg') } +.icon-fast-backward { background-image :url('iconsets/Modern-Dark/media-skip-backward.svg') } +.icon-fast-backward:hover { background-image :url('iconsets/Modern-Dark/media-skip-backward-highlight.svg') } +.icon-fast-forward { background-image :url('iconsets/Modern-Dark/media-skip-forward.svg') } +.icon-fast-forward:hover { background-image :url('iconsets/Modern-Dark/media-skip-forward-highlight.svg') } +.icon-stop-1 { background-image :url('iconsets/Modern-Dark/media-playback-stop.svg') } +.icon-stop-1:hover { background-image :url('iconsets/Modern-Dark/media-playback-stop-highlight.svg') } +.icon-to-end-1 { background-image :url('iconsets/Modern-Dark/stopafter.svg') } +.icon-to-end-1:hover { background-image :url('iconsets/Modern-Dark/stopafter-highlight.svg') } + +.icon-music { background-image: url('iconsets/Modern-Dark/collection.svg') } +.icon-search { background-image: url('iconsets/Modern-Dark/system-search.svg') } +.icon-folder-open-empty { background-image: url('iconsets/Modern-Dark/folder.svg') } +.icon-radio-tower { background-image: url('iconsets/Modern-Dark/broadcast-new.svg') } +.icon-cd { background-image: url('iconsets/Modern-Dark/cd_case.svg') } +.icon-resize-horizontal { background-image: url('iconsets/Modern-Dark/resize.svg') } +.icon-angle-double-left { background-image:url('iconsets/Modern-Dark/arrow-left-double.svg') } +.icon-angle-double-right { background-image:url('iconsets/Modern-Dark/arrow-right-double.svg') } +.icon-menu { background-image: url('iconsets/Modern-Dark/pushbutton.svg') } +.icon-versions { background-image: url('iconsets/Modern-Dark/history.svg') } +.icon-left-circled { background-image: url('iconsets/Modern-Dark/backbutton.svg') } +.icon-right-circled { background-image: url('iconsets/Modern-Dark/forwardbutton.svg') } +.icon-cog-alt { background-image: url('iconsets/Modern-Dark/preferences.svg') } +.icon-trash { background-image: url('iconsets/Modern-Dark/edit-clear-list.svg') } +.icon-wifi { background-image: url('iconsets/Modern-Dark/smartradio.svg') } +.icon-doc-text { background-image: url('iconsets/Modern-Dark/playlist.svg') } +.icon-floppy { background-image: url('iconsets/Modern-Dark/document-save.svg') } +.icon-cancel-circled { background-image: url('iconsets/Modern-Dark/edit-delete.svg') } +.icon-plus { + background-image: url('iconsets/Modern-Dark/add.svg'); + opacity:0.7; +} +.icon-alarm { background-image: url('iconsets/Modern-Dark/alarmclock_false.svg') } +.icon-alarm-on { background-image: url('iconsets/Modern-Dark/alarmclock_true.svg') } +.icon-sleep { background-image: url('iconsets/Modern-Dark/sleep.png') } +.icon-library { background-image: url('iconsets/Modern-Dark/file.svg') } +.icon-lastfm-1 { background-image: url('iconsets/Modern-Dark/lastfm.svg') } +.icon-wikipedia { background-image: url('iconsets/Modern-Dark/wikipedia-logo.svg') } +.icon-musicbrainz { background-image: url('iconsets/Modern-Dark/musicbrainz_logo.svg') } +.icon-discogs { background-image: url('iconsets/Modern-Dark/discogs-logo.svg') } +.icon-doc-text-1 { background-image: url('iconsets/Modern-Dark/lyrics.svg') } +.icon-soundcloud-circled { background-image: url('iconsets/Modern-Dark/soundcloud-logo.svg') } +.icon-youtube-circled { background-image: url('iconsets/Modern-Dark/youtube-logo.svg') } +.icon-gmusic-circled { background-image: url('iconsets/Modern-Dark/gmusic-logo.svg') } +.icon-spotify-circled { background-image: url('iconsets/Modern-Dark/spotify-logo.svg') } +.icon-vkontakte-circled { background-image: url('iconsets/Modern-Dark/vkontakte-logo.svg') } +.icon-podcast-circled { background-image: url('iconsets/Modern-Dark/podcast-logo.svg') } +.icon-audiobook { background-image: url('iconsets/Modern-Dark/audiobook.svg') } +.icon-internetarchive-circled { background-image: url('iconsets/Modern-Dark/internetarchive-logo.svg') } +.icon-increase { background-image: url('iconsets/Modern-Dark/arrow-increase.svg') } +.icon-decrease { background-image: url('iconsets/Modern-Dark/arrow-decrease.svg') } +.icon-attention-1 { background-image: url('iconsets/Modern-Dark/dialog-error.svg') } +.icon-info-circled { background-image: url('iconsets/Modern-Dark/dialog-information.svg') } +.icon-download { background-image: url('iconsets/Modern-Dark/download-icon.svg') } +.icon-sun { background-image: url('iconsets/Modern-Dark/icon-new.svg') } +.icon-headphones { background-image: url('iconsets/Modern-Dark/headphones.svg') } +.icon-unlistened { background-image: url('iconsets/Modern-Dark/headphones.svg') } +.icon-block { background-image: url('iconsets/Modern-Dark/lastfm-ban.svg') } +.icon-heart { background-image: url('iconsets/Modern-Dark/lastfm-love.svg') } +.icon-heart-broken { background-image: url('iconsets/Modern-Dark/lastfm-unlove.svg') } +.icon-refresh { background-image: url('iconsets/Modern-Dark/refresh.svg') } +.icon-dirble-circled { background-image: url('iconsets/Modern-Dark/dirble-logo.svg') } +.icon-tunein { background-image: url('iconsets/Modern-Dark/../../newimages/tunein-logo.svg') } +.icon-no-response-playbutton { background-image :url('iconsets/Modern-Dark/media-playback-start.svg') } +.icon-tags { background-image: url('iconsets/Modern-Dark/tag.svg') } +.icon-volume-up { background-image: url('iconsets/Modern-Dark/volume.svg') } +.icon-toggle-open { background-image: url('iconsets/Modern-Dark/toggle-open.svg') } +.icon-toggle-closed { background-image: url('iconsets/Modern-Dark/toggle-closed.svg') } +.icon-spin6 { background-image: url('iconsets/Modern-Dark/spinner.svg') } +.icon-output { background-image: url('iconsets/Modern-Dark/output.svg') } +.icon-output-mute { background-image: url('iconsets/Modern-Dark/output_mute.svg') } +.icon-sliders { background-image: url('iconsets/Modern-Dark/sliders.svg') } +.icon-0-stars { background-image: url('iconsets/Modern-Dark/0stars.svg') } +.icon-1-stars { background-image: url('iconsets/Modern-Dark/1stars.svg') } +.icon-2-stars { background-image: url('iconsets/Modern-Dark/2stars.svg') } +.icon-3-stars { background-image: url('iconsets/Modern-Dark/3stars.svg') } +.icon-4-stars { background-image: url('iconsets/Modern-Dark/4stars.svg') } +.icon-5-stars { background-image: url('iconsets/Modern-Dark/5stars.svg') } +.icon-single-star { background-image: url('iconsets/Modern-Dark/singlestar.svg') } +.icon-ratandtag { background-image: url('iconsets/Modern-Dark/ratandtag.svg') } +.icon-ratortag { background-image: url('iconsets/Modern-Dark/ratortag.svg') } +.icon-toggle-on { background-image: url('iconsets/Modern-Dark/togglebutton-new2-on.svg') } +.icon-toggle-off { background-image: url('iconsets/Modern-Dark/togglebutton-new2-off.svg') } + +.icon-random.flow-on { background-image: url('iconsets/Modern-Dark/random.svg') } +.icon-random.flow-off { background-image: url('iconsets/Modern-Dark/random_off.svg') } +.icon-crossfade.flow-on { background-image: url('iconsets/Modern-Dark/crossfade.svg') } +.icon-crossfade.flow-off { background-image: url('iconsets/Modern-Dark/crossfade_off.svg') } +.icon-repeat.flow-on { background-image: url('iconsets/Modern-Dark/refresh.svg') } +.icon-repeat.flow-off { background-image: url('iconsets/Modern-Dark/refresh_off.svg') } +.icon-consume.flow-on { background-image: url('iconsets/Modern-Dark/consume.svg') } +.icon-consume.flow-off { background-image: url('iconsets/Modern-Dark/consume_off.svg') } + +.icon-allrandom { background-image: url('iconsets/Modern-Dark/shuffle.png') } +.icon-neverplayed { background-image: url('iconsets/Modern-Dark/neverheard.png') } +.icon-recentlyplayed { background-image: url('iconsets/Modern-Dark/calendar.svg') } +.icon-artist { background-image: url('iconsets/Modern-Dark/artist-icon.png') } +.icon-mp3-audio { background-image: url('iconsets/Modern-Dark/mp3-audio.svg') } +.icon-aac-audio { background-image: url('iconsets/Modern-Dark/aac-audio.svg') } +.icon-flac-audio { background-image: url('iconsets/Modern-Dark/flac-audio.svg') } +.icon-wma-audio { background-image: url('iconsets/Modern-Dark/wma-audio.svg') } +.icon-ogg-audio { background-image: url('iconsets/Modern-Dark/ogg-audio.svg') } +.icon-explicit { background-image: url('iconsets/Modern-Dark/parental-advisory.svg') } +.icon-expand-up { background-image: url('iconsets/Modern-Dark/expand-up.svg') } +.icon-rss { background-image: url('iconsets/Modern-Dark/rss.svg') } +.icon-tick { background-image: url('iconsets/Modern-Dark/tick.svg') } +.icon-video { background-image: url('iconsets/Modern-Dark/movie-1.svg') } +.icon-bbc-logo { background-image: url('iconsets/Modern-Dark/bbc-logo.svg') } +.icon-imdb-logo { background-image: url('iconsets/Modern-Dark/imdb-logo.svg') } +.icon-facebook-logo { background-image: url('iconsets/Modern-Dark/facebook-logo.svg') } +.icon-twitter-logo { background-image: url('iconsets/Modern-Dark/twitter-logo.svg') } +.icon-www { background-image: url('iconsets/Modern-Dark/world-wide-web.svg') } +.icon-allmusic { background-image: url('iconsets/Modern-Dark/allmusic-logo.svg') } +.icon-updown { background-image: url('iconsets/Modern-Dark/arrow-updown.svg') } +.icon-snapcast { background-image: url('iconsets/Modern-Dark/../../newimages/snapcast.png') } + +.styledinputs label +{ + display:inline-block; + cursor:pointer; + position:relative; + padding-left:2.5em; + line-height:1.5em; +} + +.styledinputs input[type=radio] +{ + display:none; +} + +.styledinputs input[type=checkbox] +{ + display:none; +} + +.styledinputs label:before +{ + content:""; + display:inline-block; + width:2em; + height:1.5em; + position:absolute; + left:0; + /* bottom:0.2em; */ + background-image: url('iconsets/Modern-Dark/togglebutton-new2-off.svg'); + background-size:contain; + background-position: center; + background-repeat:no-repeat; +} + +.styledinputs input:checked + label:before +{ + background-image: url('iconsets/Modern-Dark/togglebutton-new2-on.svg') !important; +} + +img.notexist,img.notfound +{ + background-image: url('iconsets/Modern-Dark/compact-disc.svg'); + background-size:contain; + display:inline-block; + background-position:center; + background-repeat: no-repeat; +} + +img.stream.notfound, img.stream.notexist +{ + background-image: url('iconsets/Modern-Dark/broadcast-new.svg'); +} + +img.plimage.notfound +{ + background-image: url('iconsets/Modern-Dark/playlist.svg'); +} + +.backmenu +{ + background-image: url('iconsets/Modern-Dark/arrow-left-double.svg'); + background-repeat: no-repeat; + background-size: contain; +} + +button.iconbutton { + height:2em; + width:2em; + background-size: contain; + background-position:center; + border: none !important; + opacity: 0.8; + background-color:transparent; +} + +button.iconbutton:hover { + opacity: 1; +} + +button.searchbutton { + background-image: url('iconsets/Modern-Dark/system-search.svg'); +} + +button.rssbutton { + background-image: url('iconsets/Modern-Dark/rss.svg'); +} + diff --git a/www/rompr/iconsets/Modern-Dark/tick.svg b/www/rompr/iconsets/Modern-Dark/tick.svg new file mode 100644 index 0000000..85696d1 --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/tick.svg @@ -0,0 +1,132 @@ + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Dark/toggle-closed.svg b/www/rompr/iconsets/Modern-Dark/toggle-closed.svg new file mode 100644 index 0000000..7aeb480 --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/toggle-closed.svg @@ -0,0 +1,3 @@ + + +image/svg+xml diff --git a/www/rompr/iconsets/Modern-Dark/toggle-open.svg b/www/rompr/iconsets/Modern-Dark/toggle-open.svg new file mode 100644 index 0000000..4117d45 --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/toggle-open.svg @@ -0,0 +1,3 @@ + + +image/svg+xml diff --git a/www/rompr/iconsets/Modern-Dark/togglebutton-new2-off.svg b/www/rompr/iconsets/Modern-Dark/togglebutton-new2-off.svg new file mode 100644 index 0000000..6ac75d3 --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/togglebutton-new2-off.svg @@ -0,0 +1,232 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Modern-Dark/togglebutton-new2-on.svg b/www/rompr/iconsets/Modern-Dark/togglebutton-new2-on.svg new file mode 100644 index 0000000..981529e --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/togglebutton-new2-on.svg @@ -0,0 +1,362 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Dark/twitter-logo.svg b/www/rompr/iconsets/Modern-Dark/twitter-logo.svg new file mode 100644 index 0000000..fcf0066 --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/twitter-logo.svg @@ -0,0 +1,385 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Dark/unlistened.svg b/www/rompr/iconsets/Modern-Dark/unlistened.svg new file mode 100644 index 0000000..8faf809 --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/unlistened.svg @@ -0,0 +1,17 @@ + + + + + + diff --git a/www/rompr/iconsets/Modern-Dark/vkontakte-logo.svg b/www/rompr/iconsets/Modern-Dark/vkontakte-logo.svg new file mode 100644 index 0000000..9abe0cd --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/vkontakte-logo.svg @@ -0,0 +1,15 @@ + + + + + + + image/svg+xml + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Dark/volume.svg b/www/rompr/iconsets/Modern-Dark/volume.svg new file mode 100644 index 0000000..5b4b798 --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/volume.svg @@ -0,0 +1,25 @@ + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Dark/wikipedia-logo.svg b/www/rompr/iconsets/Modern-Dark/wikipedia-logo.svg new file mode 100644 index 0000000..cae546f --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/wikipedia-logo.svg @@ -0,0 +1,17 @@ + + + + + + diff --git a/www/rompr/iconsets/Modern-Dark/wma-audio.svg b/www/rompr/iconsets/Modern-Dark/wma-audio.svg new file mode 100644 index 0000000..588a16a --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/wma-audio.svg @@ -0,0 +1,96 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Dark/world-wide-web.svg b/www/rompr/iconsets/Modern-Dark/world-wide-web.svg new file mode 100644 index 0000000..5e39f35 --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/world-wide-web.svg @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Dark/youtube-logo.svg b/www/rompr/iconsets/Modern-Dark/youtube-logo.svg new file mode 100644 index 0000000..95910f5 --- /dev/null +++ b/www/rompr/iconsets/Modern-Dark/youtube-logo.svg @@ -0,0 +1,3 @@ + + +image/svg+xml diff --git a/www/rompr/iconsets/Modern-Light/0stars.svg b/www/rompr/iconsets/Modern-Light/0stars.svg new file mode 100644 index 0000000..909d882 --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/0stars.svg @@ -0,0 +1,19 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Light/1stars.svg b/www/rompr/iconsets/Modern-Light/1stars.svg new file mode 100644 index 0000000..4bfbefd --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/1stars.svg @@ -0,0 +1,19 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Light/2stars.svg b/www/rompr/iconsets/Modern-Light/2stars.svg new file mode 100644 index 0000000..a66dbd1 --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/2stars.svg @@ -0,0 +1,19 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Light/3stars.svg b/www/rompr/iconsets/Modern-Light/3stars.svg new file mode 100644 index 0000000..a28ede7 --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/3stars.svg @@ -0,0 +1,19 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Light/4stars.svg b/www/rompr/iconsets/Modern-Light/4stars.svg new file mode 100644 index 0000000..81e38cb --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/4stars.svg @@ -0,0 +1,19 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Light/5stars.svg b/www/rompr/iconsets/Modern-Light/5stars.svg new file mode 100644 index 0000000..8f4923e --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/5stars.svg @@ -0,0 +1,19 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Light/aac-audio.svg b/www/rompr/iconsets/Modern-Light/aac-audio.svg new file mode 100644 index 0000000..65ed660 --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/aac-audio.svg @@ -0,0 +1,89 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Light/add.svg b/www/rompr/iconsets/Modern-Light/add.svg new file mode 100644 index 0000000..1d8833e --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/add.svg @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Light/adjustments.css b/www/rompr/iconsets/Modern-Light/adjustments.css new file mode 100644 index 0000000..00cbc6a --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/adjustments.css @@ -0,0 +1,246 @@ +#buttons +{ + padding-left:12px; + padding-right:12px; + padding-top:4px; + padding-bottom:6px; +} + +.controlbutton +{ + margin:0px; + padding:0px; + vertical-align:middle; + display:inline-block; + width:56px; + height:56px; +} + +.controlbutton-small +{ + margin:0px; + vertical-align:middle; + display:inline-block; + width:48px; + height:48px; +} + +@media screen and (min-height: 800px) and (max-height: 939px) { + .controlbutton { + width:64px; + height:64px; + } + #buttons { + padding-top:12px; + } + #playbackTime { + margin-top:2px; + font-size:12px; + line-height:14px; + height:14px; + } +} + +@media screen and (min-height: 940px) and (max-height: 1099px) and (min-width: 650px) { + .controlbutton { + width:84px; + height:84px; + } + + .controlbutton-small { + width:64px; + height:64px; + } + + .shiftleft + { + left:-12px; + position:relative; + z-index:250; + } + + .shiftleft2 + { + left:-26px; + position:relative; + } + + .shiftleft3 + { + position:relative; + left:-36px; + z-index:5; + } + + .shiftleft4 + { + position:relative; + left:-48px; + z-index:1; + margin-right:-36px; + } + +} + +@media screen and (min-height: 940px) and (max-height: 1099px) and (min-width: 650px) { + .controlbutton { + width:84px; + height:84px; + } + .controlbutton-small { + width:64px; + height:64px; + } + #buttons { + padding-top:16px; + padding-left:24px; + } + #playbackTime { + margin-top:4px; + font-size:14px; + line-height:16px; + height:16px; + } + .shiftleft + { + left:-12px; + position:relative; + z-index:250; + } + + .shiftleft2 + { + left:-26px; + position:relative; + } + + .shiftleft3 + { + position:relative; + left:-36px; + z-index:5; + } + + .shiftleft4 + { + position:relative; + left:-48px; + z-index:1; + margin-right:-36px; + } +} + +@media screen and (min-height: 1100px) and (min-width: 651px) and (max-width: 749px) { + .controlbutton { + width:84px; + height:84px; + } + .controlbutton-small { + width:64px; + height:64px; + } + #buttons { + padding-top:16px; + padding-left:24px; + } + #playbackTime { + margin-top:4px; + font-size:14px; + line-height:16px; + height:16px; + } + .shiftleft + { + left:-12px; + position:relative; + z-index:250; + } + + .shiftleft2 + { + left:-26px; + position:relative; + } + + .shiftleft3 + { + position:relative; + left:-36px; + z-index:5; + } + + .shiftleft4 + { + position:relative; + left:-48px; + z-index:1; + margin-right:-36px; + } +} + +@media screen and (min-height: 1100px) and (min-width: 720px) { + .controlbutton { + width:90px; + height:90px; + } + .controlbutton-small { + width:70px; + height:70px; + } + #buttons { + padding-top:12px; + padding-left:20px; + } + #progress { + margin-top:8px; + } + #playbackTime { + margin-top:12px; + font-size:16px; + line-height:18px; + height:18px; + } + .shiftleft + { + left:-10px; + position:relative; + z-index:250; + } + + .shiftleft2 + { + left:-22px; + position:relative; + } + + .shiftleft3 + { + position:relative; + left:-34px; + z-index:5; + } + + .shiftleft4 + { + position:relative; + left:-44px; + z-index:1; + margin-right:-36px; + } +} + +.shiftleft +{ +} + +.shiftleft2 +{ +} + +.shiftleft3 +{ +} + +.shiftleft4 +{ +} diff --git a/www/rompr/iconsets/Modern-Light/alarmclock_false.svg b/www/rompr/iconsets/Modern-Light/alarmclock_false.svg new file mode 100644 index 0000000..8d0da24 --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/alarmclock_false.svg @@ -0,0 +1,64 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Modern-Light/alarmclock_true.svg b/www/rompr/iconsets/Modern-Light/alarmclock_true.svg new file mode 100644 index 0000000..4a8a161 --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/alarmclock_true.svg @@ -0,0 +1,65 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Modern-Light/allmusic-logo.svg b/www/rompr/iconsets/Modern-Light/allmusic-logo.svg new file mode 100644 index 0000000..cda87ed --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/allmusic-logo.svg @@ -0,0 +1,73 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Modern-Light/arrow-decrease.svg b/www/rompr/iconsets/Modern-Light/arrow-decrease.svg new file mode 100644 index 0000000..00f11aa --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/arrow-decrease.svg @@ -0,0 +1,67 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Modern-Light/arrow-increase.svg b/www/rompr/iconsets/Modern-Light/arrow-increase.svg new file mode 100644 index 0000000..2b4ccbb --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/arrow-increase.svg @@ -0,0 +1,66 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Modern-Light/arrow-left-double.svg b/www/rompr/iconsets/Modern-Light/arrow-left-double.svg new file mode 100644 index 0000000..18a4c1d --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/arrow-left-double.svg @@ -0,0 +1,69 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Modern-Light/arrow-right-double.svg b/www/rompr/iconsets/Modern-Light/arrow-right-double.svg new file mode 100644 index 0000000..c946fc1 --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/arrow-right-double.svg @@ -0,0 +1,69 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Modern-Light/arrow-updown.svg b/www/rompr/iconsets/Modern-Light/arrow-updown.svg new file mode 100644 index 0000000..137284a --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/arrow-updown.svg @@ -0,0 +1,54 @@ + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Light/artist-icon.png b/www/rompr/iconsets/Modern-Light/artist-icon.png new file mode 100644 index 0000000..60100f5 Binary files /dev/null and b/www/rompr/iconsets/Modern-Light/artist-icon.png differ diff --git a/www/rompr/iconsets/Modern-Light/audiobook.svg b/www/rompr/iconsets/Modern-Light/audiobook.svg new file mode 100644 index 0000000..fc7b3cf --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/audiobook.svg @@ -0,0 +1,78 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Modern-Light/backbutton.svg b/www/rompr/iconsets/Modern-Light/backbutton.svg new file mode 100644 index 0000000..326a309 --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/backbutton.svg @@ -0,0 +1,63 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Modern-Light/bbc-logo.svg b/www/rompr/iconsets/Modern-Light/bbc-logo.svg new file mode 100644 index 0000000..bcc60f5 --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/bbc-logo.svg @@ -0,0 +1,23 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Light/blobdown3-hi.svg b/www/rompr/iconsets/Modern-Light/blobdown3-hi.svg new file mode 100644 index 0000000..217a9c0 --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/blobdown3-hi.svg @@ -0,0 +1,43 @@ + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Light/blobdown3.svg b/www/rompr/iconsets/Modern-Light/blobdown3.svg new file mode 100644 index 0000000..6469ee1 --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/blobdown3.svg @@ -0,0 +1,43 @@ + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Light/broadcast-new.svg b/www/rompr/iconsets/Modern-Light/broadcast-new.svg new file mode 100644 index 0000000..addd54f --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/broadcast-new.svg @@ -0,0 +1,64 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Modern-Light/calendar.svg b/www/rompr/iconsets/Modern-Light/calendar.svg new file mode 100644 index 0000000..f5544ca --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/calendar.svg @@ -0,0 +1,103 @@ + + + + Svg Vector Icons : http://www.onlinewebfonts.com/icon image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Modern-Light/cd_case.svg b/www/rompr/iconsets/Modern-Light/cd_case.svg new file mode 100644 index 0000000..35b0b21 --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/cd_case.svg @@ -0,0 +1,65 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Modern-Light/collection.svg b/www/rompr/iconsets/Modern-Light/collection.svg new file mode 100644 index 0000000..a6c423a --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/collection.svg @@ -0,0 +1,122 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Light/compact-disc.svg b/www/rompr/iconsets/Modern-Light/compact-disc.svg new file mode 100644 index 0000000..7fcf6bf --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/compact-disc.svg @@ -0,0 +1,111 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Modern-Light/consume.svg b/www/rompr/iconsets/Modern-Light/consume.svg new file mode 100644 index 0000000..429e933 --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/consume.svg @@ -0,0 +1,60 @@ + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Light/consume_off.svg b/www/rompr/iconsets/Modern-Light/consume_off.svg new file mode 100644 index 0000000..d60b4ed --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/consume_off.svg @@ -0,0 +1,60 @@ + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Light/crossfade.svg b/www/rompr/iconsets/Modern-Light/crossfade.svg new file mode 100644 index 0000000..7628b36 --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/crossfade.svg @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Light/crossfade_off.svg b/www/rompr/iconsets/Modern-Light/crossfade_off.svg new file mode 100644 index 0000000..8cb00ba --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/crossfade_off.svg @@ -0,0 +1,61 @@ + + + + + + + + image/svg+xml + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Light/dialog-error.svg b/www/rompr/iconsets/Modern-Light/dialog-error.svg new file mode 100644 index 0000000..b084bef --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/dialog-error.svg @@ -0,0 +1,64 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Modern-Light/dialog-information.svg b/www/rompr/iconsets/Modern-Light/dialog-information.svg new file mode 100644 index 0000000..37df018 --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/dialog-information.svg @@ -0,0 +1,88 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Modern-Light/dirble-logo.svg b/www/rompr/iconsets/Modern-Light/dirble-logo.svg new file mode 100644 index 0000000..43da19b --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/dirble-logo.svg @@ -0,0 +1,204 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Light/discogs-logo.svg b/www/rompr/iconsets/Modern-Light/discogs-logo.svg new file mode 100644 index 0000000..4855d04 --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/discogs-logo.svg @@ -0,0 +1,103 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Modern-Light/document-save.svg b/www/rompr/iconsets/Modern-Light/document-save.svg new file mode 100644 index 0000000..b97fe11 --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/document-save.svg @@ -0,0 +1,65 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Modern-Light/download-icon.svg b/www/rompr/iconsets/Modern-Light/download-icon.svg new file mode 100644 index 0000000..125665d --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/download-icon.svg @@ -0,0 +1,76 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Modern-Light/edit-clear-list.svg b/www/rompr/iconsets/Modern-Light/edit-clear-list.svg new file mode 100644 index 0000000..47c1cab --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/edit-clear-list.svg @@ -0,0 +1,73 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Modern-Light/edit-delete.svg b/www/rompr/iconsets/Modern-Light/edit-delete.svg new file mode 100644 index 0000000..6a798a9 --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/edit-delete.svg @@ -0,0 +1,64 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Modern-Light/expand-up.svg b/www/rompr/iconsets/Modern-Light/expand-up.svg new file mode 100644 index 0000000..4264700 --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/expand-up.svg @@ -0,0 +1,146 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Light/facebook-logo.svg b/www/rompr/iconsets/Modern-Light/facebook-logo.svg new file mode 100644 index 0000000..58525c2 --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/facebook-logo.svg @@ -0,0 +1,97 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Light/file.svg b/www/rompr/iconsets/Modern-Light/file.svg new file mode 100644 index 0000000..7f8601f --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/file.svg @@ -0,0 +1,65 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Modern-Light/flac-audio.svg b/www/rompr/iconsets/Modern-Light/flac-audio.svg new file mode 100644 index 0000000..50a7f0b --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/flac-audio.svg @@ -0,0 +1,103 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Light/folder.svg b/www/rompr/iconsets/Modern-Light/folder.svg new file mode 100644 index 0000000..678673e --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/folder.svg @@ -0,0 +1,67 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Modern-Light/forwardbutton.svg b/www/rompr/iconsets/Modern-Light/forwardbutton.svg new file mode 100644 index 0000000..3b573c4 --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/forwardbutton.svg @@ -0,0 +1,63 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Modern-Light/gmusic-logo.svg b/www/rompr/iconsets/Modern-Light/gmusic-logo.svg new file mode 100644 index 0000000..b9a66e6 --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/gmusic-logo.svg @@ -0,0 +1,67 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Modern-Light/headphones.svg b/www/rompr/iconsets/Modern-Light/headphones.svg new file mode 100644 index 0000000..41b1698 --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/headphones.svg @@ -0,0 +1,69 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Modern-Light/icon-new.svg b/www/rompr/iconsets/Modern-Light/icon-new.svg new file mode 100644 index 0000000..96e297f --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/icon-new.svg @@ -0,0 +1,67 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Modern-Light/imdb-logo.svg b/www/rompr/iconsets/Modern-Light/imdb-logo.svg new file mode 100644 index 0000000..fbadd4d --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/imdb-logo.svg @@ -0,0 +1,472 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Light/internetarchive-logo.svg b/www/rompr/iconsets/Modern-Light/internetarchive-logo.svg new file mode 100644 index 0000000..d42d4d7 --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/internetarchive-logo.svg @@ -0,0 +1,389 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Light/lastfm-ban.svg b/www/rompr/iconsets/Modern-Light/lastfm-ban.svg new file mode 100644 index 0000000..9108f5d --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/lastfm-ban.svg @@ -0,0 +1,64 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Modern-Light/lastfm-love.svg b/www/rompr/iconsets/Modern-Light/lastfm-love.svg new file mode 100644 index 0000000..3c82b08 --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/lastfm-love.svg @@ -0,0 +1,81 @@ + + + + + + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Light/lastfm-unlove.svg b/www/rompr/iconsets/Modern-Light/lastfm-unlove.svg new file mode 100644 index 0000000..a1e0145 --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/lastfm-unlove.svg @@ -0,0 +1,64 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Modern-Light/lastfm.svg b/www/rompr/iconsets/Modern-Light/lastfm.svg new file mode 100644 index 0000000..cf903fd --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/lastfm.svg @@ -0,0 +1,64 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Modern-Light/lyrics.svg b/www/rompr/iconsets/Modern-Light/lyrics.svg new file mode 100644 index 0000000..7cedf55 --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/lyrics.svg @@ -0,0 +1,64 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Modern-Light/media-playback-pause.svg b/www/rompr/iconsets/Modern-Light/media-playback-pause.svg new file mode 100644 index 0000000..07c96c9 --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/media-playback-pause.svg @@ -0,0 +1,115 @@ + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Light/media-playback-start.svg b/www/rompr/iconsets/Modern-Light/media-playback-start.svg new file mode 100644 index 0000000..f73025a --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/media-playback-start.svg @@ -0,0 +1,110 @@ + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Light/media-playback-stop.svg b/www/rompr/iconsets/Modern-Light/media-playback-stop.svg new file mode 100644 index 0000000..f35b0d9 --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/media-playback-stop.svg @@ -0,0 +1,109 @@ + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Light/media-skip-backward.svg b/www/rompr/iconsets/Modern-Light/media-skip-backward.svg new file mode 100644 index 0000000..bc5d403 --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/media-skip-backward.svg @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Light/media-skip-forward.svg b/www/rompr/iconsets/Modern-Light/media-skip-forward.svg new file mode 100644 index 0000000..3723450 --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/media-skip-forward.svg @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Light/movie-1.svg b/www/rompr/iconsets/Modern-Light/movie-1.svg new file mode 100644 index 0000000..508255d --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/movie-1.svg @@ -0,0 +1,3 @@ + + +image/svg+xml diff --git a/www/rompr/iconsets/Modern-Light/mp3-audio.svg b/www/rompr/iconsets/Modern-Light/mp3-audio.svg new file mode 100644 index 0000000..805f083 --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/mp3-audio.svg @@ -0,0 +1,56 @@ + + + + + + + + image/svg+xml + + + + + + + diff --git a/www/rompr/iconsets/Modern-Light/musicbrainz_logo.svg b/www/rompr/iconsets/Modern-Light/musicbrainz_logo.svg new file mode 100644 index 0000000..65dc0bd --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/musicbrainz_logo.svg @@ -0,0 +1,210 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Light/neverheard.png b/www/rompr/iconsets/Modern-Light/neverheard.png new file mode 100644 index 0000000..c9a3f4e Binary files /dev/null and b/www/rompr/iconsets/Modern-Light/neverheard.png differ diff --git a/www/rompr/iconsets/Modern-Light/ogg-audio.svg b/www/rompr/iconsets/Modern-Light/ogg-audio.svg new file mode 100644 index 0000000..9dbc14b --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/ogg-audio.svg @@ -0,0 +1,478 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Vorbis + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Light/output.svg b/www/rompr/iconsets/Modern-Light/output.svg new file mode 100644 index 0000000..2c2e447 --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/output.svg @@ -0,0 +1,2 @@ + +image/svg+xml diff --git a/www/rompr/iconsets/Modern-Light/output_mute.svg b/www/rompr/iconsets/Modern-Light/output_mute.svg new file mode 100644 index 0000000..5e9dfd5 --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/output_mute.svg @@ -0,0 +1,2 @@ + +image/svg+xml diff --git a/www/rompr/iconsets/Modern-Light/parental-advisory.svg b/www/rompr/iconsets/Modern-Light/parental-advisory.svg new file mode 100644 index 0000000..6cd249e --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/parental-advisory.svg @@ -0,0 +1,82 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Light/playlist.svg b/www/rompr/iconsets/Modern-Light/playlist.svg new file mode 100644 index 0000000..3f8a48f --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/playlist.svg @@ -0,0 +1,94 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Modern-Light/podcast-logo.svg b/www/rompr/iconsets/Modern-Light/podcast-logo.svg new file mode 100644 index 0000000..f40f1f3 --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/podcast-logo.svg @@ -0,0 +1,63 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Modern-Light/preferences.svg b/www/rompr/iconsets/Modern-Light/preferences.svg new file mode 100644 index 0000000..b657889 --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/preferences.svg @@ -0,0 +1,102 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Modern-Light/pushbutton.svg b/www/rompr/iconsets/Modern-Light/pushbutton.svg new file mode 100644 index 0000000..09aede1 --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/pushbutton.svg @@ -0,0 +1,102 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Modern-Light/random.svg b/www/rompr/iconsets/Modern-Light/random.svg new file mode 100644 index 0000000..6f626ea --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/random.svg @@ -0,0 +1,115 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Light/random_off.svg b/www/rompr/iconsets/Modern-Light/random_off.svg new file mode 100644 index 0000000..621c68c --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/random_off.svg @@ -0,0 +1,116 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Light/ratandtag.svg b/www/rompr/iconsets/Modern-Light/ratandtag.svg new file mode 100644 index 0000000..df20e11 --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/ratandtag.svg @@ -0,0 +1,84 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Light/ratortag.svg b/www/rompr/iconsets/Modern-Light/ratortag.svg new file mode 100644 index 0000000..e4443e2 --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/ratortag.svg @@ -0,0 +1,85 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Light/refresh.svg b/www/rompr/iconsets/Modern-Light/refresh.svg new file mode 100644 index 0000000..819d335 --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/refresh.svg @@ -0,0 +1,67 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Modern-Light/refresh_off.svg b/www/rompr/iconsets/Modern-Light/refresh_off.svg new file mode 100644 index 0000000..0c0c832 --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/refresh_off.svg @@ -0,0 +1,60 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Modern-Light/resize.svg b/www/rompr/iconsets/Modern-Light/resize.svg new file mode 100644 index 0000000..c0c6fa3 --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/resize.svg @@ -0,0 +1,64 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Modern-Light/rss.svg b/www/rompr/iconsets/Modern-Light/rss.svg new file mode 100644 index 0000000..bf9fd31 --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/rss.svg @@ -0,0 +1,122 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Light/shuffle.png b/www/rompr/iconsets/Modern-Light/shuffle.png new file mode 100644 index 0000000..758aec2 Binary files /dev/null and b/www/rompr/iconsets/Modern-Light/shuffle.png differ diff --git a/www/rompr/iconsets/Modern-Light/singlestar.svg b/www/rompr/iconsets/Modern-Light/singlestar.svg new file mode 100644 index 0000000..377c84f --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/singlestar.svg @@ -0,0 +1,31 @@ + + + + + + + image/svg+xml + + + + + + + diff --git a/www/rompr/iconsets/Modern-Light/sleep.png b/www/rompr/iconsets/Modern-Light/sleep.png new file mode 100644 index 0000000..81196ae Binary files /dev/null and b/www/rompr/iconsets/Modern-Light/sleep.png differ diff --git a/www/rompr/iconsets/Modern-Light/sliders.svg b/www/rompr/iconsets/Modern-Light/sliders.svg new file mode 100644 index 0000000..35028b3 --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/sliders.svg @@ -0,0 +1,21 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Light/smartradio.svg b/www/rompr/iconsets/Modern-Light/smartradio.svg new file mode 100644 index 0000000..8fd11ea --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/smartradio.svg @@ -0,0 +1,64 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Modern-Light/soundcloud-logo.svg b/www/rompr/iconsets/Modern-Light/soundcloud-logo.svg new file mode 100644 index 0000000..c734ca5 --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/soundcloud-logo.svg @@ -0,0 +1,87 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Modern-Light/spinner.svg b/www/rompr/iconsets/Modern-Light/spinner.svg new file mode 100644 index 0000000..c458a73 --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/spinner.svg @@ -0,0 +1,64 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Modern-Light/spotify-logo.svg b/www/rompr/iconsets/Modern-Light/spotify-logo.svg new file mode 100644 index 0000000..ecff001 --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/spotify-logo.svg @@ -0,0 +1,64 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Modern-Light/stopafter-highlight.svg b/www/rompr/iconsets/Modern-Light/stopafter-highlight.svg new file mode 100644 index 0000000..44c88b4 --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/stopafter-highlight.svg @@ -0,0 +1,116 @@ + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Light/stopafter.svg b/www/rompr/iconsets/Modern-Light/stopafter.svg new file mode 100644 index 0000000..44c88b4 --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/stopafter.svg @@ -0,0 +1,116 @@ + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Light/system-search.svg b/www/rompr/iconsets/Modern-Light/system-search.svg new file mode 100644 index 0000000..98a6d40 --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/system-search.svg @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/www/rompr/iconsets/Modern-Light/tag.svg b/www/rompr/iconsets/Modern-Light/tag.svg new file mode 100644 index 0000000..18fcf82 --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/tag.svg @@ -0,0 +1,64 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Modern-Light/theme.css b/www/rompr/iconsets/Modern-Light/theme.css new file mode 100644 index 0000000..8f5cdd5 --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/theme.css @@ -0,0 +1,239 @@ + + [class^="icon-"], [class*=" icon-"] { + background-size:contain; + background-position: center; + background-repeat:no-repeat; + display:inline-block; +} + +.button-disabled { opacity: 0.1 } + +.clearbox { + background-image: url('iconsets/Modern-Light/edit-delete.svg'); + /* dont change the 50%, it ties in with makeHoverWork, makeClearWork, and makeTagMenu */ + background-size: auto 50%; + background-position: right 2px center; + background-repeat: no-repeat; +} + +.combobox-entry, .selectholder { + background-image: url('iconsets/Modern-Light/blobdown3.svg'); + /* dont change the 50%, it ties in with makeHoverWork, makeClearWork, and makeTagMenu */ + background-size: auto 50%; + background-position: right 2px center; + background-repeat: no-repeat; +} + +.combobox-entry:hover, .selectholder:hover { + background-image: url('iconsets/Modern-Light/blobdown3-hi.svg'); + /* dont change the 50%, it ties in with makeHoverWork, makeClearWork, and makeTagMenu */ + background-size: auto 50%; + background-position: right 2px center; + background-repeat: no-repeat; +} + +.combo-button { + background-image: url('iconsets/Modern-Light/blobdown3.svg'); +} + +.icon-play-circled { background-image :url('iconsets/Modern-Light/media-playback-start.svg') } +.playdiv { background-image :url('iconsets/Modern-Light/media-playback-start.svg') } +.icon-pause-circled { background-image :url('iconsets/Modern-Light/media-playback-pause.svg') } +.icon-fast-backward { background-image :url('iconsets/Modern-Light/media-skip-backward.svg') } +.icon-fast-forward { background-image :url('iconsets/Modern-Light/media-skip-forward.svg') } +.icon-stop-1 { background-image :url('iconsets/Modern-Light/media-playback-stop.svg') } +.icon-to-end-1 { background-image :url('iconsets/Modern-Light/stopafter.svg') } + +.icon-music { background-image: url('iconsets/Modern-Light/collection.svg') } +.icon-search { background-image: url('iconsets/Modern-Light/system-search.svg') } +.icon-folder-open-empty { background-image: url('iconsets/Modern-Light/folder.svg') } +.icon-radio-tower { background-image: url('iconsets/Modern-Light/broadcast-new.svg') } +.icon-cd { background-image: url('iconsets/Modern-Light/cd_case.svg') } +.icon-resize-horizontal { background-image: url('iconsets/Modern-Light/resize.svg') } +.icon-angle-double-left { background-image:url('iconsets/Modern-Light/arrow-left-double.svg') } +.icon-angle-double-right { background-image:url('iconsets/Modern-Light/arrow-right-double.svg') } +.icon-menu { background-image: url('iconsets/Modern-Light/pushbutton.svg') } +.icon-versions { background-image: url('iconsets/Modern-Light/history.svg') } +.icon-left-circled { background-image: url('iconsets/Modern-Light/backbutton.svg') } +.icon-right-circled { background-image: url('iconsets/Modern-Light/forwardbutton.svg') } +.icon-cog-alt { background-image: url('iconsets/Modern-Light/preferences.svg') } +.icon-trash { background-image: url('iconsets/Modern-Light/edit-clear-list.svg') } +.icon-wifi { background-image: url('iconsets/Modern-Light/smartradio.svg') } +.icon-doc-text { background-image: url('iconsets/Modern-Light/playlist.svg') } +.icon-floppy { background-image: url('iconsets/Modern-Light/document-save.svg') } +.icon-cancel-circled { background-image: url('iconsets/Modern-Light/edit-delete.svg') } +.icon-plus { + background-image: url('iconsets/Modern-Light/add.svg'); + opacity:0.9; +} +.icon-alarm { background-image: url('iconsets/Modern-Light/alarmclock_false.svg') } +.icon-alarm-on { background-image: url('iconsets/Modern-Light/alarmclock_true.svg') } +.icon-sleep { background-image: url('iconsets/Modern-Light/sleep.png') } +.icon-library { background-image: url('iconsets/Modern-Light/file.svg') } +.icon-lastfm-1 { background-image: url('iconsets/Modern-Light/lastfm.svg') } +.icon-wikipedia { background-image: url('iconsets/Modern-Light/wikipedia-logo.svg') } +.icon-musicbrainz { background-image: url('iconsets/Modern-Light/musicbrainz_logo.svg') } +.icon-discogs { background-image: url('iconsets/Modern-Light/discogs-logo.svg') } +.icon-doc-text-1 { background-image: url('iconsets/Modern-Light/lyrics.svg') } +.icon-soundcloud-circled { background-image: url('iconsets/Modern-Light/soundcloud-logo.svg') } +.icon-youtube-circled { background-image: url('iconsets/Modern-Light/youtube-logo.svg') } +.icon-gmusic-circled { background-image: url('iconsets/Modern-Light/gmusic-logo.svg') } +.icon-spotify-circled { background-image: url('iconsets/Modern-Light/spotify-logo.svg') } +.icon-vkontakte-circled { background-image: url('iconsets/Modern-Light/vkontakte-logo.svg') } +.icon-podcast-circled { background-image: url('iconsets/Modern-Light/podcast-logo.svg') } +.icon-audiobook { background-image: url('iconsets/Modern-Light/audiobook.svg') } +.icon-internetarchive-circled { background-image: url('iconsets/Modern-Light/internetarchive-logo.svg') } +.icon-increase { background-image: url('iconsets/Modern-Light/arrow-increase.svg') } +.icon-decrease { background-image: url('iconsets/Modern-Light/arrow-decrease.svg') } +.icon-attention-1 { background-image: url('iconsets/Modern-Light/dialog-error.svg') } +.icon-info-circled { background-image: url('iconsets/Modern-Light/dialog-information.svg') } +.icon-download { background-image: url('iconsets/Modern-Light/download-icon.svg') } +.icon-sun { background-image: url('iconsets/Modern-Light/icon-new.svg') } +.icon-headphones { background-image: url('iconsets/Modern-Light/headphones.svg') } +.icon-unlistened { background-image: url('iconsets/Modern-Light/headphones.svg') } +.icon-block { background-image: url('iconsets/Modern-Light/lastfm-ban.svg') } +.icon-heart { background-image: url('iconsets/Modern-Light/lastfm-love.svg') } +.icon-heart-broken { background-image: url('iconsets/Modern-Light/lastfm-unlove.svg') } +.icon-refresh { background-image: url('iconsets/Modern-Light/refresh.svg') } +.icon-dirble-circled { background-image: url('iconsets/Modern-Light/dirble-logo.svg') } +.icon-tunein { background-image: url('iconsets/Modern-Light/../../newimages/tunein-logo.svg') } +.icon-no-response-playbutton { background-image :url('iconsets/Modern-Light/media-playback-start.svg') } +.icon-tags { background-image: url('iconsets/Modern-Light/tag.svg') } +.icon-volume-up { background-image: url('iconsets/Modern-Light/volume.svg') } +.icon-toggle-open { background-image: url('iconsets/Modern-Light/toggle-open.svg') } +.icon-toggle-closed { background-image: url('iconsets/Modern-Light/toggle-closed.svg') } +.icon-spin6 { background-image: url('iconsets/Modern-Light/spinner.svg') } +.icon-output { background-image: url('iconsets/Modern-Light/output.svg') } +.icon-output-mute { background-image: url('iconsets/Modern-Light/output_mute.svg') } +.icon-sliders { background-image: url('iconsets/Modern-Light/sliders.svg') } +.icon-0-stars { background-image: url('iconsets/Modern-Light/0stars.svg') } +.icon-1-stars { background-image: url('iconsets/Modern-Light/1stars.svg') } +.icon-2-stars { background-image: url('iconsets/Modern-Light/2stars.svg') } +.icon-3-stars { background-image: url('iconsets/Modern-Light/3stars.svg') } +.icon-4-stars { background-image: url('iconsets/Modern-Light/4stars.svg') } +.icon-5-stars { background-image: url('iconsets/Modern-Light/5stars.svg') } +.icon-single-star { background-image: url('iconsets/Modern-Light/singlestar.svg') } +.icon-ratandtag { background-image: url('iconsets/Modern-Light/ratandtag.svg') } +.icon-ratortag { background-image: url('iconsets/Modern-Light/ratortag.svg') } +.icon-toggle-on { background-image: url('iconsets/Modern-Light/togglebutton-new2-on.svg') } +.icon-toggle-off { background-image: url('iconsets/Modern-Light/togglebutton-new2-off.svg') } + +.icon-random.flow-on { background-image: url('iconsets/Modern-Light/random.svg') } +.icon-random.flow-off { background-image: url('iconsets/Modern-Light/random_off.svg') } +.icon-crossfade.flow-on { background-image: url('iconsets/Modern-Light/crossfade.svg') } +.icon-crossfade.flow-off { background-image: url('iconsets/Modern-Light/crossfade_off.svg') } +.icon-repeat.flow-on { background-image: url('iconsets/Modern-Light/refresh.svg') } +.icon-repeat.flow-off { background-image: url('iconsets/Modern-Light/refresh_off.svg') } +.icon-consume.flow-on { background-image: url('iconsets/Modern-Light/consume.svg') } +.icon-consume.flow-off { background-image: url('iconsets/Modern-Light/consume_off.svg') } + +.icon-allrandom { background-image: url('iconsets/Modern-Light/shuffle.png') } +.icon-neverplayed { background-image: url('iconsets/Modern-Light/neverheard.png') } +.icon-recentlyplayed { background-image: url('iconsets/Modern-Light/calendar.svg') } +.icon-artist { background-image: url('iconsets/Modern-Light/artist-icon.png') } +.icon-mp3-audio { background-image: url('iconsets/Modern-Light/mp3-audio.svg') } +.icon-aac-audio { background-image: url('iconsets/Modern-Light/aac-audio.svg') } +.icon-flac-audio { background-image: url('iconsets/Modern-Light/flac-audio.svg') } +.icon-wma-audio { background-image: url('iconsets/Modern-Light/wma-audio.svg') } +.icon-ogg-audio { background-image: url('iconsets/Modern-Light/ogg-audio.svg') } +.icon-explicit { background-image: url('iconsets/Modern-Light/parental-advisory.svg') } +.icon-expand-up { background-image: url('iconsets/Modern-Light/expand-up.svg') } +.icon-rss { background-image: url('iconsets/Modern-Light/rss.svg') } +.icon-tick { background-image: url('iconsets/Modern-Light/tick.svg') } +.icon-video { background-image: url('iconsets/Modern-Light/movie-1.svg') } +.icon-bbc-logo { background-image: url('iconsets/Modern-Light/bbc-logo.svg') } +.icon-imdb-logo { background-image: url('iconsets/Modern-Light/imdb-logo.svg') } +.icon-facebook-logo { background-image: url('iconsets/Modern-Light/facebook-logo.svg') } +.icon-twitter-logo { background-image: url('iconsets/Modern-Light/twitter-logo.svg') } +.icon-www { background-image: url('iconsets/Modern-Light/world-wide-web.svg') } +.icon-allmusic { background-image: url('iconsets/Modern-Light/allmusic-logo.svg') } +.icon-updown { background-image: url('iconsets/Modern-Light/arrow-updown.svg') } +.icon-snapcast { background-image: url('iconsets/Modern-Light/../../newimages/snapcast.png') } + +.styledinputs label +{ + display:inline-block; + cursor:pointer; + position:relative; + padding-left:2.5em; + line-height:1.5em; +} + +.styledinputs input[type=radio] +{ + display:none; +} + +.styledinputs input[type=checkbox] +{ + display:none; +} + +.styledinputs label:before +{ + content:""; + display:inline-block; + width:2em; + height:1.5em; + position:absolute; + left:0; + /* bottom:0.2em; */ + background-image: url('iconsets/Modern-Light/togglebutton-new2-off.svg'); + background-size:contain; + background-position: center; + background-repeat:no-repeat; +} + +.styledinputs input:checked + label:before +{ + background-image: url('iconsets/Modern-Light/togglebutton-new2-on.svg') !important; +} + +img.notexist,img.notfound +{ + background-image: url('iconsets/Modern-Light/compact-disc.svg'); + background-size:contain; + display:inline-block; + background-position:center; + background-repeat: no-repeat; +} + +img.stream.notfound, img.stream.notexist +{ + background-image: url('iconsets/Modern-Light/broadcast-new.svg'); +} + +img.plimage.notfound +{ + background-image: url('iconsets/Modern-Light/playlist.svg'); +} + +.backmenu +{ + background-image: url('iconsets/Modern-Light/arrow-left-double.svg'); + background-repeat: no-repeat; + background-size: contain; +} + +button.iconbutton { + height:2em; + width:2em; + background-size: contain; + background-position:center; + border: none !important; + opacity: 0.8; + background-color:transparent; +} + +button.iconbutton:hover { + opacity: 1; +} + +button.searchbutton { + background-image: url('iconsets/Modern-Light/system-search.svg'); +} + +button.rssbutton { + background-image: url('iconsets/Modern-Light/rss.svg'); +} + diff --git a/www/rompr/iconsets/Modern-Light/tick.svg b/www/rompr/iconsets/Modern-Light/tick.svg new file mode 100644 index 0000000..38b05c8 --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/tick.svg @@ -0,0 +1,155 @@ + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Light/toggle-closed.svg b/www/rompr/iconsets/Modern-Light/toggle-closed.svg new file mode 100644 index 0000000..69e63b9 --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/toggle-closed.svg @@ -0,0 +1,64 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Modern-Light/toggle-open.svg b/www/rompr/iconsets/Modern-Light/toggle-open.svg new file mode 100644 index 0000000..32f264d --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/toggle-open.svg @@ -0,0 +1,64 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Modern-Light/togglebutton-new2-off.svg b/www/rompr/iconsets/Modern-Light/togglebutton-new2-off.svg new file mode 100644 index 0000000..6ac75d3 --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/togglebutton-new2-off.svg @@ -0,0 +1,232 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Modern-Light/togglebutton-new2-on.svg b/www/rompr/iconsets/Modern-Light/togglebutton-new2-on.svg new file mode 100644 index 0000000..981529e --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/togglebutton-new2-on.svg @@ -0,0 +1,362 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Light/twitter-logo.svg b/www/rompr/iconsets/Modern-Light/twitter-logo.svg new file mode 100644 index 0000000..9e242e2 --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/twitter-logo.svg @@ -0,0 +1,385 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Light/unlistened.svg b/www/rompr/iconsets/Modern-Light/unlistened.svg new file mode 100644 index 0000000..97bd9a4 --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/unlistened.svg @@ -0,0 +1,64 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Modern-Light/vkontakte-logo.svg b/www/rompr/iconsets/Modern-Light/vkontakte-logo.svg new file mode 100644 index 0000000..6c07df4 --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/vkontakte-logo.svg @@ -0,0 +1,25 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Light/volume.svg b/www/rompr/iconsets/Modern-Light/volume.svg new file mode 100644 index 0000000..9556081 --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/volume.svg @@ -0,0 +1,76 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Modern-Light/wikipedia-logo.svg b/www/rompr/iconsets/Modern-Light/wikipedia-logo.svg new file mode 100644 index 0000000..dbc8cb1 --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/wikipedia-logo.svg @@ -0,0 +1,64 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Modern-Light/wma-audio.svg b/www/rompr/iconsets/Modern-Light/wma-audio.svg new file mode 100644 index 0000000..1dafc59 --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/wma-audio.svg @@ -0,0 +1,112 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Light/world-wide-web.svg b/www/rompr/iconsets/Modern-Light/world-wide-web.svg new file mode 100644 index 0000000..fc50919 --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/world-wide-web.svg @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Modern-Light/youtube-logo.svg b/www/rompr/iconsets/Modern-Light/youtube-logo.svg new file mode 100644 index 0000000..9e99168 --- /dev/null +++ b/www/rompr/iconsets/Modern-Light/youtube-logo.svg @@ -0,0 +1,63 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/New-Cyan-Circled/0stars.svg b/www/rompr/iconsets/New-Cyan-Circled/0stars.svg new file mode 100644 index 0000000..158f566 --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/0stars.svg @@ -0,0 +1,19 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/1stars.svg b/www/rompr/iconsets/New-Cyan-Circled/1stars.svg new file mode 100644 index 0000000..1b63abc --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/1stars.svg @@ -0,0 +1,19 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/2stars.svg b/www/rompr/iconsets/New-Cyan-Circled/2stars.svg new file mode 100644 index 0000000..2c4d1f9 --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/2stars.svg @@ -0,0 +1,19 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/3stars.svg b/www/rompr/iconsets/New-Cyan-Circled/3stars.svg new file mode 100644 index 0000000..e50aaf8 --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/3stars.svg @@ -0,0 +1,19 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/4stars.svg b/www/rompr/iconsets/New-Cyan-Circled/4stars.svg new file mode 100644 index 0000000..6669dbb --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/4stars.svg @@ -0,0 +1,19 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/5stars.svg b/www/rompr/iconsets/New-Cyan-Circled/5stars.svg new file mode 100644 index 0000000..5fa0760 --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/5stars.svg @@ -0,0 +1,19 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/aac-audio.svg b/www/rompr/iconsets/New-Cyan-Circled/aac-audio.svg new file mode 100644 index 0000000..57e2428 --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/aac-audio.svg @@ -0,0 +1,89 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/add.svg b/www/rompr/iconsets/New-Cyan-Circled/add.svg new file mode 100644 index 0000000..dca9c1e --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/add.svg @@ -0,0 +1,50 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/adjustments.css b/www/rompr/iconsets/New-Cyan-Circled/adjustments.css new file mode 100644 index 0000000..9b93f77 --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/adjustments.css @@ -0,0 +1,230 @@ +#buttons +{ + padding-left:12px; + padding-right:12px; + padding-top:4px; + padding-bottom:6px; +} + +.controlbutton +{ + margin:0px; + padding:0px; + vertical-align:middle; + display:inline-block; + width:56px; + height:56px; +} + +.controlbutton-small +{ + margin:0px; + vertical-align:middle; + display:inline-block; + width:48px; + height:48px; +} + +@media screen and (min-height: 800px) and (max-height: 939px) { + .controlbutton { + width:64px; + height:64px; + } + #buttons { + padding-top:12px; + } + #playbackTime { + margin-top:2px; + font-size:12px; + line-height:14px; + height:14px; + } +} + +@media screen and (min-height: 940px) and (max-height: 1099px) and (min-width: 650px) { + .controlbutton { + width:84px; + height:84px; + } + + .controlbutton-small { + width:64px; + height:64px; + } + + .shiftleft + { + left:-12px; + position:relative; + z-index:250; + } + + .shiftleft2 + { + left:-26px; + position:relative; + } + + .shiftleft3 + { + position:relative; + left:-36px; + z-index:5; + } + + .shiftleft4 + { + position:relative; + left:-48px; + z-index:1; + margin-right:-36px; + } + +} + +@media screen and (min-height: 940px) and (max-height: 1099px) and (min-width: 650px) { + .controlbutton { + width:84px; + height:84px; + } + .controlbutton-small { + width:64px; + height:64px; + } + #buttons { + padding-top:16px; + padding-left:24px; + } + #playbackTime { + margin-top:4px; + font-size:14px; + line-height:16px; + height:16px; + } + .shiftleft + { + left:-12px; + position:relative; + z-index:250; + } + + .shiftleft2 + { + left:-24px; + position:relative; + } + + .shiftleft3 + { + position:relative; + left:-36px; + z-index:5; + } + + .shiftleft4 + { + position:relative; + left:-48px; + z-index:1; + margin-right:-36px; + } +} + +@media screen and (min-height: 1100px) and (min-width: 651px) and (max-width: 749px) { + .controlbutton { + width:84px; + height:84px; + } + .controlbutton-small { + width:64px; + height:64px; + } + #buttons { + padding-top:16px; + padding-left:24px; + } + #playbackTime { + margin-top:4px; + font-size:14px; + line-height:16px; + height:16px; + } + .shiftleft + { + left:-12px; + position:relative; + z-index:250; + } + + .shiftleft2 + { + left:-26px; + position:relative; + } + + .shiftleft3 + { + position:relative; + left:-36px; + z-index:5; + } + + .shiftleft4 + { + position:relative; + left:-48px; + z-index:1; + margin-right:-36px; + } +} + +@media screen and (min-height: 1100px) and (min-width: 720px) { + .controlbutton { + width:90px; + height:90px; + } + .controlbutton-small { + width:70px; + height:70px; + } + #buttons { + padding-top:12px; + padding-left:20px; + } + #progress { + margin-top:8px; + } + #playbackTime { + margin-top:12px; + font-size:16px; + line-height:18px; + height:18px; + } + .shiftleft + { + left:-10px; + position:relative; + z-index:250; + } + + .shiftleft2 + { + left:-22px; + position:relative; + } + + .shiftleft3 + { + position:relative; + left:-34px; + z-index:5; + } + + .shiftleft4 + { + position:relative; + left:-44px; + z-index:1; + margin-right:-36px; + } +} diff --git a/www/rompr/iconsets/New-Cyan-Circled/alarmclock_false.svg b/www/rompr/iconsets/New-Cyan-Circled/alarmclock_false.svg new file mode 100644 index 0000000..43523c2 --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/alarmclock_false.svg @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/alarmclock_true.svg b/www/rompr/iconsets/New-Cyan-Circled/alarmclock_true.svg new file mode 100644 index 0000000..1e5d092 --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/alarmclock_true.svg @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/allmusic-logo.svg b/www/rompr/iconsets/New-Cyan-Circled/allmusic-logo.svg new file mode 100644 index 0000000..7f6a7b7 --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/allmusic-logo.svg @@ -0,0 +1,390 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/arrow-decrease.svg b/www/rompr/iconsets/New-Cyan-Circled/arrow-decrease.svg new file mode 100644 index 0000000..625e5b8 --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/arrow-decrease.svg @@ -0,0 +1,80 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/arrow-increase.svg b/www/rompr/iconsets/New-Cyan-Circled/arrow-increase.svg new file mode 100644 index 0000000..3139125 --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/arrow-increase.svg @@ -0,0 +1,80 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/arrow-left-double.svg b/www/rompr/iconsets/New-Cyan-Circled/arrow-left-double.svg new file mode 100644 index 0000000..91e6d91 --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/arrow-left-double.svg @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/arrow-right-double.svg b/www/rompr/iconsets/New-Cyan-Circled/arrow-right-double.svg new file mode 100644 index 0000000..858d0e0 --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/arrow-right-double.svg @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/arrow-updown.svg b/www/rompr/iconsets/New-Cyan-Circled/arrow-updown.svg new file mode 100644 index 0000000..1fd7216 --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/arrow-updown.svg @@ -0,0 +1,82 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/artist-icon.svg b/www/rompr/iconsets/New-Cyan-Circled/artist-icon.svg new file mode 100644 index 0000000..aa5fb63 --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/artist-icon.svg @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/audiobook.svg b/www/rompr/iconsets/New-Cyan-Circled/audiobook.svg new file mode 100644 index 0000000..b301120 --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/audiobook.svg @@ -0,0 +1,215 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/backbutton.svg b/www/rompr/iconsets/New-Cyan-Circled/backbutton.svg new file mode 100644 index 0000000..7ae9035 --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/backbutton.svg @@ -0,0 +1,55 @@ + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/bbc-logo.svg b/www/rompr/iconsets/New-Cyan-Circled/bbc-logo.svg new file mode 100644 index 0000000..34f4d5b --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/bbc-logo.svg @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/blobdown3-hi.svg b/www/rompr/iconsets/New-Cyan-Circled/blobdown3-hi.svg new file mode 100644 index 0000000..dcb8ee7 --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/blobdown3-hi.svg @@ -0,0 +1,73 @@ + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/blobdown3.svg b/www/rompr/iconsets/New-Cyan-Circled/blobdown3.svg new file mode 100644 index 0000000..2c82bfa --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/blobdown3.svg @@ -0,0 +1,73 @@ + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/broadcast-new.svg b/www/rompr/iconsets/New-Cyan-Circled/broadcast-new.svg new file mode 100644 index 0000000..400836d --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/broadcast-new.svg @@ -0,0 +1,89 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/calendar.svg b/www/rompr/iconsets/New-Cyan-Circled/calendar.svg new file mode 100644 index 0000000..3bff91d --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/calendar.svg @@ -0,0 +1,188 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/cd_case.svg b/www/rompr/iconsets/New-Cyan-Circled/cd_case.svg new file mode 100644 index 0000000..16a6e8c --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/cd_case.svg @@ -0,0 +1,223 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/collection.svg b/www/rompr/iconsets/New-Cyan-Circled/collection.svg new file mode 100644 index 0000000..71e4cb3 --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/collection.svg @@ -0,0 +1,229 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/compact-disc.svg b/www/rompr/iconsets/New-Cyan-Circled/compact-disc.svg new file mode 100644 index 0000000..84ec54b --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/compact-disc.svg @@ -0,0 +1,61 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/New-Cyan-Circled/consume.svg b/www/rompr/iconsets/New-Cyan-Circled/consume.svg new file mode 100644 index 0000000..44435df --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/consume.svg @@ -0,0 +1,104 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/consume_off.svg b/www/rompr/iconsets/New-Cyan-Circled/consume_off.svg new file mode 100644 index 0000000..a16ea1d --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/consume_off.svg @@ -0,0 +1,104 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/crossfade.svg b/www/rompr/iconsets/New-Cyan-Circled/crossfade.svg new file mode 100644 index 0000000..c44975e --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/crossfade.svg @@ -0,0 +1,110 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/crossfade_off.svg b/www/rompr/iconsets/New-Cyan-Circled/crossfade_off.svg new file mode 100644 index 0000000..a3337ea --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/crossfade_off.svg @@ -0,0 +1,76 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/dialog-error.svg b/www/rompr/iconsets/New-Cyan-Circled/dialog-error.svg new file mode 100644 index 0000000..f3218d8 --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/dialog-error.svg @@ -0,0 +1,193 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/dialog-information.svg b/www/rompr/iconsets/New-Cyan-Circled/dialog-information.svg new file mode 100644 index 0000000..1c4d54a --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/dialog-information.svg @@ -0,0 +1,205 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/dirble-logo.svg b/www/rompr/iconsets/New-Cyan-Circled/dirble-logo.svg new file mode 100644 index 0000000..9f3de86 --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/dirble-logo.svg @@ -0,0 +1,211 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/discogs-logo.svg b/www/rompr/iconsets/New-Cyan-Circled/discogs-logo.svg new file mode 100644 index 0000000..f0369e5 --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/discogs-logo.svg @@ -0,0 +1,436 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/document-save.svg b/www/rompr/iconsets/New-Cyan-Circled/document-save.svg new file mode 100644 index 0000000..d42e26a --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/document-save.svg @@ -0,0 +1,239 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/download-icon.svg b/www/rompr/iconsets/New-Cyan-Circled/download-icon.svg new file mode 100644 index 0000000..d698e87 --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/download-icon.svg @@ -0,0 +1,216 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/edit-clear-list.svg b/www/rompr/iconsets/New-Cyan-Circled/edit-clear-list.svg new file mode 100644 index 0000000..f0e8038 --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/edit-clear-list.svg @@ -0,0 +1,265 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/edit-delete.svg b/www/rompr/iconsets/New-Cyan-Circled/edit-delete.svg new file mode 100644 index 0000000..7dbae19 --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/edit-delete.svg @@ -0,0 +1,50 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/expand-up.svg b/www/rompr/iconsets/New-Cyan-Circled/expand-up.svg new file mode 100644 index 0000000..349f310 --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/expand-up.svg @@ -0,0 +1,239 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/facebook-logo.svg b/www/rompr/iconsets/New-Cyan-Circled/facebook-logo.svg new file mode 100644 index 0000000..47a4de0 --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/facebook-logo.svg @@ -0,0 +1,79 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/file.svg b/www/rompr/iconsets/New-Cyan-Circled/file.svg new file mode 100644 index 0000000..0e2bfeb --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/file.svg @@ -0,0 +1,223 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/flac-audio.svg b/www/rompr/iconsets/New-Cyan-Circled/flac-audio.svg new file mode 100644 index 0000000..b7d1dd4 --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/flac-audio.svg @@ -0,0 +1,110 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/folder.svg b/www/rompr/iconsets/New-Cyan-Circled/folder.svg new file mode 100644 index 0000000..ea9ed73 --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/folder.svg @@ -0,0 +1,697 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/forwardbutton.svg b/www/rompr/iconsets/New-Cyan-Circled/forwardbutton.svg new file mode 100644 index 0000000..f15bee5 --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/forwardbutton.svg @@ -0,0 +1,59 @@ + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/gmusic-logo.svg b/www/rompr/iconsets/New-Cyan-Circled/gmusic-logo.svg new file mode 100644 index 0000000..3b76999 --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/gmusic-logo.svg @@ -0,0 +1,107 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/headphones.svg b/www/rompr/iconsets/New-Cyan-Circled/headphones.svg new file mode 100644 index 0000000..49a5ed3 --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/headphones.svg @@ -0,0 +1,668 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/icon-new.svg b/www/rompr/iconsets/New-Cyan-Circled/icon-new.svg new file mode 100644 index 0000000..2b40edd --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/icon-new.svg @@ -0,0 +1,670 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/imdb-logo.svg b/www/rompr/iconsets/New-Cyan-Circled/imdb-logo.svg new file mode 100644 index 0000000..a68dc9e --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/imdb-logo.svg @@ -0,0 +1,447 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/internetarchive-logo.svg b/www/rompr/iconsets/New-Cyan-Circled/internetarchive-logo.svg new file mode 100644 index 0000000..6f1fdf3 --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/internetarchive-logo.svg @@ -0,0 +1,368 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/lastfm-ban.svg b/www/rompr/iconsets/New-Cyan-Circled/lastfm-ban.svg new file mode 100644 index 0000000..d313c57 --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/lastfm-ban.svg @@ -0,0 +1,3 @@ + + +image/svg+xml diff --git a/www/rompr/iconsets/New-Cyan-Circled/lastfm-love.svg b/www/rompr/iconsets/New-Cyan-Circled/lastfm-love.svg new file mode 100644 index 0000000..1bbc7db --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/lastfm-love.svg @@ -0,0 +1,665 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/lastfm-unlove.svg b/www/rompr/iconsets/New-Cyan-Circled/lastfm-unlove.svg new file mode 100644 index 0000000..9830c60 --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/lastfm-unlove.svg @@ -0,0 +1,657 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/lastfm.svg b/www/rompr/iconsets/New-Cyan-Circled/lastfm.svg new file mode 100644 index 0000000..47ec0e5 --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/lastfm.svg @@ -0,0 +1,173 @@ + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/lyrics.svg b/www/rompr/iconsets/New-Cyan-Circled/lyrics.svg new file mode 100644 index 0000000..7d6f9e7 --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/lyrics.svg @@ -0,0 +1,657 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/media-playback-pause-highlight.svg b/www/rompr/iconsets/New-Cyan-Circled/media-playback-pause-highlight.svg new file mode 100644 index 0000000..7574be4 --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/media-playback-pause-highlight.svg @@ -0,0 +1,72 @@ + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/media-playback-pause.svg b/www/rompr/iconsets/New-Cyan-Circled/media-playback-pause.svg new file mode 100644 index 0000000..0d174be --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/media-playback-pause.svg @@ -0,0 +1,56 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/media-playback-start-highlight.svg b/www/rompr/iconsets/New-Cyan-Circled/media-playback-start-highlight.svg new file mode 100644 index 0000000..36039d3 --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/media-playback-start-highlight.svg @@ -0,0 +1,81 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/media-playback-start.svg b/www/rompr/iconsets/New-Cyan-Circled/media-playback-start.svg new file mode 100644 index 0000000..5405f52 --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/media-playback-start.svg @@ -0,0 +1,81 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/media-playback-stop-highlight.svg b/www/rompr/iconsets/New-Cyan-Circled/media-playback-stop-highlight.svg new file mode 100644 index 0000000..7659425 --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/media-playback-stop-highlight.svg @@ -0,0 +1,65 @@ + + + + + + + + image/svg+xml + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/media-playback-stop.svg b/www/rompr/iconsets/New-Cyan-Circled/media-playback-stop.svg new file mode 100644 index 0000000..a2feac5 --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/media-playback-stop.svg @@ -0,0 +1,45 @@ + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/media-skip-backward-highlight.svg b/www/rompr/iconsets/New-Cyan-Circled/media-skip-backward-highlight.svg new file mode 100644 index 0000000..290fc72 --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/media-skip-backward-highlight.svg @@ -0,0 +1,69 @@ + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/media-skip-backward.svg b/www/rompr/iconsets/New-Cyan-Circled/media-skip-backward.svg new file mode 100644 index 0000000..143d09e --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/media-skip-backward.svg @@ -0,0 +1,69 @@ + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/media-skip-forward-highlight.svg b/www/rompr/iconsets/New-Cyan-Circled/media-skip-forward-highlight.svg new file mode 100644 index 0000000..465b9c7 --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/media-skip-forward-highlight.svg @@ -0,0 +1,68 @@ + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/media-skip-forward.svg b/www/rompr/iconsets/New-Cyan-Circled/media-skip-forward.svg new file mode 100644 index 0000000..f8a8dd5 --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/media-skip-forward.svg @@ -0,0 +1,68 @@ + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/movie-1.svg b/www/rompr/iconsets/New-Cyan-Circled/movie-1.svg new file mode 100644 index 0000000..85d9b51 --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/movie-1.svg @@ -0,0 +1,38 @@ + + + + + + + image/svg+xml + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/mp3-audio.svg b/www/rompr/iconsets/New-Cyan-Circled/mp3-audio.svg new file mode 100644 index 0000000..c7c00fd --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/mp3-audio.svg @@ -0,0 +1,38 @@ + + + + + + + image/svg+xml + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/musicbrainz_logo.svg b/www/rompr/iconsets/New-Cyan-Circled/musicbrainz_logo.svg new file mode 100644 index 0000000..f805391 --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/musicbrainz_logo.svg @@ -0,0 +1,228 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/neverheard.svg b/www/rompr/iconsets/New-Cyan-Circled/neverheard.svg new file mode 100644 index 0000000..888487f --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/neverheard.svg @@ -0,0 +1,46 @@ + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/ogg-audio.svg b/www/rompr/iconsets/New-Cyan-Circled/ogg-audio.svg new file mode 100644 index 0000000..2b1ff5f --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/ogg-audio.svg @@ -0,0 +1,51 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/output.svg b/www/rompr/iconsets/New-Cyan-Circled/output.svg new file mode 100644 index 0000000..1fc152c --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/output.svg @@ -0,0 +1,90 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/output_mute.svg b/www/rompr/iconsets/New-Cyan-Circled/output_mute.svg new file mode 100644 index 0000000..b771f9f --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/output_mute.svg @@ -0,0 +1,88 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/parental-advisory.svg b/www/rompr/iconsets/New-Cyan-Circled/parental-advisory.svg new file mode 100644 index 0000000..a1c20c8 --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/parental-advisory.svg @@ -0,0 +1,446 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/playlist.svg b/www/rompr/iconsets/New-Cyan-Circled/playlist.svg new file mode 100644 index 0000000..5e9f409 --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/playlist.svg @@ -0,0 +1,93 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/podcast-logo.svg b/www/rompr/iconsets/New-Cyan-Circled/podcast-logo.svg new file mode 100644 index 0000000..891f685 --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/podcast-logo.svg @@ -0,0 +1,38 @@ + + + + + + + image/svg+xml + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/preferences.svg b/www/rompr/iconsets/New-Cyan-Circled/preferences.svg new file mode 100644 index 0000000..f0722a3 --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/preferences.svg @@ -0,0 +1,85 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/pushbutton.svg b/www/rompr/iconsets/New-Cyan-Circled/pushbutton.svg new file mode 100644 index 0000000..a51d11c --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/pushbutton.svg @@ -0,0 +1,65 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/ratandtag.svg b/www/rompr/iconsets/New-Cyan-Circled/ratandtag.svg new file mode 100644 index 0000000..01ae872 --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/ratandtag.svg @@ -0,0 +1,61 @@ + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/ratortag.svg b/www/rompr/iconsets/New-Cyan-Circled/ratortag.svg new file mode 100644 index 0000000..1115ceb --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/ratortag.svg @@ -0,0 +1,65 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/refresh.svg b/www/rompr/iconsets/New-Cyan-Circled/refresh.svg new file mode 100644 index 0000000..96128a5 --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/refresh.svg @@ -0,0 +1,44 @@ + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/refresh_off.svg b/www/rompr/iconsets/New-Cyan-Circled/refresh_off.svg new file mode 100644 index 0000000..3b72654 --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/refresh_off.svg @@ -0,0 +1,77 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/resize.svg b/www/rompr/iconsets/New-Cyan-Circled/resize.svg new file mode 100644 index 0000000..ee3202c --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/resize.svg @@ -0,0 +1,3 @@ + + +image/svg+xml diff --git a/www/rompr/iconsets/New-Cyan-Circled/rss.svg b/www/rompr/iconsets/New-Cyan-Circled/rss.svg new file mode 100644 index 0000000..6a2f4d1 --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/rss.svg @@ -0,0 +1,129 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/shuffle.svg b/www/rompr/iconsets/New-Cyan-Circled/shuffle.svg new file mode 100644 index 0000000..06f6d65 --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/shuffle.svg @@ -0,0 +1,75 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/shuffle_off.svg b/www/rompr/iconsets/New-Cyan-Circled/shuffle_off.svg new file mode 100644 index 0000000..ca4d203 --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/shuffle_off.svg @@ -0,0 +1,122 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/singlestar.svg b/www/rompr/iconsets/New-Cyan-Circled/singlestar.svg new file mode 100644 index 0000000..92915bc --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/singlestar.svg @@ -0,0 +1,328 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/sleep.svg b/www/rompr/iconsets/New-Cyan-Circled/sleep.svg new file mode 100644 index 0000000..73d4b46 --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/sleep.svg @@ -0,0 +1,93 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/sliders.svg b/www/rompr/iconsets/New-Cyan-Circled/sliders.svg new file mode 100644 index 0000000..bd34771 --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/sliders.svg @@ -0,0 +1,62 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/smartradio.svg b/www/rompr/iconsets/New-Cyan-Circled/smartradio.svg new file mode 100644 index 0000000..f046afa --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/smartradio.svg @@ -0,0 +1,48 @@ + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/soundcloud-logo.svg b/www/rompr/iconsets/New-Cyan-Circled/soundcloud-logo.svg new file mode 100644 index 0000000..d7b307c --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/soundcloud-logo.svg @@ -0,0 +1,61 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/New-Cyan-Circled/spinner.svg b/www/rompr/iconsets/New-Cyan-Circled/spinner.svg new file mode 100644 index 0000000..82c220b --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/spinner.svg @@ -0,0 +1,421 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/spotify-logo.svg b/www/rompr/iconsets/New-Cyan-Circled/spotify-logo.svg new file mode 100644 index 0000000..cad7b34 --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/spotify-logo.svg @@ -0,0 +1,187 @@ + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/stopafter-highlight.svg b/www/rompr/iconsets/New-Cyan-Circled/stopafter-highlight.svg new file mode 100644 index 0000000..21d44e4 --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/stopafter-highlight.svg @@ -0,0 +1,70 @@ + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/stopafter.svg b/www/rompr/iconsets/New-Cyan-Circled/stopafter.svg new file mode 100644 index 0000000..a3804b8 --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/stopafter.svg @@ -0,0 +1,70 @@ + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/system-search.svg b/www/rompr/iconsets/New-Cyan-Circled/system-search.svg new file mode 100644 index 0000000..c4772a8 --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/system-search.svg @@ -0,0 +1,43 @@ + + + + + + + image/svg+xml + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/tag.svg b/www/rompr/iconsets/New-Cyan-Circled/tag.svg new file mode 100644 index 0000000..c74a257 --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/tag.svg @@ -0,0 +1,327 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/theme.css b/www/rompr/iconsets/New-Cyan-Circled/theme.css new file mode 100644 index 0000000..b7ab29b --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/theme.css @@ -0,0 +1,249 @@ + + [class^="icon-"], [class*=" icon-"] { + background-size:contain; + background-position: center; + background-repeat:no-repeat; + display:inline-block; +} + +[class^="icon-"]:not(.button-disabled):hover, [class*=" icon-"]:not(.button-disabled):hover { + opacity: 1; + background-color: rgba(255,173,0,0.07); +} + +.clearbox { + background-image: url('iconsets/New-Cyan-Circled/edit-delete.svg'); + /* dont change the 50%, it ties in with makeHoverWork, makeClearWork, and makeTagMenu */ + background-size: auto 50%; + background-position: right 2px center; + background-repeat: no-repeat; +} + +.combobox-entry, .selectholder { + background-image: url('iconsets/New-Cyan-Circled/blobdown3.svg'); + /* dont change the 50%, it ties in with makeHoverWork, makeClearWork, and makeTagMenu */ + background-size: auto 50%; + background-position: right 2px center; + background-repeat: no-repeat; +} + +.combobox-entry:hover, .selectholder:hover { + background-image: url('iconsets/New-Cyan-Circled/blobdown3-hi.svg'); + /* dont change the 50%, it ties in with makeHoverWork, makeClearWork, and makeTagMenu */ + background-size: auto 50%; + background-position: right 2px center; + background-repeat: no-repeat; +} + +.combo-button { + background-image: url('iconsets/New-Cyan-Circled/blobdown3.svg'); +} + +.button-disabled { opacity: 0.1 } + +.icon-play-circled { background-image :url('iconsets/New-Cyan-Circled/media-playback-start.svg') } +.playdiv { background-image :url('iconsets/New-Cyan-Circled/media-playback-start.svg') } +.icon-play-circled:hover { background-image :url('iconsets/New-Cyan-Circled/media-playback-start-highlight.svg') } +.icon-pause-circled { background-image :url('iconsets/New-Cyan-Circled/media-playback-pause.svg') } +.icon-pause-circled:hover { background-image :url('iconsets/New-Cyan-Circled/media-playback-pause-highlight.svg') } +.icon-fast-backward { background-image :url('iconsets/New-Cyan-Circled/media-skip-backward.svg') } +.icon-fast-backward:hover { background-image :url('iconsets/New-Cyan-Circled/media-skip-backward-highlight.svg') } +.icon-fast-forward { background-image :url('iconsets/New-Cyan-Circled/media-skip-forward.svg') } +.icon-fast-forward:hover { background-image :url('iconsets/New-Cyan-Circled/media-skip-forward-highlight.svg') } +.icon-stop-1 { background-image :url('iconsets/New-Cyan-Circled/media-playback-stop.svg') } +.icon-stop-1:hover { background-image :url('iconsets/New-Cyan-Circled/media-playback-stop-highlight.svg') } +.icon-to-end-1 { background-image :url('iconsets/New-Cyan-Circled/stopafter.svg') } +.icon-to-end-1:hover { background-image :url('iconsets/New-Cyan-Circled/stopafter-highlight.svg') } + +.icon-music { background-image: url('iconsets/New-Cyan-Circled/collection.svg') } +.icon-search { background-image: url('iconsets/New-Cyan-Circled/system-search.svg') } +.icon-folder-open-empty { background-image: url('iconsets/New-Cyan-Circled/folder.svg') } +.icon-radio-tower { background-image: url('iconsets/New-Cyan-Circled/broadcast-new.svg') } +.icon-cd { background-image: url('iconsets/New-Cyan-Circled/cd_case.svg') } +.icon-resize-horizontal { background-image: url('iconsets/New-Cyan-Circled/resize.svg') } +.icon-angle-double-left { background-image:url('iconsets/New-Cyan-Circled/arrow-left-double.svg') } +.icon-angle-double-right { background-image:url('iconsets/New-Cyan-Circled/arrow-right-double.svg') } +.icon-menu { background-image: url('iconsets/New-Cyan-Circled/pushbutton.svg') } +.icon-versions { background-image: url('iconsets/New-Cyan-Circled/history.svg') } +.icon-left-circled { background-image: url('iconsets/New-Cyan-Circled/backbutton.svg') } +.icon-right-circled { background-image: url('iconsets/New-Cyan-Circled/forwardbutton.svg') } +.icon-cog-alt { background-image: url('iconsets/New-Cyan-Circled/preferences.svg') } +.icon-trash { background-image: url('iconsets/New-Cyan-Circled/edit-clear-list.svg') } +.icon-wifi { background-image: url('iconsets/New-Cyan-Circled/smartradio.svg') } +.icon-doc-text { background-image: url('iconsets/New-Cyan-Circled/playlist.svg') } +.icon-floppy { background-image: url('iconsets/New-Cyan-Circled/document-save.svg') } +.icon-cancel-circled { background-image: url('iconsets/New-Cyan-Circled/edit-delete.svg') } +.icon-plus { + background-image: url('iconsets/New-Cyan-Circled/add.svg'); + opacity:0.7; +} +.icon-alarm { background-image: url('iconsets/New-Cyan-Circled/alarmclock_false.svg') } +.icon-alarm-on { background-image: url('iconsets/New-Cyan-Circled/alarmclock_true.svg') } +.icon-sleep { background-image: url('iconsets/New-Cyan-Circled/sleep.svg') } +.icon-library { background-image: url('iconsets/New-Cyan-Circled/file.svg') } +.icon-lastfm-1 { background-image: url('iconsets/New-Cyan-Circled/lastfm.svg') } +.icon-wikipedia { background-image: url('iconsets/New-Cyan-Circled/wikipedia-logo.svg') } +.icon-musicbrainz { background-image: url('iconsets/New-Cyan-Circled/musicbrainz_logo.svg') } +.icon-discogs { background-image: url('iconsets/New-Cyan-Circled/discogs-logo.svg') } +.icon-doc-text-1 { background-image: url('iconsets/New-Cyan-Circled/lyrics.svg') } +.icon-soundcloud-circled { background-image: url('iconsets/New-Cyan-Circled/soundcloud-logo.svg') } +.icon-youtube-circled { background-image: url('iconsets/New-Cyan-Circled/youtube-logo.svg') } +.icon-gmusic-circled { background-image: url('iconsets/New-Cyan-Circled/gmusic-logo.svg') } +.icon-spotify-circled { background-image: url('iconsets/New-Cyan-Circled/spotify-logo.svg') } +.icon-vkontakte-circled { background-image: url('iconsets/New-Cyan-Circled/vkontakte-logo.svg') } +.icon-podcast-circled { background-image: url('iconsets/New-Cyan-Circled/podcast-logo.svg') } +.icon-audiobook { background-image: url('iconsets/New-Cyan-Circled/audiobook.svg') } +.icon-internetarchive-circled { background-image: url('iconsets/New-Cyan-Circled/internetarchive-logo.svg') } +.icon-increase { background-image: url('iconsets/New-Cyan-Circled/arrow-increase.svg') } +.icon-decrease { background-image: url('iconsets/New-Cyan-Circled/arrow-decrease.svg') } +.icon-attention-1 { background-image: url('iconsets/New-Cyan-Circled/dialog-error.svg') } +.icon-info-circled { background-image: url('iconsets/New-Cyan-Circled/dialog-information.svg') } +.icon-download { background-image: url('iconsets/New-Cyan-Circled/download-icon.svg') } +.icon-sun { background-image: url('iconsets/New-Cyan-Circled/icon-new.svg') } +.icon-headphones { background-image: url('iconsets/New-Cyan-Circled/headphones.svg') } +.icon-unlistened { background-image: url('iconsets/New-Cyan-Circled/headphones.svg') } +.icon-block { background-image: url('iconsets/New-Cyan-Circled/lastfm-ban.svg') } +.icon-heart { background-image: url('iconsets/New-Cyan-Circled/lastfm-love.svg') } +.icon-heart-broken { background-image: url('iconsets/New-Cyan-Circled/lastfm-unlove.svg') } +.icon-refresh { background-image: url('iconsets/New-Cyan-Circled/refresh.svg') } +.icon-dirble-circled { background-image: url('iconsets/New-Cyan-Circled/dirble-logo.svg') } +.icon-tunein { background-image: url('iconsets/New-Cyan-Circled/../../newimages/tunein-logo.svg') } +.icon-no-response-playbutton { background-image :url('iconsets/New-Cyan-Circled/media-playback-start.svg') } +.icon-tags { background-image: url('iconsets/New-Cyan-Circled/tag.svg') } +.icon-volume-up { background-image: url('iconsets/New-Cyan-Circled/volume.svg') } +.icon-toggle-open { background-image: url('iconsets/New-Cyan-Circled/toggle-open.svg') } +.icon-toggle-closed { background-image: url('iconsets/New-Cyan-Circled/toggle-closed.svg') } +.icon-spin6 { background-image: url('iconsets/New-Cyan-Circled/spinner.svg') } +.icon-output { background-image: url('iconsets/New-Cyan-Circled/output.svg') } +.icon-output-mute { background-image: url('iconsets/New-Cyan-Circled/output_mute.svg') } +.icon-sliders { background-image: url('iconsets/New-Cyan-Circled/sliders.svg') } +.icon-0-stars { background-image: url('iconsets/New-Cyan-Circled/0stars.svg') } +.icon-1-stars { background-image: url('iconsets/New-Cyan-Circled/1stars.svg') } +.icon-2-stars { background-image: url('iconsets/New-Cyan-Circled/2stars.svg') } +.icon-3-stars { background-image: url('iconsets/New-Cyan-Circled/3stars.svg') } +.icon-4-stars { background-image: url('iconsets/New-Cyan-Circled/4stars.svg') } +.icon-5-stars { background-image: url('iconsets/New-Cyan-Circled/5stars.svg') } +.icon-single-star { background-image: url('iconsets/New-Cyan-Circled/singlestar.svg') } +.icon-ratandtag { background-image: url('iconsets/New-Cyan-Circled/ratandtag.svg') } +.icon-ratortag { background-image: url('iconsets/New-Cyan-Circled/ratortag.svg') } +.icon-toggle-on { background-image: url('iconsets/New-Cyan-Circled/togglebutton-new2-on.svg') } +.icon-toggle-off { background-image: url('iconsets/New-Cyan-Circled/togglebutton-new2-off.svg') } + +.icon-random.flow-on { background-image: url('iconsets/New-Cyan-Circled/shuffle.svg') } +.icon-random.flow-off { background-image: url('iconsets/New-Cyan-Circled/shuffle_off.svg') } +.icon-crossfade.flow-on { background-image: url('iconsets/New-Cyan-Circled/crossfade.svg') } +.icon-crossfade.flow-off { background-image: url('iconsets/New-Cyan-Circled/crossfade_off.svg') } +.icon-repeat.flow-on { background-image: url('iconsets/New-Cyan-Circled/refresh.svg') } +.icon-repeat.flow-off { background-image: url('iconsets/New-Cyan-Circled/refresh_off.svg') } +.icon-consume.flow-on { background-image: url('iconsets/New-Cyan-Circled/consume.svg') } +.icon-consume.flow-off { background-image: url('iconsets/New-Cyan-Circled/consume_off.svg') } + +.icon-allrandom { background-image: url('iconsets/New-Cyan-Circled/shuffle.svg') } +.icon-neverplayed { background-image: url('iconsets/New-Cyan-Circled/neverheard.svg') } +.icon-recentlyplayed { background-image: url('iconsets/New-Cyan-Circled/calendar.svg') } +.icon-artist { background-image: url('iconsets/New-Cyan-Circled/artist-icon.svg') } +.icon-mp3-audio { background-image: url('iconsets/New-Cyan-Circled/mp3-audio.svg') } +.icon-aac-audio { background-image: url('iconsets/New-Cyan-Circled/aac-audio.svg') } +.icon-flac-audio { background-image: url('iconsets/New-Cyan-Circled/flac-audio.svg') } +.icon-wma-audio { background-image: url('iconsets/New-Cyan-Circled/wma-audio.svg') } +.icon-ogg-audio { background-image: url('iconsets/New-Cyan-Circled/ogg-audio.svg') } +.icon-explicit { background-image: url('iconsets/New-Cyan-Circled/parental-advisory.svg') } +.icon-expand-up { background-image: url('iconsets/New-Cyan-Circled/expand-up.svg') } +.icon-rss { background-image: url('iconsets/New-Cyan-Circled/rss.svg') } +.icon-tick { background-image: url('iconsets/New-Cyan-Circled/tick.svg') } +.icon-video { background-image: url('iconsets/New-Cyan-Circled/movie-1.svg') } +.icon-bbc-logo { background-image: url('iconsets/New-Cyan-Circled/bbc-logo.svg') } +.icon-imdb-logo { background-image: url('iconsets/New-Cyan-Circled/imdb-logo.svg') } +.icon-facebook-logo { background-image: url('iconsets/New-Cyan-Circled/facebook-logo.svg') } +.icon-twitter-logo { background-image: url('iconsets/New-Cyan-Circled/twitter-logo.svg') } +.icon-www { background-image: url('iconsets/New-Cyan-Circled/world-wide-web.svg') } +.icon-allmusic { background-image: url('iconsets/New-Cyan-Circled/allmusic-logo.svg') } +.icon-updown { background-image: url('iconsets/New-Cyan-Circled/arrow-updown.svg') } +.icon-snapcast { background-image: url('iconsets/New-Cyan-Circled/../../newimages/snapcast.png') } + +.styledinputs label +{ + display:inline-block; + cursor:pointer; + position:relative; + padding-left:2em; + line-height:1.5em; +} + +.styledinputs input[type=radio] +{ + display:none; +} + +.styledinputs input[type=checkbox] +{ + display:none; +} + +.styledinputs label:before +{ + content:""; + display:inline-block; + width:1.5em; + height:1.5em; + position:absolute; + left:0; + background-image: url('iconsets/New-Cyan-Circled/togglebutton-new2-off.svg'); + background-size: auto 80%; + background-position: center; + background-repeat:no-repeat; +} + +.styledinputs input:checked + label:before +{ + background-image: url('iconsets/New-Cyan-Circled/togglebutton-new2-on.svg') !important; +} + +img.notexist,img.notfound +{ + background-image: url('iconsets/New-Cyan-Circled/compact-disc.svg'); + background-size:contain; + display:inline-block; + background-position: center; + background-repeat:no-repeat; +} + +img.stream.notfound, img.stream.notexist +{ + background-image: url('iconsets/New-Cyan-Circled/broadcast-new.svg'); +} + +img.plimage.notfound +{ + background-image: url('iconsets/New-Cyan-Circled/playlist.svg'); +} + +.backmenu +{ + background-image: url('iconsets/New-Cyan-Circled/arrow-left-double.svg'); + background-repeat: no-repeat; + background-size: contain; +} + +button.iconbutton { + height:2em; + width:2em; + background-size: contain; + background-position:center; + border: none !important; + opacity: 0.8; + background-color:transparent; +} + +button.iconbutton:hover { + opacity: 1; +} + +button.searchbutton { + background-image: url('iconsets/New-Cyan-Circled/system-search.svg'); +} + +button.rssbutton { + background-image: url('iconsets/New-Cyan-Circled/rss.svg'); +} + diff --git a/www/rompr/iconsets/New-Cyan-Circled/tick.svg b/www/rompr/iconsets/New-Cyan-Circled/tick.svg new file mode 100644 index 0000000..95cb51c --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/tick.svg @@ -0,0 +1,335 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/toggle-closed.svg b/www/rompr/iconsets/New-Cyan-Circled/toggle-closed.svg new file mode 100644 index 0000000..e8cd8bc --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/toggle-closed.svg @@ -0,0 +1,376 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/toggle-open.svg b/www/rompr/iconsets/New-Cyan-Circled/toggle-open.svg new file mode 100644 index 0000000..4d41bb2 --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/toggle-open.svg @@ -0,0 +1,372 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/togglebutton-new2-off.svg b/www/rompr/iconsets/New-Cyan-Circled/togglebutton-new2-off.svg new file mode 100644 index 0000000..9e36f23 --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/togglebutton-new2-off.svg @@ -0,0 +1,444 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/togglebutton-new2-on.svg b/www/rompr/iconsets/New-Cyan-Circled/togglebutton-new2-on.svg new file mode 100644 index 0000000..773c97a --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/togglebutton-new2-on.svg @@ -0,0 +1,542 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/twitter-logo.svg b/www/rompr/iconsets/New-Cyan-Circled/twitter-logo.svg new file mode 100644 index 0000000..f3092f9 --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/twitter-logo.svg @@ -0,0 +1,367 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/unlistened.svg b/www/rompr/iconsets/New-Cyan-Circled/unlistened.svg new file mode 100644 index 0000000..ae844b3 --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/unlistened.svg @@ -0,0 +1,52 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/New-Cyan-Circled/vkontakte-logo.svg b/www/rompr/iconsets/New-Cyan-Circled/vkontakte-logo.svg new file mode 100644 index 0000000..a484503 --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/vkontakte-logo.svg @@ -0,0 +1,428 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/volume.svg b/www/rompr/iconsets/New-Cyan-Circled/volume.svg new file mode 100644 index 0000000..1fc152c --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/volume.svg @@ -0,0 +1,90 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/wikipedia-logo.svg b/www/rompr/iconsets/New-Cyan-Circled/wikipedia-logo.svg new file mode 100644 index 0000000..287c4ac --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/wikipedia-logo.svg @@ -0,0 +1,331 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/wma-audio.svg b/www/rompr/iconsets/New-Cyan-Circled/wma-audio.svg new file mode 100644 index 0000000..9ec79fd --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/wma-audio.svg @@ -0,0 +1,70 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Cyan-Circled/world-wide-web.svg b/www/rompr/iconsets/New-Cyan-Circled/world-wide-web.svg new file mode 100644 index 0000000..5c2ecef --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/world-wide-web.svg @@ -0,0 +1,61 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/New-Cyan-Circled/youtube-logo.svg b/www/rompr/iconsets/New-Cyan-Circled/youtube-logo.svg new file mode 100644 index 0000000..d448d9f --- /dev/null +++ b/www/rompr/iconsets/New-Cyan-Circled/youtube-logo.svg @@ -0,0 +1,327 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/0stars.svg b/www/rompr/iconsets/New-Dark-Circled/0stars.svg new file mode 100644 index 0000000..5b2e15a --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/0stars.svg @@ -0,0 +1,19 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/1stars.svg b/www/rompr/iconsets/New-Dark-Circled/1stars.svg new file mode 100644 index 0000000..0d60c5d --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/1stars.svg @@ -0,0 +1,19 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/2stars.svg b/www/rompr/iconsets/New-Dark-Circled/2stars.svg new file mode 100644 index 0000000..ed63c76 --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/2stars.svg @@ -0,0 +1,19 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/3stars.svg b/www/rompr/iconsets/New-Dark-Circled/3stars.svg new file mode 100644 index 0000000..7ef7c03 --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/3stars.svg @@ -0,0 +1,19 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/4stars.svg b/www/rompr/iconsets/New-Dark-Circled/4stars.svg new file mode 100644 index 0000000..9a9f32c --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/4stars.svg @@ -0,0 +1,19 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/5stars.svg b/www/rompr/iconsets/New-Dark-Circled/5stars.svg new file mode 100644 index 0000000..0fa3f1e --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/5stars.svg @@ -0,0 +1,19 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/aac-audio.svg b/www/rompr/iconsets/New-Dark-Circled/aac-audio.svg new file mode 100644 index 0000000..5168d30 --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/aac-audio.svg @@ -0,0 +1,89 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/add.svg b/www/rompr/iconsets/New-Dark-Circled/add.svg new file mode 100644 index 0000000..49ca106 --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/add.svg @@ -0,0 +1,50 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/adjustments.css b/www/rompr/iconsets/New-Dark-Circled/adjustments.css new file mode 100644 index 0000000..9b93f77 --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/adjustments.css @@ -0,0 +1,230 @@ +#buttons +{ + padding-left:12px; + padding-right:12px; + padding-top:4px; + padding-bottom:6px; +} + +.controlbutton +{ + margin:0px; + padding:0px; + vertical-align:middle; + display:inline-block; + width:56px; + height:56px; +} + +.controlbutton-small +{ + margin:0px; + vertical-align:middle; + display:inline-block; + width:48px; + height:48px; +} + +@media screen and (min-height: 800px) and (max-height: 939px) { + .controlbutton { + width:64px; + height:64px; + } + #buttons { + padding-top:12px; + } + #playbackTime { + margin-top:2px; + font-size:12px; + line-height:14px; + height:14px; + } +} + +@media screen and (min-height: 940px) and (max-height: 1099px) and (min-width: 650px) { + .controlbutton { + width:84px; + height:84px; + } + + .controlbutton-small { + width:64px; + height:64px; + } + + .shiftleft + { + left:-12px; + position:relative; + z-index:250; + } + + .shiftleft2 + { + left:-26px; + position:relative; + } + + .shiftleft3 + { + position:relative; + left:-36px; + z-index:5; + } + + .shiftleft4 + { + position:relative; + left:-48px; + z-index:1; + margin-right:-36px; + } + +} + +@media screen and (min-height: 940px) and (max-height: 1099px) and (min-width: 650px) { + .controlbutton { + width:84px; + height:84px; + } + .controlbutton-small { + width:64px; + height:64px; + } + #buttons { + padding-top:16px; + padding-left:24px; + } + #playbackTime { + margin-top:4px; + font-size:14px; + line-height:16px; + height:16px; + } + .shiftleft + { + left:-12px; + position:relative; + z-index:250; + } + + .shiftleft2 + { + left:-24px; + position:relative; + } + + .shiftleft3 + { + position:relative; + left:-36px; + z-index:5; + } + + .shiftleft4 + { + position:relative; + left:-48px; + z-index:1; + margin-right:-36px; + } +} + +@media screen and (min-height: 1100px) and (min-width: 651px) and (max-width: 749px) { + .controlbutton { + width:84px; + height:84px; + } + .controlbutton-small { + width:64px; + height:64px; + } + #buttons { + padding-top:16px; + padding-left:24px; + } + #playbackTime { + margin-top:4px; + font-size:14px; + line-height:16px; + height:16px; + } + .shiftleft + { + left:-12px; + position:relative; + z-index:250; + } + + .shiftleft2 + { + left:-26px; + position:relative; + } + + .shiftleft3 + { + position:relative; + left:-36px; + z-index:5; + } + + .shiftleft4 + { + position:relative; + left:-48px; + z-index:1; + margin-right:-36px; + } +} + +@media screen and (min-height: 1100px) and (min-width: 720px) { + .controlbutton { + width:90px; + height:90px; + } + .controlbutton-small { + width:70px; + height:70px; + } + #buttons { + padding-top:12px; + padding-left:20px; + } + #progress { + margin-top:8px; + } + #playbackTime { + margin-top:12px; + font-size:16px; + line-height:18px; + height:18px; + } + .shiftleft + { + left:-10px; + position:relative; + z-index:250; + } + + .shiftleft2 + { + left:-22px; + position:relative; + } + + .shiftleft3 + { + position:relative; + left:-34px; + z-index:5; + } + + .shiftleft4 + { + position:relative; + left:-44px; + z-index:1; + margin-right:-36px; + } +} diff --git a/www/rompr/iconsets/New-Dark-Circled/alarmclock_false.svg b/www/rompr/iconsets/New-Dark-Circled/alarmclock_false.svg new file mode 100644 index 0000000..ffad226 --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/alarmclock_false.svg @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/alarmclock_true.svg b/www/rompr/iconsets/New-Dark-Circled/alarmclock_true.svg new file mode 100644 index 0000000..2413858 --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/alarmclock_true.svg @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/allmusic-logo.svg b/www/rompr/iconsets/New-Dark-Circled/allmusic-logo.svg new file mode 100644 index 0000000..c2bd323 --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/allmusic-logo.svg @@ -0,0 +1,360 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/arrow-decrease.svg b/www/rompr/iconsets/New-Dark-Circled/arrow-decrease.svg new file mode 100644 index 0000000..5924b57 --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/arrow-decrease.svg @@ -0,0 +1,80 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/arrow-increase.svg b/www/rompr/iconsets/New-Dark-Circled/arrow-increase.svg new file mode 100644 index 0000000..4b156b9 --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/arrow-increase.svg @@ -0,0 +1,80 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/arrow-left-double.svg b/www/rompr/iconsets/New-Dark-Circled/arrow-left-double.svg new file mode 100644 index 0000000..352d85a --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/arrow-left-double.svg @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/arrow-right-double.svg b/www/rompr/iconsets/New-Dark-Circled/arrow-right-double.svg new file mode 100644 index 0000000..5af4a2d --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/arrow-right-double.svg @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/arrow-updown.svg b/www/rompr/iconsets/New-Dark-Circled/arrow-updown.svg new file mode 100644 index 0000000..56e6e48 --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/arrow-updown.svg @@ -0,0 +1,82 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/artist-icon.svg b/www/rompr/iconsets/New-Dark-Circled/artist-icon.svg new file mode 100644 index 0000000..ea39d79 --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/artist-icon.svg @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/audiobook.svg b/www/rompr/iconsets/New-Dark-Circled/audiobook.svg new file mode 100644 index 0000000..88ab07b --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/audiobook.svg @@ -0,0 +1,215 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/backbutton.svg b/www/rompr/iconsets/New-Dark-Circled/backbutton.svg new file mode 100644 index 0000000..6ce2da6 --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/backbutton.svg @@ -0,0 +1,55 @@ + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/bbc-logo.svg b/www/rompr/iconsets/New-Dark-Circled/bbc-logo.svg new file mode 100644 index 0000000..15ac167 --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/bbc-logo.svg @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/blobdown3-hi.svg b/www/rompr/iconsets/New-Dark-Circled/blobdown3-hi.svg new file mode 100644 index 0000000..f3fb2a5 --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/blobdown3-hi.svg @@ -0,0 +1,73 @@ + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/blobdown3.svg b/www/rompr/iconsets/New-Dark-Circled/blobdown3.svg new file mode 100644 index 0000000..497166e --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/blobdown3.svg @@ -0,0 +1,73 @@ + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/broadcast-new.svg b/www/rompr/iconsets/New-Dark-Circled/broadcast-new.svg new file mode 100644 index 0000000..a2ef797 --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/broadcast-new.svg @@ -0,0 +1,89 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/calendar.svg b/www/rompr/iconsets/New-Dark-Circled/calendar.svg new file mode 100644 index 0000000..eaf7ce5 --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/calendar.svg @@ -0,0 +1,188 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/cd_case.svg b/www/rompr/iconsets/New-Dark-Circled/cd_case.svg new file mode 100644 index 0000000..658afb8 --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/cd_case.svg @@ -0,0 +1,223 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/collection.svg b/www/rompr/iconsets/New-Dark-Circled/collection.svg new file mode 100644 index 0000000..feeb074 --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/collection.svg @@ -0,0 +1,229 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/compact-disc.svg b/www/rompr/iconsets/New-Dark-Circled/compact-disc.svg new file mode 100644 index 0000000..bb0734c --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/compact-disc.svg @@ -0,0 +1,61 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/New-Dark-Circled/consume.svg b/www/rompr/iconsets/New-Dark-Circled/consume.svg new file mode 100644 index 0000000..00a0652 --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/consume.svg @@ -0,0 +1,104 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/consume_off.svg b/www/rompr/iconsets/New-Dark-Circled/consume_off.svg new file mode 100644 index 0000000..4b5a0b9 --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/consume_off.svg @@ -0,0 +1,104 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/crossfade.svg b/www/rompr/iconsets/New-Dark-Circled/crossfade.svg new file mode 100644 index 0000000..0335ba1 --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/crossfade.svg @@ -0,0 +1,110 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/crossfade_off.svg b/www/rompr/iconsets/New-Dark-Circled/crossfade_off.svg new file mode 100644 index 0000000..3b8effc --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/crossfade_off.svg @@ -0,0 +1,76 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/dialog-error.svg b/www/rompr/iconsets/New-Dark-Circled/dialog-error.svg new file mode 100644 index 0000000..0647a74 --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/dialog-error.svg @@ -0,0 +1,193 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/dialog-information.svg b/www/rompr/iconsets/New-Dark-Circled/dialog-information.svg new file mode 100644 index 0000000..5fc35f2 --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/dialog-information.svg @@ -0,0 +1,205 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/dirble-logo.svg b/www/rompr/iconsets/New-Dark-Circled/dirble-logo.svg new file mode 100644 index 0000000..543f732 --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/dirble-logo.svg @@ -0,0 +1,211 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/discogs-logo.svg b/www/rompr/iconsets/New-Dark-Circled/discogs-logo.svg new file mode 100644 index 0000000..46d2c89 --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/discogs-logo.svg @@ -0,0 +1,436 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/document-save.svg b/www/rompr/iconsets/New-Dark-Circled/document-save.svg new file mode 100644 index 0000000..0af1bc3 --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/document-save.svg @@ -0,0 +1,239 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/download-icon.svg b/www/rompr/iconsets/New-Dark-Circled/download-icon.svg new file mode 100644 index 0000000..6c22445 --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/download-icon.svg @@ -0,0 +1,216 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/edit-clear-list.svg b/www/rompr/iconsets/New-Dark-Circled/edit-clear-list.svg new file mode 100644 index 0000000..6593d1b --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/edit-clear-list.svg @@ -0,0 +1,265 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/edit-delete.svg b/www/rompr/iconsets/New-Dark-Circled/edit-delete.svg new file mode 100644 index 0000000..bc23f03 --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/edit-delete.svg @@ -0,0 +1,50 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/expand-up.svg b/www/rompr/iconsets/New-Dark-Circled/expand-up.svg new file mode 100644 index 0000000..b0edd92 --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/expand-up.svg @@ -0,0 +1,239 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/facebook-logo.svg b/www/rompr/iconsets/New-Dark-Circled/facebook-logo.svg new file mode 100644 index 0000000..1b41e1c --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/facebook-logo.svg @@ -0,0 +1,79 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/file.svg b/www/rompr/iconsets/New-Dark-Circled/file.svg new file mode 100644 index 0000000..e4d0b3d --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/file.svg @@ -0,0 +1,223 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/flac-audio.svg b/www/rompr/iconsets/New-Dark-Circled/flac-audio.svg new file mode 100644 index 0000000..f8d88c6 --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/flac-audio.svg @@ -0,0 +1,110 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/folder.svg b/www/rompr/iconsets/New-Dark-Circled/folder.svg new file mode 100644 index 0000000..bc2e7eb --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/folder.svg @@ -0,0 +1,697 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/forwardbutton.svg b/www/rompr/iconsets/New-Dark-Circled/forwardbutton.svg new file mode 100644 index 0000000..b7a094a --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/forwardbutton.svg @@ -0,0 +1,59 @@ + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/gmusic-logo.svg b/www/rompr/iconsets/New-Dark-Circled/gmusic-logo.svg new file mode 100644 index 0000000..dee7b9e --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/gmusic-logo.svg @@ -0,0 +1,107 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/headphones.svg b/www/rompr/iconsets/New-Dark-Circled/headphones.svg new file mode 100644 index 0000000..fb05044 --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/headphones.svg @@ -0,0 +1,668 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/icon-new.svg b/www/rompr/iconsets/New-Dark-Circled/icon-new.svg new file mode 100644 index 0000000..ed6f730 --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/icon-new.svg @@ -0,0 +1,670 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/imdb-logo.svg b/www/rompr/iconsets/New-Dark-Circled/imdb-logo.svg new file mode 100644 index 0000000..9264de4 --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/imdb-logo.svg @@ -0,0 +1,447 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/internetarchive-logo.svg b/www/rompr/iconsets/New-Dark-Circled/internetarchive-logo.svg new file mode 100644 index 0000000..b9ab39d --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/internetarchive-logo.svg @@ -0,0 +1,368 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/lastfm-ban.svg b/www/rompr/iconsets/New-Dark-Circled/lastfm-ban.svg new file mode 100644 index 0000000..4f86340 --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/lastfm-ban.svg @@ -0,0 +1,3 @@ + + +image/svg+xml diff --git a/www/rompr/iconsets/New-Dark-Circled/lastfm-love.svg b/www/rompr/iconsets/New-Dark-Circled/lastfm-love.svg new file mode 100644 index 0000000..8b49351 --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/lastfm-love.svg @@ -0,0 +1,665 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/lastfm-unlove.svg b/www/rompr/iconsets/New-Dark-Circled/lastfm-unlove.svg new file mode 100644 index 0000000..fc89e92 --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/lastfm-unlove.svg @@ -0,0 +1,657 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/lastfm.svg b/www/rompr/iconsets/New-Dark-Circled/lastfm.svg new file mode 100644 index 0000000..2f77423 --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/lastfm.svg @@ -0,0 +1,173 @@ + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/lyrics.svg b/www/rompr/iconsets/New-Dark-Circled/lyrics.svg new file mode 100644 index 0000000..a758855 --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/lyrics.svg @@ -0,0 +1,657 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/media-playback-pause-highlight.svg b/www/rompr/iconsets/New-Dark-Circled/media-playback-pause-highlight.svg new file mode 100644 index 0000000..4c07e9d --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/media-playback-pause-highlight.svg @@ -0,0 +1,72 @@ + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/media-playback-pause.svg b/www/rompr/iconsets/New-Dark-Circled/media-playback-pause.svg new file mode 100644 index 0000000..7d464b0 --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/media-playback-pause.svg @@ -0,0 +1,56 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/media-playback-start-highlight.svg b/www/rompr/iconsets/New-Dark-Circled/media-playback-start-highlight.svg new file mode 100644 index 0000000..18a09a4 --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/media-playback-start-highlight.svg @@ -0,0 +1,81 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/media-playback-start.svg b/www/rompr/iconsets/New-Dark-Circled/media-playback-start.svg new file mode 100644 index 0000000..261cc17 --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/media-playback-start.svg @@ -0,0 +1,81 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/media-playback-stop-highlight.svg b/www/rompr/iconsets/New-Dark-Circled/media-playback-stop-highlight.svg new file mode 100644 index 0000000..660bc96 --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/media-playback-stop-highlight.svg @@ -0,0 +1,65 @@ + + + + + + + + image/svg+xml + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/media-playback-stop.svg b/www/rompr/iconsets/New-Dark-Circled/media-playback-stop.svg new file mode 100644 index 0000000..93817ed --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/media-playback-stop.svg @@ -0,0 +1,45 @@ + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/media-skip-backward-highlight.svg b/www/rompr/iconsets/New-Dark-Circled/media-skip-backward-highlight.svg new file mode 100644 index 0000000..c140a6f --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/media-skip-backward-highlight.svg @@ -0,0 +1,69 @@ + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/media-skip-backward.svg b/www/rompr/iconsets/New-Dark-Circled/media-skip-backward.svg new file mode 100644 index 0000000..fdafe8d --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/media-skip-backward.svg @@ -0,0 +1,69 @@ + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/media-skip-forward-highlight.svg b/www/rompr/iconsets/New-Dark-Circled/media-skip-forward-highlight.svg new file mode 100644 index 0000000..6be2134 --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/media-skip-forward-highlight.svg @@ -0,0 +1,68 @@ + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/media-skip-forward.svg b/www/rompr/iconsets/New-Dark-Circled/media-skip-forward.svg new file mode 100644 index 0000000..0d096d9 --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/media-skip-forward.svg @@ -0,0 +1,68 @@ + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/movie-1.svg b/www/rompr/iconsets/New-Dark-Circled/movie-1.svg new file mode 100644 index 0000000..0870194 --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/movie-1.svg @@ -0,0 +1,38 @@ + + + + + + + image/svg+xml + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/mp3-audio.svg b/www/rompr/iconsets/New-Dark-Circled/mp3-audio.svg new file mode 100644 index 0000000..58afca9 --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/mp3-audio.svg @@ -0,0 +1,38 @@ + + + + + + + image/svg+xml + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/musicbrainz_logo.svg b/www/rompr/iconsets/New-Dark-Circled/musicbrainz_logo.svg new file mode 100644 index 0000000..cf79e84 --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/musicbrainz_logo.svg @@ -0,0 +1,228 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/neverheard.svg b/www/rompr/iconsets/New-Dark-Circled/neverheard.svg new file mode 100644 index 0000000..434c88c --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/neverheard.svg @@ -0,0 +1,46 @@ + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/ogg-audio.svg b/www/rompr/iconsets/New-Dark-Circled/ogg-audio.svg new file mode 100644 index 0000000..1675106 --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/ogg-audio.svg @@ -0,0 +1,51 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/output.svg b/www/rompr/iconsets/New-Dark-Circled/output.svg new file mode 100644 index 0000000..0e08fb1 --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/output.svg @@ -0,0 +1,90 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/output_mute.svg b/www/rompr/iconsets/New-Dark-Circled/output_mute.svg new file mode 100644 index 0000000..8dab998 --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/output_mute.svg @@ -0,0 +1,88 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/parental-advisory.svg b/www/rompr/iconsets/New-Dark-Circled/parental-advisory.svg new file mode 100644 index 0000000..06330cd --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/parental-advisory.svg @@ -0,0 +1,446 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/playlist.svg b/www/rompr/iconsets/New-Dark-Circled/playlist.svg new file mode 100644 index 0000000..89d6b6c --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/playlist.svg @@ -0,0 +1,93 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/podcast-logo.svg b/www/rompr/iconsets/New-Dark-Circled/podcast-logo.svg new file mode 100644 index 0000000..62b1307 --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/podcast-logo.svg @@ -0,0 +1,38 @@ + + + + + + + image/svg+xml + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/preferences.svg b/www/rompr/iconsets/New-Dark-Circled/preferences.svg new file mode 100644 index 0000000..4d39209 --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/preferences.svg @@ -0,0 +1,85 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/pushbutton.svg b/www/rompr/iconsets/New-Dark-Circled/pushbutton.svg new file mode 100644 index 0000000..8273a1d --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/pushbutton.svg @@ -0,0 +1,65 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/ratandtag.svg b/www/rompr/iconsets/New-Dark-Circled/ratandtag.svg new file mode 100644 index 0000000..8226134 --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/ratandtag.svg @@ -0,0 +1,61 @@ + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/ratortag.svg b/www/rompr/iconsets/New-Dark-Circled/ratortag.svg new file mode 100644 index 0000000..6872f68 --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/ratortag.svg @@ -0,0 +1,65 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/refresh.svg b/www/rompr/iconsets/New-Dark-Circled/refresh.svg new file mode 100644 index 0000000..574b754 --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/refresh.svg @@ -0,0 +1,44 @@ + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/refresh_off.svg b/www/rompr/iconsets/New-Dark-Circled/refresh_off.svg new file mode 100644 index 0000000..8ac508d --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/refresh_off.svg @@ -0,0 +1,77 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/resize.svg b/www/rompr/iconsets/New-Dark-Circled/resize.svg new file mode 100644 index 0000000..b7a28eb --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/resize.svg @@ -0,0 +1,3 @@ + + +image/svg+xml diff --git a/www/rompr/iconsets/New-Dark-Circled/rss.svg b/www/rompr/iconsets/New-Dark-Circled/rss.svg new file mode 100644 index 0000000..3fce24b --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/rss.svg @@ -0,0 +1,129 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/shuffle.svg b/www/rompr/iconsets/New-Dark-Circled/shuffle.svg new file mode 100644 index 0000000..6fa72ae --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/shuffle.svg @@ -0,0 +1,75 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/shuffle_off.svg b/www/rompr/iconsets/New-Dark-Circled/shuffle_off.svg new file mode 100644 index 0000000..9ea22be --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/shuffle_off.svg @@ -0,0 +1,122 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/singlestar.svg b/www/rompr/iconsets/New-Dark-Circled/singlestar.svg new file mode 100644 index 0000000..7640b9f --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/singlestar.svg @@ -0,0 +1,328 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/sleep.svg b/www/rompr/iconsets/New-Dark-Circled/sleep.svg new file mode 100644 index 0000000..16bc900 --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/sleep.svg @@ -0,0 +1,93 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/sliders.svg b/www/rompr/iconsets/New-Dark-Circled/sliders.svg new file mode 100644 index 0000000..76f4461 --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/sliders.svg @@ -0,0 +1,62 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/smartradio.svg b/www/rompr/iconsets/New-Dark-Circled/smartradio.svg new file mode 100644 index 0000000..783479b --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/smartradio.svg @@ -0,0 +1,48 @@ + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/soundcloud-logo.svg b/www/rompr/iconsets/New-Dark-Circled/soundcloud-logo.svg new file mode 100644 index 0000000..2d57589 --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/soundcloud-logo.svg @@ -0,0 +1,61 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/New-Dark-Circled/spinner.svg b/www/rompr/iconsets/New-Dark-Circled/spinner.svg new file mode 100644 index 0000000..ad1e5b6 --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/spinner.svg @@ -0,0 +1,421 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/spotify-logo.svg b/www/rompr/iconsets/New-Dark-Circled/spotify-logo.svg new file mode 100644 index 0000000..b0b8fa7 --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/spotify-logo.svg @@ -0,0 +1,187 @@ + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/stopafter-highlight.svg b/www/rompr/iconsets/New-Dark-Circled/stopafter-highlight.svg new file mode 100644 index 0000000..b324d9f --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/stopafter-highlight.svg @@ -0,0 +1,70 @@ + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/stopafter.svg b/www/rompr/iconsets/New-Dark-Circled/stopafter.svg new file mode 100644 index 0000000..81aab1e --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/stopafter.svg @@ -0,0 +1,70 @@ + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/system-search.svg b/www/rompr/iconsets/New-Dark-Circled/system-search.svg new file mode 100644 index 0000000..3415ea0 --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/system-search.svg @@ -0,0 +1,43 @@ + + + + + + + image/svg+xml + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/tag.svg b/www/rompr/iconsets/New-Dark-Circled/tag.svg new file mode 100644 index 0000000..403bd54 --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/tag.svg @@ -0,0 +1,327 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/theme.css b/www/rompr/iconsets/New-Dark-Circled/theme.css new file mode 100644 index 0000000..f8b3ac7 --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/theme.css @@ -0,0 +1,249 @@ + + [class^="icon-"], [class*=" icon-"] { + background-size:contain; + background-position: center; + background-repeat:no-repeat; + display:inline-block; +} + +[class^="icon-"]:not(.button-disabled):hover, [class*=" icon-"]:not(.button-disabled):hover { + opacity: 1; + background-color: rgba(255,173,0,0.07); +} + +.clearbox { + background-image: url('iconsets/New-Dark-Circled/edit-delete.svg'); + /* dont change the 50%, it ties in with makeHoverWork, makeClearWork, and makeTagMenu */ + background-size: auto 50%; + background-position: right 2px center; + background-repeat: no-repeat; +} + +.combobox-entry, .selectholder { + background-image: url('iconsets/New-Dark-Circled/blobdown3.svg'); + /* dont change the 50%, it ties in with makeHoverWork, makeClearWork, and makeTagMenu */ + background-size: auto 50%; + background-position: right 2px center; + background-repeat: no-repeat; +} + +.combobox-entry:hover, .selectholder:hover { + background-image: url('iconsets/New-Dark-Circled/blobdown3-hi.svg'); + /* dont change the 50%, it ties in with makeHoverWork, makeClearWork, and makeTagMenu */ + background-size: auto 50%; + background-position: right 2px center; + background-repeat: no-repeat; +} + +.combo-button { + background-image: url('iconsets/New-Dark-Circled/blobdown3.svg'); +} + +.button-disabled { opacity: 0.1 } + +.icon-play-circled { background-image :url('iconsets/New-Dark-Circled/media-playback-start.svg') } +.playdiv { background-image :url('iconsets/New-Dark-Circled/media-playback-start.svg') } +.icon-play-circled:hover { background-image :url('iconsets/New-Dark-Circled/media-playback-start-highlight.svg') } +.icon-pause-circled { background-image :url('iconsets/New-Dark-Circled/media-playback-pause.svg') } +.icon-pause-circled:hover { background-image :url('iconsets/New-Dark-Circled/media-playback-pause-highlight.svg') } +.icon-fast-backward { background-image :url('iconsets/New-Dark-Circled/media-skip-backward.svg') } +.icon-fast-backward:hover { background-image :url('iconsets/New-Dark-Circled/media-skip-backward-highlight.svg') } +.icon-fast-forward { background-image :url('iconsets/New-Dark-Circled/media-skip-forward.svg') } +.icon-fast-forward:hover { background-image :url('iconsets/New-Dark-Circled/media-skip-forward-highlight.svg') } +.icon-stop-1 { background-image :url('iconsets/New-Dark-Circled/media-playback-stop.svg') } +.icon-stop-1:hover { background-image :url('iconsets/New-Dark-Circled/media-playback-stop-highlight.svg') } +.icon-to-end-1 { background-image :url('iconsets/New-Dark-Circled/stopafter.svg') } +.icon-to-end-1:hover { background-image :url('iconsets/New-Dark-Circled/stopafter-highlight.svg') } + +.icon-music { background-image: url('iconsets/New-Dark-Circled/collection.svg') } +.icon-search { background-image: url('iconsets/New-Dark-Circled/system-search.svg') } +.icon-folder-open-empty { background-image: url('iconsets/New-Dark-Circled/folder.svg') } +.icon-radio-tower { background-image: url('iconsets/New-Dark-Circled/broadcast-new.svg') } +.icon-cd { background-image: url('iconsets/New-Dark-Circled/cd_case.svg') } +.icon-resize-horizontal { background-image: url('iconsets/New-Dark-Circled/resize.svg') } +.icon-angle-double-left { background-image:url('iconsets/New-Dark-Circled/arrow-left-double.svg') } +.icon-angle-double-right { background-image:url('iconsets/New-Dark-Circled/arrow-right-double.svg') } +.icon-menu { background-image: url('iconsets/New-Dark-Circled/pushbutton.svg') } +.icon-versions { background-image: url('iconsets/New-Dark-Circled/history.svg') } +.icon-left-circled { background-image: url('iconsets/New-Dark-Circled/backbutton.svg') } +.icon-right-circled { background-image: url('iconsets/New-Dark-Circled/forwardbutton.svg') } +.icon-cog-alt { background-image: url('iconsets/New-Dark-Circled/preferences.svg') } +.icon-trash { background-image: url('iconsets/New-Dark-Circled/edit-clear-list.svg') } +.icon-wifi { background-image: url('iconsets/New-Dark-Circled/smartradio.svg') } +.icon-doc-text { background-image: url('iconsets/New-Dark-Circled/playlist.svg') } +.icon-floppy { background-image: url('iconsets/New-Dark-Circled/document-save.svg') } +.icon-cancel-circled { background-image: url('iconsets/New-Dark-Circled/edit-delete.svg') } +.icon-plus { + background-image: url('iconsets/New-Dark-Circled/add.svg'); + opacity:0.7; +} +.icon-alarm { background-image: url('iconsets/New-Dark-Circled/alarmclock_false.svg') } +.icon-alarm-on { background-image: url('iconsets/New-Dark-Circled/alarmclock_true.svg') } +.icon-sleep { background-image: url('iconsets/New-Dark-Circled/sleep.svg') } +.icon-library { background-image: url('iconsets/New-Dark-Circled/file.svg') } +.icon-lastfm-1 { background-image: url('iconsets/New-Dark-Circled/lastfm.svg') } +.icon-wikipedia { background-image: url('iconsets/New-Dark-Circled/wikipedia-logo.svg') } +.icon-musicbrainz { background-image: url('iconsets/New-Dark-Circled/musicbrainz_logo.svg') } +.icon-discogs { background-image: url('iconsets/New-Dark-Circled/discogs-logo.svg') } +.icon-doc-text-1 { background-image: url('iconsets/New-Dark-Circled/lyrics.svg') } +.icon-soundcloud-circled { background-image: url('iconsets/New-Dark-Circled/soundcloud-logo.svg') } +.icon-youtube-circled { background-image: url('iconsets/New-Dark-Circled/youtube-logo.svg') } +.icon-gmusic-circled { background-image: url('iconsets/New-Dark-Circled/gmusic-logo.svg') } +.icon-spotify-circled { background-image: url('iconsets/New-Dark-Circled/spotify-logo.svg') } +.icon-vkontakte-circled { background-image: url('iconsets/New-Dark-Circled/vkontakte-logo.svg') } +.icon-podcast-circled { background-image: url('iconsets/New-Dark-Circled/podcast-logo.svg') } +.icon-audiobook { background-image: url('iconsets/New-Dark-Circled/audiobook.svg') } +.icon-internetarchive-circled { background-image: url('iconsets/New-Dark-Circled/internetarchive-logo.svg') } +.icon-increase { background-image: url('iconsets/New-Dark-Circled/arrow-increase.svg') } +.icon-decrease { background-image: url('iconsets/New-Dark-Circled/arrow-decrease.svg') } +.icon-attention-1 { background-image: url('iconsets/New-Dark-Circled/dialog-error.svg') } +.icon-info-circled { background-image: url('iconsets/New-Dark-Circled/dialog-information.svg') } +.icon-download { background-image: url('iconsets/New-Dark-Circled/download-icon.svg') } +.icon-sun { background-image: url('iconsets/New-Dark-Circled/icon-new.svg') } +.icon-headphones { background-image: url('iconsets/New-Dark-Circled/headphones.svg') } +.icon-unlistened { background-image: url('iconsets/New-Dark-Circled/headphones.svg') } +.icon-block { background-image: url('iconsets/New-Dark-Circled/lastfm-ban.svg') } +.icon-heart { background-image: url('iconsets/New-Dark-Circled/lastfm-love.svg') } +.icon-heart-broken { background-image: url('iconsets/New-Dark-Circled/lastfm-unlove.svg') } +.icon-refresh { background-image: url('iconsets/New-Dark-Circled/refresh.svg') } +.icon-dirble-circled { background-image: url('iconsets/New-Dark-Circled/dirble-logo.svg') } +.icon-tunein { background-image: url('iconsets/New-Dark-Circled/../../newimages/tunein-logo.svg') } +.icon-no-response-playbutton { background-image :url('iconsets/New-Dark-Circled/media-playback-start.svg') } +.icon-tags { background-image: url('iconsets/New-Dark-Circled/tag.svg') } +.icon-volume-up { background-image: url('iconsets/New-Dark-Circled/volume.svg') } +.icon-toggle-open { background-image: url('iconsets/New-Dark-Circled/toggle-open.svg') } +.icon-toggle-closed { background-image: url('iconsets/New-Dark-Circled/toggle-closed.svg') } +.icon-spin6 { background-image: url('iconsets/New-Dark-Circled/spinner.svg') } +.icon-output { background-image: url('iconsets/New-Dark-Circled/output.svg') } +.icon-output-mute { background-image: url('iconsets/New-Dark-Circled/output_mute.svg') } +.icon-sliders { background-image: url('iconsets/New-Dark-Circled/sliders.svg') } +.icon-0-stars { background-image: url('iconsets/New-Dark-Circled/0stars.svg') } +.icon-1-stars { background-image: url('iconsets/New-Dark-Circled/1stars.svg') } +.icon-2-stars { background-image: url('iconsets/New-Dark-Circled/2stars.svg') } +.icon-3-stars { background-image: url('iconsets/New-Dark-Circled/3stars.svg') } +.icon-4-stars { background-image: url('iconsets/New-Dark-Circled/4stars.svg') } +.icon-5-stars { background-image: url('iconsets/New-Dark-Circled/5stars.svg') } +.icon-single-star { background-image: url('iconsets/New-Dark-Circled/singlestar.svg') } +.icon-ratandtag { background-image: url('iconsets/New-Dark-Circled/ratandtag.svg') } +.icon-ratortag { background-image: url('iconsets/New-Dark-Circled/ratortag.svg') } +.icon-toggle-on { background-image: url('iconsets/New-Dark-Circled/togglebutton-new2-on.svg') } +.icon-toggle-off { background-image: url('iconsets/New-Dark-Circled/togglebutton-new2-off.svg') } + +.icon-random.flow-on { background-image: url('iconsets/New-Dark-Circled/shuffle.svg') } +.icon-random.flow-off { background-image: url('iconsets/New-Dark-Circled/shuffle_off.svg') } +.icon-crossfade.flow-on { background-image: url('iconsets/New-Dark-Circled/crossfade.svg') } +.icon-crossfade.flow-off { background-image: url('iconsets/New-Dark-Circled/crossfade_off.svg') } +.icon-repeat.flow-on { background-image: url('iconsets/New-Dark-Circled/refresh.svg') } +.icon-repeat.flow-off { background-image: url('iconsets/New-Dark-Circled/refresh_off.svg') } +.icon-consume.flow-on { background-image: url('iconsets/New-Dark-Circled/consume.svg') } +.icon-consume.flow-off { background-image: url('iconsets/New-Dark-Circled/consume_off.svg') } + +.icon-allrandom { background-image: url('iconsets/New-Dark-Circled/shuffle.svg') } +.icon-neverplayed { background-image: url('iconsets/New-Dark-Circled/neverheard.svg') } +.icon-recentlyplayed { background-image: url('iconsets/New-Dark-Circled/calendar.svg') } +.icon-artist { background-image: url('iconsets/New-Dark-Circled/artist-icon.svg') } +.icon-mp3-audio { background-image: url('iconsets/New-Dark-Circled/mp3-audio.svg') } +.icon-aac-audio { background-image: url('iconsets/New-Dark-Circled/aac-audio.svg') } +.icon-flac-audio { background-image: url('iconsets/New-Dark-Circled/flac-audio.svg') } +.icon-wma-audio { background-image: url('iconsets/New-Dark-Circled/wma-audio.svg') } +.icon-ogg-audio { background-image: url('iconsets/New-Dark-Circled/ogg-audio.svg') } +.icon-explicit { background-image: url('iconsets/New-Dark-Circled/parental-advisory.svg') } +.icon-expand-up { background-image: url('iconsets/New-Dark-Circled/expand-up.svg') } +.icon-rss { background-image: url('iconsets/New-Dark-Circled/rss.svg') } +.icon-tick { background-image: url('iconsets/New-Dark-Circled/tick.svg') } +.icon-video { background-image: url('iconsets/New-Dark-Circled/movie-1.svg') } +.icon-bbc-logo { background-image: url('iconsets/New-Dark-Circled/bbc-logo.svg') } +.icon-imdb-logo { background-image: url('iconsets/New-Dark-Circled/imdb-logo.svg') } +.icon-facebook-logo { background-image: url('iconsets/New-Dark-Circled/facebook-logo.svg') } +.icon-twitter-logo { background-image: url('iconsets/New-Dark-Circled/twitter-logo.svg') } +.icon-www { background-image: url('iconsets/New-Dark-Circled/world-wide-web.svg') } +.icon-allmusic { background-image: url('iconsets/New-Dark-Circled/allmusic-logo.svg') } +.icon-updown { background-image: url('iconsets/New-Dark-Circled/arrow-updown.svg') } +.icon-snapcast { background-image: url('iconsets/New-Dark-Circled/../../newimages/snapcast.png') } + +.styledinputs label +{ + display:inline-block; + cursor:pointer; + position:relative; + padding-left:2em; + line-height:1.5em; +} + +.styledinputs input[type=radio] +{ + display:none; +} + +.styledinputs input[type=checkbox] +{ + display:none; +} + +.styledinputs label:before +{ + content:""; + display:inline-block; + width:1.5em; + height:1.5em; + position:absolute; + left:0; + background-image: url('iconsets/New-Dark-Circled/togglebutton-new2-off.svg'); + background-size: auto 80%; + background-position: center; + background-repeat:no-repeat; +} + +.styledinputs input:checked + label:before +{ + background-image: url('iconsets/New-Dark-Circled/togglebutton-new2-on.svg') !important; +} + +img.notexist,img.notfound +{ + background-image: url('iconsets/New-Dark-Circled/compact-disc.svg'); + background-size:contain; + display:inline-block; + background-position: center; + background-repeat:no-repeat; +} + +img.stream.notfound, img.stream.notexist +{ + background-image: url('iconsets/New-Dark-Circled/broadcast-new.svg'); +} + +img.plimage.notfound +{ + background-image: url('iconsets/New-Dark-Circled/playlist.svg'); +} + +.backmenu +{ + background-image: url('iconsets/New-Dark-Circled/arrow-left-double.svg'); + background-repeat: no-repeat; + background-size: contain; +} + +button.iconbutton { + height:2em; + width:2em; + background-size: contain; + background-position:center; + border: none !important; + opacity: 0.8; + background-color:transparent; +} + +button.iconbutton:hover { + opacity: 1; +} + +button.searchbutton { + background-image: url('iconsets/New-Dark-Circled/system-search.svg'); +} + +button.rssbutton { + background-image: url('iconsets/New-Dark-Circled/rss.svg'); +} + diff --git a/www/rompr/iconsets/New-Dark-Circled/tick.svg b/www/rompr/iconsets/New-Dark-Circled/tick.svg new file mode 100644 index 0000000..78dd3ed --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/tick.svg @@ -0,0 +1,335 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/toggle-closed.svg b/www/rompr/iconsets/New-Dark-Circled/toggle-closed.svg new file mode 100644 index 0000000..4179b82 --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/toggle-closed.svg @@ -0,0 +1,376 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/toggle-open.svg b/www/rompr/iconsets/New-Dark-Circled/toggle-open.svg new file mode 100644 index 0000000..20e5f9f --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/toggle-open.svg @@ -0,0 +1,372 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/togglebutton-new2-off.svg b/www/rompr/iconsets/New-Dark-Circled/togglebutton-new2-off.svg new file mode 100644 index 0000000..bba9958 --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/togglebutton-new2-off.svg @@ -0,0 +1,444 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/togglebutton-new2-on.svg b/www/rompr/iconsets/New-Dark-Circled/togglebutton-new2-on.svg new file mode 100644 index 0000000..51ce304 --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/togglebutton-new2-on.svg @@ -0,0 +1,542 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/twitter-logo.svg b/www/rompr/iconsets/New-Dark-Circled/twitter-logo.svg new file mode 100644 index 0000000..7658617 --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/twitter-logo.svg @@ -0,0 +1,367 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/unlistened.svg b/www/rompr/iconsets/New-Dark-Circled/unlistened.svg new file mode 100644 index 0000000..8faf809 --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/unlistened.svg @@ -0,0 +1,17 @@ + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/vkontakte-logo.svg b/www/rompr/iconsets/New-Dark-Circled/vkontakte-logo.svg new file mode 100644 index 0000000..51b9e6e --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/vkontakte-logo.svg @@ -0,0 +1,428 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/volume.svg b/www/rompr/iconsets/New-Dark-Circled/volume.svg new file mode 100644 index 0000000..0e08fb1 --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/volume.svg @@ -0,0 +1,90 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/wikipedia-logo.svg b/www/rompr/iconsets/New-Dark-Circled/wikipedia-logo.svg new file mode 100644 index 0000000..8b38843 --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/wikipedia-logo.svg @@ -0,0 +1,331 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/wma-audio.svg b/www/rompr/iconsets/New-Dark-Circled/wma-audio.svg new file mode 100644 index 0000000..2cffd45 --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/wma-audio.svg @@ -0,0 +1,70 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Dark-Circled/world-wide-web.svg b/www/rompr/iconsets/New-Dark-Circled/world-wide-web.svg new file mode 100644 index 0000000..2c0820d --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/world-wide-web.svg @@ -0,0 +1,61 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/New-Dark-Circled/youtube-logo.svg b/www/rompr/iconsets/New-Dark-Circled/youtube-logo.svg new file mode 100644 index 0000000..cc1d1fb --- /dev/null +++ b/www/rompr/iconsets/New-Dark-Circled/youtube-logo.svg @@ -0,0 +1,327 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/0stars.svg b/www/rompr/iconsets/New-Light-Circled/0stars.svg new file mode 100644 index 0000000..f691339 --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/0stars.svg @@ -0,0 +1,19 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/1stars.svg b/www/rompr/iconsets/New-Light-Circled/1stars.svg new file mode 100644 index 0000000..43748ec --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/1stars.svg @@ -0,0 +1,19 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/2stars.svg b/www/rompr/iconsets/New-Light-Circled/2stars.svg new file mode 100644 index 0000000..1e77ad4 --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/2stars.svg @@ -0,0 +1,19 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/3stars.svg b/www/rompr/iconsets/New-Light-Circled/3stars.svg new file mode 100644 index 0000000..637f181 --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/3stars.svg @@ -0,0 +1,19 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/4stars.svg b/www/rompr/iconsets/New-Light-Circled/4stars.svg new file mode 100644 index 0000000..74c0034 --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/4stars.svg @@ -0,0 +1,19 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/5stars.svg b/www/rompr/iconsets/New-Light-Circled/5stars.svg new file mode 100644 index 0000000..dbb99b5 --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/5stars.svg @@ -0,0 +1,19 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/aac-audio.svg b/www/rompr/iconsets/New-Light-Circled/aac-audio.svg new file mode 100644 index 0000000..43d66f2 --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/aac-audio.svg @@ -0,0 +1,96 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/add.svg b/www/rompr/iconsets/New-Light-Circled/add.svg new file mode 100644 index 0000000..7f9ced3 --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/add.svg @@ -0,0 +1,50 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/adjustments.css b/www/rompr/iconsets/New-Light-Circled/adjustments.css new file mode 100644 index 0000000..9b93f77 --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/adjustments.css @@ -0,0 +1,230 @@ +#buttons +{ + padding-left:12px; + padding-right:12px; + padding-top:4px; + padding-bottom:6px; +} + +.controlbutton +{ + margin:0px; + padding:0px; + vertical-align:middle; + display:inline-block; + width:56px; + height:56px; +} + +.controlbutton-small +{ + margin:0px; + vertical-align:middle; + display:inline-block; + width:48px; + height:48px; +} + +@media screen and (min-height: 800px) and (max-height: 939px) { + .controlbutton { + width:64px; + height:64px; + } + #buttons { + padding-top:12px; + } + #playbackTime { + margin-top:2px; + font-size:12px; + line-height:14px; + height:14px; + } +} + +@media screen and (min-height: 940px) and (max-height: 1099px) and (min-width: 650px) { + .controlbutton { + width:84px; + height:84px; + } + + .controlbutton-small { + width:64px; + height:64px; + } + + .shiftleft + { + left:-12px; + position:relative; + z-index:250; + } + + .shiftleft2 + { + left:-26px; + position:relative; + } + + .shiftleft3 + { + position:relative; + left:-36px; + z-index:5; + } + + .shiftleft4 + { + position:relative; + left:-48px; + z-index:1; + margin-right:-36px; + } + +} + +@media screen and (min-height: 940px) and (max-height: 1099px) and (min-width: 650px) { + .controlbutton { + width:84px; + height:84px; + } + .controlbutton-small { + width:64px; + height:64px; + } + #buttons { + padding-top:16px; + padding-left:24px; + } + #playbackTime { + margin-top:4px; + font-size:14px; + line-height:16px; + height:16px; + } + .shiftleft + { + left:-12px; + position:relative; + z-index:250; + } + + .shiftleft2 + { + left:-24px; + position:relative; + } + + .shiftleft3 + { + position:relative; + left:-36px; + z-index:5; + } + + .shiftleft4 + { + position:relative; + left:-48px; + z-index:1; + margin-right:-36px; + } +} + +@media screen and (min-height: 1100px) and (min-width: 651px) and (max-width: 749px) { + .controlbutton { + width:84px; + height:84px; + } + .controlbutton-small { + width:64px; + height:64px; + } + #buttons { + padding-top:16px; + padding-left:24px; + } + #playbackTime { + margin-top:4px; + font-size:14px; + line-height:16px; + height:16px; + } + .shiftleft + { + left:-12px; + position:relative; + z-index:250; + } + + .shiftleft2 + { + left:-26px; + position:relative; + } + + .shiftleft3 + { + position:relative; + left:-36px; + z-index:5; + } + + .shiftleft4 + { + position:relative; + left:-48px; + z-index:1; + margin-right:-36px; + } +} + +@media screen and (min-height: 1100px) and (min-width: 720px) { + .controlbutton { + width:90px; + height:90px; + } + .controlbutton-small { + width:70px; + height:70px; + } + #buttons { + padding-top:12px; + padding-left:20px; + } + #progress { + margin-top:8px; + } + #playbackTime { + margin-top:12px; + font-size:16px; + line-height:18px; + height:18px; + } + .shiftleft + { + left:-10px; + position:relative; + z-index:250; + } + + .shiftleft2 + { + left:-22px; + position:relative; + } + + .shiftleft3 + { + position:relative; + left:-34px; + z-index:5; + } + + .shiftleft4 + { + position:relative; + left:-44px; + z-index:1; + margin-right:-36px; + } +} diff --git a/www/rompr/iconsets/New-Light-Circled/alarmclock_false.svg b/www/rompr/iconsets/New-Light-Circled/alarmclock_false.svg new file mode 100644 index 0000000..7b98007 --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/alarmclock_false.svg @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/alarmclock_true.svg b/www/rompr/iconsets/New-Light-Circled/alarmclock_true.svg new file mode 100644 index 0000000..0a66d3f --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/alarmclock_true.svg @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/allmusic-logo.svg b/www/rompr/iconsets/New-Light-Circled/allmusic-logo.svg new file mode 100644 index 0000000..04450b8 --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/allmusic-logo.svg @@ -0,0 +1,397 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/arrow-decrease.svg b/www/rompr/iconsets/New-Light-Circled/arrow-decrease.svg new file mode 100644 index 0000000..128b319 --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/arrow-decrease.svg @@ -0,0 +1,80 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/arrow-increase.svg b/www/rompr/iconsets/New-Light-Circled/arrow-increase.svg new file mode 100644 index 0000000..de90b73 --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/arrow-increase.svg @@ -0,0 +1,80 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/arrow-left-double.svg b/www/rompr/iconsets/New-Light-Circled/arrow-left-double.svg new file mode 100644 index 0000000..c4040d7 --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/arrow-left-double.svg @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/arrow-right-double.svg b/www/rompr/iconsets/New-Light-Circled/arrow-right-double.svg new file mode 100644 index 0000000..98061ea --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/arrow-right-double.svg @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/arrow-updown.svg b/www/rompr/iconsets/New-Light-Circled/arrow-updown.svg new file mode 100644 index 0000000..bc683ae --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/arrow-updown.svg @@ -0,0 +1,62 @@ + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/artist-icon.svg b/www/rompr/iconsets/New-Light-Circled/artist-icon.svg new file mode 100644 index 0000000..dbbdec7 --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/artist-icon.svg @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/audiobook.svg b/www/rompr/iconsets/New-Light-Circled/audiobook.svg new file mode 100644 index 0000000..796fd88 --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/audiobook.svg @@ -0,0 +1,215 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/backbutton.svg b/www/rompr/iconsets/New-Light-Circled/backbutton.svg new file mode 100644 index 0000000..b3579ed --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/backbutton.svg @@ -0,0 +1,55 @@ + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/bbc-logo.svg b/www/rompr/iconsets/New-Light-Circled/bbc-logo.svg new file mode 100644 index 0000000..da24885 --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/bbc-logo.svg @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/blobdown3-hi.svg b/www/rompr/iconsets/New-Light-Circled/blobdown3-hi.svg new file mode 100644 index 0000000..f6b3ea6 --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/blobdown3-hi.svg @@ -0,0 +1,73 @@ + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/blobdown3.svg b/www/rompr/iconsets/New-Light-Circled/blobdown3.svg new file mode 100644 index 0000000..9b3b737 --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/blobdown3.svg @@ -0,0 +1,73 @@ + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/broadcast-new.svg b/www/rompr/iconsets/New-Light-Circled/broadcast-new.svg new file mode 100644 index 0000000..f3694fd --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/broadcast-new.svg @@ -0,0 +1,89 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/calendar.svg b/www/rompr/iconsets/New-Light-Circled/calendar.svg new file mode 100644 index 0000000..a198756 --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/calendar.svg @@ -0,0 +1,188 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/cd_case.svg b/www/rompr/iconsets/New-Light-Circled/cd_case.svg new file mode 100644 index 0000000..e923422 --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/cd_case.svg @@ -0,0 +1,223 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/collection.svg b/www/rompr/iconsets/New-Light-Circled/collection.svg new file mode 100644 index 0000000..5644303 --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/collection.svg @@ -0,0 +1,229 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/compact-disc.svg b/www/rompr/iconsets/New-Light-Circled/compact-disc.svg new file mode 100644 index 0000000..e86cdf7 --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/compact-disc.svg @@ -0,0 +1,61 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/New-Light-Circled/consume.svg b/www/rompr/iconsets/New-Light-Circled/consume.svg new file mode 100644 index 0000000..cf8ff48 --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/consume.svg @@ -0,0 +1,104 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/consume_off.svg b/www/rompr/iconsets/New-Light-Circled/consume_off.svg new file mode 100644 index 0000000..ec0cdc5 --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/consume_off.svg @@ -0,0 +1,104 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/crossfade.svg b/www/rompr/iconsets/New-Light-Circled/crossfade.svg new file mode 100644 index 0000000..a38348c --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/crossfade.svg @@ -0,0 +1,110 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/crossfade_off.svg b/www/rompr/iconsets/New-Light-Circled/crossfade_off.svg new file mode 100644 index 0000000..a297f39 --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/crossfade_off.svg @@ -0,0 +1,76 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/dialog-error.svg b/www/rompr/iconsets/New-Light-Circled/dialog-error.svg new file mode 100644 index 0000000..3838550 --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/dialog-error.svg @@ -0,0 +1,193 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/dialog-information.svg b/www/rompr/iconsets/New-Light-Circled/dialog-information.svg new file mode 100644 index 0000000..2e2e9ca --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/dialog-information.svg @@ -0,0 +1,205 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/dirble-logo.svg b/www/rompr/iconsets/New-Light-Circled/dirble-logo.svg new file mode 100644 index 0000000..65ef17c --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/dirble-logo.svg @@ -0,0 +1,211 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/discogs-logo.svg b/www/rompr/iconsets/New-Light-Circled/discogs-logo.svg new file mode 100644 index 0000000..58f8d1b --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/discogs-logo.svg @@ -0,0 +1,436 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/document-save.svg b/www/rompr/iconsets/New-Light-Circled/document-save.svg new file mode 100644 index 0000000..3fc40b3 --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/document-save.svg @@ -0,0 +1,239 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/download-icon.svg b/www/rompr/iconsets/New-Light-Circled/download-icon.svg new file mode 100644 index 0000000..b3751bb --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/download-icon.svg @@ -0,0 +1,216 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/edit-clear-list.svg b/www/rompr/iconsets/New-Light-Circled/edit-clear-list.svg new file mode 100644 index 0000000..846ba86 --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/edit-clear-list.svg @@ -0,0 +1,265 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/edit-delete.svg b/www/rompr/iconsets/New-Light-Circled/edit-delete.svg new file mode 100644 index 0000000..86680d4 --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/edit-delete.svg @@ -0,0 +1,50 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/expand-up.svg b/www/rompr/iconsets/New-Light-Circled/expand-up.svg new file mode 100644 index 0000000..9bc098f --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/expand-up.svg @@ -0,0 +1,239 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/facebook-logo.svg b/www/rompr/iconsets/New-Light-Circled/facebook-logo.svg new file mode 100644 index 0000000..3c63c65 --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/facebook-logo.svg @@ -0,0 +1,79 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/file.svg b/www/rompr/iconsets/New-Light-Circled/file.svg new file mode 100644 index 0000000..dc036cf --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/file.svg @@ -0,0 +1,223 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/flac-audio.svg b/www/rompr/iconsets/New-Light-Circled/flac-audio.svg new file mode 100644 index 0000000..cde73af --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/flac-audio.svg @@ -0,0 +1,110 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/folder.svg b/www/rompr/iconsets/New-Light-Circled/folder.svg new file mode 100644 index 0000000..69092c7 --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/folder.svg @@ -0,0 +1,697 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/forwardbutton.svg b/www/rompr/iconsets/New-Light-Circled/forwardbutton.svg new file mode 100644 index 0000000..2a36ad7 --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/forwardbutton.svg @@ -0,0 +1,59 @@ + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/gmusic-logo.svg b/www/rompr/iconsets/New-Light-Circled/gmusic-logo.svg new file mode 100644 index 0000000..fb17c3f --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/gmusic-logo.svg @@ -0,0 +1,107 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/headphones.svg b/www/rompr/iconsets/New-Light-Circled/headphones.svg new file mode 100644 index 0000000..1e06463 --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/headphones.svg @@ -0,0 +1,668 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/icon-new.svg b/www/rompr/iconsets/New-Light-Circled/icon-new.svg new file mode 100644 index 0000000..df1e363 --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/icon-new.svg @@ -0,0 +1,670 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/imdb-logo.svg b/www/rompr/iconsets/New-Light-Circled/imdb-logo.svg new file mode 100644 index 0000000..bb4cc6d --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/imdb-logo.svg @@ -0,0 +1,447 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/internetarchive-logo.svg b/www/rompr/iconsets/New-Light-Circled/internetarchive-logo.svg new file mode 100644 index 0000000..13213fe --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/internetarchive-logo.svg @@ -0,0 +1,368 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/lastfm-ban.svg b/www/rompr/iconsets/New-Light-Circled/lastfm-ban.svg new file mode 100644 index 0000000..daf8628 --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/lastfm-ban.svg @@ -0,0 +1,3 @@ + + +image/svg+xml diff --git a/www/rompr/iconsets/New-Light-Circled/lastfm-love.svg b/www/rompr/iconsets/New-Light-Circled/lastfm-love.svg new file mode 100644 index 0000000..5d4a8ff --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/lastfm-love.svg @@ -0,0 +1,665 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/lastfm-unlove.svg b/www/rompr/iconsets/New-Light-Circled/lastfm-unlove.svg new file mode 100644 index 0000000..ff22199 --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/lastfm-unlove.svg @@ -0,0 +1,657 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/lastfm.svg b/www/rompr/iconsets/New-Light-Circled/lastfm.svg new file mode 100644 index 0000000..f1e5315 --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/lastfm.svg @@ -0,0 +1,173 @@ + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/lyrics.svg b/www/rompr/iconsets/New-Light-Circled/lyrics.svg new file mode 100644 index 0000000..710285b --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/lyrics.svg @@ -0,0 +1,657 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/media-playback-pause-highlight.svg b/www/rompr/iconsets/New-Light-Circled/media-playback-pause-highlight.svg new file mode 100644 index 0000000..8f99576 --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/media-playback-pause-highlight.svg @@ -0,0 +1,72 @@ + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/media-playback-pause.svg b/www/rompr/iconsets/New-Light-Circled/media-playback-pause.svg new file mode 100644 index 0000000..c9f86de --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/media-playback-pause.svg @@ -0,0 +1,56 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/media-playback-start-highlight.svg b/www/rompr/iconsets/New-Light-Circled/media-playback-start-highlight.svg new file mode 100644 index 0000000..2362f6b --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/media-playback-start-highlight.svg @@ -0,0 +1,81 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/media-playback-start.svg b/www/rompr/iconsets/New-Light-Circled/media-playback-start.svg new file mode 100644 index 0000000..8330e83 --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/media-playback-start.svg @@ -0,0 +1,81 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/media-playback-stop-highlight.svg b/www/rompr/iconsets/New-Light-Circled/media-playback-stop-highlight.svg new file mode 100644 index 0000000..ab350d8 --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/media-playback-stop-highlight.svg @@ -0,0 +1,65 @@ + + + + + + + + image/svg+xml + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/media-playback-stop.svg b/www/rompr/iconsets/New-Light-Circled/media-playback-stop.svg new file mode 100644 index 0000000..eade913 --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/media-playback-stop.svg @@ -0,0 +1,45 @@ + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/media-skip-backward-highlight.svg b/www/rompr/iconsets/New-Light-Circled/media-skip-backward-highlight.svg new file mode 100644 index 0000000..0514cba --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/media-skip-backward-highlight.svg @@ -0,0 +1,69 @@ + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/media-skip-backward.svg b/www/rompr/iconsets/New-Light-Circled/media-skip-backward.svg new file mode 100644 index 0000000..34e39bc --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/media-skip-backward.svg @@ -0,0 +1,69 @@ + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/media-skip-forward-highlight.svg b/www/rompr/iconsets/New-Light-Circled/media-skip-forward-highlight.svg new file mode 100644 index 0000000..80b87bb --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/media-skip-forward-highlight.svg @@ -0,0 +1,68 @@ + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/media-skip-forward.svg b/www/rompr/iconsets/New-Light-Circled/media-skip-forward.svg new file mode 100644 index 0000000..a4d414c --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/media-skip-forward.svg @@ -0,0 +1,68 @@ + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/movie-1.svg b/www/rompr/iconsets/New-Light-Circled/movie-1.svg new file mode 100644 index 0000000..43d2bc7 --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/movie-1.svg @@ -0,0 +1,38 @@ + + + + + + + image/svg+xml + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/mp3-audio.svg b/www/rompr/iconsets/New-Light-Circled/mp3-audio.svg new file mode 100644 index 0000000..e16641c --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/mp3-audio.svg @@ -0,0 +1,38 @@ + + + + + + + image/svg+xml + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/musicbrainz_logo.svg b/www/rompr/iconsets/New-Light-Circled/musicbrainz_logo.svg new file mode 100644 index 0000000..7aed4be --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/musicbrainz_logo.svg @@ -0,0 +1,230 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/neverheard.svg b/www/rompr/iconsets/New-Light-Circled/neverheard.svg new file mode 100644 index 0000000..342cb9b --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/neverheard.svg @@ -0,0 +1,46 @@ + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/ogg-audio.svg b/www/rompr/iconsets/New-Light-Circled/ogg-audio.svg new file mode 100644 index 0000000..395e2f1 --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/ogg-audio.svg @@ -0,0 +1,51 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/output.svg b/www/rompr/iconsets/New-Light-Circled/output.svg new file mode 100644 index 0000000..e7c958c --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/output.svg @@ -0,0 +1,90 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/output_mute.svg b/www/rompr/iconsets/New-Light-Circled/output_mute.svg new file mode 100644 index 0000000..2466128 --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/output_mute.svg @@ -0,0 +1,88 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/parental-advisory.svg b/www/rompr/iconsets/New-Light-Circled/parental-advisory.svg new file mode 100644 index 0000000..3ef12ce --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/parental-advisory.svg @@ -0,0 +1,446 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/playlist.svg b/www/rompr/iconsets/New-Light-Circled/playlist.svg new file mode 100644 index 0000000..3ddf3f8 --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/playlist.svg @@ -0,0 +1,93 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/podcast-logo.svg b/www/rompr/iconsets/New-Light-Circled/podcast-logo.svg new file mode 100644 index 0000000..ca0c547 --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/podcast-logo.svg @@ -0,0 +1,38 @@ + + + + + + + image/svg+xml + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/preferences.svg b/www/rompr/iconsets/New-Light-Circled/preferences.svg new file mode 100644 index 0000000..08877bf --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/preferences.svg @@ -0,0 +1,85 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/pushbutton.svg b/www/rompr/iconsets/New-Light-Circled/pushbutton.svg new file mode 100644 index 0000000..5ef0c33 --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/pushbutton.svg @@ -0,0 +1,65 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/ratandtag.svg b/www/rompr/iconsets/New-Light-Circled/ratandtag.svg new file mode 100644 index 0000000..06c2f81 --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/ratandtag.svg @@ -0,0 +1,61 @@ + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/ratortag.svg b/www/rompr/iconsets/New-Light-Circled/ratortag.svg new file mode 100644 index 0000000..f685eb1 --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/ratortag.svg @@ -0,0 +1,65 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/refresh.svg b/www/rompr/iconsets/New-Light-Circled/refresh.svg new file mode 100644 index 0000000..895185a --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/refresh.svg @@ -0,0 +1,44 @@ + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/refresh_off.svg b/www/rompr/iconsets/New-Light-Circled/refresh_off.svg new file mode 100644 index 0000000..6357edb --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/refresh_off.svg @@ -0,0 +1,77 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/resize.svg b/www/rompr/iconsets/New-Light-Circled/resize.svg new file mode 100644 index 0000000..f6e99c0 --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/resize.svg @@ -0,0 +1,3 @@ + + +image/svg+xml diff --git a/www/rompr/iconsets/New-Light-Circled/rss.svg b/www/rompr/iconsets/New-Light-Circled/rss.svg new file mode 100644 index 0000000..86b27d4 --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/rss.svg @@ -0,0 +1,129 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/shuffle.svg b/www/rompr/iconsets/New-Light-Circled/shuffle.svg new file mode 100644 index 0000000..0068721 --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/shuffle.svg @@ -0,0 +1,75 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/shuffle_off.svg b/www/rompr/iconsets/New-Light-Circled/shuffle_off.svg new file mode 100644 index 0000000..709a400 --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/shuffle_off.svg @@ -0,0 +1,122 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/singlestar.svg b/www/rompr/iconsets/New-Light-Circled/singlestar.svg new file mode 100644 index 0000000..86dd84a --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/singlestar.svg @@ -0,0 +1,328 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/sleep.svg b/www/rompr/iconsets/New-Light-Circled/sleep.svg new file mode 100644 index 0000000..80f04f4 --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/sleep.svg @@ -0,0 +1,93 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/sliders.svg b/www/rompr/iconsets/New-Light-Circled/sliders.svg new file mode 100644 index 0000000..42ef009 --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/sliders.svg @@ -0,0 +1,62 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/smartradio.svg b/www/rompr/iconsets/New-Light-Circled/smartradio.svg new file mode 100644 index 0000000..c6aef0c --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/smartradio.svg @@ -0,0 +1,48 @@ + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/soundcloud-logo.svg b/www/rompr/iconsets/New-Light-Circled/soundcloud-logo.svg new file mode 100644 index 0000000..8c0fdd6 --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/soundcloud-logo.svg @@ -0,0 +1,61 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/New-Light-Circled/spinner.svg b/www/rompr/iconsets/New-Light-Circled/spinner.svg new file mode 100644 index 0000000..4e86fee --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/spinner.svg @@ -0,0 +1,421 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/spotify-logo.svg b/www/rompr/iconsets/New-Light-Circled/spotify-logo.svg new file mode 100644 index 0000000..b871e4d --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/spotify-logo.svg @@ -0,0 +1,187 @@ + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/stopafter-highlight.svg b/www/rompr/iconsets/New-Light-Circled/stopafter-highlight.svg new file mode 100644 index 0000000..fa7c92f --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/stopafter-highlight.svg @@ -0,0 +1,70 @@ + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/stopafter.svg b/www/rompr/iconsets/New-Light-Circled/stopafter.svg new file mode 100644 index 0000000..1bbc953 --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/stopafter.svg @@ -0,0 +1,70 @@ + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/system-search.svg b/www/rompr/iconsets/New-Light-Circled/system-search.svg new file mode 100644 index 0000000..922472b --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/system-search.svg @@ -0,0 +1,43 @@ + + + + + + + image/svg+xml + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/tag.svg b/www/rompr/iconsets/New-Light-Circled/tag.svg new file mode 100644 index 0000000..f38271e --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/tag.svg @@ -0,0 +1,327 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/theme.css b/www/rompr/iconsets/New-Light-Circled/theme.css new file mode 100644 index 0000000..5dcadbe --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/theme.css @@ -0,0 +1,249 @@ + + [class^="icon-"], [class*=" icon-"] { + background-size:contain; + background-position: center; + background-repeat:no-repeat; + display:inline-block; +} + +[class^="icon-"]:not(.button-disabled):hover, [class*=" icon-"]:not(.button-disabled):hover { + opacity: 1; + background-color: rgba(255,173,0,0.07); +} + +.clearbox { + background-image: url('iconsets/New-Light-Circled/edit-delete.svg'); + /* dont change the 50%, it ties in with makeHoverWork, makeClearWork, and makeTagMenu */ + background-size: auto 50%; + background-position: right 2px center; + background-repeat: no-repeat; +} + +.combobox-entry, .selectholder { + background-image: url('iconsets/New-Light-Circled/blobdown3.svg'); + /* dont change the 50%, it ties in with makeHoverWork, makeClearWork, and makeTagMenu */ + background-size: auto 50%; + background-position: right 2px center; + background-repeat: no-repeat; +} + +.combobox-entry:hover, .selectholder:hover { + background-image: url('iconsets/New-Light-Circled/blobdown3-hi.svg'); + /* dont change the 50%, it ties in with makeHoverWork, makeClearWork, and makeTagMenu */ + background-size: auto 50%; + background-position: right 2px center; + background-repeat: no-repeat; +} + +.combo-button { + background-image: url('iconsets/New-Light-Circled/blobdown3.svg'); +} + +.button-disabled { opacity: 0.1 } + +.icon-play-circled { background-image :url('iconsets/New-Light-Circled/media-playback-start.svg') } +.playdiv { background-image :url('iconsets/New-Light-Circled/media-playback-start.svg') } +.icon-play-circled:hover { background-image :url('iconsets/New-Light-Circled/media-playback-start-highlight.svg') } +.icon-pause-circled { background-image :url('iconsets/New-Light-Circled/media-playback-pause.svg') } +.icon-pause-circled:hover { background-image :url('iconsets/New-Light-Circled/media-playback-pause-highlight.svg') } +.icon-fast-backward { background-image :url('iconsets/New-Light-Circled/media-skip-backward.svg') } +.icon-fast-backward:hover { background-image :url('iconsets/New-Light-Circled/media-skip-backward-highlight.svg') } +.icon-fast-forward { background-image :url('iconsets/New-Light-Circled/media-skip-forward.svg') } +.icon-fast-forward:hover { background-image :url('iconsets/New-Light-Circled/media-skip-forward-highlight.svg') } +.icon-stop-1 { background-image :url('iconsets/New-Light-Circled/media-playback-stop.svg') } +.icon-stop-1:hover { background-image :url('iconsets/New-Light-Circled/media-playback-stop-highlight.svg') } +.icon-to-end-1 { background-image :url('iconsets/New-Light-Circled/stopafter.svg') } +.icon-to-end-1:hover { background-image :url('iconsets/New-Light-Circled/stopafter-highlight.svg') } + +.icon-music { background-image: url('iconsets/New-Light-Circled/collection.svg') } +.icon-search { background-image: url('iconsets/New-Light-Circled/system-search.svg') } +.icon-folder-open-empty { background-image: url('iconsets/New-Light-Circled/folder.svg') } +.icon-radio-tower { background-image: url('iconsets/New-Light-Circled/broadcast-new.svg') } +.icon-cd { background-image: url('iconsets/New-Light-Circled/cd_case.svg') } +.icon-resize-horizontal { background-image: url('iconsets/New-Light-Circled/resize.svg') } +.icon-angle-double-left { background-image:url('iconsets/New-Light-Circled/arrow-left-double.svg') } +.icon-angle-double-right { background-image:url('iconsets/New-Light-Circled/arrow-right-double.svg') } +.icon-menu { background-image: url('iconsets/New-Light-Circled/pushbutton.svg') } +.icon-versions { background-image: url('iconsets/New-Light-Circled/history.svg') } +.icon-left-circled { background-image: url('iconsets/New-Light-Circled/backbutton.svg') } +.icon-right-circled { background-image: url('iconsets/New-Light-Circled/forwardbutton.svg') } +.icon-cog-alt { background-image: url('iconsets/New-Light-Circled/preferences.svg') } +.icon-trash { background-image: url('iconsets/New-Light-Circled/edit-clear-list.svg') } +.icon-wifi { background-image: url('iconsets/New-Light-Circled/smartradio.svg') } +.icon-doc-text { background-image: url('iconsets/New-Light-Circled/playlist.svg') } +.icon-floppy { background-image: url('iconsets/New-Light-Circled/document-save.svg') } +.icon-cancel-circled { background-image: url('iconsets/New-Light-Circled/edit-delete.svg') } +.icon-plus { + background-image: url('iconsets/New-Light-Circled/add.svg'); + opacity:0.7; +} +.icon-alarm { background-image: url('iconsets/New-Light-Circled/alarmclock_false.svg') } +.icon-alarm-on { background-image: url('iconsets/New-Light-Circled/alarmclock_true.svg') } +.icon-sleep { background-image: url('iconsets/New-Light-Circled/sleep.svg') } +.icon-library { background-image: url('iconsets/New-Light-Circled/file.svg') } +.icon-lastfm-1 { background-image: url('iconsets/New-Light-Circled/lastfm.svg') } +.icon-wikipedia { background-image: url('iconsets/New-Light-Circled/wikipedia-logo.svg') } +.icon-musicbrainz { background-image: url('iconsets/New-Light-Circled/musicbrainz_logo.svg') } +.icon-discogs { background-image: url('iconsets/New-Light-Circled/discogs-logo.svg') } +.icon-doc-text-1 { background-image: url('iconsets/New-Light-Circled/lyrics.svg') } +.icon-soundcloud-circled { background-image: url('iconsets/New-Light-Circled/soundcloud-logo.svg') } +.icon-youtube-circled { background-image: url('iconsets/New-Light-Circled/youtube-logo.svg') } +.icon-gmusic-circled { background-image: url('iconsets/New-Light-Circled/gmusic-logo.svg') } +.icon-spotify-circled { background-image: url('iconsets/New-Light-Circled/spotify-logo.svg') } +.icon-vkontakte-circled { background-image: url('iconsets/New-Light-Circled/vkontakte-logo.svg') } +.icon-podcast-circled { background-image: url('iconsets/New-Light-Circled/podcast-logo.svg') } +.icon-audiobook { background-image: url('iconsets/New-Light-Circled/audiobook.svg') } +.icon-internetarchive-circled { background-image: url('iconsets/New-Light-Circled/internetarchive-logo.svg') } +.icon-increase { background-image: url('iconsets/New-Light-Circled/arrow-increase.svg') } +.icon-decrease { background-image: url('iconsets/New-Light-Circled/arrow-decrease.svg') } +.icon-attention-1 { background-image: url('iconsets/New-Light-Circled/dialog-error.svg') } +.icon-info-circled { background-image: url('iconsets/New-Light-Circled/dialog-information.svg') } +.icon-download { background-image: url('iconsets/New-Light-Circled/download-icon.svg') } +.icon-sun { background-image: url('iconsets/New-Light-Circled/icon-new.svg') } +.icon-headphones { background-image: url('iconsets/New-Light-Circled/headphones.svg') } +.icon-unlistened { background-image: url('iconsets/New-Light-Circled/headphones.svg') } +.icon-block { background-image: url('iconsets/New-Light-Circled/lastfm-ban.svg') } +.icon-heart { background-image: url('iconsets/New-Light-Circled/lastfm-love.svg') } +.icon-heart-broken { background-image: url('iconsets/New-Light-Circled/lastfm-unlove.svg') } +.icon-refresh { background-image: url('iconsets/New-Light-Circled/refresh.svg') } +.icon-dirble-circled { background-image: url('iconsets/New-Light-Circled/dirble-logo.svg') } +.icon-tunein { background-image: url('iconsets/New-Light-Circled/../../newimages/tunein-logo.svg') } +.icon-no-response-playbutton { background-image :url('iconsets/New-Light-Circled/media-playback-start.svg') } +.icon-tags { background-image: url('iconsets/New-Light-Circled/tag.svg') } +.icon-volume-up { background-image: url('iconsets/New-Light-Circled/volume.svg') } +.icon-toggle-open { background-image: url('iconsets/New-Light-Circled/toggle-open.svg') } +.icon-toggle-closed { background-image: url('iconsets/New-Light-Circled/toggle-closed.svg') } +.icon-spin6 { background-image: url('iconsets/New-Light-Circled/spinner.svg') } +.icon-output { background-image: url('iconsets/New-Light-Circled/output.svg') } +.icon-output-mute { background-image: url('iconsets/New-Light-Circled/output_mute.svg') } +.icon-sliders { background-image: url('iconsets/New-Light-Circled/sliders.svg') } +.icon-0-stars { background-image: url('iconsets/New-Light-Circled/0stars.svg') } +.icon-1-stars { background-image: url('iconsets/New-Light-Circled/1stars.svg') } +.icon-2-stars { background-image: url('iconsets/New-Light-Circled/2stars.svg') } +.icon-3-stars { background-image: url('iconsets/New-Light-Circled/3stars.svg') } +.icon-4-stars { background-image: url('iconsets/New-Light-Circled/4stars.svg') } +.icon-5-stars { background-image: url('iconsets/New-Light-Circled/5stars.svg') } +.icon-single-star { background-image: url('iconsets/New-Light-Circled/singlestar.svg') } +.icon-ratandtag { background-image: url('iconsets/New-Light-Circled/ratandtag.svg') } +.icon-ratortag { background-image: url('iconsets/New-Light-Circled/ratortag.svg') } +.icon-toggle-on { background-image: url('iconsets/New-Light-Circled/togglebutton-new2-on.svg') } +.icon-toggle-off { background-image: url('iconsets/New-Light-Circled/togglebutton-new2-off.svg') } + +.icon-random.flow-on { background-image: url('iconsets/New-Light-Circled/shuffle.svg') } +.icon-random.flow-off { background-image: url('iconsets/New-Light-Circled/shuffle_off.svg') } +.icon-crossfade.flow-on { background-image: url('iconsets/New-Light-Circled/crossfade.svg') } +.icon-crossfade.flow-off { background-image: url('iconsets/New-Light-Circled/crossfade_off.svg') } +.icon-repeat.flow-on { background-image: url('iconsets/New-Light-Circled/refresh.svg') } +.icon-repeat.flow-off { background-image: url('iconsets/New-Light-Circled/refresh_off.svg') } +.icon-consume.flow-on { background-image: url('iconsets/New-Light-Circled/consume.svg') } +.icon-consume.flow-off { background-image: url('iconsets/New-Light-Circled/consume_off.svg') } + +.icon-allrandom { background-image: url('iconsets/New-Light-Circled/shuffle.svg') } +.icon-neverplayed { background-image: url('iconsets/New-Light-Circled/neverheard.svg') } +.icon-recentlyplayed { background-image: url('iconsets/New-Light-Circled/calendar.svg') } +.icon-artist { background-image: url('iconsets/New-Light-Circled/artist-icon.svg') } +.icon-mp3-audio { background-image: url('iconsets/New-Light-Circled/mp3-audio.svg') } +.icon-aac-audio { background-image: url('iconsets/New-Light-Circled/aac-audio.svg') } +.icon-flac-audio { background-image: url('iconsets/New-Light-Circled/flac-audio.svg') } +.icon-wma-audio { background-image: url('iconsets/New-Light-Circled/wma-audio.svg') } +.icon-ogg-audio { background-image: url('iconsets/New-Light-Circled/ogg-audio.svg') } +.icon-explicit { background-image: url('iconsets/New-Light-Circled/parental-advisory.svg') } +.icon-expand-up { background-image: url('iconsets/New-Light-Circled/expand-up.svg') } +.icon-rss { background-image: url('iconsets/New-Light-Circled/rss.svg') } +.icon-tick { background-image: url('iconsets/New-Light-Circled/tick.svg') } +.icon-video { background-image: url('iconsets/New-Light-Circled/movie-1.svg') } +.icon-bbc-logo { background-image: url('iconsets/New-Light-Circled/bbc-logo.svg') } +.icon-imdb-logo { background-image: url('iconsets/New-Light-Circled/imdb-logo.svg') } +.icon-facebook-logo { background-image: url('iconsets/New-Light-Circled/facebook-logo.svg') } +.icon-twitter-logo { background-image: url('iconsets/New-Light-Circled/twitter-logo.svg') } +.icon-www { background-image: url('iconsets/New-Light-Circled/world-wide-web.svg') } +.icon-allmusic { background-image: url('iconsets/New-Light-Circled/allmusic-logo.svg') } +.icon-updown { background-image: url('iconsets/New-Light-Circled/arrow-updown.svg') } +.icon-snapcast { background-image: url('iconsets/New-Light-Circled/../../newimages/snapcast.png') } + +.styledinputs label +{ + display:inline-block; + cursor:pointer; + position:relative; + padding-left:2em; + line-height:1.5em; +} + +.styledinputs input[type=radio] +{ + display:none; +} + +.styledinputs input[type=checkbox] +{ + display:none; +} + +.styledinputs label:before +{ + content:""; + display:inline-block; + width:1.5em; + height:1.5em; + position:absolute; + left:0; + background-image: url('iconsets/New-Light-Circled/togglebutton-new2-off.svg'); + background-size: auto 80%; + background-position: center; + background-repeat:no-repeat; +} + +.styledinputs input:checked + label:before +{ + background-image: url('iconsets/New-Light-Circled/togglebutton-new2-on.svg') !important; +} + +img.notexist,img.notfound +{ + background-image: url('iconsets/New-Light-Circled/compact-disc.svg'); + background-size:contain; + display:inline-block; + background-position: center; + background-repeat:no-repeat; +} + +img.stream.notfound, img.stream.notexist +{ + background-image: url('iconsets/New-Light-Circled/broadcast-new.svg'); +} + +img.plimage.notfound +{ + background-image: url('iconsets/New-Light-Circled/playlist.svg'); +} + +.backmenu +{ + background-image: url('iconsets/New-Light-Circled/arrow-left-double.svg'); + background-repeat: no-repeat; + background-size: contain; +} + +button.iconbutton { + height:2em; + width:2em; + background-size: contain; + background-position:center; + border: none !important; + opacity: 0.8; + background-color:transparent; +} + +button.iconbutton:hover { + opacity: 1; +} + +button.searchbutton { + background-image: url('iconsets/New-Light-Circled/system-search.svg'); +} + +button.rssbutton { + background-image: url('iconsets/New-Light-Circled/rss.svg'); +} + diff --git a/www/rompr/iconsets/New-Light-Circled/tick.svg b/www/rompr/iconsets/New-Light-Circled/tick.svg new file mode 100644 index 0000000..5fa152b --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/tick.svg @@ -0,0 +1,335 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/toggle-closed.svg b/www/rompr/iconsets/New-Light-Circled/toggle-closed.svg new file mode 100644 index 0000000..d4c85ce --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/toggle-closed.svg @@ -0,0 +1,376 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/toggle-open.svg b/www/rompr/iconsets/New-Light-Circled/toggle-open.svg new file mode 100644 index 0000000..5ef4cac --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/toggle-open.svg @@ -0,0 +1,372 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/togglebutton-new2-off.svg b/www/rompr/iconsets/New-Light-Circled/togglebutton-new2-off.svg new file mode 100644 index 0000000..da0e6bd --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/togglebutton-new2-off.svg @@ -0,0 +1,444 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/togglebutton-new2-on.svg b/www/rompr/iconsets/New-Light-Circled/togglebutton-new2-on.svg new file mode 100644 index 0000000..135e386 --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/togglebutton-new2-on.svg @@ -0,0 +1,432 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/twitter-logo.svg b/www/rompr/iconsets/New-Light-Circled/twitter-logo.svg new file mode 100644 index 0000000..7e851a3 --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/twitter-logo.svg @@ -0,0 +1,367 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/unlistened.svg b/www/rompr/iconsets/New-Light-Circled/unlistened.svg new file mode 100644 index 0000000..4d0bb97 --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/unlistened.svg @@ -0,0 +1,17 @@ + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/vkontakte-logo.svg b/www/rompr/iconsets/New-Light-Circled/vkontakte-logo.svg new file mode 100644 index 0000000..a6d2c0f --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/vkontakte-logo.svg @@ -0,0 +1,428 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/volume.svg b/www/rompr/iconsets/New-Light-Circled/volume.svg new file mode 100644 index 0000000..e7c958c --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/volume.svg @@ -0,0 +1,90 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/wikipedia-logo.svg b/www/rompr/iconsets/New-Light-Circled/wikipedia-logo.svg new file mode 100644 index 0000000..73f757c --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/wikipedia-logo.svg @@ -0,0 +1,362 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/wma-audio.svg b/www/rompr/iconsets/New-Light-Circled/wma-audio.svg new file mode 100644 index 0000000..939da2c --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/wma-audio.svg @@ -0,0 +1,70 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Light-Circled/world-wide-web.svg b/www/rompr/iconsets/New-Light-Circled/world-wide-web.svg new file mode 100644 index 0000000..4efbf57 --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/world-wide-web.svg @@ -0,0 +1,61 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/New-Light-Circled/youtube-logo.svg b/www/rompr/iconsets/New-Light-Circled/youtube-logo.svg new file mode 100644 index 0000000..838da5b --- /dev/null +++ b/www/rompr/iconsets/New-Light-Circled/youtube-logo.svg @@ -0,0 +1,327 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/0stars.svg b/www/rompr/iconsets/New-Orange-Circled/0stars.svg new file mode 100644 index 0000000..ab72bc5 --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/0stars.svg @@ -0,0 +1,19 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/1stars.svg b/www/rompr/iconsets/New-Orange-Circled/1stars.svg new file mode 100644 index 0000000..a022c83 --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/1stars.svg @@ -0,0 +1,19 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/2stars.svg b/www/rompr/iconsets/New-Orange-Circled/2stars.svg new file mode 100644 index 0000000..a553fa3 --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/2stars.svg @@ -0,0 +1,19 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/3stars.svg b/www/rompr/iconsets/New-Orange-Circled/3stars.svg new file mode 100644 index 0000000..33d16d5 --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/3stars.svg @@ -0,0 +1,19 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/4stars.svg b/www/rompr/iconsets/New-Orange-Circled/4stars.svg new file mode 100644 index 0000000..24c58f4 --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/4stars.svg @@ -0,0 +1,19 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/5stars.svg b/www/rompr/iconsets/New-Orange-Circled/5stars.svg new file mode 100644 index 0000000..a05eae8 --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/5stars.svg @@ -0,0 +1,19 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/aac-audio.svg b/www/rompr/iconsets/New-Orange-Circled/aac-audio.svg new file mode 100644 index 0000000..fbbb80c --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/aac-audio.svg @@ -0,0 +1,89 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/add.svg b/www/rompr/iconsets/New-Orange-Circled/add.svg new file mode 100644 index 0000000..5bfaa10 --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/add.svg @@ -0,0 +1,50 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/adjustments.css b/www/rompr/iconsets/New-Orange-Circled/adjustments.css new file mode 100644 index 0000000..9b93f77 --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/adjustments.css @@ -0,0 +1,230 @@ +#buttons +{ + padding-left:12px; + padding-right:12px; + padding-top:4px; + padding-bottom:6px; +} + +.controlbutton +{ + margin:0px; + padding:0px; + vertical-align:middle; + display:inline-block; + width:56px; + height:56px; +} + +.controlbutton-small +{ + margin:0px; + vertical-align:middle; + display:inline-block; + width:48px; + height:48px; +} + +@media screen and (min-height: 800px) and (max-height: 939px) { + .controlbutton { + width:64px; + height:64px; + } + #buttons { + padding-top:12px; + } + #playbackTime { + margin-top:2px; + font-size:12px; + line-height:14px; + height:14px; + } +} + +@media screen and (min-height: 940px) and (max-height: 1099px) and (min-width: 650px) { + .controlbutton { + width:84px; + height:84px; + } + + .controlbutton-small { + width:64px; + height:64px; + } + + .shiftleft + { + left:-12px; + position:relative; + z-index:250; + } + + .shiftleft2 + { + left:-26px; + position:relative; + } + + .shiftleft3 + { + position:relative; + left:-36px; + z-index:5; + } + + .shiftleft4 + { + position:relative; + left:-48px; + z-index:1; + margin-right:-36px; + } + +} + +@media screen and (min-height: 940px) and (max-height: 1099px) and (min-width: 650px) { + .controlbutton { + width:84px; + height:84px; + } + .controlbutton-small { + width:64px; + height:64px; + } + #buttons { + padding-top:16px; + padding-left:24px; + } + #playbackTime { + margin-top:4px; + font-size:14px; + line-height:16px; + height:16px; + } + .shiftleft + { + left:-12px; + position:relative; + z-index:250; + } + + .shiftleft2 + { + left:-24px; + position:relative; + } + + .shiftleft3 + { + position:relative; + left:-36px; + z-index:5; + } + + .shiftleft4 + { + position:relative; + left:-48px; + z-index:1; + margin-right:-36px; + } +} + +@media screen and (min-height: 1100px) and (min-width: 651px) and (max-width: 749px) { + .controlbutton { + width:84px; + height:84px; + } + .controlbutton-small { + width:64px; + height:64px; + } + #buttons { + padding-top:16px; + padding-left:24px; + } + #playbackTime { + margin-top:4px; + font-size:14px; + line-height:16px; + height:16px; + } + .shiftleft + { + left:-12px; + position:relative; + z-index:250; + } + + .shiftleft2 + { + left:-26px; + position:relative; + } + + .shiftleft3 + { + position:relative; + left:-36px; + z-index:5; + } + + .shiftleft4 + { + position:relative; + left:-48px; + z-index:1; + margin-right:-36px; + } +} + +@media screen and (min-height: 1100px) and (min-width: 720px) { + .controlbutton { + width:90px; + height:90px; + } + .controlbutton-small { + width:70px; + height:70px; + } + #buttons { + padding-top:12px; + padding-left:20px; + } + #progress { + margin-top:8px; + } + #playbackTime { + margin-top:12px; + font-size:16px; + line-height:18px; + height:18px; + } + .shiftleft + { + left:-10px; + position:relative; + z-index:250; + } + + .shiftleft2 + { + left:-22px; + position:relative; + } + + .shiftleft3 + { + position:relative; + left:-34px; + z-index:5; + } + + .shiftleft4 + { + position:relative; + left:-44px; + z-index:1; + margin-right:-36px; + } +} diff --git a/www/rompr/iconsets/New-Orange-Circled/alarmclock_false.svg b/www/rompr/iconsets/New-Orange-Circled/alarmclock_false.svg new file mode 100644 index 0000000..e9684c6 --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/alarmclock_false.svg @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/alarmclock_true.svg b/www/rompr/iconsets/New-Orange-Circled/alarmclock_true.svg new file mode 100644 index 0000000..2bf4001 --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/alarmclock_true.svg @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/allmusic-logo.svg b/www/rompr/iconsets/New-Orange-Circled/allmusic-logo.svg new file mode 100644 index 0000000..8f9bd32 --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/allmusic-logo.svg @@ -0,0 +1,390 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/arrow-decrease.svg b/www/rompr/iconsets/New-Orange-Circled/arrow-decrease.svg new file mode 100644 index 0000000..3c1b85b --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/arrow-decrease.svg @@ -0,0 +1,80 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/arrow-increase.svg b/www/rompr/iconsets/New-Orange-Circled/arrow-increase.svg new file mode 100644 index 0000000..b4678b3 --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/arrow-increase.svg @@ -0,0 +1,80 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/arrow-left-double.svg b/www/rompr/iconsets/New-Orange-Circled/arrow-left-double.svg new file mode 100644 index 0000000..5f9a2f3 --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/arrow-left-double.svg @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/arrow-right-double.svg b/www/rompr/iconsets/New-Orange-Circled/arrow-right-double.svg new file mode 100644 index 0000000..ae3d84e --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/arrow-right-double.svg @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/arrow-updown.svg b/www/rompr/iconsets/New-Orange-Circled/arrow-updown.svg new file mode 100644 index 0000000..4440af0 --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/arrow-updown.svg @@ -0,0 +1,82 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/artist-icon.svg b/www/rompr/iconsets/New-Orange-Circled/artist-icon.svg new file mode 100644 index 0000000..e7ab2f8 --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/artist-icon.svg @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/audiobook.svg b/www/rompr/iconsets/New-Orange-Circled/audiobook.svg new file mode 100644 index 0000000..005ba01 --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/audiobook.svg @@ -0,0 +1,215 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/backbutton.svg b/www/rompr/iconsets/New-Orange-Circled/backbutton.svg new file mode 100644 index 0000000..509eff1 --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/backbutton.svg @@ -0,0 +1,55 @@ + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/bbc-logo.svg b/www/rompr/iconsets/New-Orange-Circled/bbc-logo.svg new file mode 100644 index 0000000..0f7981f --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/bbc-logo.svg @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/blobdown3-hi.svg b/www/rompr/iconsets/New-Orange-Circled/blobdown3-hi.svg new file mode 100644 index 0000000..c5d1a11 --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/blobdown3-hi.svg @@ -0,0 +1,73 @@ + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/blobdown3.svg b/www/rompr/iconsets/New-Orange-Circled/blobdown3.svg new file mode 100644 index 0000000..97c76d3 --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/blobdown3.svg @@ -0,0 +1,73 @@ + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/broadcast-new.svg b/www/rompr/iconsets/New-Orange-Circled/broadcast-new.svg new file mode 100644 index 0000000..b8da7b5 --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/broadcast-new.svg @@ -0,0 +1,89 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/calendar.svg b/www/rompr/iconsets/New-Orange-Circled/calendar.svg new file mode 100644 index 0000000..682d4ef --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/calendar.svg @@ -0,0 +1,188 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/cd_case.svg b/www/rompr/iconsets/New-Orange-Circled/cd_case.svg new file mode 100644 index 0000000..1ca19cb --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/cd_case.svg @@ -0,0 +1,223 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/collection.svg b/www/rompr/iconsets/New-Orange-Circled/collection.svg new file mode 100644 index 0000000..17880ac --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/collection.svg @@ -0,0 +1,229 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/compact-disc.svg b/www/rompr/iconsets/New-Orange-Circled/compact-disc.svg new file mode 100644 index 0000000..3c8f254 --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/compact-disc.svg @@ -0,0 +1,61 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/New-Orange-Circled/consume.svg b/www/rompr/iconsets/New-Orange-Circled/consume.svg new file mode 100644 index 0000000..f15f6cd --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/consume.svg @@ -0,0 +1,104 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/consume_off.svg b/www/rompr/iconsets/New-Orange-Circled/consume_off.svg new file mode 100644 index 0000000..4923d9b --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/consume_off.svg @@ -0,0 +1,104 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/crossfade.svg b/www/rompr/iconsets/New-Orange-Circled/crossfade.svg new file mode 100644 index 0000000..a415e2e --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/crossfade.svg @@ -0,0 +1,110 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/crossfade_off.svg b/www/rompr/iconsets/New-Orange-Circled/crossfade_off.svg new file mode 100644 index 0000000..397117d --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/crossfade_off.svg @@ -0,0 +1,76 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/dialog-error.svg b/www/rompr/iconsets/New-Orange-Circled/dialog-error.svg new file mode 100644 index 0000000..f66863a --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/dialog-error.svg @@ -0,0 +1,193 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/dialog-information.svg b/www/rompr/iconsets/New-Orange-Circled/dialog-information.svg new file mode 100644 index 0000000..9504828 --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/dialog-information.svg @@ -0,0 +1,205 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/dirble-logo.svg b/www/rompr/iconsets/New-Orange-Circled/dirble-logo.svg new file mode 100644 index 0000000..213d201 --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/dirble-logo.svg @@ -0,0 +1,211 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/discogs-logo.svg b/www/rompr/iconsets/New-Orange-Circled/discogs-logo.svg new file mode 100644 index 0000000..8349aad --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/discogs-logo.svg @@ -0,0 +1,436 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/document-save.svg b/www/rompr/iconsets/New-Orange-Circled/document-save.svg new file mode 100644 index 0000000..e5bf856 --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/document-save.svg @@ -0,0 +1,239 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/download-icon.svg b/www/rompr/iconsets/New-Orange-Circled/download-icon.svg new file mode 100644 index 0000000..8008463 --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/download-icon.svg @@ -0,0 +1,216 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/edit-clear-list.svg b/www/rompr/iconsets/New-Orange-Circled/edit-clear-list.svg new file mode 100644 index 0000000..7eb81e7 --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/edit-clear-list.svg @@ -0,0 +1,265 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/edit-delete.svg b/www/rompr/iconsets/New-Orange-Circled/edit-delete.svg new file mode 100644 index 0000000..713c8da --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/edit-delete.svg @@ -0,0 +1,50 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/expand-up.svg b/www/rompr/iconsets/New-Orange-Circled/expand-up.svg new file mode 100644 index 0000000..2936b81 --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/expand-up.svg @@ -0,0 +1,239 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/facebook-logo.svg b/www/rompr/iconsets/New-Orange-Circled/facebook-logo.svg new file mode 100644 index 0000000..8e754c1 --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/facebook-logo.svg @@ -0,0 +1,79 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/file.svg b/www/rompr/iconsets/New-Orange-Circled/file.svg new file mode 100644 index 0000000..1c9a1f1 --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/file.svg @@ -0,0 +1,223 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/flac-audio.svg b/www/rompr/iconsets/New-Orange-Circled/flac-audio.svg new file mode 100644 index 0000000..b63ff04 --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/flac-audio.svg @@ -0,0 +1,110 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/folder.svg b/www/rompr/iconsets/New-Orange-Circled/folder.svg new file mode 100644 index 0000000..3bc3347 --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/folder.svg @@ -0,0 +1,697 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/forwardbutton.svg b/www/rompr/iconsets/New-Orange-Circled/forwardbutton.svg new file mode 100644 index 0000000..38294a4 --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/forwardbutton.svg @@ -0,0 +1,59 @@ + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/gmusic-logo.svg b/www/rompr/iconsets/New-Orange-Circled/gmusic-logo.svg new file mode 100644 index 0000000..7c36b56 --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/gmusic-logo.svg @@ -0,0 +1,107 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/headphones.svg b/www/rompr/iconsets/New-Orange-Circled/headphones.svg new file mode 100644 index 0000000..6b7b3e7 --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/headphones.svg @@ -0,0 +1,668 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/icon-new.svg b/www/rompr/iconsets/New-Orange-Circled/icon-new.svg new file mode 100644 index 0000000..94030eb --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/icon-new.svg @@ -0,0 +1,670 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/imdb-logo.svg b/www/rompr/iconsets/New-Orange-Circled/imdb-logo.svg new file mode 100644 index 0000000..64f666e --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/imdb-logo.svg @@ -0,0 +1,447 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/internetarchive-logo.svg b/www/rompr/iconsets/New-Orange-Circled/internetarchive-logo.svg new file mode 100644 index 0000000..dd15cc9 --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/internetarchive-logo.svg @@ -0,0 +1,368 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/lastfm-ban.svg b/www/rompr/iconsets/New-Orange-Circled/lastfm-ban.svg new file mode 100644 index 0000000..cd2d1b3 --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/lastfm-ban.svg @@ -0,0 +1,3 @@ + + +image/svg+xml diff --git a/www/rompr/iconsets/New-Orange-Circled/lastfm-love.svg b/www/rompr/iconsets/New-Orange-Circled/lastfm-love.svg new file mode 100644 index 0000000..447abef --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/lastfm-love.svg @@ -0,0 +1,665 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/lastfm-unlove.svg b/www/rompr/iconsets/New-Orange-Circled/lastfm-unlove.svg new file mode 100644 index 0000000..4c38d1f --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/lastfm-unlove.svg @@ -0,0 +1,657 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/lastfm.svg b/www/rompr/iconsets/New-Orange-Circled/lastfm.svg new file mode 100644 index 0000000..52dae45 --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/lastfm.svg @@ -0,0 +1,173 @@ + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/lyrics.svg b/www/rompr/iconsets/New-Orange-Circled/lyrics.svg new file mode 100644 index 0000000..94c3b8f --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/lyrics.svg @@ -0,0 +1,657 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/media-playback-pause-highlight.svg b/www/rompr/iconsets/New-Orange-Circled/media-playback-pause-highlight.svg new file mode 100644 index 0000000..2cdca7e --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/media-playback-pause-highlight.svg @@ -0,0 +1,72 @@ + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/media-playback-pause.svg b/www/rompr/iconsets/New-Orange-Circled/media-playback-pause.svg new file mode 100644 index 0000000..20668e3 --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/media-playback-pause.svg @@ -0,0 +1,56 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/media-playback-start-highlight.svg b/www/rompr/iconsets/New-Orange-Circled/media-playback-start-highlight.svg new file mode 100644 index 0000000..37251e0 --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/media-playback-start-highlight.svg @@ -0,0 +1,81 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/media-playback-start.svg b/www/rompr/iconsets/New-Orange-Circled/media-playback-start.svg new file mode 100644 index 0000000..3baf50d --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/media-playback-start.svg @@ -0,0 +1,81 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/media-playback-stop-highlight.svg b/www/rompr/iconsets/New-Orange-Circled/media-playback-stop-highlight.svg new file mode 100644 index 0000000..8ddf74a --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/media-playback-stop-highlight.svg @@ -0,0 +1,65 @@ + + + + + + + + image/svg+xml + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/media-playback-stop.svg b/www/rompr/iconsets/New-Orange-Circled/media-playback-stop.svg new file mode 100644 index 0000000..efa309d --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/media-playback-stop.svg @@ -0,0 +1,45 @@ + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/media-skip-backward-highlight.svg b/www/rompr/iconsets/New-Orange-Circled/media-skip-backward-highlight.svg new file mode 100644 index 0000000..db30c0d --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/media-skip-backward-highlight.svg @@ -0,0 +1,69 @@ + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/media-skip-backward.svg b/www/rompr/iconsets/New-Orange-Circled/media-skip-backward.svg new file mode 100644 index 0000000..287366b --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/media-skip-backward.svg @@ -0,0 +1,69 @@ + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/media-skip-forward-highlight.svg b/www/rompr/iconsets/New-Orange-Circled/media-skip-forward-highlight.svg new file mode 100644 index 0000000..89adfe2 --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/media-skip-forward-highlight.svg @@ -0,0 +1,68 @@ + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/media-skip-forward.svg b/www/rompr/iconsets/New-Orange-Circled/media-skip-forward.svg new file mode 100644 index 0000000..a0ad454 --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/media-skip-forward.svg @@ -0,0 +1,68 @@ + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/movie-1.svg b/www/rompr/iconsets/New-Orange-Circled/movie-1.svg new file mode 100644 index 0000000..a493aad --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/movie-1.svg @@ -0,0 +1,38 @@ + + + + + + + image/svg+xml + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/mp3-audio.svg b/www/rompr/iconsets/New-Orange-Circled/mp3-audio.svg new file mode 100644 index 0000000..25b3a1b --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/mp3-audio.svg @@ -0,0 +1,38 @@ + + + + + + + image/svg+xml + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/musicbrainz_logo.svg b/www/rompr/iconsets/New-Orange-Circled/musicbrainz_logo.svg new file mode 100644 index 0000000..7faa413 --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/musicbrainz_logo.svg @@ -0,0 +1,228 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/neverheard.svg b/www/rompr/iconsets/New-Orange-Circled/neverheard.svg new file mode 100644 index 0000000..8888222 --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/neverheard.svg @@ -0,0 +1,46 @@ + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/ogg-audio.svg b/www/rompr/iconsets/New-Orange-Circled/ogg-audio.svg new file mode 100644 index 0000000..1ba7066 --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/ogg-audio.svg @@ -0,0 +1,51 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/output.svg b/www/rompr/iconsets/New-Orange-Circled/output.svg new file mode 100644 index 0000000..8221d3f --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/output.svg @@ -0,0 +1,90 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/output_mute.svg b/www/rompr/iconsets/New-Orange-Circled/output_mute.svg new file mode 100644 index 0000000..717cab5 --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/output_mute.svg @@ -0,0 +1,88 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/parental-advisory.svg b/www/rompr/iconsets/New-Orange-Circled/parental-advisory.svg new file mode 100644 index 0000000..25e1b7a --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/parental-advisory.svg @@ -0,0 +1,446 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/playlist.svg b/www/rompr/iconsets/New-Orange-Circled/playlist.svg new file mode 100644 index 0000000..a0ca722 --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/playlist.svg @@ -0,0 +1,93 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/podcast-logo.svg b/www/rompr/iconsets/New-Orange-Circled/podcast-logo.svg new file mode 100644 index 0000000..cd00a94 --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/podcast-logo.svg @@ -0,0 +1,38 @@ + + + + + + + image/svg+xml + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/preferences.svg b/www/rompr/iconsets/New-Orange-Circled/preferences.svg new file mode 100644 index 0000000..e9b3814 --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/preferences.svg @@ -0,0 +1,85 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/pushbutton.svg b/www/rompr/iconsets/New-Orange-Circled/pushbutton.svg new file mode 100644 index 0000000..46b1483 --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/pushbutton.svg @@ -0,0 +1,65 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/ratandtag.svg b/www/rompr/iconsets/New-Orange-Circled/ratandtag.svg new file mode 100644 index 0000000..ae67737 --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/ratandtag.svg @@ -0,0 +1,61 @@ + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/ratortag.svg b/www/rompr/iconsets/New-Orange-Circled/ratortag.svg new file mode 100644 index 0000000..cab0dc6 --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/ratortag.svg @@ -0,0 +1,65 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/refresh.svg b/www/rompr/iconsets/New-Orange-Circled/refresh.svg new file mode 100644 index 0000000..c7e8686 --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/refresh.svg @@ -0,0 +1,44 @@ + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/refresh_off.svg b/www/rompr/iconsets/New-Orange-Circled/refresh_off.svg new file mode 100644 index 0000000..84563dd --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/refresh_off.svg @@ -0,0 +1,77 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/resize.svg b/www/rompr/iconsets/New-Orange-Circled/resize.svg new file mode 100644 index 0000000..c1c6824 --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/resize.svg @@ -0,0 +1,3 @@ + + +image/svg+xml diff --git a/www/rompr/iconsets/New-Orange-Circled/rss.svg b/www/rompr/iconsets/New-Orange-Circled/rss.svg new file mode 100644 index 0000000..4b87f49 --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/rss.svg @@ -0,0 +1,129 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/shuffle.svg b/www/rompr/iconsets/New-Orange-Circled/shuffle.svg new file mode 100644 index 0000000..a1f8b48 --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/shuffle.svg @@ -0,0 +1,75 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/shuffle_off.svg b/www/rompr/iconsets/New-Orange-Circled/shuffle_off.svg new file mode 100644 index 0000000..eebce7d --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/shuffle_off.svg @@ -0,0 +1,122 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/singlestar.svg b/www/rompr/iconsets/New-Orange-Circled/singlestar.svg new file mode 100644 index 0000000..d02a63a --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/singlestar.svg @@ -0,0 +1,328 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/sleep.svg b/www/rompr/iconsets/New-Orange-Circled/sleep.svg new file mode 100644 index 0000000..4fb399a --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/sleep.svg @@ -0,0 +1,93 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/sliders.svg b/www/rompr/iconsets/New-Orange-Circled/sliders.svg new file mode 100644 index 0000000..0f761b1 --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/sliders.svg @@ -0,0 +1,62 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/smartradio.svg b/www/rompr/iconsets/New-Orange-Circled/smartradio.svg new file mode 100644 index 0000000..ff950d3 --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/smartradio.svg @@ -0,0 +1,48 @@ + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/soundcloud-logo.svg b/www/rompr/iconsets/New-Orange-Circled/soundcloud-logo.svg new file mode 100644 index 0000000..f52d2d7 --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/soundcloud-logo.svg @@ -0,0 +1,61 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/New-Orange-Circled/spinner.svg b/www/rompr/iconsets/New-Orange-Circled/spinner.svg new file mode 100644 index 0000000..3d83f9e --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/spinner.svg @@ -0,0 +1,421 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/spotify-logo.svg b/www/rompr/iconsets/New-Orange-Circled/spotify-logo.svg new file mode 100644 index 0000000..ff30e5d --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/spotify-logo.svg @@ -0,0 +1,187 @@ + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/stopafter-highlight.svg b/www/rompr/iconsets/New-Orange-Circled/stopafter-highlight.svg new file mode 100644 index 0000000..6648fd6 --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/stopafter-highlight.svg @@ -0,0 +1,70 @@ + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/stopafter.svg b/www/rompr/iconsets/New-Orange-Circled/stopafter.svg new file mode 100644 index 0000000..3becc63 --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/stopafter.svg @@ -0,0 +1,70 @@ + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/system-search.svg b/www/rompr/iconsets/New-Orange-Circled/system-search.svg new file mode 100644 index 0000000..178711c --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/system-search.svg @@ -0,0 +1,43 @@ + + + + + + + image/svg+xml + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/tag.svg b/www/rompr/iconsets/New-Orange-Circled/tag.svg new file mode 100644 index 0000000..aa3a4b0 --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/tag.svg @@ -0,0 +1,327 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/theme.css b/www/rompr/iconsets/New-Orange-Circled/theme.css new file mode 100644 index 0000000..492cb7a --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/theme.css @@ -0,0 +1,249 @@ + + [class^="icon-"], [class*=" icon-"] { + background-size:contain; + background-position: center; + background-repeat:no-repeat; + display:inline-block; +} + +[class^="icon-"]:not(.button-disabled):hover, [class*=" icon-"]:not(.button-disabled):hover { + opacity: 1; + background-color: rgba(255,173,0,0.07); +} + +.clearbox { + background-image: url('iconsets/New-Orange-Circled/edit-delete.svg'); + /* dont change the 50%, it ties in with makeHoverWork, makeClearWork, and makeTagMenu */ + background-size: auto 50%; + background-position: right 2px center; + background-repeat: no-repeat; +} + +.combobox-entry, .selectholder { + background-image: url('iconsets/New-Orange-Circled/blobdown3.svg'); + /* dont change the 50%, it ties in with makeHoverWork, makeClearWork, and makeTagMenu */ + background-size: auto 50%; + background-position: right 2px center; + background-repeat: no-repeat; +} + +.combobox-entry:hover, .selectholder:hover { + background-image: url('iconsets/New-Orange-Circled/blobdown3-hi.svg'); + /* dont change the 50%, it ties in with makeHoverWork, makeClearWork, and makeTagMenu */ + background-size: auto 50%; + background-position: right 2px center; + background-repeat: no-repeat; +} + +.combo-button { + background-image: url('iconsets/New-Orange-Circled/blobdown3.svg'); +} + +.button-disabled { opacity: 0.1 } + +.icon-play-circled { background-image :url('iconsets/New-Orange-Circled/media-playback-start.svg') } +.playdiv { background-image :url('iconsets/New-Orange-Circled/media-playback-start.svg') } +.icon-play-circled:hover { background-image :url('iconsets/New-Orange-Circled/media-playback-start-highlight.svg') } +.icon-pause-circled { background-image :url('iconsets/New-Orange-Circled/media-playback-pause.svg') } +.icon-pause-circled:hover { background-image :url('iconsets/New-Orange-Circled/media-playback-pause-highlight.svg') } +.icon-fast-backward { background-image :url('iconsets/New-Orange-Circled/media-skip-backward.svg') } +.icon-fast-backward:hover { background-image :url('iconsets/New-Orange-Circled/media-skip-backward-highlight.svg') } +.icon-fast-forward { background-image :url('iconsets/New-Orange-Circled/media-skip-forward.svg') } +.icon-fast-forward:hover { background-image :url('iconsets/New-Orange-Circled/media-skip-forward-highlight.svg') } +.icon-stop-1 { background-image :url('iconsets/New-Orange-Circled/media-playback-stop.svg') } +.icon-stop-1:hover { background-image :url('iconsets/New-Orange-Circled/media-playback-stop-highlight.svg') } +.icon-to-end-1 { background-image :url('iconsets/New-Orange-Circled/stopafter.svg') } +.icon-to-end-1:hover { background-image :url('iconsets/New-Orange-Circled/stopafter-highlight.svg') } + +.icon-music { background-image: url('iconsets/New-Orange-Circled/collection.svg') } +.icon-search { background-image: url('iconsets/New-Orange-Circled/system-search.svg') } +.icon-folder-open-empty { background-image: url('iconsets/New-Orange-Circled/folder.svg') } +.icon-radio-tower { background-image: url('iconsets/New-Orange-Circled/broadcast-new.svg') } +.icon-cd { background-image: url('iconsets/New-Orange-Circled/cd_case.svg') } +.icon-resize-horizontal { background-image: url('iconsets/New-Orange-Circled/resize.svg') } +.icon-angle-double-left { background-image:url('iconsets/New-Orange-Circled/arrow-left-double.svg') } +.icon-angle-double-right { background-image:url('iconsets/New-Orange-Circled/arrow-right-double.svg') } +.icon-menu { background-image: url('iconsets/New-Orange-Circled/pushbutton.svg') } +.icon-versions { background-image: url('iconsets/New-Orange-Circled/history.svg') } +.icon-left-circled { background-image: url('iconsets/New-Orange-Circled/backbutton.svg') } +.icon-right-circled { background-image: url('iconsets/New-Orange-Circled/forwardbutton.svg') } +.icon-cog-alt { background-image: url('iconsets/New-Orange-Circled/preferences.svg') } +.icon-trash { background-image: url('iconsets/New-Orange-Circled/edit-clear-list.svg') } +.icon-wifi { background-image: url('iconsets/New-Orange-Circled/smartradio.svg') } +.icon-doc-text { background-image: url('iconsets/New-Orange-Circled/playlist.svg') } +.icon-floppy { background-image: url('iconsets/New-Orange-Circled/document-save.svg') } +.icon-cancel-circled { background-image: url('iconsets/New-Orange-Circled/edit-delete.svg') } +.icon-plus { + background-image: url('iconsets/New-Orange-Circled/add.svg'); + opacity:0.7; +} +.icon-alarm { background-image: url('iconsets/New-Orange-Circled/alarmclock_false.svg') } +.icon-alarm-on { background-image: url('iconsets/New-Orange-Circled/alarmclock_true.svg') } +.icon-sleep { background-image: url('iconsets/New-Orange-Circled/sleep.svg') } +.icon-library { background-image: url('iconsets/New-Orange-Circled/file.svg') } +.icon-lastfm-1 { background-image: url('iconsets/New-Orange-Circled/lastfm.svg') } +.icon-wikipedia { background-image: url('iconsets/New-Orange-Circled/wikipedia-logo.svg') } +.icon-musicbrainz { background-image: url('iconsets/New-Orange-Circled/musicbrainz_logo.svg') } +.icon-discogs { background-image: url('iconsets/New-Orange-Circled/discogs-logo.svg') } +.icon-doc-text-1 { background-image: url('iconsets/New-Orange-Circled/lyrics.svg') } +.icon-soundcloud-circled { background-image: url('iconsets/New-Orange-Circled/soundcloud-logo.svg') } +.icon-youtube-circled { background-image: url('iconsets/New-Orange-Circled/youtube-logo.svg') } +.icon-gmusic-circled { background-image: url('iconsets/New-Orange-Circled/gmusic-logo.svg') } +.icon-spotify-circled { background-image: url('iconsets/New-Orange-Circled/spotify-logo.svg') } +.icon-vkontakte-circled { background-image: url('iconsets/New-Orange-Circled/vkontakte-logo.svg') } +.icon-podcast-circled { background-image: url('iconsets/New-Orange-Circled/podcast-logo.svg') } +.icon-audiobook { background-image: url('iconsets/New-Orange-Circled/audiobook.svg') } +.icon-internetarchive-circled { background-image: url('iconsets/New-Orange-Circled/internetarchive-logo.svg') } +.icon-increase { background-image: url('iconsets/New-Orange-Circled/arrow-increase.svg') } +.icon-decrease { background-image: url('iconsets/New-Orange-Circled/arrow-decrease.svg') } +.icon-attention-1 { background-image: url('iconsets/New-Orange-Circled/dialog-error.svg') } +.icon-info-circled { background-image: url('iconsets/New-Orange-Circled/dialog-information.svg') } +.icon-download { background-image: url('iconsets/New-Orange-Circled/download-icon.svg') } +.icon-sun { background-image: url('iconsets/New-Orange-Circled/icon-new.svg') } +.icon-headphones { background-image: url('iconsets/New-Orange-Circled/headphones.svg') } +.icon-unlistened { background-image: url('iconsets/New-Orange-Circled/headphones.svg') } +.icon-block { background-image: url('iconsets/New-Orange-Circled/lastfm-ban.svg') } +.icon-heart { background-image: url('iconsets/New-Orange-Circled/lastfm-love.svg') } +.icon-heart-broken { background-image: url('iconsets/New-Orange-Circled/lastfm-unlove.svg') } +.icon-refresh { background-image: url('iconsets/New-Orange-Circled/refresh.svg') } +.icon-dirble-circled { background-image: url('iconsets/New-Orange-Circled/dirble-logo.svg') } +.icon-tunein { background-image: url('iconsets/New-Orange-Circled/../../newimages/tunein-logo.svg') } +.icon-no-response-playbutton { background-image :url('iconsets/New-Orange-Circled/media-playback-start.svg') } +.icon-tags { background-image: url('iconsets/New-Orange-Circled/tag.svg') } +.icon-volume-up { background-image: url('iconsets/New-Orange-Circled/volume.svg') } +.icon-toggle-open { background-image: url('iconsets/New-Orange-Circled/toggle-open.svg') } +.icon-toggle-closed { background-image: url('iconsets/New-Orange-Circled/toggle-closed.svg') } +.icon-spin6 { background-image: url('iconsets/New-Orange-Circled/spinner.svg') } +.icon-output { background-image: url('iconsets/New-Orange-Circled/output.svg') } +.icon-output-mute { background-image: url('iconsets/New-Orange-Circled/output_mute.svg') } +.icon-sliders { background-image: url('iconsets/New-Orange-Circled/sliders.svg') } +.icon-0-stars { background-image: url('iconsets/New-Orange-Circled/0stars.svg') } +.icon-1-stars { background-image: url('iconsets/New-Orange-Circled/1stars.svg') } +.icon-2-stars { background-image: url('iconsets/New-Orange-Circled/2stars.svg') } +.icon-3-stars { background-image: url('iconsets/New-Orange-Circled/3stars.svg') } +.icon-4-stars { background-image: url('iconsets/New-Orange-Circled/4stars.svg') } +.icon-5-stars { background-image: url('iconsets/New-Orange-Circled/5stars.svg') } +.icon-single-star { background-image: url('iconsets/New-Orange-Circled/singlestar.svg') } +.icon-ratandtag { background-image: url('iconsets/New-Orange-Circled/ratandtag.svg') } +.icon-ratortag { background-image: url('iconsets/New-Orange-Circled/ratortag.svg') } +.icon-toggle-on { background-image: url('iconsets/New-Orange-Circled/togglebutton-new2-on.svg') } +.icon-toggle-off { background-image: url('iconsets/New-Orange-Circled/togglebutton-new2-off.svg') } + +.icon-random.flow-on { background-image: url('iconsets/New-Orange-Circled/shuffle.svg') } +.icon-random.flow-off { background-image: url('iconsets/New-Orange-Circled/shuffle_off.svg') } +.icon-crossfade.flow-on { background-image: url('iconsets/New-Orange-Circled/crossfade.svg') } +.icon-crossfade.flow-off { background-image: url('iconsets/New-Orange-Circled/crossfade_off.svg') } +.icon-repeat.flow-on { background-image: url('iconsets/New-Orange-Circled/refresh.svg') } +.icon-repeat.flow-off { background-image: url('iconsets/New-Orange-Circled/refresh_off.svg') } +.icon-consume.flow-on { background-image: url('iconsets/New-Orange-Circled/consume.svg') } +.icon-consume.flow-off { background-image: url('iconsets/New-Orange-Circled/consume_off.svg') } + +.icon-allrandom { background-image: url('iconsets/New-Orange-Circled/shuffle.svg') } +.icon-neverplayed { background-image: url('iconsets/New-Orange-Circled/neverheard.svg') } +.icon-recentlyplayed { background-image: url('iconsets/New-Orange-Circled/calendar.svg') } +.icon-artist { background-image: url('iconsets/New-Orange-Circled/artist-icon.svg') } +.icon-mp3-audio { background-image: url('iconsets/New-Orange-Circled/mp3-audio.svg') } +.icon-aac-audio { background-image: url('iconsets/New-Orange-Circled/aac-audio.svg') } +.icon-flac-audio { background-image: url('iconsets/New-Orange-Circled/flac-audio.svg') } +.icon-wma-audio { background-image: url('iconsets/New-Orange-Circled/wma-audio.svg') } +.icon-ogg-audio { background-image: url('iconsets/New-Orange-Circled/ogg-audio.svg') } +.icon-explicit { background-image: url('iconsets/New-Orange-Circled/parental-advisory.svg') } +.icon-expand-up { background-image: url('iconsets/New-Orange-Circled/expand-up.svg') } +.icon-rss { background-image: url('iconsets/New-Orange-Circled/rss.svg') } +.icon-tick { background-image: url('iconsets/New-Orange-Circled/tick.svg') } +.icon-video { background-image: url('iconsets/New-Orange-Circled/movie-1.svg') } +.icon-bbc-logo { background-image: url('iconsets/New-Orange-Circled/bbc-logo.svg') } +.icon-imdb-logo { background-image: url('iconsets/New-Orange-Circled/imdb-logo.svg') } +.icon-facebook-logo { background-image: url('iconsets/New-Orange-Circled/facebook-logo.svg') } +.icon-twitter-logo { background-image: url('iconsets/New-Orange-Circled/twitter-logo.svg') } +.icon-www { background-image: url('iconsets/New-Orange-Circled/world-wide-web.svg') } +.icon-allmusic { background-image: url('iconsets/New-Orange-Circled/allmusic-logo.svg') } +.icon-updown { background-image: url('iconsets/New-Orange-Circled/arrow-updown.svg') } +.icon-snapcast { background-image: url('iconsets/New-Orange-Circled/../../newimages/snapcast.png') } + +.styledinputs label +{ + display:inline-block; + cursor:pointer; + position:relative; + padding-left:2em; + line-height:1.5em; +} + +.styledinputs input[type=radio] +{ + display:none; +} + +.styledinputs input[type=checkbox] +{ + display:none; +} + +.styledinputs label:before +{ + content:""; + display:inline-block; + width:1.5em; + height:1.5em; + position:absolute; + left:0; + background-image: url('iconsets/New-Orange-Circled/togglebutton-new2-off.svg'); + background-size: auto 80%; + background-position: center; + background-repeat:no-repeat; +} + +.styledinputs input:checked + label:before +{ + background-image: url('iconsets/New-Orange-Circled/togglebutton-new2-on.svg') !important; +} + +img.notexist,img.notfound +{ + background-image: url('iconsets/New-Orange-Circled/compact-disc.svg'); + background-size:contain; + display:inline-block; + background-position: center; + background-repeat:no-repeat; +} + +img.stream.notfound, img.stream.notexist +{ + background-image: url('iconsets/New-Orange-Circled/broadcast-new.svg'); +} + +img.plimage.notfound +{ + background-image: url('iconsets/New-Orange-Circled/playlist.svg'); +} + +.backmenu +{ + background-image: url('iconsets/New-Orange-Circled/arrow-left-double.svg'); + background-repeat: no-repeat; + background-size: contain; +} + +button.iconbutton { + height:2em; + width:2em; + background-size: contain; + background-position:center; + border: none !important; + opacity: 0.8; + background-color:transparent; +} + +button.iconbutton:hover { + opacity: 1; +} + +button.searchbutton { + background-image: url('iconsets/New-Orange-Circled/system-search.svg'); +} + +button.rssbutton { + background-image: url('iconsets/New-Orange-Circled/rss.svg'); +} + diff --git a/www/rompr/iconsets/New-Orange-Circled/tick.svg b/www/rompr/iconsets/New-Orange-Circled/tick.svg new file mode 100644 index 0000000..446de8e --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/tick.svg @@ -0,0 +1,335 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/toggle-closed.svg b/www/rompr/iconsets/New-Orange-Circled/toggle-closed.svg new file mode 100644 index 0000000..2225b47 --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/toggle-closed.svg @@ -0,0 +1,376 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/toggle-open.svg b/www/rompr/iconsets/New-Orange-Circled/toggle-open.svg new file mode 100644 index 0000000..b6cc04f --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/toggle-open.svg @@ -0,0 +1,372 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/togglebutton-new2-off.svg b/www/rompr/iconsets/New-Orange-Circled/togglebutton-new2-off.svg new file mode 100644 index 0000000..71f7af9 --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/togglebutton-new2-off.svg @@ -0,0 +1,444 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/togglebutton-new2-on.svg b/www/rompr/iconsets/New-Orange-Circled/togglebutton-new2-on.svg new file mode 100644 index 0000000..bf5193b --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/togglebutton-new2-on.svg @@ -0,0 +1,542 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/twitter-logo.svg b/www/rompr/iconsets/New-Orange-Circled/twitter-logo.svg new file mode 100644 index 0000000..af66a69 --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/twitter-logo.svg @@ -0,0 +1,367 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/unlistened.svg b/www/rompr/iconsets/New-Orange-Circled/unlistened.svg new file mode 100644 index 0000000..07c61f7 --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/unlistened.svg @@ -0,0 +1,52 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/New-Orange-Circled/vkontakte-logo.svg b/www/rompr/iconsets/New-Orange-Circled/vkontakte-logo.svg new file mode 100644 index 0000000..22d3f73 --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/vkontakte-logo.svg @@ -0,0 +1,428 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/volume.svg b/www/rompr/iconsets/New-Orange-Circled/volume.svg new file mode 100644 index 0000000..8221d3f --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/volume.svg @@ -0,0 +1,90 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/wikipedia-logo.svg b/www/rompr/iconsets/New-Orange-Circled/wikipedia-logo.svg new file mode 100644 index 0000000..4a0d708 --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/wikipedia-logo.svg @@ -0,0 +1,331 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/wma-audio.svg b/www/rompr/iconsets/New-Orange-Circled/wma-audio.svg new file mode 100644 index 0000000..b2d55f5 --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/wma-audio.svg @@ -0,0 +1,70 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/New-Orange-Circled/world-wide-web.svg b/www/rompr/iconsets/New-Orange-Circled/world-wide-web.svg new file mode 100644 index 0000000..95cac38 --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/world-wide-web.svg @@ -0,0 +1,61 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/New-Orange-Circled/youtube-logo.svg b/www/rompr/iconsets/New-Orange-Circled/youtube-logo.svg new file mode 100644 index 0000000..b3c9456 --- /dev/null +++ b/www/rompr/iconsets/New-Orange-Circled/youtube-logo.svg @@ -0,0 +1,327 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/0stars.svg b/www/rompr/iconsets/Purpletrator/0stars.svg new file mode 100644 index 0000000..46faf68 --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/0stars.svg @@ -0,0 +1,179 @@ + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/1stars.svg b/www/rompr/iconsets/Purpletrator/1stars.svg new file mode 100644 index 0000000..c2ccbcf --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/1stars.svg @@ -0,0 +1,181 @@ + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/2stars.svg b/www/rompr/iconsets/Purpletrator/2stars.svg new file mode 100644 index 0000000..1bf1c3d --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/2stars.svg @@ -0,0 +1,190 @@ + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/3stars.svg b/www/rompr/iconsets/Purpletrator/3stars.svg new file mode 100644 index 0000000..8d135a2 --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/3stars.svg @@ -0,0 +1,199 @@ + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/4stars.svg b/www/rompr/iconsets/Purpletrator/4stars.svg new file mode 100644 index 0000000..d84ef1b --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/4stars.svg @@ -0,0 +1,208 @@ + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/5stars.svg b/www/rompr/iconsets/Purpletrator/5stars.svg new file mode 100644 index 0000000..ff679ee --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/5stars.svg @@ -0,0 +1,217 @@ + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/aac-audio.svg b/www/rompr/iconsets/Purpletrator/aac-audio.svg new file mode 100644 index 0000000..5d668f5 --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/aac-audio.svg @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/add.svg b/www/rompr/iconsets/Purpletrator/add.svg new file mode 100644 index 0000000..9f6be1b --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/add.svg @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/adjustments.css b/www/rompr/iconsets/Purpletrator/adjustments.css new file mode 100644 index 0000000..9b93f77 --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/adjustments.css @@ -0,0 +1,230 @@ +#buttons +{ + padding-left:12px; + padding-right:12px; + padding-top:4px; + padding-bottom:6px; +} + +.controlbutton +{ + margin:0px; + padding:0px; + vertical-align:middle; + display:inline-block; + width:56px; + height:56px; +} + +.controlbutton-small +{ + margin:0px; + vertical-align:middle; + display:inline-block; + width:48px; + height:48px; +} + +@media screen and (min-height: 800px) and (max-height: 939px) { + .controlbutton { + width:64px; + height:64px; + } + #buttons { + padding-top:12px; + } + #playbackTime { + margin-top:2px; + font-size:12px; + line-height:14px; + height:14px; + } +} + +@media screen and (min-height: 940px) and (max-height: 1099px) and (min-width: 650px) { + .controlbutton { + width:84px; + height:84px; + } + + .controlbutton-small { + width:64px; + height:64px; + } + + .shiftleft + { + left:-12px; + position:relative; + z-index:250; + } + + .shiftleft2 + { + left:-26px; + position:relative; + } + + .shiftleft3 + { + position:relative; + left:-36px; + z-index:5; + } + + .shiftleft4 + { + position:relative; + left:-48px; + z-index:1; + margin-right:-36px; + } + +} + +@media screen and (min-height: 940px) and (max-height: 1099px) and (min-width: 650px) { + .controlbutton { + width:84px; + height:84px; + } + .controlbutton-small { + width:64px; + height:64px; + } + #buttons { + padding-top:16px; + padding-left:24px; + } + #playbackTime { + margin-top:4px; + font-size:14px; + line-height:16px; + height:16px; + } + .shiftleft + { + left:-12px; + position:relative; + z-index:250; + } + + .shiftleft2 + { + left:-24px; + position:relative; + } + + .shiftleft3 + { + position:relative; + left:-36px; + z-index:5; + } + + .shiftleft4 + { + position:relative; + left:-48px; + z-index:1; + margin-right:-36px; + } +} + +@media screen and (min-height: 1100px) and (min-width: 651px) and (max-width: 749px) { + .controlbutton { + width:84px; + height:84px; + } + .controlbutton-small { + width:64px; + height:64px; + } + #buttons { + padding-top:16px; + padding-left:24px; + } + #playbackTime { + margin-top:4px; + font-size:14px; + line-height:16px; + height:16px; + } + .shiftleft + { + left:-12px; + position:relative; + z-index:250; + } + + .shiftleft2 + { + left:-26px; + position:relative; + } + + .shiftleft3 + { + position:relative; + left:-36px; + z-index:5; + } + + .shiftleft4 + { + position:relative; + left:-48px; + z-index:1; + margin-right:-36px; + } +} + +@media screen and (min-height: 1100px) and (min-width: 720px) { + .controlbutton { + width:90px; + height:90px; + } + .controlbutton-small { + width:70px; + height:70px; + } + #buttons { + padding-top:12px; + padding-left:20px; + } + #progress { + margin-top:8px; + } + #playbackTime { + margin-top:12px; + font-size:16px; + line-height:18px; + height:18px; + } + .shiftleft + { + left:-10px; + position:relative; + z-index:250; + } + + .shiftleft2 + { + left:-22px; + position:relative; + } + + .shiftleft3 + { + position:relative; + left:-34px; + z-index:5; + } + + .shiftleft4 + { + position:relative; + left:-44px; + z-index:1; + margin-right:-36px; + } +} diff --git a/www/rompr/iconsets/Purpletrator/alarmclock_false.svg b/www/rompr/iconsets/Purpletrator/alarmclock_false.svg new file mode 100644 index 0000000..6bad77f --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/alarmclock_false.svg @@ -0,0 +1,163 @@ + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/alarmclock_true.svg b/www/rompr/iconsets/Purpletrator/alarmclock_true.svg new file mode 100644 index 0000000..1338558 --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/alarmclock_true.svg @@ -0,0 +1,163 @@ + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/allmusic-logo.svg b/www/rompr/iconsets/Purpletrator/allmusic-logo.svg new file mode 100644 index 0000000..bd66f6e --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/allmusic-logo.svg @@ -0,0 +1,517 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/arrow-decrease.svg b/www/rompr/iconsets/Purpletrator/arrow-decrease.svg new file mode 100644 index 0000000..534c5ce --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/arrow-decrease.svg @@ -0,0 +1,114 @@ + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/arrow-increase.svg b/www/rompr/iconsets/Purpletrator/arrow-increase.svg new file mode 100644 index 0000000..e587ccf --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/arrow-increase.svg @@ -0,0 +1,114 @@ + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/arrow-left-double.svg b/www/rompr/iconsets/Purpletrator/arrow-left-double.svg new file mode 100644 index 0000000..7f96a78 --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/arrow-left-double.svg @@ -0,0 +1,139 @@ + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/arrow-right-double.svg b/www/rompr/iconsets/Purpletrator/arrow-right-double.svg new file mode 100644 index 0000000..4e18f16 --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/arrow-right-double.svg @@ -0,0 +1,143 @@ + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/arrow-updown.svg b/www/rompr/iconsets/Purpletrator/arrow-updown.svg new file mode 100644 index 0000000..42a0ba2 --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/arrow-updown.svg @@ -0,0 +1,128 @@ + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/artist-icon.svg b/www/rompr/iconsets/Purpletrator/artist-icon.svg new file mode 100644 index 0000000..5f88cc9 --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/artist-icon.svg @@ -0,0 +1,136 @@ + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/audiobook.svg b/www/rompr/iconsets/Purpletrator/audiobook.svg new file mode 100644 index 0000000..bc8c99b --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/audiobook.svg @@ -0,0 +1,254 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/backbutton.svg b/www/rompr/iconsets/Purpletrator/backbutton.svg new file mode 100644 index 0000000..76eb6a5 --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/backbutton.svg @@ -0,0 +1,108 @@ + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/bbc-logo.svg b/www/rompr/iconsets/Purpletrator/bbc-logo.svg new file mode 100644 index 0000000..1db2ffa --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/bbc-logo.svg @@ -0,0 +1,250 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/blobdown3-hi.svg b/www/rompr/iconsets/Purpletrator/blobdown3-hi.svg new file mode 100644 index 0000000..5a8da79 --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/blobdown3-hi.svg @@ -0,0 +1,102 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/blobdown3.svg b/www/rompr/iconsets/Purpletrator/blobdown3.svg new file mode 100644 index 0000000..7cc0c93 --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/blobdown3.svg @@ -0,0 +1,102 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/broadcast-new.svg b/www/rompr/iconsets/Purpletrator/broadcast-new.svg new file mode 100644 index 0000000..6dda8ed --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/broadcast-new.svg @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/calendar.svg b/www/rompr/iconsets/Purpletrator/calendar.svg new file mode 100644 index 0000000..54565e5 --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/calendar.svg @@ -0,0 +1,225 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/cd_case.svg b/www/rompr/iconsets/Purpletrator/cd_case.svg new file mode 100644 index 0000000..169da30 --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/cd_case.svg @@ -0,0 +1,291 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/collection.svg b/www/rompr/iconsets/Purpletrator/collection.svg new file mode 100644 index 0000000..40ecc91 --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/collection.svg @@ -0,0 +1,267 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/compact-disc.svg b/www/rompr/iconsets/Purpletrator/compact-disc.svg new file mode 100644 index 0000000..25f5551 --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/compact-disc.svg @@ -0,0 +1,82 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Purpletrator/consume.svg b/www/rompr/iconsets/Purpletrator/consume.svg new file mode 100644 index 0000000..9a33cdd --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/consume.svg @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/consume_off.svg b/www/rompr/iconsets/Purpletrator/consume_off.svg new file mode 100644 index 0000000..ca0eecd --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/consume_off.svg @@ -0,0 +1,122 @@ + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/crossfade.svg b/www/rompr/iconsets/Purpletrator/crossfade.svg new file mode 100644 index 0000000..fb3de6b --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/crossfade.svg @@ -0,0 +1,143 @@ + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/crossfade_off.svg b/www/rompr/iconsets/Purpletrator/crossfade_off.svg new file mode 100644 index 0000000..5d1c06e --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/crossfade_off.svg @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/dialog-error.svg b/www/rompr/iconsets/Purpletrator/dialog-error.svg new file mode 100644 index 0000000..5798e45 --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/dialog-error.svg @@ -0,0 +1,230 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/dialog-information.svg b/www/rompr/iconsets/Purpletrator/dialog-information.svg new file mode 100644 index 0000000..4318d9b --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/dialog-information.svg @@ -0,0 +1,242 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/dirble-logo.svg b/www/rompr/iconsets/Purpletrator/dirble-logo.svg new file mode 100644 index 0000000..3652107 --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/dirble-logo.svg @@ -0,0 +1,249 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/discogs-logo.svg b/www/rompr/iconsets/Purpletrator/discogs-logo.svg new file mode 100644 index 0000000..f743167 --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/discogs-logo.svg @@ -0,0 +1,499 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/document-save.svg b/www/rompr/iconsets/Purpletrator/document-save.svg new file mode 100644 index 0000000..0325a52 --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/document-save.svg @@ -0,0 +1,278 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/download-icon.svg b/www/rompr/iconsets/Purpletrator/download-icon.svg new file mode 100644 index 0000000..291f38a --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/download-icon.svg @@ -0,0 +1,256 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/edit-clear-list.svg b/www/rompr/iconsets/Purpletrator/edit-clear-list.svg new file mode 100644 index 0000000..44c3aca --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/edit-clear-list.svg @@ -0,0 +1,325 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/edit-delete.svg b/www/rompr/iconsets/Purpletrator/edit-delete.svg new file mode 100644 index 0000000..64d45c3 --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/edit-delete.svg @@ -0,0 +1,105 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/expand-up.svg b/www/rompr/iconsets/Purpletrator/expand-up.svg new file mode 100644 index 0000000..54908f2 --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/expand-up.svg @@ -0,0 +1,302 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/facebook-logo.svg b/www/rompr/iconsets/Purpletrator/facebook-logo.svg new file mode 100644 index 0000000..c39d14a --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/facebook-logo.svg @@ -0,0 +1,159 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/file.svg b/www/rompr/iconsets/Purpletrator/file.svg new file mode 100644 index 0000000..78384e7 --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/file.svg @@ -0,0 +1,260 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/flac-audio.svg b/www/rompr/iconsets/Purpletrator/flac-audio.svg new file mode 100644 index 0000000..689ffa8 --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/flac-audio.svg @@ -0,0 +1,147 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/folder.svg b/www/rompr/iconsets/Purpletrator/folder.svg new file mode 100644 index 0000000..67decda --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/folder.svg @@ -0,0 +1,752 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/forwardbutton.svg b/www/rompr/iconsets/Purpletrator/forwardbutton.svg new file mode 100644 index 0000000..c9b548b --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/forwardbutton.svg @@ -0,0 +1,127 @@ + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/gmusic-logo.svg b/www/rompr/iconsets/Purpletrator/gmusic-logo.svg new file mode 100644 index 0000000..c6d4a5f --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/gmusic-logo.svg @@ -0,0 +1,192 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/headphones.svg b/www/rompr/iconsets/Purpletrator/headphones.svg new file mode 100644 index 0000000..9a19b14 --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/headphones.svg @@ -0,0 +1,709 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/icon-new.svg b/www/rompr/iconsets/Purpletrator/icon-new.svg new file mode 100644 index 0000000..4dd124f --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/icon-new.svg @@ -0,0 +1,707 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/imdb-logo.svg b/www/rompr/iconsets/Purpletrator/imdb-logo.svg new file mode 100644 index 0000000..ca32e5f --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/imdb-logo.svg @@ -0,0 +1,512 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/internetarchive-logo.svg b/www/rompr/iconsets/Purpletrator/internetarchive-logo.svg new file mode 100644 index 0000000..f56afa4 --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/internetarchive-logo.svg @@ -0,0 +1,431 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/lastfm-ban.svg b/www/rompr/iconsets/Purpletrator/lastfm-ban.svg new file mode 100644 index 0000000..7c54a53 --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/lastfm-ban.svg @@ -0,0 +1,69 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Purpletrator/lastfm-love.svg b/www/rompr/iconsets/Purpletrator/lastfm-love.svg new file mode 100644 index 0000000..2ff1e1d --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/lastfm-love.svg @@ -0,0 +1,704 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/lastfm-unlove.svg b/www/rompr/iconsets/Purpletrator/lastfm-unlove.svg new file mode 100644 index 0000000..dc4442b --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/lastfm-unlove.svg @@ -0,0 +1,694 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/lastfm.svg b/www/rompr/iconsets/Purpletrator/lastfm.svg new file mode 100644 index 0000000..b945691 --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/lastfm.svg @@ -0,0 +1,210 @@ + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/lyrics.svg b/www/rompr/iconsets/Purpletrator/lyrics.svg new file mode 100644 index 0000000..5af87cb --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/lyrics.svg @@ -0,0 +1,694 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/media-playback-pause-highlight.svg b/www/rompr/iconsets/Purpletrator/media-playback-pause-highlight.svg new file mode 100644 index 0000000..89ed5ff --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/media-playback-pause-highlight.svg @@ -0,0 +1,127 @@ + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/media-playback-pause.svg b/www/rompr/iconsets/Purpletrator/media-playback-pause.svg new file mode 100644 index 0000000..3f57092 --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/media-playback-pause.svg @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/media-playback-start-highlight.svg b/www/rompr/iconsets/Purpletrator/media-playback-start-highlight.svg new file mode 100644 index 0000000..f188984 --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/media-playback-start-highlight.svg @@ -0,0 +1,132 @@ + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/media-playback-start.svg b/www/rompr/iconsets/Purpletrator/media-playback-start.svg new file mode 100644 index 0000000..985e90e --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/media-playback-start.svg @@ -0,0 +1,131 @@ + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/media-playback-stop-highlight.svg b/www/rompr/iconsets/Purpletrator/media-playback-stop-highlight.svg new file mode 100644 index 0000000..2d3cf37 --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/media-playback-stop-highlight.svg @@ -0,0 +1,116 @@ + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/media-playback-stop.svg b/www/rompr/iconsets/Purpletrator/media-playback-stop.svg new file mode 100644 index 0000000..ed61e4c --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/media-playback-stop.svg @@ -0,0 +1,99 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/media-skip-backward-highlight.svg b/www/rompr/iconsets/Purpletrator/media-skip-backward-highlight.svg new file mode 100644 index 0000000..0095b91 --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/media-skip-backward-highlight.svg @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/media-skip-backward.svg b/www/rompr/iconsets/Purpletrator/media-skip-backward.svg new file mode 100644 index 0000000..fab6931 --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/media-skip-backward.svg @@ -0,0 +1,102 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/media-skip-forward-highlight.svg b/www/rompr/iconsets/Purpletrator/media-skip-forward-highlight.svg new file mode 100644 index 0000000..20b5e59 --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/media-skip-forward-highlight.svg @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/media-skip-forward.svg b/www/rompr/iconsets/Purpletrator/media-skip-forward.svg new file mode 100644 index 0000000..1b30999 --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/media-skip-forward.svg @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/movie-1.svg b/www/rompr/iconsets/Purpletrator/movie-1.svg new file mode 100644 index 0000000..020f73e --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/movie-1.svg @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/mp3-audio.svg b/www/rompr/iconsets/Purpletrator/mp3-audio.svg new file mode 100644 index 0000000..4652bd5 --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/mp3-audio.svg @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/musicbrainz_logo.svg b/www/rompr/iconsets/Purpletrator/musicbrainz_logo.svg new file mode 100644 index 0000000..18ce675 --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/musicbrainz_logo.svg @@ -0,0 +1,272 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/neverheard.svg b/www/rompr/iconsets/Purpletrator/neverheard.svg new file mode 100644 index 0000000..bafcfeb --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/neverheard.svg @@ -0,0 +1,109 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/ogg-audio.svg b/www/rompr/iconsets/Purpletrator/ogg-audio.svg new file mode 100644 index 0000000..ebad92d --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/ogg-audio.svg @@ -0,0 +1,118 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/output.svg b/www/rompr/iconsets/Purpletrator/output.svg new file mode 100644 index 0000000..bf0f092 --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/output.svg @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/output_mute.svg b/www/rompr/iconsets/Purpletrator/output_mute.svg new file mode 100644 index 0000000..f3ded2d --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/output_mute.svg @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/parental-advisory.svg b/www/rompr/iconsets/Purpletrator/parental-advisory.svg new file mode 100644 index 0000000..fa883fd --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/parental-advisory.svg @@ -0,0 +1,498 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/playlist.svg b/www/rompr/iconsets/Purpletrator/playlist.svg new file mode 100644 index 0000000..cf3f9b7 --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/playlist.svg @@ -0,0 +1,174 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/podcast-logo.svg b/www/rompr/iconsets/Purpletrator/podcast-logo.svg new file mode 100644 index 0000000..7c12e34 --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/podcast-logo.svg @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/preferences.svg b/www/rompr/iconsets/Purpletrator/preferences.svg new file mode 100644 index 0000000..f37ae36 --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/preferences.svg @@ -0,0 +1,166 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/pushbutton.svg b/www/rompr/iconsets/Purpletrator/pushbutton.svg new file mode 100644 index 0000000..c9ec10f --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/pushbutton.svg @@ -0,0 +1,131 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/ratandtag.svg b/www/rompr/iconsets/Purpletrator/ratandtag.svg new file mode 100644 index 0000000..6fece77 --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/ratandtag.svg @@ -0,0 +1,127 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/ratortag.svg b/www/rompr/iconsets/Purpletrator/ratortag.svg new file mode 100644 index 0000000..20eee7a --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/ratortag.svg @@ -0,0 +1,140 @@ + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/refresh.svg b/www/rompr/iconsets/Purpletrator/refresh.svg new file mode 100644 index 0000000..8a3f48f --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/refresh.svg @@ -0,0 +1,109 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/refresh_off.svg b/www/rompr/iconsets/Purpletrator/refresh_off.svg new file mode 100644 index 0000000..5eac09b --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/refresh_off.svg @@ -0,0 +1,109 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/resize.svg b/www/rompr/iconsets/Purpletrator/resize.svg new file mode 100644 index 0000000..9c448db --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/resize.svg @@ -0,0 +1,69 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Purpletrator/rss.svg b/www/rompr/iconsets/Purpletrator/rss.svg new file mode 100644 index 0000000..9e8c4e4 --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/rss.svg @@ -0,0 +1,189 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/shuffle.svg b/www/rompr/iconsets/Purpletrator/shuffle.svg new file mode 100644 index 0000000..d2ae398 --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/shuffle.svg @@ -0,0 +1,154 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/shuffle_off.svg b/www/rompr/iconsets/Purpletrator/shuffle_off.svg new file mode 100644 index 0000000..a493a68 --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/shuffle_off.svg @@ -0,0 +1,154 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/singlestar.svg b/www/rompr/iconsets/Purpletrator/singlestar.svg new file mode 100644 index 0000000..7193bb8 --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/singlestar.svg @@ -0,0 +1,389 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/sleep.svg b/www/rompr/iconsets/Purpletrator/sleep.svg new file mode 100644 index 0000000..558d2b2 --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/sleep.svg @@ -0,0 +1,134 @@ + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/sliders.svg b/www/rompr/iconsets/Purpletrator/sliders.svg new file mode 100644 index 0000000..13f3bc4 --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/sliders.svg @@ -0,0 +1,125 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/smartradio.svg b/www/rompr/iconsets/Purpletrator/smartradio.svg new file mode 100644 index 0000000..c496ed3 --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/smartradio.svg @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/soundcloud-logo.svg b/www/rompr/iconsets/Purpletrator/soundcloud-logo.svg new file mode 100644 index 0000000..69d0e4a --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/soundcloud-logo.svg @@ -0,0 +1,106 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Purpletrator/spinner.svg b/www/rompr/iconsets/Purpletrator/spinner.svg new file mode 100644 index 0000000..9641f8e --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/spinner.svg @@ -0,0 +1,504 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/spotify-logo.svg b/www/rompr/iconsets/Purpletrator/spotify-logo.svg new file mode 100644 index 0000000..a39cc8d --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/spotify-logo.svg @@ -0,0 +1,224 @@ + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/stopafter-highlight.svg b/www/rompr/iconsets/Purpletrator/stopafter-highlight.svg new file mode 100644 index 0000000..4917907 --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/stopafter-highlight.svg @@ -0,0 +1,125 @@ + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/stopafter.svg b/www/rompr/iconsets/Purpletrator/stopafter.svg new file mode 100644 index 0000000..6887f71 --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/stopafter.svg @@ -0,0 +1,103 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/system-search.svg b/www/rompr/iconsets/Purpletrator/system-search.svg new file mode 100644 index 0000000..9155588 --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/system-search.svg @@ -0,0 +1,105 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/tag.svg b/www/rompr/iconsets/Purpletrator/tag.svg new file mode 100644 index 0000000..89facc6 --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/tag.svg @@ -0,0 +1,388 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/theme.css b/www/rompr/iconsets/Purpletrator/theme.css new file mode 100644 index 0000000..5acf405 --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/theme.css @@ -0,0 +1,249 @@ + + [class^="icon-"], [class*=" icon-"] { + background-size:contain; + background-position: center; + background-repeat:no-repeat; + display:inline-block; +} + +[class^="icon-"]:not(.button-disabled):hover, [class*=" icon-"]:not(.button-disabled):hover { + opacity: 1; + background-color: rgba(255,173,0,0.07); +} + +.clearbox { + background-image: url('iconsets/Purpletrator/edit-delete.svg'); + /* dont change the 50%, it ties in with makeHoverWork, makeClearWork, and makeTagMenu */ + background-size: auto 50%; + background-position: right 2px center; + background-repeat: no-repeat; +} + +.combobox-entry, .selectholder { + background-image: url('iconsets/Purpletrator/blobdown3.svg'); + /* dont change the 50%, it ties in with makeHoverWork, makeClearWork, and makeTagMenu */ + background-size: auto 50%; + background-position: right 2px center; + background-repeat: no-repeat; +} + +.combobox-entry:hover, .selectholder:hover { + background-image: url('iconsets/Purpletrator/blobdown3-hi.svg'); + /* dont change the 50%, it ties in with makeHoverWork, makeClearWork, and makeTagMenu */ + background-size: auto 50%; + background-position: right 2px center; + background-repeat: no-repeat; +} + +.combo-button { + background-image: url('iconsets/Purpletrator/blobdown3.svg'); +} + +.button-disabled { opacity: 0.1 } + +.icon-play-circled { background-image :url('iconsets/Purpletrator/media-playback-start.svg') } +.playdiv { background-image :url('iconsets/Purpletrator/media-playback-start.svg') } +.icon-play-circled:hover { background-image :url('iconsets/Purpletrator/media-playback-start-highlight.svg') } +.icon-pause-circled { background-image :url('iconsets/Purpletrator/media-playback-pause.svg') } +.icon-pause-circled:hover { background-image :url('iconsets/Purpletrator/media-playback-pause-highlight.svg') } +.icon-fast-backward { background-image :url('iconsets/Purpletrator/media-skip-backward.svg') } +.icon-fast-backward:hover { background-image :url('iconsets/Purpletrator/media-skip-backward-highlight.svg') } +.icon-fast-forward { background-image :url('iconsets/Purpletrator/media-skip-forward.svg') } +.icon-fast-forward:hover { background-image :url('iconsets/Purpletrator/media-skip-forward-highlight.svg') } +.icon-stop-1 { background-image :url('iconsets/Purpletrator/media-playback-stop.svg') } +.icon-stop-1:hover { background-image :url('iconsets/Purpletrator/media-playback-stop-highlight.svg') } +.icon-to-end-1 { background-image :url('iconsets/Purpletrator/stopafter.svg') } +.icon-to-end-1:hover { background-image :url('iconsets/Purpletrator/stopafter-highlight.svg') } + +.icon-music { background-image: url('iconsets/Purpletrator/collection.svg') } +.icon-search { background-image: url('iconsets/Purpletrator/system-search.svg') } +.icon-folder-open-empty { background-image: url('iconsets/Purpletrator/folder.svg') } +.icon-radio-tower { background-image: url('iconsets/Purpletrator/broadcast-new.svg') } +.icon-cd { background-image: url('iconsets/Purpletrator/cd_case.svg') } +.icon-resize-horizontal { background-image: url('iconsets/Purpletrator/resize.svg') } +.icon-angle-double-left { background-image:url('iconsets/Purpletrator/arrow-left-double.svg') } +.icon-angle-double-right { background-image:url('iconsets/Purpletrator/arrow-right-double.svg') } +.icon-menu { background-image: url('iconsets/Purpletrator/pushbutton.svg') } +.icon-versions { background-image: url('iconsets/Purpletrator/history.svg') } +.icon-left-circled { background-image: url('iconsets/Purpletrator/backbutton.svg') } +.icon-right-circled { background-image: url('iconsets/Purpletrator/forwardbutton.svg') } +.icon-cog-alt { background-image: url('iconsets/Purpletrator/preferences.svg') } +.icon-trash { background-image: url('iconsets/Purpletrator/edit-clear-list.svg') } +.icon-wifi { background-image: url('iconsets/Purpletrator/smartradio.svg') } +.icon-doc-text { background-image: url('iconsets/Purpletrator/playlist.svg') } +.icon-floppy { background-image: url('iconsets/Purpletrator/document-save.svg') } +.icon-cancel-circled { background-image: url('iconsets/Purpletrator/edit-delete.svg') } +.icon-plus { + background-image: url('iconsets/Purpletrator/add.svg'); + opacity:0.7; +} +.icon-alarm { background-image: url('iconsets/Purpletrator/alarmclock_false.svg') } +.icon-alarm-on { background-image: url('iconsets/Purpletrator/alarmclock_true.svg') } +.icon-sleep { background-image: url('iconsets/Purpletrator/sleep.svg') } +.icon-library { background-image: url('iconsets/Purpletrator/file.svg') } +.icon-lastfm-1 { background-image: url('iconsets/Purpletrator/lastfm.svg') } +.icon-wikipedia { background-image: url('iconsets/Purpletrator/wikipedia-logo.svg') } +.icon-musicbrainz { background-image: url('iconsets/Purpletrator/musicbrainz_logo.svg') } +.icon-discogs { background-image: url('iconsets/Purpletrator/discogs-logo.svg') } +.icon-doc-text-1 { background-image: url('iconsets/Purpletrator/lyrics.svg') } +.icon-soundcloud-circled { background-image: url('iconsets/Purpletrator/soundcloud-logo.svg') } +.icon-youtube-circled { background-image: url('iconsets/Purpletrator/youtube-logo.svg') } +.icon-gmusic-circled { background-image: url('iconsets/Purpletrator/gmusic-logo.svg') } +.icon-spotify-circled { background-image: url('iconsets/Purpletrator/spotify-logo.svg') } +.icon-vkontakte-circled { background-image: url('iconsets/Purpletrator/vkontakte-logo.svg') } +.icon-podcast-circled { background-image: url('iconsets/Purpletrator/podcast-logo.svg') } +.icon-audiobook { background-image: url('iconsets/Purpletrator/audiobook.svg') } +.icon-internetarchive-circled { background-image: url('iconsets/Purpletrator/internetarchive-logo.svg') } +.icon-increase { background-image: url('iconsets/Purpletrator/arrow-increase.svg') } +.icon-decrease { background-image: url('iconsets/Purpletrator/arrow-decrease.svg') } +.icon-attention-1 { background-image: url('iconsets/Purpletrator/dialog-error.svg') } +.icon-info-circled { background-image: url('iconsets/Purpletrator/dialog-information.svg') } +.icon-download { background-image: url('iconsets/Purpletrator/download-icon.svg') } +.icon-sun { background-image: url('iconsets/Purpletrator/icon-new.svg') } +.icon-headphones { background-image: url('iconsets/Purpletrator/headphones.svg') } +.icon-unlistened { background-image: url('iconsets/Purpletrator/headphones.svg') } +.icon-block { background-image: url('iconsets/Purpletrator/lastfm-ban.svg') } +.icon-heart { background-image: url('iconsets/Purpletrator/lastfm-love.svg') } +.icon-heart-broken { background-image: url('iconsets/Purpletrator/lastfm-unlove.svg') } +.icon-refresh { background-image: url('iconsets/Purpletrator/refresh.svg') } +.icon-dirble-circled { background-image: url('iconsets/Purpletrator/dirble-logo.svg') } +.icon-tunein { background-image: url('iconsets/Purpletrator/../../newimages/tunein-logo.svg') } +.icon-no-response-playbutton { background-image :url('iconsets/Purpletrator/media-playback-start.svg') } +.icon-tags { background-image: url('iconsets/Purpletrator/tag.svg') } +.icon-volume-up { background-image: url('iconsets/Purpletrator/volume.svg') } +.icon-toggle-open { background-image: url('iconsets/Purpletrator/toggle-open.svg') } +.icon-toggle-closed { background-image: url('iconsets/Purpletrator/toggle-closed.svg') } +.icon-spin6 { background-image: url('iconsets/Purpletrator/spinner.svg') } +.icon-output { background-image: url('iconsets/Purpletrator/output.svg') } +.icon-output-mute { background-image: url('iconsets/Purpletrator/output_mute.svg') } +.icon-sliders { background-image: url('iconsets/Purpletrator/sliders.svg') } +.icon-0-stars { background-image: url('iconsets/Purpletrator/0stars.svg') } +.icon-1-stars { background-image: url('iconsets/Purpletrator/1stars.svg') } +.icon-2-stars { background-image: url('iconsets/Purpletrator/2stars.svg') } +.icon-3-stars { background-image: url('iconsets/Purpletrator/3stars.svg') } +.icon-4-stars { background-image: url('iconsets/Purpletrator/4stars.svg') } +.icon-5-stars { background-image: url('iconsets/Purpletrator/5stars.svg') } +.icon-single-star { background-image: url('iconsets/Purpletrator/singlestar.svg') } +.icon-ratandtag { background-image: url('iconsets/Purpletrator/ratandtag.svg') } +.icon-ratortag { background-image: url('iconsets/Purpletrator/ratortag.svg') } +.icon-toggle-on { background-image: url('iconsets/Purpletrator/togglebutton-new2-on.svg') } +.icon-toggle-off { background-image: url('iconsets/Purpletrator/togglebutton-new2-off.svg') } + +.icon-random.flow-on { background-image: url('iconsets/Purpletrator/shuffle.svg') } +.icon-random.flow-off { background-image: url('iconsets/Purpletrator/shuffle_off.svg') } +.icon-crossfade.flow-on { background-image: url('iconsets/Purpletrator/crossfade.svg') } +.icon-crossfade.flow-off { background-image: url('iconsets/Purpletrator/crossfade_off.svg') } +.icon-repeat.flow-on { background-image: url('iconsets/Purpletrator/refresh.svg') } +.icon-repeat.flow-off { background-image: url('iconsets/Purpletrator/refresh_off.svg') } +.icon-consume.flow-on { background-image: url('iconsets/Purpletrator/consume.svg') } +.icon-consume.flow-off { background-image: url('iconsets/Purpletrator/consume_off.svg') } + +.icon-allrandom { background-image: url('iconsets/Purpletrator/shuffle.svg') } +.icon-neverplayed { background-image: url('iconsets/Purpletrator/neverheard.svg') } +.icon-recentlyplayed { background-image: url('iconsets/Purpletrator/calendar.svg') } +.icon-artist { background-image: url('iconsets/Purpletrator/artist-icon.svg') } +.icon-mp3-audio { background-image: url('iconsets/Purpletrator/mp3-audio.svg') } +.icon-aac-audio { background-image: url('iconsets/Purpletrator/aac-audio.svg') } +.icon-flac-audio { background-image: url('iconsets/Purpletrator/flac-audio.svg') } +.icon-wma-audio { background-image: url('iconsets/Purpletrator/wma-audio.svg') } +.icon-ogg-audio { background-image: url('iconsets/Purpletrator/ogg-audio.svg') } +.icon-explicit { background-image: url('iconsets/Purpletrator/parental-advisory.svg') } +.icon-expand-up { background-image: url('iconsets/Purpletrator/expand-up.svg') } +.icon-rss { background-image: url('iconsets/Purpletrator/rss.svg') } +.icon-tick { background-image: url('iconsets/Purpletrator/tick.svg') } +.icon-video { background-image: url('iconsets/Purpletrator/movie-1.svg') } +.icon-bbc-logo { background-image: url('iconsets/Purpletrator/bbc-logo.svg') } +.icon-imdb-logo { background-image: url('iconsets/Purpletrator/imdb-logo.svg') } +.icon-facebook-logo { background-image: url('iconsets/Purpletrator/facebook-logo.svg') } +.icon-twitter-logo { background-image: url('iconsets/Purpletrator/twitter-logo.svg') } +.icon-www { background-image: url('iconsets/Purpletrator/world-wide-web.svg') } +.icon-allmusic { background-image: url('iconsets/Purpletrator/allmusic-logo.svg') } +.icon-updown { background-image: url('iconsets/Purpletrator/arrow-updown.svg') } +.icon-snapcast { background-image: url('iconsets/Purpletrator/../../newimages/snapcast.png') } + +.styledinputs label +{ + display:inline-block; + cursor:pointer; + position:relative; + padding-left:2em; + line-height:1.5em; +} + +.styledinputs input[type=radio] +{ + display:none; +} + +.styledinputs input[type=checkbox] +{ + display:none; +} + +.styledinputs label:before +{ + content:""; + display:inline-block; + width:1.5em; + height:1.5em; + position:absolute; + left:0; + background-image: url('iconsets/Purpletrator/togglebutton-new2-off.svg'); + background-size: auto 80%; + background-position: center; + background-repeat:no-repeat; +} + +.styledinputs input:checked + label:before +{ + background-image: url('iconsets/Purpletrator/togglebutton-new2-on.svg') !important; +} + +img.notexist,img.notfound +{ + background-image: url('iconsets/Purpletrator/compact-disc.svg'); + background-size:contain; + display:inline-block; + background-position: center; + background-repeat:no-repeat; +} + +img.stream.notfound, img.stream.notexist +{ + background-image: url('iconsets/Purpletrator/broadcast-new.svg'); +} + +img.plimage.notfound +{ + background-image: url('iconsets/Purpletrator/playlist.svg'); +} + +.backmenu +{ + background-image: url('iconsets/Purpletrator/arrow-left-double.svg'); + background-repeat: no-repeat; + background-size: contain; +} + +button.iconbutton { + height:2em; + width:2em; + background-size: contain; + background-position:center; + border: none !important; + opacity: 0.8; + background-color:transparent; +} + +button.iconbutton:hover { + opacity: 1; +} + +button.searchbutton { + background-image: url('iconsets/Purpletrator/system-search.svg'); +} + +button.rssbutton { + background-image: url('iconsets/Purpletrator/rss.svg'); +} + diff --git a/www/rompr/iconsets/Purpletrator/tick.svg b/www/rompr/iconsets/Purpletrator/tick.svg new file mode 100644 index 0000000..e5e9026 --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/tick.svg @@ -0,0 +1,397 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/toggle-closed.svg b/www/rompr/iconsets/Purpletrator/toggle-closed.svg new file mode 100644 index 0000000..3085a64 --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/toggle-closed.svg @@ -0,0 +1,436 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/toggle-open.svg b/www/rompr/iconsets/Purpletrator/toggle-open.svg new file mode 100644 index 0000000..51db76a --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/toggle-open.svg @@ -0,0 +1,433 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/togglebutton-new2-off.svg b/www/rompr/iconsets/Purpletrator/togglebutton-new2-off.svg new file mode 100644 index 0000000..a2b7b77 --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/togglebutton-new2-off.svg @@ -0,0 +1,472 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/togglebutton-new2-on.svg b/www/rompr/iconsets/Purpletrator/togglebutton-new2-on.svg new file mode 100644 index 0000000..3cbe773 --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/togglebutton-new2-on.svg @@ -0,0 +1,579 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/twitter-logo.svg b/www/rompr/iconsets/Purpletrator/twitter-logo.svg new file mode 100644 index 0000000..3d34585 --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/twitter-logo.svg @@ -0,0 +1,446 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/unlistened.svg b/www/rompr/iconsets/Purpletrator/unlistened.svg new file mode 100644 index 0000000..6bf73c5 --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/unlistened.svg @@ -0,0 +1,69 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Purpletrator/vkontakte-logo.svg b/www/rompr/iconsets/Purpletrator/vkontakte-logo.svg new file mode 100644 index 0000000..85a3bc3 --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/vkontakte-logo.svg @@ -0,0 +1,489 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/volume.svg b/www/rompr/iconsets/Purpletrator/volume.svg new file mode 100644 index 0000000..86a28fa --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/volume.svg @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/wikipedia-logo.svg b/www/rompr/iconsets/Purpletrator/wikipedia-logo.svg new file mode 100644 index 0000000..a0ebcdc --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/wikipedia-logo.svg @@ -0,0 +1,393 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/wma-audio.svg b/www/rompr/iconsets/Purpletrator/wma-audio.svg new file mode 100644 index 0000000..acf8260 --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/wma-audio.svg @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Purpletrator/world-wide-web.svg b/www/rompr/iconsets/Purpletrator/world-wide-web.svg new file mode 100644 index 0000000..aa1508f --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/world-wide-web.svg @@ -0,0 +1,82 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Purpletrator/youtube-logo.svg b/www/rompr/iconsets/Purpletrator/youtube-logo.svg new file mode 100644 index 0000000..dfe9e91 --- /dev/null +++ b/www/rompr/iconsets/Purpletrator/youtube-logo.svg @@ -0,0 +1,388 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush-Dark/0stars.svg b/www/rompr/iconsets/Slush-Dark/0stars.svg new file mode 100644 index 0000000..654cc4c --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/0stars.svg @@ -0,0 +1,82 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush-Dark/1stars.svg b/www/rompr/iconsets/Slush-Dark/1stars.svg new file mode 100644 index 0000000..ffd2391 --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/1stars.svg @@ -0,0 +1,107 @@ + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush-Dark/2stars.svg b/www/rompr/iconsets/Slush-Dark/2stars.svg new file mode 100644 index 0000000..de2dc19 --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/2stars.svg @@ -0,0 +1,118 @@ + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush-Dark/3stars.svg b/www/rompr/iconsets/Slush-Dark/3stars.svg new file mode 100644 index 0000000..d961d93 --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/3stars.svg @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush-Dark/4stars.svg b/www/rompr/iconsets/Slush-Dark/4stars.svg new file mode 100644 index 0000000..bf7c774 --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/4stars.svg @@ -0,0 +1,140 @@ + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush-Dark/5stars.svg b/www/rompr/iconsets/Slush-Dark/5stars.svg new file mode 100644 index 0000000..34c702a --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/5stars.svg @@ -0,0 +1,151 @@ + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush-Dark/aac-audio.svg b/www/rompr/iconsets/Slush-Dark/aac-audio.svg new file mode 100644 index 0000000..1b018b1 --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/aac-audio.svg @@ -0,0 +1,390 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush-Dark/add.svg b/www/rompr/iconsets/Slush-Dark/add.svg new file mode 100644 index 0000000..8456963 --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/add.svg @@ -0,0 +1,175 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + diff --git a/www/rompr/iconsets/Slush-Dark/adjustments.css b/www/rompr/iconsets/Slush-Dark/adjustments.css new file mode 100644 index 0000000..003e866 --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/adjustments.css @@ -0,0 +1,230 @@ +#buttons +{ + padding-left:12px; + padding-right:12px; + padding-top:4px; + padding-bottom:6px; +} + +.controlbutton +{ + margin:0px; + padding:0px; + vertical-align:middle; + display:inline-block; + width:56px; + height:56px; +} + +.controlbutton-small +{ + margin:0px; + vertical-align:middle; + display:inline-block; + width:48px; + height:48px; +} + +@media screen and (min-height: 800px) and (max-height: 939px) { + .controlbutton { + width:64px; + height:64px; + } + #buttons { + padding-top:12px; + } + #playbackTime { + margin-top:2px; + font-size:12px; + line-height:14px; + height:14px; + } +} + +@media screen and (min-height: 940px) and (max-height: 1099px) and (min-width: 650px) { + .controlbutton { + width:84px; + height:84px; + } + + .controlbutton-small { + width:64px; + height:64px; + } + + .shiftleft + { + left:-12px; + position:relative; + z-index:250; + } + + .shiftleft2 + { + left:-26px; + position:relative; + } + + .shiftleft3 + { + position:relative; + left:-36px; + z-index:5; + } + + .shiftleft4 + { + position:relative; + left:-48px; + z-index:1; + margin-right:-36px; + } + +} + +@media screen and (min-height: 940px) and (max-height: 1099px) and (min-width: 650px) { + .controlbutton { + width:84px; + height:84px; + } + .controlbutton-small { + width:64px; + height:64px; + } + #buttons { + padding-top:16px; + padding-left:24px; + } + #playbackTime { + margin-top:4px; + font-size:14px; + line-height:16px; + height:16px; + } + .shiftleft + { + left:-12px; + position:relative; + z-index:250; + } + + .shiftleft2 + { + left:-26px; + position:relative; + } + + .shiftleft3 + { + position:relative; + left:-36px; + z-index:5; + } + + .shiftleft4 + { + position:relative; + left:-48px; + z-index:1; + margin-right:-36px; + } +} + +@media screen and (min-height: 1100px) and (min-width: 651px) and (max-width: 749px) { + .controlbutton { + width:84px; + height:84px; + } + .controlbutton-small { + width:64px; + height:64px; + } + #buttons { + padding-top:16px; + padding-left:24px; + } + #playbackTime { + margin-top:4px; + font-size:14px; + line-height:16px; + height:16px; + } + .shiftleft + { + left:-12px; + position:relative; + z-index:250; + } + + .shiftleft2 + { + left:-26px; + position:relative; + } + + .shiftleft3 + { + position:relative; + left:-36px; + z-index:5; + } + + .shiftleft4 + { + position:relative; + left:-48px; + z-index:1; + margin-right:-36px; + } +} + +@media screen and (min-height: 1100px) and (min-width: 720px) { + .controlbutton { + width:90px; + height:90px; + } + .controlbutton-small { + width:70px; + height:70px; + } + #buttons { + padding-top:12px; + padding-left:20px; + } + #progress { + margin-top:8px; + } + #playbackTime { + margin-top:12px; + font-size:16px; + line-height:18px; + height:18px; + } + .shiftleft + { + left:-10px; + position:relative; + z-index:250; + } + + .shiftleft2 + { + left:-22px; + position:relative; + } + + .shiftleft3 + { + position:relative; + left:-34px; + z-index:5; + } + + .shiftleft4 + { + position:relative; + left:-44px; + z-index:1; + margin-right:-36px; + } +} diff --git a/www/rompr/iconsets/Slush-Dark/alarmclock_false.svg b/www/rompr/iconsets/Slush-Dark/alarmclock_false.svg new file mode 100644 index 0000000..1c3dd3e --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/alarmclock_false.svg @@ -0,0 +1,67 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush-Dark/alarmclock_true.svg b/www/rompr/iconsets/Slush-Dark/alarmclock_true.svg new file mode 100644 index 0000000..31456fd --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/alarmclock_true.svg @@ -0,0 +1,67 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush-Dark/allmusic-logo.svg b/www/rompr/iconsets/Slush-Dark/allmusic-logo.svg new file mode 100644 index 0000000..c5782c5 --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/allmusic-logo.svg @@ -0,0 +1,147 @@ + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush-Dark/arrow-decrease.svg b/www/rompr/iconsets/Slush-Dark/arrow-decrease.svg new file mode 100644 index 0000000..dfa629d --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/arrow-decrease.svg @@ -0,0 +1,68 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush-Dark/arrow-increase.svg b/www/rompr/iconsets/Slush-Dark/arrow-increase.svg new file mode 100644 index 0000000..fac5421 --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/arrow-increase.svg @@ -0,0 +1,68 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush-Dark/arrow-left-double.svg b/www/rompr/iconsets/Slush-Dark/arrow-left-double.svg new file mode 100644 index 0000000..b10bda9 --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/arrow-left-double.svg @@ -0,0 +1,72 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush-Dark/arrow-right-double.svg b/www/rompr/iconsets/Slush-Dark/arrow-right-double.svg new file mode 100644 index 0000000..07dcc44 --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/arrow-right-double.svg @@ -0,0 +1,93 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush-Dark/arrow-updown.svg b/www/rompr/iconsets/Slush-Dark/arrow-updown.svg new file mode 100644 index 0000000..205d1bb --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/arrow-updown.svg @@ -0,0 +1,121 @@ + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/www/rompr/iconsets/Slush-Dark/artist-icon.svg b/www/rompr/iconsets/Slush-Dark/artist-icon.svg new file mode 100644 index 0000000..012b7a9 --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/artist-icon.svg @@ -0,0 +1,151 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush-Dark/audiobook.svg b/www/rompr/iconsets/Slush-Dark/audiobook.svg new file mode 100644 index 0000000..0a7807b --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/audiobook.svg @@ -0,0 +1,96 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush-Dark/backbutton.svg b/www/rompr/iconsets/Slush-Dark/backbutton.svg new file mode 100644 index 0000000..6763d3a --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/backbutton.svg @@ -0,0 +1,66 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush-Dark/bbc-logo.svg b/www/rompr/iconsets/Slush-Dark/bbc-logo.svg new file mode 100644 index 0000000..f29a616 --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/bbc-logo.svg @@ -0,0 +1,185 @@ + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush-Dark/blobdown2-hi.svg b/www/rompr/iconsets/Slush-Dark/blobdown2-hi.svg new file mode 100644 index 0000000..e147ca4 --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/blobdown2-hi.svg @@ -0,0 +1,125 @@ + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush-Dark/blobdown2.svg b/www/rompr/iconsets/Slush-Dark/blobdown2.svg new file mode 100644 index 0000000..d4c628c --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/blobdown2.svg @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush-Dark/broadcast-new.svg b/www/rompr/iconsets/Slush-Dark/broadcast-new.svg new file mode 100644 index 0000000..b025d3d --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/broadcast-new.svg @@ -0,0 +1,67 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush-Dark/calendar.svg b/www/rompr/iconsets/Slush-Dark/calendar.svg new file mode 100644 index 0000000..0552789 --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/calendar.svg @@ -0,0 +1,138 @@ + + + + Svg Vector Icons : http://www.onlinewebfonts.com/icon image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush-Dark/cd_case.svg b/www/rompr/iconsets/Slush-Dark/cd_case.svg new file mode 100644 index 0000000..cd4ecbf --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/cd_case.svg @@ -0,0 +1,68 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush-Dark/collection.svg b/www/rompr/iconsets/Slush-Dark/collection.svg new file mode 100644 index 0000000..39b0abe --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/collection.svg @@ -0,0 +1,161 @@ + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush-Dark/compact-disc.svg b/www/rompr/iconsets/Slush-Dark/compact-disc.svg new file mode 100644 index 0000000..ff2fd76 --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/compact-disc.svg @@ -0,0 +1,84 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush-Dark/consume.svg b/www/rompr/iconsets/Slush-Dark/consume.svg new file mode 100644 index 0000000..0ff9c07 --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/consume.svg @@ -0,0 +1,85 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/www/rompr/iconsets/Slush-Dark/consume_off.svg b/www/rompr/iconsets/Slush-Dark/consume_off.svg new file mode 100644 index 0000000..4694486 --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/consume_off.svg @@ -0,0 +1,85 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/www/rompr/iconsets/Slush-Dark/crossfade.svg b/www/rompr/iconsets/Slush-Dark/crossfade.svg new file mode 100644 index 0000000..4a3f780 --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/crossfade.svg @@ -0,0 +1,119 @@ + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + diff --git a/www/rompr/iconsets/Slush-Dark/crossfade_off.svg b/www/rompr/iconsets/Slush-Dark/crossfade_off.svg new file mode 100644 index 0000000..1936232 --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/crossfade_off.svg @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + diff --git a/www/rompr/iconsets/Slush-Dark/dialog-error.svg b/www/rompr/iconsets/Slush-Dark/dialog-error.svg new file mode 100644 index 0000000..2265bce --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/dialog-error.svg @@ -0,0 +1,68 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush-Dark/dialog-information.svg b/www/rompr/iconsets/Slush-Dark/dialog-information.svg new file mode 100644 index 0000000..c238f05 --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/dialog-information.svg @@ -0,0 +1,74 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush-Dark/dirble-logo.svg b/www/rompr/iconsets/Slush-Dark/dirble-logo.svg new file mode 100644 index 0000000..3c56a88 --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/dirble-logo.svg @@ -0,0 +1,229 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush-Dark/discogs-logo.svg b/www/rompr/iconsets/Slush-Dark/discogs-logo.svg new file mode 100644 index 0000000..a560ec6 --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/discogs-logo.svg @@ -0,0 +1,528 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush-Dark/document-save.svg b/www/rompr/iconsets/Slush-Dark/document-save.svg new file mode 100644 index 0000000..1c689ec --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/document-save.svg @@ -0,0 +1,68 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush-Dark/download-icon.svg b/www/rompr/iconsets/Slush-Dark/download-icon.svg new file mode 100644 index 0000000..85fdea5 --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/download-icon.svg @@ -0,0 +1,72 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush-Dark/edit-clear-list.svg b/www/rompr/iconsets/Slush-Dark/edit-clear-list.svg new file mode 100644 index 0000000..74f7bdb --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/edit-clear-list.svg @@ -0,0 +1,67 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush-Dark/edit-delete.svg b/www/rompr/iconsets/Slush-Dark/edit-delete.svg new file mode 100644 index 0000000..f3223dd --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/edit-delete.svg @@ -0,0 +1,67 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush-Dark/expand-up.svg b/www/rompr/iconsets/Slush-Dark/expand-up.svg new file mode 100644 index 0000000..3d96d6c --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/expand-up.svg @@ -0,0 +1,138 @@ + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush-Dark/facebook-logo.svg b/www/rompr/iconsets/Slush-Dark/facebook-logo.svg new file mode 100644 index 0000000..58dcda2 --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/facebook-logo.svg @@ -0,0 +1,140 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush-Dark/file.svg b/www/rompr/iconsets/Slush-Dark/file.svg new file mode 100644 index 0000000..fa23a07 --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/file.svg @@ -0,0 +1,68 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush-Dark/flac-audio.svg b/www/rompr/iconsets/Slush-Dark/flac-audio.svg new file mode 100644 index 0000000..ffcc720 --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/flac-audio.svg @@ -0,0 +1,127 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush-Dark/folder.svg b/www/rompr/iconsets/Slush-Dark/folder.svg new file mode 100644 index 0000000..af7aa05 --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/folder.svg @@ -0,0 +1,72 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush-Dark/forwardbutton.svg b/www/rompr/iconsets/Slush-Dark/forwardbutton.svg new file mode 100644 index 0000000..309f3b8 --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/forwardbutton.svg @@ -0,0 +1,66 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush-Dark/gmusic-logo.svg b/www/rompr/iconsets/Slush-Dark/gmusic-logo.svg new file mode 100644 index 0000000..3109dce --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/gmusic-logo.svg @@ -0,0 +1,65 @@ + + Svg Vector Icons : http://www.onlinewebfonts.com/icon image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush-Dark/headphones.svg b/www/rompr/iconsets/Slush-Dark/headphones.svg new file mode 100644 index 0000000..ce547f4 --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/headphones.svg @@ -0,0 +1,73 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush-Dark/icon-new.svg b/www/rompr/iconsets/Slush-Dark/icon-new.svg new file mode 100644 index 0000000..ae99d22 --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/icon-new.svg @@ -0,0 +1,72 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush-Dark/imdb-logo.svg b/www/rompr/iconsets/Slush-Dark/imdb-logo.svg new file mode 100644 index 0000000..3b67dbb --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/imdb-logo.svg @@ -0,0 +1,497 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush-Dark/internetarchive-logo.svg b/www/rompr/iconsets/Slush-Dark/internetarchive-logo.svg new file mode 100644 index 0000000..5784275 --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/internetarchive-logo.svg @@ -0,0 +1,145 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush-Dark/lastfm-ban.svg b/www/rompr/iconsets/Slush-Dark/lastfm-ban.svg new file mode 100644 index 0000000..1a45abe --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/lastfm-ban.svg @@ -0,0 +1,67 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush-Dark/lastfm-love.svg b/www/rompr/iconsets/Slush-Dark/lastfm-love.svg new file mode 100644 index 0000000..2c56548 --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/lastfm-love.svg @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/www/rompr/iconsets/Slush-Dark/lastfm-unlove.svg b/www/rompr/iconsets/Slush-Dark/lastfm-unlove.svg new file mode 100644 index 0000000..95f225e --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/lastfm-unlove.svg @@ -0,0 +1,67 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush-Dark/lastfm.svg b/www/rompr/iconsets/Slush-Dark/lastfm.svg new file mode 100644 index 0000000..854927f --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/lastfm.svg @@ -0,0 +1,67 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush-Dark/lyrics.svg b/www/rompr/iconsets/Slush-Dark/lyrics.svg new file mode 100644 index 0000000..71fd1db --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/lyrics.svg @@ -0,0 +1,67 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush-Dark/media-playback-pause-highlight.svg b/www/rompr/iconsets/Slush-Dark/media-playback-pause-highlight.svg new file mode 100644 index 0000000..946931a --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/media-playback-pause-highlight.svg @@ -0,0 +1,103 @@ + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush-Dark/media-playback-pause.svg b/www/rompr/iconsets/Slush-Dark/media-playback-pause.svg new file mode 100644 index 0000000..85becd8 --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/media-playback-pause.svg @@ -0,0 +1,135 @@ + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush-Dark/media-playback-start-highlight.svg b/www/rompr/iconsets/Slush-Dark/media-playback-start-highlight.svg new file mode 100644 index 0000000..ad17a66 --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/media-playback-start-highlight.svg @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + diff --git a/www/rompr/iconsets/Slush-Dark/media-playback-start.svg b/www/rompr/iconsets/Slush-Dark/media-playback-start.svg new file mode 100644 index 0000000..c5919c6 --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/media-playback-start.svg @@ -0,0 +1,220 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + diff --git a/www/rompr/iconsets/Slush-Dark/media-playback-stop-highlight.svg b/www/rompr/iconsets/Slush-Dark/media-playback-stop-highlight.svg new file mode 100644 index 0000000..402f157 --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/media-playback-stop-highlight.svg @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + diff --git a/www/rompr/iconsets/Slush-Dark/media-playback-stop.svg b/www/rompr/iconsets/Slush-Dark/media-playback-stop.svg new file mode 100644 index 0000000..19ad540 --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/media-playback-stop.svg @@ -0,0 +1,220 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + diff --git a/www/rompr/iconsets/Slush-Dark/media-skip-backward-highlight.svg b/www/rompr/iconsets/Slush-Dark/media-skip-backward-highlight.svg new file mode 100644 index 0000000..3e16fed --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/media-skip-backward-highlight.svg @@ -0,0 +1,130 @@ + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush-Dark/media-skip-backward.svg b/www/rompr/iconsets/Slush-Dark/media-skip-backward.svg new file mode 100644 index 0000000..083780e --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/media-skip-backward.svg @@ -0,0 +1,249 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush-Dark/media-skip-forward-highlight.svg b/www/rompr/iconsets/Slush-Dark/media-skip-forward-highlight.svg new file mode 100644 index 0000000..3c5a247 --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/media-skip-forward-highlight.svg @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush-Dark/media-skip-forward.svg b/www/rompr/iconsets/Slush-Dark/media-skip-forward.svg new file mode 100644 index 0000000..fa5af70 --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/media-skip-forward.svg @@ -0,0 +1,249 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush-Dark/movie-1.svg b/www/rompr/iconsets/Slush-Dark/movie-1.svg new file mode 100644 index 0000000..5467daf --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/movie-1.svg @@ -0,0 +1,67 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush-Dark/mp3-audio.svg b/www/rompr/iconsets/Slush-Dark/mp3-audio.svg new file mode 100644 index 0000000..fb752a1 --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/mp3-audio.svg @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + diff --git a/www/rompr/iconsets/Slush-Dark/musicbrainz_logo.svg b/www/rompr/iconsets/Slush-Dark/musicbrainz_logo.svg new file mode 100644 index 0000000..d48512a --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/musicbrainz_logo.svg @@ -0,0 +1,599 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush-Dark/neverheard.svg b/www/rompr/iconsets/Slush-Dark/neverheard.svg new file mode 100644 index 0000000..c7e3fdb --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/neverheard.svg @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush-Dark/ogg-audio.svg b/www/rompr/iconsets/Slush-Dark/ogg-audio.svg new file mode 100644 index 0000000..aedf39c --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/ogg-audio.svg @@ -0,0 +1,119 @@ + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush-Dark/output.svg b/www/rompr/iconsets/Slush-Dark/output.svg new file mode 100644 index 0000000..f7038a0 --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/output.svg @@ -0,0 +1,63 @@ + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush-Dark/output_mute.svg b/www/rompr/iconsets/Slush-Dark/output_mute.svg new file mode 100644 index 0000000..6b6d89b --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/output_mute.svg @@ -0,0 +1,63 @@ + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush-Dark/parental-advisory.svg b/www/rompr/iconsets/Slush-Dark/parental-advisory.svg new file mode 100644 index 0000000..81f9767 --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/parental-advisory.svg @@ -0,0 +1,106 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush-Dark/playlist.svg b/www/rompr/iconsets/Slush-Dark/playlist.svg new file mode 100644 index 0000000..618f88f --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/playlist.svg @@ -0,0 +1,99 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush-Dark/podcast-logo.svg b/www/rompr/iconsets/Slush-Dark/podcast-logo.svg new file mode 100644 index 0000000..f74c8ee --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/podcast-logo.svg @@ -0,0 +1,66 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush-Dark/preferences.svg b/www/rompr/iconsets/Slush-Dark/preferences.svg new file mode 100644 index 0000000..56817d6 --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/preferences.svg @@ -0,0 +1,75 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush-Dark/pushbutton.svg b/www/rompr/iconsets/Slush-Dark/pushbutton.svg new file mode 100644 index 0000000..46124ba --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/pushbutton.svg @@ -0,0 +1,75 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush-Dark/random.svg b/www/rompr/iconsets/Slush-Dark/random.svg new file mode 100644 index 0000000..73f9b59 --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/random.svg @@ -0,0 +1,151 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush-Dark/random_off.svg b/www/rompr/iconsets/Slush-Dark/random_off.svg new file mode 100644 index 0000000..79c0db2 --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/random_off.svg @@ -0,0 +1,141 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush-Dark/ratandtag.svg b/www/rompr/iconsets/Slush-Dark/ratandtag.svg new file mode 100644 index 0000000..d51adeb --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/ratandtag.svg @@ -0,0 +1,121 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush-Dark/ratortag.svg b/www/rompr/iconsets/Slush-Dark/ratortag.svg new file mode 100644 index 0000000..66bc658 --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/ratortag.svg @@ -0,0 +1,125 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush-Dark/refresh.svg b/www/rompr/iconsets/Slush-Dark/refresh.svg new file mode 100644 index 0000000..35566e6 --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/refresh.svg @@ -0,0 +1,72 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush-Dark/refresh_off.svg b/www/rompr/iconsets/Slush-Dark/refresh_off.svg new file mode 100644 index 0000000..d54565d --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/refresh_off.svg @@ -0,0 +1,79 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush-Dark/resize.svg b/www/rompr/iconsets/Slush-Dark/resize.svg new file mode 100644 index 0000000..0c0169d --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/resize.svg @@ -0,0 +1,67 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush-Dark/rss.svg b/www/rompr/iconsets/Slush-Dark/rss.svg new file mode 100644 index 0000000..d2a8183 --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/rss.svg @@ -0,0 +1,169 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush-Dark/shuffle.svg b/www/rompr/iconsets/Slush-Dark/shuffle.svg new file mode 100644 index 0000000..514af05 --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/shuffle.svg @@ -0,0 +1,141 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush-Dark/singlestar.svg b/www/rompr/iconsets/Slush-Dark/singlestar.svg new file mode 100644 index 0000000..f8ee836 --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/singlestar.svg @@ -0,0 +1,98 @@ + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + diff --git a/www/rompr/iconsets/Slush-Dark/sleep.svg b/www/rompr/iconsets/Slush-Dark/sleep.svg new file mode 100644 index 0000000..88431b6 --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/sleep.svg @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush-Dark/sliders.svg b/www/rompr/iconsets/Slush-Dark/sliders.svg new file mode 100644 index 0000000..95e342f --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/sliders.svg @@ -0,0 +1,116 @@ + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush-Dark/smartradio.svg b/www/rompr/iconsets/Slush-Dark/smartradio.svg new file mode 100644 index 0000000..9747dd9 --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/smartradio.svg @@ -0,0 +1,67 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush-Dark/soundcloud-logo.svg b/www/rompr/iconsets/Slush-Dark/soundcloud-logo.svg new file mode 100644 index 0000000..7a13eb2 --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/soundcloud-logo.svg @@ -0,0 +1,73 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush-Dark/spinner.svg b/www/rompr/iconsets/Slush-Dark/spinner.svg new file mode 100644 index 0000000..4714473 --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/spinner.svg @@ -0,0 +1,67 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush-Dark/spotify-logo.svg b/www/rompr/iconsets/Slush-Dark/spotify-logo.svg new file mode 100644 index 0000000..420f079 --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/spotify-logo.svg @@ -0,0 +1,67 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush-Dark/stopafter-highlight.svg b/www/rompr/iconsets/Slush-Dark/stopafter-highlight.svg new file mode 100644 index 0000000..385e941 --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/stopafter-highlight.svg @@ -0,0 +1,150 @@ + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush-Dark/stopafter.svg b/www/rompr/iconsets/Slush-Dark/stopafter.svg new file mode 100644 index 0000000..4a41222 --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/stopafter.svg @@ -0,0 +1,250 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush-Dark/system-search.svg b/www/rompr/iconsets/Slush-Dark/system-search.svg new file mode 100644 index 0000000..6a8e34b --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/system-search.svg @@ -0,0 +1,82 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush-Dark/tag.svg b/www/rompr/iconsets/Slush-Dark/tag.svg new file mode 100644 index 0000000..18de0bd --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/tag.svg @@ -0,0 +1,67 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush-Dark/theme.css b/www/rompr/iconsets/Slush-Dark/theme.css new file mode 100644 index 0000000..273f155 --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/theme.css @@ -0,0 +1,245 @@ + + [class^="icon-"], [class*=" icon-"] { + background-size:contain; + background-position: center; + background-repeat:no-repeat; + display:inline-block; +} + +.button-disabled { opacity: 0.1 } + +.clearbox { + background-image: url('iconsets/Slush-Dark/edit-delete.svg'); + /* dont change the 50%, it ties in with makeHoverWork, makeClearWork, and makeTagMenu */ + background-size: auto 50%; + background-position: right 2px center; + background-repeat: no-repeat; +} + +.combobox-entry, .selectholder { + background-image: url('iconsets/Slush-Dark/blobdown2.svg'); + /* dont change the 50%, it ties in with makeHoverWork, makeClearWork, and makeTagMenu */ + background-size: auto 50%; + background-position: right 2px center; + background-repeat: no-repeat; +} + +.combobox-entry:hover, .selectholder:hover { + background-image: url('iconsets/Slush-Dark/blobdown2-hi.svg'); + /* dont change the 50%, it ties in with makeHoverWork, makeClearWork, and makeTagMenu */ + background-size: auto 50%; + background-position: right 2px center; + background-repeat: no-repeat; +} + +.combo-button { + background-image: url('iconsets/Slush-Dark/blobdown2.svg'); +} + +.icon-play-circled { background-image :url('iconsets/Slush-Dark/media-playback-start.svg') } +.playdiv { background-image :url('iconsets/Slush-Dark/media-playback-start.svg') } +.icon-play-circled:hover { background-image :url('iconsets/Slush-Dark/media-playback-start-highlight.svg') } +.icon-pause-circled { background-image :url('iconsets/Slush-Dark/media-playback-pause.svg') } +.icon-pause-circled:hover { background-image :url('iconsets/Slush-Dark/media-playback-pause-highlight.svg') } +.icon-fast-backward { background-image :url('iconsets/Slush-Dark/media-skip-backward.svg') } +.icon-fast-backward:hover { background-image :url('iconsets/Slush-Dark/media-skip-backward-highlight.svg') } +.icon-fast-forward { background-image :url('iconsets/Slush-Dark/media-skip-forward.svg') } +.icon-fast-forward:hover { background-image :url('iconsets/Slush-Dark/media-skip-forward-highlight.svg') } +.icon-stop-1 { background-image :url('iconsets/Slush-Dark/media-playback-stop.svg') } +.icon-stop-1:hover { background-image :url('iconsets/Slush-Dark/media-playback-stop-highlight.svg') } +.icon-to-end-1 { background-image :url('iconsets/Slush-Dark/stopafter.svg') } +.icon-to-end-1:hover { background-image :url('iconsets/Slush-Dark/stopafter-highlight.svg') } + +.icon-music { background-image: url('iconsets/Slush-Dark/collection.svg') } +.icon-search { background-image: url('iconsets/Slush-Dark/system-search.svg') } +.icon-folder-open-empty { background-image: url('iconsets/Slush-Dark/folder.svg') } +.icon-radio-tower { background-image: url('iconsets/Slush-Dark/broadcast-new.svg') } +.icon-cd { background-image: url('iconsets/Slush-Dark/cd_case.svg') } +.icon-resize-horizontal { background-image: url('iconsets/Slush-Dark/resize.svg') } +.icon-angle-double-left { background-image:url('iconsets/Slush-Dark/arrow-left-double.svg') } +.icon-angle-double-right { background-image:url('iconsets/Slush-Dark/arrow-right-double.svg') } +.icon-menu { background-image: url('iconsets/Slush-Dark/pushbutton.svg') } +.icon-versions { background-image: url('iconsets/Slush-Dark/history.svg') } +.icon-left-circled { background-image: url('iconsets/Slush-Dark/backbutton.svg') } +.icon-right-circled { background-image: url('iconsets/Slush-Dark/forwardbutton.svg') } +.icon-cog-alt { background-image: url('iconsets/Slush-Dark/preferences.svg') } +.icon-trash { background-image: url('iconsets/Slush-Dark/edit-clear-list.svg') } +.icon-wifi { background-image: url('iconsets/Slush-Dark/smartradio.svg') } +.icon-doc-text { background-image: url('iconsets/Slush-Dark/playlist.svg') } +.icon-floppy { background-image: url('iconsets/Slush-Dark/document-save.svg') } +.icon-cancel-circled { background-image: url('iconsets/Slush-Dark/edit-delete.svg') } +.icon-plus { + background-image: url('iconsets/Slush-Dark/add.svg'); + opacity:0.7; +} +.icon-alarm { background-image: url('iconsets/Slush-Dark/alarmclock_false.svg') } +.icon-alarm-on { background-image: url('iconsets/Slush-Dark/alarmclock_true.svg') } +.icon-sleep { background-image: url('iconsets/Slush-Dark/sleep.svg') } +.icon-library { background-image: url('iconsets/Slush-Dark/file.svg') } +.icon-lastfm-1 { background-image: url('iconsets/Slush-Dark/lastfm.svg') } +.icon-wikipedia { background-image: url('iconsets/Slush-Dark/wikipedia-logo.svg') } +.icon-musicbrainz { background-image: url('iconsets/Slush-Dark/musicbrainz_logo.svg') } +.icon-discogs { background-image: url('iconsets/Slush-Dark/discogs-logo.svg') } +.icon-doc-text-1 { background-image: url('iconsets/Slush-Dark/lyrics.svg') } +.icon-soundcloud-circled { background-image: url('iconsets/Slush-Dark/soundcloud-logo.svg') } +.icon-youtube-circled { background-image: url('iconsets/Slush-Dark/youtube-logo.svg') } +.icon-gmusic-circled { background-image: url('iconsets/Slush-Dark/gmusic-logo.svg') } +.icon-spotify-circled { background-image: url('iconsets/Slush-Dark/spotify-logo.svg') } +.icon-vkontakte-circled { background-image: url('iconsets/Slush-Dark/vkontakte-logo.svg') } +.icon-podcast-circled { background-image: url('iconsets/Slush-Dark/podcast-logo.svg') } +.icon-audiobook { background-image: url('iconsets/Slush-Dark/audiobook.svg') } +.icon-internetarchive-circled { background-image: url('iconsets/Slush-Dark/internetarchive-logo.svg') } +.icon-increase { background-image: url('iconsets/Slush-Dark/arrow-increase.svg') } +.icon-decrease { background-image: url('iconsets/Slush-Dark/arrow-decrease.svg') } +.icon-attention-1 { background-image: url('iconsets/Slush-Dark/dialog-error.svg') } +.icon-info-circled { background-image: url('iconsets/Slush-Dark/dialog-information.svg') } +.icon-download { background-image: url('iconsets/Slush-Dark/download-icon.svg') } +.icon-sun { background-image: url('iconsets/Slush-Dark/icon-new.svg') } +.icon-headphones { background-image: url('iconsets/Slush-Dark/headphones.svg') } +.icon-unlistened { background-image: url('iconsets/Slush-Dark/headphones.svg') } +.icon-block { background-image: url('iconsets/Slush-Dark/lastfm-ban.svg') } +.icon-heart { background-image: url('iconsets/Slush-Dark/lastfm-love.svg') } +.icon-heart-broken { background-image: url('iconsets/Slush-Dark/lastfm-unlove.svg') } +.icon-refresh { background-image: url('iconsets/Slush-Dark/refresh.svg') } +.icon-dirble-circled { background-image: url('iconsets/Slush-Dark/dirble-logo.svg') } +.icon-tunein { background-image: url('iconsets/Slush-Dark/../../newimages/tunein-logo.svg') } +.icon-no-response-playbutton { background-image :url('iconsets/Slush-Dark/media-playback-start.svg') } +.icon-tags { background-image: url('iconsets/Slush-Dark/tag.svg') } +.icon-volume-up { background-image: url('iconsets/Slush-Dark/volume.svg') } +.icon-toggle-open { background-image: url('iconsets/Slush-Dark/toggle-open.svg') } +.icon-toggle-closed { background-image: url('iconsets/Slush-Dark/toggle-closed.svg') } +.icon-spin6 { background-image: url('iconsets/Slush-Dark/spinner.svg') } +.icon-output { background-image: url('iconsets/Slush-Dark/output.svg') } +.icon-output-mute { background-image: url('iconsets/Slush-Dark/output_mute.svg') } +.icon-sliders { background-image: url('iconsets/Slush-Dark/sliders.svg') } +.icon-0-stars { background-image: url('iconsets/Slush-Dark/0stars.svg') } +.icon-1-stars { background-image: url('iconsets/Slush-Dark/1stars.svg') } +.icon-2-stars { background-image: url('iconsets/Slush-Dark/2stars.svg') } +.icon-3-stars { background-image: url('iconsets/Slush-Dark/3stars.svg') } +.icon-4-stars { background-image: url('iconsets/Slush-Dark/4stars.svg') } +.icon-5-stars { background-image: url('iconsets/Slush-Dark/5stars.svg') } +.icon-single-star { background-image: url('iconsets/Slush-Dark/singlestar.svg') } +.icon-ratandtag { background-image: url('iconsets/Slush-Dark/ratandtag.svg') } +.icon-ratortag { background-image: url('iconsets/Slush-Dark/ratortag.svg') } +.icon-toggle-on { background-image: url('iconsets/Slush-Dark/togglebutton-new2-on.svg') } +.icon-toggle-off { background-image: url('iconsets/Slush-Dark/togglebutton-new2-off.svg') } + +.icon-random.flow-on { background-image: url('iconsets/Slush-Dark/random.svg') } +.icon-random.flow-off { background-image: url('iconsets/Slush-Dark/random_off.svg') } +.icon-crossfade.flow-on { background-image: url('iconsets/Slush-Dark/crossfade.svg') } +.icon-crossfade.flow-off { background-image: url('iconsets/Slush-Dark/crossfade_off.svg') } +.icon-repeat.flow-on { background-image: url('iconsets/Slush-Dark/refresh.svg') } +.icon-repeat.flow-off { background-image: url('iconsets/Slush-Dark/refresh_off.svg') } +.icon-consume.flow-on { background-image: url('iconsets/Slush-Dark/consume.svg') } +.icon-consume.flow-off { background-image: url('iconsets/Slush-Dark/consume_off.svg') } + +.icon-allrandom { background-image: url('iconsets/Slush-Dark/shuffle.svg') } +.icon-neverplayed { background-image: url('iconsets/Slush-Dark/neverheard.svg') } +.icon-recentlyplayed { background-image: url('iconsets/Slush-Dark/calendar.svg') } +.icon-artist { background-image: url('iconsets/Slush-Dark/artist-icon.svg') } +.icon-mp3-audio { background-image: url('iconsets/Slush-Dark/mp3-audio.svg') } +.icon-aac-audio { background-image: url('iconsets/Slush-Dark/aac-audio.svg') } +.icon-flac-audio { background-image: url('iconsets/Slush-Dark/flac-audio.svg') } +.icon-wma-audio { background-image: url('iconsets/Slush-Dark/wma-audio.svg') } +.icon-ogg-audio { background-image: url('iconsets/Slush-Dark/ogg-audio.svg') } +.icon-explicit { background-image: url('iconsets/Slush-Dark/parental-advisory.svg') } +.icon-expand-up { background-image: url('iconsets/Slush-Dark/expand-up.svg') } +.icon-rss { background-image: url('iconsets/Slush-Dark/rss.svg') } +.icon-tick { background-image: url('iconsets/Slush-Dark/tick.svg') } +.icon-video { background-image: url('iconsets/Slush-Dark/movie-1.svg') } +.icon-bbc-logo { background-image: url('iconsets/Slush-Dark/bbc-logo.svg') } +.icon-imdb-logo { background-image: url('iconsets/Slush-Dark/imdb-logo.svg') } +.icon-facebook-logo { background-image: url('iconsets/Slush-Dark/facebook-logo.svg') } +.icon-twitter-logo { background-image: url('iconsets/Slush-Dark/twitter-logo.svg') } +.icon-www { background-image: url('iconsets/Slush-Dark/world-wide-web.svg') } +.icon-allmusic { background-image: url('iconsets/Slush-Dark/allmusic-logo.svg') } +.icon-updown { background-image: url('iconsets/Slush-Dark/arrow-updown.svg') } +.icon-snapcast { background-image: url('iconsets/Slush-Dark/../../newimages/snapcast.png') } + +.styledinputs label +{ + display:inline-block; + cursor:pointer; + position:relative; + padding-left:2.5em; + line-height:1.5em; +} + +.styledinputs input[type=radio] +{ + display:none; +} + +.styledinputs input[type=checkbox] +{ + display:none; +} + +.styledinputs label:before +{ + content:""; + display:inline-block; + width:2em; + height:1.5em; + position:absolute; + left:0; + /* bottom:0.2em; */ + background-image: url('iconsets/Slush-Dark/togglebutton-new2-off.svg'); + background-size:auto 80%; + background-position: center; + background-repeat:no-repeat; +} + +.styledinputs input:checked + label:before +{ + background-image: url('iconsets/Slush-Dark/togglebutton-new2-on.svg') !important; +} + +img.notexist,img.notfound +{ + background-image: url('iconsets/Slush-Dark/compact-disc.svg'); + background-size:contain; + display:inline-block; + background-position:center; + background-repeat: no-repeat; +} + +img.stream.notfound, img.stream.notexist +{ + background-image: url('iconsets/Slush-Dark/broadcast-new.svg'); +} + +img.plimage.notfound +{ + background-image: url('iconsets/Slush-Dark/playlist.svg'); +} + +.backmenu +{ + background-image: url('iconsets/Slush-Dark/arrow-left-double.svg'); + background-repeat: no-repeat; + background-size: contain; +} + +button.iconbutton { + height:2em; + width:2em; + background-size: contain; + background-position:center; + border: none !important; + opacity: 0.8; + background-color:transparent; +} + +button.iconbutton:hover { + opacity: 1; +} + +button.searchbutton { + background-image: url('iconsets/Slush-Dark/system-search.svg'); +} + +button.rssbutton { + background-image: url('iconsets/Slush-Dark/rss.svg'); +} + diff --git a/www/rompr/iconsets/Slush-Dark/tick.svg b/www/rompr/iconsets/Slush-Dark/tick.svg new file mode 100644 index 0000000..dcc29c9 --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/tick.svg @@ -0,0 +1,191 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush-Dark/toggle-closed.svg b/www/rompr/iconsets/Slush-Dark/toggle-closed.svg new file mode 100644 index 0000000..5729102 --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/toggle-closed.svg @@ -0,0 +1,67 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush-Dark/toggle-open.svg b/www/rompr/iconsets/Slush-Dark/toggle-open.svg new file mode 100644 index 0000000..16d7939 --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/toggle-open.svg @@ -0,0 +1,67 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush-Dark/togglebutton-new2-off.svg b/www/rompr/iconsets/Slush-Dark/togglebutton-new2-off.svg new file mode 100644 index 0000000..ee31dbb --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/togglebutton-new2-off.svg @@ -0,0 +1,153 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush-Dark/togglebutton-new2-on.svg b/www/rompr/iconsets/Slush-Dark/togglebutton-new2-on.svg new file mode 100644 index 0000000..df9d896 --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/togglebutton-new2-on.svg @@ -0,0 +1,171 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush-Dark/twitter-logo.svg b/www/rompr/iconsets/Slush-Dark/twitter-logo.svg new file mode 100644 index 0000000..7b9a2ae --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/twitter-logo.svg @@ -0,0 +1,157 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush-Dark/unlistened.svg b/www/rompr/iconsets/Slush-Dark/unlistened.svg new file mode 100644 index 0000000..59d046d --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/unlistened.svg @@ -0,0 +1,68 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush-Dark/vkontakte-logo.svg b/www/rompr/iconsets/Slush-Dark/vkontakte-logo.svg new file mode 100644 index 0000000..4e6013f --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/vkontakte-logo.svg @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + diff --git a/www/rompr/iconsets/Slush-Dark/volume.svg b/www/rompr/iconsets/Slush-Dark/volume.svg new file mode 100644 index 0000000..134f2cd --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/volume.svg @@ -0,0 +1,79 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush-Dark/wikipedia-logo.svg b/www/rompr/iconsets/Slush-Dark/wikipedia-logo.svg new file mode 100644 index 0000000..db00cd2 --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/wikipedia-logo.svg @@ -0,0 +1,67 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush-Dark/wma-audio.svg b/www/rompr/iconsets/Slush-Dark/wma-audio.svg new file mode 100644 index 0000000..5516307 --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/wma-audio.svg @@ -0,0 +1,120 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush-Dark/world-wide-web.svg b/www/rompr/iconsets/Slush-Dark/world-wide-web.svg new file mode 100644 index 0000000..53e4156 --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/world-wide-web.svg @@ -0,0 +1,80 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush-Dark/youtube-logo.svg b/www/rompr/iconsets/Slush-Dark/youtube-logo.svg new file mode 100644 index 0000000..43419c2 --- /dev/null +++ b/www/rompr/iconsets/Slush-Dark/youtube-logo.svg @@ -0,0 +1,66 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush/0stars.svg b/www/rompr/iconsets/Slush/0stars.svg new file mode 100644 index 0000000..da2e9a8 --- /dev/null +++ b/www/rompr/iconsets/Slush/0stars.svg @@ -0,0 +1,82 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush/1stars.svg b/www/rompr/iconsets/Slush/1stars.svg new file mode 100644 index 0000000..fbd4c53 --- /dev/null +++ b/www/rompr/iconsets/Slush/1stars.svg @@ -0,0 +1,107 @@ + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush/2stars.svg b/www/rompr/iconsets/Slush/2stars.svg new file mode 100644 index 0000000..4285788 --- /dev/null +++ b/www/rompr/iconsets/Slush/2stars.svg @@ -0,0 +1,118 @@ + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush/3stars.svg b/www/rompr/iconsets/Slush/3stars.svg new file mode 100644 index 0000000..a07a421 --- /dev/null +++ b/www/rompr/iconsets/Slush/3stars.svg @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush/4stars.svg b/www/rompr/iconsets/Slush/4stars.svg new file mode 100644 index 0000000..ef77309 --- /dev/null +++ b/www/rompr/iconsets/Slush/4stars.svg @@ -0,0 +1,140 @@ + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush/5stars.svg b/www/rompr/iconsets/Slush/5stars.svg new file mode 100644 index 0000000..6726911 --- /dev/null +++ b/www/rompr/iconsets/Slush/5stars.svg @@ -0,0 +1,151 @@ + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush/aac-audio.svg b/www/rompr/iconsets/Slush/aac-audio.svg new file mode 100644 index 0000000..7e3dc0b --- /dev/null +++ b/www/rompr/iconsets/Slush/aac-audio.svg @@ -0,0 +1,390 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush/add.svg b/www/rompr/iconsets/Slush/add.svg new file mode 100644 index 0000000..3319713 --- /dev/null +++ b/www/rompr/iconsets/Slush/add.svg @@ -0,0 +1,175 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + diff --git a/www/rompr/iconsets/Slush/adjustments.css b/www/rompr/iconsets/Slush/adjustments.css new file mode 100644 index 0000000..003e866 --- /dev/null +++ b/www/rompr/iconsets/Slush/adjustments.css @@ -0,0 +1,230 @@ +#buttons +{ + padding-left:12px; + padding-right:12px; + padding-top:4px; + padding-bottom:6px; +} + +.controlbutton +{ + margin:0px; + padding:0px; + vertical-align:middle; + display:inline-block; + width:56px; + height:56px; +} + +.controlbutton-small +{ + margin:0px; + vertical-align:middle; + display:inline-block; + width:48px; + height:48px; +} + +@media screen and (min-height: 800px) and (max-height: 939px) { + .controlbutton { + width:64px; + height:64px; + } + #buttons { + padding-top:12px; + } + #playbackTime { + margin-top:2px; + font-size:12px; + line-height:14px; + height:14px; + } +} + +@media screen and (min-height: 940px) and (max-height: 1099px) and (min-width: 650px) { + .controlbutton { + width:84px; + height:84px; + } + + .controlbutton-small { + width:64px; + height:64px; + } + + .shiftleft + { + left:-12px; + position:relative; + z-index:250; + } + + .shiftleft2 + { + left:-26px; + position:relative; + } + + .shiftleft3 + { + position:relative; + left:-36px; + z-index:5; + } + + .shiftleft4 + { + position:relative; + left:-48px; + z-index:1; + margin-right:-36px; + } + +} + +@media screen and (min-height: 940px) and (max-height: 1099px) and (min-width: 650px) { + .controlbutton { + width:84px; + height:84px; + } + .controlbutton-small { + width:64px; + height:64px; + } + #buttons { + padding-top:16px; + padding-left:24px; + } + #playbackTime { + margin-top:4px; + font-size:14px; + line-height:16px; + height:16px; + } + .shiftleft + { + left:-12px; + position:relative; + z-index:250; + } + + .shiftleft2 + { + left:-26px; + position:relative; + } + + .shiftleft3 + { + position:relative; + left:-36px; + z-index:5; + } + + .shiftleft4 + { + position:relative; + left:-48px; + z-index:1; + margin-right:-36px; + } +} + +@media screen and (min-height: 1100px) and (min-width: 651px) and (max-width: 749px) { + .controlbutton { + width:84px; + height:84px; + } + .controlbutton-small { + width:64px; + height:64px; + } + #buttons { + padding-top:16px; + padding-left:24px; + } + #playbackTime { + margin-top:4px; + font-size:14px; + line-height:16px; + height:16px; + } + .shiftleft + { + left:-12px; + position:relative; + z-index:250; + } + + .shiftleft2 + { + left:-26px; + position:relative; + } + + .shiftleft3 + { + position:relative; + left:-36px; + z-index:5; + } + + .shiftleft4 + { + position:relative; + left:-48px; + z-index:1; + margin-right:-36px; + } +} + +@media screen and (min-height: 1100px) and (min-width: 720px) { + .controlbutton { + width:90px; + height:90px; + } + .controlbutton-small { + width:70px; + height:70px; + } + #buttons { + padding-top:12px; + padding-left:20px; + } + #progress { + margin-top:8px; + } + #playbackTime { + margin-top:12px; + font-size:16px; + line-height:18px; + height:18px; + } + .shiftleft + { + left:-10px; + position:relative; + z-index:250; + } + + .shiftleft2 + { + left:-22px; + position:relative; + } + + .shiftleft3 + { + position:relative; + left:-34px; + z-index:5; + } + + .shiftleft4 + { + position:relative; + left:-44px; + z-index:1; + margin-right:-36px; + } +} diff --git a/www/rompr/iconsets/Slush/alarmclock_false.svg b/www/rompr/iconsets/Slush/alarmclock_false.svg new file mode 100644 index 0000000..90a0ea2 --- /dev/null +++ b/www/rompr/iconsets/Slush/alarmclock_false.svg @@ -0,0 +1,67 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush/alarmclock_true.svg b/www/rompr/iconsets/Slush/alarmclock_true.svg new file mode 100644 index 0000000..c80ef68 --- /dev/null +++ b/www/rompr/iconsets/Slush/alarmclock_true.svg @@ -0,0 +1,67 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush/allmusic-logo.svg b/www/rompr/iconsets/Slush/allmusic-logo.svg new file mode 100644 index 0000000..b2d3d1a --- /dev/null +++ b/www/rompr/iconsets/Slush/allmusic-logo.svg @@ -0,0 +1,147 @@ + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush/arrow-decrease.svg b/www/rompr/iconsets/Slush/arrow-decrease.svg new file mode 100644 index 0000000..1240297 --- /dev/null +++ b/www/rompr/iconsets/Slush/arrow-decrease.svg @@ -0,0 +1,68 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush/arrow-increase.svg b/www/rompr/iconsets/Slush/arrow-increase.svg new file mode 100644 index 0000000..10e73f7 --- /dev/null +++ b/www/rompr/iconsets/Slush/arrow-increase.svg @@ -0,0 +1,68 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush/arrow-left-double.svg b/www/rompr/iconsets/Slush/arrow-left-double.svg new file mode 100644 index 0000000..a3ac514 --- /dev/null +++ b/www/rompr/iconsets/Slush/arrow-left-double.svg @@ -0,0 +1,72 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush/arrow-right-double.svg b/www/rompr/iconsets/Slush/arrow-right-double.svg new file mode 100644 index 0000000..a05bfc6 --- /dev/null +++ b/www/rompr/iconsets/Slush/arrow-right-double.svg @@ -0,0 +1,93 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush/arrow-updown.svg b/www/rompr/iconsets/Slush/arrow-updown.svg new file mode 100644 index 0000000..de788f3 --- /dev/null +++ b/www/rompr/iconsets/Slush/arrow-updown.svg @@ -0,0 +1,121 @@ + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/www/rompr/iconsets/Slush/artist-icon.svg b/www/rompr/iconsets/Slush/artist-icon.svg new file mode 100644 index 0000000..34db58f --- /dev/null +++ b/www/rompr/iconsets/Slush/artist-icon.svg @@ -0,0 +1,151 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush/audiobook.svg b/www/rompr/iconsets/Slush/audiobook.svg new file mode 100644 index 0000000..9ad2a30 --- /dev/null +++ b/www/rompr/iconsets/Slush/audiobook.svg @@ -0,0 +1,96 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush/backbutton.svg b/www/rompr/iconsets/Slush/backbutton.svg new file mode 100644 index 0000000..824fd2f --- /dev/null +++ b/www/rompr/iconsets/Slush/backbutton.svg @@ -0,0 +1,66 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush/bbc-logo.svg b/www/rompr/iconsets/Slush/bbc-logo.svg new file mode 100644 index 0000000..f29a616 --- /dev/null +++ b/www/rompr/iconsets/Slush/bbc-logo.svg @@ -0,0 +1,185 @@ + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush/blobdown2-hi.svg b/www/rompr/iconsets/Slush/blobdown2-hi.svg new file mode 100644 index 0000000..c17249a --- /dev/null +++ b/www/rompr/iconsets/Slush/blobdown2-hi.svg @@ -0,0 +1,141 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush/blobdown2.svg b/www/rompr/iconsets/Slush/blobdown2.svg new file mode 100644 index 0000000..5368908 --- /dev/null +++ b/www/rompr/iconsets/Slush/blobdown2.svg @@ -0,0 +1,131 @@ + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush/broadcast-new.svg b/www/rompr/iconsets/Slush/broadcast-new.svg new file mode 100644 index 0000000..386cfe6 --- /dev/null +++ b/www/rompr/iconsets/Slush/broadcast-new.svg @@ -0,0 +1,67 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush/calendar.svg b/www/rompr/iconsets/Slush/calendar.svg new file mode 100644 index 0000000..5b24466 --- /dev/null +++ b/www/rompr/iconsets/Slush/calendar.svg @@ -0,0 +1,138 @@ + + + + Svg Vector Icons : http://www.onlinewebfonts.com/icon image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush/cd_case.svg b/www/rompr/iconsets/Slush/cd_case.svg new file mode 100644 index 0000000..f321be5 --- /dev/null +++ b/www/rompr/iconsets/Slush/cd_case.svg @@ -0,0 +1,68 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush/collection.svg b/www/rompr/iconsets/Slush/collection.svg new file mode 100644 index 0000000..955d62e --- /dev/null +++ b/www/rompr/iconsets/Slush/collection.svg @@ -0,0 +1,161 @@ + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush/compact-disc.svg b/www/rompr/iconsets/Slush/compact-disc.svg new file mode 100644 index 0000000..0e9570d --- /dev/null +++ b/www/rompr/iconsets/Slush/compact-disc.svg @@ -0,0 +1,84 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush/consume.svg b/www/rompr/iconsets/Slush/consume.svg new file mode 100644 index 0000000..837f5da --- /dev/null +++ b/www/rompr/iconsets/Slush/consume.svg @@ -0,0 +1,85 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/www/rompr/iconsets/Slush/consume_off.svg b/www/rompr/iconsets/Slush/consume_off.svg new file mode 100644 index 0000000..b0e53ea --- /dev/null +++ b/www/rompr/iconsets/Slush/consume_off.svg @@ -0,0 +1,85 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/www/rompr/iconsets/Slush/crossfade.svg b/www/rompr/iconsets/Slush/crossfade.svg new file mode 100644 index 0000000..674da75 --- /dev/null +++ b/www/rompr/iconsets/Slush/crossfade.svg @@ -0,0 +1,119 @@ + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + diff --git a/www/rompr/iconsets/Slush/crossfade_off.svg b/www/rompr/iconsets/Slush/crossfade_off.svg new file mode 100644 index 0000000..2c2c55d --- /dev/null +++ b/www/rompr/iconsets/Slush/crossfade_off.svg @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + diff --git a/www/rompr/iconsets/Slush/dialog-error.svg b/www/rompr/iconsets/Slush/dialog-error.svg new file mode 100644 index 0000000..9e7d3ab --- /dev/null +++ b/www/rompr/iconsets/Slush/dialog-error.svg @@ -0,0 +1,68 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush/dialog-information.svg b/www/rompr/iconsets/Slush/dialog-information.svg new file mode 100644 index 0000000..f8d6b7e --- /dev/null +++ b/www/rompr/iconsets/Slush/dialog-information.svg @@ -0,0 +1,74 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush/dirble-logo.svg b/www/rompr/iconsets/Slush/dirble-logo.svg new file mode 100644 index 0000000..1e98e40 --- /dev/null +++ b/www/rompr/iconsets/Slush/dirble-logo.svg @@ -0,0 +1,229 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush/discogs-logo.svg b/www/rompr/iconsets/Slush/discogs-logo.svg new file mode 100644 index 0000000..394d971 --- /dev/null +++ b/www/rompr/iconsets/Slush/discogs-logo.svg @@ -0,0 +1,528 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush/document-save.svg b/www/rompr/iconsets/Slush/document-save.svg new file mode 100644 index 0000000..695eed9 --- /dev/null +++ b/www/rompr/iconsets/Slush/document-save.svg @@ -0,0 +1,68 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush/download-icon.svg b/www/rompr/iconsets/Slush/download-icon.svg new file mode 100644 index 0000000..2e6d5f0 --- /dev/null +++ b/www/rompr/iconsets/Slush/download-icon.svg @@ -0,0 +1,72 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush/edit-clear-list.svg b/www/rompr/iconsets/Slush/edit-clear-list.svg new file mode 100644 index 0000000..1b3ffd0 --- /dev/null +++ b/www/rompr/iconsets/Slush/edit-clear-list.svg @@ -0,0 +1,67 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush/edit-delete.svg b/www/rompr/iconsets/Slush/edit-delete.svg new file mode 100644 index 0000000..c6dd580 --- /dev/null +++ b/www/rompr/iconsets/Slush/edit-delete.svg @@ -0,0 +1,67 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush/expand-up.svg b/www/rompr/iconsets/Slush/expand-up.svg new file mode 100644 index 0000000..a8b963c --- /dev/null +++ b/www/rompr/iconsets/Slush/expand-up.svg @@ -0,0 +1,138 @@ + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush/facebook-logo.svg b/www/rompr/iconsets/Slush/facebook-logo.svg new file mode 100644 index 0000000..5746544 --- /dev/null +++ b/www/rompr/iconsets/Slush/facebook-logo.svg @@ -0,0 +1,140 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush/file.svg b/www/rompr/iconsets/Slush/file.svg new file mode 100644 index 0000000..d621256 --- /dev/null +++ b/www/rompr/iconsets/Slush/file.svg @@ -0,0 +1,68 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush/flac-audio.svg b/www/rompr/iconsets/Slush/flac-audio.svg new file mode 100644 index 0000000..f329774 --- /dev/null +++ b/www/rompr/iconsets/Slush/flac-audio.svg @@ -0,0 +1,127 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush/folder.svg b/www/rompr/iconsets/Slush/folder.svg new file mode 100644 index 0000000..ca6f8a8 --- /dev/null +++ b/www/rompr/iconsets/Slush/folder.svg @@ -0,0 +1,72 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush/forwardbutton.svg b/www/rompr/iconsets/Slush/forwardbutton.svg new file mode 100644 index 0000000..b2c0c30 --- /dev/null +++ b/www/rompr/iconsets/Slush/forwardbutton.svg @@ -0,0 +1,66 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush/gmusic-logo.svg b/www/rompr/iconsets/Slush/gmusic-logo.svg new file mode 100644 index 0000000..90854b8 --- /dev/null +++ b/www/rompr/iconsets/Slush/gmusic-logo.svg @@ -0,0 +1,65 @@ + + Svg Vector Icons : http://www.onlinewebfonts.com/icon image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush/headphones.svg b/www/rompr/iconsets/Slush/headphones.svg new file mode 100644 index 0000000..8b83977 --- /dev/null +++ b/www/rompr/iconsets/Slush/headphones.svg @@ -0,0 +1,73 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush/icon-new.svg b/www/rompr/iconsets/Slush/icon-new.svg new file mode 100644 index 0000000..07bec16 --- /dev/null +++ b/www/rompr/iconsets/Slush/icon-new.svg @@ -0,0 +1,72 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush/imdb-logo.svg b/www/rompr/iconsets/Slush/imdb-logo.svg new file mode 100644 index 0000000..0ddd340 --- /dev/null +++ b/www/rompr/iconsets/Slush/imdb-logo.svg @@ -0,0 +1,497 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush/internetarchive-logo.svg b/www/rompr/iconsets/Slush/internetarchive-logo.svg new file mode 100644 index 0000000..6a461cf --- /dev/null +++ b/www/rompr/iconsets/Slush/internetarchive-logo.svg @@ -0,0 +1,145 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush/lastfm-ban.svg b/www/rompr/iconsets/Slush/lastfm-ban.svg new file mode 100644 index 0000000..3b4824a --- /dev/null +++ b/www/rompr/iconsets/Slush/lastfm-ban.svg @@ -0,0 +1,67 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush/lastfm-love.svg b/www/rompr/iconsets/Slush/lastfm-love.svg new file mode 100644 index 0000000..8f28c61 --- /dev/null +++ b/www/rompr/iconsets/Slush/lastfm-love.svg @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/www/rompr/iconsets/Slush/lastfm-unlove.svg b/www/rompr/iconsets/Slush/lastfm-unlove.svg new file mode 100644 index 0000000..d192a1e --- /dev/null +++ b/www/rompr/iconsets/Slush/lastfm-unlove.svg @@ -0,0 +1,67 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush/lastfm.svg b/www/rompr/iconsets/Slush/lastfm.svg new file mode 100644 index 0000000..0caa371 --- /dev/null +++ b/www/rompr/iconsets/Slush/lastfm.svg @@ -0,0 +1,67 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush/lyrics.svg b/www/rompr/iconsets/Slush/lyrics.svg new file mode 100644 index 0000000..27acaf5 --- /dev/null +++ b/www/rompr/iconsets/Slush/lyrics.svg @@ -0,0 +1,67 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush/media-playback-pause-highlight.svg b/www/rompr/iconsets/Slush/media-playback-pause-highlight.svg new file mode 100644 index 0000000..9b63d82 --- /dev/null +++ b/www/rompr/iconsets/Slush/media-playback-pause-highlight.svg @@ -0,0 +1,103 @@ + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush/media-playback-pause.svg b/www/rompr/iconsets/Slush/media-playback-pause.svg new file mode 100644 index 0000000..77084c8 --- /dev/null +++ b/www/rompr/iconsets/Slush/media-playback-pause.svg @@ -0,0 +1,135 @@ + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush/media-playback-start-highlight.svg b/www/rompr/iconsets/Slush/media-playback-start-highlight.svg new file mode 100644 index 0000000..fc8934f --- /dev/null +++ b/www/rompr/iconsets/Slush/media-playback-start-highlight.svg @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + diff --git a/www/rompr/iconsets/Slush/media-playback-start.svg b/www/rompr/iconsets/Slush/media-playback-start.svg new file mode 100644 index 0000000..4c6fd93 --- /dev/null +++ b/www/rompr/iconsets/Slush/media-playback-start.svg @@ -0,0 +1,220 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + diff --git a/www/rompr/iconsets/Slush/media-playback-stop-highlight.svg b/www/rompr/iconsets/Slush/media-playback-stop-highlight.svg new file mode 100644 index 0000000..b185410 --- /dev/null +++ b/www/rompr/iconsets/Slush/media-playback-stop-highlight.svg @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + diff --git a/www/rompr/iconsets/Slush/media-playback-stop.svg b/www/rompr/iconsets/Slush/media-playback-stop.svg new file mode 100644 index 0000000..f444865 --- /dev/null +++ b/www/rompr/iconsets/Slush/media-playback-stop.svg @@ -0,0 +1,220 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + diff --git a/www/rompr/iconsets/Slush/media-skip-backward-highlight.svg b/www/rompr/iconsets/Slush/media-skip-backward-highlight.svg new file mode 100644 index 0000000..bf2dbfe --- /dev/null +++ b/www/rompr/iconsets/Slush/media-skip-backward-highlight.svg @@ -0,0 +1,130 @@ + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush/media-skip-backward.svg b/www/rompr/iconsets/Slush/media-skip-backward.svg new file mode 100644 index 0000000..fdcf6ed --- /dev/null +++ b/www/rompr/iconsets/Slush/media-skip-backward.svg @@ -0,0 +1,249 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush/media-skip-forward-highlight.svg b/www/rompr/iconsets/Slush/media-skip-forward-highlight.svg new file mode 100644 index 0000000..b74b966 --- /dev/null +++ b/www/rompr/iconsets/Slush/media-skip-forward-highlight.svg @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush/media-skip-forward.svg b/www/rompr/iconsets/Slush/media-skip-forward.svg new file mode 100644 index 0000000..0f7c33d --- /dev/null +++ b/www/rompr/iconsets/Slush/media-skip-forward.svg @@ -0,0 +1,249 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush/movie-1.svg b/www/rompr/iconsets/Slush/movie-1.svg new file mode 100644 index 0000000..fae9ecd --- /dev/null +++ b/www/rompr/iconsets/Slush/movie-1.svg @@ -0,0 +1,67 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush/mp3-audio.svg b/www/rompr/iconsets/Slush/mp3-audio.svg new file mode 100644 index 0000000..40311b9 --- /dev/null +++ b/www/rompr/iconsets/Slush/mp3-audio.svg @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + diff --git a/www/rompr/iconsets/Slush/musicbrainz_logo.svg b/www/rompr/iconsets/Slush/musicbrainz_logo.svg new file mode 100644 index 0000000..952bb25 --- /dev/null +++ b/www/rompr/iconsets/Slush/musicbrainz_logo.svg @@ -0,0 +1,599 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush/neverheard.svg b/www/rompr/iconsets/Slush/neverheard.svg new file mode 100644 index 0000000..68e9e76 --- /dev/null +++ b/www/rompr/iconsets/Slush/neverheard.svg @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush/ogg-audio.svg b/www/rompr/iconsets/Slush/ogg-audio.svg new file mode 100644 index 0000000..5332281 --- /dev/null +++ b/www/rompr/iconsets/Slush/ogg-audio.svg @@ -0,0 +1,119 @@ + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush/output.svg b/www/rompr/iconsets/Slush/output.svg new file mode 100644 index 0000000..4a088e8 --- /dev/null +++ b/www/rompr/iconsets/Slush/output.svg @@ -0,0 +1,63 @@ + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush/output_mute.svg b/www/rompr/iconsets/Slush/output_mute.svg new file mode 100644 index 0000000..1508b46 --- /dev/null +++ b/www/rompr/iconsets/Slush/output_mute.svg @@ -0,0 +1,63 @@ + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush/parental-advisory.svg b/www/rompr/iconsets/Slush/parental-advisory.svg new file mode 100644 index 0000000..ad4b0a7 --- /dev/null +++ b/www/rompr/iconsets/Slush/parental-advisory.svg @@ -0,0 +1,106 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush/playlist.svg b/www/rompr/iconsets/Slush/playlist.svg new file mode 100644 index 0000000..c625bc2 --- /dev/null +++ b/www/rompr/iconsets/Slush/playlist.svg @@ -0,0 +1,99 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush/podcast-logo.svg b/www/rompr/iconsets/Slush/podcast-logo.svg new file mode 100644 index 0000000..8cda8c7 --- /dev/null +++ b/www/rompr/iconsets/Slush/podcast-logo.svg @@ -0,0 +1,66 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush/preferences.svg b/www/rompr/iconsets/Slush/preferences.svg new file mode 100644 index 0000000..20848db --- /dev/null +++ b/www/rompr/iconsets/Slush/preferences.svg @@ -0,0 +1,75 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush/pushbutton.svg b/www/rompr/iconsets/Slush/pushbutton.svg new file mode 100644 index 0000000..570a571 --- /dev/null +++ b/www/rompr/iconsets/Slush/pushbutton.svg @@ -0,0 +1,75 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush/random.svg b/www/rompr/iconsets/Slush/random.svg new file mode 100644 index 0000000..0374b77 --- /dev/null +++ b/www/rompr/iconsets/Slush/random.svg @@ -0,0 +1,151 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush/random_off.svg b/www/rompr/iconsets/Slush/random_off.svg new file mode 100644 index 0000000..1e7661d --- /dev/null +++ b/www/rompr/iconsets/Slush/random_off.svg @@ -0,0 +1,141 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush/ratandtag.svg b/www/rompr/iconsets/Slush/ratandtag.svg new file mode 100644 index 0000000..748dd8f --- /dev/null +++ b/www/rompr/iconsets/Slush/ratandtag.svg @@ -0,0 +1,121 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush/ratortag.svg b/www/rompr/iconsets/Slush/ratortag.svg new file mode 100644 index 0000000..c03a846 --- /dev/null +++ b/www/rompr/iconsets/Slush/ratortag.svg @@ -0,0 +1,125 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush/refresh.svg b/www/rompr/iconsets/Slush/refresh.svg new file mode 100644 index 0000000..711745f --- /dev/null +++ b/www/rompr/iconsets/Slush/refresh.svg @@ -0,0 +1,72 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush/refresh_off.svg b/www/rompr/iconsets/Slush/refresh_off.svg new file mode 100644 index 0000000..7f3d2da --- /dev/null +++ b/www/rompr/iconsets/Slush/refresh_off.svg @@ -0,0 +1,79 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush/resize.svg b/www/rompr/iconsets/Slush/resize.svg new file mode 100644 index 0000000..f9888e9 --- /dev/null +++ b/www/rompr/iconsets/Slush/resize.svg @@ -0,0 +1,67 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush/rss.svg b/www/rompr/iconsets/Slush/rss.svg new file mode 100644 index 0000000..eca4029 --- /dev/null +++ b/www/rompr/iconsets/Slush/rss.svg @@ -0,0 +1,169 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush/shuffle.svg b/www/rompr/iconsets/Slush/shuffle.svg new file mode 100644 index 0000000..667d613 --- /dev/null +++ b/www/rompr/iconsets/Slush/shuffle.svg @@ -0,0 +1,141 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush/singlestar.svg b/www/rompr/iconsets/Slush/singlestar.svg new file mode 100644 index 0000000..a9850cc --- /dev/null +++ b/www/rompr/iconsets/Slush/singlestar.svg @@ -0,0 +1,98 @@ + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + diff --git a/www/rompr/iconsets/Slush/sleep.svg b/www/rompr/iconsets/Slush/sleep.svg new file mode 100644 index 0000000..714fc3d --- /dev/null +++ b/www/rompr/iconsets/Slush/sleep.svg @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush/sliders.svg b/www/rompr/iconsets/Slush/sliders.svg new file mode 100644 index 0000000..f4be3e4 --- /dev/null +++ b/www/rompr/iconsets/Slush/sliders.svg @@ -0,0 +1,116 @@ + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush/smartradio.svg b/www/rompr/iconsets/Slush/smartradio.svg new file mode 100644 index 0000000..3effb33 --- /dev/null +++ b/www/rompr/iconsets/Slush/smartradio.svg @@ -0,0 +1,67 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush/soundcloud-logo.svg b/www/rompr/iconsets/Slush/soundcloud-logo.svg new file mode 100644 index 0000000..adf72c0 --- /dev/null +++ b/www/rompr/iconsets/Slush/soundcloud-logo.svg @@ -0,0 +1,73 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush/spinner.svg b/www/rompr/iconsets/Slush/spinner.svg new file mode 100644 index 0000000..1fe7181 --- /dev/null +++ b/www/rompr/iconsets/Slush/spinner.svg @@ -0,0 +1,67 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush/spotify-logo.svg b/www/rompr/iconsets/Slush/spotify-logo.svg new file mode 100644 index 0000000..328ad91 --- /dev/null +++ b/www/rompr/iconsets/Slush/spotify-logo.svg @@ -0,0 +1,67 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush/stopafter-highlight.svg b/www/rompr/iconsets/Slush/stopafter-highlight.svg new file mode 100644 index 0000000..f8a0299 --- /dev/null +++ b/www/rompr/iconsets/Slush/stopafter-highlight.svg @@ -0,0 +1,150 @@ + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush/stopafter.svg b/www/rompr/iconsets/Slush/stopafter.svg new file mode 100644 index 0000000..a7d590e --- /dev/null +++ b/www/rompr/iconsets/Slush/stopafter.svg @@ -0,0 +1,250 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush/system-search.svg b/www/rompr/iconsets/Slush/system-search.svg new file mode 100644 index 0000000..85878cc --- /dev/null +++ b/www/rompr/iconsets/Slush/system-search.svg @@ -0,0 +1,82 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush/tag.svg b/www/rompr/iconsets/Slush/tag.svg new file mode 100644 index 0000000..ab2cc1e --- /dev/null +++ b/www/rompr/iconsets/Slush/tag.svg @@ -0,0 +1,67 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush/theme.css b/www/rompr/iconsets/Slush/theme.css new file mode 100644 index 0000000..d635a0a --- /dev/null +++ b/www/rompr/iconsets/Slush/theme.css @@ -0,0 +1,245 @@ + + [class^="icon-"], [class*=" icon-"] { + background-size:contain; + background-position: center; + background-repeat:no-repeat; + display:inline-block; +} + +.button-disabled { opacity: 0.1 } + +.clearbox { + background-image: url('iconsets/Slush/edit-delete.svg'); + /* dont change the 50%, it ties in with makeHoverWork, makeClearWork, and makeTagMenu */ + background-size: auto 50%; + background-position: right 2px center; + background-repeat: no-repeat; +} + +.combobox-entry, .selectholder { + background-image: url('iconsets/Slush/blobdown2.svg'); + /* dont change the 50%, it ties in with makeHoverWork, makeClearWork, and makeTagMenu */ + background-size: auto 50%; + background-position: right 2px center; + background-repeat: no-repeat; +} + +.combobox-entry:hover, .selectholder:hover { + background-image: url('iconsets/Slush/blobdown2-hi.svg'); + /* dont change the 50%, it ties in with makeHoverWork, makeClearWork, and makeTagMenu */ + background-size: auto 50%; + background-position: right 2px center; + background-repeat: no-repeat; +} + +.combo-button { + background-image: url('iconsets/Slush/blobdown2.svg'); +} + +.icon-play-circled { background-image :url('iconsets/Slush/media-playback-start.svg') } +.playdiv { background-image :url('iconsets/Slush/media-playback-start.svg') } +.icon-play-circled:hover { background-image :url('iconsets/Slush/media-playback-start-highlight.svg') } +.icon-pause-circled { background-image :url('iconsets/Slush/media-playback-pause.svg') } +.icon-pause-circled:hover { background-image :url('iconsets/Slush/media-playback-pause-highlight.svg') } +.icon-fast-backward { background-image :url('iconsets/Slush/media-skip-backward.svg') } +.icon-fast-backward:hover { background-image :url('iconsets/Slush/media-skip-backward-highlight.svg') } +.icon-fast-forward { background-image :url('iconsets/Slush/media-skip-forward.svg') } +.icon-fast-forward:hover { background-image :url('iconsets/Slush/media-skip-forward-highlight.svg') } +.icon-stop-1 { background-image :url('iconsets/Slush/media-playback-stop.svg') } +.icon-stop-1:hover { background-image :url('iconsets/Slush/media-playback-stop-highlight.svg') } +.icon-to-end-1 { background-image :url('iconsets/Slush/stopafter.svg') } +.icon-to-end-1:hover { background-image :url('iconsets/Slush/stopafter-highlight.svg') } + +.icon-music { background-image: url('iconsets/Slush/collection.svg') } +.icon-search { background-image: url('iconsets/Slush/system-search.svg') } +.icon-folder-open-empty { background-image: url('iconsets/Slush/folder.svg') } +.icon-radio-tower { background-image: url('iconsets/Slush/broadcast-new.svg') } +.icon-cd { background-image: url('iconsets/Slush/cd_case.svg') } +.icon-resize-horizontal { background-image: url('iconsets/Slush/resize.svg') } +.icon-angle-double-left { background-image:url('iconsets/Slush/arrow-left-double.svg') } +.icon-angle-double-right { background-image:url('iconsets/Slush/arrow-right-double.svg') } +.icon-menu { background-image: url('iconsets/Slush/pushbutton.svg') } +.icon-versions { background-image: url('iconsets/Slush/history.svg') } +.icon-left-circled { background-image: url('iconsets/Slush/backbutton.svg') } +.icon-right-circled { background-image: url('iconsets/Slush/forwardbutton.svg') } +.icon-cog-alt { background-image: url('iconsets/Slush/preferences.svg') } +.icon-trash { background-image: url('iconsets/Slush/edit-clear-list.svg') } +.icon-wifi { background-image: url('iconsets/Slush/smartradio.svg') } +.icon-doc-text { background-image: url('iconsets/Slush/playlist.svg') } +.icon-floppy { background-image: url('iconsets/Slush/document-save.svg') } +.icon-cancel-circled { background-image: url('iconsets/Slush/edit-delete.svg') } +.icon-plus { + background-image: url('iconsets/Slush/add.svg'); + opacity:0.7; +} +.icon-alarm { background-image: url('iconsets/Slush/alarmclock_false.svg') } +.icon-alarm-on { background-image: url('iconsets/Slush/alarmclock_true.svg') } +.icon-sleep { background-image: url('iconsets/Slush/sleep.svg') } +.icon-library { background-image: url('iconsets/Slush/file.svg') } +.icon-lastfm-1 { background-image: url('iconsets/Slush/lastfm.svg') } +.icon-wikipedia { background-image: url('iconsets/Slush/wikipedia-logo.svg') } +.icon-musicbrainz { background-image: url('iconsets/Slush/musicbrainz_logo.svg') } +.icon-discogs { background-image: url('iconsets/Slush/discogs-logo.svg') } +.icon-doc-text-1 { background-image: url('iconsets/Slush/lyrics.svg') } +.icon-soundcloud-circled { background-image: url('iconsets/Slush/soundcloud-logo.svg') } +.icon-youtube-circled { background-image: url('iconsets/Slush/youtube-logo.svg') } +.icon-gmusic-circled { background-image: url('iconsets/Slush/gmusic-logo.svg') } +.icon-spotify-circled { background-image: url('iconsets/Slush/spotify-logo.svg') } +.icon-vkontakte-circled { background-image: url('iconsets/Slush/vkontakte-logo.svg') } +.icon-podcast-circled { background-image: url('iconsets/Slush/podcast-logo.svg') } +.icon-audiobook { background-image: url('iconsets/Slush/audiobook.svg') } +.icon-internetarchive-circled { background-image: url('iconsets/Slush/internetarchive-logo.svg') } +.icon-increase { background-image: url('iconsets/Slush/arrow-increase.svg') } +.icon-decrease { background-image: url('iconsets/Slush/arrow-decrease.svg') } +.icon-attention-1 { background-image: url('iconsets/Slush/dialog-error.svg') } +.icon-info-circled { background-image: url('iconsets/Slush/dialog-information.svg') } +.icon-download { background-image: url('iconsets/Slush/download-icon.svg') } +.icon-sun { background-image: url('iconsets/Slush/icon-new.svg') } +.icon-headphones { background-image: url('iconsets/Slush/headphones.svg') } +.icon-unlistened { background-image: url('iconsets/Slush/headphones.svg') } +.icon-block { background-image: url('iconsets/Slush/lastfm-ban.svg') } +.icon-heart { background-image: url('iconsets/Slush/lastfm-love.svg') } +.icon-heart-broken { background-image: url('iconsets/Slush/lastfm-unlove.svg') } +.icon-refresh { background-image: url('iconsets/Slush/refresh.svg') } +.icon-dirble-circled { background-image: url('iconsets/Slush/dirble-logo.svg') } +.icon-tunein { background-image: url('iconsets/Slush/../../newimages/tunein-logo.svg') } +.icon-no-response-playbutton { background-image :url('iconsets/Slush/media-playback-start.svg') } +.icon-tags { background-image: url('iconsets/Slush/tag.svg') } +.icon-volume-up { background-image: url('iconsets/Slush/volume.svg') } +.icon-toggle-open { background-image: url('iconsets/Slush/toggle-open.svg') } +.icon-toggle-closed { background-image: url('iconsets/Slush/toggle-closed.svg') } +.icon-spin6 { background-image: url('iconsets/Slush/spinner.svg') } +.icon-output { background-image: url('iconsets/Slush/output.svg') } +.icon-output-mute { background-image: url('iconsets/Slush/output_mute.svg') } +.icon-sliders { background-image: url('iconsets/Slush/sliders.svg') } +.icon-0-stars { background-image: url('iconsets/Slush/0stars.svg') } +.icon-1-stars { background-image: url('iconsets/Slush/1stars.svg') } +.icon-2-stars { background-image: url('iconsets/Slush/2stars.svg') } +.icon-3-stars { background-image: url('iconsets/Slush/3stars.svg') } +.icon-4-stars { background-image: url('iconsets/Slush/4stars.svg') } +.icon-5-stars { background-image: url('iconsets/Slush/5stars.svg') } +.icon-single-star { background-image: url('iconsets/Slush/singlestar.svg') } +.icon-ratandtag { background-image: url('iconsets/Slush/ratandtag.svg') } +.icon-ratortag { background-image: url('iconsets/Slush/ratortag.svg') } +.icon-toggle-on { background-image: url('iconsets/Slush/togglebutton-new2-on.svg') } +.icon-toggle-off { background-image: url('iconsets/Slush/togglebutton-new2-off.svg') } + +.icon-random.flow-on { background-image: url('iconsets/Slush/random.svg') } +.icon-random.flow-off { background-image: url('iconsets/Slush/random_off.svg') } +.icon-crossfade.flow-on { background-image: url('iconsets/Slush/crossfade.svg') } +.icon-crossfade.flow-off { background-image: url('iconsets/Slush/crossfade_off.svg') } +.icon-repeat.flow-on { background-image: url('iconsets/Slush/refresh.svg') } +.icon-repeat.flow-off { background-image: url('iconsets/Slush/refresh_off.svg') } +.icon-consume.flow-on { background-image: url('iconsets/Slush/consume.svg') } +.icon-consume.flow-off { background-image: url('iconsets/Slush/consume_off.svg') } + +.icon-allrandom { background-image: url('iconsets/Slush/shuffle.svg') } +.icon-neverplayed { background-image: url('iconsets/Slush/neverheard.svg') } +.icon-recentlyplayed { background-image: url('iconsets/Slush/calendar.svg') } +.icon-artist { background-image: url('iconsets/Slush/artist-icon.svg') } +.icon-mp3-audio { background-image: url('iconsets/Slush/mp3-audio.svg') } +.icon-aac-audio { background-image: url('iconsets/Slush/aac-audio.svg') } +.icon-flac-audio { background-image: url('iconsets/Slush/flac-audio.svg') } +.icon-wma-audio { background-image: url('iconsets/Slush/wma-audio.svg') } +.icon-ogg-audio { background-image: url('iconsets/Slush/ogg-audio.svg') } +.icon-explicit { background-image: url('iconsets/Slush/parental-advisory.svg') } +.icon-expand-up { background-image: url('iconsets/Slush/expand-up.svg') } +.icon-rss { background-image: url('iconsets/Slush/rss.svg') } +.icon-tick { background-image: url('iconsets/Slush/tick.svg') } +.icon-video { background-image: url('iconsets/Slush/movie-1.svg') } +.icon-bbc-logo { background-image: url('iconsets/Slush/bbc-logo.svg') } +.icon-imdb-logo { background-image: url('iconsets/Slush/imdb-logo.svg') } +.icon-facebook-logo { background-image: url('iconsets/Slush/facebook-logo.svg') } +.icon-twitter-logo { background-image: url('iconsets/Slush/twitter-logo.svg') } +.icon-www { background-image: url('iconsets/Slush/world-wide-web.svg') } +.icon-allmusic { background-image: url('iconsets/Slush/allmusic-logo.svg') } +.icon-updown { background-image: url('iconsets/Slush/arrow-updown.svg') } +.icon-snapcast { background-image: url('iconsets/Slush/../../newimages/snapcast.png') } + +.styledinputs label +{ + display:inline-block; + cursor:pointer; + position:relative; + padding-left:2.5em; + line-height:1.5em; +} + +.styledinputs input[type=radio] +{ + display:none; +} + +.styledinputs input[type=checkbox] +{ + display:none; +} + +.styledinputs label:before +{ + content:""; + display:inline-block; + width:2em; + height:1.5em; + position:absolute; + left:0; + /* bottom:0.2em; */ + background-image: url('iconsets/Slush/togglebutton-new2-off.svg'); + background-size:auto 80%; + background-position: center; + background-repeat:no-repeat; +} + +.styledinputs input:checked + label:before +{ + background-image: url('iconsets/Slush/togglebutton-new2-on.svg') !important; +} + +img.notexist,img.notfound +{ + background-image: url('iconsets/Slush/compact-disc.svg'); + background-size:contain; + display:inline-block; + background-position:center; + background-repeat: no-repeat; +} + +img.stream.notfound, img.stream.notexist +{ + background-image: url('iconsets/Slush/broadcast-new.svg'); +} + +img.plimage.notfound +{ + background-image: url('iconsets/Slush/playlist.svg'); +} + +.backmenu +{ + background-image: url('iconsets/Slush/arrow-left-double.svg'); + background-repeat: no-repeat; + background-size: contain; +} + +button.iconbutton { + height:2em; + width:2em; + background-size: contain; + background-position:center; + border: none !important; + opacity: 0.8; + background-color:transparent; +} + +button.iconbutton:hover { + opacity: 1; +} + +button.searchbutton { + background-image: url('iconsets/Slush/system-search.svg'); +} + +button.rssbutton { + background-image: url('iconsets/Slush/rss.svg'); +} + diff --git a/www/rompr/iconsets/Slush/tick.svg b/www/rompr/iconsets/Slush/tick.svg new file mode 100644 index 0000000..3543240 --- /dev/null +++ b/www/rompr/iconsets/Slush/tick.svg @@ -0,0 +1,191 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush/toggle-closed.svg b/www/rompr/iconsets/Slush/toggle-closed.svg new file mode 100644 index 0000000..b9cbdcb --- /dev/null +++ b/www/rompr/iconsets/Slush/toggle-closed.svg @@ -0,0 +1,67 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush/toggle-open.svg b/www/rompr/iconsets/Slush/toggle-open.svg new file mode 100644 index 0000000..bc071e8 --- /dev/null +++ b/www/rompr/iconsets/Slush/toggle-open.svg @@ -0,0 +1,67 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush/togglebutton-new2-off.svg b/www/rompr/iconsets/Slush/togglebutton-new2-off.svg new file mode 100644 index 0000000..0c6c5ad --- /dev/null +++ b/www/rompr/iconsets/Slush/togglebutton-new2-off.svg @@ -0,0 +1,153 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush/togglebutton-new2-on.svg b/www/rompr/iconsets/Slush/togglebutton-new2-on.svg new file mode 100644 index 0000000..e45a6be --- /dev/null +++ b/www/rompr/iconsets/Slush/togglebutton-new2-on.svg @@ -0,0 +1,171 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush/twitter-logo.svg b/www/rompr/iconsets/Slush/twitter-logo.svg new file mode 100644 index 0000000..c8951bf --- /dev/null +++ b/www/rompr/iconsets/Slush/twitter-logo.svg @@ -0,0 +1,157 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush/unlistened.svg b/www/rompr/iconsets/Slush/unlistened.svg new file mode 100644 index 0000000..55efdb0 --- /dev/null +++ b/www/rompr/iconsets/Slush/unlistened.svg @@ -0,0 +1,68 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush/vkontakte-logo.svg b/www/rompr/iconsets/Slush/vkontakte-logo.svg new file mode 100644 index 0000000..003dca6 --- /dev/null +++ b/www/rompr/iconsets/Slush/vkontakte-logo.svg @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + diff --git a/www/rompr/iconsets/Slush/volume.svg b/www/rompr/iconsets/Slush/volume.svg new file mode 100644 index 0000000..b71c3a7 --- /dev/null +++ b/www/rompr/iconsets/Slush/volume.svg @@ -0,0 +1,79 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush/wikipedia-logo.svg b/www/rompr/iconsets/Slush/wikipedia-logo.svg new file mode 100644 index 0000000..86865ba --- /dev/null +++ b/www/rompr/iconsets/Slush/wikipedia-logo.svg @@ -0,0 +1,67 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush/wma-audio.svg b/www/rompr/iconsets/Slush/wma-audio.svg new file mode 100644 index 0000000..4255519 --- /dev/null +++ b/www/rompr/iconsets/Slush/wma-audio.svg @@ -0,0 +1,120 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/rompr/iconsets/Slush/world-wide-web.svg b/www/rompr/iconsets/Slush/world-wide-web.svg new file mode 100644 index 0000000..118d681 --- /dev/null +++ b/www/rompr/iconsets/Slush/world-wide-web.svg @@ -0,0 +1,80 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/Slush/youtube-logo.svg b/www/rompr/iconsets/Slush/youtube-logo.svg new file mode 100644 index 0000000..b0d328f --- /dev/null +++ b/www/rompr/iconsets/Slush/youtube-logo.svg @@ -0,0 +1,66 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/www/rompr/iconsets/colourconverter.php b/www/rompr/iconsets/colourconverter.php new file mode 100644 index 0000000..616b7a5 --- /dev/null +++ b/www/rompr/iconsets/colourconverter.php @@ -0,0 +1,46 @@ +/', '', $hack); + // $hack = preg_replace('/<\/svg>/', '', $hack); + + // These lines convert the gradient as used in Fiery + // $hack = preg_replace('/#fff663/i', '#DDDDDD', $hack); + // $hack = preg_replace('/#fb8626/i', '#333333', $hack); + // $hack = preg_replace('/#fb8a26/i', '#333333', $hack); + + // These lines convert the gradient as used in Slush-Dark. + // Don't forget to edit (or remove) the #pset and #pmaxset in theme.css + $hack = preg_replace('/#656565/i', '#654321', $hack); + $hack = preg_replace('/#000000/i', '#123456', $hack); + + + file_put_contents($file, $hack); + +} + +?> diff --git a/www/rompr/includes/about.html b/www/rompr/includes/about.html new file mode 100644 index 0000000..bf5cd53 --- /dev/null +++ b/www/rompr/includes/about.html @@ -0,0 +1,52 @@ +

      This is RompЯ

      +

      Copyright Mark Greenwood and contributors, 2011 - 2018 and onwards

      +
      +

      WHO?
      +

        +
      • Most of the coding (good and bad) - Mark Greenwood
      • +
      • Custom Scrollbars, Playlist auto-scroll, Last.FM internationalisation, and persuading me to make the interface translatable - Vitaly Ignatov
      • +
      • Darkness HiDpi theme, much much tidying up of the SQL and CSS code, and invaluable advice - Cyril (X-Ryl)
      • +
      • French translation by SourceForge user zargloub
      • +
      • Italian translation by Luca Morisi
      • +
      • German translation by Frank Schraven and Tom Roth
      • +
      • Russian translation by Паша
      • +
      • Much, much testing by Tom Roth and Frank Schraven
      • +
      • Testing and many, many ideas by GitHub user gerroon
      • +
      +

      +

      WHAT?
      +

        +
      • RompЯ is all about discovery. Discovering more about the music you love and discovering music you don't know. +
      +

      WHY?
      +

        +
      • The collectioniser aims to do what Amarok 1.4 used to do with my music collection.
      • +
      • The looks aim to do what Amarok 2 does with my music collection. It's an MPD and Mopidy client because my media center is over there.
      • +
      • Why is it called RompЯ? It just is. I think it was going to be an acronym but I gave up at 'R' and then I liked the idea of using a 'Я' at the end.
      • +
      +

      WHERE?
      +

        +
      • RompЯ is developed on macOS.
      • +
      • My media centre runs on a Raspberry Pi 3B+ using Raspbian, Mopidy, and Kodi and is over there.
      • +
      + +

      HOW?
      +RompЯ, like so much free software, is built on the work of others. Here's a list that's as complete as possible:
      +

      +Each of the items in the above list is made available under a specific license. Please follow the links for details

      diff --git a/www/rompr/includes/begging.html b/www/rompr/includes/begging.html new file mode 100644 index 0000000..972482e --- /dev/null +++ b/www/rompr/includes/begging.html @@ -0,0 +1,30 @@ +
      +

      A Message From The Developer

      +

      Hello, sorry to interupt your listening but I hope you can take a minute to read this obvious begging letter.

      +

      Developing RompЯ takes a lot of my spare time and as a self-employed person it is becoming increasingly difficult to balance my desire to develop RompЯ with my need to earn a living. I have already put many hundreds of hours into this project so if you like it and you use it and you'd like me to continue with it I wonder if you'd be so kind as to make a small donation using the Pay Now button below. This will take you to PayPal but you do not need to have a PayPal account to make a donation.

      +

      I won't keep nagging you as I know how annoying that is but I would really appreciate a show of love :)

      +

      A massive thank you to everyone who has donated so far, it is very much appreciated and you are keeping this project going

      +

      Always remember, keep on grooving

      + +
      +
      + + + + + + +
      +
      +
      +
      \ No newline at end of file diff --git a/www/rompr/includes/firstrun.php b/www/rompr/includes/firstrun.php new file mode 100644 index 0000000..68a66fa --- /dev/null +++ b/www/rompr/includes/firstrun.php @@ -0,0 +1,46 @@ + diff --git a/www/rompr/includes/functions.php b/www/rompr/includes/functions.php new file mode 100644 index 0000000..db4d87b --- /dev/null +++ b/www/rompr/includes/functions.php @@ -0,0 +1,1083 @@ +/', '$1 target="_blank">', $d); + $d = preg_replace('/(/', '$1 target="_blank">', $d); + $d = preg_replace('/style\s*=\s*\".*?\"/', '', $d); + $d = preg_replace('/

      \s*<\/p>/', '', $d); + $d = preg_replace('/

       <\/p>/', '', $d); + $d = preg_replace('/\n|(\r\n)/', '
      ', $d); + $d = preg_replace('/()+/', '
      ', $d); + $d = preg_replace('/<\/p>
      /', '

      ', $d); + return $d; +} + +class url_downloader { + + private $default_options = array( + 'useragent' => ROMPR_IDSTRING, + 'timeout' => 120, + 'connection_timeout' => 60, + 'url' => '', + 'header' => null, + 'postfields' => null, + 'cache' => null, + 'return_data' => false, + 'send_cache_headers' => false + ); + + private $ch; + private $headerarray = array(); + private $headerlen = 0; + private $content; + private $content_type; + private $info; + private $status; + + public function __construct($options) { + global $prefs; + $this->options = array_merge($this->default_options, $options); + $this->ch = curl_init(); + curl_setopt($this->ch, CURLOPT_URL, $this->options['url']); + curl_setopt($this->ch, CURLOPT_ENCODING, ''); + if ($this->options['useragent']) { + curl_setopt($this->ch, CURLOPT_USERAGENT, $this->options['useragent']); + } + curl_setopt($this->ch, CURLOPT_SSL_VERIFYPEER, false); + curl_setopt($this->ch, CURLOPT_TIMEOUT, $this->options['timeout']); + curl_setopt($this->ch, CURLOPT_CONNECTTIMEOUT, $this->options['connection_timeout']); + if ($prefs['proxy_host'] != "") { + curl_setopt($this->ch, CURLOPT_PROXY, $prefs['proxy_host']); + } + if ($prefs['proxy_user'] != "" && $prefs['proxy_password'] != "") { + curl_setopt($this->ch, CURLOPT_PROXYUSERPWD, $prefs['proxy_user'].':'.$prefs['proxy_password']); + } + curl_setopt($this->ch, CURLOPT_FOLLOWLOCATION, true); + if ($this->options['header']) { + curl_setopt($this->ch, CURLOPT_HTTPHEADER, $this->options['header']); + } + if ($this->options['postfields'] !== null) { + $fields_string = ''; + foreach ($this->options['postfields'] as $key => $value) { + $fields_string .= $key.'='.$value.'&'; + } + rtrim($fields_string,'&'); + curl_setopt($this->ch, CURLOPT_POST, count($this->options['postfields'])); + curl_setopt($this->ch, CURLOPT_POSTFIELDS, $fields_string); + } + // WARNING. Don't put the _HEADER stuff in here, for some reason I can't be arsed + // to figure out, it breaks get_data_to_file. + } + + public function get_data_to_string() { + logger::trace("URL_DOWNLOADER", "Downloading ".$this->options['url']); + if ($this->options['send_cache_headers']) { + header("Pragma: Not Cached"); + } + curl_setopt($this->ch, CURLOPT_HEADER, true); + curl_setopt($this->ch, CURLOPT_HEADERFUNCTION, function($curl, $header) + { + $len = strlen($header); + $this->headerlen += $len; + $header = explode(':', $header, 2); + if (count($header) < 2) // ignore invalid headers + return $len; + + $name = ($header[0]); + $this->headerarray[$name] = trim($header[1]); + return $len; + } + ); + curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, 1); + $this->content = curl_exec($this->ch); + return $this->get_final_info(); + } + + public function get_data_to_file($file = null, $binary = false) { + if ($file === null && $this->options['cache'] === null) { + logger::trace("URL_DOWNLOADER", " No file or cache dir for request, returning data as string"); + return $this->get_data_to_string(); + } else if ($this->options['cache'] !== null) { + $file = 'prefs/jsoncache/'.$this->options['cache'].'/'.md5($this->options['url']); + } + if ($this->options['cache'] !== null && $this->check_cache($file)) { + logger::log("URL_DOWNLOADER", "Returning cached data ".$file); + $this->content = file_get_contents($file); + return true; + } else { + logger::trace("URL_DOWNLOADER", "Downloading",$this->options['url'],"to",$file); + if (file_exists($file)) { + unlink ($file); + } + $open_mode = $binary ? 'wb' : 'w'; + $fp = fopen($file, $open_mode); + curl_setopt($this->ch, CURLOPT_FILE, $fp); + curl_exec($this->ch); + fclose($fp); + if ($this->options['return_data']) { + $this->content = file_get_contents($file); + } + if (curl_getinfo($this->ch,CURLINFO_RESPONSE_CODE) != '200') { + unlink($file); + } + return $this->get_final_info(); + } + } + + private function check_cache($file) { + if (file_exists($file)) { + if ($this->options['send_cache_headers']) { + header("Pragma: From Cache"); + } + return true; + } else { + if ($this->options['send_cache_headers']) { + header("Pragma: Not Cached"); + } + return false; + } + } + + private function get_final_info() { + $this->status = curl_getinfo($this->ch, CURLINFO_RESPONSE_CODE); + $this->content_type = curl_getinfo($this->ch, CURLINFO_CONTENT_TYPE); + $this->info = curl_getinfo($this->ch); + curl_close($this->ch); + if ($this->get_status() == '200') { + logger::trace("URL_DOWNLOADER", " .. Download Success"); + return true; + } else { + logger::warn("URL_DOWNLOADER", " .. Download Failed With Status Code",$this->get_status()); + return false; + } + } + + public function get_data() { + return substr($this->content, $this->headerlen); + } + + public function get_headers() { + return $this->headerarray; + } + + public function get_header($h) { + if (array_key_exists($h, $this->headerarray)) { + return $this->headerarray[$h]; + } else { + return false; + } + } + + public function get_status() { + return $this->status; + } + + public function get_info() { + return $this->info; + } + + public function get_content_type() { + return $this->content_type; + } + +} + +function format_time($t,$f=':') { + if (($t/86400) >= 1) { + return sprintf("%d%s%2d%s%02d%s%02d", ($t/86400), " ".get_int_text("label_days")." ", + ($t/3600)%24, $f, ($t/60)%60, $f, $t%60); + } + if (($t/3600) >= 1) { + return sprintf("%2d%s%02d%s%02d", ($t/3600), $f, ($t/60)%60, $f, $t%60); + } else { + return sprintf("%02d%s%02d", ($t/60)%60, $f, $t%60); + } +} + +function munge_album_name($name) { + $b = preg_replace('/(\(|\[)disc\s*\d+.*?(\)|\])/i', "", $name); // (disc 1) or (disc 1 of 2) or (disc 1-2) etc (or with [ ]) + $b = preg_replace('/(\(|\[)*cd\s*\d+.*?(\)|\])*/i', "", $b); // (cd 1) or (cd 1 of 2) etc (or with [ ]) + $b = preg_replace('/\sdisc\s*\d+.*?$/i', "", $b); // disc 1 or disc 1 of 2 etc + $b = preg_replace('/\scd\s*\d+.*?$/i', "", $b); // cd 1 or cd 1 of 2 etc + $b = preg_replace('/(\(|\[)\d+\s*of\s*\d+(\)|\])/i', "", $b); // (1 of 2) or (1of2) (or with [ ]) + $b = preg_replace('/(\(|\[)\d+\s*-\s*\d+(\)|\])/i', "", $b); // (1 - 2) or (1-2) (or with [ ]) + $b = preg_replace('/(\(|\[)Remastered(\)|\])/i', "", $b); // (Remastered) (or with [ ]) + $b = preg_replace('/(\(|\[).*?bonus .*(\)|\])/i', "", $b); // (With Bonus Tracks) (or with [ ]) + $b = preg_replace('/\s+-\s*$/', "", $b); // Chops any stray - off the end that could have been left by the previous + $b = preg_replace('#\s+$#', '', $b); + $b = preg_replace('#^\s+#', '', $b); + return $b; +} + +function sanitsizeDiscogsResult($name) { + $b = preg_replace('/\* /',' ', $name); + return $b; +} + +function alistheader($nart, $nalb, $ntra, $tim) { + return '
      '. + ''. + ''. + ''. + '
      '.$nart.' '.get_int_text("label_artists"). + ''.$nalb.' '.get_int_text("label_albums").'
      '.$ntra.' '.get_int_text("label_tracks"). + ''.$tim.'
      '. + '
      '; +} + +function get_base_url() { + /* First we need to get the protocol the website is using */ + $protocol = strtolower(substr($_SERVER["SERVER_PROTOCOL"], 0, 5)) == 'https://' ? 'https://' : 'http://'; + + /* returns /myproject/index.php */ + $path = $_SERVER['PHP_SELF']; + + /* + * returns an array with: + * Array ( + * [dirname] => /myproject/ + * [basename] => index.php + * [extension] => php + * [filename] => index + * ) + */ + $path_parts = pathinfo($path); + $directory = $path_parts['dirname']; + /* + * If we are visiting a page off the base URL, the dirname would just be a "/", + * If it is, we would want to remove this + */ + $directory = ($directory == "/") ? "" : $directory; + + /* Returns localhost OR mysite.com */ + $host = $_SERVER['HTTP_HOST']; + + // This handles the case where we're getting http://mypc.local/rompr/utils/something.php + $directory = preg_replace('#/utils$#', '', $directory); + $directory = preg_replace('#/streamplugins$#', '', $directory); + $directory = preg_replace('#/includes$#', '', $directory); + /* + * Returns: + * http://localhost/mysite + * OR + * https://mysite.com + */ + return $protocol . $host . $directory; +} + +function scan_for_images($albumpath) { + logger::log("LOCAL IMAGE SCAN", "Album Path Is ".$albumpath); + $result = array(); + if (is_dir("prefs/MusicFolders") && $albumpath != ".") { + $albumpath = munge_filepath($albumpath); + $result = array_merge($result, get_images($albumpath)); + // Is the album dir part of a multi-disc set? + if (preg_match('/^CD\s*\d+$|^disc\s*\d+$/i', basename($albumpath))) { + $albumpath = dirname($albumpath); + $result = array_merge($result, get_images($albumpath)); + } + // Are there any subdirectories? + $globpath = preg_replace('/(\*|\?|\[)/', '[$1]', $albumpath); + $lookfor = glob($globpath."/*", GLOB_ONLYDIR); + foreach ($lookfor as $i => $f) { + if (is_dir($f)) { + $result = array_merge($result, get_images($f)); + } + } + } + return $result; +} + +function get_images($dir_path) { + + $funkychicken = array(); + $a = basename($dir_path); + logger::log("GET_IMAGES", " Scanning :",$dir_path); + $globpath = preg_replace('/(\*|\?|\[)/', '[$1]', $dir_path); + logger::debug("GET_IMAGES", " Glob Path is",$globpath); + $funkychicken = glob($globpath."/*.{jpg,png,bmp,gif,jpeg,JPEG,JPG,BMP,GIF,PNG}", GLOB_BRACE); + logger::log("GET_IMAGES", " Checking for embedded images"); + $files = glob($globpath."/*.{mp3,MP3,mp4,MP4,flac,FLAC,ogg,OGG}", GLOB_BRACE); + $testfile = array_shift($files); + if ($testfile) { + $getID3 = new getID3; + $tags = $getID3->analyze($testfile); + getid3_lib::CopyTagsToComments($tags); + if (array_key_exists('comments', $tags) && array_key_exists('picture', $tags['comments'])) { + foreach ($tags['comments']['picture'] as $picture) { + if (array_key_exists('picturetype', $picture)) { + if ($picture['picturetype'] == 'Cover (front)') { + logger::log("GET_IMAGES", " .. found embedded front cover image"); + $filename = 'prefs/temp/'.md5($globpath); + file_put_contents($filename, $picture['data']); + array_unshift($funkychicken, $filename); + } + } + } + } + } + return $funkychicken; +} + +function munge_filepath($p) { + global $prefs; + $p = rawurldecode(html_entity_decode($p)); + $f = "file://".$prefs['music_directory_albumart']; + if (substr($p, 0, strlen($f)) == $f) { + $p = substr($p, strlen($f), strlen($p)); + } + return "prefs/MusicFolders/".$p; +} + +function find_executable($prog) { + + // Test to see if $prog is on the path and then try Homebrew and MacPorts paths until we find it + // returns boolean false if the program is not found + logger::debug("BITS", " Looking for executable program ",$prog); + $paths_to_try = array('', '/usr/local/bin/', '/opt/local/bin/', '/usr/bin/', './'); + $retval = false; + foreach ($paths_to_try as $c) { + $r = exec($c.$prog." 2>&1", $o, $a); + if ($a != 127) { + $retval = $c; + break; + } + } + if ($retval === false) { + logger::debug("BITS", " Program ".$prog." Not Found!"); + } else { + logger::debug("BITS", " program is ".$retval.$prog); + } + return $retval; + +} + +function get_browser_language() { + // TODO - this method is not good enough. + if (array_key_exists('HTTP_ACCEPT_LANGUAGE', $_SERVER)) { + return substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2); + } else { + return 'en'; + } +} + +function getStreamFolder($url) { + $f = dirname($url); + if ($f == "." || $f == "") $f = $url; + return $f; +} + +function getDummyStation($url) { + $f = getDomain($url); + switch ($f) { + case "http": + case "https": + case "mms": + case "mmsh": + case "mmst": + case "mmsu": + case "gopher": + case "rtp": + case "rtsp": + case "rtmp": + case "rtmpt": + case "rtmps": + return "Radio"; + break; + + default: + return ucfirst($f); + break; + } +} + +function sql_init_fail($message) { + + global $prefs; + header("HTTP/1.1 500 Internal Server Error"); +?> + + + +Badgers! + + +

      Collection Database Error

      +

      It's all gone horribly wrong

      +
      +RompЯ encountered an error while checking your '. + ucfirst($prefs['collection_type']).' database.'; +?> +

      An SQLite or MySQL database is required to run RompЯ

      +

      You may find it helpful to Read The Docs

      +

      The error message was:


      +

      '. + $message.'



      '; + $title = ""; + include('setupscreen.php'); + exit(0); + +} + +function imagePath($image) { + return ($image) ? $image : ''; +} + +function concatenate_artist_names($art) { + if (!is_array($art)) { + return $art; + } + if (count($art) == 0) { + return ''; + } else if (count($art) == 1) { + return $art[0]; + } else if (count($art) == 2) { + return implode(' & ',$art); + } else { + $f = array_slice($art, 0, count($art) - 1); + return implode($f, ", ")." & ".$art[count($art) - 1]; + } +} + +function unwanted_array($a) { + + if (is_array($a)) { + return $a[0]; + } else { + return $a; + } +} + +function getArray($a) { + if ($a === null) { + return array(); + } else if (is_array($a)) { + return $a; + } else { + return array($a); + } +} + +function getYear($date) { + if (preg_match('/(\d\d\d\d)/', $date, $matches)) { + return $matches[1]; + } else { + return null; + } +} + +function trim_content_type($filetype) { + $filetype = preg_replace('/;.*/','',$filetype); + $filetype = trim(strtolower($filetype)); + return $filetype; +} + +function audioClass($filetype, $domain = '') { + $filetype = trim_content_type($filetype); + switch ($filetype) { + case "mp3": + case "audio/mpeg": + return 'icon-mp3-audio'; + break; + + case "mp4": + case "m4a": + case "aac": + case "aacplus": + case "aac+": + case "aacp": + case "audio/aac": + case "audio/aacp": + return 'icon-aac-audio'; + break; + + case "flac": + return 'icon-flac-audio'; + break; + + case "wma": + case "windows media": + return 'icon-wma-audio'; + break; + + case "ogg": + case "ogg vorbis": + return 'icon-ogg-audio'; + break; + + case "cue": + case "pls": + case "m3u": + case "audio/x-mpegurl": + case "audio/x-scpls": + case "video/x-ms-asf": + return "icon-doc-text"; + break; + + case "?": + case 'text/html': + case '': + case ' '; + return domainCheck('notastream', $domain); + break; + + default: + return domainCheck('icon-music', $domain); + break; + + } + +} + +function domainCheck($default, $domain) { + if ($domain == '') { + return $default; + } + switch ($domain) { + case 'soundcloud': + case 'spotify': + case 'gmusic': + case 'vkontakte': + case 'internetarchive': + case 'podcast': + case 'dirble': + case 'youtube': + return 'icon-'.$domain.'-circled'; + break; + + case 'tunein': + return 'icon-tunein'; + break; + + default: + return $default; + break; + + } + +} + +function getDomain($d) { + if ($d === null || $d == "") { + return "local"; + } + $d = urldecode($d); + $pos = strpos($d, ":"); + $a = substr($d,0,$pos); + if ($a == "") { + return "local"; + } + $s = substr($d,$pos+3,15); + if ($s == "api.soundcloud.") { + return "soundcloud"; + } + if ($a == 'http' || $a == 'https') { + if (strpos($d, 'vk.me') !== false) { + return 'vkontakte'; + } else if (strpos($d, 'oe1:archive') !== false) { + return 'oe1'; + } else if (strpos($d, 'http://leftasrain.com') !== false) { + return 'leftasrain'; + } else if (strpos($d, 'archives.bassdrivearchive.com') !== false || + strpos($d, 'bassdrive.com') !== false) { + return 'bassdrive'; + } + } + return strtok($a, ' '); +} + +function domainIcon($d, $c) { + $h = ''; + switch($d) { + case "spotify": + case "gmusic": + case "youtube": + case "internetarchive": + case "soundcloud": + case "podcast": + case "dirble": + case "tunein": + $h = ''; + break; + + case "radio-de": + case "bassdrive": + $h = '
      '; + break; + + } + return $h; +} + +function domainHtml($uri) { + $h = domainIcon(getDomain($uri), 'collectionicon'); + if ($h == '') { + if (strtolower(pathinfo($uri, PATHINFO_EXTENSION)) == "cue") { + $h = ''; + } + } + return $h; +} + +function artistNameHtml($obj) { + global $prefs; + $h = ''; + if ($prefs['sortcollectionby'] == 'albumbyartist' && $obj['Artistname']) { + $h .= '
      '.$obj['Albumname']; + $h .= '
      '.$obj['Artistname'].''; + if ($obj['Year'] && $prefs['sortbydate']) { + $h .= ' ('.$obj['Year'].')'; + } + } else { + $h .= '
      '.$obj['Albumname']; + if ($obj['Year'] && $prefs['sortbydate']) { + $h .= ' ('.$obj['Year'].')'; + } + if ($obj['Artistname']) { + $h .= '
      '.$obj['Artistname'].''; + } + } + return $h; +} + +function checkComposerGenre($genre, $pref) { + $gl = strtolower($genre); + foreach ($pref as $g) { + if ($gl == strtolower($g)) { + return true; + } + } + return false; +} + +function get_player_ip() { + global $prefs; + // SERVER_ADDR reflects the address typed into the browser + logger::log("INIT", "Server Address is ".$_SERVER['SERVER_ADDR']); + // REMOTE_ADDR is the address of the machine running the browser + logger::log("INIT", "Remote Address is ".$_SERVER['REMOTE_ADDR']); + logger::log("INIT", "Prefs for mpd host is ".$prefs['multihosts']->{$prefs['currenthost']}->host); + $pip = ''; + if ($prefs['multihosts']->{$prefs['currenthost']}->socket != '') { + $pip = $_SERVER['HTTP_HOST']; + } else if ( $prefs['multihosts']->{$prefs['currenthost']}->host == "localhost" || + $prefs['multihosts']->{$prefs['currenthost']}->host == "127.0.0.1" || + $prefs['multihosts']->{$prefs['currenthost']}->host == '::1') { + $pip = $_SERVER['HTTP_HOST'] . ':' . $prefs['multihosts']->{$prefs['currenthost']}->port; + } else { + $pip = $prefs['multihosts']->{$prefs['currenthost']}->host . ':' . $prefs['multihosts']->{$prefs['currenthost']}->port; + } + logger::log("INIT", "Displaying Player IP as: ".$pip); + return $pip; +} + +function getCacheData($uri, $cache, $use_cache = true) { + + $me = strtoupper($cache); + logger::log("GET CACHE DATA", "Getting",$uri); + if ($use_cache == false) { + logger::trace("GET CACHE DATA", " Not using cache for this request"); + } + $options = array( + 'url' => $uri, + 'send_cache_headers' => true, + 'cache' => $use_cache ? $cache : null, + 'return_data' => true + ); + $d = new url_downloader($options); + if ($d->get_data_to_file()) { + print $d->get_data(); + } else { + if ($d->get_status() > 0) { + $header = $d->get_status().' '.http_status_code_string($d->get_status()); + logger::fail("GET CACHE DATA", "HTTP ERROR",$header); + } else { + $header = '500 '.http_status_code_string(500); + } + header('HTTP/1.1 '.$header); + if ($d->get_data() != '') { + print $d->get_data(); + } else { + print json_encode(array('error' => $header)); + } + } +} + +function get_user_file($src, $fname, $tmpname) { + global $error; + logger::log("GETALBUMCOVER", " Uploading ".$src." ".$fname." ".$tmpname); + $download_file = "prefs/temp/".$fname; + logger::log("GETALBUMCOVER", "Checking Temp File ".$tmpname); + if (move_uploaded_file($tmpname, $download_file)) { + logger::log("GETALBUMCOVER", " File ".$src." is valid, and was successfully uploaded."); + } else { + logger::warn("GETALBUMCOVER", " Possible file upload attack!"); + header('HTTP/1.0 403 Forbidden'); + ob_flush(); + exit(0); + } + return $download_file; +} + +function albumImageBuggery() { + // This was used to update album art to a new format but it's really old now and we've totally refactored the album image code + // In the eventuality that someone is still using a version that old we'll keep the function but just use it to remove all album art + // and start again. + rrmdir('albumart/small'); + rrmdir('albumart/asdownloaded'); + mkdir('albumart/small', 0755); + mkdir('albumart/asdownloaded', 0755); + generic_sql_query("UPDATE Albumtable SET Searched = 0, Image = ''"); +} + +function rejig_wishlist_tracks() { + global $mysqlc; + generic_sql_query("DELETE FROM Playcounttable WHERE TTindex IN (SELECT TTindex FROM Tracktable WHERE Hidden = 1 AND Uri IS NULL)", true); + generic_sql_query("DELETE FROM Tracktable WHERE Hidden = 1 AND Uri IS NULL", true); + $result = generic_sql_query("SELECT * FROM Tracktable WHERE Uri IS NULL"); + foreach ($result as $obj) { + if (sql_prepare_query(true, null, null, null, + "INSERT INTO + Albumtable + (Albumname, AlbumArtistindex, AlbumUri, Year, Searched, ImgKey, mbid, Domain, Image) + VALUES + (?, ?, ?, ?, ?, ?, ?, ?, ?)", + 'rompr_wishlist_'.microtime(true), $obj['Artistindex'], null, 0, 0, null, null, 'local', null)) { + + $albumindex = $mysqlc->lastInsertId(); + logger::log("MYSQL", " Created Album with Albumindex ".$albumindex); + generic_sql_query("UPDATE Tracktable SET Albumindex = ".$albumindex." WHERE TTindex = ".$obj['TTindex'], true); + } + } +} + +function emptyCollectionDisplay() { + print '
      +

      Your Music Collection Is Empty

      +

      You can add files to it by tagging and rating them, or you can build a collection of all your music

      '; + print '
      '; +} + +function emptySearchDisplay() { + print '
      +

      No Results

      +
      '; +} + +function format_bytes($size, $precision = 1) +{ + $base = log($size, 1024); + $suffixes = array('', 'K', 'M', 'G', 'T'); + + return round(pow(1024, $base - floor($base)), $precision) .' '. $suffixes[floor($base)]; +} + +function fixup_links($s) { + return preg_replace('/(^|\s+|\n|[^\s+"])(https*:\/\/.*?)(<|\n|\r|\s|\)|$|[<|\n|\r|\s|\)|$])/', '$1$2$3', $s); +} + +function set_version_string() { + global $version_string, $prefs; + if ($prefs['dev_mode']) { + // This adds an extra parameter to the version number - the short + // hash of the most recent git commit, or a timestamp. It's for use in testing, + // to make sure the browser pulls in the latest version of all the files. + if ($prefs['live_mode']) { + $version_string = ROMPR_VERSION.".".time(); + } else { + // DO NOT USE OUTSIDE A git REPO! + $git_ver = exec("git log --pretty=format:'%h' -n 1", $output); + if (count($output) == 1) { + $version_string = ROMPR_VERSION.".".$output[0]; + } else { + $version_string = ROMPR_VERSION.".".time(); + } + } + } else { + $version_string = ROMPR_VERSION; + } +} + +function update_stream_images($schemaver) { + require_once('utils/imagefunctions.php'); + switch ($schemaver) { + case 43: + $stations = generic_sql_query("SELECT Stationindex, StationName, Image FROM RadioStationtable WHERE Image LIKE 'prefs/userstreams/STREAM_%'"); + foreach ($stations as $station) { + logger::log("BACKEND", " Updating Image For Station ".$station['StationName']); + if (file_exists($station['Image'])) { + logger::log("BACKEND", " Image is ".$station['StationName']); + $src = get_base_url().'/'.$station['Image']; + $albumimage = new albumImage(array('artist' => "STREAM", 'album' => $station['StationName'], 'source' => $src)); + if ($albumimage->download_image()) { + // Can't call $albumimage->update_image_database because the functions that requires are in the backend + $images = $albumimage->get_images(); + sql_prepare_query(true, null, null, null, "UPDATE RadioStationtable SET Image = ? WHERE StationName = ?",$images['small'],$station['StationName']); + sql_prepare_query(true, null, null, null, "UPDATE WishlistSourcetable SET Image = ? WHERE Image = ?",$images['small'],$station['Image']); + unlink($station['Image']); + } else { + logger::warn("BACKEND", " Image Upgrade Failed!"); + } + } else { + generic_sql_query("UPDATE RadioStationtable SET IMAGE = NULL WHERE Stationindex = ".$station['Stationindex']); + } + } + break; + } +} + +function empty_modified_cache_dirs($schemaver) { + switch ($schemaver) { + case 44: + foreach(array('allmusic', 'lyrics', 'lastfm') as $d) { + rrmdir('prefs/jsoncache/'.$d); + mkdir('prefs/jsoncache/'.$d, 0755); + } + break; + } +} + +function getRemoteFilesize($url, $default) { + $def_options = stream_context_get_options(stream_context_get_default()); + stream_context_set_default(array('http' => array('method' => 'HEAD'))); + $head = array_change_key_case(get_headers($url, 1)); + // content-length of download (in bytes), read from Content-Length: field + $clen = isset($head['content-length']) ? $head['content-length'] : 0; + $cstring = $clen; + if (is_array($clen)) { + logger::log("REMOTEFILESIZE", "Content Length is an array ", $clen); + $cstring = 0; + foreach ($clen as $l) { + if ($l > $cstring) { + $cstring = $l; + } + } + } + stream_context_set_default($def_options); + if ($cstring !== 0) { + logger::log("REMOTEFILESIZE", " Read file size remotely as ".$cstring); + return $cstring; + } else { + logger::log("FUNCTIONS", " Couldn't read filesize remotely. Using default value of ".$default); + return $default; + } +} + +function rrmdir($path) { + $i = new DirectoryIterator($path); + foreach ($i as $f) { + if($f->isFile()) { + unlink($f->getRealPath()); + } else if (!$f->isDot() && $f->isDir()) { + rrmdir($f->getRealPath()); + } + } + rmdir($path); +} + +function collectionButtons() { + print ''; + +} + +function http_status_code_string($code) +{ + // Source: http://en.wikipedia.org/wiki/List_of_HTTP_status_codes + + switch( $code ) + { + // 1xx Informational + case 100: $string = 'Continue'; break; + case 101: $string = 'Switching Protocols'; break; + case 102: $string = 'Processing'; break; // WebDAV + case 122: $string = 'Request-URI too long'; break; // Microsoft + + // 2xx Success + case 200: $string = 'OK'; break; + case 201: $string = 'Created'; break; + case 202: $string = 'Accepted'; break; + case 203: $string = 'Non-Authoritative Information'; break; // HTTP/1.1 + case 204: $string = 'No Content'; break; + case 205: $string = 'Reset Content'; break; + case 206: $string = 'Partial Content'; break; + case 207: $string = 'Multi-Status'; break; // WebDAV + + // 3xx Redirection + case 300: $string = 'Multiple Choices'; break; + case 301: $string = 'Moved Permanently'; break; + case 302: $string = 'Found'; break; + case 303: $string = 'See Other'; break; //HTTP/1.1 + case 304: $string = 'Not Modified'; break; + case 305: $string = 'Use Proxy'; break; // HTTP/1.1 + case 306: $string = 'Switch Proxy'; break; // Depreciated + case 307: $string = 'Temporary Redirect'; break; // HTTP/1.1 + + // 4xx Client Error + case 400: $string = 'Bad Request'; break; + case 401: $string = 'Unauthorized'; break; + case 402: $string = 'Payment Required'; break; + case 403: $string = 'Forbidden'; break; + case 404: $string = 'Not Found'; break; + case 405: $string = 'Method Not Allowed'; break; + case 406: $string = 'Not Acceptable'; break; + case 407: $string = 'Proxy Authentication Required'; break; + case 408: $string = 'Request Timeout'; break; + case 409: $string = 'Conflict'; break; + case 410: $string = 'Gone'; break; + case 411: $string = 'Length Required'; break; + case 412: $string = 'Precondition Failed'; break; + case 413: $string = 'Request Entity Too Large'; break; + case 414: $string = 'Request-URI Too Long'; break; + case 415: $string = 'Unsupported Media Type'; break; + case 416: $string = 'Requested Range Not Satisfiable'; break; + case 417: $string = 'Expectation Failed'; break; + case 422: $string = 'Unprocessable Entity'; break; // WebDAV + case 423: $string = 'Locked'; break; // WebDAV + case 424: $string = 'Failed Dependency'; break; // WebDAV + case 425: $string = 'Unordered Collection'; break; // WebDAV + case 426: $string = 'Upgrade Required'; break; + case 449: $string = 'Retry With'; break; // Microsoft + case 450: $string = 'Blocked'; break; // Microsoft + + // 5xx Server Error + case 500: $string = 'Internal Server Error'; break; + case 501: $string = 'Not Implemented'; break; + case 502: $string = 'Bad Gateway'; break; + case 503: $string = 'Service Unavailable'; break; + case 504: $string = 'Gateway Timeout'; break; + case 505: $string = 'HTTP Version Not Supported'; break; + case 506: $string = 'Variant Also Negotiates'; break; + case 507: $string = 'Insufficient Storage'; break; // WebDAV + case 509: $string = 'Bandwidth Limit Exceeded'; break; // Apache + case 510: $string = 'Not Extended'; break; + + // Unknown code: + default: $string = 'Unknown'; break; + } + + return $string; +} + +function format_artist($artist, $empty = null) { + $a = concatenate_artist_names($artist); + if ($a != '.' && $a != "") { + return $a; + } else { + return $empty; + } +} + +function format_sortartist($tags, $return_albumartist = false) { + global $prefs; + $sortartist = null; + if ($prefs['sortbycomposer'] && $tags['Composer'] !== null) { + if ($prefs['composergenre'] && $tags['Genre'] && + checkComposerGenre($tags['Genre'], $prefs['composergenrename'])) { + $sortartist = $tags['Composer']; + } else if (!$prefs['composergenre']) { + $sortartist = $tags['Composer']; + } + } + if ($sortartist == null) { + if ($return_albumartist || $tags['AlbumArtist'] != null) { + $sortartist = $tags['AlbumArtist']; + } else if ($tags['Artist'] != null) { + $sortartist = $tags['Artist']; + } else if ($tags['station'] != null) { + $sortartist = $tags['station']; + } + } + $sortartist = concatenate_artist_names($sortartist); + //Some discogs tags have 'Various' instead of 'Various Artists' + if ($sortartist == "Various") { + $sortartist = "Various Artists"; + } + return $sortartist; +} + +function sort_playlists($a, $b) { + if ($a == "Discover Weekly (by spotify)") { + return -1; + } + if ($b == "Discover Weekly (by spotify)") { + return 1; + } + return (strtolower($a) < strtolower($b)) ? -1 : 1; +} + +?> diff --git a/www/rompr/includes/globals.js b/www/rompr/includes/globals.js new file mode 100644 index 0000000..9c3e3ad --- /dev/null +++ b/www/rompr/includes/globals.js @@ -0,0 +1,10 @@ +var sources = new Array(); +var last_selected_element = null; +var serverTimeOffset = 0; +var resizeTimer = null; +var menuOpeners = new Array(); +var menuClosers = new Array(); +const masonry_gutter = 8; +var coverscraper; +var lastfm; +var albumart_update = true; diff --git a/www/rompr/includes/globals.php b/www/rompr/includes/globals.php new file mode 100644 index 0000000..87fb404 --- /dev/null +++ b/www/rompr/includes/globals.php @@ -0,0 +1,22 @@ + diff --git a/www/rompr/includes/license.html b/www/rompr/includes/license.html new file mode 100644 index 0000000..efac406 --- /dev/null +++ b/www/rompr/includes/license.html @@ -0,0 +1,20 @@ +

      LICENSE

      +

      IMPORTANT CHANGE TO LICENSE TERMS:
      +This program is released under an alt-SpongWare license

      +The use of alt-SpongWare is entirely according to the following conditions:
      +

        +
      1. It is provided 'as is'. Nobody is responsible for anything it might or might not do.
      2. +
      3. It is provided free of charge but donations to the original developer are welcomed.
      4. +
      5. You may redistribute it but you may not, without permission of the author, distribute modified versions or provide it under any license other than this one, nor may you distribute or make available modifications to any of the component files.
      6. +
      7. You may not charge a fee or ask for any kind of remuneration nor accept any form of donation or gift in regards to distributing this software
      8. +
      9. There is no rule 6
      10. +
      11. Rule 7 is irrelevant
      12. +
      13. Adherence to 'coding standards' is to be regarded with suspicion.
      14. +
      15. If this program goes wrong in any way, for example it deletes all your data or perhaps it wipes the entire internet overnight and leaves the world a dead place, nobody is responsible. Deal with it. You use it at your own risk. As you do with, say, knives. Or cereal.
      16. +
      17. Use of any part of this software in any commercial context by any for-profit organisation without the express permission of the author is forbidden.
      18. +
      19. The use of the name RompЯ (or Rompr or RompR) or images of RompЯ in connection with any business or products, whether it be through advertising, marketing, sales literature, blog posts, website articles or any other form of media is srictly forbidden without the author's permission.
      20. +
        +AUTHOR CONTACT:
        +fatgerman@gmail.com +

        +
        \ No newline at end of file diff --git a/www/rompr/includes/podcastfunctions.php b/www/rompr/includes/podcastfunctions.php new file mode 100644 index 0000000..110c88b --- /dev/null +++ b/www/rompr/includes/podcastfunctions.php @@ -0,0 +1,1315 @@ + $url)); + if (!$d->get_data_to_string()) { + header('HTTP/1.0 404 Not Found'); + print "Feed Not Found"; + logger::fail("PARSE_RSS", " Failed to Download ".$url); + exit; + } + + // For debugging + // file_put_contents('prefs/temp/feed.xml', $d->get_data()); + + if ($id) { + if (!is_dir('prefs/podcasts/'.$id)) { + mkdir('prefs/podcasts/'.$id, 0755); + } + file_put_contents('prefs/podcasts/'.$id.'/feed.xml', $d->get_data()); + } + $feed = simplexml_load_string($d->get_data()); + + logger::trace("PARSE_RSS", " Our LastPubDate is ".$lastpubdate); + + // Begin RSS Parse + $podcast = array(); + $podcast['FeedURL'] = $url; + $domain = preg_replace('#^(http://.*?)/.*$#', '$1', $url); + $ppg = $feed->channel->children('ppg', TRUE); + $m = $feed->channel->children('itunes', TRUE); + $sy = $feed->channel->children('sy', TRUE); + + // Automatic Refresh + if ($ppg && $ppg->seriesDetails) { + switch ($ppg->seriesDetails[0]->attributes()->frequency) { + case "hourly": + $podcast['RefreshOption'] = REFRESHOPTION_HOURLY; + break; + case "daily": + $podcast['RefreshOption'] = REFRESHOPTION_DAILY; + break; + case "weekly": + $podcast['RefreshOption'] = REFRESHOPTION_WEEKLY; + break; + case "monthly": + $podcast['RefreshOption'] = REFRESHOPTION_MONTHLY; + break; + default: + $podcast['RefreshOption'] = REFRESHOPTION_NEVER; + break; + } + } else if ($sy && $sy->updatePeriod) { + switch ($sy->updatePeriod) { + case "hourly": + $podcast['RefreshOption'] = REFRESHOPTION_HOURLY; + break; + case "daily": + $podcast['RefreshOption'] = REFRESHOPTION_DAILY; + break; + case "weekly": + $podcast['RefreshOption'] = REFRESHOPTION_WEEKLY; + break; + case "monthly": + $podcast['RefreshOption'] = REFRESHOPTION_MONTHLY; + break; + default: + $podcast['RefreshOption'] = REFRESHOPTION_NEVER; + break; + } + } else { + $podcast['RefreshOption'] = $prefs['default_podcast_refresh_mode']; + } + + // Episode Expiry + if ($ppg && $ppg->seriesDetails && $ppg->seriesDetails[0]->attributes()->daysLive) { + $podcast['DaysLive'] = $ppg->seriesDetails[0]->attributes()->daysLive; + } else { + $podcast['DaysLive'] = -1; + } + + // Image + if ($feed->channel->image) { + $podcast['Image'] = html_entity_decode($feed->channel->image->url); + logger::log("PARSE_RSS", " Image is ".$podcast['Image']); + } else if ($m && $m->image) { + $podcast['Image'] = $m->image[0]->attributes()->href; + logger::log("PARSE_RSS", " Image is ".$podcast['Image']); + } else { + $podcast['Image'] = "newimages/podcast-logo.svg"; + logger::trace("PARSE_RSS", " No Image Found"); + } + if (preg_match('#^/#', $podcast['Image'])) { + // Image link with a relative URL. Duh. + $podcast['Image'] = $domain.$image; + } + + // Artist + if ($m && $m->author) { + $podcast['Artist'] = (string) $m->author; + } else { + $podcast['Artist'] = ''; + } + + logger::log("PARSE_RSS", " Artist is ".$podcast['Artist']); + + // Category + $cats = array(); + if ($m && $m->category) { + for ($i = 0; $i < count($m->category); $i++) { + $cat = html_entity_decode((string) $m->category[$i]->attributes()->text); + if (!in_array($cat, $cats)) { + $cats[] = $cat; + } + } + } + $spaz = array_diff($cats, array('Podcasts')); + natsort($spaz); + $podcast['Category'] = implode(', ', $spaz); + logger::log("PARSE_RSS", " Category is ".$podcast['Category']); + + // Title + $podcast['Title'] = (string) $feed->channel->title; + + if ($id !== false) { + $albumimage = new baseAlbumImage(array( + 'artist' => 'PODCAST', + 'albumpath' => $id, + 'album' => $podcast['Title'] + )); + if ($albumimage->get_image_if_exists() === null) { + logger::mark("PODCASTS", "Replacing missing podcast image"); + download_image($podcast['Image'], $id, $podcast['Title']); + } + } + + // Description + $podcast['Description'] = (string) $feed->channel->description; + + // Tracks + $podcast['tracks'] = array(); + $podcast['LastPubDate'] = $lastpubdate; + if ($gettracks) { + foreach($feed->channel->item as $item) { + $track = array(); + + $m = $item->children('media', TRUE); + + // Track Title + $track['Title'] = (string) $item->title; + logger::log("PARSE_RSS", " Found track ".$track['Title']); + + // Track URI + $uri = null; + if ($m && $m->content) { + foreach ($m->content as $c) { + if (preg_match('/audio/',(string) $c->attributes()->type)) { + $uri = (string) $c->attributes()->url; + break; + } + } + } + if ($item->enclosure && $uri == null) { + $uri = (string) $item->enclosure->attributes()->url; + } + if ($item->link && $uri == null) { + $uri = (string) $item->link; + } + + $track['Link'] = $uri; + logger::log("PARSE_RSS", " Track URI is ".$uri); + + if ($item->guid) { + $track['GUID'] = $item->guid; + } else { + $track['GUID'] = $uri; + } + + if ($uri == null) { + logger::fail("PARSE_RSS", " Could Not Find URI for track!"); + continue; + } + + // Track Duration + $track['Duration'] = 0; + if ($m && $m->content) { + if ($m->content[0]->attributes()->duration) { + $track['Duration'] = (string) $m->content[0]->attributes()->duration; + } + } + $m = $item->children('itunes', TRUE); + if ($track['Duration'] == 0 && $m && $m->duration) { + $track['Duration'] = (string) $m->duration; + } + if (preg_match('/:/', $track['Duration'])) { + $timesplit = explode(':', $track['Duration']); + $timefactors = array(1, 60, 3600, 86400); + $hms = array_reverse($timesplit); + $time = 0; + foreach ($hms as $s) { + $mf = array_shift($timefactors); + if (is_numeric($s)) { + $time += ($s * $mf); + } else { + logger::warn("PARSE_RSS", " Non-numeric duration field encountered in podcast! -",$track['Duration']); + $time = 0; + break; + } + } + $track['Duration'] = $time; + } + + // Track Author + if ($m && $m->author) { + $track['Artist'] = (string) $m->author; + } else { + $track['Artist'] = $podcast['Artist']; + } + + // Track Publication Date + $t = strtotime((string) $item->pubDate); + logger::log("PARSE_RSS", " Track PubDate is ",(string) $item->pubDate,"(".$t.")"); + if ($t === false) { + logger::warn("PARSE_RSS", " ERROR - Could not parse episode Publication Date",(string) $item->pubDate); + } else if ($t > $podcast['LastPubDate']) { + logger::log("PARSE_RSS", " This is a new episode"); + } + if ($t === false || $podcast['LastPubDate'] === null || $t > $podcast['LastPubDate']) { + $podcast['LastPubDate'] = $t; + } + $track['PubDate'] = $t; + if ($item->enclosure && $item->enclosure->attributes()) { + $track['FileSize'] = $item->enclosure->attributes()->length; + } else { + $track['FileSize'] = 0; + } + + if ($m && $m->summary) { + $track['Description'] = $m->summary; + } else { + $track['Description'] = $item->description; + } + + $podcast['tracks'][] = $track; + } + } + + if ($lastpubdate !== null) { + if ($podcast['LastPubDate'] !== false && $podcast['LastPubDate'] == $lastpubdate) { + logger::mark("PARSE_RSS", "Podcast has not been updated since last refresh"); + return false; + } + } + + return $podcast; + +} + +function getNewPodcast($url, $subbed = 1, $gettracks = true) { + global $mysqlc, $prefs; + logger::mark("PODCASTS", "Getting podcast",$url); + $newpodid = null; + $podcast = parse_rss_feed($url, false, null, $gettracks); + $r = check_if_podcast_is_subscribed(array( 'feedUrl' => $podcast['FeedURL'], + 'collectionName' => $podcast['Title'], + 'artistName' => $podcast['Artist'])); + if (count($r) > 0) { + foreach ($r as $a) { + logger::fail("PODCASTS", " Already subscribed to podcast",$a['Title']); + } + header('HTTP/1.0 404 Not Found'); + print 'You are already to subscrtibed to '.$podcast['Title']; + exit(0); + } + logger::mark("PODCASTS", "Adding New Podcast",$podcast['Title']); + + $lastupdate = calculate_best_update_time($podcast); + + if (sql_prepare_query(true, null, null, null, + "INSERT INTO Podcasttable + (FeedURL, LastUpdate, Image, Title, Artist, RefreshOption, SortMode, DisplayMode, DaysLive, Description, Version, Subscribed, LastPubDate, Category) + VALUES + (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", + $podcast['FeedURL'], + calculate_best_update_time($podcast), + $podcast['Image'], + $podcast['Title'], + $podcast['Artist'], + $podcast['RefreshOption'], + $prefs['default_podcast_sort_mode'], + $prefs['default_podcast_display_mode'], + $podcast['DaysLive'], + $podcast['Description'], + ROMPR_PODCAST_TABLE_VERSION, + $subbed, + $podcast['LastPubDate'], + $podcast['Category'])) + { + $newpodid = $mysqlc->lastInsertId(); + if (is_dir('prefs/podcasts/'.$newpodid)) { + rrmdir('prefs/podcasts/'.$newpodid); + } + mkdir('prefs/podcasts/'.$newpodid, 0755); + download_image($podcast['Image'], $newpodid, $podcast['Title']); + if ($subbed == 1) { + foreach ($podcast['tracks'] as $track) { + if (sql_prepare_query(true, null, null, null, + "INSERT INTO PodcastTracktable + (PODindex, Title, Artist, Duration, PubDate, FileSize, Description, Link, Guid, New) + VALUES + (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", + $newpodid, $track['Title'], $track['Artist'], $track['Duration'], $track['PubDate'], + $track['FileSize'], $track['Description'], $track['Link'], $track['GUID'], 1)) + { + logger::log("PODCASTS", " Added Track ".$track['Title']); + } else { + logger::fail("PODCASTS", " FAILED Adding Track ".$track['Title']); + } + } + } + } + return $newpodid; +} + +function calculate_best_update_time($podcast) { + + // Note: this returns a value for LastUpdate, since that is what refresh is based on. + // The purpose of this is try to get the refresh in sync with the podcast's publication date. + + if ($podcast['LastPubDate'] === null) { + logger::log("PODCASTS", $podcast['Title'],"last pub date is null"); + return time(); + } + switch ($podcast['RefreshOption']) { + case REFRESHOPTION_NEVER: + case REFRESHOPTION_HOURLY: + case REFRESHOPTION_DAILY: + return time(); + break; + + } + logger::log("PODCASTS", "Working out best update time for ".$podcast['Title']); + $dt = new DateTime(date('c', $podcast['LastPubDate'])); + logger::log("PODCASTS", " Last Pub Date is ".$podcast['LastPubDate'].' ('.$dt->format('c').')'); + logger::log("PODCASTS", " Podcast Refresh interval is ".$podcast['RefreshOption']); + while ($dt->getTimestamp() < time()) { + switch ($podcast['RefreshOption']) { + + case REFRESHOPTION_WEEKLY: + $dt->modify('+1 week'); + break; + + case REFRESHOPTION_MONTHLY: + $dt->modify('+1 month'); + break; + + default: + logger::error("PODCASTS", " Unknown refresh option",$podcast['RefreshOption'],"for podcast ID",$podcast['podid']); + return time(); + break; + } + + } + logger::log("PODCASTS", " Worked out update time based on pubDate and RefreshOption: ".$dt->format('r').' ('.$dt->getTImestamp().')'); + logger::log("PODCASTS", " Give it an hour's grace"); + $dt->modify('+1 hour'); + + switch ($podcast['RefreshOption']) { + + case REFRESHOPTION_WEEKLY: + $dt->modify('-1 week'); + break; + + case REFRESHOPTION_MONTHLY: + $dt->modify('-1 month'); + break; + + } + + logger::log("PODCASTS", " Therefore setting lastupdate to: ".$dt->format('r').' ('.$dt->getTImestamp().')'); + + return $dt->getTimestamp(); + +} + +function download_image($url, $podid, $title) { + + $albumimage = new albumImage(array( + 'artist' => 'PODCAST', + 'albumpath' => $podid, + 'album' => $title, + 'source' => $url + )); + if ($albumimage->get_image_if_exists() === null) { + $albumimage->download_image(); + $albumimage->update_image_database(); + } + +} + +function check_podcast_upgrade($podetails, $podid, $podcast) { + if ($podetails->Version < ROMPR_PODCAST_TABLE_VERSION) { + if ($podcast === false) { + logger::blurt("PODCASTS", "Podcast needs to be upgraded, must re-parse the feed"); + $podcast = parse_rss_feed($podetails->FeedURL, $podid, null); + } + upgrade_podcast($podid, $podetails, $podcast); + } +} + +function refreshPodcast($podid) { + global $prefs; + check_refresh_pid(); + logger::shout("PODCASTS", "---------------------------------------------------"); + logger::shout("PODCASTS", "Refreshing podcast ",$podid); + $result = generic_sql_query("SELECT * FROM Podcasttable WHERE PODindex = ".$podid, false, PDO::FETCH_OBJ); + if (count($result) > 0) { + $podetails = $result[0]; + logger::log("PODCASTS", " Podcast title is ".$podetails->Title); + } else { + logger::error("PODCASTS", "ERROR Looking up podcast ".$podid); + return $podid; + } + $podcast = parse_rss_feed($podetails->FeedURL, $podid, $podetails->LastPubDate); + if ($podetails->Subscribed == 1 && $prefs['podcast_mark_new_as_unlistened']) { + generic_sql_query("UPDATE PodcastTracktable SET New = 0 WHERE PODindex = ".$podetails->PODindex); + } + if ($podcast === false) { + check_podcast_upgrade($podetails, $podid, $podcast); + // Podcast pubDate has not changed, hence we didn't re-parse the feed. + // Still calculate the best next update time + sql_prepare_query(true, null, null, null, "UPDATE Podcasttable SET LastUpdate = ? WHERE PODindex = ?", + calculate_best_update_time( + array( + 'LastPubDate' => $podetails->LastPubDate, + 'RefreshOption' => $podetails->RefreshOption, + 'Title' => $podetails->Title + ) + ), + $podid); + // Still check to keep (days to keep still needs to be honoured) + if (check_tokeep($podetails, $podid) || $prefs['podcast_mark_new_as_unlistened']) { + return $podid; + } else { + return false; + } + } + check_podcast_upgrade($podetails, $podid, $podcast); + if ($podetails->Subscribed == 0) { + sql_prepare_query(true, null, null, null, "UPDATE Podcasttable SET Description = ?, DaysLive = ?, RefreshOption = ?, LastUpdate = ?, LastPubDate = ? WHERE PODindex = ?", + $podcast['Description'], + $podcast['DaysLive'], + $podcast['RefreshOption'], + calculate_best_update_time($podcast), + $podcast['LastPubDate'], + $podid); + sql_prepare_query(true, null, null, null, "UPDATE PodcastTracktable SET New=?, JustUpdated=?, Listened = 0 WHERE PODindex=?", 1, 0, $podid); + } else { + sql_prepare_query(true, null, null, null, "UPDATE PodcastTracktable SET New=?, JustUpdated=? WHERE PODindex=?", 0, 0, $podid); + sql_prepare_query(true, null, null, null, "UPDATE Podcasttable SET Description=?, LastUpdate=?, DaysLive=?, LastPubDate=? WHERE PODindex=?", + $podcast['Description'], + calculate_best_update_time($podcast), + $podcast['DaysLive'], + $podcast['LastPubDate'], + $podid); + } + download_image($podcast['Image'], $podid, $podetails->Title); + foreach ($podcast['tracks'] as $track) { + $trackid = sql_prepare_query(false, null, 'PODTrackindex' , null, "SELECT PODTrackindex FROM PodcastTracktable WHERE Guid=? AND PODindex = ?", $track['GUID'], $podid); + if ($trackid !== null) { + logger::trace("PODCASTS", " Found existing track ".$track['Title']); + sql_prepare_query(true, null, null, null, "UPDATE PodcastTracktable SET JustUpdated=?, Duration=?, Link=? WHERE PODTrackindex=?",1,$track['Duration'], $track['Link'], $trackid); + } else { + if (sql_prepare_query(true, null, null, null, + "INSERT INTO PodcastTracktable + (JustUpdated, PODindex, Title, Artist, Duration, PubDate, FileSize, Description, Link, Guid, New) + VALUES + (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", + 1, $podid, $track['Title'], $track['Artist'], $track['Duration'], $track['PubDate'], + $track['FileSize'], $track['Description'], $track['Link'], $track['GUID'], 1)) + { + logger::log("PODCASTS", " Added Track ".$track['Title']); + } else { + logger::fail("PODCASTS", " FAILED Adding Track ".$track['Title']); + } + } + } + check_tokeep($podetails, $podid); + clear_refresh_pid(); + return $podid; +} + +function check_tokeep($podetails, $podid) { + $retval = false; + // Remove tracks that are no longer in the feed and haven't been downloaded + if ($podetails->Subscribed == 1) { + sql_prepare_query(true, null, null, null, "DELETE FROM PodcastTracktable WHERE PODindex=? AND JustUpdated=? AND Downloaded=?",$podid, 0, 0); + + // Remove tracks that have been around longer than DaysToKeep - honoring KeepDownloaded + if ($podetails->DaysToKeep > 0) { + $oldesttime = time() - ($podetails->DaysToKeep * 86400); + $numthen = simple_query("COUNT(PODTrackindex)", "PodcastTracktable", 'Deleted = 0 AND PODindex', $podid, 0); + $qstring = "UPDATE PodcastTracktable SET Deleted=1 WHERE PODindex = ".$podid." AND PubDate < ".$oldesttime." AND Deleted = 0"; + if ($podetails->KeepDownloaded == 1) { + $qstring .= " AND Downloaded = 0"; + } + generic_sql_query($qstring, true); + $numnow = simple_query("COUNT(PODTrackindex)", "PodcastTracktable", 'Deleted = 0 AND PODindex', $podid, 0); + if ($numnow != $numthen) { + logger::log("PODCASTS", " Old episodes were removed from podcast ID ".$podid); + $retval = true; + } + } + + // Remove tracks where there are more than NumToKeep - honoring KeepDownloaded + if ($podetails->NumToKeep > 0) { + $getrid = 0; + $qstring = "SELECT COUNT(PODTrackindex) AS num FROM PodcastTracktable WHERE PODindex=".$podid." AND Deleted = 0"; + if ($podetails->KeepDownloaded == 1) { + $qstring .= " AND Downloaded = 0"; + } + $num = generic_sql_query($qstring, false, null, 'num', 0); + $getrid = $num - $podetails->NumToKeep; + logger::log("PODCASTS", " Num To Keep is ".$podetails->NumToKeep." and there are ".$num." episodes that can be pruned. Removing ".$getrid); + if ($getrid > 0) { + $qstring = "SELECT PODTrackindex FROM PodcastTracktable WHERE PODindex=".$podid." AND Deleted = 0"; + if ($podetails->KeepDownloaded == 1) { + $qstring .= " AND Downloaded=0"; + } + $qstring .= " ORDER BY PubDate ASC LIMIT ".$getrid; + $pods = sql_get_column($qstring, 0); + foreach ($pods as $i) { + logger::trace("PODCASTS", " Removing Track ".$i); + generic_sql_query("UPDATE PodcastTracktable SET Deleted=1 WHERE PODTrackindex=".$i, true); + $retval = true; + } + } + } + } + return $retval; +} + +function upgrade_podcast($podid, $podetails, $podcast) { + $v = $podetails->Version; + while ($v < ROMPR_PODCAST_TABLE_VERSION) { + switch ($v) { + case 1: + logger::mark("PODCASTS", "Updating Podcast ".$podetails->Title." to version 2"); + foreach ($podcast['tracks'] as $track) { + $t = sql_prepare_query(false, PDO::FETCH_OBJ, null, null, "SELECT * FROM PodcastTracktable WHERE Link=? OR OrigLink=?", $track['Link'], $track['Link']); + foreach($t as $result) { + logger::log("PODCASTS", " Updating Track ".$result->Title); + logger::trace("PODCASTS", " GUID is ".$track['GUID']); + $dlfilename = null; + if ($result->Downloaded == 1) { + $dlfilename = basename($result->Link); + logger::log("PODCASTS", " Track has been downloaded to ".$dlfilename); + } + sql_prepare_query(true, null, null, null, "UPDATE PodcastTracktable SET Link = ?, Guid = ?, Localfilename = ?, OrigLink = NULL WHERE PODTrackindex = ?", $track['Link'], $track['GUID'], $dlfilename, $result->PODTrackindex); + } + } + generic_sql_query("UPDATE Podcasttable SET Version = 2 WHERE PODindex = ".$podid, true); + $v++; + break; + + case 2: + // This will have been done by the function below + $v++; + break; + + case 3: + logger::mark("PODCASTS", "Updating Podcast ".$podetails->Title." to version 4"); + sql_prepare_query(true, null, null, null, "UPDATE Podcasttable SET Version = ?, Category = ? WHERE PODindex = ?", 4, $podcast['Category'], $podid); + $v++; + break; + + } + } +} + +function upgrade_podcasts_to_version() { + $pods = generic_sql_query('SELECT * FROM Podcasttable WHERE Subscribed = 1 AND Version < '.ROMPR_PODCAST_TABLE_VERSION); + foreach ($pods as $podcast) { + $v = $podcast['Version']; + while ($v < ROMPR_PODCAST_TABLE_VERSION) { + switch ($v) { + case 2; + logger::mark("PODCASTS", " Updating Podcast ".$podcast['Title']." to version 3"); + $newest_track = generic_sql_query("SELECT PubDate FROM PodcastTracktable WHERE PODindex = ".$podcast['PODindex']." ORDER BY PubDate DESC LIMIT 1"); + $podcast['LastPubDate'] = $newest_track[0]['PubDate']; + logger::log("PODCASTS", " Last episode for this podcast was published on ".date('c', $podcast['LastPubDate'])); + switch($podcast['RefreshOption']) { + case REFRESHOPTION_WEEKLY: + case REFRESHOPTION_MONTHLY: + $podcast['LastUpdate'] = calculate_best_update_time($podcast); + break; + } + generic_sql_query("UPDATE Podcasttable SET LastUpdate = ".$podcast['LastUpdate'].", LastPubDate = ".$podcast['LastPubDate'].", Version = 3 WHERE PODindex = ".$podcast['PODindex']); + $v++; + break; + + case 3; + // Upgrade to version 4 can only happen after feed has been re-parsed + $v++; + break; + } + } + } +} + +function outputPodcast($podid, $do_searchbox = true) { + $result = generic_sql_query("SELECT * FROM Podcasttable WHERE PODindex = ".$podid, false, PDO::FETCH_OBJ); + foreach ($result as $obj) { + doPodcast($obj, $do_searchbox); + } +} + +function doPodcast($y, $do_searchbox) { + + if ($y->Subscribed == 0) { + logger::mark("PODCASTS", "Getting feed for unsubscribed podcast ".$y->FeedURL); + refreshPodcast($y->PODindex); + $a = generic_sql_query("SELECT * FROM Podcasttable WHERE PODindex = ".$y->PODindex, false, PDO::FETCH_OBJ); + if (count($a) > 0) { + $y = $a[0]; + } else { + logger::fail("PODCASTS", "ERROR looking up podcast",$y->FeedURL); + return; + } + } + + $aa = $y->Artist; + if ($aa != '') { + $aa = $aa . ' - '; + } + $pm = $y->PODindex; + trackControlHeader('','','podcast_'. $pm,array(array('Image' => $y->Image))); + print '
        '.format_text($y->Description).'
        '; + if ($y->Subscribed == 1) { + print '
        '; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print '
        '; + print ''; + print '
        '; + + print '
        + '; +include("includes/podcasts.php"); +?> +
      + +
      +
      + +
      +
      + + '; + +if ($prefs['player_backend'] == "mopidy") { + print '
      Music From Your Collection
      '; +} +?> +
      + + +Music From Spotify
      '; +} +?> +
      + +Music From Everywhere'; + print '
      Play From These Sources:
      '; +} +?> +
      + +
      + + + +
      + +

      '.get_int_text('label_emptyinfo').'

      '; +?> +
      +
      + + +
      + +
      + +
      +
      +
      '.get_int_text("lastfm_addtagslabel"); +?> +
      + +
      diff --git a/www/rompr/skins/desktop/skin.requires b/www/rompr/skins/desktop/skin.requires new file mode 100644 index 0000000..83ad392 --- /dev/null +++ b/www/rompr/skins/desktop/skin.requires @@ -0,0 +1,5 @@ +jquery/jquery.hotkeys.js +jquery/jquery.mCustomScrollbar.concat.min-3.1.5.js +ui/hotkeys.js +css/jquery.mCustomScrollbar.css +css/tipTip.css diff --git a/www/rompr/skins/desktop/skinvars.php b/www/rompr/skins/desktop/skinvars.php new file mode 100644 index 0000000..71dce08 --- /dev/null +++ b/www/rompr/skins/desktop/skinvars.php @@ -0,0 +1,6 @@ + diff --git a/www/rompr/skins/desktop/ui_elements.php b/www/rompr/skins/desktop/ui_elements.php new file mode 100644 index 0000000..01420cd --- /dev/null +++ b/www/rompr/skins/desktop/ui_elements.php @@ -0,0 +1,3 @@ + diff --git a/www/rompr/skins/fruit/skin.css b/www/rompr/skins/fruit/skin.css new file mode 100644 index 0000000..e2e631c --- /dev/null +++ b/www/rompr/skins/fruit/skin.css @@ -0,0 +1,622 @@ +/* +===================================================================== += Specific Elements By ID +===================================================================== +*/ + +#infobar { + width:100%; + padding-top:4px; + margin:0px; +} + +#progress { + font-size:4px; + width: 100%; +} + +#playbackTime { + font-weight:bold; + font-size:11px; + padding-top:1px; + height:15px; + line-height:15px; + text-align:center; + width:100%; + height:15px; +} + +#albumcover { + margin:0px; + z-index:500; +} + +#upcoming { + max-width:35%; + min-width:20%; + height:100%; + overflow:hidden; + font-size:90%; +} + +#uptrackcount, #uptimecount { + font-weight:bold; +} + +#upcontents { + line-height:110%; +} + +#albumpicture { + width: auto; +} + +.timebox { + min-width: 4em; + font-size:9pt; + font-weight:bold; + line-height:100%; +} + +.tboxl { + text-align:left; +} + +.tboxr { + text-align:right; +} + +#nowplaying { + font-size:8pt; + padding-top:0px; + padding-bottom:0px; + height:60px; + width:100%; + overflow:hidden; + box-sizing:border-box; + border-right:4px solid transparent; + border-left:4px solid transparent; +} + +#patrickmoore { + box-shadow: none !important; +} + +#firefoxisshitwrapper { + overflow:hidden; +} + +#nptext { + width:auto; + overflow:hidden; +} + +#gronky { + margin-left:8px; + margin-right:8px; + font-size:8pt; +} + +#amontobin { + padding-top:4px; +} + +#infopane { + height:100%; + overflow:auto; + position:relative; + display:block; +} + +#dbtags { + overflow:hidden; + opacity:0.9; + font-size:8pt; + height:22px; + line-height:22px; +} + +#tagadder { + width:400px; + padding-right:8px; + padding-bottom:4px; +} + +#playcount { + overflow:hidden; + opacity:0.9; + font-size:8pt; + height:22px; + line-height:22px; +} + +#lastfm { + float:left; + margin-left:4px; + padding-top:1px; +} + +#lastfm img { + margin-right:2px; + margin-left:2px; +} + +#headerbar { + padding:0px; + margin:0px; + width:100%; + height:36px; +} + +#bottompage { + width:100%; +} + +#sources { + height:100%; + overflow:auto; +} + +#volumecontrol { + width:14px; + margin-left:0px; + margin-right:0px; + font-size:8px; +} + +#notifications { + position:absolute; + width:50%; + max-width:500px; + padding:8px; + top:0px; + display:none; + z-index:2000; + left: 0; + right: 0; + margin: 0 auto; +} + +#keybindtable { + margin-bottom:1em; +} + +#outputbox { + max-width:20%; +} + +#mobileplaylistcontrols +{ + display:none; +} + +#plmode { + font-size:8pt; + height:22px; + line-height:22px; +} + +#audiobooks .podcastresume>.fixed +{ + padding-left: 24px; +} + +#audiobooks .podcastresume>.expand +{ + margin-right: 4px; +} + +#flowcontrols { + height: 36px; +} + +#flowcontrols i { + max-height: 24px; + margin-top:4px; +} + +/* +===================================================================== += General Classes +===================================================================== +*/ + +.infobarlayout { + margin-left:6px; + margin-right:6px; + margin-top:0px; + margin-bottom:0px; + padding-top:0px; + padding-bottom:2px; + padding-left:0px; + padding-right:0px; + height:90px; +} + +.infobarnoheight { + margin-left:6px; + margin-right:6px; + margin-top:2px; + margin-bottom:2px; + padding-top:0px; + padding-left:0px; + padding-right:0px; +} + +.nopadright { + margin-right:0px !important; +} + +.tinycover +{ + margin-right:8px; + width:28px; + height:auto; +} + +.controlbutton-left +{ + margin-right:6px; + margin-left:6px; +} + +.topstats { + float:left; + margin-right:8px; + margin-top:1px; +} + + +.tagremover { + margin-left:0.5em; +} + + +.clicktext { + font-size:7pt; + font-weight:bold; +} + +.topimg { + margin-right:4px; + margin-left:4px; + margin-bottom:2px; + cursor: pointer; + vertical-align:middle; +} + +.smallcover { + transition: width 0.5s ease; + max-width:300px; +} + +.dropmenu { + padding-left:16px; +} + +.npicon { + padding:0px; + margin-top:0px; + margin-left:0px; + margin-bottom:0px; + margin-right:4px; + height:20px; + width:20px; + vertical-align:middle; +} + +.playlisticon { + padding:0px; + margin-right:4px; + margin-bottom:2px; + margin-top:2px; + vertical-align:middle; + height: 12px; + width: 12px; +} + +.collectionicon { + padding:0px; + margin-right:4px; + margin-bottom:2px; + margin-top:2px; + vertical-align:middle; + width:16px; + height:16px; +} + +.playlisticonr { + padding:0px; + margin-left:4px; + margin-right:2px; + margin-bottom:2px; + margin-top:2px; + vertical-align:middle; + height: 12px; + width: 12px; +} + +.rating-icon-big { + height: 20px; + width: 100px; + cursor: pointer; + vertical-align:middle; +} + +.rating-icon-small { + height: 14px; + width: 70px; + cursor: pointer; + vertical-align:middle; +} + +.headercontainer { + height:90%; + box-sizing:border-box; +} + +.background-left { + background-position: left !important; + max-height: 24px; +} + +#sourcescontrols i, #chooserbuttons i { + max-width: 24px; +} + +i.topdrop +{ + position: relative; + font-style: normal; +} + +.dragmenu { + cursor:move; +} + +.menuitem { + font-weight:bold; + margin:0px; + padding-left:8px; + padding-right:0px; + padding-top:2px; + padding-bottom:2px; + -webkit-box-align:center; + align-items: center; +} + +.prearranger { + display:none; +} + +.playlistitem.menuitem { + align-items: inherit !important; +} + +.playlistalbum { + font-weight:bold; + margin:0px; + padding-left:4px; + padding-right:0px; + padding-top:4px; + padding-bottom:2px; + -webkit-box-align:stretch; + align-items: stretch; +} + +.mh { + margin-right:6px; + display:block; + margin-top:2px; + margin-bottom:2px; +} + +.menu { + width:14px; + height: 14px; + vertical-align:middle; + cursor:pointer; +} + +.ninesix { + font-size:96%; + padding-top:2px; +} + +.indent { + margin-left:16px; +} + +.padright { + padding-right:4px; +} + +.buttonchange { + text-align:center; +} + +.outhack { + width:14px; + height:14px; + margin-top:2px; +} + +.cshrinker { + max-width:400px; +} + +.smallpluginicon { + padding:0px; + margin-right:4px; + margin-bottom:2px; + margin-top:1px; + vertical-align:middle; +} + +/* +===================================================================== += Info Panel - General +===================================================================== +*/ + +.info-box-fixed { + -webkit-box-flex:0; + flex-grow: 0; + flex-shrink:0; +} + +.info-border-right { + border-right: 1px solid #454545; + padding-right:1em; + max-width:240px; +} + +.info-box-expand { + -webkit-box-flex:1.0; + flex-grow: 1; + flex-shrink: 1; + flex-basis: auto; + +} + +.info-detail-layout { + margin-top:8px; +} + +.cleft { + border-left: 1px solid #454545; + padding-left:1em; + margin-left:1em; +} + +/* +===================================================================== += Dropdown Menus +===================================================================== +*/ + +div.normalmenu +{ + width:25vw; + max-width:360px; + min-width:240px; +} + +div.widemenu +{ + width:40vw; + max-width:640px; + min-width:400px; +} + +div.leftmenu +{ + top: 30px; + left: 0px; +} + +div.rightmenu +{ + top:30px; + right:-12px; +} + +/* +===================================================================== += Podcasts +===================================================================== +*/ + +.podicon { + padding:0px; + margin:2px; + height:16px; + width:16px; + vertical-align:middle; +} + +/* +===================================================================== += Responsive Layout +===================================================================== +*/ + +@media screen and (max-width: 480px) { + #notifications { + width: 90% !important; + } +} + +@media screen and (max-height: 1099px) { + .infobarlayout { + height:140px; + } + #albumcover { + height: 162px; + } + #albumpicture { + height: 158px; + padding: 2px; + } + #nowplaying { + height: 110px; + } + + .controlbutton-small + { + width:24px !important; + height:24px !important; + margin-top:6px !important; + margin-left:4px !important; + } + + .controlbutton-main + { + width:32px !important; + height:32px !important; + margin-top:6px !important; + } + + .smallpluginicon + { + height: 20px !important; + width: 18px !important; + } +} + +@media screen and (min-height: 1100px) { + .infobarlayout { + height:160px; + } + #albumcover { + height: 182px; + } + #albumpicture { + height: 178px; + padding: 2px; + } + #nowplaying { + height: 130px; + } + .controlbutton-small + { + width:28px !important; + height:28px !important; + margin-top:6px !important; + margin-left:4px !important; + } + + .controlbutton-main + { + width:36px !important; + height:36px !important; + margin-top:6px !important; + } + + .smallpluginicon + { + height: 24px !important; + width: 18px !important; + } +} + diff --git a/www/rompr/skins/fruit/skin.js b/www/rompr/skins/fruit/skin.js new file mode 100644 index 0000000..c5d2bb3 --- /dev/null +++ b/www/rompr/skins/fruit/skin.js @@ -0,0 +1,526 @@ + +jQuery.fn.animatePanel = function(options) { + var settings = $.extend({},options); + var panel = this.attr("id"); + var opanel = panel; + panel = panel.replace(/controls/,''); + if (settings[panel] > 0 && this.is(':hidden')) { + this.show(); + } + this.animate({width: settings[panel]+"%"}, + { + duration: settings.speed[panel], + always: function() { + if (settings[panel] == 0) { + $(this).hide(); + } else { + if (opanel == "infopane") browser.rePoint(); + if (opanel.match(/controls/)) { + var i = (prefs.sourceshidden) ? "icon-angle-double-right" : "icon-angle-double-left"; + $("#expandleft").removeClass("icon-angle-double-right icon-angle-double-left").addClass(i); + } + } + } + } + ); +} + +function showHistory() { + +} + +var layoutProcessor = function() { + + function showPanel(source) { + $('#'+source).fadeIn('fast'); + } + + function flashTrack(uri, album) { + infobar.markCurrentTrack(); + var thing = uri ? uri : album; + $('[name="'+thing+'"]').makeFlasher({flashtime: 0.5, repeats: 5}); + // The timeout is so that markCurrentTrack doesn't fuck it up - these often + // have CSS transitions that affect the scrollbar size + setTimeout(function() { + layoutProcessor.scrollCollectionTo($('[name="'+thing+'"]')); + }, 1000); + } + + function setBottomPanelWidths() { + var widths = getPanelWidths(); + $("#sources").css("width", widths.sources+"%"); + $("#sourcescontrols").css("width", widths.sources+"%"); + $("#infopane").css("width", widths.infopane+"%"); + $("#infopanecontrols").css("width", widths.infopane+"%"); + } + + function getPanelWidths() { + var sourcesweight = (prefs.sourceshidden) ? 0 : 1; + var browserweight = (prefs.hidebrowser) ? 0 : 1; + var sourceswidth = prefs.sourceswidthpercent*sourcesweight; + var browserwidth = (100 - sourceswidth)*browserweight; + if (browserwidth < 0) browserwidth = 0; + return ({infopane: browserwidth, sources: sourceswidth}); + } + + function animatePanels() { + var widths = getPanelWidths(); + widths.speed = { sources: 400, infopane: 400 }; + $("#sources").animatePanel(widths); + $("#sourcescontrols").animatePanel(widths); + $("#infopane").animatePanel(widths); + $("#infopanecontrols").animatePanel(widths); + } + + var my_scrollers = [ "#sources", "#infopane", ".topdropmenu", ".drop-box" ]; + var rtime = ''; + var ptime = ''; + var headers = Array(); + var currheader = 0; + var headertimer; + + return { + + supportsDragDrop: true, + hasCustomScrollbars: true, + usesKeyboard: true, + sortFaveRadios: true, + openOnImage: false, + + changeCollectionSortMode: function() { + collectionHelper.forceCollectionReload(); + }, + + postAlbumActions: function() { + + }, + + afterHistory: function() { + setTimeout(function() { $("#infopane").mCustomScrollbar("scrollTo",0) }, 500); + }, + + addInfoSource: function(name, obj) { + $("#chooserbuttons").append($('', { + onclick: "browser.switchsource('"+name+"')", + title: language.gettext(obj.text), + class: obj.icon+' topimg sep expand tooltip', + id: "button_source"+name + })); + }, + + setupInfoButtons: function() { + $("#button_source"+prefs.infosource).addClass("currentbun"); + }, + + goToBrowserPanel: function(panel) { + $("#infopane").mCustomScrollbar('update'); + $("#infopane").mCustomScrollbar("scrollTo","#"+panel+"information"); + }, + + goToBrowserPlugin: function(panel) { + setTimeout( function() { layoutProcessor.goToBrowserPanel(panel) }, 1000); + }, + + goToBrowserSection: function(section) { + $("#infopane").mCustomScrollbar("scrollTo",section); + }, + + notifyAddTracks: function() { + if (!playlist.radioManager.isRunning()) { + clearTimeout(headertimer); + $('#plmode').fadeOut(500, function() { + $('#plmode').html(language.gettext('label_addingtracks')).fadeIn(500); + }); + } + }, + + toggleAudioOutpts: function() { + prefs.save({outputsvisible: !$('#outputbox').is(':visible')}); + $("#outputbox").animate({width: 'toggle'},'fast',function() { + infobar.biggerize(); + }); + }, + + setTagAdderPosition: function(position) { + $("#tagadder").css({top: Math.min(position.y+8, $(window).height() - $('#tagadder').height()), + left: Math.min($(window).width() - $('#tagadder').width(), position.x-16)}); + }, + + setPlaylistHeight: function() { + $('#phacker').fanoogleMenus(); + }, + + playlistControlHotKey: function(button) { + if (!$("#playlistbuttons").is(':visible')) { + togglePlaylistButtons() + } + $("#"+button).tirgger('click'); + }, + + updateInfopaneScrollbars: function() { + $('#infopane').mCustomScrollbar('update'); + }, + + playlistLoading: function() { + infobar.smartradio(language.gettext('label_smartsetup')); + }, + + scrollPlaylistToCurrentTrack: function() { + if (prefs.scrolltocurrent) { + var scrollto = playlist.getCurrentTrackElement();; + if (scrollto.length > 0) { + debug.log("LAYOUT","Scrolling Playlist To Song:",player.status.songid); + $('#phacker').mCustomScrollbar("stop"); + $('#phacker').mCustomScrollbar("update"); + var pospixels = Math.round(scrollto.position().top - ($("#sortable").parent().parent().height()/2)); + pospixels = Math.min($("#sortable").parent().height(), Math.max(pospixels, 0)); + $('#phacker').mCustomScrollbar( + "scrollTo", + pospixels, + { scrollInertia: 0 } + ); + } + } + }, + + preHorse: function() { + + }, + + hideBrowser: function() { + + }, + + addCustomScrollBar: function(value) { + $(value).mCustomScrollbar({ + theme: "light-thick", + scrollInertia: 300, + contentTouchScroll: 25, + mouseWheel: { + scrollAmount: parseInt(prefs.wheelscrollspeed), + }, + alwaysShowScrollbar: 1, + advanced: { + updateOnContentResize: true, + updateOnImageLoad: false, + autoScrollOnFocus: false, + autoUpdateTimeout: 500, + } + }); + }, + + scrollCollectionTo: function(jq) { + if (jq) { + debug.log("LAYOUT","Scrolling Collection To",jq, jq.position().top,$("#collection").parent().parent().parent().height()/2); + var pospixels = Math.round(jq.position().top - + $("#collection").parent().parent().parent().height()/2); + debug.log("LAYOUT","Scrolling Collection To",pospixels); + $("#sources").mCustomScrollbar('update').mCustomScrollbar('scrollTo', pospixels, + { scrollInertia: 1000, + scrollEasing: 'easeOut' } + ); + } else { + debug.log("LAYOUT","Was asked to scroll collection to something non-existent",2); + } + }, + + expandInfo: function(side) { + switch(side) { + case "left": + var p = !prefs.sourceshidden; + prefs.save({sourceshidden: p}); + break; + } + animatePanels(); + return false; + }, + + sourceControl: function(source) { + if ($('#'+source).length == 0) { + prefs.save({chooser: 'albumlist'}); + source = 'albumlist'; + } + if (source != prefs.chooser) { + $('#'+prefs.chooser).fadeOut('fast', function() { + showPanel(source); + prefs.save({chooser: source}); + }); + } else { + showPanel(source); + } + return false; + }, + + adjustLayout: function() { + var ws = getWindowSize(); + // Height of the bottom pane (chooser, info, playlist container) + var newheight = ws.y - $("#bottompage").offset().top; + $("#bottompage").css("height", newheight+"px"); + var newwidth = ws.x - $('#infobar').offset().left; + $('#infobar').css('width', newwidth+'px'); + infobar.biggerize(); + browser.rePoint(); + $('.topdropmenu').fanoogleMenus(); + }, + + displayCollectionInsert: function(details) { + + debug.log("COLLECTION","Displaying New Insert",details); + layoutProcessor.sourceControl('albumlist'); + if (prefs.sortcollectionby == "artist" && $('i[name="aartist'+details.artistindex+'"]').isClosed()) { + debug.log("COLLECTION","Opening Menu","aartist"+details.artistindex); + doAlbumMenu(null, $('i[name="aartist'+details.artistindex+'"]'), function() { + if ($('i[name="aalbum'+details.albumindex+'"]').isClosed()) { + debug.log("COLLECTION","Opening Menu","aalbum"+details.albumindex); + doAlbumMenu(null, $('i[name="aalbum'+details.albumindex+'"]'), function() { + flashTrack(details.trackuri, 'aalbum'+details.albumindex); + }); + } else { + flashTrack(details.trackuri, 'aalbum'+details.albumindex); + } + }); + } else if ($('i[name="aalbum'+details.albumindex+'"]').isClosed()) { + debug.log("COLLECTION","Opening Menu","aalbum"+details.albumindex); + doAlbumMenu(null, $('i[name="aalbum'+details.albumindex+'"]'), function() { + flashTrack(details.trackuri,'aalbum'+details.albumindex); + }); + } else { + flashTrack(details.trackuri,'aalbum'+details.albumindex); + } + }, + + playlistupdate: function(upcoming) { + var time = 0; + for(var i in upcoming) { + time += upcoming[i].duration; + } + if (time > 0) { + headers['upcoming'] = "Up Next : "+upcoming.length+" tracks, "+formatTimeString(time); + } else { + headers['upcoming'] = ''; + } + layoutProcessor.doFancyHeaderStuff(); + }, + + doFancyHeaderStuff: function() { + clearTimeout(headertimer); + var lines = Array(); + for (var i in headers) { + if (headers[i] != '') { + lines.push(headers[i]); + } + } + if (lines.length == 0 && $('#plmode').html() != '') { + $('#plmode').fadeOut(500, function() { + $('#plmode').html('').fadeIn(500); + }); + } else if (lines.length == 1 && $('#plmode').html() != lines[0]) { + $('#plmode').fadeOut(500, function() { + $('#plmode').html(lines[0]).fadeIn(500); + }); + } else { + currheader++; + if (currheader >= lines.length) { + currheader = 0; + } + if ($('#plmode').html() != lines[currheader]) { + $('#plmode').fadeOut(500, function() { + $('#plmode').html(lines[currheader]).fadeIn(500, function() { + headertimer = setTimeout(layoutProcessor.doFancyHeaderStuff, 5000); + }); + }); + } else { + headertimer = setTimeout(layoutProcessor.doFancyHeaderStuff, 5000); + } + } + }, + + setProgressTime: function(stats) { + if (stats !== null) { + rtime = stats.remainString; + ptime = stats.durationString; + $("#playposss").html(stats.progressString); + } + if (prefs.displayremainingtime) { + $("#tracktimess").html(rtime); + } else { + $("#tracktimess").html(ptime); + } + }, + + toggleRemainTime: function() { + prefs.save({displayremainingtime: !prefs.displayremainingtime}); + layoutProcessor.setProgressTime(null); + }, + + setRadioModeHeader: function(html) { + if (html != headers['radiomode']) { + headers['radiomode'] = html; + layoutProcessor.doFancyHeaderStuff(); + } + }, + + postAlbumMenu: function(element) { + debug.trace("SKIN","Post Album Menu Thing",element.next()); + if (element.next().hasClass('smallcover')) { + var imgsrc = element.next().children('img').attr('src'); + var aa = new albumart_translator(imgsrc); + if (element.isClosed()) { + if (imgsrc) { + element.next().children('img').attr('src', aa.getSize('small')); + } + element.next().css('width','50%'); + element.next().css('width',''); + element.next().children('img').css('width', ''); + } else { + if (imgsrc) { + element.next().children('img').attr('src', aa.getSize('medium')); + } + element.next().css('width','50%'); + element.next().children('img').css('width', '100%'); + } + } + }, + + makeCollectionDropMenu: function(element, name) { + var x = $('#'+name); + // If the dropdown doesn't exist then create it + if (x.length == 0) { + if (element.parent().hasClass('album1')) { + var c = 'dropmenu notfilled album1'; + } else if (element.parent().hasClass('album2')) { + var c = 'dropmenu notfilled album2'; + } else { + var c = 'dropmenu notfilled'; + } + var t = $('
      ', {id: name, class: c}).insertAfter(element.parent()); + } + }, + + getArtistDestinationDiv: function(menutoopen) { + if (prefs.sortcollectionby == "artist") { + return $("#"+menutoopen).parent(); + } else { + return $("#"+menutoopen); + } + }, + + initialise: function() { + if (prefs.outputsvisible) { + layoutProcessor.toggleAudioOutpts(); + } + $("#sortable").disableSelection(); + setDraggable('#collection'); + setDraggable('#filecollection'); + setDraggable('#searchresultholder'); + setDraggable("#podcastslist"); + setDraggable("#audiobooks"); + setDraggable("#somafmlist"); + setDraggable("#communityradiolist"); + setDraggable("#icecastlist"); + setDraggable("#tuneinlist"); + setDraggable('#artistinformation'); + setDraggable('#albuminformation'); + setDraggable('#storedplaylists'); + + $("#sortable").acceptDroppedTracks({ + scroll: true, + scrollparent: '#phacker' + }); + $("#sortable").sortableTrackList({ + items: '.sortable', + outsidedrop: playlist.dragstopped, + insidedrop: playlist.dragstopped, + scroll: true, + scrollparent: '#phacker', + scrollspeed: 80, + scrollzone: 120 + }); + + $("#pscroller").acceptDroppedTracks({ + ondrop: playlist.draggedToEmpty, + coveredby: '#sortable' + }); + + animatePanels(); + + $(".topdropmenu").floatingMenu({ + handleClass: 'dragmenu', + addClassTo: 'configtitle', + siblings: '.topdropmenu' + }); + + $("#tagadder").floatingMenu({ + handleClass: 'configtitle', + handleshow: false + }); + + $(".stayopen").not('.dontstealmyclicks').on('click', function(ev) {ev.stopPropagation() }); + + // $(".enter").on('keyup', onKeyUp ); + $.each(my_scrollers, + function( index, value ) { + layoutProcessor.addCustomScrollBar(value); + }); + + $("#sources").find('.mCSB_draggerRail').resizeHandle({ + adjusticons: ['#sourcescontrols', '#infopanecontrols'], + side: 'left', + donefunc: setBottomPanelWidths + }); + + shortcuts.load(); + $("#collectionsearcher input").on('keyup', function(event) { + if (event.keyCode == 13) { + player.controller.search('search'); + } + } ); + setControlClicks(); + $('.choose_albumlist').on('click', function(){layoutProcessor.sourceControl('albumlist')}); + $('.choose_searcher').on('click', function(){layoutProcessor.sourceControl('searcher')}); + $('.choose_filelist').on('click', function(){layoutProcessor.sourceControl('filelist')}); + $('.choose_radiolist').on('click', function(){layoutProcessor.sourceControl('radiolist')}); + $('.choose_podcastslist').on('click', function(){layoutProcessor.sourceControl('podcastslist')}); + $('.choose_audiobooklist').on('click', function(){layoutProcessor.sourceControl('audiobooklist')}); + $('.choose_playlistslist').on('click', function(){layoutProcessor.sourceControl('playlistslist')}); + $('.choose_pluginplaylistslist').on('click', function(){layoutProcessor.sourceControl('pluginplaylistslist')}); + $('.open_albumart').on('click', openAlbumArtManager); + $("#ratingimage").on('click', nowplaying.setRating); + $('.icon-rss.npicon').on('click', function(){podcasts.doPodcast('nppodiput')}); + $('#expandleft').on('click', function(){layoutProcessor.expandInfo('left')}); + $('.clear_playlist').on('click', playlist.clear); + $("#playlistname").parent().next('button').on('click', player.controller.savePlaylist); + + document.body.addEventListener('drop', function(e) { + e.preventDefault(); + }, false); + $('#albumcover').on('dragenter', infobar.albumImage.dragEnter); + $('#albumcover').on('dragover', infobar.albumImage.dragOver); + $('#albumcover').on('dragleave', infobar.albumImage.dragLeave); + $("#albumcover").on('drop', infobar.albumImage.handleDrop); + $("#tracktimess").on('click', layoutProcessor.toggleRemainTime); + $(document).on('mouseenter', '.clearbox', makeHoverWork); + $(document).on('mouseleave', '.clearbox', makeHoverWork); + $(document).on('mousemove', '.clearbox', makeHoverWork); + $(document).on('mouseenter', '.combobox-entry', makeHoverWork); + $(document).on('mouseleave', '.combobox-entry', makeHoverWork); + $(document).on('mousemove', '.combobox-entry', makeHoverWork); + $(document).on('mouseenter', '.tooltip', makeToolTip); + $(document).on('mouseleave', '.tooltip', stopToolTip); + $('#plmode').detach().appendTo('#amontobin').addClass('tright'); + $('#volume').volumeControl({ + orientation: 'vertical', + command: player.controller.volume + }); + }, + + createPluginHolder: function(icon, title, id, panel) { + var d = $('
      ', {class: 'topdrop'}).prependTo('#righthandtop'); + var i = $('', {class: 'tooltip', title: title, id: id}).appendTo(d); + i.addClass(icon); + i.addClass('smallpluginicon clickicon'); + return d; + } + + } +}(); diff --git a/www/rompr/skins/fruit/skin.php b/www/rompr/skins/fruit/skin.php new file mode 100644 index 0000000..99df884 --- /dev/null +++ b/www/rompr/skins/fruit/skin.php @@ -0,0 +1,322 @@ + + + + +
      + +
      +
      +
      + +
      +
      +
      +'; + print ''; + print ''; + print ''; + print ''; +?> +
      + +
      +
      +
      +
      +
      +
      +
      + + + +
      + + +
      + +
      +
      +
      +
      +'; +?> +
      +'.get_int_text('button_saveplaylist').'
      '; + print '
      +
      + +
      '; + print ' +
      '; +?> +
      +
      +
      '; + print '
      '; +?> +
      + +
      +
      + +
      +
      +
      Play Queue
      + +
      +
      + +
      +
      +
      +
      '; + include('player/mpd/outputs.php'); + if (count($outputdata) == 1) { + // There's only one output so we'll treat it like a Mute button + print '
      '; + $f = ($outputdata[0]['outputname'] == "Mute") ? 0 : 1; + $c = ($outputdata[0]['outputenabled'] == $f) ? 'icon-output' : 'icon-output-mute'; + print ''; + print '
      '; + } else { + print '
      '; + print ''; + print '
      '; + } + +?> +
      +
      + + 1) { + print ''; + } + +?> + +
      +
      +
      +
      +
      + + + + +
      + +
      +'; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +?> +
      +
      + +
      +'; + ?> + +
      +'; +?> +
      +
      +
      + +'; +?> +
      +
      +
      + + +'; +print ''; +?> +
      + +
      + +
      + +
      + + '; + collectionButtons(); +?> +
      +
      + + + +
      +
      + + +
      +
      + + + + + + '; +include("includes/podcasts.php"); +?> + + +
      + + +
      + + + '; + +if ($prefs['player_backend'] == "mopidy") { + print '
      Music From Your Collection
      '; +} +?> +
      + + +Music From Spotify'; +} +?> +
      + +Music From Everywhere'; + print '
      Play From These Sources:
      '; +} +?> +
      + +
      +
      + + + +
      + +

      '. + get_int_text('label_emptyinfo').'

      '; +?> +
      +
      + + + + +
      +
      +
      '.get_int_text("lastfm_addtagslabel"); +?> +
      + +
      diff --git a/www/rompr/skins/fruit/skin.requires b/www/rompr/skins/fruit/skin.requires new file mode 100755 index 0000000..83ad392 --- /dev/null +++ b/www/rompr/skins/fruit/skin.requires @@ -0,0 +1,5 @@ +jquery/jquery.hotkeys.js +jquery/jquery.mCustomScrollbar.concat.min-3.1.5.js +ui/hotkeys.js +css/jquery.mCustomScrollbar.css +css/tipTip.css diff --git a/www/rompr/skins/fruit/skinvars.php b/www/rompr/skins/fruit/skinvars.php new file mode 100755 index 0000000..71dce08 --- /dev/null +++ b/www/rompr/skins/fruit/skinvars.php @@ -0,0 +1,6 @@ + diff --git a/www/rompr/skins/fruit/ui_elements.php b/www/rompr/skins/fruit/ui_elements.php new file mode 100644 index 0000000..01420cd --- /dev/null +++ b/www/rompr/skins/fruit/ui_elements.php @@ -0,0 +1,3 @@ + diff --git a/www/rompr/skins/phone/skin.css b/www/rompr/skins/phone/skin.css new file mode 100644 index 0000000..05fd5e2 --- /dev/null +++ b/www/rompr/skins/phone/skin.css @@ -0,0 +1,1160 @@ +/* +===================================================================== += Standard HTML Elements +===================================================================== +*/ + +h1 { + font-size:130%; +} + +h2 { + font-size:120%; +} + +select { + width:100%; + height:3em; +} + +.selectholder { + height:3em; +} + +input[type="text"] { + height:3em; +} + +div { + box-sizing: border-box; +} + +/* +===================================================================== += Specific Elements By ID +===================================================================== +*/ + +#pscroller { + overflow-y:scroll; + -webkit-overflow-scrolling: touch; +} + +#headerbar { + height:40px; + padding:0px; + margin:0px; + border:none; +} + +#loadsawrappers { + /* Tried to use this, but safari on my iPhone S sets 100vh as 320px when the browser reports + it as 300px, even in full-screen mode. This is definitely a bug, but what can ya do? */ + /* Note this includes 40px for headerbar. Keep them synced */ + /* height: calc(100vh - 40px); */ + width: 100%; + overflow:hidden; +} + +#albumpicture { + object-fit:contain; +} + +#historypanel, #tagadder { + overflow-y: auto !important; +} + +#volume { + width:95%; +} + +#volumecontrol { + height:2em; +} + +#infobar { + overflow-x:hidden; + overflow-y:hidden; +} + +#playbackTime { + font-weight:bold; + font-size:8px; + padding-top:1px; + height:11px; + line-height:11px; + text-align:center; + width:100%; +} + +#buttons { + padding-left:0px !important; + padding-right:0px !important; + padding-top:2px !important; + padding-bottom:0px !important; + text-align:center; +} + +#amontobin { + overflow:hidden; +} + +#nowplaying { + /* white-space:nowrap; */ + margin:auto; + padding:4px; +} + +#nptext { + text-align:center; +} + +#lastfm, #addtoplaylist, #ptagadd, #subscribe { + float:right; + margin-left:6px; + margin-right:6px; + line-height:34px; + height:34px; +} + +.playspan { + margin-right: 1em; +} + +#dbtags { + clear: both; + margin-top:4px; + padding-top:0px; + overflow:hidden; + opacity:0.9; + font-size:8pt; + line-height:12pt; +} + +#scrobwrangler { + font-size:8pt; + width:90%; +} + +#stars { + margin-top:0px; + margin-right:2px; + padding-top:0px; + margin-left:6px; +} + +#controls { + padding-top:1px; +} + +#notifications { + position:absolute; + width:100%; + padding:4px; + bottom:0px; + left:0px; + display:none; + font-size:8pt; + font-weight:bold; + z-index:10010; +} + +#chooserbuttons +{ + padding-top:4px; +} + +#sourcescontrols +{ + width:100%; +} + +#tagadder +{ + z-index: 15000; +} + +#audiobooks .podcastresume>.fixed +{ + padding-left: 32px; +} + +#audiobooks .podcastresume>.expand +{ + margin-right: 4px; +} + +#audiobooks .podcastresume +{ + border-top: none !important; +} + +#flowcontrols { + height: 36px; +} + +#flowcontrols i { + max-height: 24px; + margin-top:4px; +} + +#toomanywrappers { + height: 100%; + width: 100%; +} + + +/* +===================================================================== += General Classes +===================================================================== +*/ + +div.topdropmenu { + z-index:10009; + box-sizing:border-box; + width:100%; + position:fixed; + right: 0; +} + +.mainpane { + position: relative; + top: 0; + left: 0; +} + +.chooser { + margin-left:auto; + margin-right:auto; + font-weight:bold; + font-size:130%; + padding-bottom:1em; + text-align:center; + cursor:pointer; +} + +.topdrop +{ + float: none !important; +} + +.pref { + margin-left:8px; + margin-bottom:12px; +} + +.topimg { + margin-right:4px; + margin-left:4px; + margin-bottom:2px; + margin-top:4px; + cursor: pointer; +} + +.topdropmenu .topimg { + width:36px; + height:36px; +} + +#narrowscreenicons { + padding-right: 24px; +} + +.topimg.infoclick { + box-sizing: border-box; + border: 6px solid transparent; +} + +.mobonly { + display:inline-block; +} + +.tagremover { + margin-left:0.5em; +} + +.menuitem { + font-weight:bold; + margin:0px; + padding-left:4px; + padding-right:0px; + padding-top:6px; + padding-bottom:6px; + -webkit-box-align:center; + align-items: center; +} + +.playlistalbum { + font-weight:bold; + margin:0px; + padding-left:4px; + padding-right:0px; + padding-top:6px; + padding-bottom:6px; + -webkit-box-align:stretch; + align-items: stretch; +} + +.menu { + cursor:pointer; +} + +.dropmenu { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + overflow-y: scroll; + z-index: 10000; + padding-bottom:0px; +} + +.popupcontents { + margin: 0px; +} + +.popupcontents>div { + padding: 8px; +} + +.dropmenu .menuitem { + margin-top: 4px; +} + +.menuspacer { + width:1.5em; + height:1.5em; +} + +.mh { + display:block; + padding:8px; + margin-top:2px; + margin-bottom:2px; + margin-right:1em; +} + +.ninesix { + font-size:96%; + padding-top:4px; + padding-bottom:4px; +} + +div.normalmenu { + width:52px; +} + +div.rightmenu { + top:38px; + right:0px; +} + +.infobarlayout { + height:70px; +} + +.playlistrow2 { + font-size:80%; +} + +.clrbth { + clear:both; + display:table; + margin-top:8px; +} + +.scroller { + -webkit-overflow-scrolling:touch; + overflow-y:scroll; + overflow-x:hidden; +} + +.progressbar_v { + height:100%; + width:2em; + margin-right:auto; + margin-left:auto; +} + +.infobox { + float:none; + clear:both; + margin-left:auto !important; + margin-right:auto !important; + width:90% !important; +} + +.infobox_v3 { + float:none; + clear:both; + margin-left:auto !important; + margin-right:auto !important; + width:90% !important; +} + +.thumb { + float:none !important; + margin-left: 0px !important; + margin-right: 0px !important; +} + +.content img { + max-width: 100% !important; + height: auto !important; +} + +.thumbinner +{ + margin-left:auto; + margin-right:auto; +} + +.info-box-fixed { + padding-left: 1em; +} + +.podicon { + margin-top:4px; + margin-bottom:4px; + margin-left:4px; + margin-right:4px; + height:36px; + width:36px; + vertical-align:middle; + box-sizing:border-box; + border:8px solid transparent; +} + +.combo-button { + box-sizing: border-box; + border: 4px solid transparent; +} + +.backhi { + padding-left:2px; + padding-right:2px; + padding-top:6px; + padding-bottom:6px; +} + +#fruitbat .indent.dropmenu.padright { + padding-left: 0px; + padding-right: 0px; +} + +#fruitbat .indent.dropmenu.padright>div { + padding-left: 8px; + width:100%; + padding-right:8px; +} + +.playlisticon +{ + padding:0px; + margin-right:4px; + margin-bottom:2px; + margin-top:2px; + vertical-align:middle; + box-sizing:border-box; + border:6px solid transparent; + height: 26px; + width: 26px; +} + +[class^="icon-"].menu, [class*=" icon-"].menu { + width: 24px; + height: 24px; + box-sizing: border-box; + border: 6px solid transparent; + vertical-align:middle; +} + +.collectionicon { + padding:0px; + margin-right:4px; + margin-bottom:2px; + margin-top:2px; + vertical-align:middle; + width:20px; + height:20px +} + +.playlisticonr { + padding:0px; + margin-left:4px; + margin-bottom:2px; + margin-top:2px; + margin-right:2px; + vertical-align:middle; + box-sizing:border-box; + border:8px solid transparent; + width:32px; + height:32px; +} + +#sortable { + position: relative; + top: 0; + left: 0; +} + +#sortable .trackgroup { + position: relative; + top: 0; + left: 0; +} + +#sortable .item { + position: relative; + top: 0; + left: 0; +} + +#sortable .trackgroup .track { + position: relative; + top: 0; + left: 0; +} + +#sortable .playlisticonr.icon-cancel-circled { + /* display: none; */ +} + +.prearranger { + display:none; +} + +#sortable .playlisticonr { + margin-right:4px; + width: 40px; +} + +#collection .playlisticonr { + margin-right:4px; + width: 48px; +} + +#sortable .track>div>div.clickable { + margin-right: 8px; +} + +.npicon { + padding-top:0px; + padding-left:0px; + padding-right:0px; + padding-bottom:4px; + margin-top:0px; + margin-left:0px; + margin-bottom:0px; + margin-right:0px; + height:26px; + width:26px; + vertical-align:middle; +} + +.rating-icon-big { + height: 34px; + width: 140px; + line-height:1em; + padding-bottom:4px; + cursor: pointer; + vertical-align:middle; +} + +.rating-icon-small { + height: 14px; + width: 70px; + cursor: pointer; + vertical-align:middle; + +} + +.sptext { + white-space:nowrap; + padding-right:4px; + text-align:right; + margin-right:24px; +} + +#ratingimage { + padding-bottom:0px; +} + +.trackgroup { + white-space:normal; +} + +.dropdown-button { + margin-left:-20px !important; +} + +.padright { + padding-right:4px; +} + +.whatdoicallthis { + margin-bottom: 8px; +} + +.podhackshit { + margin-bottom:2em; +} + +@media screen and (orientation: landscape) { + .cshrinker { + max-height: calc(100vh - 40px); + width: auto; + } +} + +@media screen and (orientation: portrait) { + .cshrinker { + max-width:100%; + height: auto; + } +} + +.pleft +{ + padding-left:8px; +} + +.pright +{ + box-sizing:border-box; + padding-right:8px; +} + +.mobmenu +{ + position:absolute; + top:4px; + left:4px; + width:95%; + max-height:95%; + box-sizing:border-box; + padding:8px; + overflow-y:scroll !important; +} + +.setupdiv +{ + width:100%; + box-sizing:border-box; +} + +.backmenu +{ + box-sizing: border-box; + height: 2.5em; + border-left: 4px solid transparent; + padding-left: 38px; + padding-right: 8px; + width: 100%; + text-align:right; +} + +@-webkit-keyframes clickflash { + 0%{ + background-color: rgba(255,255,255,0.7); + } + 50%{ + background-color: rgba(255,255,255,0.3); + } + 100%{ + background-color: rgba(255,255,255,0); + } +} +@-moz-keyframes clickflash { + 0%{ + background-color: rgba(255,255,255,0.7); + } + 50%{ + background-color: rgba(255,255,255,0.3); + } + 100%{ + background-color: rgba(255,255,255,0); + } +} +@keyframes clickflash { + 0%{ + background-color: rgba(255,255,255,0.7); + } + 50%{ + background-color: rgba(255,255,255,0.3); + } + 100%{ + background-color: rgba(255,255,255,0); + } +} + +.clickflash { + animation: clickflash 0.75s linear 1; +} + +.album-menu-header { + width:100%; + text-align:center; +} + +.album-play-controls { + margin-bottom:4px; + padding-bottom:4px; +} + +.album_menu_image { + max-width: 100%; + height: auto; + max-height: 60vh; +} + +.calign { + align-items: center; +} + +.indent { + padding-left: 4px; + box-szing:border-box; +} + +img.jalopy200 { + max-width:140px; +} + +.headercontainer { + height:90%; + box-sizing: border-box; +} + +.buttonbar { + height: 42px; +} + +.onlyverywide { + padding-left:8px; + padding-right:8px; + box-sizing:border-box; +} + +.info-box-expand { + -webkit-box-flex:1.0; + flex-grow: 1; + flex-shrink: 1; + flex-basis: auto; +} + +/* +===================================================================== += Responsive Layout - General +===================================================================== +*/ + +@media screen and (max-width: 420px) { + .notnarrow.snapclienthost { + display: none; + } +} + +@media screen and (max-width: 640px) { + .info-detail-layout { + -webkit-box-orient:vertical; + flex-direction: column; + } + .info-box-expand.stumpy { + padding-left:0px; + } + .info-box-fixed.info-border-right { + padding-left:0px; + } + .info-box-expand.info-border-right { + margin-bottom:1em; + padding-bottom:0.5em; + } +} + +@media screen and (min-width: 641px) { + .cleft.narrowright { + margin-left:1em; + } +} + +@media screen and (max-width: 540px) { + .onlywide { + display:none !important; + } +} + +@media screen and (min-width: 541px) { + .onlynarrow { + display:none !important; + } +} + +@media screen and (max-width: 799px) { + .onlyverywide { + display: none; + } +} + +@media screen and (max-width: 540px) { + .stleft + { + float:none; + width:auto; + max-width:95%; + clear:both; + border-right:none !important; + border-bottom: 1px solid #dddddd !important; + } +} + +/* +===================================================================== += Responsive Layout - Portrait, playlist on separate panel +===================================================================== +*/ + +@media screen and (max-height: 699px) and (orientation: portrait) { + + #playlistm { + width:100%; + height:100%; + } + + .mainpane { + width: 100%; + height: 100%; + } + + #albumcover { + text-align: center; + overflow:hidden; + } + + #albumpicture { + width: 85%; + max-width: 60vh; + } + + #dbtags { + float: left; + margin-left:6px; + margin-right:6px; + } + + #stars { + float:left; + } + +} + +/* == Tweaks for specific sizes */ + +@media screen and (max-height: 480px) and (orientation: portrait) { + /* iPhone 4 screen height */ + #albumpicture { + max-width:50vh; + } +} + +@media screen and (max-width: 360px) and (max-height: 699px) and (orientation: portrait) { + #albumpicture { + width:98%; + } +} + +@media screen and (min-height: 640px) and (max-height: 699px) and (orientation: portrait) { + #albumpicture { + width: 98%; + } +} + +/* +===================================================================== += Responsive Layout - Portrait, playlist on now playing screen += Changes at 700px high +===================================================================== +*/ + +@media screen and (min-height: 700px) and (orientation: portrait) { + + .mainpane { + width: 100%; + height: 100%; + } + + #infobar { + height: 50%; + width: 100%; + } + + #toomanywrappers { + overflow: hidden; + } + + #playlistm { + height:50%; + width:100%; + } + + .choose_playlist { +/* This is here so the layoutProcessor knows we're in tall portrait mode + and it should choose infobar instead */ + font-weight:900; + } + +} + +@media screen and (min-height: 700px) and (max-width: 420px) and (orientation: portrait) { + /* Narrow screens - nowplaying under album picture */ + #albumcover { + text-align: center; + overflow:hidden; + } + + #albumpicture { + width: 85%; + max-width: 22vh; + height: auto; + } + + #dbtags { + float: left; + margin-left:6px; + margin-right:6px; + } + + #stars { + float:left; + } +} + +@media screen and (min-height: 700px) and (min-width: 421px) and (orientation: portrait) { + /* Wider screens - nowplaying next to album picture */ + #albumcover { + float: left; + height:100%; + } + + #albumpicture { + height: 100%; + width: auto; + margin-right:8px; + } + + #nowplaying { + padding-right: 8px; + } + + #nptext { + text-align:right; + } + + #amontobin { + text-align: right; + } + + #lastfm, #addtoplaylist, #ptagadd, #subscribe { + margin-bottom: 4px; + } + +} + +/* +===================================================================== += Responsive Layout - Landscape, playlist on separate panel += Essentially the same as portrait with min-height 700 and min-width 421 +===================================================================== +*/ + +@media screen and (max-width:639px) and (orientation: landscape) { + + .mainpane { + width: 100%; + height: 100%; + } + + #albumpicture { + height: 100%; + width: auto; + margin-right:8px; + } + + #playlistm { + width: 100%; + height: 100%; + } + + #albumcover { + float: left; + height:100%; + } + + #nowplaying { + padding-right: 8px; + } + + #amontobin { + text-align: right; + } + + #lastfm, #addtoplaylist, #ptagadd, #subscribe, #stars { + margin-bottom: 8px; + } + + #stars { + float: right; + } +} + +/* +===================================================================== += Responsive Layout - Landscape, chooser next to nowplaying += Switches at 640px wide +===================================================================== +*/ + +@media screen and (min-width:640px) and (orientation: landscape) { + .mainpane { + width: 50%; + float:left; + height: 100%; + } + + #playlistm { + width: 50%; + float:left; + height: 100%; + } + + #infobar { + display:block; + } + + #infopane { + width:100%; + } +} + +/* 3 Modes for info pane to make best use of available space */ + +@media screen and (min-width:640px) and (orientation: landscape) { + /* Standard - info pane looks like small portrait mode */ + #albumcover { + text-align: center; + overflow:hidden; + } + + #albumpicture { + width: 85%; + max-width: 40vh; + } + + #dbtags { + float: left; + margin-left:6px; + margin-right:6px; + } + + #stars { + float:left; + } +} + +@media screen and (min-width:810px) and (max-height: 540px) and (orientation: landscape) { + /* Wider - info pane looks like wide portrait mode up to 540px high*/ + /* ie nowplaying is next to album image - can't have album image very big + with a screen of this height so there's loads of wasted space to the sides */ + #albumcover { + float: left; + height:100%; + } + + #albumpicture { + height: 100%; + width: auto; + margin-right:8px; + max-width:60vh; + } + + #nowplaying { + padding-right: 8px; + } + + #nptext { + text-align:right; + } + + #amontobin { + text-align: right; + } + + #lastfm, #addtoplaylist, #ptagadd, #subscribe { + margin-bottom: 4px; + } + + #stars, #dbtags { + float: none; + } + +} + +@media screen and (min-width:640px) and (min-height: 541px) and (orientation: landscape) { + /* at 540 px high it reverts to being like small portrait mode */ + #albumpicture { + max-width:60vh + } +} + +@media screen and (min-width:1024px) and (min-height: 768px) and (orientation: landscape) { + /* Big screens - combination of everything - nowplaying and playlist together, chooser on right hand side */ + #infobar { + height: 50%; + } + + #albumcover { + float: left; + height:100%; + } + + #albumpicture { + height: 100%; + width: auto; + margin-right:8px; + } + + #nowplaying { + padding-right: 8px; + } + + #nptext { + text-align:right; + } + + #amontobin { + text-align: right; + } + + #lastfm, #addtoplaylist, #ptagadd, #subscribe { + margin-bottom: 4px; + } + + #stars, #dbtags { + float: none; + } + + .choose_playlist { +/* This is here so the layoutProcessor knows we're in tall portrait mode + and it should choose infobar instead */ + font-weight:1000; + } + + #playlistm { + position: absolute; + height: calc(50% - 20px); + top: calc(50% + 20px); + } + +} diff --git a/www/rompr/skins/phone/skin.js b/www/rompr/skins/phone/skin.js new file mode 100644 index 0000000..d10a3e1 --- /dev/null +++ b/www/rompr/skins/phone/skin.js @@ -0,0 +1,772 @@ +jQuery.fn.menuReveal = function(callback) { + debug.log("UI", "Revealing",$(this).attr('id')); + var self = this; + if (this.hasClass('toggledown')) { + if (callback) { + this.slideToggle('fast',callback); + } else { + this.slideToggle('fast'); + } + } else { + this.findParentScroller().saveScrollPos(); + this.show(0, function() { + var i = self.find('.album_menu_image'); + if (i.length > 0) { + i.attr('src', i.attr('asrc')); + } + if (callback) { + callback(); + } + }); + } + return this; +} + +jQuery.fn.menuHide = function(callback) { + debug.log("UI", "Hiding",$(this).attr('id')); + var self = this; + if (this.hasClass('toggledown')) { + if (callback) { + this.slideToggle('fast',callback); + } else { + this.slideToggle('fast'); + } + } else { + this.hide(0, function() { + if (callback) { + callback(); + } + self.findParentScroller().restoreScrollPos(); + if (self.hasClass('removeable')) { + self.remove(); + } else { + debug.log("UI", "Hiding Image",$(this).attr('id')); + var i = self.find('.album_menu_image'); + i.removeAttr('src'); + } + }); + } + return this; +} + +jQuery.fn.isOpen = function() { + if (this.hasClass('backmenu') || $('#'+this.attr('name')).is(':visible')) { + return true; + } else { + return false; + } +} + +jQuery.fn.isClosed = function() { + if (this.hasClass('backmenu') || $('#'+this.attr('name')).is(':visible')) { + return false; + } else { + return true; + } +} + +jQuery.fn.makeSpinner = function() { + if (this.hasClass('icon-toggle-closed') || + this.hasClass('icon-toggle-open') || + this.hasClass('podicon')) { + return this.each(function() { + var originalclasses = new Array(); + var classes = ''; + if ($(this).attr("class")) { + var classes = $(this).attr("class").split(/\s/); + } + for (var i = 0, len = classes.length; i < len; i++) { + if (classes[i] == "invisible" || (/^icon/.test(classes[i]))) { + originalclasses.push(classes[i]); + $(this).removeClass(classes[i]); + } + } + $(this).attr("originalclass", originalclasses.join(" ")); + $(this).addClass('icon-spin6 spinner'); + }); + } else { + this.addClass('clickflash'); + return this; + } +} + +jQuery.fn.stopSpinner = function() { + if (this.hasClass('spinner')) { + this.each(function() { + $(this).removeClass('icon-spin6 spinner'); + if ($(this).attr("originalclass")) { + $(this).addClass($(this).attr("originalclass")); + $(this).removeAttr("originalclass"); + } + }); + } else { + this.removeClass('clickflash'); + } + return this; +} + +jQuery.fn.findParentScroller = function() { + var parentScroller = this.parent(); + while (!parentScroller.hasClass('scroller') && !parentScroller.hasClass('dropmenu') && !parentScroller.hasClass('phone')) { + parentScroller = parentScroller.parent(); + } + return parentScroller; +} + +jQuery.fn.saveScrollPos = function() { + this.prepend(''); + this.scrollTo(0); + this.css('overflow-y', 'hidden'); +} + +jQuery.fn.restoreScrollPos = function() { + var a = this.find('input[name="restorescrollpos"]'); + this.css('overflow-y', 'scroll'); + this.scrollTop(a.val()); + a.remove(); +} + +jQuery.fn.makeTagMenu = function(options) { + var settings = $.extend({ + textboxname: "", + textboxextraclass: "", + labelhtml: "", + populatefunction: null, + buttontext: null, + buttonfunc: null, + buttonclass: "" + },options); + + this.each(function() { + var tbc = "enter"; + if (settings.textboxextraclass) { + tbc = tbc + " "+settings.textboxextraclass; + } + if ($(this).is('td')) { + $(this).prev().html(settings.labelhtml); + var wrapper = $('
      ', {class: 'containerbox dropdown-container'}).appendTo($(this)); + var holder = $('
      ', { class: "expand"}).appendTo(wrapper); + var dropbutton = $('', { class: 'fixed combo-button'}).appendTo(wrapper); + var textbox = $('', { type: "text", class: tbc, name: settings.textboxname }).appendTo(holder); + var dropbox = $('
      ', {class: "drop-box tagmenu dropshadow"}).appendTo($(this)); + } else { + $(this).append(settings.labelhtml); + var holder = $('
      ', { class: "expand"}).appendTo($(this)); + var dropbutton = $('', { class: 'fixed combo-button'}).appendTo($(this)); + var textbox = $('', { type: "text", class: tbc, name: settings.textboxname }).appendTo(holder); + var dropbox = $('
      ', {class: "drop-box tagmenu dropshadow"}).insertAfter($(this)); + } + var menucontents = $('
      ', {class: "tagmenu-contents"}).appendTo(dropbox); + if (settings.buttontext !== null) { + var submitbutton = $('
      +
      + +
      + + + +'; + collectionButtons(); +?> +
      +
      +
      + + +
      +
      + + +
      +
      + +'; +?> +
      +
      +
      + + + +
      + +'; +include("includes/podcasts.php"); +?> + + + +
      + + + +'; +?> +Music From Your Collection'; +} +?> +
      + +Music From Spotify'; +} +?> +
      + +Music From Everywhere'; + print '
      Play From These Sources:
      '; +} +?> +
      +
      + + + +'; +?> + + '; +?> + +
      +
      +
      +
      +
      + + + +
      + +
      + + + +
      +
      +
      '.get_int_text("lastfm_addtagslabel"); +?> +
      + +
      + +
      + '.get_int_text('button_addtoplaylist').'
      '; + ?> +
      +
      + + diff --git a/www/rompr/skins/phone/skin.requires b/www/rompr/skins/phone/skin.requires new file mode 100644 index 0000000..7b2a23a --- /dev/null +++ b/www/rompr/skins/phone/skin.requires @@ -0,0 +1 @@ +jquery/jquery.scrollTo.min.js diff --git a/www/rompr/skins/phone/skinvars.php b/www/rompr/skins/phone/skinvars.php new file mode 100644 index 0000000..0d2243f --- /dev/null +++ b/www/rompr/skins/phone/skinvars.php @@ -0,0 +1,6 @@ + diff --git a/www/rompr/skins/phone/ui_elements.php b/www/rompr/skins/phone/ui_elements.php new file mode 100644 index 0000000..be22e51 --- /dev/null +++ b/www/rompr/skins/phone/ui_elements.php @@ -0,0 +1,233 @@ +'; + } else if ($data['uri'] == null) { + print '
      '; + } else { + print '
      '; + } + + // Track Number + if ($data['trackno'] && $data['trackno'] != "" && $data['trackno'] > 0) { + print '
      99 || $data['trackno'] > 99) { + print ' style="width:3em"'; + } + print '>'.$data['trackno'].'
      '; + } + + print domainIcon($d, 'collectionicon'); + + // Track Title, Artist, and Rating + if ((string) $data['title'] == "") $data['title'] = urldecode($data['uri']); + print '
      '; + print '
      '.$data['title'].'
      '; + if ($data['artist'] && $data['trackartistindex'] != $data['albumartistindex']) { + print '
      '.$data['artist'].'
      '; + } + if ($data['rating']) { + print '
      '; + print ''; + print '
      '; + } + if ($data['tags']) { + print '
      '; + print ''.$data['tags']; + print '
      '; + } + print '
      '; + + // Track Duration + print '
      '; + if ($data['time'] > 0) { + print format_time($data['time']); + } + print '
      '; + + // Delete Button + if ($data['lm'] === null) { + print ''; + } + + print '
      '; + + if ($data['progress'] > 0) { + print ''; + print ''; + } + + return 0; +} + +function artistHeader($id, $name) { + global $divtype; + $h = ''; + return $h; +} + +function noAlbumsHeader() { + print '
      '. + get_int_text("label_noalbums").'
      '; +} + +function albumHeader($obj) { + global $prefs; + $h = ''; + if ($obj['id'] == 'nodrop') { + // Hacky at the moment, we only use nodrop for streams but here there is no checking + // because I'm lazy. + $h .= ''; + return $h; +} + +function albumControlHeader($fragment, $why, $what, $who, $artist) { + if ($fragment || $who == 'root') { + return ''; + } + $html = ''; + $html .= '
      '.$artist.'
      '; + $html .= '
      '.get_int_text('label_play_all').'
      '; + return $html; +} + +function trackControlHeader($why, $what, $who, $dets) { + $html = ''; + foreach ($dets as $det) { + $albumimage = new baseAlbumImage(array('baseimage' => $det['Image'])); + $images = $albumimage->get_images(); + $html .= '
      '; + if ($why != '') { + $html .= '
      '.get_int_text('label_play_options').'
      '; + $html .= '
      '; + if ($det['AlbumUri']) { + $albumuri = rawurlencode($det['AlbumUri']); + if (strtolower(pathinfo($albumuri, PATHINFO_EXTENSION)) == "cue") { + $html .= '
      '; + } else { + $html .= '
      '; + $html .= '
      '; + } + } else { + $html .= '
      '; + } + $html .= '
      '; + $html .= '
      '; + $html .= '
      '; + $html .= '
      '; + $html .= '
      '; + $html .= '
      '.ucfirst(get_int_text('label_tracks')).'
      '; + } + } + print $html; +} + +function printDirectoryItem($fullpath, $displayname, $prefix, $dircount, $printcontainer = false) { + $c = ($printcontainer) ? "searchdir" : "directory"; + print ''; + print ''; + if ($printcontainer) { + print '
      '; + } +} + +function directoryControlHeader($prefix, $name = null) { + print ''; + if ($name !== null) { + print '
      '.$name.'
      '; + } +} + +function printRadioDirectory($att) { + $name = md5($att['URL']); + print ''; + print ''; + print ''; + print '
      '; +} + +function playlistPlayHeader($name, $text) { + logger::log("UI", "Getting image for playlist",$name); + $albumimage = new albumImage(array('artist' => "PLAYLIST", 'album' => $text)); + $image = $albumimage->get_image_if_exists(); + if ($image) { + $images = $albumimage->get_images(); + print '
      '; + } + print '
      '.get_int_text('label_play_all'); + print ''; + print '
      '; +} + +function addPodcastCounts($html, $extra) { + $out = phpQuery::newDocument($html); + $out->find('.menuitem')->append($extra); + return $out; +} + +function addUserRadioButtons($html, $index, $uri, $name, $image) { + $out = phpQuery::newDocument($html); + $extra = '
      '; + $out->find('.menuitem')->append($extra); + return $out; +} + +function addPlaylistControls($html, $delete, $is_user, $name) { + global $prefs; + $out = phpQuery::newDocument($html); + if ($delete && ($is_user || $prefs['player_backend'] == "mpd")) { + $add = ($is_user) ? "user" : ""; + $h = ''; + $h .= ''; + $h .= ''; + $h .= ''; + $out->find('.menuitem')->append($h); + } + return $out; +} + +?> diff --git a/www/rompr/skins/playlist.php b/www/rompr/skins/playlist.php new file mode 100644 index 0000000..8e27fd2 --- /dev/null +++ b/www/rompr/skins/playlist.php @@ -0,0 +1,93 @@ +
      + + + + + + +
      +'; +?> + +'; +?> +
      +
      +'; + +if ($prefs['player_backend'] == "mpd") { +?> + + + + + + + + + + + + + + +
      +
      REPLAY GAIN
      +
      +
      +
      Off
      +
      +
      +
      +
      Track
      +
      +
      +
      +
      Album
      +
      +
      +
      +
      Auto
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      + +
      +
      +
      +
      +
      diff --git a/www/rompr/skins/search.php b/www/rompr/skins/search.php new file mode 100644 index 0000000..c2f0900 --- /dev/null +++ b/www/rompr/skins/search.php @@ -0,0 +1,47 @@ + +'; +foreach ($sterms as $label => $term) { + print ''; + print ''.ucwords(strtolower(get_int_text($label))).''; + print ''; + print ''; +} + +print ''; +print ''.get_int_text("label_rating").''; +print '
      +'; +print '
      '; +print ''; + +print ''; +print ''; +print ''; +print ''; + +print ''; + +print ''; + +print '
      + +
      + +
      + '; +include("includes/podcasts.php"); +?> +
      + +
      + + '; + +if ($prefs['player_backend'] == "mopidy") { + print '
      Music From Your Collection
      '; +} +?> +
      + + +Music From Spotify'; +} +?> +
      + +Music From Everywhere'; + print '
      Play From These Sources:
      '; +} +?> +
      + +
      +
      + + + '; +?> +
      +
      + + + + + + +
      +
      +
      '.get_int_text("lastfm_addtagslabel"); +?> +
      + +
      diff --git a/www/rompr/skins/skypotato/skin.requires b/www/rompr/skins/skypotato/skin.requires new file mode 100755 index 0000000..83ad392 --- /dev/null +++ b/www/rompr/skins/skypotato/skin.requires @@ -0,0 +1,5 @@ +jquery/jquery.hotkeys.js +jquery/jquery.mCustomScrollbar.concat.min-3.1.5.js +ui/hotkeys.js +css/jquery.mCustomScrollbar.css +css/tipTip.css diff --git a/www/rompr/skins/skypotato/skinvars.php b/www/rompr/skins/skypotato/skinvars.php new file mode 100755 index 0000000..71dce08 --- /dev/null +++ b/www/rompr/skins/skypotato/skinvars.php @@ -0,0 +1,6 @@ + diff --git a/www/rompr/skins/skypotato/ui_elements.php b/www/rompr/skins/skypotato/ui_elements.php new file mode 100644 index 0000000..dc5a37e --- /dev/null +++ b/www/rompr/skins/skypotato/ui_elements.php @@ -0,0 +1,239 @@ +'; + } else if ($data['uri'] == null) { + print '
      '; + } else { + print '
      '; + } + + // Track Number + if ($data['trackno'] && $data['trackno'] != "" && $data['trackno'] > 0) { + print '
      99 || $data['trackno'] > 99) { + print ' style="width:3em"'; + } + print '>'.$data['trackno'].'
      '; + } + + print domainIcon($d, 'collecionicon'); + + // Track Title, Artist, and Rating + if ((string) $data['title'] == "") $data['title'] = urldecode($data['uri']); + print '
      '; + print '
      '.$data['title'].'
      '; + if ($data['artist'] && $data['trackartistindex'] != $data['albumartistindex']) { + print '
      '.$data['artist'].'
      '; + } + if ($data['rating']) { + print '
      '; + print ''; + print '
      '; + } + if ($data['tags']) { + print '
      '; + print ''.$data['tags']; + print '
      '; + } + print '
      '; + + // Track Duration + print '
      '; + if ($data['time'] > 0) { + print format_time($data['time']); + } + print '
      '; + + // Delete Button + if ($data['lm'] === null) { + print ''; + } + + print '
      '; + + if ($data['progress'] > 0) { + print ''; + print ''; + } + + return 0; +} + +function artistHeader($id, $name) { + global $divtype; + $h = ''; + return $h; +} + +function noAlbumsHeader() { + print '
      '.get_int_text("label_noalbums").'
      '; +} + +function albumHeader($obj) { + global $prefs; + $h = '
      '; + if ($obj['id'] == 'nodrop') { + // Hacky at the moment, we only use nodrop for streams but here there is no checking + // because I'm lazy. + $h .= '
      '; + } else { + if (array_key_exists('plpath', $obj)) { + $h .= ''; + } + $h .= ''; + $h .= '
      '; + + return $h; +} + +function albumControlHeader($fragment, $why, $what, $who, $artist) { + if ($fragment || $who == 'root') { + return ''; + } + $html = '
      '.$artist.'
      '; + $html .= '
      '.get_int_text('label_play_all').'
      '; + return $html; +} + +function trackControlHeader($why, $what, $who, $dets) { + $html = ''; + foreach ($dets as $det) { + if ($why != '') { + $html .= '
      '; + if ($det['AlbumUri']) { + $albumuri = rawurlencode($det['AlbumUri']); + if (strtolower(pathinfo($albumuri, PATHINFO_EXTENSION)) == "cue") { + $html .= '
      '; + } else { + $html .= '
      '; + $html .= '
      '; + } + } else { + $html .= '
      '; + } + $html .= '
      '; + $html .= '
      '; + $html .= '
      '; + $html .= '
      '; + $html .= '
      '; + $html .= '
      '.ucfirst(get_int_text('label_tracks')).'
      '; + } + } + print $html; +} + +function printDirectoryItem($fullpath, $displayname, $prefix, $dircount, $printcontainer = false) { + $c = ($printcontainer) ? "searchdir" : "directory"; + print ''; + print ''; + if ($printcontainer) { + print '
      '; + } +} + +function directoryControlHeader($prefix, $name = null) { + if ($name !== null) { + print ''; + } +} + +function printRadioDirectory($att) { + $name = md5($att['URL']); + print ''; + print ''; + print ''; + print ''; +} + +function playlistPlayHeader($name, $text) { + print '
      '.get_int_text('label_play_all'); + print ''; + print '
      '; +} + +function addPodcastCounts($html, $extra) { + $out = phpQuery::newDocument($html); + $out->find('.containerbox.wrap')->removeClass('wrap')->addClass('vertical'); + $extra = '
      '.$extra.'
      '; + $out->find('.containerbox.vertical')->append($extra); + return $out; +} + +function addUserRadioButtons($html, $index, $uri, $name, $image) { + $out = phpQuery::newDocument($html); + $extra = '
      '; + $extra .= '
      '; + $extra .= ''; + $extra .= "
      "; + $out->find('.helpfulalbum')->append($extra); + return $out; +} + +function addPlaylistControls($html, $delete, $is_user, $name) { + global $prefs; + $out = phpQuery::newDocument($html); + if ($delete && ($is_user || $prefs['player_backend'] == "mpd")) { + $add = ($is_user) ? "user" : ""; + $h = '
      '; + $h .= ''; + $h .= ''; + $h .= '
      '; + $h .= ''; + $h .= ''; + $h .= '
      '; + $out->find('.helpfulalbum')->append($h); + } + return $out; +} + +?> diff --git a/www/rompr/skins/standard_ui.php b/www/rompr/skins/standard_ui.php new file mode 100644 index 0000000..f9222a4 --- /dev/null +++ b/www/rompr/skins/standard_ui.php @@ -0,0 +1,218 @@ +'; + } else if ($data['uri'] == null) { + print '
      '; + } else { + print '
      '; + } + + // Track Number + if ($data['trackno'] && $data['trackno'] != "" && $data['trackno'] > 0) { + print '
      99 || $data['trackno'] > 99) { + print ' style="width:3em"'; + } + print '>'.$data['trackno'].'
      '; + } + + print domainIcon($d, 'collectionicon'); + + // Track Title, Artist, and Rating + if ((string) $data['title'] == "") $data['title'] = urldecode($data['uri']); + print '
      '; + print '
      '.$data['title'].'
      '; + if ($data['artist'] && $data['trackartistindex'] != $data['albumartistindex']) { + print '
      '.$data['artist'].'
      '; + } + if ($data['rating']) { + print '
      '; + print ''; + print '
      '; + } + if ($data['tags']) { + print '
      '; + print ''.$data['tags']; + print '
      '; + } + print '
      '; + + // Track Duration + print '
      '; + if ($data['time'] > 0) { + print format_time($data['time']); + } + print '
      '; + + // Delete Button + if ($data['lm'] === null) { + print ''; + } + + print '
      '; + if ($data['progress'] > 0) { + print ''; + print ''; + } + + return 0; +} + +function artistHeader($id, $name) { + global $divtype; + $h = ''; + return $h; +} + +function noAlbumsHeader() { + print '
      '. + get_int_text("label_noalbums").'
      '; +} + +function albumHeader($obj) { + global $prefs; + $h = ''; + if ($obj['why'] === null) { + $h .= ' +
      +
      +
      +
      +
      +
      + + +
      + +
      + +
      + +
      +
      +
      '.get_int_text("lastfm_addtagslabel"); +?> +
      + +
      + +
      + '.get_int_text('button_addtoplaylist').'
      '; + ?> +
      +
      +
      diff --git a/www/rompr/skins/tablet/skin.requires b/www/rompr/skins/tablet/skin.requires new file mode 100644 index 0000000..caaf2f9 --- /dev/null +++ b/www/rompr/skins/tablet/skin.requires @@ -0,0 +1 @@ +jquery/jquery.scrollTo.min.js diff --git a/www/rompr/skins/tablet/skinvars.php b/www/rompr/skins/tablet/skinvars.php new file mode 100644 index 0000000..f14ed3c --- /dev/null +++ b/www/rompr/skins/tablet/skinvars.php @@ -0,0 +1,6 @@ + diff --git a/www/rompr/skins/tablet/ui_elements.php b/www/rompr/skins/tablet/ui_elements.php new file mode 100644 index 0000000..01420cd --- /dev/null +++ b/www/rompr/skins/tablet/ui_elements.php @@ -0,0 +1,3 @@ + diff --git a/www/rompr/snapcast/snapapi.php b/www/rompr/snapcast/snapapi.php new file mode 100644 index 0000000..e5592fc --- /dev/null +++ b/www/rompr/snapcast/snapapi.php @@ -0,0 +1,72 @@ +port = $port; + $this->ip = $ip; + } + + public function __destruct() { + $this->close_connection(); + } + + private function open_connection() { + if ($this->is_connected()) { + return true; + } + logger::trace("SNAPCAST", "Connecting to ".$this->ip.':'.$this->port); + $this->connection = @stream_socket_client('tcp://'.$this->ip.':'.$this->port); + if ($this->is_connected()) { + stream_set_timeout($this->connection, 65535); + stream_set_blocking($this->connection, true); + return true; + } + logger::warn("SNAPCAST", "Snapcast connection failed"); + return false; + } + + private function close_connection() { + if ($this->is_connected()) { + stream_socket_shutdown($this->connection, STREAM_SHUT_RDWR); + } + } + + private function is_connected() { + return (isset($this->connection) && is_resource($this->connection)); + } + + public function do_command($json) { + if ($this->open_connection()) { + logger::trace("SNAPCAST", "Sending ",$json); + // For some reason, fputs strips the final } off the string + fputs($this->connection, $json."}\n", strlen($json)+2); + $got = fgets($this->connection); + return $got; + } else { + return $this->errorjson('Could not connect to snapcast server'); + } + $this->close_connection(); + } + + private function errorjson($msg) { + $retval = array('error' => $msg); + return json_encode($retval); + } +} + +$server = new snapcast($prefs['snapcast_server'], $prefs['snapcast_port']); +$json = file_get_contents("php://input"); +$output = $server->do_command($json); +logger::debug("SNAPCAST", "Output is",$output); +header('Content-Type: application/json; charset=utf-8'); +print $output; +?> \ No newline at end of file diff --git a/www/rompr/snapcast/snapcast.js b/www/rompr/snapcast/snapcast.js new file mode 100644 index 0000000..a967472 --- /dev/null +++ b/www/rompr/snapcast/snapcast.js @@ -0,0 +1,450 @@ +var snapcast = function() { + + var groups = new Array(); + var streams = new Array(); + var updatetimer = null; + var id = 0; + var lastid = 0; + var ew = null; + + function snapcastRequest(parms, callback) { + clearTimeout(updatetimer); + id++; + parms.id = id; + parms.jsonrpc = "2.0"; + $.ajax({ + type: 'POST', + url: 'snapcast/snapapi.php', + data: JSON.stringify(parms) + }) + .done(callback) + .fail(function(jqXHR, textStatus, errorThrown) { + debug.error("SNAPCAST","Command Failed",parms,textStatus,errorThrown); + callback({error: language.gettext('snapcast_notthere')}); + }) + } + + function findGroup(arr, id) { + for (var i in arr) { + if (arr[i].getId() == id) { + return i; + } + } + return false; + } + + return { + updateStatus: function() { + clearTimeout(updatetimer); + if (prefs.snapcast_server != '' && prefs.snapcast_port != '') { + snapcastRequest({ + method: "Server.GetStatus" + }, snapcast.gotStatus); + $('#snapheader').removeClass('invisible'); + } + }, + + gotStatus: function(data) { + debug.trace("SNAPCAST", "Server Status", data); + if (data.hasOwnProperty('error') && lastid != id) { + if (ew === null) { + ew = $('
      ', {class: "fullwidth textcentre", style: "padding:4px"}).insertBefore('#snapcastgroups'); + $('#snapcastgroups').addClass('canbefaded').css({opacity: '0.4'}); + } + ew.html(''+data.error+''); + } else if (data.hasOwnProperty('id') && parseInt(data.id) == id) { + lastid = id; + if (ew !== null) { + ew.remove(); + ew = null; + $('#snapcastgroups').removeClass('canbefaded').css({opacity: ''}); + } + streams = data.result.server.streams; + var newgroups = new Array(); + for (var i in data.result.server.groups) { + var group_exists = findGroup(groups, data.result.server.groups[i].id); + if (group_exists === false) { + debug.log('SNAPCAST','Creating new group',data.result.server.groups[i].id); + var g = new snapcastGroup(); + newgroups.push(g); + g.initialise(); + g.update(i, data.result.server.groups[i]); + } else { + debug.trace('SNAPCAST','Updating group',data.result.server.groups[i].id); + newgroups.push(groups[group_exists]); + groups[group_exists].update(i, data.result.server.groups[i]); + } + } + // Find removed groups + for (var i in groups) { + if (findGroup(newgroups, groups[i].getId()) === false) { + debug.log('SNAPCAST','Group',groups[i].getId(),'has been removed'); + groups[i].removeSelf(); + groups[i] = null; + } + } + groups = newgroups; + } else { + debug.shout('SNAPCAST','Got response with id',data.id,'expecting',id); + } + updatetimer = setTimeout(snapcast.updateStatus, 60000); + }, + + streamInfo: function(streamid) { + for (var i in streams) { + if (streams[i].id == streamid) { + var h = streams[i].status.capitalize()+' '; + h += streams[i].meta.STREAM; + h += ' ('+streams[i].uri.query.codec+' '+streams[i].uri.query.sampleformat+')'; + return h; + } + } + return 'Unknown Stream'; + }, + + getAllStreams: function() { + return streams; + }, + + getAllGroups: function() { + var retval = new Array(); + for (var i in groups) { + retval.push(groups[i].getInfo()); + } + return retval; + }, + + setClientVolume: function(id, volume, muted) { + clearTimeout(updatetimer); + snapcastRequest({ + method: "Client.SetVolume", + params: { + id: id, + volume: { + muted: muted, + percent: volume + } + } + }, snapcast.updateStatus); + }, + + setGroupMute: function(id, muted) { + clearTimeout(updatetimer); + snapcastRequest({ + method: "Group.SetMute", + params: { + id: id, + mute: muted + } + }, snapcast.updateStatus); + }, + + deleteClient: function(id) { + clearTimeout(updatetimer); + snapcastRequest({ + method: "Server.DeleteClient", + params: { + id: id + } + }, snapcast.gotStatus); + }, + + setClientName: function(id, name) { + clearTimeout(updatetimer); + snapcastRequest({ + method: "Client.SetName", + params: { + id: id, + name: name + } + }, snapcast.updateStatus); + }, + + setClientLatency: function(id, latency) { + clearTimeout(updatetimer); + snapcastRequest({ + method: "Client.SetLatency", + params: { + id: id, + latency: parseInt(latency) + } + }, snapcast.updateStatus); + }, + + setStream: function(group, stream) { + clearTimeout(updatetimer); + snapcastRequest({ + method: "Group.SetStream", + params: { + id: group, + stream_id: stream + } + }, snapcast.updateStatus); + }, + + addClientToGroup: function(client, group) { + clearTimeout(updatetimer); + var groupindex = findGroup(groups, group); + var clients = groups[groupindex].getClients(); + clients.push(client); + snapcastRequest({ + method: "Group.SetClients", + params: { + clients: clients, + id: group + } + }, snapcast.gotStatus); + }, + + clearEverything: function() { + clearTimeout(updatetimer); + streams = []; + groups = []; + $('#snapcastgroups').empty(); + } + } + +}(); + +function snapcastGroup() { + + var self = this; + var clients = new Array(); + var holder; + var id = ''; + var muted; + var streammenu; + var ind; + var name; + + function findClient(arr, id) { + for (var i in arr) { + if (arr[i].getId() == id) { + return i; + } + } + return false; + } + + this.initialise = function() { + holder = $('
      ', {class: 'snapcastgroup fullwidth'}).appendTo('#snapcastgroups'); + var title = $('
      ', {class: 'containerbox snapgrouptitle dropdown-container'}).appendTo(holder); + title.append('
      '); + title.append('
      '); + var m = $('', {class: "podicon fixed icon-menu clickicon"}).appendTo(title).on('click', self.setStream); + m = $('', {class: "podicon fixed clickicon", name: "groupmuted"}).appendTo(title).on('click', self.setMute); + streammenu = $('
      ', {class: 'toggledown invisible'}).insertAfter(title); + } + + this.removeSelf = function() { + holder.remove(); + } + + this.getId = function() { + return id; + } + + this.update = function(index, data) { + ind = index; + id = data.id; + muted = data.muted; + name = data.name; + var g = language.gettext('snapcast_group')+index; + if (data.name) { + g += ' ('+data.name+')'; + } + holder.find('div[name="groupname"]').html(g); + holder.find('div[name="groupstream"]').html(snapcast.streamInfo(data.stream_id)); + var icon = data.muted ? 'icon-output-mute' : 'icon-output'; + holder.find('i[name="groupmuted"]').removeClass('icon-output icon-output-mute').addClass(icon); + + var newclients = new Array(); + for (var i in data.clients) { + var client_exists = findClient(clients, data.clients[i].id); + if (client_exists === false) { + debug.log('SNAPCAST','Creating new client',data.clients[i].id); + var g = new snapcastClient(); + newclients.push(g); + g.initialise(holder); + g.update(id, data.clients[i]); + } else { + debug.trace('SNAPCAST','Updating client',data.clients[i].id); + newclients.push(clients[client_exists]); + clients[client_exists].update(id, data.clients[i]); + } + } + // Find removed groups + for (var i in clients) { + if (findClient(newclients, clients[i].getId()) === false) { + debug.log('SNAPCAST','Client',clients[i].getId(),'has been removed'); + clients[i].removeSelf(); + clients[i] = null; + } + } + clients = newclients; + } + + this.setMute = function() { + snapcast.setGroupMute(id, !muted); + } + + this.setStream = function() { + streammenu.empty(); + var s = snapcast.getAllStreams(); + var a = $('
      ', {class: 'menuitem textcentre'}).appendTo(streammenu); + a.html('Change Stream'); + for (var i in s) { + var d = $('
      ', {class: 'backhi clickitem', name: s[i].id}).appendTo(streammenu).on('click', self.changeStream); + d.html(snapcast.streamInfo(s[i].id)); + } + streammenu.slideToggle('fast'); + } + + this.changeStream = function(e) { + var streamid = $(this).attr('name'); + debug.log('SNAPCAST', 'Group',id,'changing stream to',streamid); + snapcast.setStream(id, streamid); + streammenu.slideToggle('fast'); + } + + this.getInfo = function() { + return {index: ind, id: id, name: name}; + } + + this.getClients = function() { + var retval = new Array(); + for (var i in clients) { + retval.push(clients[i].getId()); + } + return retval; + } +} + +function snapcastClient() { + + var self = this; + var holder; + var id = ''; + var volume; + var volumepc; + var muted; + var vc; + var groupmenu; + var grouplist; + var groupid; + var connected; + + this.initialise = function(parentdiv) { + holder = $('
      ', {class: 'snapcastclient'}).appendTo(parentdiv); + var title = $('
      ', {class: 'containerbox dropdown-container'}).appendTo(holder); + var n = $('', {type: "text", class: "expand tag snapclientname", name: "clientname"}).appendTo(title); + var but = $('
      '; +print '
      '; +print '
      '; +print '
      '; +print '
      '; +?> diff --git a/www/rompr/streamplugins/01_somafm.php b/www/rompr/streamplugins/01_somafm.php new file mode 100644 index 0000000..5128fca --- /dev/null +++ b/www/rompr/streamplugins/01_somafm.php @@ -0,0 +1,177 @@ +'; + print albumHeader(array( + 'id' => 'somafmlist', + 'Image' => 'newimages/somafmlogo.svg', + 'Searched' => 1, + 'AlbumUri' => null, + 'Year' => null, + 'Artistname' => '', + 'Albumname' => get_int_text('label_somafm'), + 'why' => null, + 'ImgKey' => 'none', + 'class' => 'radio', + 'expand' => true + )); + print '
      '; + print '
      '.get_int_text('label_loading').'
      '; + print '
      '; + } + + public function doStationList() { + directoryControlHeader('somafmlist', get_int_text('label_somafm')); + print '
      '; + print ''.get_int_text("label_soma_beg").''; + print '
      '; + $d = new url_downloader(array('url' => "http://api.somafm.com/channels.xml")); + if ($d->get_data_to_string()) { + $this->doAllStations($d->get_data()); + } else { + print 'There was an error getting the channels from Soma FM - status code '.$d->get_status(); + } + } + + // -- Private Functions -- // + + private function getimage($c) { + $img = (string) $c->xlimage; + if (!$img) { + $img = (string) $c->largeimage; + } + if (!$img) { + $img = (string) $c->image; + } + return 'getRemoteImage.php?url='.$img; + } + + private function format_listenlink($c, $p, $label) { + $img = $this->getimage($c); + print ''; + } + + private function doAllStations($content) { + logger::trace("SOMAFM", "Loaded Soma FM channels list"); + $x = simplexml_load_string($content); + $count = 0; + foreach ($x->channel as $channel) { + $this->doChannel($count, $channel); + $count++; + } + } + + private function doChannel($count, $channel) { + logger::log("SOMAFM", "Channel :",$channel->title); + if ($channel->highestpls) { + $pls = (string) $channel->highestpls; + } else { + $pls = (string) $channel->fastpls[0]; + } + + print albumHeader(array( + 'id' => 'somafm_'.$count, + 'Image' => $this->getimage($channel), + 'Searched' => 1, + 'AlbumUri' => null, + 'Year' => null, + 'Artistname' => utf8_encode($channel->genre), + 'Albumname' => utf8_encode($channel->title), + 'why' => 'whynot', + 'ImgKey' => 'none', + 'streamuri' => $pls, + 'streamname' => (string) $channel->title, + 'streamimg' => $this->getimage($channel), + 'class' => 'radiochannel' + )); + + print '
      '; + trackControlHeader('','','somafm_'.$count, array(array('Image' => $this->getimage($channel)))); + if ($channel->description) { + print '
      '.utf8_encode($channel->description).'
      '; + } + if ($channel->listeners) { + print '
      '; + print '
      '.$channel->listeners.' '.trim(get_int_text("lastfm_listeners"),':').'
      '; + print '
      '; + } + + print '
      '; + print '
      Listen:
      '; + + if ($channel->highestpls) { + $this->format_listenlink($channel, $channel->highestpls, "High Quality"); + } + foreach ($channel->fastpls as $h) { + $this->format_listenlink($channel, $h, "Standard Quality"); + } + foreach ($channel->slowpls as $h) { + $this->format_listenlink($channel, $h, "Low Quality"); + } + + print '
      '; + + if ($channel->twitter && $channel->dj) { + print ''; + print ''; + } + if ($channel->lastPlaying) { + print ''; + } + + print '
      '; + } +} + +if (array_key_exists('populate', $_REQUEST)) { + + chdir('..'); + + include ("includes/vars.php"); + include ("includes/functions.php"); + include ("international.php"); + include ("skins/".$skin."/ui_elements.php"); + + $soma = new somafmplugin(); + $soma->doStationList(); + +} else { + + $soma = new somafmplugin(); + $soma->doHeader(); + +} + + +?> diff --git a/www/rompr/streamplugins/03_tuneinradio.php b/www/rompr/streamplugins/03_tuneinradio.php new file mode 100644 index 0000000..d7ebebb --- /dev/null +++ b/www/rompr/streamplugins/03_tuneinradio.php @@ -0,0 +1,142 @@ +url = 'http://opml.radiotime.com/'; + $this->title = ''; + } + + public function doHeader() { + print '
      '; + print albumHeader(array( + 'id' => 'tuneinlist', + 'Image' => 'newimages/tunein-logo.svg', + 'Searched' => 1, + 'AlbumUri' => null, + 'Year' => null, + 'Artistname' => '', + 'Albumname' => get_int_text('label_tuneinradio'), + 'why' => null, + 'ImgKey' => 'none', + 'class' => 'radio', + 'expand' => true + )); + print '
      '.get_int_text('label_loading').'
      '; + print '
      '; + } + + public function parseParams() { + if (array_key_exists('url', $_REQUEST)) { + $this->url = $_REQUEST['url']; + } else { + directoryControlHeader('tuneinlist', get_int_text('label_tuneinradio')); + print '
      +
      '; + } + if (array_key_exists('title', $_REQUEST)) { + $this->title = $_REQUEST['title']; + directoryControlHeader($_REQUEST['target'], htmlspecialchars($this->title)); + } + if (array_key_exists('search', $_REQUEST)) { + directoryControlHeader('tuneinlist', get_int_text('label_tuneinradio')); + $this->url .= 'Search.ashx?query='.urlencode($_REQUEST['search']); + } + } + + public function getUrl() { + logger::mark("TUNEIN", "Getting URL",$this->url); + $d = new url_downloader(array('url' => $this->url)); + if ($d->get_data_to_string()) { + $x = simplexml_load_string($d->get_data()); + $v = (string) $x['version']; + logger::debug("TUNEIN", "OPML version is ".$v); + $this->parse_tree($x->body, $this->title); + } + } + + private function parse_tree($node, $title) { + + foreach ($node->outline as $o) { + $att = $o->attributes(); + logger::trace("TUNEIN", " Text is",$att['text'],", type is",$att['type']); + switch ($att['type']) { + + case '': + print '
      '; + print '
      '.$att['text'].'
      '; + print '
      '; + $this->parse_tree($o, $title); + break; + + case 'link': + printRadioDirectory($att); + break; + + case 'audio': + switch ($att['item']) { + case 'station': + $sname = $att['text']; + $year = 'Radio Station'; + break; + + case 'topic': + $sname = $title; + $year = 'Podcast Episode'; + break; + + default: + $sname = $title; + $year = ucfirst($att['item']); + break; + + } + + print albumHeader(array( + 'id' => 'nodrop', + 'Image' => 'getRemoteImage.php?url='.$att['image'], + 'Searched' => 1, + 'AlbumUri' => null, + 'Year' => $year, + 'Artistname' => ((string) $att['playing'] != (string) $att['subtext']) ? $att['subtext'] : null, + 'Albumname' => $att['text'], + 'why' => 'whynot', + 'ImgKey' => 'none', + 'streamuri' => $att['URL'], + 'streamname' => $sname, + 'streamimg' => 'getRemoteImage.php?url='.$att['image'], + 'class' => 'radiochannel' + )); + break; + + } + } + + } + +} + +if (array_key_exists('populate', $_REQUEST)) { + + chdir('..'); + + include ("includes/vars.php"); + include ("includes/functions.php"); + include ("international.php"); + include ("skins/".$skin."/ui_elements.php"); + + $tunein = new tuneinplugin(); + $tunein->parseParams(); + $tunein->getUrl(); + +} else { + + $tunein = new tuneinplugin(); + $tunein->doHeader(); +} + +?> diff --git a/www/rompr/streamplugins/04_communityradio.php b/www/rompr/streamplugins/04_communityradio.php new file mode 100644 index 0000000..5c2a039 --- /dev/null +++ b/www/rompr/streamplugins/04_communityradio.php @@ -0,0 +1,345 @@ +pagination = 50; + $this->searchterms = array('name', 'country', 'state', 'language', 'tag'); + $this->page = 0; + } + + public function parseParams() { + $this->page = $_REQUEST['page']; + $this->country = array_key_exists('country', $_REQUEST) ? $_REQUEST['country'] : ''; + $this->language = array_key_exists('language', $_REQUEST) ? $_REQUEST['language'] : ''; + $this->tag = array_key_exists('tag', $_REQUEST) ? $_REQUEST['tag'] : ''; + $this->listby = $_REQUEST['listby']; + $this->order = $_REQUEST['order']; + } + + public function doHeader() { + print '
      '; + print albumHeader(array( + 'id' => 'communityradiolist', + 'Image' => 'newimages/broadcast.svg', + 'Searched' => 1, + 'AlbumUri' => null, + 'Year' => null, + 'Artistname' => '', + 'Albumname' => get_int_text('label_communityradio'), + 'why' => null, + 'ImgKey' => 'none', + 'class' => 'radio', + 'expand' => true + )); + print '
      '; + print '
      '.get_int_text('label_loading').'
      '; + print '
      '; + } + + public function doDropdownHeader() { + global $prefs; + directoryControlHeader('communityradiolist', get_int_text('label_communityradio')); + + print '
      List By:
      '; + + $d = new url_downloader(array('url' => 'http://www.radio-browser.info/webservice/json/countries')); + if ($d->get_data_to_string()) { + $countries = json_decode($d->get_data(), true); + $this->makeSelector($countries, 'country', $this->country); + } + + $d = new url_downloader(array('url' => 'http://www.radio-browser.info/webservice/json/languages')); + if ($d->get_data_to_string()) { + $langs = json_decode($d->get_data(), true); + $this->makeSelector($langs, 'language', $this->language); + } + + $d = new url_downloader(array('url' => 'http://www.radio-browser.info/webservice/json/tags')); + if ($d->get_data_to_string()) { + $tags = json_decode($d->get_data(), true); + $this->makeSelector($tags, 'tag', $this->tag); + } + + print '
      Search All Stations:
      '; + print '
      '; + foreach ($this->searchterms as $term) { + print ''; + } + print '
      '; + print '
      '; + print ''; + print '
      '; + print '
      '; + + print '
      Order By:
      '; + print ''; + + print '
      '; + + } + + public function doRequest() { + $url = ''; + switch ($this->listby) { + case 'country': + $url = 'http://www.radio-browser.info/webservice/json/stations/bycountryexact/'.rawurlencode($this->country).'?'; + print '
      Country - '.ucwords($this->country).'
      '; + break; + + case 'language': + $url = 'http://www.radio-browser.info/webservice/json/stations/bylanguageexact/'.rawurlencode($this->language).'?'; + print '
      Language - '.ucwords($this->language).'
      '; + break; + + case 'tag': + $url = 'http://www.radio-browser.info/webservice/json/stations/bytagexact/'.rawurlencode($this->tag).'?'; + print '
      Tag - '.ucwords($this->tag).'
      '; + break; + + case 'search': + $url = 'http://www.radio-browser.info/webservice/json/stations/search?'; + $ourterms = array(); + foreach ($this->searchterms as $t) { + if (array_key_exists($t, $_REQUEST) && $_REQUEST[$t] != '') { + $ourterms[] = $t.'='.rawurlencode($_REQUEST[$t]); + } + } + print '
      '.get_int_text('button_search').' - '.rawurldecode(implode(', ', $ourterms)).'
      '; + $url .= implode('&', $ourterms).'&'; + break; + } + + $url .= 'order='.$this->order; + + switch ($this->order) { + case 'bitrate': + case 'votes': + $url .= '&reverse=true'; + break; + } + + $d = new url_downloader(array('url' => $url)); + if ($d->get_data_to_string()) { + $stations = json_decode($d->get_data(), true); + $this->comm_radio_do_page_buttons($this->page, count($stations), $this->pagination); + for ($i = 0; $i < $this->pagination; $i++) { + $index = $this->page * $this->pagination + $i; + if ($index >= count($stations)) { + break; + } + $this->doStation($this->comm_radio_sanitise_station($stations[$index]), $index); + } + $this->comm_radio_do_page_buttons($this->page, count($stations), $this->pagination); + } + + } + + public function closeDropdown() { + print '
      '; + } + + // -- Private Functions -- // + + private function doStation($station, $index) { + print albumHeader(array( + 'id' => 'communityradio_'.$index, + 'Image' => $this->comm_radio_get_image($station), + 'Searched' => 1, + 'AlbumUri' => null, + 'Year' => null, + 'Artistname' => preg_replace('/,/', ', ', htmlspecialchars($station['tags'])), + 'Albumname' => htmlspecialchars($station['name']), + 'why' => 'whynot', + 'ImgKey' => 'none', + 'streamuri' => $station['playurl'], + 'streamname' => $station['name'], + 'streamimg' => $this->comm_radio_get_stream_image($station), + 'class' => 'radiochannel' + )); + print '
      '; + trackControlHeader('','','communityradio_'.$index, array(array('Image' => $this->comm_radio_get_image($station)))); + print '
      Listen:
      '; + print ''; + print '
      '.utf8_encode($station['state']).utf8_encode($station['country']).'
      '; + print '
      '.utf8_encode($station['votes']).' Upvotes, '.utf8_encode($station['negativevotes']).' Downvotes
      '; + if ($station['homepage']) { + print ''; + print ''; + print ''; + } + print '
      '; + + } + + private function makeSelector($json, $which, $setting) { + print ''; + } + + private function comm_radio_make_list_button($which) { + print '
      '; + print ''; + print 'listby == $which) { + print ' checked'; + } + print ' />'; + print ''; + print ''; + print '
      '; + } + + private function comm_radio_get_image($station) { + if ($station['favicon']) { + if (substr($station['favicon'], 0, 10) == 'data:image') { + return $station['favicon']; + } else { + return 'getRemoteImage.php?url='.$station['favicon'].'&rompr_backup_type=stream'; + } + } else { + return 'newimages/broadcast.svg'; + } + } + + private function comm_radio_get_stream_image($station) { + if ($station['favicon']) { + if (substr($station['favicon'], 0, 10) == 'data:image') { + // Sadly we can't handle base64 data as a stream image in this way. The URLs are too long + return ''; + } else { + return 'getRemoteImage.php?url='.$station['favicon']; + } + } else { + return ''; + } + } + + private function comm_radio_do_page_buttons($page, $count, $per_page) { + print '
      '; + + $firstpage = max(0, $page-4); + $lastpage = min($firstpage+9, round(($count/$per_page), 0, PHP_ROUND_HALF_DOWN)); + print ''; + + print '
      '; + } + + private function comm_radio_sanitise_station($station) { + global $prefs; + $blank_station = array( + 'tags' => '', + 'name' => ROMPR_UNKNOWN_STREAM, + 'state' => '', + 'country' => '', + 'votes' => 0, + 'negativevotes' => 0, + 'codec' => 'Unknown Codec', + 'bitrate' => 'Unknown ', + 'favicon' => null, + 'homepage' => null + ); + + $result = array_merge($blank_station, $station); + if ($result['state'] && $result['country']) { + $result['state'] .= ', '; + } + if ($result['bitrate'] == 0) { + $result['bitrate'] = 'Unknown '; + } + // No real idea whay one works for one player but not the other. MPD won't load the M3U files, + // Mopidy won't load the PLS files. All I do is send a load/add and a URL..... + if ($prefs['player_backend'] == 'mpd') { + $result['playurl'] = 'http://www.radio-browser.info/webservice/v2/pls/url/'.$station['id']; + } else { + $result['playurl'] = 'http://www.radio-browser.info/webservice/v2/m3u/url/'.$station['id']; + } + return $result; + } + +} + +if (array_key_exists('populate', $_REQUEST)) { + + chdir('..'); + + include ("includes/vars.php"); + include ("includes/functions.php"); + include ("international.php"); + include ("skins/".$skin."/ui_elements.php"); + + foreach ($_REQUEST as $i => $r) { + logger::log("COMMRADIO", $i,":",$r); + } + + $commradio = new commradioplugin(); + $commradio->parseParams(); + + if ($_REQUEST['populate'] == 1) { + $commradio->doDropdownHeader(); + } + + $commradio->doRequest(); + + if ($_REQUEST['populate'] == 1) { + $commradio->closeDropdown(); + } + +} else { + + $commradio = new commradioplugin(); + $commradio->doHeader(); + +} + +?> diff --git a/www/rompr/streamplugins/85_iceScraper.php b/www/rompr/streamplugins/85_iceScraper.php new file mode 100644 index 0000000..7979224 --- /dev/null +++ b/www/rompr/streamplugins/85_iceScraper.php @@ -0,0 +1,142 @@ + $getstr)); + $d->get_data_to_string(); + $icecast_shitty_page = preg_replace('/<\?xml.*?\?>/', '', $d->get_data()); + $doc = phpQuery::newDocument($icecast_shitty_page); + $list = $doc->find('table.servers-list')->find('tr'); + $page_title = $doc->find('#content')->children('h2')->text(); + logger::log("ICESCRAPER", "Page Title Is ".$page_title); + $count = 0; + directoryControlHeader('icecastlist', get_int_text('label_icecast')); + print '
      '; + print '
      '; + + print '
      '.$page_title.'
      '; + foreach ($list as $server) { + $server_web_link = ''; + $server_name = pq($server)->find('.stream-name')->children('.name')->children('a'); + $server_web_link = $server_name->attr('href'); + $server_name = $server_name->text(); + logger::log("ICESCRAPER", "Server Name Is ".$server_name); + $server_description = munge_ice_text(pq($server)->find('.stream-description')->text()); + $stream_tags = array(); + $stream_tags_section = pq($server)->find('.stream-tags')->find('li'); + foreach ($stream_tags_section as $tag) { + $stream_tags[] = pq($tag)->children('a')->text(); + } + $listeners = pq($server)->find('.listeners')->text(); + $listenlinks = pq($server)->find('.tune-in'); + $listenlink = ''; + $format = ''; + $ps = $listenlinks->find('p'); + foreach ($ps as $p) { + if (pq($p)->hasClass('format')) { + $format = pq($p)->attr('title'); + } else { + foreach(pq($p)->children('a') as $a) { + $l = pq($a)->attr('href'); + if (substr($l, -5) == ".xspf") { + $listenlink = 'http://dir.xiph.org'.$l; + } + } + } + } + + if ($listenlink != '') { + print albumHeader(array( + 'id' => 'icecast_'.$count, + 'Image' => 'newimages/icecast.svg', + 'Searched' => 1, + 'AlbumUri' => null, + 'Year' => null, + 'Artistname' => implode(', ', $stream_tags), + 'Albumname' => htmlspecialchars($server_name), + 'why' => 'whynot', + 'ImgKey' => 'none', + 'streamuri' => $listenlink, + 'streamname' => $server_name, + // 'streamimg' => 'newimages/icecast.svg', + 'streamimg' => '', + 'class' => 'radiochannel' + )); + print '
      '; + trackControlHeader('','','icecast_'.$count, array(array('Image' => 'newimages/icecast.svg'))); + print '
      '; + print '
      '.$server_description.'
      '; + print '
      '; + print '
      '.$listeners.'
      '; + print '
      '; + print '
      '; + print 'Listen '.$format; + print '
      '; + print '
      '; + print ''; + print ''; + print ''; + print '
      '; + } + $count++; + } + + $pager = $doc->find('ul.pager')->children('li'); + print '
      '; + foreach ($pager as $page) { + $link = pq($page)->children('a')->attr('href'); + print '
      '.pq($page)->children('a')->text().'
      '; + } + print '
      '; + +} else { + print '
      '; + print albumHeader(array( + 'id' => 'icecastlist', + 'Image' => 'newimages/icecast.svg', + 'Searched' => 1, + 'AlbumUri' => null, + 'Year' => null, + 'Artistname' => '', + 'Albumname' => get_int_text('label_icecast'), + 'why' => null, + 'ImgKey' => 'none', + 'class' => 'radio', + 'expand' => true + )); + print '
      '.get_int_text('label_loading').'
      '; + print '
      '; +} + +function munge_ice_text($text) { + $monkeyjesus = preg_replace('/(? diff --git a/www/rompr/streamplugins/communityradio.js b/www/rompr/streamplugins/communityradio.js new file mode 100644 index 0000000..21ae9f7 --- /dev/null +++ b/www/rompr/streamplugins/communityradio.js @@ -0,0 +1,132 @@ +var communityRadioPlugin = { + + page: 0, + searching: false, + + loadBigRadio: function() { + if ($("#communityradiolist").hasClass('notfilled')) { + $('i[name="communityradiolist"]').makeSpinner(); + $("#communityradiolist").load(communityRadioPlugin.getUri(1), + function() { + $('i[name="communityradiolist"]').stopSpinner(); + $('#communityradiolist').removeClass('notfilled'); + communityRadioPlugin.setTheThing(); + uiHelper.hackForSkinsThatModifyStuff("#communitystations"); + layoutProcessor.postAlbumActions(); + } + ); + } + }, + + update: function() { + $('i[name="communityradiolist"]').makeSpinner(); + $('#communitystations').load(communityRadioPlugin.getUri(2), + function() { + $('i[name="communityradiolist"]').stopSpinner(); + uiHelper.hackForSkinsThatModifyStuff("#communitystations"); + layoutProcessor.postAlbumActions(); + } + ); + }, + + getUri: function(p) { + var uri; + if (communityRadioPlugin.searching) { + uri = 'streamplugins/04_communityradio.php?populate='+p+ + '&listby=search'+ + '&order='+prefs.communityradioorderby+ + '&page='+communityRadioPlugin.page; + $('.comm_radio_searchterm').each(function() { + if ($(this).val() != '') { + uri += '&'+$(this).attr('name')+'='+$(this).val(); + } + }); + } else { + uri = 'streamplugins/04_communityradio.php?populate='+p+ + '&listby='+prefs.communityradiolistby+ + '&country='+prefs.communityradiocountry+ + '&tag='+prefs.communityradiotag+ + '&language='+prefs.communityradiolanguage+ + '&order='+prefs.communityradioorderby+ + '&page='+communityRadioPlugin.page; + } + return encodeURI(uri); + + }, + + setTheThing: function() { + $('input[name="commradiolistby"]').on('click', communityRadioPlugin.changeListBy); + $('select[id="commradioorderby"]').on('change', communityRadioPlugin.changeOrderBy); + $('button[name="commradiosearch"]').on('click', communityRadioPlugin.search); + $('#communityradiolist select.comradiolistby').on('change', communityRadioPlugin.changeOption); + var w = 0; + $.each($(".cslt"), function() { + if ($(this).width() > w) { + w = $(this).width(); + } + }); + w += 8; + $(".comm-search-label").css("width", w+"px"); + w = 0; + $.each($(".cclb"), function() { + if ($(this).width() > w) { + w = $(this).width(); + } + }); + w += 8; + $(".commradiolistby").css("width", w+"px"); + + }, + + changeOption: function() { + var n = $(this).attr('id'); + var pref = Array(); + pref[n] = $(this).val(); + prefs.save(pref); + var listby = n.replace('communityradio', ''); + $('input#commradiolistby'+listby).prop('checked', true); + communityRadioPlugin.changeListBy(); + }, + + changeListBy: function() { + var listby = $('input[name="commradiolistby"]:checked').val(); + prefs.save({communityradiolistby: listby}); + communityRadioPlugin.page = 0; + communityRadioPlugin.searching = false; + $('.comm_radio_searchterm').val(''); + communityRadioPlugin.update(); + }, + + changeOrderBy: function() { + var orderby = $('select[id="commradioorderby"]').val(); + prefs.save({communityradioorderby: orderby}); + communityRadioPlugin.page = 0; + communityRadioPlugin.update(); + }, + + search: function() { + communityRadioPlugin.searching = true; + communityRadioPlugin.page = 0; + communityRadioPlugin.update(); + }, + + handleClick: function(event, clickedElement) { + debug.log("COMM RADIO", "Handling Click"); + if (clickedElement.hasClass('clickcommradioforward')) { + communityRadioPlugin.page++; + clickedElement.off('click').makeSpinner(); + communityRadioPlugin.update(); + } else if (clickedElement.hasClass('clickcommradioback')) { + communityRadioPlugin.page--; + clickedElement.off('click').makeSpinner(); + communityRadioPlugin.update(); + } else if (clickedElement.hasClass('clickcommradiopager')) { + communityRadioPlugin.page = clickedElement.attr('name'); + clickedElement.off('click').makeSpinner(); + communityRadioPlugin.update(); + } + } +} + +menuOpeners['communityradiolist'] = communityRadioPlugin.loadBigRadio; +clickRegistry.addClickHandlers('commradio', communityRadioPlugin.handleClick); diff --git a/www/rompr/streamplugins/icescraper.js b/www/rompr/streamplugins/icescraper.js new file mode 100644 index 0000000..f076d32 --- /dev/null +++ b/www/rompr/streamplugins/icescraper.js @@ -0,0 +1,39 @@ +var icecastPlugin = { + + refreshMyDrink: function(path) { + if ($("#icecastlist").hasClass('notfilled')) { + icecastPlugin.makeabadger(); + $("#icecastlist").load("streamplugins/85_iceScraper.php?populate", icecastPlugin.spaghetti); + } else if (path) { + icecastPlugin.makeabadger(); + $("#icecastlist").load("streamplugins/85_iceScraper.php?populate=1&path="+path, icecastPlugin.spaghetti); + } + }, + + makeabadger: function() { + $('i[name="icecastlist"]').makeSpinner(); + }, + + spaghetti: function() { + $('i[name="icecastlist"]').stopSpinner(); + // $('[name="searchfor"]').on('keyup', onKeyUp); + $('[name="cornwallis"]').on('click', icecastPlugin.iceSearch); + $("#icecastlist").removeClass('notfilled'); + layoutProcessor.postAlbumActions(); + }, + + iceSearch: function() { + icecastPlugin.makeabadger(); + $("#icecastlist").load("streamplugins/85_iceScraper.php?populate=1&searchfor="+encodeURIComponent($('input[name="searchfor"]').val()), icecastPlugin.spaghetti); + }, + + handleClick: function(event, clickedElement) { + if (clickedElement.hasClass("clickicepager")) { + icecastPlugin.refreshMyDrink(clickedElement.attr('name')); + } + } + +} + +menuOpeners['icecastlist'] = icecastPlugin.refreshMyDrink; +clickRegistry.addClickHandlers('icescraper', icecastPlugin.handleClick); diff --git a/www/rompr/streamplugins/somafm.js b/www/rompr/streamplugins/somafm.js new file mode 100644 index 0000000..e6000d3 --- /dev/null +++ b/www/rompr/streamplugins/somafm.js @@ -0,0 +1,16 @@ +var somaFmPlugin = { + + loadSomaFM: function() { + if ($("#somafmlist").hasClass('notfilled')) { + $('i[name="somafmlist"]').makeSpinner(); + $("#somafmlist").load("streamplugins/01_somafm.php?populate", function( ) { + $('i[name="somafmlist"]').stopSpinner(); + $('#somafmlist').removeClass('notfilled'); + layoutProcessor.postAlbumActions(); + }); + } + } + +} + +menuOpeners['somafmlist'] = somaFmPlugin.loadSomaFM; diff --git a/www/rompr/streamplugins/tuneinradio.js b/www/rompr/streamplugins/tuneinradio.js new file mode 100644 index 0000000..19eb656 --- /dev/null +++ b/www/rompr/streamplugins/tuneinradio.js @@ -0,0 +1,64 @@ +var tuneinRadioPlugin = { + + loadBigRadio: function() { + if ($("#tuneinlist").hasClass('notfilled')) { + $('i[name="tuneinlist"]').makeSpinner(); + $("#tuneinlist").load("streamplugins/03_tuneinradio.php?populate=2", function() { + $('i[name="tuneinlist"]').stopSpinner(); + tuneinRadioPlugin.setTheThing(); + $("#tuneinlist").removeClass('notfilled'); + }); + } + }, + + setTheThing: function() { + layoutProcessor.postAlbumActions(); + }, + + handleClick: function(event, clickedElement) { + if (clickedElement.hasClass("browse")) { + event.stopImmediatePropagation(); + if (clickedElement.isClosed()) { + clickedElement.makeSpinner(); + var url = clickedElement.prev().prev().val(); + var title = clickedElement.prev().val(); + var menutoopen = clickedElement.attr("name"); + tuneinRadioPlugin.browse(url, title, menutoopen, function() { + clickedElement.stopSpinner(); + doMenu(null, clickedElement); + tuneinRadioPlugin.setTheThing(); + }); + } else { + doMenu(null, clickedElement); + } + } else if (clickedElement.hasClass("tuneinsearchbutton")) { + tuneinRadioPlugin.search(); + } + + }, + + browse: function(url, title, target, callback) { + $("#"+target).load("streamplugins/03_tuneinradio.php?populate=2&url="+url+'&title='+title+'&target='+target, function() { + callback(); + }); + }, + + search: function() { + var term = $('[name="tuneinsearcher"]').val(); + if (term == '') { + $('#tuneinlist').empty().addClass('notfilled'); + tuneinRadioPlugin.loadBigRadio(); + } else { + debug.log("TUNEIN","Searching For",term); + $('i[name="tuneinlist"]').makeSpinner(); + $("#tuneinlist").load("streamplugins/03_tuneinradio.php?populate=2&search="+encodeURIComponent(term), function() { + $('i[name="tuneinlist"]').stopSpinner(); + tuneinRadioPlugin.setTheThing(); + }); + } + } + +} + +menuOpeners['tuneinlist'] = tuneinRadioPlugin.loadBigRadio; +clickRegistry.addClickHandlers('tunein', tuneinRadioPlugin.handleClick); diff --git a/www/rompr/streamplugins/yourradio.js b/www/rompr/streamplugins/yourradio.js new file mode 100644 index 0000000..b724656 --- /dev/null +++ b/www/rompr/streamplugins/yourradio.js @@ -0,0 +1,97 @@ +var yourRadioPlugin = { + + loadStations: function() { + if ($('#yourradiostations').is(':empty')) { + $('i[name="yourradiolist"]').makeSpinner(); + $('#yourradiostations').load('utils/userstreams.php?populate', function() { + $('i[name="yourradiolist"]').stopSpinner(); + $('[name="spikemilligan"]').on('click', yourRadioPlugin.loadSuppliedStation); + $("#anaconda").on("drop", yourRadioPlugin.handleDropRadio); + layoutProcessor.postAlbumActions(); + if (layoutProcessor.sortFaveRadios) { + $("#yourradiostations").sortableTrackList({ + items: ".menuitem", + insidedrop: yourRadioPlugin.saveRadioOrder, + scroll: true, + scrollparent: "#radiolist", + scrollspeed: 80, + scrollzone:120, + allowdragout: true + }); + } + }); + } + }, + + updateStreamName: function(streamid, name, uri, callback) { + $.post("utils/userstreams.php", { updatename: 1, streamid: streamid, name: name, uri: uri }) + .done( function(data) { + if (callback) { + callback(); + } + if (!prefs.hide_radiolist) { + $('#yourradiostations').html(data); + } + }); + }, + + addFave: function(data) { + data.addfave = 1; + $.post("utils/userstreams.php", data) + .done( function(data) { + $('#yourradiostations').html(data); + layoutProcessor.postAlbumActions(); + infobar.notify(language.gettext('label_addedradio')); + }); + }, + + removeUserStream: function(name) { + $.post("utils/userstreams.php", {remove: name}) + .done( function(data) { + $('#yourradiostations').html(data); + layoutProcessor.postAlbumActions(); + }) + .fail( function() { + playlist.repopulate(); + infobar.error(language.gettext("label_general_error")); + }); + }, + + saveRadioOrder: function() { + var radioOrder = Array(); + $("#yourradiostations").find(".clickradioremove").each( function() { + radioOrder.push($(this).attr('name')); + }); + + $.ajax({ + type: 'POST', + url: 'utils/userstreams.php', + data: {'order[]': radioOrder} + }); + }, + + handleDropRadio: function() { + setTimeout(function() { yourRadioPlugin.loadSuppliedStation }, 1000); + }, + + loadSuppliedStation: function() { + if ($("#yourradioinput").val() != '') { + var el = new Array(); + el.push($('
      ', {class: 'invisible clickstream', name: $("#yourradioinput").val(), supply: 'user'})); + playlist.addItems(el, null); + el[0].remove(); + } + }, + + handleClick: function(event, clickedElement) { + if (clickedElement.hasClass("clickradioremove")) { + event.stopImmediatePropagation(); + yourRadioPlugin.removeUserStream(clickedElement.attr("name")); + } + + } + +} + +menuOpeners['yourradiolist'] = yourRadioPlugin.loadStations; +clickRegistry.addClickHandlers('yourradio', yourRadioPlugin.handleClick); diff --git a/www/rompr/sw.js b/www/rompr/sw.js new file mode 100644 index 0000000..0aca893 --- /dev/null +++ b/www/rompr/sw.js @@ -0,0 +1,6 @@ +self.addEventListener('install', function(e) { + + // This is a dummy function because Chrome needs a service worker + // for Add To Home Screen to work + +}); diff --git a/www/rompr/themes/Acers.css b/www/rompr/themes/Acers.css new file mode 100644 index 0000000..addf8cb --- /dev/null +++ b/www/rompr/themes/Acers.css @@ -0,0 +1,424 @@ +/* +===================================================================== += Standard HTML Elements +===================================================================== +*/ + +html, body.phone .dropmenu { + background-image:url("themes/acers2.jpg"); + background-size:cover; + background-repeat:no-repeat; + background-attachment:fixed; +} + +body.phone .dropmenu>div.playable, +body.phone .dropmenu>div.menuitem, +body.phone #pluginplaylistholder .menuitem.clickicon, +body.phone #pluginplaylistholder .menuitem.containerbox.fullwidth { + background-color:rgba(0,0,0,0.2); + background-clip:border-box; + margin-top: 4px; +} + +body.phone .dropmenu>div { + background-color:rgba(0,0,0,0.2); +} + +body.phone .mainpane .faveradio, +body.phone .mainpane .radio, +body.phone .mainpane .podcast:not(.podicon):not(.podglobal), +body.phone .mainpane .directory { + background-color:rgba(0,0,0,0.3); + background-clip:border-box; + margin-top: 4px; +} + +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input,select { + color:#eeeeee; +} + +a:link { + color:yellow; +} + +a:visited { + color:yellow; +} + +a.album:visited { + color:#220000; +} + +a.album:hover,a.album:active { + text-shadow: 0 0 15px #ffffff; + color:#ffffff; + cursor:pointer; +} + +a:hover,a:active { + text-shadow: 0 0 15px #000000; + cursor:pointer; +} + +button, input[type="button"], .filebutton { + color:#dddddd; + background-color:rgba(206,37,214,0.2); + border: 1px solid transparent; + /* border:1px solid #aaaaaa; */ +} + +button:hover, input[type="button"]:hover, .filebutton:hover { + color:#ffffff; + border:1px solid #555555; + text-shadow: 0 0 12px #777777; +} + +.selectholder { + background-color:rgba(0,0,0,0.3); +} + +.selectholder:hover { + background-color:rgba(0,0,0,0.2); +} + +input[type="text"] { + background-color: rgba(0,0,0,0.3); + border-bottom: 1px solid #555555; +} + +input[type="text"]:hover { + background-color: rgba(0,0,0,0.2); + border-bottom: 1px solid #555555; +} + +input[type="text"]:focus { + transition: border-bottom 0.5s ease; + border-bottom: 1px solid #bbbbbb; +} + +select:hover { + color:#ffffff; +} + +.drop-box { + background-color: rgba(0,0,0,0.4); + color:white; +} + +/* reddish-purple */ +#pset { + background-color: rgba(142, 57, 109, 0.99); +} +/* yellowy-brown */ +#pmaxset { + background-color: rgba(151, 139, 106, 0.99); +} + +/* +===================================================================== += Specific Elements By ID +===================================================================== +*/ + +#sources, #infobar.coloured, #headerbar, #playlist, #thetopbit { + background-color:rgba(0,0,0,0.3); +} + +#infopane { + background-color:rgba(0,0,0,0.4); +} + +#notifications { + background-color:rgba(0,0,0,0.9); +} + +#wikipopup { + background-color:#000000; + opacity:0.75; +} + +#tagadder { + background-color:rgba(0,0,0,0.8); +} + +#artistchooser { + background-color:rgba(0,0,0,0.3); + color:#aaaaaa; +} + +#dragger { + background-color:rgba(0,0,0,0.3); +} + +/* +===================================================================== += General Classes +===================================================================== +*/ + +.mainpane { + background-color:rgba(0,0,0,0.2); +} + +.album2 { + background-color:rgba(0,0,0,0.2); +} + +.item { + margin-bottom: 2px; +} + +.playable:hover, .infoclick:hover, div.clickplaylist:hover, tr.playable:hover>td { + text-shadow: 0 0 15px #ffffff; + color:#ffffff; +} + +.selected { + background-color:rgba(255,72,0,0.5); +} + +.playlistcurrentitem { + font-weight:bold; + font-size:120%; + border-left:4px solid white; + color:#eeeeee; + transition:font-size 0.3s ease, text-shadow 0.3s ease; +} + +.clicktrack.playlistcurrentitem +{ + padding-left:8px; +} + +.playlistitem { + transition:font-size 0.3s ease, text-shadow 0.3s ease; +} + +.playlistcurrenttitle { + text-shadow: 0px 0px 20px #cccccc; + font-weight:bold; + color:#eeeeee; + background-color:rgba(0,0,0,0.3); +} + +.playlisttitle { + background-color:rgba(0,0,0,0.3); +} + +.stleft { + border-right:1px solid #888888; +} + +.infosection { + background-color:rgba(0,0,0,0.5); +} + +.popupwindow { + background-color:rgba(0,0,0,0.6); +} + +table.histable tr:hover { + font-size:105%; + text-shadow: 0 0 15px #ffffff; + color:#ffffff; + transition:all 0.1s; +} + +table.histable tr { + transition:all 0.2s; +} + +.backhi:hover { + text-shadow: 0 0 15px #ffffff; + color:#ff4800; + cursor:pointer; + transition:all 0.1s; +} + +.backhi { + transition:all 0.2s; +} + +tr.clickaddtrack:hover { + background-color:#e1e4ea; +} + +.bsel { + color:#ffffff; + text-shadow:0 0 15px #ffffff; +} + +.bmid { + border-left:2px solid #ff4800; +} + +.tagholder table tr th { + background-color:rgba(0,0,0,0.5); + border-bottom:1px solid #000000; +} + +.dropshadow { + box-shadow: 7px 7px 5px rgba(0, 0, 0, 0.4); +} + +.progressbar { + border:1px solid #666666; +} + +.progressbar_v { + border:1px solid #666666; +} + +/* +===================================================================== += Dropdown Menus +===================================================================== +*/ + +div.topdropmenu { + background-color:rgba(30,30,30,0.9); +} + +.configtitle { + background-color:rgba(138,45,90,0.4); +} + +body.mobile .configtitle { + width:100%; + margin-left:auto; + margin-right:auto; +} + +/* +===================================================================== += Info Panel - General +===================================================================== +*/ + +#artistbio { + padding:4px; +} + +.infowiki { + color:white; +} + +.currentbun { + border-bottom:1px solid #000000; + padding-bottom:2px; +} + +/* +===================================================================== += Info Panel - Spotify +===================================================================== +*/ + +.helpfulalbum +{ + background-color:rgba(0,0,0,0.4); +} + +.tagholder_wide +{ + background-color:rgba(0,0,0,0.6); +} + +/* +===================================================================== += Podcasts +===================================================================== +*/ + +.podcastitem +{ + border-top:1px solid #cccccc; +} + +/* +===================================================================== += For Album Art Manager +===================================================================== +*/ + +#artistcoverslist { + background-color:rgba(0,0,0,0.5); +} + +.highlighted { + background-color:rgba(0,0,0,0.5) !important; +} + +.albumcovers .infosection { + margin-bottom: 0px; +} + +.albumsection { + background-color:rgba(0,0,0,0.5); + box-sizing:border-box; +} + +/* +===================================================================== += Things that look like they might be for styling wikipedia data +===================================================================== +*/ + +table.navbox th +{ + background-color: rgba(0,0,0,0.2); +} + +.navbox-abovebelow +{ + padding-bottom:4px; +} + +.navbox-title a:link, +.navbox-abovebelow a:link, +.navbox-group a:link +{ + text-decoration:none; +} + +.navbox-title a:visited, +.navbox-abovebelow a:visited, +.navbox-group a:visited +{ + text-decoration:none; +} + +.navbox-title a:hover,a:active, +.navbox-abovebelow a:hover,a:active, +.navbox-group a:hover,a:active +{ + text-decoration:none; +} + +table.tracklist { + line-height:1.5em; +} + +.tracklist tbody tr th +{ + font-weight:bold; +} + +.description +{ + margin-top:4px; +} + +.underline +{ + border-bottom: 1px solid yellow; +} + +.infosection h2 +{ + border-bottom:2px solid white; +} + +.topbarplaycontrols { + background-color: rgba(0,0,0,0.2); +} diff --git a/www/rompr/themes/Aqua.css b/www/rompr/themes/Aqua.css new file mode 100644 index 0000000..f95a45e --- /dev/null +++ b/www/rompr/themes/Aqua.css @@ -0,0 +1,388 @@ +/* +===================================================================== += Standard HTML Elements +===================================================================== +*/ + +html, body.phone .dropmenu { + background-color:#e8ebf0; +} + +body,p,h1,h2,h3,h4,h5,h6,table,td,th,ul,ol,textarea,input { + color:#000000; +} + +body.phone .dropmenu>div.playable, +body.phone .dropmenu>div.menuitem, +body.phone .mainpane .radio, +body.phone .mainpane .faveradio, +body.phone .mainpane .podcast:not(.podicon):not(.podglobal), +body.phone .mainpane .directory { + border-top: 1px solid rgba(60,60,60,0.1); +} + +body.phone #pluginplaylistholder .menuitem.clickicon, +body.phone #pluginplaylistholder .menuitem.containerbox.fullwidth { + border-bottom: 1px solid rgba(60,60,60,0.1); +} + +a:link { + color:#0b0080; +} + +a:visited { + color:#0b0080; +} + +a:hover,a:active { + color:#ff4800; +} + +button, input[type="button"], .filebutton { + background-image: linear-gradient(#ccdcf2, #c0d0e7); + color:#000000; + border:1px solid #adadad; +} + +button:hover, input[type="button"]:hover, .filebutton:hover { + color:#3875d7; + border:1px solid #ccdcf2; + text-shadow: 0 0 15px #3875d7; +} + +input { + color:#181818; +} + +input.inbrowser, div.inbrowser { + border: 1px solid #888888; +} + +select { + color:#000000; +} + +/* +===================================================================== += Specific Elements By ID +===================================================================== +*/ +#pset { + background-color: rgba(192, 208, 231, 0.99); +} + +#pmaxset { + background-color: rgba(232, 235, 240, 0.99); +} + +#custombackground { + display:none; +} + +#headerbar { + background-image: linear-gradient(#b3b3b3, #afafaf); +} + +#infobar.coloured, #thetopbit { + background-image: linear-gradient(#E5E5E5, #b3b3b3); +} + +#horse { + background-image: linear-gradient(#afafaf, #b4b4b4); +} + +#playlist { + background-image: linear-gradient(#b4b4b4, #e5e5e5); +} + +#notifications { + background-color:#ccdcf2; +} + +#sources { + border-top:1px solid #000000; +} + +#infopane { + border-top:1px solid #000000; +} + +#wikipopup { + background-color:#000000; +} + +#tagadder { + background-color:#cccccc; +} + +#artistchooser { + border-bottom:1px solid #555555; + border-top:1px solid #555555; + color:#555555; +} + +#dragger { + background-color:rgba(0,0,0,0.5); +} + +/* +===================================================================== += General Classes +===================================================================== +*/ + +.bordered { + border-left:1px solid #9a9a9a; + border-bottom:1px solid #e0e0e0; + border-right:1px solid #e0e0e0; + border-top:1px solid #9a9a9a; +} + +.album2 { + background-color:rgba(225,228,234,0.75); +} + +.playable:hover, .infoclick:hover, div.clickplaylist:hover, tr.playable:hover>td { + color:#3875d7; +} + +.playable.selected:hover, tr.playable.selected:hover>td { + color:#000000; +} + +.selected { + background-color:#3875d7; +} + +.playlistcurrentitem { + color:#3875d7; +} + +.playlistcurrenttitle { + color:#3875d7; +} + +.item { + border-top:1px solid #cccccc; +} + +.stleft { + border-right:1px solid #888888; +} + +.popupwindow { + background-color:#cccccc; + border-left:1px solid #eeeeee; + border-bottom:1px solid #9a9a9a; + border-right:1px solid #9a9a9a; + border-top:1px solid #eeeeee; +} + +table.histable tr:hover { + background-color:#ccdcf2; +} + +.backhi:hover { + background-color:#ccdcf2; + cursor:pointer; +} + +tr.clickaddtrack:hover { + background-color:#e1e4ea; +} + +.tagholder table tr th { + background-color:#e8ebf0; + border-bottom:1px solid #000000; +} + +.bsel { + color:#ff4800; +} + +.bmid { + border-left:2px solid #ff4800; +} + +.currentbun { + border-bottom:1px solid #fe6500; + padding-bottom:2px; +} + +.dropshadow { + box-shadow: 7px 7px 5px rgba(50, 50, 50, 0.6); +} + +.progressbar { + border:1px solid #414141; +} + +.mCSB_draggerRail { + background:rgba(0,0,0,0.1) !important; +} + +.mCSB_dragger_bar { + background:rgba(0,0,0,0.75) !important; +} + +/* +===================================================================== += Dropdown Menus +===================================================================== +*/ + +div.topdropmenu +{ + background-image: linear-gradient(#E5E5E5, #b3b3b3); + border-left:1px solid #eeeeee; + border-bottom:1px solid #9a9a9a; + border-right:1px solid #9a9a9a; +} + +.configtitle +{ + background-image: linear-gradient(#E5E5E5, #b3b3b3); +} + +/* +===================================================================== += Info Panel - General +===================================================================== +*/ + +.infosection { + background-image: linear-gradient(#E5E5E5, #b3b3b3); +/} + +.infowiki { + background-color:#ffffff; +} + +.inbrowser { + color:#000000; +} + +/* +===================================================================== += Info Panel - Spotify +===================================================================== +*/ + +.helpfulalbum +{ + background-color:#cccccc; +} + +.tagholder_wide +{ + background-color:#cccccc; +} + +.tagholder_wide .helpfulalbum +{ + background-color:#bcbcbc; +} + +/* +===================================================================== += Podcasts +===================================================================== +*/ + +.podcastitem +{ + border-top:1px solid #000000; +} + +/* +===================================================================== += For Album Art Manager +===================================================================== +*/ + +.albumsection { + background-color:#b9d2fd; +} + +#imageeditor { + background-color:#b9d2fd; +} + +#albumcovers { + background-color:#adb4cd; +} + +.highlighted { + border-top: 4px solid #fe6800 !important; + border-left: 4px solid #fe6800 !important; + border-right: 4px solid #fe6800 !important; + border-bottom: 4px solid #fe6800 !important; + border-radius:2px !important; +} + +.covercontainer.highlighted +{ + border-bottom: none !important; + margin-bottom:-4px; + background-color:#b9d2fd; +} + +/* +===================================================================== += Things that look like they might be for styling wikipedia data +===================================================================== +*/ + +table.navbox th { + background-color: #e5e5e5; +} + +.navbox-abovebelow { + padding-bottom:4px; +} + +.navbox-title a:link, +.navbox-abovebelow a:link, +.navbox-group a:link +{ + text-decoration:none; +} + +.navbox-title a:visited, +.navbox-abovebelow a:visited, +.navbox-group a:visited +{ + text-decoration:none; +} + +.navbox-title a:hover,a:active, +.navbox-abovebelow a:hover,a:active, +.navbox-group a:hover,a:active +{ + text-decoration:none; +} + +table.tracklist { + line-height:1.5em; +} + +.tracklist tbody tr th { + font-weight:bold; +} + +.description { + margin-top:4px; +} + +.underline { + border-bottom: 1px solid #444444; +} + +.infosection h2 { + border-bottom:2px solid #444444; +} + +.topbarplaycontrols { + border-left: 1px solid black; + border-right: 1px solid black; +} diff --git a/www/rompr/themes/BrushedAluminium.css b/www/rompr/themes/BrushedAluminium.css new file mode 100644 index 0000000..7cd67d0 --- /dev/null +++ b/www/rompr/themes/BrushedAluminium.css @@ -0,0 +1,365 @@ +/* +===================================================================== += Standard HTML Elements +===================================================================== +*/ + +html, body.phone .dropmenu { + color:#000000; + background-image:url('newimages/silver1.jpg'); +} + +h1,h2,h3,h4,h5,h6 { + color:#000000; +} + +a:link { + color:#12569a; +} + +a:visited { + color:#12569a; +} + +a:hover,a:active { + color:#ff4800; +} + +button, .filebutton { + color:#000000; + border: 1px solid #000000; +} + +button:hover, .filebutton:hover { + color:#ff4800; + text-shadow: 0 0 15px #ff4800; +} + +input.inbrowser, div.inbrowser { + border: 1px solid #888888; +} + +.selectholder { + background-color:rgba(0,0,0,0.1); +} + +.selectholder:hover { + background-color:rgba(0,0,0,0.2); +} + +input[type="text"] { + background-color: rgba(0,0,0,0.1); +} + +input[type="text"]:hover { + background-color: rgba(0,0,0,0.2); +} + +input[type="text"]:focus { + transition: border-bottom 0.5s ease; + border-bottom: 1px solid #eeeeee; +} + +.drop-box { + background-color: rgba(0,0,0,0.2); + color:white; +} + +#pset { + background-color: rgba(201, 201, 201, 0.99); +} +#pmaxset { + background-color: rgba(255, 255, 255, 0.99); +} + +/* +===================================================================== += Specific Elements By ID +===================================================================== +*/ + +#custombackground { + display:none; +} + +#notifications { + background-image:url('newimages/silver2.jpg');; +} + +#wikipopup { + background-color:#000000; +} + +#imagecontainer { + background-color:#ffffff; +} + +#tagadder { + background-color:#ededed; +} + +#dragger { + background-color:rgba(0,0,0,0.5); +} + +/* +===================================================================== += General Classes +===================================================================== +*/ + +.bordered { + border-left:1px solid #aaaaaa; + border-bottom:1px solid #dddddd; + border-right:1px solid #dddddd; + border-top:1px solid #aaaaaa; +} + +.album1 { + background-image:url('newimages/silver2.jpg'); +} + +.album2 { + background-image:url('newimages/silver1.jpg'); +} + +.playable:hover, .infoclick:hover, div.clickplaylist:hover, tr.playable:hover>td { + color:#ff4800; +} + +.playable.selected:hover, tr.playable.selected:hover>td { + color:#dddddd; +} + +.selected { + background-color:#CC5500; +} + +.playlistcurrentitem { + color:#cc0000; +} + +.playlistcurrenttitle { + color:#cc0000; +} + +.item { + border-top:1px solid #000000; +} + +.stleft { + border-right:1px solid #aaaaaa; +} + +.popupwindow { + background-color:#dddddd; + border-left:2px solid #ffffff; + border-bottom:2px solid #555555; + border-right:2px solid #555555; + border-top:2px solid #ffffff; +} + +table.histable tr:hover { + background-color:#CC5500; +} + +.backhi:hover { + background-color:#CC5500; + cursor:pointer; +} + +tr.clickaddtrack:hover { + background-image:url('newimages/silver1.jpg'); +} + +.tagholder table tr th { + background-image:url('newimages/silver1.jpg'); + border-bottom:1px solid #000000; +} + +.bsel { + color:#ff4800; +} + +.bmid { + border-left:2px solid #ff4800; +} + +.currentbun { + border-bottom:1px solid #fe6500; + padding-bottom:2px; +} + +.dropshadow { + box-shadow: 7px 7px 5px rgba(50, 50, 50, 0.6); +} + +.progressbar { + border:1px solid #414141; +} + + +.mCSB_draggerRail { + background:rgba(0,0,0,0.1) !important; +} + +.mCSB_dragger_bar { + background:rgba(0,0,0,0.75) !important; +} + +.textunderline { + border-bottom: 1px solid #222222; +} + +/* +===================================================================== += Dropdown Menus +===================================================================== +*/ + +div.topdropmenu { + background-image:url('newimages/silver2.jpg');; + border-left:1px solid #ffffff; + border-bottom:1px solid #555555; + border-right:1px solid #555555; + border-top:none; +} + +.configtitle { + background-color:rgba(0,0,0,0.5); + color:white; +} + +/* +===================================================================== += Info Panel - General +===================================================================== +*/ + +.infosection { + background-color:#efefef; +} + +.infowiki { + background-color:#ffffff; +} + +/* +===================================================================== += Info Panel - Spotify +===================================================================== +*/ + +.helpfulalbum { + background-color:#dddddd; +} + +.tagholder_wide { + background-color:#dddddd; +} + +.tagholder_wide .helpfulalbum +{ + background-color:#cdcdcd; +} + +/* +===================================================================== += Podcasts +===================================================================== +*/ + +.podcastitem { + border-top:1px solid #000000; +} + +/* +===================================================================== += For Album Art Manager +===================================================================== +*/ + +#artistchooser { + border-bottom:1px solid #555555; + border-top:1px solid #555555; + color:#555555; +} + +#albumcovers { + background-color:#eeeeee; +} + +.albumsection { + background-color:#e7e7e7; +} + +.highlighted { + border-top: 4px solid #fe6800 !important; + border-left: 4px solid #fe6800 !important; + border-right: 4px solid #fe6800 !important; + border-bottom: 4px solid #fe6800 !important; + border-radius:2px !important; +} + +.covercontainer.highlighted +{ + border-bottom: none !important; + margin-bottom:-4px; + background-image:url('newimages/silver2.jpg'); +} + +#imageeditor { + background-image:url('newimages/silver2.jpg'); +} + +/* +===================================================================== += Things that look like they might be for styling wikipedia data +===================================================================== +*/ + +table.navbox th { + background-color: #e5e5e5; +} + +.navbox-title { + color:#000000; +} + +.navbox-group { + color:#000000; +} + +.navbox-abovebelow { + color:#000000; + padding-bottom:4px; +} + +.navbox-title a:link, +.navbox-abovebelow a:link, +.navbox-group a:link +{ + color:#990000; + text-decoration:none; +} + +.navbox-title a:visited, +.navbox-abovebelow a:visited, +.navbox-group a:visited +{ + color:#990000; + text-decoration:none; +} + +.navbox-title a:hover,a:active, +.navbox-abovebelow a:hover,a:active, +.navbox-group a:hover,a:active +{ + color:#ff4800; + text-decoration:none; +} + +.topbarplaycontrols { + border-left: 1px solid black; + border-right: 1px solid black; +} diff --git a/www/rompr/themes/Crystals.css b/www/rompr/themes/Crystals.css new file mode 100644 index 0000000..465f9ad --- /dev/null +++ b/www/rompr/themes/Crystals.css @@ -0,0 +1,460 @@ +/* +===================================================================== += Standard HTML Elements +===================================================================== +*/ + +html, body.phone .dropmenu { + background-image:url("themes/Crystals.jpg"); + background-size:cover; + background-repeat:no-repeat; + background-attachment:fixed; +} + +body.phone .dropmenu>div { + background-color:rgba(255,255,255,0.3); + background-clip:border-box; +} + +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea +{ + color:#000000; +} + +a:link +{ + color:#ff4800; +} + +a:visited +{ + color:#ff4800; +} + +a:hover,a:active +{ + text-shadow: 0 0 15px #000000; + cursor:pointer; +} + +button, input[type="button"], .filebutton +{ + color:#000000; + background-color:rgba(255,255,255,0.5); + border:1px solid #222222; +} + +button:hover, input[type="button"]:hover, .filebutton:hover +{ + color:#ffffff; + border:1px solid #ffffff; + text-shadow: 0 0 15px #ffffff; +} + +select { + color:#dddddd; +} + +select:hover { + color:#ffffff; +} + +input { + color: #dddddd; +} + +.selectholder { + background-color:rgba(0,0,0,0.4); +} + +.selectholder:hover { + background-color:rgba(0,0,0,0.5); +} + +input[type="text"] { + background-color: rgba(0,0,0,0.4); + border-bottom: 1px solid #555555; +} + +input[type="text"]:hover { + background-color: rgba(0,0,0,0.5); + border-bottom: 1px solid #555555; +} + +input[type="text"]:focus { + transition: border-bottom 0.5s ease; + border-bottom: 1px solid #bbbbbb; +} + +.drop-box { + background-color: rgba(0,0,0,0.5); + color:white; +} + +#pset { + background-color: rgba(156, 70, 81, 0.99); +} +#pmaxset { + background-color: rgba(187, 240, 254, 0.99); +} + +/* +===================================================================== += Specific Elements By ID +===================================================================== +*/ + +#sources +{ + background-color:rgba(255,255,255,0.3); +} + +#playlist +{ + background-color:rgba(255,255,255,0.3); +} + +#notifications +{ + background-color:rgba(65,65,85,0.9); + color:#ffffff; +} + +#wikipopup +{ + background-color:#000000; +} + +#imagecontainer +{ + background-color:#ffffff; +} + +#tagadder +{ + background-color:rgba(65,65,85,0.9); + color:white; +} + +#dragger +{ + background-color:rgba(0,0,0,0.3); +} + +/* +===================================================================== += General Classes +===================================================================== +*/ + +/*// Some stuff to pretty up the buttons when using the IconFont theme*/ + +.controlbutton { + text-shadow: 0 0 30px #cccccc, 0 0 20px #ffffff !important; +} + +.controlbutton-small { + text-shadow: 0 0 30px #cccccc, 0 0 20px #ffffff !important; +} + +.mainpane +{ + background-color:rgba(255,255,255,0.3); +} + +.album2 +{ + background-color:rgba(255,255,255,0.2); +} + +.item +{ + margin-bottom: 2px; +} + +.playable:hover, .infoclick:hover, div.clickplaylist:hover, tr.playable:hover>td { + text-shadow: 0 0 15px #ffffff; + color:#ffffff; +} + +div.clickable.selected:hover +{ + color:#ffffff; +} + +.selected +{ + background-color:rgba(255,72,0,0.7); +} + +/*-- divs and classes used in the playlist --*/ + +.playlistcurrentitem +{ + font-weight:bold; + font-size:120%; + color:#ff4800; + transition:font-size 0.2s ease, text-shadow 0.2s ease; +} + +.playlistitem +{ + transition:font-size 0.3s ease, text-shadow 0.3s ease; +} + +.playlistcurrenttitle +{ + text-shadow: 0px 0px 20px #cccccc; + font-weight:bold; + color:#ff4800; + background-color:rgba(255,255,255,0.2); +} + +.playlisttitle{ + background-color:rgba(255,255,255,0.2); +} + +.stleft +{ + border-right:1px solid #888888; +} + +.popupwindow +{ + background-color:rgba(65,65,85,0.9); + color:white; +} + +.popupwindow td, .popupwindow h2, .popupwindow p +{ + color:white; +} + +table.histable tr:hover { + font-size:105%; + text-shadow: 0 0 15px #ffffff; + color:#000000; + transition:all 0.1s; +} + +table.histable tr +{ + transition:all 0.2s; +} + +.backhi:hover { + text-shadow: 0 0 15px #ffffff; + color:#ff4800; + cursor:pointer; + transition:all 0.1s; +} + +.backhi +{ + transition:all 0.2s; +} + +tr.clickaddtrack:hover +{ + background-color:#e1e4ea; +} + +.bsel +{ + color:#000000; + text-shadow:0 0 15px #666666; +} + +.bmid +{ + border-left:2px solid #ff4800; +} + +.tagholder table tr th { + background-color:rgba(255,255,255,0.5); + border-bottom:1px solid #333333; +} + +.currentbun +{ + border-bottom:1px solid #fe6500; + padding-bottom:2px; +} + +.dropshadow +{ + box-shadow: 7px 7px 5px rgba(50, 50, 50, 0.5); +} + +.progressbar +{ + border:1px solid #414141; +} + +.progressbar_v +{ + border:1px solid #414141; +} + +/* +===================================================================== += Dropdown Menus +===================================================================== +*/ + +div.topdropmenu +{ + background-color:rgba(1,133,215,0.9); +} + +.configtitle +{ + background-color: rgba(162, 72, 84, 0.7); +} + +body.mobile .configtitle +{ + width:100%; + margin-left:auto; + margin-right:auto; +} + +/* +===================================================================== += Info Panel - General +===================================================================== +*/ + +#infopane +{ + background-color:rgba(255,255,255,0.4); +} + +#artistbio +{ + padding:4px; +} + +.infowiki +{ + color:black; +} + +.infosection +{ + background-color:rgba(255,255,255,0.4); + background-size:cover; + background-repeat:no-repeat; +} + +/* +===================================================================== += Info Panel - Spotify +===================================================================== +*/ +.helpfulalbum +{ + background-color:rgba(255,255,255,0.4); +} + +.tagholder_wide +{ + background-color:rgba(255,255,255,0.3); +} + +/* +===================================================================== += Podcasts +===================================================================== +*/ + +.podcastitem +{ + border-top:1px solid #000000; +} + +/* +===================================================================== += For Album Art Manager +===================================================================== +*/ + +#artistcoverslist +{ + background-color:rgba(255,255,255,0.3); +} + +.highlighted { + background-color:rgba(255,255,255,0.7); +} + +#artistchooser +{ + background-color:rgba(255,255,255,0.2); + color:#777777; +} + +/* +===================================================================== += Things that look like they might be for styling wikipedia data +===================================================================== +*/ + +table.navbox th +{ + background-color: rgba(255,255,255,0.2); +} + +.navbox-abovebelow +{ + padding-bottom:4px; +} + +.navbox-title a:link, +.navbox-abovebelow a:link, +.navbox-group a:link +{ + text-decoration:none; +} + +.navbox-title a:visited, +.navbox-abovebelow a:visited, +.navbox-group a:visited +{ + text-decoration:none; +} + +.navbox-title a:hover,a:active, +.navbox-abovebelow a:hover,a:active, +.navbox-group a:hover,a:active +{ + text-decoration:none; +} + +table.tracklist { + line-height:1.5em; +} + +.tracklist tbody tr th +{ + font-weight:bold; +} + +.description +{ + margin-top:4px; +} + +.underline +{ + border-bottom: 1px solid black; +} + +.infosection h2 +{ + border-bottom:2px solid black; +} + +.topbarplaycontrols { + background-color: rgba(0,0,0,0.2); +} diff --git a/www/rompr/themes/Crystals.jpg b/www/rompr/themes/Crystals.jpg new file mode 100644 index 0000000..cbc4ae0 Binary files /dev/null and b/www/rompr/themes/Crystals.jpg differ diff --git a/www/rompr/themes/Curves.css b/www/rompr/themes/Curves.css new file mode 100644 index 0000000..78e7608 --- /dev/null +++ b/www/rompr/themes/Curves.css @@ -0,0 +1,510 @@ +/* +===================================================================== += Standard HTML Elements +===================================================================== +*/ + +html, body.phone .dropmenu { + background-image: linear-gradient(#999999, #eeeeee, #aaaaaa); + background-color:#aaaaaa; +} + +body,p,h1,h2,h3,h4,h5,h6,table,td,th,ul,ol,textarea,input +{ + color:#000000; +} +a:link +{ + color:#0b0080; +} + +a:visited +{ + color:#0b0080; +} + +a:hover,a:active +{ + text-shadow: 0 0 15px #ff4800; + cursor:pointer; +} + +button, input[type="button"], .filebutton +{ + background-image: linear-gradient(#999999, #cccccc, #999999); + color:#ee3700; + border:0px none; + border-radius:0.5em; +} + +input +{ + color:#181818; + border-radius: 0.5em !important; +} + +input.inbrowser, div.inbrowser +{ + border: 1px solid #888888; +} + +select +{ + color:#000000; + border-radius:0.5em !important; +} + +/* +===================================================================== += Specific Elements By ID +===================================================================== +*/ + +#custombackground +{ + display:none; +} + +#notifications +{ + background-image: linear-gradient(#999999, #cccccc, #999999); + border-bottom-left-radius:1em; + border-bottom-right-radius:1em; +} + +#wikipopup +{ + background-color:#000000; + border-radius: 1em; +} + +#imagecontainer +{ + background-color:#ffffff; +} + +#wobblebottom { + background-color:#aaaaaa; +} + +#tagadder +{ + background-color:#cccccc; + border-radius:1em; +} + +#dragger +{ + background-color:rgba(0,0,0,0.5); +} + +/* +===================================================================== += General Classes +===================================================================== +*/ + +.bordered +{ + border-left:1px solid #9a9a9a; + border-bottom:1px solid #e0e0e0; + border-right:1px solid #e0e0e0; + border-top:1px solid #9a9a9a; + border-radius:1em; +} + +.progressbar_v, .progressbar +{ + border-radius:1em; +} + +.selectholder +{ + border-radius:0.5em !important; +} + +.playable:hover, .infoclick:hover, div.clickplaylist:hover, tr.playable:hover>td { + text-shadow: 0 0 15px #ff4800; +} + +.playable.selected:hover, tr.playable.selected:hover>td { + color:#000000; +} + +.selected +{ + background-color:#ff4800; +} + +.playlistcurrentitem +{ + font-weight:bold; + font-size:105%; + text-shadow: 0 0 15px #ff4800; + transition:font-size 0.3s ease, text-shadow 0.3s ease; +} + +.playlistitem +{ + transition:font-size 0.3s ease, text-shadow 0.3s ease; +} + +.playlistcurrenttitle +{ + text-shadow: 0 0 15px #ff4800; + font-weight:bold; +} + +.inbrowser +{ + color:#000000; +} + +.stleft +{ + border-right:1px solid #888888; +} + +.popupwindow +{ + background-image: linear-gradient(#999999, #cccccc, #999999); + border-left:1px solid #eeeeee; + border-bottom:1px solid #9a9a9a; + border-right:1px solid #9a9a9a; + border-top:1px solid #eeeeee; + border-radius:1em; +} + +.tagmenu +{ + border-radius:1em; +} + +table.histable tr:hover { + font-size:105%; + text-shadow: 0 0 15px #ff4800; + transition:all 0.1s; +} + +table.histable tr +{ + transition:all 0.2s; +} + +.backhi:hover { + text-shadow: 0 0 15px #ff4800; + cursor:pointer; + transition:all 0.1s; +} + +.backhi +{ + transition:all 0.2s; +} + +tr.clickaddtrack:hover +{ + background-color:#e1e4ea; +} + +.tagholder table tr th { + background-color:rgba(255,255,255,0.5); + border-bottom:1px solid #cccccc; +} + +.bsel +{ + color:#ff4800; +} + +.bmid +{ + border-left:2px solid #ff4800; +} + +.currentbun +{ + border-bottom:1px solid #fe6500; + padding-bottom:2px; +} + +.dropshadow +{ + box-shadow: 7px 7px 5px rgba(50, 50, 50, 0.6); +} + +.progressbar +{ + border:1px solid #414141; +} + +.progressbar_v +{ + border-left:1px solid #9a9a9a; + border-bottom:1px solid #e0e0e0; + border-right:1px solid #e0e0e0; + border-top:1px solid #9a9a9a; +} + +.mCSB_draggerRail +{ + background:rgba(0,0,0,0.1) !important; +} + +.mCSB_dragger_bar +{ + background:rgba(0,0,0,0.75) !important; +} + +/* +===================================================================== += Dropdown Menus +===================================================================== +*/ + +div.topdropmenu +{ + background-image: linear-gradient(#999999, #cccccc, #999999); + border-left:1px solid #eeeeee; + border-bottom:1px solid #9a9a9a; + border-right:1px solid #9a9a9a; +} + +div.rightmenu +{ + border-top-left-radius: 1em; + border-top-right-radius: 0; + border-bottom-left-radius: 1em; + border-bottom-right-radius: 1em; +} + +div.leftmenu +{ + border-top-left-radius: 0; + border-top-right-radius: 1em; + border-bottom-left-radius: 1em; + border-bottom-right-radius: 1em; +} + +.configtitle +{ + background-image: linear-gradient(#999999, #cccccc, #999999); + border-radius:0.5em; + color:#000000; +} + +body.mobile .configtitle +{ + width:95%; + margin-left:auto; + margin-right:auto; +} + +/* +===================================================================== += Info Panel - General +===================================================================== +*/ + +.infowiki +{ + background-image: linear-gradient(#ffffff, #aaaaaa); +} + +.infosection +{ + background-image: linear-gradient(#999999, #eeeeee, #999999); + border-radius:1em; + padding-left:1em; +} + +/* +===================================================================== += Info Panel - Spotify +===================================================================== +*/ + +.helpfulalbum +{ + background-color: #d0d0d0; + border-radius:1em; +} + +.containerbox .podcast .helpfulalbum.expand +{ + border-bottom-left-radius: 0px; + border-bottom-right-radius: 0px; +} + +.containerbox .podcast .helpfulalbum.fixed +{ + border-top-left-radius: 0px; + border-top-right-radius: 0px; +} + +.tagholder_wide +{ + background-color: #d0d0d0; + border-radius:1em; +} + +.tagholder_wide .helpfulalbum +{ + background-color: #c0c0c0; +} + +.tagholder_wide .helpfulalbum.tleft +{ + padding-top:1.5% !important; +} + +/* +===================================================================== += Podcasts +===================================================================== +*/ + +.podcastitem +{ + border-top:1px solid #000000; +} + +/* +===================================================================== += For Album Art Manager +===================================================================== +*/ + +button:hover, input[type="button"]:hover, .filebutton:hover +{ + color:#ff4800; + text-shadow: 0 0 15px #ff4800; +} + +.albumsection +{ + background-image: linear-gradient(#999999, #eeeeee, #999999); + border-radius:1em; + padding-left:1em; + box-sizing:border-box; +} + +#albumcovers +{ + background-image: linear-gradient(#ffffff, #aaaaaa); +} + +.highlighted { + border-top: 4px solid #fe6800 !important; + border-left: 4px solid #fe6800 !important; + border-right: 4px solid #fe6800 !important; + border-bottom: 4px solid #fe6800 !important; + border-radius:12px !important; +} + +.covercontainer.highlighted +{ + border-bottom: none !important; + margin-bottom:-4px; + background-color:#aaaaaa; + border-radius:12px 12px 0px 0px !important; +} + +#imageeditor +{ + border-radius:12px !important; + background-color:#aaaaaa; +} + +#artistchooser +{ + border-bottom:1px solid #555555; + border-top:1px solid #555555; + color:#555555; +} + +/* +===================================================================== += Things that look like they might be for styling wikipedia data +===================================================================== +*/ + +table.navbox th +{ + background-color: rgba(0,0,0,0.1); +} + +div.toc +{ + border-radius:1em; +} + +.infobox +{ + border-radius:1em; +} + +table.infobox th +{ + border-radius:1em; +} + +.quotebox +{ + border-radius:1em; +} + +.infotext table +{ + border-radius:1em !important; +} + +.navbox-abovebelow +{ + padding-bottom:4px; +} + +.navbox-title a:link, +.navbox-abovebelow a:link, +.navbox-group a:link +{ + text-decoration:none; +} + +.navbox-title a:visited, +.navbox-abovebelow a:visited, +.navbox-group a:visited +{ + text-decoration:none; +} + +.navbox-title a:hover,a:active, +.navbox-abovebelow a:hover,a:active, +.navbox-group a:hover,a:active +{ + text-decoration:none; +} + +table.tracklist { + line-height:1.5em; +} + +.tracklist tbody tr th +{ + font-weight:bold; +} + +.description +{ + margin-top:4px; +} + +.underline +{ + border-bottom: 1px solid #444444; +} + +.infosection h2 +{ + border-bottom:2px solid #444444; +} diff --git a/www/rompr/themes/Darkness.css b/www/rompr/themes/Darkness.css new file mode 100644 index 0000000..b7a61d7 --- /dev/null +++ b/www/rompr/themes/Darkness.css @@ -0,0 +1,466 @@ +/* +===================================================================== += Standard HTML Elements +===================================================================== +*/ + +html, body.phone .dropmenu { + background-color:#181818; +} + +body.phone .dropmenu div.playable, body.phone .dropmenu div.menu { + background-color: rgba(100,100,100,0.1); +} + +body,p,h1,h2,h3,h4,h5,h6,table,td,th,ul,ol,textarea,input +{ + color:#dddddd; +} + +button, input[type="button"], .filebutton +{ + background-color:#202020; + border:1px solid #dedede; + /* background-image:none !important; */ + color:#dddddd; + font-weight:bold; + font-size:110%; +} + +button:hover, input[type="button"]:hover, .filebutton:hover +{ + color:#ff4800; + border:1px solid #ff4800; + text-shadow: 0 0 15px #ff4800; +} + +input[type="submit"] +{ + color: #ffffff; +} + +a:link +{ + color:#dcdcff; +} + +a:visited +{ + color:#dcdcff; +} + +a:hover,a:active +{ + color:#ff4800; +} + +select { + color:#dddddd; +} + +select:hover { + color:#ffffff; +} + +.selectholder { + background-color:rgba(0,0,0,0.3); + border: 1px solid #555555; +} + +.selectholder:hover { + background-color:rgba(0,0,0,0.2); +} + +input[type="text"] { + background-color: rgba(0,0,0,0.3); + border-bottom: 1px solid #555555; + border-top: 1px solid #232323; +} + +input[type="text"]:hover { + background-color: rgba(0,0,0,0.2); +} + +input[type="text"]:focus { + transition: border-bottom 0.5s ease; + transition: border-top 0.5s ease; + border-bottom: 1px solid #bbbbbb; + border-top: 1px solid #555555; +} + +.drop-box { + background-color: rgba(0,0,0,0.2); + color:white; +} + +/* +===================================================================== += Specific Elements By ID +===================================================================== +*/ + +#headerbar +{ + background-color:#181818; +} + +#infopane +{ + box-sizing:border-box; + border-left: 2px solid gray; + border-right: 2px solid gray; + border-top: 2px solid gray; +} + +#custombackground +{ + display:none; +} + +#notifications +{ + background-color:#000000; +} + +#wikipopup +{ + background-color:#000000; +} + +#imagecontainer +{ + background-color:#ffffff; +} + +#tagadder +{ + background-color:#000000; + border-left:1px solid #666666; + border-bottom:1px solid #000000; + border-right:1px solid #000000; +} + +#dragger +{ + background-color:rgba(255,255,255,0.3); +} + +/* +===================================================================== += General Classes +===================================================================== +*/ + +.bordered +{ + border-left:1px solid #000000; + border-bottom:1px solid #232323; + border-right:1px solid #232323; + border-top:1px solid #000000; +} + +.album1 +{ + background-color:#252525; +} + +.album2 +{ + background-color:#181818; +} + +a.album:visited +{ + color:#dcdcff; +} + +a.album:hover,a.album:active +{ + color:#ff4800; +} + +.playable:hover, .infoclick:hover, div.clickplaylist:hover, tr.playable:hover>td { + color:#ff4800; +} + +.playable.selected:hover, tr.playable.selected:hover>td { + color:#dddddd; +} + +.selected +{ + background-color:#CC5500; +} + +.playlistcurrentitem +{ + font-size:110%; + text-shadow: 0 0 15px #ffffff; + transition:font-size 0.5s ease, text-shadow 0.5s ease; + color:#ffffff; +} + +.playlistitem, .playlistalbum +{ + transition:font-size 0.5s ease, text-shadow 0.5s ease; +} + +.playlistcurrenttitle +{ + font-size: 125%; + text-shadow: 0 0 20px #ffffff; + color:#ffffff; + transition:font-size 0.5s ease, text-shadow 0.5s ease; +} + +.item +{ + border-top:1px solid #cccccc; +} + +.stleft +{ + border-right:1px solid #aaaaaa; +} + +.popupwindow +{ + background-color:#111111; + border-left:1px solid #666666; + border-bottom:1px solid #000000; + border-right:1px solid #000000; + border-top:1px solid #666666; +} + +.backhi:hover { + color:#ff4800; + cursor:pointer; +} + +table.histable tr:hover { + background-color:#ff4800; + cursor:pointer; +} + +.tagholder table tr th +{ + border-bottom:1px solid #cccccc; + background-color:#000000; +} + +tr.clickaddtrack:hover +{ + background-color:#353535; +} + +.bsel +{ + color:#ff4800; +} + +.bmid +{ + border-left:2px solid #ff4800; +} + +.currentbun +{ + border-bottom:1px solid #fe6500; + padding-bottom:2px; +} + +.dropshadow +{ + box-shadow: 7px 7px 5px rgba(0, 0, 0, 0.9); +} + +.progressbar +{ + border:1px solid #414141; +} + +.progressbar_v +{ + border-left:1px solid #000000; + border-bottom:1px solid #343434; + border-right:1px solid #343434; + border-top:1px solid #000000; +} + +/* +===================================================================== += Dropdown Menus +===================================================================== +*/ + +div.topdropmenu +{ + background-color:#191919; + border-left:1px solid #262626; + border-bottom:1px solid #000000; + border-right:1px solid #000000; + border-top:none; +} + +.configtitle +{ + background-color:#252525; + border-bottom: 1px solid #555555; +} + +/* +===================================================================== += Info Panel - General +===================================================================== +*/ + +.infowiki +{ + background-color:#181818; +} + +/* +===================================================================== += Info Panel - Spotify +===================================================================== +*/ + +.helpfulalbum +{ + background-color:#303030; +} + +.tagholder_wide +{ + background-color:#404040; +} + +/* +===================================================================== += Podcasts +===================================================================== +*/ + +.podcastitem +{ + border-top:1px solid #cccccc; +} + +/* +===================================================================== += For Album Art Manager +===================================================================== +*/ + +.albumsection +{ + background-color:#000000; +} + +#albumcovers +{ + background-color:#444444; +} + +#coverslist +{ + box-sizing:border-box; + border-left:1px solid #bbbbbb; +} + +.highlighted { + border-top: 4px solid #fe6800 !important; + border-left: 4px solid #fe6800 !important; + border-right: 4px solid #fe6800 !important; + border-bottom: 4px solid #fe6800 !important; + border-radius:2px !important; +} + +.covercontainer.highlighted +{ + border-bottom: none !important; + margin-bottom:-4px; + background-color:#181818; +} + +#imageeditor +{ + background-color:#181818; +} + +#artistchooser +{ + border-bottom:1px solid #777777; + color:#555555; +} + +/* +===================================================================== += Things that look like they might be for styling wikipedia data +===================================================================== +*/ + +table.navbox th +{ + background-color: rgba(255,255,255,0.1); +} + +.navbox-abovebelow +{ + padding-bottom:4px; +} + +.navbox-title a:link, +.navbox-abovebelow a:link, +.navbox-group a:link +{ + text-decoration:none; +} + +.navbox-title a:visited, +.navbox-abovebelow a:visited, +.navbox-group a:visited +{ + text-decoration:none; +} + +.navbox-title a:hover,a:active, +.navbox-abovebelow a:hover,a:active, +.navbox-group a:hover,a:active +{ + text-decoration:none; +} + +table.tracklist { + line-height:1.5em; +} + +.tracklist tbody tr th +{ + font-weight:bold; +} + +th.tlheader +{ + background-color:#232323; +} + +.description +{ + margin-top:4px; +} + +.underline +{ + border-bottom: 1px solid #999999; +} + +.infosection h2 +{ + border-bottom:2px solid #eeeeee; +} + +.topbarplaycontrols { + border-left: 1px solid white; + border-right: 1px solid white; +} diff --git a/www/rompr/themes/DarknessHiDPI.css b/www/rompr/themes/DarknessHiDPI.css new file mode 100644 index 0000000..50c3429 --- /dev/null +++ b/www/rompr/themes/DarknessHiDPI.css @@ -0,0 +1,455 @@ +/* +===================================================================== += Standard HTML Elements +===================================================================== +*/ + +html, body.phone .dropmenu { + background: #101010 url("themes/bg.jpg"); + background-image: -webkit-radial-gradient(50% 150px, circle cover, rgba(200, 125, 0, 0.0980392) 12%, rgba(0, 0, 0, 0.2) 51%), url("themes/bg.jpg"); + background-image: -moz-radial-gradient(50% 150px, circle cover, rgba(200, 125, 0, 0.0980392) 12%, rgba(0, 0, 0, 0.2) 51%), url("themes/bg.jpg"); + background-image: -ms-radial-gradient(50% 150px, circle cover, rgba(200, 125, 0, 0.0980392) 12%, rgba(0, 0, 0, 0.2) 51%), url("themes/bg.jpg"); + background-image: -o-radial-gradient(50% 150px, circle cover, rgba(200, 125, 0, 0.0980392) 12%, rgba(0, 0, 0, 0.2) 51%), url("themes/bg.jpg"); + background-image: radial-gradient(50% 150px, circle cover, rgba(200, 125, 0, 0.0980392) 12%, rgba(0, 0, 0, 0.2) 51%), url("themes/bg.jpg"); + background-repeat: no-repeat, repeat; + background-attachment: fixed; + min-height: 100%; +} + +body,p,h1,h2,h3,h4,h5,h6,table,td,th,ul,ol,textarea,input +{ + color:#dddddd; +} + +button, .filebutton +{ + background-color:#202020; + border:1px solid #dedede; + /* background-image:none !important; */ + color:#dddddd; + font-weight:bold; + font-size:110%; +} + +button:hover, .filebutton:hover +{ + color:#ff4800; + text-shadow: 0 0 15px #ff4800; +} + +input +{ + color:#181818; +} + +input.snapclientname[type=text] { + color: #ffffff; +} + +a:link +{ + color:#dcdcff; +} + +a:visited +{ + color:#dcdcff; +} + +a:hover,a:active +{ + color:#ff4800; +} + +/* +===================================================================== += Specific Elements By ID +===================================================================== +*/ + +#custombackground +{ + display:none; +} + +#volumecontrol +{ + height:98%; + width:18px; +} + +#notifications +{ + background-color:#000000; +} + +#wikipopup +{ + background-color:#000000; +} + +#imagecontainer +{ + background-color:#ffffff; +} + +#tagadder +{ + background-color:#000000; + border-left:1px solid #666666; + border-bottom:1px solid #000000; + border-right:1px solid #000000; +} + +#dragger +{ + background-color:rgba(255,255,255,0.3); +} + +/* +===================================================================== += General Classes +===================================================================== +*/ + +.bordered +{ + border-bottom:1px solid #343434; +} + +.infobarlayout +{ + margin: 0px; + padding-right: 12px; +} + +.progressbar_v +{ + /* width:auto; */ + border-radius:5px; +} + +.progressbar_v:hover +{ + border-color:#666; + box-shadow: 0 0 15px #666; +} + +.progressbar:hover +{ + border-color:#666; + box-shadow: 0 0 15px #666; +} + +.album1 +{ + background-color:#252525; +} + +.album2 +{ + background-color:#181818; +} + +.playable:hover, .infoclick:hover, div.clickplaylist:hover, tr.playable:hover>td { + color:#ff4800; +} + +.playable.selected:hover, tr.playable.selected:hover>td { + color:#dddddd; +} + +.selected +{ + background-color:#CC5500; +} + +.playlistcurrentitem +{ + color:#cc0000; +} + +.playlistcurrenttitle +{ + color:#cc0000; +} + +.item +{ + border-top:1px solid #cccccc; +} + +.inbrowser +{ + color:#000000; +} + +.stleft +{ + border-right:1px solid #aaaaaa; +} + +.popupwindow +{ + background-color:#111111; + border-left:1px solid #666666; + border-bottom:1px solid #000000; + border-right:1px solid #000000; + border-top:1px solid #666666; +} + +.backhi:hover { + background-color:#454545; + cursor:pointer; +} + +.tagholder table tr th +{ + border-bottom:1px solid #cccccc; + background-color:#000000; +} + +tr.clickaddtrack:hover +{ + background-color:#353535; +} + +.drop-box +{ + background-color:#fefefe; + color:#090909; +} + +.bsel +{ + color:#ff4800; +} + +.bmid +{ + border-left:2px solid #ff4800; +} + +.currentbun +{ + border-bottom:1px solid #fe6500; + padding-bottom:2px; +} + +.dropshadow +{ + box-shadow: 7px 7px 5px rgba(0, 0, 0, 0.8); +} + +.progressbar +{ + border:1px solid #414141; +} + +.progressbar_v +{ + border-left:1px solid #000000; + border-bottom:1px solid #343434; + border-right:1px solid #343434; + border-top:1px solid #000000; +} + +/* +===================================================================== += Dropdown Menus +===================================================================== +*/ + +div.topdropmenu +{ + background-color:#191919; + border-left:1px solid #262626; + border-bottom:1px solid #000000; + border-right:1px solid #000000; + border-top:none; +} + +.configtitle +{ + background-color:#252525; +} + +/* +===================================================================== += Info Panel - General +===================================================================== +*/ + +.infosection +{ + border-top:1px solid #000000; +} + +.infowiki +{ + background-color:#181818; + background-color:rgba(24, 24, 24, 0.4); +} + +/* +===================================================================== += Info Panel - Spotify +===================================================================== +*/ + +.helpfulalbum +{ + background-color:#303030; +} + +.tagholder_wide +{ + background-color:#404040; +} + +/* +===================================================================== += Podcasts +===================================================================== +*/ + +.podcastitem +{ + border-top:1px solid #cccccc; +} + +/* +===================================================================== += For Album Art Manager +===================================================================== +*/ + +.albumsection +{ + background-color:#000000; +} + +#albumcovers +{ + background-color:#444444; +} + +#coverslist +{ + box-sizing:border-box; + border-left:1px solid #bbbbbb; +} + +.highlighted { + border-top: 4px solid #fe6800 !important; + border-left: 4px solid #fe6800 !important; + border-right: 4px solid #fe6800 !important; + border-bottom: 4px solid #fe6800 !important; + border-radius:2px !important; +} + +.covercontainer.highlighted +{ + border-bottom: none !important; + margin-bottom:-4px; + background-color:#181818; + background: #101010 url("themes/bg.jpg"); + background-image: -webkit-radial-gradient(50% 150px, circle cover, rgba(200, 125, 0, 0.0980392) 12%, rgba(0, 0, 0, 0.2) 51%), url("themes/bg.jpg"); + background-image: -moz-radial-gradient(50% 150px, circle cover, rgba(200, 125, 0, 0.0980392) 12%, rgba(0, 0, 0, 0.2) 51%), url("themes/bg.jpg"); + background-image: -ms-radial-gradient(50% 150px, circle cover, rgba(200, 125, 0, 0.0980392) 12%, rgba(0, 0, 0, 0.2) 51%), url("themes/bg.jpg"); + background-image: -o-radial-gradient(50% 150px, circle cover, rgba(200, 125, 0, 0.0980392) 12%, rgba(0, 0, 0, 0.2) 51%), url("themes/bg.jpg"); + background-image: radial-gradient(50% 150px, circle cover, rgba(200, 125, 0, 0.0980392) 12%, rgba(0, 0, 0, 0.2) 51%), url("themes/bg.jpg"); + background-repeat: no-repeat, repeat; + background-attachment: fixed; +} + +#imageeditor +{ + background-color:#181818; + background: #101010 url("themes/bg.jpg"); + background-image: -webkit-radial-gradient(50% 150px, circle cover, rgba(200, 125, 0, 0.0980392) 12%, rgba(0, 0, 0, 0.2) 51%), url("themes/bg.jpg"); + background-image: -moz-radial-gradient(50% 150px, circle cover, rgba(200, 125, 0, 0.0980392) 12%, rgba(0, 0, 0, 0.2) 51%), url("themes/bg.jpg"); + background-image: -ms-radial-gradient(50% 150px, circle cover, rgba(200, 125, 0, 0.0980392) 12%, rgba(0, 0, 0, 0.2) 51%), url("themes/bg.jpg"); + background-image: -o-radial-gradient(50% 150px, circle cover, rgba(200, 125, 0, 0.0980392) 12%, rgba(0, 0, 0, 0.2) 51%), url("themes/bg.jpg"); + background-image: radial-gradient(50% 150px, circle cover, rgba(200, 125, 0, 0.0980392) 12%, rgba(0, 0, 0, 0.2) 51%), url("themes/bg.jpg"); + background-repeat: no-repeat, repeat; + background-attachment: fixed; +} + +#artistchooser +{ + border-bottom:1px solid #777777; + border-top:1px solid #777777; + color:#555555; +} + +/* +===================================================================== += Things that look like they might be for styling wikipedia data +===================================================================== +*/ + +table.navbox th +{ + background-color: rgba(255,255,255,0.1); +} + +.navbox-abovebelow +{ + padding-bottom:4px; +} + +.navbox-title a:link, +.navbox-abovebelow a:link, +.navbox-group a:link +{ + text-decoration:none; +} + +.navbox-title a:visited, +.navbox-abovebelow a:visited, +.navbox-group a:visited +{ + text-decoration:none; +} + +.navbox-title a:hover,a:active, +.navbox-abovebelow a:hover,a:active, +.navbox-group a:hover,a:active +{ + text-decoration:none; +} + +table.tracklist { + line-height:1.5em; +} + +.tracklist tbody tr th +{ + font-weight:bold; +} + +th.tlheader +{ + background-color:#232323; +} + +.description +{ + margin-top:4px; +} + +.underline +{ + border-bottom: 1px solid #999999; +} + +.infosection h2 +{ + border-bottom:2px solid #eeeeee; +} + +.topbarplaycontrols { + border-left: 1px solid white; + border-right: 1px solid white; +} diff --git a/www/rompr/themes/ElegantGrey.css b/www/rompr/themes/ElegantGrey.css new file mode 100644 index 0000000..d5e7e9b --- /dev/null +++ b/www/rompr/themes/ElegantGrey.css @@ -0,0 +1,484 @@ +/* +===================================================================== += Standard HTML Elements +===================================================================== +*/ + +body +{ + +} + +body,p,h1,h2,h3,h4,h5,h6,table,td,th,ul,ol,input +{ + color:#dddddd; +} + +button, input[type="button"], .filebutton +{ + background-color:#000000; + border:none; + color:#dddddd; + font-weight:bold; + font-size:110%; +} + +button:hover, input[type="button"]:hover, .filebutton:hover +{ + background-color:#222222; + color:#ffffff; +} + +select { + color:#dddddd; +} + +select:hover { + color:#ffffff; +} + +.selectholder { + background-color:rgba(200,200,200,0.05); +} + +.selectholder:hover { + background-color:rgba(200,200,200,0.1); +} + +input[type="text"] { + background-color: rgba(200,200,200,0.05); + border-bottom: 1px solid #555555; +} + +input[type="text"]:hover { + background-color: rgba(200,200,200,0.1); + border-bottom: 1px solid #555555; +} + +input[type="text"]:focus { + transition: border-bottom 0.5s ease; + border-bottom: 1px solid #bbbbbb; +} + +a:link { + color:orange; +} + +a:visited { + color:orange; +} + +a:hover,a:active +{ + color:yellow; +} + +/* +===================================================================== += Specific Elements By ID +===================================================================== +*/ + +body.mobile, body.phone .dropmenu { + background-image: linear-gradient(#000000, #444444); +} + +body.desktop #infobar +{ + background-image: linear-gradient(#000000, #050505); +} + +body.desktop #thetopbit +{ + background-image: linear-gradient(#000000, #050505); +} + +body.desktop #headerbar +{ + background-image: linear-gradient(#050505, #0b0b0b); +} + +#bottompage +{ + background-image: linear-gradient(#0b0b0b, #444444); +} + +#pset { + background-color: rgba(150, 150, 150, 0.99); +} +#pmaxset { + background-color: rgba(255, 255, 255, 0.99); +} + +#custombackground +{ + display:none; +} + +#notifications +{ + background-image: linear-gradient(#000000, #050505); +} + +#wikipopup +{ + background-image: linear-gradient(#050505, #0b0b0b); +} + +#imagecontainer +{ + background-image: linear-gradient(#0b0b0b, #444444); +} + +#tagadder +{ + background-image: linear-gradient(#000000, #050505); + border-left:1px solid #666666; + border-bottom:1px solid #000000; + border-right:1px solid #000000; +} + +#dragger +{ + background-color:rgba(255,255,255,0.3); +} + +/* +===================================================================== += General Classes +===================================================================== +*/ + +.bordered +{ + border-left:1px solid #222222; + border-bottom:1px solid #292929; + border-right:1px solid #292929; + border-top:1px solid #222222; +} + +a.album:visited +{ + color:#eeeeee; +} + +a.album:hover,a.album:active +{ + color:#ffffff; +} + +.playable:hover, .infoclick:hover, div.clickplaylist:hover, tr.playable:hover>td { + color:#ffffff; + text-shadow: 0 0 8px #aaaaaa; +} + +.selected +{ + background-color:rgba(255,255,255,0.2); +} + +.playlistcurrentitem +{ + font-size:110%; + text-shadow: 0 0 12px #cccccc; + transition:font-size 0.5s ease, text-shadow 0.5s ease; + color:#dddddd; + background-color:rgba(255,255,255,0.1); +} + +.playlistitem +{ + transition:font-size 0.5s ease, text-shadow 0.5s ease; +} + +.playlistalbum +{ + transition:font-size 0.5s ease, text-shadow 0.5s ease; +} + +.playlistcurrenttitle +{ + font-size:125%; + text-shadow: 0 0 12px #cccccc; + background-color:rgba(255,255,255,0.1); + transition:font-size 0.5s ease, text-shadow 0.5s ease; +} + +.item +{ + border-top:1px solid #444444; +} + +.stleft +{ + border-right:1px solid #aaaaaa; +} + +.popupwindow +{ + background-image: linear-gradient(#101010, #303030); + border-left:1px solid #555555; + border-bottom:1px solid #555555; + border-right:1px solid #555555; + border-top:1px solid #555555; +} + +.backhi:hover { + color:#ffffff; + cursor:pointer; + background-color:rgba(255,255,255,0.1); +} + +table.histable tr:hover { + background-color:rgba(255,255,255,0.1); + cursor:pointer; +} + +.tagholder table tr th +{ + border-bottom:1px solid #cccccc; +} + +tr.clickaddtrack:hover +{ + color:#ffffff; + text-shadow: 0 0 8px #cccccc; +} + +.drop-box +{ + background-image: linear-gradient(#0b0b0b, #444444); + color:#dddddd; +} + +.bsel +{ + color:#ffffff; + text-shadow: 0 0 8px #cccccc; +} + +.bmid +{ + border-left:2px solid #ffffff; +} + +.currentbun +{ + border-bottom:1px solid #ffffff; + padding-bottom:2px; +} + +.dropshadow +{ + box-shadow: 7px 7px 5px rgba(0, 0, 0, 0.9); +} + +.progressbar +{ + border:1px solid #414141; +} + +.progressbar_v +{ + border-left:1px solid #000000; + border-bottom:1px solid #343434; + border-right:1px solid #343434; + border-top:1px solid #000000; +} + +.mixbox { + background-color:rgba(200,200,200,0.2); +} + +/* +===================================================================== += Dropdown Menus +===================================================================== +*/ + +.albumbitsmenu +{ + background-image: linear-gradient(#000000, #050505) !important; +} + +div.topdropmenu +{ + background-image: linear-gradient(#0b0b0b, #444444); + border-left:1px solid #262626; + border-bottom:1px solid #000000; + border-right:1px solid #000000; + border-top:none; +} + +.configtitle +{ + background-color:rgba(255,255,255,0.2); +} + +/* +===================================================================== += Info Panel - General +===================================================================== +*/ + +.infowiki +{ + background-color:rgba(255,255,255,0.1); +} + +/* +===================================================================== += Info Panel - Spotify +===================================================================== +*/ + +.helpfulalbum +{ + background-image: linear-gradient(rgba(100,100,100,0.3), rgba(200,200,200,0.2)); +} + +.collectionitem .helpfulalbum.fixed { + background-image: linear-gradient(rgba(200,200,200,0.2), rgba(220,220,220,0.2)); +} + +.tagholder_wide +{ + background-image: linear-gradient(rgba(100,100,100,0.2), rgba(200,200,200,0.1)); +} + +.tagholder_wide .helpfulalbum.tleft +{ + background-image: none; +} + +/* +===================================================================== += Podcasts +===================================================================== +*/ + +.podcastitem +{ + border-top:1px solid #444444; +} + +/* +===================================================================== += For Album Art Manager +===================================================================== +*/ + +.albumsection +{ + background-image: linear-gradient(#000000, #111111); +} + +.albumcovers +{ + background-image: linear-gradient(#0b0b0b, #444444); +} + +#wobblebottom +{ + background-image: linear-gradient(#0b0b0b, #444444); +} + +#coverslist +{ + box-sizing:border-box; + border-left:1px solid #bbbbbb; +} + +.highlighted { + background-color:rgba(0,0,0,0.6); +} + +#imageeditor +{ + background-color:rgba(0,0,0,0.6); +} + +#artistchooser +{ + border-bottom:1px solid #777777; +} + +/* +===================================================================== += Things that look like they might be for styling wikipedia data +===================================================================== +*/ + +table.navbox th +{ + background-color: rgba(255,255,255,0.1); +} + +.navbox-abovebelow +{ + padding-bottom:4px; +} + +.navbox-title a:link, +.navbox-abovebelow a:link, +.navbox-group a:link +{ + text-decoration:none; +} + +.navbox-title a:visited, +.navbox-abovebelow a:visited, +.navbox-group a:visited +{ + text-decoration:none; +} + +.navbox-title a:hover,a:active, +.navbox-abovebelow a:hover,a:active, +.navbox-group a:hover,a:active +{ + text-decoration:none; +} + +table.tracklist { + line-height:1.5em; +} + +.tracklist tbody tr th +{ + font-weight:bold; +} + +tr.tagh +{ + font-size:150%; +} + +th.tlheader +{ + /*background-color:#232323;*/ +} + +.description +{ + margin-top:4px; +} + +.underline +{ + border-bottom: 1px solid #999999; +} + +.infosection h2 +{ + border-bottom:2px solid #eeeeee; +} + +.ratsoptions { + border-top: 1px solid #444444; +} + +.topbarplaycontrols { + border-left: 1px solid white; + border-right: 1px solid white; +} diff --git a/www/rompr/themes/Fire.css b/www/rompr/themes/Fire.css new file mode 100644 index 0000000..91fd3e5 --- /dev/null +++ b/www/rompr/themes/Fire.css @@ -0,0 +1,444 @@ +/* +===================================================================== += Standard HTML Elements +===================================================================== +*/ + +@media screen and (orientation: landscape) { + html, body.phone .dropmenu { + background-image:url("themes/fire.jpg"); + background-size:cover; + background-repeat:no-repeat; + background-attachment:fixed; + } +} + +@media screen and (orientation: portrait) { + html, body.phone .dropmenu { + background-image:url("themes/fire-portrait.jpg"); + background-size:cover; + background-repeat:no-repeat; + background-attachment:fixed; + } +} + +body.phone .dropmenu>div { + background-color:rgba(0,0,0,0.3); + background-clip:border-box; +} + +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input +{ + color:#eeeeee; + background-color:rgba(0,0,0,0.3); +} + +a:link +{ + color:yellow; +} + +a:visited +{ + color:yellow; +} + +a:hover,a:active +{ + text-shadow: 0 0 15px #000000; + cursor:pointer; +} + +button, input[type="button"], .filebutton +{ + color:#dddddd; + background-color:transparent; + border:1px solid #aaaaaa; +} + +button:hover, input[type="button"]:hover, .filebutton:hover +{ + color:#ffffff; + border:1px solid #ffffff; + text-shadow: 0 0 15px #ffffff; +} + +input +{ + color:#181818; +} + +input[type="text"] { + color: white; + background-color: rgba(20,20,20,0.5); + border: 1px solid #444; +} + +/* +===================================================================== += Specific Elements By ID +===================================================================== +*/ + +#infobar.coloured, #headerbar, #thetopbit +{ + background-color:rgba(0,0,0,0.3); +} + +body.mobile #headerbar { + background-color:rgba(0,0,0,0.6); +} + +#sources, .mainpane, #playlist +{ + background-color:rgba(0,0,0,0.1); +} + +#infopane +{ + background-color:rgba(0,0,0,0.4); +} + +#artistbio +{ + padding:4px; +} + +#notifications +{ + background-color:rgba(0,0,0,0.9); +} + +#wikipopup +{ + background-color:#000000; +} + +#imagecontainer +{ + background-color:#ffffff; +} + +#tagadder +{ + background-color:rgba(0,0,0,0.8); +} + +#dragger +{ + background-color:rgba(0,0,0,0.3); +} + +#pset { + background-color: rgba(147, 61, 24, 0.99); +} + +#pmaxset { + background-color: rgba(255, 238, 95, 0.99); +} + +/* +===================================================================== += General Classes +===================================================================== +*/ + +.selectholder { + background-color: rgba(20,20,20,0.5); +} + +.selectholder:hover { + background-color: rgba(20,20,20,0.5); +} + +select { + color: white; +} + +.drop-box { + background-color: #222; + color:white; +} + +.album2 +{ + background-color:rgba(0,0,0,0.1); +} + +.playable:hover, .infoclick:hover, div.clickplaylist:hover, tr.playable:hover>td { + text-shadow: 0 0 15px #ffffff; + color:#ffffff; + cursor:pointer; +} + +.playable.selected:hover, tr.playable.selected:hover>td { + color:#ffffff; +} + +.selected +{ + background-color:rgba(255,72,0,0.5); +} + +.playlistcurrentitem +{ + font-weight:bold; + font-size:120%; + color:#eeeeee; + background-color:rgba(200,200,200,0.2); + transition:font-size 0.2s ease, text-shadow 0.2s ease, background-color 0.2s ease; +} + +.playlistitem, .playlistalbum +{ + transition:font-size 0.3s ease, text-shadow 0.3s ease, background-color 0.2s ease; +} + +.playlistcurrenttitle +{ + background-color:rgba(200,200,200,0.2); + text-shadow: 0px 0px 20px #cccccc; + font-weight:bold; + color:#eeeeee; + transition:font-size 0.2s ease, text-shadow 0.2s ease, background-color 0.2s ease; +} + +.inbrowser +{ + color:#000000; +} + +.stleft +{ + border-right:1px solid #888888; +} + +.popupwindow +{ + background-color:rgba(0,0,0,0.8); +} + +table.histable tr:hover { + font-size:105%; + text-shadow: 0 0 15px #ffffff; + color:#ffffff; + transition:all 0.1s; +} + +table.histable tr +{ + transition:all 0.2s; +} + +.backhi:hover { + text-shadow: 0 0 15px #ffffff; + color:#ff4800; + cursor:pointer; + transition:all 0.1s; +} + +.backhi +{ + transition:all 0.2s; +} + +tr.clickaddtrack:hover +{ + background-color:#e1e4ea; +} + +.bsel +{ + color:#ffffff; + text-shadow:0 0 15px #ffffff; +} + +.bmid +{ + border-left:2px solid #ff4800; +} + +.tagholder table tr th { + background-color:rgba(0,0,0,0.5); + border-bottom:1px solid #000000; +} + + +.currentbun +{ + border-bottom:1px solid #ffffff; + padding-bottom:2px; +} + +.dropshadow +{ + box-shadow: 7px 7px 5px rgba(0, 0, 0, 0.5); +} + +.progressbar +{ + border:1px solid #414141; +} + +.progressbar_v +{ + border:1px solid #414141; +} + +/* +===================================================================== += Dropdown Menus +===================================================================== +*/ + +div.topdropmenu +{ + background-color:rgba(0,0,0,0.9); +} + +.configtitle +{ + background-color:rgba(255,128,20,0.2); +} + +body.mobile .configtitle +{ + width:100%; + margin-left:auto; + margin-right:auto; +} + +/* +===================================================================== += Info Panel - General +===================================================================== +*/ + +.infowiki +{ + color:white; +} + +.infosection +{ + background-color:rgba(0,0,0,0.5); + background-size:cover; + background-repeat:no-repeat; +} + +/* +===================================================================== += Info Panel - Spotify +===================================================================== +*/ + +.helpfulalbum +{ + background-color:rgba(0,0,0,0.4); +} + +.tagholder_wide +{ + background-color:rgba(0,0,0,0.6); +} + +/* +===================================================================== += Podcasts +===================================================================== +*/ + +.podcastitem +{ + border-top:1px solid #cccccc; +} + +/* +===================================================================== += For Album Art Manager +===================================================================== +*/ + +.albumsection +{ + background-color:rgba(0,0,0,0.5); + background-size:cover; + background-repeat:no-repeat; +} + +.highlighted { + background-color:rgba(90,0,60,0.7) !important; +} + +#coverslist +{ + box-sizing:border-box; + border-left:1px solid #bbbbbb; +} + +#artistchooser +{ + background-color:rgba(0,0,0,0.3); + color:#aaaaaa; +} + +/* +===================================================================== += Things that look like they might be for styling wikipedia data +===================================================================== +*/ + +table.navbox th +{ + background-color: rgba(0,0,0,0.2); +} + +.navbox-abovebelow +{ + padding-bottom:4px; +} + +.navbox-title a:link, +.navbox-abovebelow a:link, +.navbox-group a:link +{ + text-decoration:none; +} + +.navbox-title a:visited, +.navbox-abovebelow a:visited, +.navbox-group a:visited +{ + text-decoration:none; +} + +.navbox-title a:hover,a:active, +.navbox-abovebelow a:hover,a:active, +.navbox-group a:hover,a:active +{ + text-decoration:none; +} + +table.tracklist { + line-height:1.5em; +} + +.tracklist tbody tr th +{ + font-weight:bold; +} + +.description +{ + margin-top:4px; +} + +.underline +{ + border-bottom: 1px solid yellow; +} + +.infosection h2 +{ + border-bottom:2px solid white; +} diff --git a/www/rompr/themes/Flatworld.css b/www/rompr/themes/Flatworld.css new file mode 100644 index 0000000..20b4190 --- /dev/null +++ b/www/rompr/themes/Flatworld.css @@ -0,0 +1,369 @@ +html, body.phone .dropmenu { + background-color:#cccccc; +} + +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input +{ + color:#000000; +} + +h1,h2,h3,h4,h5,h6 +{ + color:#000000; +} + +a:link +{ + color:#0b0080; +} + +a:visited +{ + color:#0b0080; +} + +a:hover,a:active +{ + color:#ff4800; +} + +input +{ + color:#181818; +} + +button, .filebutton +{ + color:#000000; + border: 1px solid #000000; +} + +button:hover, .filebutton:hover +{ + color:#000000; + border: 1px solid white; +} + +select +{ + color:#181818; +} + +#custombackground +{ + display:none; +} + +.selectholder { + background-color:rgba(0,0,0,0); +} + +.selectholder:hover { + background-color:rgba(0,0,0,0); +} + +input[type="text"] { + background-color: rgba(0,0,0,0); + border-bottom: 1px solid #555555; +} + +input[type="text"]:focus { + border-bottom: 1px solid #eeeeee; +} + +.configtitle { + border-bottom: 1px solid #888888; +} + +.drop-box { + background-color: rgba(0,0,0,0.01); +} + +#pset { + background-color: rgba(255, 255, 255, 0.99); +} +#pmaxset { + background-color: rgba(255, 255, 255, 0.99); +} + +#infopane +{ + box-sizing:border-box; + border-left: 2px solid black; + border-right: 2px solid black; + border-top: 2px solid black; +} + +/*-- divs used to create infobar layout --*/ + +#notifications +{ + background-color:#a9a9a9; +} +/*-- divs and classes used in the albums list --*/ + +.album1 +{ + background-color:#cccccc; +} + +.album2 +{ + background-color:#cccccc; +} + +a.album:visited +{ + color:#220000; +} + +a.album:hover,a.album:active +{ + color:#ff4800; +} + +.playable:hover, .infoclick:hover, div.clickplaylist:hover, tr.playable:hover>td { + color:#ff4800; +} + +.playable.selected:hover, tr.playable.selected:hover>td { + color:#dddddd; +} + +.selected +{ + background-color:#CC5500; +} + +/*-- divs and classes used in the playlist --*/ + +.playlistcurrentitem +{ + color:#cc0000; +} + +.playlistcurrenttitle +{ + color:#cc0000; +} + +.inbrowser +{ + color:#000000; +} + +/*-- For Wikipedia and Last.FM pages --*/ + +#wikipopup +{ + background-color:#aaaaaa; +} + +#imagecontainer +{ + background-color:#ffffff; +} + +.translucent +{ + opacity:0.7; +} + +/*-- For Album Cover Art --*/ + +.popupwindow +{ + background-color:#bababa; + border-left:1px solid #eeeeee; + border-bottom:1px solid #9a9a9a; + border-right:1px solid #9a9a9a; + border-top:1px solid #eeeeee; +} + +.underline +{ + border-bottom: 0px none !important; +} + +.info-border-right +{ + border-right: 0px none !important; +} + +.helpfulalbum +{ + border: 1px solid black; +} + +.containerbox .podcast .helpfulalbum.expand +{ + border-bottom: none; +} + +.containerbox .podcast .helpfulalbum.fixed +{ + border-top: none; +} + +.tagholder_wide +{ + border-bottom: 1px solid black; +} + +.tagholder_wide .helpfulalbum.tleft +{ + border: none; +} + +/*-- Styles for drop-down menus --*/ + +div.topdropmenu +{ + background-color:#cccccc; + border-left:1px solid #eeeeee; + border-bottom:1px solid #9a9a9a; + border-right:1px solid #9a9a9a; +} + +/*-- Styles to make the Wikipedia nav boxes look prettier --*/ + +table.navbox th +{ + background-color: #dddddd; +} + +.navbox-abovebelow +{ + padding-bottom:4px; +} + +.navbox-title a:link, +.navbox-abovebelow a:link, +.navbox-group a:link +{ + text-decoration:none; +} + +.navbox-title a:visited, +.navbox-abovebelow a:visited, +.navbox-group a:visited +{ + text-decoration:none; +} + +.navbox-title a:hover,a:active, +.navbox-abovebelow a:hover,a:active, +.navbox-group a:hover,a:active +{ + text-decoration:none; +} + +table.tracklist { + line-height:1.5em; +} + +.tracklist tbody tr th +{ + font-weight:bold; +} + +.description +{ + margin-top:4px; +} + +.crackbaby +{ + border-bottom: 1px solid #444444; +} + +#tagadder +{ + background-color:#bababa; +} + +table.histable tr:hover { + background-color:#CC5500; +} + +.backhi:hover { + background-color:#CC5500; + cursor:pointer; +} + +tr.clickaddtrack:hover +{ + background-color:#cccccc; +} + +#fiddler { + border-left: 4px solid #fe6500; + border-right: 4px solid #fe6500; +} + +.highlighted { + border-top: 4px solid #fe6800 !important; + border-left: 4px solid #fe6800 !important; + border-right: 4px solid #fe6800 !important; + border-bottom: 4px solid #fe6800 !important; + border-radius:2px !important; +} + +.covercontainer.highlighted +{ + border-bottom: none !important; + margin-bottom:-4px; + background-color:#cccccc; +} + +#imageeditor +{ + background-color:#cccccc; +} + +.tagholder table tr th { + border-bottom:1px solid #000000; +} + +.bsel +{ + color:#ff4800; +} + +.bmid +{ + border-left:2px solid #ff4800; +} + +#artistchooser +{ + border-bottom:1px solid #777777; + border-top:1px solid #777777; + color:#555555; +} + +.currentbun +{ + border-bottom:1px solid #fe6500; + padding-bottom:2px; +} + +.progressbar +{ + border:1px solid #414141; +} + +.progressbar_v +{ + border:1px solid #414141; +} + +.podcastitem +{ + border-top:1px solid #000000; +} + +#dragger +{ + background-color:rgba(0,0,0,0.3); +} diff --git a/www/rompr/themes/Kernsary.css b/www/rompr/themes/Kernsary.css new file mode 100644 index 0000000..99e2c28 --- /dev/null +++ b/www/rompr/themes/Kernsary.css @@ -0,0 +1,416 @@ +/* +===================================================================== += Standard HTML Elements +===================================================================== +*/ + +html, body.phone .dropmenu { + background-image:url("themes/kernsary.jpg"); + background-size:cover; + background-repeat:no-repeat; + background-attachment:fixed; +} + +body.phone .dropmenu>div { + background-color:rgba(0,0,0,0.4); + background-clip:border-box; +} + +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input +{ + color:#eeeeee; +} + +a:link +{ + color:yellow; +} + +a:visited +{ + color:yellow; +} + +a:hover,a:active +{ + text-shadow: 0 0 15px #000000; + cursor:pointer; +} + +button, input[type="button"], .filebutton +{ + color:#dddddd; + background-color:rgba(0,0,0,0.5); + border:1px solid transparent; +} + +button:hover, input[type="button"]:hover, .filebutton:hover +{ + color:#ffffff; + background-color:rgba(0,0,0,0.7); + border:1px solid #222222; +} + +select { + color:#dddddd; +} + +.selectholder { + background-color:rgba(0,0,0,0.3); +} + +.selectholder:hover { + background-color:rgba(0,0,0,0.2); +} + +input[type="text"] { + background-color: rgba(0,0,0,0.3); + border-bottom: 1px solid #555555; +} + +input[type="text"]:hover { + background-color: rgba(0,0,0,0.2); + border-bottom: 1px solid #555555; +} + +input[type="text"]:focus { + transition: border-bottom 0.5s ease; + border-bottom: 1px solid #bbbbbb; +} + +select:hover { + color: #ffffff; +} + +.drop-box { + background-color: rgba(0,0,0,0.4); + color:white; +} + +/* +===================================================================== += Specific Elements By ID +===================================================================== +*/ + +#headerbar + { + /*background-color:rgba(0,0,0,0.3);*/ + } + +#playlist +{ + background-color:rgba(0,0,0,0.4); +} + +#notifications +{ + background-color:rgba(60,0,17,0.7); +} + +#wikipopup +{ + background-color:#000000; +} + +#imagecontainer +{ + background-color:#ffffff; +} + +#tagadder +{ + background-color:rgba(60,0,17,0.7); +} + +#dragger +{ + background-color:rgba(60,0,17,0.7); +} + +#pset { + background-color: rgba(79, 71, 93, 0.99); +} +#pmaxset { + background-color: rgba(151, 87, 40, 0.99); +} + +/* +===================================================================== += General Classes +===================================================================== +*/ + +.album2 +{ + background-color:rgba(0,0,0,0.1); +} + +.playable:hover, .infoclick:hover, div.clickplaylist:hover, tr.playable:hover>td { + text-shadow: 0 0 15px #ffffff; + color:#ffffff; + cursor:pointer; +} + +.playable.selected:hover, tr.playable.selected:hover>td { + color:#ffffff; +} + +.selected +{ + background-color:rgba(255,72,0,0.5); +} + +.playlistcurrentitem +{ + font-weight:bold; + font-size:120%; + color:#eeeeee; + background-color:rgba(200,200,200,0.2); + transition:font-size 0.2s ease, text-shadow 0.2s ease, background-color 0.2s ease; +} + +.playlistitem, .playlistalbum +{ + transition:font-size 0.3s ease, text-shadow 0.3s ease, background-color 0.2s ease; +} + +.playlistcurrenttitle +{ + background-color:rgba(200,200,200,0.2); + text-shadow: 0px 0px 20px #cccccc; + font-weight:bold; + color:#eeeeee; + transition:font-size 0.2s ease, text-shadow 0.2s ease, background-color 0.2s ease; +} + +.stleft +{ + border-right:1px solid #888888; +} + +.popupwindow +{ + background-color:rgba(60,0,17,0.7); +} + +table.histable tr:hover { + font-size:105%; + text-shadow: 0 0 15px #ffffff; + color:#ffffff; + transition:all 0.1s; +} + +table.histable tr +{ + transition:all 0.2s; +} + +.backhi:hover { + text-shadow: 0 0 15px #ffffff; + color:#ff4800; + cursor:pointer; + transition:all 0.1s; +} + +.backhi +{ + transition:all 0.2s; +} + +tr.clickaddtrack:hover +{ + background-color:#e1e4ea; +} + +.bsel +{ + color:#ffffff; + text-shadow:0 0 15px #ffffff; +} + +.bmid +{ + border-left:2px solid #ff4800; +} + +.tagholder table tr th { + background-color:rgba(0,0,0,0.5); + border-bottom:1px solid #000000; +} + +.currentbun +{ + border-bottom:1px solid #ffffff; + padding-bottom:2px; +} + +.dropshadow +{ + box-shadow: 7px 7px 5px rgba(0, 0, 0, 0.5); +} + +.progressbar +{ + border:1px solid #414141; +} + +.progressbar_v +{ + border:1px solid #414141; +} + +/* +===================================================================== += Dropdown Menus +===================================================================== +*/ + +div.topdropmenu +{ + background-color:rgba(53,37,48,0.9); +} + +.configtitle +{ + background-color:rgba(144,91,77,0.5); +} + +body.mobile .configtitle +{ + width:100%; + margin-left:auto; + margin-right:auto; +} + +/* +===================================================================== += Info Panel - General +===================================================================== +*/ + +#infopane +{ + background-color:rgba(0,0,0,0.4); +} + +#artistbio +{ + padding:4px; +} + +.infowiki +{ + color:white; +} + +.infosection +{ + background-color:rgba(0,0,0,0.5); + background-size:cover; + background-repeat:no-repeat; +} + +/* +===================================================================== += Info Panel - Spotify +===================================================================== +*/ + +.helpfulalbum +{ + background-color:rgba(0,0,0,0.4); +} + +.tagholder_wide +{ + background-color:rgba(0,0,0,0.6); +} + +/* +===================================================================== += Podcasts +===================================================================== +*/ + +.podcastitem +{ + border-top:1px solid #cccccc; +} + +/* +===================================================================== += For Album Art Manager +===================================================================== +*/ + +.highlighted { + background-color:rgba(60,0,17,0.7) !important; +} + +#artistchooser +{ + background-color:rgba(0,0,0,0.3); + color:#aaaaaa; +} + +/* +===================================================================== += Things that look like they might be for styling wikipedia data +===================================================================== +*/ + +table.navbox th +{ + background-color: rgba(0,0,0,0.2); +} + +.navbox-abovebelow +{ + padding-bottom:4px; +} + +.navbox-title a:link, +.navbox-abovebelow a:link, +.navbox-group a:link +{ + text-decoration:none; +} + +.navbox-title a:visited, +.navbox-abovebelow a:visited, +.navbox-group a:visited +{ + text-decoration:none; +} + +.navbox-title a:hover,a:active, +.navbox-abovebelow a:hover,a:active, +.navbox-group a:hover,a:active +{ + text-decoration:none; +} + +table.tracklist { + line-height:1.5em; +} + +.tracklist tbody tr th +{ + font-weight:bold; +} + +.description +{ + margin-top:4px; +} + +.underline +{ + border-bottom: 1px solid yellow; +} + +.infosection h2 +{ + border-bottom:2px solid white; +} diff --git a/www/rompr/themes/Leaf.css b/www/rompr/themes/Leaf.css new file mode 100644 index 0000000..c39092d --- /dev/null +++ b/www/rompr/themes/Leaf.css @@ -0,0 +1,414 @@ +/* +===================================================================== += Standard HTML Elements +===================================================================== +*/ + +html, body.phone .dropmenu { + background-image:url("themes/leaf.jpg"); + background-size:cover; + background-repeat:no-repeat; + background-attachment:fixed; +} + +body.phone .dropmenu>div { + background-color:rgba(0,0,0,0.3); + background-clip:border-box; +} + +button, input[type="button"], .filebutton +{ + color:#dddddd; + background-color:transparent; + border:1px solid #aaaaaa; +} + +button:hover, input[type="button"]:hover, .filebutton:hover +{ + color:#ffffff; + border:1px solid #ffffff; + text-shadow: 0 0 15px #ffffff; +} + +input +{ + color:#181818; +} + +input.snapclientname[type=text] { + color: #ffffff; +} + +select +{ + color:#000000; +} + +/* +===================================================================== += Specific Elements By ID +===================================================================== +*/ + +#sources, .mainpane, #headerbar, #infobar.coloured, #thetopbit +{ + background-color:rgba(0,0,0,0.3); +} + +#playlist +{ + background-color:rgba(0,0,0,0.3); +} + +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea +{ + color:#eeeeee; +} + +a:link +{ + color:yellow; +} + +a:visited +{ + color:yellow; +} + +a:hover,a:active +{ + text-shadow: 0 0 15px #000000; + cursor:pointer; +} + +#notifications +{ + background-color:rgba(0,0,0,0.9); +} + +#wikipopup +{ + background-color:#000000; +} + +#imagecontainer +{ + background-color:#ffffff; +} + +#tagadder +{ + background-color:rgba(0,0,0,0.9); +} + +#dragger +{ + background-color:rgba(0,0,0,0.5); +} + +#pset { + background-color: rgba(77, 80, 17, 0.99); +} +#pmaxset { + background-color: rgba(136, 142, 30, 0.99); +} + +/* +===================================================================== += General Classes +===================================================================== +*/ + +.album2 +{ + background-color:rgba(0,0,0,0.2); +} + +.item +{ + margin-bottom: 2px; +} + +.playable:hover, .infoclick:hover, div.clickplaylist:hover, tr.playable:hover>td { + text-shadow: 0 0 15px #ffffff; + color:#ffffff; + cursor:pointer; +} + +.playable.selected:hover, tr.playable.selected:hover>td { + color:#ffffff; +} + +.selected +{ + background-color:rgba(255,72,0,0.6); +} + +.playlistcurrentitem +{ + font-weight:bold; + font-size:120%; + border-left:4px solid white; + color:#eeeeee; + transition:font-size 0.3s ease, text-shadow 0.3s ease; +} + +.clicktrack.playlistcurrentitem +{ + padding-left:8px; +} + +.playlistitem, .playlistalbum +{ + transition:font-size 0.3s ease, text-shadow 0.3s ease; +} + +.playlistcurrenttitle +{ + text-shadow: 0px 0px 20px #cccccc; + font-weight:bold; + color:#eeeeee; + background-color:rgba(0,0,0,0.2); + transition:font-size 0.3s ease, text-shadow 0.3s ease; +} + +.playlisttitle{ + background-color:rgba(0,0,0,0.2); +} + +.inbrowser +{ + color:#000000; +} + +.stleft +{ + border-right:1px solid #888888; +} + +.popupwindow +{ + background-color:rgba(0,0,0,0.8); +} + +table.histable tr:hover { + font-size:105%; + text-shadow: 0 0 15px #ffffff; + color:#ff4800; + transition:all 0.1s; +} + +table.histable tr +{ + transition:all 0.2s; +} + +.backhi:hover { + text-shadow: 0 0 15px #ffffff; + color:#ff4800; + cursor:pointer; + transition:all 0.1s; +} + +.backhi +{ + transition:all 0.2s; +} + +tr.clickaddtrack:hover +{ + background-color:#e1e4ea; +} + +.bsel +{ + color:#ffffff; + text-shadow:0 0 15px #ffffff; +} + +.bmid +{ + border-left:2px solid #ff4800; +} + +.tagholder table tr th { + background-color:rgba(0,0,0,0.5); + border-bottom:1px solid #000000; +} + +.currentbun +{ + border-bottom:1px solid #fe6500; + padding-bottom:2px; +} + +.dropshadow +{ + box-shadow: 7px 7px 5px rgba(0, 0, 0, 0.6); +} + +.progressbar +{ + border:1px solid #414141; +} + +.progressbar_v +{ + border:1px solid #414141; +} + +/* +===================================================================== += Dropdown Menus +===================================================================== +*/ + +div.topdropmenu +{ + background-color:rgba(0,0,0,0.9); +} + +.configtitle +{ + background-color:rgba(20,50,20,1); +} + +body.mobile .configtitle +{ + width:100%; + margin-left:auto; + margin-right:auto; +} + +/* +===================================================================== += Info Panel - General +===================================================================== +*/ + +#infopane +{ + background-color:rgba(0,0,0,0.6); +} + +#artistbio +{ + padding:4px; +} + +.infowiki +{ + color:white; +} + +.infosection +{ + background-color:rgba(0,0,0,0.4); + background-size:cover; + background-repeat:no-repeat; +} + +/* +===================================================================== += Info Panel - Spotify +===================================================================== +*/ + +.helpfulalbum +{ + background-color:rgba(0,0,0,0.4); +} + +.tagholder_wide +{ + background-color:rgba(0,0,0,0.6); +} + +.podcastitem +{ + border-top:1px solid #cccccc; +} + +/* +===================================================================== += For Album Art Manager +===================================================================== +*/ + +.albumsection +{ + background-color:rgba(0,0,0,0.4); + background-size:cover; + background-repeat:no-repeat; +} + +.highlighted { + background-color:rgba(0,0,0,0.6); +} + +#artistchooser +{ + background-color:rgba(0,0,0,0.4); + color:#555555; +} + +/* +===================================================================== += Things that look like they might be for styling wikipedia data +===================================================================== +*/ + +table.navbox th +{ + background-color: rgba(0,0,0,0.2); +} + +.navbox-abovebelow +{ + padding-bottom:4px; +} + +.navbox-title a:link, +.navbox-abovebelow a:link, +.navbox-group a:link +{ + text-decoration:none; +} + +.navbox-title a:visited, +.navbox-abovebelow a:visited, +.navbox-group a:visited +{ + text-decoration:none; +} + +.navbox-title a:hover,a:active, +.navbox-abovebelow a:hover,a:active, +.navbox-group a:hover,a:active +{ + text-decoration:none; +} + +table.tracklist { + line-height:1.5em; +} + +.tracklist tbody tr th +{ + font-weight:bold; +} + +.description +{ + margin-top:4px; +} + +.underline +{ + border-bottom: 1px solid yellow; +} + +.infosection h2 +{ + border-bottom:2px solid white; +} diff --git a/www/rompr/themes/Leaves.css b/www/rompr/themes/Leaves.css new file mode 100644 index 0000000..d22848c --- /dev/null +++ b/www/rompr/themes/Leaves.css @@ -0,0 +1,356 @@ +/* +===================================================================== += Standard HTML Elements +===================================================================== +*/ + +html, body.phone .dropmenu { + color:#eeeeee; + background-image:url('themes/leaftile.jpg'); +} + +a:link +{ + color:yellow; +} + +a:visited +{ + color:yellow; +} + +a:hover,a:active +{ + color:#ff4800; +} + +button, .filebutton +{ + color:#eeeeee; + background-image:url('themes/veins.jpg'); + border:none; + box-shadow: 0px 0px 20px rgba(150, 250, 50, 0.4); +} + +button:active, .filebutton:active +{ + box-shadow:none; +} + +button:hover, .filebutton:hover +{ + color:#ff4800; + box-shadow: 0px 0px 20px rgba(150, 250, 50, 1); +} + +input.inbrowser, div.inbrowser +{ + border: 1px solid #888888; +} + +input.snapclientname[type=text] { + color: #ffffff; +} + +/* +===================================================================== += Specific Elements By ID +===================================================================== +*/ + +#custombackground +{ + display:none; +} + +#notifications +{ + background-image:url('themes/veins.jpg'); + box-shadow: 4px 4px 12px rgba(150, 250, 50, 0.4); + opacity:0.8; +} + +#wikipopup +{ + background-image:url('themes/leaves2.jpg'); +} + +#imagecontainer +{ + background-color:#ffffff; +} + +#tagadder +{ + background-image:url('themes/leaves2.jpg'); +} + +#dragger +{ + background-color:rgba(0,0,0,0.5); +} + +/* +===================================================================== += General Classes +===================================================================== +*/ + +.bordered +{ + background-color:rgba(250,250,250,0.2); +} + +.album1 +{ + background-color:rgba(250,250,250,0.1); +} + +.album2 +{ + background-color:rgba(250,250,250,0.2); +} + +.playable:hover, .infoclick:hover, div.clickplaylist:hover, tr.playable:hover>td { + color:#ff4800; +} + +.playable:hover, .infoclick:hover, div.clickplaylist:hover, tr.playable:hover>td { + color:#dddddd; +} + +.selected +{ + background-color:#CC5500; +} + +.playlistcurrentitem +{ + background-color:rgba(250,250,250,0.2); + border-left:2px solid white; + padding-left:2px; +} + +.playlistcurrenttitle +{ + background-color:rgba(250,250,250,0.2); + border-left:2px solid white; + padding-left:2px; +} + +.stleft +{ + border-right:1px solid #aaaaaa; +} + +.popupwindow +{ + background-image:url('themes/leaves2.jpg'); + border-bottom:2px solid #555555; + border-right:2px solid #555555; +} + +table.histable tr:hover { + background-color:#CC5500; +} + +.backhi:hover { + background-color:#CC5500; + cursor:pointer; +} + +tr.clickaddtrack:hover +{ + background-image:url('themes/leaves2.jpg'); +} + +.bsel +{ + color:#ff4800; +} + +.bmid +{ + border-left:2px solid #ff4800; +} + +.currentbun +{ + border-bottom:1px solid #fe6500; + padding-bottom:2px; +} + +.dropshadow +{ + box-shadow: 4px 4px 12px rgba(150, 250, 50, 0.4); +} + +.progressbar +{ + border:1px solid #414141; +} + +.mCSB_draggerRail +{ + background:rgba(0,0,0,0.1) !important; +} + +.mCSB_dragger_bar +{ + background:rgba(0,0,0,0.75) !important; +} + +/* +===================================================================== += Dropdown Menus +===================================================================== +*/ + +div.topdropmenu +{ + background-image:url('themes/leaves2.jpg'); + border-bottom:1px solid #555555; + border-right:1px solid #555555; + border-top:none; +} + +.configtitle +{ + background-image:url('themes/veins.jpg'); + box-shadow: 0px 0px 8px rgba(250, 520, 250, 0.6); + margin-bottom:8px; +} + +/* +===================================================================== += Info Panel - General +===================================================================== +*/ + +.infosection +{ + background-image:url('themes/veins.jpg'); + box-shadow: 0px 0px 12px rgba(150, 250, 50, 0.4); + margin-bottom:8px; +} + +.infowiki +{ + background-image:url('themes/leaves2.jpg'); +} + +.tagholder table tr th { + background-image:url('themes/veins.jpg'); + border-bottom:1px solid #eeeeee; +} + +/* +===================================================================== += Podcasts +===================================================================== +*/ + +.podcastitem +{ + border-top:1px solid #eeeeee; +} + +/* +===================================================================== += For Album Art Manager +===================================================================== +*/ + +.albumsection +{ + background-image:url('themes/veins.jpg'); + box-shadow: 0px 0px 12px rgba(150, 250, 50, 0.4); +} + +.albumcovers .infosection +{ + background-image:url('themes/leaftile.jpg'); +} + +.highlighted { + background-color: rgba(0,0,0,0.6); +} + +.helpfulalbum +{ + background-color:rgba(0,0,0,0.4); +} + +.tagholder_wide +{ + background-color:rgba(0,0,0,0.3); +} + +#artistchooser +{ + border-bottom:1px solid #555555; + border-top:1px solid #555555; + color:#555555; +} + +#artistcoverslist +{ + background-image:url('themes/leaftile.jpg'); + box-shadow: 7px 7px 5px rgba(50, 50, 50, 0.6); +} + +#coverslist +{ + background-image:url('themes/leaves2.jpg'); +} + +/* +===================================================================== += Things that look like they might be for styling wikipedia data +===================================================================== +*/ + +table.navbox th +{ + background-color: #e5e5e5; +} + +.navbox-title +{ + color:#eeeeee; +} + +.navbox-group +{ + color:#eeeeee; +} + +.navbox-abovebelow +{ + color:#eeeeee; + padding-bottom:4px; +} + +.navbox-title a:link, +.navbox-abovebelow a:link, +.navbox-group a:link +{ + color:#990000; + text-decoration:none; +} + +.navbox-title a:visited, +.navbox-abovebelow a:visited, +.navbox-group a:visited +{ + color:#990000; + text-decoration:none; +} + +.navbox-title a:hover,a:active, +.navbox-abovebelow a:hover,a:active, +.navbox-group a:hover,a:active +{ + color:#ff4800; + text-decoration:none; +} diff --git a/www/rompr/themes/Light.css b/www/rompr/themes/Light.css new file mode 100644 index 0000000..e9788a5 --- /dev/null +++ b/www/rompr/themes/Light.css @@ -0,0 +1,369 @@ +html, body.phone .dropmenu { + color:#000000; + background-color:#f8f8f8; +} + +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input +{ + color:#000000; +} + +h1,h2,h3,h4,h5,h6 +{ + color:#000000; +} + +a:link +{ + color:#2255cc; +} + +a:visited +{ + color:#2255cc; +} + +a:hover,a:active +{ + color:#ff4800; +} + +input +{ + color:#000000; +} + +button, .filebutton +{ + color:#000000; + border: 1px solid #000000; +} + +#infopane +{ + box-sizing:border-box; + border-left: 2px solid gray; + border-right: 2px solid gray; + border-top: 2px solid gray; +} + +button:hover, .filebutton:hover +{ + color:#ff4800; + text-shadow: 0 0 15px #ff4800; +} + +select +{ + color:#000000; +} + +#custombackground +{ + display:none; +} + +input.inbrowser, div.inbrowser +{ + border: 1px solid #888888; +} + +#headerbar +{ + background-color:#f8f8f8; +} + +#pset { + background-color: rgba(150, 150, 150, 0.99); +} +#pmaxset { + background-color: rgba(180, 180, 180, 0.99); +} + +#notifications +{ + background-color:#e7e7e7; +} + +.tagholder table tr th { + background-color:rgba(0,0,0,0.3); + border-bottom:1px solid #000000; +} + + +/*-- divs used to create infobar layout --*/ + +.bordered +{ + border-left:1px solid #dddddd; + border-bottom:1px solid #ffffff; + border-right:1px solid #ffffff; + border-top:1px solid #dddddd; +} + +/*-- divs and classes used in the albums list --*/ + +.album1 +{ + background-color:#f8f8f8; +} + +.album2 +{ + background-color:#eeeeee; +} + +a.album:visited +{ + color:#000000; +} + +a.album:hover,a.album:active +{ + color:#ff4800; +} + +#filemenu +{ + border-left:1px solid #444444; +} + +.playable:hover, .infoclick:hover, div.clickplaylist:hover, tr.playable:hover>td { + color:#ff4800; +} + +.playable.selected:hover, tr.playable.selected:hover>td { + color:#dddddd; +} + +.selected +{ + background-color:#CC5500; +} + +/*-- divs and classes used in the playlist --*/ + +.playlistcurrentitem +{ + color:#cc0000; +} + +.playlistcurrenttitle +{ + color:#cc0000; +} + +.item +{ + border-top:1px solid #222222; +} + +.inbrowser +{ + color:#000000; +} + +/*-- For Wikipedia and Last.FM pages --*/ + +.stleft +{ + border-right:1px solid #333333; +} + +#wikipopup +{ + background-color:#000000; +} + +#imagecontainer +{ + background-color:#ffffff; +} + +.infosection +{ + background-color:#ededed; +} + +.albumsection +{ + background-color:#d5d5d5; +} + +.translucent +{ + opacity:0.7; +} + +.infowiki +{ + background-color:#f8f8f8; +} + +/*-- For Album Cover Art --*/ + +.crackbaby +{ + background-color:#f8f8f8; +} + +#albumcovers +{ + background-color:#f8f8f8; +} + +.popupwindow +{ + background-color:#dedede; + border-left:2px solid #888888; + border-bottom:2px solid #888888; + border-right:2px solid #888888; + border-top:2px solid #888888; +} + +/*-- Styles for drop-down menus --*/ + +div.topdropmenu +{ + background-color:#e7e7e7; +} + +.configtitle +{ + background-color:#f8f8f8; +} + +/*-- Styles to make the Wikipedia nav boxes look prettier --*/ + +table.navbox th +{ + background-color: #dddddd; +} + +.navbox-abovebelow +{ + padding-bottom:4px; +} + +.navbox-title a:link, +.navbox-abovebelow a:link, +.navbox-group a:link +{ + text-decoration:none; +} + +.navbox-title a:visited, +.navbox-abovebelow a:visited, +.navbox-group a:visited +{ + text-decoration:none; +} + +.navbox-title a:hover,a:active, +.navbox-abovebelow a:hover,a:active, +.navbox-group a:hover,a:active +{ + text-decoration:none; +} + +.tracklist tbody tr th +{ + font-weight:bold; +} + +#tagadder +{ + background-color:#f8f8f8; +} + +table.histable tr:hover { + background-color:#CC5500; +} + +.backhi:hover { + background-color:#CC5500; + cursor:pointer; +} + +tr.clickaddtrack:hover +{ + background-color:#eeeeee; +} + +.highlighted { + border-top: 4px solid #fe6800 !important; + border-left: 4px solid #fe6800 !important; + border-right: 4px solid #fe6800 !important; + border-bottom: 4px solid #fe6800 !important; + border-radius:2px !important; +} + +.covercontainer.highlighted +{ + border-bottom: none !important; + margin-bottom:-4px; + background-color:#f8f8f8; +} + +#imageeditor +{ + background-color:#f8f8f8; +} + +.bsel +{ + color:#ff4800; +} + +.bmid +{ + border-left:2px solid #ff4800; +} + +.helpfulalbum +{ + background-color:#f0f0f0; +} + +#artistchooser +{ + border-bottom:1px solid #777777; + border-top:1px solid #777777; + color:#555555; +} + +.currentbun +{ + border-bottom:1px solid #fe6500; + padding-bottom:2px; +} + +.dropshadow +{ + box-shadow: 7px 7px 5px rgba(50, 50, 50, 0.6); +} + +.progressbar +{ + border:1px solid #414141; +} + +.podcastitem +{ + border-top:1px solid #000000; +} + +.mCSB_draggerRail +{ + background:rgba(0,0,0,0.1) !important; +} + +.mCSB_dragger_bar +{ + background:rgba(0,0,0,0.75) !important; +} + +#dragger +{ + background-color:rgba(0,0,0,0.3); +} diff --git a/www/rompr/themes/Mountains.css b/www/rompr/themes/Mountains.css new file mode 100644 index 0000000..e8c5873 --- /dev/null +++ b/www/rompr/themes/Mountains.css @@ -0,0 +1,405 @@ +/* +===================================================================== += Standard HTML Elements +===================================================================== +*/ + +html, body.phone .dropmenu { + background-image:url("themes/mountains.jpg"); + background-size:cover; + background-repeat:no-repeat; + background-attachment:fixed; +} + +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input { + color:#eeeeee; +} + +a:link { + color:yellow; +} + +a:visited { + color:yellow; +} + +a.album:visited { + color:#220000; +} + +a.album:hover,a.album:active { + text-shadow: 0 0 15px #ffffff; + color:#ffffff; + cursor:pointer; +} + +a:hover,a:active { + text-shadow: 0 0 15px #000000; + cursor:pointer; +} + +button, input[type="button"], .filebutton { + color:#dddddd; + background-color:transparent; + border:1px solid #aaaaaa; +} + +button:hover, input[type="button"]:hover, .filebutton:hover { + color:#ffffff; + border:1px solid #ffffff; + text-shadow: 0 0 15px #ffffff; +} + +select { + color:#dddddd; +} + +.selectholder { + background-color:rgba(0,0,0,0.3); +} + +.selectholder:hover { + background-color:rgba(0,0,0,0.2); +} + +input[type="text"] { + background-color: rgba(0,0,0,0.3); + border-bottom: 1px solid #555555; +} + +input[type="text"]:hover { + background-color: rgba(0,0,0,0.2); + border-bottom: 1px solid #555555; +} + +input[type="text"]:focus { + transition: border-bottom 0.5s ease; + border-bottom: 1px solid #bbbbbb; +} + +select:hover { + color: #ffffff; +} + +.drop-box { + background-color: rgba(0,0,0,0.3); + color:white; +} + +/* +===================================================================== += Specific Elements By ID +===================================================================== +*/ + +#sources, #infobar.coloured, #headerbar, #playlist, #thetopbit { + background-color:rgba(0,0,0,0.3); +} + +#infopane { + background-color:rgba(0,0,0,0.4); +} + +#notifications { + background-color:rgba(0,0,0,0.9); +} + +#wikipopup { + background-color:#000000; + opacity:0.75; +} + +#tagadder { + background-color:rgba(0,0,0,0.8); +} + +#artistchooser { + background-color:rgba(0,0,0,0.3); + color:#aaaaaa; +} + +#dragger { + background-color:rgba(0,0,0,0.3); +} + +#pset { + background-color: rgba(61, 47, 49, 0.99); +} +#pmaxset { + background-color: rgba(89, 80, 72, 0.99); +} + +/* +===================================================================== += General Classes +===================================================================== +*/ + +.mainpane { + background-color:rgba(0,0,0,0.2); +} + +.album2 { + background-color:rgba(0,0,0,0.2); +} + +.item { + margin-bottom: 2px; +} + +.playable:hover, .infoclick:hover, div.clickplaylist:hover, tr.playable:hover>td { + text-shadow: 0 0 15px #ffffff; + color:#ffffff; + cursor:pointer; +} + +.playable.selected:hover, tr.playable.selected:hover>td { + color:#ffffff; +} + +.selected { + background-color:rgba(255,72,0,0.5); +} + +.playlistcurrentitem { + font-weight:bold; + font-size:120%; + border-left:4px solid white; + color:#eeeeee; + transition:font-size 0.3s ease, text-shadow 0.3s ease; +} + +.clicktrack.playlistcurrentitem +{ + padding-left:8px; +} + +.playlistitem, .playlistalbum { + transition:font-size 0.3s ease, text-shadow 0.3s ease; +} + +.playlistcurrenttitle { + text-shadow: 0px 0px 20px #cccccc; + font-weight:bold; + color:#eeeeee; + background-color:rgba(0,0,0,0.1); + transition:font-size 0.3s ease, text-shadow 0.3s ease; +} + +.playlisttitle { + background-color:rgba(0,0,0,0.1); +} + +.stleft { + border-right:1px solid #888888; +} + +.infosection { + background-color:rgba(0,0,0,0.5); +} + +.popupwindow { + background-color:rgba(0,0,0,0.6); +} + +table.histable tr:hover { + font-size:105%; + text-shadow: 0 0 15px #ffffff; + color:#ffffff; + transition:all 0.1s; +} + +table.histable tr { + transition:all 0.2s; +} + +.backhi:hover { + text-shadow: 0 0 15px #ffffff; + color:#ff4800; + cursor:pointer; + transition:all 0.1s; +} + +.backhi { + transition:all 0.2s; +} + +tr.clickaddtrack:hover { + background-color:#e1e4ea; +} + +.bsel { + color:#ffffff; + text-shadow:0 0 15px #ffffff; +} + +.bmid { + border-left:2px solid #ff4800; +} + +.tagholder table tr th { + background-color:rgba(0,0,0,0.5); + border-bottom:1px solid #000000; +} + +.dropshadow { + box-shadow: 7px 7px 5px rgba(0, 0, 0, 0.4); +} + +.progressbar { + border:1px solid #666666; +} + +.progressbar_v { + border:1px solid #666666; +} + +/* +===================================================================== += Dropdown Menus +===================================================================== +*/ + +div.topdropmenu { + background-color:rgba(74,58,52,0.9); +} + +.configtitle { + background-color:rgba(50,50,50,0.8); +} + +body.mobile .configtitle { + width:95%; + margin-left:auto; + margin-right:auto; +} + +/* +===================================================================== += Info Panel - General +===================================================================== +*/ + +#artistbio { + padding:4px; +} + +.infowiki { + color:white; +} + +.currentbun { + border-bottom:1px solid #000000; + padding-bottom:2px; +} + +/* +===================================================================== += Info Panel - Spotify +===================================================================== +*/ + +.helpfulalbum +{ + background-color:rgba(0,0,0,0.4); +} + +.tagholder_wide +{ + background-color:rgba(0,0,0,0.6); +} + +/* +===================================================================== += Podcasts +===================================================================== +*/ + +.podcastitem +{ + border-top:1px solid #cccccc; +} + +/* +===================================================================== += For Album Art Manager +===================================================================== +*/ + +#artistcoverslist { + background-color:rgba(0,0,0,0.5); +} + +.highlighted { + background-color:rgba(0,0,0,0.5) !important; +} + +.albumcovers .infosection { + margin-bottom: 0px; +} + +.albumsection { + background-color:rgba(0,0,0,0.5); + box-sizing:border-box; +} + +/* +===================================================================== += Things that look like they might be for styling wikipedia data +===================================================================== +*/ + +table.navbox th +{ + background-color: rgba(0,0,0,0.2); +} + +.navbox-abovebelow +{ + padding-bottom:4px; +} + +.navbox-title a:link, +.navbox-abovebelow a:link, +.navbox-group a:link +{ + text-decoration:none; +} + +.navbox-title a:visited, +.navbox-abovebelow a:visited, +.navbox-group a:visited +{ + text-decoration:none; +} + +.navbox-title a:hover,a:active, +.navbox-abovebelow a:hover,a:active, +.navbox-group a:hover,a:active +{ + text-decoration:none; +} + +table.tracklist { + line-height:1.5em; +} + +.tracklist tbody tr th +{ + font-weight:bold; +} + +.description +{ + margin-top:4px; +} + +.underline +{ + border-bottom: 1px solid yellow; +} + +.infosection h2 +{ + border-bottom:2px solid white; +} diff --git a/www/rompr/themes/Negative.css b/www/rompr/themes/Negative.css new file mode 100644 index 0000000..1e30eee --- /dev/null +++ b/www/rompr/themes/Negative.css @@ -0,0 +1,453 @@ +/* +===================================================================== += Standard HTML Elements +===================================================================== +*/ + +body +{ + +} + +body,p,h1,h2,h3,h4,h5,h6,table,td,th,ul,ol +{ + color:#111111; +} + +button, input[type="button"], .filebutton +{ + background-color:#121212; + border:1px solid #333333; + /* background-image:none !important; */ + color:#cccccc; + font-weight:bold; + font-size:110%; +} + +button:hover, input[type="button"]:hover, .filebutton:hover +{ + color:#ffffff; + border:1px solid #666666; + transition: all 0.5s ease; +} + +input +{ + color:#000000; +} + +input[type="submit"] +{ + color: #dddddd; +} + +a:link { + color:yellow; +} + +a:visited { + color:yellow; +} + +a:hover,a:active +{ + color:red; +} + +/* +===================================================================== += Specific Elements By ID +===================================================================== +*/ + +body.mobile, body.phone .dropmenu { + background-image: linear-gradient(#eeeeee, #999999); +} + +body.desktop #infobar +{ + background-image: linear-gradient(#eeeeee, #dddddd); +} + +body.desktop #headerbar +{ + background-image: linear-gradient(#dddddd, #dcdcdc); +} + +body.desktop #thetopbit +{ + background-image: linear-gradient(#eeeeee, #dcdcdc); +} + +#bottompage +{ + background-image: linear-gradient(#dcdcdc, #999999); +} + +#custombackground +{ + display:none; +} + +#notifications +{ + background-image: linear-gradient(#dcdcdc, #999999); +} + +#wikipopup +{ + background-image: linear-gradient(#dcdcdc, #999999); +} + +#imagecontainer +{ + background-image: linear-gradient(#dcdcdc, #999999); +} + +#tagadder +{ + background-image: linear-gradient(#dcdcdc, #999999); + border-left:1px solid #ffffff; + border-bottom:1px solid #000000; + border-right:1px solid #000000; +} + +#dragger +{ + background-color:rgba(0,0,0,0.3); +} + +#pset { + background-color: rgba(150, 150, 150, 0.99); +} +#pmaxset { + background-color: rgba(255, 255, 255, 0.99); +} + +/* +===================================================================== += General Classes +===================================================================== +*/ + +.bordered +{ + border-left:1px solid #bbbbbb; + border-bottom:1px solid #eeeeee; + border-right:1px solid #eeeeee; + border-top:1px solid #bbbbbb; +} + +.album1 +{ + /*background-color:rgba(200,200,200,0.1);*/ +} + +.album2 +{ + /*background-color:rgba(200,200,200,0.2);*/ +} + +a.album:visited +{ + color:#222222; +} + +a.album:hover,a.album:active +{ + color:#333333; +} + +.playable:hover, .infoclick:hover, div.clickplaylist:hover, tr.playable:hover>td { + text-shadow: 0 0 8px #ffffff; +} + +.playable.selected:hover, tr.playable.selected:hover>td { + text-shadow: 0 0 8px #ffffff; +} + +.selected +{ + background-color:rgba(0,0,0,0.5); +} + +.playlistcurrentitem +{ + font-size:110%; + transition:font-size 0.5s ease, text-shadow 0.5s ease; + background-color:rgba(0,0,0,0.1); +} + +.playlistitem, .playlistalbum +{ + transition:font-size 0.5s ease, text-shadow 0.5s ease; +} + +.playlistcurrenttitle +{ + font-size:125% + background-color:rgba(0,0,0,0.1); + transition:font-size 0.5s ease, text-shadow 0.5s ease; +} + +.item +{ + border-top:1px solid #222222; +} + +.inbrowser +{ + color:#000000; +} + +.stleft +{ + border-right:1px solid #444444; +} + +.popupwindow +{ + background-image: linear-gradient(#dcdcdc, #999999); + border-left:1px solid #eeeeee; + border-bottom:1px solid #bbbbbb; + border-right:1px solid #bbbbbb; + border-top:1px solid #eeeeee; +} + +.backhi:hover { + color:#444444; + cursor:pointer; +} + +table.histable tr:hover { + background-color:rgba(0,0,0,0.1); + cursor:pointer; +} + +.tagholder table tr th +{ + border-bottom:1px solid #cccccc; +} + +tr.clickaddtrack:hover +{ + text-shadow: 0 0 8px #333333; +} + +.bsel +{ + text-shadow: 0 0 8px #333333; +} + +.bmid +{ + border-left:2px solid #222222; +} + +.currentbun +{ + border-bottom:1px solid #222222; + padding-bottom:2px; +} + +.dropshadow +{ + box-shadow: 7px 7px 5px rgba(0, 0, 0, 0.9); +} + +.progressbar +{ + border:1px solid #414141; +} + +.progressbar_v +{ + border-left:1px solid #bbbbbb; + border-bottom:1px solid #eeeeee; + border-right:1px solid #eeeeee; + border-top:1px solid #bbbbbb; +} + +/* +===================================================================== += Dropdown Menus +===================================================================== +*/ + +div.topdropmenu +{ + background-image: linear-gradient(#dcdcdc, #999999); + border-left:1px solid #eeeeee; + border-bottom:1px solid #bbbbbb; + border-right:1px solid #bbbbbb; + border-top:none; +} + +.configtitle +{ + background-image: linear-gradient(#dcdcdc, #999999); +} + +/* +===================================================================== += Info Panel - General +===================================================================== +*/ + +.infowiki +{ + background-color:rgba(0,0,0,0.1); +} + +/* +===================================================================== += Info Panel - Spotify +===================================================================== +*/ + +.helpfulalbum +{ + background-image: linear-gradient(#dcdcdc, #999999); +} + +.collectionitem .helpfulalbum.fixed { + background-image: linear-gradient(#999999, #878787); +} + +.tagholder_wide +{ + background-image: linear-gradient(#dcdcdc, #999999); +} + +.tagholder_wide .helpfulalbum.tleft +{ + background-image: none; +} + +/* +===================================================================== += Podcasts +===================================================================== +*/ + +.podcastitem +{ + border-top:1px solid #cccccc; +} + +/* +===================================================================== += For Album Art Manager +===================================================================== +*/ + +.albumsection +{ + background-image: linear-gradient(#dcdcdc, #999999); +} + +.albumcovers +{ + background-image: linear-gradient(#dcdcdc, #999999); +} + +#wobblebottom +{ + background-image: linear-gradient(#dcdcdc, #999999); +} + +#coverslist +{ + box-sizing:border-box; + border-left:1px solid #bbbbbb; +} + +.highlighted { + background-color:rgba(0,0,0,0.6); +} + +#imageeditor +{ + background-color:rgba(0,0,0,0.6); +} + +#artistchooser +{ + border-bottom:1px solid #777777; +} + +/* +===================================================================== += Things that look like they might be for styling wikipedia data +===================================================================== +*/ + +table.navbox th +{ + background-color: rgba(255,255,255,0.1); +} + +.navbox-abovebelow +{ + padding-bottom:4px; +} + +.navbox-title a:link, +.navbox-abovebelow a:link, +.navbox-group a:link +{ + text-decoration:none; +} + +.navbox-title a:visited, +.navbox-abovebelow a:visited, +.navbox-group a:visited +{ + text-decoration:none; +} + +.navbox-title a:hover,a:active, +.navbox-abovebelow a:hover,a:active, +.navbox-group a:hover,a:active +{ + text-decoration:none; +} + +table.tracklist { + line-height:1.5em; +} + +.tracklist tbody tr th +{ + font-weight:bold; +} + +tr.tagh +{ + font-size:150%; +} + +th.tlheader +{ + /*background-color:#232323;*/ +} + +.description +{ + margin-top:4px; +} + +.underline +{ + border-bottom: 1px solid #999999; +} + +.infosection h2 +{ + border-bottom:2px solid #eeeeee; +} + +.topbarplaycontrols { + border-left: 1px solid black; + border-right: 1px solid black; +} diff --git a/www/rompr/themes/NightClouds.css b/www/rompr/themes/NightClouds.css new file mode 100644 index 0000000..14de8ee --- /dev/null +++ b/www/rompr/themes/NightClouds.css @@ -0,0 +1,415 @@ +html, body.phone .dropmenu { + background-image:url("themes/nightclouds.jpg"); + background-size:cover; + background-repeat:no-repeat; + background-attachment:fixed; +} + +body.phone .dropmenu>div { + background-color:rgba(0,0,0,0.2); + background-clip:border-box; +} + +#sources, .mainpane +{ + background-color:rgba(0,0,0,0.2); +} + +.album2 +{ + background-color:rgba(0,0,0,0.2); +} + +#playlist +{ + background-color:rgba(0,0,0,0.2); +} + +#infopane +{ + background-color:rgba(0,0,0,0.4); +} + +.helpfulalbum +{ + background-color:rgba(0,0,0,0.4); +} + +.tagholder_wide +{ + background-color:rgba(0,0,0,0.6); +} + +#artistbio +{ + padding:4px; +} + +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input +{ + color:#eeeeee; +} + +a:link +{ + color:yellow; +} + +a:visited +{ + color:yellow; +} + +a:hover,a:active +{ + text-shadow: 0 0 15px #000000; + cursor:pointer; +} + +.infowiki +{ + color:white; +} + +.item +{ + margin-bottom: 2px; +} + +/*-- divs used to create infobar layout --*/ + +button, input[type="button"], .filebutton +{ + color:#dddddd; + background-color:transparent; + border:1px solid #aaaaaa; +} + +button:hover, input[type="button"]:hover, .filebutton:hover +{ + color:#ffffff; + border:1px solid #ffffff; + text-shadow: 0 0 15px #ffffff; +} + +select { + color:#dddddd; +} + +.selectholder { + background-color:rgba(200,200,200,0.15); +} + +.selectholder:hover { + background-color:rgba(200,200,200,0.2); +} + +input[type="text"] { + background-color: rgba(200,200,200,0.15); + border-bottom: 1px solid #555555; +} + +input[type="text"]:hover { + background-color: rgba(200,200,200,0.2); + border-bottom: 1px solid #555555; +} + +input[type="text"]:focus { + transition: border-bottom 0.5s ease; + border-bottom: 1px solid #bbbbbb; +} + +select:hover { + color: #ffffff; +} + +.drop-box { + background-color: rgba(200,200,200,0.3); + color:white; +} + +#notifications +{ + background-color:rgba(0,0,0,0.9); +} + +a.album:visited +{ + color:#220000; +} + +a.album:hover,a.album:active +{ + text-shadow: 0 0 15px #ffffff; + color:#ffffff; + cursor:pointer; +} + +#filemenu +{ + border-left:1px solid white; +} + +#pset { + background-color: rgba(73, 47, 24, 0.99); +} + +.playable:hover, .infoclick:hover, div.clickplaylist:hover, tr.playable:hover>td { + text-shadow: 0 0 15px #ffffff; + color:#ffffff; + cursor:pointer; +} + +.playable.selected:hover, tr.playable.selected:hover>td { + color:#ffffff; +} + +.selected +{ + background-color:rgba(255,72,0,0.6); +} + +/*-- divs and classes used in the playlist --*/ + +.playlistcurrentitem +{ + font-weight:bold; + font-size:120%; + border-left:4px solid white; + color:#eeeeee; + transition:font-size 0.3s ease, text-shadow 0.3s ease; +} + +.clicktrack.playlistcurrentitem +{ + padding-left:8px; +} + +.playlistitem, .playlistalbum +{ + transition:font-size 0.3s ease, text-shadow 0.3s ease; +} + +.playlistcurrenttitle +{ + text-shadow: 0px 0px 20px #cccccc; + font-weight:bold; + color:#eeeeee; + background-color:rgba(0,0,0,0.2); + transition:font-size 0.3s ease, text-shadow 0.3s ease; +} + +.playlisttitle{ + background-color:rgba(0,0,0,0.2); +} + +/*-- For Wikipedia and Last.FM pages --*/ + +.stleft +{ + border-right:1px solid #888888; +} + +#wikipopup +{ + background-color:#000000; +} + +#imagecontainer +{ + background-color:#ffffff; +} + +.infosection +{ + background-color:rgba(0,0,0,0.4); + background-size:cover; + background-repeat:no-repeat; +} + +.translucent +{ + opacity:0.7; +} + +/*-- For Album Cover Art --*/ + +.crackbaby +{ + background-color:rgba(0,0,0,0.4); + box-sizing:border-box; + background-size:cover; + background-repeat:no-repeat; +} + +.popupwindow +{ + background-color:rgba(0,0,0,0.8); +} + +/*-- Styles for drop-down menus --*/ + +div.topdropmenu +{ + background-color:rgba(0,0,0,0.9); +} + +.configtitle +{ + background-color:rgba(200,80,0,0.4); +} + +body.mobile .configtitle +{ + width:100%; + margin-left:auto; + margin-right:auto; +} + +/*-- Styles to make the Wikipedia nav boxes look prettier --*/ + +table.navbox th +{ + background-color: rgba(0,0,0,0.2); +} + +.navbox-abovebelow +{ + padding-bottom:4px; +} + +.navbox-title a:link, +.navbox-abovebelow a:link, +.navbox-group a:link +{ + text-decoration:none; +} + +.navbox-title a:visited, +.navbox-abovebelow a:visited, +.navbox-group a:visited +{ + text-decoration:none; +} + +.navbox-title a:hover,a:active, +.navbox-abovebelow a:hover,a:active, +.navbox-group a:hover,a:active +{ + text-decoration:none; +} + +table.tracklist { + line-height:1.5em; +} + +.tracklist tbody tr th +{ + font-weight:bold; +} + +.description +{ + margin-top:4px; +} + +.underline +{ + border-bottom: 1px solid yellow; +} + +.infosection h2 +{ + border-bottom:2px solid white; +} + +#tagadder +{ + background-color:rgba(0,0,0,0.9); +} + +table.histable tr:hover { + font-size:105%; + text-shadow: 0 0 15px #ffffff; + color:#ff4800; + transition:all 0.1s; +} + +table.histable tr +{ + transition:all 0.2s; +} + +.backhi:hover { + text-shadow: 0 0 15px #ffffff; + color:#ff4800; + cursor:pointer; + transition:all 0.1s; +} + +.backhi +{ + transition:all 0.2s; +} + +tr.clickaddtrack:hover +{ + background-color:#e1e4ea; +} + +.bsel +{ + color:#ffffff; + text-shadow:0 0 15px #ffffff; +} + +.bmid +{ + border-left:2px solid #ff4800; +} + +.highlighted { + background-color:rgba(180,120,0,0.8); +} + +.tagholder table tr th { + background-color:rgba(0,0,0,0.5); + border-bottom:1px solid #000000; +} + +#artistchooser +{ + background-color:rgba(0,0,0,0.4); + color:#555555; +} + +.currentbun +{ + border-bottom:1px solid #fe6500; + padding-bottom:2px; +} + +.dropshadow +{ + box-shadow: 7px 7px 5px rgba(0, 0, 0, 0.6); +} + +.progressbar +{ + border:1px solid #414141; +} + +.progressbar_v +{ + border:1px solid #414141; +} + +.podcastitem +{ + border-top:1px solid #cccccc; +} + +#dragger +{ + background-color:rgba(0,0,0,0.5); +} diff --git a/www/rompr/themes/Numismatist.css b/www/rompr/themes/Numismatist.css new file mode 100644 index 0000000..46d0c20 --- /dev/null +++ b/www/rompr/themes/Numismatist.css @@ -0,0 +1,507 @@ +/* +===================================================================== += Standard HTML Elements +===================================================================== +*/ + +body +{ + +} + +body,p,h1,h2,h3,h4,h5,h6,table,td,th,ul,ol,input,select +{ + color:#111111; +} + +body.phone .dropmenu>div.playable, +body.phone .dropmenu>div.menuitem, +body.phone .mainpane .radio, +body.phone .mainpane .faveradio, +body.phone .mainpane .podcast:not(.podicon):not(.podglobal), +body.phone .mainpane .directory { + border-top: 1px solid rgba(60,60,60,0.4); +} + +body.phone #pluginplaylistholder .menuitem.clickicon, +body.phone #pluginplaylistholder .menuitem.containerbox.fullwidth { + border-bottom: 1px solid rgba(60,60,60,0.4); +} + +button, input[type="button"], .filebutton +{ + background-color:#dddddd; + border:none; + color:#444444; + font-weight:normal; + font-size:110%; +} + +button:hover, input[type="button"]:hover, .filebutton:hover +{ + color:black; + background-color:#eeeeee; +} + +input[type="submit"] +{ + color: #dddddd; +} + +a:link { + color:#0b0080; +} + +a:visited { + color:#0b0080; +} + +a:hover,a:active { + color:#ff4800; +} + +.selectholder { + background-color:rgba(0,0,0,0.05); +} + +.selectholder:hover { + background-color:rgba(0,0,0,0.03); +} + +input[type="text"] { + background-color: rgba(0,0,0,0.05); +} + +input[type="text"]:hover, input.snapclientname[type="text"]:hover { + background-color: rgba(0,0,0,0.03) !important; +} + +input[type="text"]:focus { + transition: border-bottom 0.5s ease; + border-bottom: 1px solid #bbbbbb; +} + +/* +===================================================================== += Specific Elements By ID +===================================================================== +*/ + +body.mobile, body.phone .dropmenu { + background-image: linear-gradient(#ffffff, #bbbbbb); +} + +.album2 { + background-color:rgba(0,0,0,0.1); +} + +.setupdiv +{ + background-image: linear-gradient(#ffffff, #bbbbbb); +} + +body.setup +{ + background-color: #dddddd; +} + +body.desktop #infobar +{ + background-image: linear-gradient(#ffffff, #eeeeee); +} + +body.desktop #headerbar +{ + background-image: linear-gradient(#eeeeee, #ededed); +} + +body.desktop #thetopbit +{ + background-image: linear-gradient(#ffffff, #ededed); +} + +#bottompage +{ + background-image: linear-gradient(#ededed, #bbbbbb); +} + +#pset { + background-color: rgba(1, 1, 1, 0.75); +} +#pmaxset { + background-color: rgba(150, 150, 150, 0.75); +} +#pbgset { + background-color: rgba(1, 1, 1, 0); +} + +#custombackground +{ + display:none; +} + +#notifications +{ + background-image: linear-gradient(#ededed, #cccccc); +} + +#wikipopup +{ + background-image: linear-gradient(#ededed, #cccccc); +} + +#imagecontainer +{ + background-image: linear-gradient(#ededed, #cccccc); +} + +#tagadder +{ + background-image: linear-gradient(#ededed, #cccccc); + border-left:1px solid #ffffff; + border-bottom:1px solid #000000; + border-right:1px solid #000000; +} + +#dragger +{ + background-color:rgba(0,0,0,0.3); +} + +/* +===================================================================== += General Classes +===================================================================== +*/ + +.bordered +{ + border-left:1px solid #bbbbbb; + border-bottom:1px solid #ffffff; + border-right:1px solid #ffffff; + border-top:1px solid #bbbbbb; +} + +.album1 +{ + /*background-color:rgba(200,200,200,0.1);*/ +} + +.album2 +{ + /*background-color:rgba(200,200,200,0.2);*/ +} + +a.album:visited +{ + color:#222222; +} + +a.album:hover,a.album:active +{ + color:#333333; +} + +.playable:hover, .infoclick:hover, div.clickplaylist:hover, tr.playable:hover>td { + text-shadow: 0 0 10px #ffffff; +} + +.playable.selected:hover, tr.playable.selected:hover>td { + background-color:rgba(0,0,0,0.1); +} + +div.playable.selected:hover +{ + text-shadow: 0 0 12px #333333; +} + +.selected +{ + background-color:rgba(0,0,0,0.4) !important; +} + +.playlistcurrentitem +{ + font-size:120%; + transition:font-size 0.5s ease, text-shadow 0.5s ease; +} + +.playlistitem, .playlistalbum +{ + transition:font-size 0.5s ease, text-shadow 0.5s ease; +} + +.playlistcurrenttitle +{ + font-size:125% + transition:font-size 0.5s ease, text-shadow 0.5s ease; +} + +.item +{ + border-top:1px solid #222222; +} + +.stleft +{ + border-right:1px solid #444444; +} + +.popupwindow +{ + background-image: linear-gradient(#ededed, #bbbbbb); + border-left:1px solid #eeeeee; + border-bottom:1px solid #bbbbbb; + border-right:1px solid #bbbbbb; + border-top:1px solid #eeeeee; +} + +.backhi:hover { + color:#444444; + cursor:pointer; +} + +table.histable tr:hover { + background-color:rgba(0,0,0,0.1); + cursor:pointer; +} + +.tagholder table tr th +{ + border-bottom:1px solid #222222; +} + +tr.clickaddtrack:hover +{ + text-shadow: 0 0 8px #333333; +} + +.drop-box +{ + background-color: rgba(0,0,0,0.05); +} + +.bsel +{ + text-decoration: underline; +} + +.bmid +{ + border-left:2px solid #222222; +} + +.currentbun +{ + border-bottom:1px solid #222222; + padding-bottom:2px; +} + +.dropshadow +{ + box-shadow: 7px 7px 5px rgba(0, 0, 0, 0.9); +} + +.progressbar +{ + border:1px solid #414141; +} + +.progressbar_v +{ + border-left:1px solid #bbbbbb; + border-bottom:1px solid #eeeeee; + border-right:1px solid #eeeeee; + border-top:1px solid #bbbbbb; +} + +.textunderline +{ + border-bottom: 1px solid #222222; +} + +/* +===================================================================== += Dropdown Menus +===================================================================== +*/ + +div.topdropmenu +{ + background-image: linear-gradient(#ededed, #bbbbbb); + border-left:1px solid #eeeeee; + border-bottom:1px solid #bbbbbb; + border-right:1px solid #bbbbbb; + border-top:none; +} + +.configtitle +{ + border-bottom:1px solid #111111; + background-color: rgba(255,255,255,0.2); +} + +/* +===================================================================== += Info Panel - General +===================================================================== +*/ + +.infowiki +{ + background-color:#dedede; +} + +/* +===================================================================== += Info Panel - Spotify +===================================================================== +*/ + +.helpfulalbum +{ + background-image: linear-gradient(#ededed, #bbbbbb); +} + +.collectionitem .helpfulalbum.fixed { + background-image: linear-gradient(#bbbbbb, #aaaaaa); +} + +.tagholder_wide +{ + background-image: linear-gradient(#ededed, #bbbbbb); +} + +.tagholder_wide .helpfulalbum.tleft +{ + background-image: none; +} + +/* +===================================================================== += Podcasts +===================================================================== +*/ + +.podcastitem +{ + border-top:1px solid #cccccc; +} + +/* +===================================================================== += For Album Art Manager +===================================================================== +*/ + +.albumsection +{ + border-top:1px solid #999999; + margin-top:8px; +} + +.albumcovers +{ + background-image: linear-gradient(#ededed, #bbbbbb); +} + +#wobblebottom +{ + background-image: linear-gradient(#ededed, #bbbbbb); +} + +#coverslist +{ + box-sizing:border-box; + border-left:1px solid #bbbbbb; +} + +.highlighted { + background-color:rgba(255,255,255,0.7); +} + +#imageeditor +{ + background-color:rgba(255,255,255,0.7); +} + +#artistchooser +{ + border-bottom:1px solid #777777; +} + +/* +===================================================================== += Things that look like they might be for styling wikipedia data +===================================================================== +*/ + +table.navbox th +{ + background-color: rgba(255,255,255,0.1); +} + +.navbox-abovebelow +{ + padding-bottom:4px; +} + +.navbox-title a:link, +.navbox-abovebelow a:link, +.navbox-group a:link +{ + text-decoration:none; +} + +.navbox-title a:visited, +.navbox-abovebelow a:visited, +.navbox-group a:visited +{ + text-decoration:none; +} + +.navbox-title a:hover,a:active, +.navbox-abovebelow a:hover,a:active, +.navbox-group a:hover,a:active +{ + text-decoration:none; +} + +table.tracklist { + line-height:1.5em; +} + +.tracklist tbody tr th +{ + font-weight:bold; +} + +tr.tagh +{ + font-size:150%; +} + +th.tlheader +{ + /*background-color:#232323;*/ +} + +.description +{ + margin-top:4px; +} + +.underline +{ + border-bottom: 1px solid #222222; +} + +.infosection h2 +{ + border-bottom:2px solid #222222; +} + +.topbarplaycontrols { + border-left: 1px solid black; + border-right: 1px solid black; +} diff --git a/www/rompr/themes/Oxygen.css b/www/rompr/themes/Oxygen.css new file mode 100644 index 0000000..6157449 --- /dev/null +++ b/www/rompr/themes/Oxygen.css @@ -0,0 +1,414 @@ +html, body.phone .dropmenu { + background-color:#cccccc; +} + +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input +{ + color:#000000; +} + +h1,h2,h3,h4,h5,h6 +{ + color:#000000; +} + +a:link +{ + color:#0b0080; +} + +a:visited +{ + color:#0b0080; +} + +a:hover,a:active +{ + color:#ff4800; +} + +input +{ + color:#181818; +} + +button, .filebutton +{ + color:#000000; + border: 1px solid #000000; +} + +button:hover, .filebutton:hover +{ + color:#ff4800; + text-shadow: 0 0 15px #ff4800; +} + +select +{ + color:#181818; +} + +input.inbrowser, div.inbrowser +{ + border: 1px solid #888888; +} + +#infobar.coloured, #thetopbit +{ + background-image: linear-gradient(#dfdfdf, #b9b9b9); +} + +#headerbar +{ + background-image: linear-gradient(#b9b9b9, #b4b4b4); +} + +#custombackground +{ + display:none; +} + +#infopane +{ + border-top:1px solid #000000; +} + +#sources +{ + border-top:1px solid #000000; +} + +#playlist +{ + background-image: linear-gradient(#b4b4b4, #aeaeae); +} + +/*-- divs used to create infobar layout --*/ + +.bordered +{ + border-left:1px solid #9a9a9a; + border-bottom:1px solid #efefef; + border-right:1px solid #efefef; + border-top:1px solid #9a9a9a; +} + +#notifications +{ + background-color:#a9a9a9; +} +/*-- divs and classes used in the albums list --*/ + +.album1 +{ + background-color:#c4c4c4; +} + +.album2 +{ + background-color:#cccccc; +} + +.textunderline { + border-bottom: 1px solid #222222; +} + +a.album:visited +{ + color:#220000; +} + +a.album:hover,a.album:active +{ + color:#ff4800; +} + +#filemenu +{ + border-left:1px solid #444444; +} + +.playable:hover, .infoclick:hover, div.clickplaylist:hover, tr.playable:hover>td { + color:#ff4800; +} + +.playable.selected:hover, tr.playable.selected:hover>td { + color:#dddddd; +} + +.selected +{ + background-color:#CC5500; +} + +/*-- divs and classes used in the playlist --*/ + +.playlistcurrentitem +{ + color:#cc0000; +} + +.playlistcurrenttitle +{ + color:#cc0000; +} + +.item +{ + border-top:1px solid #999999; +} + +.inbrowser +{ + color:#000000; +} + +/*-- For Wikipedia and Last.FM pages --*/ + +.stleft +{ + border-right:1px solid #888888; +} + +#wikipopup +{ + background-color:#000000; +} + +#imagecontainer +{ + background-color:#ffffff; +} + +.infosection +{ + background-image: linear-gradient(#dfdfdf, #b9b9b9); +} + +.albumsection +{ + background-color:#bbbbbb; +} + +.translucent +{ + opacity:0.7; +} + +.infowiki +{ + background-color:#eaeaea; +} + +/*-- For Album Cover Art --*/ + +.crackbaby +{ + background-image: linear-gradient(#dfdfdf, #b9b9b9); +} + +#albumcovers +{ + background-color:#bbbbbb; +} + +.popupwindow +{ + background-color:#bababa; + border-left:1px solid #eeeeee; + border-bottom:1px solid #9a9a9a; + border-right:1px solid #9a9a9a; + border-top:1px solid #eeeeee; +} + + +/*-- Styles for drop-down menus --*/ + +div.topdropmenu +{ + background-image: linear-gradient(#b9b9b9, #b4b4b4); + border-left:1px solid #eeeeee; + border-bottom:1px solid #9a9a9a; + border-right:1px solid #9a9a9a; +} + +.configtitle +{ + background-image: linear-gradient(#dfdfdf, #b4b4b4); +} + +/*-- Styles to make the Wikipedia nav boxes look prettier --*/ + +table.navbox th +{ + background-color: #dddddd; +} + +.navbox-abovebelow +{ + padding-bottom:4px; +} + +.navbox-title a:link, +.navbox-abovebelow a:link, +.navbox-group a:link +{ + text-decoration:none; +} + +.navbox-title a:visited, +.navbox-abovebelow a:visited, +.navbox-group a:visited +{ + text-decoration:none; +} + +.navbox-title a:hover,a:active, +.navbox-abovebelow a:hover,a:active, +.navbox-group a:hover,a:active +{ + text-decoration:none; +} + +table.tracklist { + line-height:1.5em; +} + +.tracklist tbody tr th +{ + font-weight:bold; +} + +.description +{ + margin-top:4px; +} + +.underline +{ + border-bottom: 1px solid #444444; +} + +.infosection h2 +{ + border-bottom:2px solid #444444; +} + +#tagadder +{ + background-color:#bababa; +} + +table.histable tr:hover { + background-color:#CC5500; +} + +.backhi:hover { + background-color:#CC5500; + cursor:pointer; +} + +tr.clickaddtrack:hover +{ + background-color:#cccccc; +} + +.highlighted { + border-top: 4px solid #fe6800 !important; + border-left: 4px solid #fe6800 !important; + border-right: 4px solid #fe6800 !important; + border-bottom: 4px solid #fe6800 !important; + border-radius:2px !important; +} + +.covercontainer.highlighted +{ + border-bottom: none !important; + margin-bottom:-4px; + background-color:#cccccc; +} + +#imageeditor +{ + background-color:#cccccc; +} + +.tagholder table tr th { + background-color:rgba(0,0,0,0.5); + border-bottom:1px solid #000000; + color:#ffffff; +} + +.bsel +{ + color:#ff4800; +} + +.bmid +{ + border-left:2px solid #ff4800; +} + +.helpfulalbum +{ + background-color:#dddddd; +} + +.tagholder_wide +{ + background-color:#cccccc; +} + +.tagholder_wide .helpfulalbum.tleft +{ + background-color:transparent; +} + +#artistchooser +{ + border-bottom:1px solid #777777; + border-top:1px solid #777777; + color:#555555; +} + +.currentbun +{ + border-bottom:1px solid #fe6500; + padding-bottom:2px; +} + +.dropshadow +{ + box-shadow: 7px 7px 5px rgba(50, 50, 50, 0.6); +} + +.progressbar +{ + border:1px solid #414141; +} + +.podcastitem +{ + border-top:1px solid #000000; +} + +.mCSB_draggerRail +{ + background:rgba(0,0,0,0.1) !important; +} + +.mCSB_dragger_bar +{ + background:rgba(0,0,0,0.75) !important; +} + +#dragger +{ + background-color:rgba(0,0,0,0.3); +} + +.topbarplaycontrols { + border-left: 1px solid black; + border-right: 1px solid black; +} diff --git a/www/rompr/themes/Paper.css b/www/rompr/themes/Paper.css new file mode 100644 index 0000000..c972293 --- /dev/null +++ b/www/rompr/themes/Paper.css @@ -0,0 +1,360 @@ +/* +===================================================================== += Standard HTML Elements +===================================================================== +*/ + +html, body.phone .dropmenu { + color:#000000; + background-image:url('themes/Paper1.jpg'); +} + +h1,h2,h3,h4,h5,h6 { + color:#000000; +} + +a:link { + color:#12569a; +} + +a:visited { + color:#12569a; +} + +a:hover,a:active { + color:#ff4800; +} + +button, .filebutton { + color:#000000; + background-color:transparent; + border:none; + box-shadow: 3px 3px 2px rgba(50, 50, 50, 0.8); + font-weight:bold; +} + +button:active, .filebutton:active { + box-shadow:none; +} + +button:hover, .filebutton:hover { + color:#ff4800; + background-color: rgba(255, 72, 0, 0.1); +} + +input.inbrowser, div.inbrowser { + border: 1px solid #888888; +} + +/* +===================================================================== += Specific Elements By ID +===================================================================== +*/ + +#custombackground { + display:none; +} + +#buttonholder { + box-shadow: 7px 7px 5px rgba(50, 50, 50, 0.6); +} + +#patrickmoore { + box-shadow: 7px 7px 5px rgba(50, 50, 50, 0.6); +} + +#infopane { + box-sizing:border-box; + border-left: 2px solid black; + border-right: 2px solid white; + border-top: 2px solid black; +} + +#notifications { + background-image:url('themes/oldpaper.jpg'); + box-shadow: 7px 7px 5px rgba(50, 50, 50, 0.6); + opacity:0.8; +} + +#wikipopup { + background-image:url('themes/oldpaper.jpg'); +} + +#tagadder { + background-image:url('themes/oldpaper.jpg'); +} + +#dragger { + background-color:rgba(0,0,0,0.5); +} + +/* +===================================================================== += General Classes +===================================================================== +*/ + +.bordered { + border-top:1px solid #dddddd; + border-left:1px solid #dddddd; +} + +.album1 { + background-color:rgba(150,150,150,0.1); +} + +.album2 { + background-color:rgba(150,150,150,0.2); +} + +.playable:not(.selected):hover, .infoclick:hover, div.clickplaylist:hover, tr.playable:not(.selected):hover>td { + background-color:rgba(220,220,220,0.7); +} + +.playable.selected:hover, tr.playable.selected:hover>td { + color:#dddddd; +} + +.selected { + background-color:#CC5500; +} + +.playlistcurrentitem { + color:#cc0000; +} + +.playlistcurrenttitle { + color:#cc0000; +} + +.stleft { + border-right:1px solid #aaaaaa; +} + +.popupwindow { + background-image:url('themes/vellum-seamless-repeating-white.jpg'); + border-top:1px solid #dddddd; + border-left:1px solid #dddddd; +} + +table.histable tr:hover { + background-color:#CC5500; +} + +.backhi:hover { + background-color:#CC5500; + cursor:pointer; +} + +tr.clickaddtrack:hover { + background-image:url('themes/oldpaper.jpg'); +} + +.tagholder table tr th { + background-image:url('themes/oldpaper.jpg'); + border-bottom:1px solid #000000; +} + +.bsel { + color:#ff4800; +} + +.bmid { + border-left:2px solid #ff4800; +} + +.currentbun { + border-bottom:1px solid #fe6500; + padding-bottom:2px; +} + +.dropshadow { + box-shadow: 7px 7px 5px rgba(50, 50, 50, 0.6); +} + +.progressbar { + border:1px solid #414141; +} + +.mCSB_draggerRail { + background:rgba(0,0,0,0.1) !important; +} + +.mCSB_dragger_bar { + background:rgba(0,0,0,0.75) !important; +} + +.textunderline { + border-bottom: 1px solid #222222; +} + +/* +===================================================================== += Dropdown Menus +===================================================================== +*/ + +div.topdropmenu { + background-image:url('themes/oldpaper.jpg'); + border-bottom:1px solid #555555; + border-right:1px solid #555555; + border-top:none; +} + +.configtitle { + background-image:url('themes/tanpaper.jpg'); + box-shadow: 3px 3px 2px rgba(50, 50, 50, 0.5); + margin-bottom:8px; +} + +/* +===================================================================== += Info Panel - General +===================================================================== +*/ + +.infosection { + background-image:url('themes/tanpaper.jpg'); + box-shadow: 3px 3px 2px rgba(50, 50, 50, 0.5); + margin-bottom:8px; +} + +.albumcovers .infosection { + background-image:url('themes/Paper1.jpg'); +} + +/* +===================================================================== += Info Panel - Spotify +===================================================================== +*/ + +.tagholder_wide +{ + background-color:rgba(0,0,0,0.2); +} + +.helpfulalbum +{ + background-color:rgba(0,0,0,0.3); +} + +.tagholder_wide .helpfulalbum.tleft +{ + background-color:transparent; +} +/* +===================================================================== += Podcasts +===================================================================== +*/ + +.podcastitem +{ + border-top:1px solid #000000; +} + +/* +===================================================================== += For Album Art Manager +===================================================================== +*/ + +.albumsection { + background-image:url('themes/oldpaper.jpg'); + box-shadow: 7px 7px 5px rgba(50, 50, 50, 0.6); +} + +.infowiki { + background-image:url('themes/vellum-seamless-repeating-white.jpg'); +} + +.highlighted { + border-top: 4px solid #fe6800 !important; + border-left: 4px solid #fe6800 !important; + border-right: 4px solid #fe6800 !important; + border-bottom: 4px solid #fe6800 !important; + border-radius:2px !important; +} + +.covercontainer.highlighted +{ + border-bottom: none !important; + margin-bottom:-4px; + background-image:url('themes/Paper1.jpg'); +} + +#imageeditor { + background-image:url('themes/Paper1.jpg'); +} + + + +#artistchooser { + border-bottom:1px solid #555555; + border-top:1px solid #555555; + color:#555555; +} + +#artistcoverslist { + background-image:url('themes/Paper1.jpg'); + box-shadow: 7px 7px 5px rgba(50, 50, 50, 0.6); +} + +#coverslist { + background-image:url('themes/vellum-seamless-repeating-white.jpg'); + box-sizing:border-box; + border-left:2px solid black; +} + +/* +===================================================================== += Things that look like they might be for styling wikipedia data +===================================================================== +*/ + +table.navbox th +{ + background-color: #e5e5e5; +} + +.navbox-title +{ + color:#000000; +} + +.navbox-group +{ + color:#000000; +} + +.navbox-abovebelow +{ + color:#000000; + padding-bottom:4px; +} + +.navbox-title a:link, +.navbox-abovebelow a:link, +.navbox-group a:link +{ + color:#990000; + text-decoration:none; +} + +.navbox-title a:visited, +.navbox-abovebelow a:visited, +.navbox-group a:visited +{ + color:#990000; + text-decoration:none; +} + +.navbox-title a:hover,a:active, +.navbox-abovebelow a:hover,a:active, +.navbox-group a:hover,a:active +{ + color:#ff4800; + text-decoration:none; +} diff --git a/www/rompr/themes/Paper1.jpg b/www/rompr/themes/Paper1.jpg new file mode 100644 index 0000000..c5d0363 Binary files /dev/null and b/www/rompr/themes/Paper1.jpg differ diff --git a/www/rompr/themes/Plasma.css b/www/rompr/themes/Plasma.css new file mode 100644 index 0000000..aa4a3aa --- /dev/null +++ b/www/rompr/themes/Plasma.css @@ -0,0 +1,431 @@ +/* +===================================================================== += Standard HTML Elements +===================================================================== +*/ +@media screen and (orientation: landscape) { + html, body.phone .dropmenu { + background-image:url("themes/plasma.jpg"); + background-size:cover; + background-repeat:no-repeat; + background-attachment:fixed; + } +} + +@media screen and (orientation: portrait) { + html, body.phone .dropmenu { + background-image:url("themes/plasma_portrait.jpg"); + background-size:cover; + background-repeat:no-repeat; + background-attachment:fixed; + } +} + +body.phone .dropmenu>div { + background-color:rgba(0,0,0,0.2); + background-clip:border-box; +} + +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input +{ + color:#cccccc; +} + +a:link +{ + color:yellow; +} + +a:visited +{ + color:yellow; +} + +a:hover,a:active +{ + text-shadow: 0 0 15px #000000; + cursor:pointer; +} + +button, input[type="button"], .filebutton +{ color:#dddddd; + background-color:rgba(0,0,0,0.5); + border:1px solid transparent; +} + + +button:hover, input[type="button"]:hover, .filebutton:hover +{ + color:#ffffff; + background-color:rgba(0,0,0,0.7); + border:1px solid #444444; +} + +select { + color:#dddddd; +} + +.selectholder { + background-color:rgba(0,0,0,0.5); +} + +.selectholder:hover { + background-color:rgba(0,0,0,0.2); +} + +input[type="text"] { + background-color: rgba(0,0,0,0.5); + border-bottom: 1px solid #555555; +} + +input[type="text"]:hover { + background-color: rgba(0,0,0,0.2); + border-bottom: 1px solid #555555; +} + +input[type="text"]:focus { + transition: border-bottom 0.5s ease; + border-bottom: 1px solid #bbbbbb; +} + +select:hover { + color: #ffffff; +} + +.drop-box { + background-color:rgba(100,0,80,0.6); + color:white; +} + +/* +===================================================================== += Specific Elements By ID +===================================================================== +*/ + +#sources, .mainpane, #headerbar, #infobar.coloured, #thetopbit +{ + background-color:rgba(0,0,0,0.2); +} + +body.mobile #headerbar { + background-color:rgba(0,0,0,0.6); +} + +#playlist +{ + background-color:rgba(0,0,0,0.2); +} + +#infopane +{ + background-color:rgba(0,0,0,0.4); +} + +#artistbio +{ + padding:4px; +} + +#notifications +{ + background-color:rgba(0,0,0,0.9); +} + +#wikipopup +{ + background-color:#000000; +} + +#tagadder +{ + background-color:rgba(0,0,0,0.9); +} + +#dragger +{ + background-color:rgba(0,0,0,0.5); +} + +#imagecontainer +{ + background-color:#ffffff; +} + +#pset { + background-color: rgba(186, 62, 145, 0.99); +} +#pmaxset { + background-color: rgba(202, 145, 190, 0.99); +} + +/* +===================================================================== += General Classes +===================================================================== +*/ + +.album2 +{ + background-color:rgba(0,0,0,0.2); +} + +.item +{ + margin-bottom: 2px; +} + +.playable:hover, .infoclick:hover, div.clickplaylist:hover, tr.playable:hover>td { + text-shadow: 0 0 15px #ffffff; + color:#ffffff; + cursor:pointer; +} + +.playable.selected:hover, tr.playable.selected:hover>td { + color:#ffffff; +} + +.selected +{ + background-color:rgba(255,72,0,0.6); +} + +.playlistcurrentitem +{ + font-weight:bold; + font-size:120%; + border-left:4px solid white; + color:#eeeeee; + transition:font-size 0.3s ease, text-shadow 0.3s ease; +} + +.clicktrack.playlistcurrentitem +{ + padding-left:8px; +} + +.playlistitem +{ + transition:font-size 0.3s ease, text-shadow 0.3s ease; +} + +.playlistcurrenttitle +{ + text-shadow: 0px 0px 20px #cccccc; + font-weight:bold; + color:#eeeeee; + background-color:rgba(0,0,0,0.2); +} + +.playlisttitle { + background-color:rgba(0,0,0,0.2); +} + +.stleft +{ + border-right:1px solid #888888; +} + +.popupwindow +{ + background-color:rgba(0,0,0,0.8); +} + +table.histable tr:hover { + font-size:105%; + text-shadow: 0 0 15px #ffffff; + color:#ff4800; + transition:all 0.1s; +} + +table.histable tr +{ + transition:all 0.2s; +} + +.backhi:hover { + text-shadow: 0 0 15px #ffffff; + color:#ff4800; + cursor:pointer; + transition:all 0.1s; +} + +.backhi +{ + transition:all 0.2s; +} + +tr.clickaddtrack:hover +{ + background-color:#e1e4ea; +} + +.bsel +{ + color:#ffffff; + text-shadow:0 0 15px #ffffff; +} + +.bmid +{ + border-left:2px solid #ff4800; +} + +.currentbun +{ + border-bottom:1px solid #fe6500; + padding-bottom:2px; +} + +.dropshadow +{ + box-shadow: 7px 7px 5px rgba(0, 0, 0, 0.6); +} + +.progressbar +{ + border:1px solid #414141; +} + +.progressbar_v +{ + border:1px solid #414141; +} + +.podcastitem +{ + border-top:1px solid #cccccc; +} + +/* +===================================================================== += Dropdown Menus +===================================================================== +*/ + +div.topdropmenu +{ + background-color:rgba(30,0,5,0.9); +} + +.configtitle +{ + background-color:rgba(100,0,80,0.8); +} + +body.mobile .configtitle +{ + width:100%; + margin-left:auto; + margin-right:auto; +} + +/* +===================================================================== += Info Panel - General +===================================================================== +*/ + +.infowiki +{ + color:white; +} + +.infosection +{ + background-color:rgba(0,0,0,0.4); + background-size:cover; + background-repeat:no-repeat; +} + +.tagholder table tr th { + background-color:rgba(0,0,0,0.5); + border-bottom:1px solid #000000; +} + +/* +===================================================================== += For Album Art Manager +===================================================================== +*/ + +.helpfulalbum +{ + background-color:rgba(0,0,0,0.4); +} + +.tagholder_wide +{ + background-color:rgba(0,0,0,0.6); +} + +.highlighted { + background-color:rgba(150,0,120,0.8); +} + +#artistchooser +{ + background-color:rgba(0,0,0,0.4); + color:#555555; +} + +/* +===================================================================== += Things that look like they might be for styling wikipedia data +===================================================================== +*/ + +table.navbox th +{ + background-color: rgba(0,0,0,0.2); +} + +.navbox-abovebelow +{ + padding-bottom:4px; +} + +.navbox-title a:link, +.navbox-abovebelow a:link, +.navbox-group a:link +{ + text-decoration:none; +} + +.navbox-title a:visited, +.navbox-abovebelow a:visited, +.navbox-group a:visited +{ + text-decoration:none; +} + +.navbox-title a:hover,a:active, +.navbox-abovebelow a:hover,a:active, +.navbox-group a:hover,a:active +{ + text-decoration:none; +} + +table.tracklist { + line-height:1.5em; +} + +.tracklist tbody tr th +{ + font-weight:bold; +} + +.description +{ + margin-top:4px; +} + +.underline +{ + border-bottom: 1px solid yellow; +} + +.infosection h2 +{ + border-bottom:2px solid white; +} diff --git a/www/rompr/themes/ShootingStars.css b/www/rompr/themes/ShootingStars.css new file mode 100644 index 0000000..ea10d6b --- /dev/null +++ b/www/rompr/themes/ShootingStars.css @@ -0,0 +1,391 @@ +html, body.phone .dropmenu { + background-image:url("themes/shootingstars.jpg"); + background-size:cover; + background-repeat:no-repeat; + background-attachment:fixed; +} + +body.phone .dropmenu>div { + background-clip:border-box; +} + +.helpfulalbum +{ + background-color:rgba(0,0,0,0.4); +} + +.tagholder_wide +{ + background-color:rgba(0,0,0,0.6); +} + +#artistbio +{ + padding:4px; +} + +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input +{ + color:#eeeeee; +} + +a:link +{ + color:yellow; +} + +a:visited +{ + color:yellow; +} + +a:hover,a:active +{ + text-shadow: 0 0 15px #000000; + cursor:pointer; +} + +.infowiki +{ + color:white; +} + +.item +{ + margin-bottom: 2px; +} + +/*-- divs used to create infobar layout --*/ + +button, input[type="button"], .filebutton +{ + color:#dddddd; + background-color:rgba(200,200,200,0.3); + border:none; +} + +button:hover, input[type="button"]:hover, .filebutton:hover +{ + color:#ffffff; + background-color:rgba(200,200,200,0.5); +} + +select { + color:white; +} + +.selectholder { + background-color:rgba(200,200,200,0.2); +} + +.selectholder:hover { + background-color:rgba(200,200,200,0.2); +} + +input[type="text"] { + background-color: rgba(200,200,200,0.2); + border-bottom: 1px solid #555555; +} + +input[type="text"]:hover { + background-color: rgba(200,200,200,0.2); + border-bottom: 1px solid #555555; +} + +input[type="text"]:focus { + transition: border-bottom 0.5s ease; + border-bottom: 1px solid #bbbbbb; +} + +.drop-box { + background-color:rgba(6,29,47,0.9); + color:white; +} + +#notifications +{ + background-color:rgba(0,0,0,0.9); +} + +a.album:visited +{ + color:#220000; +} + +a.album:hover,a.album:active +{ + text-shadow: 0 0 15px #ffffff; + color:#ffffff; + cursor:pointer; +} + +#pset { + background-color: rgba(2, 23, 40, 0.99); +} +#pmaxset { + background-color: rgba(200, 200, 200, 0.99); +} + +#filemenu +{ + border-left:1px solid white; +} + +.playable:hover, .infoclick:hover, div.clickplaylist:hover, tr.playable:hover>td { + text-shadow: 0 0 15px #ffffff; + color:#ffffff; + cursor:pointer; +} + +.playable.selected:hover, tr.playable.selected:hover>td { + color:#ffffff; +} + +.selected +{ + background-color:rgba(255,72,0,0.5); +} + + +/*-- divs and classes used in the playlist --*/ + +.playlistcurrentitem +{ + font-weight:bold; + border-left:4px solid white; + color:#eeeeee; + transition:font-size 0.3s ease, text-shadow 0.3s ease; +} + +.clicktrack.playlistcurrentitem +{ + padding-left:8px; +} + +.playlistitem +{ + transition:font-size 0.3s ease, text-shadow 0.3s ease; +} + +.playlistcurrenttitle +{ + text-shadow: 0px 0px 20px #cccccc; + font-weight:bold; + color:#eeeeee; + background-color:rgba(0,0,0,0.2); +} + +.playlisttitle{ + background-color:rgba(0,0,0,0.2); +} + +/*-- For Wikipedia and Last.FM pages --*/ + +.stleft +{ + border-right:1px solid #888888; +} + +#wikipopup +{ + background-color:#000000; +} + +#imagecontainer +{ + background-color:#ffffff; +} + +.infosection +{ + background-color:rgba(255,255,255,0.2); + background-size:cover; + background-repeat:no-repeat; +} + +.translucent +{ + opacity:0.7; +} + +/*-- For Album Cover Art --*/ + +.crackbaby +{ + background-color:rgba(255,255,255,0.2); + box-sizing:border-box; + background-size:cover; + background-repeat:no-repeat; +} + +.popupwindow +{ + background-color:rgba(0,0,0,0.8); +} + +/*-- Styles for drop-down menus --*/ + +div.topdropmenu +{ + background-color:rgba(0,0,0,0.9); +} + +.configtitle +{ + background-color:rgba(6,29,47,0.9); +} + +body.mobile .configtitle +{ + width:100%; + margin-left:auto; + margin-right:auto; +} + +/*-- Styles to make the Wikipedia nav boxes look prettier --*/ + +table.navbox th +{ + background-color: rgba(255,255,255,0.2); +} + +.navbox-abovebelow +{ + padding-bottom:4px; +} + +.navbox-title a:link, +.navbox-abovebelow a:link, +.navbox-group a:link +{ + text-decoration:none; +} + +.navbox-title a:visited, +.navbox-abovebelow a:visited, +.navbox-group a:visited +{ + text-decoration:none; +} + +.navbox-title a:hover,a:active, +.navbox-abovebelow a:hover,a:active, +.navbox-group a:hover,a:active +{ + text-decoration:none; +} + +table.tracklist { + line-height:1.5em; +} + +.tracklist tbody tr th +{ + font-weight:bold; +} + +.description +{ + margin-top:4px; +} + +.underline +{ + border-bottom: 1px solid yellow; +} + +.infosection h2 +{ + border-bottom:2px solid white; +} + +#tagadder +{ + background-color:rgba(0,0,0,0.9); +} + +table.histable tr:hover { + font-size:105%; + text-shadow: 0 0 15px #ffffff; + color:#ffffff; + transition:all 0.1s; +} + +table.histable tr +{ + transition:all 0.2s; +} + +.backhi:hover { + text-shadow: 0 0 15px #ffffff; + color:#ff4800; + cursor:pointer; + transition:all 0.1s; +} + +.backhi +{ + transition:all 0.2s; +} + +tr.clickaddtrack:hover +{ + background-color:#e1e4ea; +} + +.bsel +{ + color:#ffffff; + text-shadow:0 0 15px #ffffff; +} + +.bmid +{ + border-left:2px solid #ff4800; +} + +.highlighted { + background-color:rgba(0,50,100,0.8); +} + +.tagholder table tr th { + background-color:rgba(255,255,255,0.5); + border-bottom:1px solid #cccccc; +} + +#artistchooser +{ + background-color:rgba(255,255,255,0.1); + color:#aaaaaa; +} + +.currentbun +{ + border-bottom:1px solid #fe6500; + padding-bottom:2px; +} + +.dropshadow +{ + box-shadow: 7px 7px 5px rgba(0, 0, 0, 0.6); +} + +.progressbar +{ + border:1px solid #414141; +} + +.progressbar_v +{ + border:1px solid #414141; +} + +.podcastitem +{ + border-top:1px solid #cccccc; +} + +#dragger +{ + background-color:rgba(0,0,0,0.3); +} diff --git a/www/rompr/themes/Skytrails.css b/www/rompr/themes/Skytrails.css new file mode 100644 index 0000000..bdcbc7a --- /dev/null +++ b/www/rompr/themes/Skytrails.css @@ -0,0 +1,453 @@ +/* +===================================================================== += Standard HTML Elements +===================================================================== +*/ + +html, body.phone .dropmenu { + background-image:url("themes/skytrailscrop.jpg"); + background-size:cover; + background-repeat:no-repeat; + background-attachment:fixed; +} + +body.phone .dropmenu>div.playable, +body.phone .dropmenu>div.menuitem, +body.phone #pluginplaylistholder .menuitem.clickicon, +body.phone #pluginplaylistholder .menuitem.containerbox.fullwidth { + background-color:rgba(255,255,255,0.3); + background-clip:border-box; + margin-top: 4px; +} + +body.phone .dropmenu>div { + background-color:rgba(255,255,255,0.3); +} + +body.phone .mainpane .faveradio, +body.phone .mainpane .radio, +body.phone .mainpane .podcast:not(.podicon):not(.podglobal), +body.phone .mainpane .directory { + background-color:rgba(255,255,255,0.3); + background-clip:border-box; + margin-top: 4px; +} + +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input +{ + color:#000000; +} + +a:link +{ + color:#ff4800; +} + +a:visited +{ + color:#ff4800; +} + +a:hover,a:active +{ + text-shadow: 0 0 15px #000000; + cursor:pointer; +} + +button, input[type="button"], .filebutton +{ + color:#000000; + background-color:rgba(255,255,255,0.5); + border:1px solid #222222; +} + +button:hover, input[type="button"]:hover, .filebutton:hover +{ + border:1px solid #bbbbbb; + background-color:rgba(255,255,255,0.7); +} + +select { + color:#000000; +} + +.selectholder { + background-color:rgba(255,255,255,0.3); +} + +.selectholder:hover { + background-color:rgba(255,255,255,0.4); +} + +input[type="text"] { + background-color: rgba(255,255,255,0.3); + border-bottom: 1px solid #bbbbbb; +} + +input[type="text"]:hover { + background-color: rgba(255,255,255,0.4); + border-bottom: 1px solid #bbbbbb; +} + +input[type="text"]:focus { + transition: border-bottom 0.5s ease; + border-bottom: 1px solid #555555; +} + +.drop-box { + background-color: rgba(255,255,255,0.4); +} + +/* +===================================================================== += Specific Elements By ID +===================================================================== +*/ + +#sources +{ + background-color:rgba(255,255,255,0.3); +} + +#playlist +{ + background-color:rgba(255,255,255,0.3); +} + +#notifications +{ + background-color:rgba(65,65,85,0.9); + color:#ffffff; +} + +#wikipopup +{ + background-color:#000000; +} + +#imagecontainer +{ + background-color:#ffffff; +} + +#tagadder +{ + background-color:rgba(65,65,85,0.9); + color:white; +} + +#dragger +{ + background-color:rgba(0,0,0,0.3); +} + +#pset { + background-color: rgba(155, 187, 222, 0.99); +} +#pmaxset { + background-color: rgba(252, 189, 104, 0.99); +} + +/* +===================================================================== += General Classes +===================================================================== +*/ + +.mainpane +{ + background-color:rgba(255,255,255,0.3); +} + +.album2 +{ + background-color:rgba(255,255,255,0.2); +} + +.item +{ + margin-bottom: 2px; +} + +.playable:hover, .infoclick:hover, div.clickplaylist:hover, tr.playable:hover>td { + text-shadow: 0 0 15px #ffffff; + color:#ffffff; + cursor:pointer; +} + +.playable.selected:hover, tr.playable.selected:hover>td { + color:#ffffff; +} + +.selected +{ + background-color:rgba(255,72,0,0.7); +} + +/*-- divs and classes used in the playlist --*/ + +.playlistcurrentitem +{ + font-weight:bold; + font-size:120%; + color:#ff4800; + transition:font-size 0.2s ease, text-shadow 0.2s ease; +} + +.playlistitem +{ + transition:font-size 0.3s ease, text-shadow 0.3s ease; +} + +.playlistcurrenttitle +{ + text-shadow: 0px 0px 20px #cccccc; + font-weight:bold; + color:#ff4800; + background-color:rgba(255,255,255,0.2); +} + +.playlisttitle{ + background-color:rgba(255,255,255,0.2); +} + +.stleft +{ + border-right:1px solid #888888; +} + +.popupwindow +{ + background-color:rgba(65,65,85,0.9); + color:white; +} + +.popupwindow td, .popupwindow h2, .popupwindow p +{ + color:white; +} + +table.histable tr:hover { + font-size:105%; + text-shadow: 0 0 15px #ffffff; + color:#000000; + transition:all 0.1s; +} + +table.histable tr +{ + transition:all 0.2s; +} + +.backhi:hover { + text-shadow: 0 0 15px #ffffff; + color:#ff4800; + cursor:pointer; + transition:all 0.1s; +} + +.backhi +{ + transition:all 0.2s; +} + +tr.clickaddtrack:hover +{ + background-color:#e1e4ea; +} + +.bsel +{ + color:#000000; + text-shadow:0 0 15px #666666; +} + +.bmid +{ + border-left:2px solid #ff4800; +} + +.tagholder table tr th { + background-color:rgba(255,255,255,0.5); + border-bottom:1px solid #333333; +} + +.currentbun +{ + border-bottom:1px solid #fe6500; + padding-bottom:2px; +} + +.dropshadow +{ + box-shadow: 7px 7px 5px rgba(50, 50, 50, 0.5); +} + +.progressbar +{ + border:1px solid #414141; +} + +.progressbar_v +{ + border:1px solid #414141; +} + +/* +===================================================================== += Dropdown Menus +===================================================================== +*/ + +div.topdropmenu +{ + background-color:rgba(135,180,222,0.9); +} + +.configtitle +{ + background-color:rgba(255,255,255,0.5); +} + +body.mobile .configtitle +{ + width:100%; + margin-left:auto; + margin-right:auto; +} + +/* +===================================================================== += Info Panel - General +===================================================================== +*/ + +#infopane +{ + background-color:rgba(255,255,255,0.4); +} + +#artistbio +{ + padding:4px; +} + +.infowiki +{ + color:black; +} + +.infosection +{ + background-color:rgba(255,255,255,0.4); + background-size:cover; + background-repeat:no-repeat; +} + +/* +===================================================================== += Info Panel - Spotify +===================================================================== +*/ +.helpfulalbum +{ + background-color:rgba(255,255,255,0.4); +} + +.tagholder_wide +{ + background-color:rgba(255,255,255,0.5); +} + +/* +===================================================================== += Podcasts +===================================================================== +*/ + +.podcastitem +{ + border-top:1px solid #000000; +} + +/* +===================================================================== += For Album Art Manager +===================================================================== +*/ + +#artistcoverslist +{ + background-color:rgba(255,255,255,0.3); +} + +.highlighted { + background-color:rgba(200,217,240,0.9); +} + +#artistchooser +{ + background-color:rgba(255,255,255,0.2); + color:#777777; +} + +/* +===================================================================== += Things that look like they might be for styling wikipedia data +===================================================================== +*/ + +table.navbox th +{ + background-color: rgba(255,255,255,0.2); +} + +.navbox-abovebelow +{ + padding-bottom:4px; +} + +.navbox-title a:link, +.navbox-abovebelow a:link, +.navbox-group a:link +{ + text-decoration:none; +} + +.navbox-title a:visited, +.navbox-abovebelow a:visited, +.navbox-group a:visited +{ + text-decoration:none; +} + +.navbox-title a:hover,a:active, +.navbox-abovebelow a:hover,a:active, +.navbox-group a:hover,a:active +{ + text-decoration:none; +} + +table.tracklist { + line-height:1.5em; +} + +.tracklist tbody tr th +{ + font-weight:bold; +} + +.description +{ + margin-top:4px; +} + +.underline +{ + border-bottom: 1px solid black; +} + +.infosection h2 +{ + border-bottom:2px solid black; +} diff --git a/www/rompr/themes/Sunburst.css b/www/rompr/themes/Sunburst.css new file mode 100644 index 0000000..fc5bfbf --- /dev/null +++ b/www/rompr/themes/Sunburst.css @@ -0,0 +1,377 @@ +html, body.phone .dropmenu { + background-image: radial-gradient(circle farthest-side at top left, yellow, orange, red); +} + +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input +{ + color:#000000; +} + +a:link +{ + color:#0b0080; +} + +a:visited +{ + color:#0b0080; +} + +a:hover,a:active +{ + text-shadow: 0 0 15px #000000; + cursor:pointer; +} + +#custombackground +{ + display:none; +} + +/*-- divs used to create infobar layout --*/ + +.bordered +{ + border-left:1px solid orange; + border-bottom:1px solid yellow; + border-right:1px solid yellow; + border-top:1px solid orange; +} + +.album1 +{ + background-color:rgba(0,0,0,0.1); +} + +.album2 +{ + background-color:rgba(0,0,0,0.2); +} + +button, input[type="button"], .filebutton +{ + background-image: radial-gradient(circle farthest-side at center, yellow, orange, red); + color:#000000; + border:1px solid #000000; +} + +button:hover, input[type="button"]:hover, .filebutton:hover +{ + color:#ffffff; + text-shadow: 0 0 15px #ffffff; +} + +input +{ + color:#181818; +} + +input.inbrowser, div.inbrowser +{ + border: 1px solid #000000; +} + +select +{ + color:#000000; +} + +#pset { + background-color: rgba(255, 22, 0, 0.99); +} + +#notifications +{ + background-image: radial-gradient(circle farthest-side at top left, yellow, orange, red); +} + +a.album:visited +{ + color:#220000; +} + +a.album:hover,a.album:active +{ + text-shadow: 0 0 15px #ffffff; + color:#ffffff; + cursor:pointer; +} + +#filemenu +{ + border-left:1px solid orange; +} + +.playable:hover, .infoclick:hover, div.clickplaylist:hover, tr.playable:hover>td { + text-shadow: 0 0 15px #ffffff; + color:#ffffff; + cursor:pointer; +} + +.playable.selected:hover, tr.playable.selected:hover>td { + color:#ffffff; +} + +.selected +{ + background-color:#ff4800; +} + + +/*-- divs and classes used in the playlist --*/ + +.playlistcurrentitem +{ + font-weight:bold; + font-size:120%; + border-left:4px solid yellow; + color:#eeeeee; + transition:font-size 0.3s ease, text-shadow 0.3s ease; +} + +.clicktrack.playlistcurrentitem +{ + padding-left:8px; +} + +.playlistitem +{ + transition:font-size 0.3s ease, text-shadow 0.3s ease; +} + +.playlistcurrenttitle +{ + text-shadow: 0px 0px 20px #cccccc; + font-weight:bold; + color:#eeeeee; +} + +.inbrowser +{ + color:#000000; +} + +/*-- For Wikipedia and Last.FM pages --*/ + +.stleft +{ + border-right:1px solid #888888; +} + +#wikipopup +{ + background-color:#000000; +} + +#imagecontainer +{ + background-color:#ffffff; +} + +.infosection +{ + background-image: radial-gradient(circle farthest-side at top left, yellow, orange, red); +} + +.translucent +{ + opacity:0.7; +} + +/*-- For Album Cover Art --*/ + +.crackbaby +{ + background-image: radial-gradient(circle farthest-side at top left, yellow, orange, red); + box-sizing:border-box; +} + +.popupwindow +{ + background-image: radial-gradient(circle farthest-side at top left, yellow, orange, red); + border-left:1px solid yellow; + border-bottom:1px solid red; + border-right:1px solid red; + border-top:1px solid yellow; +} + +/*-- Styles for drop-down menus --*/ + +div.topdropmenu +{ + background-image: radial-gradient(circle farthest-side at top left, yellow, orange, red); + border-left:1px solid yellow; + border-bottom:1px solid red; + border-right:1px solid red; +} + +.configtitle +{ + background-image: radial-gradient(circle farthest-side at top left, yellow, orange, red); +} + +body.mobile .configtitle +{ + width:95%; + margin-left:auto; + margin-right:auto; +} + +/*-- Styles to make the Wikipedia nav boxes look prettier --*/ + +table.navbox th +{ + background-color: rgba(0,0,0,0.1); +} + +.navbox-abovebelow +{ + padding-bottom:4px; +} + +.navbox-title a:link, +.navbox-abovebelow a:link, +.navbox-group a:link +{ + text-decoration:none; +} + +.navbox-title a:visited, +.navbox-abovebelow a:visited, +.navbox-group a:visited +{ + text-decoration:none; +} + +.navbox-title a:hover,a:active, +.navbox-abovebelow a:hover,a:active, +.navbox-group a:hover,a:active +{ + text-decoration:none; +} + +table.tracklist { + line-height:1.5em; +} + +.tracklist tbody tr th +{ + font-weight:bold; +} + +.description +{ + margin-top:4px; +} + +.underline +{ + border-bottom: 1px solid orange; +} + +.infosection h2 +{ + border-bottom:2px solid orange; +} + +#tagadder +{ + background-image: radial-gradient(circle farthest-side at top left, yellow, orange, red); + background-color:yellow; +} + +table.histable tr:hover { + font-size:105%; + text-shadow: 0 0 15px #ffffff; + color:#ffffff; + transition:all 0.1s; +} + +table.histable tr +{ + transition:all 0.2s; +} + +.backhi:hover { + text-shadow: 0 0 15px #ffffff; + color:#ff4800; + cursor:pointer; + transition:all 0.1s; +} + +.backhi +{ + transition:all 0.2s; +} + +tr.clickaddtrack:hover +{ + background-color:#e1e4ea; +} + +.helpfulalbum +{ + background-color:rgba(255,255,255,0.2); +} + +.tagholder_wide +{ + background-color:rgba(255,255,255,0.2); +} + +.bsel +{ + color:#ffffff; + text-shadow:0 0 15px #ffffff; +} + +.bmid +{ + border-left:2px solid #ff4800; +} + +.highlighted { + background-color:rgba(255,226,0,1); +} + +#artistcoverslist +{ + background-color:rgba(0,0,0,0.2); +} + +.tagholder table tr th { + background-color:rgba(255,255,255,0.5); + border-bottom:1px solid #cccccc; +} + +#artistchooser +{ + background-color:rgba(0,0,0,0.3); + color:#aaaaaa; +} + +.currentbun +{ + border-bottom:1px solid #000000; + padding-bottom:2px; +} + +.dropshadow +{ + box-shadow: 7px 7px 5px rgba(50, 50, 50, 0.6); +} + +.progressbar +{ + border:1px solid #414141; +} + +.podcastitem +{ + border-top:1px solid #000000; +} + +#dragger +{ + background-color:rgba(0,0,0,0.3); +} diff --git a/www/rompr/themes/Sunset.css b/www/rompr/themes/Sunset.css new file mode 100644 index 0000000..94bea36 --- /dev/null +++ b/www/rompr/themes/Sunset.css @@ -0,0 +1,438 @@ +html, body.phone .dropmenu +{ + background-image:url("themes/sunsetbirds.jpg"); + background-size:cover; + background-repeat:no-repeat; + background-attachment:fixed; +} + +body.phone .dropmenu>div.playable, +body.phone .dropmenu>div.menuitem, +body.phone #pluginplaylistholder .menuitem.clickicon, +body.phone #pluginplaylistholder .menuitem.containerbox.fullwidth { + background-color:rgba(0,0,0,0.2); + background-clip:border-box; + margin-top: 4px; +} + +body.phone .dropmenu>div { + background-color:rgba(0,0,0,0.2); +} + +body.phone .mainpane .faveradio, +body.phone .mainpane .radio, +body.phone .mainpane .podcast:not(.podicon):not(.podglobal), +body.phone .mainpane .directory { + background-color:rgba(0,0,0,0.1); + background-clip:border-box; + margin-top: 4px; +} + +#sources, .mainpane +{ + background-color:rgba(0,0,0,0.2); +} + +.album2 +{ + background-color:rgba(0,0,0,0.2); +} + +#playlist, #infopane +{ + background-color:rgba(0,0,0,0.2); +} + +.helpfulalbum +{ + background-color:rgba(0,0,0,0.4); +} + +.tagholder_wide +{ + background-color:rgba(0,0,0,0.6); +} + +#artistbio +{ + padding:4px; +} + +#pset { + background-color: rgba(1, 1, 1, 0); +} + +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input,select +{ + color:#eeeeee; +} + +body.mobile .headerbar { + background-color: rgba(0,0,0,0.4); +} + +.albumsection { + background-color: rgba(0,0,0,0.4); +} + +a:link +{ + color:yellow; +} + +a:visited +{ + color:yellow; +} + +a:hover,a:active +{ + text-shadow: 0 0 15px #000000; + cursor:pointer; +} + +.infowiki +{ + color:white; +} + +.item +{ + margin-bottom: 2px; +} + +/*-- divs used to create infobar layout --*/ + +button, input[type="button"], .filebutton +{ + color:#dddddd; + background-color:transparent; + border:1px solid #aaaaaa; +} + +button:hover, input[type="button"]:hover, .filebutton:hover +{ + color:#ffffff; + border:1px solid #ffffff; + text-shadow: 0 0 15px #ffffff; +} + +.selectholder { + background-color:rgba(200,200,200,0.2); +} + +.selectholder:hover { + background-color:rgba(200,200,200,0.2); +} + +input[type="text"] { + background-color: rgba(200,200,200,0.2); + border-bottom: 1px solid #555555; +} + +input[type="text"]:hover { + border-bottom: 1px solid #555555; +} + +input[type="text"]:focus { + transition: border-bottom 0.5s ease; + border-bottom: 1px solid #bbbbbb; +} + +select:hover { + color: #ffffff; +} + +.drop-box { + background-color: rgba(200,200,200,0.3); + color:white; +} + +#notifications +{ + background-color:rgba(0,0,0,0.9); +} + +a.album:visited +{ + color:#220000; +} + +a.album:hover,a.album:active +{ + text-shadow: 0 0 15px #ffffff; + color:#ffffff; + cursor:pointer; +} + +#filemenu +{ + border-left:1px solid white; +} + +#pset { + background-color: rgba(139, 32, 23, 0.99); +} +#pmaxset { + background-color: rgba(173, 100, 44, 0.99); +} + +.playable:hover, .infoclick:hover, div.clickplaylist:hover, tr.playable:hover>td { + text-shadow: 0 0 15px #ffffff; + color:#ffffff; + cursor:pointer; +} + +.playable.selected:hover, tr.playable.selected:hover>td { + color:#ffffff; +} + +.selected +{ + background-color:rgba(255,72,0,0.5); +} + +/*-- divs and classes used in the playlist --*/ + +.playlistcurrentitem +{ + font-weight:bold; + font-size:120%; + border-left:4px solid white; + color:#eeeeee; + transition:font-size 0.3s ease, text-shadow 0.3s ease; +} + +.clicktrack.playlistcurrentitem +{ + padding-left:8px; +} + +.playlistitem +{ + transition:font-size 0.3s ease, text-shadow 0.3s ease; +} + +.playlistcurrenttitle +{ + text-shadow: 0px 0px 20px #cccccc; + font-weight:bold; + color:#eeeeee; + background-color:rgba(0,0,0,0.2); +} + +/*-- For Wikipedia and Last.FM pages --*/ + +.stleft +{ + border-right:1px solid #888888; +} + +#wikipopup +{ + background-color:#000000; +} + +#imagecontainer +{ + background-color:#ffffff; +} + +.infosection +{ + background-color:rgba(0,0,0,0.3); + background-size:cover; + background-repeat:no-repeat; +} + +.translucent +{ + opacity:0.7; +} + +/*-- For Album Cover Art --*/ + +.crackbaby +{ + background-color:rgba(0,0,0,0.3); + box-sizing:border-box; + background-size:cover; + background-repeat:no-repeat; +} + +.popupwindow +{ + background-color:rgba(0,0,0,0.8); +} + +/*-- Styles for drop-down menus --*/ + +div.topdropmenu +{ + background-color:rgba(0,0,0,0.9); +} + +.configtitle +{ + background-color:rgba(150,40,23,0.7); + margin-top:4px; +} + +body.mobile .configtitle +{ + width:100%; + margin-left:auto; + margin-right:auto; +} + +/*-- Styles to make the Wikipedia nav boxes look prettier --*/ + +table.navbox th +{ + background-color: rgba(0,0,0,0.2); +} + +.navbox-abovebelow +{ + padding-bottom:4px; +} + +.navbox-title a:link, +.navbox-abovebelow a:link, +.navbox-group a:link +{ + text-decoration:none; +} + +.navbox-title a:visited, +.navbox-abovebelow a:visited, +.navbox-group a:visited +{ + text-decoration:none; +} + +.navbox-title a:hover,a:active, +.navbox-abovebelow a:hover,a:active, +.navbox-group a:hover,a:active +{ + text-decoration:none; +} + +table.tracklist { + line-height:1.5em; +} + +.tracklist tbody tr th +{ + font-weight:bold; +} + +.description +{ + margin-top:4px; +} + +.underline +{ + border-bottom: 1px solid yellow; +} + +.infosection h2 +{ + border-bottom:2px solid white; +} + +#tagadder +{ + background-color:rgba(0,0,0,0.8); +} + +table.histable tr:hover { + font-size:105%; + text-shadow: 0 0 15px #ffffff; + color:#ffffff; + transition:all 0.1s; +} + +table.histable tr +{ + transition:all 0.2s; +} + +.backhi:hover { + text-shadow: 0 0 15px #ffffff; + color:#ff4800; + cursor:pointer; + transition:all 0.1s; +} + +.backhi +{ + transition:all 0.2s; +} + +tr.clickaddtrack:hover +{ + background-color:#e1e4ea; +} + +.bsel +{ + color:#ffffff; + text-shadow:0 0 15px #ffffff; +} + +.bmid +{ + border-left:2px solid #ff4800; +} + +.highlighted { + background-color:rgba(0,0,0,0.7) !important; +} + +.tagholder table tr th { + background-color:rgba(0,0,0,0.2); + border-bottom:1px solid #000000; +} + +#artistchooser +{ + background-color:rgba(0,0,0,0.3); + color:#aaaaaa; +} + +.currentbun +{ + border-bottom:1px solid #ffffff; + padding-bottom:2px; +} + +.dropshadow +{ + box-shadow: 7px 7px 5px rgba(0, 0, 0, 0.5); +} + +.progressbar +{ + border:1px solid #414141; +} + +.progressbar_v +{ + border:1px solid #414141; +} + +.podcastitem +{ + border-top:1px solid #cccccc; +} + +#dragger +{ + background-color:rgba(0,0,0,0.3); +} + +.ratsoptions { + border-top: 1px solid #999999; +} diff --git a/www/rompr/themes/SunsetLoch.css b/www/rompr/themes/SunsetLoch.css new file mode 100644 index 0000000..dcb2e48 --- /dev/null +++ b/www/rompr/themes/SunsetLoch.css @@ -0,0 +1,405 @@ +html, body.phone .dropmenu { + background-image:url("themes/sunset_loch.jpg"); + background-size:cover; + background-repeat:no-repeat; + background-attachment:fixed; +} + +body.phone .dropmenu>div { + background-color:rgba(0,0,0,0.4); + background-clip:border-box; +} + +#sources, #artistcoverslist +{ + background-color:rgba(0,0,0,0.4); +} + +.mainpane +{ + background-color:rgba(0,0,0,0.3); +} + +.album2 +{ + background-color:rgba(0,0,0,0.2); +} + +#playlist +{ + background-color:rgba(0,0,0,0.4); +} + +#infopane +{ + background-color:rgba(0,0,0,0.5); +} + +.helpfulalbum +{ + background-color:rgba(0,0,0,0.4); +} + +.tagholder_wide +{ + background-color:rgba(0,0,0,0.6); +} + +#artistbio +{ + padding:4px; +} + +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input +{ + color:#eeeeee; +} + +a:link +{ + color:yellow; +} + +a:visited +{ + color:yellow; +} + +a:hover,a:active +{ + text-shadow: 0 0 15px #000000; + cursor:pointer; +} + +.infowiki +{ + color:white; +} + +.item +{ + margin-bottom: 2px; +} + +/*-- divs used to create infobar layout --*/ + +button, input[type="button"], .filebutton +{ + color:#dddddd; + background-color:transparent; + border:1px solid #aaaaaa; +} + +button:hover, input[type="button"]:hover, .filebutton:hover +{ + color:#ffffff; + border:1px solid #ffffff; + text-shadow: 0 0 15px #ffffff; +} + +input +{ + color:#181818; +} + +input.snapclientname[type=text] { + color: #ffffff; +} + +select +{ + color:#000000; +} + +#notifications +{ + background-color:rgba(0,0,0,0.9); +} + +#pset { + background-color: rgba(23, 38, 77, 0.99); +} +#pmaxset { + background-color: rgba(155, 172, 227, 0.99); +} + +a.album:visited +{ + color:#220000; +} + +a.album:hover,a.album:active +{ + text-shadow: 0 0 15px #ffffff; + color:#ffffff; + cursor:pointer; +} + +#filemenu +{ + border-left:1px solid white; +} + +.playable:hover, .infoclick:hover, div.clickplaylist:hover, tr.playable:hover>td { + text-shadow: 0 0 15px #ffffff; + color:#ffffff; + cursor:pointer; +} + +.playable.selected:hover, tr.playable.selected:hover>td { + color:#ffffff; +} + +.selected +{ + background-color:rgba(255,72,0,0.5); +} + +/*-- divs and classes used in the playlist --*/ + +.playlistcurrentitem +{ + font-weight:bold; + font-size:120%; + border-left:4px solid white; + color:#eeeeee; + transition:font-size 0.3s ease, text-shadow 0.3s ease; +} + +.clicktrack.playlistcurrentitem +{ + padding-left:8px; +} + +.playlistitem +{ + transition:font-size 0.3s ease, text-shadow 0.3s ease; +} + +.playlistcurrenttitle +{ + text-shadow: 0px 0px 20px #cccccc; + font-weight:bold; + color:#eeeeee; + background-color:rgba(0,0,0,0.1); +} + +.playlisttitle{ + background-color:rgba(0,0,0,0.1); +} + +.inbrowser +{ + color:#000000; +} + +/*-- For Wikipedia and Last.FM pages --*/ + +.stleft +{ + border-right:1px solid #888888; +} + +#wikipopup +{ + background-color:#000000; +} + +#imagecontainer +{ + background-color:#ffffff; +} + +.infosection +{ + background-color:rgba(0,0,0,0.5); + background-size:cover; + background-repeat:no-repeat; +} + +.translucent +{ + opacity:0.7; +} + +/*-- For Album Cover Art --*/ + +.crackbaby +{ + background-color:rgba(0,0,0,0.5); + box-sizing:border-box; + background-size:cover; + background-repeat:no-repeat; +} + +.popupwindow +{ + background-color:rgba(0,0,0,0.8); +} + +/*-- Styles for drop-down menus --*/ + +div.topdropmenu +{ + background-color:rgba(0,0,0,0.9); +} + +.configtitle +{ + background-color:rgba(60,0,200,0.3); +} + +body.mobile .configtitle +{ + width:100%; + margin-left:auto; + margin-right:auto; +} + +/*-- Styles to make the Wikipedia nav boxes look prettier --*/ + +table.navbox th +{ + background-color: rgba(0,0,0,0.2); +} + +.navbox-abovebelow +{ + padding-bottom:4px; +} + +.navbox-title a:link, +.navbox-abovebelow a:link, +.navbox-group a:link +{ + text-decoration:none; +} + +.navbox-title a:visited, +.navbox-abovebelow a:visited, +.navbox-group a:visited +{ + text-decoration:none; +} + +.navbox-title a:hover,a:active, +.navbox-abovebelow a:hover,a:active, +.navbox-group a:hover,a:active +{ + text-decoration:none; +} + +table.tracklist { + line-height:1.5em; +} + +.tracklist tbody tr th +{ + font-weight:bold; +} + +.description +{ + margin-top:4px; +} + +.underline +{ + border-bottom: 1px solid yellow; +} + +.infosection h2 +{ + border-bottom:2px solid white; +} + +#tagadder +{ + background-color:rgba(0,0,0,0.8); +} + +table.histable tr:hover { + font-size:105%; + text-shadow: 0 0 15px #ffffff; + color:#ffffff; + transition:all 0.1s; +} + +table.histable tr +{ + transition:all 0.2s; +} + +.backhi:hover { + text-shadow: 0 0 15px #ffffff; + color:#ff4800; + cursor:pointer; + transition:all 0.1s; +} + +.backhi +{ + transition:all 0.2s; +} + +tr.clickaddtrack:hover +{ + background-color:#e1e4ea; +} + +.bsel +{ + color:#ffffff; + text-shadow:0 0 15px #ffffff; +} + +.bmid +{ + border-left:2px solid #ff4800; +} + +.highlighted { + background-color:rgba(84,91,189,0.8) !important; +} + +.tagholder table tr th { + background-color:rgba(0,0,0,0.5); + border-bottom:1px solid #000000; +} + +#artistchooser +{ + background-color:rgba(0,0,0,0.3); + color:#aaaaaa; +} + +.currentbun +{ + border-bottom:1px solid #000000; + padding-bottom:2px; +} + +.dropshadow +{ + box-shadow: 7px 7px 5px rgba(0, 0, 0, 0.4); +} + +.progressbar +{ + border:1px solid #666666; +} + +.progressbar_v +{ + border:1px solid #666666; +} + +.podcastitem +{ + border-top:1px solid #cccccc; +} + +#dragger +{ + background-color:rgba(0,0,0,0.3); +} diff --git a/www/rompr/themes/Table.css b/www/rompr/themes/Table.css new file mode 100644 index 0000000..f66cabd --- /dev/null +++ b/www/rompr/themes/Table.css @@ -0,0 +1,424 @@ +@media screen and (orientation: landscape) { + html, body.phone .dropmenu { + background-image:url("themes/table.jpg"); + background-size:cover; + background-repeat:no-repeat; + background-attachment:fixed; + } +} + +@media screen and (orientation: portrait) { + html, body.phone .dropmenu { + background-image:url("themes/table_portrait.jpg"); + background-size:cover; + background-repeat:no-repeat; + background-attachment:fixed; + } +} + +#sources, #artistcoverslist, #infobar.coloured, #headerbar, #thetopbit +{ + background-color:rgba(0,0,0,0.3); +} + +.mainpane +{ + background-color:rgba(0,0,0,0.2); +} + +.album2 +{ + background-color:rgba(0,0,0,0.2); +} + +#playlist +{ + background-color:rgba(0,0,0,0.3); +} + +#infopane +{ + background-color:rgba(0,0,0,0.3); +} + +.helpfulalbum +{ + background-color:rgba(0,0,0,0.4); +} + +.tagholder_wide +{ + background-color:rgba(0,0,0,0.6); +} + +#artistbio +{ + padding:4px; +} + +#pset { + background-color: rgba(54, 61, 64, 0.99); +} +#pmaxset { + background-color: rgba(121, 105, 89, 0.99); +} + +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input +{ + color:#eeeeee; +} + +a:link +{ + color:yellow; +} + +a:visited +{ + color:yellow; +} + +a:hover,a:active +{ + text-shadow: 0 0 15px #000000; + cursor:pointer; +} + +.infowiki +{ + color:white; +} + +/*-- divs used to create infobar layout --*/ + +button, input[type="button"], .filebutton +{ + color:#dddddd; + background-color:transparent; + border:1px solid #aaaaaa; +} + +button:hover, input[type="button"]:hover, .filebutton:hover +{ + color:#ffffff; + border:1px solid #ffffff; + text-shadow: 0 0 15px #ffffff; +} + +select { + color:#dddddd; +} + +.selectholder { + background-color:rgba(0,0,0,0.5); +} + +.selectholder:hover { + background-color:rgba(0,0,0,0.6); +} + +input[type="text"] { + background-color: rgba(0,0,0,0.5); + border-bottom: 1px solid #555555; +} + +input[type="text"]:hover { + background-color: rgba(0,0,0,0.6); + border-bottom: 1px solid #555555; +} + +input[type="text"]:focus { + background-color: rgba(0,0,0,0.6); + transition: border-bottom 0.5s ease; + border-bottom: 1px solid #bbbbbb; +} + +select:hover { + color: #ffffff; +} + +.drop-box { + background-color: rgba(0,0,0,0.6); + color:white; +} + +#notifications +{ + background-color:rgba(0,0,0,0.9); +} + +a.album:visited +{ + color:#220000; +} + +a.album:hover,a.album:active +{ + text-shadow: 0 0 15px #ffffff; + color:#ffffff; + cursor:pointer; +} + +#filemenu +{ + border-left:1px solid white; +} + +.playable:hover, .infoclick:hover, div.clickplaylist:hover, tr.playable:hover>td { + text-shadow: 0 0 15px #ffffff; + color:#ffffff; + cursor:pointer; +} + +.playable.selected:hover, tr.playable.selected:hover>td { + color:#ffffff; +} + +.selected +{ + background-color:rgba(255,72,0,0.5); +} + +/*-- divs and classes used in the playlist --*/ + +.playlistcurrentitem +{ + font-weight:bold; + font-size:120%; + border-left:4px solid white; + color:#eeeeee; + transition:font-size 0.3s ease, text-shadow 0.3s ease; +} + +.clicktrack.playlistcurrentitem +{ + padding-left:8px; +} + +.playlistitem +{ + transition:font-size 0.3s ease, text-shadow 0.3s ease; +} + +.playlistcurrenttitle +{ + text-shadow: 0px 0px 20px #cccccc; + font-weight:bold; + color:#eeeeee; + background-color:rgba(0,0,0,0.1); +} + +.playlisttitle{ + background-color:rgba(0,0,0,0.1); +} + +/*-- For Wikipedia and Last.FM pages --*/ + +.stleft +{ + border-right:1px solid #888888; +} + +#wikipopup +{ + background-color:#000000; +} + +#imagecontainer +{ + background-color:#ffffff; +} + +.infosection +{ + background-color:rgba(0,0,0,0.5); + background-size:cover; + background-repeat:no-repeat; +} + +.translucent +{ + opacity:0.7; +} + +/*-- For Album Cover Art --*/ + +.crackbaby +{ + background-color:rgba(0,0,0,0.5); + box-sizing:border-box; + background-size:cover; + background-repeat:no-repeat; +} + +.popupwindow +{ + background-color:rgba(0,0,0,0.8); +} + +/*-- Styles for drop-down menus --*/ + +div.topdropmenu +{ + background-color:rgba(135,123,110,0.9); +} + +.configtitle +{ + background-color:rgba(145,44,64,0.9); +} + +body.mobile .configtitle +{ + width:95%; + margin-left:auto; + margin-right:auto; +} + +/*-- Styles to make the Wikipedia nav boxes look prettier --*/ + +table.navbox th +{ + background-color: rgba(0,0,0,0.2); +} + +.navbox-abovebelow +{ + padding-bottom:4px; +} + +.navbox-title a:link, +.navbox-abovebelow a:link, +.navbox-group a:link +{ + text-decoration:none; +} + +.navbox-title a:visited, +.navbox-abovebelow a:visited, +.navbox-group a:visited +{ + text-decoration:none; +} + +.navbox-title a:hover,a:active, +.navbox-abovebelow a:hover,a:active, +.navbox-group a:hover,a:active +{ + text-decoration:none; +} + +table.tracklist { + line-height:1.5em; +} + +.tracklist tbody tr th +{ + font-weight:bold; +} + +.description +{ + margin-top:4px; +} + +.underline +{ + border-bottom: 1px solid yellow; +} + +.infosection h2 +{ + border-bottom:2px solid white; +} + +#tagadder +{ + background-color:rgba(0,0,0,0.8); +} + +table.histable tr:hover { + font-size:105%; + text-shadow: 0 0 15px #ffffff; + color:#ffffff; + transition:all 0.1s; +} + +table.histable tr +{ + transition:all 0.2s; +} + +.backhi:hover { + text-shadow: 0 0 15px #ffffff; + color:#ff4800; + cursor:pointer; + transition:all 0.1s; +} + +.backhi +{ + transition:all 0.2s; +} + +tr.clickaddtrack:hover +{ + background-color:#e1e4ea; +} + +.bsel +{ + color:#ffffff; + text-shadow:0 0 15px #ffffff; +} + +.bmid +{ + border-left:2px solid #ff4800; +} + +.highlighted { + background-color:rgba(0,0,0,0.7) !important; +} + +.tagholder table tr th { + background-color:rgba(0,0,0,0.5); + border-bottom:1px solid #000000; +} + +#artistchooser +{ + background-color:rgba(0,0,0,0.3); + color:#aaaaaa; +} + +.currentbun +{ + border-bottom:1px solid #000000; + padding-bottom:2px; +} + +.dropshadow +{ + box-shadow: 7px 7px 5px rgba(0, 0, 0, 0.4); +} + +.progressbar +{ + border:1px solid #666666; +} + +.progressbar_v +{ + border:1px solid #666666; +} + +.podcastitem +{ + border-top:1px solid #cccccc; +} + +#dragger +{ + background-color:rgba(0,0,0,0.3); +} diff --git a/www/rompr/themes/TheBlues.css b/www/rompr/themes/TheBlues.css new file mode 100644 index 0000000..c23c98d --- /dev/null +++ b/www/rompr/themes/TheBlues.css @@ -0,0 +1,333 @@ +html, body.phone .dropmenu { + color:#000000; + background-color:#171760; +} + +body,p,h1,h2,h3,h4,table,td,th,ul,ol,textarea,input +{ + color:#dddddd; +} + +h1,h2,h3,h4,h5,h6 +{ + color:#eeeeee; +} + +a:link +{ + color:#dcdcff; +} + +a:visited +{ + color:#dcdcff; +} + +a:hover,a:active +{ + color:#ff4800; +} + +input +{ + color:#222222; +} + +button, .filebutton +{ + color:#000000; + border: 1px solid #000000; +} + +button:hover, .filebutton:hover +{ + color:#ff4800; + border:1px solid #ff4800; + text-shadow: 0 0 15px #ff4800; +} + +select +{ + color:#222222; +} + +input.inbrowser, div.inbrowser +{ + border: 1px solid #888888; +} + +input.snapclientname[type=text] { + color: #ffffff; +} + +#notifications +{ + background-color:#181850; +} + +#custombackground +{ + display:none; +} + +/*-- divs used to create infobar layout --*/ + +.bordered +{ + border-left:1px solid #121240; + border-bottom:1px solid #1a1a90; + border-right:1px solid #1a1a90; + border-top:1px solid #121240; +} + +/*-- divs and classes used in the albums list --*/ + +.album1 +{ + background-color:#181850; +} + +.album2 +{ + background-color:#171760; +} + +a.album:visited +{ + color:#dcdcff; +} + +a.album:hover,a.album:active +{ + color:#ff4800; +} + +#filemenu +{ + border-left:1px solid #444444; +} + +.playable:hover, .infoclick:hover, div.clickplaylist:hover, tr.playable:hover>td { + color:#ff4800; +} + +.playable.selected:hover, tr.playable.selected:hover>td { + color:#dddddd; +} + +.selected +{ + background-color:#ff4800; +} + +/*-- divs and classes used in the playlist --*/ + +.playlistcurrentitem +{ + color:#cc0000; +} + +.playlistcurrenttitle +{ + color:#cc0000; +} + +.item +{ + border-top:1px solid #0022dd; +} + +/*-- For Wikipedia and Last.FM pages --*/ + +.stleft +{ + border-right:1px solid #aaaaaa; +} + +#wikipopup +{ + background-color:#000000; +} + +#imagecontainer +{ + background-color:#ffffff; +} + +.infosection +{ + background-color:#131330; +} + +.albumsection +{ + background-color:#131330; +} + +#imageeditor +{ + background-color:#131330; +} + +.translucent +{ + opacity:0.7; +} + +.infowiki +{ + background-color:#171760; +} + +/*-- For Album Cover Art --*/ + +.crackbaby +{ + background-color:#181850; +} + +#albumcovers +{ + background-color:#171760; +} + +.popupwindow +{ + background-color:#121230; + border-left:2px solid #888888; + border-bottom:2px solid #888888; + border-right:2px solid #888888; + border-top:2px solid #888888; +} + +/*-- Styles for drop-down menus --*/ + +div.topdropmenu +{ + background-color:#181850; + border-left:1px solid #1a1a90; + border-bottom:1px solid #1a1a90; + border-right:1px solid #1a1a90; + border-top:none; +} + +.configtitle +{ + background-color:#171760; +} + +/*-- Styles to make the Wikipedia nav boxes look prettier --*/ + +table.navbox th +{ + background-color:#181850; +} + +.navbox-title a:link, +.navbox-abovebelow a:link, +.navbox-group a:link +{ + text-decoration:none; +} + +.navbox-title a:visited, +.navbox-abovebelow a:visited, +.navbox-group a:visited +{ + text-decoration:none; +} + +.navbox-title a:hover,a:active, +.navbox-abovebelow a:hover,a:active, +.navbox-group a:hover,a:active +{ + text-decoration:none; +} + +#tagadder +{ + background-color:#000055; +} + +tr.clickaddtrack:hover +{ + background-color:#171760; +} + +.highlighted { + border-top: 4px solid #fe6800 !important; + border-left: 4px solid #fe6800 !important; + border-right: 4px solid #fe6800 !important; + border-bottom: 4px solid #fe6800 !important; + border-radius:2px !important; +} + +.covercontainer.highlighted +{ + border-bottom: none !important; + margin-bottom:-4px; + background-color:#171760; +} + +#imageeditor +{ + background-color:#171760; +} + +.tagholder table tr th { + background-color:rgba(0,0,0,0.8); + border-bottom:1px solid #dddddd; +} + +.bsel +{ + color:#ff4800; +} + +.bmid +{ + border-left:2px solid #ff4800; +} + +.helpfulalbum +{ + background-color:#181850; +} + +.tagholder_wide +{ + background-color:#181850; +} + +#artistchooser +{ + border-top:1px solid #cccccc; + border-bottom:1px solid #cccccc; + color:#aaaaaa; +} + +.currentbun +{ + border-bottom:1px solid #fe6500; + padding-bottom:2px; +} + +.dropshadow +{ + box-shadow: 7px 7px 5px rgba(0, 0, 0, 0.6); +} + +.podcastitem +{ + border-top:1px solid #cccccc; +} + +#dragger +{ + background-color:rgba(0,0,0,0.3); +} + +.topbarplaycontrols { + border-left: 1px solid black; + border-right: 1px solid black; +} diff --git a/www/rompr/themes/acers2.jpg b/www/rompr/themes/acers2.jpg new file mode 100644 index 0000000..3d0fbd6 Binary files /dev/null and b/www/rompr/themes/acers2.jpg differ diff --git a/www/rompr/themes/bg.jpg b/www/rompr/themes/bg.jpg new file mode 100644 index 0000000..e7452e5 Binary files /dev/null and b/www/rompr/themes/bg.jpg differ diff --git a/www/rompr/themes/fire-portrait.jpg b/www/rompr/themes/fire-portrait.jpg new file mode 100644 index 0000000..601dfcf Binary files /dev/null and b/www/rompr/themes/fire-portrait.jpg differ diff --git a/www/rompr/themes/fire.jpg b/www/rompr/themes/fire.jpg new file mode 100644 index 0000000..430b16e Binary files /dev/null and b/www/rompr/themes/fire.jpg differ diff --git a/www/rompr/themes/kernsary.jpg b/www/rompr/themes/kernsary.jpg new file mode 100644 index 0000000..b95b31a Binary files /dev/null and b/www/rompr/themes/kernsary.jpg differ diff --git a/www/rompr/themes/leaf.jpg b/www/rompr/themes/leaf.jpg new file mode 100644 index 0000000..2248b83 Binary files /dev/null and b/www/rompr/themes/leaf.jpg differ diff --git a/www/rompr/themes/leaftile.jpg b/www/rompr/themes/leaftile.jpg new file mode 100644 index 0000000..f4765e0 Binary files /dev/null and b/www/rompr/themes/leaftile.jpg differ diff --git a/www/rompr/themes/leaves2.jpg b/www/rompr/themes/leaves2.jpg new file mode 100644 index 0000000..e855b18 Binary files /dev/null and b/www/rompr/themes/leaves2.jpg differ diff --git a/www/rompr/themes/mountains.jpg b/www/rompr/themes/mountains.jpg new file mode 100644 index 0000000..bdf90e5 Binary files /dev/null and b/www/rompr/themes/mountains.jpg differ diff --git a/www/rompr/themes/nightclouds.jpg b/www/rompr/themes/nightclouds.jpg new file mode 100644 index 0000000..dd9bd94 Binary files /dev/null and b/www/rompr/themes/nightclouds.jpg differ diff --git a/www/rompr/themes/oldpaper.jpg b/www/rompr/themes/oldpaper.jpg new file mode 100644 index 0000000..931cd9a Binary files /dev/null and b/www/rompr/themes/oldpaper.jpg differ diff --git a/www/rompr/themes/plasma.jpg b/www/rompr/themes/plasma.jpg new file mode 100644 index 0000000..a031f42 Binary files /dev/null and b/www/rompr/themes/plasma.jpg differ diff --git a/www/rompr/themes/plasma_portrait.jpg b/www/rompr/themes/plasma_portrait.jpg new file mode 100644 index 0000000..de84dcd Binary files /dev/null and b/www/rompr/themes/plasma_portrait.jpg differ diff --git a/www/rompr/themes/shootingstars.jpg b/www/rompr/themes/shootingstars.jpg new file mode 100644 index 0000000..0e521eb Binary files /dev/null and b/www/rompr/themes/shootingstars.jpg differ diff --git a/www/rompr/themes/skytrailscrop.jpg b/www/rompr/themes/skytrailscrop.jpg new file mode 100644 index 0000000..320df47 Binary files /dev/null and b/www/rompr/themes/skytrailscrop.jpg differ diff --git a/www/rompr/themes/sunset_loch.jpg b/www/rompr/themes/sunset_loch.jpg new file mode 100644 index 0000000..d47a8ab Binary files /dev/null and b/www/rompr/themes/sunset_loch.jpg differ diff --git a/www/rompr/themes/sunsetbirds.jpg b/www/rompr/themes/sunsetbirds.jpg new file mode 100644 index 0000000..ba42314 Binary files /dev/null and b/www/rompr/themes/sunsetbirds.jpg differ diff --git a/www/rompr/themes/table.jpg b/www/rompr/themes/table.jpg new file mode 100644 index 0000000..15289ba Binary files /dev/null and b/www/rompr/themes/table.jpg differ diff --git a/www/rompr/themes/table_portrait.jpg b/www/rompr/themes/table_portrait.jpg new file mode 100644 index 0000000..a884b30 Binary files /dev/null and b/www/rompr/themes/table_portrait.jpg differ diff --git a/www/rompr/themes/tanpaper.jpg b/www/rompr/themes/tanpaper.jpg new file mode 100644 index 0000000..39badee Binary files /dev/null and b/www/rompr/themes/tanpaper.jpg differ diff --git a/www/rompr/themes/veins.jpg b/www/rompr/themes/veins.jpg new file mode 100644 index 0000000..d999f89 Binary files /dev/null and b/www/rompr/themes/veins.jpg differ diff --git a/www/rompr/themes/vellum-seamless-repeating-white.jpg b/www/rompr/themes/vellum-seamless-repeating-white.jpg new file mode 100644 index 0000000..7f5ce33 Binary files /dev/null and b/www/rompr/themes/vellum-seamless-repeating-white.jpg differ diff --git a/www/rompr/timezones.txt b/www/rompr/timezones.txt new file mode 100644 index 0000000..c4d5112 --- /dev/null +++ b/www/rompr/timezones.txt @@ -0,0 +1,576 @@ +Africa/Abidjan +Africa/Accra +Africa/Addis_Ababa +Africa/Asmara +Africa/Asmera +Africa/Bamako +Africa/Bangui +Africa/Banjul +Africa/Bissau +Africa/Blantyre +Africa/Brazzaville +Africa/Bujumbura +Africa/Cairo +Africa/Casablanca +Africa/Ceuta +Africa/Conakry +Africa/Dakar +Africa/Dar_es_Salaam +Africa/Djibouti +Africa/Douala +Africa/El_Aaiun +Africa/Freetown +Africa/Gaborone +Africa/Harare +Africa/Johannesburg +Africa/Juba +Africa/Kigali +Africa/Kinshasa +Africa/Lagos +Africa/Libreville +Africa/Lome +Africa/Luanda +Africa/Lubumbashi +Africa/Lusaka +Africa/Malabo +Africa/Maputo +Africa/Maseru +Africa/Mbabane +Africa/Mogadishu +Africa/Monrovia +Africa/Nairobi +Africa/Ndjamena +Africa/Niamey +Africa/Nouakchott +Africa/Ouagadougou +Africa/Porto-Novo +Africa/Sao_Tome +Africa/Timbuktu +Africa/Tripoli +Africa/Tunis +Africa/Windhoek +America/Adak +America/Anchorage +America/Anguilla +America/Antigua +America/Araguaina +America/Argentina/Buenos_Aires +America/Argentina/Catamarca +America/Argentina/ComodRivadavia +America/Argentina/Cordoba +America/Argentina/Jujuy +America/Argentina/La_Rioja +America/Argentina/Mendoza +America/Argentina/Rio_Gallegos +America/Argentina/Salta +America/Argentina/San_Juan +America/Argentina/San_Luis +America/Argentina/Tucuman +America/Argentina/Ushuaia +America/Aruba +America/Asuncion +America/Atikokan +America/Atka +America/Bahia +America/Bahia_Banderas +America/Barbados +America/Belem +America/Belize +America/Blanc-Sablon +America/Boa_Vista +America/Bogota +America/Boise +America/Buenos_Aires +America/Cambridge_Bay +America/Campo_Grande +America/Cancun +America/Caracas +America/Catamarca +America/Cayenne +America/Cayman +America/Chicago +America/Chihuahua +America/Coral_Harbour +America/Cordoba +America/Costa_Rica +America/Creston +America/Cuiaba +America/Curacao +America/Danmarkshavn +America/Dawson +America/Dawson_Creek +America/Denver +America/Detroit +America/Dominica +America/Edmonton +America/Eirunepe +America/El_Salvador +America/Ensenada +America/Fort_Wayne +America/Fortaleza +America/Glace_Bay +America/Godthab +America/Goose_Bay +America/Grand_Turk +America/Grenada +America/Guadeloupe +America/Guatemala +America/Guayaquil +America/Guyana +America/Halifax +America/Havana +America/Hermosillo +America/Indiana/Indianapolis +America/Indiana/Knox +America/Indiana/Marengo +America/Indiana/Petersburg +America/Indiana/Tell_City +America/Indiana/Vevay +America/Indiana/Vincennes +America/Indiana/Winamac +America/Indianapolis +America/Inuvik +America/Iqaluit +America/Jamaica +America/Jujuy +America/Juneau +America/Kentucky/Louisville +America/Kentucky/Monticello +America/Knox_IN +America/Kralendijk +America/La_Paz +America/Lima +America/Los_Angeles +America/Louisville +America/Lower_Princes +America/Maceio +America/Managua +America/Manaus +America/Marigot +America/Martinique +America/Matamoros +America/Mazatlan +America/Mendoza +America/Menominee +America/Merida +America/Metlakatla +America/Mexico_City +America/Miquelon +America/Moncton +America/Monterrey +America/Montevideo +America/Montreal +America/Montserrat +America/Nassau +America/New_York +America/Nipigon +America/Nome +America/Noronha +America/North_Dakota/Beulah +America/North_Dakota/Center +America/North_Dakota/New_Salem +America/Ojinaga +America/Panama +America/Pangnirtung +America/Paramaribo +America/Phoenix +America/Port-au-Prince +America/Port_of_Spain +America/Porto_Acre +America/Porto_Velho +America/Puerto_Rico +America/Rainy_River +America/Rankin_Inlet +America/Recife +America/Regina +America/Resolute +America/Rio_Branco +America/Rosario +America/Santa_Isabel +America/Santarem +America/Santiago +America/Santo_Domingo +America/Sao_Paulo +America/Scoresbysund +America/Shiprock +America/Sitka +America/St_Barthelemy +America/St_Johns +America/St_Kitts +America/St_Lucia +America/St_Thomas +America/St_Vincent +America/Swift_Current +America/Tegucigalpa +America/Thule +America/Thunder_Bay +America/Tijuana +America/Toronto +America/Tortola +America/Vancouver +America/Virgin +America/Whitehorse +America/Winnipeg +America/Yakutat +America/Yellowknife +Antarctica/Casey +Antarctica/Davis +Antarctica/DumontDUrville +Antarctica/Macquarie +Antarctica/Mawson +Antarctica/McMurdo +Antarctica/Palmer +Antarctica/Rothera +Antarctica/South_Pole +Antarctica/Syowa +Antarctica/Vostok +Arctic/Longyearbyen +Asia/Aden +Asia/Almaty +Asia/Amman +Asia/Anadyr +Asia/Aqtau +Asia/Aqtobe +Asia/Ashgabat +Asia/Ashkhabad +Asia/Baghdad +Asia/Bahrain +Asia/Baku +Asia/Bangkok +Asia/Beirut +Asia/Bishkek +Asia/Brunei +Asia/Calcutta +Asia/Choibalsan +Asia/Chongqing +Asia/Chungking +Asia/Colombo +Asia/Dacca +Asia/Damascus +Asia/Dhaka +Asia/Dili +Asia/Dubai +Asia/Dushanbe +Asia/Gaza +Asia/Harbin +Asia/Hebron +Asia/Ho_Chi_Minh +Asia/Hong_Kong +Asia/Hovd +Asia/Irkutsk +Asia/Istanbul +Asia/Jakarta +Asia/Jayapura +Asia/Jerusalem +Asia/Kabul +Asia/Kamchatka +Asia/Karachi +Asia/Kashgar +Asia/Kathmandu +Asia/Katmandu +Asia/Khandyga +Asia/Kolkata +Asia/Krasnoyarsk +Asia/Kuala_Lumpur +Asia/Kuching +Asia/Kuwait +Asia/Macao +Asia/Macau +Asia/Magadan +Asia/Makassar +Asia/Manila +Asia/Muscat +Asia/Nicosia +Asia/Novokuznetsk +Asia/Novosibirsk +Asia/Omsk +Asia/Oral +Asia/Phnom_Penh +Asia/Pontianak +Asia/Pyongyang +Asia/Qatar +Asia/Qyzylorda +Asia/Rangoon +Asia/Riyadh +Asia/Saigon +Asia/Sakhalin +Asia/Samarkand +Asia/Seoul +Asia/Shanghai +Asia/Singapore +Asia/Taipei +Asia/Tashkent +Asia/Tbilisi +Asia/Tehran +Asia/Tel_Aviv +Asia/Thimbu +Asia/Thimphu +Asia/Tokyo +Asia/Ujung_Pandang +Asia/Ulaanbaatar +Asia/Ulan_Bator +Asia/Urumqi +Asia/Ust-Nera +Asia/Vientiane +Asia/Vladivostok +Asia/Yakutsk +Asia/Yekaterinburg +Asia/Yerevan +Atlantic/Azores +Atlantic/Bermuda +Atlantic/Canary +Atlantic/Cape_Verde +Atlantic/Faeroe +Atlantic/Faroe +Atlantic/Jan_Mayen +Atlantic/Madeira +Atlantic/Reykjavik +Atlantic/South_Georgia +Atlantic/St_Helena +Atlantic/Stanley +Australia/ACT +Australia/Adelaide +Australia/Brisbane +Australia/Broken_Hill +Australia/Canberra +Australia/Currie +Australia/Darwin +Australia/Eucla +Australia/Hobart +Australia/LHI +Australia/Lindeman +Australia/Lord_Howe +Australia/Melbourne +Australia/North +Australia/NSW +Australia/Perth +Australia/Queensland +Australia/South +Australia/Sydney +Australia/Tasmania +Australia/Victoria +Australia/West +Australia/Yancowinna +Brazil/Acre +Brazil/DeNoronha +Brazil/East +Brazil/West +Canada/Atlantic +Canada/Central +Canada/East-Saskatchewan +Canada/Eastern +Canada/Mountain +Canada/Newfoundland +Canada/Pacific +Canada/Saskatchewan +Canada/Yukon +CET +Chile/Continental +Chile/EasterIsland +CST6CDT +Cuba +EET +Egypt +Eire +EST +EST5EDT +Etc/GMT +Etc/GMT+0 +Etc/GMT+1 +Etc/GMT+10 +Etc/GMT+11 +Etc/GMT+12 +Etc/GMT+2 +Etc/GMT+3 +Etc/GMT+4 +Etc/GMT+5 +Etc/GMT+6 +Etc/GMT+7 +Etc/GMT+8 +Etc/GMT+9 +Etc/GMT-0 +Etc/GMT-1 +Etc/GMT-10 +Etc/GMT-11 +Etc/GMT-12 +Etc/GMT-13 +Etc/GMT-14 +Etc/GMT-2 +Etc/GMT-3 +Etc/GMT-4 +Etc/GMT-5 +Etc/GMT-6 +Etc/GMT-7 +Etc/GMT-8 +Etc/GMT-9 +Etc/GMT0 +Etc/Greenwich +Etc/UCT +Etc/Universal +Etc/UTC +Etc/Zulu +Europe/Amsterdam +Europe/Andorra +Europe/Athens +Europe/Belfast +Europe/Belgrade +Europe/Berlin +Europe/Bratislava +Europe/Brussels +Europe/Bucharest +Europe/Budapest +Europe/Busingen +Europe/Chisinau +Europe/Copenhagen +Europe/Dublin +Europe/Gibraltar +Europe/Guernsey +Europe/Helsinki +Europe/Isle_of_Man +Europe/Istanbul +Europe/Jersey +Europe/Kaliningrad +Europe/Kiev +Europe/Lisbon +Europe/Ljubljana +Europe/London +Europe/Luxembourg +Europe/Madrid +Europe/Malta +Europe/Mariehamn +Europe/Minsk +Europe/Monaco +Europe/Moscow +Europe/Nicosia +Europe/Oslo +Europe/Paris +Europe/Podgorica +Europe/Prague +Europe/Riga +Europe/Rome +Europe/Samara +Europe/San_Marino +Europe/Sarajevo +Europe/Simferopol +Europe/Skopje +Europe/Sofia +Europe/Stockholm +Europe/Tallinn +Europe/Tirane +Europe/Tiraspol +Europe/Uzhgorod +Europe/Vaduz +Europe/Vatican +Europe/Vienna +Europe/Vilnius +Europe/Volgograd +Europe/Warsaw +Europe/Zagreb +Europe/Zaporozhye +Europe/Zurich +Factory +GB +GB-Eire +GMT +GMT+0 +GMT-0 +GMT0 +Greenwich +Hongkong +HST +Iceland +Indian/Antananarivo +Indian/Chagos +Indian/Christmas +Indian/Cocos +Indian/Comoro +Indian/Kerguelen +Indian/Mahe +Indian/Maldives +Indian/Mauritius +Indian/Mayotte +Indian/Reunion +Iran +Israel +Jamaica +Japan +Kwajalein +Libya +MET +Mexico/BajaNorte +Mexico/BajaSur +Mexico/General +MST +MST7MDT +Navajo +NZ +NZ-CHAT +Pacific/Apia +Pacific/Auckland +Pacific/Chatham +Pacific/Chuuk +Pacific/Easter +Pacific/Efate +Pacific/Enderbury +Pacific/Fakaofo +Pacific/Fiji +Pacific/Funafuti +Pacific/Galapagos +Pacific/Gambier +Pacific/Guadalcanal +Pacific/Guam +Pacific/Honolulu +Pacific/Johnston +Pacific/Kiritimati +Pacific/Kosrae +Pacific/Kwajalein +Pacific/Majuro +Pacific/Marquesas +Pacific/Midway +Pacific/Nauru +Pacific/Niue +Pacific/Norfolk +Pacific/Noumea +Pacific/Pago_Pago +Pacific/Palau +Pacific/Pitcairn +Pacific/Pohnpei +Pacific/Ponape +Pacific/Port_Moresby +Pacific/Rarotonga +Pacific/Saipan +Pacific/Samoa +Pacific/Tahiti +Pacific/Tarawa +Pacific/Tongatapu +Pacific/Truk +Pacific/Wake +Pacific/Wallis +Pacific/Yap +Poland +Portugal +PRC +PST8PDT +ROC +ROK +Singapore +Turkey +UCT +Universal +US/Alaska +US/Aleutian +US/Arizona +US/Central +US/East-Indiana +US/Eastern +US/Hawaii +US/Indiana-Starke +US/Michigan +US/Mountain +US/Pacific +US/Pacific-New +US/Samoa +UTC +W-SU +WET +Zulu \ No newline at end of file diff --git a/www/rompr/ui/albumart.js b/www/rompr/ui/albumart.js new file mode 100644 index 0000000..c5fc26c --- /dev/null +++ b/www/rompr/ui/albumart.js @@ -0,0 +1,683 @@ +var imagekey = ''; +var imgobj = null; +var nosource = false; +var running = false; +var clickindex = null; +var wobblebottom; +var searchcontent; +var localimages; +var allshown = true; +var stream = ""; +var progress; + +function getNewAlbumArt(div) { + + debug.log("ALBUMART","Getting art in",div); + $.each($(div).find("img").filter(filterImages), function () { + coverscraper.GetNewAlbumArt($(this)); + } + ); + if (running == false) { + running = true; + progress.fadeIn('slow'); + $("#harold").off("click"); + $("#harold").on("click", reset ); + $("#harold").html("Stop Download"); + $('#doobag').off('click'); + } + +} + +// Does anybody ever read the comments in code? +// I hope they do, because most of the comments in my code are entirely useless. + +function reset() { + coverscraper.reset(-1); +} + +// I like badgers + +function start() { + getNewAlbumArt('#wobblebottom'); +} + +function getsmall() { + $('#doobag').html(language.gettext('label_searching')).makeFlasher(); + $("#doobag").off("click"); + $.ajax({ + type: 'GET', + url: 'utils/findsmallimages.php', + dataType: 'json', + timeout: 300000 + }) + .done(function(data) { + $('#doobag').stopFlasher().css('opacity', '0'); + debug.log("SMALL IMAGES","Got List!",data); + for (var i in data) { + $('img[name="'+data[i]+'"]').removeAttr('src').addClass('notexist'); + } + coverscraper.reset($('.notexist:not(.notfound)').length + $('.notfound:not(.notexist)').length); + }) + .fail(function() { + $('#doobag').html("FAILED!").stopFlasher(); + debug.error("SMALL IMAGES","Big Wet Balls"); + }); +} + +function aADownloadFinished() { + if (running == true) { + running = false; + $("#harold").off("click"); + $("#harold").on("click", start ); + $("#doobag").off("click"); + $("#doobag").on("click", getsmall ); + $("#harold").html("Get Missing Covers"); + } + $("#status").html(""); + if (progress) { + progress.fadeOut('slow'); + progress.rangechooser('setProgress', 0); + } +} + +function onWobblebottomClicked(event) { + + var clickedElement = findClickableElement(event); + if (clickedElement.hasClass("clickalbumcover")) { + event.stopImmediatePropagation(); + imageEditor.show(clickedElement); + } + if (clickedElement.hasClass('clickselectartist')) { + event.stopImmediatePropagation(); + var a = clickedElement.attr("id"); + $(".clickselectartist").filter('.selected').removeClass('selected'); + clickedElement.addClass('selected'); + if (a == "allartists") { + $(".cheesegrater").show(); + if (!allshown) { + boogerbenson(); + boogerbenson(); + } + } else { + $(".cheesegrater").filter('[name!="'+a+'"]').hide(); + $('[name="'+a+'"]').show(); + } + } +} + +function findClickableElement(event) { + + var clickedElement = $(event.target); + // Search upwards through the parent elements to find the clickable object + while (!clickedElement.hasClass("clickable") && + clickedElement.prop("id") != "wobblebottom" && + clickedElement.prop("id") != "searchcontent") { + clickedElement = clickedElement.parent(); + } + return clickedElement; + +} + +// It's not raining + +function boogerbenson() { + if (allshown) { + $("img", "#wobblebottom").filter( onlywithcovers ).parent().parent().hide(); + $("#finklestein").html(language.gettext("albumart_showall")); + $(".albumsection").filter( emptysections ).hide(); + $(".bigholder").filter( emptysections2 ).hide(); + } else { + $(".bigholder").show(); + $(".albumsection").show(); + $("img", "#wobblebottom").parent().parent().show(); + $("#finklestein").html(language.gettext("albumart_onlyempty")); + } + allshown = !allshown; +} + +function onlywithcovers() { + if ($(this).hasAttr('src')) { + return true; + } else { + return false; + } +} + +function filterImages() { + if ($(this).hasClass('playlistimage')){ + return false; + } + if ($(this).hasAttr('src')) { + return false; + } else { + return true; + } +} + +// This comment is useless + +function emptysections() { + var empty = true; + $.each($(this).next().find('.albumimg'), function() { if (!$(this).is(':hidden')) { empty = false } }); + return empty; +} + +function emptysections2() { + var empty = true; + $.each($(this).find('.albumimg'), function() { if (!$(this).is(':hidden')) { empty = false } }); + return empty; +} + +function sections_without_missing_images() { + var ne = $(this).find('img.notexist'); + var nf = $(this).find('img.notfound'); + if (ne.length + nf.length > 0) { + return false; + } + return true; +} + +function sections_with_missing_images() { + var ne = $(this).find('img.notexist'); + var nf = $(this).find('img.notfound'); + if (ne.length + nf.length > 0) { + return true; + } + return false; +} + +$(document).ready(function () { + + debug.log("ALBUMART","Document is ready"); + prefs.rgbs = null; + prefs.maxrgbs = null; + prefs.setTheme(prefs.theme); + progress = $('#progress'); + progress.rangechooser({range: 100, startmax: 0, interactive: false}); + $(window).on('resize', wobbleMyBottom ); + $("#harold").on('click', start ); + $("#doobag").on('click', getsmall ); + $("#finklestein").on('click', boogerbenson ); + wobblebottom = $('#wobblebottom'); + wobbleMyBottom(); + $('#artistcoverslist').mCustomScrollbar({ + theme: "light", + scrollInertia: 300, + contentTouchScroll: 25, + mouseWheel: { + scrollAmount: 40, + }, + advanced: { + updateOnContentResize: true, + updateOnImageLoad: false, + autoScrollOnFocus: false, + autoUpdateTimeout: 500, + } + }); + $('#coverslist').mCustomScrollbar({ + theme: "light", + scrollInertia: 200, + contentTouchScroll: 25, + mouseWheel: { + scrollAmount: 20, + }, + advanced: { + updateOnContentResize: true, + updateOnImageLoad: false, + autoScrollOnFocus: false, + autoUpdateTimeout: 500, + } + }); + document.body.addEventListener('drop', function(e) { + e.preventDefault(); + }, false); + wobblebottom.on('click', onWobblebottomClicked); + $('.droppable').on('dragenter', dragEnter); + $('.droppable').on('dragover', dragOver); + $('.droppable').on('dragleave', dragLeave); + $('.droppable').on('drop', handleDrop); + $(document).on('mouseenter', '.clearbox', makeHoverWork); + $(document).on('mouseleave', '.clearbox', makeHoverWork); + $(document).on('mousemove', '.clearbox', makeHoverWork); + $(document).on('click', '.clearbox.enter', makeClearWork); + +}); + +$(window).on('load', function () { + debug.log("ALBUMART","Document has loaded"); + coverscraper = new coverScraper(1, true, true, true); + var count = 0; + $.each($(document).find("img").filter(filterImages), function() { + count++; + $(this).addClass("notexist"); + }); + $('.cheesegrater').filter(sections_with_missing_images).each(function() { + $(this).children('.albumsection').find('button').show(); + }); + $('#poobag').prop('checked', false); + $('#dinkytoy').prop('checked', false); + coverscraper.toggleScrolling(false); + coverscraper.toggleLocal(false); + $("#totaltext").html(numcovers+" "+language.gettext("label_albums")); + coverscraper.reset(albums_without_cover); + coverscraper.updateInfo(albums_without_cover - count); + $("#status").html(language.gettext("albumart_instructions")); +}); + +function dragEnter(ev) { + evt = ev.originalEvent; + evt.stopPropagation(); + evt.preventDefault(); + $(ev.target).addClass("highlighted"); + return false; +} + +function dragOver(ev) { + evt = ev.originalEvent; + evt.stopPropagation(); + evt.preventDefault(); + return false; +} + +function dragLeave(ev) { + evt = ev.originalEvent; + evt.stopPropagation(); + evt.preventDefault(); + $(ev.target).removeClass("highlighted"); + return false; +} + +function handleDrop(ev) { + debug.log("ALBUMART","Dropped",ev); + evt = ev.originalEvent; + $(ev.target).removeClass("highlighted"); + imgobj = $(ev.target); + imagekey = imgobj.attr("name"); + nosource = (imgobj.hasClass('notfound') || imgobj.hasClass('notexist')); + clickindex = null; + dropProcessor(ev.originalEvent, imgobj, coverscraper, uploadComplete, searchFail); +} + +var imageEditor = function() { + + var start = 1; + var position = null; + var bigdiv = null; + var bigimg = new Image(); + var currparent = null; + var currhighlight = null; + var currname = null; + var current = "g"; + var nureek = "https://www.googleapis.com/customsearch/v1?key="+prefs.google_api_key+"&cx="+prefs.google_search_engine_id+"&searchType=image&alt=json"; + bigimg.onload = function() { + imageEditor.displayBigImage(); + } + + return { + + show: function(where) { + var newpos = where.parent().parent(); + if (where.attr('name') == currname) { + imageEditor.close(); + return true; + } + if (currparent !== null) { + imageEditor.close(); + } + currname = where.attr('name'); + bigdiv = $('
      ', {id: "imageeditor", class: "containerbox highlighted dropshadow"}).appendTo(newpos); + bigdiv.on('click', imageEditor.onGoogleSearchClicked); + start = 1; + currhighlight = where.parent(); + currhighlight.addClass('highlighted'); + currparent = newpos; + + bigimg.src = ""; + bigdiv.empty(); + imgobj = where; + imagekey = imgobj.attr('name'); + nosource = (imgobj.hasClass('notfound') || imgobj.hasClass('notexist')); + var phrase = decodeURIComponent(imgobj.parent().find('input[name="searchterm"]').val()); + var path = imgobj.parent().find('input[name="albumpath"]').val(); + debug.log('ALBUMART','Local Path Is',path); + + bigdiv.append($('
      ', { id: "searchcontent" })); + bigdiv.append($('
      ', { id: "origimage"}).append($("", { id: 'browns' }))); + + $("#searchcontent").append( $('
      ', {id: "editcontrols", class: "clearfix fullwidth"}), + $('
      ', {id: "gsearch", class: "noddy fullwidth invisible"}), + $('
      ', {id: "fsearch", class: "noddy fullwidth invisible"}), + $('
      ', {id: "usearch", class: "noddy fullwidth invisible"})); + + $("#"+current+"search").removeClass("invisible"); + + $("#gsearch").append( $('
      ', {id: "brian", class: "fullwidth"}), + $('
      ', {id: "searchresultsholder", class: "fullwidth"})); + + $("#searchresultsholder").append($('
      ', {id: "searchresults", class: "clearfix fullwidth"})); + + var fdiv = $('
      ', {class: "fullwidth"}).appendTo('#usearch'); + var uform = $('
      ', { id: 'uform', action: 'getalbumcover.php', method: 'post', enctype: 'multipart/form-data' }).appendTo(fdiv); + uform.append( $('', { id: 'uploadkey', type: 'hidden', name: 'key', value: '' }), + $('', { id: 'uploadartist', type: 'hidden', name: 'artist', value: '' }), + $('', { id: 'uploadalbum', type: 'hidden', name: 'album', value: '' }), + ); + var fb = $('
      ', {class: 'filebutton textcentre'}).appendTo(uform); + var inp = $('', { name: 'ufile', type: 'file', id: 'ufile', class: 'inputfile'}).appendTo(fb); + inp.on('change', function() { + var filename = $(this).val().replace(/.*(\/|\\)/, ''); + $(this).next().html(filename); + $(this).parent().next('input[type="button"]').fadeIn('fast'); + }); + var lab = $('