/**
  * Converts query response from HTTP API to a list of Movie objects. Each row must return the
  * following attributes in the following order:
  *
  * <ol>
  *   <li><code>idMovie</code>
  *   <li><code>c00</code> (title)
  *   <li><code>c07</code> (year)
  *   <li><code>strPath</code>
  *   <li><code>strFileName</code>
  *   <li><code>c15</code> (director)
  *   <li><code>c11</code> (runtime)
  *   <li><code>c14</code> (genres)
  *   <li><code>c05</code> (rating)
  * </ol>
  *
  * @param response
  * @return List of movies
  */
 private ArrayList<Movie> parseMovies(String response) {
   ArrayList<Movie> movies = new ArrayList<Movie>();
   String[] fields = response.split("<field>");
   try {
     for (int row = 1; row < fields.length; row += 10) {
       movies.add(
           new Movie( // int id, String title, int year, String path, String filename, String
               // director, String runtime, String genres, Double rating, int numWatched
               Connection.trimInt(fields[row]),
               Connection.trim(fields[row + 1]),
               Connection.trimInt(fields[row + 2]),
               Connection.trim(fields[row + 3]),
               Connection.trim(fields[row + 4]),
               Connection.trim(fields[row + 5]),
               Connection.trim(fields[row + 6]),
               Connection.trim(fields[row + 7]),
               Connection.trimDouble(fields[row + 8]),
               Connection.trimInt(fields[row + 9])));
     }
   } catch (Exception e) {
     System.err.println("ERROR: " + e.getMessage());
     System.err.println("response = " + response);
     e.printStackTrace();
   }
   return movies;
 }