Merge branch 'master' of git://factorcode.org/git/factor
commit
154d248a86
|
@ -27,7 +27,7 @@ word wrap.">
|
|||
" " wrap-indented-string
|
||||
] unit-test
|
||||
|
||||
[ "this text\nhas lots\nof spaces" ]
|
||||
[ "this text\nhas lots of\nspaces" ]
|
||||
[ "this text has lots of spaces" 12 wrap-string ] unit-test
|
||||
|
||||
[ "hello\nhow\nare\nyou\ntoday?" ]
|
||||
|
@ -39,3 +39,5 @@ word wrap.">
|
|||
[ "aaa bb\nccccccc\nddddddd" ] [ "aaa bb ccccccc ddddddd" 6 wrap-string ] unit-test
|
||||
|
||||
\ wrap-string must-infer
|
||||
|
||||
[ "a b c d e f\ng h" ] [ "a b c d e f g h" 11 wrap-string ] unit-test
|
||||
|
|
|
@ -36,8 +36,10 @@ SYMBOL: line-ideal
|
|||
] each drop ; inline
|
||||
|
||||
: paragraph-cost ( paragraph -- cost )
|
||||
[ head-width>> deviation ]
|
||||
[ tail-cost>> ] bi + ;
|
||||
dup lines>> 1list? [ drop 0 ] [
|
||||
[ head-width>> deviation ]
|
||||
[ tail-cost>> ] bi +
|
||||
] if ;
|
||||
|
||||
: min-cost ( paragraphs -- paragraph )
|
||||
[ paragraph-cost ] min-by ;
|
||||
|
|
|
@ -3,15 +3,15 @@
|
|||
USING: help.markup help.syntax sequences kernel ;
|
||||
IN: id3
|
||||
|
||||
HELP: id3-parse-mp3-file
|
||||
HELP: file-id3-tags
|
||||
{ $values
|
||||
{ "path" "a path string" }
|
||||
{ "object/f" "either a tuple consisting of the data from an MP3 file, or an f indicating this file has no (supported) ID3 information." } }
|
||||
{ $description "Return a tuple containing the ID3 information parsed out of the MP3 file" } ;
|
||||
{ "object/f" "a tuple storing ID3 metadata or f" } }
|
||||
{ $description "Return a tuple containing the ID3 information parsed out of the MP3 file, or " { $link f } " if no metadata is present." } ;
|
||||
|
||||
ARTICLE: "id3" "ID3 tags"
|
||||
{ $emphasis "ID3" } " tags are textual data that is used to describe the information (title, artist, etc.) in an .MP3 file"
|
||||
"Parsing an MP3 file: "
|
||||
{ $subsection id3-parse-mp3-file } ;
|
||||
"The " { $vocab-link "id3" } " vocabulary contains words for parsing " { $emphasis "ID3" } " tags, which are textual fields storing an MP3's title, artist, and other metadata." $nl
|
||||
"Parsing ID3 tags from an MP3 file:"
|
||||
{ $subsection file-id3-tags } ;
|
||||
|
||||
ABOUT: "id3"
|
||||
|
|
|
@ -58,7 +58,7 @@ IN: id3.tests
|
|||
}
|
||||
}
|
||||
}
|
||||
] [ "resource:extra/id3/tests/blah3.mp3" id3-parse-mp3-file ] unit-test
|
||||
] [ "resource:extra/id3/tests/blah3.mp3" file-id3-tags ] unit-test
|
||||
|
||||
[
|
||||
T{ mp3v2-file
|
||||
|
@ -159,7 +159,7 @@ IN: id3.tests
|
|||
}
|
||||
}
|
||||
}
|
||||
] [ "resource:extra/id3/tests/blah2.mp3" id3-parse-mp3-file ] unit-test
|
||||
] [ "resource:extra/id3/tests/blah2.mp3" file-id3-tags ] unit-test
|
||||
|
||||
[
|
||||
T{ mp3v1-file
|
||||
|
@ -178,5 +178,5 @@ IN: id3.tests
|
|||
}
|
||||
{ genre 89 }
|
||||
}
|
||||
] [ "resource:extra/id3/tests/blah.mp3" id3-parse-mp3-file ] unit-test
|
||||
] [ "resource:extra/id3/tests/blah.mp3" file-id3-tags ] unit-test
|
||||
|
||||
|
|
|
@ -142,7 +142,7 @@ PRIVATE>
|
|||
|
||||
! main stuff
|
||||
|
||||
: id3-parse-mp3-file ( path -- object )
|
||||
: file-id3-tags ( path -- object/f )
|
||||
[
|
||||
{
|
||||
{ [ dup id3v2? ] [ read-v2-tag-data ] } ! ( ? -- mp3v2-file )
|
||||
|
|
Loading…
Reference in New Issue