anchor.diff:                                          get_info(Torrent)),
       lists:sum([get_file_length(F) || F <- Files]).
   
  -%%--------------------------------------------------------------------
  -%% Function: get_files/1
  -%% Description: Get a file list from the torrent
  -%%--------------------------------------------------------------------
  -get_files(Torrent) ->
  -    {list, FilesEntries} = get_files_section(Torrent),
  -    [process_file_entry(Path) || Path <- FilesEntries].
  -
  -%%--------------------------------------------------------------------
  -%% Function: get_name/1
  -%% Description: Get the name of a torrent. Returns either {ok, N} for
  -%%   for a valid name or {error, security_violation, N} for something
  -%%   that violates the security limitations.
  -%%--------------------------------------------------------------------
  -get_name(Torrent) ->
  -    {string, N} = etorrent_bcoding:search_dict({string, "name"},
  -                                      get_info(Torrent)),
  -    true = valid_path(N),
  -    N.
  -
  -%%--------------------------------------------------------------------
  -%% Function: get_url/1
  -%% Description: Return the URL of a torrent
  -%%--------------------------------------------------------------------
  -get_url(Torrent) ->
  -    {string, U} = etorrent_bcoding:search_dict({string, "announce"},
  -                                               Torrent),
  -    U.
  -
  -%%--------------------------------------------------------------------
  -%% Function: get_infohash/1
  -%% Description: Return the infohash for a torrent
  -%%--------------------------------------------------------------------
  -get_infohash(Torrent) ->
  -    InfoDict = etorrent_bcoding:search_dict({string, "info"}, Torrent),
  -    InfoString = etorrent_bcoding:encode(InfoDict),
  -    crypto:sha(list_to_binary(InfoString)).
  -
  -
  -%%====================================================================
  -%% Internal functions
  -%%====================================================================
   get_info(Torrent) ->
       etorrent_bcoding:search_dict({string, "info"}, Torrent).
   
  
positive.code:             %% Multifile torrent
              sum_files(Torrent)
      end.
  
  get_file_length(File) ->
      {integer, N} = etorrent_bcoding:search_dict({string, "length"},
  
negative.code: -module(etorrent_metainfo).
  -author("Jesper Louis Andersen <jesper.louis.andersen@gmail.com>").
  
  -include("types.hrl").
  
  %% API
  -export([get_piece_length/1, get_length/1, get_pieces/1, get_url/1,
           get_infohash/1,
           get_files/1, get_name/1]).
  
  
  %% ====================================================================
  
  % @doc Search a torrent file, return the piece length
  % @end
  -spec get_piece_length(bcode()) -> integer().
  get_piece_length(Torrent) ->
      {integer, Size} =
          etorrent_bcoding:search_dict({string, "piece length"},
                                       get_info(Torrent)),
      Size.
  
  % @doc Search a torrent for the length field
  % @end
  -spec get_length(bcode()) -> integer().
  get_length(Torrent) ->
      case etorrent_bcoding:search_dict({string, "length"},
                                        get_info(Torrent)) of
  