if ($partition) {
$partition = $partition->getUrl();
}
- $lyrics_html = ';)';
$lyrics_doc = $song->getFirstMediaInField('lyrics_doc');
if ($lyrics_doc) {
- $path = $lyrics_doc->getPath();
- $html_path = $path . '.html';
- if (!file_exists($html_path)) {
- `libreoffice --convert-to HTML:HTML --outdir $html_path $path`;
+ $path = new \SplFileInfo($lyrics_doc->getPath());
+ $html_path = $path->getPath() . '/html';
+ $htmlFile = $html_path . '/' . $path->getBasename('.' . $path->getExtension()) . '.HTML';
+ if (!file_exists($htmlFile)) {
+ $cmd = "export HOME=/tmp;/usr/bin/libreoffice --convert-to HTML:HTML --outdir $html_path --headless $path";
+ `$cmd`;
}
- $lyrics_html = file_get_contents($html_path);
+ $lyrics_html = file_get_contents($htmlFile);
+ //$lyrics_html = str_replace('<style', '<style scoped', $lyrics_html);
}
return view('song', ['menu' => true, 'lyrics_html' => $lyrics_html, 'song' => $song, 'collection' => $collection, 'partition' => $partition, 'collection_songs' => $this->_getSongsOfCollection($collection->id, $lists), 'collection_lists' => $lists]);
}
@include('header',['title'=>$song->title,'subtitle'=>$song->artist])
<article class="song" data-tone="{{$song->key}}" data-mode="{{$song->mode}}">
@if($lyrics_html!=='')
- <section class="fromdoc">{{$lyrics_html}}</section>
+ <section class="fromdoc">{!! $lyrics_html !!}</section>
@endif
@foreach($song->lyrics as $part)
@php
cacheName: 'home', matchOptions: {ignoreVary: true},
},
}, {
- urlPattern: /^https:\/\/songbook.enhydra.fr\/(.*).html$/, handler: 'StaleWhileRevalidate', options: {
+ urlPattern: /^https:\/\/songbook.enhydra.fr\/(.*).html$/,
+ handler: /*'StaleWhileRevalidate'*/"NetworkFirst",
+ options: {
cacheName: 'songs', matchOptions: {ignoreVary: true},
},
},], skipWaiting: true,