   [index]
   (split-lines (:out (apply sh (flatten (conj (list index) iplayer-info))))))
 
+(defn get-download-modes
+  "build list of possible download-modes for a given index."
+  [lst]
+  (let [modes (first (filter #(re-find #"modes.*" %) lst))]
+    (remove nil? (list (re-find #"flashhigh" modes)
+                       (re-find #"flashvhigh" modes)
+                       (re-find #"flashhd" modes)
+                       (re-find #"flashlow" modes)))))
+
 (defn load-thumbandinfo-for-index
   "grep url for thumbnail size44, title and description
    for entered index."

  (:out (apply sh (flatten
                   (conj (list search-title) iplayer-command)))))



(defn iplayer-search
  "run external command with given args list."
  [search-title]
  (let [result (iplayer-search-resultstring search-title)]
    (if (old-recordings? (split-lines result))
      (split-lines (subs result (.indexOf result delete-string)))
      (split-lines result))))


(defn search-categories
  "search iplayer for a given category"

(defn iplayer-download-command
  "concatenate index and mode to download command"
   [index mode]
   (list "get-iplayer" (apply str "modes=" mode "1\"")
         "output=\"$HOME/Videos\"" "-g" index)) 

(defn get-url
  "return /info url string concatenated with index"
