Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FINNA-2579] & [FINNA-2875] Add file size to LIDO resource and fix resource play buttons for sr #3118

Open
wants to merge 14 commits into
base: dev
Choose a base branch
from

Conversation

siiriylonen
Copy link

No description provided.

@siiriylonen siiriylonen marked this pull request as ready for review January 14, 2025 17:24
*
* @return array
*/
protected function getModel(
string $url,
string $format,
string $type,
\SimpleXmlElement $measurements = null,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tämän tyypin pitäisi olla ?\SimpleXmlElement

*
* @return array
*/
protected function getAudio(
string $url,
string $format,
string $description
string $description,
\SimpleXmlElement $measurements = null

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tämän tyypin pitäisi olla ?\SimpleXmlElement

@@ -923,6 +951,9 @@ protected function getAudio(
'codec' => $format,
'type' => 'audio',
'embed' => 'audio',
'data' => $this->formatResourceMeasurements(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ei voi kutsua formatResourceMeasurements-metodia varmistamatta, ettei $measurements ole null.

@@ -955,6 +988,9 @@ protected function getVideo(
'url' => $url,
'embed' => 'iframe',
'format' => $format,
'data' => $this->formatResourceMeasurements(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ei voi kutsua formatResourceMeasurements-metodia varmistamatta, ettei $measurements ole null.

@@ -966,6 +1002,9 @@ protected function getVideo(
'src' => $url,
'type' => $mediaType,
],
'data' => $this->formatResourceMeasurements(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ei voi kutsua formatResourceMeasurements-metodia varmistamatta, ettei $measurements ole null.

@EreMaijala
Copy link

@siiriylonen Saisiko saamen käännöksen myös?

* @param string $url Model url
* @param string $format Model format
* @param string $type Model type
* @param \SimpleXmlElement $measurements Measurements SimpleXmlElement

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kysymysmerkki tähänkin tyypin eteen. Jälkimmäinen SimpleXmlElement on turha – sehän on jo parametrin tyypissä.

@@ -1,8 +1,13 @@
<!-- START of: finna - RecordDriver/DefaultRecord/audio-information.phtml -->
<?php
if ($fileSize = $url['data']['size'] ?? '') {
$fileSize = !empty($fileSize['value']) && $fileSize['unit'] === 'byte' ? '(' . $this->fileSize(preg_replace('/[^0-9]/', '', $fileSize['value'])) . ')' : '';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Miksi yksikön pitää olla byte? Jos tietueessa on koko vaikka kilotavuina, niin jää näyttämättä, eikö?

@@ -1,7 +1,7 @@
<!-- START of: finna - RecordDriver/DefaultRecord/audio-information.phtml -->
<?php
if ($fileSize = $url['data']['size'] ?? '') {
$fileSize = !empty($fileSize['value']) && $fileSize['unit'] === 'byte' ? '(' . $this->fileSize(preg_replace('/[^0-9]/', '', $fileSize['value'])) . ')' : '';
$fileSize = !empty($fileSize['value']) ? '(' . $this->fileSize(preg_replace('/[^0-9]/', '', $fileSize['value'])) . ')' : '';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eihän tämä kuitenkaan näin voi mennä. Jos unit on jotain muuta kuin byte, niin ei fileSize anna sille oikeaa arvoa. Toisin sanoen pitää joko konvertoida tavuiksi SolrLido:ssa, välittää myös yksikkö fileSize:lle tai näyttää koko jotenkin vaihtoehtoisesti.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lisäksi pitää huomioida, että muu kuin tavu voi olla desimaaliluku, vaikka "3.5", jolloin ei voi suoraan vain poistaa ei-numeroita stringistä. Muuten olisi kyllä parempi tehdä siivous SolrLidon puolella, jotta sitä ei tarvitse erikseen tehdä monessa paikassa templaateissa.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants