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
Déploiement
Releases
Registre de paquets
Registre de conteneur
Registre de modèles
Opération
Modules Terraform
Surveillance
Incidents
Analyse
Données d'analyse des chaînes de valeur
Analyse des contributeurs
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é
Contribuer à GitLab
Donner votre avis
Raccourcis clavier
?
Extraits de code
Groupes
Projets
Afficher davantage de fils d'Ariane
Alexandre MORIGNOT
Matrix Stickers
Validations
a847bf0f
Valider
a847bf0f
rédigé
4 years ago
par
Miryuni
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
Added colors on the scripts
parent
55373b42
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Modifications
2
Masquer les modifications d'espaces
En ligne
Côte à côte
Affichage de
2 fichiers modifiés
matrixpack.sh
+1
-0
1 ajout, 0 suppression
matrixpack.sh
updatePacks.py
+8
-5
8 ajouts, 5 suppressions
updatePacks.py
avec
9 ajouts
et
5 suppressions
matrixpack.sh
+
1
−
0
Voir le fichier @
a847bf0f
...
...
@@ -141,6 +141,7 @@ do
convert
"
$slug
/tmp/
$f
.
$type
"
-resize
"128x128"
"
$slug
/tmp/size"
width
=
$(
identify
-format
"%w"
"
$slug
/tmp/size"
[
0]
)
>
/dev/null
height
=
$(
identify
-format
"%h"
"
$slug
/tmp/size"
[
0]
)
>
/dev/null
# Appending to json
echo
-n
"{
\"
body
\"
:
\"
$f
\"
,
\"
info
\"
:{
\"
mimetype
\"
:
\"
image/
$type
\"
,
\"
h
\"
:
$height
,
\"
w
\"
:
$width
,
\"
thumbnail_url
\"
:
\"
$mxc
\"
},
\"
msgtype
\"
:
\"
m.sticker
\"
,
\"
url
\"
:
\"
$mxc
\"
,
\"
id
\"
:
\"
$packname
-
$f
\"
}"
>>
"
$slug
/
$slug
.json"
first
=
","
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
updatePacks.py
+
8
−
5
Voir le fichier @
a847bf0f
import
json
import
sys
from
colorama
import
Fore
,
Back
,
Style
# Check the arguments
# Pack is updated only if index and description are precised
update
=
False
if
len
(
sys
.
argv
)
<=
1
or
len
(
sys
.
argv
)
==
3
:
print
(
"
Usage : python updatePack.py pack.json [sticker_index] [new_description]
"
)
print
(
"
Usage : python updatePack
s
.py pack.json [sticker_index] [new_description]
"
)
exit
(
1
)
elif
len
(
sys
.
argv
)
>
3
:
update
=
True
...
...
@@ -23,9 +24,9 @@ if update == False:
# Print the number of stickers in this pack
print
(
"
There are
"
+
str
(
nb_stickers
)
+
"
stickers in this pack:
"
)
for
i
in
range
(
nb_stickers
):
print
(
str
(
i
+
1
)
+
"
.
"
+
json_pack
[
'
stickers
'
][
i
][
'
body
'
])
print
(
"
To update one of them
type
:
"
)
print
(
"
python
updatePack.py
"
+
sys
.
argv
[
1
]
+
"
sticker_index
'
new_description
'"
)
print
(
"
\t
"
+
str
(
i
+
1
)
+
"
.
"
+
json_pack
[
'
stickers
'
][
i
][
'
body
'
])
print
(
"
To update one of them
replace the red arguments
:
"
)
print
(
Fore
.
CYAN
+
Style
.
BRIGHT
+
"
python
"
+
Style
.
RESET_ALL
+
"
updatePack
s
.py
"
+
sys
.
argv
[
1
]
+
Fore
.
RED
+
Style
.
BRIGHT
+
"
sticker_index
'
new_description
'"
)
exit
(
0
)
# Informations
...
...
@@ -41,8 +42,10 @@ elif sticker_index == 0:
else
:
json_pack
[
'
stickers
'
][
sticker_index
-
1
][
'
body
'
]
=
new_body
# Print the body of all the stickers
print
(
Fore
.
GREEN
+
'
Updated!
'
)
print
(
"
New sticker pack:
"
)
for
i
in
range
(
nb_stickers
):
print
(
str
(
i
+
1
)
+
"
.
"
+
json_pack
[
'
stickers
'
][
i
][
'
body
'
])
print
(
"
\t
"
+
str
(
i
+
1
)
+
"
.
"
+
json_pack
[
'
stickers
'
][
i
][
'
body
'
])
out_file
=
open
(
sys
.
argv
[
1
],
'
w
'
)
json
.
dump
(
json_pack
,
out_file
,
indent
=
3
)
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