carpe

package module
v0.0.0-...-5ec718d Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2019 License: MIT Imports: 32 Imported by: 0

README

carpe-qrss

QRSS Grabber Seizer.

Alpha quality. Work in progress. See text in last function in survey.go.

Documentation

Index

Constants

View Source
const BUFSIZ = 128 << 10 // For reading and writing images to/from files.
View Source
const GC_GRACE_HOURS = 2
View Source
const HEI = 500
View Source
const MAX_GIF = 200 // Problems with Out Of Memory.
View Source
const NS = 5 // How many to stack
View Source
const TS_FORMAT = "2006-01-02-150405"
View Source
const VerboseCrop = true
View Source
const WHOM = "W6REK"
View Source
const WID = 800

A modest size for video frames.

Variables

View Source
var Crops = map[OriginalDim]CropMargins{
	MakeOriginalDim(1152, 702): []int{0, 80, 0, 80},
	MakeOriginalDim(1000, 696): []int{12, 96, 88, 40},
	MakeOriginalDim(1235, 686): []int{3, 130, 5, 5},
	MakeOriginalDim(1226, 721): []int{4, 172, 4, 4},
	MakeOriginalDim(1187, 812): []int{3, 262, 3, 3},
}

Map original (width, height) to (left, right, top, bottom) margins. So far, each different type of image has a different size. We will use that, as long as it works.

View Source
var ETag = make(map[string]string)
View Source
var GREEN = image.NewUniform(color.NRGBA{20, 200, 20, 255})
View Source
var JpegOpts = &jpeg.Options{Quality: *QUALITY}
View Source
var LastModified = make(map[string]string)

Map URL to Date String

View Source
var QUALITY = flag.Int("quality", 90, "Jpeg output quality, typically 90 to 95.")
View Source
var Targets = []Target{
	{"w4hbk", "http://www.qsl.net/w4hbk/hf1.jpg", ""},
	{"w4hbk_8h", "http://www.qsl.net/w4hbk/hf2.jpg", ""},

	{"wa5djj_40", "http://qsl.net/wa5djj/hf2.jpg", ""},
	{"wa5djj_30", "http://qsl.net/wa5djj/hf3.jpg", ""},
	{"wa5djj_20", "http://qsl.net/wa5djj/hf4.jpg", ""},

	{"wa5djj_80", "http://qsl.net/wa5djj/mf3.jpg", ""},
	{"wa5djj_17", "http://qsl.net/wa5djj/hf5.jpg", ""},
	{"wa5djj_15", "http://qsl.net/wa5djj/hf6.jpg", ""},
	{"wa5djj_12", "http://qsl.net/wa5djj/hf7.jpg", ""},
	{"wa5djj_10", "http://qsl.net/wa5djj/hf8.jpg", ""},

	{"wd4elg_20", "https://dl.dropboxusercontent.com/s/gba72cz0au66032/WD4ELG%2020M%20grabber%20%28REFRESH%20for%20latest%20grab%29.jpg", ""},
	{"wd4elg_30", "https://dl.dropboxusercontent.com/s/7djby65cbfh6hv7/WD4ELG%2030M%20grabber%20%28REFRESH%20for%20latest%20grab%29.jpg", ""},
	{"wd4elg_40", "https://dl.dropboxusercontent.com/s/ajhc4t640k7k67u/WD4ELG%2040M%20grabber%20%28REFRESH%20for%20latest%20grab%29.jpg", ""},
	{"wd4elg_80", "https://dl.dropboxusercontent.com/s/59ktcp48iie5i1m/WD4ELG%2080M%20grabber%20%28REFRESH%20for%20latest%20grab%29.jpg", ""},

	{"ve1vdm", "http://users.eastlink.ca/~ve1vdm/argocaptures/argo.jpg", ""},
	{"zl2ik", "http://zl2ik.com/Argo.jpg", ""},
	{"kl7l", "http://kl7l.com/Alaska00000.jpg", ""},

	{"tg6ajr", "http://qsl.net/tg9ajr/argo/mf1.gif", ""},

	{"g3vyz_1", "http://www.holywell44.com/qrss/qrss_.jpg", ""},
	{"g3vyz_2", "http://www.holywell44.com/qrss/qrss_2.jpg", ""},
	{"g3vyz_3", "http://www.holywell44.com/qrss/qrss_3.jpg", ""},
	{"g3vyz_4", "http://www.holywell44.com/qrss/qrss_4.jpg", ""},
	{"g3vyz_5", "http://www.holywell44.com/qrss/qrss_5.jpg", ""},

	{"ea8bvp", "http://www.qsl.net/ea8bvp/hf1.jpg", ""},
	{"ea8bvp_4h", "http://www.qsl.net/ea8bvp/hf2.jpg", ""},

	{"la5goa", "http://la5goa.manglet.net/grabber/lopshot1.jpg", ""},

	{"n2nxz", "http://www.qsl.net/n2nxz/hf1.jpg", ""},

	{"wd4ah", "http://www.qsl.net/wd4ah/hf1.jpg", ""},

	{"ok1fcx", "http://qsl.net/ok1fcx/hf1.jpg", ""},

	{"aa7us", "http://www.qsl.net/aa7us/hf3.jpg", ""},
}
View Source
var YELLOW = image.NewUniform(color.NRGBA{200, 200, 20, 255})

Functions

func BuildAnimatedGif

func BuildAnimatedGif(filenames []string, delay time.Duration, converter ImageConverter, outgif string, outmean string) (failures int)

func Crop

func Crop(img image.Image, margins []int) image.Image

func DieIf

func DieIf(err error, args ...interface{})

func EveryNSeconds

func EveryNSeconds(key string, n uint, fn func())

func Fetch

func Fetch(grabbers_url string, spool string)

func FetchEveryNSeconds

func FetchEveryNSeconds(n uint, grabbers_url string, spool string)

func Get

func Get(t Target, spool string) (filename string, status int, err error)

func ReadCsvLinesWithN

func ReadCsvLinesWithN(r *csv.Reader, n int) ([][]string, error)

func ReadImage

func ReadImage(filename string) image.Image

func StartWeb

func StartWeb(bind string, spool string)

func ThinStrings

func ThinStrings(a []string) []string

ThinStrings drops 1 random input string.

func WriteJpegImage

func WriteJpegImage(img image.Image, filename string)

Types

type CropMargins

type CropMargins []int

type ImageConverter

type ImageConverter func(img image.Image, filename string) image.Image

type OriginalDim

type OriginalDim int // encodes (width<<16 + height)

func MakeOriginalDim

func MakeOriginalDim(width, height int) OriginalDim

type Products

type Products struct {
	MovieName    string
	MovieModTime time.Time
	MeanName     string
	MeanModTime  time.Time
}

type SubImager

type SubImager interface {
	SubImage(r image.Rectangle) image.Image
}

Luckily this works for jpeg. Maybe for other Image Decodes?

type Survey

type Survey struct {
	Spool      string
	TagDayHash map[string]*TagSurvey
	SeenOther  map[string]bool // Seen for mark-and-sweep
	UsedOther  map[string]bool // Marked for mark-and-sweep
}

For all tags on all days, this is everything.

func NewSurvey

func NewSurvey(spool string) *Survey

func (*Survey) Build1Giffy

func (o *Survey) Build1Giffy(inputs []string, tmpgif, gifname, meanname string) (ok bool)

func (*Survey) BuildMovies

func (o *Survey) BuildMovies(prefix string)

func (*Survey) CollectGarbage

func (o *Survey) CollectGarbage()

func (*Survey) ConvertToModest

func (o *Survey) ConvertToModest(img image.Image, filename string) image.Image

func (*Survey) DumpProducts

func (o *Survey) DumpProducts(w io.Writer)

func (*Survey) SortedWebTags

func (o *Survey) SortedWebTags() []string

func (*Survey) SortedWebTagsForDay

func (o *Survey) SortedWebTagsForDay(daysAgo int) []string

func (*Survey) Walk

func (o *Survey) Walk()

Survey uses simple shell scripts, so don't have Spaces or Newlines or Exploits or web-user-provided data in the file paths.

func (*Survey) WalkFunc

func (o *Survey) WalkFunc(filename string, info os.FileInfo, err error) error

func (*Survey) WriteWebPageForDay

func (o *Survey) WriteWebPageForDay(w io.Writer, daysAgo int)

type SurveyRec

type SurveyRec struct {
	Filename    string
	Filesize    int64
	Tag         string
	TimeString  string
	ShapeString string
	Time        time.Time
	Width       int
	Height      int
}

func ParseFilenameForPrimary

func ParseFilenameForPrimary(filename string, info os.FileInfo) *SurveyRec

Originals filenames always end in `.jpg` (regardless of their image type).

func RenameFileForImageSize

func RenameFileForImageSize(spool string, filename string) (string, *SurveyRec)

type TagDaySurvey

type TagDaySurvey struct {
	Surveys []*SurveyRec
}

For one tag on one day.

type TagSurvey

type TagSurvey struct {
	DayHash     map[int]*TagDaySurvey
	NewProducts map[int]Products // int is Days Ago, 0 is today.
}

For one tag on all days.

type Target

type Target struct {
	Nick   string
	URL    string
	Remark string
}

func GetTargetsViaURL

func GetTargetsViaURL(url string) []Target

Jump to

Keyboard shortcuts

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