From f76d6bb2f7691896535b9f91eea6742c3321e02f Mon Sep 17 00:00:00 2001 From: celogeek <65178+celogeek@users.noreply.github.com> Date: Thu, 27 Jan 2022 20:01:38 +0100 Subject: [PATCH] move doc to readme --- README.md | 155 ++++++++++++++++++++++++++----- cmd/piwigo-cli/doc.go | 14 +-- cmd/piwigo-cli/general.go | 31 ------- cmd/piwigo-cli/images.go | 12 --- cmd/piwigo-cli/images_details.go | 43 --------- cmd/piwigo-cli/images_list.go | 37 -------- 6 files changed, 132 insertions(+), 160 deletions(-) diff --git a/README.md b/README.md index b33eb45..42332fe 100644 --- a/README.md +++ b/README.md @@ -1,65 +1,170 @@ -# piwigo-cli +# Piwigo Cli + +## Installation This tools allow you to interact with your Piwigo Instance. - -## Install - +Installation: ``` -go install github.com/celogeek/piwigo-cli/cmd/piwigo-cli@latest +$ go install github.com/celogeek/piwigo-cli/cmd/piwigo-cli@latest ``` -## Quickstart +## Help + +To get help: +``` +$ piwigo-cli -h +``` + +## QuickStart ### Login +First connect to your instance: ``` -piwigo-cli session login -u URL -l USER -p PASSWORD +$ piwigo-cli session login -u URL -l USER -p PASSWORD ``` -### Check your status +### Status +Then check your status ``` -piwigo-cli session status +$ piwigo-cli session status ``` -### List Categories +## Commands + +### General commands ``` -piwigo-cli categories list +$ piwigo-cli getinfos ``` -### List images in a category and sub categories +### GetInfos Command + +General information of your instance. ``` -piwigo-cli images list -c 4 -r +$ piwigo-cli getinfos + +┌───────────────────┬─────────────────────┐ +│ KEY │ VALUE │ +├───────────────────┼─────────────────────┤ +│ version │ 12.2.0 │ +│ nb_elements │ 39664 │ +│ nb_categories │ 816 │ +│ nb_virtual │ 816 │ +│ nb_physical │ 0 │ +│ nb_image_category │ 39714 │ +│ nb_tags │ 73 │ +│ nb_image_tag │ 24024 │ +│ nb_users │ 3 │ +│ nb_groups │ 1 │ +│ nb_comments │ 0 │ +│ first_date │ 2021-08-27 20:15:15 │ +│ cache_size │ 4242 │ +└───────────────────┴─────────────────────┘ ``` -With a tree style +### Categories List Command + +List the categories. ``` -piwigo-cli images list -c 4 -r -t +$ piwigo-cli categories list + +┌──────┬────────────────────────────────────────────────────────────────────┬────────┬──────────────┬──────────────────────────────────────────────────────┐ +│ ID │ NAME │ IMAGES │ TOTAL IMAGES │ URL │ +├──────┼────────────────────────────────────────────────────────────────────┼────────┼──────────────┼──────────────────────────────────────────────────────┤ +│ 4 │ 2021 │ 0 │ 1520 │ https://yourphotos/index.php?/category/4 │ +│ 677 │ 2021/Animals │ 0 │ 49 │ https://yourphotos/index.php?/category/677 │ +│ 24 │ 2021/Animals/Cats │ 29 │ 32 │ https://yourphotos/index.php?/category/24 │ +│ 760 │ 2021/Animals/Cats/Videos │ 3 │ 3 │ https://yourphotos/index.php?/category/760 │ +└──────┴────────────────────────────────────────────────────────────────────┴────────┴──────────────┴──────────────────────────────────────────────────────┘ ``` -### Upload a tree of images +### Images List Command -This will also create all the categories using the directory name. +List the images of a category. + +Recursive list: -In this example, the category 4 (-c 4) is 2021 ``` -images upload-tree -d ~/Downloads/2021 -j4 -c 4 +$ piwigo-cli images list -r + +Category1/SubCategory1/IMG_00001.jpeg +Category1/SubCategory1/IMG_00002.jpeg +Category1/SubCategory1/IMG_00003.jpeg +Category1/SubCategory1/IMG_00004.jpeg +Category1/SubCategory2/IMG_00005.jpeg +Category1/SubCategory2/IMG_00006.jpeg +Category2/SubCategory1/IMG_00007.jpeg ``` -This will create the categories based on your local directories, and upload only the images that doen't already exists somewhere else. +Specify a category: +``` +$ piwigo-cli images list -r -c 2 -The check of the images existance use MD5 checksum. If you change the metadata of the images, it will reupload the image as a new one. +Category2/SubCategory1/IMG_00007.jpeg +``` -You can remove the duplicates in piwigo by looking for similar photo with Name & Date & Size. Just pickup the first one so when you try to upload again, it won't reupload the images. +Tree view: -## Doc +``` +$ piwigo-cli images list -r -c 1 -t -You can checkout the go doc here: +. +├── SubCategory1 +│ ├── IMG_00001.jpeg +│ ├── IMG_00002.jpeg +│ ├── IMG_00003.jpeg +│ └── IMG_00004.jpeg +└── SubCategory2 + ├── IMG_00005.jpeg + └── IMG_00006.jpeg +``` -https://pkg.go.dev/github.com/celogeek/piwigo-cli/cmd/piwigo-cli +### Images Details Command + +Get details of an image. It supports the birthday plugin. + +``` +$ piwigo-cli images details -i 38062 + +┌───────────────┬───────────────────────────────────────────────────────────────────────────┐ +│ KEY │ VALUE │ +├───────────────┼───────────────────────────────────────────────────────────────────────────┤ +│ Id │ 38062 │ +│ Md5 │ 6ad2abade6d5460181890e2bad671002 │ +│ Name │ 2006 04 14 015 │ +│ DateAvailable │ 2021-11-25 20:25:05 │ +│ DateCreation │ 2006-04-14 04:14:00 │ +│ LastModified │ 2022-01-01 23:11:48 │ +│ Width │ 1984 │ +│ Height │ 1488 │ +│ Url │ https://yourphotos/picture.php?/38062 │ +│ ImageUrl │ https://yourphotos/upload/2021/11/25/20211125202505-6ad2abad.jpg │ +│ Filename │ 2006_04_14_015.jpeg │ +│ Filesize │ 513 │ +│ Categories │ 2007 │ +│ Tags │ User Tag 1 (46 years old) │ +│ │ User Tag 2 (8 months old) │ +│ │ User Tag 3 (48 years old) │ +└───────────────┴───────────────────────────────────────────────────────────────────────────┘ +Derivatives: +┌─────────┬───────┬────────┬──────────────────────────────────────────────────────────────────────────────────────┐ +│ NAME │ WIDTH │ HEIGHT │ URL │ +├─────────┼───────┼────────┼──────────────────────────────────────────────────────────────────────────────────────┤ +│ thumb │ 144 │ 108 │ https://yourphotos/i.php?/upload/2021/11/25/20211125202505-6ad2abad-th.jpg │ +│ xsmall │ 432 │ 324 │ https://yourphotos/i.php?/upload/2021/11/25/20211125202505-6ad2abad-xs.jpg │ +│ xxlarge │ 1656 │ 1242 │ https://yourphotos/_data/i/upload/2021/11/25/20211125202505-6ad2abad-xx.jpg │ +│ square │ 120 │ 120 │ https://yourphotos/_data/i/upload/2021/11/25/20211125202505-6ad2abad-sq.jpg │ +│ small │ 576 │ 432 │ https://yourphotos/_data/i/upload/2021/11/25/20211125202505-6ad2abad-sm.jpg │ +│ medium │ 792 │ 594 │ https://yourphotos/_data/i/upload/2021/11/25/20211125202505-6ad2abad-me.jpg │ +│ large │ 1008 │ 756 │ https://yourphotos/i.php?/upload/2021/11/25/20211125202505-6ad2abad-la.jpg │ +│ xlarge │ 1224 │ 918 │ https://yourphotos/_data/i/upload/2021/11/25/20211125202505-6ad2abad-xl.jpg │ +│ 2small │ 240 │ 180 │ https://yourphotos/i.php?/upload/2021/11/25/20211125202505-6ad2abad-2s.jpg │ +└─────────┴───────┴────────┴──────────────────────────────────────────────────────────────────────────────────────┘ +``` ## License diff --git a/cmd/piwigo-cli/doc.go b/cmd/piwigo-cli/doc.go index 594da29..e014bed 100644 --- a/cmd/piwigo-cli/doc.go +++ b/cmd/piwigo-cli/doc.go @@ -5,19 +5,9 @@ This tools allow you to interact with your Piwigo Instance. Installation: go install github.com/celogeek/piwigo-cli/cmd/piwigo-cli@latest -Help +Checkout the readme for usage example. -To get help: - piwigo-cli -h +https://github.com/celogeek/piwigo-cli/#readme -QuickStart - -Login - -First connect to your instance: - piwigo-cli session login -u URL -l USER -p PASSWORD - -Then check your status - piwigo-cli session status */ package main diff --git a/cmd/piwigo-cli/general.go b/cmd/piwigo-cli/general.go index 09a18bb..8c3b86a 100644 --- a/cmd/piwigo-cli/general.go +++ b/cmd/piwigo-cli/general.go @@ -1,34 +1,3 @@ -/* -General Commands - -General commands - - $ piwigo-cli getinfos - -GetInfos Command - -General information of your instance. - - $ piwigo-cli getinfos - - ┌───────────────────┬─────────────────────┐ - │ KEY │ VALUE │ - ├───────────────────┼─────────────────────┤ - │ version │ 12.2.0 │ - │ nb_elements │ 39664 │ - │ nb_categories │ 816 │ - │ nb_virtual │ 816 │ - │ nb_physical │ 0 │ - │ nb_image_category │ 39714 │ - │ nb_tags │ 73 │ - │ nb_image_tag │ 24024 │ - │ nb_users │ 3 │ - │ nb_groups │ 1 │ - │ nb_comments │ 0 │ - │ first_date │ 2021-08-27 20:15:15 │ - │ cache_size │ 4242 │ - └───────────────────┴─────────────────────┘ -*/ package main import ( diff --git a/cmd/piwigo-cli/images.go b/cmd/piwigo-cli/images.go index d375edf..30fead8 100644 --- a/cmd/piwigo-cli/images.go +++ b/cmd/piwigo-cli/images.go @@ -1,15 +1,3 @@ -/* -Images Group Commands - -This is a group of commands to manipulate the images: - - piwigo-cli images list - piwigo-cli images details - piwigo-cli images upload - piwigo-cli images upload-tree - piwigo-cli images tag - -*/ package main type ImagesGroup struct { diff --git a/cmd/piwigo-cli/images_details.go b/cmd/piwigo-cli/images_details.go index 5e74ac1..14b927c 100644 --- a/cmd/piwigo-cli/images_details.go +++ b/cmd/piwigo-cli/images_details.go @@ -1,46 +1,3 @@ -/* -Images Details Command - -Get details of an image. It supports the birthday plugin. - - $ piwigo-cli images details -i 38062 - - ┌───────────────┬───────────────────────────────────────────────────────────────────────────┐ - │ KEY │ VALUE │ - ├───────────────┼───────────────────────────────────────────────────────────────────────────┤ - │ Id │ 38062 │ - │ Md5 │ 6ad2abade6d5460181890e2bad671002 │ - │ Name │ 2006 04 14 015 │ - │ DateAvailable │ 2021-11-25 20:25:05 │ - │ DateCreation │ 2006-04-14 04:14:00 │ - │ LastModified │ 2022-01-01 23:11:48 │ - │ Width │ 1984 │ - │ Height │ 1488 │ - │ Url │ https://yourphotos/picture.php?/38062 │ - │ ImageUrl │ https://yourphotos/upload/2021/11/25/20211125202505-6ad2abad.jpg │ - │ Filename │ 2006_04_14_015.jpeg │ - │ Filesize │ 513 │ - │ Categories │ 2007 │ - │ Tags │ User Tag 1 (46 years old) │ - │ │ User Tag 2 (8 months old) │ - │ │ User Tag 3 (48 years old) │ - └───────────────┴───────────────────────────────────────────────────────────────────────────┘ - Derivatives: - ┌─────────┬───────┬────────┬──────────────────────────────────────────────────────────────────────────────────────┐ - │ NAME │ WIDTH │ HEIGHT │ URL │ - ├─────────┼───────┼────────┼──────────────────────────────────────────────────────────────────────────────────────┤ - │ thumb │ 144 │ 108 │ https://yourphotos/i.php?/upload/2021/11/25/20211125202505-6ad2abad-th.jpg │ - │ xsmall │ 432 │ 324 │ https://yourphotos/i.php?/upload/2021/11/25/20211125202505-6ad2abad-xs.jpg │ - │ xxlarge │ 1656 │ 1242 │ https://yourphotos/_data/i/upload/2021/11/25/20211125202505-6ad2abad-xx.jpg │ - │ square │ 120 │ 120 │ https://yourphotos/_data/i/upload/2021/11/25/20211125202505-6ad2abad-sq.jpg │ - │ small │ 576 │ 432 │ https://yourphotos/_data/i/upload/2021/11/25/20211125202505-6ad2abad-sm.jpg │ - │ medium │ 792 │ 594 │ https://yourphotos/_data/i/upload/2021/11/25/20211125202505-6ad2abad-me.jpg │ - │ large │ 1008 │ 756 │ https://yourphotos/i.php?/upload/2021/11/25/20211125202505-6ad2abad-la.jpg │ - │ xlarge │ 1224 │ 918 │ https://yourphotos/_data/i/upload/2021/11/25/20211125202505-6ad2abad-xl.jpg │ - │ 2small │ 240 │ 180 │ https://yourphotos/i.php?/upload/2021/11/25/20211125202505-6ad2abad-2s.jpg │ - └─────────┴───────┴────────┴──────────────────────────────────────────────────────────────────────────────────────┘ - -*/ package main import ( diff --git a/cmd/piwigo-cli/images_list.go b/cmd/piwigo-cli/images_list.go index f2046b2..e88454f 100644 --- a/cmd/piwigo-cli/images_list.go +++ b/cmd/piwigo-cli/images_list.go @@ -1,40 +1,3 @@ -/* -Images List Command - -List the images of a category. - -Recursive list: - - $ piwigo-cli images list -r - - Category1/SubCategory1/IMG_00001.jpeg - Category1/SubCategory1/IMG_00002.jpeg - Category1/SubCategory1/IMG_00003.jpeg - Category1/SubCategory1/IMG_00004.jpeg - Category1/SubCategory2/IMG_00005.jpeg - Category1/SubCategory2/IMG_00006.jpeg - Category2/SubCategory1/IMG_00007.jpeg - -Specify a category: - - $ piwigo-cli images list -r -c 2 - - Category2/SubCategory1/IMG_00007.jpeg - -Tree view: - $ piwigo-cli images list -r -c 1 -t - - . - ├── SubCategory1 - │   ├── IMG_00001.jpeg - │   ├── IMG_00002.jpeg - │   ├── IMG_00003.jpeg - │   └── IMG_00004.jpeg - └── SubCategory2 - ├── IMG_00005.jpeg - └── IMG_00006.jpeg - -*/ package main import (