Save in exceptions
This commit is contained in:
parent
e5d613360b
commit
bfabf33842
@ -1,4 +1,4 @@
|
|||||||
1,google.com
|
1,google.com,true
|
||||||
2,youtube.com
|
2,youtube.com,false
|
||||||
4,tmall.com
|
4,tmall.com,nil
|
||||||
5,idecrea.es
|
5,idecrea.es,nil
|
|
@ -26,10 +26,17 @@
|
|||||||
(defn -main
|
(defn -main
|
||||||
[& args]
|
[& args]
|
||||||
(let [;; Name of the file containing the CSV with the domains
|
(let [;; Name of the file containing the CSV with the domains
|
||||||
file-csv "top-1m-test.csv"
|
file-csv "top-1m-test.csv"
|
||||||
;; List with domains
|
;; Get domains from CSV
|
||||||
domains (read-csv-domains file-csv)
|
domains-csv (vec (read-csv-domains file-csv))
|
||||||
;; List with domains with a boolean indicating if it is generate or not in WordPress
|
;; Filters leaving those that have not been checked
|
||||||
domains-checks (doall (vec (map #(conj % (wordpress? (get % 1))) domains)))]
|
domains-unchecked (filter #(= (get % 2) "nil") domains-csv)]
|
||||||
;; Save domains to CSV
|
(def mod-domains-csv domains-csv)
|
||||||
(save-csv-domains file-csv domains-checks)))
|
;; List with domains with a boolean indicating if it is generate or not in WordPress
|
||||||
|
(doseq [domain-data domains-unchecked] (let [domain (get domain-data 1)
|
||||||
|
;; Check if domain it is generate or not in WordPress
|
||||||
|
check-wordpress (wordpress? domain)]
|
||||||
|
;; Edit domains-csv with check WordPress
|
||||||
|
(def mod-domains-csv (map #(-> (if (= domain (get % 1)) (assoc % 2 (str check-wordpress)) %)) mod-domains-csv))
|
||||||
|
;; Save domains to CSV
|
||||||
|
(save-csv-domains file-csv mod-domains-csv)))))
|
||||||
|
Loading…
Reference in New Issue
Block a user