App-MHFS

 view release on metacpan or  search on metacpan

lib/MHFS/HTTP/Server/Client/Request.pm  view on Meta::CPAN

        $msg = "301 Moved Permanently";
    }
    elsif($code == 307) {
        $msg = "307 Temporary Redirect";
    }
    $msg .= "\r\n<a href=\"$url\"></a>\r\n";
    $self->SendHTML($msg, {'code' => $code});
}

# encodes path and querystring
# path and query string keys and values must be bytes not unicode string
sub SendRedirect {
    my ($self, $code, $path, $qs) = @_;
    my $url;
    # encode the path component
    while(length($path)) {
        my $slash = index($path, '/');
        my $len = ($slash != -1) ? $slash : length($path);
        my $pathcomponent = substr($path, 0, $len, '');
        $url .= uri_escape($pathcomponent);
        if($slash != -1) {

lib/MHFS/HTTP/Server/Client/Request.pm  view on Meta::CPAN

        'get_current_length' => sub { return undef }
    );
    $self->_SendDataItem(\%fileitem, {
        'size'     => $bytesize,
        'mime'     => $mime,
        'filename' => $options->{'filename'},
        'code'     => $options->{'code'}
    });
}

# expects unicode string (not bytes)
sub SendText {
    my ($self, $mime, $buf, $options) = @_;
    @_ = ($self, $mime, encode('UTF-8', $buf), $options);
    goto &SendBytes;
}

# expects unicode string (not bytes)
sub SendHTML {
    my ($self, $buf, $options) = @_;;
    @_ = ($self, 'text/html; charset=utf-8', encode('UTF-8', $buf), $options);
    goto &SendBytes;
}

# expects perl data structure
sub SendAsJSON {
    my ($self, $obj, $options) = @_;
    @_ = ($self, 'application/json', encode_json($obj), $options);

lib/MHFS/Plugin/BitTorrent/Client/Interface.pm  view on Meta::CPAN

            my @lines = split( /\n/, $rtresponse);
            my $buf = '<h1>Torrents</h1>';
            $buf  .=  '<h3><a href="video?action=browsemovies">Browse Movies</a> | <a href="video">Video</a> | <a href="music">Music</a></h3>';
            $buf   .= '<table border="1" >';
            $buf   .= '<thead><tr><th>Name</th><th>Hash</th><th>Size</th><th>Done</th><th>Private</th></tr></thead>';
            $buf   .= "<tbody>";
            my $curtor = '';
            while(1) {
                if($curtor =~ /^\[(u?)['"](.+)['"],\s'(.+)',\s([0-9]+),\s([0-9]+),\s([0-9]+)\]$/) {
                    my %torrent;
                    my $is_unicode = $1;
                    $torrent{'name'} = $2;
                    $torrent{'hash'} = $3;
                    $torrent{'size_bytes'} = $4;
                    $torrent{'bytes_done'} = $5;
                    $torrent{'private'} = $6;
                    if($is_unicode) {
                        my $escaped_unicode = $torrent{'name'};
                        $torrent{'name'} =~ s/\\u(.{4})/chr(hex($1))/eg;
                        $torrent{'name'} =~ s/\\x(.{2})/chr(hex($1))/eg;
                        my $decoded_as = $torrent{'name'};
                        $torrent{'name'} = ${escape_html($torrent{'name'})};
                        if($qs->{'logunicode'}) {
                            say 'unicode escaped: ' . $escaped_unicode;
                            say 'decoded as: ' . $decoded_as;
                            say 'html escaped ' . $torrent{'name'};
                        }
                    }
                    $buf .= '<tr><td>' . $torrent{'name'} . '</td><td>' . $torrent{'hash'} . '</td><td>' . $torrent{'size_bytes'} . '</td><td>' . $torrent{'bytes_done'} . '</td><td>' . $torrent{'private'} . '</td></tr>';
                    $curtor = '';
                }
                else {
                    my $line = shift @lines;
                    if(! $line) {

lib/MHFS/Plugin/MusicLibrary.pm  view on Meta::CPAN

        }
        my $node = $nodestack[@nodestack - 1];
        my $newnode = {'name' =>$file->[3]};
        if($file->[2]) {
            $newnode->{'files'} = [];
            push @nodestack, $newnode;
            @files = (@{$file->[2]}, undef, @files);
        }
        push @{$node->{'files'}}, $newnode;
    }
    # encode json outputs bytes NOT unicode string
    return encode_json($head);
}


sub LibraryHTML {
    my ($self) = @_;
    my $buf = '';
    foreach my $file (@{$self->{'library'}}) {
        $buf .= ToHTML($file);
        $buf .= '<br>';

share/public_html/static/hls.js  view on Meta::CPAN

/**
 * Unicode character with styling and background.
 * @constructor
 */


var StyledUnicodeChar = function () {
  function StyledUnicodeChar(uchar, foreground, underline, italics, background, flash) {
    cea_608_parser__classCallCheck(this, StyledUnicodeChar);

    this.uchar = uchar || ' '; // unicode character
    this.penState = new PenState(foreground, underline, italics, background, flash);
  }

  StyledUnicodeChar.prototype.reset = function reset() {
    this.uchar = ' ';
    this.penState.reset();
  };

  StyledUnicodeChar.prototype.setChar = function setChar(uchar, newPenState) {
    this.uchar = uchar;

share/public_html/static/hls.js  view on Meta::CPAN

    cea_608_parser_logger.log('TEXT', this.getDisplayText());
    var topRowIndex = this.currRow + 1 - this.nrRollUpRows;
    var topRow = this.rows.splice(topRowIndex, 1)[0];
    topRow.clear();
    this.rows.splice(this.currRow, 0, topRow);
    cea_608_parser_logger.log('INFO', 'Rolling up');
    // logger.log('TEXT', this.get_display_text())
  };

  /**
    * Get all non-empty rows with as unicode text.
    */


  CaptionScreen.prototype.getDisplayText = function getDisplayText(asOneRow) {
    asOneRow = asOneRow || false;
    var displayText = [];
    var text = '';
    var rowNr = -1;
    for (var i = 0; i < NR_ROWS; i++) {
      var rowText = this.rows[i].getTextString();

share/public_html/static/music_inc/drflac.js  view on Meta::CPAN

async function Module(moduleArg={}){var moduleRtn;var Module=moduleArg;var ENVIRONMENT_IS_WEB=typeof window=="object";var ENVIRONMENT_IS_WORKER=typeof WorkerGlobalScope!="undefined";var ENVIRONMENT_IS_NODE=typeof process=="object"&&process.versions?....
;return moduleRtn}export default Module;



( run in 0.578 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )