Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
ad301e0ff2 | |||
1f0aefb72d | |||
c71ad9cc79 |
@ -1,18 +1,25 @@
|
|||||||
# Unlock Music Project - CLI Edition
|
# Unlock Music Project - CLI Edition
|
||||||
|
|
||||||
Original: Web Edition https://github.com/ix64/unlock-music
|
Original: Web Edition https://github.com/ix64/unlock-music
|
||||||
|
|
||||||
- [Release Download](https://github.com/unlock-music/cli/releases/latest)
|
- [Release Download](https://github.com/unlock-music/cli/releases/latest)
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
- [x] All Algorithm Supported By `ix64/unlock-music`
|
- [x] All Algorithm Supported By `ix64/unlock-music`
|
||||||
- [ ] Complete Cover Image
|
- [ ] Complete Cover Image
|
||||||
- [ ] Parse Meta Data
|
- [ ] Parse Meta Data
|
||||||
- [ ] Complete Meta Data
|
- [ ] Complete Meta Data
|
||||||
|
|
||||||
## Hou to Build
|
## Hou to Build
|
||||||
|
|
||||||
- Requirements: **Golang 1.16**
|
- Requirements: **Golang 1.16**
|
||||||
|
|
||||||
1. Clone this repo `git clone https://github.com/unlock-music/cli && cd cli`
|
1. Clone this repo `git clone https://github.com/unlock-music/cli && cd cli`
|
||||||
2. Build the executable `go build ./cmd/um`
|
2. Build the executable `go build ./cmd/um`
|
||||||
|
|
||||||
## How to use
|
## How to use
|
||||||
|
|
||||||
|
- Drag the encrypted file to `um.exe` (Tested on Windows)
|
||||||
|
- Run: `./um [-o <output dir>] [-i] <input dir/file>`
|
||||||
- Use `./um -h` to show help menu
|
- Use `./um -h` to show help menu
|
||||||
|
@ -12,13 +12,12 @@ import (
|
|||||||
"github.com/unlock-music/cli/internal/logging"
|
"github.com/unlock-music/cli/internal/logging"
|
||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli/v2"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
"log"
|
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
var AppVersion = "0.0.3"
|
var AppVersion = "0.0.4"
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
app := cli.App{
|
app := cli.App{
|
||||||
@ -27,23 +26,36 @@ func main() {
|
|||||||
Usage: "Unlock your encrypted music file https://github.com/unlock-music/cli",
|
Usage: "Unlock your encrypted music file https://github.com/unlock-music/cli",
|
||||||
Version: AppVersion,
|
Version: AppVersion,
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
&cli.StringFlag{Name: "input", Aliases: []string{"i"}, Usage: "path to input file or dir", Required: true},
|
&cli.StringFlag{Name: "input", Aliases: []string{"i"}, Usage: "path to input file or dir", Required: false},
|
||||||
&cli.StringFlag{Name: "output", Aliases: []string{"o"}, Usage: "path to output dir", Required: true},
|
&cli.StringFlag{Name: "output", Aliases: []string{"o"}, Usage: "path to output dir", Required: false},
|
||||||
},
|
},
|
||||||
|
|
||||||
Action: appMain,
|
Action: appMain,
|
||||||
Copyright: "Copyright (c) 2020 Unlock Music https://github.com/unlock-music/cli/blob/master/LICENSE",
|
Copyright: "Copyright (c) 2020 - 2021 Unlock Music https://github.com/unlock-music/cli/blob/master/LICENSE",
|
||||||
HideHelpCommand: true,
|
HideHelpCommand: true,
|
||||||
UsageText: "um -i /path/to/input -o /path/to/output/dir",
|
UsageText: "um [-o /path/to/output/dir] [-i] /path/to/input",
|
||||||
}
|
}
|
||||||
err := app.Run(os.Args)
|
err := app.Run(os.Args)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
logging.Log().Fatal("run app failed", zap.Error(err))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func appMain(c *cli.Context) error {
|
func appMain(c *cli.Context) error {
|
||||||
input := c.String("input")
|
input := c.String("input")
|
||||||
|
if input == "" && c.Args().Present() {
|
||||||
|
input = c.Args().Get(c.Args().Len() - 1)
|
||||||
|
}
|
||||||
|
|
||||||
output := c.String("output")
|
output := c.String("output")
|
||||||
|
if output == "" {
|
||||||
|
var err error
|
||||||
|
output, err = os.Getwd()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
inputStat, err := os.Stat(input)
|
inputStat, err := os.Stat(input)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
Reference in New Issue
Block a user