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
88ee1ee9
Valider
88ee1ee9
rédigé
Il y a 4 ans
par
Tigriz
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
Matrixpack script: fix indexed palette, gif
parent
babb6536
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Modifications
1
Afficher les modifications d'espaces
En ligne
Côte à côte
Affichage de
1 fichier modifié
matrixpack.sh
+28
-15
28 ajouts, 15 suppressions
matrixpack.sh
avec
28 ajouts
et
15 suppressions
matrixpack.sh
+
28
−
15
Voir le fichier @
88ee1ee9
...
@@ -31,37 +31,50 @@ homeserver=$2
...
@@ -31,37 +31,50 @@ homeserver=$2
echo
-e
"Creating sticker pack
\0
33[94;1m
$packname
\0
33[0m
\n
homeserver=
\0
33[94m
$homeserver
\0
33[0m
\n
output=
\0
33[94m
$slug
\0
33[0m"
echo
-e
"Creating sticker pack
\0
33[94;1m
$packname
\0
33[0m
\n
homeserver=
\0
33[94m
$homeserver
\0
33[0m
\n
output=
\0
33[94m
$slug
\0
33[0m"
# Making result folder
# Making result folder
mkdir
$slug
if
!
[
-d
$slug
]
;
then
mkdir
$slug
;
fi
echo
-n
"{
\"
title
\"
:
\"
$packname
\"
,
\"
id
\"
:
\"
$slug
\"
,
\"
stickers
\"
:["
>
"
$slug
/
$slug
.json"
echo
-n
"{
\"
title
\"
:
\"
$packname
\"
,
\"
id
\"
:
\"
$slug
\"
,
\"
stickers
\"
:["
>
"
$slug
/
$slug
.json"
first
=
0
first
=
""
for
f
in
*
for
f
in
*
do
do
# Ignore folders
if
[
-f
"
$f
"
]
;
then
if
[
-f
"
$f
"
]
;
then
echo
-n
"
$f
: trimming and resizing"
echo
-n
"
$f
: "
convert
"
$f
"
-bordercolor
none
-border
1
"
$slug
/
$f
.png"
type
=
"png"
opts
=
"-type TrueColor PNG32:"
# Gif
if
[[
"
$f
"
==
*
.gif
]]
;
then
type
=
"gif"
opts
=
""
fi
# Trim, resize and remove indexed palette from image
echo
-n
"trimming and resizing"
convert
"
$f
"
-bordercolor
none
-border
1
"
$slug
/
$f
"
echo
-n
"."
echo
-n
"."
convert
"
$slug
/
$f
.png
"
-trim
+repage
"
$slug
/
$f
.png
"
convert
"
$slug
/
$f
"
-trim
+repage
"
$slug
/
$f
"
echo
-n
"."
echo
-n
"."
convert
-background
none
-gravity
center
"
$slug
/
$f
.png
"
-resize
"128x128>"
-extent
128x128
"
$slug
/
$f
.png
"
convert
-background
none
-gravity
center
"
$slug
/
$f
"
-resize
"128x128>"
-extent
128x128
$opts
"
$slug
/
$f
"
echo
-ne
".
\0
33[92mdone
\0
33[0m! "
echo
-ne
".
\0
33[92mdone
\0
33[0m! "
# First item in array
# First item in array
if
test
$first
!=
1
;
then
echo
-n
"
$first
"
>>
"
$slug
/
$slug
.json"
first
=
1
else
echo
-n
","
>>
"
$slug
/
$slug
.json"
fi
# Uploading image
# Uploading image
echo
-n
"uploading."
echo
-n
"uploading."
mxc
=
$(
curl
-s
-X
POST
-H
"Content-Type: image/
png
"
--data-binary
"@
$slug
/
$f
.png
"
"https://
$homeserver
/_matrix/media/r0/upload?access_token=
$token
"
| python3
-c
"import sys, json; print(json.load(sys.stdin)['content_uri'])"
)
mxc
=
$(
curl
-s
-X
POST
-H
"Content-Type: image/
$type
"
--data-binary
"@
$slug
/
$f
"
"https://
$homeserver
/_matrix/media/r0/upload?access_token=
$token
"
| python3
-c
"import sys, json; print(json.load(sys.stdin)['content_uri'])"
)
echo
-n
"."
echo
-n
"."
# Appending to json
# Appending to json
echo
-n
"{
\"
body
\"
:
\"
$f
\"
,
\"
info
\"
:{
\"
h
\"
:128,
\"
w
\"
:128,
\"
thumbnail_url
\"
:
\"
$mxc
\"
},
\"
msgtype
\"
:
\"
m.sticker
\"
,
\"
url
\"
:
\"
$mxc
\"
,
\"
id
\"
:
\"
$packname
-
$f
\"
}"
>>
"
$slug
/
$slug
.json"
echo
-n
"{
\"
body
\"
:
\"
$f
\"
,
\"
info
\"
:{
\"
mimetype
\"
:
\"
image/
$type
\"
,
\"
h
\"
:128,
\"
w
\"
:128,
\"
thumbnail_url
\"
:
\"
$mxc
\"
},
\"
msgtype
\"
:
\"
m.sticker
\"
,
\"
url
\"
:
\"
$mxc
\"
,
\"
id
\"
:
\"
$packname
-
$f
\"
}"
>>
"
$slug
/
$slug
.json"
first
=
","
echo
-e
".
\0
33[92msuccess
\0
33[0m!"
echo
-e
".
\0
33[92msuccess
\0
33[0m!"
fi
fi
done
done
montage
"
$slug
/*.png"
"
$slug
/preview.png"
montage
"
$slug
/*.png"
"preview.png"
rm
$slug
/
*
.png
mv
"preview.png"
"
$slug
"
echo
-ne
"###
$packname
\n
"
>
"
$slug
/README.md"
echo
-ne
"###
$packname
\n
"
>
"
$slug
/README.md"
echo
-n
"]}"
>>
"
$slug
/
$slug
.json"
echo
-n
"]}"
>>
"
$slug
/
$slug
.json"
cd
-
>
/dev/null
cd
-
>
/dev/null
echo
-e
"
\0
33[92;1mPack successfully created!
\n
Check
$dir
/
$slug
for output
\0
33[0m
"
echo
-e
"
\0
33[92;1mPack successfully created!
\n
\0
33[0mCheck
\0
33[94;1m
$dir
/
$slug
\0
33[0m
for output"
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