Open
Conversation
Ivana-
reviewed
Sep 13, 2024
Ivana-
left a comment
There was a problem hiding this comment.
Виден прогресс в освоении Кложи, радует :)
| 0 (String. (byte-array text) "ISO-8859-1") | ||
| 1 (String. (byte-array text) "UTF-16") | ||
| 2 (String. (byte-array text) "UTF-16BE") | ||
| 3 (String. (byte-array text) "UTF-8") |
There was a problem hiding this comment.
Можно без дублирования (String. (byte-array text) (case id ...
|
|
||
| ; "TALB — Album" | ||
| (defmethod decode-frame :TALB | ||
| [data] |
There was a problem hiding this comment.
Больше дестракчеринга богу дестракчеринга:
[{:keys [enc-byte body] :as data}]
| $49 44 33 yy yy xx zz zz zz zz" | ||
| [header] | ||
| (let [[h1 h2 h3 yy1 yy2 _ zz1 zz2 zz3 zz4] header] | ||
| (and (every? true? (map = [\I \D \3] [h1 h2 h3])) |
There was a problem hiding this comment.
Я ошибаюсь, или это просто (= [\I \D \3] [h1 h2 h3]) == (= "ID3" (str h1 h2 h3)) ?
| body (map int (drop 1 all-body)) | ||
| header-size (+ 10 data-size)] | ||
| (lazy-seq (cons (decode-frame (zipmap [:id :size :enc-byte :body] | ||
| [(keyword (apply str id)) header-size enc-byte body])) |
There was a problem hiding this comment.
Вопрос вкуса, но имхо читаемее просто литерал мапы:
{:id (keyword (apply str id))
:size header-size
:enc-byte enc-byte
:body body}
| [header] | ||
| (let [flag-bit (int (nth header 5))] | ||
| (zipmap [:unsync :extended :exp :footer] | ||
| [(bit-test flag-bit 7) (bit-test flag-bit 6) (bit-test flag-bit 5) |
There was a problem hiding this comment.
Я за литерал мапы :)
(let [flag-bit (int (nth header 5))
bt #(bit-test flag-bit %)]
{:unsync (bt 7)
:extended (bt 6)
....
| (if errors | ||
| (apply println errors) | ||
| (let [what-to-show (set (keys (dissoc opts :filename))) | ||
| frames (:frames (id3/get-id3-header (:filename opts)))] |
| (if (empty? what-to-show) | ||
| (print (usage summary)) | ||
| (dorun (map #(println (string/join " - " %)) | ||
| (for [frame frames |
There was a problem hiding this comment.
Я за дестракчеринг:
(for [{:keys [id title body]} frames
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.