Compare commits

..

4 Commits

Author SHA1 Message Date
28ca8cef60 docs: update readme about go version and how to build from source
All checks were successful
continuous-integration/drone/push Build is passing
2024-11-22 00:57:09 +09:00
2b0bd2985e chore: bump golang and dependency version
All checks were successful
continuous-integration/drone/push Build is passing
2024-11-22 00:50:52 +09:00
72ace9fc62 chore: bump version to v0.2.11
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
2024-11-05 16:56:40 +09:00
074e4f874f fix #108: rel path resolution in windows
All checks were successful
continuous-integration/drone/push Build is passing
2024-11-05 16:27:14 +09:00
6 changed files with 79 additions and 53 deletions

View File

@ -33,7 +33,7 @@ local StepGoBuild(GOOS, GOARCH) = {
],
name: 'go build %s/%s' % [GOOS, GOARCH],
image: 'golang:1.22',
image: 'golang:1.23',
environment: {
GOOS: GOOS,
GOARCH: GOARCH,
@ -54,7 +54,7 @@ local StepUploadArtifact(GOOS, GOARCH) = {
local pkgname = '${DRONE_REPO_NAME}-build',
name: 'upload artifact',
image: 'golang:1.22', // reuse golang:1.19 for curl
image: 'golang:1.23', // reuse golang:1.19 for curl
environment: {
DRONE_GITEA_SERVER: 'https://git.unlock-music.dev',
GITEA_API_KEY: { from_secret: 'GITEA_API_KEY' },
@ -83,7 +83,7 @@ local PipelineBuild(GOOS, GOARCH, RUN_TEST) = {
(
if RUN_TEST then [{
name: 'go test',
image: 'golang:1.22',
image: 'golang:1.23',
environment: {
GOPROXY: 'https://goproxy.io,direct',
},
@ -112,7 +112,7 @@ local PipelineRelease() = {
},
{
name: 'go test',
image: 'golang:1.22',
image: 'golang:1.23',
environment: {
GOPROXY: 'https://goproxy.io,direct',
},
@ -128,7 +128,7 @@ local PipelineRelease() = {
StepGoBuild('darwin', 'arm64'),
{
name: 'prepare root',
image: 'golang:1.22',
image: 'golang:1.23',
commands: [
'mv dist/*.tar.gz dist/*.zip ./',
],

View File

@ -10,7 +10,7 @@ steps:
- go test -v ./...
environment:
GOPROXY: https://goproxy.io,direct
image: golang:1.22
image: golang:1.23
name: go test
- commands:
- DIST_DIR=$(mktemp -d)
@ -23,7 +23,7 @@ steps:
GOARCH: amd64
GOOS: linux
GOPROXY: https://goproxy.io,direct
image: golang:1.22
image: golang:1.23
name: go build linux/amd64
- commands:
- curl --fail --include --user "um-release-bot:$GITEA_API_KEY" --upload-file "dist/um-linux-amd64-$(git
@ -35,7 +35,7 @@ steps:
DRONE_GITEA_SERVER: https://git.unlock-music.dev
GITEA_API_KEY:
from_secret: GITEA_API_KEY
image: golang:1.22
image: golang:1.23
name: upload artifact
trigger:
event:
@ -61,7 +61,7 @@ steps:
GOARCH: amd64
GOOS: windows
GOPROXY: https://goproxy.io,direct
image: golang:1.22
image: golang:1.23
name: go build windows/amd64
- commands:
- curl --fail --include --user "um-release-bot:$GITEA_API_KEY" --upload-file "dist/um-windows-amd64-$(git
@ -73,7 +73,7 @@ steps:
DRONE_GITEA_SERVER: https://git.unlock-music.dev
GITEA_API_KEY:
from_secret: GITEA_API_KEY
image: golang:1.22
image: golang:1.23
name: upload artifact
trigger:
event:
@ -99,7 +99,7 @@ steps:
GOARCH: amd64
GOOS: darwin
GOPROXY: https://goproxy.io,direct
image: golang:1.22
image: golang:1.23
name: go build darwin/amd64
- commands:
- curl --fail --include --user "um-release-bot:$GITEA_API_KEY" --upload-file "dist/um-darwin-amd64-$(git
@ -111,7 +111,7 @@ steps:
DRONE_GITEA_SERVER: https://git.unlock-music.dev
GITEA_API_KEY:
from_secret: GITEA_API_KEY
image: golang:1.22
image: golang:1.23
name: upload artifact
trigger:
event:
@ -130,7 +130,7 @@ steps:
- go test -v ./...
environment:
GOPROXY: https://goproxy.io,direct
image: golang:1.22
image: golang:1.23
name: go test
- commands:
- DIST_DIR=$(mktemp -d)
@ -143,7 +143,7 @@ steps:
GOARCH: amd64
GOOS: linux
GOPROXY: https://goproxy.io,direct
image: golang:1.22
image: golang:1.23
name: go build linux/amd64
- commands:
- DIST_DIR=$(mktemp -d)
@ -156,7 +156,7 @@ steps:
GOARCH: arm64
GOOS: linux
GOPROXY: https://goproxy.io,direct
image: golang:1.22
image: golang:1.23
name: go build linux/arm64
- commands:
- DIST_DIR=$(mktemp -d)
@ -168,7 +168,7 @@ steps:
GOARCH: "386"
GOOS: linux
GOPROXY: https://goproxy.io,direct
image: golang:1.22
image: golang:1.23
name: go build linux/386
- commands:
- DIST_DIR=$(mktemp -d)
@ -181,7 +181,7 @@ steps:
GOARCH: amd64
GOOS: windows
GOPROXY: https://goproxy.io,direct
image: golang:1.22
image: golang:1.23
name: go build windows/amd64
- commands:
- DIST_DIR=$(mktemp -d)
@ -194,7 +194,7 @@ steps:
GOARCH: arm64
GOOS: windows
GOPROXY: https://goproxy.io,direct
image: golang:1.22
image: golang:1.23
name: go build windows/arm64
- commands:
- DIST_DIR=$(mktemp -d)
@ -207,7 +207,7 @@ steps:
GOARCH: "386"
GOOS: windows
GOPROXY: https://goproxy.io,direct
image: golang:1.22
image: golang:1.23
name: go build windows/386
- commands:
- DIST_DIR=$(mktemp -d)
@ -220,7 +220,7 @@ steps:
GOARCH: amd64
GOOS: darwin
GOPROXY: https://goproxy.io,direct
image: golang:1.22
image: golang:1.23
name: go build darwin/amd64
- commands:
- DIST_DIR=$(mktemp -d)
@ -233,11 +233,11 @@ steps:
GOARCH: arm64
GOOS: darwin
GOPROXY: https://goproxy.io,direct
image: golang:1.22
image: golang:1.23
name: go build darwin/arm64
- commands:
- mv dist/*.tar.gz dist/*.zip ./
image: golang:1.22
image: golang:1.23
name: prepare root
- image: plugins/gitea-release
name: create release

View File

@ -14,12 +14,23 @@ Original: Web Edition https://git.unlock-music.dev/um/web
- [x] All Algorithm Supported By `unlock-music/web`
- [x] Complete Metadata & Cover Image
## Hou to Build
## Release
- Requirements: **Golang 1.19**
[Latest release](https://git.unlock-music.dev/um/cli/releases/latest).
## Install from source
- Requirements: **Golang 1.23.3**
1. run `go install unlock-music.dev/cli/cmd/um@master`
### Build from repo source
1. Pull repo source.
2. Build with `go build ./cmd/um`.
It will produce `um` or `um.exe` (Windows).
## How to use
- Drag the encrypted file to `um.exe` (Tested on Windows)

View File

@ -12,7 +12,6 @@ import (
"io"
"os"
"os/signal"
"path"
"path/filepath"
"runtime"
"runtime/debug"
@ -32,7 +31,7 @@ import (
"unlock-music.dev/cli/internal/utils"
)
var AppVersion = "v0.2.10"
var AppVersion = "v0.2.11"
var logger = setupLogger(false) // TODO: inject logger to application, instead of using global logger
@ -150,7 +149,7 @@ func appMain(c *cli.Context) (err error) {
if inputStat.IsDir() {
inputDir = input
} else {
inputDir = path.Dir(input)
inputDir = filepath.Dir(input)
}
inputDir, absErr = filepath.Abs(inputDir)
if absErr != nil {
@ -161,6 +160,7 @@ func appMain(c *cli.Context) (err error) {
// Default to where the input dir is
output = inputDir
}
logger.Debug("resolve input/output path", zap.String("inputDir", inputDir), zap.String("input", input), zap.String("output", output))
outputStat, err := os.Stat(output)
if err != nil {
@ -299,6 +299,8 @@ func (p *processor) processDir(inputDir string) error {
}
func (p *processor) processFile(filePath string) error {
p.logger.Debug("processFile", zap.String("file", filePath), zap.String("inputDir", p.inputDir))
allDec := common.GetDecoder(filePath, p.skipNoopDecoder)
if len(allDec) == 0 {
return errors.New("skipping while no suitable decoder")

24
go.mod
View File

@ -1,26 +1,26 @@
module unlock-music.dev/cli
go 1.19
go 1.23.3
require (
github.com/fsnotify/fsnotify v1.7.0
github.com/fsnotify/fsnotify v1.8.0
github.com/go-flac/flacpicture v0.3.0
github.com/go-flac/flacvorbis v0.2.0
github.com/go-flac/go-flac v1.0.0
github.com/samber/lo v1.39.0
github.com/urfave/cli/v2 v2.27.1
github.com/samber/lo v1.47.0
github.com/urfave/cli/v2 v2.27.5
go.uber.org/zap v1.27.0
golang.org/x/crypto v0.26.0
golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f
golang.org/x/text v0.17.0
unlock-music.dev/mmkv v0.0.0-20240424090133-31549c6a948b
golang.org/x/crypto v0.29.0
golang.org/x/exp v0.0.0-20241108190413-2d47ceb2692f
golang.org/x/text v0.20.0
unlock-music.dev/mmkv v0.1.0
)
require (
github.com/cpuguy83/go-md2man/v2 v2.0.4 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.5 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/xrash/smetrics v0.0.0-20240312152122-5f08fbb34913 // indirect
github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/sys v0.23.0 // indirect
google.golang.org/protobuf v1.33.0 // indirect
golang.org/x/sys v0.27.0 // indirect
google.golang.org/protobuf v1.35.2 // indirect
)

41
go.sum
View File

@ -1,8 +1,13 @@
github.com/cpuguy83/go-md2man/v2 v2.0.4 h1:wfIWP927BUkWJb2NmU/kNDYIBTh/ziUX91+lVfRxZq4=
github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/cpuguy83/go-md2man/v2 v2.0.5 h1:ZtcqGrnekaHpVLArFSe4HK5DoKx1T0rq2DwVB0alcyc=
github.com/cpuguy83/go-md2man/v2 v2.0.5/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA=
github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM=
github.com/fsnotify/fsnotify v1.8.0 h1:dAwr6QBTBZIkG8roQaJjGof0pp0EeF+tNV7YBP3F/8M=
github.com/fsnotify/fsnotify v1.8.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0=
github.com/go-flac/flacpicture v0.3.0 h1:LkmTxzFLIynwfhHiZsX0s8xcr3/u33MzvV89u+zOT8I=
github.com/go-flac/flacpicture v0.3.0/go.mod h1:DPbrzVYQ3fJcvSgLFp9HXIrEQEdfdk/+m0nQCzwodZI=
github.com/go-flac/flacvorbis v0.2.0 h1:KH0xjpkNTXFER4cszH4zeJxYcrHbUobz/RticWGOESs=
@ -10,38 +15,46 @@ github.com/go-flac/flacvorbis v0.2.0/go.mod h1:uIysHOtuU7OLGoCRG92bvnkg7QEqHx19q
github.com/go-flac/go-flac v1.0.0 h1:6qI9XOVLcO50xpzm3nXvO31BgDgHhnr/p/rER/K/doY=
github.com/go-flac/go-flac v1.0.0/go.mod h1:WnZhcpmq4u1UdZMNn9LYSoASpWOCMOoxXxcWEHSzkW8=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/samber/lo v1.39.0 h1:4gTz1wUhNYLhFSKl6O+8peW0v2F4BCY034GRpU9WnuA=
github.com/samber/lo v1.39.0/go.mod h1:+m/ZKRl6ClXCE2Lgf3MsQlWfh4bn1bz6CXEOxnEXnEA=
github.com/samber/lo v1.47.0 h1:z7RynLwP5nbyRscyvcD043DWYoOcYRv3mV8lBeqOCLc=
github.com/samber/lo v1.47.0/go.mod h1:RmDH9Ct32Qy3gduHQuKJ3gW1fMHAnE/fAzQuf6He5cU=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/urfave/cli/v2 v2.27.1 h1:8xSQ6szndafKVRmfyeUMxkNUJQMjL1F2zmsZ+qHpfho=
github.com/urfave/cli/v2 v2.27.1/go.mod h1:8qnjx1vcq5s2/wpsqoZFndg2CE5tNFyrTvS6SinrnYQ=
github.com/urfave/cli/v2 v2.27.5 h1:WoHEJLdsXr6dDWoJgMq/CboDmyY/8HMMH1fTECbih+w=
github.com/urfave/cli/v2 v2.27.5/go.mod h1:3Sevf16NykTbInEnD0yKkjDAeZDS0A6bzhBH5hrMvTQ=
github.com/xrash/smetrics v0.0.0-20240312152122-5f08fbb34913 h1:+qGGcbkzsfDQNPPe9UDgpxAWQrhbbBXOYJFQDq/dtJw=
github.com/xrash/smetrics v0.0.0-20240312152122-5f08fbb34913/go.mod h1:4aEEwZQutDLsQv2Deui4iYQ6DWTxR14g6m8Wv88+Xqk=
github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 h1:gEOO8jv9F4OT7lGCjxCBTO/36wtF6j2nSip77qHd4x4=
github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1/go.mod h1:Ohn+xnUBiLI6FVj/9LpzZWtj1/D6lUovWYBkxHVV3aM=
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8=
go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30=
golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M=
golang.org/x/crypto v0.26.0 h1:RrRspgV4mU+YwB4FYnuBoKsUapNIL5cohGAmSH3azsw=
golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54=
golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f h1:99ci1mjWVBWwJiEKYY6jWa4d2nTQVIEhZIptnrVb1XY=
golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f/go.mod h1:/lliqkxwWAhPjf5oSOIJup2XcqJaw8RGS6k3TGEc7GI=
golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o=
golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/crypto v0.29.0 h1:L5SG1JTTXupVV3n6sUqMTeWbjAyfPwoda2DLX8J8FrQ=
golang.org/x/crypto v0.29.0/go.mod h1:+F4F4N5hv6v38hfeYwTdx20oUvLLc+QfrE9Ax9HtgRg=
golang.org/x/exp v0.0.0-20241108190413-2d47ceb2692f h1:XdNn9LlyWAhLVp6P/i8QYBW+hlyhrhei9uErw2B5GJo=
golang.org/x/exp v0.0.0-20241108190413-2d47ceb2692f/go.mod h1:D5SMRVC3C2/4+F/DB1wZsLRnSNimn2Sp/NPsCrsv8ak=
golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM=
golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/sys v0.27.0 h1:wBqf8DvsY9Y/2P8gAfPDEYNuS30J4lPHJxXSb/nJZ+s=
golang.org/x/sys v0.27.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc=
golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI=
google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
golang.org/x/text v0.20.0 h1:gK/Kv2otX8gz+wn7Rmb3vT96ZwuoxnQlY+HlJVj7Qug=
golang.org/x/text v0.20.0/go.mod h1:D4IsuqiFMhST5bX19pQ9ikHC2GsaKyk/oF+pn3ducp4=
google.golang.org/protobuf v1.35.2 h1:8Ar7bF+apOIoThw1EdZl0p1oWvMqTHmpA2fRTyZO8io=
google.golang.org/protobuf v1.35.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
unlock-music.dev/mmkv v0.0.0-20240424090133-0953e6901f3a h1:UW0sxgwsfGGC/SrKvvAbZ4HZyOQ3fqs8qr3lBxG6Fzo=
unlock-music.dev/mmkv v0.0.0-20240424090133-0953e6901f3a/go.mod h1:qr34SM3x8xRxyUfGzefH/rSi+DUXkQZcSfXY/yfuTeo=
unlock-music.dev/mmkv v0.0.0-20240424090133-31549c6a948b h1:VIJ0mDqj0OgX1ZvL9gbAH8kkqyrDlpVt5yUeGYSJ1/s=
unlock-music.dev/mmkv v0.0.0-20240424090133-31549c6a948b/go.mod h1:qr34SM3x8xRxyUfGzefH/rSi+DUXkQZcSfXY/yfuTeo=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
unlock-music.dev/mmkv v0.1.0 h1:hgUHo0gJVoiKZ6bOcFOw2LHFqNiefIe+jb5o0OyL720=
unlock-music.dev/mmkv v0.1.0/go.mod h1:qr34SM3x8xRxyUfGzefH/rSi+DUXkQZcSfXY/yfuTeo=