Skip to content
GitLab
Explorer
Connexion
Navigation principale
Rechercher ou aller à…
Projet
matrix-stickers
Gestion
Activité
Membres
Labels
Programmation
Tickets
Tableaux des tickets
Jalons
Wiki
Wiki externe
Code
Requêtes de fusion
Dépôt
Branches
Validations
Étiquettes
Graphe du dépôt
Comparer les révisions
Extraits de code
Compilation
Pipelines
Jobs
Planifications de pipeline
Artéfacts
Déploiement
Releases
Registre de paquets
Registre de conteneurs
Registre de modèles
Opération
Environnements
Modules Terraform
Surveillance
Incidents
Analyse
Données d'analyse des chaînes de valeur
Analyse des contributeurs
Données d'analyse CI/CD
Données d'analyse du dépôt
Expériences du modèle
Aide
Aide
Support
Documentation de GitLab
Comparer les forfaits GitLab
Forum de la communauté GitLab
Contribuer à GitLab
Donner votre avis
Raccourcis clavier
?
Extraits de code
Groupes
Projets
Afficher davantage de fils d'Ariane
Elliu
matrix-stickers
Validations
c4064db6
Valider
c4064db6
rédigé
Il y a 4 ans
par
Kubat
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
Finished pack command, with working upload
parent
4a65148e
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Modifications
2
Afficher les modifications d'espaces
En ligne
Côte à côte
Affichage de
2 fichiers modifiés
matrixpack.sh
+5
-5
5 ajouts, 5 suppressions
matrixpack.sh
stpkg
+24
-34
24 ajouts, 34 suppressions
stpkg
avec
29 ajouts
et
39 suppressions
matrixpack.sh
+
5
−
5
Voir le fichier @
c4064db6
Ce diff est replié.
Cliquez pour l'agrandir.
stpkg
+
24
−
34
Voir le fichier @
c4064db6
...
@@ -380,9 +380,6 @@ __pack() {
...
@@ -380,9 +380,6 @@ __pack() {
local
NAME
=
`
echo
"
$FILE
"
|
cut
-f1
-d
'.'
`
local
NAME
=
`
echo
"
$FILE
"
|
cut
-f1
-d
'.'
`
local
DEST
=
"
$DEST_FOLDER
/
$NAME
.
$TYPE
"
local
DEST
=
"
$DEST_FOLDER
/
$NAME
.
$TYPE
"
# For the report
echo
-e
"
$NAME
$TYPE
$WIDTH
$HEIGHT
"
# For the progress
# For the progress
progress
"(
$CURRENT_FILE
/
$TOTAL_FILES
)
$NAME
"
progress
"(
$CURRENT_FILE
/
$TOTAL_FILES
)
$NAME
"
CURRENT_FILE
=
$[
$CURRENT_FILE
+ 1
]
CURRENT_FILE
=
$[
$CURRENT_FILE
+ 1
]
...
@@ -397,12 +394,18 @@ __pack() {
...
@@ -397,12 +394,18 @@ __pack() {
# Add a ',' only if it's not the first in the array
# Add a ',' only if it's not the first in the array
echo
-n
"
$FIRST_IN_ARRAY
"
>>
$DEST_INDEX
echo
-n
"
$FIRST_IN_ARRAY
"
>>
$DEST_INDEX
FIRST_IN_ARRAY
=
","
# Upload TODO
# Upload
local
MXC
=
1
# TODO: Use jq here
local
MXC
=
`
curl
-s
-X
POST
-H
"Content-Type: image/
$TYPE
"
--data-binary
"@
$DEST
"
\
"https://
$STPKG_HOMESERV
/_matrix/media/r0/upload?access_token=
$STPKG_TOKEN
"
|
\
python
-c
"import sys, json; print(json.load(sys.stdin)['content_uri'])"
\
||
die
"Failed to upload sticker
$NAME
for pack
$PACK_NAME
to
$STPKG_HOMESERV
"
`
progress_dot
# Calculate the 128x128 format
# Calculate the 128x128 format
local
INIT_WIDTH
=
$WIDTH
local
INIT_HEIGHT
=
$HEIGHT
convert
"
$DEST
"
-resize
"128x128"
"
$DEST
"
1>&2
\
convert
"
$DEST
"
-resize
"128x128"
"
$DEST
"
1>&2
\
&&
progress_dot
||
die
"
$NAME
failed at 128x128 resize"
&&
progress_dot
||
die
"
$NAME
failed at 128x128 resize"
WIDTH
=
$(
identify
-format
"%w"
"
$DEST
"
)
>
/dev/null
WIDTH
=
$(
identify
-format
"%w"
"
$DEST
"
)
>
/dev/null
...
@@ -413,13 +416,18 @@ __pack() {
...
@@ -413,13 +416,18 @@ __pack() {
"
\"
w
\"
:
$WIDTH
,
\"
thumbnail_url
\"
:
\"
$MXC
\"
},
\"
msgtype
\"
:
\"
m.sticker
\"
,
\"
url
\"
:
\"
$MXC
\"
"
\
"
\"
w
\"
:
$WIDTH
,
\"
thumbnail_url
\"
:
\"
$MXC
\"
},
\"
msgtype
\"
:
\"
m.sticker
\"
,
\"
url
\"
:
\"
$MXC
\"
"
\
",
\"
id
\"
:
\"
$PACK_NAME
-
$NAME
\"
}"
>>
$DEST_INDEX
",
\"
id
\"
:
\"
$PACK_NAME
-
$NAME
\"
}"
>>
$DEST_INDEX
# For the report
[
"x
$FIRST_IN_ARRAY
"
=
"x"
]
&&
echo
-e
"StickerName MXC Type Width Height"
FIRST_IN_ARRAY
=
","
echo
-e
"
$NAME
(
$MXC
)
$TYPE
$INIT_WIDTH
$INIT_HEIGHT
"
progress_reset
progress_reset
done
| column
-t
|
sort
done
| column
-t
# Create the preview
# Create the preview
montage
"
$DEST_FOLDER
/*.{png,gif}"
-background
none
"
$DEST_FOLDER
/preview.png"
montage
"
$DEST_FOLDER
/*.{png,gif}"
-background
none
"
$DEST_FOLDER
/preview.png"
echo
-ne
"#
$PACK_NAME
\n
"
>
"
$DEST_FOLDER
/README.md"
echo
-ne
"#
$PACK_NAME
\n
"
>
"
$DEST_FOLDER
/README.md"
find
$DEST_FOLDER
-type
f
\(
!
-name
"preview.png"
\)
-exec
rm
{}
\;
find
$DEST_FOLDER
-type
f
\(
!
-name
"preview.png"
-and
!
-name
"
$PACK_NAME
.json"
\)
-exec
rm
{}
\;
echo
-n
"]}"
>>
$DEST_INDEX
echo
-n
"]}"
>>
$DEST_INDEX
info
"Pack created, you can now commit it and create a MR to share it with other users"
info
"Pack created, you can now commit it and create a MR to share it with other users"
...
@@ -431,29 +439,11 @@ __pack() {
...
@@ -431,29 +439,11 @@ __pack() {
[
"x
$1
"
=
"x"
]
&&
usage
[
"x
$1
"
=
"x"
]
&&
usage
case
"
$1
"
in
case
"
$1
"
in
update
)
update
)
__update
;;
__update
list
)
shift
;
__list
$*
;;
;;
add
)
shift
;
__add
$*
;;
list
)
del
)
shift
;
__del
$*
;;
shift
default
)
__default
;;
__list
$*
pack
)
shift
;
__pack
$*
;;
;;
*
)
usage
;;
add
)
shift
__add
$*
;;
del
)
shift
__del
$*
;;
default
)
__default
;;
pack
)
shift
__pack
$*
;;
*
)
usage
;;
esac
esac
Ce diff est replié.
Cliquez pour l'agrandir.
Aperçu
0%
Chargement en cours
Veuillez réessayer
ou
joindre un nouveau fichier
.
Annuler
You are about to add
0
people
to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Enregistrer le commentaire
Annuler
Veuillez vous
inscrire
ou vous
se connecter
pour commenter