Skip to content

Commit

Permalink
Add Dendrite importer
Browse files Browse the repository at this point in the history
  • Loading branch information
turt2live committed Nov 23, 2023
1 parent aaf1646 commit e20fbc9
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions cmd/homeserver_live_importers/import_dendrite/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package main

import (
"github.com/turt2live/matrix-media-repo/cmd/homeserver_live_importers/_common"
"github.com/turt2live/matrix-media-repo/common/rcontext"
"github.com/turt2live/matrix-media-repo/homeserver_interop/dendrite"
)

func main() {
cfg := _common.InitImportPsqlMatrixDownload("Dendrite")
ctx := rcontext.InitialNoConfig()

ctx.Log.Debug("Connecting to homeserver database...")
hsDb, err := dendrite.OpenDatabase(cfg.ConnectionString, cfg.ServerName)
if err != nil {
panic(err)
}

_common.PsqlMatrixDownloadCopy[dendrite.LocalMedia](ctx, cfg, hsDb, func(record *dendrite.LocalMedia) (*_common.MediaMetadata, error) {
return &_common.MediaMetadata{
MediaId: record.MediaId,
ContentType: record.ContentType,
FileName: record.UploadName,
UploaderUserId: record.UserId,
SizeBytes: record.FileSizeBytes,
}, nil
})
}

0 comments on commit e20fbc9

Please sign in to comment.