External Services and Kirby

Hey,
a few weeks ago i wrote a bash script which calls some other scripts to download gps tracks from strava, building an png image of the track and overlaying this onto another picture.

this was something i want to use inside my blog.
currently i’m thinking about using this inside kirby. or to code it new for kirby.

what do you think, could be a good way to call an api of another website to download files and work with them right inside kirby panel?

probably it will be the best idea to do it manualy outside of kirby, like i already do. but it would be nice to have a button in the panel on which this will start more or less automaticaly.

Well, looking at Strava’s Docs, you can use JSON to fetch the waypoint data, and then something like leaflet to plot the route on a map automagically. This extension is probably useful.

the main part of my wanted things is plotting the track transparent onto an image. a watermark like this:

i found a pythoin script which generates an svg image of the gpx track.
this svg image will then be converted to a transparent png which is drawn onto the image via a little watermark php script.

very complicated… but well… i’m not a coder =)

using leaflet to draw a track onto an interactive map, will be a separated thing

So this bashscript is on your server? You can probably create a panel dashboard widget that runs the bash script at the press of a button. Then alter the bash script slightly so that it copies the images into somewhere in kirbys content folder.

If the bashscript is on your computer instead, you can alter the bash script so that it transfers the resulting image to the server using rSync. If you setup a hidden page within kirby, you can then access the files from there. Then you can make a custom kirby tag to render the image within your pages.

If your on a Mac, you could use Automator to turn the script into an app, so you just double click it to make it do its thing, instead of heading to terminal and typing stuff in :slight_smile: Infact, Automator can do a lot of things, so you can probably offload some of the scripts into native Automator actions. It can add watermarks to images for example.

There also a Perl script here that might be interesting, it converts to png right from the beginning, so you don’t have to create an svg first only to convert that to png.

Also, it shouldn’t be necessary to download the tracks but you could most likely work with the Strava API data directly. Then you don’t have to worry about moving data from one server to another etc.

Thx a lot.
it is several weeks ago, when i was playing with all of this stuff. as far as i remember, i also was playing with the openstreetmap perl script and i was not satisfied with the result. but i realy can’t remember at the moment. i think it was because of only generating images in context with openstreetmap database.

it is necessary to download the gpx file, because the strava api provides a very low resolution data stream in the api.

i’ll check the perl script again and will get into all of this in more detail again, soon.
i just was wondering what the best strategy will be to recall this project by the idea of using it with kirby.

maybe it is a better solution to not use kirby on those things directly but generating blogpost via the bash script. for this i should read about kirby api, i think.

but well… all of this is in a very very early stage.

I think there are several ways to go about this and the best probably depends on what sort of workflow you are thinking of. For example, you could create a Kirby post via the panel, upload an image and a track file and then use a Kirbytag that brings the two together. Or, the images with the tracks are created outside of Kirby and you only upload the image with the track already included. Or…