Difference between revisions of "Template:StreamLinkTable"
Stuiterveer (talk | contribs) (Switch example to HTTPS as well) |
m (trying and fix the HLS stream) |
||
Line 95: | Line 95: | ||
<th>{{#explode:languageVar|;|0}}</th> | <th>{{#explode:languageVar|;|0}}</th> | ||
{{#arraymap:{{{formats|WebM;.webm,HLS;.m3u8}}}|,|format| | {{#arraymap:{{{formats|WebM;.webm,HLS;.m3u8}}}|,|format| | ||
− | {{#arraymap:{{{types|HD;hd,SD;sd,Slides;slides}}}|,|type|<td>[{{{baseURL|https://cdn.c3voc.de/}}}{{#explode:stage|;|1}}{{#explode:languageVar|;|1}}{{#explode:type|;|1}}{{#explode:format|;|1}} link]</td>|}} | + | {{#arraymap:{{{types|HD;hd,SD;sd,Slides;slides}}}|,|type|<td>[{{{baseURL|https://cdn.c3voc.de/}}}{{#ifeq:{{#explode:format|;|0}}|HLS|hls/}}{{#explode:stage|;|1}}{{#explode:languageVar|;|1}}{{#explode:type|;|1}}{{#explode:format|;|1}} link]</td>|}} |
|}} | |}} | ||
Revision as of 14:46, 27 December 2017
Contents
synopsis
This is the "StreamLinkTable" template.
It will generate a table with various links derived from the stages
, languages
, formats
and types
.
It should be called in the following format (all parameters are optional):
{{StreamLinkTable |baseURL= |stages= |languages= |languageCount= |formats= |types= |typeCount= }}
parameters
The parameters all default to something useful for CCC and each has a specific syntax: baseURL
baseURL
: first common part of the link, defaults to https://cdn.c3voc.de/stages
: comma separated (,) list ofStage Label;urlPart
(note the semicolon ;), defaults to 3 × Stage n;snlanguages
: comma separated (,) list ofLanguage Label;urlPart
(note the semicolon ;), defaults to Native;_native_,Translated;_translated_languageCount
: number used for setting the correct table header span, set to reflect the amount of languages, defaults to 2formats
: comma separated (,) list ofFormat Label;urlPart
(note the semicolon ;), defaults to WebM;.webm,HLS;.m3u8types
: comma separated (,) list ofType Label;urlPart
(note the semicolon ;), defaults to HD;hd,SD;sd,Slides;slidestypeCount
: number used for setting the correct table header span, set to reflect the amount of types, defaults to 3
The links are generated as followed (always using the item part after the semicolon:
baseURL
+stage
(outer row)+language
(inner row)+type
(inner column)+format
(outer column), for example Stage 3 Native Slides as HLS will have the link: https://cdn.c3voc.de/s3_native_slides.m3u8
css
Note that for the best results, this table needs extra CSS in MediaWiki:Common.css:
/* CSS span table rowspan only showing the first row header (assuming there are 2 column headers stacked, hence +3) */ table.span tr>th.span2, table.span tr>th.span3, table.span tr>th.span4, table.span tr>th.span5 { display: none; } table.span tr:nth-of-type(2n+3)>th.span2, table.span tr:nth-of-type(3n+3)>th.span3, table.span tr:nth-of-type(4n+3)>th.span4, table.span tr:nth-of-type(5n+3)>th.span5 { display: table-cell; }
If it is not possible to have this CSS added, or you want to repeat every row header, make sure to set languageCount = 1
(or the table layout will break without the added CSS).
example
Edit the page to see how the following tables are generated:
The default is written like this:
{{StreamLinkTable}}
looks like this:
WebM | HLS | ||||||
---|---|---|---|---|---|---|---|
HD | SD | Slides | HD | SD | Slides | ||
Stage 1 | Native | link | link | link | link | link | link |
Stage 1 | Translated | link | link | link | link | link | link |
Stage 2 | Native | link | link | link | link | link | link |
Stage 2 | Translated | link | link | link | link | link | link |
Stage 3 | Native | link | link | link | link | link | link |
Stage 3 | Translated | link | link | link | link | link | link |
For a different set of stages, use this:
{{StreamLinkTable |stages=Main stage;stage1,Backup stage;stageb }}
to generate:
WebM | HLS | ||||||
---|---|---|---|---|---|---|---|
HD | SD | Slides | HD | SD | Slides | ||
Main stage | Native | link | link | link | link | link | link |
Main stage | Translated | link | link | link | link | link | link |
Backup stage | Native | link | link | link | link | link | link |
Backup stage | Translated | link | link | link | link | link | link |
For an extra set of languages, use this:
{{StreamLinkTable |languages=English;_eng_,German;_deu_,French;_fra_,Dutch;_ned_ |languageCount=4 }}
to generate:
WebM | HLS | ||||||
---|---|---|---|---|---|---|---|
HD | SD | Slides | HD | SD | Slides | ||
Stage 1 | English | link | link | link | link | link | link |
Stage 1 | German | link | link | link | link | link | link |
Stage 1 | French | link | link | link | link | link | link |
Stage 1 | Dutch | link | link | link | link | link | link |
Stage 2 | English | link | link | link | link | link | link |
Stage 2 | German | link | link | link | link | link | link |
Stage 2 | French | link | link | link | link | link | link |
Stage 2 | Dutch | link | link | link | link | link | link |
Stage 3 | English | link | link | link | link | link | link |
Stage 3 | German | link | link | link | link | link | link |
Stage 3 | French | link | link | link | link | link | link |
Stage 3 | Dutch | link | link | link | link | link | link |