Merge pull request #2291 from xemles/patch-5

16/9 better quality parseIcon (we could technically go higher)
This commit is contained in:
Aleksandr Statciuk 2023-12-26 09:29:20 +03:00 committed by GitHub
commit bb9c859a70
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View file

@ -93,6 +93,10 @@ function parseIcon($item) {
const value = img.attr('srcset') || img.data('srcset') const value = img.attr('srcset') || img.data('srcset')
const obj = value ? srcset.parse(value).find(i => i.width === 128) : {} const obj = value ? srcset.parse(value).find(i => i.width === 128) : {}
if (obj.url) {
obj.url = obj.url.replace('128x180', '960x540');
}
return obj.url return obj.url
} }

View file

@ -39,7 +39,7 @@ it('can parse response', () => {
stop: '2023-11-27T05:30:00.000Z', stop: '2023-11-27T05:30:00.000Z',
title: 'Programmes de la nuit', title: 'Programmes de la nuit',
category: 'Autre', category: 'Autre',
icon: 'https://www.programme-tv.net/imgre/fit/~2~program~978eb86d5b99cee0.jpg/128x180/quality/80/programmes-de-la-nuit.jpg' icon: 'https://www.programme-tv.net/imgre/fit/~2~program~978eb86d5b99cee0.jpg/960x540/quality/80/programmes-de-la-nuit.jpg'
}) })
expect(results[27]).toMatchObject({ expect(results[27]).toMatchObject({
@ -47,7 +47,7 @@ it('can parse response', () => {
stop: '2023-11-27T23:45:00.000Z', stop: '2023-11-27T23:45:00.000Z',
title: 'Coup de foudre chez le Père Noël', title: 'Coup de foudre chez le Père Noël',
category: 'Téléfilm', category: 'Téléfilm',
icon: 'https://www.programme-tv.net/imgre/fit/~2~program~5a4e78779c4a3fac.jpg/128x180/quality/80/coup-de-foudre-chez-le-pere-noel.jpg' icon: 'https://www.programme-tv.net/imgre/fit/~2~program~5a4e78779c4a3fac.jpg/960x540/quality/80/coup-de-foudre-chez-le-pere-noel.jpg'
}) })
}) })