Compare commits

..

4 Commits

Author SHA1 Message Date
Steve Ayerhart 745db6b657
sure up flac pictures 2021-08-09 11:51:13 -04:00
Steve Ayerhart ada7286d92
initial picture 2021-08-09 11:51:12 -04:00
Steve Ayerhart 1829f4e732
add flac seek 2021-08-09 11:51:11 -04:00
Steve Ayerhart 2a0c71fd6e
bbb deploy ready 2021-08-09 11:51:10 -04:00
8 changed files with 39 additions and 6 deletions

View File

@ -2,7 +2,7 @@ USING: tools.deploy.config ;
H{ H{
{ deploy-console? t } { deploy-console? t }
{ deploy-io 3 } { deploy-io 3 }
{ deploy-reflection 1 } { deploy-reflection 5 }
{ deploy-ui? f } { deploy-ui? f }
{ deploy-word-defs? f } { deploy-word-defs? f }
{ deploy-threads? t } { deploy-threads? t }

View File

@ -1 +0,0 @@
templates/themes.xml

View File

@ -45,7 +45,7 @@ link "links"
ensure-link-logger [ <repost> dup update-tuple ] with-bbb-db random-callout ; ensure-link-logger [ <repost> dup update-tuple ] with-bbb-db random-callout ;
: repost? ( url -- link/f ) : repost? ( url -- link/f )
link new swap >>url [ select-tuple ] with-bbb-db ; ensure-link-logger link new swap >>url [ select-tuple ] with-bbb-db ;
: url-regex ( -- regexp ) : url-regex ( -- regexp )
R/ http[s]?:\/\/(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+/i ; R/ http[s]?:\/\/(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+/i ;

View File

@ -46,7 +46,7 @@ mississippis "mississippis"
random ; random ;
: nonstandard-mississippi-duration ( -- duration ) : nonstandard-mississippi-duration ( -- duration )
.5 1.5 uniform-random-float seconds ; .5 1.75 uniform-random-float seconds ;
: standard-mississippi-duration ( -- duration ) : standard-mississippi-duration ( -- duration )
1 seconds ; 1 seconds ;

View File

@ -24,6 +24,7 @@ platzism "platzisms"
[ <platzism> insert-tuple ] with-bbb-db ; [ <platzism> insert-tuple ] with-bbb-db ;
: platzism-exists? ( str -- ? ) : platzism-exists? ( str -- ? )
ensure-platzisms
[ >lower "SELECT id FROM platzisms WHERE lower(quote) = '%s'" sprintf sql-query ] with-bbb-db empty? not ; [ >lower "SELECT id FROM platzisms WHERE lower(quote) = '%s'" sprintf sql-query ] with-bbb-db empty? not ;
: is-platz? ( str -- ? ) : is-platz? ( str -- ? )

View File

@ -31,6 +31,10 @@ M: flac-stream-reader dispose stream>> dispose ;
dup bytes>> swap [ prepend ] dip swap >>bytes drop dup bytes>> swap [ prepend ] dip swap >>bytes drop
] while flac-input-stream get bitstream>> bitstreams:read ; ] while flac-input-stream get bitstream>> bitstreams:read ;
: flac-seek ( n -- )
[ 8 * flac-input-stream get bitstream>> bitstreams:seek ]
[ io:seek-relative flac-input-stream get stream>> io:stream-seek ] bi ;
: flac-read-sint ( n -- n ) : flac-read-sint ( n -- n )
! TODO: this isn't rightt ! TODO: this isn't rightt
dup flac-read-uint dup . dup 1 - neg shift swap shift ; dup flac-read-uint dup . dup 1 - neg shift swap shift ;

View File

@ -244,4 +244,4 @@ TUPLE: metadata
{ seek-table maybe{ seek-table } } { seek-table maybe{ seek-table } }
{ vorbis-comment maybe{ vorbis-comment } } { vorbis-comment maybe{ vorbis-comment } }
{ cuesheet maybe{ cuesheet } } { cuesheet maybe{ cuesheet } }
{ picture maybe{ picture } } ; { picture maybe{ sequence } initial: { } } ;

View File

@ -111,6 +111,9 @@ ERROR: cuesheet-index-reserved-must-be-zero ;
32 flac-read-uint dup 8 * flac-read-uint swap >n-byte-array 32 flac-read-uint dup 8 * flac-read-uint swap >n-byte-array
picture boa ; picture boa ;
: append-picture ( metadata picture -- metadata )
[ dup picture>> ] dip 1array append >>picture ;
: read-metadata-block ( metadata length type -- metadata ) : read-metadata-block ( metadata length type -- metadata )
[ [
{ {
@ -120,7 +123,7 @@ ERROR: cuesheet-index-reserved-must-be-zero ;
{ metadata-seek-table [ read-metadata-block-seek-table >>seek-table ] } { metadata-seek-table [ read-metadata-block-seek-table >>seek-table ] }
{ metadata-vorbis-comment [ read-metadata-block-vorbis-comment >>vorbis-comment ] } { metadata-vorbis-comment [ read-metadata-block-vorbis-comment >>vorbis-comment ] }
{ metadata-cuesheet [ read-metadata-block-cuesheet >>cuesheet ] } { metadata-cuesheet [ read-metadata-block-cuesheet >>cuesheet ] }
{ metadata-picture [ read-metadata-block-picture >>picture ] } { metadata-picture [ read-metadata-block-picture append-picture ] }
} case } case
] with-big-endian ; ] with-big-endian ;
@ -136,5 +139,31 @@ ERROR: cuesheet-index-reserved-must-be-zero ;
[ read-metadata-block ] dip [ read-metadata-block ] dip
] loop ; ] loop ;
: <flac-stream-info> ( filename -- stream-info )
[
read/assert-flac-magic
32 flac-read-uint drop
read-metadata-block-stream-info
] with-flac-file-reader ;
: <flac-tags> ( filename -- tags )
[
read/assert-flac-magic
[ read-metadata-block-header [ length>> ] [ type>> metadata-vorbis-comment = ] [ last?>> ] tri or ]
[ flac-seek ] until [ read-metadata-block-vorbis-comment ] with-big-endian
] with-flac-file-reader ;
: <flac-pictures> ( filename -- pictures )
[
read/assert-flac-magic
[ read-metadata-block-header dup last?>> not ]
[
[ length>> ] [ type>> metadata-picture = ] bi
[ read-metadata-block-picture ]
[ flac-seek f ] if
] produce nip sift
] with-flac-file-reader ;
: <flac-metadata> ( filename -- metadata ) : <flac-metadata> ( filename -- metadata )
[ read-flac-metadata ] with-flac-file-reader ; [ read-flac-metadata ] with-flac-file-reader ;