pipes-digital / pipes

Repository for Pipes
https://pipes.digital
GNU Affero General Public License v3.0
264 stars 21 forks source link

Basic math / Manipulating dates and times #93

Open benfishbus opened 2 years ago

benfishbus commented 2 years ago

Is there any way to perform arithmetic in Pipes? I want to convert a time from mm:ss to just seconds. Can I call a webservice like https://api.mathjs.org/ ?

onli commented 2 years ago

Yes. Well, Pipes does not have a block for this. But you can call https://api.mathjs.org/. You just need to feed your target calculation url into a download block.

If you need to take the mm:ss from a different feed then feeding that into a download block is not obvious, as the download block only has a text input. The trick is to use a foreach block, fill it with a download block, and then connect its input with a feed that contains the URLs you want to call.

The result will be combined into one feed and the created download calls will also be properly throttled.

I'm not against adding a new block that does calculations if someone comes up with a usable block layout.