attributions

package module
v0.0.0-...-7349987 Latest Latest
Warning

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

Go to latest
Published: May 15, 2023 License: MIT Imports: 10 Imported by: 6

README

Attributions

This package provides common structures and utilities for reasoning about content attribution in creative projects. The goal is to make it easier to "do the right thing": showing clear history of parties whose work was used, and clearly identifying their contributions.

This package is one I'll seek to maintain and grow over time.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AttributedFile

type AttributedFile interface {
	Attributions() []Attribution
	Read() ([]byte, error)
	ReadString() (string, error)
	SHA256() string
	// contains filtered or unexported methods
}

func ReadAllAttributedFiles

func ReadAllAttributedFiles(dirPath string) ([]AttributedFile, error)

func ReadAttributedFile

func ReadAttributedFile(filePath string) (AttributedFile, error)

type AttributedFilePointer

type AttributedFilePointer struct {
	FilePath string
}

func AttributeLocalFile

func AttributeLocalFile(filePath string, attributions ...Attribution) (AttributedFilePointer, error)

func AttributeRawFile

func AttributeRawFile(filePath, bytes string, attributions ...Attribution) (AttributedFilePointer, error)

func ReadAllAttributedFilePointers

func ReadAllAttributedFilePointers(dirPath string) ([]AttributedFilePointer, error)

func (AttributedFilePointer) Base

func (a AttributedFilePointer) Base() string

func (AttributedFilePointer) CopyTo

func (a AttributedFilePointer) CopyTo(newLocalPath string) (AttributedFilePointer, error)

func (AttributedFilePointer) CopyToDir

func (a AttributedFilePointer) CopyToDir(newDirPath string) (AttributedFilePointer, error)

func (AttributedFilePointer) Delete

func (a AttributedFilePointer) Delete() error

func (AttributedFilePointer) GetDataPath

func (afp AttributedFilePointer) GetDataPath() (string, error)

func (AttributedFilePointer) ReadAttributedFile

func (a AttributedFilePointer) ReadAttributedFile() (AttributedFile, error)

type Attribution

type Attribution struct {
	OriginUrl           string    `xml:"origin_url"`
	CollectedAt         time.Time `xml:"collected_at"`
	OriginalTitle       string    `xml:"original_title"`
	Author              string    `xml:"author"`
	AuthorUrl           string    `xml:"author_url"`
	License             string    `xml:"license"`
	LicenseUrl          string    `xml:"license_url"`
	CreatedAt           time.Time `xml:"created_at"`
	Context             []string  `xml:"context"`
	ScrapingMethodology string    `xml:"scraping_methodology"`
}

Jump to

Keyboard shortcuts

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