Created
July 19, 2017 20:46
-
-
Save PragTob/0b13314c9980da964409efc28d0be1d3 to your computer and use it in GitHub Desktop.
Elixir binary matching from http://benjamintan.io/blog/2014/06/10/elixir-bit-syntax-and-id3/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mp3_byte_size = (byte_size(binary) - 128) | |
<< _ :: binary-size(mp3_byte_size), id3_tag :: binary >> = binary | |
<< "TAG", | |
title :: binary-size(30), | |
artist :: binary-size(30), | |
album :: binary-size(30), | |
year :: binary-size(4), | |
comment :: binary-size(30), | |
_rest :: binary >> = id3_tag |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment