-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from anitschke/anitschk/initialVersion
Initial commit of photo-db-fs
- Loading branch information
Showing
67 changed files
with
3,247 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# This workflow will build a golang project | ||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go | ||
|
||
name: CI | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
jobs: | ||
|
||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: 1.19 | ||
|
||
- name: Build | ||
run: go build -v ./... | ||
|
||
- name: Test | ||
run: go test -v ./... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
on: | ||
release: | ||
types: [created] | ||
|
||
jobs: | ||
release-linux-amd64: | ||
name: release linux/amd64 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: wangyoucao577/go-release-action@v1.33 | ||
with: | ||
go-version: 1.19 | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
goos: linux | ||
goarch: amd64 | ||
extra_files: LICENSE README.md | ||
md5sum: true | ||
sha256sum: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
name: spellcheck | ||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
jobs: | ||
spellcheck: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: streetsidesoftware/cspell-action@v2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# photo-db-fs | ||
[![Release](https://github.com/anitschke/photo-db-fs/actions/workflows/release.yml/badge.svg)](https://github.com/anitschke/photo-db-fs/actions/workflows/release.yml) [![CI](https://github.com/anitschke/photo-db-fs/actions/workflows/ci.yml/badge.svg)](https://github.com/anitschke/photo-db-fs/actions/workflows/ci.yml) ![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/anitschke/photo-db-fs) [![Go Report Card](https://goreportcard.com/badge/github.com/anitschke/photo-db-fs)](https://goreportcard.com/report/github.com/anitschke/photo-db-fs) | ||
|
||
`photo-db-fs` is a FUSE virtual file system for Linux that exposes a photo database as a file system. At the moment it only supports digiKam but is built to be extensible so as to support other photo management programs in the future. | ||
|
||
## Installation | ||
### GitHub Release | ||
Visit the [releases page](https://github.com/anitschke/photo-db-fs/releases) to download one of the prebuilt binaries. | ||
|
||
### go install | ||
Build and install from source: | ||
``` | ||
go install github.com/anitschke/photo-db-fs@latest | ||
``` | ||
|
||
## Usage | ||
``` | ||
[anitschk@localhost ~]$ photo-db-fs -h | ||
Usage of photo-db-fs: | ||
-db-source string | ||
source of the database photo-db-fs will use for querying, ie for local databases this is the path to the database | ||
-db-type string | ||
type of photo database photo-db-fs will use for querying | ||
-log-level string | ||
debugging logging level | ||
-mount-point string | ||
location where photo-db-fs file system will be mounted | ||
``` | ||
|
||
example: | ||
``` | ||
[anitschk@localhost ~]$ mkdir /tmp/myPhotos | ||
[anitschk@localhost ~]$ photo-db-fs --mount-point /tmp/myPhotos --db-type digikam-sqlite --db-source ~/Pictures/digikam4.db & | ||
[1] 12910 | ||
[anitschk@localhost ~]$ ls /tmp/myPhotos/tags/DesktopBackground/photos | ||
009318790e574d9764679ec1b8f0a987.jpg 5c23b47abdb881acee6b1f5313ecbc71.JPG ae1628e3571980c2f8909fff5a8d860c.JPG | ||
01586b0bc31424ab3b156ffdac8ef58f.JPG 5c4918818f3f14575f76c78ad1cf62d6.JPG ae4beaabd272f22fbc04dd57c42d9826.jpg | ||
0338a700e5e602c496abdcad2deaa133.jpg 5da619a984339d0e1bd4b80de91a79cd.jpg ae5cd09cafe0f53a737d6f53d3567314.JPG | ||
[anitschk@localhost ~]$ kill %1 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
anitschk | ||
anitschke | ||
digikam | ||
digiKam | ||
digikamtestresources | ||
Dups | ||
dylib | ||
Embedder | ||
goarch | ||
hanwen | ||
inode | ||
inodes | ||
integrationtests | ||
Lookuper | ||
mattn | ||
photofs | ||
Readdirer | ||
stretchr | ||
Subquery | ||
subselector | ||
testtools | ||
wangyoucao | ||
watersports | ||
zapcore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"$schema": "https://raw.githubusercontent.com/streetsidesoftware/cspell/main/cspell.schema.json", | ||
"version": "0.2", | ||
"dictionaryDefinitions": [ | ||
{ | ||
"name": "cspell-words", | ||
"path": "./cspell-words.txt", | ||
"addWords": true | ||
} | ||
], | ||
"dictionaries": ["cspell-words"], | ||
"ignorePaths": [ | ||
"/go.sum", | ||
"/go.mod", | ||
"**/digikam4.db", | ||
"recognition.db", | ||
"similarity.db", | ||
"thumbnails-digikam.db" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package db | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
"sync" | ||
|
||
"github.com/anitschke/photo-db-fs/types" | ||
) | ||
|
||
var ( | ||
dbFactoryMu sync.RWMutex | ||
dbFactory = make(map[string]DBConstructor) | ||
) | ||
|
||
type DBConstructor func(dbSource string) (DB, error) | ||
|
||
// DB is an interface for interacting with a photo database to query information | ||
// about photos within the database. | ||
type DB interface { | ||
Photos(ctx context.Context, q types.Query) ([]types.Photo, error) | ||
RootTags(ctx context.Context) ([]types.Tag, error) | ||
ChildrenTags(ctx context.Context, parent types.Tag) ([]types.Tag, error) | ||
Close() error | ||
} | ||
|
||
// Register handles registration of a new DB type. | ||
// | ||
// We handle registration of new DB types similar to how SQL database drivers | ||
// are registered. We expect that all DB types Register by calling Register with | ||
// the init() function of their package. Then They should import their package | ||
// into db/register. This way importing the db/register package into main will | ||
// import all DB types | ||
func Register(name string, dbCtor DBConstructor) { | ||
dbFactoryMu.Lock() | ||
defer dbFactoryMu.Unlock() | ||
if dbCtor == nil { | ||
panic("nil dbCtor") | ||
} | ||
if _, dup := dbFactory[name]; dup { | ||
panic("duplicate database type: " + name) | ||
} | ||
dbFactory[name] = dbCtor | ||
} | ||
|
||
func New(name string, dbSource string) (DB, error) { | ||
ctor, ok := dbFactory[name] | ||
if !ok { | ||
return nil, fmt.Errorf("dbCtor with name %q does not exist", name) | ||
} | ||
|
||
return ctor(dbSource) | ||
} |
Oops, something went wrong.