z------------- / CPod

(UNMAINTAINED) A simple, beautiful podcast app for Windows, macOS, and Linux.
Apache License 2.0
746 stars 76 forks source link

CPod Fails to subscribe to pinecast-hosted RSS links #235

Open megidont opened 2 years ago

megidont commented 2 years ago

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:

leighsmith commented 2 years ago

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)
mattbasta commented 2 years ago

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).

leighsmith commented 2 years ago

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.