diff --git a/.env.example b/.env.example index b6c6f96..5b0768d 100644 --- a/.env.example +++ b/.env.example @@ -1,5 +1,8 @@ +# Refer to the README or `create_poster -h` for details on the below options + +TYPE="grid" TITLE="Running" -YEAR="2017" -ATHLETE="Your name here" -UNITS="imperial" +YEAR="2024" +ATHLETE="John Doe" +UNITS="metric" EXTRA_OPTIONS= \ No newline at end of file diff --git a/.gitignore b/.gitignore index a884dde..cd0e3b7 100644 --- a/.gitignore +++ b/.gitignore @@ -57,7 +57,8 @@ sdist .mypy_cache # Project specific -gpx_dir/* +.env +gpx/* output/* data *.svg diff --git a/README.md b/README.md index 0868768..6933b7b 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ Create a visually appealing poster from your GPX tracks - heavily inspired by https://www.instagram.com/p/Behppx9HCfx/ ## Setup +### Local 1. Clone the repository: `git clone https://github.com/flopp/GpxTrackPoster.git` 2. `cd GpxTrackPoster` 3. Create virtualenv: `virtualenv -p /usr/bin/python3 venv` or `python -m venv venv` @@ -17,8 +18,19 @@ Create a visually appealing poster from your GPX tracks - heavily inspired by ht ### Container There is a Dockerfile in this repository, which you can use to run this software. -1. Build the container: `podman build -f Dockerfile -t gpxtrackposter:latest` -2. Run the container to build your poster: `podman run --rm -v /my/gpx/files:/gpx --name gpxtrackposter localhost/gpxtrackposter:latest create_poster --gpx-dir /gpx --output /gpx/poster.svg` + +1. Build the container: `podman build -f Dockerfile -t gpxtrackposter:latest`. +2. Run the container to build your poster: + ``` + podman run --rm -v ./gpx/:/usr/src/app/gpx -v ./output:/usr/src/app/output \ + --name gpxtrackposter localhost/gpxtrackposter:latest \ + create_poster --gpx-dir /usr/src/app/gpx --output /usr/src/app/output/poster.svg + ``` + +Alternatively you can use the included `docker-compose.yml`, which will do all the above for you. + +1. Copy the `.env.example` to `.env` and adapt it to your needs. +2. Run `podman compose up` in the root of this directory. ## Usage First of all, you need directory with a bunch of GPX files (e.g. you can export all your tracks from Garmin Connect with the excellent tool [garmin-connect-export](https://github.com/kjkjava/garmin-connect-export), or use [StravaExportToGPX](https://github.com/flopp/StravaExportToGPX), or use [runtastic](https://github.com/yihong0618/Runtastic), or use [nrc-exporter](https://github.com/yasoob/nrc-exporter) to convert the activities in a Strava or Runtastic or `Nike Run Club` export zip file to GPX or GPX files). diff --git a/docker-compose.yml b/docker-compose.yml index 3a6843e..6b31ab4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,8 +1,21 @@ -app: - build: . - env_file: - - .env - command: /usr/src/app/create_poster.py --type grid --gpx-dir /usr/src/app/gpx_dir --year $YEAR --title $TITLE --athlete $ATHLETE --units $UNITS $EXTRA_OPTIONS --output /usr/src/app/output/output.svg - volumes: - - ./output:/usr/src/app/output - - ./gpx_dir:/usr/src/app/gpx_dir \ No newline at end of file +name: gpxtrackposter + +services: + create: + build: ./ + image: gpxtrackposter:latest + restart: "no" + env_file: + - .env + command: "/usr/local/bin/create_poster \ + --type ${TYPE:-'grid'} \ + --title ${TITLE:-'Running'} \ + --year ${YEAR:-'2024'} \ + --athlete ${ATHLETE:-'John Doe'} \ + --units ${UNITS:-'metric'} \ + --gpx-dir /usr/src/app/gpx \ + ${EXTRA_OPTIONS:-'--verbose'} \ + --output /usr/src/app/output/output.svg" + volumes: + - ./output:/usr/src/app/output + - ./gpx:/usr/src/app/gpx diff --git a/requirements.txt b/requirements.txt index b6c2af5..6332f31 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,4 +8,4 @@ s2sphere svgwrite>=1.1.9 stravalib~=0.10 polyline -timezonefinder +timezonefinder