App-MHFS

 view release on metacpan or  search on metacpan

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

    my %fileitem = ('requestfile' => $requestfile);
    my $currentsize;
    if($self->{'method'} ne 'HEAD') {
        my $FH;
        if(! open($FH, "<", $requestfile)) {
            say "SLF: open failed";
            $self->Send404;
            return;
        }
        binmode($FH);
        my $st = stat($FH);
        if(! $st) {
            $self->Send404();
            return;
        }
        $currentsize = $st->size;
        $fileitem{'fh'} = $FH;
    }
    else {
        $currentsize = (-s $requestfile);
    }

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


    # truncate to the [potentially] satisfiable end
    if(defined $self->{'header'}{'_RangeEnd'}) {
        $self->{'header'}{'_RangeEnd'} = min($filelength-1,  $self->{'header'}{'_RangeEnd'});
    }

    # setup callback for retrieving current file size if we are following the file
    if($fileitem{'fh'}) {
        if(! $done) {
            $get_current_size = sub {
                return stat($fileitem{'fh'})
            };
        }

        my $get_read_filesize = sub {
            my $maxsize = $get_max_size->();
            if(defined $self->{'header'}{'_RangeEnd'}) {
                my $rangesize = $self->{'header'}{'_RangeEnd'}+1;
                return $rangesize if($rangesize <= $maxsize);
            }
            return $maxsize;

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

    use constant HAS_MHFS_XS => (eval "use MHFS::XS; 1");
    if(! HAS_MHFS_XS) {
        warn __PACKAGE__.": XS not available";
    }
}

# read the directory tree from desk and store
# this assumes filenames are UTF-8ish, the octlets will be the actual filename, but the printable filename is created by decoding it as UTF-8
sub BuildLibrary {
    my ($path) = @_;
    my $statinfo = stat($path);
    return undef if(! $statinfo);
    my $basepath = basename($path);
    my $utf8name = get_printable_utf8($basepath);

    if(!S_ISDIR($statinfo->mode)){
    return undef if($path !~ /\.(flac|mp3|m4a|wav|ogg|webm)$/);
        return [$basepath, $statinfo->size, undef, $utf8name];
    }
    else {
        my $dir;

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

            return 1 if(! $cl);
            my ($cr) = $context->{'stdout'} =~ /^.*Content\-Range:\sbytes\s\d+\-\d+\/(\d+)/s;
            if($cr) {
                say "cr $cr";
                $cl = $cr if($cr > $cl);
            }
            say "cl is $cl";
            UNLOCK_WRITE($filename);
            LOCK_WRITE($filename, $cl);
            # make sure the file exists and within our parameters
            my $st = stat($filename);
            $st or return;
            my $minsize = 16384;
            $minsize = $cl if($cl < $minsize);
            return if($st->size < $minsize);
            say "sending, currentsize " . $st->size . ' totalsize ' . $cl;
            # dont need to check the new data anymore
            $context->{'on_stdout_data'} = undef;
            $sendit->();
            $request = undef;
        },

share/public_html/static/music_inc/src/miniaudio.h  view on Meta::CPAN


#ifdef MA_WIN32
#include <windows.h>
#else
#include <stdlib.h>     /* For malloc(), free(), wcstombs(). */
#include <string.h>     /* For memset() */
#include <sched.h>
#include <sys/time.h>   /* select() (used for ma_sleep()). */
#endif

#include <sys/stat.h>   /* For fstat(), etc. */

#ifdef MA_EMSCRIPTEN
#include <emscripten/emscripten.h>
#endif

#if !defined(MA_64BIT) && !defined(MA_32BIT)
#ifdef _WIN32
#ifdef _WIN64
#define MA_64BIT
#else

share/public_html/static/music_inc/src/miniaudio.h  view on Meta::CPAN

    version here since we can open it even when another process has control of the "/dev/audioN" device.
    */
    for (iDevice = 0; iDevice < maxDevices; ++iDevice) {
        struct stat st;
        int fd;
        ma_bool32 isTerminating = MA_FALSE;

        ma_strcpy_s(devpath, sizeof(devpath), "/dev/audioctl");
        ma_itoa_s(iDevice, devpath+strlen(devpath), sizeof(devpath)-strlen(devpath), 10);
    
        if (stat(devpath, &st) < 0) {
            break;
        }

        /* The device exists, but we need to check if it's usable as playback and/or capture. */
        
        /* Playback. */
        if (!isTerminating) {
            fd = open(devpath, O_RDONLY, 0);
            if (fd >= 0) {
                /* Supports playback. */

share/public_html/static/music_inc/src/miniaudio.h  view on Meta::CPAN

    MA_ASSERT(pInfo != NULL);

    (void)pVFS;

#if defined(_MSC_VER)
    fd = _fileno((FILE*)file);
#else
    fd =  fileno((FILE*)file);
#endif

    if (fstat(fd, &info) != 0) {
        return ma_result_from_errno(errno);
    }

    pInfo->sizeInBytes = info.st_size;

    return MA_SUCCESS;
}
#endif


share/public_html/static/music_worklet_inprogress/decoder/bin/_mhfscl.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;

share/public_html/static/music_worklet_inprogress/decoder/deps/miniaudio/miniaudio.h  view on Meta::CPAN

#ifdef MA_WIN32
#include <windows.h>
#else
#include <stdlib.h>     /* For malloc(), free(), wcstombs(). */
#include <string.h>     /* For memset() */
#include <sched.h>
#include <sys/time.h>   /* select() (used for ma_sleep()). */
#include <pthread.h>
#endif

#include <sys/stat.h>   /* For fstat(), etc. */

#ifdef MA_EMSCRIPTEN
#include <emscripten/emscripten.h>
#endif

#if !defined(MA_64BIT) && !defined(MA_32BIT)
#ifdef _WIN32
#ifdef _WIN64
#define MA_64BIT
#else

share/public_html/static/music_worklet_inprogress/decoder/deps/miniaudio/miniaudio.h  view on Meta::CPAN

    version here since we can open it even when another process has control of the "/dev/audioN" device.
    */
    for (iDevice = 0; iDevice < maxDevices; ++iDevice) {
        struct stat st;
        int fd;
        ma_bool32 isTerminating = MA_FALSE;

        ma_strcpy_s(devpath, sizeof(devpath), "/dev/audioctl");
        ma_itoa_s(iDevice, devpath+strlen(devpath), sizeof(devpath)-strlen(devpath), 10);

        if (stat(devpath, &st) < 0) {
            break;
        }

        /* The device exists, but we need to check if it's usable as playback and/or capture. */

        /* Playback. */
        if (!isTerminating) {
            fd = open(devpath, O_RDONLY, 0);
            if (fd >= 0) {
                /* Supports playback. */

share/public_html/static/music_worklet_inprogress/decoder/deps/miniaudio/miniaudio.h  view on Meta::CPAN

    MA_ASSERT(pInfo != NULL);

    (void)pVFS;

#if defined(_MSC_VER)
    fd = _fileno((FILE*)file);
#else
    fd =  fileno((FILE*)file);
#endif

    if (fstat(fd, &info) != 0) {
        return ma_result_from_errno(errno);
    }

    pInfo->sizeInBytes = info.st_size;

    return MA_SUCCESS;
}
#endif




( run in 0.956 second using v1.01-cache-2.11-cpan-5f4f29bf90f )