spec.asciidoc 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. = Radiomanifest specification
  2. CiurmaPirata
  3. Un formato per fare sì che il sito di una radio possa esporre in maniera strutturata alcune informazioni sul
  4. suo sito.
  5. Tali informazioni sono, brevemente:
  6. * il palinsesto
  7. * l'elenco delle trasmissioni che vanno in onda in modo regolare, e per ciascuna di esse i principali feed
  8. * gli indirizzi di streaming
  9. Per permettere un'implementazione più semplice, ciascuna di queste informazioni segue una sua specifica, possibilmente appoggiandosi a specifiche già esistenti.
  10. == RadioManifest
  11. Al fine di avere un singolo punto in cui "esporre" le funzionalità supportate dal sito web, un sito può creare un manifest. Esso *DOVREBBE* (*SHOULD*) chiamarsi sempre ``${BASEURL}/radiomanifest.xml``.
  12. Ecco un esempio di xml:
  13. <?xml version="1.0" encoding="UTF-8" ?>
  14. <radio-manifest>
  15. <schedule src="https://www.radioexample.org/palinsesto.ics" />
  16. <streaming>
  17. <source name="hi-quality" priority="100" src="https://www.radioexample.org/stream.m3u" />
  18. <source name="lo-quality" priority="50" src="https://www.radioexample.org/stream-low.m3u" />
  19. </streaming>
  20. <shows src="https://www.radioexample.org/shows.xml" />
  21. <feed src="https://www.radioexample.org/all.xml" />
  22. </radio-manifest>
  23. (link:radio-manifest.xsd[Schema XSD])
  24. Ovvero:
  25. * 0 o 1 ``schedule``. Gli schedule sono definiti in link:https://icalendar.org/RFC-Specifications/iCalendar-RFC-5545/[formato iCalendar]
  26. * 0 o 1 oggetti ``streaming``; contengono un qualsiasi numero (almeno 1) di source, le quali
  27. ** *POSSONO* avere un campo ``name``. Il campo ``name`` è fortemente
  28. raccomandato se viene fornito più di un oggetto ``streaming``
  29. ** *DEVONO* avere un campo ``src``, il quale deve puntare ad una risorsa di tipo M3U.
  30. ** *POSSONO* avere un campo ``priority``, contenente un valore intero; se omesso, si assume il valore "1". Un numero più grande indica una
  31. maggiore importanza. Il campo ``priority`` serve a definire l'ordinamento con cui i client *DOVREBBERO*
  32. mostrare le playlist agli utenti, o a definire quale playlist vada usata, se il client sceglie automaticamente
  33. senza proporrere all'utente. Il valore della priority è relativo alle altre source, non si riferisce ad altre
  34. radio. Valori di priority minori di zero indicano che la source non dovrebbe essere resa visibile all'utente
  35. in condizioni normali.
  36. * 0 o 1 oggetti ``shows``. Il campo ``src`` *DEVE* puntare ad una risorsa di formato _shows_ (vedi di
  37. seguito).
  38. * 0 o 1 ``feed``. Il campo ``src`` *DEVE* puntare ad una risorsa di tipo feed.
  39. ### Implementazione client
  40. Un client dovrebbe chiedere all'utente di fornire l'indirizzo base di un sito. Il manifest dovrebbe essere
  41. rintracciabile andando all'indirizzo ``radiomanifest.xml`` relativo all'indirizzo di un sito.
  42. Ad esempio, se l'utente inserisce "http://hosting.com/myradio/" il manifest *DEVE* essere cercato all'indirizzo
  43. "http://hosting.com/myradio/radiomanifest.xml"
  44. Quando un client vuole suonare lo streaming associato ad un radiomanifest, esso potrebbe voler mostrare
  45. all'utente la scelta tra le varie source, oppure decidere automaticamente.
  46. Se il client sceglie automaticamente:
  47. * *DEVE* rispettare l'ordinamento delle priority.
  48. * *DEVE* escludere le source con priority minore di zero.
  49. * Qualora la riproduzione della source dovesse avere problemi, *DOVREBBE* passare alla successiva
  50. * Se alcune source hanno uguale priority, *DOVREBBE* scegliere casualmente tra di esse
  51. Se il client fa scegliere l'utente:
  52. * *DEVE* rispettare l'ordinamento delle priority
  53. * *DOVREBBE* omettere le source con priority minore di zero.
  54. == Schedule
  55. The goal of the schedule is to express the typical weekly table that is commonly found in radio websites. It is an iCalendar file. Each show should be a distinct ``VEVENT``.
  56. The schedule *SHOULD* include at least events up until 1 week
  57. The schedule *SHOULD* use recurrency rule where appropriate, so that the user is informed of this.
  58. == Shows
  59. The goal of the shows file is to:
  60. * list shows
  61. * provide useful metadata for each show, such as:
  62. ** dedicated feed
  63. ** link to specialized page for the show
  64. The syntax tries to be compatible with link:http://pyxml.sourceforge.net/topics/xbel/[XBEL], a bookmark
  65. format. While this format has not seen extensive usage in the latest years, it's still valuable to reuse
  66. someone else work instead of reinventing the wheel.
  67. Here is an example:
  68. <?xml version="1.0" encoding="UTF-8"?>
  69. <xbel version="1.0"
  70. xmlns:show="https://radiomanifest.degenerazione.xyz/v0.2/shows/"
  71. >
  72. <bookmark href="http://radioexample.com/shows/learn-cook">
  73. <title>Learn to cook in C++</title>
  74. <info>
  75. <metadata owner="https://radiomanifest.degenerazione.xyz/">
  76. <show:name>Learn to cook in C++</show:name>
  77. <show:id>learn-C++</show:id>
  78. <show:description>A podcast about C++, templates, and nouvelle cuisine</show:description>
  79. <show:website>http://radioexample.com/shows/learn-cook</show:website>
  80. <show:feed>http://radioexample.com/shows/learn-cook/feed</show:feed>
  81. <show:schedule>http://radioexample.com/shows/learn-cook.ics</show:schedule>
  82. </metadata>
  83. </info>
  84. </bookmark>
  85. <folder>
  86. <title>Information</title>
  87. <bookmark href="http://radioexample.com/shows/learn-cook">
  88. <title>Uncensored information</title>
  89. <info>
  90. <metadata owner="https://radiomanifest.degenerazione.xyz/">
  91. <show:name>Uncensored information</show:name>
  92. <show:id>uncensored</show:id>
  93. <show:description>News, news & more news</show:description>
  94. <show:website>http://radioexample.com/shows/uncensored</show:website>
  95. <show:feed type="application/rss+xml">http://radioexample.com/shows/uncensored/feed</show:feed>
  96. <show:schedule type="text/calendar">http://radioexample.com/shows/uncensored.ics</show:schedule>
  97. <show:schedule type="application/calendar+json">http://radioexample.com/shows/uncensored.json</show:schedule>
  98. </metadata>
  99. </info>
  100. </bookmark>
  101. </folder>
  102. </xbel>
  103. (XXX: Schema XSD is yet to be written)
  104. Only ``show:name`` is required, though parsers are invited to apply the Postel law and read the parent
  105. ``title`` element.
  106. The ``type`` attribute is available for ``show:feed`` and ``show:schedule``; it defines the mime type of the
  107. resource, so that in the future different formats can be used. Right now, the default is
  108. ``application/rss+xml`` for ``show:feed`` and ``text/calendar`` for ``show:schedule``.
  109. ``show:feed`` and ``show:schedule`` can be present multiple times; When this happens, the semantic is that
  110. those files are equivalent, and can be considered different formats for the same data. The example shows
  111. exactly this: here, the producer is providing the same calendar in both ICS and
  112. link:https://tools.ietf.org/id/draft-kewisch-et-al-icalendar-in-json-00.html#RFC6321[jCal].
  113. XBEL supports folders, and we want to be XBEL-compatible. However, the parser is free to flatten the folder
  114. structure if they so prefer. In this case, they should use depth-first order when presenting the content to
  115. the user. We encourage producers not to rely on the fact that the user will be able to use a tree-like
  116. navigation.
  117. === Relationship with schedule
  118. It's pretty clear that in many cases ``shows.xml`` and ``schedule.ics`` will benefit from being linked. How to
  119. do that? For every event in the schedule, apply this rules:
  120. 1. If the VEVENT has a ``X-SHOW-ID`` field, see if a show with the same ``<show:id>`` exists
  121. 2. If the VEVENT has a ``CATEGORIES`` field, see, for all categories, if a show has the same ``<show:id>``
  122. 3. If the VEVENT has a ``SUMMARY``, see if there is a show with the same ``<show:name>``
  123. If any of this rule has a match, the event in the calendar belongs to that show.
  124. == Implementation details
  125. === HTTP Implementation
  126. Clients:
  127. - *MUST* provide an ``Accept`` header in every HTTP request. This will enable maximum flexibility in the
  128. future, allowing clients and servers to smoothly move to new file formats
  129. Servers:
  130. - *MUST* implement CORS adequately. Every file related to this specification must be retrievable by a browser
  131. on a different domain via a `GET`.
  132. == Casi d'uso
  133. === Player
  134. Supponiamo di voler realizzare un player di radio con feature avanzate, che sia però portabile su molte radio.
  135. Data una lista di URL di siti web, è possibile fare un player che:
  136. * supporti vari indirizzi di streaming in modo trasparente per l'utente
  137. * permetta all'utente di scegliere il tipo di streaming, ad esempio se la radio fornisce streaming di diversa
  138. qualità
  139. * possa dire all'utente informazioni utili sul palinsesto della radio che sta ascoltando
  140. * permetta di puntare allo storico, o di andare rapidamente alla pagina della trasmissione che sta
  141. ascoltando.
  142. Come capita spesso, questo può essere applicato anche alla scrittura di app che supportino molte radio, senza che però esse debbano essere limitate al solo streaming come è il caso attualmente (vedi le varie Transistor, RadioDroid, ecc.)
  143. === Radio automation
  144. Se un radio automation (della radio A) vuole importare contenuti da un'altra radio B, esso può facilmente
  145. fornire all'utente della radio A utili informazioni. Ad esempio, permette di vedere il palinsesto in forma
  146. grafica, selezionare uno show, vedere un'anteprima del feed corrispondente, quindi importarlo in una specifica
  147. fascia oraria.
  148. === radio-browser++
  149. https://www.radio-browser.info/ fornisce molte info utili su delle radio. Grazie a radio-manifest, sarebbe più semplice:
  150. * mantenere le informazioni in modo più semplice; finché una radio mantiene lo stesso sito web, può aggiornare la lista di url di streaming in modo automatico
  151. * più informazioni; radio-browser potrebbe includere le informazioni dettagliate disponibili tramite ``<schedule>`` e ``<shows>`` per fornire informazioni aggiuntive.
  152. === RadioDroid++
  153. RadioDroid is a fine Android app to listen to stream. We'd like to have an improved version of RadioDroid that
  154. also includes features that RadioManifest provide. See the _Player_ use case.