change project structure

This commit is contained in:
GenZmeY 2020-11-02 17:04:58 +03:00
parent 316b49a59f
commit 9500d346e5
6 changed files with 62 additions and 8 deletions

View File

@ -3,12 +3,14 @@ VERSION = dev_$(shell date +%F_%T)
GOCMD = go GOCMD = go
LDFLAGS := "$(LDFLAGS) -X 'main.Version=$(VERSION)'" LDFLAGS := "$(LDFLAGS) -X 'main.Version=$(VERSION)'"
GOBUILD = $(GOCMD) build -ldflags=$(LDFLAGS) GOBUILD = $(GOCMD) build -ldflags=$(LDFLAGS)
SRCMAIN = . SRCMAIN = ./cmd/$(NAME)
BINDIR = bin BINDIR = bin
BIN = $(BINDIR)/$(NAME) BIN = $(BINDIR)/$(NAME)
README = ./doc/README
LICENSE = LICENSE
PREFIX = /usr PREFIX = /usr
.PHONY: all prep build check-build freebsd-386 darwin-386 linux-386 windows-386 freebsd-amd64 darwin-amd64 linux-amd64 windows-amd64 compile install check-install uninstall clean .PHONY: all prep build doc check-build freebsd-386 darwin-386 linux-386 windows-386 freebsd-amd64 darwin-amd64 linux-amd64 windows-amd64 compile install check-install uninstall clean
all: build all: build
@ -19,6 +21,10 @@ prep: clean
build: prep build: prep
$(GOBUILD) -o $(BIN) $(SRCMAIN) $(GOBUILD) -o $(BIN) $(SRCMAIN)
doc: check-build
test -d ./doc || mkdir ./doc
$(BIN) --help > ./doc/README
check-build: check-build:
test -e $(BIN) test -e $(BIN)
@ -48,15 +54,25 @@ windows-amd64: prep
compile: freebsd-386 darwin-386 linux-386 windows-386 freebsd-amd64 darwin-amd64 linux-amd64 windows-amd64 compile: freebsd-386 darwin-386 linux-386 windows-386 freebsd-amd64 darwin-amd64 linux-amd64 windows-amd64
install: check-build install: check-build doc
install -m 755 -d $(PREFIX)/bin/ install -m 755 -d $(PREFIX)/bin/
install -m 755 $(BIN) $(PREFIX)/bin/ install -m 755 $(BIN) $(PREFIX)/bin/
install -m 755 -d $(PREFIX)/share/licenses/$(NAME)/
install -m 644 $(LICENSE) $(PREFIX)/share/licenses/$(NAME)/
install -m 755 -d $(PREFIX)/share/licenses/$(NAME)/go-perceptualhash
install -m 644 ./third_party/go-perceptualhash/LICENSE $(PREFIX)/share/licenses/$(NAME)/go-perceptualhash
install -m 755 -d $(PREFIX)/share/doc/$(NAME)/
install -m 644 $(README) $(PREFIX)/share/doc/$(NAME)/
check-install: check-install:
test -e $(PREFIX)/bin/$(NAME) test -e $(PREFIX)/bin/$(NAME) || \
test -d $(PREFIX)/share/licenses/$(NAME) || \
test -d $(PREFIX)/share/doc/$(NAME)
uninstall: check-install uninstall: check-install
rm -f $(PREFIX)/bin/$(NAME) rm -f $(PREFIX)/bin/$(NAME)
rm -rf $(PREFIX)/share/licenses/$(NAME)
rm -rf $(PREFIX)/share/doc/$(NAME)
clean: clean:
rm -rf $(BINDIR) rm -rf $(BINDIR)

View File

@ -3,7 +3,7 @@ package main
import ( import (
"github.com/juju/gnuflag" "github.com/juju/gnuflag"
"range-gen/output" "range-gen/internal/output"
"errors" "errors"
"os" "os"

View File

@ -18,7 +18,7 @@ import (
"github.com/dsoprea/go-perceptualhash" "github.com/dsoprea/go-perceptualhash"
"range-gen/output" "range-gen/internal/output"
) )
const ( const (

12
doc/README Normal file
View File

@ -0,0 +1,12 @@
Сreates a list of scene ranges based on a set of frames from the video
Usage: range-gen [option]... <input_dir> <output_file> <threshold>
input_dir Directory with png images
output_file Range list file
threshold Image similarity threshold (0-1024)
Options:
-j, --jobs N Allow N jobs at once
-n, --noise Default noise level for each range
-h, --help Show this page
-v, --version Show version

26
third_party/go-perceptualhash/LICENSE vendored Normal file
View File

@ -0,0 +1,26 @@
BSD 3-Clause License
Copyright (c) 2018, Dustin Oprea
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the <organization> nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.