un modèle pour afficher <touteslesmusiques|>

This commit is contained in:
chankalan 2022-10-04 15:55:59 +02:00
parent 8be7239fd2
commit 574fcd5ce9
2 changed files with 35 additions and 2 deletions

View File

@ -46,7 +46,7 @@ function libreavous_duree($start,$end) {
$timeend = new DateTime($end); $timeend = new DateTime($end);
$timeduree = $timestart->diff($timeend); $timeduree = $timestart->diff($timeend);
$duree = $timeduree->format('%h h %i min. %s s.'); $duree = $timeduree->format('%h h %i min. %s s.');
return $duree; return $duree;
} }
@ -59,7 +59,7 @@ function libreavous_duree_podcast($start,$end) {
$timeend = new DateTime($end); $timeend = new DateTime($end);
$timeduree = $timestart->diff($timeend); $timeduree = $timestart->diff($timeend);
$duree = $timeduree->format('%H:%I:%S'); $duree = $timeduree->format('%H:%I:%S');
return $duree; return $duree;
} }
@ -87,3 +87,19 @@ function libreavous_aveczerod($chaine) {
} }
return $chaineaveczero; return $chaineaveczero;
} }
// renvoie $chaine seulement si $chaine commence par http
function libreavous_sihttp($chaine) {
if (preg_match('/media.april.org/',$chaine)) {
return $chaine;
}
}
// renvoie $chaine seulement si $chaine commence par #EXTINF
// et retire le debut indesirable
function libreavous_siextinf($chaine) {
if (preg_match('/^#EXTINF/',$chaine)) {
$pattern = '/^#EXTINF(.*),/';
$replace = preg_replace($pattern, '', $chaine);
return $replace;
}
}

View File

@ -0,0 +1,17 @@
<div class="liste articles playlist">
<B_playlist>
<ul>
[(#REM) on cherche toutes les musiques ecoutees sur libreavous.org dans la playlist ]
<BOUCLE_playlist(DATA){source file, https://media.april.org/audio/radio-cause-commune/libre-a-vous/emissions/musiques/libre-a-vous.m3u}>
[<li>
<strong>(#VALEUR|libreavous_siextinf)</strong><br />]
[<a href="#VALEUR">(#VALEUR|libreavous_sihttp|basename)</a>
</li>]
</BOUCLE_playlist>
</ul>
</B_playlist>
</div>