<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -106,109 +106,109 @@ my %atron_state;
 #   We see if we need to add anything to the send queue.
 #
 while (1) {
-  check_for_stuff_to_queue();
-  send_update();
-  sleep 10;
+    check_for_stuff_to_queue();
+    send_update();
+    sleep 10;
 }
 
 # Here we check to see if the atron is playing something and if
 # that something meets the requirements to send to AS. If so,
 # we queue it.
 sub check_for_stuff_to_queue {
-  %atron_state = %{ get_status() };
-  
-  # if the atron is off or inactive, then we clear
-  # what was last playing if anything, and exit.
-  if ( ! %atron_state || $atron_state{ State } eq 'Inactive' ) {
-    init_selection();
-    $sys_state = $SYS_STATE_ACTIVE;
-    return;
-  }
-
-  # Something is playing. Let's capture what was playing.
-  foreach my $key ( ( $AT_SOURCE, $AT_ARTIST, $AT_TITLE ) ) {
-    if ( ! $selection{ $key } || $atron_state{ $key } ne $selection{ $key } ) {
-      new_selection();
-      if ( $sys_state eq $SYS_STATE_INIT ) {
-	# do not send the first one ( the first one would get resent on startups )
-	$selection{ $SEL_STATE } = $SEL_STATE_SENT;
-	$sys_state = $SYS_STATE_ACTIVE;
-      }
-      last;
+    %atron_state = %{ get_status() };
+    
+    # if the atron is off or inactive, then we clear
+    # what was last playing if anything, and exit.
+    if ( ! %atron_state || $atron_state{ State } eq 'Inactive' ) {
+        init_selection();
+        $sys_state = $SYS_STATE_ACTIVE;
+        return;
+    }
+
+    # Something is playing. Let's capture what was playing.
+    foreach my $key ( ( $AT_SOURCE, $AT_ARTIST, $AT_TITLE ) ) {
+        if ( ! $selection{ $key } || $atron_state{ $key } ne $selection{ $key } ) {
+            new_selection();
+            if ( $sys_state eq $SYS_STATE_INIT ) {
+                # do not send the first one ( the first one would get resent on startups )
+                $selection{ $SEL_STATE } = $SEL_STATE_SENT;
+                $sys_state = $SYS_STATE_ACTIVE;
+            }
+            last;
+        }
+    }
+
+    # Something is playing and we saved it, now, should it be queued?
+    # First, update the play time (this needs to be updated on each poll)
+    $selection{ $AT_PLAY_TIME } = $atron_state{ $AT_PLAY_TIME };
+    if ( $selection{ $SEL_STATE } eq $SEL_STATE_SENT ) {
+        $selection{ $SEL_UNSENT_REASON } = 'we did queue it';
+        return;
+    }
+
+    if ( $selection{ $AT_SOURCE } ne 'UNC' ) {
+        $selection{ $SEL_UNSENT_REASON } = 'not an mp3 -- probably streaming radio';
+        return;
+    }
+
+    if ( $selection{ $AT_TOTAL_TIME } == 0 ) {
+        $selection{ $SEL_UNSENT_REASON } = 'no total time???';
+        return;
+    }
+
+    if ( $selection{ $AT_TOTAL_TIME } &lt; $AS_MIN_LENGTH ) {
+        $selection{ $SEL_UNSENT_REASON } = &quot;total time ($selection{ $AT_TOTAL_TIME }) less than min length ($AS_MIN_LENGTH)&quot;;
+        return;
     }
-  }
-
-  # Something is playing and we saved it, now, should it be queued?
-  # First, update the play time (this needs to be updated on each poll)
-  $selection{ $AT_PLAY_TIME } = $atron_state{ $AT_PLAY_TIME };
-  if ( $selection{ $SEL_STATE } eq $SEL_STATE_SENT ) {
-    $selection{ $SEL_UNSENT_REASON } = 'we did queue it';
-    return;
-  }
-
-  if ( $selection{ $AT_SOURCE } ne 'UNC' ) {
-    $selection{ $SEL_UNSENT_REASON } = 'not an mp3 -- probably streaming radio';
-    return;
-  }
-
-  if ( $selection{ $AT_TOTAL_TIME } == 0 ) {
-    $selection{ $SEL_UNSENT_REASON } = 'no total time???';
-    return;
-  }
-
-  if ( $selection{ $AT_TOTAL_TIME } &lt; $AS_MIN_LENGTH ) {
-    $selection{ $SEL_UNSENT_REASON } = &quot;total time ($selection{ $AT_TOTAL_TIME }) less than min length ($AS_MIN_LENGTH)&quot;;
-    return;
-  }
-
-  if ( $selection{ $AT_TOTAL_TIME } &gt; $AS_MAX_LENGTH ) {
-    $selection{ $SEL_UNSENT_REASON } = &quot;total time ($selection{ $AT_TOTAL_TIME }) greater than max length ($AS_MAX_LENGTH)&quot;;
-    return;
-  }
-
-  if (( $selection{ $AT_PLAY_TIME } / $selection{ $AT_TOTAL_TIME } &lt; $AS_MIN_PERCENT ) &amp;&amp; ( $selection{ $AT_PLAY_TIME } &lt; $AS_MIN_SECONDS )) {
-    my $play_percent = int(( $selection{ $AT_PLAY_TIME } / $selection{ $AT_TOTAL_TIME }) * 100);
-    my $min_percent = int( $AS_MIN_PERCENT * 100);
-    $selection{ $SEL_UNSENT_REASON } = &quot;play % ($play_percent) less than min % ($min_percent) AND &quot;.
-      &quot;play time ($selection{ $AT_PLAY_TIME }) less than min seconds ($AS_MIN_SECONDS)&quot;;
-    return;
-  }
-
-  # ok, passed all the tests, lets queue it.
-  queue_selection();
-  $selection{ $SEL_STATE } = $SEL_STATE_SENT;
-  $selection{ $SEL_UNSENT_REASON } = 'queued';
+
+    if ( $selection{ $AT_TOTAL_TIME } &gt; $AS_MAX_LENGTH ) {
+        $selection{ $SEL_UNSENT_REASON } = &quot;total time ($selection{ $AT_TOTAL_TIME }) greater than max length ($AS_MAX_LENGTH)&quot;;
+        return;
+    }
+
+    if (( $selection{ $AT_PLAY_TIME } / $selection{ $AT_TOTAL_TIME } &lt; $AS_MIN_PERCENT ) &amp;&amp; ( $selection{ $AT_PLAY_TIME } &lt; $AS_MIN_SECONDS )) {
+        my $play_percent = int(( $selection{ $AT_PLAY_TIME } / $selection{ $AT_TOTAL_TIME }) * 100);
+        my $min_percent = int( $AS_MIN_PERCENT * 100);
+        $selection{ $SEL_UNSENT_REASON } = &quot;play % ($play_percent) less than min % ($min_percent) AND &quot;.
+            &quot;play time ($selection{ $AT_PLAY_TIME }) less than min seconds ($AS_MIN_SECONDS)&quot;;
+        return;
+    }
+
+    # ok, passed all the tests, lets queue it.
+    queue_selection();
+    $selection{ $SEL_STATE } = $SEL_STATE_SENT;
+    $selection{ $SEL_UNSENT_REASON } = 'queued';
 }
 
 # new_selection saves the current state of the atron. 
 sub new_selection {
-  init_selection();
-  foreach ( ( $AT_SOURCE, $AT_ARTIST, $AT_TITLE, $AT_TOTAL_TIME ) ) {
-    $selection{ $_ } = $atron_state{ $_ };
-  }
-  my $epoch_time = time() - $atron_state{ $AT_PLAY_TIME };
-  $selection{ $SEL_START_TIME } = as_time( $epoch_time );
-  print '%% Something new is playing '.display_selection().&quot;\n&quot;;
+    init_selection();
+    foreach ( ( $AT_SOURCE, $AT_ARTIST, $AT_TITLE, $AT_TOTAL_TIME ) ) {
+        $selection{ $_ } = $atron_state{ $_ };
+    }
+    my $epoch_time = time() - $atron_state{ $AT_PLAY_TIME };
+    $selection{ $SEL_START_TIME } = as_time( $epoch_time );
+    print '%% Something new is playing '.display_selection().&quot;\n&quot;;
 }
 
 # initialize selection hash and print the reason the previous selection was 
 # not queued.
 sub init_selection {
-  if ( $selection{ $AT_ARTIST } &amp;&amp; $selection{ $SEL_STATE } ne $SEL_STATE_SENT ) {
-    print '%% '.display_selection().&quot; not sent: $selection{ $SEL_UNSENT_REASON }\n&quot;;
-  }
-  %selection = %def_selection;
+    if ( $selection{ $AT_ARTIST } &amp;&amp; $selection{ $SEL_STATE } ne $SEL_STATE_SENT ) {
+        print '%% '.display_selection().&quot; not sent: $selection{ $SEL_UNSENT_REASON }\n&quot;;
+    }
+    %selection = %def_selection;
 }
 
 sub display_selection {
-  my $display_selection = &quot;$selection{ $AT_ARTIST } / $selection{ $AT_TITLE }&quot;;
-  return $display_selection;
+    my $display_selection = &quot;$selection{ $AT_ARTIST } / $selection{ $AT_TITLE }&quot;;
+    return $display_selection;
 }
 
 sub as_time {
-  my $epoch_time = shift;
-  my $as_time = strftime( &quot;%Y-%m-%d %H:%M:%S&quot;, gmtime( $epoch_time ) );
-  return $as_time;
+    my $epoch_time = shift;
+    my $as_time = strftime( &quot;%Y-%m-%d %H:%M:%S&quot;, gmtime( $epoch_time ) );
+    return $as_time;
 }
 
 my (
@@ -216,15 +216,15 @@ my (
     @title_queue,
     @total_time_queue,
     @start_time_queue,
-   );
+    );
 
 sub queue_selection {
-  push ( @artist_queue, $selection{ $AT_ARTIST } );
-  push ( @title_queue, $selection{ $AT_TITLE } );
-  push ( @total_time_queue, $selection{ $AT_TOTAL_TIME } );
-  push ( @start_time_queue, $selection{ $SEL_START_TIME } );
+    push ( @artist_queue, $selection{ $AT_ARTIST } );
+    push ( @title_queue, $selection{ $AT_TITLE } );
+    push ( @total_time_queue, $selection{ $AT_TOTAL_TIME } );
+    push ( @start_time_queue, $selection{ $SEL_START_TIME } );
 }
-  
+
 # u=&lt;username&gt;
 # p=&lt;md5sum of password, hex encoded&gt;
 # a[0]=&lt;artist name&gt;
@@ -240,270 +240,270 @@ sub queue_selection {
 
 sub get_status {
 
-  my $user_agent = get_ua();
-  if (! $atron_req) {
-    $atron_req = HTTP::Request-&gt;new(GET =&gt; &quot;http://$user_preferences{ $UP_AT_HOST }/Apigetstatus.asp&quot;);
-    if ( $user_preferences{ $UP_AT_USERNAME } ) {
-      $atron_req-&gt;authorization_basic( $user_preferences{ $UP_AT_USERNAME }, $user_preferences{ $UP_AT_PASSWORD });
+    my $user_agent = get_ua();
+    if (! $atron_req) {
+        $atron_req = HTTP::Request-&gt;new(GET =&gt; &quot;http://$user_preferences{ $UP_AT_HOST }/Apigetstatus.asp&quot;);
+        if ( $user_preferences{ $UP_AT_USERNAME } ) {
+            $atron_req-&gt;authorization_basic( $user_preferences{ $UP_AT_USERNAME }, $user_preferences{ $UP_AT_PASSWORD });
+        }
     }
-  }
-
-  my %at_state;
-  my $res = $user_agent-&gt;request( $atron_req );
-  if (! $res-&gt;is_success) {
-    print STDERR $res-&gt;status_line, &quot;\n&quot;;
-    return \%at_state;
-
-  } else {
-
-    my @lines = split( &quot;\n&quot;, $res-&gt;content );
-    foreach (@lines) {
-      my ($line) = /^\s*(.*?)\s*$/;
-      next unless ($line);
-      next if ($line eq '[End Status]');
-      next if ($line eq '[Status]');
-      #    print &quot;$line\n&quot;;
-      my ($a1, $a2) = split('=', $line);
-      $a1 =~ /^\s*(.+?)\s*$/;
-      my $key = $1;
-      $a2 =~ /^\s*(.+?)\s*$/;
-      my $value = $1;
-      $at_state{ $key } = $value;
-    }
-    
-    if ( exists $at_state{ $AT_TITLE } ) {
+
+    my %at_state;
+    my $res = $user_agent-&gt;request( $atron_req );
+    if (! $res-&gt;is_success) {
+        print STDERR $res-&gt;status_line, &quot;\n&quot;;
+        return \%at_state;
+
+    } else {
+
+        my @lines = split( &quot;\n&quot;, $res-&gt;content );
+        foreach (@lines) {
+            my ($line) = /^\s*(.*?)\s*$/;
+            next unless ($line);
+            next if ($line eq '[End Status]');
+            next if ($line eq '[Status]');
+            #    print &quot;$line\n&quot;;
+            my ($a1, $a2) = split('=', $line);
+            $a1 =~ /^\s*(.+?)\s*$/;
+            my $key = $1;
+            $a2 =~ /^\s*(.+?)\s*$/;
+            my $value = $1;
+            $at_state{ $key } = $value;
+        }
+        
+        if ( exists $at_state{ $AT_TITLE } ) {
 #      print &quot;++++ was: $at_state{ $AT_TITLE }\n&quot;;
-      $at_state{ $AT_TITLE } =~ s/- \(\d+\)$//;
+            $at_state{ $AT_TITLE } =~ s/- \(\d+\)$//;
 #      print &quot;++++ now: $at_state{ $AT_TITLE }\n&quot;;
+        }
+        return \%at_state;
     }
-    return \%at_state;
-  }
 }
 
 sub get_ua {
 
-  if (! $user_agent) {
-    $user_agent = LWP::UserAgent-&gt;new;
-    $user_agent-&gt;agent( $0.'/'.$AS_CLIENT.'/'.$AS_CLIENT_VER );
-    $user_agent-&gt;from( 'kellyfmail-atronscrobbler@yahoo.com' );
-  }
-  return $user_agent;
+    if (! $user_agent) {
+        $user_agent = LWP::UserAgent-&gt;new;
+        $user_agent-&gt;agent( $0.'/'.$AS_CLIENT.'/'.$AS_CLIENT_VER );
+        $user_agent-&gt;from( 'kellyfmail-atronscrobbler@yahoo.com' );
+    }
+    return $user_agent;
 }
 
 # Check for or acquire an AS session
 sub as_session {
-  # we already have a session
-  if ( $as_submit_url ) {
-    return 1;
-  }
-
-  # We don't want to try too often for a session
-  my $time = time();
-  return if ( $time &lt; ( $as_last_session_time + $as_session_interval ) );
-  $as_last_session_time = $time;
-
-  if (! $as_req) {
-    $as_req = HTTP::Request-&gt;new(GET =&gt; &quot;http://post.audioscrobbler.com?hs=true&amp;p=1.1&amp;c=$AS_CLIENT&amp;v=$AS_CLIENT_VER&amp;u=$user_preferences{ $UP_AS_USERNAME }&quot; );
-  }
-    
-  print &quot;doing handshake...\n&quot;;
-  my $as_res = get_ua()-&gt;request( $as_req );
-  if (! $as_res-&gt;is_success) {
-    print STDERR $as_res-&gt;status_line, &quot;\n&quot;;
-    $as_session_interval = $as_session_interval ? $as_session_interval*2 : 10;
-    print &quot;will wait $as_session_interval before trying again\n&quot;;
-  } else {
-      
-    my @lines = split( &quot;\n&quot;, $as_res-&gt;content );
-    if ( $lines[0] =~ /^UPTODATE$/ ) {
-      $as_md5_challenge = $lines[1];
-      $as_submit_url = $lines[2];
-      ( $as_submit_interval ) = $lines[3] =~ /^INTERVAL (.*)$/;
-    } 
-    elsif ( $lines[0] =~ /^UPDATE (.*)$/ ) {
-      print &quot;HS MSG: Please update atronscrobbler. Visit $1\n&quot;;
-      $as_md5_challenge = $lines[1];
-      $as_submit_url = $lines[2];
-      ( $as_submit_interval ) = $lines[3] =~ /^INTERVAL (.*)$/;
+    # we already have a session
+    if ( $as_submit_url ) {
+        return 1;
     }
-    elsif ( $lines[0] =~ /^FAILED (.*)$/ ) {
-      print &quot;HS MSG: handshake failed, reason: $1\n&quot;;
-      ( $as_submit_interval ) = $lines[1] =~ /^INTERVAL (.*)$/;
-      $as_submit_url = undef;
-    }
-    elsif ( $lines[0] =~ /^BADUSER$/ ) {
-      print &quot;HS MSG: bad user\n&quot;;
-      ( $as_submit_interval ) = $lines[1] =~ /^INTERVAL (.*)$/;
-      $as_submit_url = undef;
+
+    # We don't want to try too often for a session
+    my $time = time();
+    return if ( $time &lt; ( $as_last_session_time + $as_session_interval ) );
+    $as_last_session_time = $time;
+
+    if (! $as_req) {
+        $as_req = HTTP::Request-&gt;new(GET =&gt; &quot;http://post.audioscrobbler.com?hs=true&amp;p=1.1&amp;c=$AS_CLIENT&amp;v=$AS_CLIENT_VER&amp;u=$user_preferences{ $UP_AS_USERNAME }&quot; );
     }
-    else {
-      print &quot;HS MSG: unknown response $lines[0]\n&quot;;
-      $as_submit_url = undef;
+    
+    print &quot;doing handshake...\n&quot;;
+    my $as_res = get_ua()-&gt;request( $as_req );
+    if (! $as_res-&gt;is_success) {
+        print STDERR $as_res-&gt;status_line, &quot;\n&quot;;
+        $as_session_interval = $as_session_interval ? $as_session_interval*2 : 10;
+        print &quot;will wait $as_session_interval before trying again\n&quot;;
+    } else {
+        
+        my @lines = split( &quot;\n&quot;, $as_res-&gt;content );
+        if ( $lines[0] =~ /^UPTODATE$/ ) {
+            $as_md5_challenge = $lines[1];
+            $as_submit_url = $lines[2];
+            ( $as_submit_interval ) = $lines[3] =~ /^INTERVAL (.*)$/;
+        } 
+        elsif ( $lines[0] =~ /^UPDATE (.*)$/ ) {
+            print &quot;HS MSG: Please update atronscrobbler. Visit $1\n&quot;;
+            $as_md5_challenge = $lines[1];
+            $as_submit_url = $lines[2];
+            ( $as_submit_interval ) = $lines[3] =~ /^INTERVAL (.*)$/;
+        }
+        elsif ( $lines[0] =~ /^FAILED (.*)$/ ) {
+            print &quot;HS MSG: handshake failed, reason: $1\n&quot;;
+            ( $as_submit_interval ) = $lines[1] =~ /^INTERVAL (.*)$/;
+            $as_submit_url = undef;
+        }
+        elsif ( $lines[0] =~ /^BADUSER$/ ) {
+            print &quot;HS MSG: bad user\n&quot;;
+            ( $as_submit_interval ) = $lines[1] =~ /^INTERVAL (.*)$/;
+            $as_submit_url = undef;
+        }
+        else {
+            print &quot;HS MSG: unknown response $lines[0]\n&quot;;
+            $as_submit_url = undef;
+        }
     }
-  }
-  return defined $as_submit_url;
+    return defined $as_submit_url;
 }
 
 sub send_update {
 
-  # nothing to do
-  return unless @artist_queue;
-
-  # no session, can't do anything
-  return unless as_session();
-
-  my $time = time();
-  # we have to respect AS's update interval
-  return if ( $time &lt; ( $as_last_submit_time + $as_submit_interval ) );
-  $as_last_submit_time = $time;
-
-  my $as_update = HTTP::Request-&gt;new( POST =&gt; $as_submit_url );
-  $as_update-&gt;content_type('application/x-www-form-urlencoded');
-  
-  my $md5_response = md5_hex(md5_hex( $user_preferences{ $UP_AS_PASSWORD } ).$as_md5_challenge);
-  my $content = 
-    'u='.as_encode( $user_preferences{ $UP_AS_USERNAME } ).'&amp;s='.as_encode( $md5_response );
-
-  my $max_idx = $#artist_queue &gt; 9 ? 9 : $#artist_queue;
-  my $log_msg;
-  for ( 0 .. $max_idx ) {
-    my $item = 
-      &quot;&amp;a[$_]=&quot;.as_encode( $artist_queue[ $_ ] ).
-	&quot;&amp;t[$_]=&quot;.as_encode( $title_queue[ $_ ] ).
-	  &quot;&amp;b[$_]=&quot;.
-	    &quot;&amp;m[$_]=&quot;.
-	      &quot;&amp;l[$_]=&quot;.as_encode( $total_time_queue[ $_ ] ).
-		&quot;&amp;i[$_]=&quot;.as_encode( $start_time_queue[ $_ ] );
-    $content .= $item;
-    $log_msg .= '  '.$artist_queue[ $_ ].' / '.$title_queue[ $_ ].&quot;\n&quot;;
-  }
+    # nothing to do
+    return unless @artist_queue;
+
+    # no session, can't do anything
+    return unless as_session();
+
+    my $time = time();
+    # we have to respect AS's update interval
+    return if ( $time &lt; ( $as_last_submit_time + $as_submit_interval ) );
+    $as_last_submit_time = $time;
+
+    my $as_update = HTTP::Request-&gt;new( POST =&gt; $as_submit_url );
+    $as_update-&gt;content_type('application/x-www-form-urlencoded');
     
-  $as_update-&gt;content( $content );
-
-  print &quot;submitting:&quot;;
-  print $log_msg;
-  my $as_res = get_ua()-&gt;request( $as_update );
-  if (! $as_res-&gt;is_success) {
-    print $as_res-&gt;status_line, &quot;\n&quot;;
-  } else {
-      
-    my @lines = split( &quot;\n&quot;, $as_res-&gt;content );
-    if ( $lines[0] =~ /^OK$/ ) {
-      print &quot;SBMT MSG: OK\n&quot;;
-      ( $as_submit_interval ) = $lines[1] =~ /^INTERVAL (.*)$/;
-      if ( $max_idx &lt; $#artist_queue ) {
-	@artist_queue = $artist_queue[ $max_idx+1 .. $#artist_queue ];
-	@title_queue = $title_queue[ $max_idx+1 .. $#artist_queue ];
-	@total_time_queue = $total_time_queue[ $max_idx+1 .. $#artist_queue ];
-	@start_time_queue = $start_time_queue[ $max_idx+1 .. $#artist_queue ];
-      } else {
-	@artist_queue = ();
-	@title_queue = ();
-	@total_time_queue = ();
-	@start_time_queue = ();
-      }
-    }
-    elsif ( $lines[0] =~ /^FAILED (.*)$/ ) {
-      print STDERR &quot;SBMT MSG: submit failed, reason: $1\n&quot;;
-      ( $as_submit_interval ) = $lines[1] =~ /^INTERVAL (.*)$/;
-      $as_submit_url = undef; # do another handshake
+    my $md5_response = md5_hex(md5_hex( $user_preferences{ $UP_AS_PASSWORD } ).$as_md5_challenge);
+    my $content = 
+        'u='.as_encode( $user_preferences{ $UP_AS_USERNAME } ).'&amp;s='.as_encode( $md5_response );
+
+    my $max_idx = $#artist_queue &gt; 9 ? 9 : $#artist_queue;
+    my $log_msg;
+    for ( 0 .. $max_idx ) {
+        my $item = 
+            &quot;&amp;a[$_]=&quot;.as_encode( $artist_queue[ $_ ] ).
+            &quot;&amp;t[$_]=&quot;.as_encode( $title_queue[ $_ ] ).
+            &quot;&amp;b[$_]=&quot;.
+            &quot;&amp;m[$_]=&quot;.
+            &quot;&amp;l[$_]=&quot;.as_encode( $total_time_queue[ $_ ] ).
+            &quot;&amp;i[$_]=&quot;.as_encode( $start_time_queue[ $_ ] );
+        $content .= $item;
+        $log_msg .= '  '.$artist_queue[ $_ ].' / '.$title_queue[ $_ ].&quot;\n&quot;;
     }
-    elsif ( $lines[0] =~ /^BADAUTH$/ ) {
-      print STDERR &quot;SBMT MSG: BADAUTH\n&quot;;
-      ( $as_submit_interval ) = $lines[1] =~ /^INTERVAL (.*)$/;
-      $as_submit_url = undef; # do another handshake
-    }
-    else {
-      print STDERR &quot;SBMT MSG: unknown response $lines[0]\n&quot;;
-      $as_submit_url = undef; # do another handshake
+    
+    $as_update-&gt;content( $content );
+
+    print &quot;submitting:&quot;;
+    print $log_msg;
+    my $as_res = get_ua()-&gt;request( $as_update );
+    if (! $as_res-&gt;is_success) {
+        print $as_res-&gt;status_line, &quot;\n&quot;;
+    } else {
+        
+        my @lines = split( &quot;\n&quot;, $as_res-&gt;content );
+        if ( $lines[0] =~ /^OK$/ ) {
+            print &quot;SBMT MSG: OK\n&quot;;
+            ( $as_submit_interval ) = $lines[1] =~ /^INTERVAL (.*)$/;
+            if ( $max_idx &lt; $#artist_queue ) {
+                @artist_queue = $artist_queue[ $max_idx+1 .. $#artist_queue ];
+                @title_queue = $title_queue[ $max_idx+1 .. $#artist_queue ];
+                @total_time_queue = $total_time_queue[ $max_idx+1 .. $#artist_queue ];
+                @start_time_queue = $start_time_queue[ $max_idx+1 .. $#artist_queue ];
+            } else {
+                @artist_queue = ();
+                @title_queue = ();
+                @total_time_queue = ();
+                @start_time_queue = ();
+            }
+        }
+        elsif ( $lines[0] =~ /^FAILED (.*)$/ ) {
+            print STDERR &quot;SBMT MSG: submit failed, reason: $1\n&quot;;
+            ( $as_submit_interval ) = $lines[1] =~ /^INTERVAL (.*)$/;
+            $as_submit_url = undef; # do another handshake
+        }
+        elsif ( $lines[0] =~ /^BADAUTH$/ ) {
+            print STDERR &quot;SBMT MSG: BADAUTH\n&quot;;
+            ( $as_submit_interval ) = $lines[1] =~ /^INTERVAL (.*)$/;
+            $as_submit_url = undef; # do another handshake
+        }
+        else {
+            print STDERR &quot;SBMT MSG: unknown response $lines[0]\n&quot;;
+            $as_submit_url = undef; # do another handshake
+        }
     }
-  }
 }
 
 sub as_encode {
-  my $value = shift;
-  $value =~ s/([^\w()'*~!.-])/sprintf '%%%02x', ord $1/eg;
-  return $value;
+    my $value = shift;
+    $value =~ s/([^\w()'*~!.-])/sprintf '%%%02x', ord $1/eg;
+    return $value;
 }
 
 sub load_user_config {
-  my $CF;
+    my $CF;
 
-  my $user_config = expand_tildes('~/.atronscrobbler');
+    my $user_config = expand_tildes('~/.atronscrobbler');
 #  print &quot;Expanded config is $user_config\n&quot;;
-  if (-e $user_config ) {
-    open ( $CF, $user_config ) or 
-      die &quot;could not read ~/.atronscrobbler: $!&quot;;
-    print &quot;reading ~/.atronscrobbler\n&quot;;
-    return parse_config( $CF );
-  } 
-  elsif (-e &quot;/etc/atronscrobbler&quot; ) {
-    open ( $CF, &quot;/etc/atronscrobbler&quot; ) or 
-      die &quot;could not read /etc/atronscrobbler: $!&quot;;
-    print &quot;reading /etc/atronscrobbler\n&quot;;
-    return parse_config( $CF );
-  }
-  else {
-    print &lt;&lt;&quot;config instructions&quot;;
-
-No config file found. Create a config file as either
-~/atronscrobbler or /etc/atronscrobbler. Include in it these values:
+    if (-e $user_config ) {
+        open ( $CF, $user_config ) or 
+            die &quot;could not read ~/.atronscrobbler: $!&quot;;
+        print &quot;reading ~/.atronscrobbler\n&quot;;
+        return parse_config( $CF );
+    } 
+    elsif (-e &quot;/etc/atronscrobbler&quot; ) {
+        open ( $CF, &quot;/etc/atronscrobbler&quot; ) or 
+            die &quot;could not read /etc/atronscrobbler: $!&quot;;
+        print &quot;reading /etc/atronscrobbler\n&quot;;
+        return parse_config( $CF );
+    }
+    else {
+        print &lt;&lt;&quot;config instructions&quot;;
+
+        No config file found. Create a config file as either
+            ~/atronscrobbler or /etc/atronscrobbler. Include in it these values:
 
 #
 # The audiotron_host is the host name or ip address of the audiotron. You
 # should be able to ping your audiotron using this address.
 #
-  audiotron_host = myatron
+            audiotron_host = myatron
 
 #
 # The audiotron may require a username and password. Enter them here:
 # If your audiotron does not require a username and password, leave
 # these blank.
 #
-  audiotron_username=
-  audiotron_password=
+            audiotron_username=
+            audiotron_password=
 #
 # AudioScrobber requires a username and password. Enter those here:
 # http://www.audioscrobbler.com
 #
-  audioscrobbler_username=
-  audioscrobbler_password=
-config instructions
-    return 0;
-  }
+            audioscrobbler_username=
+            audioscrobbler_password=
+            config instructions
+            return 0;
+    }
 }
-  
+
 sub parse_config {
-  my $CF = shift;
-  
-  while (&lt;$CF&gt;) {
-    chomp;                  # no newline
-    s/#.*//;                # no comments
-    s/^\s+//;               # no leading white
-    s/\s+$//;               # no trailing white
-    next unless length;     # anything left?
-    my ($var, $value) = split(/\s*=\s*/, $_, 2);
-    $user_preferences{ $var } = $value;
-  } 
-  
-  my $complete_config = 1;
-  foreach ( $UP_AT_HOST, $UP_AS_USERNAME, $UP_AS_PASSWORD ) {
-    if (! exists $user_preferences{ $_ } ) {
-      print STDERR &quot;Required configuration value not found: $_\n&quot;;
-      $complete_config = 0;
+    my $CF = shift;
+    
+    while (&lt;$CF&gt;) {
+        chomp;                  # no newline
+        s/#.*//;                # no comments
+        s/^\s+//;               # no leading white
+        s/\s+$//;               # no trailing white
+        next unless length;     # anything left?
+        my ($var, $value) = split(/\s*=\s*/, $_, 2);
+        $user_preferences{ $var } = $value;
+    } 
+    
+    my $complete_config = 1;
+    foreach ( $UP_AT_HOST, $UP_AS_USERNAME, $UP_AS_PASSWORD ) {
+        if (! exists $user_preferences{ $_ } ) {
+            print STDERR &quot;Required configuration value not found: $_\n&quot;;
+            $complete_config = 0;
+        }
     }
-  }
-  return $complete_config;
+    return $complete_config;
 }
 
 sub expand_tildes {
-  my $filename = shift;
-  $filename =~ s{^~([^/]*)}
+    my $filename = shift;
+    $filename =~ s{^~([^/]*)}
     { $1
-	? (getpwnam($1))[7]
-	  : ( $ENV{HOME} || $ENV{LOGDIR}
-	      || (getpwuid($&gt;))[7]
-	    )
-	}ex;
-  return $filename;
+          ? (getpwnam($1))[7]
+          : ( $ENV{HOME} || $ENV{LOGDIR}
+              || (getpwuid($&gt;))[7]
+          )
+    }ex;
+    return $filename;
 }</diff>
      <filename>atronscrobbler</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>de35a3d18eb520f6048a61ce4a9a81e1e97322cf</id>
    </parent>
  </parents>
  <author>
    <name>Kelly Felkins</name>
    <email>kelly@restlater.com</email>
  </author>
  <url>http://github.com/kellyfelkins/atronscrobbler/commit/01737cf59e538d96886a5a684cc9647af3988a3e</url>
  <id>01737cf59e538d96886a5a684cc9647af3988a3e</id>
  <committed-date>2009-02-25T12:25:05-08:00</committed-date>
  <authored-date>2009-02-25T12:25:05-08:00</authored-date>
  <message>reformat code removing tabs</message>
  <tree>7d8c383d099477d77a19633da9950623c46083ff</tree>
  <committer>
    <name>Kelly Felkins</name>
    <email>kelly@restlater.com</email>
  </committer>
</commit>
