(executable
 (name meta)
 (modules meta)
 (libraries str metadata))

(executable
 (name artist_title)
 (modules artist_title)
 (libraries str metadata))

(executable
 (name basic)
 (modules basic)
 (libraries metadata))

(executable
 (name dump)
 (modules dump)
 (libraries metadata))

(executable
 (name mimetype)
 (modules mimetype)
 (libraries metadata))

(executable
 (name test)
 (modules test)
 (optional)
 (libraries metadata))

(rule
 (alias citest)
 (deps
  test.mp3
  test.png
  test.jpg
  test.avi
  test.mp4
  ; test.mkv
  ; test.webm
  test.wav
  (glob_files id3v2/*.mp3))
 (action
  (progn
   (run ./basic.exe)
   (run ./test.exe)
   (run ./artist_title.exe %{deps})
   (run ./meta.exe %{deps}))))

(rule
 (target test.mp3)
 (action
  (run
   ffmpeg
   -f
   lavfi
   -i
   "sine=frequency=440:sample_rate=44100:duration=10"
   -f
   mp3
   -write_id3v1
   true
   -metadata
   "title=The title"
   -metadata
   "artist=The artist"
   -metadata
   "album=The album"
   test.mp3)))

(rule
 (target test.wav)
 (action
  (run
   ffmpeg
   -f
   lavfi
   -i
   "sine=frequency=440:sample_rate=44100:duration=10"
   -f
   wav
   -metadata
   "title=The title"
   -metadata
   "artist=The artist"
   -metadata
   "album=The album"
   test.wav)))

(rule
 (target test.png)
 (action
  (run
   ffmpeg
   -f
   lavfi
   -i
   color=size=320x240:color=blue
   -vf
   "drawtext=fontsize=30:fontcolor=white:x=(w-text_w)/2:y=(h-text_h)/2:text=Testing"
   -metadata
   "title=The title"
   -metadata
   "artist=The artist"
   -frames:v
   1
   test.png)))

(rule
 (target test.jpg)
 (action
  (run
   ffmpeg
   -f
   lavfi
   -i
   color=size=320x240:color=blue
   -vf
   "drawtext=fontsize=30:fontcolor=white:x=(w-text_w)/2:y=(h-text_h)/2:text=Testing"
   -frames:v
   1
   test.jpg)))

(rule
 (target test.avi)
 (action
  (run
   ffmpeg
   -f
   lavfi
   -i
   testsrc=duration=1:size=640x480:rate=25
   -metadata
   "title=The title"
   -metadata
   "artist=The artist"
   -metadata
   "year=2022"
   test.avi)))

(rule
 (target test.mp4)
 (action
  (run
   ffmpeg
   -f
   lavfi
   -i
   testsrc=duration=1:size=640x480:rate=25
   -metadata
   "title=The title"
   -metadata
   "artist=The artist"
   -metadata
   "year=2022"
   test.mp4)))

(rule
 (target test.mkv)
 (action
  (run
   ffmpeg
   -f
   lavfi
   -i
   testsrc=duration=1:size=640x480:rate=25
   -metadata
   "title=The title"
   -metadata
   "artist=The artist"
   -metadata
   "year=2022"
   test.mkv)))

(rule
 (target test.webm)
 (action
  (run
   ffmpeg
   -f
   lavfi
   -i
   testsrc=duration=1:size=640x480:rate=25
   -metadata
   "title=The title"
   -metadata
   "artist=The artist"
   -metadata
   "year=2022"
   test.webm)))
