aboutsummaryrefslogtreecommitdiff
path: root/examples/settitle.scm
blob: cd431067c645ec31d92e483ba898b26ca6613bce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
;; title.scm - set title (TIT2) frame based on the file name.
;; Copyright (C) 2011 Sergey Poznyakoff
;; License GPLv3+: GNU GPL version 3 or later
;;  <http://gnu.org/licenses/gpl.html>
;; This is free software: you are free to change and redistribute it.
;; There is NO WARRANTY, to the extent permitted by law.

(use-modules (ice-9 regex)
	     (srfi srfi-13))

(define (idest-main file frames)
  (cond
   ((string-match "(.*)\\.mp3" file) =>
    (lambda (match)
      (cons
       (cons "TIT2"
	     (list
	      (cons
	       'text
	       (string-map
		(lambda (c)
		  (if (char=? c #\_) #\space c))
		(match:substring match 1)))))
       ;;
       (filter
	(lambda (elt)
	  (not (string=? (car elt) "TIT2")))
	frames))))
   (else
    #f)))

(set! idest-readonly #f)

Return to:

Send suggestions and report system problems to the System administrator.