<commit_before><?
/*

Builds metadata about a book on the Internet Archive in json(p) format so that the book
can be accessed by other software including the Internet Archive BookReader.

<NAME> <http://github.com/mangtronix>

Copyright (c) 2008-2010 Internet Archive. Software license AGPL version 3.

This file is part of BookReader.

    BookReader is free software: you can redistribute it and/or modify
    it under the terms of the GNU Affero General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    BookReader is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Affero General Public License for more details.

    You should have received a copy of the GNU Affero General Public License
    along with BookReader.  If not, see <http://www.gnu.org/licenses/>.
*/

class BookReaderMeta {

    // Fields from _meta.xml to add to response (if present)
    var $metaFields = array(
        'title' => 'title',
        'author' => 'author',
        'publisher' => 'publisher',
        'date' => 'date',
        'language' => 'language',
        'contributor' => 'contributor',
        'collection' => 'collection',
        'page-progression' => 'pageProgression',
    );
    
    var $metaDefaults = array(
        'pageProgression' => 'lr',
    );
    
    // Stash spot for callback data... where are closures when we need them?
    static $cbData = NULL;

    // Builds metadata object (to be encoded as JSON)
    function buildMetadata($id, $itemPath, $subPrefix, $server) {
    
        $response = array();
        
        if ("" == $id) {
            $this->BRFatal("No identifier specified!");
        }<commit_msg>Add ppi (pixels per inch) to BookReader metadata API<commit_after><?
/*

Builds metadata about a book on the Internet Archive in json(p) format so that the book
can be accessed by other software including the Internet Archive BookReader.

<NAME> <http://github.com/mangtronix>

Copyright (c) 2008-2010 Internet Archive. Software license AGPL version 3.

This file is part of BookReader.

    BookReader is free software: you can redistribute it and/or modify
    it under the terms of the GNU Affero General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    BookReader is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Affero General Public License for more details.

    You should have received a copy of the GNU Affero General Public License
    along with BookReader.  If not, see <http://www.gnu.org/licenses/>.
*/

class BookReaderMeta {

    // Fields from _meta.xml to add to response (if present)
    var $metaFields = array(
        'title' => 'title',
        'author' => 'author',
        'publisher' => 'publisher',
        'date' => 'date',
        'language' => 'language',
        'contributor' => 'contributor',
        'collection' => 'collection',
        'page-progression' => 'pageProgression',
        'ppi' => 'ppi',
    );
    
    var $metaDefaults = array(
        'pageProgression' => 'lr',
    );
    
    // Stash spot for callback data... where are closures when we need them?
    static $cbData = NULL;

    // Builds metadata object (to be encoded as JSON)
    function buildMetadata($id, $itemPath, $subPrefix, $server) {
    
        $response = array();
        
        if ("" == $id) {
            $this->BRFatal("No identifier specified!");
        }
{'fraction_non_alphanumeric': 0.09527579836368436, 'fraction_numerical': 0.005278437582475587, 'mean_word_length': 2.7524752475247523, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 30, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4253772', 'n_tokens_mistral': 1047, 'n_tokens_neox': 999, 'n_words': 440}