mirror of
https://github.com/celogeek/piwigo-cli.git
synced 2025-05-25 02:02:37 +02:00
handle or ignore error
This commit is contained in:
parent
40a79e8e6b
commit
efc5a9793e
@ -7,5 +7,8 @@ type CategoriesGroup struct {
|
||||
var categoriesGroup CategoriesGroup
|
||||
|
||||
func init() {
|
||||
parser.AddCommand("categories", "Categories management", "", &categoriesGroup)
|
||||
_, err := parser.AddCommand("categories", "Categories management", "", &categoriesGroup)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
@ -55,5 +55,8 @@ func (c *GetInfosCommand) Execute(args []string) error {
|
||||
}
|
||||
|
||||
func init() {
|
||||
parser.AddCommand("getinfos", "Get general information", "", &getInfosCommand)
|
||||
_, err := parser.AddCommand("getinfos", "Get general information", "", &getInfosCommand)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
@ -11,5 +11,8 @@ type ImagesGroup struct {
|
||||
var imagesGroup ImagesGroup
|
||||
|
||||
func init() {
|
||||
parser.AddCommand("images", "Images management", "", &imagesGroup)
|
||||
_, err := parser.AddCommand("images", "Images management", "", &imagesGroup)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ func (c *ImagesListCommand) Execute(args []string) error {
|
||||
|
||||
bar := progressbar.Default(1, "listing")
|
||||
progressbar.OptionOnCompletion(func() {
|
||||
os.Stderr.WriteString("\n")
|
||||
_, _ = os.Stderr.WriteString("\n")
|
||||
})(bar)
|
||||
for page := 0; ; page++ {
|
||||
var resp ImagesListResult
|
||||
@ -95,14 +95,14 @@ func (c *ImagesListCommand) Execute(args []string) error {
|
||||
}
|
||||
rootTree.AddPath(filename)
|
||||
}
|
||||
bar.Add(1)
|
||||
_ = bar.Add(1)
|
||||
}
|
||||
|
||||
if resp.Paging.Count < resp.Paging.PerPage {
|
||||
break
|
||||
}
|
||||
}
|
||||
bar.Close()
|
||||
_ = bar.Close()
|
||||
|
||||
var results chan string
|
||||
if c.Tree {
|
||||
|
@ -134,7 +134,7 @@ func (c *ImagesTagCommand) Execute(args []string) error {
|
||||
|
||||
if len(sel) == 0 {
|
||||
exit := false
|
||||
survey.AskOne(&survey.Confirm{
|
||||
_ = survey.AskOne(&survey.Confirm{
|
||||
Message: "Selection is empty, exit:",
|
||||
Default: false,
|
||||
}, &exit)
|
||||
@ -144,7 +144,7 @@ func (c *ImagesTagCommand) Execute(args []string) error {
|
||||
}
|
||||
|
||||
confirmSel := false
|
||||
survey.AskOne(&survey.Confirm{
|
||||
_ = survey.AskOne(&survey.Confirm{
|
||||
Message: "Confirm:",
|
||||
Default: true,
|
||||
}, &confirmSel)
|
||||
|
@ -9,5 +9,8 @@ type MethodGroup struct {
|
||||
var methodGroup MethodGroup
|
||||
|
||||
func init() {
|
||||
parser.AddCommand("method", "Reflexion management", "", &methodGroup)
|
||||
_, err := parser.AddCommand("method", "Reflexion management", "", &methodGroup)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
@ -8,5 +8,8 @@ type SessionGroup struct {
|
||||
var sessionGroup SessionGroup
|
||||
|
||||
func init() {
|
||||
parser.AddCommand("session", "Session management", "", &sessionGroup)
|
||||
_, err := parser.AddCommand("session", "Session management", "", &sessionGroup)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
@ -106,7 +106,9 @@ func (p *Piwigo) Upload(file *piwigotools.FileToUpload, stat *piwigotools.FileTo
|
||||
if hasVideoJS {
|
||||
switch *file.Ext() {
|
||||
case "ogg", "ogv", "mp4", "m4v", "webm", "webmv":
|
||||
p.VideoJSSync(resp.ImageId)
|
||||
if err := p.VideoJSSync(resp.ImageId); err != nil {
|
||||
stat.Error("VideoJSSync", *file.FullPath(), err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,9 @@ func (p *Piwigo) GetStatus() (*StatusResponse, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
p.Post("pwg.plugins.getList", nil, &resp.Plugins)
|
||||
if err := p.Post("pwg.plugins.getList", nil, &resp.Plugins); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if resp.User == p.Username {
|
||||
return resp, nil
|
||||
|
@ -178,9 +178,9 @@ func (f *FileToUpload) Base64BuildChunk() (chan *FileToUploadChunk, error) {
|
||||
break
|
||||
}
|
||||
bf.Size += int64(n)
|
||||
b64.Write(b[:n])
|
||||
_, _ = b64.Write(b[:n])
|
||||
}
|
||||
b64.Close()
|
||||
_ = b64.Close()
|
||||
if bf.Size > 0 {
|
||||
out <- bf
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ func (t Tags) Selector(exclude *regexp.Regexp, keepFilter bool, keepPreviousAnsw
|
||||
return func() Tags {
|
||||
answer := []string{}
|
||||
|
||||
survey.AskOne(&survey.MultiSelect{
|
||||
_ = survey.AskOne(&survey.MultiSelect{
|
||||
Message: "Tags:",
|
||||
Options: options,
|
||||
PageSize: 20,
|
||||
|
Loading…
x
Reference in New Issue
Block a user