id3 shouldn't fail on files with length < 128
parent
e8361b9980
commit
e986a60487
|
@ -1,6 +1,10 @@
|
||||||
! Copyright (C) 2009 Tim Wawrzynczak
|
! Copyright (C) 2009 Tim Wawrzynczak
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: sequences io io.encodings.binary io.files io.pathnames strings kernel math io.mmap io.mmap.uchar accessors syntax combinators math.ranges unicode.categories byte-arrays io.encodings.string io.encodings.utf8 assocs math.parser ;
|
USING: sequences io io.encodings.binary io.files io.pathnames
|
||||||
|
strings kernel math io.mmap io.mmap.uchar accessors syntax
|
||||||
|
combinators math.ranges unicode.categories byte-arrays
|
||||||
|
io.encodings.string io.encodings.utf8 assocs math.parser
|
||||||
|
combinators.short-circuit ;
|
||||||
IN: id3
|
IN: id3
|
||||||
|
|
||||||
<PRIVATE
|
<PRIVATE
|
||||||
|
@ -160,7 +164,7 @@ TUPLE: id3-info title artist album year comment genre ;
|
||||||
"ID3" head? ;
|
"ID3" head? ;
|
||||||
|
|
||||||
: id3v1? ( mmap -- ? )
|
: id3v1? ( mmap -- ? )
|
||||||
128 tail-slice* "TAG" head? ;
|
{ [ length 128 >= ] [ 128 tail-slice* "TAG" head? ] } 1&& ;
|
||||||
|
|
||||||
: >28bitword ( seq -- int )
|
: >28bitword ( seq -- int )
|
||||||
0 [ swap 7 shift bitor ] reduce ;
|
0 [ swap 7 shift bitor ] reduce ;
|
||||||
|
|
Loading…
Reference in New Issue