Skip to content

Commit 2fb9890

Browse files
Switch to all in one binary
commit 0323204 Author: RedSkiesReaperr <[email protected]> Date: Mon Aug 19 11:25:17 2024 +0200 Update README.md commit 5908700 Author: RedSkiesReaperr <[email protected]> Date: Mon Aug 19 11:17:16 2024 +0200 Updated README.md commit bcd3368 Author: RedSkiesReaperr <[email protected]> Date: Mon Aug 19 10:53:46 2024 +0200 Docker build fixes commit 96e93aa Author: RedSkiesReaperr <[email protected]> Date: Mon Aug 19 10:53:23 2024 +0200 Some adjustments for headless mode commit 85ae26d Author: RedSkiesReaperr <[email protected]> Date: Mon Aug 19 09:47:51 2024 +0200 Add make build rule commit 0c18fc5 Author: RedSkiesReaperr <[email protected]> Date: Sat Aug 17 09:56:52 2024 +0200 Fixes commit beb154e Author: RedSkiesReaperr <[email protected]> Date: Fri Aug 16 10:08:19 2024 +0200 Initialize core only at dashboardScreen.Init() commit d286607 Author: RedSkiesReaperr <[email protected]> Date: Fri Aug 16 10:07:21 2024 +0200 Fix config struct not updated after a call to .Update() commit b6c250c Author: RedSkiesReaperr <[email protected]> Date: Thu Aug 15 00:47:34 2024 +0200 tasks can be re-run on demand commit abf87d2 Author: RedSkiesReaperr <[email protected]> Date: Wed Aug 14 23:42:36 2024 +0200 Fix howlongtobeat 404 requests commit 44a70b8 Author: RedSkiesReaperr <[email protected]> Date: Wed Aug 14 23:26:19 2024 +0200 Configuration screen works & nicer TUI commit 8f9c359 Author: RedSkiesReaperr <[email protected]> Date: Wed Aug 14 23:25:10 2024 +0200 Get config value through ConfigKey commit 4e846b7 Author: RedSkiesReaperr <[email protected]> Date: Wed Aug 14 12:29:10 2024 +0200 Rework config/ to use spf13/viper package commit 1b9de66 Author: RedSkiesReaperr <[email protected]> Date: Wed Aug 14 10:50:29 2024 +0200 Added style & menus to home screen commit f7988ce Author: RedSkiesReaperr <[email protected]> Date: Tue Aug 13 17:41:07 2024 +0200 Refacto + Fix miss-exported functions/structs commit 8be536c Author: RedSkiesReaperr <[email protected]> Date: Tue Aug 13 17:24:49 2024 +0200 Fix circleci build job commit 7cdef7b Author: RedSkiesReaperr <[email protected]> Date: Tue Aug 13 16:32:18 2024 +0200 Nicer task screen commit a0da4d4 Author: RedSkiesReaperr <[email protected]> Date: Mon Aug 12 19:20:25 2024 +0200 Single app begin (dashboard & task details works) commit 1c3d263 Author: RedSkiesReaperr <[email protected]> Date: Mon Aug 12 19:19:52 2024 +0200 cleanup dependencies commit d1dea34 Author: RedSkiesReaperr <[email protected]> Date: Mon Aug 12 19:19:36 2024 +0200 Rework tui package architecture commit 7d3cc87 Author: RedSkiesReaperr <[email protected]> Date: Mon Aug 12 19:19:05 2024 +0200 Updated docker stuff commit 0e56ece Author: RedSkiesReaperr <[email protected]> Date: Sun Aug 11 23:32:25 2024 +0200 Add -no-logfile option commit 3e06271 Author: RedSkiesReaperr <[email protected]> Date: Sat Aug 10 22:18:51 2024 +0200 Architecture rework commit 5186c6a Author: RedSkiesReaperr <[email protected]> Date: Fri Feb 9 17:11:45 2024 +0100 Create base dashboard layout with panels and a table commit 89135c1 Author: RedSkiesReaperr <[email protected]> Date: Fri Feb 9 12:32:53 2024 +0100 Implement dialog workflow with configuration saving commit 732f937 Author: RedSkiesReaperr <[email protected]> Date: Fri Feb 9 12:30:49 2024 +0100 Created dialog view to display infos to user commit 3bd4187 Author: RedSkiesReaperr <[email protected]> Date: Fri Feb 9 10:14:25 2024 +0100 Ignore log files commit 9a08de2 Author: RedSkiesReaperr <[email protected]> Date: Fri Feb 9 10:13:25 2024 +0100 Remove no more used cmd/configurator commit d215013 Author: RedSkiesReaperr <[email protected]> Date: Mon Feb 5 18:29:24 2024 +0100 Add debug.log commit 03c0da9 Author: RedSkiesReaperr <[email protected]> Date: Mon Feb 5 18:29:06 2024 +0100 Configuration view works commit 58de3fd Author: RedSkiesReaperr <[email protected]> Date: Mon Feb 5 18:27:28 2024 +0100 Cleaned app & main view commit 8ef942f Author: RedSkiesReaperr <[email protected]> Date: Sun Feb 4 14:02:06 2024 +0100 Added Makefile commit 9ac368c Author: RedSkiesReaperr <[email protected]> Date: Sat Feb 3 17:31:39 2024 +0100 Adapt circleci config commit 995aa2b Author: RedSkiesReaperr <[email protected]> Date: Sat Feb 3 17:21:06 2024 +0100 Setup App & multiview system commit 78b739a Author: RedSkiesReaperr <[email protected]> Date: Sun Jan 7 13:47:22 2024 +0100 Use bubble help.Model instead of custom one commit 10b35b6 Author: RedSkiesReaperr <[email protected]> Date: Sun Jan 7 00:13:00 2024 +0100 config package now store config in json file & Created configurator app
1 parent 05c8d8e commit 2fb9890

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+2174
-777
lines changed

.circleci/config.yml

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@
33
version: 2.1
44

55
orbs:
6-
go: circleci/[email protected]
7-
docker: circleci/[email protected]
6+
go: circleci/[email protected]
87

98
jobs:
10-
build_updater:
9+
build:
1110
executor:
1211
name: go/default
1312
tag: 1.21.1
@@ -17,21 +16,8 @@ jobs:
1716
- go/mod-download
1817
- go/save-cache
1918
- run:
20-
name: Build updater
21-
command: go build -v -o ./updater cmd/updater/main.go
22-
23-
build_watcher:
24-
executor:
25-
name: go/default
26-
tag: 1.21.1
27-
steps:
28-
- checkout
29-
- go/load-cache
30-
- go/mod-download
31-
- go/save-cache
32-
- run:
33-
name: Build watcher
34-
command: go build -v -o ./watcher cmd/watcher/main.go
19+
name: Build application
20+
command: make ci
3521

3622
test:
3723
executor:
@@ -50,9 +36,7 @@ jobs:
5036
workflows:
5137
main:
5238
jobs:
53-
- build_watcher
54-
- build_updater
39+
- build
5540
- test:
5641
requires:
57-
- build_watcher
58-
- build_updater
42+
- build

.dockerignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.circleci/
2+
bin/*
3+
.env*
4+
*.log

.env.example

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
NOTION_API_SECRET=
2-
NOTION_PAGE_ID=
31
IGDB_CLIENT_ID=
42
IGDB_SECRET=
5-
UPDATER_HOST=127.0.0.1
6-
UPDATER_PORT=8080
7-
WATCHER_TICK_DELAY=3
3+
NOTION_API_SECRET=
4+
NOTION_PAGE_ID=
5+
REFRESH_DELAY=2

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,5 @@ Temporary Items
6060
# End of https://www.toptal.com/developers/gitignore/api/go,macos
6161

6262
bin/*
63-
.env
63+
.env
64+
*.log

Dockerfile

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
1-
FROM golang:1.21.1-alpine as build
1+
FROM golang:1.21.1-alpine AS build
2+
3+
RUN apk update && apk add --no-cache make
24

35
WORKDIR /usr/src/app
46
COPY go.mod go.sum ./
57
RUN go mod download && go mod verify
68

79
COPY . .
8-
RUN go build -v -o /usr/local/bin/updater ./cmd/updater/main.go
9-
RUN go build -v -o /usr/local/bin/watcher ./cmd/watcher/main.go
10+
RUN make docker
1011

1112
# Release stage
1213
FROM alpine:3.18
1314

1415
WORKDIR /bin
15-
COPY --from=build /usr/local/bin/updater /bin/updater
16-
COPY --from=build /usr/local/bin/watcher /bin/watcher
17-
COPY .env .
16+
COPY --from=build /usr/local/bin/igdb-app /bin/igdb-app
17+
RUN touch .env
18+
RUN chmod +x /bin/igdb-app
19+
20+
CMD ["igdb-app", "-headless"]

Makefile

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
SOURCES := main.go logger.go
2+
BINARY:= bin/app
3+
PLATFORMS := darwin/amd64 darwin/arm64 linux/386 linux/amd64 linux/arm linux/arm64
4+
WIN_PLATFORMS := windows/386 windows/amd64 windows/arm windows/arm64
5+
6+
temp = $(subst /, ,$@)
7+
os = $(word 1, $(temp))
8+
arch = $(word 2, $(temp))
9+
10+
.PHONY : release $(PLATFORMS) $(WIN_PLATFORMS) clean
11+
12+
release: $(PLATFORMS) $(WIN_PLATFORMS)
13+
14+
$(PLATFORMS):
15+
GOOS=$(os) GOARCH=$(arch) go build -o $(BINARY)-$(os)-$(arch) $(SOURCES)
16+
17+
$(WIN_PLATFORMS):
18+
GOOS=$(os) GOARCH=$(arch) go build -o $(BINARY)-$(os)-$(arch).exe $(SOURCES)
19+
20+
build:
21+
go build -o $(BINARY) $(SOURCES)
22+
23+
clean:
24+
rm -rf $(BINARY)-*
25+
26+
ci:
27+
go build -v -o ./app $(SOURCES)
28+
29+
dev:
30+
go build -o $(BINARY)-dev $(SOURCES)
31+
32+
docker:
33+
go build -v -o /usr/local/bin/igdb-app $(SOURCES)
34+
35+
run:
36+
go build -o $(BINARY) $(SOURCES)
37+
./$(BINARY)-dev

README.md

Lines changed: 106 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
# Notion IGDB autocomplete [![CircleCI](https://dl.circleci.com/status-badge/img/gh/RedSkiesReaperr/notion-igdb-autocomplete/tree/main.svg?style=svg)](https://dl.circleci.com/status-badge/redirect/gh/RedSkiesReaperr/notion-igdb-autocomplete/tree/main) [![reddit thread](https://img.shields.io/badge/Reddit-FF4500?logo=reddit&logoColor=white)](https://www.reddit.com/r/Notion/comments/17dw8js/created_integration_to_automatically_fill_in/?utm_source=share&utm_medium=web2x&context=3) [![Notion template](https://img.shields.io/badge/Notion-%23000000.svg?logo=notion&logoColor=white)](https://plant-pantry-77c.notion.site/Automated-video-games-library-c833cb560feb4b82935a310e508d34c2)
1+
2+
# Notion IGDB autocomplete [![CircleCI](https://dl.circleci.com/status-badge/img/gh/RedSkiesReaperr/notion-igdb-autocomplete/tree/main.svg?style=svg)](https://dl.circleci.com/status-badge/redirect/gh/RedSkiesReaperr/notion-igdb-autocomplete/tree/main) [![reddit thread](https://img.shields.io/badge/Reddit-FF4500?logo=reddit&logoColor=white)](https://www.reddit.com/r/Notion/comments/17dw8js/created_integration_to_automatically_fill_in/?utm_source=share&utm_medium=web2x&context=3) [![Notion template](https://img.shields.io/badge/Notion-%23000000.svg?logo=notion&logoColor=white)](https://plant-pantry-77c.notion.site/Automated-video-games-library-c833cb560feb4b82935a310e508d34c2) [![DockerHub](https://img.shields.io/badge/DockerHub-blue.svg?logo=docker&logoColor=white)](https://hub.docker.com/r/redskiesreaperr/notion-igdb-autocomplete)
23

34
This Go project aims to automate the completion of video game information in a Notion database. It simplifies the task of collecting and updating details of video games, including titles, franchises, genres, platforms, and release dates, by connecting to the Notion database.
45

@@ -9,108 +10,139 @@ This Go project aims to automate the completion of video game information in a N
910
- Automated Search: Performs online searches to retrieve up-to-date information about video games.
1011
- Database Updates: Updates video game entries in Notion with the latest details, such as titles, franchises, genres, platforms, and release dates.
1112

12-
## System Requirements
13-
- [Docker](https://www.docker.com/products/docker-desktop/)
13+
## Table of Contents
14+
1. [Prerequisites](#prerequisites)
15+
2. [Installation](#installation)
16+
3. [Configuration](#configuration)
17+
4. [Running the Project](#running-the-project)
18+
- [Running on Local Machine](#running-on-local-machine)
19+
- [Running with Docker](#running-with-docker)
20+
5. [Dependencies](#dependencies)
21+
6. [Contributing](#contributing)
22+
7. [License](#license)
23+
24+
## Prerequisites
25+
- Go v1.21.1+ (if running on local machine)
26+
- Make (if running on local machine)
27+
- [Docker](https://www.docker.com/products/docker-desktop/) (if running on docker)
1428
- Access to a Notion database and a Notion integration key (see Configuration section for details)
1529
- Access to IGDB API by a client id and client secret (see Configuration section for details)
1630

1731
## Installation
32+
> This section is mandatory only if you want to download the source & run the code on your local machine. Either, you can directly go to the [Configuration section]()
1833
19-
1. Clone this repository to your local machine:
20-
```sh
21-
git clone https://github.com/RedSkiesReaperr/notion-igdb-autocomplete
22-
cd notion-igdb-autocomplete
23-
```
34+
To get started, you need to install Go, download the source code and install all the dependencies it needs to work properly.
2435

25-
## Configuration
36+
### Clone the Repository
37+
```bash
38+
$ git clone https://github.com/RedSkiesReaperr/notion-igdb-autocomplete
39+
$ cd notion-igdb-autocomplete
40+
```
2641

27-
1. Create environment configuration file:
28-
```sh
29-
cp ./.env.example .env
30-
```
31-
32-
2.
33-
>**If you start from scratch**: Duplicate the [Notion template](https://plant-pantry-77c.notion.site/Automated-video-games-library-c833cb560feb4b82935a310e508d34c2?pvs=4) and go to step 4
34-
>
35-
>**If you already have a Notion database**: Continue to step 3
36-
37-
3. Create a Notion database (or configure an already existing one) with the following properties:
38-
- Title:
39-
- Name: Title
40-
- Type: Title
41-
- Platforms:
42-
- Name: Platforms
43-
- Type: Multi-select
44-
- Genres:
45-
- Name: Genres
46-
- Type: Multi-select
47-
- Franchises:
48-
- Name: Franchises
49-
- Type: Multi-select
50-
- Release date:
51-
- Name: Release date
52-
- Type: Date
53-
- Time to complete (Main Story)
54-
- Name: Time to complete (Main Story)
55-
- Type: Text
56-
- Time to complete (Main + Sides)
57-
- Name: Time to complete (Main + Sides)
58-
- Type: Text
59-
- Time to complete (Completionist)
60-
- Name: Time to complete (Completionist)
61-
- Type: Text
62-
63-
3. Create a private Notion integration on your account by following the [getting started page](https://developers.notion.com/docs/create-a-notion-integration#create-your-integration-in-notion) before the "Setting up the demo locally" step.
64-
65-
4. Put your integration API secret as value of the `NOTION_API_SECRET` in your `.env` file.
66-
67-
5. Go on your Notion databse, click on the "..." button and on the "copy link" option. As mentionned in [environment variables section](https://developers.notion.com/docs/create-a-notion-integration#environment-variables), Get the ID of your database and put it as value of the `NOTION_PAGE_ID` in your `.env` file.
42+
### Install Dependencies
43+
```bash
44+
$ go mod download
45+
```
46+
47+
## Configuration
48+
This section will help you to get all the mandatory variables from third party apps and create the base application configuration.
49+
50+
### 1. Create environment configuration file:
51+
Create a `.env` file to save your configuration informations:
52+
```shell
53+
$ cp ./.env.example .env
54+
```
55+
56+
#### 2. Create a Notion database
57+
>**If you start from scratch**: Duplicate the [Notion template](https://plant-pantry-77c.notion.site/Automated-video-games-library-c833cb560feb4b82935a310e508d34c2?pvs=4) and go to step 2
58+
59+
>**If you already have a Notion database**: Continue to step 1
60+
61+
1. Create a Notion database (or configure an already existing one) with the following properties:
62+
- Title: (**type: Title**)
63+
- Platforms: (**type: Multi-select**)
64+
- Genres: (**type: Multi-select**)
65+
- Franchises: (**type: Multi-select**)
66+
- Release date: (**type: Date**)
67+
- Time to complete (Main Story): (**type: Text**)
68+
- Time to complete (Main + Sides): (**type: Text**)
69+
- Time to complete (Completionist): (**type: Text**)
70+
71+
2. Create a private Notion integration on your account by following the [getting started page](https://developers.notion.com/docs/create-a-notion-integration#create-your-integration-in-notion) before the "Setting up the demo locally" step.
72+
3. Put your integration API secret as value of the `NOTION_API_SECRET` in your `.env` file.
73+
4. Go on your Notion databse, click on the "..." button and on the "copy link" option. As mentionned in [environment variables section](https://developers.notion.com/docs/create-a-notion-integration#environment-variables), Get the ID of your database and put it as value of the `NOTION_PAGE_ID` in your `.env` file.
6874

6975
> ***At this point you should have a Notion database, with all mandatory properties. You should have created a private Notion integration connected with you database. You should have a `.env` file in your cloned project directory who have two values filled: `NOTION_API_SECRET` and `NOTION_PAGE_ID`***
7076
71-
6. Create a Twitch Developer application (needed to use IGDB API) by following the "Account Creation" of [getting started page](https://api-docs.igdb.com/#getting-started). This will give you steps to get your `IGDB_CLIENT_ID` & `IGDB_SECRET`. Afterward fill `IGDB_CLIENT_ID` & `IGDB_SECRET` in your `.env` file. ***If you need more detailed explanations, follow the 'More details about IGDB configuration' section below***.
77+
5. Create a Twitch Developer application (needed to use IGDB API) by following the "Account Creation" of [getting started page](https://api-docs.igdb.com/#getting-started). This will give you steps to get your `IGDB_CLIENT_ID` & `IGDB_SECRET`. Afterward fill `IGDB_CLIENT_ID` & `IGDB_SECRET` in your `.env` file. ***If you need more detailed explanations, follow the 'More details about IGDB configuration' section below***.
7278

7379
🎉 **Congrats, configuration done!** 🎉
7480

7581
### More details about IGDB configuration
7682
Once you are on the Twitch developers portal:
7783
1. On the left menu go in the "Applications" section
7884
2. Then click on the "Register your application" purple button
79-
3. In the registration form:
80-
1. Name field: you fill whatever you want.
81-
2. Second field (about OAuth things): `http://localhost`.
82-
3. Click on create button
85+
3. In the registration form:
86+
1. Name field: you fill whatever you want.
87+
2. Second field (about OAuth things): `http://localhost`.
88+
3. Click on create button
8389
4. Once created it takes you to the applications listing, then click on "Manage" button for your newly created app.
8490
5. Under the captcha, you have a field "client identifier" (or something like that). This value is your `IGDB_CLIENT_ID`
8591
6. Click on the "New secret" button. It gives you the `IGDB_SECRET`
8692

87-
## Usage
88-
Install & configure the application following the steps above.
89-
90-
1. Run the application:
91-
```sh
92-
docker-compose up
93-
```
94-
2. In you Notion database create a new entry with a title matching the pattern `{{YOUR_DESIRED_GAME_NAME}}`
95-
96-
The application will connect to your Notion database, IGDB API and search for video game information.
97-
Video game details, including titles, franchises, genres, platforms, and release dates, will be updated in your Notion database.
98-
99-
## Any question ?
100-
The answer might be [there](https://www.reddit.com/r/Notion/comments/17dw8js/created_integration_to_automatically_fill_in/?utm_source=share&utm_medium=web2x&context=3)
93+
## Running the Project
94+
95+
### Running on Local Machine
96+
97+
1. Compile the project:
98+
```bash
99+
$ make build
100+
```
101+
2. Run the generated binary:
102+
```bash
103+
$ ./bin/app
104+
```
105+
106+
By running the app this way you will get into a nicer and clearer TUI (terminal user interface) than the more conventional way to run. You can navigate through it by using your keyboard. It will also help you to have a better understanding of whats going on. Here is a sneak peak of this TUI:
107+
![tui-demo](https://github.com/user-attachments/assets/3a0dca3a-7d67-42ff-8c35-016b7f55abd7)
108+
109+
### Running with Docker
110+
111+
1. Pull the docker image:
112+
```bash
113+
$ docker pull redskiesreaperr/notion-igdb-autocomplete:latest
114+
```
115+
2. Create and run the container, send the config values as environment variables to the container:
116+
```bash
117+
$ docker run \
118+
-e NOTION_PAGE_ID=your_notion_page_id \
119+
-e IGDB_CLIENT_ID=your_igdb_client_id \
120+
-e IGDB_SECRET=your_igdb_secret \
121+
-e NOTION_API_SECRET=your_notion_api_secret \
122+
-e REFRESH_DELAY=5 \
123+
redskiesreaperr/notion-igdb-autocomplete:latest
124+
```
125+
126+
## Dependencies
127+
Thanks to all the authors who created and maintains the following packages:
128+
- [agnivade/levenshtein](github.com/agnivade/levenshtein)
129+
- [charmbracelet/bubbles](github.com/charmbracelet/bubbles)
130+
- [charmbracelet/bubbletea](github.com/charmbracelet/bubbletea)
131+
- [charmbracelet/lipgloss](github.com/charmbracelet/lipgloss)
132+
- [corpix/uarand](github.com/corpix/uarand)
133+
- [fsnotify/fsnotify](github.com/fsnotify/fsnotify)
134+
- [google/uuid](github.com/google/uuid)
135+
- [jomei/notionapi](github.com/jomei/notionapi)
136+
- [spf13/viper](github.com/spf13/viper)
101137

102138
## Contributing
103139
If you wish to contribute to this project, please follow these steps:
104-
105140
1. Fork this repository.
106141
2. Create a branch for your feature: git checkout -b feature/feature-name
107142
3. Commit your changes: git commit -m 'Added a new feature'
108143
4. Push your branch: git push origin feature/feature-name
109-
5. Submit a Pull Request.
144+
5. Open a Pull Request.
110145

111146
## License
112147
This project is licensed under the MIT License. See the LICENSE file for details.
113-
114148
Feel free to open issues or submit feature requests if you have ideas to enhance this project.
115-
116-
## Contributors

0 commit comments

Comments
 (0)