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

[RadioMelodieBridge] Fix to use the new website layout #2330

Merged
merged 4 commits into from
Dec 18, 2021

Conversation

sysadminstory
Copy link
Contributor

The website layout has been slightly updated, so the bridge needed to be adapted.

The website layout has been slightly updated, so the bridge needed to be adapted.
Copy link
Contributor

@dvikan dvikan left a comment

Choose a reason for hiding this comment

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

Tested locally and the bridge is repaired. However the parsing of the publish date is broken. Im getting:

Notice: Trying to access array offset on value of type bool in /home/rssbridge/public/bridges/RadioMelodieBridge.php on line 69

and the offending code is:

preg_match('/([a-z]{4,10} [0-9]{1,2} [a-z]{4,10} [0-9]{4} à [0-9]{2}:[0-9]{2})/ms', $dateHTML, $matches);
$dateText = $matches[1];
$dateArray = strptime($dateText, $dateFormat);

https://www.php.net/manual/en/function.strptime.php:

Warning

This function has been DEPRECATED as of PHP 8.1.0. Relying on this function is highly discouraged.

The regex is working fine but the strptime() does not like the input and returns false.

Remove the function strptime which will is deprecated in PHP 8.1 and
replace it with the function date_parse_from_format
@dvikan
Copy link
Contributor

dvikan commented Nov 28, 2021

I tested your change and now it works perfectly. Thank you @sysadminstory

@sysadminstory
Copy link
Contributor Author

As strptime() is deprecated, I replaced it with a new function using date_parse_from_format() instead !

Two date issues fixed !

The regular eexpression did not match days with one digit (because the
day is always printed with two caracters, with a leading space), and did
not match months with accented characters like 'décembre'.

The date 'translate' function had a wrong placed duplicate for
'november' in the '$replace_en' array, which leaded to a wrong date conversion.
@em92 em92 merged commit a0bbbd6 into RSS-Bridge:master Dec 18, 2021
@sysadminstory sysadminstory deleted the radio-melodie-fix branch January 16, 2022 22:03
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.

3 participants