]> gitweb.factorcode.org Git - factor.git/blobdiff - extra/id3/id3.factor
functors: inline the parts of interpolate this needs
[factor.git] / extra / id3 / id3.factor
index 754f3c460daf9010c3f78bb809018ea6d9124779..6de42598670549d0cd7e96eec812181bc7cefbbb 100644 (file)
@@ -1,12 +1,10 @@
 ! Copyright (C) 2009 Tim Wawrzynczak, Doug Coleman.
-! See http://factorcode.org/license.txt for BSD license.
-USING: sequences io io.encodings.binary io.files io.pathnames
-strings kernel math io.mmap accessors combinators math.ranges
-unicode.categories byte-arrays io.encodings.string
-io.encodings.utf16 assocs math.parser combinators.short-circuit
-fry namespaces combinators.smart splitting io.encodings.ascii
-arrays io.files.info unicode.case io.directories.search literals
-math.functions continuations ;
+! See https://factorcode.org/license.txt for BSD license.
+USING: accessors arrays assocs byte-arrays
+combinators combinators.short-circuit combinators.smart
+continuations io.directories io.encodings.ascii
+io.encodings.string io.encodings.utf16 io.mmap kernel math
+math.functions math.parser sequences splitting unicode ;
 FROM: alien.c-types => uchar ;
 IN: id3
 
@@ -118,7 +116,7 @@ CONSTANT: id3v1+-length 227
     [ 10 over size>> 10 + ] dip <slice> filter-text-data ;
 
 : decode-text ( string -- string' )
-    dup 2 short head
+    dup 2 index-or-length head
     { { 0xff 0xfe } { 0xfe 0xff } } member?
     utf16 ascii ? decode ;
 
@@ -233,7 +231,7 @@ PRIVATE>
 : genre ( id3 -- string/f )
     "TCON" find-id3-frame parse-genre ;
 
-: find-mp3s ( path -- seq ) ".mp3" find-by-extension ;
+: find-mp3s ( path -- seq ) ".mp3" find-files-by-extension ;
 
 ERROR: id3-parse-error path error ;