├── .dir-locals.el ├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ ├── feature_request.md │ └── other_custom.md ├── dependabot.yaml ├── funding.yaml ├── release.yaml └── workflows │ ├── cicd.yaml │ └── secops.yaml ├── .gitignore ├── CHANGELOG.md ├── CONTRIBUTING.md ├── COPYING ├── Makefile ├── README.md ├── SECURITY.md ├── assets └── diego_header.png ├── configs ├── goreleaser.yaml ├── release-please-config.json └── release-please-manifest.json ├── docs ├── demonstration.md ├── help │ ├── diego.md │ ├── diego_completion.md │ ├── diego_completion_bash.md │ ├── diego_completion_fish.md │ ├── diego_completion_powershell.md │ ├── diego_completion_zsh.md │ ├── diego_import.md │ ├── diego_import_goodreads.md │ ├── diego_import_imdb.md │ ├── diego_import_instapaper.md │ ├── diego_import_letterboxd.md │ ├── diego_import_spotify.md │ ├── diego_import_youtube.md │ ├── diego_set.md │ ├── diego_set_all.md │ ├── diego_set_defaults.md │ ├── diego_set_format.md │ ├── diego_set_hugodir.md │ ├── diego_set_overwrite.md │ ├── diego_set_scrape.md │ ├── diego_set_shortcode.md │ └── diego_settings.md ├── man │ ├── diego-completion-bash.1 │ ├── diego-completion-fish.1 │ ├── diego-completion-powershell.1 │ ├── diego-completion-zsh.1 │ ├── diego-completion.1 │ ├── diego-import-goodreads.1 │ ├── diego-import-imdb.1 │ ├── diego-import-instapaper.1 │ ├── diego-import-letterboxd.1 │ ├── diego-import-spotify.1 │ ├── diego-import-youtube.1 │ ├── diego-import.1 │ ├── diego-set-all.1 │ ├── diego-set-defaults.1 │ ├── diego-set-format.1 │ ├── diego-set-hugodir.1 │ ├── diego-set-overwrite.1 │ ├── diego-set-scrape.1 │ ├── diego-set-shortcode.1 │ ├── diego-set.1 │ ├── diego-settings.1 │ └── diego.1 └── user_guide.md ├── examples └── silo │ ├── goodreads_library.csv │ ├── imdb_list.csv │ ├── imdb_ratings.csv │ ├── imdb_watchlist.csv │ ├── instapaper_list.csv │ ├── letterboxd_diary.csv │ ├── letterboxd_likes_films.csv │ ├── letterboxd_reviews.csv │ ├── letterboxd_watchlist.csv │ ├── spotify_playlist.json │ ├── spotify_your_library.json │ ├── youtube_playlist.csv │ └── youtube_subscriptions.csv ├── go.mod ├── go.sum ├── internal ├── adapters │ ├── left │ │ └── cli │ │ │ ├── cli.go │ │ │ ├── cli_test.go │ │ │ ├── import.go │ │ │ ├── import_goodreads.go │ │ │ ├── import_imdb.go │ │ │ ├── import_instapaper.go │ │ │ ├── import_letterboxd.go │ │ │ ├── import_spotify.go │ │ │ ├── import_youtube.go │ │ │ ├── root.go │ │ │ ├── set.go │ │ │ ├── set_all.go │ │ │ ├── set_defaults.go │ │ │ ├── set_format.go │ │ │ ├── set_hugodir.go │ │ │ ├── set_overwrite.go │ │ │ ├── set_scrape.go │ │ │ ├── set_shortcode.go │ │ │ ├── settings.go │ │ │ └── testdata │ │ │ ├── goodreads │ │ │ ├── complete_library.golden │ │ │ ├── empty.csv │ │ │ ├── invalid.csv │ │ │ ├── library.csv │ │ │ ├── library.golden │ │ │ ├── shortcode_complete_library.golden │ │ │ └── shortcode_library.golden │ │ │ ├── imdb │ │ │ ├── complete_list.golden │ │ │ ├── complete_ratings.golden │ │ │ ├── complete_watchlist.golden │ │ │ ├── empty.csv │ │ │ ├── invalid.csv │ │ │ ├── list.csv │ │ │ ├── list.golden │ │ │ ├── ratings.csv │ │ │ ├── ratings.golden │ │ │ ├── shortcode_complete_list.golden │ │ │ ├── shortcode_complete_ratings.golden │ │ │ ├── shortcode_complete_watchlist.golden │ │ │ ├── shortcode_list.golden │ │ │ ├── shortcode_ratings.golden │ │ │ ├── shortcode_watchlist.golden │ │ │ ├── watchlist.csv │ │ │ └── watchlist.golden │ │ │ ├── instapaper │ │ │ ├── complete_list.golden │ │ │ ├── empty.csv │ │ │ ├── invalid.csv │ │ │ ├── list.csv │ │ │ ├── list.golden │ │ │ ├── shortcode_complete_list.golden │ │ │ └── shortcode_list.golden │ │ │ ├── letterboxd │ │ │ ├── complete_diary.golden │ │ │ ├── complete_films.golden │ │ │ ├── complete_reviews.golden │ │ │ ├── complete_watchlist.golden │ │ │ ├── diary.csv │ │ │ ├── diary.golden │ │ │ ├── empty.csv │ │ │ ├── films.csv │ │ │ ├── films.golden │ │ │ ├── invalid.csv │ │ │ ├── reviews.csv │ │ │ ├── reviews.golden │ │ │ ├── shortcode_complete_diary.golden │ │ │ ├── shortcode_complete_films.golden │ │ │ ├── shortcode_complete_reviews.golden │ │ │ ├── shortcode_complete_watchlist.golden │ │ │ ├── shortcode_diary.golden │ │ │ ├── shortcode_films.golden │ │ │ ├── shortcode_reviews.golden │ │ │ ├── shortcode_watchlist.golden │ │ │ ├── watchlist.csv │ │ │ └── watchlist.golden │ │ │ ├── spotify │ │ │ ├── complete_library.golden │ │ │ ├── complete_playlist.golden │ │ │ ├── empty.json │ │ │ ├── invalid.json │ │ │ ├── library.golden │ │ │ ├── library.json │ │ │ ├── playlist.golden │ │ │ ├── playlist.json │ │ │ ├── shortcode_complete_library.golden │ │ │ ├── shortcode_complete_playlist.golden │ │ │ ├── shortcode_library.golden │ │ │ └── shortcode_playlist.golden │ │ │ └── youtube │ │ │ ├── complete_playlist.golden │ │ │ ├── complete_subscriptions.golden │ │ │ ├── empty.csv │ │ │ ├── invalid.csv │ │ │ ├── playlist.csv │ │ │ ├── playlist.golden │ │ │ ├── shortcode_complete_playlist.golden │ │ │ ├── shortcode_complete_subscriptions.golden │ │ │ ├── shortcode_playlist.golden │ │ │ ├── shortcode_subscriptions.golden │ │ │ ├── subscriptions.csv │ │ │ └── subscriptions.golden │ └── right │ │ └── filesystem │ │ └── filesystem.go ├── app │ ├── api │ │ ├── api.go │ │ └── interfaces.go │ ├── core │ │ └── core.go │ ├── domain │ │ └── domain.go │ └── social │ │ ├── goodreads │ │ └── library.go │ │ ├── imdb │ │ ├── list.go │ │ ├── ratings.go │ │ └── watchlist.go │ │ ├── instapaper │ │ └── list.go │ │ ├── letterboxd │ │ ├── diary.go │ │ ├── films.go │ │ ├── reviews.go │ │ └── watchlist.go │ │ ├── social.go │ │ ├── spotify │ │ ├── library.go │ │ └── playlist.go │ │ └── youtube │ │ ├── playlist.go │ │ └── subscriptions.go └── ports │ ├── left.go │ └── right.go └── main.go /.dir-locals.el: -------------------------------------------------------------------------------- 1 | ((nil . ((compile-command . "make run"))) 2 | (makefile-mode . ((eval . (setenv "DIEGO_GENDOCS" "1"))))) 3 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a bug report to help the project improve 4 | title: "" 5 | labels: bug 6 | assignees: '' 7 | 8 | --- 9 | 11 | 12 | **Context** 13 | 14 | - Program Version: 15 | - OS: 16 | 17 | **Bug report description** 18 | 19 | 20 | 21 | **Steps to reproduce the behavior** 22 | 23 | 1. Go to '...' 24 | 2. Run '...' on '...' 25 | 3. See error 26 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Request a feature or suggest an idea for the project 4 | title: "" 5 | labels: enhancement 6 | assignees: '' 7 | 8 | --- 9 | 11 | 12 | **Which of the following options relate to your request?** 13 | 14 | - [ ] Extending an existing functionality 15 | - [ ] Proposing an entirely new feature 16 | - [ ] None of the above 17 | 18 | **Feature request description** 19 | 20 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/other_custom.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Other issue 3 | about: Submit a custom issue 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 11 | -------------------------------------------------------------------------------- /.github/dependabot.yaml: -------------------------------------------------------------------------------- 1 | # To get started with Dependabot version updates, you'll need to specify which 2 | # package ecosystems to update and where the package manifests are located. 3 | # Please see the documentation for all configuration options: 4 | # https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file 5 | 6 | version: 2 7 | updates: 8 | - package-ecosystem: "github-actions" # See documentation for possible values 9 | directory: "/" # Location of package manifests 10 | schedule: 11 | interval: "weekly" 12 | commit-message: 13 | prefix: "deps(gh)" 14 | # include: "scope" 15 | 16 | - package-ecosystem: "gomod" # See documentation for possible values 17 | directory: "/" # Location of package manifests 18 | schedule: 19 | interval: "weekly" 20 | commit-message: 21 | prefix: "deps(go)" 22 | # include: "scope" 23 | -------------------------------------------------------------------------------- /.github/funding.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | buy_me_a_coffee: ttybitnik 3 | -------------------------------------------------------------------------------- /.github/release.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | changelog: 3 | categories: 4 | # Disabled in favour of release-please deps commit type 5 | # - title: Dependencies 6 | # labels: 7 | # - dependencies 8 | - title: Pull Requests 9 | labels: 10 | - '*' 11 | exclude: 12 | labels: 13 | - dependencies 14 | - 'autorelease: tagged' 15 | -------------------------------------------------------------------------------- /.github/workflows/cicd.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | name: CI/CD 3 | 4 | on: 5 | workflow_dispatch: 6 | push: 7 | branches: 8 | - master 9 | paths-ignore: 10 | - '**.md' 11 | - 'docs/**' 12 | pull_request: 13 | paths-ignore: 14 | - '**.md' 15 | - 'docs/**' 16 | schedule: 17 | - cron: '0 0 1,16 * *' 18 | 19 | concurrency: 20 | group: ${{ github.workflow }}-${{ github.ref }} 21 | cancel-in-progress: true 22 | 23 | jobs: 24 | release-please: 25 | permissions: 26 | contents: write 27 | pull-requests: write 28 | runs-on: ubuntu-latest 29 | outputs: 30 | releases_created: ${{ steps.release.outputs.releases_created }} 31 | prs_created: ${{ steps.release.outputs.prs_created }} 32 | release_created: ${{ steps.release.outputs.release_created }} 33 | major: ${{ steps.release.outputs.major }} 34 | minor: ${{ steps.release.outputs.minor }} 35 | patch: ${{ steps.release.outputs.patch }} 36 | sha: ${{ steps.release.outputs.sha }} 37 | steps: 38 | - name: Automate releases based on conventional commits 39 | id: release 40 | uses: googleapis/release-please-action@a02a34c4d625f9be7cb89156071d8567266a2445 # v4.2.0 41 | with: 42 | token: ${{ secrets.GITHUB_TOKEN }} 43 | config-file: configs/release-please-config.json 44 | manifest-file: configs/release-please-manifest.json 45 | - name: Format and print GH step summary 46 | if: always() 47 | run: | 48 | echo "| Key | Value |" >> $GITHUB_STEP_SUMMARY 49 | echo "|:--|:--|" >> $GITHUB_STEP_SUMMARY 50 | echo "| **releases_created** | ${{ steps.release.outputs.releases_created }} |" >> $GITHUB_STEP_SUMMARY 51 | echo "| **prs_created** | ${{ steps.release.outputs.prs_created }} |" >> $GITHUB_STEP_SUMMARY 52 | - name: Format and print the release_created GH step summary 53 | if: ${{ steps.release.outputs.release_created }} 54 | run: | 55 | echo "" >> $GITHUB_STEP_SUMMARY 56 | echo "| Key | Value |" >> $GITHUB_STEP_SUMMARY 57 | echo "|:--|:--|" >> $GITHUB_STEP_SUMMARY 58 | echo "| **release_created** | ${{ steps.release.outputs.release_created }} |" >> $GITHUB_STEP_SUMMARY 59 | echo "| **major** | ${{ steps.release.outputs.major }} |" >> $GITHUB_STEP_SUMMARY 60 | echo "| **minor** | ${{ steps.release.outputs.minor }} |" >> $GITHUB_STEP_SUMMARY 61 | echo "| **patch** | ${{ steps.release.outputs.patch }} |" >> $GITHUB_STEP_SUMMARY 62 | echo "| **sha** | ${{ steps.release.outputs.sha }} |" >> $GITHUB_STEP_SUMMARY 63 | 64 | lint-and-test: 65 | needs: release-please 66 | permissions: 67 | contents: read 68 | pull-requests: read 69 | checks: write 70 | runs-on: ubuntu-latest 71 | steps: 72 | - name: Checkout default branch 73 | uses: actions/checkout@v4 74 | - name: Run setup-go 75 | uses: actions/setup-go@v5 76 | with: 77 | go-version: 'stable' 78 | cache: false 79 | - name: Check files with golangci-lint 80 | id: golangci 81 | uses: golangci/golangci-lint-action@v8 82 | with: 83 | version: latest 84 | - name: Test changes with go test 85 | id: go-test 86 | run: | 87 | go test -cover ./internal/adapters/left/cli 88 | - name: Format and print GH step summary 89 | if: always() 90 | run: | 91 | echo "| Key | Value |" >> $GITHUB_STEP_SUMMARY 92 | echo "|:--|:--|" >> $GITHUB_STEP_SUMMARY 93 | echo "| **golangci-lint** | ${{ steps.golangci.outcome }} |" >> $GITHUB_STEP_SUMMARY 94 | echo "| **go-test** | ${{ steps.go-test.outcome }} |" >> $GITHUB_STEP_SUMMARY 95 | 96 | goreleaser: 97 | permissions: 98 | contents: write 99 | runs-on: ubuntu-latest 100 | needs: [release-please, lint-and-test] 101 | if: needs.release-please.outputs.release_created 102 | steps: 103 | - name: Checkout default branch 104 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 105 | with: 106 | fetch-depth: 0 107 | - name: Fetch tags 108 | run: git fetch --force --tags 109 | - name: Set up go 110 | uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v.5.4.0 111 | with: 112 | go-version: 'stable' 113 | - name: Build and release with goreleaser 114 | id: releaser 115 | uses: goreleaser/goreleaser-action@9c156ee8a17a598857849441385a2041ef570552 # v6.3.0 116 | with: 117 | distribution: goreleaser 118 | version: latest 119 | args: release --clean --config configs/goreleaser.yaml 120 | env: 121 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 122 | - name: Format and print GH step summary 123 | if: always() 124 | run: | 125 | echo "| Key | Value |" >> $GITHUB_STEP_SUMMARY 126 | echo "|:--|:--|" >> $GITHUB_STEP_SUMMARY 127 | echo "| **goreleaser** | ${{ steps.releaser.outcome }} |" >> $GITHUB_STEP_SUMMARY 128 | 129 | secops: 130 | needs: [release-please, lint-and-test] 131 | permissions: 132 | contents: read 133 | security-events: write 134 | # private repos only 135 | # actions: read 136 | if: ${{ needs.release-please.outputs.release_created }} 137 | uses: ./.github/workflows/secops.yaml 138 | -------------------------------------------------------------------------------- /.github/workflows/secops.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | name: SecOps 3 | on: 4 | workflow_dispatch: 5 | workflow_call: 6 | schedule: 7 | - cron: '0 8 * * 4' 8 | 9 | jobs: 10 | codeql-analyze: 11 | permissions: 12 | security-events: write 13 | # only required for workflows in private repositories 14 | # actions: read 15 | # contents: read 16 | runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }} 17 | timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }} 18 | strategy: 19 | fail-fast: false 20 | matrix: 21 | language: [ 'go' ] 22 | steps: 23 | - name: Checkout repository 24 | uses: actions/checkout@v4 25 | - name: Initialize CodeQL 26 | uses: github/codeql-action/init@v3 27 | with: 28 | languages: ${{ matrix.language }} 29 | - name: Install Go 30 | uses: actions/setup-go@v5 31 | with: 32 | go-version-file: go.mod 33 | - name: Autobuild 34 | uses: github/codeql-action/autobuild@v3 35 | - name: Perform CodeQL Analysis 36 | id: analyze 37 | uses: github/codeql-action/analyze@v3 38 | with: 39 | category: "/language:${{matrix.language}}" 40 | - name: Format and print GH step summary 41 | if: always() 42 | run: | 43 | echo "| Key | Value |" >> $GITHUB_STEP_SUMMARY 44 | echo "|:--|:--|" >> $GITHUB_STEP_SUMMARY 45 | echo "| **codeql** | ${{ steps.analyze.outcome }} |" >> $GITHUB_STEP_SUMMARY 46 | echo "| **codeql_verbosity** | $CODEQL_VERBOSITY |" >> $GITHUB_STEP_SUMMARY 47 | 48 | trivy: 49 | permissions: 50 | contents: read 51 | security-events: write 52 | # private repos only 53 | # actions: read 54 | runs-on: ubuntu-latest 55 | steps: 56 | - name: Checkout default branch 57 | uses: actions/checkout@v4 58 | - name: Run Trivy vulnerability scanner in fs mode 59 | id: trivy-scan 60 | uses: aquasecurity/trivy-action@0.30.0 61 | with: 62 | scan-type: 'fs' 63 | ignore-unfixed: true 64 | format: 'sarif' 65 | output: 'trivy-results.sarif' 66 | severity: 'CRITICAL,HIGH' 67 | - name: Upload Trivy scan results to GitHub Security tab 68 | uses: github/codeql-action/upload-sarif@v3 69 | with: 70 | sarif_file: 'trivy-results.sarif' 71 | - name: Format and print GH step summary 72 | if: always() 73 | run: | 74 | echo "| Key | Value |" >> $GITHUB_STEP_SUMMARY 75 | echo "|:--|:--|" >> $GITHUB_STEP_SUMMARY 76 | echo "| **trivy** | ${{ steps.trivy-scan.outcome }} |" >> $GITHUB_STEP_SUMMARY 77 | echo "| **trivy_ignore_unfixed** | $TRIVY_IGNORE_UNFIXED |" >> $GITHUB_STEP_SUMMARY 78 | echo "| **trivy_severity** | $TRIVY_SEVERITY |" >> $GITHUB_STEP_SUMMARY 79 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /diego 2 | diego_*.yaml 3 | diego_*.toml 4 | diego_*.xml 5 | diego_*.json 6 | diego_*.html 7 | dist/ 8 | /.mkdev/ 9 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | Thank you for contributing to `diego`. Here are some guidelines to help you get started. 4 | 5 | ## Basic steps 6 | 7 | 1. Fork the project. 8 | 1. Download your fork to your PC (`git clone https://github.com/your_username/diego && cd diego`) 9 | 1. Create your feature branch (`git checkout -b feat/new-feature`) 10 | 1. Make changes and test (`make run`) 11 | 1. Add them to staging (`git add .`) 12 | 1. Commit your changes (`git commit -m 'feat(import): add support for new-feature'`) 13 | 1. Push to the branch (`git push origin feat/new-feature`) 14 | 1. Create new pull request 15 | 16 | ## Commit messages 17 | 18 | [Conventional Commits](https://www.conventionalcommits.org/) messages are welcome but not mandatory, since each pull request will be squashed during the merge process. They are used to automate [Semantic Versioning](https://semver.org/) for the releases. 19 | 20 | ## Tests and checks 21 | 22 | Execute `make run` to test and check your changes. If you do not have `golangci-lint` installed on your system, comment out the `golangci-lint run` line in the `Makefile`. 23 | 24 | ## Internals 25 | 26 | `diego` follows the **[Port and Adapters Architecture (Hexagonal)](https://jmgarridopaz.github.io/content/hexagonalarchitecture.html)**. Refer to commit [3eb8bf8](https://github.com/ttybitnik/diego/commit/3eb8bf8c4ff034c0383a258be3eda1b966aa1e86) for an overview of the files that need to be changed to implement support for a new service/file. 27 | 28 | ### Makefile 29 | 30 | - `make dev/start/stop/clean/serestore` :: see [ttybitnik/mkdev](https://github.com/ttybitnik/mkdev) 31 | - `make lint` :: lint the source code 32 | - `make test` :: lint and test the source code 33 | - `make build` :: lint, test, and build the binary 34 | - `make run` :: lint, test, build, and run the binary 35 | - `make deploy` :: lint, test, build, and deploy the application locally 36 | - `make debug` :: build the binary for debugging 37 | - `make disclean` :: remove artifacts 38 | - `make update` :: update module dependencies and call `make run` 39 | - `make golden` :: generate/update golden files using current test results 40 | 41 | ### Generate docs 42 | 43 | To automate the process of updating the `docs/help` and `docs/man` files, set the `DIEGO_GENDOCS` environment variable to `1` before building and running the application. 44 | 45 | The recommended approach is to temporarily set the variable by using the following command whenever necessary: 46 | ```bash 47 | DIEGO_GENDOCS=1 make run 48 | ``` 49 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # MKDEV 0.5.0 (x-release-please-version) 2 | # See for more information. 3 | 4 | PROJECT_NAME = diego 5 | CONTAINER_ENGINE = podman 6 | 7 | RUN_BIND_SOCKET = false 8 | EXEC_SHELL_CMD = /bin/bash 9 | 10 | __USER = $(or $(USER),$(shell whoami)) 11 | __SOCKET = /run/user/$(shell id -u)/podman/podman.sock 12 | 13 | # Host targets/commands 14 | .PHONY: dev start open stop clean serestore 15 | 16 | dev: 17 | $(info Building development container image...) 18 | 19 | $(CONTAINER_ENGINE) build \ 20 | --build-arg USERNAME=$(__USER) \ 21 | -f .mkdev/Containerfile \ 22 | -t localhost/mkdev/$(PROJECT_NAME) \ 23 | . 24 | 25 | start: 26 | $(info Starting development container...) 27 | 28 | $(CONTAINER_ENGINE) run -it -d --replace \ 29 | $(if $(filter podman,$(CONTAINER_ENGINE)),--userns=keep-id) \ 30 | --name mkdev-$(PROJECT_NAME) \ 31 | --volume .:/home/$(__USER)/workspace:Z \ 32 | $(if $(filter true,$(RUN_BIND_SOCKET)),--volume $(__SOCKET):$(__SOCKET)) \ 33 | $(if $(filter true,$(RUN_BIND_SOCKET)),--env CONTAINER_HOST=unix://$(__SOCKET)) \ 34 | localhost/mkdev/$(PROJECT_NAME):latest 35 | 36 | @# $(CONTAINER_ENGINE) compose .mkdev/compose.yaml up -d 37 | 38 | open: 39 | $(info Opening development container...) 40 | 41 | $(CONTAINER_ENGINE) exec -it mkdev-$(PROJECT_NAME) $(EXEC_SHELL_CMD) 42 | 43 | stop: 44 | $(info Stopping development container...) 45 | 46 | $(CONTAINER_ENGINE) stop mkdev-$(PROJECT_NAME) 47 | 48 | @# $(CONTAINER_ENGINE) compose .mkdev/compose.yaml down 49 | 50 | clean: distclean 51 | $(info Removing development container and image...) 52 | 53 | -$(CONTAINER_ENGINE) rm mkdev-$(PROJECT_NAME) 54 | -$(CONTAINER_ENGINE) image rm localhost/mkdev/$(PROJECT_NAME) 55 | 56 | @# $(CONTAINER_ENGINE) image prune 57 | 58 | serestore: 59 | $(info Restoring project SELinux context and permissions...) 60 | 61 | chcon -Rv unconfined_u:object_r:user_home_t:s0 . 62 | # find . -type d -exec chmod 700 {} \; 63 | # find . -type f -exec chmod 600 {} \; 64 | 65 | # Container targets/commands 66 | .PHONY: lint test build run deploy debug distclean 67 | 68 | lint: 69 | $(info Running linters...) 70 | 71 | golangci-lint run 72 | 73 | test: lint 74 | $(info Running tests...) 75 | 76 | go test -cover -race ./internal/adapters/left/cli 77 | 78 | build: test 79 | $(info Building...) 80 | 81 | go build -o $(PROJECT_NAME) main.go 82 | 83 | run: build 84 | $(info Running...) 85 | 86 | ./$(PROJECT_NAME) 87 | 88 | deploy: build 89 | $(info Deploying...) 90 | 91 | goreleaser build --snapshot --clean 92 | 93 | debug: test 94 | $(info Debugging tasks...) 95 | 96 | go build -gcflags=all="-N -l" -o $(PROJECT_NAME) main.go 97 | 98 | distclean: 99 | $(info Cleaning artifacts...) 100 | 101 | rm -rf ./$(PROJECT_NAME) ./dist/ 102 | 103 | 104 | update: 105 | go get -u ./... 106 | go mod tidy 107 | $(MAKE) run 108 | 109 | golden: lint 110 | go test -cover ./internal/adapters/left/cli -update 111 | $(MAKE) run 112 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security policy 2 | 3 | ## Supported versions 4 | 5 | This project is provided "as is" without any warranty or liability, as stated in the license. 6 | 7 | While no formal support is guaranteed, best efforts will be made to address reports promptly and responsibly for the latest version. 8 | 9 | ## Reporting a vulnerability 10 | 11 | If you have found a security vulnerability, **please do not open an issue, submit a pull request, or discuss it publicly on the mailing list**, as this can expose the vulnerability to others. 12 | 13 | Report the issue via [private vulnerability reporting](https://docs.github.com/en/code-security/security-advisories/guidance-on-reporting-and-writing-information-about-vulnerabilities/privately-reporting-a-security-vulnerability) or [eternodevir.com/contact](https://eternodevir.com/contact). 14 | 15 | Once the issue is confirmed and a fix is implemented, a security advisory will be issued, and any necessary updates will be published. 16 | 17 | --- 18 | 19 | Thanks for helping to keep the project secure! 20 | -------------------------------------------------------------------------------- /assets/diego_header.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ttybitnik/diego/93706f3b6e08c58af495bfd0a8d00925e66a0805/assets/diego_header.png -------------------------------------------------------------------------------- /configs/goreleaser.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # This is an example .goreleaser.yml file with some sensible defaults. 3 | # Make sure to check the documentation at https://goreleaser.com 4 | 5 | # The lines below are called `modelines`. See `:help modeline` 6 | # Feel free to remove those if you don't want/need to use them. 7 | # yaml-language-server: $schema=https://goreleaser.com/static/schema.json 8 | # vim: set ts=2 sw=2 tw=0 fo=cnqoj 9 | 10 | version: 2 11 | 12 | before: 13 | hooks: 14 | - go mod tidy 15 | 16 | builds: 17 | - main: . 18 | env: 19 | - CGO_ENABLED=0 20 | goos: 21 | - linux 22 | - freebsd 23 | - darwin 24 | - windows 25 | goarch: 26 | - "amd64" 27 | - "arm64" 28 | - "386" 29 | ignore: 30 | - goos: darwin 31 | goarch: "386" 32 | - goos: windows 33 | goarch: "arm64" 34 | - goos: windows 35 | goarch: "386" 36 | 37 | archives: 38 | - format: tar.gz 39 | # this name template makes the OS and Arch compatible with the results of `uname`. 40 | name_template: >- 41 | {{ .ProjectName }}_ 42 | {{- .Version }}_ 43 | {{- title .Os }}_ 44 | {{- if eq .Arch "amd64" }}x86_64 45 | {{- else if eq .Arch "386" }}i386 46 | {{- else }}{{ .Arch }}{{ end }} 47 | {{- if .Arm }}v{{ .Arm }}{{ end }} 48 | # use zip for windows archives 49 | format_overrides: 50 | - goos: windows 51 | format: zip 52 | files: 53 | - CHANGELOG.md 54 | - COPYING 55 | - README.md 56 | - src: "docs/man/*" 57 | dst: man 58 | strip_parent: true 59 | 60 | # release: 61 | # draft: true 62 | 63 | changelog: 64 | disable: true 65 | -------------------------------------------------------------------------------- /configs/release-please-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json", 3 | "release-type": "go", 4 | "changelog-type": "default", 5 | "changelog-path": "CHANGELOG.md", 6 | "include-component-in-tag": false, 7 | "draft": false, 8 | "prerelease": false, 9 | "bump-minor-pre-major": true, 10 | "changelog-sections": [ 11 | { 12 | "type": "feat", 13 | "section": "Features", 14 | "hidden": false 15 | }, 16 | { 17 | "type": "fix", 18 | "section": "Bug Fixes", 19 | "hidden": false 20 | }, 21 | { 22 | "type": "perf", 23 | "section": "Performance Improvements", 24 | "hidden": false 25 | }, 26 | { 27 | "type": "revert", 28 | "section": "Reverts", 29 | "hidden": false 30 | }, 31 | { 32 | "type": "deps", 33 | "section": "Dependencies", 34 | "hidden": false 35 | }, 36 | { 37 | "type": "docs", 38 | "section": "Documentation", 39 | "hidden": true 40 | }, 41 | { 42 | "type": "chore", 43 | "section": "Miscellaneous Chores", 44 | "hidden": true 45 | }, 46 | { 47 | "type": "refactor", 48 | "section": "Code Refactoring", 49 | "hidden": true 50 | }, 51 | { 52 | "type": "test", 53 | "section": "Tests", 54 | "hidden": true 55 | }, 56 | { 57 | "type": "style", 58 | "section": "Styles", 59 | "hidden": true 60 | }, 61 | { 62 | "type": "build", 63 | "section": "Build System", 64 | "hidden": true 65 | }, 66 | { 67 | "type": "ci", 68 | "section": "Continuous Integration", 69 | "hidden": true 70 | } 71 | ], 72 | "packages": { 73 | ".": { 74 | "extra-files": [ 75 | "internal/adapters/left/cli/root.go", 76 | "README.md" 77 | ] 78 | } 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /configs/release-please-manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | ".": "1.0.4" 3 | } 4 | -------------------------------------------------------------------------------- /docs/help/diego.md: -------------------------------------------------------------------------------- 1 | ## diego 2 | 3 | DIEGO - A data importer extension for Hugo 4 | 5 | ### Synopsis 6 | 7 | DIEGO - A data importer extension for Hugo 8 | 9 | Diego integrates with Hugo as a CLI tool to assist in importing and utilizing 10 | exported social media data from various services on Hugo websites. 11 | 12 | Complete documentation is available at . 13 | 14 | ### Options 15 | 16 | ``` 17 | --config string config file (default is $HOME/.config/diego/config.yaml) 18 | -h, --help help for diego 19 | -v, --version version for diego 20 | ``` 21 | 22 | ### SEE ALSO 23 | 24 | * [diego completion](diego_completion.md) - Generate the autocompletion script for the specified shell 25 | * [diego import](diego_import.md) - Import data from various services into Hugo 26 | * [diego set](diego_set.md) - Set a configuration option 27 | * [diego settings](diego_settings.md) - Show current settings 28 | 29 | -------------------------------------------------------------------------------- /docs/help/diego_completion.md: -------------------------------------------------------------------------------- 1 | ## diego completion 2 | 3 | Generate the autocompletion script for the specified shell 4 | 5 | ### Synopsis 6 | 7 | Generate the autocompletion script for diego for the specified shell. 8 | See each sub-command's help for details on how to use the generated script. 9 | 10 | 11 | ### Options 12 | 13 | ``` 14 | -h, --help help for completion 15 | ``` 16 | 17 | ### Options inherited from parent commands 18 | 19 | ``` 20 | --config string config file (default is $HOME/.config/diego/config.yaml) 21 | ``` 22 | 23 | ### SEE ALSO 24 | 25 | * [diego](diego.md) - DIEGO - A data importer extension for Hugo 26 | * [diego completion bash](diego_completion_bash.md) - Generate the autocompletion script for bash 27 | * [diego completion fish](diego_completion_fish.md) - Generate the autocompletion script for fish 28 | * [diego completion powershell](diego_completion_powershell.md) - Generate the autocompletion script for powershell 29 | * [diego completion zsh](diego_completion_zsh.md) - Generate the autocompletion script for zsh 30 | 31 | -------------------------------------------------------------------------------- /docs/help/diego_completion_bash.md: -------------------------------------------------------------------------------- 1 | ## diego completion bash 2 | 3 | Generate the autocompletion script for bash 4 | 5 | ### Synopsis 6 | 7 | Generate the autocompletion script for the bash shell. 8 | 9 | This script depends on the 'bash-completion' package. 10 | If it is not installed already, you can install it via your OS's package manager. 11 | 12 | To load completions in your current shell session: 13 | 14 | source <(diego completion bash) 15 | 16 | To load completions for every new session, execute once: 17 | 18 | #### Linux: 19 | 20 | diego completion bash > /etc/bash_completion.d/diego 21 | 22 | #### macOS: 23 | 24 | diego completion bash > $(brew --prefix)/etc/bash_completion.d/diego 25 | 26 | You will need to start a new shell for this setup to take effect. 27 | 28 | 29 | ``` 30 | diego completion bash 31 | ``` 32 | 33 | ### Options 34 | 35 | ``` 36 | -h, --help help for bash 37 | --no-descriptions disable completion descriptions 38 | ``` 39 | 40 | ### Options inherited from parent commands 41 | 42 | ``` 43 | --config string config file (default is $HOME/.config/diego/config.yaml) 44 | ``` 45 | 46 | ### SEE ALSO 47 | 48 | * [diego completion](diego_completion.md) - Generate the autocompletion script for the specified shell 49 | 50 | -------------------------------------------------------------------------------- /docs/help/diego_completion_fish.md: -------------------------------------------------------------------------------- 1 | ## diego completion fish 2 | 3 | Generate the autocompletion script for fish 4 | 5 | ### Synopsis 6 | 7 | Generate the autocompletion script for the fish shell. 8 | 9 | To load completions in your current shell session: 10 | 11 | diego completion fish | source 12 | 13 | To load completions for every new session, execute once: 14 | 15 | diego completion fish > ~/.config/fish/completions/diego.fish 16 | 17 | You will need to start a new shell for this setup to take effect. 18 | 19 | 20 | ``` 21 | diego completion fish [flags] 22 | ``` 23 | 24 | ### Options 25 | 26 | ``` 27 | -h, --help help for fish 28 | --no-descriptions disable completion descriptions 29 | ``` 30 | 31 | ### Options inherited from parent commands 32 | 33 | ``` 34 | --config string config file (default is $HOME/.config/diego/config.yaml) 35 | ``` 36 | 37 | ### SEE ALSO 38 | 39 | * [diego completion](diego_completion.md) - Generate the autocompletion script for the specified shell 40 | 41 | -------------------------------------------------------------------------------- /docs/help/diego_completion_powershell.md: -------------------------------------------------------------------------------- 1 | ## diego completion powershell 2 | 3 | Generate the autocompletion script for powershell 4 | 5 | ### Synopsis 6 | 7 | Generate the autocompletion script for powershell. 8 | 9 | To load completions in your current shell session: 10 | 11 | diego completion powershell | Out-String | Invoke-Expression 12 | 13 | To load completions for every new session, add the output of the above command 14 | to your powershell profile. 15 | 16 | 17 | ``` 18 | diego completion powershell [flags] 19 | ``` 20 | 21 | ### Options 22 | 23 | ``` 24 | -h, --help help for powershell 25 | --no-descriptions disable completion descriptions 26 | ``` 27 | 28 | ### Options inherited from parent commands 29 | 30 | ``` 31 | --config string config file (default is $HOME/.config/diego/config.yaml) 32 | ``` 33 | 34 | ### SEE ALSO 35 | 36 | * [diego completion](diego_completion.md) - Generate the autocompletion script for the specified shell 37 | 38 | -------------------------------------------------------------------------------- /docs/help/diego_completion_zsh.md: -------------------------------------------------------------------------------- 1 | ## diego completion zsh 2 | 3 | Generate the autocompletion script for zsh 4 | 5 | ### Synopsis 6 | 7 | Generate the autocompletion script for the zsh shell. 8 | 9 | If shell completion is not already enabled in your environment you will need 10 | to enable it. You can execute the following once: 11 | 12 | echo "autoload -U compinit; compinit" >> ~/.zshrc 13 | 14 | To load completions in your current shell session: 15 | 16 | source <(diego completion zsh) 17 | 18 | To load completions for every new session, execute once: 19 | 20 | #### Linux: 21 | 22 | diego completion zsh > "${fpath[1]}/_diego" 23 | 24 | #### macOS: 25 | 26 | diego completion zsh > $(brew --prefix)/share/zsh/site-functions/_diego 27 | 28 | You will need to start a new shell for this setup to take effect. 29 | 30 | 31 | ``` 32 | diego completion zsh [flags] 33 | ``` 34 | 35 | ### Options 36 | 37 | ``` 38 | -h, --help help for zsh 39 | --no-descriptions disable completion descriptions 40 | ``` 41 | 42 | ### Options inherited from parent commands 43 | 44 | ``` 45 | --config string config file (default is $HOME/.config/diego/config.yaml) 46 | ``` 47 | 48 | ### SEE ALSO 49 | 50 | * [diego completion](diego_completion.md) - Generate the autocompletion script for the specified shell 51 | 52 | -------------------------------------------------------------------------------- /docs/help/diego_import.md: -------------------------------------------------------------------------------- 1 | ## diego import 2 | 3 | Import data from various services into Hugo 4 | 5 | ### Synopsis 6 | 7 | Import data from various services into Hugo. 8 | 9 | ### Options 10 | 11 | ``` 12 | -h, --help help for import 13 | ``` 14 | 15 | ### Options inherited from parent commands 16 | 17 | ``` 18 | --config string config file (default is $HOME/.config/diego/config.yaml) 19 | ``` 20 | 21 | ### SEE ALSO 22 | 23 | * [diego](diego.md) - DIEGO - A data importer extension for Hugo 24 | * [diego import goodreads](diego_import_goodreads.md) - Import data from Goodreads 25 | * [diego import imdb](diego_import_imdb.md) - Import data from IMDb 26 | * [diego import instapaper](diego_import_instapaper.md) - Import data from Instapaper 27 | * [diego import letterboxd](diego_import_letterboxd.md) - Import data from Letterboxd 28 | * [diego import spotify](diego_import_spotify.md) - Import data from Spotify 29 | * [diego import youtube](diego_import_youtube.md) - Import data from YouTube 30 | 31 | -------------------------------------------------------------------------------- /docs/help/diego_import_goodreads.md: -------------------------------------------------------------------------------- 1 | ## diego import goodreads 2 | 3 | Import data from Goodreads 4 | 5 | ### Synopsis 6 | 7 | Import data from Goodreads. 8 | 9 | ``` 10 | diego import goodreads {library} -i file [flags] 11 | ``` 12 | 13 | ### Examples 14 | 15 | ``` 16 | diego import goodreads library -i library.csv 17 | diego i g library -i library.csv --all --scrape --shortcode 18 | ``` 19 | 20 | ### Options 21 | 22 | ``` 23 | --all import every available field from CSV file 24 | --format string output format for the Hugo data file (default "yaml") 25 | -h, --help help for goodreads 26 | --hugodir string path to the Hugo directory (default ".") 27 | -i, --input string path to the CSV file (required) 28 | --overwrite overwrite existent output data file 29 | --scrape fetch additional data from CSV links using HTTP 30 | --shortcode generate a shortcode template for Hugo 31 | ``` 32 | 33 | ### Options inherited from parent commands 34 | 35 | ``` 36 | --config string config file (default is $HOME/.config/diego/config.yaml) 37 | ``` 38 | 39 | ### SEE ALSO 40 | 41 | * [diego import](diego_import.md) - Import data from various services into Hugo 42 | 43 | -------------------------------------------------------------------------------- /docs/help/diego_import_imdb.md: -------------------------------------------------------------------------------- 1 | ## diego import imdb 2 | 3 | Import data from IMDb 4 | 5 | ### Synopsis 6 | 7 | Import data from IMDb. 8 | 9 | ``` 10 | diego import imdb {list|ratings|watchlist} -i file [flags] 11 | ``` 12 | 13 | ### Examples 14 | 15 | ``` 16 | diego import imdb list -i list.csv 17 | diego i i ratings -i ratings.csv --all --scrape --shortcode 18 | ``` 19 | 20 | ### Options 21 | 22 | ``` 23 | --all import every available field from CSV file 24 | --format string output format for the Hugo data file (default "yaml") 25 | -h, --help help for imdb 26 | --hugodir string path to the Hugo directory (default ".") 27 | -i, --input string path to the CSV file (required) 28 | --overwrite overwrite existent output data file 29 | --scrape fetch additional data from CSV links using HTTP 30 | --shortcode generate a shortcode template for Hugo 31 | ``` 32 | 33 | ### Options inherited from parent commands 34 | 35 | ``` 36 | --config string config file (default is $HOME/.config/diego/config.yaml) 37 | ``` 38 | 39 | ### SEE ALSO 40 | 41 | * [diego import](diego_import.md) - Import data from various services into Hugo 42 | 43 | -------------------------------------------------------------------------------- /docs/help/diego_import_instapaper.md: -------------------------------------------------------------------------------- 1 | ## diego import instapaper 2 | 3 | Import data from Instapaper 4 | 5 | ### Synopsis 6 | 7 | Import data from Instapaper. 8 | 9 | ``` 10 | diego import instapaper {list} -i file [flags] 11 | ``` 12 | 13 | ### Examples 14 | 15 | ``` 16 | diego import instapaper list -i list.csv 17 | diego i ip list -i list.csv --all --shortcode 18 | ``` 19 | 20 | ### Options 21 | 22 | ``` 23 | --all import every available field from CSV file 24 | --format string output format for the Hugo data file (default "yaml") 25 | -h, --help help for instapaper 26 | --hugodir string path to the Hugo directory (default ".") 27 | -i, --input string path to the CSV file (required) 28 | --overwrite overwrite existent output data file 29 | --shortcode generate a shortcode template for Hugo 30 | ``` 31 | 32 | ### Options inherited from parent commands 33 | 34 | ``` 35 | --config string config file (default is $HOME/.config/diego/config.yaml) 36 | ``` 37 | 38 | ### SEE ALSO 39 | 40 | * [diego import](diego_import.md) - Import data from various services into Hugo 41 | 42 | -------------------------------------------------------------------------------- /docs/help/diego_import_letterboxd.md: -------------------------------------------------------------------------------- 1 | ## diego import letterboxd 2 | 3 | Import data from Letterboxd 4 | 5 | ### Synopsis 6 | 7 | Import data from Letterboxd. 8 | 9 | ``` 10 | diego import letterboxd {diary|films|reviews|watchlist} -i file [flags] 11 | ``` 12 | 13 | ### Examples 14 | 15 | ``` 16 | diego import letterboxd films -i films.csv 17 | diego i l diary -i diary.csv --all --scrape --shortcode 18 | ``` 19 | 20 | ### Options 21 | 22 | ``` 23 | --all import every available field from CSV file 24 | --format string output format for the Hugo data file (default "yaml") 25 | -h, --help help for letterboxd 26 | --hugodir string path to the Hugo directory (default ".") 27 | -i, --input string path to the CSV file (required) 28 | --overwrite overwrite existent output data file 29 | --scrape fetch additional data from CSV links using HTTP 30 | --shortcode generate a shortcode template for Hugo 31 | ``` 32 | 33 | ### Options inherited from parent commands 34 | 35 | ``` 36 | --config string config file (default is $HOME/.config/diego/config.yaml) 37 | ``` 38 | 39 | ### SEE ALSO 40 | 41 | * [diego import](diego_import.md) - Import data from various services into Hugo 42 | 43 | -------------------------------------------------------------------------------- /docs/help/diego_import_spotify.md: -------------------------------------------------------------------------------- 1 | ## diego import spotify 2 | 3 | Import data from Spotify 4 | 5 | ### Synopsis 6 | 7 | Import data from Spotify. 8 | 9 | ``` 10 | diego import spotify {library|playlist} -i file [flags] 11 | ``` 12 | 13 | ### Examples 14 | 15 | ``` 16 | diego import spotify library -i library.json 17 | diego i s playlist -i playlist.json --all --shortcode 18 | ``` 19 | 20 | ### Options 21 | 22 | ``` 23 | --all import every available field from JSON file 24 | --format string output format for the Hugo data file (default "yaml") 25 | -h, --help help for spotify 26 | --hugodir string path to the Hugo directory (default ".") 27 | -i, --input string path to the JSON file (required) 28 | --overwrite overwrite existent output data file 29 | --shortcode generate a shortcode template for Hugo 30 | ``` 31 | 32 | ### Options inherited from parent commands 33 | 34 | ``` 35 | --config string config file (default is $HOME/.config/diego/config.yaml) 36 | ``` 37 | 38 | ### SEE ALSO 39 | 40 | * [diego import](diego_import.md) - Import data from various services into Hugo 41 | 42 | -------------------------------------------------------------------------------- /docs/help/diego_import_youtube.md: -------------------------------------------------------------------------------- 1 | ## diego import youtube 2 | 3 | Import data from YouTube 4 | 5 | ### Synopsis 6 | 7 | Import data from YouTube. 8 | 9 | ``` 10 | diego import youtube {playlist|subscriptions} -i file [flags] 11 | ``` 12 | 13 | ### Examples 14 | 15 | ``` 16 | diego import youtube subscriptions -i subscriptions.csv 17 | diego i y playlist -i playlist.csv --all --scrape --shortcode 18 | ``` 19 | 20 | ### Options 21 | 22 | ``` 23 | --all import every available field from CSV file 24 | --format string output format for the Hugo data file (default "yaml") 25 | -h, --help help for youtube 26 | --hugodir string path to the Hugo directory (default ".") 27 | -i, --input string path to the CSV file (required) 28 | --overwrite overwrite existent output data file 29 | --scrape fetch additional data from CSV links using HTTP 30 | --shortcode generate a shortcode template for Hugo 31 | ``` 32 | 33 | ### Options inherited from parent commands 34 | 35 | ``` 36 | --config string config file (default is $HOME/.config/diego/config.yaml) 37 | ``` 38 | 39 | ### SEE ALSO 40 | 41 | * [diego import](diego_import.md) - Import data from various services into Hugo 42 | 43 | -------------------------------------------------------------------------------- /docs/help/diego_set.md: -------------------------------------------------------------------------------- 1 | ## diego set 2 | 3 | Set a configuration option 4 | 5 | ### Synopsis 6 | 7 | Set a configuration option. 8 | 9 | ### Options 10 | 11 | ``` 12 | -h, --help help for set 13 | ``` 14 | 15 | ### Options inherited from parent commands 16 | 17 | ``` 18 | --config string config file (default is $HOME/.config/diego/config.yaml) 19 | ``` 20 | 21 | ### SEE ALSO 22 | 23 | * [diego](diego.md) - DIEGO - A data importer extension for Hugo 24 | * [diego set all](diego_set_all.md) - Enable or disable the all flag by default 25 | * [diego set defaults](diego_set_defaults.md) - Restore Diego default settings 26 | * [diego set format](diego_set_format.md) - Set output format for the Hugo data file (default "yaml") 27 | * [diego set hugodir](diego_set_hugodir.md) - Set path to the Hugo directory (default ".") 28 | * [diego set overwrite](diego_set_overwrite.md) - Enable or disable the overwrite flag by default 29 | * [diego set scrape](diego_set_scrape.md) - Enable or disable the scrape flag by default 30 | * [diego set shortcode](diego_set_shortcode.md) - Enable or disable the shortcode flag by default 31 | 32 | -------------------------------------------------------------------------------- /docs/help/diego_set_all.md: -------------------------------------------------------------------------------- 1 | ## diego set all 2 | 3 | Enable or disable the all flag by default 4 | 5 | ### Synopsis 6 | 7 | Enable or disable the all flag by default. 8 | 9 | ``` 10 | diego set all {true|false|1|0|enabled|disabled} [flags] 11 | ``` 12 | 13 | ### Examples 14 | 15 | ``` 16 | diego set all true 17 | diego s all false 18 | ``` 19 | 20 | ### Options 21 | 22 | ``` 23 | -h, --help help for all 24 | ``` 25 | 26 | ### Options inherited from parent commands 27 | 28 | ``` 29 | --config string config file (default is $HOME/.config/diego/config.yaml) 30 | ``` 31 | 32 | ### SEE ALSO 33 | 34 | * [diego set](diego_set.md) - Set a configuration option 35 | 36 | -------------------------------------------------------------------------------- /docs/help/diego_set_defaults.md: -------------------------------------------------------------------------------- 1 | ## diego set defaults 2 | 3 | Restore Diego default settings 4 | 5 | ### Synopsis 6 | 7 | Restore Diego default settings. 8 | 9 | ``` 10 | diego set defaults [flags] 11 | ``` 12 | 13 | ### Examples 14 | 15 | ``` 16 | diego set defaults true 17 | diego s defaults 1 18 | ``` 19 | 20 | ### Options 21 | 22 | ``` 23 | -h, --help help for defaults 24 | ``` 25 | 26 | ### Options inherited from parent commands 27 | 28 | ``` 29 | --config string config file (default is $HOME/.config/diego/config.yaml) 30 | ``` 31 | 32 | ### SEE ALSO 33 | 34 | * [diego set](diego_set.md) - Set a configuration option 35 | 36 | -------------------------------------------------------------------------------- /docs/help/diego_set_format.md: -------------------------------------------------------------------------------- 1 | ## diego set format 2 | 3 | Set output format for the Hugo data file (default "yaml") 4 | 5 | ### Synopsis 6 | 7 | Set output format for the Hugo data file (default "yaml"). 8 | 9 | ``` 10 | diego set format {yaml|json|toml|xml} [flags] 11 | ``` 12 | 13 | ### Examples 14 | 15 | ``` 16 | diego set format yaml 17 | diego s format json 18 | ``` 19 | 20 | ### Options 21 | 22 | ``` 23 | -h, --help help for format 24 | ``` 25 | 26 | ### Options inherited from parent commands 27 | 28 | ``` 29 | --config string config file (default is $HOME/.config/diego/config.yaml) 30 | ``` 31 | 32 | ### SEE ALSO 33 | 34 | * [diego set](diego_set.md) - Set a configuration option 35 | 36 | -------------------------------------------------------------------------------- /docs/help/diego_set_hugodir.md: -------------------------------------------------------------------------------- 1 | ## diego set hugodir 2 | 3 | Set path to the Hugo directory (default ".") 4 | 5 | ### Synopsis 6 | 7 | Set path to the Hugo directory (default "."). 8 | 9 | ``` 10 | diego set hugodir path [flags] 11 | ``` 12 | 13 | ### Examples 14 | 15 | ``` 16 | diego set hugodir ~/Projects/HugoBlog 17 | diego s hugodir ../Projects/HugoSite 18 | ``` 19 | 20 | ### Options 21 | 22 | ``` 23 | -h, --help help for hugodir 24 | ``` 25 | 26 | ### Options inherited from parent commands 27 | 28 | ``` 29 | --config string config file (default is $HOME/.config/diego/config.yaml) 30 | ``` 31 | 32 | ### SEE ALSO 33 | 34 | * [diego set](diego_set.md) - Set a configuration option 35 | 36 | -------------------------------------------------------------------------------- /docs/help/diego_set_overwrite.md: -------------------------------------------------------------------------------- 1 | ## diego set overwrite 2 | 3 | Enable or disable the overwrite flag by default 4 | 5 | ### Synopsis 6 | 7 | Enable or disable the overwrite flag by default. 8 | 9 | ``` 10 | diego set overwrite {true|false|1|0|enabled|disabled} [flags] 11 | ``` 12 | 13 | ### Examples 14 | 15 | ``` 16 | diego set overwrite true 17 | diego s overwrite false 18 | ``` 19 | 20 | ### Options 21 | 22 | ``` 23 | -h, --help help for overwrite 24 | ``` 25 | 26 | ### Options inherited from parent commands 27 | 28 | ``` 29 | --config string config file (default is $HOME/.config/diego/config.yaml) 30 | ``` 31 | 32 | ### SEE ALSO 33 | 34 | * [diego set](diego_set.md) - Set a configuration option 35 | 36 | -------------------------------------------------------------------------------- /docs/help/diego_set_scrape.md: -------------------------------------------------------------------------------- 1 | ## diego set scrape 2 | 3 | Enable or disable the scrape flag by default 4 | 5 | ### Synopsis 6 | 7 | Enable or disable the scrape flag by default. 8 | 9 | ``` 10 | diego set scrape {true|false|1|0|enabled|disabled} [flags] 11 | ``` 12 | 13 | ### Examples 14 | 15 | ``` 16 | diego set scrape true 17 | diego s scrape false 18 | ``` 19 | 20 | ### Options 21 | 22 | ``` 23 | -h, --help help for scrape 24 | ``` 25 | 26 | ### Options inherited from parent commands 27 | 28 | ``` 29 | --config string config file (default is $HOME/.config/diego/config.yaml) 30 | ``` 31 | 32 | ### SEE ALSO 33 | 34 | * [diego set](diego_set.md) - Set a configuration option 35 | 36 | -------------------------------------------------------------------------------- /docs/help/diego_set_shortcode.md: -------------------------------------------------------------------------------- 1 | ## diego set shortcode 2 | 3 | Enable or disable the shortcode flag by default 4 | 5 | ### Synopsis 6 | 7 | Enable or disable the shortcode flag by default. 8 | 9 | ``` 10 | diego set shortcode {true|false|1|0|enabled|disabled} [flags] 11 | ``` 12 | 13 | ### Examples 14 | 15 | ``` 16 | diego set shortcode true 17 | diego s shortcode false 18 | ``` 19 | 20 | ### Options 21 | 22 | ``` 23 | -h, --help help for shortcode 24 | ``` 25 | 26 | ### Options inherited from parent commands 27 | 28 | ``` 29 | --config string config file (default is $HOME/.config/diego/config.yaml) 30 | ``` 31 | 32 | ### SEE ALSO 33 | 34 | * [diego set](diego_set.md) - Set a configuration option 35 | 36 | -------------------------------------------------------------------------------- /docs/help/diego_settings.md: -------------------------------------------------------------------------------- 1 | ## diego settings 2 | 3 | Show current settings 4 | 5 | ### Synopsis 6 | 7 | Show current settings. 8 | 9 | ``` 10 | diego settings [flags] 11 | ``` 12 | 13 | ### Options 14 | 15 | ``` 16 | -h, --help help for settings 17 | ``` 18 | 19 | ### Options inherited from parent commands 20 | 21 | ``` 22 | --config string config file (default is $HOME/.config/diego/config.yaml) 23 | ``` 24 | 25 | ### SEE ALSO 26 | 27 | * [diego](diego.md) - DIEGO - A data importer extension for Hugo 28 | 29 | -------------------------------------------------------------------------------- /docs/man/diego-completion-bash.1: -------------------------------------------------------------------------------- 1 | .nh 2 | .TH "DIEGO" "1" "Apr 2025" "diego manual" "User Commands" 3 | 4 | .SH NAME 5 | diego-completion-bash - Generate the autocompletion script for bash 6 | 7 | 8 | .SH SYNOPSIS 9 | \fBdiego completion bash\fP 10 | 11 | 12 | .SH DESCRIPTION 13 | Generate the autocompletion script for the bash shell. 14 | 15 | .PP 16 | This script depends on the 'bash-completion' package. 17 | If it is not installed already, you can install it via your OS's package manager. 18 | 19 | .PP 20 | To load completions in your current shell session: 21 | 22 | .EX 23 | source <(diego completion bash) 24 | .EE 25 | 26 | .PP 27 | To load completions for every new session, execute once: 28 | 29 | .SS Linux: 30 | .EX 31 | diego completion bash > /etc/bash_completion.d/diego 32 | .EE 33 | 34 | .SS macOS: 35 | .EX 36 | diego completion bash > $(brew --prefix)/etc/bash_completion.d/diego 37 | .EE 38 | 39 | .PP 40 | You will need to start a new shell for this setup to take effect. 41 | 42 | 43 | .SH OPTIONS 44 | \fB-h\fP, \fB--help\fP[=false] 45 | help for bash 46 | 47 | .PP 48 | \fB--no-descriptions\fP[=false] 49 | disable completion descriptions 50 | 51 | 52 | .SH OPTIONS INHERITED FROM PARENT COMMANDS 53 | \fB--config\fP="" 54 | config file (default is $HOME/.config/diego/config.yaml) 55 | 56 | 57 | .SH SEE ALSO 58 | \fBdiego-completion(1)\fP 59 | -------------------------------------------------------------------------------- /docs/man/diego-completion-fish.1: -------------------------------------------------------------------------------- 1 | .nh 2 | .TH "DIEGO" "1" "Apr 2025" "diego manual" "User Commands" 3 | 4 | .SH NAME 5 | diego-completion-fish - Generate the autocompletion script for fish 6 | 7 | 8 | .SH SYNOPSIS 9 | \fBdiego completion fish [flags]\fP 10 | 11 | 12 | .SH DESCRIPTION 13 | Generate the autocompletion script for the fish shell. 14 | 15 | .PP 16 | To load completions in your current shell session: 17 | 18 | .EX 19 | diego completion fish | source 20 | .EE 21 | 22 | .PP 23 | To load completions for every new session, execute once: 24 | 25 | .EX 26 | diego completion fish > ~/.config/fish/completions/diego.fish 27 | .EE 28 | 29 | .PP 30 | You will need to start a new shell for this setup to take effect. 31 | 32 | 33 | .SH OPTIONS 34 | \fB-h\fP, \fB--help\fP[=false] 35 | help for fish 36 | 37 | .PP 38 | \fB--no-descriptions\fP[=false] 39 | disable completion descriptions 40 | 41 | 42 | .SH OPTIONS INHERITED FROM PARENT COMMANDS 43 | \fB--config\fP="" 44 | config file (default is $HOME/.config/diego/config.yaml) 45 | 46 | 47 | .SH SEE ALSO 48 | \fBdiego-completion(1)\fP 49 | -------------------------------------------------------------------------------- /docs/man/diego-completion-powershell.1: -------------------------------------------------------------------------------- 1 | .nh 2 | .TH "DIEGO" "1" "Apr 2025" "diego manual" "User Commands" 3 | 4 | .SH NAME 5 | diego-completion-powershell - Generate the autocompletion script for powershell 6 | 7 | 8 | .SH SYNOPSIS 9 | \fBdiego completion powershell [flags]\fP 10 | 11 | 12 | .SH DESCRIPTION 13 | Generate the autocompletion script for powershell. 14 | 15 | .PP 16 | To load completions in your current shell session: 17 | 18 | .EX 19 | diego completion powershell | Out-String | Invoke-Expression 20 | .EE 21 | 22 | .PP 23 | To load completions for every new session, add the output of the above command 24 | to your powershell profile. 25 | 26 | 27 | .SH OPTIONS 28 | \fB-h\fP, \fB--help\fP[=false] 29 | help for powershell 30 | 31 | .PP 32 | \fB--no-descriptions\fP[=false] 33 | disable completion descriptions 34 | 35 | 36 | .SH OPTIONS INHERITED FROM PARENT COMMANDS 37 | \fB--config\fP="" 38 | config file (default is $HOME/.config/diego/config.yaml) 39 | 40 | 41 | .SH SEE ALSO 42 | \fBdiego-completion(1)\fP 43 | -------------------------------------------------------------------------------- /docs/man/diego-completion-zsh.1: -------------------------------------------------------------------------------- 1 | .nh 2 | .TH "DIEGO" "1" "Apr 2025" "diego manual" "User Commands" 3 | 4 | .SH NAME 5 | diego-completion-zsh - Generate the autocompletion script for zsh 6 | 7 | 8 | .SH SYNOPSIS 9 | \fBdiego completion zsh [flags]\fP 10 | 11 | 12 | .SH DESCRIPTION 13 | Generate the autocompletion script for the zsh shell. 14 | 15 | .PP 16 | If shell completion is not already enabled in your environment you will need 17 | to enable it. You can execute the following once: 18 | 19 | .EX 20 | echo "autoload -U compinit; compinit" >> ~/.zshrc 21 | .EE 22 | 23 | .PP 24 | To load completions in your current shell session: 25 | 26 | .EX 27 | source <(diego completion zsh) 28 | .EE 29 | 30 | .PP 31 | To load completions for every new session, execute once: 32 | 33 | .SS Linux: 34 | .EX 35 | diego completion zsh > "${fpath[1]}/_diego" 36 | .EE 37 | 38 | .SS macOS: 39 | .EX 40 | diego completion zsh > $(brew --prefix)/share/zsh/site-functions/_diego 41 | .EE 42 | 43 | .PP 44 | You will need to start a new shell for this setup to take effect. 45 | 46 | 47 | .SH OPTIONS 48 | \fB-h\fP, \fB--help\fP[=false] 49 | help for zsh 50 | 51 | .PP 52 | \fB--no-descriptions\fP[=false] 53 | disable completion descriptions 54 | 55 | 56 | .SH OPTIONS INHERITED FROM PARENT COMMANDS 57 | \fB--config\fP="" 58 | config file (default is $HOME/.config/diego/config.yaml) 59 | 60 | 61 | .SH SEE ALSO 62 | \fBdiego-completion(1)\fP 63 | -------------------------------------------------------------------------------- /docs/man/diego-completion.1: -------------------------------------------------------------------------------- 1 | .nh 2 | .TH "DIEGO" "1" "Apr 2025" "diego manual" "User Commands" 3 | 4 | .SH NAME 5 | diego-completion - Generate the autocompletion script for the specified shell 6 | 7 | 8 | .SH SYNOPSIS 9 | \fBdiego completion [flags]\fP 10 | 11 | 12 | .SH DESCRIPTION 13 | Generate the autocompletion script for diego for the specified shell. 14 | See each sub-command's help for details on how to use the generated script. 15 | 16 | 17 | .SH OPTIONS 18 | \fB-h\fP, \fB--help\fP[=false] 19 | help for completion 20 | 21 | 22 | .SH OPTIONS INHERITED FROM PARENT COMMANDS 23 | \fB--config\fP="" 24 | config file (default is $HOME/.config/diego/config.yaml) 25 | 26 | 27 | .SH SEE ALSO 28 | \fBdiego(1)\fP, \fBdiego-completion-bash(1)\fP, \fBdiego-completion-fish(1)\fP, \fBdiego-completion-powershell(1)\fP, \fBdiego-completion-zsh(1)\fP 29 | -------------------------------------------------------------------------------- /docs/man/diego-import-goodreads.1: -------------------------------------------------------------------------------- 1 | .nh 2 | .TH "DIEGO" "1" "Apr 2025" "diego manual" "User Commands" 3 | 4 | .SH NAME 5 | diego-import-goodreads - Import data from Goodreads 6 | 7 | 8 | .SH SYNOPSIS 9 | \fBdiego import goodreads {library} -i file [flags]\fP 10 | 11 | 12 | .SH DESCRIPTION 13 | Import data from Goodreads. 14 | 15 | 16 | .SH OPTIONS 17 | \fB--all\fP[=false] 18 | import every available field from CSV file 19 | 20 | .PP 21 | \fB--format\fP="yaml" 22 | output format for the Hugo data file 23 | 24 | .PP 25 | \fB-h\fP, \fB--help\fP[=false] 26 | help for goodreads 27 | 28 | .PP 29 | \fB--hugodir\fP="." 30 | path to the Hugo directory 31 | 32 | .PP 33 | \fB-i\fP, \fB--input\fP="" 34 | path to the CSV file (required) 35 | 36 | .PP 37 | \fB--overwrite\fP[=false] 38 | overwrite existent output data file 39 | 40 | .PP 41 | \fB--scrape\fP[=false] 42 | fetch additional data from CSV links using HTTP 43 | 44 | .PP 45 | \fB--shortcode\fP[=false] 46 | generate a shortcode template for Hugo 47 | 48 | 49 | .SH OPTIONS INHERITED FROM PARENT COMMANDS 50 | \fB--config\fP="" 51 | config file (default is $HOME/.config/diego/config.yaml) 52 | 53 | 54 | .SH EXAMPLE 55 | .EX 56 | diego import goodreads library -i library.csv 57 | diego i g library -i library.csv --all --scrape --shortcode 58 | .EE 59 | 60 | 61 | .SH SEE ALSO 62 | \fBdiego-import(1)\fP 63 | -------------------------------------------------------------------------------- /docs/man/diego-import-imdb.1: -------------------------------------------------------------------------------- 1 | .nh 2 | .TH "DIEGO" "1" "Apr 2025" "diego manual" "User Commands" 3 | 4 | .SH NAME 5 | diego-import-imdb - Import data from IMDb 6 | 7 | 8 | .SH SYNOPSIS 9 | \fBdiego import imdb {list|ratings|watchlist} -i file [flags]\fP 10 | 11 | 12 | .SH DESCRIPTION 13 | Import data from IMDb. 14 | 15 | 16 | .SH OPTIONS 17 | \fB--all\fP[=false] 18 | import every available field from CSV file 19 | 20 | .PP 21 | \fB--format\fP="yaml" 22 | output format for the Hugo data file 23 | 24 | .PP 25 | \fB-h\fP, \fB--help\fP[=false] 26 | help for imdb 27 | 28 | .PP 29 | \fB--hugodir\fP="." 30 | path to the Hugo directory 31 | 32 | .PP 33 | \fB-i\fP, \fB--input\fP="" 34 | path to the CSV file (required) 35 | 36 | .PP 37 | \fB--overwrite\fP[=false] 38 | overwrite existent output data file 39 | 40 | .PP 41 | \fB--scrape\fP[=false] 42 | fetch additional data from CSV links using HTTP 43 | 44 | .PP 45 | \fB--shortcode\fP[=false] 46 | generate a shortcode template for Hugo 47 | 48 | 49 | .SH OPTIONS INHERITED FROM PARENT COMMANDS 50 | \fB--config\fP="" 51 | config file (default is $HOME/.config/diego/config.yaml) 52 | 53 | 54 | .SH EXAMPLE 55 | .EX 56 | diego import imdb list -i list.csv 57 | diego i i ratings -i ratings.csv --all --scrape --shortcode 58 | .EE 59 | 60 | 61 | .SH SEE ALSO 62 | \fBdiego-import(1)\fP 63 | -------------------------------------------------------------------------------- /docs/man/diego-import-instapaper.1: -------------------------------------------------------------------------------- 1 | .nh 2 | .TH "DIEGO" "1" "Apr 2025" "diego manual" "User Commands" 3 | 4 | .SH NAME 5 | diego-import-instapaper - Import data from Instapaper 6 | 7 | 8 | .SH SYNOPSIS 9 | \fBdiego import instapaper {list} -i file [flags]\fP 10 | 11 | 12 | .SH DESCRIPTION 13 | Import data from Instapaper. 14 | 15 | 16 | .SH OPTIONS 17 | \fB--all\fP[=false] 18 | import every available field from CSV file 19 | 20 | .PP 21 | \fB--format\fP="yaml" 22 | output format for the Hugo data file 23 | 24 | .PP 25 | \fB-h\fP, \fB--help\fP[=false] 26 | help for instapaper 27 | 28 | .PP 29 | \fB--hugodir\fP="." 30 | path to the Hugo directory 31 | 32 | .PP 33 | \fB-i\fP, \fB--input\fP="" 34 | path to the CSV file (required) 35 | 36 | .PP 37 | \fB--overwrite\fP[=false] 38 | overwrite existent output data file 39 | 40 | .PP 41 | \fB--shortcode\fP[=false] 42 | generate a shortcode template for Hugo 43 | 44 | 45 | .SH OPTIONS INHERITED FROM PARENT COMMANDS 46 | \fB--config\fP="" 47 | config file (default is $HOME/.config/diego/config.yaml) 48 | 49 | 50 | .SH EXAMPLE 51 | .EX 52 | diego import instapaper list -i list.csv 53 | diego i ip list -i list.csv --all --shortcode 54 | .EE 55 | 56 | 57 | .SH SEE ALSO 58 | \fBdiego-import(1)\fP 59 | -------------------------------------------------------------------------------- /docs/man/diego-import-letterboxd.1: -------------------------------------------------------------------------------- 1 | .nh 2 | .TH "DIEGO" "1" "Apr 2025" "diego manual" "User Commands" 3 | 4 | .SH NAME 5 | diego-import-letterboxd - Import data from Letterboxd 6 | 7 | 8 | .SH SYNOPSIS 9 | \fBdiego import letterboxd {diary|films|reviews|watchlist} -i file [flags]\fP 10 | 11 | 12 | .SH DESCRIPTION 13 | Import data from Letterboxd. 14 | 15 | 16 | .SH OPTIONS 17 | \fB--all\fP[=false] 18 | import every available field from CSV file 19 | 20 | .PP 21 | \fB--format\fP="yaml" 22 | output format for the Hugo data file 23 | 24 | .PP 25 | \fB-h\fP, \fB--help\fP[=false] 26 | help for letterboxd 27 | 28 | .PP 29 | \fB--hugodir\fP="." 30 | path to the Hugo directory 31 | 32 | .PP 33 | \fB-i\fP, \fB--input\fP="" 34 | path to the CSV file (required) 35 | 36 | .PP 37 | \fB--overwrite\fP[=false] 38 | overwrite existent output data file 39 | 40 | .PP 41 | \fB--scrape\fP[=false] 42 | fetch additional data from CSV links using HTTP 43 | 44 | .PP 45 | \fB--shortcode\fP[=false] 46 | generate a shortcode template for Hugo 47 | 48 | 49 | .SH OPTIONS INHERITED FROM PARENT COMMANDS 50 | \fB--config\fP="" 51 | config file (default is $HOME/.config/diego/config.yaml) 52 | 53 | 54 | .SH EXAMPLE 55 | .EX 56 | diego import letterboxd films -i films.csv 57 | diego i l diary -i diary.csv --all --scrape --shortcode 58 | .EE 59 | 60 | 61 | .SH SEE ALSO 62 | \fBdiego-import(1)\fP 63 | -------------------------------------------------------------------------------- /docs/man/diego-import-spotify.1: -------------------------------------------------------------------------------- 1 | .nh 2 | .TH "DIEGO" "1" "Apr 2025" "diego manual" "User Commands" 3 | 4 | .SH NAME 5 | diego-import-spotify - Import data from Spotify 6 | 7 | 8 | .SH SYNOPSIS 9 | \fBdiego import spotify {library|playlist} -i file [flags]\fP 10 | 11 | 12 | .SH DESCRIPTION 13 | Import data from Spotify. 14 | 15 | 16 | .SH OPTIONS 17 | \fB--all\fP[=false] 18 | import every available field from JSON file 19 | 20 | .PP 21 | \fB--format\fP="yaml" 22 | output format for the Hugo data file 23 | 24 | .PP 25 | \fB-h\fP, \fB--help\fP[=false] 26 | help for spotify 27 | 28 | .PP 29 | \fB--hugodir\fP="." 30 | path to the Hugo directory 31 | 32 | .PP 33 | \fB-i\fP, \fB--input\fP="" 34 | path to the JSON file (required) 35 | 36 | .PP 37 | \fB--overwrite\fP[=false] 38 | overwrite existent output data file 39 | 40 | .PP 41 | \fB--shortcode\fP[=false] 42 | generate a shortcode template for Hugo 43 | 44 | 45 | .SH OPTIONS INHERITED FROM PARENT COMMANDS 46 | \fB--config\fP="" 47 | config file (default is $HOME/.config/diego/config.yaml) 48 | 49 | 50 | .SH EXAMPLE 51 | .EX 52 | diego import spotify library -i library.json 53 | diego i s playlist -i playlist.json --all --shortcode 54 | .EE 55 | 56 | 57 | .SH SEE ALSO 58 | \fBdiego-import(1)\fP 59 | -------------------------------------------------------------------------------- /docs/man/diego-import-youtube.1: -------------------------------------------------------------------------------- 1 | .nh 2 | .TH "DIEGO" "1" "Apr 2025" "diego manual" "User Commands" 3 | 4 | .SH NAME 5 | diego-import-youtube - Import data from YouTube 6 | 7 | 8 | .SH SYNOPSIS 9 | \fBdiego import youtube {playlist|subscriptions} -i file [flags]\fP 10 | 11 | 12 | .SH DESCRIPTION 13 | Import data from YouTube. 14 | 15 | 16 | .SH OPTIONS 17 | \fB--all\fP[=false] 18 | import every available field from CSV file 19 | 20 | .PP 21 | \fB--format\fP="yaml" 22 | output format for the Hugo data file 23 | 24 | .PP 25 | \fB-h\fP, \fB--help\fP[=false] 26 | help for youtube 27 | 28 | .PP 29 | \fB--hugodir\fP="." 30 | path to the Hugo directory 31 | 32 | .PP 33 | \fB-i\fP, \fB--input\fP="" 34 | path to the CSV file (required) 35 | 36 | .PP 37 | \fB--overwrite\fP[=false] 38 | overwrite existent output data file 39 | 40 | .PP 41 | \fB--scrape\fP[=false] 42 | fetch additional data from CSV links using HTTP 43 | 44 | .PP 45 | \fB--shortcode\fP[=false] 46 | generate a shortcode template for Hugo 47 | 48 | 49 | .SH OPTIONS INHERITED FROM PARENT COMMANDS 50 | \fB--config\fP="" 51 | config file (default is $HOME/.config/diego/config.yaml) 52 | 53 | 54 | .SH EXAMPLE 55 | .EX 56 | diego import youtube subscriptions -i subscriptions.csv 57 | diego i y playlist -i playlist.csv --all --scrape --shortcode 58 | .EE 59 | 60 | 61 | .SH SEE ALSO 62 | \fBdiego-import(1)\fP 63 | -------------------------------------------------------------------------------- /docs/man/diego-import.1: -------------------------------------------------------------------------------- 1 | .nh 2 | .TH "DIEGO" "1" "Apr 2025" "diego manual" "User Commands" 3 | 4 | .SH NAME 5 | diego-import - Import data from various services into Hugo 6 | 7 | 8 | .SH SYNOPSIS 9 | \fBdiego import [flags]\fP 10 | 11 | 12 | .SH DESCRIPTION 13 | Import data from various services into Hugo. 14 | 15 | 16 | .SH OPTIONS 17 | \fB-h\fP, \fB--help\fP[=false] 18 | help for import 19 | 20 | 21 | .SH OPTIONS INHERITED FROM PARENT COMMANDS 22 | \fB--config\fP="" 23 | config file (default is $HOME/.config/diego/config.yaml) 24 | 25 | 26 | .SH SEE ALSO 27 | \fBdiego(1)\fP, \fBdiego-import-goodreads(1)\fP, \fBdiego-import-imdb(1)\fP, \fBdiego-import-instapaper(1)\fP, \fBdiego-import-letterboxd(1)\fP, \fBdiego-import-spotify(1)\fP, \fBdiego-import-youtube(1)\fP 28 | -------------------------------------------------------------------------------- /docs/man/diego-set-all.1: -------------------------------------------------------------------------------- 1 | .nh 2 | .TH "DIEGO" "1" "Apr 2025" "diego manual" "User Commands" 3 | 4 | .SH NAME 5 | diego-set-all - Enable or disable the all flag by default 6 | 7 | 8 | .SH SYNOPSIS 9 | \fBdiego set all {true|false|1|0|enabled|disabled} [flags]\fP 10 | 11 | 12 | .SH DESCRIPTION 13 | Enable or disable the all flag by default. 14 | 15 | 16 | .SH OPTIONS 17 | \fB-h\fP, \fB--help\fP[=false] 18 | help for all 19 | 20 | 21 | .SH OPTIONS INHERITED FROM PARENT COMMANDS 22 | \fB--config\fP="" 23 | config file (default is $HOME/.config/diego/config.yaml) 24 | 25 | 26 | .SH EXAMPLE 27 | .EX 28 | diego set all true 29 | diego s all false 30 | .EE 31 | 32 | 33 | .SH SEE ALSO 34 | \fBdiego-set(1)\fP 35 | -------------------------------------------------------------------------------- /docs/man/diego-set-defaults.1: -------------------------------------------------------------------------------- 1 | .nh 2 | .TH "DIEGO" "1" "Apr 2025" "diego manual" "User Commands" 3 | 4 | .SH NAME 5 | diego-set-defaults - Restore Diego default settings 6 | 7 | 8 | .SH SYNOPSIS 9 | \fBdiego set defaults [flags]\fP 10 | 11 | 12 | .SH DESCRIPTION 13 | Restore Diego default settings. 14 | 15 | 16 | .SH OPTIONS 17 | \fB-h\fP, \fB--help\fP[=false] 18 | help for defaults 19 | 20 | 21 | .SH OPTIONS INHERITED FROM PARENT COMMANDS 22 | \fB--config\fP="" 23 | config file (default is $HOME/.config/diego/config.yaml) 24 | 25 | 26 | .SH EXAMPLE 27 | .EX 28 | diego set defaults true 29 | diego s defaults 1 30 | .EE 31 | 32 | 33 | .SH SEE ALSO 34 | \fBdiego-set(1)\fP 35 | -------------------------------------------------------------------------------- /docs/man/diego-set-format.1: -------------------------------------------------------------------------------- 1 | .nh 2 | .TH "DIEGO" "1" "Apr 2025" "diego manual" "User Commands" 3 | 4 | .SH NAME 5 | diego-set-format - Set output format for the Hugo data file (default "yaml") 6 | 7 | 8 | .SH SYNOPSIS 9 | \fBdiego set format {yaml|json|toml|xml} [flags]\fP 10 | 11 | 12 | .SH DESCRIPTION 13 | Set output format for the Hugo data file (default "yaml"). 14 | 15 | 16 | .SH OPTIONS 17 | \fB-h\fP, \fB--help\fP[=false] 18 | help for format 19 | 20 | 21 | .SH OPTIONS INHERITED FROM PARENT COMMANDS 22 | \fB--config\fP="" 23 | config file (default is $HOME/.config/diego/config.yaml) 24 | 25 | 26 | .SH EXAMPLE 27 | .EX 28 | diego set format yaml 29 | diego s format json 30 | .EE 31 | 32 | 33 | .SH SEE ALSO 34 | \fBdiego-set(1)\fP 35 | -------------------------------------------------------------------------------- /docs/man/diego-set-hugodir.1: -------------------------------------------------------------------------------- 1 | .nh 2 | .TH "DIEGO" "1" "Apr 2025" "diego manual" "User Commands" 3 | 4 | .SH NAME 5 | diego-set-hugodir - Set path to the Hugo directory (default ".") 6 | 7 | 8 | .SH SYNOPSIS 9 | \fBdiego set hugodir path [flags]\fP 10 | 11 | 12 | .SH DESCRIPTION 13 | Set path to the Hugo directory (default "."). 14 | 15 | 16 | .SH OPTIONS 17 | \fB-h\fP, \fB--help\fP[=false] 18 | help for hugodir 19 | 20 | 21 | .SH OPTIONS INHERITED FROM PARENT COMMANDS 22 | \fB--config\fP="" 23 | config file (default is $HOME/.config/diego/config.yaml) 24 | 25 | 26 | .SH EXAMPLE 27 | .EX 28 | diego set hugodir ~/Projects/HugoBlog 29 | diego s hugodir ../Projects/HugoSite 30 | .EE 31 | 32 | 33 | .SH SEE ALSO 34 | \fBdiego-set(1)\fP 35 | -------------------------------------------------------------------------------- /docs/man/diego-set-overwrite.1: -------------------------------------------------------------------------------- 1 | .nh 2 | .TH "DIEGO" "1" "Apr 2025" "diego manual" "User Commands" 3 | 4 | .SH NAME 5 | diego-set-overwrite - Enable or disable the overwrite flag by default 6 | 7 | 8 | .SH SYNOPSIS 9 | \fBdiego set overwrite {true|false|1|0|enabled|disabled} [flags]\fP 10 | 11 | 12 | .SH DESCRIPTION 13 | Enable or disable the overwrite flag by default. 14 | 15 | 16 | .SH OPTIONS 17 | \fB-h\fP, \fB--help\fP[=false] 18 | help for overwrite 19 | 20 | 21 | .SH OPTIONS INHERITED FROM PARENT COMMANDS 22 | \fB--config\fP="" 23 | config file (default is $HOME/.config/diego/config.yaml) 24 | 25 | 26 | .SH EXAMPLE 27 | .EX 28 | diego set overwrite true 29 | diego s overwrite false 30 | .EE 31 | 32 | 33 | .SH SEE ALSO 34 | \fBdiego-set(1)\fP 35 | -------------------------------------------------------------------------------- /docs/man/diego-set-scrape.1: -------------------------------------------------------------------------------- 1 | .nh 2 | .TH "DIEGO" "1" "Apr 2025" "diego manual" "User Commands" 3 | 4 | .SH NAME 5 | diego-set-scrape - Enable or disable the scrape flag by default 6 | 7 | 8 | .SH SYNOPSIS 9 | \fBdiego set scrape {true|false|1|0|enabled|disabled} [flags]\fP 10 | 11 | 12 | .SH DESCRIPTION 13 | Enable or disable the scrape flag by default. 14 | 15 | 16 | .SH OPTIONS 17 | \fB-h\fP, \fB--help\fP[=false] 18 | help for scrape 19 | 20 | 21 | .SH OPTIONS INHERITED FROM PARENT COMMANDS 22 | \fB--config\fP="" 23 | config file (default is $HOME/.config/diego/config.yaml) 24 | 25 | 26 | .SH EXAMPLE 27 | .EX 28 | diego set scrape true 29 | diego s scrape false 30 | .EE 31 | 32 | 33 | .SH SEE ALSO 34 | \fBdiego-set(1)\fP 35 | -------------------------------------------------------------------------------- /docs/man/diego-set-shortcode.1: -------------------------------------------------------------------------------- 1 | .nh 2 | .TH "DIEGO" "1" "Apr 2025" "diego manual" "User Commands" 3 | 4 | .SH NAME 5 | diego-set-shortcode - Enable or disable the shortcode flag by default 6 | 7 | 8 | .SH SYNOPSIS 9 | \fBdiego set shortcode {true|false|1|0|enabled|disabled} [flags]\fP 10 | 11 | 12 | .SH DESCRIPTION 13 | Enable or disable the shortcode flag by default. 14 | 15 | 16 | .SH OPTIONS 17 | \fB-h\fP, \fB--help\fP[=false] 18 | help for shortcode 19 | 20 | 21 | .SH OPTIONS INHERITED FROM PARENT COMMANDS 22 | \fB--config\fP="" 23 | config file (default is $HOME/.config/diego/config.yaml) 24 | 25 | 26 | .SH EXAMPLE 27 | .EX 28 | diego set shortcode true 29 | diego s shortcode false 30 | .EE 31 | 32 | 33 | .SH SEE ALSO 34 | \fBdiego-set(1)\fP 35 | -------------------------------------------------------------------------------- /docs/man/diego-set.1: -------------------------------------------------------------------------------- 1 | .nh 2 | .TH "DIEGO" "1" "Apr 2025" "diego manual" "User Commands" 3 | 4 | .SH NAME 5 | diego-set - Set a configuration option 6 | 7 | 8 | .SH SYNOPSIS 9 | \fBdiego set [flags]\fP 10 | 11 | 12 | .SH DESCRIPTION 13 | Set a configuration option. 14 | 15 | 16 | .SH OPTIONS 17 | \fB-h\fP, \fB--help\fP[=false] 18 | help for set 19 | 20 | 21 | .SH OPTIONS INHERITED FROM PARENT COMMANDS 22 | \fB--config\fP="" 23 | config file (default is $HOME/.config/diego/config.yaml) 24 | 25 | 26 | .SH SEE ALSO 27 | \fBdiego(1)\fP, \fBdiego-set-all(1)\fP, \fBdiego-set-defaults(1)\fP, \fBdiego-set-format(1)\fP, \fBdiego-set-hugodir(1)\fP, \fBdiego-set-overwrite(1)\fP, \fBdiego-set-scrape(1)\fP, \fBdiego-set-shortcode(1)\fP 28 | -------------------------------------------------------------------------------- /docs/man/diego-settings.1: -------------------------------------------------------------------------------- 1 | .nh 2 | .TH "DIEGO" "1" "Apr 2025" "diego manual" "User Commands" 3 | 4 | .SH NAME 5 | diego-settings - Show current settings 6 | 7 | 8 | .SH SYNOPSIS 9 | \fBdiego settings [flags]\fP 10 | 11 | 12 | .SH DESCRIPTION 13 | Show current settings. 14 | 15 | 16 | .SH OPTIONS 17 | \fB-h\fP, \fB--help\fP[=false] 18 | help for settings 19 | 20 | 21 | .SH OPTIONS INHERITED FROM PARENT COMMANDS 22 | \fB--config\fP="" 23 | config file (default is $HOME/.config/diego/config.yaml) 24 | 25 | 26 | .SH SEE ALSO 27 | \fBdiego(1)\fP 28 | -------------------------------------------------------------------------------- /docs/man/diego.1: -------------------------------------------------------------------------------- 1 | .nh 2 | .TH "DIEGO" "1" "Apr 2025" "diego manual" "User Commands" 3 | 4 | .SH NAME 5 | diego - DIEGO \- A data importer extension for Hugo 6 | 7 | 8 | .SH SYNOPSIS 9 | \fBdiego [flags]\fP 10 | 11 | 12 | .SH DESCRIPTION 13 | DIEGO - A data importer extension for Hugo 14 | 15 | .PP 16 | Diego integrates with Hugo as a CLI tool to assist in importing and utilizing 17 | exported social media data from various services on Hugo websites. 18 | 19 | .PP 20 | Complete documentation is available at 21 | \[la]https://github.com/ttybitnik/diego\[ra]\&. 22 | 23 | 24 | .SH OPTIONS 25 | \fB--config\fP="" 26 | config file (default is $HOME/.config/diego/config.yaml) 27 | 28 | .PP 29 | \fB-h\fP, \fB--help\fP[=false] 30 | help for diego 31 | 32 | .PP 33 | \fB-v\fP, \fB--version\fP[=false] 34 | version for diego 35 | 36 | 37 | .SH SEE ALSO 38 | \fBdiego-completion(1)\fP, \fBdiego-import(1)\fP, \fBdiego-set(1)\fP, \fBdiego-settings(1)\fP 39 | -------------------------------------------------------------------------------- /examples/silo/goodreads_library.csv: -------------------------------------------------------------------------------- 1 | Id,Name,Author,Author l-f,Additional Authors,ISBN,ISBN13,My Rating,Average Rating,Publisher,Binding,Number of Pages,Year Published,Year,Date Read,Date Added,Bookshelves,Bookshelves with positions,Exclusive Shelf,My Review,Spoiler,Private Notes,Read Count,Owned Copies 2 | 517435,Memórias do Subsolo,Fyodor Dostoevsky,"Dostoevsky, Fyodor","Boris Schnaiderman, Fiódor Dostoyevski","=""8573261854""","=""9788573261851""",0,4.18,Editora 34,Paperback,152,2009,1864,,2018/01/03,favorites,favorites (#20),read,,,,1,0 3 | 13614950,Ein Brasilianer in Berlin,João Ubaldo Ribeiro,"Ribeiro, João Ubaldo",,"=""3939455040""","=""9783939455042""",0,3.92,Suhrkamp,Paperback,,2017,1994,2020/10/13,2020/10/13,favorites,favorites (#11),read,,,,1,0 4 | 25587882,Mastering Emacs,Mickey Petersen,"Petersen, Mickey",,"=""""","=""""",0,4.16,,ebook,314,2022,2015,2023/01/22,2023/01/22,,,read,,,,1,0 5 | -------------------------------------------------------------------------------- /examples/silo/imdb_list.csv: -------------------------------------------------------------------------------- 1 | Position,Const,Created,Modified,Description,Title,Original Title,URL,Title Type,IMDb Rating,Runtime (mins),Year,Genres,Num Votes,Release Date,Directors,Your Rating,Date Rated 2 | 1,tt6532954,2018-05-25,2018-05-25,,"No Intenso Agora","No Intenso Agora",https://www.imdb.com/title/tt6532954/,Movie,7.4,127,2017,"Documentary, History",623,2018-01-31,"João Moreira Salles",10,2018-05-25 3 | 2,tt3262342,2018-01-20,2018-01-20,,"Loving Vincent","Loving Vincent",https://www.imdb.com/title/tt3262342/,Movie,7.8,94,2017,"Animation, Drama, Mystery",65222,2017-09-22,"DK Welchman, Hugh Welchman",10,2018-01-20 4 | 3,tt2763304,2017-05-28,2017-05-28,,"T2 Trainspotting","T2 Trainspotting",https://www.imdb.com/title/tt2763304/,Movie,7.1,117,2017,"Comedy, Crime, Drama",135606,2017-03-31,"Danny Boyle",9,2017-05-28 -------------------------------------------------------------------------------- /examples/silo/imdb_ratings.csv: -------------------------------------------------------------------------------- 1 | Const,Your Rating,Date Rated,Title,Original Title,URL,Title Type,IMDb Rating,Runtime (mins),Year,Genres,Num Votes,Release Date,Directors 2 | tt0058003,10,2018-08-21,"Red Desert","Il deserto rosso",https://www.imdb.com/title/tt0058003,Movie,7.4,117,1964,"Drama",18182,"1965-02-08","Michelangelo Antonioni" 3 | tt0287467,10,2016-07-24,"Talk to Her","Hable con ella",https://www.imdb.com/title/tt0287467,Movie,7.9,112,2002,"Romance, Mystery, Drama",119041,"2003-02-14","Pedro Almodóvar" 4 | tt0118694,10,2021-05-16,"In the Mood for Love","Fa yeung nin wah",https://www.imdb.com/title/tt0118694,Movie,8.1,98,2000,"Romance, Drama",172527,"2001-03-09","Kar-Wai Wong" -------------------------------------------------------------------------------- /examples/silo/imdb_watchlist.csv: -------------------------------------------------------------------------------- 1 | Position,Const,Created,Modified,Description,Title,Original Title,URL,Title Type,IMDb Rating,Runtime (mins),Year,Genres,Num Votes,Release Date,Directors,Your Rating,Date Rated 2 | 8,tt0054389,2016-01-15,2016-01-15,,"Shoot the Piano Player","Tirez sur le pianiste",https://www.imdb.com/title/tt0054389/,Movie,7.4,92,1960,"Crime, Drama, Thriller",21077,1962-07-23,"François Truffaut",, 3 | 218,tt21254598,2023-12-25,2023-12-25,,"Cobweb","Geomijip",https://www.imdb.com/title/tt21254598/,Movie,6.6,135,2023,"Comedy, Drama, History",1908,2024-02-09,"Kim Jee-woon",, 4 | 220,tt26255088,2023-12-29,2023-12-29,,"Elis and Tom","Elis & Tom: Só Tinha de Ser com Você",https://www.imdb.com/title/tt26255088/,Movie,7.8,100,2022,"Documentary, Music",438,2024-08-01,"Roberto de Oliveira, Jom Tob Azulay",, 5 | -------------------------------------------------------------------------------- /examples/silo/instapaper_list.csv: -------------------------------------------------------------------------------- 1 | URL,Title,Selection,Folder,Timestamp 2 | https://www.newyorker.com/magazine/2017/09/04/fernando-pessoas-disappearing-act,Fernando Pessoa’s Disappearing Act,,Starred,1679174385 3 | https://dougseven.com/2014/04/17/knightmare-a-devops-cautionary-tale/,Knightmare: A DevOps Cautionary Tale,,Starred,1694613937 4 | https://www.newyorker.com/magazine/2016/08/08/lauren-collins-learns-to-love-in-french,Love in Translation,,Starred,1679174483 5 | -------------------------------------------------------------------------------- /examples/silo/letterboxd_diary.csv: -------------------------------------------------------------------------------- 1 | Date,Name,Year,Letterboxd URI,Rating,Rewatch,Tags,Watched Date 2 | 2023-07-16,My Small Land,2022,https://boxd.it/4wyHj9,5,,,2023-07-15 3 | 2023-12-03,Mars One,2022,https://boxd.it/5geIaV,4.5,,,2023-12-03 4 | 2023-12-24,As Tears Go By,1988,https://boxd.it/5nUHjJ,5,,,2023-12-24 -------------------------------------------------------------------------------- /examples/silo/letterboxd_likes_films.csv: -------------------------------------------------------------------------------- 1 | Date,Name,Year,Letterboxd URI 2 | 2021-12-14,Sans Soleil,1983,https://boxd.it/28B8 3 | 2021-12-14,Dekalog,1989,https://boxd.it/bv4u 4 | 2021-12-14,Blade Runner,1982,https://boxd.it/2bcA -------------------------------------------------------------------------------- /examples/silo/letterboxd_reviews.csv: -------------------------------------------------------------------------------- 1 | Date,Name,Year,Letterboxd URI,Rating,Rewatch,Review,Tags,Watched Date 2 | 2024-01-07,Fallen Leaves,2023,https://boxd.it/5wluaZ,4,,"Lorem Ipsum!",,2024-01-06 3 | 2024-01-21,"Goodbye, Dragon Inn",2003,https://boxd.it/5E4WzB,4,,"Lorem Ipsum!",,2024-01-20 4 | 2024-01-24,Pictures of Ghosts,2023,https://boxd.it/5FB5dd,5,,"Lorem Ipsum!",,2024-01-23 -------------------------------------------------------------------------------- /examples/silo/letterboxd_watchlist.csv: -------------------------------------------------------------------------------- 1 | Date,Name,Year,Letterboxd URI 2 | 2023-12-14,Vivre Sa Vie,1962,https://boxd.it/28s6 3 | 2023-12-14,Mon Oncle,1958,https://boxd.it/2apy 4 | 2023-12-14,Days,2020,https://boxd.it/oEE8 -------------------------------------------------------------------------------- /examples/silo/spotify_playlist.json: -------------------------------------------------------------------------------- 1 | { 2 | "playlists": [ 3 | { 4 | "name": "A Sétima", 5 | "lastModifiedDate": "2020-02-21", 6 | "items": [ 7 | { 8 | "track": { 9 | "trackName": "Le tourbillon", 10 | "artistName": "Jeanne Moreau", 11 | "albumName": "Le tourbillon de ma vie (Best Of 2017)", 12 | "trackUri": "spotify:track:0ZRnvyA5MxbgTCfWRw3YU4" 13 | }, 14 | "episode": null, 15 | "localTrack": null, 16 | "addedDate": "2018-09-09" 17 | }, 18 | { 19 | "track": { 20 | "trackName": "Cucurrucucu Paloma - Ao Vivo", 21 | "artistName": "Caetano Veloso", 22 | "albumName": "Fina Estampa Ao Vivo", 23 | "trackUri": "spotify:track:2jIyIMXAHeHSz3ip6ccMFl" 24 | }, 25 | "episode": null, 26 | "localTrack": null, 27 | "addedDate": "2018-09-10" 28 | }, 29 | { 30 | "track": { 31 | "trackName": "Preciso Me Encontrar", 32 | "artistName": "Cartola", 33 | "albumName": "Raizes Do Samba", 34 | "trackUri": "spotify:track:1op7nM2R2M6FAU6dSCTRWV" 35 | }, 36 | "episode": null, 37 | "localTrack": null, 38 | "addedDate": "2018-09-09" 39 | } 40 | ], 41 | "description": "O cinema e a música: eternodevir.com/a-setima/", 42 | "numberOfFollowers": 4 43 | }, 44 | { 45 | "name": "Rendez-vous 1408", 46 | "lastModifiedDate": "2020-02-21", 47 | "items": [ 48 | { 49 | "track": { 50 | "trackName": "Love Will Tear Us Apart - 2010 Remaster", 51 | "artistName": "Joy Division", 52 | "albumName": "Substance", 53 | "trackUri": "spotify:track:1r8oPEXqnhUVgkUkJNqEuF" 54 | }, 55 | "episode": null, 56 | "localTrack": null, 57 | "addedDate": "2016-11-19" 58 | }, 59 | { 60 | "track": { 61 | "trackName": "Tear You Apart", 62 | "artistName": "She Wants Revenge", 63 | "albumName": "She Wants Revenge", 64 | "trackUri": "spotify:track:5uahjiKiYXxGlF4GdnKPNv" 65 | }, 66 | "episode": null, 67 | "localTrack": null, 68 | "addedDate": "2016-11-19" 69 | }, 70 | { 71 | "track": { 72 | "trackName": "Who Can It Be Now?", 73 | "artistName": "Men At Work", 74 | "albumName": "The Essential Men At Work", 75 | "trackUri": "spotify:track:29r3fDexnrto7WABfpblNH" 76 | }, 77 | "episode": null, 78 | "localTrack": null, 79 | "addedDate": "2016-11-19" 80 | } 81 | ], 82 | "description": "Festa de 5 (-:", 83 | "numberOfFollowers": 3 84 | } 85 | ] 86 | } 87 | -------------------------------------------------------------------------------- /examples/silo/spotify_your_library.json: -------------------------------------------------------------------------------- 1 | { 2 | "tracks": [ 3 | { 4 | "artist": "Modena City Ramblers", 5 | "album": "Tracce Clandestine", 6 | "track": "Crookedwood Polkas", 7 | "uri": "spotify:track:4pQF8GvUIT2CKmoJG209ak" 8 | }, 9 | { 10 | "artist": "Jorge Ben Jor", 11 | "album": "A Tabua De Esmeralda", 12 | "track": "O Homem Da Gravata Florida", 13 | "uri": "spotify:track:0iPjvpxh6XE9Zo2smrWDhw" 14 | }, 15 | { 16 | "artist": "Lou Reed", 17 | "album": "The Raven", 18 | "track": "Call on Me (feat. Laurie Anderson)", 19 | "uri": "spotify:track:2WSnY39N88UvTgt1YhvVFA" 20 | } 21 | ], 22 | "albums": [ 23 | { 24 | "artist": "SEATBELTS", 25 | "album": "「COWBOY BEBOP」オリジナルサウンドトラック", 26 | "uri": "spotify:album:6cYPbwsAFAcddFuGeXMR7l" 27 | }, 28 | { 29 | "artist": "Lykke Li", 30 | "album": "Youth Novels", 31 | "uri": "spotify:album:65ain97ltDAxldCiOcBtHo" 32 | }, 33 | { 34 | "artist": "Zaz", 35 | "album": "Spotify Sessions", 36 | "uri": "spotify:album:4Oun04R6kdukRGC8djhzHG" 37 | } 38 | ], 39 | "shows": [ 40 | { 41 | "name": "AntiCast", 42 | "publisher": "Half Deaf", 43 | "uri": "spotify:show:55Aug5UvJC8LSWyzEI7xSR" 44 | }, 45 | { 46 | "name": "Decrépitos", 47 | "publisher": "Decrépitos Podcast", 48 | "uri": "spotify:show:2epGmU5E47xlTJ4kc5Cevs" 49 | }, 50 | { 51 | "name": "ID10T with Chris Hardwick", 52 | "publisher": "Chris Hardwick", 53 | "uri": "spotify:show:0Jz4xn4nDRQRjQ5SOyTTuv" 54 | } 55 | ], 56 | "episodes": [ 57 | ], 58 | "bannedTracks": [ 59 | ], 60 | "artists": [ 61 | ], 62 | "bannedArtists": [ 63 | ], 64 | "other": [ 65 | ] 66 | } 67 | -------------------------------------------------------------------------------- /examples/silo/youtube_playlist.csv: -------------------------------------------------------------------------------- 1 | Video ID, Playlist video creation timestamp 2 | eY-eyZuW_Uk,2023-12-07T15:57:57+00:00 3 | 28tZ-S1LFok,2023-12-07T18:08:55+00:00 4 | J9qja4KmPQQ,2023-12-07T16:49:34+00:00 5 | -------------------------------------------------------------------------------- /examples/silo/youtube_subscriptions.csv: -------------------------------------------------------------------------------- 1 | Channel ID,Channel URL,Channel Title 2 | UC9-y-6csu5WGm29I7JiwpnA,http://www.youtube.com/channel/UC9-y-6csu5WGm29I7JiwpnA,Computerphile 3 | UCy0tKL1T7wFoYcxCe0xjN6Q,http://www.youtube.com/channel/UCy0tKL1T7wFoYcxCe0xjN6Q,Technology Connections 4 | UClcE-kVhqyiHCcjYwcpfj9w,http://www.youtube.com/channel/UClcE-kVhqyiHCcjYwcpfj9w,LiveOverflow -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/ttybitnik/diego 2 | 3 | go 1.23.7 4 | 5 | toolchain go1.24.1 6 | 7 | require ( 8 | github.com/gocolly/colly/v2 v2.2.0 9 | github.com/pelletier/go-toml/v2 v2.2.4 10 | github.com/spf13/cobra v1.9.1 11 | github.com/spf13/viper v1.20.1 12 | gopkg.in/yaml.v3 v3.0.1 13 | ) 14 | 15 | require ( 16 | github.com/PuerkitoBio/goquery v1.10.2 // indirect 17 | github.com/andybalholm/cascadia v1.3.3 // indirect 18 | github.com/antchfx/htmlquery v1.3.4 // indirect 19 | github.com/antchfx/xmlquery v1.4.4 // indirect 20 | github.com/antchfx/xpath v1.3.3 // indirect 21 | github.com/bits-and-blooms/bitset v1.22.0 // indirect 22 | github.com/cpuguy83/go-md2man/v2 v2.0.6 // indirect 23 | github.com/fsnotify/fsnotify v1.8.0 // indirect 24 | github.com/go-viper/mapstructure/v2 v2.2.1 // indirect 25 | github.com/gobwas/glob v0.2.3 // indirect 26 | github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 // indirect 27 | github.com/golang/protobuf v1.5.4 // indirect 28 | github.com/inconshreveable/mousetrap v1.1.0 // indirect 29 | github.com/kennygrant/sanitize v1.2.4 // indirect 30 | github.com/nlnwa/whatwg-url v0.6.1 // indirect 31 | github.com/russross/blackfriday/v2 v2.1.0 // indirect 32 | github.com/sagikazarmark/locafero v0.7.0 // indirect 33 | github.com/saintfish/chardet v0.0.0-20230101081208-5e3ef4b5456d // indirect 34 | github.com/sourcegraph/conc v0.3.0 // indirect 35 | github.com/spf13/afero v1.12.0 // indirect 36 | github.com/spf13/cast v1.7.1 // indirect 37 | github.com/spf13/pflag v1.0.6 // indirect 38 | github.com/subosito/gotenv v1.6.0 // indirect 39 | github.com/temoto/robotstxt v1.1.2 // indirect 40 | go.uber.org/multierr v1.11.0 // indirect 41 | golang.org/x/net v0.38.0 // indirect 42 | golang.org/x/sys v0.31.0 // indirect 43 | golang.org/x/text v0.23.0 // indirect 44 | google.golang.org/appengine v1.6.8 // indirect 45 | google.golang.org/protobuf v1.36.6 // indirect 46 | ) 47 | -------------------------------------------------------------------------------- /internal/adapters/left/cli/import.go: -------------------------------------------------------------------------------- 1 | /* 2 | DIEGO - A data importer extension for Hugo 3 | Copyright (C) 2024 Vinícius Moraes 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | package cli 20 | 21 | import ( 22 | "github.com/spf13/cobra" 23 | ) 24 | 25 | var importCmd = &cobra.Command{ 26 | Use: "import", 27 | Aliases: []string{"i"}, 28 | Short: "Import data from various services into Hugo", 29 | Long: `Import data from various services into Hugo.`, 30 | } 31 | 32 | func init() { 33 | rootCmd.AddCommand(importCmd) 34 | } 35 | -------------------------------------------------------------------------------- /internal/adapters/left/cli/import_goodreads.go: -------------------------------------------------------------------------------- 1 | /* 2 | DIEGO - A data importer extension for Hugo 3 | Copyright (C) 2024 Vinícius Moraes 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | package cli 20 | 21 | import ( 22 | "github.com/ttybitnik/diego/internal/app/domain" 23 | 24 | "github.com/spf13/cobra" 25 | ) 26 | 27 | var goodreadsCmd = &cobra.Command{ 28 | Use: "goodreads {library} -i file", 29 | Aliases: []string{"g"}, 30 | Args: cobra.MatchAll(cobra.ExactArgs(1), cobra.OnlyValidArgs), 31 | ValidArgs: []string{"library"}, 32 | Example: "diego import goodreads library -i library.csv\n" + 33 | "diego i g library -i library.csv --all --scrape --shortcode", 34 | Short: "Import data from Goodreads", 35 | Long: `Import data from Goodreads.`, 36 | PreRun: func(cmd *cobra.Command, args []string) { 37 | bindViperFlags(cmd, args) 38 | }, 39 | Run: func(cmd *cobra.Command, args []string) { 40 | bindInputFlag(cmd, args) 41 | 42 | switch args[0] { 43 | case "library": 44 | ca.cobra.model = domain.GoodreadsLibrary 45 | ca.cobraImport(ca.cobra) 46 | } 47 | }, 48 | } 49 | 50 | func init() { 51 | importCmd.AddCommand(goodreadsCmd) 52 | ca = cobraAdapter() 53 | 54 | goodreadsCmd.Flags().BoolVar(&ca.cobra.all, "all", false, "import every available field from CSV file") 55 | goodreadsCmd.Flags().BoolVar(&ca.cobra.overwrite, "overwrite", false, "overwrite existent output data file") 56 | goodreadsCmd.Flags().BoolVar(&ca.cobra.scrape, "scrape", false, "fetch additional data from CSV links using HTTP") 57 | goodreadsCmd.Flags().BoolVar(&ca.cobra.shortcode, "shortcode", false, "generate a shortcode template for Hugo") 58 | goodreadsCmd.Flags().StringVar(&ca.cobra.format, "format", domain.OutputYAML, "output format for the Hugo data file") 59 | goodreadsCmd.Flags().StringVar(&ca.cobra.hugodir, "hugodir", ".", "path to the Hugo directory") 60 | goodreadsCmd.Flags().StringVarP(&ca.cobra.input, "input", "i", "", "path to the CSV file (required)") 61 | } 62 | -------------------------------------------------------------------------------- /internal/adapters/left/cli/import_imdb.go: -------------------------------------------------------------------------------- 1 | /* 2 | DIEGO - A data importer extension for Hugo 3 | Copyright (C) 2024 Vinícius Moraes 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | package cli 20 | 21 | import ( 22 | "github.com/ttybitnik/diego/internal/app/domain" 23 | 24 | "github.com/spf13/cobra" 25 | ) 26 | 27 | var imdbCmd = &cobra.Command{ 28 | Use: "imdb {list|ratings|watchlist} -i file", 29 | Aliases: []string{"i"}, 30 | Args: cobra.MatchAll(cobra.ExactArgs(1), cobra.OnlyValidArgs), 31 | ValidArgs: []string{"list", "ratings", "watchlist"}, 32 | Example: "diego import imdb list -i list.csv\n" + 33 | "diego i i ratings -i ratings.csv --all --scrape --shortcode", 34 | Short: "Import data from IMDb", 35 | Long: `Import data from IMDb.`, 36 | PreRun: func(cmd *cobra.Command, args []string) { 37 | bindViperFlags(cmd, args) 38 | }, 39 | Run: func(cmd *cobra.Command, args []string) { 40 | input, _ := cmd.Flags().GetString("input") 41 | ca.cobra.input = input 42 | 43 | switch args[0] { 44 | case "list": 45 | ca.cobra.model = domain.ImdbList 46 | ca.cobraImport(ca.cobra) 47 | case "ratings": 48 | ca.cobra.model = domain.ImdbRatings 49 | ca.cobraImport(ca.cobra) 50 | case "watchlist": 51 | ca.cobra.model = domain.ImdbWatchlist 52 | ca.cobraImport(ca.cobra) 53 | } 54 | }, 55 | } 56 | 57 | func init() { 58 | importCmd.AddCommand(imdbCmd) 59 | ca = cobraAdapter() 60 | 61 | imdbCmd.Flags().BoolVar(&ca.cobra.all, "all", false, "import every available field from CSV file") 62 | imdbCmd.Flags().BoolVar(&ca.cobra.overwrite, "overwrite", false, "overwrite existent output data file") 63 | imdbCmd.Flags().BoolVar(&ca.cobra.scrape, "scrape", false, "fetch additional data from CSV links using HTTP") 64 | imdbCmd.Flags().BoolVar(&ca.cobra.shortcode, "shortcode", false, "generate a shortcode template for Hugo") 65 | imdbCmd.Flags().StringVar(&ca.cobra.format, "format", domain.OutputYAML, "output format for the Hugo data file") 66 | imdbCmd.Flags().StringVar(&ca.cobra.hugodir, "hugodir", ".", "path to the Hugo directory") 67 | imdbCmd.Flags().StringVarP(&ca.cobra.input, "input", "i", "", "path to the CSV file (required)") 68 | } 69 | -------------------------------------------------------------------------------- /internal/adapters/left/cli/import_instapaper.go: -------------------------------------------------------------------------------- 1 | /* 2 | DIEGO - A data importer extension for Hugo 3 | Copyright (C) 2024 Vinícius Moraes 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | package cli 20 | 21 | import ( 22 | "github.com/ttybitnik/diego/internal/app/domain" 23 | 24 | "github.com/spf13/cobra" 25 | ) 26 | 27 | var instapaperCmd = &cobra.Command{ 28 | Use: "instapaper {list} -i file", 29 | Aliases: []string{"ip"}, 30 | Args: cobra.MatchAll(cobra.ExactArgs(1), cobra.OnlyValidArgs), 31 | ValidArgs: []string{"list"}, 32 | Example: "diego import instapaper list -i list.csv\n" + 33 | "diego i ip list -i list.csv --all --shortcode", 34 | Short: "Import data from Instapaper", 35 | Long: `Import data from Instapaper.`, 36 | PreRun: func(cmd *cobra.Command, args []string) { 37 | bindViperFlags(cmd, args) 38 | }, 39 | Run: func(cmd *cobra.Command, args []string) { 40 | input, _ := cmd.Flags().GetString("input") 41 | ca.cobra.input = input 42 | 43 | switch args[0] { 44 | case "list": 45 | ca.cobra.model = domain.InstapaperList 46 | ca.cobraImport(ca.cobra) 47 | } 48 | }, 49 | } 50 | 51 | func init() { 52 | importCmd.AddCommand(instapaperCmd) 53 | ca = cobraAdapter() 54 | 55 | instapaperCmd.Flags().BoolVar(&ca.cobra.all, "all", false, "import every available field from CSV file") 56 | instapaperCmd.Flags().BoolVar(&ca.cobra.overwrite, "overwrite", false, "overwrite existent output data file") 57 | instapaperCmd.Flags().BoolVar(&ca.cobra.shortcode, "shortcode", false, "generate a shortcode template for Hugo") 58 | instapaperCmd.Flags().StringVar(&ca.cobra.format, "format", domain.OutputYAML, "output format for the Hugo data file") 59 | instapaperCmd.Flags().StringVar(&ca.cobra.hugodir, "hugodir", ".", "path to the Hugo directory") 60 | instapaperCmd.Flags().StringVarP(&ca.cobra.input, "input", "i", "", "path to the CSV file (required)") 61 | } 62 | -------------------------------------------------------------------------------- /internal/adapters/left/cli/import_letterboxd.go: -------------------------------------------------------------------------------- 1 | /* 2 | DIEGO - A data importer extension for Hugo 3 | Copyright (C) 2024 Vinícius Moraes 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | package cli 20 | 21 | import ( 22 | "github.com/ttybitnik/diego/internal/app/domain" 23 | 24 | "github.com/spf13/cobra" 25 | ) 26 | 27 | var letterboxdCmd = &cobra.Command{ 28 | Use: "letterboxd {diary|films|reviews|watchlist} -i file", 29 | Aliases: []string{"l"}, 30 | Args: cobra.MatchAll(cobra.ExactArgs(1), cobra.OnlyValidArgs), 31 | ValidArgs: []string{"diary", "films", "reviews", "watchlist"}, 32 | Example: "diego import letterboxd films -i films.csv\n" + 33 | "diego i l diary -i diary.csv --all --scrape --shortcode", 34 | Short: "Import data from Letterboxd", 35 | Long: `Import data from Letterboxd.`, 36 | PreRun: func(cmd *cobra.Command, args []string) { 37 | bindViperFlags(cmd, args) 38 | }, 39 | Run: func(cmd *cobra.Command, args []string) { 40 | input, _ := cmd.Flags().GetString("input") 41 | ca.cobra.input = input 42 | 43 | switch args[0] { 44 | case "diary": 45 | ca.cobra.model = domain.LetterboxdDiary 46 | ca.cobraImport(ca.cobra) 47 | case "films": 48 | ca.cobra.model = domain.LetterboxdFilms 49 | ca.cobraImport(ca.cobra) 50 | case "reviews": 51 | ca.cobra.model = domain.LetterboxdReviews 52 | ca.cobraImport(ca.cobra) 53 | case "watchlist": 54 | ca.cobra.model = domain.LetterboxdWatchlist 55 | ca.cobraImport(ca.cobra) 56 | } 57 | }, 58 | } 59 | 60 | func init() { 61 | importCmd.AddCommand(letterboxdCmd) 62 | ca = cobraAdapter() 63 | 64 | letterboxdCmd.Flags().BoolVar(&ca.cobra.all, "all", false, "import every available field from CSV file") 65 | letterboxdCmd.Flags().BoolVar(&ca.cobra.overwrite, "overwrite", false, "overwrite existent output data file") 66 | letterboxdCmd.Flags().BoolVar(&ca.cobra.scrape, "scrape", false, "fetch additional data from CSV links using HTTP") 67 | letterboxdCmd.Flags().BoolVar(&ca.cobra.shortcode, "shortcode", false, "generate a shortcode template for Hugo") 68 | letterboxdCmd.Flags().StringVar(&ca.cobra.format, "format", domain.OutputYAML, "output format for the Hugo data file") 69 | letterboxdCmd.Flags().StringVar(&ca.cobra.hugodir, "hugodir", ".", "path to the Hugo directory") 70 | letterboxdCmd.Flags().StringVarP(&ca.cobra.input, "input", "i", "", "path to the CSV file (required)") 71 | } 72 | -------------------------------------------------------------------------------- /internal/adapters/left/cli/import_spotify.go: -------------------------------------------------------------------------------- 1 | /* 2 | DIEGO - A data importer extension for Hugo 3 | Copyright (C) 2024 Vinícius Moraes 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | package cli 20 | 21 | import ( 22 | "log" 23 | 24 | "github.com/ttybitnik/diego/internal/app/domain" 25 | 26 | "github.com/spf13/cobra" 27 | ) 28 | 29 | var spotifyCmd = &cobra.Command{ 30 | Use: "spotify {library|playlist} -i file", 31 | Aliases: []string{"s"}, 32 | Args: cobra.MatchAll(cobra.ExactArgs(1), cobra.OnlyValidArgs), 33 | ValidArgs: []string{"library", "playlist", "watchlist"}, 34 | Example: "diego import spotify library -i library.json\n" + 35 | "diego i s playlist -i playlist.json --all --shortcode", 36 | Short: "Import data from Spotify", 37 | Long: `Import data from Spotify.`, 38 | PreRun: func(cmd *cobra.Command, args []string) { 39 | bindViperFlags(cmd, args) 40 | }, 41 | Run: func(cmd *cobra.Command, args []string) { 42 | input, _ := cmd.Flags().GetString("input") 43 | ca.cobra.input = input 44 | 45 | switch args[0] { 46 | case "library": 47 | ca.cobra.model = domain.SpotifyLibrary 48 | ca.cobraImport(ca.cobra) 49 | case "playlist": 50 | ca.cobra.model = domain.SpotifyPlaylist 51 | ca.cobraImport(ca.cobra) 52 | } 53 | }, 54 | } 55 | 56 | func init() { 57 | importCmd.AddCommand(spotifyCmd) 58 | ca = cobraAdapter() 59 | 60 | spotifyCmd.Flags().BoolVar(&ca.cobra.all, "all", false, "import every available field from JSON file") 61 | spotifyCmd.Flags().BoolVar(&ca.cobra.overwrite, "overwrite", false, "overwrite existent output data file") 62 | spotifyCmd.Flags().BoolVar(&ca.cobra.scrape, "scrape", false, "fetch additional data from JSON links using HTTP") 63 | spotifyCmd.Flags().BoolVar(&ca.cobra.shortcode, "shortcode", false, "generate a shortcode template for Hugo") 64 | spotifyCmd.Flags().StringVar(&ca.cobra.format, "format", domain.OutputYAML, "output format for the Hugo data file") 65 | spotifyCmd.Flags().StringVar(&ca.cobra.hugodir, "hugodir", ".", "path to the Hugo directory") 66 | spotifyCmd.Flags().StringVarP(&ca.cobra.input, "input", "i", "", "path to the JSON file (required)") 67 | 68 | err := spotifyCmd.Flags().MarkHidden("scrape") 69 | if err != nil { 70 | log.Fatalln("Error marking flag as hidden:", err) 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /internal/adapters/left/cli/import_youtube.go: -------------------------------------------------------------------------------- 1 | /* 2 | DIEGO - A data importer extension for Hugo 3 | Copyright (C) 2024 Vinícius Moraes 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | package cli 20 | 21 | import ( 22 | "github.com/ttybitnik/diego/internal/app/domain" 23 | 24 | "github.com/spf13/cobra" 25 | ) 26 | 27 | var youtubeCmd = &cobra.Command{ 28 | Use: "youtube {playlist|subscriptions} -i file", 29 | Aliases: []string{"y"}, 30 | Args: cobra.MatchAll(cobra.ExactArgs(1), cobra.OnlyValidArgs), 31 | ValidArgs: []string{"playlist", "subscriptions"}, 32 | Example: "diego import youtube subscriptions -i subscriptions.csv\n" + 33 | "diego i y playlist -i playlist.csv --all --scrape --shortcode", 34 | Short: "Import data from YouTube", 35 | Long: `Import data from YouTube.`, 36 | PreRun: func(cmd *cobra.Command, args []string) { 37 | bindViperFlags(cmd, args) 38 | }, 39 | Run: func(cmd *cobra.Command, args []string) { 40 | input, _ := cmd.Flags().GetString("input") 41 | ca.cobra.input = input 42 | 43 | switch args[0] { 44 | case "playlist": 45 | ca.cobra.model = domain.YoutubePlaylist 46 | ca.cobraImport(ca.cobra) 47 | case "subscriptions": 48 | ca.cobra.model = domain.YoutubeSubscriptions 49 | ca.cobraImport(ca.cobra) 50 | } 51 | }, 52 | } 53 | 54 | func init() { 55 | importCmd.AddCommand(youtubeCmd) 56 | ca = cobraAdapter() 57 | 58 | youtubeCmd.Flags().BoolVar(&ca.cobra.all, "all", false, "import every available field from CSV file") 59 | youtubeCmd.Flags().BoolVar(&ca.cobra.overwrite, "overwrite", false, "overwrite existent output data file") 60 | youtubeCmd.Flags().BoolVar(&ca.cobra.scrape, "scrape", false, "fetch additional data from CSV links using HTTP") 61 | youtubeCmd.Flags().BoolVar(&ca.cobra.shortcode, "shortcode", false, "generate a shortcode template for Hugo") 62 | youtubeCmd.Flags().StringVar(&ca.cobra.format, "format", domain.OutputYAML, "output format for the Hugo data file") 63 | youtubeCmd.Flags().StringVar(&ca.cobra.hugodir, "hugodir", ".", "path to the Hugo directory") 64 | youtubeCmd.Flags().StringVarP(&ca.cobra.input, "input", "i", "", "path to the CSV file (required)") 65 | } 66 | -------------------------------------------------------------------------------- /internal/adapters/left/cli/root.go: -------------------------------------------------------------------------------- 1 | /* 2 | DIEGO - A data importer extension for Hugo 3 | Copyright (C) 2024 Vinícius Moraes 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | package cli 20 | 21 | import ( 22 | "fmt" 23 | "log" 24 | "os" 25 | 26 | "github.com/spf13/cobra" 27 | "github.com/spf13/cobra/doc" 28 | "github.com/spf13/viper" 29 | ) 30 | 31 | var ( 32 | cfgFile string 33 | ciVersion string = "1.0.4" // x-release-please-version 34 | ) 35 | 36 | var rootCmd = &cobra.Command{ 37 | Use: "diego", 38 | Version: ciVersion + ` 39 | Copyright (C) 2024 Vinícius Moraes 40 | License GPLv3+: GNU GPL version 3 or later 41 | This is free software, and you are welcome to change and redistribute it under 42 | certain conditions. This program comes with ABSOLUTELY NO WARRANTY. 43 | Source code available at .`, 44 | Short: "DIEGO - A data importer extension for Hugo", 45 | Long: `DIEGO - A data importer extension for Hugo 46 | 47 | Diego integrates with Hugo as a CLI tool to assist in importing and utilizing 48 | exported social media data from various services on Hugo websites. 49 | 50 | Complete documentation is available at .`, 51 | } 52 | 53 | // Execute adds all child commands to the root command and sets flags appropriately. 54 | // This is called by main.main(). It only needs to happen once to the rootCmd. 55 | func Execute() { 56 | err := rootCmd.Execute() 57 | if err != nil { 58 | os.Exit(1) 59 | } 60 | 61 | if os.Getenv("DIEGO_GENDOCS") == "1" { 62 | generateDocs() 63 | } 64 | 65 | } 66 | 67 | func init() { 68 | cobra.OnInitialize(initConfig) 69 | 70 | rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.config/diego/config.yaml)") 71 | } 72 | 73 | func initConfig() { 74 | viper.SetDefault("diego.import.all", false) 75 | viper.SetDefault("diego.import.overwrite", false) 76 | viper.SetDefault("diego.import.scrape", false) 77 | viper.SetDefault("diego.import.shortcode", false) 78 | viper.SetDefault("diego.import.format", "yaml") 79 | viper.SetDefault("diego.import.hugodir", ".") 80 | 81 | // Use config file from the flag or file system. 82 | if cfgFile != "" { 83 | viper.SetConfigFile(cfgFile) 84 | } else { 85 | home, err := os.UserHomeDir() 86 | cobra.CheckErr(err) 87 | 88 | viper.SetConfigName("config") 89 | viper.SetConfigType("yaml") 90 | viper.AddConfigPath(home + "/.config/diego") 91 | 92 | _ = viper.SafeWriteConfig() 93 | } 94 | 95 | viper.AutomaticEnv() // read in environment variables that match. 96 | 97 | if err := viper.ReadInConfig(); err == nil { 98 | fmt.Fprintln(os.Stderr, "Using config file:", viper.ConfigFileUsed()) 99 | } 100 | } 101 | 102 | func generateDocs() { 103 | header := &doc.GenManHeader{ 104 | Title: "DIEGO", 105 | Section: "1", 106 | Manual: "User Commands", 107 | Source: "diego manual", 108 | } 109 | 110 | rootCmd.DisableAutoGenTag = true 111 | 112 | docsDir := ("docs") 113 | cobra.CheckErr(doc.GenManTree(rootCmd, header, docsDir+"/man")) 114 | cobra.CheckErr(doc.GenMarkdownTree(rootCmd, docsDir+"/help")) 115 | 116 | log.Println("Man and markdown docs recreated:", "./"+docsDir) 117 | } 118 | -------------------------------------------------------------------------------- /internal/adapters/left/cli/set.go: -------------------------------------------------------------------------------- 1 | /* 2 | DIEGO - A data importer extension for Hugo 3 | Copyright (C) 2024 Vinícius Moraes 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | package cli 20 | 21 | import ( 22 | "github.com/spf13/cobra" 23 | ) 24 | 25 | var setCmd = &cobra.Command{ 26 | Use: "set", 27 | Aliases: []string{"s"}, 28 | Short: "Set a configuration option", 29 | Long: `Set a configuration option.`, 30 | } 31 | 32 | func init() { 33 | rootCmd.AddCommand(setCmd) 34 | } 35 | -------------------------------------------------------------------------------- /internal/adapters/left/cli/set_all.go: -------------------------------------------------------------------------------- 1 | /* 2 | DIEGO - A data importer extension for Hugo 3 | Copyright (C) 2024 Vinícius Moraes 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | package cli 20 | 21 | import ( 22 | "fmt" 23 | "log" 24 | 25 | "github.com/spf13/cobra" 26 | "github.com/spf13/viper" 27 | ) 28 | 29 | var allCmd = &cobra.Command{ 30 | Use: "all {true|false|1|0|enabled|disabled}", 31 | Args: cobra.MatchAll(cobra.ExactArgs(1), cobra.OnlyValidArgs), 32 | ValidArgs: []string{"true", "false", "1", "0", "enabled", "disabled"}, 33 | Example: "diego set all true\n" + 34 | "diego s all false", 35 | Short: "Enable or disable the all flag by default", 36 | Long: "Enable or disable the all flag by default.", 37 | Run: func(cmd *cobra.Command, args []string) { 38 | switch args[0] { 39 | case "true", "1", "enabled": 40 | viper.Set("diego.import.all", true) 41 | fmt.Println("All flag is set to 'enabled' by default.") 42 | case "false", "0", "disabled": 43 | viper.Set("diego.import.all", false) 44 | fmt.Println("All flag is set to 'disabled' by default.") 45 | } 46 | 47 | err := viper.WriteConfig() 48 | if err != nil { 49 | log.Fatalln("Error writing into config file:", err) 50 | return 51 | } 52 | }, 53 | } 54 | 55 | func init() { 56 | setCmd.AddCommand(allCmd) 57 | } 58 | -------------------------------------------------------------------------------- /internal/adapters/left/cli/set_defaults.go: -------------------------------------------------------------------------------- 1 | /* 2 | DIEGO - A data importer extension for Hugo 3 | Copyright (C) 2024 Vinícius Moraes 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | package cli 20 | 21 | import ( 22 | "fmt" 23 | "log" 24 | 25 | "github.com/spf13/cobra" 26 | "github.com/spf13/viper" 27 | ) 28 | 29 | var defaultsCmd = &cobra.Command{ 30 | Use: "defaults", 31 | Args: cobra.MatchAll(cobra.ExactArgs(0)), 32 | Example: "diego set defaults true\n" + 33 | "diego s defaults 1", 34 | Short: "Restore Diego default settings", 35 | Long: "Restore Diego default settings.", 36 | Run: func(cmd *cobra.Command, args []string) { 37 | viper.Set("diego.import.all", false) 38 | viper.Set("diego.import.overwrite", false) 39 | viper.Set("diego.import.scrape", false) 40 | viper.Set("diego.import.shortcode", false) 41 | viper.Set("diego.import.format", "yaml") 42 | viper.Set("diego.import.hugodir", ".") 43 | 44 | fmt.Println("Diego default settings restored.") 45 | 46 | err := viper.WriteConfig() 47 | if err != nil { 48 | log.Fatalln("Error writing into config file:", err) 49 | return 50 | } 51 | }, 52 | } 53 | 54 | func init() { 55 | setCmd.AddCommand(defaultsCmd) 56 | } 57 | -------------------------------------------------------------------------------- /internal/adapters/left/cli/set_format.go: -------------------------------------------------------------------------------- 1 | /* 2 | DIEGO - A data importer extension for Hugo 3 | Copyright (C) 2024 Vinícius Moraes 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | package cli 20 | 21 | import ( 22 | "fmt" 23 | "log" 24 | 25 | "github.com/spf13/cobra" 26 | "github.com/spf13/viper" 27 | ) 28 | 29 | var formatCmd = &cobra.Command{ 30 | Use: "format {yaml|json|toml|xml}", 31 | Args: cobra.MatchAll(cobra.ExactArgs(1), cobra.OnlyValidArgs), 32 | ValidArgs: []string{"yaml", "json", "toml", "xml"}, 33 | Example: "diego set format yaml\n" + 34 | "diego s format json", 35 | Short: "Set output format for the Hugo data file (default \"yaml\")", 36 | Long: "Set output format for the Hugo data file (default \"yaml\").", 37 | Run: func(cmd *cobra.Command, args []string) { 38 | switch args[0] { 39 | case "yaml": 40 | viper.Set("diego.import.format", "yaml") 41 | fmt.Println("Format flag is set to 'yaml' by default.") 42 | case "json": 43 | viper.Set("diego.import.format", "json") 44 | fmt.Println("Format flag is set to 'json' by default.") 45 | case "toml": 46 | viper.Set("diego.import.format", "toml") 47 | fmt.Println("Format flag is set to 'toml' by default.") 48 | case "xml": 49 | viper.Set("diego.import.format", "xml") 50 | fmt.Println("Format flag is set to 'yaml' by default.") 51 | } 52 | 53 | err := viper.WriteConfig() 54 | if err != nil { 55 | log.Fatalln("Error writing into config file:", err) 56 | return 57 | } 58 | }, 59 | } 60 | 61 | func init() { 62 | setCmd.AddCommand(formatCmd) 63 | } 64 | -------------------------------------------------------------------------------- /internal/adapters/left/cli/set_hugodir.go: -------------------------------------------------------------------------------- 1 | /* 2 | DIEGO - A data importer extension for Hugo 3 | Copyright (C) 2024 Vinícius Moraes 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | package cli 20 | 21 | import ( 22 | "fmt" 23 | "log" 24 | "os" 25 | "path/filepath" 26 | 27 | "github.com/spf13/cobra" 28 | "github.com/spf13/viper" 29 | ) 30 | 31 | var hugodirCmd = &cobra.Command{ 32 | Use: "hugodir path", 33 | Args: cobra.MatchAll(cobra.ExactArgs(1)), 34 | Example: "diego set hugodir ~/Projects/HugoBlog \n" + 35 | "diego s hugodir ../Projects/HugoSite", 36 | Short: "Set path to the Hugo directory (default \".\")", 37 | Long: "Set path to the Hugo directory (default \".\").", 38 | Run: func(cmd *cobra.Command, args []string) { 39 | dirPath := args[0] 40 | 41 | if _, err := os.Stat(dirPath); os.IsNotExist(err) { 42 | log.Fatalln("Invalid path "+dirPath+":", err) 43 | } 44 | 45 | dirPath = filepath.Clean(dirPath) 46 | 47 | viper.Set("diego.import.hugodir", dirPath) 48 | fmt.Printf("Format flag is set to '%s' by default.\n", dirPath) 49 | 50 | err := viper.WriteConfig() 51 | if err != nil { 52 | log.Fatalln("Error writing into config file:", err) 53 | return 54 | } 55 | }, 56 | } 57 | 58 | func init() { 59 | setCmd.AddCommand(hugodirCmd) 60 | } 61 | -------------------------------------------------------------------------------- /internal/adapters/left/cli/set_overwrite.go: -------------------------------------------------------------------------------- 1 | /* 2 | DIEGO - A data importer extension for Hugo 3 | Copyright (C) 2024 Vinícius Moraes 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | package cli 20 | 21 | import ( 22 | "fmt" 23 | "log" 24 | 25 | "github.com/spf13/cobra" 26 | "github.com/spf13/viper" 27 | ) 28 | 29 | var overwriteCmd = &cobra.Command{ 30 | Use: "overwrite {true|false|1|0|enabled|disabled}", 31 | Args: cobra.MatchAll(cobra.ExactArgs(1), cobra.OnlyValidArgs), 32 | ValidArgs: []string{"true", "false", "1", "0", "enabled", "disabled"}, 33 | Example: "diego set overwrite true\n" + 34 | "diego s overwrite false", 35 | Short: "Enable or disable the overwrite flag by default", 36 | Long: "Enable or disable the overwrite flag by default.", 37 | Run: func(cmd *cobra.Command, args []string) { 38 | switch args[0] { 39 | case "true", "1", "enabled": 40 | viper.Set("diego.import.overwrite", true) 41 | fmt.Println("Overwrite flag is set to 'enabled' by default.") 42 | case "false", "0", "disabled": 43 | viper.Set("diego.import.overwrite", false) 44 | fmt.Println("Overwrite flag is set to 'disabled' by default.") 45 | } 46 | 47 | err := viper.WriteConfig() 48 | if err != nil { 49 | log.Fatalln("Error writing into config file:", err) 50 | return 51 | } 52 | }, 53 | } 54 | 55 | func init() { 56 | setCmd.AddCommand(overwriteCmd) 57 | } 58 | -------------------------------------------------------------------------------- /internal/adapters/left/cli/set_scrape.go: -------------------------------------------------------------------------------- 1 | /* 2 | DIEGO - A data importer extension for Hugo 3 | Copyright (C) 2024 Vinícius Moraes 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | package cli 20 | 21 | import ( 22 | "fmt" 23 | "log" 24 | 25 | "github.com/spf13/cobra" 26 | "github.com/spf13/viper" 27 | ) 28 | 29 | var scrapeCmd = &cobra.Command{ 30 | Use: "scrape {true|false|1|0|enabled|disabled}", 31 | Args: cobra.MatchAll(cobra.ExactArgs(1), cobra.OnlyValidArgs), 32 | ValidArgs: []string{"true", "false", "1", "0", "enabled", "disabled"}, 33 | Example: "diego set scrape true\n" + 34 | "diego s scrape false", 35 | Short: "Enable or disable the scrape flag by default", 36 | Long: "Enable or disable the scrape flag by default.", 37 | Run: func(cmd *cobra.Command, args []string) { 38 | switch args[0] { 39 | case "true", "1", "enabled": 40 | viper.Set("diego.import.scrape", true) 41 | fmt.Println("Scrape flag is set to 'enabled' by default.") 42 | case "false", "0", "disabled": 43 | viper.Set("diego.import.scrape", false) 44 | fmt.Println("Scrape flag is set to 'disabled' by default.") 45 | } 46 | 47 | err := viper.WriteConfig() 48 | if err != nil { 49 | log.Fatalln("Error writing into config file:", err) 50 | return 51 | } 52 | }, 53 | } 54 | 55 | func init() { 56 | setCmd.AddCommand(scrapeCmd) 57 | } 58 | -------------------------------------------------------------------------------- /internal/adapters/left/cli/set_shortcode.go: -------------------------------------------------------------------------------- 1 | /* 2 | DIEGO - A data importer extension for Hugo 3 | Copyright (C) 2024 Vinícius Moraes 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | package cli 20 | 21 | import ( 22 | "fmt" 23 | "log" 24 | 25 | "github.com/spf13/cobra" 26 | "github.com/spf13/viper" 27 | ) 28 | 29 | var shortcodeCmd = &cobra.Command{ 30 | Use: "shortcode {true|false|1|0|enabled|disabled}", 31 | Args: cobra.MatchAll(cobra.ExactArgs(1), cobra.OnlyValidArgs), 32 | ValidArgs: []string{"true", "false", "1", "0", "enabled", "disabled"}, 33 | Example: "diego set shortcode true\n" + 34 | "diego s shortcode false", 35 | Short: "Enable or disable the shortcode flag by default", 36 | Long: "Enable or disable the shortcode flag by default.", 37 | Run: func(cmd *cobra.Command, args []string) { 38 | switch args[0] { 39 | case "true", "1", "enabled": 40 | viper.Set("diego.import.shortcode", true) 41 | fmt.Println("Shortcode flag is set to 'enabled' by default.") 42 | case "false", "0", "disabled": 43 | viper.Set("diego.import.shortcode", false) 44 | fmt.Println("Shortcode flag is set to 'disabled' by default.") 45 | } 46 | 47 | err := viper.WriteConfig() 48 | if err != nil { 49 | log.Fatalln("Error writing into config file:", err) 50 | return 51 | } 52 | }, 53 | } 54 | 55 | func init() { 56 | setCmd.AddCommand(shortcodeCmd) 57 | } 58 | -------------------------------------------------------------------------------- /internal/adapters/left/cli/settings.go: -------------------------------------------------------------------------------- 1 | /* 2 | DIEGO - A data importer extension for Hugo 3 | Copyright (C) 2024 Vinícius Moraes 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | package cli 20 | 21 | import ( 22 | "fmt" 23 | "log" 24 | "sort" 25 | 26 | "github.com/spf13/cobra" 27 | "github.com/spf13/viper" 28 | ) 29 | 30 | var settingsCmd = &cobra.Command{ 31 | Use: "settings", 32 | Short: "Show current settings", 33 | Long: `Show current settings.`, 34 | Run: func(cmd *cobra.Command, args []string) { 35 | if err := viper.ReadInConfig(); err != nil { 36 | log.Fatalln("Error reading config file:", err) 37 | } 38 | 39 | settings := viper.AllSettings() 40 | printSettings("", settings) 41 | 42 | if settings == nil { 43 | log.Fatalln("Error: no configuration file found.") 44 | } 45 | }, 46 | } 47 | 48 | func init() { 49 | rootCmd.AddCommand(settingsCmd) 50 | } 51 | 52 | func printSettings(prefix string, settings map[string]interface{}) { 53 | keys := make([]string, 0, len(settings)) 54 | for key := range settings { 55 | keys = append(keys, key) 56 | } 57 | 58 | sort.Strings(keys) 59 | 60 | for _, key := range keys { 61 | value := settings[key] 62 | if nestedMap, ok := value.(map[string]interface{}); ok { 63 | printSettings(fmt.Sprintf("%s%s.", prefix, key), nestedMap) 64 | } else { 65 | fmt.Printf("%s: %v\n", key, value) 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /internal/adapters/left/cli/testdata/goodreads/complete_library.golden: -------------------------------------------------------------------------------- 1 | - name: Memórias do Subsolo 2 | author: Fyodor Dostoevsky 3 | additionalauthors: Boris Schnaiderman, Fiódor Dostoyevski 4 | isbn: ="8573261854" 5 | isbn13: ="9788573261851" 6 | myrating: "0" 7 | averagerating: "4.18" 8 | publisher: Editora 34 9 | binding: Paperback 10 | numberofpages: "152" 11 | yearpublished: "2009" 12 | year: "1864" 13 | dateread: "" 14 | dateadded: 2018/01/03 15 | bookshelves: favorites 16 | bookshelveswithpos: favorites (#20) 17 | exclusiveshelf: read 18 | myreview: "" 19 | spoiler: "" 20 | privatenotes: "" 21 | readcount: "1" 22 | ownedcopies: "0" 23 | id: "517435" 24 | url: https://www.goodreads.com/book/show/517435 25 | - name: Ein Brasilianer in Berlin 26 | author: João Ubaldo Ribeiro 27 | additionalauthors: "" 28 | isbn: ="3939455040" 29 | isbn13: ="9783939455042" 30 | myrating: "0" 31 | averagerating: "3.92" 32 | publisher: Suhrkamp 33 | binding: Paperback 34 | numberofpages: "" 35 | yearpublished: "2017" 36 | year: "1994" 37 | dateread: 2020/10/13 38 | dateadded: 2020/10/13 39 | bookshelves: favorites 40 | bookshelveswithpos: favorites (#11) 41 | exclusiveshelf: read 42 | myreview: "" 43 | spoiler: "" 44 | privatenotes: "" 45 | readcount: "1" 46 | ownedcopies: "0" 47 | id: "13614950" 48 | url: https://www.goodreads.com/book/show/13614950 49 | - name: Mastering Emacs 50 | author: Mickey Petersen 51 | additionalauthors: "" 52 | isbn: ="" 53 | isbn13: ="" 54 | myrating: "0" 55 | averagerating: "4.16" 56 | publisher: "" 57 | binding: ebook 58 | numberofpages: "314" 59 | yearpublished: "2022" 60 | year: "2015" 61 | dateread: 2023/01/22 62 | dateadded: 2023/01/22 63 | bookshelves: "" 64 | bookshelveswithpos: "" 65 | exclusiveshelf: read 66 | myreview: "" 67 | spoiler: "" 68 | privatenotes: "" 69 | readcount: "1" 70 | ownedcopies: "0" 71 | id: "25587882" 72 | url: https://www.goodreads.com/book/show/25587882 73 | -------------------------------------------------------------------------------- /internal/adapters/left/cli/testdata/goodreads/empty.csv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ttybitnik/diego/93706f3b6e08c58af495bfd0a8d00925e66a0805/internal/adapters/left/cli/testdata/goodreads/empty.csv -------------------------------------------------------------------------------- /internal/adapters/left/cli/testdata/goodreads/invalid.csv: -------------------------------------------------------------------------------- 1 | Name,Author,Author l-f,Additional Authors,ISBN,ISBN13,My Rating,Average Rating,Publisher,Binding,Number of Pages,Year Published,Year,Date Read,Date Added,Bookshelves,Bookshelves with positions,Exclusive Shelf,My Review,Spoiler,Private Notes,Read Count,Owned Copies 2 | Memórias do Subsolo,Fyodor Dostoevsky,"Dostoevsky, Fyodor","Boris Schnaiderman, Fiódor Dostoyevski","=""8573261854""","=""9788573261851""",0,4.18,Editora 34,Paperback,152,2009,1864,,2018/01/03,favorites,favorites (#20),read,,,,1,0 3 | Ein Brasilianer in Berlin,João Ubaldo Ribeiro,"Ribeiro, João Ubaldo",,"=""3939455040""","=""9783939455042""",0,3.92,Suhrkamp,Paperback,,2017,1994,2020/10/13,2020/10/13,favorites,favorites (#11),read,,,,1,0 4 | Mastering Emacs,Mickey Petersen,"Petersen, Mickey",,"=""""","=""""",0,4.16,,ebook,314,2022,2015,2023/01/22,2023/01/22,,,read,,,,1,0 5 | -------------------------------------------------------------------------------- /internal/adapters/left/cli/testdata/goodreads/library.csv: -------------------------------------------------------------------------------- 1 | Id,Name,Author,Author l-f,Additional Authors,ISBN,ISBN13,My Rating,Average Rating,Publisher,Binding,Number of Pages,Year Published,Year,Date Read,Date Added,Bookshelves,Bookshelves with positions,Exclusive Shelf,My Review,Spoiler,Private Notes,Read Count,Owned Copies 2 | 517435,Memórias do Subsolo,Fyodor Dostoevsky,"Dostoevsky, Fyodor","Boris Schnaiderman, Fiódor Dostoyevski","=""8573261854""","=""9788573261851""",0,4.18,Editora 34,Paperback,152,2009,1864,,2018/01/03,favorites,favorites (#20),read,,,,1,0 3 | 13614950,Ein Brasilianer in Berlin,João Ubaldo Ribeiro,"Ribeiro, João Ubaldo",,"=""3939455040""","=""9783939455042""",0,3.92,Suhrkamp,Paperback,,2017,1994,2020/10/13,2020/10/13,favorites,favorites (#11),read,,,,1,0 4 | 25587882,Mastering Emacs,Mickey Petersen,"Petersen, Mickey",,"=""""","=""""",0,4.16,,ebook,314,2022,2015,2023/01/22,2023/01/22,,,read,,,,1,0 5 | -------------------------------------------------------------------------------- /internal/adapters/left/cli/testdata/goodreads/library.golden: -------------------------------------------------------------------------------- 1 | - name: Memórias do Subsolo 2 | author: Fyodor Dostoevsky 3 | myrating: "0" 4 | yearpublished: "2009" 5 | url: https://www.goodreads.com/book/show/517435 6 | - name: Ein Brasilianer in Berlin 7 | author: João Ubaldo Ribeiro 8 | myrating: "0" 9 | yearpublished: "2017" 10 | url: https://www.goodreads.com/book/show/13614950 11 | - name: Mastering Emacs 12 | author: Mickey Petersen 13 | myrating: "0" 14 | yearpublished: "2022" 15 | url: https://www.goodreads.com/book/show/25587882 16 | -------------------------------------------------------------------------------- /internal/adapters/left/cli/testdata/goodreads/shortcode_complete_library.golden: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {{ range sort .Site.Data.diego_goodreads_library "name" }} 5 | 6 | 9 | 12 | 15 | 18 | 21 | 22 | {{ end }} 23 | 24 |
7 | {{ .name }} 8 | 10 | {{ .author }} 11 | 13 | {{ .myrating }} 14 | 16 | {{ .yearpublished }} 17 | 19 | goodreads 20 |
-------------------------------------------------------------------------------- /internal/adapters/left/cli/testdata/goodreads/shortcode_library.golden: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {{ range sort .Site.Data.diego_goodreads_library "name" }} 5 | 6 | 9 | 12 | 15 | 18 | 21 | 22 | {{ end }} 23 | 24 |
7 | {{ .name }} 8 | 10 | {{ .author }} 11 | 13 | {{ .myrating }} 14 | 16 | {{ .yearpublished }} 17 | 19 | goodreads 20 |
-------------------------------------------------------------------------------- /internal/adapters/left/cli/testdata/imdb/complete_list.golden: -------------------------------------------------------------------------------- 1 | - name: No Intenso Agora 2 | originalname: No Intenso Agora 3 | directors: João Moreira Salles 4 | year: "2017" 5 | yourrating: "10" 6 | url: https://www.imdb.com/title/tt6532954/ 7 | position: "1" 8 | const: tt6532954 9 | created: "2018-05-25" 10 | modified: "2018-05-25" 11 | description: "" 12 | titletype: Movie 13 | imdbrating: "7.4" 14 | runtimemins: "127" 15 | genres: Documentary, History 16 | numvotes: "623" 17 | releasedate: "2018-01-31" 18 | daterated: "2018-05-25" 19 | - name: Loving Vincent 20 | originalname: Loving Vincent 21 | directors: DK Welchman, Hugh Welchman 22 | year: "2017" 23 | yourrating: "10" 24 | url: https://www.imdb.com/title/tt3262342/ 25 | position: "2" 26 | const: tt3262342 27 | created: "2018-01-20" 28 | modified: "2018-01-20" 29 | description: "" 30 | titletype: Movie 31 | imdbrating: "7.8" 32 | runtimemins: "94" 33 | genres: Animation, Drama, Mystery 34 | numvotes: "65222" 35 | releasedate: "2017-09-22" 36 | daterated: "2018-01-20" 37 | - name: T2 Trainspotting 38 | originalname: T2 Trainspotting 39 | directors: Danny Boyle 40 | year: "2017" 41 | yourrating: "9" 42 | url: https://www.imdb.com/title/tt2763304/ 43 | position: "3" 44 | const: tt2763304 45 | created: "2017-05-28" 46 | modified: "2017-05-28" 47 | description: "" 48 | titletype: Movie 49 | imdbrating: "7.1" 50 | runtimemins: "117" 51 | genres: Comedy, Crime, Drama 52 | numvotes: "135606" 53 | releasedate: "2017-03-31" 54 | daterated: "2017-05-28" 55 | -------------------------------------------------------------------------------- /internal/adapters/left/cli/testdata/imdb/complete_ratings.golden: -------------------------------------------------------------------------------- 1 | - name: Red Desert 2 | originalname: Il deserto rosso 3 | directors: Michelangelo Antonioni 4 | year: "1964" 5 | yourrating: "10" 6 | imdbrating: "7.4" 7 | url: https://www.imdb.com/title/tt0058003 8 | const: tt0058003 9 | titletype: Movie 10 | daterated: "2018-08-21" 11 | runtimemins: "117" 12 | genres: Drama 13 | numvotes: "18182" 14 | releasedate: "1965-02-08" 15 | - name: Talk to Her 16 | originalname: Hable con ella 17 | directors: Pedro Almodóvar 18 | year: "2002" 19 | yourrating: "10" 20 | imdbrating: "7.9" 21 | url: https://www.imdb.com/title/tt0287467 22 | const: tt0287467 23 | titletype: Movie 24 | daterated: "2016-07-24" 25 | runtimemins: "112" 26 | genres: Romance, Mystery, Drama 27 | numvotes: "119041" 28 | releasedate: "2003-02-14" 29 | - name: In the Mood for Love 30 | originalname: Fa yeung nin wah 31 | directors: Kar-Wai Wong 32 | year: "2000" 33 | yourrating: "10" 34 | imdbrating: "8.1" 35 | url: https://www.imdb.com/title/tt0118694 36 | const: tt0118694 37 | titletype: Movie 38 | daterated: "2021-05-16" 39 | runtimemins: "98" 40 | genres: Romance, Drama 41 | numvotes: "172527" 42 | releasedate: "2001-03-09" 43 | -------------------------------------------------------------------------------- /internal/adapters/left/cli/testdata/imdb/complete_watchlist.golden: -------------------------------------------------------------------------------- 1 | - name: Shoot the Piano Player 2 | originalname: Tirez sur le pianiste 3 | directors: François Truffaut 4 | year: "1960" 5 | created: "2016-01-15" 6 | position: "8" 7 | url: https://www.imdb.com/title/tt0054389/ 8 | const: tt0054389 9 | modified: "2016-01-15" 10 | description: "" 11 | titletype: Movie 12 | imdbrating: "7.4" 13 | runtimemins: "92" 14 | genres: Crime, Drama, Thriller 15 | numvotes: "21077" 16 | releasedate: "1962-07-23" 17 | yourrating: "" 18 | daterated: "" 19 | - name: Cobweb 20 | originalname: Geomijip 21 | directors: Kim Jee-woon 22 | year: "2023" 23 | created: "2023-12-25" 24 | position: "218" 25 | url: https://www.imdb.com/title/tt21254598/ 26 | const: tt21254598 27 | modified: "2023-12-25" 28 | description: "" 29 | titletype: Movie 30 | imdbrating: "6.6" 31 | runtimemins: "135" 32 | genres: Comedy, Drama, History 33 | numvotes: "1908" 34 | releasedate: "2024-02-09" 35 | yourrating: "" 36 | daterated: "" 37 | - name: Elis and Tom 38 | originalname: 'Elis & Tom: Só Tinha de Ser com Você' 39 | directors: Roberto de Oliveira, Jom Tob Azulay 40 | year: "2022" 41 | created: "2023-12-29" 42 | position: "220" 43 | url: https://www.imdb.com/title/tt26255088/ 44 | const: tt26255088 45 | modified: "2023-12-29" 46 | description: "" 47 | titletype: Movie 48 | imdbrating: "7.8" 49 | runtimemins: "100" 50 | genres: Documentary, Music 51 | numvotes: "438" 52 | releasedate: "2024-08-01" 53 | yourrating: "" 54 | daterated: "" 55 | -------------------------------------------------------------------------------- /internal/adapters/left/cli/testdata/imdb/empty.csv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ttybitnik/diego/93706f3b6e08c58af495bfd0a8d00925e66a0805/internal/adapters/left/cli/testdata/imdb/empty.csv -------------------------------------------------------------------------------- /internal/adapters/left/cli/testdata/imdb/invalid.csv: -------------------------------------------------------------------------------- 1 | Const,Created 2 | tt5537002,2023-12-25 3 | tt21027780,2023-12-25 4 | tt26255088,2023-12-25 -------------------------------------------------------------------------------- /internal/adapters/left/cli/testdata/imdb/list.csv: -------------------------------------------------------------------------------- 1 | Position,Const,Created,Modified,Description,Title,Original Title,URL,Title Type,IMDb Rating,Runtime (mins),Year,Genres,Num Votes,Release Date,Directors,Your Rating,Date Rated 2 | 1,tt6532954,2018-05-25,2018-05-25,,"No Intenso Agora","No Intenso Agora",https://www.imdb.com/title/tt6532954/,Movie,7.4,127,2017,"Documentary, History",623,2018-01-31,"João Moreira Salles",10,2018-05-25 3 | 2,tt3262342,2018-01-20,2018-01-20,,"Loving Vincent","Loving Vincent",https://www.imdb.com/title/tt3262342/,Movie,7.8,94,2017,"Animation, Drama, Mystery",65222,2017-09-22,"DK Welchman, Hugh Welchman",10,2018-01-20 4 | 3,tt2763304,2017-05-28,2017-05-28,,"T2 Trainspotting","T2 Trainspotting",https://www.imdb.com/title/tt2763304/,Movie,7.1,117,2017,"Comedy, Crime, Drama",135606,2017-03-31,"Danny Boyle",9,2017-05-28 -------------------------------------------------------------------------------- /internal/adapters/left/cli/testdata/imdb/list.golden: -------------------------------------------------------------------------------- 1 | - name: No Intenso Agora 2 | originalname: No Intenso Agora 3 | directors: João Moreira Salles 4 | year: "2017" 5 | yourrating: "10" 6 | url: https://www.imdb.com/title/tt6532954/ 7 | - name: Loving Vincent 8 | originalname: Loving Vincent 9 | directors: DK Welchman, Hugh Welchman 10 | year: "2017" 11 | yourrating: "10" 12 | url: https://www.imdb.com/title/tt3262342/ 13 | - name: T2 Trainspotting 14 | originalname: T2 Trainspotting 15 | directors: Danny Boyle 16 | year: "2017" 17 | yourrating: "9" 18 | url: https://www.imdb.com/title/tt2763304/ 19 | -------------------------------------------------------------------------------- /internal/adapters/left/cli/testdata/imdb/ratings.csv: -------------------------------------------------------------------------------- 1 | Const,Your Rating,Date Rated,Title,Original Title,URL,Title Type,IMDb Rating,Runtime (mins),Year,Genres,Num Votes,Release Date,Directors 2 | tt0058003,10,2018-08-21,"Red Desert","Il deserto rosso",https://www.imdb.com/title/tt0058003,Movie,7.4,117,1964,"Drama",18182,"1965-02-08","Michelangelo Antonioni" 3 | tt0287467,10,2016-07-24,"Talk to Her","Hable con ella",https://www.imdb.com/title/tt0287467,Movie,7.9,112,2002,"Romance, Mystery, Drama",119041,"2003-02-14","Pedro Almodóvar" 4 | tt0118694,10,2021-05-16,"In the Mood for Love","Fa yeung nin wah",https://www.imdb.com/title/tt0118694,Movie,8.1,98,2000,"Romance, Drama",172527,"2001-03-09","Kar-Wai Wong" -------------------------------------------------------------------------------- /internal/adapters/left/cli/testdata/imdb/ratings.golden: -------------------------------------------------------------------------------- 1 | - name: Red Desert 2 | originalname: Il deserto rosso 3 | directors: Michelangelo Antonioni 4 | year: "1964" 5 | yourrating: "2018-08-21" 6 | imdbrating: "7.4" 7 | url: https://www.imdb.com/title/tt0058003 8 | - name: Talk to Her 9 | originalname: Hable con ella 10 | directors: Pedro Almodóvar 11 | year: "2002" 12 | yourrating: "2016-07-24" 13 | imdbrating: "7.9" 14 | url: https://www.imdb.com/title/tt0287467 15 | - name: In the Mood for Love 16 | originalname: Fa yeung nin wah 17 | directors: Kar-Wai Wong 18 | year: "2000" 19 | yourrating: "2021-05-16" 20 | imdbrating: "8.1" 21 | url: https://www.imdb.com/title/tt0118694 22 | -------------------------------------------------------------------------------- /internal/adapters/left/cli/testdata/imdb/shortcode_complete_list.golden: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {{ range sort .Site.Data.diego_imdb_list "name" }} 5 | 6 | 9 | 12 | 15 | 18 | 21 | 22 | {{ end }} 23 | 24 |
7 | {{ .name }} 8 | 10 | {{ .directors }} 11 | 13 | {{ .year }} 14 | 16 | {{ .yourrating }} 17 | 19 | IMDb 20 |
-------------------------------------------------------------------------------- /internal/adapters/left/cli/testdata/imdb/shortcode_complete_ratings.golden: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {{ range sort .Site.Data.diego_imdb_ratings "name" }} 5 | 6 | 9 | 12 | 15 | 18 | 21 | 24 | 25 | {{ end }} 26 | 27 |
7 | {{ .name }} 8 | 10 | {{ .directors }} 11 | 13 | {{ .year }} 14 | 16 | {{ .yourrating }} 17 | 19 | {{ .imdbrating }} 20 | 22 | IMDb 23 |
-------------------------------------------------------------------------------- /internal/adapters/left/cli/testdata/imdb/shortcode_complete_watchlist.golden: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {{ range sort .Site.Data.diego_imdb_watchlist "name" }} 5 | 6 | 9 | 12 | 15 | 18 | 21 | 24 | 25 | {{ end }} 26 | 27 |
7 | {{ .name }} 8 | 10 | {{ .directors }} 11 | 13 | {{ .year }} 14 | 16 | {{ .created }} 17 | 19 | {{ .position }} 20 | 22 | IMDb 23 |
-------------------------------------------------------------------------------- /internal/adapters/left/cli/testdata/imdb/shortcode_list.golden: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {{ range sort .Site.Data.diego_imdb_list "name" }} 5 | 6 | 9 | 12 | 15 | 18 | 21 | 22 | {{ end }} 23 | 24 |
7 | {{ .name }} 8 | 10 | {{ .directors }} 11 | 13 | {{ .year }} 14 | 16 | {{ .yourrating }} 17 | 19 | IMDb 20 |
-------------------------------------------------------------------------------- /internal/adapters/left/cli/testdata/imdb/shortcode_ratings.golden: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {{ range sort .Site.Data.diego_imdb_ratings "name" }} 5 | 6 | 9 | 12 | 15 | 18 | 21 | 24 | 25 | {{ end }} 26 | 27 |
7 | {{ .name }} 8 | 10 | {{ .directors }} 11 | 13 | {{ .year }} 14 | 16 | {{ .yourrating }} 17 | 19 | {{ .imdbrating }} 20 | 22 | IMDb 23 |
-------------------------------------------------------------------------------- /internal/adapters/left/cli/testdata/imdb/shortcode_watchlist.golden: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {{ range sort .Site.Data.diego_imdb_watchlist "name" }} 5 | 6 | 9 | 12 | 15 | 18 | 21 | 24 | 25 | {{ end }} 26 | 27 |
7 | {{ .name }} 8 | 10 | {{ .directors }} 11 | 13 | {{ .year }} 14 | 16 | {{ .created }} 17 | 19 | {{ .position }} 20 | 22 | IMDb 23 |
-------------------------------------------------------------------------------- /internal/adapters/left/cli/testdata/imdb/watchlist.csv: -------------------------------------------------------------------------------- 1 | Position,Const,Created,Modified,Description,Title,Original Title,URL,Title Type,IMDb Rating,Runtime (mins),Year,Genres,Num Votes,Release Date,Directors,Your Rating,Date Rated 2 | 8,tt0054389,2016-01-15,2016-01-15,,"Shoot the Piano Player","Tirez sur le pianiste",https://www.imdb.com/title/tt0054389/,Movie,7.4,92,1960,"Crime, Drama, Thriller",21077,1962-07-23,"François Truffaut",, 3 | 218,tt21254598,2023-12-25,2023-12-25,,"Cobweb","Geomijip",https://www.imdb.com/title/tt21254598/,Movie,6.6,135,2023,"Comedy, Drama, History",1908,2024-02-09,"Kim Jee-woon",, 4 | 220,tt26255088,2023-12-29,2023-12-29,,"Elis and Tom","Elis & Tom: Só Tinha de Ser com Você",https://www.imdb.com/title/tt26255088/,Movie,7.8,100,2022,"Documentary, Music",438,2024-08-01,"Roberto de Oliveira, Jom Tob Azulay",, 5 | -------------------------------------------------------------------------------- /internal/adapters/left/cli/testdata/imdb/watchlist.golden: -------------------------------------------------------------------------------- 1 | - name: Shoot the Piano Player 2 | originalname: Tirez sur le pianiste 3 | directors: François Truffaut 4 | year: "1960" 5 | created: "2016-01-15" 6 | position: "8" 7 | url: https://www.imdb.com/title/tt0054389/ 8 | - name: Cobweb 9 | originalname: Geomijip 10 | directors: Kim Jee-woon 11 | year: "2023" 12 | created: "2023-12-25" 13 | position: "218" 14 | url: https://www.imdb.com/title/tt21254598/ 15 | - name: Elis and Tom 16 | originalname: 'Elis & Tom: Só Tinha de Ser com Você' 17 | directors: Roberto de Oliveira, Jom Tob Azulay 18 | year: "2022" 19 | created: "2023-12-29" 20 | position: "220" 21 | url: https://www.imdb.com/title/tt26255088/ 22 | -------------------------------------------------------------------------------- /internal/adapters/left/cli/testdata/instapaper/complete_list.golden: -------------------------------------------------------------------------------- 1 | - name: Fernando Pessoa’s Disappearing Act 2 | url: https://www.newyorker.com/magazine/2017/09/04/fernando-pessoas-disappearing-act 3 | selection: "" 4 | directory: Starred 5 | timestamp: "1679174385" 6 | - name: 'Knightmare: A DevOps Cautionary Tale' 7 | url: https://dougseven.com/2014/04/17/knightmare-a-devops-cautionary-tale/ 8 | selection: "" 9 | directory: Starred 10 | timestamp: "1694613937" 11 | - name: Love in Translation 12 | url: https://www.newyorker.com/magazine/2016/08/08/lauren-collins-learns-to-love-in-french 13 | selection: "" 14 | directory: Starred 15 | timestamp: "1679174483" 16 | -------------------------------------------------------------------------------- /internal/adapters/left/cli/testdata/instapaper/empty.csv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ttybitnik/diego/93706f3b6e08c58af495bfd0a8d00925e66a0805/internal/adapters/left/cli/testdata/instapaper/empty.csv -------------------------------------------------------------------------------- /internal/adapters/left/cli/testdata/instapaper/invalid.csv: -------------------------------------------------------------------------------- 1 | URL,Title,Selection 2 | https://www.newyorker.com/magazine/2017/09/04/fernando-pessoas-disappearing-act,Fernando Pessoa’s Disappearing Act,, 3 | -------------------------------------------------------------------------------- /internal/adapters/left/cli/testdata/instapaper/list.csv: -------------------------------------------------------------------------------- 1 | URL,Title,Selection,Folder,Timestamp 2 | https://www.newyorker.com/magazine/2017/09/04/fernando-pessoas-disappearing-act,Fernando Pessoa’s Disappearing Act,,Starred,1679174385 3 | https://dougseven.com/2014/04/17/knightmare-a-devops-cautionary-tale/,Knightmare: A DevOps Cautionary Tale,,Starred,1694613937 4 | https://www.newyorker.com/magazine/2016/08/08/lauren-collins-learns-to-love-in-french,Love in Translation,,Starred,1679174483 5 | -------------------------------------------------------------------------------- /internal/adapters/left/cli/testdata/instapaper/list.golden: -------------------------------------------------------------------------------- 1 | - name: Fernando Pessoa’s Disappearing Act 2 | url: https://www.newyorker.com/magazine/2017/09/04/fernando-pessoas-disappearing-act 3 | timestamp: "1679174385" 4 | - name: 'Knightmare: A DevOps Cautionary Tale' 5 | url: https://dougseven.com/2014/04/17/knightmare-a-devops-cautionary-tale/ 6 | timestamp: "1694613937" 7 | - name: Love in Translation 8 | url: https://www.newyorker.com/magazine/2016/08/08/lauren-collins-learns-to-love-in-french 9 | timestamp: "1679174483" 10 | -------------------------------------------------------------------------------- /internal/adapters/left/cli/testdata/instapaper/shortcode_complete_list.golden: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {{ range sort .Site.Data.diego_instapaper_list "name" }} 5 | 6 | 9 | 12 | 15 | 16 | {{ end }} 17 | 18 |
7 | {{ .name }} 8 | 10 | {{ .timestamp }} 11 | 13 | Link 14 |
-------------------------------------------------------------------------------- /internal/adapters/left/cli/testdata/instapaper/shortcode_list.golden: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {{ range sort .Site.Data.diego_instapaper_list "name" }} 5 | 6 | 9 | 12 | 15 | 16 | {{ end }} 17 | 18 |
7 | {{ .name }} 8 | 10 | {{ .timestamp }} 11 | 13 | Link 14 |
-------------------------------------------------------------------------------- /internal/adapters/left/cli/testdata/letterboxd/complete_diary.golden: -------------------------------------------------------------------------------- 1 | - name: My Small Land 2 | year: "2022" 3 | url: https://boxd.it/4wyHj9 4 | date: "2023-07-16" 5 | rating: "5" 6 | rewatch: "" 7 | tags: "" 8 | watcheddate: "2023-07-15" 9 | - name: Mars One 10 | year: "2022" 11 | url: https://boxd.it/5geIaV 12 | date: "2023-12-03" 13 | rating: "4.5" 14 | rewatch: "" 15 | tags: "" 16 | watcheddate: "2023-12-03" 17 | - name: As Tears Go By 18 | year: "1988" 19 | url: https://boxd.it/5nUHjJ 20 | date: "2023-12-24" 21 | rating: "5" 22 | rewatch: "" 23 | tags: "" 24 | watcheddate: "2023-12-24" 25 | -------------------------------------------------------------------------------- /internal/adapters/left/cli/testdata/letterboxd/complete_films.golden: -------------------------------------------------------------------------------- 1 | - name: Sans Soleil 2 | year: "1983" 3 | url: https://boxd.it/28B8 4 | date: "2021-12-14" 5 | - name: Dekalog 6 | year: "1989" 7 | url: https://boxd.it/bv4u 8 | date: "2021-12-14" 9 | - name: Blade Runner 10 | year: "1982" 11 | url: https://boxd.it/2bcA 12 | date: "2021-12-14" 13 | -------------------------------------------------------------------------------- /internal/adapters/left/cli/testdata/letterboxd/complete_reviews.golden: -------------------------------------------------------------------------------- 1 | - name: Fallen Leaves 2 | year: "2023" 3 | url: https://boxd.it/5wluaZ 4 | date: "2024-01-07" 5 | rating: "4" 6 | rewatch: "" 7 | review: Lorem Ipsum! 8 | tags: "" 9 | watcheddate: "2024-01-06" 10 | - name: Goodbye, Dragon Inn 11 | year: "2003" 12 | url: https://boxd.it/5E4WzB 13 | date: "2024-01-21" 14 | rating: "4" 15 | rewatch: "" 16 | review: Lorem Ipsum! 17 | tags: "" 18 | watcheddate: "2024-01-20" 19 | - name: Pictures of Ghosts 20 | year: "2023" 21 | url: https://boxd.it/5FB5dd 22 | date: "2024-01-24" 23 | rating: "5" 24 | rewatch: "" 25 | review: Lorem Ipsum! 26 | tags: "" 27 | watcheddate: "2024-01-23" 28 | -------------------------------------------------------------------------------- /internal/adapters/left/cli/testdata/letterboxd/complete_watchlist.golden: -------------------------------------------------------------------------------- 1 | - name: Vivre Sa Vie 2 | year: "1962" 3 | url: https://boxd.it/28s6 4 | date: "2023-12-14" 5 | - name: Mon Oncle 6 | year: "1958" 7 | url: https://boxd.it/2apy 8 | date: "2023-12-14" 9 | - name: Days 10 | year: "2020" 11 | url: https://boxd.it/oEE8 12 | date: "2023-12-14" 13 | -------------------------------------------------------------------------------- /internal/adapters/left/cli/testdata/letterboxd/diary.csv: -------------------------------------------------------------------------------- 1 | Date,Name,Year,Letterboxd URI,Rating,Rewatch,Tags,Watched Date 2 | 2023-07-16,My Small Land,2022,https://boxd.it/4wyHj9,5,,,2023-07-15 3 | 2023-12-03,Mars One,2022,https://boxd.it/5geIaV,4.5,,,2023-12-03 4 | 2023-12-24,As Tears Go By,1988,https://boxd.it/5nUHjJ,5,,,2023-12-24 -------------------------------------------------------------------------------- /internal/adapters/left/cli/testdata/letterboxd/diary.golden: -------------------------------------------------------------------------------- 1 | - name: My Small Land 2 | year: "2022" 3 | url: https://boxd.it/4wyHj9 4 | date: "2023-07-16" 5 | rating: "5" 6 | - name: Mars One 7 | year: "2022" 8 | url: https://boxd.it/5geIaV 9 | date: "2023-12-03" 10 | rating: "4.5" 11 | - name: As Tears Go By 12 | year: "1988" 13 | url: https://boxd.it/5nUHjJ 14 | date: "2023-12-24" 15 | rating: "5" 16 | -------------------------------------------------------------------------------- /internal/adapters/left/cli/testdata/letterboxd/empty.csv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ttybitnik/diego/93706f3b6e08c58af495bfd0a8d00925e66a0805/internal/adapters/left/cli/testdata/letterboxd/empty.csv -------------------------------------------------------------------------------- /internal/adapters/left/cli/testdata/letterboxd/films.csv: -------------------------------------------------------------------------------- 1 | Date,Name,Year,Letterboxd URI 2 | 2021-12-14,Sans Soleil,1983,https://boxd.it/28B8 3 | 2021-12-14,Dekalog,1989,https://boxd.it/bv4u 4 | 2021-12-14,Blade Runner,1982,https://boxd.it/2bcA -------------------------------------------------------------------------------- /internal/adapters/left/cli/testdata/letterboxd/films.golden: -------------------------------------------------------------------------------- 1 | - name: Sans Soleil 2 | year: "1983" 3 | url: https://boxd.it/28B8 4 | date: "2021-12-14" 5 | - name: Dekalog 6 | year: "1989" 7 | url: https://boxd.it/bv4u 8 | date: "2021-12-14" 9 | - name: Blade Runner 10 | year: "1982" 11 | url: https://boxd.it/2bcA 12 | date: "2021-12-14" 13 | -------------------------------------------------------------------------------- /internal/adapters/left/cli/testdata/letterboxd/invalid.csv: -------------------------------------------------------------------------------- 1 | Date 2 | 2021-12-14 3 | 2021-12-14 4 | 2021-12-14 -------------------------------------------------------------------------------- /internal/adapters/left/cli/testdata/letterboxd/reviews.csv: -------------------------------------------------------------------------------- 1 | Date,Name,Year,Letterboxd URI,Rating,Rewatch,Review,Tags,Watched Date 2 | 2024-01-07,Fallen Leaves,2023,https://boxd.it/5wluaZ,4,,"Lorem Ipsum!",,2024-01-06 3 | 2024-01-21,"Goodbye, Dragon Inn",2003,https://boxd.it/5E4WzB,4,,"Lorem Ipsum!",,2024-01-20 4 | 2024-01-24,Pictures of Ghosts,2023,https://boxd.it/5FB5dd,5,,"Lorem Ipsum!",,2024-01-23 -------------------------------------------------------------------------------- /internal/adapters/left/cli/testdata/letterboxd/reviews.golden: -------------------------------------------------------------------------------- 1 | - name: Fallen Leaves 2 | year: "2023" 3 | url: https://boxd.it/5wluaZ 4 | date: "2024-01-07" 5 | rating: "4" 6 | review: Lorem Ipsum! 7 | - name: Goodbye, Dragon Inn 8 | year: "2003" 9 | url: https://boxd.it/5E4WzB 10 | date: "2024-01-21" 11 | rating: "4" 12 | review: Lorem Ipsum! 13 | - name: Pictures of Ghosts 14 | year: "2023" 15 | url: https://boxd.it/5FB5dd 16 | date: "2024-01-24" 17 | rating: "5" 18 | review: Lorem Ipsum! 19 | -------------------------------------------------------------------------------- /internal/adapters/left/cli/testdata/letterboxd/shortcode_complete_diary.golden: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {{ range sort .Site.Data.diego_letterboxd_diary "name" }} 5 | 6 | 9 | 12 | 15 | 18 | 21 | 22 | {{ end }} 23 | 24 |
7 | {{ .name }} 8 | 10 | {{ .year }} 11 | 13 | {{ .date }} 14 | 16 | {{ .rating }} 17 | 19 | Letterboxd 20 |
-------------------------------------------------------------------------------- /internal/adapters/left/cli/testdata/letterboxd/shortcode_complete_films.golden: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {{ range sort .Site.Data.diego_letterboxd_films "name" }} 5 | 6 | 9 | 12 | 15 | 18 | 19 | {{ end }} 20 | 21 |
7 | {{ .name }} 8 | 10 | {{ .year }} 11 | 13 | {{ .date }} 14 | 16 | Letterboxd 17 |
-------------------------------------------------------------------------------- /internal/adapters/left/cli/testdata/letterboxd/shortcode_complete_reviews.golden: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {{ range sort .Site.Data.diego_letterboxd_reviews "name" }} 5 | 6 | 9 | 12 | 15 | 18 | 21 | 24 | 25 | {{ end }} 26 | 27 |
7 | {{ .name }} 8 | 10 | {{ .year }} 11 | 13 | {{ .date }} 14 | 16 | {{ .rating }} 17 | 19 | {{ .review }} 20 | 22 | Letterboxd 23 |
-------------------------------------------------------------------------------- /internal/adapters/left/cli/testdata/letterboxd/shortcode_complete_watchlist.golden: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {{ range sort .Site.Data.diego_letterboxd_watchlist "name" }} 5 | 6 | 9 | 12 | 15 | 18 | 19 | {{ end }} 20 | 21 |
7 | {{ .name }} 8 | 10 | {{ .year }} 11 | 13 | {{ .date }} 14 | 16 | Letterboxd 17 |
-------------------------------------------------------------------------------- /internal/adapters/left/cli/testdata/letterboxd/shortcode_diary.golden: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {{ range sort .Site.Data.diego_letterboxd_diary "name" }} 5 | 6 | 9 | 12 | 15 | 18 | 21 | 22 | {{ end }} 23 | 24 |
7 | {{ .name }} 8 | 10 | {{ .year }} 11 | 13 | {{ .date }} 14 | 16 | {{ .rating }} 17 | 19 | Letterboxd 20 |
-------------------------------------------------------------------------------- /internal/adapters/left/cli/testdata/letterboxd/shortcode_films.golden: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {{ range sort .Site.Data.diego_letterboxd_films "name" }} 5 | 6 | 9 | 12 | 15 | 18 | 19 | {{ end }} 20 | 21 |
7 | {{ .name }} 8 | 10 | {{ .year }} 11 | 13 | {{ .date }} 14 | 16 | Letterboxd 17 |
-------------------------------------------------------------------------------- /internal/adapters/left/cli/testdata/letterboxd/shortcode_reviews.golden: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {{ range sort .Site.Data.diego_letterboxd_reviews "name" }} 5 | 6 | 9 | 12 | 15 | 18 | 21 | 24 | 25 | {{ end }} 26 | 27 |
7 | {{ .name }} 8 | 10 | {{ .year }} 11 | 13 | {{ .date }} 14 | 16 | {{ .rating }} 17 | 19 | {{ .review }} 20 | 22 | Letterboxd 23 |
-------------------------------------------------------------------------------- /internal/adapters/left/cli/testdata/letterboxd/shortcode_watchlist.golden: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {{ range sort .Site.Data.diego_letterboxd_watchlist "name" }} 5 | 6 | 9 | 12 | 15 | 18 | 19 | {{ end }} 20 | 21 |
7 | {{ .name }} 8 | 10 | {{ .year }} 11 | 13 | {{ .date }} 14 | 16 | Letterboxd 17 |
-------------------------------------------------------------------------------- /internal/adapters/left/cli/testdata/letterboxd/watchlist.csv: -------------------------------------------------------------------------------- 1 | Date,Name,Year,Letterboxd URI 2 | 2023-12-14,Vivre Sa Vie,1962,https://boxd.it/28s6 3 | 2023-12-14,Mon Oncle,1958,https://boxd.it/2apy 4 | 2023-12-14,Days,2020,https://boxd.it/oEE8 -------------------------------------------------------------------------------- /internal/adapters/left/cli/testdata/letterboxd/watchlist.golden: -------------------------------------------------------------------------------- 1 | - name: Vivre Sa Vie 2 | year: "1962" 3 | url: https://boxd.it/28s6 4 | date: "2023-12-14" 5 | - name: Mon Oncle 6 | year: "1958" 7 | url: https://boxd.it/2apy 8 | date: "2023-12-14" 9 | - name: Days 10 | year: "2020" 11 | url: https://boxd.it/oEE8 12 | date: "2023-12-14" 13 | -------------------------------------------------------------------------------- /internal/adapters/left/cli/testdata/spotify/complete_library.golden: -------------------------------------------------------------------------------- 1 | - tracks: 2 | - artist: Modena City Ramblers 3 | album: Tracce Clandestine 4 | track: Crookedwood Polkas 5 | uri: spotify:track:4pQF8GvUIT2CKmoJG209ak 6 | trackurl: https://open.spotify.com/track/4pQF8GvUIT2CKmoJG209ak 7 | - artist: Jorge Ben Jor 8 | album: A Tabua De Esmeralda 9 | track: O Homem Da Gravata Florida 10 | uri: spotify:track:0iPjvpxh6XE9Zo2smrWDhw 11 | trackurl: https://open.spotify.com/track/0iPjvpxh6XE9Zo2smrWDhw 12 | - artist: Lou Reed 13 | album: The Raven 14 | track: Call on Me (feat. Laurie Anderson) 15 | uri: spotify:track:2WSnY39N88UvTgt1YhvVFA 16 | trackurl: https://open.spotify.com/track/2WSnY39N88UvTgt1YhvVFA 17 | albums: 18 | - artist: SEATBELTS 19 | album: 「COWBOY BEBOP」オリジナルサウンドトラック 20 | uri: spotify:album:6cYPbwsAFAcddFuGeXMR7l 21 | albumurl: https://open.spotify.com/album/6cYPbwsAFAcddFuGeXMR7l 22 | - artist: Lykke Li 23 | album: Youth Novels 24 | uri: spotify:album:65ain97ltDAxldCiOcBtHo 25 | albumurl: https://open.spotify.com/album/65ain97ltDAxldCiOcBtHo 26 | - artist: Zaz 27 | album: Spotify Sessions 28 | uri: spotify:album:4Oun04R6kdukRGC8djhzHG 29 | albumurl: https://open.spotify.com/album/4Oun04R6kdukRGC8djhzHG 30 | -------------------------------------------------------------------------------- /internal/adapters/left/cli/testdata/spotify/complete_playlist.golden: -------------------------------------------------------------------------------- 1 | - playlists: 2 | - name: A Sétima 3 | lastmodifieddate: "2020-02-21" 4 | items: 5 | - track: 6 | trackname: Le tourbillon 7 | artistname: Jeanne Moreau 8 | albumname: Le tourbillon de ma vie (Best Of 2017) 9 | trackuri: spotify:track:0ZRnvyA5MxbgTCfWRw3YU4 10 | trackurl: https://open.spotify.com/track/0ZRnvyA5MxbgTCfWRw3YU4 11 | episode: null 12 | localtrack: null 13 | addeddate: "2018-09-09" 14 | - track: 15 | trackname: Cucurrucucu Paloma - Ao Vivo 16 | artistname: Caetano Veloso 17 | albumname: Fina Estampa Ao Vivo 18 | trackuri: spotify:track:2jIyIMXAHeHSz3ip6ccMFl 19 | trackurl: https://open.spotify.com/track/2jIyIMXAHeHSz3ip6ccMFl 20 | episode: null 21 | localtrack: null 22 | addeddate: "2018-09-10" 23 | - track: 24 | trackname: Preciso Me Encontrar 25 | artistname: Cartola 26 | albumname: Raizes Do Samba 27 | trackuri: spotify:track:1op7nM2R2M6FAU6dSCTRWV 28 | trackurl: https://open.spotify.com/track/1op7nM2R2M6FAU6dSCTRWV 29 | episode: null 30 | localtrack: null 31 | addeddate: "2018-09-09" 32 | description: 'O cinema e a música: eternodevir.com/a-setima/' 33 | numberoffollowers: 4 34 | - name: Rendez-vous 1408 35 | lastmodifieddate: "2020-02-21" 36 | items: 37 | - track: 38 | trackname: Love Will Tear Us Apart - 2010 Remaster 39 | artistname: Joy Division 40 | albumname: Substance 41 | trackuri: spotify:track:1r8oPEXqnhUVgkUkJNqEuF 42 | trackurl: https://open.spotify.com/track/1r8oPEXqnhUVgkUkJNqEuF 43 | episode: null 44 | localtrack: null 45 | addeddate: "2016-11-19" 46 | - track: 47 | trackname: Tear You Apart 48 | artistname: She Wants Revenge 49 | albumname: She Wants Revenge 50 | trackuri: spotify:track:5uahjiKiYXxGlF4GdnKPNv 51 | trackurl: https://open.spotify.com/track/5uahjiKiYXxGlF4GdnKPNv 52 | episode: null 53 | localtrack: null 54 | addeddate: "2016-11-19" 55 | - track: 56 | trackname: Who Can It Be Now? 57 | artistname: Men At Work 58 | albumname: The Essential Men At Work 59 | trackuri: spotify:track:29r3fDexnrto7WABfpblNH 60 | trackurl: https://open.spotify.com/track/29r3fDexnrto7WABfpblNH 61 | episode: null 62 | localtrack: null 63 | addeddate: "2016-11-19" 64 | description: 'Festa de 5 (-:' 65 | numberoffollowers: 3 66 | -------------------------------------------------------------------------------- /internal/adapters/left/cli/testdata/spotify/empty.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ttybitnik/diego/93706f3b6e08c58af495bfd0a8d00925e66a0805/internal/adapters/left/cli/testdata/spotify/empty.json -------------------------------------------------------------------------------- /internal/adapters/left/cli/testdata/spotify/invalid.json: -------------------------------------------------------------------------------- 1 | { 2 | "tracks": [ 3 | { 4 | "artist": "Modena City Ramblers", 5 | "album": "Tracce Clandestine", 6 | "track": "Crookedwood Polkas", 7 | "uri": "spotify:track:4pQF8GvUIT2CKmoJG209ak" 8 | }, 9 | -------------------------------------------------------------------------------- /internal/adapters/left/cli/testdata/spotify/library.golden: -------------------------------------------------------------------------------- 1 | - tracks: 2 | - artist: Modena City Ramblers 3 | album: Tracce Clandestine 4 | track: Crookedwood Polkas 5 | uri: spotify:track:4pQF8GvUIT2CKmoJG209ak 6 | trackurl: https://open.spotify.com/track/4pQF8GvUIT2CKmoJG209ak 7 | - artist: Jorge Ben Jor 8 | album: A Tabua De Esmeralda 9 | track: O Homem Da Gravata Florida 10 | uri: spotify:track:0iPjvpxh6XE9Zo2smrWDhw 11 | trackurl: https://open.spotify.com/track/0iPjvpxh6XE9Zo2smrWDhw 12 | - artist: Lou Reed 13 | album: The Raven 14 | track: Call on Me (feat. Laurie Anderson) 15 | uri: spotify:track:2WSnY39N88UvTgt1YhvVFA 16 | trackurl: https://open.spotify.com/track/2WSnY39N88UvTgt1YhvVFA 17 | albums: 18 | - artist: SEATBELTS 19 | album: 「COWBOY BEBOP」オリジナルサウンドトラック 20 | uri: spotify:album:6cYPbwsAFAcddFuGeXMR7l 21 | albumurl: https://open.spotify.com/album/6cYPbwsAFAcddFuGeXMR7l 22 | - artist: Lykke Li 23 | album: Youth Novels 24 | uri: spotify:album:65ain97ltDAxldCiOcBtHo 25 | albumurl: https://open.spotify.com/album/65ain97ltDAxldCiOcBtHo 26 | - artist: Zaz 27 | album: Spotify Sessions 28 | uri: spotify:album:4Oun04R6kdukRGC8djhzHG 29 | albumurl: https://open.spotify.com/album/4Oun04R6kdukRGC8djhzHG 30 | -------------------------------------------------------------------------------- /internal/adapters/left/cli/testdata/spotify/library.json: -------------------------------------------------------------------------------- 1 | { 2 | "tracks": [ 3 | { 4 | "artist": "Modena City Ramblers", 5 | "album": "Tracce Clandestine", 6 | "track": "Crookedwood Polkas", 7 | "uri": "spotify:track:4pQF8GvUIT2CKmoJG209ak" 8 | }, 9 | { 10 | "artist": "Jorge Ben Jor", 11 | "album": "A Tabua De Esmeralda", 12 | "track": "O Homem Da Gravata Florida", 13 | "uri": "spotify:track:0iPjvpxh6XE9Zo2smrWDhw" 14 | }, 15 | { 16 | "artist": "Lou Reed", 17 | "album": "The Raven", 18 | "track": "Call on Me (feat. Laurie Anderson)", 19 | "uri": "spotify:track:2WSnY39N88UvTgt1YhvVFA" 20 | } 21 | ], 22 | "albums": [ 23 | { 24 | "artist": "SEATBELTS", 25 | "album": "「COWBOY BEBOP」オリジナルサウンドトラック", 26 | "uri": "spotify:album:6cYPbwsAFAcddFuGeXMR7l" 27 | }, 28 | { 29 | "artist": "Lykke Li", 30 | "album": "Youth Novels", 31 | "uri": "spotify:album:65ain97ltDAxldCiOcBtHo" 32 | }, 33 | { 34 | "artist": "Zaz", 35 | "album": "Spotify Sessions", 36 | "uri": "spotify:album:4Oun04R6kdukRGC8djhzHG" 37 | } 38 | ], 39 | "shows": [ 40 | { 41 | "name": "AntiCast", 42 | "publisher": "Half Deaf", 43 | "uri": "spotify:show:55Aug5UvJC8LSWyzEI7xSR" 44 | }, 45 | { 46 | "name": "Decrépitos", 47 | "publisher": "Decrépitos Podcast", 48 | "uri": "spotify:show:2epGmU5E47xlTJ4kc5Cevs" 49 | }, 50 | { 51 | "name": "ID10T with Chris Hardwick", 52 | "publisher": "Chris Hardwick", 53 | "uri": "spotify:show:0Jz4xn4nDRQRjQ5SOyTTuv" 54 | } 55 | ], 56 | "episodes": [ 57 | ], 58 | "bannedTracks": [ 59 | ], 60 | "artists": [ 61 | ], 62 | "bannedArtists": [ 63 | ], 64 | "other": [ 65 | ] 66 | } 67 | -------------------------------------------------------------------------------- /internal/adapters/left/cli/testdata/spotify/playlist.golden: -------------------------------------------------------------------------------- 1 | - playlists: 2 | - name: A Sétima 3 | lastmodifieddate: "2020-02-21" 4 | items: 5 | - track: 6 | trackname: Le tourbillon 7 | artistname: Jeanne Moreau 8 | albumname: Le tourbillon de ma vie (Best Of 2017) 9 | trackuri: spotify:track:0ZRnvyA5MxbgTCfWRw3YU4 10 | trackurl: https://open.spotify.com/track/0ZRnvyA5MxbgTCfWRw3YU4 11 | episode: null 12 | localtrack: null 13 | addeddate: "2018-09-09" 14 | - track: 15 | trackname: Cucurrucucu Paloma - Ao Vivo 16 | artistname: Caetano Veloso 17 | albumname: Fina Estampa Ao Vivo 18 | trackuri: spotify:track:2jIyIMXAHeHSz3ip6ccMFl 19 | trackurl: https://open.spotify.com/track/2jIyIMXAHeHSz3ip6ccMFl 20 | episode: null 21 | localtrack: null 22 | addeddate: "2018-09-10" 23 | - track: 24 | trackname: Preciso Me Encontrar 25 | artistname: Cartola 26 | albumname: Raizes Do Samba 27 | trackuri: spotify:track:1op7nM2R2M6FAU6dSCTRWV 28 | trackurl: https://open.spotify.com/track/1op7nM2R2M6FAU6dSCTRWV 29 | episode: null 30 | localtrack: null 31 | addeddate: "2018-09-09" 32 | description: 'O cinema e a música: eternodevir.com/a-setima/' 33 | numberoffollowers: 4 34 | - name: Rendez-vous 1408 35 | lastmodifieddate: "2020-02-21" 36 | items: 37 | - track: 38 | trackname: Love Will Tear Us Apart - 2010 Remaster 39 | artistname: Joy Division 40 | albumname: Substance 41 | trackuri: spotify:track:1r8oPEXqnhUVgkUkJNqEuF 42 | trackurl: https://open.spotify.com/track/1r8oPEXqnhUVgkUkJNqEuF 43 | episode: null 44 | localtrack: null 45 | addeddate: "2016-11-19" 46 | - track: 47 | trackname: Tear You Apart 48 | artistname: She Wants Revenge 49 | albumname: She Wants Revenge 50 | trackuri: spotify:track:5uahjiKiYXxGlF4GdnKPNv 51 | trackurl: https://open.spotify.com/track/5uahjiKiYXxGlF4GdnKPNv 52 | episode: null 53 | localtrack: null 54 | addeddate: "2016-11-19" 55 | - track: 56 | trackname: Who Can It Be Now? 57 | artistname: Men At Work 58 | albumname: The Essential Men At Work 59 | trackuri: spotify:track:29r3fDexnrto7WABfpblNH 60 | trackurl: https://open.spotify.com/track/29r3fDexnrto7WABfpblNH 61 | episode: null 62 | localtrack: null 63 | addeddate: "2016-11-19" 64 | description: 'Festa de 5 (-:' 65 | numberoffollowers: 3 66 | -------------------------------------------------------------------------------- /internal/adapters/left/cli/testdata/spotify/playlist.json: -------------------------------------------------------------------------------- 1 | { 2 | "playlists": [ 3 | { 4 | "name": "A Sétima", 5 | "lastModifiedDate": "2020-02-21", 6 | "items": [ 7 | { 8 | "track": { 9 | "trackName": "Le tourbillon", 10 | "artistName": "Jeanne Moreau", 11 | "albumName": "Le tourbillon de ma vie (Best Of 2017)", 12 | "trackUri": "spotify:track:0ZRnvyA5MxbgTCfWRw3YU4" 13 | }, 14 | "episode": null, 15 | "localTrack": null, 16 | "addedDate": "2018-09-09" 17 | }, 18 | { 19 | "track": { 20 | "trackName": "Cucurrucucu Paloma - Ao Vivo", 21 | "artistName": "Caetano Veloso", 22 | "albumName": "Fina Estampa Ao Vivo", 23 | "trackUri": "spotify:track:2jIyIMXAHeHSz3ip6ccMFl" 24 | }, 25 | "episode": null, 26 | "localTrack": null, 27 | "addedDate": "2018-09-10" 28 | }, 29 | { 30 | "track": { 31 | "trackName": "Preciso Me Encontrar", 32 | "artistName": "Cartola", 33 | "albumName": "Raizes Do Samba", 34 | "trackUri": "spotify:track:1op7nM2R2M6FAU6dSCTRWV" 35 | }, 36 | "episode": null, 37 | "localTrack": null, 38 | "addedDate": "2018-09-09" 39 | } 40 | ], 41 | "description": "O cinema e a música: eternodevir.com/a-setima/", 42 | "numberOfFollowers": 4 43 | }, 44 | { 45 | "name": "Rendez-vous 1408", 46 | "lastModifiedDate": "2020-02-21", 47 | "items": [ 48 | { 49 | "track": { 50 | "trackName": "Love Will Tear Us Apart - 2010 Remaster", 51 | "artistName": "Joy Division", 52 | "albumName": "Substance", 53 | "trackUri": "spotify:track:1r8oPEXqnhUVgkUkJNqEuF" 54 | }, 55 | "episode": null, 56 | "localTrack": null, 57 | "addedDate": "2016-11-19" 58 | }, 59 | { 60 | "track": { 61 | "trackName": "Tear You Apart", 62 | "artistName": "She Wants Revenge", 63 | "albumName": "She Wants Revenge", 64 | "trackUri": "spotify:track:5uahjiKiYXxGlF4GdnKPNv" 65 | }, 66 | "episode": null, 67 | "localTrack": null, 68 | "addedDate": "2016-11-19" 69 | }, 70 | { 71 | "track": { 72 | "trackName": "Who Can It Be Now?", 73 | "artistName": "Men At Work", 74 | "albumName": "The Essential Men At Work", 75 | "trackUri": "spotify:track:29r3fDexnrto7WABfpblNH" 76 | }, 77 | "episode": null, 78 | "localTrack": null, 79 | "addedDate": "2016-11-19" 80 | } 81 | ], 82 | "description": "Festa de 5 (-:", 83 | "numberOfFollowers": 3 84 | } 85 | ] 86 | } 87 | -------------------------------------------------------------------------------- /internal/adapters/left/cli/testdata/spotify/shortcode_complete_library.golden: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {{ range sort .Site.Data.diego_spotify_library.tracks "track" }} 5 | 6 | 9 | 12 | 15 | 18 | 19 | {{ end }} 20 | 21 |
7 | {{ .track }} 8 | 10 | {{ .artist }} 11 | 13 | {{ .album }} 14 | 16 | Spotify 17 |
22 | 23 | 24 | {{ range sort .Site.Data.diego_spotify_library.albums "album" }} 25 | 26 | 29 | 32 | 35 | 36 | {{ end }} 37 | 38 |
27 | {{ .album }} 28 | 30 | {{ .artist }} 31 | 33 | Spotify 34 |
-------------------------------------------------------------------------------- /internal/adapters/left/cli/testdata/spotify/shortcode_complete_playlist.golden: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {{ range sort .Site.Data.diego_spotify_playlist.playlists "name" }} 5 | 6 | 9 | 12 | 15 | 18 | 21 | 22 | {{ end }} 23 | 24 |
7 | {{ .name }} 8 | 10 | {{ .items.track.trackname }} 11 | 13 | {{ .items.track.artistname }} 14 | 16 | {{ .items.track.albumname }} 17 | 19 | Spotify 20 |
-------------------------------------------------------------------------------- /internal/adapters/left/cli/testdata/spotify/shortcode_library.golden: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {{ range sort .Site.Data.diego_spotify_library.tracks "track" }} 5 | 6 | 9 | 12 | 15 | 18 | 19 | {{ end }} 20 | 21 |
7 | {{ .track }} 8 | 10 | {{ .artist }} 11 | 13 | {{ .album }} 14 | 16 | Spotify 17 |
22 | 23 | 24 | {{ range sort .Site.Data.diego_spotify_library.albums "album" }} 25 | 26 | 29 | 32 | 35 | 36 | {{ end }} 37 | 38 |
27 | {{ .album }} 28 | 30 | {{ .artist }} 31 | 33 | Spotify 34 |
-------------------------------------------------------------------------------- /internal/adapters/left/cli/testdata/spotify/shortcode_playlist.golden: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {{ range sort .Site.Data.diego_spotify_playlist.playlists "name" }} 5 | 6 | 9 | 12 | 15 | 18 | 21 | 22 | {{ end }} 23 | 24 |
7 | {{ .name }} 8 | 10 | {{ .items.track.trackname }} 11 | 13 | {{ .items.track.artistname }} 14 | 16 | {{ .items.track.albumname }} 17 | 19 | Spotify 20 |
-------------------------------------------------------------------------------- /internal/adapters/left/cli/testdata/youtube/complete_playlist.golden: -------------------------------------------------------------------------------- 1 | - id: eY-eyZuW_Uk 2 | timestamp: "2023-12-07T15:57:57+00:00" 3 | url: https://www.youtube.com/watch?v=eY-eyZuW_Uk 4 | - id: 28tZ-S1LFok 5 | timestamp: "2023-12-07T18:08:55+00:00" 6 | url: https://www.youtube.com/watch?v=28tZ-S1LFok 7 | - id: J9qja4KmPQQ 8 | timestamp: "2023-12-07T16:49:34+00:00" 9 | url: https://www.youtube.com/watch?v=J9qja4KmPQQ 10 | -------------------------------------------------------------------------------- /internal/adapters/left/cli/testdata/youtube/complete_subscriptions.golden: -------------------------------------------------------------------------------- 1 | - name: Computerphile 2 | channelid: UC9-y-6csu5WGm29I7JiwpnA 3 | channelurl: http://www.youtube.com/channel/UC9-y-6csu5WGm29I7JiwpnA 4 | - name: Technology Connections 5 | channelid: UCy0tKL1T7wFoYcxCe0xjN6Q 6 | channelurl: http://www.youtube.com/channel/UCy0tKL1T7wFoYcxCe0xjN6Q 7 | - name: LiveOverflow 8 | channelid: UClcE-kVhqyiHCcjYwcpfj9w 9 | channelurl: http://www.youtube.com/channel/UClcE-kVhqyiHCcjYwcpfj9w 10 | -------------------------------------------------------------------------------- /internal/adapters/left/cli/testdata/youtube/empty.csv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ttybitnik/diego/93706f3b6e08c58af495bfd0a8d00925e66a0805/internal/adapters/left/cli/testdata/youtube/empty.csv -------------------------------------------------------------------------------- /internal/adapters/left/cli/testdata/youtube/invalid.csv: -------------------------------------------------------------------------------- 1 | Video ID 2 | eY-eyZuW_Uk 3 | 28tZ-S1LFok 4 | J9qja4KmPQQ 5 | -------------------------------------------------------------------------------- /internal/adapters/left/cli/testdata/youtube/playlist.csv: -------------------------------------------------------------------------------- 1 | Video ID, Playlist video creation timestamp 2 | eY-eyZuW_Uk,2023-12-07T15:57:57+00:00 3 | 28tZ-S1LFok,2023-12-07T18:08:55+00:00 4 | J9qja4KmPQQ,2023-12-07T16:49:34+00:00 5 | -------------------------------------------------------------------------------- /internal/adapters/left/cli/testdata/youtube/playlist.golden: -------------------------------------------------------------------------------- 1 | - id: eY-eyZuW_Uk 2 | timestamp: "2023-12-07T15:57:57+00:00" 3 | url: https://www.youtube.com/watch?v=eY-eyZuW_Uk 4 | - id: 28tZ-S1LFok 5 | timestamp: "2023-12-07T18:08:55+00:00" 6 | url: https://www.youtube.com/watch?v=28tZ-S1LFok 7 | - id: J9qja4KmPQQ 8 | timestamp: "2023-12-07T16:49:34+00:00" 9 | url: https://www.youtube.com/watch?v=J9qja4KmPQQ 10 | -------------------------------------------------------------------------------- /internal/adapters/left/cli/testdata/youtube/shortcode_complete_playlist.golden: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {{ range sort .Site.Data.diego_youtube_playlist "timestamp" }} 5 | 6 | 9 | 12 | 15 | 16 | {{ end }} 17 | 18 |
7 | {{ .timestamp }} 8 | 10 | {{ .id }} 11 | 13 | YouTube 14 |
-------------------------------------------------------------------------------- /internal/adapters/left/cli/testdata/youtube/shortcode_complete_subscriptions.golden: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {{ range sort .Site.Data.diego_youtube_subscriptions "name" }} 5 | 6 | 9 | 12 | 13 | {{ end }} 14 | 15 |
7 | {{ .channelid }} 8 | 10 | YouTube 11 |
-------------------------------------------------------------------------------- /internal/adapters/left/cli/testdata/youtube/shortcode_playlist.golden: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {{ range sort .Site.Data.diego_youtube_playlist "timestamp" }} 5 | 6 | 9 | 12 | 15 | 16 | {{ end }} 17 | 18 |
7 | {{ .timestamp }} 8 | 10 | {{ .id }} 11 | 13 | YouTube 14 |
-------------------------------------------------------------------------------- /internal/adapters/left/cli/testdata/youtube/shortcode_subscriptions.golden: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {{ range sort .Site.Data.diego_youtube_subscriptions "name" }} 5 | 6 | 9 | 12 | 13 | {{ end }} 14 | 15 |
7 | {{ .channelid }} 8 | 10 | YouTube 11 |
-------------------------------------------------------------------------------- /internal/adapters/left/cli/testdata/youtube/subscriptions.csv: -------------------------------------------------------------------------------- 1 | Channel ID,Channel URL,Channel Title 2 | UC9-y-6csu5WGm29I7JiwpnA,http://www.youtube.com/channel/UC9-y-6csu5WGm29I7JiwpnA,Computerphile 3 | UCy0tKL1T7wFoYcxCe0xjN6Q,http://www.youtube.com/channel/UCy0tKL1T7wFoYcxCe0xjN6Q,Technology Connections 4 | UClcE-kVhqyiHCcjYwcpfj9w,http://www.youtube.com/channel/UClcE-kVhqyiHCcjYwcpfj9w,LiveOverflow -------------------------------------------------------------------------------- /internal/adapters/left/cli/testdata/youtube/subscriptions.golden: -------------------------------------------------------------------------------- 1 | - name: Computerphile 2 | channelid: UC9-y-6csu5WGm29I7JiwpnA 3 | channelurl: http://www.youtube.com/channel/UC9-y-6csu5WGm29I7JiwpnA 4 | - name: Technology Connections 5 | channelid: UCy0tKL1T7wFoYcxCe0xjN6Q 6 | channelurl: http://www.youtube.com/channel/UCy0tKL1T7wFoYcxCe0xjN6Q 7 | - name: LiveOverflow 8 | channelid: UClcE-kVhqyiHCcjYwcpfj9w 9 | channelurl: http://www.youtube.com/channel/UClcE-kVhqyiHCcjYwcpfj9w 10 | -------------------------------------------------------------------------------- /internal/adapters/right/filesystem/filesystem.go: -------------------------------------------------------------------------------- 1 | /* 2 | DIEGO - A data importer extension for Hugo 3 | Copyright (C) 2024, 2025 Vinícius Moraes 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | // Package filesystem implements the filesystem adapter logic. 20 | package filesystem 21 | 22 | import ( 23 | "encoding/json" 24 | "encoding/xml" 25 | "fmt" 26 | "log" 27 | "os" 28 | "path/filepath" 29 | 30 | "github.com/ttybitnik/diego/internal/app/domain" 31 | "github.com/ttybitnik/diego/internal/app/social" 32 | 33 | "github.com/pelletier/go-toml/v2" 34 | "gopkg.in/yaml.v3" 35 | ) 36 | 37 | // Filesystem Adapter implements the FileSystemPort interface. 38 | type Adapter struct{} 39 | 40 | // NewAdapter creates a new instance of the Adapter struct. 41 | func NewAdapter() *Adapter { 42 | return &Adapter{} 43 | } 44 | 45 | func (fsa *Adapter) validateWriteToFile(format string) error { 46 | supportedFormats := map[string]bool{ 47 | domain.OutputYAML: true, 48 | domain.OutputJSON: true, 49 | domain.OutputTOML: true, 50 | domain.OutputXML: true, 51 | } 52 | 53 | if !supportedFormats[format] { 54 | return fmt.Errorf("error: file format %s not supported", format) 55 | } 56 | 57 | return nil 58 | } 59 | func (fsa *Adapter) isExist(filename string) bool { 60 | _, err := os.Stat(filename) 61 | return !os.IsNotExist(err) 62 | } 63 | 64 | // WriteToFile writes data into filesystem using the given domain.FileSystem configuration. 65 | func (fsa *Adapter) WriteToFile(data []social.Service, dfs domain.FileSystem) error { 66 | err := fsa.validateWriteToFile(dfs.Format) 67 | if err != nil { 68 | log.Fatalln(err) 69 | } 70 | 71 | var dto []byte 72 | 73 | switch dfs.Format { 74 | case domain.OutputJSON: 75 | dto, err = json.MarshalIndent(data, "", "\t") 76 | if err != nil { 77 | log.Fatalln("Error marshaling into json:", err) 78 | } 79 | case domain.OutputTOML: 80 | tomlData := map[string]interface{}{"Itens": data} 81 | dto, err = toml.Marshal(tomlData) 82 | if err != nil { 83 | log.Fatalln("Error marshaling into toml:", err) 84 | } 85 | case domain.OutputXML: 86 | dto, err = xml.MarshalIndent(data, "", " ") 87 | if err != nil { 88 | log.Fatalln("Error marshaling into xml:", err) 89 | } 90 | dto = append([]byte(""), dto...) 91 | dto = append(dto, []byte("")...) 92 | default: 93 | dto, err = yaml.Marshal(data) 94 | if err != nil { 95 | log.Fatalln("Error marshaling into yaml:", err) 96 | } 97 | } 98 | 99 | filePath := "data/" + dfs.Filename + "." + dfs.Format 100 | fileExists := fsa.isExist(filePath) 101 | 102 | if fileExists && !dfs.Overwrite { 103 | counter := 1 104 | for { 105 | newFilePath := fmt.Sprintf("data/%s(%d).%s", dfs.Filename, counter, dfs.Format) 106 | if !fsa.isExist(newFilePath) { 107 | filePath = newFilePath 108 | break 109 | } 110 | counter++ 111 | } 112 | } 113 | 114 | if dfs.HugoDir != "." { 115 | filePath = dfs.HugoDir + "/" + filePath 116 | } 117 | 118 | filePath = filepath.Clean(filePath) 119 | 120 | err = os.WriteFile(filePath, dto, 0o644) 121 | if err != nil { 122 | log.Fatalln("Error writing file into file system:", err) 123 | } 124 | 125 | fmt.Println("Hugo data file created:", filePath) 126 | 127 | return err 128 | } 129 | 130 | // WriteShortcode writes the shortcode into filesystem in the Hugo directory. 131 | func (fsa *Adapter) WriteShortcode(shortcode *string, dfs domain.FileSystem) error { 132 | if dfs.Shortcode { 133 | 134 | filePath := "layouts/shortcodes/" + dfs.Filename + ".html" 135 | 136 | if dfs.HugoDir != "." { 137 | filePath = dfs.HugoDir + "/" + filePath 138 | } 139 | 140 | filePath = filepath.Clean(filePath) 141 | 142 | dirPath := filepath.Dir(filePath) 143 | if _, err := os.Stat(dirPath); os.IsNotExist(err) { 144 | err := os.MkdirAll(dirPath, 0755) 145 | if err != nil { 146 | log.Fatalln("Error creating [shortcodes] directory:", err) 147 | return err 148 | } 149 | } 150 | 151 | err := os.WriteFile(filePath, []byte(*shortcode), 0o644) 152 | if err != nil { 153 | log.Fatalln("Error writing shortcode into file system:", err) 154 | } 155 | 156 | fmt.Println("Hugo shortcode template created:", filePath) 157 | 158 | } 159 | 160 | return nil 161 | } 162 | -------------------------------------------------------------------------------- /internal/app/api/api.go: -------------------------------------------------------------------------------- 1 | /* 2 | DIEGO - A data importer extension for Hugo 3 | Copyright (C) 2024 Vinícius Moraes 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | // Package api provides a versstile application programming interface. 20 | package api 21 | 22 | import ( 23 | "github.com/ttybitnik/diego/internal/app/domain" 24 | "github.com/ttybitnik/diego/internal/app/social" 25 | ) 26 | 27 | // Application implements the API Port interface. 28 | type Application struct { 29 | core Core 30 | } 31 | 32 | // NewApplication creates a new instance of Application with the provided core. 33 | func NewApplication(core Core) *Application { 34 | return &Application{core: core} 35 | } 36 | 37 | // GetImportFile delegates the import file operation to the underlying core. 38 | func (a Application) GetImportFile(f string, dc domain.Core) ([]social.Service, error) { 39 | return a.core.ImportFile(f, dc) 40 | } 41 | 42 | // GetGenerateShortcode delegates the shortcode generation to the underlying core. 43 | func (a Application) GetGenerateShortcode(dc domain.Core) (*string, error) { 44 | return a.core.GenerateShortcode(dc) 45 | } 46 | -------------------------------------------------------------------------------- /internal/app/api/interfaces.go: -------------------------------------------------------------------------------- 1 | /* 2 | DIEGO - A data importer extension for Hugo 3 | Copyright (C) 2024 Vinícius Moraes 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | package api 20 | 21 | import ( 22 | "github.com/ttybitnik/diego/internal/app/domain" 23 | "github.com/ttybitnik/diego/internal/app/social" 24 | ) 25 | 26 | // Abstraction reflecting core exported functionality. 27 | type Core interface { 28 | ImportFile(f string, dc domain.Core) ([]social.Service, error) 29 | GenerateShortcode(dc domain.Core) (*string, error) 30 | } 31 | -------------------------------------------------------------------------------- /internal/app/domain/domain.go: -------------------------------------------------------------------------------- 1 | /* 2 | DIEGO - A data importer extension for Hugo 3 | Copyright (C) 2024 Vinícius Moraes 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | // Package domain provides application options. 20 | package domain 21 | 22 | // Driver options. 23 | const ( 24 | GoodreadsLibrary = "diego_goodreads_library" 25 | ImdbList = "diego_imdb_list" 26 | ImdbRatings = "diego_imdb_ratings" 27 | ImdbWatchlist = "diego_imdb_watchlist" 28 | InstapaperList = "diego_instapaper_list" 29 | LetterboxdDiary = "diego_letterboxd_diary" 30 | LetterboxdFilms = "diego_letterboxd_films" 31 | LetterboxdReviews = "diego_letterboxd_reviews" 32 | LetterboxdWatchlist = "diego_letterboxd_watchlist" 33 | SpotifyLibrary = "diego_spotify_library" 34 | SpotifyPlaylist = "diego_spotify_playlist" 35 | YoutubePlaylist = "diego_youtube_playlist" 36 | YoutubeSubscriptions = "diego_youtube_subscriptions" 37 | 38 | OutputYAML = "yaml" 39 | OutputJSON = "json" 40 | OutputTOML = "toml" 41 | OutputXML = "xml" 42 | ) 43 | 44 | // Core represents the configuration domain for the APIPort. 45 | type Core struct { 46 | Model string 47 | Scrape bool 48 | All bool 49 | } 50 | 51 | // FileSystem represents the configuration domain for the WriterPort. 52 | type FileSystem struct { 53 | Filename string 54 | Format string 55 | HugoDir string 56 | Overwrite bool 57 | Shortcode bool 58 | } 59 | -------------------------------------------------------------------------------- /internal/app/social/instapaper/list.go: -------------------------------------------------------------------------------- 1 | /* 2 | DIEGO - A data importer extension for Hugo 3 | Copyright (C) 2024 Vinícius Moraes 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | // Package instapaper implements the social interface for instapaper service. 20 | package instapaper 21 | 22 | import ( 23 | "fmt" 24 | ) 25 | 26 | // List represents the official input data fields. 27 | type List struct { 28 | Name string 29 | URL string 30 | Timestamp string 31 | } 32 | 33 | // BindFile binds the CSV values into the List struct. 34 | func (i *List) BindFile(record *[]string) error { 35 | i.URL = (*record)[0] 36 | i.Name = (*record)[1] 37 | i.Timestamp = (*record)[4] 38 | 39 | return nil 40 | } 41 | 42 | // FetchFromHTTP gets additional values from the URLs for the List struct. 43 | func (i *List) FetchFromHTTP() error { 44 | return nil 45 | } 46 | 47 | // BindHTML generates the Hugo shortcode for the List struct. 48 | func (i *List) BindHTML(shortcode, comment *string, model string) error { 49 | return htmlPlaylist(shortcode, comment, model) 50 | } 51 | 52 | // ListComplete represents the official input data fields. 53 | type ListComplete struct { 54 | Name string 55 | URL string 56 | Selection string 57 | Directory string 58 | Timestamp string 59 | } 60 | 61 | // BindFile binds the CSV values into the ListComplete struct. 62 | func (i *ListComplete) BindFile(record *[]string) error { 63 | i.URL = (*record)[0] 64 | i.Name = (*record)[1] 65 | i.Selection = (*record)[2] 66 | i.Directory = (*record)[3] 67 | i.Timestamp = (*record)[4] 68 | 69 | return nil 70 | } 71 | 72 | // FetchFromHTTP gets additional values from the URLs for the ListComplete struct. 73 | func (i *ListComplete) FetchFromHTTP() error { 74 | return nil 75 | } 76 | 77 | // BindHTML generates the Hugo shortcode for the ListComplete struct. 78 | func (i *ListComplete) BindHTML(shortcode, comment *string, model string) error { 79 | return htmlPlaylist(shortcode, comment, model) 80 | } 81 | 82 | // Common to both structs. 83 | func htmlPlaylist(shortcode, comment *string, model string) error { 84 | htmlTemplate := `%s 85 | 86 | 87 | {{ range sort .Site.Data.%s "name" }} 88 | 89 | 92 | 95 | 98 | 99 | {{ end }} 100 | 101 |
90 | {{ .name }} 91 | 93 | {{ .timestamp }} 94 | 96 | Link 97 |
` 102 | 103 | *shortcode = fmt.Sprintf(htmlTemplate, *comment, model) 104 | 105 | return nil 106 | } 107 | -------------------------------------------------------------------------------- /internal/app/social/social.go: -------------------------------------------------------------------------------- 1 | /* 2 | DIEGO - A data importer extension for Hugo 3 | Copyright (C) 2024 Vinícius Moraes 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | // Package social provides an abstraction for services packages. 20 | package social 21 | 22 | // Service interface for social media services. 23 | type Service interface { 24 | BindFile(record *[]string) error 25 | FetchFromHTTP() error 26 | BindHTML(shortcode, comment *string, model string) error 27 | } 28 | -------------------------------------------------------------------------------- /internal/app/social/spotify/library.go: -------------------------------------------------------------------------------- 1 | /* 2 | DIEGO - A data importer extension for Hugo 3 | Copyright (C) 2024 Vinícius Moraes 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | // Package spotify implements the social interface for spotify service. 20 | package spotify 21 | 22 | import ( 23 | "fmt" 24 | "strings" 25 | ) 26 | 27 | // Library represents the official input data fields. 28 | type Library struct { 29 | Tracks []struct { 30 | Artist string `json:"artist"` 31 | Album string `json:"album"` 32 | Track string `json:"track"` 33 | URI string `json:"uri"` 34 | TrackURL string `json:"trackurl"` 35 | } `json:"tracks"` 36 | Albums []struct { 37 | Artist string `json:"artist"` 38 | Album string `json:"album"` 39 | URI string `json:"uri"` 40 | AlbumURL string `json:"albumurl"` 41 | } `json:"albums"` 42 | } 43 | 44 | // BindFile binds the CSV values into the Library struct. 45 | func (s *Library) BindFile(record *[]string) error { 46 | for i := range s.Tracks { 47 | trackURL, _ := strings.CutPrefix(s.Tracks[i].URI, "spotify:track:") 48 | s.Tracks[i].TrackURL = "https://open.spotify.com/track/" + trackURL 49 | } 50 | for i := range s.Albums { 51 | albumURL, _ := strings.CutPrefix(s.Albums[i].URI, "spotify:album:") 52 | s.Albums[i].AlbumURL = "https://open.spotify.com/album/" + albumURL 53 | } 54 | return nil 55 | } 56 | 57 | // FetchFromHTTP gets additional values from the URLs for the Library struct. 58 | func (s *Library) FetchFromHTTP() error { 59 | return nil 60 | } 61 | 62 | // BindHTML generates the Hugo shortcode for the Library struct. 63 | func (s *Library) BindHTML(shortcode, comment *string, model string) error { 64 | return htmlLibrary(shortcode, comment, model) 65 | } 66 | 67 | // LibraryComplete represents the official input data fields. 68 | type LibraryComplete struct { 69 | Tracks []struct { 70 | Artist string `json:"artist"` 71 | Album string `json:"album"` 72 | Track string `json:"track"` 73 | URI string `json:"uri"` 74 | TrackURL string `json:"trackurl"` 75 | } `json:"tracks"` 76 | Albums []struct { 77 | Artist string `json:"artist"` 78 | Album string `json:"album"` 79 | URI string `json:"uri"` 80 | AlbumURL string `json:"albumurl"` 81 | } `json:"albums"` 82 | } 83 | 84 | // BindFile binds the CSV values into the LibraryComplete struct. 85 | func (s *LibraryComplete) BindFile(record *[]string) error { 86 | for i := range s.Tracks { 87 | trackURL, _ := strings.CutPrefix(s.Tracks[i].URI, "spotify:track:") 88 | s.Tracks[i].TrackURL = "https://open.spotify.com/track/" + trackURL 89 | } 90 | for i := range s.Albums { 91 | albumURL, _ := strings.CutPrefix(s.Albums[i].URI, "spotify:album:") 92 | s.Albums[i].AlbumURL = "https://open.spotify.com/album/" + albumURL 93 | } 94 | return nil 95 | } 96 | 97 | // FetchFromHTTP gets additional values from the URLs for the LibraryComplete struct. 98 | func (s *LibraryComplete) FetchFromHTTP() error { 99 | return nil 100 | } 101 | 102 | // BindHTML generates the Hugo shortcode for the LibraryComplete struct. 103 | func (s *LibraryComplete) BindHTML(shortcode, comment *string, model string) error { 104 | return htmlLibrary(shortcode, comment, model) 105 | } 106 | 107 | // Common to both structs. 108 | func htmlLibrary(shortcode, comment *string, model string) error { 109 | htmlTemplate := `%s 110 | 111 | 112 | {{ range sort .Site.Data.%s.tracks "track" }} 113 | 114 | 117 | 120 | 123 | 126 | 127 | {{ end }} 128 | 129 |
115 | {{ .track }} 116 | 118 | {{ .artist }} 119 | 121 | {{ .album }} 122 | 124 | Spotify 125 |
130 | 131 | 132 | {{ range sort .Site.Data.%s.albums "album" }} 133 | 134 | 137 | 140 | 143 | 144 | {{ end }} 145 | 146 |
135 | {{ .album }} 136 | 138 | {{ .artist }} 139 | 141 | Spotify 142 |
` 147 | 148 | *shortcode = fmt.Sprintf(htmlTemplate, *comment, model, model) 149 | 150 | return nil 151 | } 152 | -------------------------------------------------------------------------------- /internal/app/social/spotify/playlist.go: -------------------------------------------------------------------------------- 1 | /* 2 | DIEGO - A data importer extension for Hugo 3 | Copyright (C) 2024 Vinícius Moraes 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | package spotify 20 | 21 | import ( 22 | "fmt" 23 | "strings" 24 | ) 25 | 26 | // Playlist represents the official input data fields. 27 | type Playlist struct { 28 | Playlists []struct { 29 | Name string `json:"name"` 30 | LastModifiedDate string `json:"lastModifiedDate"` 31 | Items []struct { 32 | Track struct { 33 | TrackName string `json:"trackName"` 34 | ArtistName string `json:"artistName"` 35 | AlbumName string `json:"albumName"` 36 | TrackURI string `json:"trackUri"` 37 | TrackURL string `json:"trackUrl"` 38 | } `json:"track"` 39 | Episode interface{} `json:"episode"` 40 | LocalTrack interface{} `json:"localTrack"` 41 | AddedDate string `json:"addedDate"` 42 | } `json:"items"` 43 | Description string `json:"description"` 44 | NumberOfFollowers int `json:"numberOfFollowers"` 45 | } `json:"playlists"` 46 | } 47 | 48 | // BindFile binds the JSON values into the Playlist struct. 49 | func (s *Playlist) BindFile(record *[]string) error { 50 | for i := range s.Playlists { 51 | for j := range s.Playlists[i].Items { 52 | trackURI := s.Playlists[i].Items[j].Track.TrackURI 53 | trackURL, _ := strings.CutPrefix(trackURI, "spotify:track:") 54 | s.Playlists[i].Items[j].Track.TrackURL = "https://open.spotify.com/track/" + trackURL 55 | } 56 | } 57 | return nil 58 | } 59 | 60 | // FetchFromHTTP gets additional values from the URLs for the Playlist struct. 61 | func (s *Playlist) FetchFromHTTP() error { 62 | return nil 63 | } 64 | 65 | // BindHTML generates the Hugo shortcode for the Playlist struct. 66 | func (s *Playlist) BindHTML(shortcode, comment *string, model string) error { 67 | return htmlPlaylist(shortcode, comment, model) 68 | } 69 | 70 | // PlaylistComplete represents the official input data fields. 71 | type PlaylistComplete struct { 72 | Playlists []struct { 73 | Name string `json:"name"` 74 | LastModifiedDate string `json:"lastModifiedDate"` 75 | Items []struct { 76 | Track struct { 77 | TrackName string `json:"trackName"` 78 | ArtistName string `json:"artistName"` 79 | AlbumName string `json:"albumName"` 80 | TrackURI string `json:"trackUri"` 81 | TrackURL string `json:"trackUrl"` 82 | } `json:"track"` 83 | Episode interface{} `json:"episode"` 84 | LocalTrack interface{} `json:"localTrack"` 85 | AddedDate string `json:"addedDate"` 86 | } `json:"items"` 87 | Description string `json:"description"` 88 | NumberOfFollowers int `json:"numberOfFollowers"` 89 | } `json:"playlists"` 90 | } 91 | 92 | // BindFile binds the JSON values into the PlaylistComplete struct. 93 | func (s *PlaylistComplete) BindFile(record *[]string) error { 94 | for i := range s.Playlists { 95 | for j := range s.Playlists[i].Items { 96 | trackURI := s.Playlists[i].Items[j].Track.TrackURI 97 | trackURL, _ := strings.CutPrefix(trackURI, "spotify:track:") 98 | s.Playlists[i].Items[j].Track.TrackURL = "https://open.spotify.com/track/" + trackURL 99 | } 100 | } 101 | return nil 102 | } 103 | 104 | // FetchFromHTTP gets additional values from the URLs for the PlaylistComplete struct. 105 | func (s *PlaylistComplete) FetchFromHTTP() error { 106 | return nil 107 | } 108 | 109 | // BindHTML generates the Hugo shortcode for the PlaylistComplete struct. 110 | func (s *PlaylistComplete) BindHTML(shortcode, comment *string, model string) error { 111 | return htmlPlaylist(shortcode, comment, model) 112 | } 113 | 114 | // Common to both structs. 115 | func htmlPlaylist(shortcode, comment *string, model string) error { 116 | htmlTemplate := `%s 117 | 118 | 119 | {{ range sort .Site.Data.%s.playlists "name" }} 120 | 121 | 124 | 127 | 130 | 133 | 136 | 137 | {{ end }} 138 | 139 |
122 | {{ .name }} 123 | 125 | {{ .items.track.trackname }} 126 | 128 | {{ .items.track.artistname }} 129 | 131 | {{ .items.track.albumname }} 132 | 134 | Spotify 135 |
` 140 | 141 | *shortcode = fmt.Sprintf(htmlTemplate, *comment, model) 142 | 143 | return nil 144 | } 145 | -------------------------------------------------------------------------------- /internal/app/social/youtube/playlist.go: -------------------------------------------------------------------------------- 1 | /* 2 | DIEGO - A data importer extension for Hugo 3 | Copyright (C) 2024 Vinícius Moraes 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | // Package youtube implements the social interface for youtube service. 20 | package youtube 21 | 22 | import ( 23 | "errors" 24 | "fmt" 25 | "log" 26 | "net" 27 | "time" 28 | 29 | "github.com/gocolly/colly/v2" 30 | "github.com/gocolly/colly/v2/extensions" 31 | ) 32 | 33 | // Playlist represents the official input data fields. 34 | type Playlist struct { 35 | Name string `yaml:",omitempty" json:",omitempty" toml:",omitempty" xml:",omitempty"` 36 | ID string 37 | Timestamp string 38 | URL string 39 | } 40 | 41 | // BindFile binds the CSV values into the Playlist struct. 42 | func (y *Playlist) BindFile(record *[]string) error { 43 | y.ID = (*record)[0] 44 | y.Timestamp = (*record)[1] 45 | y.URL = "https://www.youtube.com/watch?v=" + (*record)[0] 46 | 47 | return nil 48 | } 49 | 50 | // FetchFromHTTP gets additional values from the URLs for the Playlist struct. 51 | func (y *Playlist) FetchFromHTTP() error { 52 | var name string 53 | 54 | err := fetchPlaylist(y.URL, &name) 55 | if err != nil { 56 | return err 57 | } 58 | 59 | y.Name = name 60 | 61 | return nil 62 | } 63 | 64 | // BindHTML generates the Hugo shortcode for the Playlist struct. 65 | func (y *Playlist) BindHTML(shortcode, comment *string, model string) error { 66 | return htmlPlaylist(shortcode, comment, model) 67 | } 68 | 69 | // PlaylistComplete represents the official input data fields. 70 | type PlaylistComplete struct { 71 | Name string `yaml:",omitempty" json:",omitempty" toml:",omitempty" xml:",omitempty"` 72 | ID string 73 | Timestamp string 74 | URL string 75 | } 76 | 77 | // BindFile binds the CSV values into the PlaylistComplete struct. 78 | func (y *PlaylistComplete) BindFile(record *[]string) error { 79 | y.ID = (*record)[0] 80 | y.Timestamp = (*record)[1] 81 | y.URL = "https://www.youtube.com/watch?v=" + (*record)[0] 82 | 83 | return nil 84 | } 85 | 86 | // FetchFromHTTP gets additional values from the URLs for the PlaylistComplete struct. 87 | func (y *PlaylistComplete) FetchFromHTTP() error { 88 | var name string 89 | 90 | err := fetchPlaylist(y.URL, &name) 91 | if err != nil { 92 | return err 93 | } 94 | 95 | y.Name = name 96 | 97 | return nil 98 | } 99 | 100 | // BindHTML generates the Hugo shortcode for the PlaylistComplete struct. 101 | func (y *PlaylistComplete) BindHTML(shortcode, comment *string, model string) error { 102 | return htmlPlaylist(shortcode, comment, model) 103 | } 104 | 105 | // Common to both structs. 106 | func htmlPlaylist(shortcode, comment *string, model string) error { 107 | htmlTemplate := `%s 108 | 109 | 110 | {{ range sort .Site.Data.%s "timestamp" }} 111 | 112 | 115 | 118 | 121 | 122 | {{ end }} 123 | 124 |
113 | {{ .timestamp }} 114 | 116 | {{ .id }} 117 | 119 | YouTube 120 |
` 125 | 126 | *shortcode = fmt.Sprintf(htmlTemplate, *comment, model) 127 | 128 | return nil 129 | } 130 | 131 | func fetchPlaylist(url string, name *string) error { 132 | c := colly.NewCollector() 133 | extensions.RandomUserAgent(c) 134 | c.SetRequestTimeout(15 * time.Second) 135 | c.IgnoreRobotsTxt = false 136 | maxRetries := 3 137 | retryCount := 1 138 | 139 | err := c.Limit(&colly.LimitRule{ 140 | DomainGlob: "*", 141 | RandomDelay: 1000 * time.Millisecond, 142 | }) 143 | if err != nil { 144 | log.Fatalf("Error limiting colector: %s", err) 145 | } 146 | 147 | c.OnRequest(func(r *colly.Request) { 148 | fmt.Printf("Fetching \"%s\"...\n", r.URL.String()) 149 | }) 150 | 151 | c.OnHTML("meta[name='title']", func(e *colly.HTMLElement) { 152 | *name = e.Attr("content") 153 | }) 154 | 155 | c.OnError(func(resp *colly.Response, err error) { 156 | var netErr net.Error 157 | if errors.As(err, &netErr) && netErr.Timeout() { 158 | if retryCount <= maxRetries { 159 | fmt.Printf("Retry %d/%d due to timeout:\n", retryCount, maxRetries) 160 | _ = resp.Request.Retry() 161 | retryCount++ 162 | } else { 163 | log.Printf("Failed fetching \"%s\": %s\n", url, err) 164 | return 165 | } 166 | } else { 167 | log.Fatalf("Error fetching \"%s\": %s\n", url, err) 168 | } 169 | }) 170 | 171 | _ = c.Visit(url) 172 | 173 | return nil 174 | } 175 | -------------------------------------------------------------------------------- /internal/app/social/youtube/subscriptions.go: -------------------------------------------------------------------------------- 1 | /* 2 | DIEGO - A data importer extension for Hugo 3 | Copyright (C) 2024 Vinícius Moraes 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | package youtube 20 | 21 | import "fmt" 22 | 23 | // Subscriptions represents the official input data fields. 24 | type Subscriptions struct { 25 | Name string 26 | ChannelID string 27 | ChannelURL string 28 | } 29 | 30 | // BindFile binds the CSV values into the Subscriptions struct. 31 | func (y *Subscriptions) BindFile(record *[]string) error { 32 | y.Name = (*record)[2] 33 | y.ChannelID = (*record)[0] 34 | y.ChannelURL = (*record)[1] 35 | 36 | return nil 37 | } 38 | 39 | // FetchFromHTTP gets additional values from the URLs for the Subscriptions struct. 40 | func (y *Subscriptions) FetchFromHTTP() error { 41 | return nil 42 | } 43 | 44 | // BindHTML generates the Hugo shortcode for the Subscriptions struct. 45 | func (y *Subscriptions) BindHTML(shortcode, comment *string, model string) error { 46 | return htmlSubscriptions(shortcode, comment, model) 47 | } 48 | 49 | // SubscriptionsComplete represents the official input data fields. 50 | type SubscriptionsComplete struct { 51 | Name string 52 | ChannelID string 53 | ChannelURL string 54 | } 55 | 56 | // BindFile binds the CSV values into the SubscriptionsComplete struct. 57 | func (y *SubscriptionsComplete) BindFile(record *[]string) error { 58 | y.Name = (*record)[2] 59 | y.ChannelID = (*record)[0] 60 | y.ChannelURL = (*record)[1] 61 | 62 | return nil 63 | } 64 | 65 | // FetchFromHTTP gets additional values from the URLs for the SubscriptionsComplete struct. 66 | func (y *SubscriptionsComplete) FetchFromHTTP() error { 67 | return nil 68 | } 69 | 70 | // BindHTML generates the Hugo shortcode for the SubscriptionsComplete struct. 71 | func (y *SubscriptionsComplete) BindHTML(shortcode, comment *string, model string) error { 72 | return htmlSubscriptions(shortcode, comment, model) 73 | } 74 | 75 | // Common to both structs. 76 | func htmlSubscriptions(shortcode, comment *string, model string) error { 77 | htmlTemplate := `%s 78 | 79 | 80 | {{ range sort .Site.Data.%s "name" }} 81 | 82 | 85 | 88 | 89 | {{ end }} 90 | 91 |
83 | {{ .channelid }} 84 | 86 | YouTube 87 |
` 92 | 93 | *shortcode = fmt.Sprintf(htmlTemplate, *comment, model) 94 | 95 | return nil 96 | } 97 | -------------------------------------------------------------------------------- /internal/ports/left.go: -------------------------------------------------------------------------------- 1 | /* 2 | DIEGO - A data importer extension for Hugo 3 | Copyright (C) 2024 Vinícius Moraes 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | // Package ports provides driver (left) and driven (right) ports. 20 | package ports 21 | 22 | import ( 23 | "github.com/ttybitnik/diego/internal/app/domain" 24 | "github.com/ttybitnik/diego/internal/app/social" 25 | ) 26 | 27 | // APIPort is the technology neutral port for driver adapters. 28 | type APIPort interface { 29 | GetImportFile(f string, dc domain.Core) ([]social.Service, error) 30 | GetGenerateShortcode(dc domain.Core) (*string, error) 31 | } 32 | -------------------------------------------------------------------------------- /internal/ports/right.go: -------------------------------------------------------------------------------- 1 | /* 2 | DIEGO - A data importer extension for Hugo 3 | Copyright (C) 2024 Vinícius Moraes 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | package ports 20 | 21 | import ( 22 | "github.com/ttybitnik/diego/internal/app/domain" 23 | "github.com/ttybitnik/diego/internal/app/social" 24 | ) 25 | 26 | // WriterPort is the output port for driven adapters. 27 | type WriterPort interface { 28 | WriteToFile(data []social.Service, dfs domain.FileSystem) error 29 | WriteShortcode(shortcode *string, dfs domain.FileSystem) error 30 | } 31 | -------------------------------------------------------------------------------- /main.go: -------------------------------------------------------------------------------- 1 | /* 2 | DIEGO - A data importer extension for Hugo 3 | Copyright (C) 2024 Vinícius Moraes 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | package main 20 | 21 | import ( 22 | "log" 23 | 24 | cmd "github.com/ttybitnik/diego/internal/adapters/left/cli" 25 | ) 26 | 27 | func main() { 28 | log.SetFlags(0) 29 | cmd.Execute() 30 | } 31 | --------------------------------------------------------------------------------