CPod icon indicating copy to clipboard operation
CPod copied to clipboard

CPod Fails to subscribe to pinecast-hosted RSS links

Open megidont opened this issue 2 years ago • 3 comments

CPod version: 1.28.0 Platform: Windows Installation type (.deb, Snap, etc.): Installer from releases page Description: When attempting to add podcasts from pinecast rss urls, CPod appears to subscribe to them but does not add them to subscriptions.

Pinecast renders their RSS links in a web browser with a beautified page, which may contribute to the problem. Links I tested with: https://pinecast.com/feed/artificial-ghost-radio https://pinecast.com/feed/mock-footage https://pinecast.com/feed/deck-of-friendship Version of CPod which introduced the issue (if applicable):

Steps to reproduce: Enter any of the above URLs to the search box in CPod. The correct information will show up, but if you hit subscribe it will not be added to subscriptions. Other information (e.g. Developer Tools console log, screenshots) if possible:

megidont avatar Sep 15 '21 08:09 megidont

Actually it seems the problem is the artwork image is not in a format able to currently be handled:

cbus-data.js:194 Uncaught Error: Unsupported MIME type: image/webp
    at Jimp.throwError (index.js:15)
    at Jimp.parseBitmap (image-bitmap.js:84)
    at Jimp.parseBitmap (index.js:395)
    at new Jimp (index.js:350)
    at index.js:849
    at new Promise (<anonymous>)
    at Function.Jimp.read (index.js:848)
    at gotPodcastImage (cbus-data.js:193)
    at xhr (cbus-data.js:282)
    at XMLHttpRequest.req.onload (basic.js:28)

leighsmith avatar Sep 22 '21 13:09 leighsmith

Matt from Pinecast here. Sounds like the image is being downloaded using XHR or fetch, which means the browser (read: electron) is sending the Accepts header with WebP as a supported image format. If the image is then decoded using JS alone using a library without support for WebP, you'll end up in this situation.

The fix is to either override the Accepts header on the image request, or to decode the image using the browser runtime (e.g., using the image constructor and a canvas).

mattbasta avatar Dec 16 '21 05:12 mattbasta

Ok I have created a PR to add support for WebP using webp_converter. Using {"Accept": "image/png, image/jpg"} did not result in those formats being returned, for at least some podcasts on patreon, so I've added conversion to PNG prior to resizing. This is what was suggested by the JIMP developers.

leighsmith avatar Dec 26 '21 18:12 leighsmith