media

package
v0.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 21, 2023 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ListLocal action.GTSAction = func(ctx context.Context) error {
	list, err := setupList(ctx)
	if err != nil {
		return err
	}

	defer func() {

		if err := list.shutdown(ctx); err != nil {
			log.Error(ctx, err)
		}
	}()

	mediaPath := config.GetStorageLocalBasePath()
	media, err := list.GetAllMediaPaths(
		ctx,
		func(m *gtsmodel.MediaAttachment) string {
			if m.RemoteURL == "" {
				return path.Join(mediaPath, m.File.Path)
			}
			return ""
		})
	if err != nil {
		return err
	}

	for _, m := range media {
		_, _ = list.out.WriteString(m + "\n")
	}
	return nil
}
View Source
var ListRemote action.GTSAction = func(ctx context.Context) error {
	list, err := setupList(ctx)
	if err != nil {
		return err
	}

	defer func() {

		if err := list.shutdown(ctx); err != nil {
			log.Error(ctx, err)
		}
	}()

	media, err := list.GetAllMediaPaths(
		ctx,
		func(m *gtsmodel.MediaAttachment) string {
			return m.RemoteURL
		})
	if err != nil {
		return err
	}

	for _, m := range media {
		_, _ = list.out.WriteString(m + "\n")
	}
	return nil
}

Functions

This section is empty.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL