-
Notifications
You must be signed in to change notification settings - Fork 15
homework-10-ataranchiev #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Виден прогресс в освоении Кложи, радует :)
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Можно без дублирования (String. (byte-array text) (case id ...
|
||
; "TALB — Album" | ||
(defmethod decode-frame :TALB | ||
[data] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Больше дестракчеринга богу дестракчеринга:
[{: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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Я ошибаюсь, или это просто (= [\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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Вопрос вкуса, но имхо читаемее просто литерал мапы:
{: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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Я за литерал мапы :)
(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)))] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Я за тред-макросы :)
(if (empty? what-to-show) | ||
(print (usage summary)) | ||
(dorun (map #(println (string/join " - " %)) | ||
(for [frame frames |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Я за дестракчеринг:
(for [{:keys [id title body]} frames
No description provided.