mp3-tag.lisp 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. ;;; -*- Mode: Lisp; show-trailing-whitespace: t; Base: 10; indent-tabs: nil; Syntax: ANSI-Common-Lisp; Package: MP3-TAG; -*-
  2. ;;; Copyright (c) 2013, Mark VandenBrink. All rights reserved.
  3. (in-package #:mp3-tag)
  4. (defmethod album ((me mp3-file-stream))
  5. (let ((ret)
  6. (f (get-frame-info me (ecase (version (mp3-header me)) (2 "TAL") (3 "TALB") (4 "TALB")))))
  7. (if (not f)
  8. (if (v21-tag-header (mp3-header me))
  9. (setf ret (album (v21-tag-header (mp3-header me)))))
  10. (setf ret (info f)))
  11. ret))
  12. (defmethod artist ((me mp3-file-stream))
  13. (let ((f (get-frame-info me (ecase (version (mp3-header me)) (2 "TP1") (3 "TPE1") (4 "TPE1")))))
  14. (if f
  15. (info f)
  16. nil)))
  17. (defmethod album-artist ((me mp3-file-stream)) nil)
  18. (defmethod comment ((me mp3-file-stream)) nil)
  19. (defmethod composer ((me mp3-file-stream)) nil)
  20. (defmethod copyright ((me mp3-file-stream)) nil)
  21. (defmethod year ((me mp3-file-stream)) nil)
  22. (defmethod encoder ((me mp3-file-stream)) nil)
  23. (defmethod groups ((me mp3-file-stream)) nil)
  24. (defmethod lyrics ((me mp3-file-stream)) nil)
  25. (defmethod purchased-date ((me mp3-file-stream)) nil)
  26. (defmethod title ((me mp3-file-stream)) nil)
  27. (defmethod tool ((me mp3-file-stream)) nil)
  28. (defmethod writer ((me mp3-file-stream)) nil)
  29. (defmethod compilation ((me mp3-file-stream)) nil)
  30. (defmethod disk ((me mp3-file-stream)) nil)
  31. (defmethod tempo ((me mp3-file-stream)) nil)
  32. (defmethod genre ((me mp3-file-stream)) nil)
  33. (defmethod track ((me mp3-file-stream)) nil)
  34. (defmethod show-tags ((me mp3-file-stream) &key (raw nil))
  35. "Show the tags for an mp3-file"
  36. (if raw
  37. (format t "~a:~a~%" (stream-filename me) (mp3-frame:vpprint (audio-streams:mp3-header me) nil))
  38. (let ((album (album me))
  39. (album-artist (album-artist me))
  40. (artist (artist me))
  41. (comment (comment me))
  42. (compilation (compilation me))
  43. (composer (composer me))
  44. (copyright (copyright me))
  45. (disk (disk me))
  46. (encoder (encoder me))
  47. (genre (genre me))
  48. (groups (groups me))
  49. (lyrics (lyrics me))
  50. (purchased-date (purchased-date me))
  51. (tempo (tempo me))
  52. (title (title me))
  53. (tool (tool me))
  54. (track (track me))
  55. (writer (writer me))
  56. (year (year me)))
  57. (format t "~a~%" (stream-filename me))
  58. (when album (format t "~4talbum: ~a~%" album))
  59. (when album-artist (format t "~4talbum-artist: ~a~%" album-artist))
  60. (when artist (format t "~4tartist: ~a~%" artist))
  61. (when comment (format t "~4tcomment: ~a~%" comment))
  62. (format t "~4tcompilation: ~a~%" compilation)
  63. (when composer (format t "~4tcomposer: ~a~%" composer))
  64. (when copyright (format t "~4tcopyright: ~a~%" copyright))
  65. (when disk (format t "~4tdisk: ~a~%" disk))
  66. (when encoder (format t "~4tencoder: ~a~%" encoder))
  67. (when genre (format t "~4tgenre: ~a~%" genre))
  68. (when groups (format t "~4tgroups: ~a~%" groups))
  69. (when lyrics (format t "~4tlyrics: ~a~%" lyrics))
  70. (when purchased-date (format t "~4tpurchased date: ~a~%" purchased-date))
  71. (when tempo (format t "~4ttempo: ~a~%" tempo))
  72. (when title (format t "~4ttitle: ~a~%" title))
  73. (when tool (format t "~4ttool: ~a~%" tool))
  74. (when track (format t "~4ttrack: ~a~%" track))
  75. (when writer (format t "~4twriter: ~a~%" writer))
  76. (when year (format t "~4tyear: ~a~%" year)))))