We are living in stressful times. With all the digital content online and social networks and smartphones that are constantly begging for our attention, it's easy to lose yourself in the digital world.
MindfulBytes is a plugin based application that scans your digital assets and lets you know what has happened at this day x years ago. It does that by looking at the creation timestamp (and in case of pictures by parsing the EXIF timestamp).
- Plugin based and easily extendable
- Powerful REST API
- Built-in Support for Email & Signal Messenger Notifications
- Fully dockerized and easy to set up
imgreader-fs
: scans your local filesystem for imagesimgreader-nc
: scans your Nextcloud instance for images
In order to install MindfulBytes, the following steps are necessary:
- Clone this repository with
git clone https://github.com/bbernhard/mindfulbytes.git
- Rename the
defaultconfig
folder toconfig
- Configure the general settings in the
config.yaml
file - Enable the plugins you want to use and configure the plugin specific settings in the appropriate
config.yaml
files - Rename the
docker-compose.default.yml
file todocker-compose.yml
- Build the docker images with
docker-compose -f env/docker/docker-compose.yml build
(run this command from the mindfulbytes root folder!) - Start the docker constainers with
docker-compose -f env/docker/docker-compose.yml up
The following example describes how to set up MindfulBytes to scan both a local directory and a remote Nextcloud instance for images.
-
Clone this repository with
git clone https://github.com/bbernhard/mindfulbytes.git
-
Rename the
defaultconfig
folder toconfig
-
Enable both the
imgreader-fs
andimgreader-nc
plugin by settingenabled: true
in theimgreader-fs/config.yaml
andimgreader-nc/config.yaml
file. -
Change the
nextcloud-webdav-url
,nextcloud-token
andnextcloud-root-dir
parameters in theimgreader-nc/config.yaml
file.
The Nextcloud Token can be created by navigating to Profile -> Settings -> Security on your Nextcloud instance.
Name your token mindfulbytes
and click "Generate new app password" to generate a new token.
Copy the token and use it as the nextcloud-token
parameter.
The WebDAV URL can be found by clicking on the small settings icon in the files tab.
Copy the WebDAV Url and use it as the nextcloud-webdav-url
parameter.
Last but not least, we need to set the nextcloud-root-dir
parameter. Specify the relative path where your images are stored. For now, we assume that all our pictures are stored in the Pictures
folder in Nextcloud. So we set the value to Pictures
.
-
Edit the global
config/config.yaml
file to configure Signal Messenger/Email notifications -
Rename the
docker-compose.default.yml
file todocker-compose.yml
-
Adapt the
docker-compose.yml
file and change the/tmp/images
folder to the folder on the host system where your images are stored. -
Build the docker containers with
docker-compose -f env/docker/docker-compose.yml build
-
Start the docker containers with
docker-compose -f env/docker/docker-compose.yml up
After starting the docker containers, the specified folder on your host system and the folder on your Nextcloud instance gets scanned for images. Depending on the size of the folder, this may take a while.
When the scanning is done, navigate to http://127.0.0.1:8088
with your web browser.
Ideally, you should see a picture ;-).
Due to the powerful REST API and the built-in notification support, you can display your mindful bytes on almost any device that has a screen.
Use the built-in notification support to receive your daily mindful bytes via Signal or Email.
The REST API Swagger documentation is available here
- Get an image that was created at this date x years ago, or if nothing found, a random image
curl -X GET http://127.0.0.1:8088/v1/topics/imgreader/images/today-or-random
- Add a caption to the image
curl -X GET http://127.0.0.1:8085/v1/topics/imgreader/images/today-or-random?caption=This%20image%20was%20created%20{{timeago}}
- Format image (for EPaper displays)
curl -X GET http://127.0.0.1:8085/v1/topics/imgreader/images/today-or-random?caption=This%20image%20was%20created%20{{timeago}}&format=bmp&mode=grayscale
- Cache Images When an image is requested, the request gets delegated to the appropriate plugin which fetches the image. Then, the image will be scaled, labeled, etc. before it will be served. This process can take quite a bit of time.
If you are running a battery powered device (e.g a microcontroller with an E-Paper display), you usually want to spend as much time as possible sleeping and only wake up the device for a short amount of time to maxime the battery life. In order to avoid waiting several seconds for the image processing, it's possible to send a caching request to the backend to cache the image for x seconds in memory.
A typical workflow for a battery powered microcontroller could e.g look like this:
curl -X POST -H "Content-Type: application/json" -d '{"urlpath":"/v1/topics/imgreader/images/today-or-random?size=200x200", "expires": 1800}' http://127.0.0.1:8085/v1/cache
curl -X GET http://127.0.0.1:8085/v1/cache/<cacheid>
With the expires
parameter it's possible to specify the duration (in seconds) the image will be kept in the in-memory cache.