Skip to content

Commit

Permalink
update README, fix default group channel handling, see TODOs for next…
Browse files Browse the repository at this point in the history
… work
  • Loading branch information
jcdlbs committed Sep 16, 2022
1 parent 2334f0d commit 8a73b64
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 18 deletions.
7 changes: 2 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -263,14 +263,11 @@ Requires [Leiningen](https://leiningen.org/)

## Todo

- Add the ability to selectively push or pull any channel, group,
script, etc (this is in progress)
- Add granular extraction of scripts into their own files and merge
back into XML for pushing
- Gracefully handle renames and deletions

## License

Copyright © 2017-2021 Saga IT LLC
Copyright © 2017-2022 Saga IT LLC

Distributed under the Eclipse Public License either version 1.0 or any later version.

Expand Down
31 changes: 18 additions & 13 deletions src/mirthsync/apis.clj
Original file line number Diff line number Diff line change
Expand Up @@ -451,19 +451,24 @@


;; ************** TODO - deal with the duplication/ugliness
(defmethod mi/deconstruct-node :channels [{:keys [disk-mode] :as app-conf} file-path el-loc]
(case (int disk-mode)
1 (let [index-loc (mx/to-zip (slurp file-path))]
[[file-path (cdx/indent-str (cz/root (mx/add-update-child (cdzx/xml1-> index-loc :channels) el-loc)))]])
2 [[file-path (cdx/indent-str (cz/node el-loc))]]
(deconstruct-node
file-path
el-loc
(fn [el-loc]
(some (fn [[name script]]
(when-let [script-loc (script el-loc)]
[(name script-loc) script-loc]))
channel-deconstructors)))))
(defmethod mi/deconstruct-node :channels [{:keys [disk-mode] :as app-conf} ^String file-path el-loc]
;; handle default-group channels
(let [effective-disk-mode (if (and (= 1 disk-mode)
(not (.endsWith file-path (str File/separator "index.xml"))))
2
disk-mode)]
(case (int effective-disk-mode)
1 (let [index-loc (mx/to-zip (slurp file-path))]
[[file-path (cdx/indent-str (cz/root (mx/add-update-child (cdzx/xml1-> index-loc :channels) el-loc)))]])
2 [[file-path (cdx/indent-str (cz/node el-loc))]]
(deconstruct-node
file-path
el-loc
(fn [el-loc]
(some (fn [[name script]]
(when-let [script-loc (script el-loc)]
[(name script-loc) script-loc]))
channel-deconstructors))))))

(defmethod mi/deconstruct-node :code-templates [{:keys [disk-mode] :as app-conf} file-path el-loc]
(case (int disk-mode)
Expand Down

0 comments on commit 8a73b64

Please sign in to comment.