anchor.diff:  %% API
   -export([
            start_link/2,
  -         stop/0
  +         stop/0,
  +         get_url/0,
  +         get_queue/0
           ]).
   
   %% gen_server callbacks
  
positive.code: %%%============================================================================
  %%% Internal functionality
  %%%============================================================================
  do_download(#state{port = undefined, queue =  Queue} = State) ->
     case queue:out(Queue) of
        {{value, Url}, Queue2} ->
             vffov_common:verbose(info, "Downloading video from url ~s", [Url]),
  
negative.code: stop() ->
      gen_server:cast(?MODULE, stop).
  
  get_url() ->
      gen_server:call(?MODULE, current_url).
  
  get_queue() ->
      gen_server:call(?MODULE, current_queue).
  
  %%%============================================================================
  %%% gen_server callbacks
  %%%============================================================================
  init([Queue]) ->
      process_flag(trap_exit, true),
      {ok, #state{queue = queue:from_list(Queue), current_url = undefined}, 0};
  init([]) ->
      process_flag(trap_exit, true),
      {ok, #state{queue = queue:new(), current_url = undefined}, 0}.
  
  handle_call(current_url, _From, State) ->
      {reply, {ok, State#state.current_url}, State};
  handle_call(current_queue, _From, State) ->
      {reply, {ok, State#state.queue}, State};
  handle_call(Call, From, State) ->
      vffov_common:verbose(error, "Unmatched call ~p from ~p", [Call, From]),
      {reply, invalid_call, State}.
  