audiogenerators.rst 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. Audiogenerators
  2. ===============
  3. mpd
  4. ---------
  5. picks ``howmany`` song randomly from your mpd library. It follows this
  6. strategy: it picks ``howmany`` artists from your MPD library, then picks a random song for each one
  7. if you specify a ``prefix``, then only files inside the ``prefix`` directory
  8. will be picked.
  9. randomdir
  10. ----------
  11. Given a directory ``path``, scan it recursively, then picks ``howmany`` random
  12. files. Only files whose filename ends in mp3/ogg/oga/wav are considered . Files are copied to ``TMPDIR`` before being returned.
  13. static
  14. ---------
  15. That simple: every element in ``paths`` is returned. Before doing so, they are
  16. copied to ``TMPDIR``.
  17. http
  18. ---------
  19. Given a sequence of ``urls``, downloads each one and enqueue it.
  20. This is **not** suitable for streams (a fundamental limitation of larigira),
  21. only for audio files.
  22. mostrecent
  23. -------------
  24. It is similar to randomdir, but instead of picking randomly, picks the most
  25. recent file (according to the ctime).
  26. podcast
  27. ------------
  28. This is probably the most powerful generator that comes included with
  29. ``larigira``. To use this generator, you would need to have a valid podcast
  30. URL. Beware, here the world *podcast* refer to its very specific meaning of
  31. an xml-based format which resembles a RSS feed but has more media-specific
  32. entities. See `this specification
  33. <https://github.com/simplepie/simplepie-ng/wiki/Spec:-iTunes-Podcast-RSS>`_ for
  34. more technical details.
  35. So, if you have a valid podcast URL, larigira can look at it, extract audios,
  36. download and play the most recent one. Here are some typical usecases for this:
  37. * You want to play replica based on what you host on your radio's website.
  38. * You want to play some audio from some other radio (or other kind of podcast
  39. source)
  40. The podcast form has many many options, but I promise you that 90% of the cases
  41. are easily solved using ONLY the first option: enter the URL of the podcast
  42. and... it works!
  43. So, what are all the other options for? Well, to cover some other use cases.
  44. For example, let's say that at night you want to play a *random* show (not the
  45. last one, which is the default) that happened on your radio. Then you can
  46. change the "sort by" to be "random". Easy, right?
  47. Another typical usecase is selecting an audio that has a duration which "fits"
  48. with the schedule of your radio: not too long and not too short. You can do
  49. that with the "min len" and "max len" fields. For example, setting a `min_len`
  50. of `30min` and `max_len` of `1h15m` you can avoid picking flash news (too
  51. short) and very long shows.
  52. You can do many other things with its options, but I left those to your
  53. immagination. Let's just clarify the workflow:
  54. * the podcast URL is fetched and audio information is retrieved
  55. * filter: audios are filtered by min/max length
  56. * sort: audios are sorted according to `sort_by` and `reverse`
  57. * select: the n-th episode is fetched, according to `start` field
  58. script
  59. --------
  60. see :doc:`audiogenerators-write`