forked from xbapps/xbvr
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
cld9x
committed
May 9, 2019
0 parents
commit 5e60bfe
Showing
78 changed files
with
11,818 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
pkg = "assets" | ||
dest = "./xbase/assets/" | ||
fmt = false | ||
|
||
[compression] | ||
compress = true | ||
method = "DefaultCompression" | ||
keep = false | ||
|
||
clean = false | ||
output = "ab0x.go" | ||
unexporTed = false | ||
spread = false | ||
debug = true | ||
|
||
[[custom]] | ||
files = ["./ui/public/"] | ||
base = "./ui/public/" | ||
exclude = [".DS_Store"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
kind: pipeline | ||
name: default | ||
|
||
workspace: | ||
base: /go | ||
path: appsrc/ | ||
|
||
steps: | ||
- name: fetch | ||
image: docker:git | ||
when: | ||
event: | ||
- tag | ||
commands: | ||
- git fetch --tags | ||
|
||
- name: ui | ||
image: node | ||
when: | ||
event: | ||
- tag | ||
commands: | ||
- cd ui | ||
- yarn install | ||
- yarn build | ||
|
||
- name: build | ||
image: mailchain/goreleaser-xcgo:latest | ||
environment: | ||
GITHUB_TOKEN: | ||
from_secret: GITHUB_TOKEN | ||
when: | ||
event: | ||
- tag | ||
commands: | ||
- apt-get update && apt-get install -y gcc-arm-linux-gnueabi g++-arm-linux-gnueabi | ||
- goreleaser --skip-validate --rm-dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/.idea | ||
.DS_Store | ||
|
||
npm-debug.log | ||
yarn-error.log | ||
go.sum | ||
test.db | ||
|
||
/dist/ | ||
/node_modules/ | ||
/xbase/assets/ | ||
/ui/public/static/bundle.* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
before: | ||
hooks: | ||
- go mod download | ||
- go get github.com/UnnoTed/fileb0x | ||
- go get github.com/go-bindata/go-bindata | ||
- go generate ./... | ||
builds: | ||
- id: xbvr-mac | ||
binary: xbvr | ||
env: | ||
- CGO_ENABLED=1 | ||
- CC=o64-clang | ||
- CXX=o64-clang++ | ||
goos: | ||
- darwin | ||
goarch: | ||
- amd64 | ||
- id: xbvr-windows | ||
binary: xbvr | ||
env: | ||
- CGO_ENABLED=1 | ||
- CC=x86_64-w64-mingw32-gcc | ||
- CXX=x86_64-w64-mingw32-g++ | ||
goos: | ||
- windows | ||
goarch: | ||
- amd64 | ||
- id: xbvr-linux-amd64 | ||
binary: xbvr | ||
env: | ||
- CGO_ENABLED=1 | ||
goos: | ||
- linux | ||
goarch: | ||
- amd64 | ||
- id: xbvr-linux-arm | ||
binary: xbvr | ||
env: | ||
- CGO_ENABLED=1 | ||
- CC=arm-linux-gnueabi-gcc | ||
goos: | ||
- linux | ||
goarch: | ||
- arm | ||
goarm: | ||
- 6 | ||
- 7 | ||
archives: | ||
- replacements: | ||
darwin: macOS | ||
linux: Linux | ||
windows: Windows | ||
amd64: x86_64 | ||
snapshot: | ||
name_template: "{{ .Tag }}-next" | ||
changelog: | ||
sort: asc | ||
filters: | ||
exclude: | ||
- '^docs:' | ||
- '^test:' | ||
release: | ||
disable: false | ||
github: | ||
owner: cld9x | ||
name: test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
settings: | ||
legacy: | ||
force: false | ||
interval: 0s | ||
server: | ||
status: true | ||
open: false | ||
host: localhost | ||
port: 5001 | ||
schema: | ||
- name: xbvr | ||
env: | ||
DEBUG: 1 | ||
path: . | ||
commands: | ||
generate: | ||
status: true | ||
run: | ||
status: true | ||
args: | ||
- run | ||
watcher: | ||
extensions: | ||
- go | ||
paths: | ||
- / | ||
ignore: | ||
paths: | ||
- .git | ||
- .realize | ||
- node_modules/ | ||
- ui/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package command | ||
|
||
import ( | ||
"gopkg.in/urfave/cli.v1" | ||
) | ||
|
||
var commands []cli.Command | ||
|
||
type Commander interface { | ||
Execute(c *cli.Context) | ||
} | ||
|
||
func RegisterCommand(command cli.Command) { | ||
commands = append(commands, command) | ||
} | ||
|
||
func GetCommands() []cli.Command { | ||
return commands | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package command | ||
|
||
import ( | ||
"github.com/sirupsen/logrus" | ||
"github.com/x-cray/logrus-prefixed-formatter" | ||
"os" | ||
"runtime" | ||
) | ||
|
||
var log = logrus.New() | ||
|
||
func init() { | ||
log.Out = os.Stdout | ||
log.SetLevel(logrus.InfoLevel) | ||
|
||
if runtime.GOOS == "windows" { | ||
log.Formatter = &prefixed.TextFormatter{ | ||
DisableColors: true, | ||
} | ||
} else { | ||
log.Formatter = &prefixed.TextFormatter{} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package command | ||
|
||
import ( | ||
"github.com/cld9x/xbvr/xbase" | ||
"gopkg.in/urfave/cli.v1" | ||
) | ||
|
||
func ActionRun(c *cli.Context) { | ||
xbase.StartServer() | ||
} | ||
|
||
func init() { | ||
RegisterCommand(cli.Command{ | ||
Name: "run", | ||
Usage: "run xbvr", | ||
Action: ActionRun, | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package command | ||
|
||
import ( | ||
"github.com/cld9x/xbvr/xbase" | ||
"github.com/cld9x/xbvr/xbase/scrape" | ||
"gopkg.in/urfave/cli.v1" | ||
) | ||
|
||
func ActionCleanTags(c *cli.Context) { | ||
xbase.RenameTags() | ||
xbase.CountTags() | ||
} | ||
|
||
func ActionScrape(c *cli.Context) { | ||
scrape.ScrapeNA() | ||
scrape.ScrapeBadoink() | ||
scrape.ScrapeMilfVR() | ||
scrape.ScrapeVRB() | ||
scrape.ScrapeWankz() | ||
scrape.ScrapeVirtualTaboo() | ||
} | ||
|
||
func init() { | ||
RegisterCommand(cli.Command{ | ||
Name: "task", | ||
Usage: "run various tasks", | ||
Subcommands: []cli.Command{ | ||
{ | ||
Name: "clean-tags", | ||
Category: "tasks", | ||
Usage: "clean tags", | ||
Action: ActionCleanTags, | ||
}, | ||
{ | ||
Name: "scrape", | ||
Category: "tasks", | ||
Usage: "run scrapers", | ||
Action: ActionScrape, | ||
}, | ||
}, | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
package command | ||
|
||
import ( | ||
"os" | ||
"path/filepath" | ||
|
||
"github.com/cld9x/xbvr/xbase" | ||
"gopkg.in/urfave/cli.v1" | ||
) | ||
|
||
func ActionAddVolume(c *cli.Context) { | ||
if len(c.Args()) == 1 { | ||
path := c.Args()[0] | ||
if fi, err := os.Stat(path); os.IsNotExist(err) || !fi.IsDir() { | ||
log.Fatal("Path does not exist or is not a directory") | ||
} | ||
|
||
path, _ = filepath.Abs(path) | ||
|
||
db, _ := xbase.GetDB() | ||
defer db.Close() | ||
|
||
var vol []xbase.Volume | ||
db.Where(&xbase.Volume{Path: path}).Find(&vol) | ||
|
||
if len(vol) > 0 { | ||
log.Fatal("Volume already exists") | ||
} | ||
|
||
nv := xbase.Volume{Path: path, IsEnabled: true, IsAvailable: true} | ||
nv.Save() | ||
|
||
log.Info("Added new volume", path) | ||
} | ||
} | ||
|
||
func ActionRescanVolumes(c *cli.Context) { | ||
xbase.RescanVolumes() | ||
} | ||
|
||
func ActionSaveLocalInfo(c *cli.Context) { | ||
db, _ := xbase.GetDB() | ||
defer db.Close() | ||
|
||
var vol []xbase.Volume | ||
db.Find(&vol) | ||
|
||
for i := range vol { | ||
vol[i].SaveLocalInfo() | ||
} | ||
} | ||
|
||
func init() { | ||
RegisterCommand(cli.Command{ | ||
Name: "volume", | ||
Usage: "manage Volumes", | ||
Subcommands: []cli.Command{ | ||
{ | ||
Name: "add", | ||
Category: "volume", | ||
Usage: "add new volume", | ||
Action: ActionAddVolume, | ||
}, | ||
{ | ||
Name: "rescan", | ||
Category: "volume", | ||
Usage: "rescan Volumes", | ||
Action: ActionRescanVolumes, | ||
}, | ||
{ | ||
Name: "localinfo", | ||
Category: "volume", | ||
Usage: "save File info", | ||
Action: ActionSaveLocalInfo, | ||
}, | ||
}, | ||
}) | ||
} |
Oops, something went wrong.