Compare commits
403 Commits
bcdb3c0815
...
master
Author | SHA1 | Date | |
---|---|---|---|
82df1c9412 | |||
688d87bb66 | |||
74a695d65c | |||
c267d62e62 | |||
386c58e40b | |||
4c7b6a2bd7 | |||
4940fee1cc | |||
c5ee1be726 | |||
7f7dfd1838 | |||
af4106b1f6 | |||
d9629d8817 | |||
e52e16df93 | |||
8d868cfeb5 | |||
|
4093afc78d | ||
|
d6023ef851 | ||
|
4259f74718 | ||
|
46a3a8722b | ||
|
3c6d970681 | ||
|
f11ed91101 | ||
|
b812d7f769 | ||
|
62fa973e4e | ||
|
be538f720d | ||
|
ea33b5cd95 | ||
|
80354312f6 | ||
|
e359be76a5 | ||
|
a9aa5070fc | ||
|
f40ce88f64 | ||
|
1285b8b659 | ||
|
ef31ea82be | ||
|
9f459ad8fe | ||
|
9a134d0118 | ||
|
88bebb510e | ||
|
43f47b8fbf | ||
|
a0a69b31b6 | ||
|
d0bb8252a6 | ||
|
2412b203ed | ||
|
0f0f2b2a47 | ||
|
fb153caa2b | ||
|
ea380d551c | ||
|
46b0987e86 | ||
|
fb6760ec63 | ||
|
28eb756ab0 | ||
|
046b5bcd42 | ||
|
119c56656c | ||
|
c8eca5736e | ||
|
6fb044e248 | ||
|
d88a51819a | ||
|
f96f299e97 | ||
|
48b5c5336a | ||
|
5d5d3be702 | ||
|
983fcc3d6b | ||
|
ebe9dd0e72 | ||
|
16b9e2cfbb | ||
|
b29617d025 | ||
|
96c8de2a0e | ||
|
929caae93f | ||
|
bb32617942 | ||
|
e0bddb9890 | ||
|
b319a77da2 | ||
|
f25e85fb52 | ||
|
f4638be665 | ||
|
414b7f4ab4 | ||
|
35a34a0803 | ||
|
a3602f3b28 | ||
|
26f4f29ea8 | ||
b392fd8cb3 | |||
af2731bc03 | |||
cde63519b6 | |||
8036adcfbe | |||
eb271bd389 | |||
7b7dc31eff | |||
fb947ffb57 | |||
1bc733b55a | |||
20a0e336b7 | |||
|
25c58cb3f5 | ||
|
5a508512a4 | ||
|
b25529d138 | ||
5a7735c239 | |||
bf06049b39 | |||
3d9d87a0cd | |||
b7001253d6 | |||
67d5be43b2 | |||
6cd9841d43 | |||
bb2fe2c071 | |||
c4e7f82288 | |||
75ef373a2f | |||
a67742218f | |||
abf19161d1 | |||
1b011dbf12 | |||
638b0ac112 | |||
f83080ff3a | |||
|
b7ede595e7 | ||
69cf57b887 | |||
ed9a329c52 | |||
f597da21dc | |||
3bc02d539d | |||
1d75372fa7 | |||
35fa1471c4 | |||
730deb5302 | |||
d85a99e873 | |||
f440b27dc9 | |||
1a10780e39 | |||
f0345169c5 | |||
6319e62015 | |||
|
19475e0885 | ||
ef36fff425 | |||
b9671b13c1 | |||
67a7dc73f6 | |||
|
e3e389945e | ||
467c01d373 | |||
3e07a97bc1 | |||
eaf54cbff3 | |||
a4c57b9843 | |||
9a02669c63 | |||
60ced590d3 | |||
2d72e43b10 | |||
b81bdf5fc0 | |||
00f8aee210 | |||
61c2ee798f | |||
6cdfcd5d57 | |||
8ee69bc47e | |||
754ea8f0fc | |||
8bac70b01d | |||
e35dc5d3e8 | |||
2fd314e116 | |||
82d2a8a0eb | |||
38b758f9fe | |||
797e2bf7c1 | |||
fb94cfbaa7 | |||
61c180842b | |||
09c3609e26 | |||
3eacf27648 | |||
9e5e330de3 | |||
18bdac085a | |||
754513f84f | |||
ece28454a6 | |||
fa3eded8a4 | |||
b25ac295f1 | |||
70719b2565 | |||
1142557c48 | |||
211034223d | |||
062af284c7 | |||
76f2bbe397 | |||
bdd99c4d51 | |||
8b580d6d68 | |||
b6f8a75423 | |||
f24db8987c | |||
c81bb51b4d | |||
57df1efb58 | |||
dc81a1fb89 | |||
f2f9be4a3b | |||
d945017846 | |||
9d3d9a8e81 | |||
355c7cc971 | |||
0ab51e8a64 | |||
3dc76791e7 | |||
c8dbc44dcc | |||
d8cb84f500 | |||
7ce9c5ce0a | |||
b573f7825a | |||
|
7f0701fd24 | ||
|
003e593c26 | ||
e2980e86df | |||
e658ccf77e | |||
|
45f28f2a6a | ||
|
d2eabf8e6b | ||
20acc6396c | |||
7e0871fd81 | |||
75cea0816b | |||
fffb1c9ebd | |||
|
4040616434 | ||
b9f916ab8f | |||
9df7494065 | |||
9573bdcf50 | |||
7e46e4567a | |||
7bc3cb83a3 | |||
dd816e4bb8 | |||
e69054aa41 | |||
e937406894 | |||
db666639cc | |||
146d64bbee | |||
|
4e4b41a29d | ||
f0b601d05f | |||
62f2b50e98 | |||
2a17a45848 | |||
59b579ffaa | |||
56b28966be | |||
73173839b6 | |||
0789cbdcd9 | |||
20a5907a4c | |||
562d9bae8d | |||
33253d1aaa | |||
5dcea1e2cc | |||
f15c31c1e0 | |||
afe9e12e1e | |||
|
b9f5673264 | ||
838d47be34 | |||
47b210d303 | |||
d203ab5057 | |||
94e6ce94f2 | |||
0e3511079e | |||
7cc7e5e27d | |||
15db722412 | |||
12499be20c | |||
cd01f7dda3 | |||
|
7bfd202a33 | ||
ab4faec5a3 | |||
4acada0cc6 | |||
8844715dcf | |||
ed61d93c94 | |||
02c473c473 | |||
|
8fa0625898 | ||
01a7611920 | |||
4b862a771e | |||
6327fba1dc | |||
cf5513d883 | |||
4cba029878 | |||
042c85e42e | |||
eada25f6f7 | |||
|
49e9b65609 | ||
|
c8c35d6d20 | ||
|
3e303de96f | ||
|
f3fa8becbe | ||
|
32ebed0d43 | ||
|
99b6a39722 | ||
|
02dec00a69 | ||
|
ac8cd59101 | ||
|
e0a4addb11 | ||
|
e77af37dcf | ||
|
aa41880a90 | ||
|
af2358621d | ||
|
5176b820b5 | ||
|
39f11412b8 | ||
|
2917affb34 | ||
|
a5fb88848b | ||
|
439c39361d | ||
|
44e5f1deef | ||
|
cf5093b830 | ||
|
b70fcff128 | ||
|
28ba6ac8d4 | ||
|
5d84b40b26 | ||
|
7a861c7e8b | ||
|
2e4258f015 | ||
|
ebc7b1202a | ||
|
fd7721aad1 | ||
|
f6a994544d | ||
|
0150391690 | ||
|
b50deea343 | ||
|
c542418747 | ||
|
ccd946c2c7 | ||
|
8f4bd088c2 | ||
|
bb627645a5 | ||
|
8cc5b39cd6 | ||
|
3116abd4bb | ||
|
8dbc5191a5 | ||
|
a3d941caac | ||
|
11582415bd | ||
|
7908c218fa | ||
|
e1693ee5d8 | ||
|
a21b66044c | ||
|
8fd6c4530a | ||
|
e46735ab4d | ||
|
972a730365 | ||
697b255efc | |||
6da3a06714 | |||
066800178a | |||
440cc9cb49 | |||
52c2ec03da | |||
aa1bf4f3e2 | |||
00c4e87f69 | |||
1c57928338 | |||
|
e81ec2841b | ||
|
03ef92ed73 | ||
09a6fc1f5c | |||
c952ffdcdc | |||
|
4fbcc99007 | ||
287e4ced3e | |||
|
0b75ab8c7c | ||
|
5096f50333 | ||
|
d45f2a32d7 | ||
|
74f21e2d03 | ||
|
47a1a783bc | ||
|
96de161307 | ||
|
f60f050150 | ||
|
2fc5f2d690 | ||
|
075a78252f | ||
|
be26ea5be3 | ||
ef9f185bdc | |||
000fb9f606 | |||
|
4bc07cd4a8 | ||
|
f9786d7a6d | ||
|
9c82570b8f | ||
d232951b96 | |||
8ccf9db1f7 | |||
|
e113ba745d | ||
|
84f8b58c83 | ||
|
9ecc7e11e1 | ||
7eb2a29b97 | |||
e50e9caa46 | |||
c32a185150 | |||
6c5071add5 | |||
|
5816a523fb | ||
|
681fdb0bd1 | ||
|
9465ad324c | ||
90e1921825 | |||
|
af5d535fe7 | ||
fa000e0b57 | |||
d664e71461 | |||
5152f1d945 | |||
abdc241f48 | |||
7b885db868 | |||
d87049b00e | |||
|
210395eaf9 | ||
|
2a146e3355 | ||
|
9ba22d0de2 | ||
6845305d37 | |||
|
ac9419bdba | ||
97b8ba29e1 | |||
|
98c78d8468 | ||
ca5482b614 | |||
|
1d395614bf | ||
adde272122 | |||
|
ae5effedc8 | ||
862b077d80 | |||
|
0a99fe09e6 | ||
|
777aae6f29 | ||
b0324375d3 | |||
|
de05d31ffa | ||
0b13ece750 | |||
|
0379fa7479 | ||
63f2c404ff | |||
ca2dac1de6 | |||
600610aea1 | |||
c85e40f0cc | |||
|
640d0972ec | ||
|
db12118f41 | ||
e7376f3f0f | |||
2c590cf499 | |||
|
d3093ca3a6 | ||
3f48b1433d | |||
|
450841d834 | ||
c69135384a | |||
9609c4e053 | |||
7eccdc24b3 | |||
a3374e5bf0 | |||
|
75919acec3 | ||
009955b4a3 | |||
e761e8e397 | |||
|
19d8e64f91 | ||
|
bfaec9a32c | ||
|
16e9e31e74 | ||
0b6a6b008c | |||
|
6b250ed1da | ||
66ec1df6bd | |||
e0b040de2d | |||
|
19794c0423 | ||
|
a97f054502 | ||
6fd2973654 | |||
|
61193239f8 | ||
|
aafe982b93 | ||
|
13cc0ac88e | ||
626316c0de | |||
48e0521ea9 | |||
2460082d82 | |||
0d5b309458 | |||
|
8a17ab18b2 | ||
2a2a5ac117 | |||
|
d9fd27a23a | ||
6f9e279b5f | |||
eaca49fb56 | |||
bf87ee4df4 | |||
105d69b4ae | |||
7a691c9eff | |||
ca5c0e6400 | |||
22ad5bd007 | |||
8880a9c2d9 | |||
c2c56d257f | |||
e5f582f73f | |||
2f6414e12c | |||
1ed7b55599 | |||
5f78e1899b | |||
1d7899eba6 | |||
35137f739e | |||
e64b978c1b | |||
d391253cee | |||
d2038e018f | |||
2538148b64 | |||
80885ae7e5 | |||
1216a15f90 | |||
85ca0ace7b | |||
|
5c490c3066 | ||
c4527684b3 | |||
|
1d5b07b3be | ||
e82c40f52b | |||
5db224543d | |||
bbe88bda2d | |||
fc92f47860 | |||
a959b0f4f2 | |||
3994baaeb7 | |||
3092156bd5 | |||
d5f58ebc53 | |||
b190cd6552 | |||
52232065c5 |
70
.gitignore
vendored
@ -72,3 +72,73 @@ fabric.properties
|
||||
# Android studio 3.1+ serialized cache file
|
||||
.idea/caches/build_file_checksums.ser
|
||||
|
||||
# Ajout MilesTEG
|
||||
# Pour ne pas mettre les fichiers un peu spéciaux de windows, macOS, etc...
|
||||
# Et aussi certains créés par VSCode.
|
||||
|
||||
# ---> Windows
|
||||
# Windows thumbnail cache files
|
||||
Thumbs.db
|
||||
Thumbs.db:encryptable
|
||||
ehthumbs.db
|
||||
ehthumbs_vista.db
|
||||
|
||||
# Dump file
|
||||
*.stackdump
|
||||
|
||||
# Folder config file
|
||||
[Dd]esktop.ini
|
||||
|
||||
# Recycle Bin used on file shares
|
||||
$RECYCLE.BIN/
|
||||
|
||||
# Windows Installer files
|
||||
*.cab
|
||||
*.msi
|
||||
*.msix
|
||||
*.msm
|
||||
*.msp
|
||||
|
||||
# Windows shortcuts
|
||||
*.lnk
|
||||
|
||||
# ---> VisualStudioCode
|
||||
.vscode/*
|
||||
!.vscode/settings.json
|
||||
!.vscode/tasks.json
|
||||
!.vscode/launch.json
|
||||
!.vscode/extensions.json
|
||||
*.code-workspace
|
||||
|
||||
# Local History for Visual Studio Code
|
||||
.history/
|
||||
|
||||
# ---> macOS
|
||||
# General
|
||||
.DS_Store
|
||||
.AppleDouble
|
||||
.LSOverride
|
||||
|
||||
# Icon must end with two \r
|
||||
Icon
|
||||
|
||||
|
||||
# Thumbnails
|
||||
._*
|
||||
|
||||
# Files that might appear in the root of a volume
|
||||
.DocumentRevisions-V100
|
||||
.fseventsd
|
||||
.Spotlight-V100
|
||||
.TemporaryItems
|
||||
.Trashes
|
||||
.VolumeIcon.icns
|
||||
.com.apple.timemachine.donotpresent
|
||||
|
||||
# Directories potentially created on remote AFP share
|
||||
.AppleDB
|
||||
.AppleDesktop
|
||||
Network Trash Folder
|
||||
Temporary Items
|
||||
.apdisk
|
||||
|
||||
|
11
Conversion FLAC vers MP3/flac_to_mp3.sh
Normal file
@ -0,0 +1,11 @@
|
||||
## Discord Plex FR : https://discord.gg/3gtABCH
|
||||
## Version 2021-08-26
|
||||
##
|
||||
## Pour une aide à l'installation, consulter le README
|
||||
##
|
||||
#!/bin/bash
|
||||
|
||||
while read FILE ; do
|
||||
[[ -e ${FILE%%.*}.mp3 ]] || ffmpeg -i "$FILE" -ab 320k -map_metadata 0 "${FILE%.*}.mp3"
|
||||
[[ $? -eq 0 ]] && rm $FILE
|
||||
done < <(find . -name "*.flac")
|
6
Conversion FLAC vers MP3/readme.md
Normal file
@ -0,0 +1,6 @@
|
||||
Conversion FLAC vers MP3
|
||||
========
|
||||
|
||||
Ce script permet la conversion de vos flacs en MP3 320kbps de manière automatique.
|
||||
|
||||
ATTENTION : Les fichiers flacs sont supprimées quand la conversion à réussie.
|
8
Plex Bot Music/README.md
Normal file
@ -0,0 +1,8 @@
|
||||
# Plex Bot Music
|
||||
|
||||
**Plex Bot Music est un bot écrit en Python. Il vous permettra d'écouter votre musique sur Discord au travers d'un bot, tel que Rythme mais vous serez limité à votre Bibliothèque**
|
||||
|
||||
|
||||
## Lien vers le répértoire
|
||||
|
||||
https://gitea.zoz-serv.org/gigidsss/Plex-Bot-Music
|
76
Plex Discord Activity/README.md
Normal file
@ -0,0 +1,76 @@
|
||||
# Plex Discord Activity
|
||||
|
||||
**Plex Discord Activity est un logiciel en Python. Il a été récuperé déjà depuis le dépot d'un utilisateur GitHub mais a été simplifié de sorte a ce que la pré-configuration soit la plus simple possible**
|
||||
|
||||
Il y a eu peu de modifications par rapport à l'original, mais elles vous simplifient grandement la vie.
|
||||
|
||||
## Attention
|
||||
|
||||
Sachez que pour que le script fonctionne, il faut qu'il tourne sur le même PC que votre application Discord. Malheureusement faire tourner ce script sur un serveur en tâche de fond ne donnera aucun résultat...
|
||||
|
||||
## Installation
|
||||
|
||||
Pour cela, commencez déjà par installer Python3 sur votre ordinateur si cela n'est pas déjà fait...
|
||||
|
||||
Ensuite installez ces 2 bibliothèques Python via pip3:
|
||||
|
||||
```bash
|
||||
pip3 install plexapi
|
||||
pip3 install websocket-client==0.48.0
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
Éditez le document pma.py et éditez ce paragraphe seulement:
|
||||
```python
|
||||
### SEULEMENT CE QUE VOUS DEVEZ EDITER
|
||||
|
||||
MyDomain = "https://your.plex.dns:32400" #Soit via votre nom de domaine, soit via le domaine de Plex, c'est à dire, https://app.plex.tv
|
||||
Serveur = "MyPlex" #Le nom de votre Serveur Plex, visible dans Paramètres > Général > Nom d'usage
|
||||
NomUser = "username" #Le nom d'utilisateur Plex pour récupérer les métadonnées et les informations de lecture en temps réel
|
||||
MotDePasse = "password" #Votre mot de passe de votre compte Plex
|
||||
MonToken = "your_token" #Votre Token, accessible a la fin de l'url lorsque vous consultez le fichier XML de l'un de vos médias
|
||||
BlackList = ["Musique", "BackingTracks"] #séparée par des virgules avec espace, entourées par des "", entrent 2 balises [], ex: ["bib1", "bib2"]
|
||||
UserOnly = "username" #Si vous avez crée des utilisateurs gérés, pour éviter de partager l'état de lecture d'un autre utilisateur que vous-même, précisez le psuedo du bon utilisateur a priori le même que le 3ème paramètre que vous...
|
||||
InfosSupp = "true" #Ceci partage les métadonnées de votre épisode si c'est sur True, sinon mettez False pour n'afficher que l'état de lecture
|
||||
TempsRestant = "true" #True = Afficher le temps restant de lecture / False = Afficher le nombre de minutes que vous avez déjà consulté depuis le démarrage de l'épisode
|
||||
|
||||
### END DE CE QUE VOUS DEVEZ EDITER
|
||||
```
|
||||
|
||||
Voici un résumé des paramètres:
|
||||
|
||||
**Attention a ne pas supprimer des guillemets ou des crochets... Si vous ne voulez pas préciser de valeur, laissez les guillemets vides ou indiquez-y ``none`` !**
|
||||
|
||||
**Serveur**: C'est le nom de votre serveur Plex. Vous le trouverez dans ``Paramètres > Général > Nom d'usage``
|
||||
|
||||
**NomUser**: Votre nom d'utilisateur Plex associé à votre compte.
|
||||
|
||||
**MotDePasse**: Votre mot de passe de l'utilisateur Plex associé à votre compte.
|
||||
|
||||
**MonToken**: Token que vous pouvez obtenir en consultant le fichier XML d'un de vos média. Allez sur un épisode ou film précis, allez dans ``Voir informations`` puis ``Voir le XML``. Ensuite regardez à la fin de votre URL, vous devriez avoir: **Plex-Token=0x0x0xx0x00xx0x0**
|
||||
|
||||
**BlackList**: Vous pouvez décider de ne pas partager sur Discord les médias d'une bibliothèque définie, indiquez-y entre guillemets et eux-même entre crochets, le nom des Bibliothèques.
|
||||
Exemple:
|
||||
```python
|
||||
BlackList = ["Musique", "BackingTracks"]
|
||||
```
|
||||
**UserOnly**: Si vous avez crée des utilisateurs gérés, pour éviter de partager l'état de lecture d'un autre utilisateur que vous-même, précisez le psuedo du bon utilisateur qui à priori est le même que celui du paramètre ``username``...
|
||||
|
||||
**InfosSupp**: Vous permet de partager davantage d'infos sur le média, à savoir les métadonnées, etc. (Réponse: True / False)
|
||||
|
||||
**TempsRestant**: Vous permet de préciser si vous voulez indiquer le temps restant du média ou la position actuelle (Réponse: True (Il reste 05:00 minutes) / False (Vous êtes à 15:00 minutes sur 20:00 minutes))
|
||||
|
||||
## Utilisation
|
||||
|
||||
```
|
||||
python3 pma.py
|
||||
```
|
||||
*Patientez +/- 20 secondes pour que le script démarre... Le script lancera tout seul la page web Plex*
|
||||
|
||||
## Source
|
||||
https://github.com/Phineas05/discord-rich-presence-plex
|
||||
|
||||
|
||||
## License
|
||||
[MIT](https://choosealicense.com/licenses/mit/)
|
413
Plex Discord Activity/pda.py
Normal file
@ -0,0 +1,413 @@
|
||||
import asyncio
|
||||
import datetime
|
||||
import hashlib
|
||||
import json
|
||||
import os
|
||||
import plexapi.myplex
|
||||
import struct
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
import threading
|
||||
import time
|
||||
import webbrowser
|
||||
|
||||
### SEULEMENT CE QUE VOUS DEVEZ EDITER
|
||||
|
||||
MyDomain = "https://your.plex.dns:32400" #Soit via votre nom de domaine, soit via le domaine de Plex, c'est à dire, https://app.plex.tv
|
||||
Serveur = "MyPlex" #Le nom de votre Serveur Plex, visible dans Paramètres > Général > Nom d'usage
|
||||
NomUser = "username" #Le nom d'utilisateur Plex pour récupérer les métadonnées et les informations de lecture en temps réel
|
||||
MotDePasse = "password" #Votre mot de passe de votre compte Plex
|
||||
MonToken = "your_token" #Votre Token, accessible a la fin de l'url lorsque vous consultez le fichier XML de l'un de vos médias
|
||||
BlackList = ["Musique", "BackingTracks"] #séparée par des virgules avec espace, entourées par des "", entrent 2 balises [], ex: ["bib1", "bib2"]
|
||||
UserOnly = "username" #Si vous avez crée des utilisateurs gérés, pour éviter de partager l'état de lecture d'un autre utilisateur que vous-même, précisez le psuedo du bon utilisateur a priori le même que le 3ème paramètre que vous...
|
||||
InfosSupp = "true" #Ceci partage les métadonnées de votre épisode si c'est sur True, sinon mettez False pour n'afficher que l'état de lecture
|
||||
TempsRestant = "true" #True = Afficher le temps restant de lecture / False = Afficher le nombre de minutes que vous avez déjà consulté depuis le démarrage de l'épisode
|
||||
|
||||
### END DE CE QUE VOUS DEVEZ EDITER
|
||||
|
||||
webbrowser.open(MyDomain)
|
||||
|
||||
class plexConfig:
|
||||
|
||||
extraLogging = (InfosSupp)
|
||||
timeRemaining = (TempsRestant)
|
||||
|
||||
def __init__(self, serverName = "", username = "", password = "", token = "", listenForUser = "", blacklistedLibraries = None, whitelistedLibraries = None, clientID = "413407336082833418"):
|
||||
self.serverName = serverName
|
||||
self.username = username
|
||||
self.password = password
|
||||
self.token = token
|
||||
self.listenForUser = (username if listenForUser == "" else listenForUser).lower()
|
||||
self.blacklistedLibraries = blacklistedLibraries
|
||||
self.whitelistedLibraries = whitelistedLibraries
|
||||
self.clientID = clientID
|
||||
|
||||
plexConfigs = [
|
||||
plexConfig(serverName = (Serveur), username = (NomUser), password = (MotDePasse), token = (MonToken), blacklistedLibraries = (BlackList), listenForUser = (UserOnly))
|
||||
]
|
||||
|
||||
class discordRichPresence:
|
||||
|
||||
def __init__(self, clientID, child):
|
||||
self.IPCPipe = ((os.environ.get("XDG_RUNTIME_DIR", None) or os.environ.get("TMPDIR", None) or os.environ.get("TMP", None) or os.environ.get("TEMP", None) or "/tmp") + "/discord-ipc-0") if isLinux else "\\\\?\\pipe\\discord-ipc-0"
|
||||
self.clientID = clientID
|
||||
self.pipeReader = None
|
||||
self.pipeWriter = None
|
||||
self.process = None
|
||||
self.running = False
|
||||
self.child = child
|
||||
|
||||
async def read(self):
|
||||
try:
|
||||
data = await self.pipeReader.read(1024)
|
||||
self.child.log("[READ] " + str(json.loads(data[8:].decode("utf-8"))))
|
||||
except Exception as e:
|
||||
self.child.log("[READ] " + str(e))
|
||||
self.stop()
|
||||
|
||||
def write(self, op, payload):
|
||||
payload = json.dumps(payload)
|
||||
self.child.log("[WRITE] " + str(payload))
|
||||
data = self.pipeWriter.write(struct.pack("<ii", op, len(payload)) + payload.encode("utf-8"))
|
||||
|
||||
async def handshake(self):
|
||||
try:
|
||||
if (isLinux):
|
||||
self.pipeReader, self.pipeWriter = await asyncio.open_unix_connection(self.IPCPipe, loop = self.loop)
|
||||
else:
|
||||
self.pipeReader = asyncio.StreamReader(loop = self.loop)
|
||||
self.pipeWriter, _ = await self.loop.create_pipe_connection(lambda: asyncio.StreamReaderProtocol(self.pipeReader, loop = self.loop), self.IPCPipe)
|
||||
self.write(0, {"v": 1, "client_id": self.clientID})
|
||||
await self.read()
|
||||
self.running = True
|
||||
except Exception as e:
|
||||
self.child.log("[HANDSHAKE] " + str(e))
|
||||
|
||||
def start(self):
|
||||
self.child.log("Opening Discord IPC Pipe")
|
||||
emptyProcessFilePath = tempfile.gettempdir() + ("/" if isLinux else "\\") + "discordRichPresencePlex-emptyProcess.py"
|
||||
if (not os.path.exists(emptyProcessFilePath)):
|
||||
with open(emptyProcessFilePath, "w") as emptyProcessFile:
|
||||
emptyProcessFile.write("import time\n\ntry:\n\twhile (True):\n\t\ttime.sleep(3600)\nexcept:\n\tpass")
|
||||
self.process = subprocess.Popen(["python3" if isLinux else "pythonw", emptyProcessFilePath])
|
||||
self.loop = asyncio.new_event_loop() if isLinux else asyncio.ProactorEventLoop()
|
||||
self.loop.run_until_complete(self.handshake())
|
||||
|
||||
def stop(self):
|
||||
self.child.log("Closing Discord IPC Pipe")
|
||||
self.child.lastState, self.child.lastSessionKey, self.child.lastRatingKey = None, None, None
|
||||
self.process.kill()
|
||||
if (self.child.stopTimer):
|
||||
self.child.stopTimer.cancel()
|
||||
self.child.stopTimer = None
|
||||
if (self.child.stopTimer2):
|
||||
self.child.stopTimer2.cancel()
|
||||
self.child.stopTimer2 = None
|
||||
if (self.pipeWriter):
|
||||
try:
|
||||
self.pipeWriter.close()
|
||||
except:
|
||||
pass
|
||||
self.pipeWriter = None
|
||||
if (self.pipeReader):
|
||||
try:
|
||||
self.loop.run_until_complete(self.pipeReader.read(1024))
|
||||
except:
|
||||
pass
|
||||
self.pipeReader = None
|
||||
try:
|
||||
self.loop.close()
|
||||
except:
|
||||
pass
|
||||
self.running = False
|
||||
|
||||
def send(self, activity):
|
||||
payload = {
|
||||
"cmd": "SET_ACTIVITY",
|
||||
"args": {
|
||||
"activity": activity,
|
||||
"pid": self.process.pid
|
||||
},
|
||||
"nonce": "{0:.20f}".format(time.time())
|
||||
}
|
||||
self.write(1, payload)
|
||||
self.loop.run_until_complete(self.read())
|
||||
|
||||
class discordRichPresencePlex(discordRichPresence):
|
||||
|
||||
productName = "Plex Media Server"
|
||||
stopTimerInterval = 5
|
||||
stopTimer2Interval = 35
|
||||
checkConnectionTimerInterval = 60
|
||||
maximumIgnores = 3
|
||||
|
||||
def __init__(self, plexConfig):
|
||||
self.plexConfig = plexConfig
|
||||
self.instanceID = hashlib.md5(str(id(self)).encode("UTF-8")).hexdigest()[:5]
|
||||
super().__init__(plexConfig.clientID, self)
|
||||
self.plexAccount = None
|
||||
self.plexServer = None
|
||||
self.isServerOwner = False
|
||||
self.plexAlertListener = None
|
||||
self.lastState = None
|
||||
self.lastSessionKey = None
|
||||
self.lastRatingKey = None
|
||||
self.stopTimer = None
|
||||
self.stopTimer2 = None
|
||||
self.checkConnectionTimer = None
|
||||
self.ignoreCount = 0
|
||||
|
||||
def run(self):
|
||||
self.reset()
|
||||
connected = False
|
||||
while (not connected):
|
||||
try:
|
||||
if (self.plexConfig.token):
|
||||
self.plexAccount = plexapi.myplex.MyPlexAccount(self.plexConfig.username, token = self.plexConfig.token)
|
||||
else:
|
||||
self.plexAccount = plexapi.myplex.MyPlexAccount(self.plexConfig.username, self.plexConfig.password)
|
||||
self.log("Logged in as Plex User \"" + self.plexAccount.username + "\"")
|
||||
self.plexServer = None
|
||||
for resource in self.plexAccount.resources():
|
||||
if (resource.product == self.productName and resource.name == self.plexConfig.serverName):
|
||||
self.plexServer = resource.connect()
|
||||
try:
|
||||
self.plexServer.account()
|
||||
self.isServerOwner = True
|
||||
except:
|
||||
pass
|
||||
self.log("Connected to " + self.productName + " \"" + self.plexConfig.serverName + "\"")
|
||||
self.plexAlertListener = self.plexServer.startAlertListener(self.onPlexServerAlert)
|
||||
self.log("Listening for PlaySessionStateNotification alerts from user \"" + self.plexConfig.listenForUser + "\"")
|
||||
if (self.checkConnectionTimer):
|
||||
self.checkConnectionTimer.cancel()
|
||||
self.checkConnectionTimer = None
|
||||
self.checkConnectionTimer = threading.Timer(self.checkConnectionTimerInterval, self.checkConnection)
|
||||
self.checkConnectionTimer.start()
|
||||
connected = True
|
||||
break
|
||||
if (not self.plexServer):
|
||||
self.log(self.productName + " \"" + self.plexConfig.serverName + "\" not found")
|
||||
break
|
||||
except Exception as e:
|
||||
self.log("Failed to connect to Plex: " + str(e))
|
||||
self.log("Reconnecting in 10 seconds")
|
||||
time.sleep(10)
|
||||
|
||||
def reset(self):
|
||||
if (self.running):
|
||||
self.stop()
|
||||
self.plexAccount, self.plexServer = None, None
|
||||
if (self.plexAlertListener):
|
||||
try:
|
||||
self.plexAlertListener.stop()
|
||||
except:
|
||||
pass
|
||||
self.plexAlertListener = None
|
||||
if (self.stopTimer):
|
||||
self.stopTimer.cancel()
|
||||
self.stopTimer = None
|
||||
if (self.stopTimer2):
|
||||
self.stopTimer2.cancel()
|
||||
self.stopTimer2 = None
|
||||
if (self.checkConnectionTimer):
|
||||
self.checkConnectionTimer.cancel()
|
||||
self.checkConnectionTimer = None
|
||||
|
||||
def checkConnection(self):
|
||||
try:
|
||||
self.log("Request for clients list to check connection: " + str(self.plexServer.clients()), extra = True)
|
||||
self.checkConnectionTimer = threading.Timer(self.checkConnectionTimerInterval, self.checkConnection)
|
||||
self.checkConnectionTimer.start()
|
||||
except Exception as e:
|
||||
self.log("Connection to Plex lost: " + str(e))
|
||||
self.log("Reconnecting")
|
||||
self.run()
|
||||
|
||||
def log(self, text, colour = "", extra = False):
|
||||
timestamp = datetime.datetime.now().strftime("%I:%M:%S %p")
|
||||
prefix = "[" + timestamp + "] [" + self.plexConfig.serverName + "/" + self.instanceID + "] "
|
||||
lock.acquire()
|
||||
if (extra):
|
||||
if (self.plexConfig.extraLogging):
|
||||
print(prefix + colourText(str(text), colour))
|
||||
else:
|
||||
print(prefix + colourText(str(text), colour))
|
||||
lock.release()
|
||||
|
||||
def onPlexServerAlert(self, data):
|
||||
if (not self.plexServer):
|
||||
return
|
||||
try:
|
||||
if (data["type"] == "playing" and "PlaySessionStateNotification" in data):
|
||||
sessionData = data["PlaySessionStateNotification"][0]
|
||||
state = sessionData["state"]
|
||||
sessionKey = int(sessionData["sessionKey"])
|
||||
ratingKey = int(sessionData["ratingKey"])
|
||||
viewOffset = int(sessionData["viewOffset"])
|
||||
self.log("Received Update: " + colourText(sessionData, "yellow").replace("'", "\""), extra = True)
|
||||
metadata = self.plexServer.fetchItem(ratingKey)
|
||||
libraryName = metadata.section().title
|
||||
if (isinstance(self.plexConfig.blacklistedLibraries, list)):
|
||||
if (libraryName in self.plexConfig.blacklistedLibraries):
|
||||
self.log("Library \"" + libraryName + "\" is blacklisted, ignoring", "yellow", True)
|
||||
return
|
||||
if (isinstance(self.plexConfig.whitelistedLibraries, list)):
|
||||
if (libraryName not in self.plexConfig.whitelistedLibraries):
|
||||
self.log("Library \"" + libraryName + "\" is not whitelisted, ignoring", "yellow", True)
|
||||
return
|
||||
if (self.lastSessionKey == sessionKey and self.lastRatingKey == ratingKey):
|
||||
if (self.stopTimer2):
|
||||
self.stopTimer2.cancel()
|
||||
self.stopTimer2 = None
|
||||
if (self.lastState == state):
|
||||
if (self.ignoreCount == self.maximumIgnores):
|
||||
self.ignoreCount = 0
|
||||
else:
|
||||
self.log("Nothing changed, ignoring", "yellow", True)
|
||||
self.ignoreCount += 1
|
||||
self.stopTimer2 = threading.Timer(self.stopTimer2Interval, self.stopOnNoUpdate)
|
||||
self.stopTimer2.start()
|
||||
return
|
||||
elif (state == "stopped"):
|
||||
self.lastState, self.lastSessionKey, self.lastRatingKey = None, None, None
|
||||
self.stopTimer = threading.Timer(self.stopTimerInterval, self.stop)
|
||||
self.stopTimer.start()
|
||||
self.log("Started stopTimer", "yellow", True)
|
||||
return
|
||||
elif (state == "stopped"):
|
||||
self.log("\"stopped\" state update from unknown session key, ignoring", "yellow", True)
|
||||
return
|
||||
if (self.isServerOwner):
|
||||
self.log("Checking Sessions for Session Key " + colourText(sessionKey, "yellow"), extra = True)
|
||||
plexServerSessions = self.plexServer.sessions()
|
||||
if (len(plexServerSessions) < 1):
|
||||
self.log("Empty session list, ignoring", "red", True)
|
||||
return
|
||||
for session in plexServerSessions:
|
||||
self.log(str(session) + ", Session Key: " + colourText(session.sessionKey, "yellow") + ", Users: " + colourText(session.usernames, "yellow").replace("'", "\""), extra = True)
|
||||
sessionFound = False
|
||||
if (session.sessionKey == sessionKey):
|
||||
sessionFound = True
|
||||
self.log("Session found", "green", True)
|
||||
if (session.usernames[0].lower() == self.plexConfig.listenForUser):
|
||||
self.log("Username \"" + session.usernames[0].lower() + "\" matches \"" + self.plexConfig.listenForUser + "\", continuing", "green", True)
|
||||
break
|
||||
else:
|
||||
self.log("Username \"" + session.usernames[0].lower() + "\" doesn't match \"" + self.plexConfig.listenForUser + "\", ignoring", "red", True)
|
||||
return
|
||||
if (not sessionFound):
|
||||
self.log("No matching session found", "red", True)
|
||||
return
|
||||
if (self.stopTimer):
|
||||
self.stopTimer.cancel()
|
||||
self.stopTimer = None
|
||||
if (self.stopTimer2):
|
||||
self.stopTimer2.cancel()
|
||||
self.stopTimer2 = threading.Timer(self.stopTimer2Interval, self.stopOnNoUpdate)
|
||||
self.stopTimer2.start()
|
||||
self.lastState, self.lastSessionKey, self.lastRatingKey = state, sessionKey, ratingKey
|
||||
mediaType = metadata.type
|
||||
if (state != "playing"):
|
||||
extra = secondsToText(viewOffset / 1000, ":") + "/" + secondsToText(metadata.duration / 1000, ":")
|
||||
else:
|
||||
extra = secondsToText(metadata.duration / 1000)
|
||||
if (mediaType == "movie"):
|
||||
title = metadata.title + " (" + str(metadata.year) + ")"
|
||||
extra = extra + " · " + ", ".join([genre.tag for genre in metadata.genres[:3]])
|
||||
largeText = "Watching a Movie"
|
||||
elif (mediaType == "episode"):
|
||||
title = metadata.grandparentTitle
|
||||
extra = extra + " · S" + str(metadata.parentIndex) + " · E" + str(metadata.index) + " - " + metadata.title
|
||||
largeText = "Watching a TV Show"
|
||||
elif (mediaType == "track"):
|
||||
title = metadata.title
|
||||
artist = metadata.originalTitle
|
||||
if (not artist):
|
||||
artist = metadata.grandparentTitle
|
||||
extra = artist + " · " + metadata.parentTitle
|
||||
largeText = "Listening to Music"
|
||||
else:
|
||||
self.log("Unsupported media type \"" + mediaType + "\", ignoring", "red", True)
|
||||
return
|
||||
activity = {
|
||||
"details": title,
|
||||
"state": extra,
|
||||
"assets": {
|
||||
"large_text": largeText,
|
||||
"large_image": "logo",
|
||||
"small_text": state.capitalize(),
|
||||
"small_image": state
|
||||
},
|
||||
}
|
||||
if (state == "playing"):
|
||||
currentTimestamp = int(time.time())
|
||||
if (self.plexConfig.timeRemaining):
|
||||
activity["timestamps"] = {"end": round(currentTimestamp + ((metadata.duration - viewOffset) / 1000))}
|
||||
else:
|
||||
activity["timestamps"] = {"start": round(currentTimestamp - (viewOffset / 1000))}
|
||||
if (not self.running):
|
||||
self.start()
|
||||
if (self.running):
|
||||
self.send(activity)
|
||||
else:
|
||||
self.stop()
|
||||
except Exception as e:
|
||||
self.log("onPlexServerAlert Error: " + str(e))
|
||||
|
||||
def stopOnNoUpdate(self):
|
||||
self.log("No updates from session key " + str(self.lastSessionKey) + ", stopping", "red", True)
|
||||
self.stop()
|
||||
|
||||
isLinux = sys.platform in ["linux", "darwin"]
|
||||
lock = threading.Semaphore(value = 1)
|
||||
|
||||
os.system("clear" if isLinux else "cls")
|
||||
|
||||
if (len(plexConfigs) == 0):
|
||||
print("Error: plexConfigs list is empty")
|
||||
sys.exit()
|
||||
|
||||
colours = {
|
||||
"red": "91",
|
||||
"green": "92",
|
||||
"yellow": "93",
|
||||
"blue": "94",
|
||||
"magenta": "96",
|
||||
"cyan": "97"
|
||||
}
|
||||
|
||||
def colourText(text, colour = ""):
|
||||
prefix = ""
|
||||
suffix = ""
|
||||
colour = colour.lower()
|
||||
if (colour in colours):
|
||||
prefix = "\033[" + colours[colour] + "m"
|
||||
suffix = "\033[0m"
|
||||
return prefix + str(text) + suffix
|
||||
|
||||
def secondsToText(seconds, joiner = ""):
|
||||
seconds = round(seconds)
|
||||
text = {"h": seconds // 3600, "m": seconds // 60 % 60, "s": seconds % 60}
|
||||
if (joiner == ""):
|
||||
text = [str(v) + k for k, v in text.items() if v > 0]
|
||||
else:
|
||||
if (text["h"] == 0):
|
||||
del text["h"]
|
||||
text = [str(v).rjust(2, "0") for k, v in text.items()]
|
||||
return joiner.join(text)
|
||||
|
||||
discordRichPresencePlexInstances = []
|
||||
for config in plexConfigs:
|
||||
discordRichPresencePlexInstances.append(discordRichPresencePlex(config))
|
||||
try:
|
||||
for discordRichPresencePlexInstance in discordRichPresencePlexInstances:
|
||||
discordRichPresencePlexInstance.run()
|
||||
while (True):
|
||||
time.sleep(3600)
|
||||
except KeyboardInterrupt:
|
||||
for discordRichPresencePlexInstance in discordRichPresencePlexInstances:
|
||||
discordRichPresencePlexInstance.reset()
|
||||
except Exception as e:
|
||||
print("Error: " + str(e))
|
@ -19,6 +19,8 @@ Ce dépot nous sert a stocker les composes / aides / tutos / ... qui nous permet
|
||||
|
||||
Lisez le README "Aide pour le repo" ici : https://gitea.zoz-serv.org/Zoz/plex_fr_discord_repo/src/branch/master/README_GIT.md
|
||||
|
||||
Aussi dispo : [Tutoriel pour Git avec SourceTree](https://gitea.zoz-serv.org/Zoz/plex_fr_discord_repo/src/branch/master/TUTO_Git_SourceTree.md)
|
||||
|
||||
## Comment nous rejoindre ?
|
||||
|
||||
Nous sommes sur Discord, a cette adresse : https://discord.gg/ERpYMqS
|
||||
Nous sommes sur Discord et Guilded, a ces adresses : https://discord.gg/3gtABCH | https://guilded.gg/PlexFR
|
@ -12,6 +12,7 @@ Clonez le dépot sur votre machine `git clone https://gitea.zoz-serv.org/Zoz/ple
|
||||
### Pour chaque modification, attention à bien suivre cette procédure si vous voulez éviter des conflits de versions
|
||||
|
||||
- Créez votre branche via la GUI Gitea (idéalement votre pseudo) ex : `Benj`
|
||||
(pour cela, demandez à Zoz de vous attribuer un rôle de contributeur)
|
||||
|
||||
![mabanche](https://i.imgur.com/0KLNFSG.png)
|
||||
|
||||
|
@ -0,0 +1,885 @@
|
||||
##==============================================================================================
|
||||
## ##
|
||||
## Batch Merge Subtitles with MKVMerge ##
|
||||
## By Miles ##
|
||||
## Idea from Iain McCain : https://superuser.com/a/1249870 ##
|
||||
## ##
|
||||
##==============================================================================================
|
||||
## ##
|
||||
## Utilisation et conditions : ##
|
||||
## - Il faut que les .srt et les .mkv soient dans le même dossier. ##
|
||||
## - Il faut que les sous-titres externes .SRT aient le même nom de fichier que les .MKV. ##
|
||||
## - Il faut paramétrer l'extension des fichiers de sous-titres pour que ces derniers ##
|
||||
## reflètent la langue : eng, fre,... ##
|
||||
## - Il faudra par ailleurs modifier le code langage dans AudioLang_X et SubTrackLang_1 ##
|
||||
## Il est possible de : ##
|
||||
## - spécifier des dossiers sources et destinations identiques ou différents ##
|
||||
## - spécifier un titre de piste (pour toutes) ##
|
||||
## ##
|
||||
##==============================================================================================
|
||||
## ##
|
||||
## Objectifs : ##
|
||||
## Remuxer deux MKV en gardant l'audio et le(s) sous-titre du premier ou un sous-titre ##
|
||||
## externe, et seulement la vidéo du second MKV ##
|
||||
## ##
|
||||
##==============================================================================================
|
||||
|
||||
# ┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
# │ - MKV1 : file to keep with 2 audio, 1 internal SRT, DROP the video (720p) │
|
||||
# │ - MKV2 : file to keep with only the video 1080p ! │
|
||||
# │ - SRT1 : external SRT file with same name of the MKV2 file (SRT made by extracted PGS in the MKV2 file) │
|
||||
# │ - SRT2 : external SRT file with same name of the MKV2 file (SRT made by extracted PGS in the MKV2 file) │
|
||||
# └──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
|
||||
Clear-Host
|
||||
Invoke-Command -ScriptBlock {
|
||||
|
||||
# #############################################################################################
|
||||
# -> BEGIN VARIABLES DECLARATION -----------------------------------------------------------
|
||||
# #############################################################################################
|
||||
|
||||
# Set MKVMerge.exe and MediaInfo.exe (CLI version) Path
|
||||
$MKVMerge = "`"PATH_TO\mkvtoolnix\mkvmerge.exe`""
|
||||
$MediaInfo = "`"PATH_TO\MediaInfo_CLI\MediaInfo.exe`""
|
||||
# For the parameters to pass to MKVMerge executable, will be construct
|
||||
# Set this to $true in order to merge a MKV_2 present in $sourceDirectory_2
|
||||
$merge_another_video_MKV2 = $false # If set to $false, $sourceDirectory_2 will be ignored.
|
||||
|
||||
# Don't add a \ at the end of the path...
|
||||
$sourceDirectory_1 = "PATH_TO_SOURCE_1"
|
||||
$sourceDirectory_2 = "PATH_TO_SOURCE_1"
|
||||
|
||||
$destinationDirectory = "PATH_TO_DESTINATION"
|
||||
|
||||
# If you want a .json file created, set this $JSON_Export to $true, set the $sourceDirectory_1_json variable to set the path for the .json file.
|
||||
# If you don"t want a .json file, set set this $JSON_Export to $false, and let the others as they are.
|
||||
$JSON_Export = $false
|
||||
$sourceDirectory_1_json = "PATH_TO_JSON_FILE"
|
||||
|
||||
|
||||
|
||||
# Remove dots before the season or the resolution ?
|
||||
$remove_dots = $false
|
||||
# If there is the year in the title, set it to $true
|
||||
$set_year_with_brackets = $false
|
||||
|
||||
# Renaming the output file (and the video title)
|
||||
# Use https://regex101.com/r/cU5lC2/1 to get the RegEx
|
||||
$chain_to_search = ''
|
||||
$chain__to_replace = ''
|
||||
|
||||
# $chain_to_search = '(.*) - S(\d{2})E(\d{3})(.*)H264(.*)'
|
||||
# $chain_to_search = '(.*) - S(\d{2})E(\d{3})(.*)'
|
||||
# $chain__to_replace = '$1 - S$2E$3$4x265-10bits$5--Custom'
|
||||
|
||||
# Move MKV1 (and SRT) to Not-Merged folder ? Set to $false or $true
|
||||
$move_mkv1_after_merge = $true
|
||||
$move_mkv2_after_merge = $true
|
||||
|
||||
# Extension without the .
|
||||
$VideoExtension_1 = "mkv"
|
||||
$VideoExtension_2 = "mkv"
|
||||
|
||||
$no_attachements = $true
|
||||
|
||||
# ################ VIDEO to keep ##################
|
||||
# = 0 : for video from MKV1 (first file)
|
||||
# = 1 : for video from MKV2 (second file)
|
||||
$Video_Lang = "ja" # en for english / fr for french / ja for japanese
|
||||
# ================== AUDIO ================== Common for all videos, MAX 2 audio
|
||||
# _1 will be the first in track-name order, then _2
|
||||
|
||||
# How many audio tracks to keep = 0, 1 or 2
|
||||
$NB_Audio_MKV1 = 1
|
||||
# This is to search for the right ID in the MKV (with JSON)
|
||||
$AudioTrack_1_Lang = "ja" # Set here the first audio lang to keep
|
||||
$AudioTrack_2_Lang = "fr" # Set here the second audio lang to keep
|
||||
# $AudioTrack_Default_Lang = "ja" # Set here the default audio lang to set in merge
|
||||
|
||||
# This is for personalizing the tracks info !
|
||||
# Track 1 = Audio n°1
|
||||
$AudioTrackName_1_sansID = "Japonais - AAC 2.0"
|
||||
$AudioLang_1_sansID = "ja" # en for english / fr for french / ja for japanese
|
||||
$AudioTrack_1_default_sansID = "yes"
|
||||
# Define track order. Do not modify it unless you changed the track number in this section
|
||||
|
||||
# Track 2 = Audio n°2
|
||||
# Name and language of Audio Track n°2
|
||||
$AudioTrackName_2_sansID = "Français - Dolby Digital 2.0"
|
||||
$AudioLang_2_sansID = "fr" # en for english / fr for french / ja for japanese
|
||||
$AudioTrack_2_default_sansID = "no"
|
||||
# Define track order. Do not modify it unless you changed the track number in this section
|
||||
# ================================================================
|
||||
|
||||
|
||||
|
||||
# ===========================================
|
||||
# ================== Internal SUB ? =========
|
||||
# To keep or not internal subtitles
|
||||
# $keep_internal_Sub = $true
|
||||
$Internal_SUB_Number = 0 # Set this to 1 or 2 to keep 1 or 2 or 3 internal subtitles, or to 0 to keep no internal sub.
|
||||
$Internal_SUB_Lang_1 = "fr" # Set here the first internal subtitle lang to keep
|
||||
$Internal_SUB_Lang_2 = "fr" # Set here the second internal subtitle lang to keep
|
||||
$Internal_SUB_Lang_3 = "fr" # Set here the third internal subtitle lang to keep
|
||||
|
||||
# If there is 2 sub in the same language, like "FR Full" and "FR Forced", set those variables :
|
||||
$Internal_SUB_to_search_with_title = $false # Set this to $true if there is at least 2 internal sub in the same lang
|
||||
$Internal_SUB_1_title_to_search = "SDH" # Set this to a string to search in sub title to set it into the first internal sub
|
||||
$Internal_SUB_2_title_to_search = "" # Set this to a string to search in subtitle TITLE to set it into the second internal sub
|
||||
$Internal_SUB_2_title_to_search = "" # Set this to a string to search in subtitle TITLE to set it into the third internal sub
|
||||
$Internal_SUB_to_be_forced = "" # Set this to 1 or 2 in order to set it to forced subtitle
|
||||
|
||||
# Max 3 Internal SRT is configured in the script.
|
||||
# If set to 3, must be 2 SRT configured
|
||||
$SubTrackName_1_sansID = "English SDH - SRT"
|
||||
$SubTrackLang_1_sansID = "en" # en for english / fr for french / jp for japanese
|
||||
$SubTrack_1_default_sansID = "yes"
|
||||
$SubTrack_1_forced_track_sansID = "no"
|
||||
$SubTrack_1_SDH_sansID = "yes"
|
||||
$sub_charset_1_sansID = "UTF-8"
|
||||
|
||||
|
||||
$SubTrackName_2_sansID = "Français - SRT"
|
||||
$SubTrackLang_2_sansID = "fr" # en for english / fr for french / jp for japanese
|
||||
$SubTrack_2_default_sansID = "no"
|
||||
$SubTrack_2_forced_track_sansID = "no"
|
||||
$SubTrack_2_SDH_sansID = "no"
|
||||
$sub_charset_2_sansID = "UTF-8"
|
||||
|
||||
$SubTrackName_3_sansID = "Français - SRT"
|
||||
$SubTrackLang_3_sansID = "fr" # en for english / fr for french / jp for japanese
|
||||
$SubTrack_3_default_sansID = "no"
|
||||
$SubTrack_3_forced_track_sansID = "no"
|
||||
$SubTrack_3_SDH_sansID = "no"
|
||||
$sub_charset_3_sansID = "UTF-8"
|
||||
# ===========================================
|
||||
|
||||
# ===========================================
|
||||
# ================== External SUB ? =========
|
||||
# Must have the same name as MKV1
|
||||
|
||||
$External_SUB = $true
|
||||
$External_SUB_Number = 1 # Works only if $External_SUB = $true
|
||||
# Max 2 External SRT is configured in the script.
|
||||
# If set to 2, must be 2 SRT configured
|
||||
|
||||
# Set Subtitle Extension (Don't add the . before the extension)
|
||||
$SubExtension_1 = 'Full.fre.srt'
|
||||
$SubExtension_2 = 'Forced.fre.srt'
|
||||
|
||||
#### FILE 2 - SRT_1 - Keeping all but the video (audio + chapters tags)
|
||||
# Track 0 = Sub n°1 to keep
|
||||
# Name and language of Subtitle Track n°0 + Sync Value
|
||||
$ExtSubTrackName_1 = "0:Français (Complet) - SRT"
|
||||
$ExtSubTrackLang_1 = "0:fr"
|
||||
$ExtSubTrack_1_default = "0:yes"
|
||||
$ExtSub_charset_1 = "0:UTF-8"
|
||||
$ExtSub_forced_track_1 = "0:no"
|
||||
$ExtSub_SDH_1 = "0:no"
|
||||
|
||||
#### FILE 3 - SRT_2 - Keeping all but the video (audio + chapters tags)
|
||||
# Track 0 = Sub n°1 to keep
|
||||
# Name and language of Subtitle Track n°0 + Sync Value
|
||||
$ExtSubTrackName_2 = "0:Français (Forcé) - SRT"
|
||||
$ExtSubTrackLang_2 = "0:fr"
|
||||
$ExtSubTrack_2_default = "0:no"
|
||||
$ExtSub_charset_2 = "0:UTF-8"
|
||||
$ExtSub_forced_track_2 = "0:yes"
|
||||
$ExtSub_SDH_2 = "0:no"
|
||||
|
||||
#----------------------------------------------------------------------------------------------
|
||||
# DO NOT TOUCH WHAT'S UNDER THIS -----------------------------------------------------------
|
||||
#----------------------------------------------------------------------------------------------
|
||||
|
||||
# #############################################################################################
|
||||
# -> BEGIN FUNCTION DEFINITIONS -----------------------------------------------------------
|
||||
# #############################################################################################
|
||||
|
||||
function Get-Track_ID {
|
||||
param (
|
||||
[Parameter(Mandatory)]$MediaInfo,
|
||||
[Parameter(Mandatory)]$MKV_1,
|
||||
[Parameter(Mandatory)][ValidateSet(1, 2)]$NB_Audio_MKV1,
|
||||
[Parameter(Mandatory)]$AudioTrack_1_Lang,
|
||||
[Parameter(Mandatory)]$AudioTrack_2_Lang,
|
||||
[Parameter(Mandatory)][ValidateSet(0, 1, 2, 3)]$Internal_SUB_Number,
|
||||
[Parameter(Mandatory)]$Internal_SUB_Lang_1,
|
||||
[Parameter(Mandatory)]$Internal_SUB_Lang_2,
|
||||
[Parameter(Mandatory)]$Internal_SUB_Lang_3,
|
||||
[Parameter(Mandatory)][ValidateSet($true, $false)]$Internal_SUB_to_search_with_title,
|
||||
[Parameter(Mandatory)]$Internal_SUB_1_title_to_search = "",
|
||||
[Parameter(Mandatory)]$Internal_SUB_2_title_to_search = "",
|
||||
[Parameter(Mandatory)]$Internal_SUB_3_title_to_search = "",
|
||||
[Parameter(Mandatory = $false)][ValidateSet($true, $false)]$JSON_Export = $false,
|
||||
[Parameter(Mandatory = $false)]$JSON_file = ""
|
||||
)
|
||||
|
||||
# Values witch will be found with MediaInfo JSON
|
||||
$VideoTrack_ID = ""
|
||||
$AudioTrack_1_ID = ""
|
||||
$AudioTrack_2_ID = ""
|
||||
$Internal_Sub_1_ID = ""
|
||||
$Internal_Sub_2_ID = ""
|
||||
$Internal_Sub_3_ID = ""
|
||||
|
||||
$JSON_video_position = "" # To use with $JSON_object.media.Track[ ]
|
||||
$JSON_audio_1_position = "" # To use with $JSON_object.media.Track[ ]
|
||||
$JSON_audio_2_position = "" # To use with $JSON_object.media.Track[ ]
|
||||
$JSON_sub_1_position = ""
|
||||
$JSON_sub_2_position = ""
|
||||
$JSON_sub_3_position = ""
|
||||
|
||||
if (( $JSON_Export -eq $true) -And ( $JSON_file -ne "")) {
|
||||
$MediaInfo_arguments = "--output=JSON --LogFile=`"$JSON_file`""
|
||||
}
|
||||
else {
|
||||
if ( $JSON_Export -eq $false ) {
|
||||
Write-Host "`tNo JSON file will be created..." -ForegroundColor "White" -BackgroundColor "DarkRed"
|
||||
}
|
||||
elseif ( $JSON_file -eq "") {
|
||||
Write-Host "`tNo JSON file is pass in Get-Track_ID function parameters !!`n`tThere will not be any JSON file created..." -ForegroundColor "White" -BackgroundColor "DarkRed"
|
||||
}
|
||||
$MediaInfo_arguments = "--output=JSON"
|
||||
}
|
||||
$command_info = "& $MediaInfo $MediaInfo_arguments `"$MKV_1`""
|
||||
# Launch command begin... and we're grabbing the output into json_output
|
||||
$json_output = Invoke-Expression $command_info
|
||||
# Write-Host "`$json_output = `n$json_output" -ForegroundColor "green"
|
||||
# $JSON_object = Get-Content -Raw -Path "$JSON_file" | ConvertFrom-Json
|
||||
$JSON_object = $json_output | ConvertFrom-Json
|
||||
|
||||
|
||||
$i = 0 # Counter for video track detected
|
||||
$j = 0 # Counter for audio track detected
|
||||
$k = 0 # Counter for audio tracks kept
|
||||
$l = 0 # Counter for track position
|
||||
$m = 0 # Counter for sub track detected
|
||||
$n = 0 # Counter for sub tracks kept
|
||||
$JSON_VideoCount = $JSON_object.media.Track[0].VideoCount
|
||||
$JSON_AudioCount = $JSON_object.media.Track[0].AudioCount
|
||||
$JSON_SubCount = $JSON_object.media.Track[0].TextCount
|
||||
|
||||
foreach ( $track in $JSON_object.media.Track ) {
|
||||
# Note :
|
||||
# The reel track ID is 1 minus the ID get in JSON...
|
||||
|
||||
# Check if there is a bug in the script
|
||||
if ( $j -gt $JSON_AudioCount ) {
|
||||
Write-Host "`tThere is a problem in Audio Track detection from JSON !! Need to debug this !!" -ForegroundColor "White" -BackgroundColor "DarkRed"
|
||||
Exit
|
||||
}
|
||||
elseif ( $i -gt $JSON_VideoCount ) {
|
||||
Write-Host "`tThere is a problem in Video Track detection from JSON !! Need to debug this !!" -ForegroundColor "White" -BackgroundColor "DarkRed"
|
||||
Exit
|
||||
}
|
||||
elseif ( ( $m -gt $JSON_SubCount ) -And ( $JSON_SubCount -ne $null ) ) {
|
||||
Write-Host "`tThere is a problem in Subtitles Track detection from JSON !! Need to debug this !!" -ForegroundColor "White" -BackgroundColor "DarkRed"
|
||||
Exit
|
||||
}
|
||||
|
||||
if ( $track."@type" -match "Video" ) {
|
||||
$VideoTrack_ID = $track.id - 1
|
||||
$i++
|
||||
$JSON_video_position = $l
|
||||
}
|
||||
elseif ( $track."@type" -match "Audio" ) {
|
||||
$j++
|
||||
|
||||
if (( $track."Language" -match "$AudioTrack_1_Lang" ) -And ( $AudioTrack_1_ID -eq "" ) -And ( $k -ne $NB_Audio_MKV1)) {
|
||||
$AudioTrack_1_ID = $track.id - 1
|
||||
$k++
|
||||
$JSON_audio_1_position = $l
|
||||
}
|
||||
elseif (( $track."Language" -match "$AudioTrack_2_Lang" ) -And ( $AudioTrack_2_ID -eq "" ) -And ( $k -ne $NB_Audio_MKV1)) {
|
||||
$AudioTrack_2_ID = $track.id - 1
|
||||
$k++
|
||||
$JSON_audio_2_position = $l
|
||||
}
|
||||
else {
|
||||
if (( $AudioTrack_1_ID -eq "" ) -And ( $AudioTrack_2_ID -eq "" )) {
|
||||
Write-Host "`tThere is no audio tracks that match your specifications." -ForegroundColor "Yellow"
|
||||
}
|
||||
else {
|
||||
Write-Host "`tThere is no audio tracks that match your specifications." -ForegroundColor "Yellow"
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif ( $track."@type" -match "Text" ) {
|
||||
$m++
|
||||
if ($Internal_SUB_Number -ne 0 ) {
|
||||
if ( ( $Internal_SUB_Lang_1 -ne "" ) -And ( $track."Language" -match "$Internal_SUB_Lang_1" ) -And ( $Internal_Sub_1_ID -eq "" ) -And ( $n -ne $Internal_SUB_Number ) -And (( $Internal_SUB_to_search_with_title -eq $false ) -OR (( $Internal_SUB_to_search_with_title -eq $true ) -And ( $track.Title -match "$Internal_SUB_1_title_to_search" )) ) ) {
|
||||
$Internal_Sub_1_ID = $track.id - 1
|
||||
$n++
|
||||
$JSON_sub_1_position = $l
|
||||
}
|
||||
elseif ( ( $Internal_SUB_Lang_2 -ne "" ) -And ( $track."Language" -match "$Internal_SUB_Lang_2" ) -And ( $Internal_Sub_2_ID -eq "" ) -And ( $n -ne $Internal_SUB_Number) -And (( $Internal_SUB_to_search_with_title -eq $false ) -OR (( $Internal_SUB_to_search_with_title -eq $true ) -And ( $track.Title -match "$Internal_SUB_2_title_to_search" )) ) ) {
|
||||
$Internal_Sub_2_ID = $track.id - 1
|
||||
$n++
|
||||
$JSON_sub_2_position = $l
|
||||
}
|
||||
elseif ( ( $Internal_SUB_Lang_3 -ne "" ) -And ( $track."Language" -match "$Internal_SUB_Lang_3" ) -And ( $Internal_Sub_3_ID -eq "" ) -And ( $n -ne $Internal_SUB_Number) -And (( $Internal_SUB_to_search_with_title -eq $false ) -OR (( $Internal_SUB_to_search_with_title -eq $true ) -And ( $track.Title -match "$Internal_SUB_3_title_to_search" )) ) ) {
|
||||
$Internal_Sub_3_ID = $track.id - 1
|
||||
$n++
|
||||
$JSON_sub_3_position = $l
|
||||
}
|
||||
else {
|
||||
|
||||
}
|
||||
}
|
||||
else {
|
||||
# Some Internal Sub are present, but we don't care, we don't keep it/them...
|
||||
Write-Host "`tThere is some internal subtitle tracks, but you choose to not keep it/them..." -ForegroundColor "Cyan"
|
||||
}
|
||||
}
|
||||
|
||||
$l++ # Increment number of track processed
|
||||
}
|
||||
if ($Internal_SUB_Number -ne 0 ) {
|
||||
# Checking if there are the right number of IDs retrieved
|
||||
if ( ( $Internal_SUB_Number -ne 0 ) -And ( $JSON_SubCount -eq 0 ) ) {
|
||||
Write-Host "`tYou choose to keep at least one internal subtitle, but there isn't any in the MKV..." -ForegroundColor "Red"
|
||||
}
|
||||
|
||||
|
||||
if (( $Internal_Sub_1_ID -eq "" ) -And ( $Internal_Sub_2_ID -eq "" ) -And ( $Internal_Sub_3_ID -eq "" )) {
|
||||
Write-Host "`tThere is no internal subtitle tracks that match your specifications." -ForegroundColor "Yellow"
|
||||
}
|
||||
else {
|
||||
$counter = 0
|
||||
if ( $Internal_Sub_1_ID -ne "" ) {
|
||||
$counter++
|
||||
}
|
||||
if ( $Internal_Sub_2_ID -ne "" ) {
|
||||
$counter++
|
||||
}
|
||||
if ( $Internal_Sub_3_ID -ne "" ) {
|
||||
$counter++
|
||||
}
|
||||
if ( $counter -lt $Internal_SUB_Number ) {
|
||||
# Not all desired subtitles are retrieved
|
||||
Write-Host "`tNot all desired subtitles are retrieved..." -ForegroundColor "Red"
|
||||
if (( $Internal_SUB_Number -ge 1 ) -And ( $Internal_Sub_1_ID -eq "" )) {
|
||||
Write-Host "`tThere is no internal subtitle tracks that match your specification language : $Internal_SUB_Lang_1." -ForegroundColor "Yellow"
|
||||
}
|
||||
if (( $Internal_SUB_Number -ge 2 ) -And ( $Internal_Sub_2_ID -eq "" )) {
|
||||
Write-Host "`tThere is no internal subtitle tracks that match your specification language : $Internal_SUB_Lang_2." -ForegroundColor "Yellow"
|
||||
}
|
||||
if (( $Internal_SUB_Number -eq 3 ) -And ( $Internal_Sub_3_ID -eq "" )) {
|
||||
Write-Host "`tThere is no internal subtitle tracks that match your specification language : $Internal_SUB_Lang_3." -ForegroundColor "Yellow"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
# Write-Host "`tThere is no internal subtitle tracks that match your specifications." -ForegroundColor "Yellow"
|
||||
}
|
||||
}
|
||||
|
||||
# if ( ( $Internal_SUB_Number -eq 1 ) -And ( $Internal_Sub_1_ID -eq "" ) ) {
|
||||
# Write-Host "`tYou choose to keep one internal subtitle, but there isn't any in the MKV..." -ForegroundColor "Red"
|
||||
# }
|
||||
# elseif ( ( $Internal_SUB_Number -eq 2 ) -And ( ($Internal_Sub_1_ID -eq "") -Or ($Internal_Sub_2_ID -eq "") ) ) {
|
||||
# if ( $Internal_Sub_1_ID -eq "" ) {
|
||||
# Write-Host "`tYou choose to keep two internal subtitle, but there isn't any in the MKV..." -ForegroundColor "Yellow"
|
||||
# }
|
||||
# }
|
||||
# elseif ( ( $Internal_SUB_Number -eq 2 ) -And ( ($Internal_Sub_1_ID -eq "") -And ($Internal_Sub_2_ID -eq "") ) ) {
|
||||
# Write-Host "`tYou choose to keep two internal subtitle, but there isn't any in the MKV..." -ForegroundColor "Yellow"
|
||||
# }
|
||||
# elseif ( ( $Internal_SUB_Number -eq 2 ) -And ( ($Internal_Sub_1_ID -ne "") -And ($Internal_Sub_2_ID -ne "") -And ($Internal_Sub_3_ID -eq "") ) ) {
|
||||
# Write-Host "`tOnly Two Internal Subtitles ID have been retrieved ! Great !" -ForegroundColor "Yellow"
|
||||
# }
|
||||
# elseif ( ( $Internal_SUB_Number -eq 3 ) -And ( ($Internal_Sub_1_ID -ne "") -And ($Internal_Sub_2_ID -ne "") -And ($Internal_Sub_3_ID -ne "") ) ) {
|
||||
# Write-Host "`tOnly Three Internal Subtitles ID have been retrieved ! Great !" -ForegroundColor "Yellow"
|
||||
# }
|
||||
|
||||
Write-Host "`t`$VideoTrack_ID = $VideoTrack_ID" -ForegroundColor "Yellow"
|
||||
if ($NB_Audio_MKV1 -ge 1) {
|
||||
Write-Host "`t`$AudioTrack_1_ID = $AudioTrack_1_ID`tLang set in the script = $AudioTrack_1_Lang" -ForegroundColor "Yellow"
|
||||
if ($NB_Audio_MKV1 -eq 2) {
|
||||
Write-Host "`t`$AudioTrack_2_ID = $AudioTrack_2_ID`tLang set in the script = $AudioTrack_2_Lang" -ForegroundColor "Yellow"
|
||||
}
|
||||
}
|
||||
|
||||
if ( $Internal_SUB_Number -ne 0 ) {
|
||||
Write-Host "`t`$Internal_Sub_1_ID = $Internal_Sub_1_ID`tLang set in the script = $Internal_SUB_Lang_1" ( &{ If ($Internal_SUB_to_search_with_title -eq $true) { "`tSearched Title was : $Internal_SUB_1_title_to_search" } Else { "" } }) -ForegroundColor "Yellow"
|
||||
if ($Internal_SUB_Number -ge 2) {
|
||||
Write-Host "`t`$Internal_Sub_2_ID = $Internal_Sub_2_ID`tLang set in the script = $Internal_SUB_Lang_2" ( &{ If ($Internal_SUB_to_search_with_title -eq $true) { "`tSearched Title was : $Internal_SUB_2_title_to_search" } Else { "" } }) -ForegroundColor "Yellow"
|
||||
if ($Internal_SUB_Number -eq 3) {
|
||||
Write-Host "`t`$Internal_Sub_3_ID = $Internal_Sub_3_ID`tLang set in the script = $Internal_SUB_Lang_3" ( &{ If ($Internal_SUB_to_search_with_title -eq $true) { "`tSearched Title was : $Internal_SUB_3_title_to_search" } Else { "" } }) -ForegroundColor "Yellow"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $VideoTrack_ID, $AudioTrack_1_ID, $AudioTrack_2_ID, $Internal_Sub_1_ID, $Internal_Sub_2_ID, $Internal_Sub_3_ID
|
||||
}
|
||||
|
||||
function Test-Directory {
|
||||
param (
|
||||
[Parameter(Mandatory)]$path_to_verify
|
||||
)
|
||||
If (!(test-path $path_to_verify)) {
|
||||
New-Item -ItemType "Directory" -Force -Path $path_to_verify
|
||||
Write-Host "The path $path_to_verify (or one of the last subfolder) didn't exist. It has been created." -ForegroundColor "DarkBlue"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# #############################################################################################
|
||||
# -> BEGIN MAIN SCRIPT -------------------------------------------------------------------
|
||||
# #############################################################################################
|
||||
|
||||
# Resetting some variables that should be equal to ""
|
||||
if ( $NB_Audio_MKV1 -eq 0 ) {
|
||||
$AudioTrack_1_Lang = ""
|
||||
$AudioTrack_2_Lang = ""
|
||||
}
|
||||
elseif ( $NB_Audio_MKV1 -eq 1 ) {
|
||||
$AudioTrack_2_Lang = ""
|
||||
}
|
||||
|
||||
if ( $Internal_SUB_Number -eq 0 ) {
|
||||
$Internal_SUB_Lang_1 = ""
|
||||
$Internal_SUB_Lang_2 = ""
|
||||
$Internal_SUB_Lang_3 = ""
|
||||
}
|
||||
elseif ( $Internal_SUB_Number -eq 1 ) {
|
||||
$Internal_SUB_Lang_2 = ""
|
||||
$Internal_SUB_Lang_3 = ""
|
||||
}
|
||||
elseif ( $Internal_SUB_Number -eq 2 ) {
|
||||
$Internal_SUB_Lang_3 = ""
|
||||
}
|
||||
# -------------------------------------------------
|
||||
|
||||
# Define track order - DO NOT TOUCH
|
||||
$track_order_EXT_sub = ""
|
||||
if ( $merge_another_video_MKV2 -eq $false) {
|
||||
if ( $External_SUB -eq $true ) {
|
||||
if ( $External_SUB_Number -ge 1 ) {
|
||||
$track_order_EXT_sub += "1:0"
|
||||
if ( $External_SUB_Number -eq 2 ) {
|
||||
$track_order_EXT_sub += ",2:0"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ( $External_SUB -eq $true ) {
|
||||
if ( $External_SUB_Number -ge 1 ) {
|
||||
$track_order_EXT_sub += "2:0"
|
||||
if ( $External_SUB_Number -eq 2 ) {
|
||||
$track_order_EXT_sub += ",3:0"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# ===========================================
|
||||
|
||||
# Checking if the $destinationDirectory exists, if not, create the folder(s)
|
||||
Test-Directory $destinationDirectory
|
||||
|
||||
# Counting the number of MKV_1
|
||||
$MKV_1_List = Get-ChildItem $sourceDirectory_1 -Filter "*.$VideoExtension_1" | ForEach-Object { $_.FullName } | Sort-Object
|
||||
$Count_1 = $MKV_1_List.count
|
||||
Write-Host "$Count_1 Videos ($VideoExtension_1) to be processed in $sourceDirectory_1."
|
||||
# Testing if the Done_Remerged folder already exists : if yes, it will be renamed, else it will be created.
|
||||
$Path_Folder_NotMerged_1 = $sourceDirectory_1 + "\Done_Remerged"
|
||||
Test-Directory $Path_Folder_NotMerged_1
|
||||
|
||||
if ($merge_another_video_MKV2 -eq $true) {
|
||||
# Counting the number of MKV_1
|
||||
$MKV_2_List = Get-ChildItem $sourceDirectory_2 -Filter "*.$VideoExtension_2" | ForEach-Object { $_.FullName } | Sort-Object
|
||||
$Count_2 = $MKV_2_List.count
|
||||
Write-Host "$Count_2 MKV's to be processed in $sourceDirectory_2."
|
||||
# Testing if the Done_Remerged folder already exists : if yes, it will be renamed, else it will be created.
|
||||
$Path_Folder_NotMerged_2 = $sourceDirectory_2 + "\Done_Remerged"
|
||||
Test-Directory $Path_Folder_NotMerged_2
|
||||
|
||||
|
||||
# #########################
|
||||
# Check if there is the same .mkv files in both source directory
|
||||
if ($Count_1 -eq $Count_2) {
|
||||
Write-Host "There is the same number of MKV in the two sources folders. Let's continue."
|
||||
}
|
||||
else {
|
||||
Write-Host "The number of MKV in the two sources folders isn't the same. ABORT..." -foreground "red"
|
||||
Exit
|
||||
}
|
||||
# #########################
|
||||
}
|
||||
|
||||
# #########################
|
||||
# Check if there is the same number of .srt files as .mkv files
|
||||
if ( $External_SUB -eq $true ) {
|
||||
if ( $External_SUB_Number -ge 1 ) {
|
||||
# If $NB_External_SUB >= 1 (include =1 and =2)
|
||||
$SRT_1_List = Get-ChildItem $sourceDirectory_1 -Filter "*.$SubExtension_1" | ForEach-Object { $_.FullName } | Sort-Object
|
||||
$Count_1_SRT = $SRT_1_List.count
|
||||
Write-Host "$Count_1_SRT SRT's ($SubExtension_1) to be processed in $sourceDirectory_1."
|
||||
if ($Count_1 -eq $Count_1_SRT) {
|
||||
Write-Host "There is the same number of MKV and SRT n°1 files ($SubExtension_1) in this folder. Let's continue."
|
||||
}
|
||||
else {
|
||||
Write-Host "The number of MKV and SRT n°1 files isn't the same. ABORT..." -foreground "red"
|
||||
Exit
|
||||
}
|
||||
}
|
||||
|
||||
if ( $External_SUB_Number -eq 2 ) {
|
||||
# Only if $External_SUB_Number = 2
|
||||
$SRT_2_List = Get-ChildItem $sourceDirectory_1 -Filter "*.$SubExtension_2" | ForEach-Object { $_.FullName } | Sort-Object
|
||||
$Count_2_SRT = $SRT_2_List.count
|
||||
Write-Host "$Count_2_SRT SRT's ($SubExtension_2) to be processed in $sourceDirectory_1."
|
||||
|
||||
if ($Count_1 -eq $Count_2_SRT) {
|
||||
Write-Host "There is the same number of MKV and SRT n°2 files ($SubExtension_2) in this folder. Let's continue."
|
||||
}
|
||||
else {
|
||||
Write-Host "The number of MKV and SRT n°2 files ($SubExtension_2) isn't the same. ABORT..." -foreground "red"
|
||||
Exit
|
||||
}
|
||||
}
|
||||
}
|
||||
# #########################
|
||||
|
||||
$compteur = 1 # Counter to show the progress of file processed
|
||||
|
||||
Foreach ($MKV_1 in $MKV_1_List) {
|
||||
|
||||
Write-Host "" -ForegroundColor "black" -BackgroundColor "white"
|
||||
Write-Host "Traitement du fichier n° $compteur / $Count_1..." -ForegroundColor "black" -BackgroundColor "white"
|
||||
Write-Host "" -ForegroundColor "black" -BackgroundColor "white"
|
||||
|
||||
# Clear variables
|
||||
$MKVMerge_param_start = ""
|
||||
$MKVMerge_param_mkv1 = ""
|
||||
$MKVMerge_param_srt1 = ""
|
||||
$MKVMerge_param_srt2 = ""
|
||||
$MKVMerge_param_all = ""
|
||||
$MKVMerge_sub_param = ""
|
||||
$SRT_1_Name = ""
|
||||
$SRT_2_Name = ""
|
||||
$SRT_1 = ""
|
||||
$SRT_2 = ""
|
||||
$SubTrackName_1 = ""
|
||||
$SubTrackLang_1 = ""
|
||||
$SubTrack_1_default = ""
|
||||
$sub_charset_1 = ""
|
||||
$SubTrackName_2 = ""
|
||||
$SubTrackLang_2 = ""
|
||||
$SubTrack_2_default = ""
|
||||
$sub_charset_2 = ""
|
||||
$track_order = ""
|
||||
$VideoTrack_ID, $AudioTrack_1_ID, $AudioTrack_2_ID = "", "", ""
|
||||
$Internal_Sub_1_ID, $Internal_Sub_2_ID, $Internal_Sub_3_ID = "", "", ""
|
||||
$MKVMerge_audio_param = ""
|
||||
|
||||
$FormatName_1 = (Get-Item $MKV_1).Basename
|
||||
$MKV_1_name = $FormatName_1.ToString()
|
||||
|
||||
# #################################################################
|
||||
# Title for the video track and for the destination file $Output
|
||||
$VideoTrackName = $MKV_1_name
|
||||
if ( $set_year_with_brackets -eq $true ) {
|
||||
if ( $type_media -eq "movie" ) {
|
||||
$VideoTrackName = $VideoTrackName -replace '(\d{4}(?=\..*))', '($1)'
|
||||
}
|
||||
elseif ( $type_media -eq "serie" ) {
|
||||
$VideoTrackName = $VideoTrackName -replace '(\d{4}(?=.*S\d{2}E\d{2}))', '($1)'
|
||||
}
|
||||
}
|
||||
if ( $remove_dots -eq $true ) {
|
||||
if ( $type_media -eq "movie" ) {
|
||||
$VideoTrackName = $VideoTrackName -replace '\.(?=.*\d{4})', ' '
|
||||
}
|
||||
elseif ( $type_media -eq "serie" ) {
|
||||
$VideoTrackName = $VideoTrackName -replace '\.(?=.*S\d{2}E\d{2})', ' '
|
||||
}
|
||||
}
|
||||
$VideoTrackName = $VideoTrackName -replace $chain_to_search, $chain__to_replace
|
||||
$VideoTrackName = "$VideoTrackName"
|
||||
Write-Host "`tThe Video Track Name will be : `r`n`t`t $VideoTrackName" -ForegroundColor "green"
|
||||
if ( $compteur -le 3 ) {
|
||||
# Will prompt for a key to be pressed for the 3 first names
|
||||
Write-Host "`tFor the 3 first file, this will show up, and pause for 10s" -ForegroundColor "yellow";
|
||||
Start-Sleep -Seconds 10
|
||||
}
|
||||
$Output = "$destinationDirectory" + "\" + "$VideoTrackName" + ".mkv"
|
||||
$JSON_file = "$sourceDirectory_1_json\$MKV_1_name.json"
|
||||
# #################################################################
|
||||
|
||||
# Now we'll get the track ID for the MKV in action !
|
||||
$VideoTrack_ID, $AudioTrack_1_ID, $AudioTrack_2_ID, $Internal_Sub_1_ID, $Internal_Sub_2_ID, $Internal_Sub_3_ID = Get-Track_ID $MediaInfo $MKV_1 $NB_Audio_MKV1 $AudioTrack_1_Lang $AudioTrack_2_Lang $Internal_SUB_Number $Internal_SUB_Lang_1 $Internal_SUB_Lang_2 $Internal_SUB_Lang_3 $Internal_SUB_to_search_with_title $Internal_SUB_1_title_to_search $Internal_SUB_2_title_to_search $Internal_SUB_3_title_to_search $JSON_Export $JSON_file
|
||||
|
||||
# Exception for some files !!! -----------------------------------------------------------------
|
||||
if ( $MKV_1_name.Substring(0, 26) -eq "One Piece (1999) - S20E001" ) {
|
||||
$AudioTrack_1_ID = 2 # Manual set for 1st audio track in final MKV
|
||||
$AudioTrack_2_ID = 1 # Manual set for 2nd audio track in final MKV
|
||||
Write-Host "`tThis file doesn't have correct track language. We set it to :`n`t`t`$AudioTrack_1_ID = $AudioTrack_1_ID`t for audio lang 1 = $AudioTrack_1_Lang`n`t`t`$AudioTrack_2_ID = $AudioTrack_2_ID." -ForegroundColor "White" -BackgroundColor "DarkRed"
|
||||
}
|
||||
# if ( $MKV_1_name.Substring(0, 26) -eq "One Piece (1999) - S18E001" ) {
|
||||
# $AudioTrackName_1_sansID = "Japonais - AAC 2.0"
|
||||
# $AudioTrackName_2_sansID = "Français - AAC 2.0"
|
||||
# Write-Host "`tThis file doesn't have correct track language. We set it to : `$AudioTrack_1_ID = $AudioTrack_1_ID`tand`t`$AudioTrack_2_ID = $AudioTrack_2_ID."
|
||||
# }
|
||||
# if ( $MKV_1_name.Substring(0, 26) -eq "One Piece (1999) - S18E008" ) {
|
||||
# $AudioTrack_1_ID = 2
|
||||
# $AudioTrack_2_ID = 1
|
||||
# Write-Host "`tThis file doesn't have correct track language. We set it to : `$AudioTrack_1_ID = $AudioTrack_1_ID`tand`t`$AudioTrack_2_ID = $AudioTrack_2_ID."
|
||||
# }
|
||||
# if ( $MKV_1_name.Substring(0, 26) -eq "One Piece (1999) - S18E020" ) {
|
||||
# $AudioTrack_1_ID = 2
|
||||
# $AudioTrack_2_ID = 1
|
||||
# Write-Host "`tThis file doesn't have correct track language. We set it to : `$AudioTrack_1_ID = $AudioTrack_1_ID`tand`t`$AudioTrack_2_ID = $AudioTrack_2_ID."
|
||||
# }
|
||||
|
||||
|
||||
# End of Exceptions ----------------------------------------------------------------------------
|
||||
|
||||
if ( $merge_another_video_MKV2 -eq $false ) {
|
||||
# Only 1 MKV is to re-merge
|
||||
# We keep video and audio from MKV_1
|
||||
if (( $NB_Audio_MKV1 -gt 0 ) -and ($NB_Audio_MKV1 -le 2)) {
|
||||
# $NB_Audio_MKV1 = 1 or 2
|
||||
$MKVMerge_audio_param = "--language $AudioTrack_1_ID" + ":$AudioLang_1_sansID --track-name `"$AudioTrack_1_ID" + ":$AudioTrackName_1_sansID`" --default-track $AudioTrack_1_ID" + ":$AudioTrack_1_default_sansID"
|
||||
$track_order = "$VideoTrack_ID" + ":0,0:$AudioTrack_1_ID"
|
||||
if ( $NB_Audio_MKV1 -eq 2 ) {
|
||||
$MKVMerge_audio_param += " --language $AudioTrack_2_ID" + ":$AudioLang_2_sansID --track-name `"$AudioTrack_2_ID" + ":$AudioTrackName_2_sansID`" --default-track $AudioTrack_2_ID" + ":$AudioTrack_2_default_sansID"
|
||||
$track_order += ",0:$AudioTrack_2_ID"
|
||||
}
|
||||
}
|
||||
elseif ($NB_Audio_MKV1 -ne 0) {
|
||||
write-host "Problem with `$NB_Audio_MKV1=$NB_Audio_MKV1.`n`$NB_Audio_MKV1 must be set to : 0, 1 or 2" -ForegroundColor "Red"
|
||||
exit
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
# 2 MKV are to be merged, keeping audio from MKV_1 and only video from MKV_2
|
||||
|
||||
# We change the video track ID because it's on the MKV_2 !!
|
||||
$VideoTrack_ID = "0" # May not be usefull... TO-DO !!!!
|
||||
|
||||
# ########################################################
|
||||
# Extracting the episode number of the OnePiece Serie (must be commented if not used...)
|
||||
# Generating pattern string to search for the right MKV2 file in case of filename differents...
|
||||
|
||||
# $MKV1_search_pattern = '(.*) - (\d{3}) -(.*)'
|
||||
# # $chain__to_replace = ''
|
||||
# $MKV1_chain_to_replace_for_MKV2 = '$1 - $2'
|
||||
# $MKV_2_search_pattern = $MKV_1_name -replace $MKV1_search_pattern, $MKV1_chain_to_replace_for_MKV2
|
||||
|
||||
$MKV_2_search_pattern = $MKV_1_name
|
||||
# Get MKV2 filename
|
||||
$MKV_2_file = get-ChildItem $sourceDirectory_2 | where { $_.name -like "*$MKV_2_search_pattern*" } | select name
|
||||
$FormatName_2 = $MKV_2_file.Name.ToString()
|
||||
$MKV_2_name = $FormatName_2.Substring(0, $FormatName_2.Length - ($VideoExtension_2.Length + 1))
|
||||
$MKV_2 = $sourceDirectory_2 + "\" + $MKV_2_name + ".$VideoExtension_2"
|
||||
|
||||
# Now that MKV_2 is defined, we can create the MKVmerge parameters, witch will be common to all merge.
|
||||
$MKVMerge_param_mkv2 = "--no-audio --no-subtitles --no-track-tags --no-global-tags --language 0:$Video_Lang --track-name `"0:$VideoTrackName`" --default-track 0:yes `"$MKV_2`""
|
||||
|
||||
|
||||
|
||||
if (( $NB_Audio_MKV1 -gt 0 ) -and ($NB_Audio_MKV1 -le 2)) {
|
||||
# $NB_Audio_MKV1 = 1 or 2
|
||||
$MKVMerge_audio_param = "--language $AudioTrack_1_ID" + ":$AudioLang_1_sansID --track-name `"$AudioTrack_1_ID" + ":$AudioTrackName_1_sansID`" --default-track $AudioTrack_1_ID" + ":$AudioTrack_1_default_sansID"
|
||||
$track_order = "1:0,0:$AudioTrack_1_ID"
|
||||
if ( $NB_Audio_MKV1 -eq 2 ) {
|
||||
$MKVMerge_audio_param += " --language $AudioTrack_2_ID" + ":$AudioLang_2_sansID --track-name `"$AudioTrack_2_ID" + ":$AudioTrackName_2_sansID`" --default-track $AudioTrack_2_ID" + ":$AudioTrack_2_default_sansID"
|
||||
$track_order += ",0:$AudioTrack_2_ID"
|
||||
}
|
||||
}
|
||||
elseif ($NB_Audio_MKV1 -ne 0) {
|
||||
write-host "Problem with `$NB_Audio_MKV1=$NB_Audio_MKV1.`n`$NB_Audio_MKV1 must be set to : 0, 1 or 2" -ForegroundColor "Red"
|
||||
exit
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
if ( $Internal_SUB_Number -ne 0 ) {
|
||||
|
||||
# Sub n°1 to keep
|
||||
# Name and language of Subtitle Track n°1 + Sync Value
|
||||
$SubTrackName_1 = "$Internal_Sub_1_ID" + ":$SubTrackName_1_sansID"
|
||||
$SubTrackLang_1 = "$Internal_Sub_1_ID" + ":$SubTrackLang_1_sansID"
|
||||
$SubTrack_1_default = "$Internal_Sub_1_ID" + ":$SubTrack_1_default_sansID"
|
||||
$SubTrack_1_forced_track = "$Internal_Sub_1_ID" + ":$SubTrack_1_forced_track_sansID"
|
||||
$SubTrack_1_SDH = "$Internal_Sub_1_ID" + ":$SubTrack_1_SDH_sansID"
|
||||
$sub_charset_1 = "$Internal_Sub_1_ID" + ":$sub_charset_1_sansID"
|
||||
# Define track order
|
||||
$track_order += ",0:$Internal_Sub_1_ID"
|
||||
$subtitle_tracks = "$Internal_Sub_1_ID"
|
||||
$MKVMerge_sub_param = "--sub-charset $sub_charset_1 --language $SubTrackLang_1 --track-name `"$SubTrackName_1`" --default-track $SubTrack_1_default --forced-track $SubTrack_1_forced_track --hearing-impaired-flag $SubTrack_1_SDH"
|
||||
|
||||
if ( $Internal_SUB_Number -ge 2 ) {
|
||||
# Sub n°2 to keep
|
||||
# Name and language of Subtitle Track n°1 + Sync Value
|
||||
$SubTrackName_2 = "$Internal_Sub_2_ID" + ":$SubTrackName_2_sansID"
|
||||
$SubTrackLang_2 = "$Internal_Sub_2_ID" + ":$SubTrackLang_2_sansID"
|
||||
$SubTrack_2_default = "$Internal_Sub_2_ID" + ":$SubTrack_2_default_sansID"
|
||||
$SubTrack_2_forced_track = "$Internal_Sub_2_ID" + ":$SubTrack_2_forced_track_sansID"
|
||||
$SubTrack_2_SDH = "$Internal_Sub_2_ID" + ":$SubTrack_2_SDH_sansID"
|
||||
$sub_charset_2 = "$Internal_Sub_2_ID" + ":$sub_charset_2_sansID"
|
||||
# Define track order
|
||||
$track_order += ",0:$Internal_Sub_2_ID"
|
||||
$subtitle_tracks += ",$Internal_Sub_2_ID"
|
||||
$MKVMerge_sub_param += " --sub-charset $sub_charset_2 --language $SubTrackLang_2 --track-name `"$SubTrackName_2`" --default-track $SubTrack_2_default --forced-track $SubTrack_2_forced_track --hearing-impaired-flag $SubTrack_2_SDH"
|
||||
}
|
||||
if ( $Internal_SUB_Number -eq 3 ) {
|
||||
# Sub n°3 to keep
|
||||
# Name and language of Subtitle Track n°1 + Sync Value
|
||||
$SubTrackName_3 = "$Internal_Sub_3_ID" + ":$SubTrackName_3_sansID"
|
||||
$SubTrackLang_3 = "$Internal_Sub_3_ID" + ":$SubTrackLang_3_sansID"
|
||||
$SubTrack_3_default = "$Internal_Sub_3_ID" + ":$SubTrack_3_default_sansID"
|
||||
$SubTrack_3_forced_track = "$Internal_Sub_3_ID" + ":$SubTrack_3_forced_track_sansID"
|
||||
$SubTrack_3_SDH = "$Internal_Sub_3_ID" + ":$SubTrack_3_SDH_sansID"
|
||||
$sub_charset_3 = "$Internal_Sub_3_ID" + ":$sub_charset_3_sansID"
|
||||
# Define track order
|
||||
$track_order += ",0:$Internal_Sub_3_ID"
|
||||
$subtitle_tracks += ",$Internal_Sub_3_ID"
|
||||
$MKVMerge_sub_param += " --sub-charset $sub_charset_3 --language $SubTrackLang_3 --track-name `"$SubTrackName_3`" --default-track $SubTrack_3_default --forced-track $SubTrack_3_forced_track --hearing-impaired-flag $SubTrack_3_SDH"
|
||||
}
|
||||
$subtitle_tracks = "`"$subtitle_tracks`""
|
||||
}
|
||||
|
||||
if ( ( $External_SUB_Number -ne 0 ) -and ( $External_SUB -eq $true ) ) {
|
||||
|
||||
# First external SRT to include
|
||||
$SRT_1_Name = $MKV_1_name + ".$SubExtension_1"
|
||||
$SRT_1 = $sourceDirectory_1 + "\" + $SRT_1_name
|
||||
|
||||
# Subtitles are elsewhere...
|
||||
# $SRT_1_Name = "3_English.srt"
|
||||
# $SRT_1 = $sourceDirectory_1 + "\" + $SRT_1_name
|
||||
# $SRT_1 = $sourceDirectory_1 + "\Subs\" + $MKV_1_name + "\" + $SRT_1_name
|
||||
|
||||
If (-Not (Test-Path $SRT_1) ) {
|
||||
Write-Host "File NON-EXISTANT - $SRT_1" -ForegroundColor "Red"
|
||||
Write-Host "Check the filename or the script. ABORT..." -ForegroundColor "Red"
|
||||
Exit
|
||||
}
|
||||
$track_order += ",$track_order_EXT_sub"
|
||||
|
||||
$MKVMerge_param_srt1 = "--sub-charset $Extsub_charset_1 --language $ExtSubTrackLang_1 --track-name `"$ExtSubTrackName_1`" --default-track $ExtSubTrack_1_default --forced-track $ExtSub_forced_track_1 --hearing-impaired-flag $ExtSub_SDH_1 `"$SRT_1`""
|
||||
|
||||
if ( $External_SUB_Number -eq 2 ) {
|
||||
# Second external SRT to include
|
||||
$SRT_2_Name = $MKV_1_name + ".$SubExtension_2"
|
||||
$SRT_2 = $sourceDirectory_1 + "\" + $SRT_2_name
|
||||
|
||||
# Subtitles are elsewhere...
|
||||
# $SRT_2_Name = "3_English.srt"
|
||||
# $SRT_2 = $sourceDirectory_1 + "\" + $SRT_2_name
|
||||
# $SRT_2 = $sourceDirectory_1 + "\Subs\" + $MKV_1_name + "\" + $SRT_2_name
|
||||
|
||||
$MKVMerge_param_srt2 = "--sub-charset $Extsub_charset_2 --language $ExtSubTrackLang_2 --track-name `"$ExtSubTrackName_2`" --default-track $ExtSubTrack_2_default --forced-track $ExtSub_forced_track_2 --hearing-impaired-flag $ExtSub_SDH_2 `"$SRT_2`""
|
||||
}
|
||||
}
|
||||
|
||||
$MKVMerge_param_start = "--output `"$Output`" --title `"$VideoTrackName`" --track-order `"$track_order`""
|
||||
|
||||
if ( $Internal_SUB_Number -eq 0 ) {
|
||||
$MKVMerge_param_start += " --no-subtitles"
|
||||
}
|
||||
else {
|
||||
# Part for internal subtitles
|
||||
$MKVMerge_param_start += " --subtitle-tracks $subtitle_tracks"
|
||||
}
|
||||
|
||||
|
||||
if ($merge_another_video_MKV2 -eq $false) {
|
||||
# Video is from MKV_1
|
||||
$MKVMerge_param_start += " --track-name `"$VideoTrack_ID" + ":$VideoTrackName`" --default-track $VideoTrack_ID" + ":yes --language $VideoTrack_ID" + ":$Video_Lang"
|
||||
}
|
||||
else {
|
||||
# If Video is from MKV_2, we don't want the video from MKV_1 added...
|
||||
$MKVMerge_param_start += " --no-video"
|
||||
}
|
||||
|
||||
|
||||
if ( $no_attachements -eq $true ) {
|
||||
$MKVMerge_param_start += " --no-attachments"
|
||||
}
|
||||
|
||||
if ( $Internal_SUB_Number -ne 0 ) {
|
||||
# Part for internal subtitles
|
||||
$MKVMerge_param_mkv1 = "$MKVMerge_audio_param $MKVMerge_sub_param `"$MKV_1`""
|
||||
}
|
||||
else {
|
||||
$MKVMerge_param_mkv1 = "$MKVMerge_audio_param `"$MKV_1`""
|
||||
}
|
||||
|
||||
$MKVMerge_param_all = "$MKVMerge_param_start $MKVMerge_param_mkv1"
|
||||
|
||||
if ( $merge_another_video_MKV2 -eq $true ) {
|
||||
$MKVMerge_param_all += " $MKVMerge_param_mkv2"
|
||||
}
|
||||
|
||||
if ( ( $External_SUB_Number -ne 0 ) -and ( $External_SUB -eq $true ) ) {
|
||||
$MKVMerge_param_all += " $MKVMerge_param_srt1"
|
||||
if ( $External_SUB_Number -eq 2 ) {
|
||||
$MKVMerge_param_all += " $MKVMerge_param_srt2"
|
||||
}
|
||||
}
|
||||
|
||||
# Write-Host "`$MKVMerge_param_start = $MKVMerge_param_start" -ForegroundColor "White"
|
||||
# Write-Host "`$MKVMerge_param_mkv1 = $MKVMerge_param_mkv1" -ForegroundColor "White"
|
||||
# Write-Host "`$MKVMerge_param_all = $MKVMerge_param_all" -ForegroundColor "White"
|
||||
Write-Host "`tRecap. of all language tracks :" -ForegroundColor "Cyan"
|
||||
Write-Host "`t`t- Video lang will be : $Video_Lang" -ForegroundColor "Cyan"
|
||||
Write-Host "`t`t- Audio 1 lang will be : $AudioLang_1_sansID`t`tand name = $AudioTrackName_1_sansID" -ForegroundColor "Cyan"
|
||||
if ($NB_Audio_MKV1 -eq 2) {
|
||||
Write-Host "`t`t- Audio 2 lang will be : $AudioLang_2_sansID`t`tand name = $AudioTrackName_2_sansID" -ForegroundColor "Cyan"
|
||||
}
|
||||
if ($Internal_SUB_Number -ge 1) {
|
||||
Write-Host "`t`t- Internal Sub 1 lang will be : $SubTrackLang_1_sansID`tand name = $SubTrackName_1_sansID" ( &{ If ( ($SubTrack_1_SDH_sansID -eq "yes") -eq $true) { "`tFlagged with SDH (--hearing-impaired-flag)" } }) -ForegroundColor "Cyan"
|
||||
if ($Internal_SUB_Number -ge 2) {
|
||||
Write-Host "`t`t- Internal Sub 2 lang will be : $SubTrackLang_2_sansID`tand name = $SubTrackName_2_sansID" ( &{ If ( ($SubTrack_2_SDH_sansID -eq "yes") -eq $true) { "`tFlagged with SDH (--hearing-impaired-flag)" } }) -ForegroundColor "Cyan"
|
||||
if ($Internal_SUB_Number -eq 3) {
|
||||
Write-Host "`t`t- Internal Sub 3 lang will be : $SubTrackLang_3_sansID`tand name = $SubTrackName_3_sansID" ( &{ If ( ($SubTrack_3_SDH_sansID -eq "yes") -eq $true) { "`tFlagged with SDH (--hearing-impaired-flag)" } }) -ForegroundColor "Cyan"
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($External_SUB -eq $true) {
|
||||
Write-Host "`t`t- External Sub 1 lang will be : $($ExtSubTrackLang_1 -replace '0:', '')`tand name = $($ExtSubTrackName_1 -replace '0:', '')" ( &{ If ( ($ExtSub_SDH_1 -match "yes") -eq $true) { "`tFlagged with SDH (--hearing-impaired-flag)" } }) -ForegroundColor "Cyan"
|
||||
if ($External_SUB_Number -eq 2) {
|
||||
Write-Host "`t`t- External Sub 2 lang will be : $($ExtSubTrackLang_2 -replace '0:', '')`tand name = $($ExtSubTrackName_1 -replace '0:', '')" ( &{ If ( ($ExtSub_SDH_2 -match "yes") -eq $true) { "`tFlagged with SDH (--hearing-impaired-flag)" } }) -ForegroundColor "Cyan"
|
||||
}
|
||||
}
|
||||
|
||||
# Last step to command construction
|
||||
$command = "& $MKVMerge $MKVMerge_param_all"
|
||||
# Launch begin...
|
||||
Invoke-Expression $command
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "Fin du traitement du fichier n° $compteur / $Count_1.`n" -ForegroundColor "black" -BackgroundColor "white"
|
||||
|
||||
If (-Not (Test-Path $Output) ) {
|
||||
write-host "File NON-EXISTANT - $Output" -foreground "red"
|
||||
"File NON-EXISTANT - $Output" | Out-File "$destinationDirectory\Errors.txt" -Append
|
||||
}
|
||||
else {
|
||||
if ( $move_mkv1_after_merge -eq $true ) {
|
||||
Move-Item -Path $MKV_1 -Destination $Path_Folder_NotMerged_1 -Verbose
|
||||
if ( $External_SUB -eq $true ) {
|
||||
Move-Item -Path $SRT_1 -Destination $Path_Folder_NotMerged_1 -Verbose
|
||||
if ( $External_SUB_Number -eq 2 ) {
|
||||
Move-Item -Path $SRT_2 -Destination $Path_Folder_NotMerged_1 -Verbose
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( ( $move_mkv2_after_merge -eq $true ) -And ( $merge_another_video_MKV2 -eq $true) ) {
|
||||
Move-Item -Path $MKV_2 -Destination $Path_Folder_NotMerged_2 -Verbose
|
||||
}
|
||||
}
|
||||
|
||||
$compteur++
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,479 @@
|
||||
##==============================================================================================
|
||||
## ##
|
||||
## Batch Merge Subtitles with MKVMerge ##
|
||||
## By Miles ##
|
||||
## Idea from Iain McCain : https://superuser.com/a/1249870 ##
|
||||
## ##
|
||||
##==============================================================================================
|
||||
## ##
|
||||
## Utilisation et conditions : ##
|
||||
## - Il faut que les .srt et les .mkv soient dans le même dossier. ##
|
||||
## - Il faut que les sous-titres externes .SRT aient le même nom de fichier que les .MKV. ##
|
||||
## - Il faut paramétrer l'extension des fichiers de sous-titres pour que ces derniers ##
|
||||
## reflètent la langue : eng, fre,... ##
|
||||
## - Il faudra par ailleurs modifier le code langage dans AudioLang_X et SubTrackLang_1 ##
|
||||
## Il est possible de : ##
|
||||
## - spécifier des dossiers sources et destinations identiques ou différents ##
|
||||
## - spécifier un titre de piste (pour toutes) ##
|
||||
## ##
|
||||
##==============================================================================================
|
||||
## ##
|
||||
## Objectifs : ##
|
||||
## Remuxer deux MKV en gardant l'audio et le(s) sous-titre du premier ou un sous-titre ##
|
||||
## externe, et seulement la vidéo du second MKV ##
|
||||
## ##
|
||||
##==============================================================================================
|
||||
|
||||
Clear-Host
|
||||
Invoke-Command -ScriptBlock {
|
||||
|
||||
# Set MKVMerge.exe Path
|
||||
$MKVMerge = "`"PATH_TO\mkvtoolnix\mkvmerge.exe`""
|
||||
# For the parameters to pass to MKVMerge executable, will be construct
|
||||
|
||||
#Set Source and Target directories (Don't put an \ at the end)
|
||||
$sourceDirectory_1 = "PATH_TO_SOURCE_1"
|
||||
$sourceDirectory_2 = "PATH_TO_SOURCE_2"
|
||||
$destinationDirectory = "PATH_TO_DESTINATION"
|
||||
|
||||
# Rename output file with this settings :
|
||||
# Use https://regex101.com/r/cU5lC2/1 to get the RegEx
|
||||
$chain_to_search = ''
|
||||
# $chain_to_search = '(\w+)\.S(\d{2})E(\d{2}).(.*)H264(.*)'
|
||||
# $chain_to_search = '(\w+)\.S(\d{2})E(\d{2})(.*)1080p.(.*)H.264(.*)'
|
||||
$chain__to_replace = ''
|
||||
# $chain__to_replace = '$1 - S$2E$3 - $4x265-10bits$5--Reencoded'
|
||||
# $chain__to_replace = '$1 (2021) - S$2E$3 - 1080p.$5x265-10bits$6--Reencoded'
|
||||
|
||||
# The filenames must be like : blabla.S00E00.blabla.H.264.blabla
|
||||
# They will be renamed to : blabla - S00E00 - blabla.x265-10bits.blabla--Reencoded
|
||||
# If you don't want the rename to be made, juste set to '' the variables.
|
||||
|
||||
# If there is no internal subtitles to keep :
|
||||
# Set to $false for no internal subtitle
|
||||
# Set to $true for one or more internal subtitles
|
||||
$Internal_SUB = $true
|
||||
|
||||
# Is there an external subtitle ? Set the number of .SRT (0 - 2)
|
||||
# It's exclusive, no internal SUB will be proceed..
|
||||
$NB_External_SUB = 0
|
||||
|
||||
# Extension without the .
|
||||
$MkvExtension = "mkv"
|
||||
#Set Subtitle Extension (Don't add the . before the extension)
|
||||
$SubExtension_1 = 'eng.srt'
|
||||
$SubExtension_2 = 'fre.srt'
|
||||
|
||||
#If source and destination are the same folder, set this to True, Otherwise let it to "False"
|
||||
$merged_SUFFIX_name = "False"
|
||||
|
||||
# Move MKV1 (and SRT) to Not-Merged folder ? Set to $false or $true
|
||||
$move_mkv1_after_merge = $true
|
||||
# Move MKV2 (and SRT) to Not-Merged folder ? Set to $false or $true
|
||||
$move_mkv1_after_merge = $true
|
||||
|
||||
# Initialization for those 3 variables, do not change them !
|
||||
$MKVMerge_sub_param = ""
|
||||
$MKVMerge_audio_param = ""
|
||||
$subtitle_tracks = ""
|
||||
# ##################
|
||||
|
||||
#### FILE 1 - Keeping all but the video
|
||||
# ================== AUDIO ==================
|
||||
# Track 1 = Audio n°1
|
||||
# Name and language of Audio Track n°1
|
||||
$AudioTrackName_1 = "1:English - DDP 5.1"
|
||||
$AudioLang_1 = "1:eng"
|
||||
$AudioTrack_1_default = "1:yes"
|
||||
# Define track order. Do not modify it unless you changed the track number in this section
|
||||
$track_order = "1:0,0:1"
|
||||
# $MKVMerge_audio_param = '--language', "$AudioLang_1", '--track-name', "$AudioTrackName_1", '--default-track', "$AudioTrack_1_default"
|
||||
$MKVMerge_audio_param = "--language $AudioLang_1 --track-name `"$AudioTrackName_1`" --default-track $AudioTrack_1_default"
|
||||
|
||||
# # Track 2 = Audio n°2
|
||||
# # Name and language of Audio Track n°2
|
||||
# $AudioTrackName_1 = "2:English - DDP 5.1"
|
||||
# $AudioLang_1 = "2:en"
|
||||
# $AudioTrack_1_default = "2:yes"
|
||||
# # Define track order. Do not modify it unless you changed the track number in this section
|
||||
# $track_order = "1:0,0:1,0:2"
|
||||
# $MKVMerge_audio_param += "--language $AudioLang_2 --track-name `"$AudioTrackName_2`" --default-track $AudioTrack_2_default"
|
||||
|
||||
##########################################
|
||||
#### FILE 2 - MKV - Keeping only the video
|
||||
#### $file_2_options = "--no-audio --no-track-tags --no-global-tags"
|
||||
|
||||
if ( $NB_External_SUB -ne 0 ) {
|
||||
# ================== EXTERNAL SUBTITLE ==================
|
||||
# Must have the same name as MKV1
|
||||
####
|
||||
#### FILE 3 - SRT - Keeping all but the video (audio + chapters tags)
|
||||
# ================== SUBTITLES ==================
|
||||
# Track 0 = Sub n°1 to keep
|
||||
# Name and language of Subtitle Track n°0 + Sync Value
|
||||
$ExtSubTrackName_1 = "0:English - SRT"
|
||||
$ExtSubTrackLang_1 = "0:eng"
|
||||
$ExtSubTrack_1_default = "0:yes"
|
||||
$ExtSub_charset_1 = "0:UTF-8"
|
||||
# Define track order
|
||||
$track_order += ",2:0"
|
||||
####
|
||||
#### FILE 4 - SRT - Keeping all but the video (audio + chapters tags)
|
||||
# ================== SUBTITLES ==================
|
||||
# Track 0 = Sub n°1 to keep
|
||||
# Name and language of Subtitle Track n°0 + Sync Value
|
||||
$ExtSubTrackName_2 = "0:Français - SRT"
|
||||
$ExtSubTrackLang_2 = "0:fr"
|
||||
$ExtSubTrack_2_default = "0:no"
|
||||
$ExtSub_charset_2 = "0:UTF-8"
|
||||
# Define track order
|
||||
if ( $NB_External_SUB -eq 2 ) {
|
||||
$track_order += ",3:0"
|
||||
}
|
||||
}
|
||||
else {
|
||||
# ================== INTERNAL SUBTITLES ==================
|
||||
if ( $Internal_SUB -eq $true ) {
|
||||
# Track 2 = Sub n°1 to keep
|
||||
# Name and language of Subtitle Track n°1 + Sync Value
|
||||
# $SubTrackName_1 = "2:English - SRT"
|
||||
# $SubTrackLang_1 = "2:en"
|
||||
# $SubTrack_1_default = "2:yes"
|
||||
# $sub_charset_1 = "2:UTF-8"
|
||||
# # Define track order
|
||||
# $track_order += ",0:2"
|
||||
# $subtitle_tracks = "2"
|
||||
# # $MKVMerge_sub_param = '--sub-charset', "$sub_charset_1", '--language', "$SubTrackLang_1", '--track-name', "$SubTrackName_1", '--default-track', "$SubTrack_1_default"
|
||||
# $MKVMerge_sub_param = "--sub-charset $sub_charset_1 --language $SubTrackLang_1 --track-name `"$SubTrackName_1`" --default-track $SubTrack_1_default"
|
||||
|
||||
# Track 3 = Sub n°2 to keep
|
||||
# Name and language of Subtitle Track n°1 + Sync Value
|
||||
$SubTrackName_2 = "3:English SDH - SRT"
|
||||
$SubTrackLang_2 = "3:eng"
|
||||
$SubTrack_2_default = "3:yes"
|
||||
$sub_charset_2 = "3:UTF-8"
|
||||
# Define track order
|
||||
$track_order += ",0:3"
|
||||
$subtitle_tracks = "3"
|
||||
$MKVMerge_sub_param += "--sub-charset $sub_charset_2 --language $SubTrackLang_2 --track-name `"$SubTrackName_2`" --default-track $SubTrack_2_default"
|
||||
####
|
||||
}
|
||||
else {
|
||||
# No internal subtitles are to be kept...
|
||||
$MKVMerge_sub_param = ""
|
||||
}
|
||||
}
|
||||
## End of part where there is something to change !
|
||||
##==============================================================================================
|
||||
|
||||
# Testing if the Not-Merged folder already exists : if yes, it will be renamed, else it will be created.
|
||||
$Path_Folder_NotMerged_2 = $sourceDirectory_2 + "\Not-Merged"
|
||||
If (!(test-path $Path_Folder_NotMerged_2)) {
|
||||
New-Item -ItemType "Directory" -Force -Path $Path_Folder_NotMerged_2 -Verbose
|
||||
}
|
||||
else {
|
||||
# Don't know what's the best... TO BE IMPROVED
|
||||
#Move-Item -Path $Path_Folder_NotMerged_2 -Destination "$sourceDirectory\Not-Merged--backup" -Verbose
|
||||
#Move-Item -Path $Path_Folder_NotMerged_2 -Destination "$sourceDirectory\Not-Merged--backup" -Verbose
|
||||
}
|
||||
# Testing if the Not-Merged folder already exists : if yes, it will be renamed, else it will be created.
|
||||
$Path_Folder_NotMerged_1 = $sourceDirectory_1 + "\Not-Merged"
|
||||
If (!(test-path $Path_Folder_NotMerged_1)) {
|
||||
New-Item -ItemType "Directory" -Force -Path $Path_Folder_NotMerged_1 -Verbose
|
||||
}
|
||||
else {
|
||||
# Don't know what's the best... TO BE IMPROVED
|
||||
#Move-Item -Path $Path_Folder_NotMerged_2 -Destination "$sourceDirectory\Not-Merged--backup" -Verbose
|
||||
#Move-Item -Path $Path_Folder_NotMerged_2 -Destination "$sourceDirectory\Not-Merged--backup" -Verbose
|
||||
}
|
||||
|
||||
#Process
|
||||
$MKV_1_List = Get-ChildItem $sourceDirectory_1 -Filter "*.mkv" | ForEach-Object { $_.FullName } | Sort-Object
|
||||
$Count_1 = $MKV_1_List.count
|
||||
Write-Host "$Count_1 MKV's to be processed in $sourceDirectory_1."
|
||||
|
||||
$MKV_2_List = Get-ChildItem $sourceDirectory_2 -Filter "*.mkv" | ForEach-Object { $_.FullName } | Sort-Object
|
||||
$Count_2 = $MKV_2_List.count
|
||||
Write-Host "$Count_2 MKV's to be processed in $sourceDirectory_2."
|
||||
|
||||
# #########################
|
||||
# Check if there is the same number of .srt files as .mkv files
|
||||
if ( $NB_External_SUB -ne 0 ) {
|
||||
if ( $NB_External_SUB -ge 1 ) {
|
||||
# If $NB_External_SUB >= 1 (include =1 and =2)
|
||||
$SRT_1_List = Get-ChildItem $sourceDirectory_1 -Filter "*.$SubExtension_1" | ForEach-Object { $_.FullName } | Sort-Object
|
||||
$Count_1_SRT = $SRT_1_List.count
|
||||
Write-Host "$Count_1 MKV's to be processed and $Count_1_SRT SRT's to be processed in $sourceDirectory_1."
|
||||
if ($Count_1 -eq $Count_1_SRT) {
|
||||
Write-Host "There is the same number of MKV and SRT n°1 files in this folder. Let's continue."
|
||||
}
|
||||
else {
|
||||
Write-Host "The number of MKV and SRT n°1 files isn't the same. ABORT..." -foreground "red"
|
||||
Exit
|
||||
}
|
||||
}
|
||||
|
||||
if ( $NB_External_SUB -eq 2 ) {
|
||||
# Only if $NB_External_SUB = 2
|
||||
$SRT_2_List = Get-ChildItem $sourceDirectory_1 -Filter "*.$SubExtension_2" | ForEach-Object { $_.FullName } | Sort-Object
|
||||
$Count_2_SRT = $SRT_2_List.count
|
||||
if ($Count_1 -eq $Count_2_SRT) {
|
||||
Write-Host "There is the same number of MKV and SRT n°2 files in this folder. Let's continue."
|
||||
}
|
||||
else {
|
||||
Write-Host "The number of MKV and SRT n°2 files isn't the same. ABORT..." -foreground "red"
|
||||
Exit
|
||||
}
|
||||
}
|
||||
}
|
||||
# #########################
|
||||
|
||||
# #########################
|
||||
# Check if there is the same .mkv files in both source directory
|
||||
if ($Count_1 -eq $Count_2) {
|
||||
Write-Host "There is the same number of MKV in the two sources folders. Let's continue."
|
||||
}
|
||||
else {
|
||||
Write-Host "The number of MKV in the two sources folders isn't the same. ABORT..." -foreground "red"
|
||||
Exit
|
||||
}
|
||||
# if (!($Count_1 -eq ($filename_ep_final - $filename_ep_start + 1))) {
|
||||
# Write-Host "The number of episodes set in the script isn't the same as the number of files in the folders... EXITING NOW !" -foreground "red"
|
||||
# Exit
|
||||
# }
|
||||
# #########################
|
||||
$compteur = 1
|
||||
|
||||
# for ($i = $filename_ep_start; $i -lt $filename_ep_final+1; $i++) {
|
||||
Foreach ($MKV_1 in $MKV_1_List) {
|
||||
|
||||
Write-Host "" -ForegroundColor "black" -BackgroundColor "white"
|
||||
Write-Host "Traitement du fichier n° $compteur / $Count_1..." -ForegroundColor "black" -BackgroundColor "white"
|
||||
Write-Host "" -ForegroundColor "black" -BackgroundColor "white"
|
||||
|
||||
# Genreating Files Name & Video Title
|
||||
# format = filename_1_part_1 + S + filename_season + E + i_counter + filename_1_part_2 + .mkv
|
||||
# format = filename_2_part_1 + S + filename_season + E + i_counter + filename_2_part_2 + .mkv
|
||||
$FormatName_1 = (Get-Item $MKV_1).Basename
|
||||
$MKV_1_name = $FormatName_1.ToString()
|
||||
|
||||
$MKV_2_file = get-ChildItem $sourceDirectory_2 -recurse | where { $_.name -like "*$MKV_1_name*" } | select name
|
||||
|
||||
# Faire test si count = 1 -> ok Sinon soucis !
|
||||
|
||||
$FormatName_2 = $MKV_2_file.Name.ToString()
|
||||
$MKV_2_name = $FormatName_2.Substring(0, $FormatName_2.Length - ($MkvExtension.Length + 1))
|
||||
$MKV_2 = $sourceDirectory_2 + "\" + $MKV_2_name + ".$MkvExtension"
|
||||
|
||||
# Title for the video track and for the destination file
|
||||
$VideoTrackName = $MKV_1_name
|
||||
if ( $set_year_with_brackets -eq $true ) {
|
||||
$VideoTrackName = $VideoTrackName -replace '(\d{4}(?=.*S\d{2}E\d{2}))', '($1)'
|
||||
}
|
||||
if ( $remove_dots -eq $true ) {
|
||||
$VideoTrackName = $VideoTrackName -replace '\.(?=.*S\d{2}E\d{2})', ' '
|
||||
}
|
||||
$VideoTrackName = $VideoTrackName -replace $chain_to_search, $chain__to_replace
|
||||
$VideoTrackName = "$VideoTrackName"
|
||||
Write-Host "`tThe Video Track Name will be : `r`n`t`t $VideoTrackName" -ForegroundColor "green"
|
||||
if ( $compteur -le 3 ) {
|
||||
# Will prompt for a key to be pressed for the 3 first names
|
||||
Write-Host "`tFor the 3 first file, this will show up, and pause for 10s" -ForegroundColor "yellow";
|
||||
Start-Sleep -Seconds 10
|
||||
}
|
||||
|
||||
#########################################################
|
||||
# Exceptions for some files with other than 2 SRT inside
|
||||
# You must copy paste the default entries set in the begining of this script in the Default section
|
||||
switch ($MKV_1_name) {
|
||||
"MY_FILE_WITH_EXCEPTION" {
|
||||
# # ================== AUDIO ==================
|
||||
# # Track 1 = Audio n°1
|
||||
# # Name and language of Audio Track n°1
|
||||
# $AudioTrackName_1 = "1:English - DDP 5.1"
|
||||
# $AudioLang_1 = "1:en"
|
||||
# $AudioTrack_1_default = "1:yes"
|
||||
|
||||
# # Only One subtitle track : n°2
|
||||
# $SubTrackName_1 = "3:English SDH - SRT"
|
||||
# $SubTrackLang_1 = "3:en"
|
||||
# $SubTrack_1_default = "3:yes"
|
||||
# $sub_charset_1 = "3:UTF-8"
|
||||
# # Define track order
|
||||
# $track_order = "1:0,0:1,0:3"
|
||||
# # Define subtitles track to keep
|
||||
# $subtitle_tracks = "3"
|
||||
|
||||
$VideoTrackName = "Defiance - S03E01-E02 - 720p.HDTV.x265-10bits-DIMENSION--Reencoded"
|
||||
break
|
||||
}
|
||||
"MY_FILE_WITH_EXCEPTION_2" {
|
||||
# # Track 1 = Audio n°1
|
||||
# # Name and language of Audio Track n°1
|
||||
# $AudioTrackName_1 = "1:English - AAC 2.0"
|
||||
# $AudioLang_1 = "1:en"
|
||||
# $AudioTrack_1_default = "1:yes"
|
||||
|
||||
# # Only One subtitle track : n°2
|
||||
# $SubTrackName_1 = "2:English - SRT"
|
||||
# $SubTrackLang_1 = "2:en"
|
||||
# $SubTrack_1_default = "2:yes"
|
||||
# $sub_charset_1 = "2:UTF-8"
|
||||
# # Define track order
|
||||
# $track_order = "1:0,0:1,0:2"
|
||||
# # Define subtitles track to keep
|
||||
# $subtitle_tracks = "2"
|
||||
|
||||
$VideoTrackName = "Defiance - S02S02E12-E13 - PROPER.720p.HDTV.x265-10bits-KILLERS--Reencoded"
|
||||
|
||||
break
|
||||
}
|
||||
#Default state
|
||||
Default {
|
||||
# If not an exception, we don't want to modify the variables
|
||||
# $SubTrackName_1 = "3:English SDH - SRT"
|
||||
# $SubTrackLang_1 = "3:eng"
|
||||
# $SubTrack_1_default = "3:yes"
|
||||
# $sub_charset_1 = "3:UTF-8"
|
||||
# # Define track order
|
||||
# $track_order = "1:0,0:1,0:3"
|
||||
# # Define subtitles track to keep
|
||||
# $subtitle_tracks = "3"
|
||||
break
|
||||
}
|
||||
}
|
||||
#########################################################
|
||||
|
||||
# Set Output File Name
|
||||
If ($merged_SUFFIX_name -eq "True") {
|
||||
$Output = $destinationDirectory + "\" + $VideoTrackName + '___MERGED' + '.mkv'
|
||||
}
|
||||
elseif ($merged_SUFFIX_name -eq "False") {
|
||||
# $Output = $destinationDirectory + "\" + $VideoTrackName + '.mkv'
|
||||
$Output = "$destinationDirectory" + "\" + "$VideoTrackName" + ".mkv"
|
||||
}
|
||||
else {
|
||||
write-host "Error in the value of the merged_SUFFIX_name variable. Current value = $merged_SUFFIX_name" -ForegroundColor "red"
|
||||
write-host "Should be set to True or False.`nScript is exiting now..." -ForegroundColor "white"
|
||||
Exit
|
||||
}
|
||||
# write-host "Output file will be :" -ForegroundColor "white"
|
||||
# write-host "$Output" -ForegroundColor "white"
|
||||
# write-host "--" -ForegroundColor "white"
|
||||
|
||||
if ( $NB_External_SUB -ne 0 ) {
|
||||
|
||||
# First external SRT to include
|
||||
$SRT_1_Name = $MKV_1_name + ".$SubExtension_1"
|
||||
$SRT_1 = $sourceDirectory_1 + "\" + $SRT_1_name
|
||||
|
||||
$MKVMerge_param_start = "--output `"$Output`" --title `"$VideoTrackName`" --track-order `"$track_order`" --no-video --no-subtitles"
|
||||
if ( $no_attachements -eq $true ) {
|
||||
$MKVMerge_param_start += " --no-attachments"
|
||||
}
|
||||
|
||||
$MKVMerge_param_mkv1 = "$MKVMerge_audio_param `"$MKV_1`""
|
||||
$MKVMerge_param_mkv2 = "--no-audio --no-track-tags --no-global-tags --language 0:en --track-name `"0:$VideoTrackName`" --default-track 0:yes --no-subtitles --no-audio `"$MKV_2`""
|
||||
|
||||
$MKVMerge_param_srt1 = "--sub-charset $Extsub_charset_1 --language $ExtSubTrackLang_1 --track-name `"$ExtSubTrackName_1`" --default-track $ExtSubTrack_1_default `"$SRT_1`""
|
||||
|
||||
$MKVMerge_param_srt_all = "$MKVMerge_param_srt1"
|
||||
|
||||
if ( $NB_External_SUB -eq 2 ) {
|
||||
# Second external SRT to include
|
||||
$SRT_2_Name = $MKV_1_name + ".$SubExtension_2"
|
||||
$SRT_2 = $sourceDirectory_1 + "\" + $SRT_2_name
|
||||
|
||||
$MKVMerge_param_srt2 = "--sub-charset $Extsub_charset_2 --language $ExtSubTrackLang_2 --track-name `"$ExtSubTrackName_2`" --default-track $ExtSubTrack_2_default `"$SRT_2`""
|
||||
$MKVMerge_param_srt_all += " $MKVMerge_param_srt2"
|
||||
}
|
||||
|
||||
$MKVMerge_param_all = "$MKVMerge_param_start $MKVMerge_param_mkv1 $MKVMerge_param_mkv2 $MKVMerge_param_srt_all"
|
||||
|
||||
}
|
||||
else {
|
||||
# INTERNAL SUB to keep
|
||||
$MKVMerge_param_start = "--output `"$Output`" --title `"$VideoTrackName`" --track-order `"$track_order`" --subtitle-tracks $subtitle_tracks --no-video"
|
||||
if ( $Internal_SUB -eq $true ) {
|
||||
# There is some internal subtitles to keep
|
||||
$MKVMerge_param_mkv1 = "$MKVMerge_audio_param $MKVMerge_sub_param `"$MKV_1`""
|
||||
}
|
||||
else {
|
||||
# There is no internal subtitles to keep
|
||||
$MKVMerge_param_mkv1 = "$MKVMerge_audio_param `"$MKV_1`""
|
||||
}
|
||||
$MKVMerge_param_mkv2 = "--no-audio --no-track-tags --no-global-tags --language 0:en --track-name `"0:$VideoTrackName`" --default-track 0:yes --no-subtitles --no-audio `"$MKV_2`""
|
||||
|
||||
$MKVMerge_param_all = "$MKVMerge_param_start $MKVMerge_param_mkv1 $MKVMerge_param_mkv2"
|
||||
|
||||
# ##################
|
||||
# Debug
|
||||
# Write-Host "$MKVMerge_param_start" -ForegroundColor "black" -BackgroundColor "DarkGray"
|
||||
# Write-Host "$MKVMerge_audio_param" -ForegroundColor "black" -BackgroundColor "DarkGray"
|
||||
# Write-Host "$MKVMerge_sub_param" -ForegroundColor "black" -BackgroundColor "DarkGray"
|
||||
# Write-Host "$MKVMerge_param_mkv2" -ForegroundColor "black" -BackgroundColor "DarkGray"
|
||||
# Write-Host "" -ForegroundColor "black" -BackgroundColor "DarkGray"
|
||||
# Write-Host "$MKVMerge_param_all" -ForegroundColor "black" -BackgroundColor "DarkGray"
|
||||
# Write-Host "" -ForegroundColor "black" -BackgroundColor "DarkGray"
|
||||
# Write-Host "Commande qui sera lancée :" -ForegroundColor "black" -BackgroundColor "DarkGray"
|
||||
|
||||
# Write-Host "& $MKVMerge" "$MKVMerge_param_all" -ForegroundColor "black" -BackgroundColor "DarkGray"
|
||||
# ##################
|
||||
}
|
||||
|
||||
# Last step to command construction
|
||||
$command = "& $MKVMerge $MKVMerge_param_all"
|
||||
# Launch begin...
|
||||
Invoke-Expression $command
|
||||
|
||||
Write-Host "" -ForegroundColor "black" -BackgroundColor "white"
|
||||
Write-Host "Fin du traitement du fichier n° $compteur / $Count_1." -ForegroundColor "black" -BackgroundColor "white"
|
||||
Write-Host "" -ForegroundColor "black" -BackgroundColor "white"
|
||||
|
||||
If (Test-Path $Output) {
|
||||
#Clean Up
|
||||
#Remove-Item $MKV
|
||||
#Remove-Item $Sub
|
||||
#Remove-Item $OtherSub
|
||||
# Move to folder Not-Merged, this folder's existence has already been tested, and the folder is created.
|
||||
if ( $move_mkv1_after_merge -eq $true ) {
|
||||
Move-Item -Path $MKV_1 -Destination $Path_Folder_NotMerged_1 -Verbose
|
||||
if ( $NB_External_SUB -ne 0 ) {
|
||||
Move-Item -Path $SRT_1 -Destination $Path_Folder_NotMerged_1 -Verbose
|
||||
if ( $NB_External_SUB -eq 2 ) {
|
||||
Move-Item -Path $SRT_2 -Destination $Path_Folder_NotMerged_2 -Verbose
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( $move_mkv2_after_merge -eq $true ) {
|
||||
Move-Item -Path $MKV_2 -Destination $Path_Folder_NotMerged_2 -Verbose
|
||||
}
|
||||
}
|
||||
Else {
|
||||
write-host "File NON-EXISTANT - $Output" -foreground "red"
|
||||
"File NON-EXISTANT - $Output" | Out-File "$destinationDirectory\Errors.txt" -Append
|
||||
}
|
||||
$compteur++
|
||||
}
|
||||
|
||||
|
||||
|
||||
# ##############################
|
||||
# Command History
|
||||
#
|
||||
# internal Subtitles :
|
||||
# two subtiles to keep :
|
||||
#& $MKVMerge --title "$VideoTrackName" --track-order "$track_order" --subtitle-tracks "$subtitle_tracks" -o "$Output" --no-video --language "$AudioLang_1" --track-name "$AudioTrackName_1" --default-track "$AudioTrack_1_default" --sub-charset "$sub_charset_1" --language "$SubTrackLang_1" --track-name "$SubTrackName_1" --default-track "$SubTrack_1_default" --sub-charset "$sub_charset_2" --language "$SubTrackLang_2" --track-name "$SubTrackName_2" --default-track "$SubTrack_2_default" "$MKV_1" --no-audio --no-track-tags --no-global-tags --language "0:en" --track-name "0:$VideoTrackName" --default-track "0:yes" --no-subtitles --no-audio "$MKV_2"
|
||||
|
||||
# Only one subtitles to keep
|
||||
# & $MKVMerge --title "$VideoTrackName" --track-order "$track_order" --subtitle-tracks "$subtitle_tracks" -o "$Output" --no-video --language "$AudioLang_1" --track-name "$AudioTrackName_1" --default-track "$AudioTrack_1_default" --sub-charset "$sub_charset_1" --language "$SubTrackLang_1" --track-name "$SubTrackName_1" --default-track "$SubTrack_1_default" "$MKV_1" --no-audio --no-track-tags --no-global-tags --language "0:en" --track-name "0:$VideoTrackName" --default-track "0:yes" --no-subtitles --no-audio "$MKV_2"
|
||||
#
|
||||
#
|
||||
# External Subtitles
|
||||
# # 1 SRT
|
||||
# & $MKVMerge --output "$Output" --title "$VideoTrackName" --track-order "$track_order" --no-video --no-subtitles --language "$AudioLang_1" --track-name "$AudioTrackName_1" --default-track "$AudioTrack_1_default" "$MKV_1" --no-audio --no-track-tags --no-global-tags --language "0:en" --track-name "0:$VideoTrackName" --default-track "0:yes" "$MKV_2" --sub-charset "$Extsub_charset_1" --language "$ExtSubTrackLang_1" --track-name "$ExtSubTrackName_1" --default-track "$ExtSubTrack_1_default" "$SRT_1"
|
||||
#
|
||||
# # 2 SRTs
|
||||
# & $MKVMerge --title "$VideoTrackName" --track-order "$track_order" -o "$Output" --no-video --no-subtitles --language "$AudioLang_1" --track-name "$AudioTrackName_1" --default-track "$AudioTrack_1_default" --language "$AudioLang_1" --track-name "$AudioTrackName_1" --default-track "$AudioTrack_1_default" "$MKV_1" --no-audio --no-track-tags --no-global-tags --language "0:en" --track-name "0:$VideoTrackName" --default-track "0:yes" "$MKV_2" --sub-charset "$ExtSub_charset_1" --language "$ExtSubTrackLang_1" --track-name "$ExtSubTrackName_1" --default-track "$ExtSubTrack_1_default" "$SRT_1" --sub-charset "$ExtSub_charset_2" --language "$ExtSubTrackLang_2" --track-name "$ExtSubTrackName_2" --default-track "$ExtSubTrack_2_default" "$SRT_2"
|
||||
|
||||
}
|
332
Scripts-Divers/Batch Remove Sub but all selected.ps1
Normal file
@ -0,0 +1,332 @@
|
||||
# ┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
# │ Powershell Script │
|
||||
# │ │
|
||||
# │ Objective : to keep up to 2 internal subtiles form a MKV and adding 1 or 2 external SRT. │
|
||||
# │ │
|
||||
# │ Configure : │
|
||||
# │ - the Audio_ variables │
|
||||
# │ - the ExtSubTrack_ variables │
|
||||
# │ - All variables before the function Get-SubID │
|
||||
# │ - The Track ID in the function Get-SubID + the filename for those track ID │
|
||||
# └──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
|
||||
|
||||
Clear-Host
|
||||
|
||||
# Set MKVMerge.exe Path
|
||||
$MKVMerge = "`"H:\z_MKV\mkvtoolnix\mkvmerge.exe`""
|
||||
# For the parameters to pass to MKVMerge executable, will be construct
|
||||
|
||||
$sourceDirectory_1 = "PATH_TO_SOURCE_1"
|
||||
$destinationDirectory = "PATH_TO_DESTINATION"
|
||||
|
||||
# Remove dots before the season or the resolution ?
|
||||
$remove_dots = $true
|
||||
# If there is the year in the title, set it to $true
|
||||
$set_year_with_brackets = $false
|
||||
# $chain_to_search = ''
|
||||
# $chain__to_replace = ''
|
||||
$chain_to_search = '(.*) S(\d{2})E(\d{2}).(.*)'
|
||||
$chain__to_replace = '$1 - S$2E$3 - $4--Custom'
|
||||
|
||||
# Move MKV1 (and SRT) to Not-Merged folder ? Set to $false or $true
|
||||
$move_mkv1_after_merge = $true
|
||||
|
||||
# ================== AUDIO ================== Common for all videos
|
||||
# Track 1 = Audio n°1
|
||||
# Name and language of Audio Track n°1
|
||||
$AudioTrackName_1 = "1:Japonais - AAC 2.0"
|
||||
$AudioLang_1 = "1:ja" # en for english / fr for french / ja for japanese
|
||||
$AudioTrack_1_default = "1:yes"
|
||||
# Define track order. Do not modify it unless you changed the track number in this section
|
||||
$track_order = "0:0,0:1"
|
||||
|
||||
# ================================================================
|
||||
|
||||
# To keep or not internal subtitles
|
||||
$keep_internal_Sub = $false
|
||||
# NOTE : Internal SUB always came first in the track order !
|
||||
|
||||
# ===========================================
|
||||
# ================== Internal SUB ? =========
|
||||
$Internal_SUB_Number = 2 # Works only if $External_SUB = $true
|
||||
# Max 2 Internal SRT is configured in the script.
|
||||
# If set to 2, must be 2 SRT configured
|
||||
$SubTrackName_1 = "Français - SRT"
|
||||
$SubTrackLang_1 = "fr" # en for english / fr for french / jp for japanese
|
||||
$SubTrack_1_default = "yes"
|
||||
$sub_charset_1 = "UTF-8"
|
||||
|
||||
$SubTrackName_2 = "English SDH - SRT"
|
||||
$SubTrackLang_2 = "en" # en for english / fr for french / jp for japanese
|
||||
$SubTrack_2_default = "no"
|
||||
$sub_charset_2 = "UTF-8"
|
||||
|
||||
# ===========================================
|
||||
|
||||
|
||||
# ===========================================
|
||||
# ================== External SUB ? =========
|
||||
# Must have the same name as MKV1
|
||||
$External_SUB = $true
|
||||
$External_SUB_Number = 1 # Works only if $External_SUB = $true
|
||||
# Max 2 External SRT is configured in the script.
|
||||
# If set to 2, must be 2 SRT configured
|
||||
# Set Subtitle Extension (Don't add the . before the extension)
|
||||
$SubExtension_1 = 'fre.srt'
|
||||
$SubExtension_2 = 'fre.srt'
|
||||
|
||||
#### FILE 2 - SRT_1 - Keeping all but the video (audio + chapters tags)
|
||||
# ================== SUBTITLES ==================
|
||||
# Track 0 = Sub n°1 to keep
|
||||
# Name and language of Subtitle Track n°0 + Sync Value
|
||||
$ExtSubTrackName_1 = "0:Français - SRT"
|
||||
$ExtSubTrackLang_1 = "0:fr"
|
||||
$ExtSubTrack_1_default = "0:yes"
|
||||
$ExtSub_charset_1 = "0:UTF-8"
|
||||
|
||||
#### FILE 3 - SRT_2 - Keeping all but the video (audio + chapters tags)
|
||||
# ================== SUBTITLES ==================
|
||||
# Track 0 = Sub n°1 to keep
|
||||
# Name and language of Subtitle Track n°0 + Sync Value
|
||||
$ExtSubTrackName_2 = "0:Français - SRT"
|
||||
$ExtSubTrackLang_2 = "0:fr"
|
||||
$ExtSubTrack_2_default = "0:no"
|
||||
$ExtSub_charset_2 = "0:UTF-8"
|
||||
|
||||
# Define track order - DO NOT TOUCH
|
||||
$track_order_EXT_sub = ""
|
||||
if ( $External_SUB -eq $true ) {
|
||||
if ( $External_SUB_Number -eq 1 ) {
|
||||
$track_order_EXT_sub += ",1:0"
|
||||
if ( $External_SUB_Number -eq 2 ) {
|
||||
$track_order_EXT_sub += ",2:0"
|
||||
}
|
||||
}
|
||||
}
|
||||
# ===========================================
|
||||
|
||||
function Get-SubID { # FOR INTERNAL SUB !
|
||||
param ( # sub_1_id for 1st sub to keep
|
||||
$file_name # sub_2_id for 2nd sub to keep
|
||||
)
|
||||
|
||||
switch ($file_name)
|
||||
{
|
||||
"FILE1"
|
||||
{
|
||||
$sub_1_id = "4"
|
||||
$sub_2_id = "5"
|
||||
break
|
||||
}
|
||||
"FILE2"
|
||||
{
|
||||
$sub_1_id = "5"
|
||||
$sub_2_id = "6"
|
||||
break
|
||||
}
|
||||
#Default state
|
||||
Default
|
||||
{
|
||||
Write-Host "This file is not set in the script : $file_name" -ForegroundColor "red"
|
||||
Write-Host "End of script..." -ForegroundColor "red"
|
||||
Exit
|
||||
}
|
||||
}
|
||||
|
||||
return $sub_1_id, $sub_2_id
|
||||
}
|
||||
|
||||
#Process
|
||||
$MKV_1_List = Get-ChildItem $sourceDirectory_1 -Filter "*.mkv" | ForEach-Object { $_.FullName } | Sort-Object
|
||||
$Count_1 = $MKV_1_List.count
|
||||
Write-Host "$Count_1 MKV's to be processed in $sourceDirectory_1."
|
||||
|
||||
# Testing if the Done_Remerged folder already exists : if yes, it will be renamed, else it will be created.
|
||||
$Path_Folder_NotMerged_1 = $sourceDirectory_1 + "\Done_Remerged"
|
||||
If(!(test-path $Path_Folder_NotMerged_1)) {
|
||||
New-Item -ItemType "Directory" -Force -Path $Path_Folder_NotMerged_1 -Verbose
|
||||
} else {
|
||||
# Don't know what's the best... TO BE IMPROVED
|
||||
#Move-Item -Path $Path_Folder_NotMerged_2 -Destination "$sourceDirectory\Not-Merged--backup" -Verbose
|
||||
#Move-Item -Path $Path_Folder_NotMerged_2 -Destination "$sourceDirectory\Not-Merged--backup" -Verbose
|
||||
}
|
||||
|
||||
|
||||
# #########################
|
||||
# Check if there is the same number of .srt files as .mkv files
|
||||
if ( $External_SUB -eq $true ) {
|
||||
if ( $External_SUB_Number -ge 1 ) { # If $NB_External_SUB >= 1 (include =1 and =2)
|
||||
$SRT_1_List = Get-ChildItem $sourceDirectory_1 -Filter "*.$SubExtension_1" | ForEach-Object { $_.FullName } | Sort-Object
|
||||
$Count_1_SRT = $SRT_1_List.count
|
||||
Write-Host "$Count_1_SRT SRT's ($SubExtension_1) to be processed in $sourceDirectory_1."
|
||||
if ($Count_1 -eq $Count_1_SRT) {
|
||||
Write-Host "There is the same number of MKV and SRT n°1 files ($SubExtension_1) in this folder. Let's continue."
|
||||
} else {
|
||||
Write-Host "The number of MKV and SRT n°1 files isn't the same. ABORT..." -foreground "red"
|
||||
Exit
|
||||
}
|
||||
}
|
||||
|
||||
if ( $External_SUB_Number -eq 2 ) { # Only if $External_SUB_Number = 2
|
||||
$SRT_2_List = Get-ChildItem $sourceDirectory_1 -Filter "*.$SubExtension_2" | ForEach-Object { $_.FullName } | Sort-Object
|
||||
$Count_2_SRT = $SRT_2_List.count
|
||||
Write-Host "$Count_2_SRT SRT's ($SubExtension_2) to be processed in $sourceDirectory_1."
|
||||
|
||||
if ($Count_1 -eq $Count_2_SRT) {
|
||||
Write-Host "There is the same number of MKV and SRT n°2 files ($SubExtension_2) in this folder. Let's continue."
|
||||
} else {
|
||||
Write-Host "The number of MKV and SRT n°2 files ($SubExtension_2) isn't the same. ABORT..." -foreground "red"
|
||||
Exit
|
||||
}
|
||||
}
|
||||
}
|
||||
# #########################
|
||||
|
||||
$compteur = 1
|
||||
|
||||
Foreach ($MKV_1 in $MKV_1_List) {
|
||||
|
||||
Write-Host "" -ForegroundColor "black" -BackgroundColor "white"
|
||||
Write-Host "Traitement du fichier n° $compteur / $Count_1..." -ForegroundColor "black" -BackgroundColor "white"
|
||||
Write-Host "" -ForegroundColor "black" -BackgroundColor "white"
|
||||
|
||||
# Clear variables
|
||||
$MKVMerge_param_start = ""
|
||||
$MKVMerge_param_mkv1 = ""
|
||||
$MKVMerge_param_srt1 = ""
|
||||
$MKVMerge_param_srt2 = ""
|
||||
$MKVMerge_param_all = ""
|
||||
$MKVMerge_sub_param = ""
|
||||
$SRT_1_Name = ""
|
||||
$SRT_2_Name = ""
|
||||
$SRT_1 = ""
|
||||
$SRT_2 = ""
|
||||
|
||||
$FormatName_1 = (Get-Item $MKV_1).Basename
|
||||
$MKV_1_name = $FormatName_1.ToString()
|
||||
|
||||
# Title for the video track and for the destination file
|
||||
$VideoTrackName = $MKV_1_name
|
||||
if ( $set_year_with_brackets -eq $true ) {
|
||||
$VideoTrackName = $VideoTrackName -replace '(\d{4}(?=.*S\d{2}E\d{2}))', '($1)'
|
||||
}
|
||||
if ( $remove_dots -eq $true ) {
|
||||
$VideoTrackName = $VideoTrackName -replace '\.(?=.*S\d{2}E\d{2})', ' '
|
||||
}
|
||||
$VideoTrackName = $VideoTrackName -replace $chain_to_search, $chain__to_replace
|
||||
$VideoTrackName = "$VideoTrackName"
|
||||
Write-Host "`tThe Video Track Name will be : `r`n`t`t $VideoTrackName" -ForegroundColor "green"
|
||||
|
||||
$Output = "$destinationDirectory" + "\" + "$VideoTrackName" + ".mkv"
|
||||
|
||||
|
||||
# DO NOT TOUCH - Common for all files
|
||||
$MKVMerge_audio_param = "--language $AudioLang_1 --track-name `"$AudioTrackName_1`" --default-track $AudioTrack_1_default"
|
||||
|
||||
if (( $keep_internal_Sub -eq $true ) -and ( $Internal_SUB_Number -ne 0 )) {
|
||||
|
||||
$sub_1_id, $sub_2_id = Get-SubID $MKV_1_name
|
||||
|
||||
# Track 2 = Sub n°1 to keep
|
||||
# Name and language of Subtitle Track n°1 + Sync Value
|
||||
$SubTrackName_1 = $sub_1_id + ":$SubTrackName_1"
|
||||
$SubTrackLang_1 = $sub_1_id + ":$SubTrackLang_1"
|
||||
$SubTrack_1_default = $sub_1_id + ":$SubTrack_1_default"
|
||||
$sub_charset_1 = $sub_1_id + ":$sub_charset_1"
|
||||
# Define track order
|
||||
$track_order += ",0:" + $sub_1_id
|
||||
$subtitle_tracks = "$sub_1_id"
|
||||
$MKVMerge_sub_param = "--sub-charset $sub_charset_1 --language $SubTrackLang_1 --track-name `"$SubTrackName_1`" --default-track $SubTrack_1_default"
|
||||
|
||||
if ( $Internal_SUB_Number -eq 2 ) {
|
||||
# Track 3 = Sub n°2 to keep
|
||||
# Name and language of Subtitle Track n°1 + Sync Value
|
||||
$SubTrackName_2 = $sub_2_id + ":$SubTrackName_2"
|
||||
$SubTrackLang_2 = $sub_2_id + ":$SubTrackLang_2"
|
||||
$SubTrack_2_default = $sub_2_id + ":$SubTrack_2_default"
|
||||
$sub_charset_2 = $sub_2_id + ":$sub_charset_2"
|
||||
# Define track order
|
||||
$track_order += ",0:" + $sub_2_id
|
||||
$subtitle_tracks += ",$sub_2_id"
|
||||
$MKVMerge_sub_param += " --sub-charset $sub_charset_2 --language $SubTrackLang_2 --track-name `"$SubTrackName_2`" --default-track $SubTrack_2_default"
|
||||
}
|
||||
}
|
||||
elseif (( $keep_internal_Sub -eq $true ) -and ( $Internal_SUB_Number -eq 0 )) {
|
||||
write-host "Problem with `$keep_internal_Sub=$keep_internal_Sub and `$Internal_SUB_Number=$Internal_SUB_Number.`nIf `$keep_internal_Sub=true, `$Internal_SUB_Number should have a value different from 0 !" -ForegroundColor "Red"
|
||||
exit
|
||||
}
|
||||
|
||||
if ( ( $External_SUB_Number -ne 0 ) -and ( $External_SUB -eq $true ) ) {
|
||||
|
||||
# First external SRT to include
|
||||
$SRT_1_Name = $MKV_1_name + ".$SubExtension_1"
|
||||
$SRT_1 = $sourceDirectory_1 + "\" + $SRT_1_name
|
||||
|
||||
$track_order += $track_order_EXT_sub
|
||||
|
||||
$MKVMerge_param_srt1 = "--sub-charset $Extsub_charset_1 --language $ExtSubTrackLang_1 --track-name `"$ExtSubTrackName_1`" --default-track $ExtSubTrack_1_default `"$SRT_1`""
|
||||
$MKVMerge_param_srt_all = "$MKVMerge_param_srt1"
|
||||
if ( $External_SUB_Number -eq 2 ) {
|
||||
# Second external SRT to include
|
||||
$SRT_2_Name = $MKV_1_name + ".$SubExtension_2"
|
||||
$SRT_2 = $sourceDirectory_1 + "\" + $SRT_2_name
|
||||
|
||||
$MKVMerge_param_srt2 = "--sub-charset $Extsub_charset_2 --language $ExtSubTrackLang_2 --track-name `"$ExtSubTrackName_2`" --default-track $ExtSubTrack_2_default `"$SRT_2`""
|
||||
$MKVMerge_param_srt_all += " $MKVMerge_param_srt2"
|
||||
}
|
||||
|
||||
if ( $keep_internal_Sub -eq $false ) {
|
||||
$MKVMerge_param_start = "--output `"$Output`" --title `"$VideoTrackName`" --track-order `"$track_order`" --no-subtitles --track-name `"0:$VideoTrackName`" --default-track 0:yes"
|
||||
$MKVMerge_param_mkv1 = "$MKVMerge_audio_param `"$MKV_1`""
|
||||
$MKVMerge_param_all = "$MKVMerge_param_start $MKVMerge_param_mkv1 $MKVMerge_param_srt_all"
|
||||
}
|
||||
else {
|
||||
$MKVMerge_param_start = "--output `"$Output`" --title `"$VideoTrackName`" --track-order `"$track_order`" --subtitle-tracks $subtitle_tracks --track-name `"0:$VideoTrackName`" --default-track 0:yes"
|
||||
$MKVMerge_param_mkv1 = "$MKVMerge_audio_param $MKVMerge_sub_param `"$MKV_1`""
|
||||
$MKVMerge_param_all = "$MKVMerge_param_start $MKVMerge_param_mkv1 $MKVMerge_param_srt_all"
|
||||
}
|
||||
}
|
||||
elseif (( $External_SUB_Number -eq 0 ) -and ( $External_SUB -eq $true )) {
|
||||
write-host "Problem with `$External_SUB_Number=$External_SUB_Number and `$External_SUB=$External_SUB.`nIf `$External_SUB=true, `$External_SUB_Number should have a value different from 0 !" -ForegroundColor "Red"
|
||||
exit
|
||||
}
|
||||
|
||||
# To modify a SubTrackName after previous operation... :
|
||||
# if ( $MKV_1_name -eq "BLABLA" ) {
|
||||
# $SubTrackName_2 = $sub_2_id + ":Français Québécois - SRT"
|
||||
# }
|
||||
|
||||
# Write-Host "`$MKVMerge_param_start = $MKVMerge_param_start" -ForegroundColor "White"
|
||||
# Write-Host "`$MKVMerge_param_mkv1 = $MKVMerge_param_mkv1" -ForegroundColor "White"
|
||||
# Write-Host "`$MKVMerge_param_all = $MKVMerge_param_all" -ForegroundColor "White"
|
||||
|
||||
# Last step to command construction
|
||||
$command = "& $MKVMerge $MKVMerge_param_all"
|
||||
# Launch begin...
|
||||
Invoke-Expression $command
|
||||
|
||||
Write-Host "" -ForegroundColor "black" -BackgroundColor "white"
|
||||
Write-Host "Fin du traitement du fichier n° $compteur / $Count_1." -ForegroundColor "black" -BackgroundColor "white"
|
||||
Write-Host "" -ForegroundColor "black" -BackgroundColor "white"
|
||||
|
||||
If (-Not (Test-Path $Output) ) {
|
||||
write-host "File NON-EXISTANT - $Output" -foreground "red"
|
||||
"File NON-EXISTANT - $Output" | Out-File "$destinationDirectory\Errors.txt" -Append
|
||||
}
|
||||
else {
|
||||
if ( $move_mkv1_after_merge -eq $true ) {
|
||||
Move-Item -Path $MKV_1 -Destination $Path_Folder_NotMerged_1 -Verbose
|
||||
if ( $NB_External_SUB -ne 0 ) {
|
||||
Move-Item -Path $SRT_1 -Destination $Path_Folder_NotMerged_1 -Verbose
|
||||
if ( $NB_External_SUB -eq 2 ) {
|
||||
Move-Item -Path $SRT_2 -Destination $Path_Folder_NotMerged_2 -Verbose
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$compteur++
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,150 @@
|
||||
##==============================================================================================
|
||||
## ##
|
||||
## Batch Merge Subtitles with MKVMerge ##
|
||||
## By Miles ##
|
||||
## Idea from Iain McCain : https://superuser.com/a/1249870 ##
|
||||
## ##
|
||||
##==============================================================================================
|
||||
## ##
|
||||
## Utilisation et conditions : ##
|
||||
## - Il faut que les .srt et les .mkv soient dans le même dossier. ##
|
||||
## - Il faut que les sous-titres externes .SRT aient le même nom de fichier que les .MKV. ##
|
||||
## - Il faut paramétrer l'extension des fichiers de sous-titres pour que ces derniers ##
|
||||
## reflètent la langue : eng, fre,... ##
|
||||
## - Il faudra par ailleurs modifier le code langage dans AudioLang_X et SubTrackLang_1 ##
|
||||
## Il est possible de : ##
|
||||
## - spécifier des dossiers sources et destinations identiques ou différents ##
|
||||
## - spécifier un titre de piste (pour toutes) ##
|
||||
## ##
|
||||
##==============================================================================================
|
||||
## ##
|
||||
## Objectifs : ##
|
||||
## Remuxer un MKV en ne gardant que 2 pistes de sous-titres SRT et les 2 pistes audio ##
|
||||
## en spécifiant un nom pour chaque piste et en permettant de paramétrer celles par défaut ##
|
||||
## ainsi que l'odre des pistes ##
|
||||
## Le MKV de base contient 2 ou 3 pistes SRT. On en garde que 2. ##
|
||||
## ##
|
||||
##==============================================================================================
|
||||
|
||||
#Set MKVMerge.exe Path
|
||||
$MKVMerge = 'H:\z_MKV\mkvtoolnix\mkvmerge.exe'
|
||||
|
||||
#Set Source and Target directories (Don't put an \ at the end)
|
||||
$sourceDirectory = "D:\DOSSIER_SOURCE\2ST"
|
||||
$destinationDirectory = "F:\DOSSIER_DESTINATION"
|
||||
|
||||
#If source and destination are the same folder, set this to True, Otherwise let it to "False"
|
||||
$merged_SUFFIX_name = "False"
|
||||
|
||||
#Set Subtitle Extension (Don't add the . before the extension)
|
||||
$SubExtension = 'eng.srt'
|
||||
#$SecondSubExtension = "sub"
|
||||
|
||||
# Track 0 = video
|
||||
|
||||
# ================== AUDIO ==================
|
||||
# Track 1 = Audio n°1
|
||||
# Name and language of Audio Track n°1
|
||||
$AudioTrackName_1 = "1:Français - AC3 5.1"
|
||||
$AudioLang_1 = "1:fr"
|
||||
$AudioTrack_1_default = "1:no"
|
||||
|
||||
# Track 2 = Audio n°2
|
||||
# Name of Audio Track n°2
|
||||
$AudioTrackName_2 = "2:English - AC3 5.1"
|
||||
$AudioLang_2 = "2:en"
|
||||
$AudioTrack_2_default = "2:yes"
|
||||
|
||||
# ================== SUBTITLES ==================
|
||||
# Track 3 = Sub n°1 to keep
|
||||
# Name and language of Subtitle Track n°1 + Sync Value
|
||||
$SubTrackName_1 = "3:FR Complet - SRT"
|
||||
$SubTrackLang_1 = "3:fr"
|
||||
$SubTrack_1_default = "3:no"
|
||||
$sub_charset_1 = "3:UTF-8"
|
||||
|
||||
# Track 4 = Sub n°2 to keep
|
||||
# Name and language of Subtitle Track n°2 + Sync Value
|
||||
$SubTrackName_2 = "5:ENG SDH - SRT"
|
||||
$SubTrackLang_2 = "5:en"
|
||||
$SubTrack_2_default = "5:yes"
|
||||
$sub_charset_2 = "5:UTF-8"
|
||||
|
||||
|
||||
# ================== OTHER SETTINGS ==================
|
||||
# Define track order
|
||||
$track_order = "0:0,0:2,0:1,0:5,0:3"
|
||||
# Define subtitles track to keep
|
||||
$subtitle_tracks = "3,5"
|
||||
|
||||
##==============================================================================================
|
||||
##==============================================================================================
|
||||
|
||||
# Testing if the Not-Merged folder already exists : if yes, it will be renamed, else it will be created.
|
||||
$Path_Folder_NotMerged = $sourceDirectory + "\Not-Merged"
|
||||
If(!(test-path $Path_Folder_NotMerged)) {
|
||||
New-Item -ItemType "Directory" -Force -Path $Path_Folder_NotMerged -Verbose
|
||||
} else {
|
||||
# Don't know what's the best... TO BE IMPROVED
|
||||
#Move-Item -Path $Path_Folder_NotMerged -Destination "$sourceDirectory\Not-Merged--backup" -Verbose
|
||||
#Move-Item -Path $Path_Folder_NotMerged -Destination "$sourceDirectory\Not-Merged--backup" -Verbose
|
||||
}
|
||||
|
||||
|
||||
#Process - Grab the list of all MKV file in the folder
|
||||
$MKV_List = Get-ChildItem $sourceDirectory -Filter "*.mkv" | ForEach-Object { $_.FullName } | Sort-Object
|
||||
$Count = $MKV_List.count
|
||||
Write-Host "$Count MKV's to be processed in $sourceDirectory."
|
||||
|
||||
Foreach ($MKV_file in $MKV_List) {
|
||||
#Get File Name
|
||||
$FormatName = $MKV_file.ToString()
|
||||
$Name = $FormatName.Substring(0,$FormatName.Length-(4))
|
||||
$MKV = $FormatName
|
||||
#$OtherSub = $Name + '.' + $SecondSubExtension
|
||||
|
||||
# Title for the video track
|
||||
$VideoTrackName = ((Get-Item $MKV).Basename).ToString()
|
||||
|
||||
#Set Output File Name
|
||||
#$Output = $Name + '___MERGED' + '.mkv'
|
||||
If ($merged_SUFFIX_name -eq "True") {
|
||||
$Output = $destinationDirectory + "\" + $VideoTrackName + '___MERGED' + '.mkv'
|
||||
} elseif ($merged_SUFFIX_name -eq "False") {
|
||||
$Output = $destinationDirectory + "\" + $VideoTrackName + '.mkv'
|
||||
} else {
|
||||
write-host "Error in the value of the merged_SUFFIX_name variable. Current value = $merged_SUFFIX_name" -foreground "red"
|
||||
write-host "Should be set to True or False.`nScript is exiting now..." -foreground "white"
|
||||
Exit
|
||||
}
|
||||
|
||||
#Execute : Merge SRT with MKV
|
||||
#& $MKVMerge --title "$VideoTrackName" --track-order "0:0,0:1,0:2,1:0" -o "$Output" --no-subtitles --language "0:en" --track-name "0:$VideoTrackName" --default-track "0:yes" --language "1:$AudioLang_1" --track-name "1:$AudioTrackName_1" --default-track "1:yes" --language "2:$AudioLang_2" --track-name "2:$AudioTrackName_2" --default-track "2:no" "$MKV" --language "0:$SubTrackLang_1" --track-name "0:$SubTrackName_1" --default-track "0:yes" --sync "0:$SubSYNCvalue_1" "$Sub"
|
||||
|
||||
# Delete PGS subtitles in MKV keeping all the rest
|
||||
# & $MKVMerge --title "$VideoTrackName" --track-order "$track_order" -o "$Output" --subtitle-tracks "$subtitle_tracks" --language "0:en" --track-name "0:$VideoTrackName" --default-track "0:yes"
|
||||
# --language "$AudioLang_1" --track-name "$AudioTrackName_1" --default-track "$AudioTrack_1_default"
|
||||
# --language "$AudioLang_2" --track-name "$AudioTrackName_2" --default-track "$AudioTrack_2_default"
|
||||
# --sub-charset "3:UTF-8" --language "$SubTrackLang_1" --track-name "$SubTrackName_1" --default-track "$SubTrack_1_default"
|
||||
# --sub-charset "4:UTF-8" --language "$SubTrackLang_2" --track-name "$SubTrackName_2" --default-track "$SubTrack_2_default"
|
||||
# --sub-charset "5:UTF-8" --language "$SubTrackLang_3" --track-name "$SubTrackName_3" --default-track "$SubTrack_3_default"
|
||||
# "$MKV"
|
||||
& $MKVMerge --title "$VideoTrackName" --track-order "$track_order" -o "$Output" --subtitle-tracks "$subtitle_tracks" --language "0:en" --track-name "0:$VideoTrackName" --default-track "0:yes" --language "$AudioLang_1" --track-name "$AudioTrackName_1" --default-track "$AudioTrack_1_default" --language "$AudioLang_2" --track-name "$AudioTrackName_2" --default-track "$AudioTrack_2_default" --sub-charset "$sub_charset_1" --language "$SubTrackLang_1" --track-name "$SubTrackName_1" --default-track "$SubTrack_1_default" --sub-charset "$sub_charset_2" --language "$SubTrackLang_2" --track-name "$SubTrackName_2" --default-track "$SubTrack_2_default" "$MKV"
|
||||
|
||||
If (Test-Path $Output) {
|
||||
#Clean Up
|
||||
#Remove-Item $MKV
|
||||
#Remove-Item $Sub
|
||||
#Remove-Item $OtherSub
|
||||
# Move to folder Not-Merged, this folder's existence has already been tested, and the folder is created.
|
||||
Move-Item -Path $MKV -Destination $Path_Folder_NotMerged -Verbose
|
||||
#Move-Item -Path $Sub -Destination $Path_Folder_NotMerged -Verbose
|
||||
|
||||
# Renaming the output file is not necessary if the output filename doesn't have __MERGED in it
|
||||
#Rename-Item -Path $Output -NewName $MKV -Verbose
|
||||
|
||||
} Else {
|
||||
write-host "File NON-EXISTANT - $Output" -foreground "red"
|
||||
"File NON-EXISTANT - $Output" | Out-File "$destinationDirectory\Errors.txt" -Append
|
||||
}
|
||||
}
|
@ -0,0 +1,156 @@
|
||||
##==============================================================================================
|
||||
## ##
|
||||
## Batch Merge Subtitles with MKVMerge ##
|
||||
## By Miles ##
|
||||
## Idea from Iain McCain : https://superuser.com/a/1249870 ##
|
||||
## ##
|
||||
##==============================================================================================
|
||||
## ##
|
||||
## Utilisation et conditions : ##
|
||||
## - Il faut que les .srt et les .mkv soient dans le même dossier. ##
|
||||
## - Il faut que les sous-titres externes .SRT aient le même nom de fichier que les .MKV. ##
|
||||
## - Il faut paramétrer l'extension des fichiers de sous-titres pour que ces derniers ##
|
||||
## reflètent la langue : eng, fre,... ##
|
||||
## - Il faudra par ailleurs modifier le code langage dans AudioLang_X et SubTrackLang_1 ##
|
||||
## Il est possible de : ##
|
||||
## - spécifier des dossiers sources et destinations identiques ou différents ##
|
||||
## - spécifier un titre de piste (pour toutes) ##
|
||||
## ##
|
||||
##==============================================================================================
|
||||
## ##
|
||||
## Objectifs : ##
|
||||
## Remuxer un MKV en ne gardant que 3 pistes de sous-titres SRT et les 2 pistes audio ##
|
||||
## en spécifiant un nom pour chaque piste et en permettant de paramétrer celles par défaut ##
|
||||
## ainsi que l'odre des pistes ##
|
||||
## Le MKV de base contient 3 pistes SRT. On en garde que 3. ##
|
||||
## ##
|
||||
##==============================================================================================
|
||||
|
||||
#Set MKVMerge.exe Path
|
||||
$MKVMerge = 'H:\z_MKV\mkvtoolnix\mkvmerge.exe'
|
||||
|
||||
#Set Source and Target directories (Don't put an \ at the end)
|
||||
$sourceDirectory = "D:\DOSSIER_SOURCE\3ST"
|
||||
$destinationDirectory = "F:\DOSSIER_DESTINATION"
|
||||
|
||||
#If source and destination are the same folder, set this to True, Otherwise let it to "False"
|
||||
$merged_SUFFIX_name = "False"
|
||||
|
||||
#Set Subtitle Extension (Don't add the . before the extension)
|
||||
$SubExtension = 'eng.srt'
|
||||
#$SecondSubExtension = "sub"
|
||||
|
||||
# Track 0 = video
|
||||
|
||||
# ================== AUDIO ==================
|
||||
# Track 1 = Audio n°1
|
||||
# Name and language of Audio Track n°1
|
||||
$AudioTrackName_1 = "1:Français - AC3 5.1"
|
||||
$AudioLang_1 = "1:fr"
|
||||
$AudioTrack_1_default = "1:no"
|
||||
|
||||
# Track 2 = Audio n°2
|
||||
# Name of Audio Track n°2
|
||||
$AudioTrackName_2 = "2:English - AC3 5.1"
|
||||
$AudioLang_2 = "2:en"
|
||||
$AudioTrack_2_default = "2:yes"
|
||||
|
||||
# ================== SUBTITLES ==================
|
||||
# Track 3 = Sub n°1 to keep
|
||||
# Name and language of Subtitle Track n°1 + Sync Value
|
||||
$SubTrackName_1 = "3:FR Forcé - SRT"
|
||||
$SubTrackLang_1 = "3:fr"
|
||||
$SubTrack_1_default = "3:no"
|
||||
$sub_charset_1 = "3:UTF-8"
|
||||
|
||||
# Track 4 = Sub n°2 to keep
|
||||
# Name and language of Subtitle Track n°2 + Sync Value
|
||||
$SubTrackName_2 = "4:FR Complet - SRT"
|
||||
$SubTrackLang_2 = "4:fr"
|
||||
$SubTrack_2_default = "4:no"
|
||||
$sub_charset_2 = "4:UTF-8"
|
||||
|
||||
# Track 5 = Sub n°3 to keep
|
||||
# Name and language of Subtitle Track n°3 + Sync Value
|
||||
$SubTrackName_3 = "5:ENG Full - SRT"
|
||||
$SubTrackLang_3 = "5:en"
|
||||
$SubTrack_3_default = "5:yes"
|
||||
$sub_charset_3 = "5:UTF-8"
|
||||
|
||||
# ================== OTHER SETTINGS ==================
|
||||
# Define track order
|
||||
$track_order = "0:0,0:2,0:1,0:5,0:4,0:3"
|
||||
# Define subtitles track to keep
|
||||
$subtitle_tracks = "3,4,5"
|
||||
|
||||
##==============================================================================================
|
||||
##==============================================================================================
|
||||
|
||||
# Testing if the Not-Merged folder already exists : if yes, it will be renamed, else it will be created.
|
||||
$Path_Folder_NotMerged = $sourceDirectory + "\Not-Merged"
|
||||
If(!(test-path $Path_Folder_NotMerged)) {
|
||||
New-Item -ItemType "Directory" -Force -Path $Path_Folder_NotMerged -Verbose
|
||||
} else {
|
||||
# Don't know what's the best... TO BE IMPROVED
|
||||
#Move-Item -Path $Path_Folder_NotMerged -Destination "$sourceDirectory\Not-Merged--backup" -Verbose
|
||||
#Move-Item -Path $Path_Folder_NotMerged -Destination "$sourceDirectory\Not-Merged--backup" -Verbose
|
||||
}
|
||||
|
||||
|
||||
#Process - Grab the list of all MKV file in the folder
|
||||
$MKV_List = Get-ChildItem $sourceDirectory -Filter "*.mkv" | ForEach-Object { $_.FullName } | Sort-Object
|
||||
$Count = $MKV_List.count
|
||||
Write-Host "$Count MKV's to be processed in $sourceDirectory."
|
||||
|
||||
Foreach ($MKV_file in $MKV_List) {
|
||||
#Get File Name
|
||||
$FormatName = $MKV_file.ToString()
|
||||
$Name = $FormatName.Substring(0,$FormatName.Length-(4))
|
||||
$MKV = $FormatName
|
||||
#$OtherSub = $Name + '.' + $SecondSubExtension
|
||||
|
||||
# Title for the video track
|
||||
$VideoTrackName = ((Get-Item $MKV).Basename).ToString()
|
||||
|
||||
#Set Output File Name
|
||||
#$Output = $Name + '___MERGED' + '.mkv'
|
||||
If ($merged_SUFFIX_name -eq "True") {
|
||||
$Output = $destinationDirectory + "\" + $VideoTrackName + '___MERGED' + '.mkv'
|
||||
} elseif ($merged_SUFFIX_name -eq "False") {
|
||||
$Output = $destinationDirectory + "\" + $VideoTrackName + '.mkv'
|
||||
} else {
|
||||
write-host "Error in the value of the merged_SUFFIX_name variable. Current value = $merged_SUFFIX_name" -foreground "red"
|
||||
write-host "Should be set to True or False.`nScript is exiting now..." -foreground "white"
|
||||
Exit
|
||||
}
|
||||
|
||||
#Execute : Merge SRT with MKV
|
||||
#& $MKVMerge --title "$VideoTrackName" --track-order "0:0,0:1,0:2,1:0" -o "$Output" --no-subtitles --language "0:en" --track-name "0:$VideoTrackName" --default-track "0:yes" --language "1:$AudioLang_1" --track-name "1:$AudioTrackName_1" --default-track "1:yes" --language "2:$AudioLang_2" --track-name "2:$AudioTrackName_2" --default-track "2:no" "$MKV" --language "0:$SubTrackLang_1" --track-name "0:$SubTrackName_1" --default-track "0:yes" --sync "0:$SubSYNCvalue_1" "$Sub"
|
||||
|
||||
# Delete PGS subtitles in MKV keeping all the rest
|
||||
# & $MKVMerge --title "$VideoTrackName" --track-order "$track_order" -o "$Output" --subtitle-tracks "$subtitle_tracks" --language "0:en" --track-name "0:$VideoTrackName" --default-track "0:yes"
|
||||
# --language "$AudioLang_1" --track-name "$AudioTrackName_1" --default-track "$AudioTrack_1_default"
|
||||
# --language "$AudioLang_2" --track-name "$AudioTrackName_2" --default-track "$AudioTrack_2_default"
|
||||
# --sub-charset "$sub_charset_1" --language "$SubTrackLang_1" --track-name "$SubTrackName_1" --default-track "$SubTrack_1_default"
|
||||
# --sub-charset "$sub_charset_2" --language "$SubTrackLang_2" --track-name "$SubTrackName_2" --default-track "$SubTrack_2_default"
|
||||
# --sub-charset "$sub_charset_3" --language "$SubTrackLang_3" --track-name "$SubTrackName_3" --default-track "$SubTrack_3_default"
|
||||
# "$MKV"
|
||||
& $MKVMerge --title "$VideoTrackName" --track-order "$track_order" -o "$Output" --subtitle-tracks "$subtitle_tracks" --language "0:en" --track-name "0:$VideoTrackName" --default-track "0:yes" --language "$AudioLang_1" --track-name "$AudioTrackName_1" --default-track "$AudioTrack_1_default" --language "$AudioLang_2" --track-name "$AudioTrackName_2" --default-track "$AudioTrack_2_default" --sub-charset "$sub_charset_1" --language "$SubTrackLang_1" --track-name "$SubTrackName_1" --default-track "$SubTrack_1_default" --sub-charset "$sub_charset_2" --language "$SubTrackLang_2" --track-name "$SubTrackName_2" --default-track "$SubTrack_2_default" --sub-charset "$sub_charset_3" --language "$SubTrackLang_3" --track-name "$SubTrackName_3" --default-track "$SubTrack_3_default" "$MKV"
|
||||
|
||||
If (Test-Path $Output) {
|
||||
#Clean Up
|
||||
#Remove-Item $MKV
|
||||
#Remove-Item $Sub
|
||||
#Remove-Item $OtherSub
|
||||
# Move to folder Not-Merged, this folder's existence has already been tested, and the folder is created.
|
||||
Move-Item -Path $MKV -Destination $Path_Folder_NotMerged -Verbose
|
||||
#Move-Item -Path $Sub -Destination $Path_Folder_NotMerged -Verbose
|
||||
|
||||
# Renaming the output file is not necessary if the output filename doesn't have __MERGED in it
|
||||
#Rename-Item -Path $Output -NewName $MKV -Verbose
|
||||
|
||||
} Else {
|
||||
write-host "File NON-EXISTANT - $Output" -foreground "red"
|
||||
"File NON-EXISTANT - $Output" | Out-File "$destinationDirectory\Errors.txt" -Append
|
||||
}
|
||||
}
|
@ -0,0 +1,158 @@
|
||||
##==============================================================================================
|
||||
## ##
|
||||
## Batch Merge Subtitles with MKVMerge ##
|
||||
## By Miles ##
|
||||
## Idea from Iain McCain : https://superuser.com/a/1249870 ##
|
||||
## ##
|
||||
##==============================================================================================
|
||||
## ##
|
||||
## Utilisation et conditions : ##
|
||||
## - Il faut que les .srt et les .mkv soient dans le même dossier. ##
|
||||
## - Il faut que les sous-titres externes .SRT aient le même nom de fichier que les .MKV. ##
|
||||
## - Il faut paramétrer l'extension des fichiers de sous-titres pour que ces derniers ##
|
||||
## reflètent la langue : eng, fre,... ##
|
||||
## - Il faudra par ailleurs modifier le code langage dans AudioLang_X et SubTrackLang_1 ##
|
||||
## Il est possible de : ##
|
||||
## - spécifier des dossiers sources et destinations identiques ou différents ##
|
||||
## - spécifier un titre de piste (pour toutes) ##
|
||||
## ##
|
||||
##==============================================================================================
|
||||
## ##
|
||||
## Objectifs : ##
|
||||
## Remuxer un MKV en ne gardant que 3 pistes de sous-titres SRT et les 2 pistes audio ##
|
||||
## en spécifiant un nom pour chaque piste et en permettant de paramétrer celles par défaut ##
|
||||
## ainsi que l'odre des pistes ##
|
||||
## Le MKV de base contient 4 pistes SRT. On en garde que 3. ##
|
||||
## ##
|
||||
##==============================================================================================
|
||||
#Set MKVMerge.exe Path
|
||||
$MKVMerge = 'H:\z_MKV\mkvtoolnix\mkvmerge.exe'
|
||||
|
||||
#Set Source and Target directories (Don't put an \ at the end)
|
||||
$sourceDirectory = "D:\DOSSIER_SOURCE\4ST"
|
||||
$destinationDirectory = "F:\DOSSIER_DESTINATION"
|
||||
|
||||
#If source and destination are the same folder, set this to True, Otherwise let it to "False"
|
||||
$merged_SUFFIX_name = "False"
|
||||
|
||||
#Set Subtitle Extension (Don't add the . before the extension)
|
||||
$SubExtension = 'eng.srt'
|
||||
#$SecondSubExtension = "sub"
|
||||
|
||||
# Track 0 = video
|
||||
|
||||
# ================== AUDIO ==================
|
||||
# Track 1 = Audio n°1
|
||||
# Name and language of Audio Track n°1
|
||||
$AudioTrackName_1 = "1:Français - AC3 5.1"
|
||||
$AudioLang_1 = "1:fr"
|
||||
$AudioTrack_1_default = "1:no"
|
||||
|
||||
# Track 2 = Audio n°2
|
||||
# Name of Audio Track n°2
|
||||
$AudioTrackName_2 = "2:English - AC3 5.1"
|
||||
$AudioLang_2 = "2:en"
|
||||
$AudioTrack_2_default = "2:yes"
|
||||
|
||||
# ================== SUBTITLES ==================
|
||||
# Track 3 = Sub n°1 to keep
|
||||
# Name and language of Subtitle Track n°1 + Sync Value
|
||||
$SubTrackName_1 = "3:FR Forcé - SRT"
|
||||
$SubTrackLang_1 = "3:fr"
|
||||
$SubTrack_1_default = "3:no"
|
||||
$sub_charset_1 = "3:UTF-8"
|
||||
#$SubSYNCvalue_1 = "0000"
|
||||
|
||||
# Track 4 = Sub n°2 to keep
|
||||
# Name and language of Subtitle Track n°2 + Sync Value
|
||||
$SubTrackName_2 = "4:FR Complet - SRT"
|
||||
$SubTrackLang_2 = "4:fr"
|
||||
$SubTrack_2_default = "4:no"
|
||||
$sub_charset_2 = "4:UTF-8"
|
||||
#$SubSYNCvalue_2 = "0000"
|
||||
|
||||
# Track 6 = Sub n°3 to keep
|
||||
# Name and language of Subtitle Track n°3 + Sync Value
|
||||
$SubTrackName_3 = "6:ENG SDH - SRT"
|
||||
$SubTrackLang_3 = "6:en"
|
||||
$SubTrack_3_default = "6:yes"
|
||||
$sub_charset_3 = "6:UTF-8"
|
||||
#$SubSYNCvalue_3 = "0000"
|
||||
|
||||
# ================== OTHER SETTINGS ==================
|
||||
# Define track order
|
||||
$track_order = "0:0,0:2,0:1,0:6,0:3,0:4"
|
||||
# Define subtitles track to keep
|
||||
$subtitle_tracks = "3,4,6"
|
||||
|
||||
##==============================================================================================
|
||||
##==============================================================================================
|
||||
|
||||
# Testing if the Not-Merged folder already exists : if yes, it will be renamed, else it will be created.
|
||||
$Path_Folder_NotMerged = $sourceDirectory + "\Not-Merged"
|
||||
If(!(test-path $Path_Folder_NotMerged)) {
|
||||
New-Item -ItemType "Directory" -Force -Path $Path_Folder_NotMerged -Verbose
|
||||
} else {
|
||||
# Don't know what's the best... TO BE IMPROVED
|
||||
#Move-Item -Path $Path_Folder_NotMerged -Destination "$sourceDirectory\Not-Merged--backup" -Verbose
|
||||
#Move-Item -Path $Path_Folder_NotMerged -Destination "$sourceDirectory\Not-Merged--backup" -Verbose
|
||||
}
|
||||
|
||||
|
||||
#Process - Grab the list of all MKV file in the folder
|
||||
$MKV_List = Get-ChildItem $sourceDirectory -Filter "*.mkv" | ForEach-Object { $_.FullName } | Sort-Object
|
||||
$Count = $MKV_List.count
|
||||
Write-Host "$Count MKV's to be processed in $sourceDirectory."
|
||||
|
||||
Foreach ($MKV_file in $MKV_List) {
|
||||
#Get File Name
|
||||
$FormatName = $MKV_file.ToString()
|
||||
$Name = $FormatName.Substring(0,$FormatName.Length-(4))
|
||||
$MKV = $FormatName
|
||||
#$OtherSub = $Name + '.' + $SecondSubExtension
|
||||
|
||||
# Title for the video track
|
||||
$VideoTrackName = ((Get-Item $MKV).Basename).ToString()
|
||||
|
||||
#Set Output File Name
|
||||
#$Output = $Name + '___MERGED' + '.mkv'
|
||||
If ($merged_SUFFIX_name -eq "True") {
|
||||
$Output = $destinationDirectory + "\" + $VideoTrackName + '___MERGED' + '.mkv'
|
||||
} elseif ($merged_SUFFIX_name -eq "False") {
|
||||
$Output = $destinationDirectory + "\" + $VideoTrackName + '.mkv'
|
||||
} else {
|
||||
write-host "Error in the value of the merged_SUFFIX_name variable. Current value = $merged_SUFFIX_name" -foreground "red"
|
||||
write-host "Should be set to True or False.`nScript is exiting now..." -foreground "white"
|
||||
Exit
|
||||
}
|
||||
|
||||
#Execute : Merge SRT with MKV
|
||||
#& $MKVMerge --title "$VideoTrackName" --track-order "0:0,0:1,0:2,1:0" -o "$Output" --no-subtitles --language "0:en" --track-name "0:$VideoTrackName" --default-track "0:yes" --language "1:$AudioLang_1" --track-name "1:$AudioTrackName_1" --default-track "1:yes" --language "2:$AudioLang_2" --track-name "2:$AudioTrackName_2" --default-track "2:no" "$MKV" --language "0:$SubTrackLang_1" --track-name "0:$SubTrackName_1" --default-track "0:yes" --sync "0:$SubSYNCvalue_1" "$Sub"
|
||||
|
||||
# Delete PGS subtitles in MKV keeping all the rest
|
||||
# & $MKVMerge --title "$VideoTrackName" --track-order "$track_order" -o "$Output" --subtitle-tracks "$subtitle_tracks" --language "0:en" --track-name "0:$VideoTrackName" --default-track "0:yes"
|
||||
# --language "$AudioLang_1" --track-name "$AudioTrackName_1" --default-track "$AudioTrack_1_default"
|
||||
# --language "$AudioLang_2" --track-name "$AudioTrackName_2" --default-track "$AudioTrack_2_default"
|
||||
# --sub-charset "$sub_charset_1" --language "$SubTrackLang_1" --track-name "$SubTrackName_1" --default-track "$SubTrack_1_default"
|
||||
# --sub-charset "$sub_charset_2" --language "$SubTrackLang_2" --track-name "$SubTrackName_2" --default-track "$SubTrack_2_default"
|
||||
# --sub-charset "$sub_charset_3" --language "$SubTrackLang_3" --track-name "$SubTrackName_3" --default-track "$SubTrack_3_default"
|
||||
# "$MKV"
|
||||
& $MKVMerge --title "$VideoTrackName" --track-order "$track_order" -o "$Output" --subtitle-tracks "$subtitle_tracks" --language "0:und" --track-name "0:$VideoTrackName" --default-track "0:yes" --language "$AudioLang_1" --track-name "$AudioTrackName_1" --default-track "$AudioTrack_1_default" --language "$AudioLang_2" --track-name "$AudioTrackName_2" --default-track "$AudioTrack_2_default" --sub-charset "$sub_charset_1" --language "$SubTrackLang_1" --track-name "$SubTrackName_1" --default-track "$SubTrack_1_default" --sub-charset "$sub_charset_2" --language "$SubTrackLang_2" --track-name "$SubTrackName_2" --default-track "$SubTrack_2_default" --sub-charset "$sub_charset_3" --language "$SubTrackLang_3" --track-name "$SubTrackName_3" --default-track "$SubTrack_3_default" "$MKV"
|
||||
|
||||
If (Test-Path $Output) {
|
||||
#Clean Up
|
||||
#Remove-Item $MKV
|
||||
#Remove-Item $Sub
|
||||
#Remove-Item $OtherSub
|
||||
# Move to folder Not-Merged, this folder's existence has already been tested, and the folder is created.
|
||||
Move-Item -Path $MKV -Destination $Path_Folder_NotMerged -Verbose
|
||||
#Move-Item -Path $Sub -Destination $Path_Folder_NotMerged -Verbose
|
||||
|
||||
# Renaming the output file is not necessary if the output filename doesn't have __MERGED in it
|
||||
#Rename-Item -Path $Output -NewName $MKV -Verbose
|
||||
|
||||
} Else {
|
||||
write-host "File NON-EXISTANT - $Output" -foreground "red"
|
||||
"File NON-EXISTANT - $Output" | Out-File "$destinationDirectory\Errors.txt" -Append
|
||||
}
|
||||
}
|
@ -0,0 +1,157 @@
|
||||
##==============================================================================================
|
||||
## ##
|
||||
## Batch Merge Subtitles with MKVMerge ##
|
||||
## By Miles ##
|
||||
## Idea from Iain McCain : https://superuser.com/a/1249870 ##
|
||||
## ##
|
||||
##==============================================================================================
|
||||
## ##
|
||||
## Utilisation et conditions : ##
|
||||
## - Il faut que les .srt et les .mkv soient dans le même dossier. ##
|
||||
## - Il faut que les sous-titres externes .SRT aient le même nom de fichier que les .MKV. ##
|
||||
## - Il faut paramétrer l'extension des fichiers de sous-titres pour que ces derniers ##
|
||||
## reflètent la langue : eng, fre,... ##
|
||||
## - Il faudra par ailleurs modifier le code langage dans AudioLang_X et SubTrackLang_1 ##
|
||||
## Il est possible de : ##
|
||||
## - spécifier des dossiers sources et destinations identiques ou différents ##
|
||||
## - spécifier un titre de piste (pour toutes) ##
|
||||
## ##
|
||||
##==============================================================================================
|
||||
## ##
|
||||
## Objectifs : ##
|
||||
## Remuxer un MKV en ne gardant que 3 pistes de sous-titres SRT et les 2 pistes audio ##
|
||||
## en spécifiant un nom pour chaque piste et en permettant de paramétrer celles par défaut ##
|
||||
## ainsi que l'odre des pistes ##
|
||||
## Le MKV de base contient 5 pistes SRT. On en garde que 3. ##
|
||||
## ##
|
||||
##==============================================================================================
|
||||
|
||||
|
||||
#Set MKVMerge.exe Path
|
||||
$MKVMerge = 'H:\z_MKV\mkvtoolnix\mkvmerge.exe'
|
||||
|
||||
#Set Source and Target directories (Don't put an \ at the end)
|
||||
$sourceDirectory = "D:\DOSSIER_SOURCE\5ST"
|
||||
$destinationDirectory = "F:\DOSSIER_DESTINATION"
|
||||
|
||||
#If source and destination are the same folder, set this to True, Otherwise let it to "False"
|
||||
$merged_SUFFIX_name = "False"
|
||||
|
||||
#Set Subtitle Extension (Don't add the . before the extension)
|
||||
$SubExtension = 'eng.srt'
|
||||
#$SecondSubExtension = "sub"
|
||||
|
||||
# Track 0 = video
|
||||
|
||||
# ================== AUDIO ==================
|
||||
# Track 1 = Audio n°1
|
||||
# Name and language of Audio Track n°1
|
||||
$AudioTrackName_1 = "1:Français - AC3 5.1"
|
||||
$AudioLang_1 = "1:fr"
|
||||
$AudioTrack_1_default = "1:no"
|
||||
|
||||
# Track 2 = Audio n°2
|
||||
# Name of Audio Track n°2
|
||||
$AudioTrackName_2 = "2:English - AC3 5.1"
|
||||
$AudioLang_2 = "2:en"
|
||||
$AudioTrack_2_default = "2:yes"
|
||||
|
||||
# ================== SUBTITLES ==================
|
||||
# Track 3 = Sub n°1 to keep
|
||||
# Name and language of Subtitle Track n°1 + Sync Value
|
||||
$SubTrackName_1 = "3:FR Forcé - SRT"
|
||||
$SubTrackLang_1 = "3:fr"
|
||||
$SubTrack_1_default = "3:no"
|
||||
$sub_charset_1 = "3:UTF-8"
|
||||
|
||||
# Track 4 = Sub n°2 to keep
|
||||
# Name and language of Subtitle Track n°2 + Sync Value
|
||||
$SubTrackName_2 = "4:FR Complet - SRT"
|
||||
$SubTrackLang_2 = "4:fr"
|
||||
$SubTrack_2_default = "4:no"
|
||||
$sub_charset_2 = "4:UTF-8"
|
||||
|
||||
# Track 7 = Sub n°3 to keep
|
||||
# Name and language of Subtitle Track n°3 + Sync Value
|
||||
$SubTrackName_3 = "7:ENG SDH - SRT"
|
||||
$SubTrackLang_3 = "7:en"
|
||||
$SubTrack_3_default = "7:yes"
|
||||
$sub_charset_3 = "7:UTF-8"
|
||||
|
||||
# ================== OTHER SETTINGS ==================
|
||||
# Define track order
|
||||
$track_order = "0:0,0:2,0:1,0:7,0:3,0:4"
|
||||
# Define subtitles track to keep
|
||||
$subtitle_tracks = "3,4,7"
|
||||
|
||||
##==============================================================================================
|
||||
##==============================================================================================
|
||||
|
||||
# Testing if the Not-Merged folder already exists : if yes, it will be renamed, else it will be created.
|
||||
$Path_Folder_NotMerged = $sourceDirectory + "\Not-Merged"
|
||||
If(!(test-path $Path_Folder_NotMerged)) {
|
||||
New-Item -ItemType "Directory" -Force -Path $Path_Folder_NotMerged -Verbose
|
||||
} else {
|
||||
# Don't know what's the best... TO BE IMPROVED
|
||||
#Move-Item -Path $Path_Folder_NotMerged -Destination "$sourceDirectory\Not-Merged--backup" -Verbose
|
||||
#Move-Item -Path $Path_Folder_NotMerged -Destination "$sourceDirectory\Not-Merged--backup" -Verbose
|
||||
}
|
||||
|
||||
|
||||
#Process - Grab the list of all MKV file in the folder
|
||||
$MKV_List = Get-ChildItem $sourceDirectory -Filter "*.mkv" | ForEach-Object { $_.FullName } | Sort-Object
|
||||
$Count = $MKV_List.count
|
||||
Write-Host "$Count MKV's to be processed in $sourceDirectory."
|
||||
|
||||
Foreach ($MKV_file in $MKV_List) {
|
||||
#Get File Name
|
||||
$FormatName = $MKV_file.ToString()
|
||||
$Name = $FormatName.Substring(0,$FormatName.Length-(4))
|
||||
$MKV = $FormatName
|
||||
#$OtherSub = $Name + '.' + $SecondSubExtension
|
||||
|
||||
# Title for the video track
|
||||
$VideoTrackName = ((Get-Item $MKV).Basename).ToString()
|
||||
|
||||
#Set Output File Name
|
||||
#$Output = $Name + '___MERGED' + '.mkv'
|
||||
If ($merged_SUFFIX_name -eq "True") {
|
||||
$Output = $destinationDirectory + "\" + $VideoTrackName + '___MERGED' + '.mkv'
|
||||
} elseif ($merged_SUFFIX_name -eq "False") {
|
||||
$Output = $destinationDirectory + "\" + $VideoTrackName + '.mkv'
|
||||
} else {
|
||||
write-host "Error in the value of the merged_SUFFIX_name variable. Current value = $merged_SUFFIX_name" -foreground "red"
|
||||
write-host "Should be set to True or False.`nScript is exiting now..." -foreground "white"
|
||||
Exit
|
||||
}
|
||||
|
||||
#Execute : Merge SRT with MKV
|
||||
#& $MKVMerge --title "$VideoTrackName" --track-order "0:0,0:1,0:2,1:0" -o "$Output" --no-subtitles --language "0:en" --track-name "0:$VideoTrackName" --default-track "0:yes" --language "1:$AudioLang_1" --track-name "1:$AudioTrackName_1" --default-track "1:yes" --language "2:$AudioLang_2" --track-name "2:$AudioTrackName_2" --default-track "2:no" "$MKV" --language "0:$SubTrackLang_1" --track-name "0:$SubTrackName_1" --default-track "0:yes" --sync "0:$SubSYNCvalue_1" "$Sub"
|
||||
|
||||
# Delete PGS subtitles in MKV keeping all the rest
|
||||
# & $MKVMerge --title "$VideoTrackName" --track-order "$track_order" -o "$Output" --subtitle-tracks "$subtitle_tracks" --language "0:en" --track-name "0:$VideoTrackName" --default-track "0:yes"
|
||||
# --language "$AudioLang_1" --track-name "$AudioTrackName_1" --default-track "$AudioTrack_1_default"
|
||||
# --language "$AudioLang_2" --track-name "$AudioTrackName_2" --default-track "$AudioTrack_2_default"
|
||||
# --sub-charset "$sub_charset_1" --language "$SubTrackLang_1" --track-name "$SubTrackName_1" --default-track "$SubTrack_1_default"
|
||||
# --sub-charset "$sub_charset_2" --language "$SubTrackLang_2" --track-name "$SubTrackName_2" --default-track "$SubTrack_2_default"
|
||||
# --sub-charset "$sub_charset_3" --language "$SubTrackLang_3" --track-name "$SubTrackName_3" --default-track "$SubTrack_3_default"
|
||||
# "$MKV"
|
||||
& $MKVMerge --title "$VideoTrackName" --track-order "$track_order" -o "$Output" --subtitle-tracks "$subtitle_tracks" --language "0:und" --track-name "0:$VideoTrackName" --default-track "0:yes" --language "$AudioLang_1" --track-name "$AudioTrackName_1" --default-track "$AudioTrack_1_default" --language "$AudioLang_2" --track-name "$AudioTrackName_2" --default-track "$AudioTrack_2_default" --sub-charset "$sub_charset_1" --language "$SubTrackLang_1" --track-name "$SubTrackName_1" --default-track "$SubTrack_1_default" --sub-charset "$sub_charset_2" --language "$SubTrackLang_2" --track-name "$SubTrackName_2" --default-track "$SubTrack_2_default" --sub-charset "$sub_charset_3" --language "$SubTrackLang_3" --track-name "$SubTrackName_3" --default-track "$SubTrack_3_default" "$MKV"
|
||||
|
||||
If (Test-Path $Output) {
|
||||
#Clean Up
|
||||
#Remove-Item $MKV
|
||||
#Remove-Item $Sub
|
||||
#Remove-Item $OtherSub
|
||||
# Move to folder Not-Merged, this folder's existence has already been tested, and the folder is created.
|
||||
Move-Item -Path $MKV -Destination $Path_Folder_NotMerged -Verbose
|
||||
#Move-Item -Path $Sub -Destination $Path_Folder_NotMerged -Verbose
|
||||
|
||||
# Renaming the output file is not necessary if the output filename doesn't have __MERGED in it
|
||||
#Rename-Item -Path $Output -NewName $MKV -Verbose
|
||||
|
||||
} Else {
|
||||
write-host "File NON-EXISTANT - $Output" -foreground "red"
|
||||
"File NON-EXISTANT - $Output" | Out-File "$destinationDirectory\Errors.txt" -Append
|
||||
}
|
||||
}
|
120
Scripts-Divers/OLD/Batch Merge Subtitles with MKVMerge - OLD.ps1
Normal file
@ -0,0 +1,120 @@
|
||||
##==============================================================================================
|
||||
## ##
|
||||
## Batch Merge Subtitles with MKVMerge ##
|
||||
## By Miles ##
|
||||
## Idea from Iain McCain : https://superuser.com/a/1249870 ##
|
||||
## ##
|
||||
##==============================================================================================
|
||||
## ##
|
||||
## Utilisation et conditions : ##
|
||||
## - Il faut que les .srt et les .mkv soient dans le même dossier. ##
|
||||
## - Il faut que les sous-titres externes .SRT aient le même nom de fichier que les .MKV. ##
|
||||
## - Il faut paramétrer l'extension des fichiers de sous-titres pour que ces derniers ##
|
||||
## reflètent la langue : eng, fre,... ##
|
||||
## - Il faudra par ailleurs modifier le code langage dans AudioLang_X et SubTrackLang_1 ##
|
||||
## Il est possible de : ##
|
||||
## - spécifier des dossiers sources et destinations identiques ou différents ##
|
||||
## - spécifier un titre de piste (pour toutes) ##
|
||||
## ##
|
||||
##==============================================================================================
|
||||
|
||||
#Set MKVMerge.exe Path
|
||||
$MKVMerge = 'H:\z_MKV\mkvtoolnix\mkvmerge.exe'
|
||||
|
||||
#Set Source and Target directories (Don't put an \ at the end)
|
||||
$sourceDirectory = "D:\DOSSIER_SOURCE"
|
||||
$destinationDirectory = "F:\DOSSIER_DESTINATION"
|
||||
|
||||
#If source and destination are the same folder, set this to True, Otherwise let it to "False"
|
||||
$merged_SUFFIX_name = "False"
|
||||
|
||||
#Set Subtitle Extension (Don't add the . before the extension)
|
||||
$SubExtension = 'eng.srt'
|
||||
#$SecondSubExtension = "sub"
|
||||
|
||||
# Name and language of Audio Track n°1
|
||||
$AudioTrackName_1 = "English AC3 5.1"
|
||||
$AudioLang_1 = "en"
|
||||
|
||||
# Name of Audio Track n°2
|
||||
$AudioTrackName_2 = "Français AC3 2.0"
|
||||
$AudioLang_2 = "fr"
|
||||
|
||||
# Name and language of Subtitle Track n°1 + Sync Value
|
||||
$SubTrackName_1 = "English SRT"
|
||||
$SubTrackLang_1 = "en"
|
||||
# Leave this at "0000" if no synchronisation modifier is to used, otherwise it's in ms
|
||||
# +xxxx to delay the display of subtitles of xxxx ms
|
||||
# -xxxx to advance the display of subtitles of xxxx ms
|
||||
$SubSYNCvalue_1 = "0000"
|
||||
|
||||
# Name and language of Subtitle Track n°2
|
||||
#$SubTrackName_2 = "Français SRT"
|
||||
#$SubTrackLang_2 = "fr"
|
||||
# Leave this at "0:0000" if no synchronisation modifier is to used, otherwise it's in ms :
|
||||
# 0:+xxxx to delay the display of subtitles of xxxx ms
|
||||
# 0:-xxxx to advance the display of subtitles of xxxx ms
|
||||
#$SubSYNCvalue_2 = "0:1000"
|
||||
|
||||
##==============================================================================================
|
||||
##==============================================================================================
|
||||
|
||||
# Testing if the Not-Merged folder already exists : if yes, it will be renamed, else it will be created.
|
||||
$Path_Folder_NotMerged = $sourceDirectory + "\Not-Merged"
|
||||
If(!(test-path $Path_Folder_NotMerged)) {
|
||||
New-Item -ItemType "Directory" -Force -Path $Path_Folder_NotMerged -Verbose
|
||||
} else {
|
||||
# Don't know what's the best... TO BE IMPROVED
|
||||
#Move-Item -Path $Path_Folder_NotMerged -Destination "$sourceDirectory\Not-Merged--backup" -Verbose
|
||||
#Move-Item -Path $Path_Folder_NotMerged -Destination "$sourceDirectory\Not-Merged--backup" -Verbose
|
||||
}
|
||||
|
||||
|
||||
#Process
|
||||
$Subs = Get-ChildItem $sourceDirectory -Filter "*.$SubExtension" | ForEach-Object { $_.FullName } | Sort-Object
|
||||
$Count = $Subs.count
|
||||
Write-Host "$Count MKV's to be processed."
|
||||
|
||||
Foreach ($Sub in $Subs) {
|
||||
#Get File Name
|
||||
$FormatName = $Sub.ToString()
|
||||
#$Name = $FormatName.TrimEnd(".$SubExtension")
|
||||
$Name = $FormatName.Substring(0,$FormatName.Length-($SubExtension.Length+1))
|
||||
$MKV = $Name + '.mkv'
|
||||
#$OtherSub = $Name + '.' + $SecondSubExtension
|
||||
|
||||
# Title for the video track
|
||||
$VideoTrackName = (Get-Item $MKV).Basename
|
||||
|
||||
#Set Output File Name
|
||||
#$Output = $Name + '___MERGED' + '.mkv'
|
||||
If ($merged_SUFFIX_name -eq "True") {
|
||||
$Output = $destinationDirectory + "\" + $VideoTrackName + '___MERGED' + '.mkv'
|
||||
} elseif ($merged_SUFFIX_name -eq "False") {
|
||||
$Output = $destinationDirectory + "\" + $VideoTrackName + '.mkv'
|
||||
} else {
|
||||
write-host "Error in the value of the merged_SUFFIX_name variable. Current value = $merged_SUFFIX_name" -foreground "red"
|
||||
write-host "Should be set to True or False.`nScript is exiting now..." -foreground "white"
|
||||
Exit
|
||||
}
|
||||
|
||||
#Execute
|
||||
& $MKVMerge --title "$VideoTrackName" --track-order "0:0,0:1,0:2,1:0" -o "$Output" --no-subtitles --language "0:en" --track-name "0:$VideoTrackName" --default-track "0:yes" --language "1:$AudioLang_1" --track-name "1:$AudioTrackName_1" --default-track "1:yes" --language "2:$AudioLang_2" --track-name "2:$AudioTrackName_2" --default-track "2:no" "$MKV" --language "0:$SubTrackLang_1" --track-name "0:$SubTrackName_1" --default-track "0:yes" --sync "0:$SubSYNCvalue_1" "$Sub"
|
||||
|
||||
If (Test-Path $Output) {
|
||||
#Clean Up
|
||||
#Remove-Item $MKV
|
||||
#Remove-Item $Sub
|
||||
#Remove-Item $OtherSub
|
||||
# Move to folder Not-Merged, this folder's existence has already been tested, and the folder is created.
|
||||
Move-Item -Path $MKV -Destination $Path_Folder_NotMerged -Verbose
|
||||
Move-Item -Path $Sub -Destination $Path_Folder_NotMerged -Verbose
|
||||
|
||||
# Renaming the output file is not necessary if the output filename doesn't have __MERGED in it
|
||||
#Rename-Item -Path $Output -NewName $MKV -Verbose
|
||||
|
||||
} Else {
|
||||
write-host "File NON-EXISTANT - $Output" -foreground "red"
|
||||
"File NON-EXISTANT - $Output" | Out-File "$destinationDirectory\Errors.txt" -Append
|
||||
}
|
||||
}
|
136
Scripts-Divers/OLD/Batch Merge Subtitles with MKVMerge.ps1
Normal file
@ -0,0 +1,136 @@
|
||||
##==============================================================================================
|
||||
## ##
|
||||
## Batch Merge Subtitles with MKVMerge ##
|
||||
## By Miles ##
|
||||
## Idea from Iain McCain : https://superuser.com/a/1249870 ##
|
||||
## ##
|
||||
##==============================================================================================
|
||||
## ##
|
||||
## Utilisation et conditions : ##
|
||||
## - Il faut que les .srt et les .mkv soient dans le même dossier. ##
|
||||
## - Il faut que les sous-titres externes .SRT aient le même nom de fichier que les .MKV. ##
|
||||
## - Il faut paramétrer l'extension des fichiers de sous-titres pour que ces derniers ##
|
||||
## reflètent la langue : eng, fre,... ##
|
||||
## - Il faudra par ailleurs modifier le code langage dans AudioLang_X et SubTrackLang_1 ##
|
||||
## Il est possible de : ##
|
||||
## - spécifier des dossiers sources et destinations identiques ou différents ##
|
||||
## - spécifier un titre de piste (pour toutes) ##
|
||||
## ##
|
||||
##==============================================================================================
|
||||
## ##
|
||||
## Objectifs : ##
|
||||
## Remuxer un MKV avec un SRT externe présent dans le même dossiers. ##
|
||||
## Il faut que ce SRT ait le même nom que le MKV, avec comme extension .eng.srt ou .fr.srt ##
|
||||
## en fonction de la langue du ST. ##
|
||||
## ##
|
||||
##==============================================================================================
|
||||
|
||||
#Set MKVMerge.exe Path
|
||||
$MKVMerge = 'H:\z_MKV\mkvtoolnix\mkvmerge.exe'
|
||||
|
||||
#Set Source and Target directories (Don't put an \ at the end)
|
||||
$sourceDirectory = "D:\DOSSIER_SOURCE"
|
||||
$destinationDirectory = "F:\DOSSIER_DESTINATION"
|
||||
|
||||
#If source and destination are the same folder, set this to True, Otherwise let it to "False"
|
||||
$merged_SUFFIX_name = "False"
|
||||
|
||||
#Set Subtitle Extension (Don't add the . before the extension)
|
||||
$SubExtension = 'eng.srt'
|
||||
#$SecondSubExtension = "sub"
|
||||
|
||||
# Track 0 = video
|
||||
|
||||
# ================== AUDIO ==================
|
||||
# Track 1 = Audio n°1
|
||||
# Name and language of Audio Track n°1
|
||||
$AudioTrackName_1 = "1:Français - AC3 5.1"
|
||||
$AudioLang_1 = "1:fr"
|
||||
$AudioTrack_1_default = "1:no"
|
||||
|
||||
# Track 2 = Audio n°2
|
||||
# Name of Audio Track n°2
|
||||
# $AudioTrackName_2 = "2:English - AC3 5.1"
|
||||
# $AudioLang_2 = "2:en"
|
||||
# $AudioTrack_2_default = "2:yes"
|
||||
|
||||
# ================== SUBTITLES ==================
|
||||
# Track 0 : beacause it's a SRT file
|
||||
# Name and language of Subtitle Track n°1 + Sync Value
|
||||
$SubTrackName_1 = "0:ENG SDH - SRT"
|
||||
$SubTrackLang_1 = "0:en"
|
||||
$SubTrack_1_default = "3:yes"
|
||||
$sub_charset_1 = "3:UTF-8"
|
||||
#$SubSYNCvalue_1 = "0000"
|
||||
|
||||
# ================== OTHER SETTINGS ==================
|
||||
# Define track order
|
||||
$track_order = "0:0,0:2,0:1,0:6,0:3,0:4"
|
||||
# Define subtitles track to keep
|
||||
$subtitle_tracks = "3,4,6"
|
||||
|
||||
##==============================================================================================
|
||||
##==============================================================================================
|
||||
|
||||
##==============================================================================================
|
||||
##==============================================================================================
|
||||
|
||||
# Testing if the Not-Merged folder already exists : if yes, it will be renamed, else it will be created.
|
||||
$Path_Folder_NotMerged = $sourceDirectory + "\Not-Merged"
|
||||
If(!(test-path $Path_Folder_NotMerged)) {
|
||||
New-Item -ItemType "Directory" -Force -Path $Path_Folder_NotMerged -Verbose
|
||||
} else {
|
||||
# Don't know what's the best... TO BE IMPROVED
|
||||
#Move-Item -Path $Path_Folder_NotMerged -Destination "$sourceDirectory\Not-Merged--backup" -Verbose
|
||||
#Move-Item -Path $Path_Folder_NotMerged -Destination "$sourceDirectory\Not-Merged--backup" -Verbose
|
||||
}
|
||||
|
||||
|
||||
#Process
|
||||
$Subs = Get-ChildItem $sourceDirectory -Filter "*.$SubExtension" | ForEach-Object { $_.FullName } | Sort-Object
|
||||
$Count = $Subs.count
|
||||
Write-Host "$Count MKV's to be processed."
|
||||
|
||||
Foreach ($Sub in $Subs) {
|
||||
#Get File Name
|
||||
$FormatName = $Sub.ToString()
|
||||
#$Name = $FormatName.TrimEnd(".$SubExtension")
|
||||
$Name = $FormatName.Substring(0,$FormatName.Length-($SubExtension.Length+1))
|
||||
$MKV = $Name + '.mkv'
|
||||
#$OtherSub = $Name + '.' + $SecondSubExtension
|
||||
|
||||
# Title for the video track
|
||||
$VideoTrackName = (Get-Item $MKV).Basename
|
||||
|
||||
#Set Output File Name
|
||||
#$Output = $Name + '___MERGED' + '.mkv'
|
||||
If ($merged_SUFFIX_name -eq "True") {
|
||||
$Output = $destinationDirectory + "\" + $VideoTrackName + '___MERGED' + '.mkv'
|
||||
} elseif ($merged_SUFFIX_name -eq "False") {
|
||||
$Output = $destinationDirectory + "\" + $VideoTrackName + '.mkv'
|
||||
} else {
|
||||
write-host "Error in the value of the merged_SUFFIX_name variable. Current value = $merged_SUFFIX_name" -foreground "red"
|
||||
write-host "Should be set to True or False.`nScript is exiting now..." -foreground "white"
|
||||
Exit
|
||||
}
|
||||
|
||||
#Execute
|
||||
& $MKVMerge --title "$VideoTrackName" --track-order "0:0,0:1,0:2,1:0" -o "$Output" --no-subtitles --language "0:en" --track-name "0:$VideoTrackName" --default-track "0:yes" --language "1:$AudioLang_1" --track-name "1:$AudioTrackName_1" --default-track "1:yes" --language "2:$AudioLang_2" --track-name "2:$AudioTrackName_2" --default-track "2:no" "$MKV" --language "0:$SubTrackLang_1" --track-name "0:$SubTrackName_1" --default-track "0:yes" --sync "0:$SubSYNCvalue_1" "$Sub"
|
||||
|
||||
If (Test-Path $Output) {
|
||||
#Clean Up
|
||||
#Remove-Item $MKV
|
||||
#Remove-Item $Sub
|
||||
#Remove-Item $OtherSub
|
||||
# Move to folder Not-Merged, this folder's existence has already been tested, and the folder is created.
|
||||
Move-Item -Path $MKV -Destination $Path_Folder_NotMerged -Verbose
|
||||
Move-Item -Path $Sub -Destination $Path_Folder_NotMerged -Verbose
|
||||
|
||||
# Renaming the output file is not necessary if the output filename doesn't have __MERGED in it
|
||||
#Rename-Item -Path $Output -NewName $MKV -Verbose
|
||||
|
||||
} Else {
|
||||
write-host "File NON-EXISTANT - $Output" -foreground "red"
|
||||
"File NON-EXISTANT - $Output" | Out-File "$destinationDirectory\Errors.txt" -Append
|
||||
}
|
||||
}
|
@ -0,0 +1,212 @@
|
||||
##==============================================================================================
|
||||
## ##
|
||||
## Batch Merge Subtitles with MKVMerge ##
|
||||
## By Miles ##
|
||||
## Idea from Iain McCain : https://superuser.com/a/1249870 ##
|
||||
## ##
|
||||
##==============================================================================================
|
||||
## ##
|
||||
## Utilisation et conditions : ##
|
||||
## - Il faut que les .srt et les .mkv soient dans le même dossier. ##
|
||||
## - Il faut que les sous-titres externes .SRT aient le même nom de fichier que les .MKV. ##
|
||||
## - Il faut paramétrer l'extension des fichiers de sous-titres pour que ces derniers ##
|
||||
## reflètent la langue : eng, fre,... ##
|
||||
## - Il faudra par ailleurs modifier le code langage dans AudioLang_X et SubTrackLang_1 ##
|
||||
## Il est possible de : ##
|
||||
## - spécifier des dossiers sources et destinations identiques ou différents ##
|
||||
## - spécifier un titre de piste (pour toutes) ##
|
||||
## ##
|
||||
##==============================================================================================
|
||||
## ##
|
||||
## Objectifs : ##
|
||||
## Remuxer deux MKV en gardant l'audio et les chapitres du premier, et seulement la vidéo ##
|
||||
## du second, en muxant en plus un SRT ayant le même nom que le 1er mkv et étant dans le même ##
|
||||
## dossier que ce 1er mkv ##
|
||||
## ##
|
||||
##==============================================================================================
|
||||
|
||||
|
||||
#Set MKVMerge.exe Path
|
||||
$MKVMerge = 'H:\z_MKV\mkvtoolnix\mkvmerge.exe'
|
||||
|
||||
#Set Source and Target directories (Don't put an \ at the end)
|
||||
$sourceDirectory_1 = "D:\DOSSIER_SOURCE-1"
|
||||
$sourceDirectory_2 = "D:\DOSSIER_SOURCE-2"
|
||||
$destinationDirectory = "G:\DOSSIER_DESTINATION"
|
||||
|
||||
#If source and destination are the same folder, set this to True, Otherwise let it to "False"
|
||||
$merged_SUFFIX_name = "False"
|
||||
|
||||
#Set Subtitle Extension (Don't add the . before the extension)
|
||||
$SubExtension = 'eng.srt'
|
||||
|
||||
#### Objective : Keep audio and subtitles and tags from FILE n°1 - Add video from FILE n°2
|
||||
|
||||
##########################################
|
||||
#### FILE 1 - MKV - Keeping all but the video (audio + chapters tags)
|
||||
# ================== AUDIO ==================
|
||||
# Track 1 = Audio n°1
|
||||
# Name and language of Audio Track n°1
|
||||
$AudioTrackName_1 = "1:English - DTS 5.1 768kb/s"
|
||||
$AudioLang_1 = "1:fr"
|
||||
$AudioTrack_1_default = "1:yes"
|
||||
$file_1_options = "--no-video"
|
||||
|
||||
##########################################
|
||||
#### FILE 2 - MKV - Keeping only the video
|
||||
$file_2_options = "--no-audio --no-track-tags --no-global-tags"
|
||||
|
||||
##########################################
|
||||
#### FILE 3 - SRT - Keeping all but the video (audio + chapters tags)
|
||||
# ================== SUBTITLES ==================
|
||||
# Track 0 = Sub n°1 to keep
|
||||
# Name and language of Subtitle Track n°0 + Sync Value
|
||||
$SubTrackName_1 = "0:English SDH - SRT"
|
||||
$SubTrackLang_1 = "0:en"
|
||||
$SubTrack_1_default = "0:yes"
|
||||
$sub_charset_1 = "0:UTF-8"
|
||||
####
|
||||
|
||||
# ================== OTHER SETTINGS ==================
|
||||
# Define track order
|
||||
$track_order = "1:0,0:1,2:0"
|
||||
# Define subtitles track to keep
|
||||
#$subtitle_tracks = "3"
|
||||
|
||||
# Files name, without .mkv :
|
||||
# format = filename_1_part_1 + S + filename_season + E + i_counter + filename_1_part_2 + .mkv
|
||||
# format = filename_2_part_1 + S + filename_season + E + i_counter + filename_2_part_2 + .mkv
|
||||
$filename_1_part_1 = "Ma série (20xx) - "
|
||||
$filename_1_part_2 = " - 1080p-h264"
|
||||
# Final name 1 = Ma série (20xx) - S01E01 - 1080p-h264
|
||||
# The SRT file must have the same name (without the extention .eng.srt)
|
||||
|
||||
$filename_2_part_1 = "Ma série (20xx) - "
|
||||
$filename_2_part_2 = " - 1080p.x265"
|
||||
# Final name 2 = Ma série (20xx) - S01E01 - 1080p.x265
|
||||
|
||||
$filename_season = "01"
|
||||
$filename_ep_start = 4
|
||||
$filename_ep_final = 4
|
||||
##==============================================================================================
|
||||
##==============================================================================================
|
||||
|
||||
# Testing if the Not-Merged folder already exists : if yes, it will be renamed, else it will be created.
|
||||
$Path_Folder_NotMerged_2 = $sourceDirectory_2 + "\Not-Merged"
|
||||
If(!(test-path $Path_Folder_NotMerged_2)) {
|
||||
New-Item -ItemType "Directory" -Force -Path $Path_Folder_NotMerged_2 -Verbose
|
||||
} else {
|
||||
# Don't know what's the best... TO BE IMPROVED
|
||||
#Move-Item -Path $Path_Folder_NotMerged_2 -Destination "$sourceDirectory\Not-Merged--backup" -Verbose
|
||||
#Move-Item -Path $Path_Folder_NotMerged_2 -Destination "$sourceDirectory\Not-Merged--backup" -Verbose
|
||||
}
|
||||
# Testing if the Not-Merged folder already exists : if yes, it will be renamed, else it will be created.
|
||||
$Path_Folder_NotMerged_1 = $sourceDirectory_1 + "\Not-Merged"
|
||||
If(!(test-path $Path_Folder_NotMerged_1)) {
|
||||
New-Item -ItemType "Directory" -Force -Path $Path_Folder_NotMerged_1 -Verbose
|
||||
} else {
|
||||
# Don't know what's the best... TO BE IMPROVED
|
||||
#Move-Item -Path $Path_Folder_NotMerged_2 -Destination "$sourceDirectory\Not-Merged--backup" -Verbose
|
||||
#Move-Item -Path $Path_Folder_NotMerged_2 -Destination "$sourceDirectory\Not-Merged--backup" -Verbose
|
||||
}
|
||||
|
||||
#Process
|
||||
$MKV_1_List = Get-ChildItem $sourceDirectory_1 -Filter "*.mkv" | ForEach-Object { $_.FullName } | Sort-Object
|
||||
$SRT_1_List = Get-ChildItem $sourceDirectory_1 -Filter "*.$SubExtension" | ForEach-Object { $_.FullName } | Sort-Object
|
||||
$Count_1 = $MKV_1_List.count
|
||||
$Count_1_SRT = $SRT_1_List.count
|
||||
Write-Host "$Count_1 MKV's to be processed and $Count_1_SRT SRT's to be processed in $sourceDirectory_1."
|
||||
if ($Count_1 -eq $Count_1_SRT) {
|
||||
Write-Host "There is the same number of MKV and SRT file in this folder. Let's continue."
|
||||
} else {
|
||||
Write-Host "The number of MKV and SRT files isn't the same. ABORT..." -foreground "red"
|
||||
Exit
|
||||
}
|
||||
|
||||
$MKV_2_List = Get-ChildItem $sourceDirectory_2 -Filter "*.mkv" | ForEach-Object { $_.FullName } | Sort-Object
|
||||
$Count_2 = $MKV_2_List.count
|
||||
Write-Host "$Count_2 MKV's to be processed in $sourceDirectory_2."
|
||||
if ($Count_1 -eq $Count_2) {
|
||||
Write-Host "There is the same number of MKV in the two sources folders. Let's continue."
|
||||
} else {
|
||||
Write-Host "The number of MKV in the two sources folders isn't the same. ABORT..." -foreground "red"
|
||||
Exit
|
||||
}
|
||||
|
||||
if (!($Count_1 -eq ($filename_ep_final - $filename_ep_start + 1))) {
|
||||
Write-Host "The number of epidoes set in the script isn't the same as the number of files in the folders... EXITING NOW !" -foreground "red"
|
||||
Exit
|
||||
}
|
||||
|
||||
for ($i = $filename_ep_start; $i -lt $filename_ep_final+1; $i++) {
|
||||
|
||||
# Genreating File Name
|
||||
# format = filename_1_part_1 + S + filename_season + E + i_counter + filename_1_part_2 + .mkv
|
||||
# format = filename_2_part_1 + S + filename_season + E + i_counter + filename_2_part_2 + .mkv
|
||||
# Final name 1 = Le Bureau des Légendes (2015) - S01E01 - 1080p-h264
|
||||
# Final name 2 = Le Bureau des Légendes (2015) - S01E01 - 1080p.BDRip.x265.Aac.NoTag
|
||||
|
||||
if ($i -lt 10 ) { # i<10
|
||||
$MKV_1_name = $filename_1_part_1 + "S" + $filename_season + "E0" + $i + $filename_1_part_2
|
||||
$SRT_1_name = $MKV_1_name
|
||||
$MKV_2_name = $filename_2_part_1 + "S" + $filename_season + "E0" + $i + $filename_2_part_2
|
||||
} else { # i=10
|
||||
$MKV_1_name = $filename_1_part_1 + "S" + $filename_season + "E" + $i + $filename_1_part_2
|
||||
$SRT_1_name = $MKV_1_name
|
||||
$MKV_2_name = $filename_2_part_1 + "S" + $filename_season + "E" + $i + $filename_2_part_2
|
||||
}
|
||||
$MKV_1 = $sourceDirectory_1 + "\" + $MKV_1_name + ".mkv"
|
||||
$SRT_1 = $sourceDirectory_1 + "\" + $SRT_1_name + "." + $SubExtension
|
||||
$MKV_2 = $sourceDirectory_2 + "\" + $MKV_2_name + ".mkv"
|
||||
|
||||
# Title for the video track
|
||||
$VideoTrackName = $MKV_2_name
|
||||
|
||||
#Set Output File Name
|
||||
#$Output = $Name + '___MERGED' + '.mkv'
|
||||
If ($merged_SUFFIX_name -eq "True") {
|
||||
$Output = $destinationDirectory + "\" + $VideoTrackName + '___MERGED' + '.mkv'
|
||||
} elseif ($merged_SUFFIX_name -eq "False") {
|
||||
$Output = $destinationDirectory + "\" + $VideoTrackName + '.mkv'
|
||||
} else {
|
||||
write-host "Error in the value of the merged_SUFFIX_name variable. Current value = $merged_SUFFIX_name" -foreground "red"
|
||||
write-host "Should be set to True or False.`nScript is exiting now..." -foreground "white"
|
||||
Exit
|
||||
}
|
||||
|
||||
|
||||
#Execute
|
||||
# Keep Audio/Subtitles/tags from MKV_1 + Only video from MKV_2
|
||||
<# Command to edit
|
||||
& $MKVMerge --title "$VideoTrackName" --track-order "$track_order" -o "$Output"
|
||||
"$file_1_options"
|
||||
--language "$AudioLang_1" --track-name "$AudioTrackName_1" --default-track "$AudioTrack_1_default"
|
||||
"$MKV_1"
|
||||
"$file_2_options"
|
||||
--language "0:en" --track-name "0:$VideoTrackName" --default-track "0:yes"
|
||||
"$MKV_2"
|
||||
--sub-charset "$sub_charset_1" --language "$SubTrackLang_1" --track-name "$SubTrackName_1" --default-track "$SubTrack_1_default"
|
||||
"$SRT_1"
|
||||
#>
|
||||
|
||||
& $MKVMerge --title "$VideoTrackName" --track-order "$track_order" -o "$Output" --no-video --language "$AudioLang_1" --track-name "$AudioTrackName_1" --default-track "$AudioTrack_1_default" "$MKV_1" --no-audio --no-track-tags --no-global-tags --language "0:en" --track-name "0:$VideoTrackName" --default-track "0:yes" "$MKV_2" --sub-charset "$sub_charset_1" --language "$SubTrackLang_1" --track-name "$SubTrackName_1" --default-track "$SubTrack_1_default" "$SRT_1"
|
||||
|
||||
If (Test-Path $Output) {
|
||||
#Clean Up
|
||||
#Remove-Item $MKV
|
||||
#Remove-Item $Sub
|
||||
#Remove-Item $OtherSub
|
||||
# Move to folder Not-Merged, this folder's existence has already been tested, and the folder is created.
|
||||
Move-Item -Path $MKV_1 -Destination $Path_Folder_NotMerged_1 -Verbose
|
||||
Move-Item -Path $SRT_1 -Destination $Path_Folder_NotMerged_1 -Verbose
|
||||
Move-Item -Path $MKV_2 -Destination $Path_Folder_NotMerged_2 -Verbose
|
||||
#Move-Item -Path $Sub -Destination $Path_Folder_NotMerged_2 -Verbose
|
||||
|
||||
# Renaming the output file is not necessary if the output filename doesn't have __MERGED in it
|
||||
#Rename-Item -Path $Output -NewName $MKV -Verbose
|
||||
|
||||
} Else {
|
||||
write-host "File NON-EXISTANT - $Output" -foreground "red"
|
||||
"File NON-EXISTANT - $Output" | Out-File "$destinationDirectory\Errors.txt" -Append
|
||||
}
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
# Script pour créer un certain nombre de dossiers de même nom avec un n° qui change
|
||||
|
||||
# Source : https://stackoverflow.com/questions/28631419/how-to-recursively-remove-all-empty-folders-in-powershell
|
||||
|
||||
Clear-Host
|
||||
Invoke-Command -ScriptBlock {
|
||||
$source_folder = "PATH_WHERE_TO_CREATE_FOLDERS"
|
||||
$nb_folder = 10
|
||||
# Base Name : (number will be added after with a space)
|
||||
$folder_to_create = "My Folder Base NAME"
|
||||
|
||||
function Test-Directory {
|
||||
param (
|
||||
[Parameter(Mandatory)]$path_to_verify
|
||||
)
|
||||
If (!(test-path $path_to_verify)) {
|
||||
New-Item -ItemType "Directory" -Force -Path $path_to_verify
|
||||
Write-Host "The path $path_to_verify (or one of the last subfolder) didn't exist. It has been created." -ForegroundColor "DarkBlue"
|
||||
}
|
||||
else {
|
||||
Write-Host "The path $path_to_verify already exist." -ForegroundColor "DarkBlue"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for ($i = 1 ; $i -le $nb_folder ; $i++) {
|
||||
|
||||
$folder_name = $folder_to_create + " $i"
|
||||
|
||||
# Exceptions
|
||||
if ( $folder_name -eq "My Folder Base NAME 9" ) {
|
||||
$folder_name = "My Folder Base NAME Part.1"
|
||||
}
|
||||
elseif ( $folder_name -eq "My Folder Base NAME 10" ) {
|
||||
$folder_name = "My Folder Base NAME Part.2"
|
||||
}
|
||||
|
||||
# Construction of the final folder name
|
||||
$final_folder_name = $source_folder + "\" + $folder_name
|
||||
Test-Directory $final_folder_name
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
# Script pour tester si le dossier mis en paramètre contient des dossiers vides
|
||||
# et si oui, les supprimer.
|
||||
|
||||
# Source : https://stackoverflow.com/questions/28631419/how-to-recursively-remove-all-empty-folders-in-powershell
|
||||
|
||||
Clear-Host
|
||||
Invoke-Command -ScriptBlock {
|
||||
$folder_to_check = "PATH_TO_FOLDER_CONTAINING_EMPTY_FOLDERS"
|
||||
|
||||
$dirs = Get-ChildItem $folder_to_check -Directory -Recurse | Where-Object { (Get-ChildItem $_.fullName).count -eq 0 } | Select-Object -ExpandProperty FullName
|
||||
$dirs | Foreach-Object { Write-Host "Dossier qui sera supprimer car considéré comme vide : " $_ }
|
||||
# $dirs | Foreach-Object { Remove-Item $_ }
|
||||
|
||||
}
|
141
TUTO_Git_SourceTree.md
Normal file
@ -0,0 +1,141 @@
|
||||
Tutoriel pour Git avec SourceTree <!-- omit in toc -->
|
||||
============
|
||||
Le but de ce tuto est d'expliquer comment faire des commits proprement sur le Gitea de Zoz.
|
||||
|
||||
## Table des matières <!-- omit in toc -->
|
||||
- [1. Introduction & Installation](#1-introduction-installation)
|
||||
- [1.1. Prérequis :](#1-1-prérequis)
|
||||
- [1.2. Cloner le dépôt avec SourceTree :](#1-2-cloner-le-dépôt-avec-sourcetree)
|
||||
- [1.3. Explications rapides des fonctions de SourceTree utilisées dans ce tuto](#1-3-explications-rapides-des-fonctions-de-sourcetree-utilisées-dans-ce-tuto)
|
||||
- [2. Créer une branche de travail `mon_pseudo-travail` depuis la branche `master`](#2-créer-une-branche-de-travail-mon-pseudo-travail-depuis-la-branche-master)
|
||||
- [2.1. Méthode n°1 : depuis SourceTree](#2-1-méthode-n-1-depuis-sourcetree)
|
||||
- [2.2. Méthode n°2 : depuis l'interface web de Gitea](#2-2-méthode-n-2-depuis-l-interface-web-de-gitea)
|
||||
- [3. Envoi du premier commit, et des suivants...](#3-envoi-du-premier-commit-et-des-suivants)
|
||||
- [4. Demande de fusion de notre branche `mon_pseudo-travail` avec `master`](#4-demande-de-fusion-de-notre-branche-mon-pseudo-travail-avec-master)
|
||||
|
||||
## 1. Introduction & Installation
|
||||
|
||||
Ce petit tuto va utiliser l'application SourceTree : [https://www.sourcetreeapp.com/](https://www.sourcetreeapp.com/).<br>
|
||||
J'ai essayé plusieurs clients Git pour windows et macOS, et SourceTree est le seul (parmis ceux essayés) qui offre une interface graphique assez similaire sur ces deux plateformes, et est assez facile d'utilisation. Ce tuto sera donc en partie rédigé pour utiliser cette application.
|
||||
|
||||
**Ce tuto va donc servir de guide pour contribuer au dépôt avec le moins possible de ligne de commande, voir aucune.**
|
||||
|
||||
### 1.1. Prérequis :
|
||||
|
||||
- Vous devrez aussi avoir installé Git pour windows (ou macos) : [https://git-scm.com/downloads](https://git-scm.com/downloads). Ça pourra être nécessaire si on passe par la ligne de commande.
|
||||
- Installez SourceTree. <br> Une fois Git installé, et SourceTree installé, allez dans les options de SourceTree pour vérifier que le Git utilisé est bien celui que vous venez d'installer (en externe du point de vue de SourceTree) :<br>
|
||||
[<img src="https://gitea.zoz-serv.org/Zoz/plex_fr_discord_repo/raw/branch/master/Tuto-Git-SourceTree/SourceTree-Git-config.png" align="" height="500" />](https://gitea.zoz-serv.org/Zoz/plex_fr_discord_repo/raw/branch/master/Tuto-Git-SourceTree/SourceTree-Git-config.png)<br>
|
||||
Tous les autres paramètres étant ceux par défaut.
|
||||
|
||||
### 1.2. Cloner le dépôt avec SourceTree :
|
||||
|
||||
[<img src="https://gitea.zoz-serv.org/Zoz/plex_fr_discord_repo/raw/branch/master/Tuto-Git-SourceTree/Capture-05.png" align="" height="500" />](https://gitea.zoz-serv.org/Zoz/plex_fr_discord_repo/raw/branch/master/Tuto-Git-SourceTree/Capture-05.png)<br>
|
||||
Une fois le dépôt cloné, on peut commencer à commiter comme un pro :D.
|
||||
Vous devriez avoir ce genre d'affichage :<br>
|
||||
[<img src="https://gitea.zoz-serv.org/Zoz/plex_fr_discord_repo/raw/branch/master/Tuto-Git-SourceTree/Capture-06.png" align="" height="500" />](https://gitea.zoz-serv.org/Zoz/plex_fr_discord_repo/raw/branch/master/Tuto-Git-SourceTree/Capture-06.png)<br>
|
||||
|
||||
### 1.3. Explications rapides des fonctions de SourceTree utilisées dans ce tuto
|
||||
|
||||
Dans ce tuto, nous n'allons pas utiliser beaucoup de fonctionnalités de SourceTree, mais voilà les principales :
|
||||
|
||||
- **Bouton Valider** : permet d'afficher l'écran de validation du commit que l'on s'apprête à finaliser. On peut, et on doit, laisser un bref message indiquant sommairement ce que contient ce commit (en termes d'ajout, modification, etc...).<br>
|
||||
En ligne de commande, ce serait : `git commit -m "ma super modif"`.
|
||||
- **Bouton Récupérer** : C'est le `git pull`, ça permet de récupérer dans la branche en cours le conteneur d'une branche distante :
|
||||
- **Bouton Envoyer** : C'est le `git push`, ça permet d'envoyer les modifications locales sur le dépôt distant. En général, je préfère utiliser la case à cocher "Envoyer les modifications vers origin/ma-brancheblabla" à l'étape de validation du commit (voir plus bas).
|
||||
- **Bouton Rapatrier** : Je l'utilise lorsque je suis sur la branche `master` pour récupérer les données et enlever de SourceTree les branches distantes qui ont été supprimées.
|
||||
- **Bouton Changer de branche** : C'est avec ce bouton que je crée une nouvelle branche depuis la de départ `master`.
|
||||
|
||||
|
||||
## 2. Créer une branche de travail `mon_pseudo-travail` depuis la branche `master`
|
||||
|
||||
#### 2.1. Méthode n°1 : depuis SourceTree
|
||||
|
||||
- Il faut tout d'abord se placer sur la branche master en double cliquant dessus.<br>
|
||||
![](https://gitea.zoz-serv.org/Zoz/plex_fr_discord_repo/raw/branch/master/Tuto-Git-SourceTree/Capture-10.png)
|
||||
- Ensuite, toujours choisir "Parent de la copie de travail" avant de créer la branche :<br>
|
||||
![](https://gitea.zoz-serv.org/Zoz/plex_fr_discord_repo/raw/branch/master/Tuto-Git-SourceTree/Capture-11.png)
|
||||
|
||||
On est maintenant prêt à faire nos commit :<br>
|
||||
![](https://gitea.zoz-serv.org/Zoz/plex_fr_discord_repo/raw/branch/master/Tuto-Git-SourceTree/Capture-12.png)
|
||||
|
||||
#### 2.2. Méthode n°2 : depuis l'interface web de Gitea
|
||||
|
||||
![](https://gitea.zoz-serv.org/Zoz/plex_fr_discord_repo/raw/branch/master/Tuto-Git-SourceTree/Capture-01.png)<br><br>
|
||||
![](https://gitea.zoz-serv.org/Zoz/plex_fr_discord_repo/raw/branch/master/Tuto-Git-SourceTree/Capture-02.png)<br><br>
|
||||
![](https://gitea.zoz-serv.org/Zoz/plex_fr_discord_repo/raw/branch/master/Tuto-Git-SourceTree/Capture-03.png)<br><br>
|
||||
![](https://gitea.zoz-serv.org/Zoz/plex_fr_discord_repo/raw/branch/master/Tuto-Git-SourceTree/Capture-04.png)
|
||||
|
||||
Si vous créez votre branche depuis Gitea, il faudra l'importer dans SourceTree.
|
||||
- Pour ce faire :
|
||||
- soit vous double-cliquez sur la branche distance à rapatrier,
|
||||
- soit vous faites un clic droit dessus :<br>
|
||||
![](https://gitea.zoz-serv.org/Zoz/plex_fr_discord_repo/raw/branch/master/Tuto-Git-SourceTree/Capture-07.png)
|
||||
|
||||
- Ensuite vous cochez bien la case indiquée, et laissez le nom qui s'affiche pour la branche locale, puis validez par OK :<br>
|
||||
![](https://gitea.zoz-serv.org/Zoz/plex_fr_discord_repo/raw/branch/master/Tuto-Git-SourceTree/Capture-08.png)
|
||||
<br><br><br>
|
||||
|
||||
**Une fois la branche créée, vérifiez bien que cette dernière est bien sélectionnée !**
|
||||
|
||||
![](https://gitea.zoz-serv.org/Zoz/plex_fr_discord_repo/raw/branch/master/Tuto-Git-SourceTree/Capture-12.png)
|
||||
|
||||
## 3. Envoi du premier commit, et des suivants...
|
||||
|
||||
Vous pouvez maintenant créer vos dossiers/fichiers, faire les modifications sur les fichiers/dossiers existants.
|
||||
|
||||
Une fois que vous arrivez à une étape clé, ou bien pour être sûr que votre travail soit "sauvegardé" sur le serveur, vous pouvez faire votre 1er commit.
|
||||
|
||||
- Cliquez sur le bouton + :<br>
|
||||
![](https://gitea.zoz-serv.org/Zoz/plex_fr_discord_repo/raw/branch/master/Tuto-Git-SourceTree/Capture-14.png)
|
||||
- Puis choisissez les élements à indexer :<br>
|
||||
![](https://gitea.zoz-serv.org/Zoz/plex_fr_discord_repo/raw/branch/master/Tuto-Git-SourceTree/Capture-16.png)
|
||||
- Puis pensez bien à écrire un commentaire et à cocher la case en bas pour que le commit soit envoyé sur le dépôt distant.<br>
|
||||
Cette case est l'équivalent d'un `git push`.<br>
|
||||
![](https://gitea.zoz-serv.org/Zoz/plex_fr_discord_repo/raw/branch/master/Tuto-Git-SourceTree/Capture-17.png)
|
||||
|
||||
Pour la rédaction de ce tuto, j'ai fait pas mal de commits ^^. Voilà çe que ça donne avec une vue :
|
||||
|
||||
![](https://gitea.zoz-serv.org/Zoz/plex_fr_discord_repo/raw/branch/master/Tuto-Git-SourceTree/Capture-18.png)
|
||||
|
||||
On voit même une branche (MilesTEG) que j'ai supprimé en cours de route... (ça rendait trop complexe la gestion des branches).
|
||||
|
||||
## 4. Demande de fusion de notre branche `mon_pseudo-travail` avec `master`
|
||||
|
||||
Une fois qu'on a fini de travailler sur notre branche, dernier commit fait, ou bien pour soumettre le travail fait à la relecture par les autres membres, on peut faire une demande de fusion.
|
||||
|
||||
Je vais illustrer cela maintenant, même si au moment où je fais la capture, le tuto n'est pas entièrement terminé.
|
||||
|
||||
- Pour faire cette demande de fusion, le plus simple est d'aller là [aller sur la page web des branches](https://gitea.zoz-serv.org/Zoz/plex_fr_discord_repo/branches) puis de cliquer sur le bouton "**Nouvelle demande de fusion**" de notre branche (il se peut que ce bouton s'intitule juste "**Demande de fusion**"):<br>
|
||||
![](https://gitea.zoz-serv.org/Zoz/plex_fr_discord_repo/raw/branch/master/Tuto-Git-SourceTree/Capture-19.png)
|
||||
<br>
|
||||
(On voit que j'ai 12 commits dans cette branche, je ne sais pas à quoi correspond le 0...)
|
||||
|
||||
- Ensuite, on vérifie bien qu'on a la bonne branche de destination `master` (à gauche) et notre branche source `mon_pseudo-travail` :<br>
|
||||
![](https://gitea.zoz-serv.org/Zoz/plex_fr_discord_repo/raw/branch/master/Tuto-Git-SourceTree/Capture-20.png)
|
||||
|
||||
- Étape suivante : (lisez le texte dans la capture)<br>
|
||||
![](https://gitea.zoz-serv.org/Zoz/plex_fr_discord_repo/raw/branch/master/Tuto-Git-SourceTree/Capture-21.png)
|
||||
<br><br>
|
||||
|
||||
Si vous faites encore des commits avant de fusionner, vous les verrez apparaître à la suite des précédents et des modifications apportées à la demande de fusion (message, ajout d'étiquette, etc...):<br>
|
||||
![](https://gitea.zoz-serv.org/Zoz/plex_fr_discord_repo/raw/branch/master/Tuto-Git-SourceTree/Capture-23.png)
|
||||
|
||||
- Dernière étape : Sélectionnez quelques relecteurs dans la liste<br>
|
||||
![](https://gitea.zoz-serv.org/Zoz/plex_fr_discord_repo/raw/branch/master/Tuto-Git-SourceTree/Capture-24.png)
|
||||
|
||||
- Si jamais vous avez cliquez sur WIP, quand vous aurez terminé vos modifications, il faudra cliquer sur le bouton "**Enlever le préfixe WIP**" pour fusionner votre branche avec `master`.
|
||||
![](https://gitea.zoz-serv.org/Zoz/plex_fr_discord_repo/raw/branch/master/Tuto-Git-SourceTree/Capture-22.png)
|
||||
<br><br>
|
||||
|
||||
Il ne vous reste plus qu'à attendre la validation par un relecteur, et qu'il fusionne votre branche avec la branche `master`.
|
||||
|
||||
À l'issue de cette fusion, votre branche sera supprimée. Si vous vouliez continuer à travailler dessus, mettez-là en statut WIP, en postant un message indiquant votre intention.
|
||||
|
||||
> :pencil2: **Note :** Si jamais vous envoyiez un nouveau commit (ou plusieurs) après que la fusion ait été faite, mais avant que la branche soit supprimée, il faudra refaire une demande de fusion.<br>
|
||||
|
||||
___
|
||||
Ça y est, c'est la fin du tutoriel :D
|
||||
|
||||
Merci d'avoir tout lu et tout suivi ;)
|
||||
|
||||
Votre avis, conseils et idées d'amélioration sont les bienvenues. Vous pouvez faire ue branche et commiter dessus ^^ ou bien me demander directement sur Discord.
|
BIN
Tuto-Git-SourceTree/Capture-01.png
Normal file
After Width: | Height: | Size: 36 KiB |
BIN
Tuto-Git-SourceTree/Capture-02.png
Normal file
After Width: | Height: | Size: 38 KiB |
BIN
Tuto-Git-SourceTree/Capture-03.png
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
Tuto-Git-SourceTree/Capture-04.png
Normal file
After Width: | Height: | Size: 102 KiB |
BIN
Tuto-Git-SourceTree/Capture-05.png
Normal file
After Width: | Height: | Size: 21 KiB |
BIN
Tuto-Git-SourceTree/Capture-06.png
Normal file
After Width: | Height: | Size: 160 KiB |
BIN
Tuto-Git-SourceTree/Capture-07.png
Normal file
After Width: | Height: | Size: 50 KiB |
BIN
Tuto-Git-SourceTree/Capture-08.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
Tuto-Git-SourceTree/Capture-10.png
Normal file
After Width: | Height: | Size: 58 KiB |
BIN
Tuto-Git-SourceTree/Capture-11.png
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
Tuto-Git-SourceTree/Capture-12.png
Normal file
After Width: | Height: | Size: 68 KiB |
BIN
Tuto-Git-SourceTree/Capture-14.png
Normal file
After Width: | Height: | Size: 43 KiB |
BIN
Tuto-Git-SourceTree/Capture-16.png
Normal file
After Width: | Height: | Size: 82 KiB |
BIN
Tuto-Git-SourceTree/Capture-17.png
Normal file
After Width: | Height: | Size: 92 KiB |
BIN
Tuto-Git-SourceTree/Capture-18.png
Normal file
After Width: | Height: | Size: 148 KiB |
BIN
Tuto-Git-SourceTree/Capture-19.png
Normal file
After Width: | Height: | Size: 61 KiB |
BIN
Tuto-Git-SourceTree/Capture-20.png
Normal file
After Width: | Height: | Size: 132 KiB |
BIN
Tuto-Git-SourceTree/Capture-21.png
Normal file
After Width: | Height: | Size: 127 KiB |
BIN
Tuto-Git-SourceTree/Capture-22.png
Normal file
After Width: | Height: | Size: 131 KiB |
BIN
Tuto-Git-SourceTree/Capture-23.png
Normal file
After Width: | Height: | Size: 59 KiB |
BIN
Tuto-Git-SourceTree/Capture-24.png
Normal file
After Width: | Height: | Size: 95 KiB |
BIN
Tuto-Git-SourceTree/SourceTree-Git-config.png
Normal file
After Width: | Height: | Size: 34 KiB |
33
dns-blacklists/adguard-home/liste.md
Normal file
@ -0,0 +1,33 @@
|
||||
# Liste de blocage DNS pour AdGuard-Home
|
||||
|
||||
## Listes disponibles avec une simple case à cocher :
|
||||
|
||||
* Il faut aller dans le menu **Filtres** -> **Liste de blocage DNS**.
|
||||
|
||||
* Puis, il faut cliquer sur le bouton vert "**Ajouter une liste de blocage**.
|
||||
|
||||
* Et enfin, cliquer sur le bouton "**Choisissez dans la liste**".
|
||||
|
||||
* Choisir ensuite ces listes : (la première est incluse dans une liste à ajouter manuellement ensuite)
|
||||
|
||||
![image](https://gitea.zoz-serv.org/attachments/640b8667-ad65-4986-aad1-05151b81ab83)
|
||||
|
||||
![image](https://gitea.zoz-serv.org/attachments/2b17f2e0-66d5-4f4c-9a71-acbf1f59bc9c)
|
||||
|
||||
## Listes à ajouter manuellement (pris dans le fichier de configuration AdGuardHome.yaml) :
|
||||
|
||||
* `Nom de la liste` (à placer dans le champ adéquat) <br/>
|
||||
[URL de la liste](URL)
|
||||
<br/><br/>
|
||||
|
||||
* `sebsauvage.net hosts-adguard`<br/>
|
||||
https://sebsauvage.net/hosts/hosts-adguard
|
||||
|
||||
* `firebog.net - NoTrack-blocklist`<br/>
|
||||
https://gitlab.com/quidsup/notrack-blocklists/raw/master/notrack-blocklist.txt
|
||||
|
||||
* `firebog.net - SmartTV`<br/>
|
||||
https://raw.githubusercontent.com/Perflyst/PiHoleBlocklist/master/SmartTV.txt
|
||||
|
||||
* `Firebog.net - ads-and-tracking-extended`<br/>
|
||||
https://www.github.developerdan.com/hosts/lists/ads-and-tracking-extended.txt
|
65
dns-blacklists/pihole/liste
Normal file
@ -0,0 +1,65 @@
|
||||
https://justdomains.github.io/blocklists/lists/easylist-justdomains.txt
|
||||
https://raw.githubusercontent.com/kboghdady/youTube_ads_4_pi-hole/master/black.list
|
||||
https://www.github.developerdan.com/hosts/lists/amp-hosts-extended.txt
|
||||
https://www.github.developerdan.com/hosts/lists/tracking-aggressive-extended.txt
|
||||
https://www.github.developerdan.com/hosts/lists/ads-and-tracking-extended.txt
|
||||
https://raw.githubusercontent.com/PolishFiltersTeam/KADhosts/master/KADhosts_without_controversies.txt
|
||||
https://raw.githubusercontent.com/FadeMind/hosts.extras/master/add.Spam/hosts
|
||||
https://v.firebog.net/hosts/static/w3kbl.txt
|
||||
https://adaway.org/hosts.txt
|
||||
https://v.firebog.net/hosts/AdguardDNS.txt
|
||||
https://v.firebog.net/hosts/Admiral.txt
|
||||
https://raw.githubusercontent.com/anudeepND/blacklist/master/adservers.txt
|
||||
https://s3.amazonaws.com/lists.disconnect.me/simple_ad.txt
|
||||
https://v.firebog.net/hosts/Easylist.txt
|
||||
https://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts&showintro=0&mimetype=plaintext
|
||||
https://raw.githubusercontent.com/FadeMind/hosts.extras/master/UncheckyAds/hosts
|
||||
https://raw.githubusercontent.com/bigdargon/hostsVN/master/hosts
|
||||
https://v.firebog.net/hosts/Easyprivacy.txt
|
||||
https://v.firebog.net/hosts/Prigent-Ads.txt
|
||||
https://gitlab.com/quidsup/notrack-blocklists/raw/master/notrack-blocklist.txt
|
||||
https://raw.githubusercontent.com/FadeMind/hosts.extras/master/add.2o7Net/hosts
|
||||
https://raw.githubusercontent.com/crazy-max/WindowsSpyBlocker/master/data/hosts/spy.txt
|
||||
https://hostfiles.frogeye.fr/firstparty-trackers-hosts.txt
|
||||
https://zerodot1.gitlab.io/CoinBlockerLists/hosts_browser
|
||||
https://raw.githubusercontent.com/DandelionSprout/adfilt/master/Alternate%20versions%20Anti-Malware%20List/AntiMalwareHosts.txt
|
||||
https://osint.digitalside.it/Threat-Intel/lists/latestdomains.txt
|
||||
https://s3.amazonaws.com/lists.disconnect.me/simple_malvertising.txt
|
||||
https://v.firebog.net/hosts/Prigent-Crypto.txt
|
||||
https://bitbucket.org/ethanr/dns-blacklists/raw/8575c9f96e5b4a1308f2f12394abd86d0927a4a0/bad_lists/Mandiant_APT1_Report_Appendix_D.txt
|
||||
https://phishing.army/download/phishing_army_blocklist_extended.txt
|
||||
https://gitlab.com/quidsup/notrack-blocklists/raw/master/notrack-malware.txt
|
||||
https://v.firebog.net/hosts/Shalla-mal.txt
|
||||
https://raw.githubusercontent.com/Spam404/lists/master/main-blacklist.txt
|
||||
https://raw.githubusercontent.com/FadeMind/hosts.extras/master/add.Risk/hosts
|
||||
https://urlhaus.abuse.ch/downloads/hostfile/
|
||||
https://gitlab.com/ZeroDot1/CoinBlockerLists/raw/master/list.txt
|
||||
http://sysctl.org/cameleon/hosts
|
||||
https://s3.amazonaws.com/lists.disconnect.me/simple_tracking.txt
|
||||
https://gist.githubusercontent.com/anudeepND/adac7982307fec6ee23605e281a57f1a/raw/5b8582b906a9497624c3f3187a49ebc23a9cf2fb/Test.txt
|
||||
https://raw.githubusercontent.com/Dawsey21/Lists/master/main-blacklist.txt
|
||||
https://v.firebog.net/hosts/Kowabit.txt
|
||||
http://forcet.fr/shared/pihole/Samsung-TV.txt
|
||||
https://raw.githubusercontent.com/neodevpro/neodevhost/master/host
|
||||
https://raw.githubusercontent.com/durablenapkin/scamblocklist/master/hosts.txt
|
||||
https://raw.githubusercontent.com/PolishFiltersTeam/KADhosts/master/KADhosts.txt
|
||||
https://raw.githubusercontent.com/matomo-org/referrer-spam-blacklist/master/spammers.txt
|
||||
https://someonewhocares.org/hosts/zero/hosts
|
||||
https://raw.githubusercontent.com/VeleSila/yhosts/master/hosts
|
||||
https://winhelp2002.mvps.org/hosts.txt
|
||||
https://v.firebog.net/hosts/neohostsbasic.txt
|
||||
https://raw.githubusercontent.com/RooneyMcNibNug/pihole-stuff/master/SNAFU.txt
|
||||
https://paulgb.github.io/BarbBlock/blacklists/hosts-file.txt
|
||||
https://raw.githubusercontent.com/crazy-max/WindowsSpyBlocker/master/data/hosts/extra.txt
|
||||
https://git.ponywave.de/Akamaru/Pi-Hole-Lists/raw/branch/master/mobile.txt
|
||||
https://git.ponywave.de/Akamaru/Pi-Hole-Lists/raw/branch/master/smarttv.txt
|
||||
https://git.ponywave.de/Akamaru/Pi-Hole-Lists/raw/branch/master/adobeblock.txt
|
||||
https://git.ponywave.de/Akamaru/Pi-Hole-Lists/raw/branch/master/nintendoblock.txt
|
||||
https://git.ponywave.de/Akamaru/Pi-Hole-Lists/raw/branch/master/nomsdata.txt
|
||||
https://git.ponywave.de/Akamaru/Pi-Hole-Lists/raw/branch/master/gamefake.txt
|
||||
https://git.ponywave.de/Akamaru/Pi-Hole-Lists/raw/branch/master/fakenewsde.txt
|
||||
https://git.ponywave.de/Akamaru/Pi-Hole-Lists/raw/branch/master/cryptomine.txt
|
||||
https://git.ponywave.de/Akamaru/Pi-Hole-Lists/raw/branch/master/other.txt
|
||||
https://git.ponywave.de/Akamaru/Pi-Hole-Lists/raw/branch/master/unsorted.txt
|
||||
https://raw.githubusercontent.com/Perflyst/PiHoleBlocklist/master/SmartTV.txt
|
||||
https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/fakenews-gambling-porn-social/hosts
|
16
dns_whitelists/adguard-home/liste.md
Normal file
@ -0,0 +1,16 @@
|
||||
# Listes d’autorisation DNS pour AdGuard-Home
|
||||
|
||||
## Listes à ajouter manuellement (pris dans le fichier de configuration AdGuardHome.yaml) :
|
||||
|
||||
- `Nom de la liste` (à placer dans le champ adéquat) <br/>
|
||||
[URL de la liste](URL)
|
||||
<br/><br/>
|
||||
|
||||
* `anudeepND/whitelist`<br/>
|
||||
https://raw.githubusercontent.com/anudeepND/whitelist/master/domains/whitelist.txt
|
||||
|
||||
* `hg1978 / AdGuard-Home-Whitelist`<br/>
|
||||
https://raw.githubusercontent.com/hg1978/AdGuard-Home-Whitelist/master/whitelist.txt
|
||||
|
||||
* `hg1978 / AdGuard-Home-Whitelist`<br/>
|
||||
https://raw.githubusercontent.com/hg1978/AdGuard-Home-Whitelist/master/facebook-whitelist.txt
|
54
docker-compose/adguard-macvlan/bridgemacvlan-interface.sh
Normal file
@ -0,0 +1,54 @@
|
||||
#!/bin/bash
|
||||
|
||||
##===========================================================================================##
|
||||
## Script bridgemacvlan-interface.sh ##
|
||||
## ##
|
||||
## Script de création d'interface virtuelle pour les conteneurs en macvlan ##
|
||||
## Voir tutos : ##
|
||||
## https://www.nas-forum.com/forum/topic/69319-tuto-docker-macvlan-pi-hole/ ##
|
||||
## https://www.nas-forum.com/forum/topic/67311-tuto-certificat-ssl-reverse-proxy-via-docker/ ##
|
||||
## ##
|
||||
## Rappels des différentes IP : ##
|
||||
## - Plage d'IP macvlan : 192.168.xxx.MMM/28 == 192.168.2.208/28 ##
|
||||
## - IP virtuelle unique : 192.168.xxx.zzz/32 == 192.168.2.210/32 ##
|
||||
## - Plage d'IP du LAN : 192.168.xxx.0/24 == 192.168.2.0/24 ##
|
||||
## - Passerelle/routeur : 192.168.xxx.1 == 192.168.2.1 ##
|
||||
## - IP conteneur n°1 : 192.168.xxx.yyy == 192.168.2.209 ##
|
||||
## - IP conteneur n°2 : 192.168.xxx.ooo == 192.168.2.210 AdGuard_Home ##
|
||||
## ##
|
||||
##=============================================================================================
|
||||
|
||||
# Set timeout to wait host network is up and running
|
||||
sleep 60
|
||||
|
||||
echo "$(date "+%R:%S - ") Script de création d'une interface virtuelle pour le NAS"
|
||||
echo "$(date "+%R:%S - ") Exécution des commandes..."
|
||||
|
||||
ip link add macv0 link eth0 type macvlan mode bridge # macv0 : est le nom données à l'interface virtuelle
|
||||
# eth0 : est l'interface réseau utilisée sur le NAS (lorsque VMM n'est pas utilisé)
|
||||
# si VMM est utilisé, ce sera ovs_eth0
|
||||
ip addr add 192.168.xxx.zzz/32 dev macv0 # Adresse IP virtuelle 192.168.x.zzz/32 -- Il faut que cette adresse soit libre dans le réseau
|
||||
# et qu'elle ne fasse pas partie du DHCP du routeur/box
|
||||
#
|
||||
#### Dans mon cas, c'est cette commande :
|
||||
#### ip addr add 192.168.2.230/32 dev macv0
|
||||
|
||||
ip link set dev macv0 address 5E:00:01:02:03:04 # MAC adresse pour l'adaptateur ayant l'IP virtuelle
|
||||
# Il faut que l'adresse MAC respecte ces conditions :
|
||||
# - Elle n'existe pas déjà sur mon hôte et sur mon réseau.
|
||||
# - Elle respecte la base hexadécimale, les notations allant de 0 à F.
|
||||
# - Le premier nombre doit être pair, ici 5E = 94 en base 10, c'est donc OK (vous pouvez
|
||||
# utiliser un convertisseur en ligne, ou faire vos divisions euclidiennes).
|
||||
# S'il est impair, vous aurez un message :
|
||||
# RTNETLINK answers: Cannot assign requested address
|
||||
ip link set macv0 up
|
||||
|
||||
ip route add 192.168.xxx.MMM/28 dev macv0 # 192.168.xxx.MMM/28 : Plage d'adresse macvlan
|
||||
# IP réellement disponible : voir les calculateurs internet
|
||||
# Utiliser Portainer ou l'interface Docker ou encore le script : create-macvlan-network.sh
|
||||
#
|
||||
#### Dans mon cas, c'est cette commande :
|
||||
#### ip route add 192.168.2.208/28 dev macv0
|
||||
|
||||
echo "$(date "+%R:%S - ") Script terminé"
|
||||
exit
|
88
docker-compose/adguard-macvlan/docker-compose.yml
Normal file
@ -0,0 +1,88 @@
|
||||
## Discord Plex FR : https://discord.gg/3gtABCH
|
||||
## Version 2021-08-23
|
||||
##==============================================================================================
|
||||
## ##
|
||||
## Fichier docker-compose.yml pour Adguard-Home en macvlan ##
|
||||
## ##
|
||||
##==============================================================================================
|
||||
|
||||
##============================================================================================##
|
||||
## ##
|
||||
## Attention, il faut créer le réseau macvlan à l'aide du script : macvlan-network.sh ##
|
||||
## Ce dernier va créer un réseau macvlan ayant comme IP unique 192.168.2.210 ##
|
||||
## Cette IP doit être dans la plage d'IP mavclan définie dans le script de création du réseau.##
|
||||
## Le conteneur sera donc vu comme une machine sur le réseau LAN, mais ne pourra pas être ##
|
||||
## joint par le NAS lui-même. ##
|
||||
## Pour celà, il faut utiliser le second script : boot-bridgemacvlan-interface.sh ##
|
||||
## Ce dernier va créer une IP-interface virtuelle qui pourra être accessible par le NAS. ##
|
||||
## Cette interface ne persiste pas au démarrage, il faudra mettre le script en tâche ##
|
||||
## planifiée avec le planificateur de tâches dans DSM. ##
|
||||
## ##
|
||||
## Voir tuto : https://www.nas-forum.com/forum/topic/69319-tuto-docker-macvlan-pi-hole/ ##
|
||||
## ##
|
||||
## Attention ! ##
|
||||
## ##
|
||||
## Ces deux scripts ne sont à utiliser qu'une seule fois, quelque soit le nombre de ##
|
||||
## conteneurs qui en bénéficieront. ##
|
||||
## Par exemple, si vous utilisez 2 conteneurs en macvlan, une fois le réseau macvlan créé ##
|
||||
## pour le 1er, il est inutile (et impossible) de le recréer. ##
|
||||
## Le script boot-bridgemacvlan-interface.sh ne doit être lancé qu'une seule fois, et à ##
|
||||
## chaque reboot. L'IP virtuelle est unique, il ne faut pas en recréer une seconde. ##
|
||||
## ##
|
||||
##==============================================================================================
|
||||
|
||||
---
|
||||
version: "2.4"
|
||||
services:
|
||||
adguardhome_macvlan:
|
||||
image: adguard/adguardhome:latest # https://github.com/AdguardTeam/AdGuardHome
|
||||
# https://github.com/AdguardTeam/AdGuardHome/wiki/Docker
|
||||
container_name: adguardhome_macvlan
|
||||
|
||||
hostname: AdGuard-Home--DS920+ # Permet d'avoir un nom pour le conteneur dans AdGuard lui même (sinon c'est une chaine aléatoire)
|
||||
|
||||
environment:
|
||||
- PUID=1000 # Utiliser la commande (en SSH) : id NOM_UTILISATEUR
|
||||
- PGID=100 # Utiliser la commande (en SSH) : id NOM_UTILISATEUR
|
||||
- TZ=Europe/Paris
|
||||
- LANG=fr_FR.UTF8
|
||||
- LANGUAGE=fr_FR.UTF8
|
||||
|
||||
# ---------------------------------------------------------------------------------
|
||||
# Le label ci-dessous permet à Watchtower de faire les mises à jour automatiquement
|
||||
# Cela peut-être supprimé si Watchtower n'est pas utilisé.
|
||||
labels:
|
||||
- "com.centurylinklabs.watchtower.enable=true"
|
||||
# ---------------------------------------------------------------------------------
|
||||
|
||||
volumes:
|
||||
- "/volume1/docker/adguardhome_macvlan/work:/opt/adguardhome/work"
|
||||
- "/volume1/docker/adguardhome_macvlan/conf:/opt/adguardhome/conf"
|
||||
|
||||
# La déclaration des ports n'est pas utile lors d'une installation en macvlan, car tous les ports seront directement accessible
|
||||
# avec l'IP virtuelle.
|
||||
# ports:
|
||||
# - "953:53"
|
||||
# - "967:67/udp"
|
||||
# - "968:68"
|
||||
# - "8080:80/tcp"
|
||||
# - "9443:443/tcp"
|
||||
# - "9853:853/tcp"
|
||||
# - "3030:3000/tcp"
|
||||
|
||||
networks:
|
||||
macvlan-network:
|
||||
ipv4_address: 192.168.xxx.yyy # Mettre ici l'IP macvlan dans la plage définie dans les scripts
|
||||
# Dans mon cas c'est 192.168.2.210
|
||||
|
||||
restart: unless-stopped
|
||||
|
||||
healthcheck:
|
||||
test: "/bin/netstat -pant | /bin/grep 53"
|
||||
interval: 45s
|
||||
timeout: 30s
|
||||
retries: 3
|
||||
|
||||
networks:
|
||||
macvlan-network: # Ce réseau devra bien entendu être créé avant avec le script annexe ou avec Portainer.
|
||||
external: true
|
@ -0,0 +1,59 @@
|
||||
#!/bin/bash
|
||||
|
||||
##============================================================================================##
|
||||
## ##
|
||||
## Script docker_network_create_macvlan.sh ##
|
||||
## ##
|
||||
## Script de création d'interface virtuelle pour les conteneurs qui auront une IP macvlan ##
|
||||
## Voir tutos : ##
|
||||
## https://www.nas-forum.com/forum/topic/69319-tuto-docker-macvlan-pi-hole/ ##
|
||||
## https://www.nas-forum.com/forum/topic/67311-tuto-certificat-ssl-reverse-proxy-via-docker/ ##
|
||||
## ##
|
||||
## Les IPs prévues pour les conteneurs sont : ##
|
||||
## - Conteneur A : 192.168.xxx.yyy ##
|
||||
## - AdGuard-Home : 192.168.xxx.ooo ##
|
||||
## ##
|
||||
## Rappels des différentes IP : ##
|
||||
## - Plage d'IP macvlan : 192.168.xxx.MMM/28 ##
|
||||
## - IP virtuelle unique : 192.168.xxx.zzz/32 ##
|
||||
## - IP conteneur n°1 : 192.168.xxx.yyy ##
|
||||
## - IP conteneur n°2 : 192.168.xxx.ooo ##
|
||||
## - Plage d'IP du LAN : 192.168.xxx.0/24 ##
|
||||
## - Passerelle/routeur : 192.168.xxx.1 ##
|
||||
## ##
|
||||
##==============================================================================================
|
||||
|
||||
##==============================================================================================
|
||||
## ##
|
||||
## --ip-range=192.168.xxx.MMM/28 : cela correspond à la plage d'IP pour le réseau macvlan ##
|
||||
## sachant que 192.168.xxx.MMM doit être la 1ère IP donnée par les calculateurs internet. ##
|
||||
## Il se peut que ce ne soit pas la même que l'IP macvlan que l'on veut donner au conteneur ##
|
||||
## AdGuardHome. ##
|
||||
## ##
|
||||
## Quelques calculateurs internet : ##
|
||||
## https://cric.grenoble.cnrs.fr/Administrateurs/Outils/CalculMasque/ ##
|
||||
## https://www.cidr.eu/en/calculator/+/192.168.2.208/28 ##
|
||||
## ##
|
||||
##==============================================================================================
|
||||
|
||||
|
||||
docker network create -d macvlan \
|
||||
--subnet=192.168.xxx.0/24 \
|
||||
--ip-range=192.168.xxx.MMM/28 \
|
||||
--gateway=192.168.xxx.1 \
|
||||
-o parent=eth0 \ # Ici, eth0 est à remplacer par votre interface réseau : eth0, ovs_eth0 ou autre...
|
||||
macvlan-network
|
||||
|
||||
##==============================================================================================
|
||||
## Pour exemple, voilà mes valeurs à moi : ##
|
||||
## ##
|
||||
## - Conteneur A : 192.168.2.209 ##
|
||||
## - AdGuard-Home : 192.168.2.210 ##
|
||||
## - Conteneur B : 192.168.2.211 ##
|
||||
## ##
|
||||
## Rappels des différentes IP : ##
|
||||
## - Plage d'IP macvlan : 192.168.xxx.MMM/28 == 192.168.2.208/28 ##
|
||||
## - IP virtuelle unique : 192.168.xxx.zzz/32 == 192.168.2.210/32 ##
|
||||
## - Plage d'IP du LAN : 192.168.xxx.0/24 == 192.168.2.0/24 ##
|
||||
## - Passerelle/routeur : 192.168.xxx.1 == 192.168.2.1 ##
|
||||
##==============================================================================================
|
@ -1,5 +1,5 @@
|
||||
## Discord Plex FR : https://discord.gg/ERpYMqS
|
||||
## Version 2021-02-26
|
||||
## Discord Plex FR : https://discord.gg/3gtABCH
|
||||
## Version 2021-08-23
|
||||
version: '3.3'
|
||||
services:
|
||||
adguardhome:
|
||||
@ -10,8 +10,8 @@ services:
|
||||
ports:
|
||||
- '53:53/tcp'
|
||||
- '53:53/udp'
|
||||
- '80:80/tcp' #acces suite config validé
|
||||
- '3000:3000/tcp' #1ere connexion pour configurer
|
||||
- '80:80/tcp' # WebUI suite config validé
|
||||
- '3000:3000/tcp' # WebUI 1ere connexion pour configurer
|
||||
- '443:443/tcp'
|
||||
- '853:853/tcp'
|
||||
image: adguard/adguardhome
|
||||
|
@ -1,21 +0,0 @@
|
||||
## Discord Plex FR : https://discord.gg/ERpYMqS
|
||||
## Version 2021-02-26
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
bitwarden:
|
||||
image: bitwardenrs/server
|
||||
restart: unless-stopped
|
||||
# Decommenter les 2 lignes suivantes pour que watchtower surveille ce conteneur
|
||||
# labels:
|
||||
# - com.centurylinklabs.watchtower.enable=true
|
||||
ports:
|
||||
- 80:80 #acces interface
|
||||
volumes:
|
||||
- /volume1/docker/bitwarden/bw-data:/data
|
||||
environment:
|
||||
- WEBSOCKET_ENABLED: 'true' # Necessaire pour utiliser websockets
|
||||
- SIGNUPS_ALLOWED: 'true' # Mettre faux une fois le 1er utilisateur creer et redemarrer le conteneur
|
||||
# Network conseillé de ne pas utiliser host (pas de redirection de port) ni default_bridge car limité a 16 ip
|
||||
network_mode: 'bitwardenrs_network'
|
||||
|
27
docker-compose/dashy/docker-compose.yml
Normal file
@ -0,0 +1,27 @@
|
||||
## Discord Plex FR : https://discord.gg/3gtABCH
|
||||
## Version 2021-08-23
|
||||
|
||||
version: "3.8"
|
||||
services:
|
||||
dashy:
|
||||
container_name: Dashy
|
||||
image: lissy93/dashy
|
||||
# Decommenter les 2 lignes suivantes pour que watchtower surveille ce conteneur
|
||||
# labels:
|
||||
# - com.centurylinklabs.watchtower.enable=true
|
||||
volumes:
|
||||
- /volume1/docker/dashy/conf.yml:/app/public/conf.yml
|
||||
- /volume1/docker/dashy/item-icons:/app/public/item-icons
|
||||
ports:
|
||||
- 4000:80
|
||||
environment:
|
||||
- NODE_ENV=production
|
||||
- UID=1000
|
||||
- GID=1000
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: ['CMD', 'node', '/app/services/healthcheck']
|
||||
interval: 1m30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 40s
|
33
docker-compose/dashy/readme.md
Normal file
@ -0,0 +1,33 @@
|
||||
Dashy
|
||||
============
|
||||
|
||||
Dashy vous aide à organiser vos services auto-hébergés, en les rendant tous accessibles à partir d'un seul endroit
|
||||
|
||||
<p align="center">
|
||||
<img width="220" src="https://i.ibb.co/yhbt6CY/dashy.png" />
|
||||
</p>
|
||||
|
||||
## Caractéristiques
|
||||
|
||||
* Recherche instantanée par nom, domaine et tags - commencez simplement à taper
|
||||
* Raccourcis clavier entièrement personnalisables pour la navigation, le filtrage et le lancement d'applications
|
||||
* Plusieurs thèmes de couleurs intégrés, avec éditeur de couleurs d'interface utilisateur et prise en charge du CSS personnalisé
|
||||
* Disposition personnalisable, tailles, texte, visibilité des composants, comportement et couleurs, etc.
|
||||
* De nombreuses options pour les icônes, y compris la prise en charge de Font-Awesome, le favicon à récupération automatique, les images et les emojis
|
||||
* Possibilité d'afficher l'état du service pour chacune de vos applications/liens, pour une surveillance de base de la disponibilité et de la disponibilité
|
||||
* Choisissez comment lancer les applications, que ce soit dans votre navigateur, une vue modale contextuelle ou un espace de travail
|
||||
* Option pour l'image d'arrière-plan en plein écran, les liens de barre de navigation personnalisés, le pied de page html, le titre, etc.
|
||||
* Fonctionnalité de sauvegarde et de restauration en nuage cryptée en option disponible
|
||||
* Authentification facultative avec prise en charge multi-utilisateurs et privilèges configurables pour protéger votre tableau de bord
|
||||
* La petite taille de l'ensemble, l'interface utilisateur et la PWA entièrement réactives rendent l'application facile à utiliser sur n'importe quel appareil
|
||||
* Facile à configurer avec Docker, ou sur bare metal, ou avec un déploiement cloud en un clic
|
||||
* Prise en charge multilingue, avec plus de langues ajoutées régulièrement
|
||||
* Configuration simple basée sur YAML à fichier unique, ou configuration de l'application directement via l'interface utilisateur
|
||||
* Fort accent sur la confidentialité
|
||||
* Et bien plus encore...
|
||||
|
||||
## Demo ⚡
|
||||
|
||||
[Demo 1](https://dashy-demo-1.as93.net) ┆ [Demo 2](https://dashy-demo-2.as93.net) ┆ [Demo 3](https://dashy-demo-3.as93.net)
|
||||
|
||||
Lien du Github : https://github.com/Lissy93/dashy
|
19
docker-compose/deluge/docker-compose.yml
Normal file
@ -0,0 +1,19 @@
|
||||
## Discord Plex FR : https://discord.gg/3gtABCH
|
||||
## Version 2021-08-23
|
||||
|
||||
version: "2.1"
|
||||
services:
|
||||
deluge:
|
||||
image: ghcr.io/linuxserver/deluge:latest
|
||||
container_name: deluge
|
||||
environment:
|
||||
- PUID=1000 # Utiliser la commande (en SSH) : id NOM_UTILISATEUR
|
||||
- PGID=1000 # Utiliser la commande (en SSH) : id NOM_UTILISATEUR
|
||||
ports:
|
||||
- 8112:8112 # Port de gauche à modifier si nécessaire
|
||||
volumes:
|
||||
- /volume1/docker/deluge/config:/config # Chemin des fichiers de configuration de Deluge
|
||||
- /volume1/torrent:/downloads # Chemin où Deluge dépose les téléchargements
|
||||
restart: unless-stopped
|
||||
labels:
|
||||
- com.centurylinklabs.watchtower.enable=true # Ce label permet à Watchtower de faire les mises à jour automatiquement
|
22
docker-compose/docker-compose.yml
Normal file
@ -0,0 +1,22 @@
|
||||
## Discord Plex FR : https://discord.gg/3gtABCH
|
||||
## Version 2021-09-18
|
||||
##
|
||||
## Pour une aide à l'installation, consulter le README
|
||||
##
|
||||
version: "2.1"
|
||||
|
||||
services:
|
||||
unifi-controller:
|
||||
image: ghcr.io/linuxserver/unifi-controller
|
||||
container_name: unifi-controller
|
||||
# labels:
|
||||
# - com.centurylinklabs.watchtower.enable=true
|
||||
network_mode: host
|
||||
environment:
|
||||
- PUID=1000
|
||||
- PGID=1000
|
||||
- MEM_LIMIT=1024M
|
||||
- MEM_STARTUP=1024M
|
||||
volumes:
|
||||
- /volume1/docker/unifi/config:/config
|
||||
restart: unless-stopped
|
@ -1,5 +1,5 @@
|
||||
## Discord Plex FR : https://discord.gg/ERpYMqS
|
||||
## Version 2021-03-03
|
||||
## Discord Plex FR : https://discord.gg/3gtABCH
|
||||
## Version 2021-08-23
|
||||
version: '3.3'
|
||||
services:
|
||||
linuxserver:
|
||||
|
90
docker-compose/fail2ban/TUTO--fail2ban_docker-compose.yml
Normal file
@ -0,0 +1,90 @@
|
||||
##==============================================================================================
|
||||
## ##
|
||||
## Docker-compose file for Fail2ban ##
|
||||
## ##
|
||||
##==============================================================================================
|
||||
|
||||
---
|
||||
version: "2"
|
||||
##==============================================================================================
|
||||
## ##
|
||||
## Sources utilisées pour personnaliser ce fichier et ceux dans les sous-dossiers ##
|
||||
## ##
|
||||
##==============================================================================================
|
||||
## ##
|
||||
## https://www.linode.com/docs/guides/using-fail2ban-to-secure-your-server-a-tutorial/ ##
|
||||
## https://www.linuxtricks.fr/wiki/print.php?id=40 ##
|
||||
## https://github.com/dani-garcia/bitwarden_rs/wiki/Fail2Ban-Setup#synology-dsm ##
|
||||
## https://github.com/sosandroid/docker-fail2ban-synology ##
|
||||
## ##
|
||||
##──── ────────────────────────────────────────────────────────────────────────────────────────
|
||||
##──── ────────────────────────────────────────────────────────────────────────────────────────
|
||||
## ##
|
||||
## Cloner/télécharger le dépôt suivant qui contient les fichiers à utiliser : ##
|
||||
## https://github.com/sosandroid/docker-fail2ban-synology.git ##
|
||||
## Il faudra juste modifier le docker-compose.yml qui vient avec ou utiliser celui-ci. ##
|
||||
## ##
|
||||
##──── ────────────────────────────────────────────────────────────────────────────────────────
|
||||
## ##
|
||||
## Pour supprimer une IP bannie, lancer la commande suivante : ##
|
||||
## sudo docker exec -t fail2ban fail2ban-client set bitwarden_rs unbanip xx.xx.xx.xx ##
|
||||
## ##
|
||||
## Pour Voir le log de fail2ban, lancer la commande : ##
|
||||
## cat /volume1/docker/fail2ban/fail2ban.log ##
|
||||
## ##
|
||||
## ##
|
||||
## Quelques commandes utiles : ##
|
||||
## docker exec -t fail2ban fail2ban-client status ##
|
||||
## docker exec -t fail2ban fail2ban-client status bitwarden_rs ##
|
||||
## ##
|
||||
## unbans <IP> (in all jails and database) : ##
|
||||
## docker exec -t fail2ban fail2ban-client unban <IP> ... <IP> ##
|
||||
## ##
|
||||
## docker exec -t fail2ban fail2ban-client --help ##
|
||||
## docker exec -t fail2ban fail2ban-client restart ##
|
||||
## docker exec -t fail2ban fail2ban-client reload --restart --unban --all ##
|
||||
## ##
|
||||
## flushes the logtarget if a file and reopens it. For log rotation. : ##
|
||||
## docker exec -t fail2ban fail2ban-client flushlogs ##
|
||||
## ##
|
||||
##==============================================================================================
|
||||
|
||||
services:
|
||||
fail2ban:
|
||||
image: ghcr.io/crazy-max/fail2ban:latest
|
||||
container_name: fail2ban
|
||||
network_mode: host
|
||||
|
||||
environment:
|
||||
- TZ=Europe/Paris
|
||||
- F2B_DB_PURGE_AGE=30d
|
||||
- F2B_LOG_TARGET=/data/fail2ban.log
|
||||
- F2B_LOG_LEVEL=INFO
|
||||
- F2B_IPTABLES_CHAIN=INPUT
|
||||
|
||||
# Il faut adapter ces variables à votre fournisseur d'email.
|
||||
- SSMTP_HOST=smtp.gmail.com
|
||||
- SSMTP_PORT=587 # Pour gmail : 587
|
||||
- SSMTP_HOSTNAME=Docker-Fail2ban # Ce sera le nom qui sera affiché dans les emails
|
||||
- SSMTP_USER=XXxxXX@gmail.com
|
||||
- SSMTP_PASSWORD=XXxxXX # Pensez à générer un mot de passe application si la 2FA est activée
|
||||
- SSMTP_TLS=YES # Pour gmail : YES
|
||||
- SSMTP_STARTTLS=YES # Pour gmail : YES
|
||||
|
||||
labels:
|
||||
- "com.centurylinklabs.watchtower.enable=true"
|
||||
|
||||
volumes:
|
||||
- "/volume1/docker/fail2ban:/data"
|
||||
|
||||
# Les différents chemins d'accès vers les fichiers log des services à protéger par fail2ban
|
||||
# On ajoute ro pour read-only (lecture seule)
|
||||
- "/volume1/docker/vaultwarden/vaultwarden-data:/vaultwarden:ro" # Vaultwarden
|
||||
- "/volume1/docker/gitea/data/gitea/log:/gitea:ro" # Gitea
|
||||
#- "/var/log/auth.log:/log/host_ssh_auth.log:ro" # SSH sur l'hôte (Synology)
|
||||
|
||||
cap_add:
|
||||
- NET_ADMIN
|
||||
- NET_RAW
|
||||
|
||||
restart: always
|
@ -0,0 +1,4 @@
|
||||
[Init]
|
||||
blocktype = DROP
|
||||
[Init?family=inet6]
|
||||
blocktype = DROP
|
@ -0,0 +1,5 @@
|
||||
# /volume1/docker/fail2ban/filter.d/gitea.conf
|
||||
|
||||
[Definition]
|
||||
failregex = .*(Failed authentication attempt|invalid credentials|Attempted access of unknown user).* from <HOST>
|
||||
ignoreregex =
|
@ -0,0 +1,8 @@
|
||||
# /volume1/docker/fail2ban/filter.d/vaultwarden-admin.conf
|
||||
|
||||
[INCLUDES]
|
||||
before = common.conf
|
||||
|
||||
[Definition]
|
||||
failregex = ^.*Invalid admin token\. IP: <ADDR>.*$
|
||||
ignoreregex =
|
@ -0,0 +1,8 @@
|
||||
# /volume1/docker/fail2ban/filter.d/vaultwarden.conf
|
||||
|
||||
[INCLUDES]
|
||||
before = common.conf
|
||||
|
||||
[Definition]
|
||||
failregex = ^.*Username or password is incorrect\. Try again\. IP: <ADDR>\. Username:.*$
|
||||
ignoreregex =
|
@ -0,0 +1,964 @@
|
||||
#
|
||||
# WARNING: heavily refactored in 0.9.0 release. Please review and
|
||||
# customize settings for your setup.
|
||||
#
|
||||
# Changes: in most of the cases you should not modify this
|
||||
# file, but provide customizations in jail.local file,
|
||||
# or separate .conf files under jail.d/ directory, e.g.:
|
||||
#
|
||||
# HOW TO ACTIVATE JAILS:
|
||||
#
|
||||
# YOU SHOULD NOT MODIFY THIS FILE.
|
||||
#
|
||||
# It will probably be overwritten or improved in a distribution update.
|
||||
#
|
||||
# Provide customizations in a jail.local file or a jail.d/customisation.local.
|
||||
# For example to change the default bantime for all jails and to enable the
|
||||
# ssh-iptables jail the following (uncommented) would appear in the .local file.
|
||||
# See man 5 jail.conf for details.
|
||||
#
|
||||
# [DEFAULT]
|
||||
# bantime = 1h
|
||||
#
|
||||
# [sshd]
|
||||
# enabled = true
|
||||
#
|
||||
# See jail.conf(5) man page for more information
|
||||
|
||||
|
||||
|
||||
# Comments: use '#' for comment lines and ';' (following a space) for inline comments
|
||||
|
||||
|
||||
[INCLUDES]
|
||||
|
||||
#before = paths-distro.conf
|
||||
before = paths-debian.conf
|
||||
|
||||
# The DEFAULT allows a global definition of the options. They can be overridden
|
||||
# in each jail afterwards.
|
||||
|
||||
[DEFAULT]
|
||||
|
||||
#
|
||||
# MISCELLANEOUS OPTIONS
|
||||
#
|
||||
|
||||
# "bantime.increment" allows to use database for searching of previously banned ip's to increase a
|
||||
# default ban time using special formula, default it is banTime * 1, 2, 4, 8, 16, 32...
|
||||
#bantime.increment = true
|
||||
|
||||
# "bantime.rndtime" is the max number of seconds using for mixing with random time
|
||||
# to prevent "clever" botnets calculate exact time IP can be unbanned again:
|
||||
#bantime.rndtime =
|
||||
|
||||
# "bantime.maxtime" is the max number of seconds using the ban time can reach (doesn't grow further)
|
||||
#bantime.maxtime =
|
||||
|
||||
# "bantime.factor" is a coefficient to calculate exponent growing of the formula or common multiplier,
|
||||
# default value of factor is 1 and with default value of formula, the ban time
|
||||
# grows by 1, 2, 4, 8, 16 ...
|
||||
#bantime.factor = 1
|
||||
|
||||
# "bantime.formula" used by default to calculate next value of ban time, default value below,
|
||||
# the same ban time growing will be reached by multipliers 1, 2, 4, 8, 16, 32...
|
||||
#bantime.formula = ban.Time * (1<<(ban.Count if ban.Count<20 else 20)) * banFactor
|
||||
#
|
||||
# more aggressive example of formula has the same values only for factor "2.0 / 2.885385" :
|
||||
#bantime.formula = ban.Time * math.exp(float(ban.Count+1)*banFactor)/math.exp(1*banFactor)
|
||||
|
||||
# "bantime.multipliers" used to calculate next value of ban time instead of formula, coresponding
|
||||
# previously ban count and given "bantime.factor" (for multipliers default is 1);
|
||||
# following example grows ban time by 1, 2, 4, 8, 16 ... and if last ban count greater as multipliers count,
|
||||
# always used last multiplier (64 in example), for factor '1' and original ban time 600 - 10.6 hours
|
||||
#bantime.multipliers = 1 2 4 8 16 32 64
|
||||
# following example can be used for small initial ban time (bantime=60) - it grows more aggressive at begin,
|
||||
# for bantime=60 the multipliers are minutes and equal: 1 min, 5 min, 30 min, 1 hour, 5 hour, 12 hour, 1 day, 2 day
|
||||
#bantime.multipliers = 1 5 30 60 300 720 1440 2880
|
||||
|
||||
# "bantime.overalljails" (if true) specifies the search of IP in the database will be executed
|
||||
# cross over all jails, if false (dafault), only current jail of the ban IP will be searched
|
||||
#bantime.overalljails = false
|
||||
|
||||
# --------------------
|
||||
|
||||
# "ignoreself" specifies whether the local resp. own IP addresses should be ignored
|
||||
# (default is true). Fail2ban will not ban a host which matches such addresses.
|
||||
#ignoreself = true
|
||||
|
||||
# "ignoreip" can be a list of IP addresses, CIDR masks or DNS hosts. Fail2ban
|
||||
# will not ban a host which matches an address in this list. Several addresses
|
||||
# can be defined using space (and/or comma) separator.
|
||||
#ignoreip = 127.0.0.1/8 ::1
|
||||
|
||||
# External command that will take an tagged arguments to ignore, e.g. <ip>,
|
||||
# and return true if the IP is to be ignored. False otherwise.
|
||||
#
|
||||
# ignorecommand = /path/to/command <ip>
|
||||
ignorecommand =
|
||||
|
||||
# "bantime" is the number of seconds that a host is banned.
|
||||
bantime = 10m
|
||||
|
||||
# A host is banned if it has generated "maxretry" during the last "findtime"
|
||||
# seconds.
|
||||
findtime = 10m
|
||||
|
||||
# "maxretry" is the number of failures before a host get banned.
|
||||
maxretry = 5
|
||||
|
||||
# "maxmatches" is the number of matches stored in ticket (resolvable via tag <matches> in actions).
|
||||
maxmatches = %(maxretry)s
|
||||
|
||||
# "backend" specifies the backend used to get files modification.
|
||||
# Available options are "pyinotify", "gamin", "polling", "systemd" and "auto".
|
||||
# This option can be overridden in each jail as well.
|
||||
#
|
||||
# pyinotify: requires pyinotify (a file alteration monitor) to be installed.
|
||||
# If pyinotify is not installed, Fail2ban will use auto.
|
||||
# gamin: requires Gamin (a file alteration monitor) to be installed.
|
||||
# If Gamin is not installed, Fail2ban will use auto.
|
||||
# polling: uses a polling algorithm which does not require external libraries.
|
||||
# systemd: uses systemd python library to access the systemd journal.
|
||||
# Specifying "logpath" is not valid for this backend.
|
||||
# See "journalmatch" in the jails associated filter config
|
||||
# auto: will try to use the following backends, in order:
|
||||
# pyinotify, gamin, polling.
|
||||
#
|
||||
# Note: if systemd backend is chosen as the default but you enable a jail
|
||||
# for which logs are present only in its own log files, specify some other
|
||||
# backend for that jail (e.g. polling) and provide empty value for
|
||||
# journalmatch. See https://github.com/fail2ban/fail2ban/issues/959#issuecomment-74901200
|
||||
backend = auto
|
||||
|
||||
# "usedns" specifies if jails should trust hostnames in logs,
|
||||
# warn when DNS lookups are performed, or ignore all hostnames in logs
|
||||
#
|
||||
# yes: if a hostname is encountered, a DNS lookup will be performed.
|
||||
# warn: if a hostname is encountered, a DNS lookup will be performed,
|
||||
# but it will be logged as a warning.
|
||||
# no: if a hostname is encountered, will not be used for banning,
|
||||
# but it will be logged as info.
|
||||
# raw: use raw value (no hostname), allow use it for no-host filters/actions (example user)
|
||||
usedns = warn
|
||||
|
||||
# "logencoding" specifies the encoding of the log files handled by the jail
|
||||
# This is used to decode the lines from the log file.
|
||||
# Typical examples: "ascii", "utf-8"
|
||||
#
|
||||
# auto: will use the system locale setting
|
||||
logencoding = auto
|
||||
|
||||
# "enabled" enables the jails.
|
||||
# By default all jails are disabled, and it should stay this way.
|
||||
# Enable only relevant to your setup jails in your .local or jail.d/*.conf
|
||||
#
|
||||
# true: jail will be enabled and log files will get monitored for changes
|
||||
# false: jail is not enabled
|
||||
enabled = false
|
||||
|
||||
|
||||
# "mode" defines the mode of the filter (see corresponding filter implementation for more info).
|
||||
mode = normal
|
||||
|
||||
# "filter" defines the filter to use by the jail.
|
||||
# By default jails have names matching their filter name
|
||||
#
|
||||
filter = %(__name__)s[mode=%(mode)s]
|
||||
|
||||
|
||||
#
|
||||
# ACTIONS
|
||||
#
|
||||
|
||||
# Some options used for actions
|
||||
|
||||
# Destination email address used solely for the interpolations in
|
||||
# jail.{conf,local,d/*} configuration files.
|
||||
destemail = root@localhost
|
||||
|
||||
# Sender email address used solely for some actions
|
||||
sender = root@<fq-hostname>
|
||||
|
||||
# E-mail action. Since 0.8.1 Fail2Ban uses sendmail MTA for the
|
||||
# mailing. Change mta configuration parameter to mail if you want to
|
||||
# revert to conventional 'mail'.
|
||||
mta = sendmail
|
||||
|
||||
# Default protocol
|
||||
protocol = tcp
|
||||
|
||||
# Specify chain where jumps would need to be added in ban-actions expecting parameter chain
|
||||
chain = <known/chain>
|
||||
|
||||
# Ports to be banned
|
||||
# Usually should be overridden in a particular jail
|
||||
port = 0:65535
|
||||
|
||||
# Format of user-agent https://tools.ietf.org/html/rfc7231#section-5.5.3
|
||||
fail2ban_agent = Fail2Ban/%(fail2ban_version)s
|
||||
|
||||
#
|
||||
# Action shortcuts. To be used to define action parameter
|
||||
|
||||
# Default banning action (e.g. iptables, iptables-new,
|
||||
# iptables-multiport, shorewall, etc) It is used to define
|
||||
# action_* variables. Can be overridden globally or per
|
||||
# section within jail.local file
|
||||
banaction = iptables-multiport
|
||||
banaction_allports = iptables-allports
|
||||
|
||||
# The simplest action to take: ban only
|
||||
action_ = %(banaction)s[port="%(port)s", protocol="%(protocol)s", chain="%(chain)s"]
|
||||
|
||||
# ban & send an e-mail with whois report to the destemail.
|
||||
action_mw = %(action_)s
|
||||
%(mta)s-whois[sender="%(sender)s", dest="%(destemail)s", protocol="%(protocol)s", chain="%(chain)s"]
|
||||
|
||||
# ban & send an e-mail with whois report and relevant log lines
|
||||
# to the destemail.
|
||||
action_mwl = %(action_)s
|
||||
%(mta)s-whois-lines[sender="%(sender)s", dest="%(destemail)s", logpath="%(logpath)s", chain="%(chain)s"]
|
||||
|
||||
# See the IMPORTANT note in action.d/xarf-login-attack for when to use this action
|
||||
#
|
||||
# ban & send a xarf e-mail to abuse contact of IP address and include relevant log lines
|
||||
# to the destemail.
|
||||
action_xarf = %(action_)s
|
||||
xarf-login-attack[service=%(__name__)s, sender="%(sender)s", logpath="%(logpath)s", port="%(port)s"]
|
||||
|
||||
# ban IP on CloudFlare & send an e-mail with whois report and relevant log lines
|
||||
# to the destemail.
|
||||
action_cf_mwl = cloudflare[cfuser="%(cfemail)s", cftoken="%(cfapikey)s"]
|
||||
%(mta)s-whois-lines[sender="%(sender)s", dest="%(destemail)s", logpath="%(logpath)s", chain="%(chain)s"]
|
||||
|
||||
# Report block via blocklist.de fail2ban reporting service API
|
||||
#
|
||||
# See the IMPORTANT note in action.d/blocklist_de.conf for when to use this action.
|
||||
# Specify expected parameters in file action.d/blocklist_de.local or if the interpolation
|
||||
# `action_blocklist_de` used for the action, set value of `blocklist_de_apikey`
|
||||
# in your `jail.local` globally (section [DEFAULT]) or per specific jail section (resp. in
|
||||
# corresponding jail.d/my-jail.local file).
|
||||
#
|
||||
action_blocklist_de = blocklist_de[email="%(sender)s", service="%(__name__)s", apikey="%(blocklist_de_apikey)s", agent="%(fail2ban_agent)s"]
|
||||
|
||||
# Report ban via badips.com, and use as blacklist
|
||||
#
|
||||
# See BadIPsAction docstring in config/action.d/badips.py for
|
||||
# documentation for this action.
|
||||
#
|
||||
# NOTE: This action relies on banaction being present on start and therefore
|
||||
# should be last action defined for a jail.
|
||||
#
|
||||
action_badips = badips.py[category="%(__name__)s", banaction="%(banaction)s", agent="%(fail2ban_agent)s"]
|
||||
#
|
||||
# Report ban via badips.com (uses action.d/badips.conf for reporting only)
|
||||
#
|
||||
action_badips_report = badips[category="%(__name__)s", agent="%(fail2ban_agent)s"]
|
||||
|
||||
# Report ban via abuseipdb.com.
|
||||
#
|
||||
# See action.d/abuseipdb.conf for usage example and details.
|
||||
#
|
||||
action_abuseipdb = abuseipdb
|
||||
|
||||
# Choose default action. To change, just override value of 'action' with the
|
||||
# interpolation to the chosen action shortcut (e.g. action_mw, action_mwl, etc) in jail.local
|
||||
# globally (section [DEFAULT]) or per specific section
|
||||
action = %(action_)s
|
||||
|
||||
|
||||
#
|
||||
# JAILS
|
||||
#
|
||||
|
||||
#
|
||||
# SSH servers
|
||||
#
|
||||
|
||||
[sshd]
|
||||
|
||||
# To use more aggressive sshd modes set filter parameter "mode" in jail.local:
|
||||
# normal (default), ddos, extra or aggressive (combines all).
|
||||
# See "tests/files/logs/sshd" or "filter.d/sshd.conf" for usage example and details.
|
||||
#mode = normal
|
||||
port = ssh
|
||||
logpath = %(sshd_log)s
|
||||
backend = %(sshd_backend)s
|
||||
|
||||
|
||||
[dropbear]
|
||||
|
||||
port = ssh
|
||||
logpath = %(dropbear_log)s
|
||||
backend = %(dropbear_backend)s
|
||||
|
||||
|
||||
[selinux-ssh]
|
||||
|
||||
port = ssh
|
||||
logpath = %(auditd_log)s
|
||||
|
||||
|
||||
#
|
||||
# HTTP servers
|
||||
#
|
||||
|
||||
[apache-auth]
|
||||
|
||||
port = http,https
|
||||
logpath = %(apache_error_log)s
|
||||
|
||||
|
||||
[apache-badbots]
|
||||
# Ban hosts which agent identifies spammer robots crawling the web
|
||||
# for email addresses. The mail outputs are buffered.
|
||||
port = http,https
|
||||
logpath = %(apache_access_log)s
|
||||
bantime = 48h
|
||||
maxretry = 1
|
||||
|
||||
|
||||
[apache-noscript]
|
||||
|
||||
port = http,https
|
||||
logpath = %(apache_error_log)s
|
||||
|
||||
|
||||
[apache-overflows]
|
||||
|
||||
port = http,https
|
||||
logpath = %(apache_error_log)s
|
||||
maxretry = 2
|
||||
|
||||
|
||||
[apache-nohome]
|
||||
|
||||
port = http,https
|
||||
logpath = %(apache_error_log)s
|
||||
maxretry = 2
|
||||
|
||||
|
||||
[apache-botsearch]
|
||||
|
||||
port = http,https
|
||||
logpath = %(apache_error_log)s
|
||||
maxretry = 2
|
||||
|
||||
|
||||
[apache-fakegooglebot]
|
||||
|
||||
port = http,https
|
||||
logpath = %(apache_access_log)s
|
||||
maxretry = 1
|
||||
ignorecommand = %(ignorecommands_dir)s/apache-fakegooglebot <ip>
|
||||
|
||||
|
||||
[apache-modsecurity]
|
||||
|
||||
port = http,https
|
||||
logpath = %(apache_error_log)s
|
||||
maxretry = 2
|
||||
|
||||
|
||||
[apache-shellshock]
|
||||
|
||||
port = http,https
|
||||
logpath = %(apache_error_log)s
|
||||
maxretry = 1
|
||||
|
||||
|
||||
[openhab-auth]
|
||||
|
||||
filter = openhab
|
||||
banaction = %(banaction_allports)s
|
||||
logpath = /opt/openhab/logs/request.log
|
||||
|
||||
|
||||
[nginx-http-auth]
|
||||
|
||||
port = http,https
|
||||
logpath = %(nginx_error_log)s
|
||||
|
||||
# To use 'nginx-limit-req' jail you should have `ngx_http_limit_req_module`
|
||||
# and define `limit_req` and `limit_req_zone` as described in nginx documentation
|
||||
# http://nginx.org/en/docs/http/ngx_http_limit_req_module.html
|
||||
# or for example see in 'config/filter.d/nginx-limit-req.conf'
|
||||
[nginx-limit-req]
|
||||
port = http,https
|
||||
logpath = %(nginx_error_log)s
|
||||
|
||||
[nginx-botsearch]
|
||||
|
||||
port = http,https
|
||||
logpath = %(nginx_error_log)s
|
||||
maxretry = 2
|
||||
|
||||
|
||||
# Ban attackers that try to use PHP's URL-fopen() functionality
|
||||
# through GET/POST variables. - Experimental, with more than a year
|
||||
# of usage in production environments.
|
||||
|
||||
[php-url-fopen]
|
||||
|
||||
port = http,https
|
||||
logpath = %(nginx_access_log)s
|
||||
%(apache_access_log)s
|
||||
|
||||
|
||||
[suhosin]
|
||||
|
||||
port = http,https
|
||||
logpath = %(suhosin_log)s
|
||||
|
||||
|
||||
[lighttpd-auth]
|
||||
# Same as above for Apache's mod_auth
|
||||
# It catches wrong authentifications
|
||||
port = http,https
|
||||
logpath = %(lighttpd_error_log)s
|
||||
|
||||
|
||||
#
|
||||
# Webmail and groupware servers
|
||||
#
|
||||
|
||||
[roundcube-auth]
|
||||
|
||||
port = http,https
|
||||
logpath = %(roundcube_errors_log)s
|
||||
# Use following line in your jail.local if roundcube logs to journal.
|
||||
#backend = %(syslog_backend)s
|
||||
|
||||
|
||||
[openwebmail]
|
||||
|
||||
port = http,https
|
||||
logpath = /var/log/openwebmail.log
|
||||
|
||||
|
||||
[horde]
|
||||
|
||||
port = http,https
|
||||
logpath = /var/log/horde/horde.log
|
||||
|
||||
|
||||
[groupoffice]
|
||||
|
||||
port = http,https
|
||||
logpath = /home/groupoffice/log/info.log
|
||||
|
||||
|
||||
[sogo-auth]
|
||||
# Monitor SOGo groupware server
|
||||
# without proxy this would be:
|
||||
# port = 20000
|
||||
port = http,https
|
||||
logpath = /var/log/sogo/sogo.log
|
||||
|
||||
|
||||
[tine20]
|
||||
|
||||
logpath = /var/log/tine20/tine20.log
|
||||
port = http,https
|
||||
|
||||
|
||||
#
|
||||
# Web Applications
|
||||
#
|
||||
#
|
||||
|
||||
[drupal-auth]
|
||||
|
||||
port = http,https
|
||||
logpath = %(syslog_daemon)s
|
||||
backend = %(syslog_backend)s
|
||||
|
||||
[guacamole]
|
||||
|
||||
port = http,https
|
||||
logpath = /var/log/tomcat*/catalina.out
|
||||
#logpath = /var/log/guacamole.log
|
||||
|
||||
[monit]
|
||||
#Ban clients brute-forcing the monit gui login
|
||||
port = 2812
|
||||
logpath = /var/log/monit
|
||||
/var/log/monit.log
|
||||
|
||||
|
||||
[webmin-auth]
|
||||
|
||||
port = 10000
|
||||
logpath = %(syslog_authpriv)s
|
||||
backend = %(syslog_backend)s
|
||||
|
||||
|
||||
[froxlor-auth]
|
||||
|
||||
port = http,https
|
||||
logpath = %(syslog_authpriv)s
|
||||
backend = %(syslog_backend)s
|
||||
|
||||
|
||||
#
|
||||
# HTTP Proxy servers
|
||||
#
|
||||
#
|
||||
|
||||
[squid]
|
||||
|
||||
port = 80,443,3128,8080
|
||||
logpath = /var/log/squid/access.log
|
||||
|
||||
|
||||
[3proxy]
|
||||
|
||||
port = 3128
|
||||
logpath = /var/log/3proxy.log
|
||||
|
||||
|
||||
#
|
||||
# FTP servers
|
||||
#
|
||||
|
||||
|
||||
[proftpd]
|
||||
|
||||
port = ftp,ftp-data,ftps,ftps-data
|
||||
logpath = %(proftpd_log)s
|
||||
backend = %(proftpd_backend)s
|
||||
|
||||
|
||||
[pure-ftpd]
|
||||
|
||||
port = ftp,ftp-data,ftps,ftps-data
|
||||
logpath = %(pureftpd_log)s
|
||||
backend = %(pureftpd_backend)s
|
||||
|
||||
|
||||
[gssftpd]
|
||||
|
||||
port = ftp,ftp-data,ftps,ftps-data
|
||||
logpath = %(syslog_daemon)s
|
||||
backend = %(syslog_backend)s
|
||||
|
||||
|
||||
[wuftpd]
|
||||
|
||||
port = ftp,ftp-data,ftps,ftps-data
|
||||
logpath = %(wuftpd_log)s
|
||||
backend = %(wuftpd_backend)s
|
||||
|
||||
|
||||
[vsftpd]
|
||||
# or overwrite it in jails.local to be
|
||||
# logpath = %(syslog_authpriv)s
|
||||
# if you want to rely on PAM failed login attempts
|
||||
# vsftpd's failregex should match both of those formats
|
||||
port = ftp,ftp-data,ftps,ftps-data
|
||||
logpath = %(vsftpd_log)s
|
||||
|
||||
|
||||
#
|
||||
# Mail servers
|
||||
#
|
||||
|
||||
# ASSP SMTP Proxy Jail
|
||||
[assp]
|
||||
|
||||
port = smtp,465,submission
|
||||
logpath = /root/path/to/assp/logs/maillog.txt
|
||||
|
||||
|
||||
[courier-smtp]
|
||||
|
||||
port = smtp,465,submission
|
||||
logpath = %(syslog_mail)s
|
||||
backend = %(syslog_backend)s
|
||||
|
||||
|
||||
[postfix]
|
||||
# To use another modes set filter parameter "mode" in jail.local:
|
||||
mode = more
|
||||
port = smtp,465,submission
|
||||
logpath = %(postfix_log)s
|
||||
backend = %(postfix_backend)s
|
||||
|
||||
|
||||
[postfix-rbl]
|
||||
|
||||
filter = postfix[mode=rbl]
|
||||
port = smtp,465,submission
|
||||
logpath = %(postfix_log)s
|
||||
backend = %(postfix_backend)s
|
||||
maxretry = 1
|
||||
|
||||
|
||||
[sendmail-auth]
|
||||
|
||||
port = submission,465,smtp
|
||||
logpath = %(syslog_mail)s
|
||||
backend = %(syslog_backend)s
|
||||
|
||||
|
||||
[sendmail-reject]
|
||||
# To use more aggressive modes set filter parameter "mode" in jail.local:
|
||||
# normal (default), extra or aggressive
|
||||
# See "tests/files/logs/sendmail-reject" or "filter.d/sendmail-reject.conf" for usage example and details.
|
||||
#mode = normal
|
||||
port = smtp,465,submission
|
||||
logpath = %(syslog_mail)s
|
||||
backend = %(syslog_backend)s
|
||||
|
||||
|
||||
[qmail-rbl]
|
||||
|
||||
filter = qmail
|
||||
port = smtp,465,submission
|
||||
logpath = /service/qmail/log/main/current
|
||||
|
||||
|
||||
# dovecot defaults to logging to the mail syslog facility
|
||||
# but can be set by syslog_facility in the dovecot configuration.
|
||||
[dovecot]
|
||||
|
||||
port = pop3,pop3s,imap,imaps,submission,465,sieve
|
||||
logpath = %(dovecot_log)s
|
||||
backend = %(dovecot_backend)s
|
||||
|
||||
|
||||
[sieve]
|
||||
|
||||
port = smtp,465,submission
|
||||
logpath = %(dovecot_log)s
|
||||
backend = %(dovecot_backend)s
|
||||
|
||||
|
||||
[solid-pop3d]
|
||||
|
||||
port = pop3,pop3s
|
||||
logpath = %(solidpop3d_log)s
|
||||
|
||||
|
||||
[exim]
|
||||
# see filter.d/exim.conf for further modes supported from filter:
|
||||
#mode = normal
|
||||
port = smtp,465,submission
|
||||
logpath = %(exim_main_log)s
|
||||
|
||||
|
||||
[exim-spam]
|
||||
|
||||
port = smtp,465,submission
|
||||
logpath = %(exim_main_log)s
|
||||
|
||||
|
||||
[kerio]
|
||||
|
||||
port = imap,smtp,imaps,465
|
||||
logpath = /opt/kerio/mailserver/store/logs/security.log
|
||||
|
||||
|
||||
#
|
||||
# Mail servers authenticators: might be used for smtp,ftp,imap servers, so
|
||||
# all relevant ports get banned
|
||||
#
|
||||
|
||||
[courier-auth]
|
||||
|
||||
port = smtp,465,submission,imap,imaps,pop3,pop3s
|
||||
logpath = %(syslog_mail)s
|
||||
backend = %(syslog_backend)s
|
||||
|
||||
|
||||
[postfix-sasl]
|
||||
|
||||
filter = postfix[mode=auth]
|
||||
port = smtp,465,submission,imap,imaps,pop3,pop3s
|
||||
# You might consider monitoring /var/log/mail.warn instead if you are
|
||||
# running postfix since it would provide the same log lines at the
|
||||
# "warn" level but overall at the smaller filesize.
|
||||
logpath = %(postfix_log)s
|
||||
backend = %(postfix_backend)s
|
||||
|
||||
|
||||
[perdition]
|
||||
|
||||
port = imap,imaps,pop3,pop3s
|
||||
logpath = %(syslog_mail)s
|
||||
backend = %(syslog_backend)s
|
||||
|
||||
|
||||
[squirrelmail]
|
||||
|
||||
port = smtp,465,submission,imap,imap2,imaps,pop3,pop3s,http,https,socks
|
||||
logpath = /var/lib/squirrelmail/prefs/squirrelmail_access_log
|
||||
|
||||
|
||||
[cyrus-imap]
|
||||
|
||||
port = imap,imaps
|
||||
logpath = %(syslog_mail)s
|
||||
backend = %(syslog_backend)s
|
||||
|
||||
|
||||
[uwimap-auth]
|
||||
|
||||
port = imap,imaps
|
||||
logpath = %(syslog_mail)s
|
||||
backend = %(syslog_backend)s
|
||||
|
||||
|
||||
#
|
||||
#
|
||||
# DNS servers
|
||||
#
|
||||
|
||||
|
||||
# !!! WARNING !!!
|
||||
# Since UDP is connection-less protocol, spoofing of IP and imitation
|
||||
# of illegal actions is way too simple. Thus enabling of this filter
|
||||
# might provide an easy way for implementing a DoS against a chosen
|
||||
# victim. See
|
||||
# http://nion.modprobe.de/blog/archives/690-fail2ban-+-dns-fail.html
|
||||
# Please DO NOT USE this jail unless you know what you are doing.
|
||||
#
|
||||
# IMPORTANT: see filter.d/named-refused for instructions to enable logging
|
||||
# This jail blocks UDP traffic for DNS requests.
|
||||
# [named-refused-udp]
|
||||
#
|
||||
# filter = named-refused
|
||||
# port = domain,953
|
||||
# protocol = udp
|
||||
# logpath = /var/log/named/security.log
|
||||
|
||||
# IMPORTANT: see filter.d/named-refused for instructions to enable logging
|
||||
# This jail blocks TCP traffic for DNS requests.
|
||||
|
||||
[named-refused]
|
||||
|
||||
port = domain,953
|
||||
logpath = /var/log/named/security.log
|
||||
|
||||
|
||||
[nsd]
|
||||
|
||||
port = 53
|
||||
action_ = %(default/action_)s[name=%(__name__)s-tcp, protocol="tcp"]
|
||||
%(default/action_)s[name=%(__name__)s-udp, protocol="udp"]
|
||||
logpath = /var/log/nsd.log
|
||||
|
||||
|
||||
#
|
||||
# Miscellaneous
|
||||
#
|
||||
|
||||
[asterisk]
|
||||
|
||||
port = 5060,5061
|
||||
action_ = %(default/action_)s[name=%(__name__)s-tcp, protocol="tcp"]
|
||||
%(default/action_)s[name=%(__name__)s-udp, protocol="udp"]
|
||||
logpath = /var/log/asterisk/messages
|
||||
maxretry = 10
|
||||
|
||||
|
||||
[freeswitch]
|
||||
|
||||
port = 5060,5061
|
||||
action_ = %(default/action_)s[name=%(__name__)s-tcp, protocol="tcp"]
|
||||
%(default/action_)s[name=%(__name__)s-udp, protocol="udp"]
|
||||
logpath = /var/log/freeswitch.log
|
||||
maxretry = 10
|
||||
|
||||
|
||||
# enable adminlog; it will log to a file inside znc's directory by default.
|
||||
[znc-adminlog]
|
||||
|
||||
port = 6667
|
||||
logpath = /var/lib/znc/moddata/adminlog/znc.log
|
||||
|
||||
|
||||
# To log wrong MySQL access attempts add to /etc/my.cnf in [mysqld] or
|
||||
# equivalent section:
|
||||
# log-warnings = 2
|
||||
#
|
||||
# for syslog (daemon facility)
|
||||
# [mysqld_safe]
|
||||
# syslog
|
||||
#
|
||||
# for own logfile
|
||||
# [mysqld]
|
||||
# log-error=/var/log/mysqld.log
|
||||
[mysqld-auth]
|
||||
|
||||
port = 3306
|
||||
logpath = %(mysql_log)s
|
||||
backend = %(mysql_backend)s
|
||||
|
||||
|
||||
# Log wrong MongoDB auth (for details see filter 'filter.d/mongodb-auth.conf')
|
||||
[mongodb-auth]
|
||||
# change port when running with "--shardsvr" or "--configsvr" runtime operation
|
||||
port = 27017
|
||||
logpath = /var/log/mongodb/mongodb.log
|
||||
|
||||
|
||||
# Jail for more extended banning of persistent abusers
|
||||
# !!! WARNINGS !!!
|
||||
# 1. Make sure that your loglevel specified in fail2ban.conf/.local
|
||||
# is not at DEBUG level -- which might then cause fail2ban to fall into
|
||||
# an infinite loop constantly feeding itself with non-informative lines
|
||||
# 2. Increase dbpurgeage defined in fail2ban.conf to e.g. 648000 (7.5 days)
|
||||
# to maintain entries for failed logins for sufficient amount of time
|
||||
[recidive]
|
||||
|
||||
logpath = /var/log/fail2ban.log
|
||||
banaction = %(banaction_allports)s
|
||||
bantime = 1w
|
||||
findtime = 1d
|
||||
|
||||
|
||||
# Generic filter for PAM. Has to be used with action which bans all
|
||||
# ports such as iptables-allports, shorewall
|
||||
|
||||
[pam-generic]
|
||||
# pam-generic filter can be customized to monitor specific subset of 'tty's
|
||||
banaction = %(banaction_allports)s
|
||||
logpath = %(syslog_authpriv)s
|
||||
backend = %(syslog_backend)s
|
||||
|
||||
|
||||
[xinetd-fail]
|
||||
|
||||
banaction = iptables-multiport-log
|
||||
logpath = %(syslog_daemon)s
|
||||
backend = %(syslog_backend)s
|
||||
maxretry = 2
|
||||
|
||||
|
||||
# stunnel - need to set port for this
|
||||
[stunnel]
|
||||
|
||||
logpath = /var/log/stunnel4/stunnel.log
|
||||
|
||||
|
||||
[ejabberd-auth]
|
||||
|
||||
port = 5222
|
||||
logpath = /var/log/ejabberd/ejabberd.log
|
||||
|
||||
|
||||
[counter-strike]
|
||||
|
||||
logpath = /opt/cstrike/logs/L[0-9]*.log
|
||||
tcpport = 27030,27031,27032,27033,27034,27035,27036,27037,27038,27039
|
||||
udpport = 1200,27000,27001,27002,27003,27004,27005,27006,27007,27008,27009,27010,27011,27012,27013,27014,27015
|
||||
action_ = %(default/action_)s[name=%(__name__)s-tcp, port="%(tcpport)s", protocol="tcp"]
|
||||
%(default/action_)s[name=%(__name__)s-udp, port="%(udpport)s", protocol="udp"]
|
||||
|
||||
[softethervpn]
|
||||
port = 500,4500
|
||||
protocol = udp
|
||||
logpath = /usr/local/vpnserver/security_log/*/sec.log
|
||||
|
||||
[gitlab]
|
||||
port = http,https
|
||||
logpath = /var/log/gitlab/gitlab-rails/application.log
|
||||
|
||||
[grafana]
|
||||
port = http,https
|
||||
logpath = /var/log/grafana/grafana.log
|
||||
|
||||
[bitwarden]
|
||||
port = http,https
|
||||
logpath = /home/*/bwdata/logs/identity/Identity/log.txt
|
||||
|
||||
[centreon]
|
||||
port = http,https
|
||||
logpath = /var/log/centreon/login.log
|
||||
|
||||
# consider low maxretry and a long bantime
|
||||
# nobody except your own Nagios server should ever probe nrpe
|
||||
[nagios]
|
||||
|
||||
logpath = %(syslog_daemon)s ; nrpe.cfg may define a different log_facility
|
||||
backend = %(syslog_backend)s
|
||||
maxretry = 1
|
||||
|
||||
|
||||
[oracleims]
|
||||
# see "oracleims" filter file for configuration requirement for Oracle IMS v6 and above
|
||||
logpath = /opt/sun/comms/messaging64/log/mail.log_current
|
||||
banaction = %(banaction_allports)s
|
||||
|
||||
[directadmin]
|
||||
logpath = /var/log/directadmin/login.log
|
||||
port = 2222
|
||||
|
||||
[portsentry]
|
||||
logpath = /var/lib/portsentry/portsentry.history
|
||||
maxretry = 1
|
||||
|
||||
[pass2allow-ftp]
|
||||
# this pass2allow example allows FTP traffic after successful HTTP authentication
|
||||
port = ftp,ftp-data,ftps,ftps-data
|
||||
# knocking_url variable must be overridden to some secret value in jail.local
|
||||
knocking_url = /knocking/
|
||||
filter = apache-pass[knocking_url="%(knocking_url)s"]
|
||||
# access log of the website with HTTP auth
|
||||
logpath = %(apache_access_log)s
|
||||
blocktype = RETURN
|
||||
returntype = DROP
|
||||
action = %(action_)s[blocktype=%(blocktype)s, returntype=%(returntype)s,
|
||||
actionstart_on_demand=false, actionrepair_on_unban=true]
|
||||
bantime = 1h
|
||||
maxretry = 1
|
||||
findtime = 1
|
||||
|
||||
|
||||
[murmur]
|
||||
# AKA mumble-server
|
||||
port = 64738
|
||||
action_ = %(default/action_)s[name=%(__name__)s-tcp, protocol="tcp"]
|
||||
%(default/action_)s[name=%(__name__)s-udp, protocol="udp"]
|
||||
logpath = /var/log/mumble-server/mumble-server.log
|
||||
|
||||
|
||||
[screensharingd]
|
||||
# For Mac OS Screen Sharing Service (VNC)
|
||||
logpath = /var/log/system.log
|
||||
logencoding = utf-8
|
||||
|
||||
[haproxy-http-auth]
|
||||
# HAProxy by default doesn't log to file you'll need to set it up to forward
|
||||
# logs to a syslog server which would then write them to disk.
|
||||
# See "haproxy-http-auth" filter for a brief cautionary note when setting
|
||||
# maxretry and findtime.
|
||||
logpath = /var/log/haproxy.log
|
||||
|
||||
[slapd]
|
||||
port = ldap,ldaps
|
||||
logpath = /var/log/slapd.log
|
||||
|
||||
[domino-smtp]
|
||||
port = smtp,ssmtp
|
||||
logpath = /home/domino01/data/IBM_TECHNICAL_SUPPORT/console.log
|
||||
|
||||
[phpmyadmin-syslog]
|
||||
port = http,https
|
||||
logpath = %(syslog_authpriv)s
|
||||
backend = %(syslog_backend)s
|
||||
|
||||
|
||||
[zoneminder]
|
||||
# Zoneminder HTTP/HTTPS web interface auth
|
||||
# Logs auth failures to apache2 error log
|
||||
port = http,https
|
||||
logpath = %(apache_error_log)s
|
||||
|
||||
[traefik-auth]
|
||||
# to use 'traefik-auth' filter you have to configure your Traefik instance,
|
||||
# see `filter.d/traefik-auth.conf` for details and service example.
|
||||
port = http,https
|
||||
logpath = /var/log/traefik/access.log
|
@ -0,0 +1,39 @@
|
||||
# /volume1/docker/fail2ban/jail.d/gitea.conf
|
||||
|
||||
[DEFAULT]
|
||||
# "ignoreip" can be an IP address, a CIDR mask or a DNS host. Fail2ban will not
|
||||
# ban a host which matches an address in this list. Several addresses can be
|
||||
# defined using space separator.
|
||||
ignoreip = 172.16.0.0/12 192.168.0.0/16 10.0.0.0/8
|
||||
|
||||
# Changes the default ban action from "iptables-multiport", which causes issues on some platforms, to "iptables-allports".
|
||||
banaction = iptables-allports
|
||||
|
||||
# "bantime" is the number of seconds that a host is banned.
|
||||
bantime = 600
|
||||
|
||||
# A host is banned if it has generated "maxretry" during the last "findtime"
|
||||
# seconds.
|
||||
findtime = 600
|
||||
|
||||
# "maxretry" is the number of failures before a host get banned.
|
||||
maxretry = 5
|
||||
|
||||
destemail = email@gmail.com
|
||||
sender = email@gmail.com
|
||||
sendername = Fail2Ban
|
||||
action = %(action_mwl)s
|
||||
|
||||
backend = auto
|
||||
|
||||
|
||||
[gitea]
|
||||
enabled = true
|
||||
|
||||
# Doit correspondre au nom du fichier .conf dans le dossier filter.d
|
||||
filter = gitea
|
||||
|
||||
logpath = /gitea/gitea.log
|
||||
maxretry = 10
|
||||
findtime = 3600
|
||||
bantime = 900
|
@ -0,0 +1,37 @@
|
||||
# /volume1/docker/fail2ban/jail.d/vaultwarden-admin.conf
|
||||
|
||||
[DEFAULT]
|
||||
# "ignoreip" can be an IP address, a CIDR mask or a DNS host. Fail2ban will not
|
||||
# ban a host which matches an address in this list. Several addresses can be
|
||||
# defined using space separator.
|
||||
ignoreip = 172.16.0.0/12 192.168.0.0/16 10.0.0.0/8
|
||||
|
||||
# Changes the default ban action from "iptables-multiport", which causes issues on some platforms, to "iptables-allports".
|
||||
banaction = iptables-allports
|
||||
|
||||
# "bantime" is the number of seconds that a host is banned.
|
||||
bantime = 600
|
||||
|
||||
# A host is banned if it has generated "maxretry" during the last "findtime"
|
||||
# seconds.
|
||||
findtime = 600
|
||||
|
||||
# "maxretry" is the number of failures before a host get banned.
|
||||
maxretry = 5
|
||||
|
||||
destemail = email@gmail.com
|
||||
sender = email@gmail.com
|
||||
sendername = Fail2Ban
|
||||
action = %(action_mwl)s
|
||||
|
||||
backend = auto
|
||||
|
||||
|
||||
[vaultwarden-admin]
|
||||
enabled = true
|
||||
port = 882,3012
|
||||
|
||||
# Doit correspondre au nom du fichier .conf dans le dossier filter.d
|
||||
filter = vaultwarden-admin
|
||||
|
||||
logpath = /vaultwarden/vaultwarden.log
|
@ -0,0 +1,37 @@
|
||||
# /volume1/docker/fail2ban/jail.d/vaultwarden.conf
|
||||
|
||||
[DEFAULT]
|
||||
# "ignoreip" can be an IP address, a CIDR mask or a DNS host. Fail2ban will not
|
||||
# ban a host which matches an address in this list. Several addresses can be
|
||||
# defined using space separator.
|
||||
ignoreip = 172.16.0.0/12 192.168.0.0/16 10.0.0.0/8
|
||||
|
||||
# Changes the default ban action from "iptables-multiport", which causes issues on some platforms, to "iptables-allports".
|
||||
banaction = iptables-allports
|
||||
|
||||
# "bantime" is the number of seconds that a host is banned.
|
||||
bantime = 600
|
||||
|
||||
# A host is banned if it has generated "maxretry" during the last "findtime"
|
||||
# seconds.
|
||||
findtime = 600
|
||||
|
||||
# "maxretry" is the number of failures before a host get banned.
|
||||
maxretry = 5
|
||||
|
||||
destemail = email@gmail.com
|
||||
sender = email@gmail.com
|
||||
sendername = Fail2Ban
|
||||
action = %(action_mwl)s
|
||||
|
||||
backend = auto
|
||||
|
||||
|
||||
[vaultwarden]
|
||||
enabled = true
|
||||
port = 882,3012
|
||||
|
||||
# Doit correspondre au nom du fichier .conf dans le dossier filter.d
|
||||
filter = vaultwarden
|
||||
|
||||
logpath = /vaultwarden/vaultwarden.log
|
43
docker-compose/ghost-mysql/docker-compose.yml
Normal file
@ -0,0 +1,43 @@
|
||||
## Discord Plex FR : https://discord.gg/3gtABCH
|
||||
## Version 2022-08-21
|
||||
version: '3.1'
|
||||
|
||||
services:
|
||||
ghost:
|
||||
container_name: blog_ghost
|
||||
image: ghost:5-alpine
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- 2368:2368
|
||||
volumes:
|
||||
- ./ghost_content:/var/lib/ghost/content
|
||||
environment:
|
||||
url: https://blog.ndd.fr # LIEN DU BLOG, peut être http://IP_LOCAL:2368 si utilisation local uniquement
|
||||
database__client: mysql
|
||||
database__connection__host: db
|
||||
database__connection__user: root
|
||||
database__connection__password: PASSWORD_SUPER_FORT # CHOISIR UN MOT DE PASSE
|
||||
database__connection__database: ghost
|
||||
# - DEBUT - CONFIGURATION MAIL - NON OBLIGATOIRE #
|
||||
# mail__transport: SMTP
|
||||
# mail__from: monmail@ndd.fr
|
||||
# mail__options__service: SMTP
|
||||
# mail__options__host: serveur.smtp.net
|
||||
# mail__options__port: <PORT_SMTP>
|
||||
# mail__options__auth__user: nom_utilisateur
|
||||
# mail__options__auth__pass: mon_mot_de_passe
|
||||
# - FIN - CONFIGURATION MAIL - NON OBLIGATOIRE #
|
||||
depends_on:
|
||||
- db
|
||||
mem_limit: 512m
|
||||
|
||||
db:
|
||||
container_name: blog_db
|
||||
image: mysql:8-debian
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: PASSWORD_SUPER_FORT # RE-UTILISER LE MOT DE PASSE CHOISI DANS LES VARIABLES DE GHOST
|
||||
volumes:
|
||||
- ./ghost_db:/var/lib/mysql
|
||||
mem_limit: 768m
|
||||
|
26
docker-compose/ghost/docker-compose.yml
Normal file
@ -0,0 +1,26 @@
|
||||
## Discord Plex FR : https://discord.gg/3gtABCH
|
||||
## Version 2021-08-23
|
||||
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
ghost:
|
||||
container_name: ghost
|
||||
image: ghost:4-alpine
|
||||
# Decommenter les 2 lignes suivantes pour que watchtower surveille ce conteneur
|
||||
# labels:
|
||||
# - com.centurylinklabs.watchtower.enable=true
|
||||
networks:
|
||||
- ghost-network
|
||||
restart: always
|
||||
ports:
|
||||
- 2368:2368
|
||||
volumes:
|
||||
- /mnt/volume1/docker/ghost/content:/var/lib/ghost/content
|
||||
environment:
|
||||
url : http://192.168.1.10:2368
|
||||
|
||||
networks:
|
||||
ghost-network:
|
||||
external:
|
||||
name: ghost-network
|
199
docker-compose/gitea/Changer-Theme-Gitea.md
Normal file
@ -0,0 +1,199 @@
|
||||
Changer le thème de Gitea <!-- omit in toc -->
|
||||
============
|
||||
---
|
||||
> :pencil2: **Mise à jour v3.1 :** Suppression du `header.tmpl` au profit de `body_outer_pre.tmpl` suite à la MAJ par theme-park ([voir ici](https://github.com/GilbN/theme.park/issues/293#issuecomment-972038142)). Suppression de l'ancienne méthode.<br>
|
||||
> :pencil2: **Mise à jour v3.0 :** Gros changement `header.tmpl` suite à la MAJ par theme-park. Suppression de l'ancienne méthode.<br>
|
||||
> :pencil2: **Mise à jour v2.1 :** Petit changement du `header.tmpl` suite à la MAJ 1.15 de Gitea.<br>
|
||||
> :pencil2: **Mise à jour :** De nouveaux thèmes sont disponibles. Il faut re-télécharger les fichiers CSS. <br>
|
||||
*Voir* [§ 1. Ajouter les différents thèmes en laissant le choix à l'utilisateur](#1-ajouter-les-différents-thèmes-en-laissant-le-choix-à-lutilisateur)
|
||||
---
|
||||
|
||||
:arrow_forward: Vous pouvez trouver quelques thèmes ici : https://gitea.com/gitea/awesome-gitea#themes
|
||||
|
||||
:book: Dans la suite de ce tuto, on ne parlera que des thèmes Gitea de [theme.park](https://docs.theme-park.dev/themes/gitea/).
|
||||
|
||||
## Table des matières <!-- omit in toc -->
|
||||
- [1. Ajouter les différents thèmes en laissant le choix à l'utilisateur](#1-ajouter-les-différents-thèmes-en-laissant-le-choix-à-l-utilisateur)
|
||||
- [1.1. Création des dossiers dans `/volume1/docker/gitea/data/`](#1-1-création-des-dossiers-dans-volume1-docker-gitea-data)
|
||||
- [1.2. Création du fichier `body_outer_pre.tmpl` -- MAJ v3.1](#1-2-création-du-fichier-body-outer-pre-tmpl-maj-v3-1)
|
||||
- [1.3. Modification du fichier `/data/gitea/conf/app.ini`](#1-3-modification-du-fichier-data-gitea-conf-app-ini)
|
||||
- [1.3.1. Point info sur la modification de ce fichier](#1-3-1-point-info-sur-la-modification-de-ce-fichier)
|
||||
- [1.3.2. Ce qu'il faut ajouter au fichier `/data/gitea/conf/app.ini`](#1-3-2-ce-qu-il-faut-ajouter-au-fichier-data-gitea-conf-app-ini)
|
||||
- [2.4.3. Redémarrer le conteneur](#2-4-3-redémarrer-le-conteneur)
|
||||
- [2.5. Choisir son thème dans l'interface graphique de Gitea](#2-5-choisir-son-thème-dans-l-interface-graphique-de-gitea)
|
||||
- [2. Méthode précédente - Ajouter les différents thèmes en laissant le choix à l'utilisateur (Laissée pour la postérité)](#2-méthode-précédente-ajouter-les-différents-thèmes-en-laissant-le-choix-à-l-utilisateur-laissée-pour-la-postérité)
|
||||
- [2.1. Création des dossiers dans `/volume1/docker/gitea/data/`](#2-1-création-des-dossiers-dans-volume1-docker-gitea-data)
|
||||
- [2.2. Télécharger les différents css](#2-2-télécharger-les-différents-css)
|
||||
- [2.3. Création du fichier `header.tmpl` -- MAJ v2.1](#2-3-création-du-fichier-header-tmpl-maj-v2-1)
|
||||
- [2.4. Modification du fichier `/data/gitea/conf/app.ini`](#2-4-modification-du-fichier-data-gitea-conf-app-ini)
|
||||
- [2.4.1. Point info sur la modification de ce fichier](#2-4-1-point-info-sur-la-modification-de-ce-fichier)
|
||||
- [2.4.2. Ce qu'il faut ajouter au fichier `/data/gitea/conf/app.ini`](#2-4-2-ce-qu-il-faut-ajouter-au-fichier-data-gitea-conf-app-ini)
|
||||
- [2.4.3. Redémarrer le conteneur](#2-4-3-redémarrer-le-conteneur-1)
|
||||
- [2.5. Choisir son thème dans l'interface graphique de Gitea](#2-5-choisir-son-thème-dans-l-interface-graphique-de-gitea-1)
|
||||
|
||||
|
||||
---
|
||||
|
||||
# 1. Ajouter les différents thèmes en laissant le choix à l'utilisateur
|
||||
|
||||
> :memo: Cette partie devrait être compatible avec d'autres thèmes qui n'apportent qu'un seul fichier `.css`. ***À confirmer...***
|
||||
|
||||
## 1.1. Création des dossiers dans `/volume1/docker/gitea/data/`
|
||||
|
||||
- Il faut vérifier si la variable GITEA_CUSTOM a été paramétrée. En temps normal, ce n'est pas le cas.
|
||||
|
||||
- Si ce n'est pas le cas, on peut aller vérifier le chemin qui est paramétré pour le dossier dit CUSTOM de gitea. Pour celà, il faut aller ici :
|
||||
`https://url-de-votre-gitea.tlds/admin/config`
|
||||
|
||||
- Puis chercher la ligne `GITEA_CUSTOM` où apparaîtra le chemin d'accès : `/data/gitea`.
|
||||
|
||||
- Dans le cas d'une installation Docker, ça donnerait ceci : `/docker/gitea/data/gitea`
|
||||
<br>(voir le fichier **docker-compose.yml** pour le chemin d'accès avant le `/data/gitea`)
|
||||
|
||||
- Il faudra alors créer les dossiers suivants :
|
||||
|
||||
- `public`
|
||||
- `public/css`
|
||||
- `templates`
|
||||
- `templates/custom`
|
||||
|
||||
## 1.2. Création du fichier `body_outer_pre.tmpl` -- MAJ v3.1
|
||||
|
||||
- Supprimer le fichier `header.tmpl` du le dossier `.../templates/custom/` s'il est présent (créé lors d'une méthode précédente dépréciée).
|
||||
- Créer le fichier `body_outer_pre.tmpl` et l'enregistrer dans le dossier `.../templates/custom/` créé précédemment.
|
||||
```go
|
||||
<!-- Voir : https://docs.theme-park.dev/themes/gitea/#adding-the-themes-in-gitea -->
|
||||
{{ if .IsSigned }}
|
||||
{{ if and (ne .SignedUser.Theme "gitea") (ne .SignedUser.Theme "arc-green") }}
|
||||
<link rel="stylesheet" href="https://theme-park.dev/css/base/gitea/{{.SignedUser.Theme}}.css">
|
||||
{{end}}
|
||||
{{ else if and (ne DefaultTheme "gitea") (ne DefaultTheme "arc-green") }}
|
||||
<link rel="stylesheet" href="https://theme-park.dev/css/base/gitea/{{DefaultTheme}}.css">
|
||||
{{end}}
|
||||
```
|
||||
- Vous pouvez aussi récupérer le fichier tout prêt [dans dossier `data--gitea/public/template/custom/` de ce dépôt](https://gitea.zoz-serv.org/Zoz/plex_fr_discord_repo/src/branch/master/docker-compose/gitea/data--gitea/templates/custom/body_outer_pre.tmpl). Il contient en commentaires quelques détails.
|
||||
|
||||
## 1.3. Modification du fichier `/data/gitea/conf/app.ini`
|
||||
|
||||
### 1.3.1. Point info sur la modification de ce fichier
|
||||
|
||||
Pour modifier ce fichier, il se peut que vous n'ayez pas les permissions d'enregistrer les modifications apportées... Il faudra alors le copier ailleurs, faire les modifications et sauvegarder, puis re-copier dans l'autre sens le fichier dans son dossier d'origine.
|
||||
|
||||
C'est ce que je dois faire. Depuis une ligne de commande SSH, je fais :
|
||||
- Je copie le fichier dans un dossier où mon utilisateur Admin à les droits en écriture (je ne me logue pas avec l'utilisateur choisir pour Gitea) : <br>`cp /volume1/docker/gitea/data/gitea/conf/app.ini /volume1/docker/gitea/`
|
||||
- Je modifie et sauvegarde mon fichier...
|
||||
- puis je copie en retour le fichier modifier : `cp /volume1/docker/gitea/app.ini /volume1/docker/gitea/data/gitea/conf/`
|
||||
- Il faut ensuite relancer le conteneur Gitea avec Portainer/DSM ou en CLI : `docker restart gitea`
|
||||
|
||||
### 1.3.2. Ce qu'il faut ajouter au fichier `/data/gitea/conf/app.ini`
|
||||
|
||||
Il faut ajouter ceci au fichier `app.ini` :
|
||||
|
||||
```ini
|
||||
[ui]
|
||||
THEMES = gitea,arc-green,dracula,plex,dark,aquamarine,hotline,hotpink,nord,organizr,overseerr,space-gray,onedark,blackberry-abyss,blackberry-amethyst,blackberry-carol,blackberry-dreamscape,blackberry-flamingo,blackberry-hearth,blackberry-martian,blackberry-pumpkin,blackberry-royal,blackberry-shadow,blackberry-solar,blackberry-vanta
|
||||
DEFAULT_THEME = dracula
|
||||
```
|
||||
> :memo: Note 1 : Il se peut que la section `[ui]` soit déjà présente dans votre `app.ini`, il faudra alors modifier la ligne `THEMES`.
|
||||
> :memo: Note 2 : **Le thème par défaut n'a plus besoin d'être obligatoirement "gitea".**
|
||||
|
||||
### 2.4.3. Redémarrer le conteneur
|
||||
|
||||
Il faut bien penser à redémarrer le conteneur une fois le app.ini modifié et copié dans `/data/gitea/conf/`.
|
||||
|
||||
## 2.5. Choisir son thème dans l'interface graphique de Gitea
|
||||
|
||||
![](https://gitea.zoz-serv.org/Zoz/plex_fr_discord_repo/raw/branch/master/docker-compose/gitea/tuto-1.png)
|
||||
|
||||
![](https://gitea.zoz-serv.org/Zoz/plex_fr_discord_repo/raw/branch/master/docker-compose/gitea/tuto-2.png)
|
||||
|
||||
![](https://gitea.zoz-serv.org/Zoz/plex_fr_discord_repo/raw/branch/master/docker-compose/gitea/tuto-3.png)
|
||||
|
||||
|
||||
|
||||
|
||||
# 2. Méthode précédente - Ajouter les différents thèmes en laissant le choix à l'utilisateur (Laissée pour la postérité)
|
||||
|
||||
> :memo: Cette partie devrait être compatible avec d'autres thèmes qui n'apportent qu'un seul fichier `.css`. ***À confirmer...***
|
||||
|
||||
## 2.1. Création des dossiers dans `/volume1/docker/gitea/data/`
|
||||
|
||||
- Il faut vérifier si la variable GITEA_CUSTOM a été paramétrée. En temps normal, ce n'est pas le cas.
|
||||
|
||||
- Si ce n'est pas le cas, on peut aller vérifier le chemin qui est paramétré pour le dossier dit CUSTOM de gitea. Pour celà, il faut aller ici :
|
||||
`https://url-de-votre-gitea.tlds/admin/config`
|
||||
|
||||
- Puis chercher la ligne `GITEA_CUSTOM` où apparaîtra le chemin d'accès : `/data/gitea`.
|
||||
|
||||
- Dans le cas d'une installation Docker, ça donnerait ceci : `/docker/gitea/data/gitea`
|
||||
<br>(voir le fichier **docker-compose.yml** pour le chemin d'accès avant le `/data/gitea`)
|
||||
|
||||
- Il faudra alors créer les dossiers suivants :
|
||||
|
||||
- `public`
|
||||
- `public/css`
|
||||
- `templates`
|
||||
- `templates/custom`
|
||||
|
||||
## 2.2. Télécharger les différents css
|
||||
|
||||
- Télécharger les différents fichiers .css [du dossier `data--gitea/public/css/` de ce dépôt](https://gitea.zoz-serv.org/Zoz/plex_fr_discord_repo/src/branch/master/docker-compose/gitea/data--gitea/public/css).
|
||||
*(Ne pas les renommer.)*
|
||||
- Placer ces fichiers dans le dossier `...public/css` créé précédemment.
|
||||
|
||||
## 2.3. Création du fichier `header.tmpl` -- MAJ v2.1
|
||||
|
||||
- Créer le fichier `header.tmpl` et l'enregistrer dans le dossier `.../templates/custom/` créé précédemment.
|
||||
```html
|
||||
{{if .IsSigned }}
|
||||
{{ if ne .SignedUser.Theme "gitea" }}
|
||||
<link rel="stylesheet" href="{{AssetUrlPrefix}}/css/{{.SignedUser.Theme}}.css?v={{MD5 AppVer}}">
|
||||
{{end}}
|
||||
{{else if ne DefaultTheme "gitea"}}
|
||||
<link rel="stylesheet" href="{{AssetUrlPrefix}}/css/theme-{{DefaultTheme}}.css?v={{MD5 AppVer}}">
|
||||
{{end}}
|
||||
```
|
||||
- Vous pouvez aussi récupérer le fichier tout prêt [dans dossier `data--gitea/public/template/custom/` de ce dépôt](https://gitea.zoz-serv.org/Zoz/plex_fr_discord_repo/src/branch/master/docker-compose/gitea/data--gitea/templates/custom/header.tmpl). Il contient en commentaires quelques détails.
|
||||
|
||||
## 2.4. Modification du fichier `/data/gitea/conf/app.ini`
|
||||
|
||||
### 2.4.1. Point info sur la modification de ce fichier
|
||||
|
||||
Pour modifier ce fichier, il se peut que vous n'ayez pas les permissions d'enregistrer les modifications apportées... Il faudra alors le copier ailleurs, faire les modifications et sauvegarder, puis re-copier dans l'autre sens le fichier dans son dossier d'origine.
|
||||
|
||||
C'est ce que je dois faire. Depuis une ligne de commande SSH, je fais :
|
||||
- Je copie le fichier dans un dossier où mon utilisateur Admin à les droits en écriture (je ne me logue pas avec l'utilisateur choisir pour Gitea) : <br>`cp /volume1/docker/gitea/data/gitea/conf/app.ini /volume1/docker/gitea/`
|
||||
- Je modifie et sauvegarde mon fichier...
|
||||
- puis je copie en retour le fichier modifier : `cp /volume1/docker/gitea/app.ini /volume1/docker/gitea/data/gitea/conf/`
|
||||
- Il faut ensuite relancer le conteneur Gitea avec Portainer/DSM ou en CLI : `docker restart gitea`
|
||||
|
||||
### 2.4.2. Ce qu'il faut ajouter au fichier `/data/gitea/conf/app.ini`
|
||||
|
||||
Il faut ajouter ceci au fichier `app.ini` :
|
||||
|
||||
```ini
|
||||
[ui]
|
||||
THEMES = gitea,arc-green,dracula,dracula-test,plex,dark,aquamarine,hotline,hotpink,nord,organizr,overseerr,space-gray,onedark,blackberry-abyss,blackberry-amethyst,blackberry-carol,blackberry-dreamscape,blackberry-flamingo,blackberry-hearth,blackberry-martian,blackberry-pumpkin,blackberry-royal,blackberry-shadow,blackberry-solar,blackberry-vanta
|
||||
DEFAULT_THEME = gitea
|
||||
```
|
||||
> :memo: Note 1 : Il se peut que la section `[ui]` soit déjà présente dans votre `app.ini`, il faudra alors modifier la ligne `THEMES`.
|
||||
> :memo: Note 2 : **Il faut que le thème par défaut soit "gitea" car les nouveaux thèmes de theme.park se base sur celui-là.**
|
||||
|
||||
### 2.4.3. Redémarrer le conteneur
|
||||
|
||||
Il faut bien penser à redémarrer le conteneur une fois le app.ini modifié et copié dans `/data/gitea/conf/`.
|
||||
|
||||
## 2.5. Choisir son thème dans l'interface graphique de Gitea
|
||||
|
||||
![](https://gitea.zoz-serv.org/Zoz/plex_fr_discord_repo/raw/branch/master/docker-compose/gitea/tuto-1.png)
|
||||
|
||||
![](https://gitea.zoz-serv.org/Zoz/plex_fr_discord_repo/raw/branch/master/docker-compose/gitea/tuto-2.png)
|
||||
|
||||
![](https://gitea.zoz-serv.org/Zoz/plex_fr_discord_repo/raw/branch/master/docker-compose/gitea/tuto-3.png)
|
||||
|
||||
|
||||
---
|
||||
|
||||
Voilà, c'est la fin :D
|
||||
|
||||
---
|
47
docker-compose/gitea/data--gitea/public/css/aquamarine.css
Normal file
@ -0,0 +1,47 @@
|
||||
/* dP dP dP */
|
||||
/* 88 88 88 */
|
||||
/* d8888P 88d888b. .d8888b. 88d8b.d8b. .d8888b. 88d888b. .d8888b. 88d888b. 88 .dP */
|
||||
/* 88 88' `88 88ooood8 88'`88'`88 88ooood8 88' `88 88' `88 88' `88 88888" */
|
||||
/* 88 88 88 88. ... 88 88 88 88. ... 88. .88 88. .88 88 88 `8b. */
|
||||
/* dP dP dP `88888P' dP dP dP `88888P' 88 88Y888P' `88888P8 dP dP `YP */
|
||||
/* 88 */
|
||||
/* dP */
|
||||
|
||||
/* Made by @gilbN */
|
||||
/* https://github.com/gilbN/theme.park */
|
||||
|
||||
/* https://docs.theme-park.dev/setup/#stylus-method
|
||||
|
||||
@import "https://theme-park.dev/css/base/<APP_NAME>/<APP_NAME>-base.css";
|
||||
@import "https://theme-park.dev/css/theme-options/THEME.css";
|
||||
|
||||
Nouveaux thèmes avec :
|
||||
@import "https://theme-park.dev/css/base/<APP_NAME>/<APP_NAME>-base.css";
|
||||
@import "https://theme-park.dev/css/theme-options/THEME.css";
|
||||
aquamarine.css
|
||||
dark.css
|
||||
dracula.css
|
||||
hotline.css
|
||||
hotpink.css
|
||||
nord.css
|
||||
organizr.css
|
||||
overseerr.css
|
||||
plex.css
|
||||
space-gray.css
|
||||
|
||||
Nouveaux thèmes avec :
|
||||
@import "https://theme-park.dev/css/base/<APP_NAME>/<APP_NAME>-base.css";
|
||||
@import "https://theme-park.dev/css/community-theme-options/THEME.css";
|
||||
mind.css
|
||||
onedark.css
|
||||
power.css
|
||||
reality.css
|
||||
soul.css
|
||||
space.css
|
||||
time.css
|
||||
... voir ici la liste -> https://github.com/GilbN/theme.park/tree/master/css/community-theme-options
|
||||
*/
|
||||
|
||||
@import "https://theme-park.dev/css/base/gitea/gitea-base.css";
|
||||
@import "https://theme-park.dev/css/base/gitea/chroma.css";
|
||||
@import "https://theme-park.dev/css/theme-options/aquamarine.css";
|
@ -0,0 +1,59 @@
|
||||
/* dP dP dP */
|
||||
/* 88 88 88 */
|
||||
/* d8888P 88d888b. .d8888b. 88d8b.d8b. .d8888b. 88d888b. .d8888b. 88d888b. 88 .dP */
|
||||
/* 88 88' `88 88ooood8 88'`88'`88 88ooood8 88' `88 88' `88 88' `88 88888" */
|
||||
/* 88 88 88 88. ... 88 88 88 88. ... 88. .88 88. .88 88 88 `8b. */
|
||||
/* dP dP dP `88888P' dP dP dP `88888P' 88 88Y888P' `88888P8 dP dP `YP */
|
||||
/* 88 */
|
||||
/* dP */
|
||||
|
||||
/* Made by @gilbN */
|
||||
/* https://github.com/gilbN/theme.park */
|
||||
|
||||
/* https://docs.theme-park.dev/setup/#stylus-method
|
||||
|
||||
@import "https://theme-park.dev/css/base/<APP_NAME>/<APP_NAME>-base.css";
|
||||
@import "https://theme-park.dev/css/theme-options/THEME.css";
|
||||
|
||||
Nouveaux thèmes avec :
|
||||
@import "https://theme-park.dev/css/base/<APP_NAME>/<APP_NAME>-base.css";
|
||||
@import "https://theme-park.dev/css/theme-options/THEME.css";
|
||||
aquamarine.css
|
||||
dark.css
|
||||
dracula.css
|
||||
hotline.css
|
||||
hotpink.css
|
||||
nord.css
|
||||
organizr.css
|
||||
overseerr.css
|
||||
plex.css
|
||||
space-gray.css
|
||||
|
||||
Nouveaux thèmes avec :
|
||||
@import "https://theme-park.dev/css/base/<APP_NAME>/<APP_NAME>-base.css";
|
||||
@import "https://theme-park.dev/css/community-theme-options/THEME.css";
|
||||
blackberry-abyss.css
|
||||
blackberry-amethyst.css
|
||||
blackberry-carol.css
|
||||
blackberry-dreamscape.css
|
||||
blackberry-flamingo.css
|
||||
blackberry-hearth.css
|
||||
blackberry-martian.css
|
||||
blackberry-pumpkin.css
|
||||
blackberry-royal.css
|
||||
blackberry-shadow.css
|
||||
blackberry-solar.css
|
||||
blackberry-vanta.css
|
||||
mind.css
|
||||
onedark.css
|
||||
power.css
|
||||
reality.css
|
||||
soul.css
|
||||
space.css
|
||||
time.css
|
||||
... voir ici la liste -> https://github.com/GilbN/theme.park/tree/master/css/community-theme-options
|
||||
*/
|
||||
|
||||
@import "https://theme-park.dev/css/base/gitea/gitea-base.css";
|
||||
@import "https://theme-park.dev/css/base/gitea/chroma.css";
|
||||
@import "https://theme-park.dev/css/community-theme-options/blackberry-abyss.css";
|
@ -0,0 +1,59 @@
|
||||
/* dP dP dP */
|
||||
/* 88 88 88 */
|
||||
/* d8888P 88d888b. .d8888b. 88d8b.d8b. .d8888b. 88d888b. .d8888b. 88d888b. 88 .dP */
|
||||
/* 88 88' `88 88ooood8 88'`88'`88 88ooood8 88' `88 88' `88 88' `88 88888" */
|
||||
/* 88 88 88 88. ... 88 88 88 88. ... 88. .88 88. .88 88 88 `8b. */
|
||||
/* dP dP dP `88888P' dP dP dP `88888P' 88 88Y888P' `88888P8 dP dP `YP */
|
||||
/* 88 */
|
||||
/* dP */
|
||||
|
||||
/* Made by @gilbN */
|
||||
/* https://github.com/gilbN/theme.park */
|
||||
|
||||
/* https://docs.theme-park.dev/setup/#stylus-method
|
||||
|
||||
@import "https://theme-park.dev/css/base/<APP_NAME>/<APP_NAME>-base.css";
|
||||
@import "https://theme-park.dev/css/theme-options/THEME.css";
|
||||
|
||||
Nouveaux thèmes avec :
|
||||
@import "https://theme-park.dev/css/base/<APP_NAME>/<APP_NAME>-base.css";
|
||||
@import "https://theme-park.dev/css/theme-options/THEME.css";
|
||||
aquamarine.css
|
||||
dark.css
|
||||
dracula.css
|
||||
hotline.css
|
||||
hotpink.css
|
||||
nord.css
|
||||
organizr.css
|
||||
overseerr.css
|
||||
plex.css
|
||||
space-gray.css
|
||||
|
||||
Nouveaux thèmes avec :
|
||||
@import "https://theme-park.dev/css/base/<APP_NAME>/<APP_NAME>-base.css";
|
||||
@import "https://theme-park.dev/css/community-theme-options/THEME.css";
|
||||
blackberry-abyss.css
|
||||
blackberry-amethyst.css
|
||||
blackberry-carol.css
|
||||
blackberry-dreamscape.css
|
||||
blackberry-flamingo.css
|
||||
blackberry-hearth.css
|
||||
blackberry-martian.css
|
||||
blackberry-pumpkin.css
|
||||
blackberry-royal.css
|
||||
blackberry-shadow.css
|
||||
blackberry-solar.css
|
||||
blackberry-vanta.css
|
||||
mind.css
|
||||
onedark.css
|
||||
power.css
|
||||
reality.css
|
||||
soul.css
|
||||
space.css
|
||||
time.css
|
||||
... voir ici la liste -> https://github.com/GilbN/theme.park/tree/master/css/community-theme-options
|
||||
*/
|
||||
|
||||
@import "https://theme-park.dev/css/base/gitea/gitea-base.css";
|
||||
@import "https://theme-park.dev/css/base/gitea/chroma.css";
|
||||
@import "https://theme-park.dev/css/community-theme-options/blackberry-amethyst.css";
|
@ -0,0 +1,59 @@
|
||||
/* dP dP dP */
|
||||
/* 88 88 88 */
|
||||
/* d8888P 88d888b. .d8888b. 88d8b.d8b. .d8888b. 88d888b. .d8888b. 88d888b. 88 .dP */
|
||||
/* 88 88' `88 88ooood8 88'`88'`88 88ooood8 88' `88 88' `88 88' `88 88888" */
|
||||
/* 88 88 88 88. ... 88 88 88 88. ... 88. .88 88. .88 88 88 `8b. */
|
||||
/* dP dP dP `88888P' dP dP dP `88888P' 88 88Y888P' `88888P8 dP dP `YP */
|
||||
/* 88 */
|
||||
/* dP */
|
||||
|
||||
/* Made by @gilbN */
|
||||
/* https://github.com/gilbN/theme.park */
|
||||
|
||||
/* https://docs.theme-park.dev/setup/#stylus-method
|
||||
|
||||
@import "https://theme-park.dev/css/base/<APP_NAME>/<APP_NAME>-base.css";
|
||||
@import "https://theme-park.dev/css/theme-options/THEME.css";
|
||||
|
||||
Nouveaux thèmes avec :
|
||||
@import "https://theme-park.dev/css/base/<APP_NAME>/<APP_NAME>-base.css";
|
||||
@import "https://theme-park.dev/css/theme-options/THEME.css";
|
||||
aquamarine.css
|
||||
dark.css
|
||||
dracula.css
|
||||
hotline.css
|
||||
hotpink.css
|
||||
nord.css
|
||||
organizr.css
|
||||
overseerr.css
|
||||
plex.css
|
||||
space-gray.css
|
||||
|
||||
Nouveaux thèmes avec :
|
||||
@import "https://theme-park.dev/css/base/<APP_NAME>/<APP_NAME>-base.css";
|
||||
@import "https://theme-park.dev/css/community-theme-options/THEME.css";
|
||||
blackberry-abyss.css
|
||||
blackberry-amethyst.css
|
||||
blackberry-carol.css
|
||||
blackberry-dreamscape.css
|
||||
blackberry-flamingo.css
|
||||
blackberry-hearth.css
|
||||
blackberry-martian.css
|
||||
blackberry-pumpkin.css
|
||||
blackberry-royal.css
|
||||
blackberry-shadow.css
|
||||
blackberry-solar.css
|
||||
blackberry-vanta.css
|
||||
mind.css
|
||||
onedark.css
|
||||
power.css
|
||||
reality.css
|
||||
soul.css
|
||||
space.css
|
||||
time.css
|
||||
... voir ici la liste -> https://github.com/GilbN/theme.park/tree/master/css/community-theme-options
|
||||
*/
|
||||
|
||||
@import "https://theme-park.dev/css/base/gitea/gitea-base.css";
|
||||
@import "https://theme-park.dev/css/base/gitea/chroma.css";
|
||||
@import "https://theme-park.dev/css/community-theme-options/blackberry-carol.css";
|
@ -0,0 +1,59 @@
|
||||
/* dP dP dP */
|
||||
/* 88 88 88 */
|
||||
/* d8888P 88d888b. .d8888b. 88d8b.d8b. .d8888b. 88d888b. .d8888b. 88d888b. 88 .dP */
|
||||
/* 88 88' `88 88ooood8 88'`88'`88 88ooood8 88' `88 88' `88 88' `88 88888" */
|
||||
/* 88 88 88 88. ... 88 88 88 88. ... 88. .88 88. .88 88 88 `8b. */
|
||||
/* dP dP dP `88888P' dP dP dP `88888P' 88 88Y888P' `88888P8 dP dP `YP */
|
||||
/* 88 */
|
||||
/* dP */
|
||||
|
||||
/* Made by @gilbN */
|
||||
/* https://github.com/gilbN/theme.park */
|
||||
|
||||
/* https://docs.theme-park.dev/setup/#stylus-method
|
||||
|
||||
@import "https://theme-park.dev/css/base/<APP_NAME>/<APP_NAME>-base.css";
|
||||
@import "https://theme-park.dev/css/theme-options/THEME.css";
|
||||
|
||||
Nouveaux thèmes avec :
|
||||
@import "https://theme-park.dev/css/base/<APP_NAME>/<APP_NAME>-base.css";
|
||||
@import "https://theme-park.dev/css/theme-options/THEME.css";
|
||||
aquamarine.css
|
||||
dark.css
|
||||
dracula.css
|
||||
hotline.css
|
||||
hotpink.css
|
||||
nord.css
|
||||
organizr.css
|
||||
overseerr.css
|
||||
plex.css
|
||||
space-gray.css
|
||||
|
||||
Nouveaux thèmes avec :
|
||||
@import "https://theme-park.dev/css/base/<APP_NAME>/<APP_NAME>-base.css";
|
||||
@import "https://theme-park.dev/css/community-theme-options/THEME.css";
|
||||
blackberry-abyss.css
|
||||
blackberry-amethyst.css
|
||||
blackberry-carol.css
|
||||
blackberry-dreamscape.css
|
||||
blackberry-flamingo.css
|
||||
blackberry-hearth.css
|
||||
blackberry-martian.css
|
||||
blackberry-pumpkin.css
|
||||
blackberry-royal.css
|
||||
blackberry-shadow.css
|
||||
blackberry-solar.css
|
||||
blackberry-vanta.css
|
||||
mind.css
|
||||
onedark.css
|
||||
power.css
|
||||
reality.css
|
||||
soul.css
|
||||
space.css
|
||||
time.css
|
||||
... voir ici la liste -> https://github.com/GilbN/theme.park/tree/master/css/community-theme-options
|
||||
*/
|
||||
|
||||
@import "https://theme-park.dev/css/base/gitea/gitea-base.css";
|
||||
@import "https://theme-park.dev/css/base/gitea/chroma.css";
|
||||
@import "https://theme-park.dev/css/community-theme-options/blackberry-dreamscape.css";
|
@ -0,0 +1,59 @@
|
||||
/* dP dP dP */
|
||||
/* 88 88 88 */
|
||||
/* d8888P 88d888b. .d8888b. 88d8b.d8b. .d8888b. 88d888b. .d8888b. 88d888b. 88 .dP */
|
||||
/* 88 88' `88 88ooood8 88'`88'`88 88ooood8 88' `88 88' `88 88' `88 88888" */
|
||||
/* 88 88 88 88. ... 88 88 88 88. ... 88. .88 88. .88 88 88 `8b. */
|
||||
/* dP dP dP `88888P' dP dP dP `88888P' 88 88Y888P' `88888P8 dP dP `YP */
|
||||
/* 88 */
|
||||
/* dP */
|
||||
|
||||
/* Made by @gilbN */
|
||||
/* https://github.com/gilbN/theme.park */
|
||||
|
||||
/* https://docs.theme-park.dev/setup/#stylus-method
|
||||
|
||||
@import "https://theme-park.dev/css/base/<APP_NAME>/<APP_NAME>-base.css";
|
||||
@import "https://theme-park.dev/css/theme-options/THEME.css";
|
||||
|
||||
Nouveaux thèmes avec :
|
||||
@import "https://theme-park.dev/css/base/<APP_NAME>/<APP_NAME>-base.css";
|
||||
@import "https://theme-park.dev/css/theme-options/THEME.css";
|
||||
aquamarine.css
|
||||
dark.css
|
||||
dracula.css
|
||||
hotline.css
|
||||
hotpink.css
|
||||
nord.css
|
||||
organizr.css
|
||||
overseerr.css
|
||||
plex.css
|
||||
space-gray.css
|
||||
|
||||
Nouveaux thèmes avec :
|
||||
@import "https://theme-park.dev/css/base/<APP_NAME>/<APP_NAME>-base.css";
|
||||
@import "https://theme-park.dev/css/community-theme-options/THEME.css";
|
||||
blackberry-abyss.css
|
||||
blackberry-amethyst.css
|
||||
blackberry-carol.css
|
||||
blackberry-dreamscape.css
|
||||
blackberry-flamingo.css
|
||||
blackberry-hearth.css
|
||||
blackberry-martian.css
|
||||
blackberry-pumpkin.css
|
||||
blackberry-royal.css
|
||||
blackberry-shadow.css
|
||||
blackberry-solar.css
|
||||
blackberry-vanta.css
|
||||
mind.css
|
||||
onedark.css
|
||||
power.css
|
||||
reality.css
|
||||
soul.css
|
||||
space.css
|
||||
time.css
|
||||
... voir ici la liste -> https://github.com/GilbN/theme.park/tree/master/css/community-theme-options
|
||||
*/
|
||||
|
||||
@import "https://theme-park.dev/css/base/gitea/gitea-base.css";
|
||||
@import "https://theme-park.dev/css/base/gitea/chroma.css";
|
||||
@import "https://theme-park.dev/css/community-theme-options/blackberry-flamingo.css";
|
@ -0,0 +1,59 @@
|
||||
/* dP dP dP */
|
||||
/* 88 88 88 */
|
||||
/* d8888P 88d888b. .d8888b. 88d8b.d8b. .d8888b. 88d888b. .d8888b. 88d888b. 88 .dP */
|
||||
/* 88 88' `88 88ooood8 88'`88'`88 88ooood8 88' `88 88' `88 88' `88 88888" */
|
||||
/* 88 88 88 88. ... 88 88 88 88. ... 88. .88 88. .88 88 88 `8b. */
|
||||
/* dP dP dP `88888P' dP dP dP `88888P' 88 88Y888P' `88888P8 dP dP `YP */
|
||||
/* 88 */
|
||||
/* dP */
|
||||
|
||||
/* Made by @gilbN */
|
||||
/* https://github.com/gilbN/theme.park */
|
||||
|
||||
/* https://docs.theme-park.dev/setup/#stylus-method
|
||||
|
||||
@import "https://theme-park.dev/css/base/<APP_NAME>/<APP_NAME>-base.css";
|
||||
@import "https://theme-park.dev/css/theme-options/THEME.css";
|
||||
|
||||
Nouveaux thèmes avec :
|
||||
@import "https://theme-park.dev/css/base/<APP_NAME>/<APP_NAME>-base.css";
|
||||
@import "https://theme-park.dev/css/theme-options/THEME.css";
|
||||
aquamarine.css
|
||||
dark.css
|
||||
dracula.css
|
||||
hotline.css
|
||||
hotpink.css
|
||||
nord.css
|
||||
organizr.css
|
||||
overseerr.css
|
||||
plex.css
|
||||
space-gray.css
|
||||
|
||||
Nouveaux thèmes avec :
|
||||
@import "https://theme-park.dev/css/base/<APP_NAME>/<APP_NAME>-base.css";
|
||||
@import "https://theme-park.dev/css/community-theme-options/THEME.css";
|
||||
blackberry-abyss.css
|
||||
blackberry-amethyst.css
|
||||
blackberry-carol.css
|
||||
blackberry-dreamscape.css
|
||||
blackberry-flamingo.css
|
||||
blackberry-hearth.css
|
||||
blackberry-martian.css
|
||||
blackberry-pumpkin.css
|
||||
blackberry-royal.css
|
||||
blackberry-shadow.css
|
||||
blackberry-solar.css
|
||||
blackberry-vanta.css
|
||||
mind.css
|
||||
onedark.css
|
||||
power.css
|
||||
reality.css
|
||||
soul.css
|
||||
space.css
|
||||
time.css
|
||||
... voir ici la liste -> https://github.com/GilbN/theme.park/tree/master/css/community-theme-options
|
||||
*/
|
||||
|
||||
@import "https://theme-park.dev/css/base/gitea/gitea-base.css";
|
||||
@import "https://theme-park.dev/css/base/gitea/chroma.css";
|
||||
@import "https://theme-park.dev/css/community-theme-options/blackberry-hearth.css";
|
@ -0,0 +1,59 @@
|
||||
/* dP dP dP */
|
||||
/* 88 88 88 */
|
||||
/* d8888P 88d888b. .d8888b. 88d8b.d8b. .d8888b. 88d888b. .d8888b. 88d888b. 88 .dP */
|
||||
/* 88 88' `88 88ooood8 88'`88'`88 88ooood8 88' `88 88' `88 88' `88 88888" */
|
||||
/* 88 88 88 88. ... 88 88 88 88. ... 88. .88 88. .88 88 88 `8b. */
|
||||
/* dP dP dP `88888P' dP dP dP `88888P' 88 88Y888P' `88888P8 dP dP `YP */
|
||||
/* 88 */
|
||||
/* dP */
|
||||
|
||||
/* Made by @gilbN */
|
||||
/* https://github.com/gilbN/theme.park */
|
||||
|
||||
/* https://docs.theme-park.dev/setup/#stylus-method
|
||||
|
||||
@import "https://theme-park.dev/css/base/<APP_NAME>/<APP_NAME>-base.css";
|
||||
@import "https://theme-park.dev/css/theme-options/THEME.css";
|
||||
|
||||
Nouveaux thèmes avec :
|
||||
@import "https://theme-park.dev/css/base/<APP_NAME>/<APP_NAME>-base.css";
|
||||
@import "https://theme-park.dev/css/theme-options/THEME.css";
|
||||
aquamarine.css
|
||||
dark.css
|
||||
dracula.css
|
||||
hotline.css
|
||||
hotpink.css
|
||||
nord.css
|
||||
organizr.css
|
||||
overseerr.css
|
||||
plex.css
|
||||
space-gray.css
|
||||
|
||||
Nouveaux thèmes avec :
|
||||
@import "https://theme-park.dev/css/base/<APP_NAME>/<APP_NAME>-base.css";
|
||||
@import "https://theme-park.dev/css/community-theme-options/THEME.css";
|
||||
blackberry-abyss.css
|
||||
blackberry-amethyst.css
|
||||
blackberry-carol.css
|
||||
blackberry-dreamscape.css
|
||||
blackberry-flamingo.css
|
||||
blackberry-hearth.css
|
||||
blackberry-martian.css
|
||||
blackberry-pumpkin.css
|
||||
blackberry-royal.css
|
||||
blackberry-shadow.css
|
||||
blackberry-solar.css
|
||||
blackberry-vanta.css
|
||||
mind.css
|
||||
onedark.css
|
||||
power.css
|
||||
reality.css
|
||||
soul.css
|
||||
space.css
|
||||
time.css
|
||||
... voir ici la liste -> https://github.com/GilbN/theme.park/tree/master/css/community-theme-options
|
||||
*/
|
||||
|
||||
@import "https://theme-park.dev/css/base/gitea/gitea-base.css";
|
||||
@import "https://theme-park.dev/css/base/gitea/chroma.css";
|
||||
@import "https://theme-park.dev/css/community-theme-options/blackberry-martian.css";
|
@ -0,0 +1,59 @@
|
||||
/* dP dP dP */
|
||||
/* 88 88 88 */
|
||||
/* d8888P 88d888b. .d8888b. 88d8b.d8b. .d8888b. 88d888b. .d8888b. 88d888b. 88 .dP */
|
||||
/* 88 88' `88 88ooood8 88'`88'`88 88ooood8 88' `88 88' `88 88' `88 88888" */
|
||||
/* 88 88 88 88. ... 88 88 88 88. ... 88. .88 88. .88 88 88 `8b. */
|
||||
/* dP dP dP `88888P' dP dP dP `88888P' 88 88Y888P' `88888P8 dP dP `YP */
|
||||
/* 88 */
|
||||
/* dP */
|
||||
|
||||
/* Made by @gilbN */
|
||||
/* https://github.com/gilbN/theme.park */
|
||||
|
||||
/* https://docs.theme-park.dev/setup/#stylus-method
|
||||
|
||||
@import "https://theme-park.dev/css/base/<APP_NAME>/<APP_NAME>-base.css";
|
||||
@import "https://theme-park.dev/css/theme-options/THEME.css";
|
||||
|
||||
Nouveaux thèmes avec :
|
||||
@import "https://theme-park.dev/css/base/<APP_NAME>/<APP_NAME>-base.css";
|
||||
@import "https://theme-park.dev/css/theme-options/THEME.css";
|
||||
aquamarine.css
|
||||
dark.css
|
||||
dracula.css
|
||||
hotline.css
|
||||
hotpink.css
|
||||
nord.css
|
||||
organizr.css
|
||||
overseerr.css
|
||||
plex.css
|
||||
space-gray.css
|
||||
|
||||
Nouveaux thèmes avec :
|
||||
@import "https://theme-park.dev/css/base/<APP_NAME>/<APP_NAME>-base.css";
|
||||
@import "https://theme-park.dev/css/community-theme-options/THEME.css";
|
||||
blackberry-abyss.css
|
||||
blackberry-amethyst.css
|
||||
blackberry-carol.css
|
||||
blackberry-dreamscape.css
|
||||
blackberry-flamingo.css
|
||||
blackberry-hearth.css
|
||||
blackberry-martian.css
|
||||
blackberry-pumpkin.css
|
||||
blackberry-royal.css
|
||||
blackberry-shadow.css
|
||||
blackberry-solar.css
|
||||
blackberry-vanta.css
|
||||
mind.css
|
||||
onedark.css
|
||||
power.css
|
||||
reality.css
|
||||
soul.css
|
||||
space.css
|
||||
time.css
|
||||
... voir ici la liste -> https://github.com/GilbN/theme.park/tree/master/css/community-theme-options
|
||||
*/
|
||||
|
||||
@import "https://theme-park.dev/css/base/gitea/gitea-base.css";
|
||||
@import "https://theme-park.dev/css/base/gitea/chroma.css";
|
||||
@import "https://theme-park.dev/css/community-theme-options/blackberry-pumpkin.css";
|
@ -0,0 +1,59 @@
|
||||
/* dP dP dP */
|
||||
/* 88 88 88 */
|
||||
/* d8888P 88d888b. .d8888b. 88d8b.d8b. .d8888b. 88d888b. .d8888b. 88d888b. 88 .dP */
|
||||
/* 88 88' `88 88ooood8 88'`88'`88 88ooood8 88' `88 88' `88 88' `88 88888" */
|
||||
/* 88 88 88 88. ... 88 88 88 88. ... 88. .88 88. .88 88 88 `8b. */
|
||||
/* dP dP dP `88888P' dP dP dP `88888P' 88 88Y888P' `88888P8 dP dP `YP */
|
||||
/* 88 */
|
||||
/* dP */
|
||||
|
||||
/* Made by @gilbN */
|
||||
/* https://github.com/gilbN/theme.park */
|
||||
|
||||
/* https://docs.theme-park.dev/setup/#stylus-method
|
||||
|
||||
@import "https://theme-park.dev/css/base/<APP_NAME>/<APP_NAME>-base.css";
|
||||
@import "https://theme-park.dev/css/theme-options/THEME.css";
|
||||
|
||||
Nouveaux thèmes avec :
|
||||
@import "https://theme-park.dev/css/base/<APP_NAME>/<APP_NAME>-base.css";
|
||||
@import "https://theme-park.dev/css/theme-options/THEME.css";
|
||||
aquamarine.css
|
||||
dark.css
|
||||
dracula.css
|
||||
hotline.css
|
||||
hotpink.css
|
||||
nord.css
|
||||
organizr.css
|
||||
overseerr.css
|
||||
plex.css
|
||||
space-gray.css
|
||||
|
||||
Nouveaux thèmes avec :
|
||||
@import "https://theme-park.dev/css/base/<APP_NAME>/<APP_NAME>-base.css";
|
||||
@import "https://theme-park.dev/css/community-theme-options/THEME.css";
|
||||
blackberry-abyss.css
|
||||
blackberry-amethyst.css
|
||||
blackberry-carol.css
|
||||
blackberry-dreamscape.css
|
||||
blackberry-flamingo.css
|
||||
blackberry-hearth.css
|
||||
blackberry-martian.css
|
||||
blackberry-pumpkin.css
|
||||
blackberry-royal.css
|
||||
blackberry-shadow.css
|
||||
blackberry-solar.css
|
||||
blackberry-vanta.css
|
||||
mind.css
|
||||
onedark.css
|
||||
power.css
|
||||
reality.css
|
||||
soul.css
|
||||
space.css
|
||||
time.css
|
||||
... voir ici la liste -> https://github.com/GilbN/theme.park/tree/master/css/community-theme-options
|
||||
*/
|
||||
|
||||
@import "https://theme-park.dev/css/base/gitea/gitea-base.css";
|
||||
@import "https://theme-park.dev/css/base/gitea/chroma.css";
|
||||
@import "https://theme-park.dev/css/community-theme-options/blackberry-royal.css";
|
@ -0,0 +1,59 @@
|
||||
/* dP dP dP */
|
||||
/* 88 88 88 */
|
||||
/* d8888P 88d888b. .d8888b. 88d8b.d8b. .d8888b. 88d888b. .d8888b. 88d888b. 88 .dP */
|
||||
/* 88 88' `88 88ooood8 88'`88'`88 88ooood8 88' `88 88' `88 88' `88 88888" */
|
||||
/* 88 88 88 88. ... 88 88 88 88. ... 88. .88 88. .88 88 88 `8b. */
|
||||
/* dP dP dP `88888P' dP dP dP `88888P' 88 88Y888P' `88888P8 dP dP `YP */
|
||||
/* 88 */
|
||||
/* dP */
|
||||
|
||||
/* Made by @gilbN */
|
||||
/* https://github.com/gilbN/theme.park */
|
||||
|
||||
/* https://docs.theme-park.dev/setup/#stylus-method
|
||||
|
||||
@import "https://theme-park.dev/css/base/<APP_NAME>/<APP_NAME>-base.css";
|
||||
@import "https://theme-park.dev/css/theme-options/THEME.css";
|
||||
|
||||
Nouveaux thèmes avec :
|
||||
@import "https://theme-park.dev/css/base/<APP_NAME>/<APP_NAME>-base.css";
|
||||
@import "https://theme-park.dev/css/theme-options/THEME.css";
|
||||
aquamarine.css
|
||||
dark.css
|
||||
dracula.css
|
||||
hotline.css
|
||||
hotpink.css
|
||||
nord.css
|
||||
organizr.css
|
||||
overseerr.css
|
||||
plex.css
|
||||
space-gray.css
|
||||
|
||||
Nouveaux thèmes avec :
|
||||
@import "https://theme-park.dev/css/base/<APP_NAME>/<APP_NAME>-base.css";
|
||||
@import "https://theme-park.dev/css/community-theme-options/THEME.css";
|
||||
blackberry-abyss.css
|
||||
blackberry-amethyst.css
|
||||
blackberry-carol.css
|
||||
blackberry-dreamscape.css
|
||||
blackberry-flamingo.css
|
||||
blackberry-hearth.css
|
||||
blackberry-martian.css
|
||||
blackberry-pumpkin.css
|
||||
blackberry-royal.css
|
||||
blackberry-shadow.css
|
||||
blackberry-solar.css
|
||||
blackberry-vanta.css
|
||||
mind.css
|
||||
onedark.css
|
||||
power.css
|
||||
reality.css
|
||||
soul.css
|
||||
space.css
|
||||
time.css
|
||||
... voir ici la liste -> https://github.com/GilbN/theme.park/tree/master/css/community-theme-options
|
||||
*/
|
||||
|
||||
@import "https://theme-park.dev/css/base/gitea/gitea-base.css";
|
||||
@import "https://theme-park.dev/css/base/gitea/chroma.css";
|
||||
@import "https://theme-park.dev/css/community-theme-options/blackberry-shadow.css";
|
@ -0,0 +1,59 @@
|
||||
/* dP dP dP */
|
||||
/* 88 88 88 */
|
||||
/* d8888P 88d888b. .d8888b. 88d8b.d8b. .d8888b. 88d888b. .d8888b. 88d888b. 88 .dP */
|
||||
/* 88 88' `88 88ooood8 88'`88'`88 88ooood8 88' `88 88' `88 88' `88 88888" */
|
||||
/* 88 88 88 88. ... 88 88 88 88. ... 88. .88 88. .88 88 88 `8b. */
|
||||
/* dP dP dP `88888P' dP dP dP `88888P' 88 88Y888P' `88888P8 dP dP `YP */
|
||||
/* 88 */
|
||||
/* dP */
|
||||
|
||||
/* Made by @gilbN */
|
||||
/* https://github.com/gilbN/theme.park */
|
||||
|
||||
/* https://docs.theme-park.dev/setup/#stylus-method
|
||||
|
||||
@import "https://theme-park.dev/css/base/<APP_NAME>/<APP_NAME>-base.css";
|
||||
@import "https://theme-park.dev/css/theme-options/THEME.css";
|
||||
|
||||
Nouveaux thèmes avec :
|
||||
@import "https://theme-park.dev/css/base/<APP_NAME>/<APP_NAME>-base.css";
|
||||
@import "https://theme-park.dev/css/theme-options/THEME.css";
|
||||
aquamarine.css
|
||||
dark.css
|
||||
dracula.css
|
||||
hotline.css
|
||||
hotpink.css
|
||||
nord.css
|
||||
organizr.css
|
||||
overseerr.css
|
||||
plex.css
|
||||
space-gray.css
|
||||
|
||||
Nouveaux thèmes avec :
|
||||
@import "https://theme-park.dev/css/base/<APP_NAME>/<APP_NAME>-base.css";
|
||||
@import "https://theme-park.dev/css/community-theme-options/THEME.css";
|
||||
blackberry-abyss.css
|
||||
blackberry-amethyst.css
|
||||
blackberry-carol.css
|
||||
blackberry-dreamscape.css
|
||||
blackberry-flamingo.css
|
||||
blackberry-hearth.css
|
||||
blackberry-martian.css
|
||||
blackberry-pumpkin.css
|
||||
blackberry-royal.css
|
||||
blackberry-shadow.css
|
||||
blackberry-solar.css
|
||||
blackberry-vanta.css
|
||||
mind.css
|
||||
onedark.css
|
||||
power.css
|
||||
reality.css
|
||||
soul.css
|
||||
space.css
|
||||
time.css
|
||||
... voir ici la liste -> https://github.com/GilbN/theme.park/tree/master/css/community-theme-options
|
||||
*/
|
||||
|
||||
@import "https://theme-park.dev/css/base/gitea/gitea-base.css";
|
||||
@import "https://theme-park.dev/css/base/gitea/chroma.css";
|
||||
@import "https://theme-park.dev/css/community-theme-options/blackberry-solar.css";
|
@ -0,0 +1,59 @@
|
||||
/* dP dP dP */
|
||||
/* 88 88 88 */
|
||||
/* d8888P 88d888b. .d8888b. 88d8b.d8b. .d8888b. 88d888b. .d8888b. 88d888b. 88 .dP */
|
||||
/* 88 88' `88 88ooood8 88'`88'`88 88ooood8 88' `88 88' `88 88' `88 88888" */
|
||||
/* 88 88 88 88. ... 88 88 88 88. ... 88. .88 88. .88 88 88 `8b. */
|
||||
/* dP dP dP `88888P' dP dP dP `88888P' 88 88Y888P' `88888P8 dP dP `YP */
|
||||
/* 88 */
|
||||
/* dP */
|
||||
|
||||
/* Made by @gilbN */
|
||||
/* https://github.com/gilbN/theme.park */
|
||||
|
||||
/* https://docs.theme-park.dev/setup/#stylus-method
|
||||
|
||||
@import "https://theme-park.dev/css/base/<APP_NAME>/<APP_NAME>-base.css";
|
||||
@import "https://theme-park.dev/css/theme-options/THEME.css";
|
||||
|
||||
Nouveaux thèmes avec :
|
||||
@import "https://theme-park.dev/css/base/<APP_NAME>/<APP_NAME>-base.css";
|
||||
@import "https://theme-park.dev/css/theme-options/THEME.css";
|
||||
aquamarine.css
|
||||
dark.css
|
||||
dracula.css
|
||||
hotline.css
|
||||
hotpink.css
|
||||
nord.css
|
||||
organizr.css
|
||||
overseerr.css
|
||||
plex.css
|
||||
space-gray.css
|
||||
|
||||
Nouveaux thèmes avec :
|
||||
@import "https://theme-park.dev/css/base/<APP_NAME>/<APP_NAME>-base.css";
|
||||
@import "https://theme-park.dev/css/community-theme-options/THEME.css";
|
||||
blackberry-abyss.css
|
||||
blackberry-amethyst.css
|
||||
blackberry-carol.css
|
||||
blackberry-dreamscape.css
|
||||
blackberry-flamingo.css
|
||||
blackberry-hearth.css
|
||||
blackberry-martian.css
|
||||
blackberry-pumpkin.css
|
||||
blackberry-royal.css
|
||||
blackberry-shadow.css
|
||||
blackberry-solar.css
|
||||
blackberry-vanta.css
|
||||
mind.css
|
||||
onedark.css
|
||||
power.css
|
||||
reality.css
|
||||
soul.css
|
||||
space.css
|
||||
time.css
|
||||
... voir ici la liste -> https://github.com/GilbN/theme.park/tree/master/css/community-theme-options
|
||||
*/
|
||||
|
||||
@import "https://theme-park.dev/css/base/gitea/gitea-base.css";
|
||||
@import "https://theme-park.dev/css/base/gitea/chroma.css";
|
||||
@import "https://theme-park.dev/css/community-theme-options/blackberry-vanta.css";
|
47
docker-compose/gitea/data--gitea/public/css/dark.css
Normal file
@ -0,0 +1,47 @@
|
||||
/* dP dP dP */
|
||||
/* 88 88 88 */
|
||||
/* d8888P 88d888b. .d8888b. 88d8b.d8b. .d8888b. 88d888b. .d8888b. 88d888b. 88 .dP */
|
||||
/* 88 88' `88 88ooood8 88'`88'`88 88ooood8 88' `88 88' `88 88' `88 88888" */
|
||||
/* 88 88 88 88. ... 88 88 88 88. ... 88. .88 88. .88 88 88 `8b. */
|
||||
/* dP dP dP `88888P' dP dP dP `88888P' 88 88Y888P' `88888P8 dP dP `YP */
|
||||
/* 88 */
|
||||
/* dP */
|
||||
|
||||
/* Made by @gilbN */
|
||||
/* https://github.com/gilbN/theme.park */
|
||||
|
||||
/* https://docs.theme-park.dev/setup/#stylus-method
|
||||
|
||||
@import "https://theme-park.dev/css/base/<APP_NAME>/<APP_NAME>-base.css";
|
||||
@import "https://theme-park.dev/css/theme-options/THEME.css";
|
||||
|
||||
Nouveaux thèmes avec :
|
||||
@import "https://theme-park.dev/css/base/<APP_NAME>/<APP_NAME>-base.css";
|
||||
@import "https://theme-park.dev/css/theme-options/THEME.css";
|
||||
aquamarine.css
|
||||
dark.css
|
||||
dracula.css
|
||||
hotline.css
|
||||
hotpink.css
|
||||
nord.css
|
||||
organizr.css
|
||||
overseerr.css
|
||||
plex.css
|
||||
space-gray.css
|
||||
|
||||
Nouveaux thèmes avec :
|
||||
@import "https://theme-park.dev/css/base/<APP_NAME>/<APP_NAME>-base.css";
|
||||
@import "https://theme-park.dev/css/community-theme-options/THEME.css";
|
||||
mind.css
|
||||
onedark.css
|
||||
power.css
|
||||
reality.css
|
||||
soul.css
|
||||
space.css
|
||||
time.css
|
||||
... voir ici la liste -> https://github.com/GilbN/theme.park/tree/master/css/community-theme-options
|
||||
*/
|
||||
|
||||
@import "https://theme-park.dev/css/base/gitea/gitea-base.css";
|
||||
@import "https://theme-park.dev/css/base/gitea/chroma.css";
|
||||
@import "https://theme-park.dev/css/theme-options/dark.css";
|
47
docker-compose/gitea/data--gitea/public/css/dracula-test.css
Normal file
@ -0,0 +1,47 @@
|
||||
/* dP dP dP */
|
||||
/* 88 88 88 */
|
||||
/* d8888P 88d888b. .d8888b. 88d8b.d8b. .d8888b. 88d888b. .d8888b. 88d888b. 88 .dP */
|
||||
/* 88 88' `88 88ooood8 88'`88'`88 88ooood8 88' `88 88' `88 88' `88 88888" */
|
||||
/* 88 88 88 88. ... 88 88 88 88. ... 88. .88 88. .88 88 88 `8b. */
|
||||
/* dP dP dP `88888P' dP dP dP `88888P' 88 88Y888P' `88888P8 dP dP `YP */
|
||||
/* 88 */
|
||||
/* dP */
|
||||
|
||||
/* Made by @gilbN */
|
||||
/* https://github.com/gilbN/theme.park */
|
||||
|
||||
/* https://docs.theme-park.dev/setup/#stylus-method
|
||||
|
||||
@import "https://theme-park.dev/css/base/<APP_NAME>/<APP_NAME>-base.css";
|
||||
@import "https://theme-park.dev/css/theme-options/THEME.css";
|
||||
|
||||
Nouveaux thèmes avec :
|
||||
@import "https://theme-park.dev/css/base/<APP_NAME>/<APP_NAME>-base.css";
|
||||
@import "https://theme-park.dev/css/theme-options/THEME.css";
|
||||
aquamarine.css
|
||||
dark.css
|
||||
dracula.css
|
||||
hotline.css
|
||||
hotpink.css
|
||||
nord.css
|
||||
organizr.css
|
||||
overseerr.css
|
||||
plex.css
|
||||
space-gray.css
|
||||
|
||||
Nouveaux thèmes avec :
|
||||
@import "https://theme-park.dev/css/base/<APP_NAME>/<APP_NAME>-base.css";
|
||||
@import "https://theme-park.dev/css/community-theme-options/THEME.css";
|
||||
mind.css
|
||||
onedark.css
|
||||
power.css
|
||||
reality.css
|
||||
soul.css
|
||||
space.css
|
||||
time.css
|
||||
... voir ici la liste -> https://github.com/GilbN/theme.park/tree/master/css/community-theme-options
|
||||
*/
|
||||
|
||||
@import "https://theme-park.dev/css/base/gitea/gitea-base.css";
|
||||
@import "https://theme-park.dev/css/base/gitea/chroma.css";
|
||||
@import "https://theme-park.dev/css/theme-options/dracula.css";
|
47
docker-compose/gitea/data--gitea/public/css/dracula.css
Normal file
@ -0,0 +1,47 @@
|
||||
/* dP dP dP */
|
||||
/* 88 88 88 */
|
||||
/* d8888P 88d888b. .d8888b. 88d8b.d8b. .d8888b. 88d888b. .d8888b. 88d888b. 88 .dP */
|
||||
/* 88 88' `88 88ooood8 88'`88'`88 88ooood8 88' `88 88' `88 88' `88 88888" */
|
||||
/* 88 88 88 88. ... 88 88 88 88. ... 88. .88 88. .88 88 88 `8b. */
|
||||
/* dP dP dP `88888P' dP dP dP `88888P' 88 88Y888P' `88888P8 dP dP `YP */
|
||||
/* 88 */
|
||||
/* dP */
|
||||
|
||||
/* Made by @gilbN */
|
||||
/* https://github.com/gilbN/theme.park */
|
||||
|
||||
/* https://docs.theme-park.dev/setup/#stylus-method
|
||||
|
||||
@import "https://theme-park.dev/css/base/<APP_NAME>/<APP_NAME>-base.css";
|
||||
@import "https://theme-park.dev/css/theme-options/THEME.css";
|
||||
|
||||
Nouveaux thèmes avec :
|
||||
@import "https://theme-park.dev/css/base/<APP_NAME>/<APP_NAME>-base.css";
|
||||
@import "https://theme-park.dev/css/theme-options/THEME.css";
|
||||
aquamarine.css
|
||||
dark.css
|
||||
dracula.css
|
||||
hotline.css
|
||||
hotpink.css
|
||||
nord.css
|
||||
organizr.css
|
||||
overseerr.css
|
||||
plex.css
|
||||
space-gray.css
|
||||
|
||||
Nouveaux thèmes avec :
|
||||
@import "https://theme-park.dev/css/base/<APP_NAME>/<APP_NAME>-base.css";
|
||||
@import "https://theme-park.dev/css/community-theme-options/THEME.css";
|
||||
mind.css
|
||||
onedark.css
|
||||
power.css
|
||||
reality.css
|
||||
soul.css
|
||||
space.css
|
||||
time.css
|
||||
... voir ici la liste -> https://github.com/GilbN/theme.park/tree/master/css/community-theme-options
|
||||
*/
|
||||
|
||||
@import "https://theme-park.dev/css/base/gitea/gitea-base.css";
|
||||
@import "https://theme-park.dev/css/base/gitea/chroma.css";
|
||||
@import "https://theme-park.dev/css/theme-options/dracula.css";
|
47
docker-compose/gitea/data--gitea/public/css/hotline.css
Normal file
@ -0,0 +1,47 @@
|
||||
/* dP dP dP */
|
||||
/* 88 88 88 */
|
||||
/* d8888P 88d888b. .d8888b. 88d8b.d8b. .d8888b. 88d888b. .d8888b. 88d888b. 88 .dP */
|
||||
/* 88 88' `88 88ooood8 88'`88'`88 88ooood8 88' `88 88' `88 88' `88 88888" */
|
||||
/* 88 88 88 88. ... 88 88 88 88. ... 88. .88 88. .88 88 88 `8b. */
|
||||
/* dP dP dP `88888P' dP dP dP `88888P' 88 88Y888P' `88888P8 dP dP `YP */
|
||||
/* 88 */
|
||||
/* dP */
|
||||
|
||||
/* Made by @gilbN */
|
||||
/* https://github.com/gilbN/theme.park */
|
||||
|
||||
/* https://docs.theme-park.dev/setup/#stylus-method
|
||||
|
||||
@import "https://theme-park.dev/css/base/<APP_NAME>/<APP_NAME>-base.css";
|
||||
@import "https://theme-park.dev/css/theme-options/THEME.css";
|
||||
|
||||
Nouveaux thèmes avec :
|
||||
@import "https://theme-park.dev/css/base/<APP_NAME>/<APP_NAME>-base.css";
|
||||
@import "https://theme-park.dev/css/theme-options/THEME.css";
|
||||
aquamarine.css
|
||||
dark.css
|
||||
dracula.css
|
||||
hotline.css
|
||||
hotpink.css
|
||||
nord.css
|
||||
organizr.css
|
||||
overseerr.css
|
||||
plex.css
|
||||
space-gray.css
|
||||
|
||||
Nouveaux thèmes avec :
|
||||
@import "https://theme-park.dev/css/base/<APP_NAME>/<APP_NAME>-base.css";
|
||||
@import "https://theme-park.dev/css/community-theme-options/THEME.css";
|
||||
mind.css
|
||||
onedark.css
|
||||
power.css
|
||||
reality.css
|
||||
soul.css
|
||||
space.css
|
||||
time.css
|
||||
... voir ici la liste -> https://github.com/GilbN/theme.park/tree/master/css/community-theme-options
|
||||
*/
|
||||
|
||||
@import "https://theme-park.dev/css/base/gitea/gitea-base.css";
|
||||
@import "https://theme-park.dev/css/base/gitea/chroma.css";
|
||||
@import "https://theme-park.dev/css/theme-options/hotline.css";
|
47
docker-compose/gitea/data--gitea/public/css/hotpink.css
Normal file
@ -0,0 +1,47 @@
|
||||
/* dP dP dP */
|
||||
/* 88 88 88 */
|
||||
/* d8888P 88d888b. .d8888b. 88d8b.d8b. .d8888b. 88d888b. .d8888b. 88d888b. 88 .dP */
|
||||
/* 88 88' `88 88ooood8 88'`88'`88 88ooood8 88' `88 88' `88 88' `88 88888" */
|
||||
/* 88 88 88 88. ... 88 88 88 88. ... 88. .88 88. .88 88 88 `8b. */
|
||||
/* dP dP dP `88888P' dP dP dP `88888P' 88 88Y888P' `88888P8 dP dP `YP */
|
||||
/* 88 */
|
||||
/* dP */
|
||||
|
||||
/* Made by @gilbN */
|
||||
/* https://github.com/gilbN/theme.park */
|
||||
|
||||
/* https://docs.theme-park.dev/setup/#stylus-method
|
||||
|
||||
@import "https://theme-park.dev/css/base/<APP_NAME>/<APP_NAME>-base.css";
|
||||
@import "https://theme-park.dev/css/theme-options/THEME.css";
|
||||
|
||||
Nouveaux thèmes avec :
|
||||
@import "https://theme-park.dev/css/base/<APP_NAME>/<APP_NAME>-base.css";
|
||||
@import "https://theme-park.dev/css/theme-options/THEME.css";
|
||||
aquamarine.css
|
||||
dark.css
|
||||
dracula.css
|
||||
hotline.css
|
||||
hotpink.css
|
||||
nord.css
|
||||
organizr.css
|
||||
overseerr.css
|
||||
plex.css
|
||||
space-gray.css
|
||||
|
||||
Nouveaux thèmes avec :
|
||||
@import "https://theme-park.dev/css/base/<APP_NAME>/<APP_NAME>-base.css";
|
||||
@import "https://theme-park.dev/css/community-theme-options/THEME.css";
|
||||
mind.css
|
||||
onedark.css
|
||||
power.css
|
||||
reality.css
|
||||
soul.css
|
||||
space.css
|
||||
time.css
|
||||
... voir ici la liste -> https://github.com/GilbN/theme.park/tree/master/css/community-theme-options
|
||||
*/
|
||||
|
||||
@import "https://theme-park.dev/css/base/gitea/gitea-base.css";
|
||||
@import "https://theme-park.dev/css/base/gitea/chroma.css";
|
||||
@import "https://theme-park.dev/css/theme-options/hotpink.css";
|
47
docker-compose/gitea/data--gitea/public/css/nord.css
Normal file
@ -0,0 +1,47 @@
|
||||
/* dP dP dP */
|
||||
/* 88 88 88 */
|
||||
/* d8888P 88d888b. .d8888b. 88d8b.d8b. .d8888b. 88d888b. .d8888b. 88d888b. 88 .dP */
|
||||
/* 88 88' `88 88ooood8 88'`88'`88 88ooood8 88' `88 88' `88 88' `88 88888" */
|
||||
/* 88 88 88 88. ... 88 88 88 88. ... 88. .88 88. .88 88 88 `8b. */
|
||||
/* dP dP dP `88888P' dP dP dP `88888P' 88 88Y888P' `88888P8 dP dP `YP */
|
||||
/* 88 */
|
||||
/* dP */
|
||||
|
||||
/* Made by @gilbN */
|
||||
/* https://github.com/gilbN/theme.park */
|
||||
|
||||
/* https://docs.theme-park.dev/setup/#stylus-method
|
||||
|
||||
@import "https://theme-park.dev/css/base/<APP_NAME>/<APP_NAME>-base.css";
|
||||
@import "https://theme-park.dev/css/theme-options/THEME.css";
|
||||
|
||||
Nouveaux thèmes avec :
|
||||
@import "https://theme-park.dev/css/base/<APP_NAME>/<APP_NAME>-base.css";
|
||||
@import "https://theme-park.dev/css/theme-options/THEME.css";
|
||||
aquamarine.css
|
||||
dark.css
|
||||
dracula.css
|
||||
hotline.css
|
||||
hotpink.css
|
||||
nord.css
|
||||
organizr.css
|
||||
overseerr.css
|
||||
plex.css
|
||||
space-gray.css
|
||||
|
||||
Nouveaux thèmes avec :
|
||||
@import "https://theme-park.dev/css/base/<APP_NAME>/<APP_NAME>-base.css";
|
||||
@import "https://theme-park.dev/css/community-theme-options/THEME.css";
|
||||
mind.css
|
||||
onedark.css
|
||||
power.css
|
||||
reality.css
|
||||
soul.css
|
||||
space.css
|
||||
time.css
|
||||
... voir ici la liste -> https://github.com/GilbN/theme.park/tree/master/css/community-theme-options
|
||||
*/
|
||||
|
||||
@import "https://theme-park.dev/css/base/gitea/gitea-base.css";
|
||||
@import "https://theme-park.dev/css/base/gitea/chroma.css";
|
||||
@import "https://theme-park.dev/css/theme-options/nord.css";
|
59
docker-compose/gitea/data--gitea/public/css/onedark.css
Normal file
@ -0,0 +1,59 @@
|
||||
/* dP dP dP */
|
||||
/* 88 88 88 */
|
||||
/* d8888P 88d888b. .d8888b. 88d8b.d8b. .d8888b. 88d888b. .d8888b. 88d888b. 88 .dP */
|
||||
/* 88 88' `88 88ooood8 88'`88'`88 88ooood8 88' `88 88' `88 88' `88 88888" */
|
||||
/* 88 88 88 88. ... 88 88 88 88. ... 88. .88 88. .88 88 88 `8b. */
|
||||
/* dP dP dP `88888P' dP dP dP `88888P' 88 88Y888P' `88888P8 dP dP `YP */
|
||||
/* 88 */
|
||||
/* dP */
|
||||
|
||||
/* Made by @gilbN */
|
||||
/* https://github.com/gilbN/theme.park */
|
||||
|
||||
/* https://docs.theme-park.dev/setup/#stylus-method
|
||||
|
||||
@import "https://theme-park.dev/css/base/<APP_NAME>/<APP_NAME>-base.css";
|
||||
@import "https://theme-park.dev/css/theme-options/THEME.css";
|
||||
|
||||
Nouveaux thèmes avec :
|
||||
@import "https://theme-park.dev/css/base/<APP_NAME>/<APP_NAME>-base.css";
|
||||
@import "https://theme-park.dev/css/theme-options/THEME.css";
|
||||
aquamarine.css
|
||||
dark.css
|
||||
dracula.css
|
||||
hotline.css
|
||||
hotpink.css
|
||||
nord.css
|
||||
organizr.css
|
||||
overseerr.css
|
||||
plex.css
|
||||
space-gray.css
|
||||
|
||||
Nouveaux thèmes avec :
|
||||
@import "https://theme-park.dev/css/base/<APP_NAME>/<APP_NAME>-base.css";
|
||||
@import "https://theme-park.dev/css/community-theme-options/THEME.css";
|
||||
blackberry-abyss.css
|
||||
blackberry-amethyst.css
|
||||
blackberry-carol.css
|
||||
blackberry-dreamscape.css
|
||||
blackberry-flamingo.css
|
||||
blackberry-hearth.css
|
||||
blackberry-martian.css
|
||||
blackberry-pumpkin.css
|
||||
blackberry-royal.css
|
||||
blackberry-shadow.css
|
||||
blackberry-solar.css
|
||||
blackberry-vanta.css
|
||||
mind.css
|
||||
onedark.css
|
||||
power.css
|
||||
reality.css
|
||||
soul.css
|
||||
space.css
|
||||
time.css
|
||||
... voir ici la liste -> https://github.com/GilbN/theme.park/tree/master/css/community-theme-options
|
||||
*/
|
||||
|
||||
@import "https://theme-park.dev/css/base/gitea/gitea-base.css";
|
||||
@import "https://theme-park.dev/css/base/gitea/chroma.css";
|
||||
@import "https://theme-park.dev/css/community-theme-options/onedark.css";
|
47
docker-compose/gitea/data--gitea/public/css/organizr.css
Normal file
@ -0,0 +1,47 @@
|
||||
/* dP dP dP */
|
||||
/* 88 88 88 */
|
||||
/* d8888P 88d888b. .d8888b. 88d8b.d8b. .d8888b. 88d888b. .d8888b. 88d888b. 88 .dP */
|
||||
/* 88 88' `88 88ooood8 88'`88'`88 88ooood8 88' `88 88' `88 88' `88 88888" */
|
||||
/* 88 88 88 88. ... 88 88 88 88. ... 88. .88 88. .88 88 88 `8b. */
|
||||
/* dP dP dP `88888P' dP dP dP `88888P' 88 88Y888P' `88888P8 dP dP `YP */
|
||||
/* 88 */
|
||||
/* dP */
|
||||
|
||||
/* Made by @gilbN */
|
||||
/* https://github.com/gilbN/theme.park */
|
||||
|
||||
/* https://docs.theme-park.dev/setup/#stylus-method
|
||||
|
||||
@import "https://theme-park.dev/css/base/<APP_NAME>/<APP_NAME>-base.css";
|
||||
@import "https://theme-park.dev/css/theme-options/THEME.css";
|
||||
|
||||
Nouveaux thèmes avec :
|
||||
@import "https://theme-park.dev/css/base/<APP_NAME>/<APP_NAME>-base.css";
|
||||
@import "https://theme-park.dev/css/theme-options/THEME.css";
|
||||
aquamarine.css
|
||||
dark.css
|
||||
dracula.css
|
||||
hotline.css
|
||||
hotpink.css
|
||||
nord.css
|
||||
organizr.css
|
||||
overseerr.css
|
||||
plex.css
|
||||
space-gray.css
|
||||
|
||||
Nouveaux thèmes avec :
|
||||
@import "https://theme-park.dev/css/base/<APP_NAME>/<APP_NAME>-base.css";
|
||||
@import "https://theme-park.dev/css/community-theme-options/THEME.css";
|
||||
mind.css
|
||||
onedark.css
|
||||
power.css
|
||||
reality.css
|
||||
soul.css
|
||||
space.css
|
||||
time.css
|
||||
... voir ici la liste -> https://github.com/GilbN/theme.park/tree/master/css/community-theme-options
|
||||
*/
|
||||
|
||||
@import "https://theme-park.dev/css/base/gitea/gitea-base.css";
|
||||
@import "https://theme-park.dev/css/base/gitea/chroma.css";
|
||||
@import "https://theme-park.dev/css/theme-options/organizr.css";
|
47
docker-compose/gitea/data--gitea/public/css/overseerr.css
Normal file
@ -0,0 +1,47 @@
|
||||
/* dP dP dP */
|
||||
/* 88 88 88 */
|
||||
/* d8888P 88d888b. .d8888b. 88d8b.d8b. .d8888b. 88d888b. .d8888b. 88d888b. 88 .dP */
|
||||
/* 88 88' `88 88ooood8 88'`88'`88 88ooood8 88' `88 88' `88 88' `88 88888" */
|
||||
/* 88 88 88 88. ... 88 88 88 88. ... 88. .88 88. .88 88 88 `8b. */
|
||||
/* dP dP dP `88888P' dP dP dP `88888P' 88 88Y888P' `88888P8 dP dP `YP */
|
||||
/* 88 */
|
||||
/* dP */
|
||||
|
||||
/* Made by @gilbN */
|
||||
/* https://github.com/gilbN/theme.park */
|
||||
|
||||
/* https://docs.theme-park.dev/setup/#stylus-method
|
||||
|
||||
@import "https://theme-park.dev/css/base/<APP_NAME>/<APP_NAME>-base.css";
|
||||
@import "https://theme-park.dev/css/theme-options/THEME.css";
|
||||
|
||||
Nouveaux thèmes avec :
|
||||
@import "https://theme-park.dev/css/base/<APP_NAME>/<APP_NAME>-base.css";
|
||||
@import "https://theme-park.dev/css/theme-options/THEME.css";
|
||||
aquamarine.css
|
||||
dark.css
|
||||
dracula.css
|
||||
hotline.css
|
||||
hotpink.css
|
||||
nord.css
|
||||
organizr.css
|
||||
overseerr.css
|
||||
plex.css
|
||||
space-gray.css
|
||||
|
||||
Nouveaux thèmes avec :
|
||||
@import "https://theme-park.dev/css/base/<APP_NAME>/<APP_NAME>-base.css";
|
||||
@import "https://theme-park.dev/css/community-theme-options/THEME.css";
|
||||
mind.css
|
||||
onedark.css
|
||||
power.css
|
||||
reality.css
|
||||
soul.css
|
||||
space.css
|
||||
time.css
|
||||
... voir ici la liste -> https://github.com/GilbN/theme.park/tree/master/css/community-theme-options
|
||||
*/
|
||||
|
||||
@import "https://theme-park.dev/css/base/gitea/gitea-base.css";
|
||||
@import "https://theme-park.dev/css/base/gitea/chroma.css";
|
||||
@import "https://theme-park.dev/css/theme-options/overseerr.css";
|
47
docker-compose/gitea/data--gitea/public/css/plex.css
Normal file
@ -0,0 +1,47 @@
|
||||
/* dP dP dP */
|
||||
/* 88 88 88 */
|
||||
/* d8888P 88d888b. .d8888b. 88d8b.d8b. .d8888b. 88d888b. .d8888b. 88d888b. 88 .dP */
|
||||
/* 88 88' `88 88ooood8 88'`88'`88 88ooood8 88' `88 88' `88 88' `88 88888" */
|
||||
/* 88 88 88 88. ... 88 88 88 88. ... 88. .88 88. .88 88 88 `8b. */
|
||||
/* dP dP dP `88888P' dP dP dP `88888P' 88 88Y888P' `88888P8 dP dP `YP */
|
||||
/* 88 */
|
||||
/* dP */
|
||||
|
||||
/* Made by @gilbN */
|
||||
/* https://github.com/gilbN/theme.park */
|
||||
|
||||
/* https://docs.theme-park.dev/setup/#stylus-method
|
||||
|
||||
@import "https://theme-park.dev/css/base/<APP_NAME>/<APP_NAME>-base.css";
|
||||
@import "https://theme-park.dev/css/theme-options/THEME.css";
|
||||
|
||||
Nouveaux thèmes avec :
|
||||
@import "https://theme-park.dev/css/base/<APP_NAME>/<APP_NAME>-base.css";
|
||||
@import "https://theme-park.dev/css/theme-options/THEME.css";
|
||||
aquamarine.css
|
||||
dark.css
|
||||
dracula.css
|
||||
hotline.css
|
||||
hotpink.css
|
||||
nord.css
|
||||
organizr.css
|
||||
overseerr.css
|
||||
plex.css
|
||||
space-gray.css
|
||||
|
||||
Nouveaux thèmes avec :
|
||||
@import "https://theme-park.dev/css/base/<APP_NAME>/<APP_NAME>-base.css";
|
||||
@import "https://theme-park.dev/css/community-theme-options/THEME.css";
|
||||
mind.css
|
||||
onedark.css
|
||||
power.css
|
||||
reality.css
|
||||
soul.css
|
||||
space.css
|
||||
time.css
|
||||
... voir ici la liste -> https://github.com/GilbN/theme.park/tree/master/css/community-theme-options
|
||||
*/
|
||||
|
||||
@import "https://theme-park.dev/css/base/gitea/gitea-base.css";
|
||||
@import "https://theme-park.dev/css/base/gitea/chroma.css";
|
||||
@import "https://theme-park.dev/css/theme-options/plex.css";
|
47
docker-compose/gitea/data--gitea/public/css/space-gray.css
Normal file
@ -0,0 +1,47 @@
|
||||
/* dP dP dP */
|
||||
/* 88 88 88 */
|
||||
/* d8888P 88d888b. .d8888b. 88d8b.d8b. .d8888b. 88d888b. .d8888b. 88d888b. 88 .dP */
|
||||
/* 88 88' `88 88ooood8 88'`88'`88 88ooood8 88' `88 88' `88 88' `88 88888" */
|
||||
/* 88 88 88 88. ... 88 88 88 88. ... 88. .88 88. .88 88 88 `8b. */
|
||||
/* dP dP dP `88888P' dP dP dP `88888P' 88 88Y888P' `88888P8 dP dP `YP */
|
||||
/* 88 */
|
||||
/* dP */
|
||||
|
||||
/* Made by @gilbN */
|
||||
/* https://github.com/gilbN/theme.park */
|
||||
|
||||
/* https://docs.theme-park.dev/setup/#stylus-method
|
||||
|
||||
@import "https://theme-park.dev/css/base/<APP_NAME>/<APP_NAME>-base.css";
|
||||
@import "https://theme-park.dev/css/theme-options/THEME.css";
|
||||
|
||||
Nouveaux thèmes avec :
|
||||
@import "https://theme-park.dev/css/base/<APP_NAME>/<APP_NAME>-base.css";
|
||||
@import "https://theme-park.dev/css/theme-options/THEME.css";
|
||||
aquamarine.css
|
||||
dark.css
|
||||
dracula.css
|
||||
hotline.css
|
||||
hotpink.css
|
||||
nord.css
|
||||
organizr.css
|
||||
overseerr.css
|
||||
plex.css
|
||||
space-gray.css
|
||||
|
||||
Nouveaux thèmes avec :
|
||||
@import "https://theme-park.dev/css/base/<APP_NAME>/<APP_NAME>-base.css";
|
||||
@import "https://theme-park.dev/css/community-theme-options/THEME.css";
|
||||
mind.css
|
||||
onedark.css
|
||||
power.css
|
||||
reality.css
|
||||
soul.css
|
||||
space.css
|
||||
time.css
|
||||
... voir ici la liste -> https://github.com/GilbN/theme.park/tree/master/css/community-theme-options
|
||||
*/
|
||||
|
||||
@import "https://theme-park.dev/css/base/gitea/gitea-base.css";
|
||||
@import "https://theme-park.dev/css/base/gitea/chroma.css";
|
||||
@import "https://theme-park.dev/css/theme-options/space-gray.css";
|
@ -0,0 +1,16 @@
|
||||
<!-- Voir : https://docs.theme-park.dev/themes/gitea/#adding-the-themes-in-gitea -->
|
||||
<!-- Pensez à supprimer le fichier header.tmpl du serveur Gitea ! -->
|
||||
|
||||
{{ if .IsSigned }}
|
||||
{{ if and (ne .SignedUser.Theme "gitea") (ne .SignedUser.Theme "arc-green") }}
|
||||
{{ if (eq .SignedUser.Theme "dracula-test") }}
|
||||
<link rel="stylesheet" href="https://theme-park.dev/css/base/gitea/gitea-base.css">
|
||||
<link rel="stylesheet" href="https://theme-park.dev/css/base/gitea/chroma.css">
|
||||
<link rel="stylesheet" href="https://theme-park.dev/css/theme-options/dracula.css">
|
||||
{{else}}
|
||||
<link rel="stylesheet" href="https://theme-park.dev/css/base/gitea/{{.SignedUser.Theme}}.css">
|
||||
{{end}}
|
||||
{{end}}
|
||||
{{ else if and (ne DefaultTheme "gitea") (ne DefaultTheme "arc-green") }}
|
||||
<link rel="stylesheet" href="https://theme-park.dev/css/base/gitea/{{DefaultTheme}}.css">
|
||||
{{end}}
|
@ -0,0 +1,23 @@
|
||||
<!-- NE PLUS UTILISER CE FICHIER, voir tuto pour utiliser body_outer_pre.tmpl -->
|
||||
<!-- IL FAUT SUPPRIMER CE FICHIER du serveur Gitea... (il peut rester dans le dépôt) -->
|
||||
|
||||
<!-- Voir : https://docs.theme-park.dev/themes/gitea/#adding-the-themes-in-gitea -->
|
||||
|
||||
{{ if .IsSigned }}
|
||||
{{ if and (ne .SignedUser.Theme "gitea") (ne .SignedUser.Theme "arc-green") }}
|
||||
<!-- <link rel="stylesheet" href="/styles.css"> -->
|
||||
<!-- <link rel="stylesheet" href="/css/gitea.css"> -->
|
||||
<link rel="stylesheet" href="https://theme-park.dev/css/base/gitea/gitea-base.css">
|
||||
<link rel="stylesheet" href="https://theme-park.dev/css/base/gitea/chroma.css">
|
||||
|
||||
<!-- <link rel="stylesheet" href="https://theme-park.dev/css/theme-options/{{.SignedUser.Theme}}.css"> -->
|
||||
<link rel="stylesheet" href="https://theme-park.dev/css/base/gitea/{{.SignedUser.Theme}}.css">
|
||||
{{end}}
|
||||
|
||||
{{ else if and (ne DefaultTheme "gitea") (ne DefaultTheme "arc-green") }}
|
||||
<!-- <link rel="stylesheet" href="/styles.css"> -->
|
||||
<!-- <link rel="stylesheet" href="/css/gitea.css"> -->
|
||||
<link rel="stylesheet" href="https://theme-park.dev/css/base/gitea/gitea-base.css">
|
||||
<link rel="stylesheet" href="https://theme-park.dev/css/base/gitea/chroma.css">
|
||||
<link rel="stylesheet" href="https://theme-park.dev/css/base/gitea/{{DefaultTheme}}.css">
|
||||
{{end}}
|
94
docker-compose/gitea/docker-compose.yml
Normal file
@ -0,0 +1,94 @@
|
||||
## Discord Plex FR : https://discord.gg/3gtABCH
|
||||
## Version 2021-08-23
|
||||
##==============================================================================================
|
||||
## ##
|
||||
## Fichier docker-compose.yml pour Gitea ##
|
||||
## ##
|
||||
##==============================================================================================
|
||||
## ##
|
||||
## Pour que Gitea fonctionne correctement et que l'on puisse faire des git clone depuis ##
|
||||
## un ordinateur, il faut un nom de domaine ! Je n'ai pas trouver comment faire sans... ##
|
||||
## ##
|
||||
##──── ────────────────────────────────────────────────────────────────────────────────────────
|
||||
## ##
|
||||
## Pense-bête pour la configuration du serveur : ##
|
||||
## ##
|
||||
## - URL locale d'accès (pour l'installation): http://192.168.xxx.xxxx:8196 ##
|
||||
## - URL d'accès : https://gitea.ndd.tld ##
|
||||
## - Parmètres emailer : ##
|
||||
## - ENABLED = true ##
|
||||
## - HOST = smtp.gmail.com:465 ##
|
||||
## - FROM = xxxxxxxxxxxxxxxxxxxxxxxxxxxxx ##
|
||||
## - USER = xxxxxxxxxxxxxxxxxxxxxxxxxxxxx ##
|
||||
## - PASSWD = xxxxxxxxxxxxxxxxxxxxxxxxxxxxx ##
|
||||
## - MAILER_TYPE = smtp ##
|
||||
## - IS_TLS_ENABLED = true ##
|
||||
## ##
|
||||
##==============================================================================================
|
||||
|
||||
---
|
||||
version: "2.4"
|
||||
|
||||
services:
|
||||
server:
|
||||
image: gitea/gitea:1 # On reste ici avec la dernière version stable de la branche 1.x.x
|
||||
# https://docs.gitea.io/en-us/install-with-docker/
|
||||
# https://docs.gitea.io/fr-fr/install-with-docker/
|
||||
# https://github.com/go-gitea/gitea
|
||||
container_name: gitea
|
||||
|
||||
#network_mode: "bridge"
|
||||
networks:
|
||||
- gitea_network
|
||||
|
||||
environment:
|
||||
- USER_UID=1000 # Utiliser la commande : id user
|
||||
- USER_GID=100 # Utiliser la commande : id user
|
||||
- APP_NAME=Mon Gitea perso
|
||||
- RUN_MODE=prod
|
||||
|
||||
# Les deux paramètres ci-dessous ne semblent pas fonctionner puisqu'il faut faire manuellement le réglage lors du setup...
|
||||
- REQUIRE_SIGNIN_VIEW=true # Enable this to force users to log in to view any page.
|
||||
- DISABLE_REGISTRATION=true # Disable registration, after which only admin can create accounts for users.
|
||||
|
||||
- DOMAIN=gitea.ndd.tld
|
||||
- SSH_DOMAIN=gitea.ndd.tld
|
||||
- ROOT_URL=https://gitea.ndd.tld
|
||||
- DB_TYPE=sqlite3
|
||||
- DB_HOST=localhost:3306
|
||||
- DB_NAME=gitea
|
||||
- DB_USER=root
|
||||
- DB_PASSWD="gitea_db_blabla"
|
||||
|
||||
- INSTALL_LOCK=false # Disallow access to the install page
|
||||
# À passer en true une fois installer la première fois.
|
||||
- GITEA__PICTURE__DISABLE_GRAVATAR=true
|
||||
- GITEA__PICTURE__ENABLE_FEDERATED_AVATAR=false
|
||||
|
||||
- GITEA__SERVICE__REGISTER_EMAIL_CONFIRM=true # Ne semble pas fonctionner puisqu'il faut cocher manuellement la case lors du setup...
|
||||
- GITEA__SERVICE__ENABLE_NOTIFY_MAIL=true # Ne semble pas fonctionner puisqu'il faut cocher manuellement la case lors du setup...
|
||||
|
||||
|
||||
# ###############
|
||||
# Le label ci-dessous permet à Watchtower de faire les mises à jour automatiquement
|
||||
# Cela peut-être supprimé si Watchtower n'est pas utilisé.
|
||||
labels:
|
||||
- "com.centurylinklabs.watchtower.enable=true"
|
||||
# ###############
|
||||
|
||||
volumes:
|
||||
- "/volume1/docker/gitea/data:/data" # Dossier pour les données de Gitea (Dépôts, BDD, config...)
|
||||
- "/volume1/docker/gitea/backup-data:/backup-data" # Dossier pour les sauvegardes régulières à lancer avec un script en tâche planifiée.
|
||||
- "/etc/localtime:/etc/localtime:ro" # Nécessaire pour avoir le temps local correct (vu que la variable TZ=Europe/Paris n'existe pas pour ce conteneur...)
|
||||
|
||||
ports:
|
||||
- "8196:3000" # Choisir un port de connexion libre sur votre machine, ce sera la port de connexion pour l'interface graphique
|
||||
# - "8197:22" # Idem ici, sauf que ce sera pour le port SSH, mais ça ne fonctionne pas avec une installation en Bridge...
|
||||
|
||||
restart: unless-stopped
|
||||
|
||||
networks:
|
||||
gitea_network:
|
||||
external: false
|
||||
driver: bridge
|
||||
name: gitea_network
|
272
docker-compose/gitea/gitea-backup.sh
Normal file
@ -0,0 +1,272 @@
|
||||
#!/bin/bash
|
||||
##==============================================================================================
|
||||
## ##
|
||||
## Script gitea-backup.sh ##
|
||||
## ##
|
||||
##==============================================================================================
|
||||
## ##
|
||||
## gitea-backup.sh [<méthode de backup>] ##
|
||||
## <méthode de backup> est facultatif. S'il n'est pas spécifié, on fait les deux ! ##
|
||||
## <méthode de backup> = gitea_dump ##
|
||||
## = archive_dossier ##
|
||||
## ##
|
||||
##==============================================================================================
|
||||
|
||||
##==============================================================================================
|
||||
## ##
|
||||
## MAJ du 19.04.2021 : La partie de sauvegarde gite_dump a été commentée, et n'est donc ##
|
||||
## plus utilisée, car la restauration de cette archive est trop galère à mettre en place. ##
|
||||
## Donc soit on ne donne aucun paramètre en argument au script, soit on met archive_dossier. ##
|
||||
## L'autre paramètre n'aura donc plus aucun effet. ##
|
||||
## ##
|
||||
##==============================================================================================
|
||||
|
||||
##==============================================================================================
|
||||
## ##
|
||||
## Objectif du script : faire une sauvegarde de l'installation Gitea @ Docker ##
|
||||
## Il y a aura un shutdown du conteneur le temps de la sauvegarde afin que la base de ##
|
||||
## données ne soit pas modifiée pendant le backup, puis le conteneur sera redémarré. ##
|
||||
## ##
|
||||
## Il faudra créer une tâche planifiée pour lancer la sauvegarde toutes les nuits, par ##
|
||||
## exemple à 3h du matin. ##
|
||||
## ##
|
||||
##==============================================================================================
|
||||
## ##
|
||||
## Une méthode officielle de backup de la base de données est présente ici : ##
|
||||
## https://docs.gitea.io/en-us/backup-and-restore/#backup-command-dump ##
|
||||
## ##
|
||||
##==============================================================================================
|
||||
|
||||
|
||||
|
||||
# Récupération des arguments qu'on place dans des variables constantes
|
||||
declare -r nb_arg=$# # Nombre d'argument(s) fourni(s) au script.
|
||||
declare -r methode="$1" # 1er argument fourni
|
||||
|
||||
if [ "$methode" = "--help" ] || [ "$methode" = "-help" ] || [ "$methode" = "-h" ] || [ "$methode" = "--h" ]; then
|
||||
echo "Le script gitea-backup.sh permet de faire une sauvegarde des données du conteneur Gitea."
|
||||
echo "Utilisation : gitea-backup.sh [<méthode de backup>]"
|
||||
echo "L'argument <méthode de backup> est facultatif. S'il n'est pas spécifié, on fait les deux !"
|
||||
echo " <méthode de backup> = gitea_dump"
|
||||
echo " = archive_dossier"
|
||||
echo
|
||||
exit 0
|
||||
fi
|
||||
|
||||
mode_backup=0 # 0 = aucune méthode indiquée ; 1 = gitea_dump ; 2 = archive_dossier
|
||||
|
||||
##──── ────────────────────────────────────────────────────────────────────────────────────────
|
||||
##──── ────────────────────────────────────────────────────────────────────────────────────────
|
||||
## ##
|
||||
## VALEURS À PERSONNALISER ##
|
||||
## ##
|
||||
## Chemin d'accès vers votre dossier docker et vers le dossier de backup de gitea ##
|
||||
|
||||
# Chemin du dossier qui contient le dossier des données (data) et des backups (backup-data)
|
||||
GITEA_DOCKER_DIR=/volume1/docker/gitea
|
||||
|
||||
# Les noms des dossiers montés dans le conteneur doivent êtres identiques à ceux présents sur la machine hôte. Sinon faudra modifier le script...
|
||||
# Nom du dossier contenant les backups qui doit exister car il doit être monté dans le conteneur à l'aide du docker-compose.yml.
|
||||
GITEA_BACKUP_DIR=backup-data
|
||||
|
||||
# Nom du dossier contenant les donneés de Gitea (data)
|
||||
GITEA_DATA_DIR=data
|
||||
|
||||
# Nom du conteneur
|
||||
NOM_CONTENEUR=gitea
|
||||
|
||||
# ID de l'utilisateur du NAS qui a les droits sur le conteneur
|
||||
ID_USER_NAS=1060
|
||||
|
||||
# Nombre de jours d'archives-backup à garder (ça inclus le jour actuel)
|
||||
NB_JOURS_A_GARDER=10
|
||||
|
||||
##──── ────────────────────────────────────────────────────────────────────────────────────────
|
||||
##──── ────────────────────────────────────────────────────────────────────────────────────────
|
||||
|
||||
function pause() {
|
||||
read -p "$*"
|
||||
}
|
||||
|
||||
echo "$(date "+%R:%S - ") Script de sauvegarde des données du conteneur Gitea"
|
||||
|
||||
|
||||
##==============================================================================================
|
||||
## Vérification de la présence des dossiers du conteneur ##
|
||||
|
||||
cd $GITEA_DOCKER_DIR
|
||||
num_erreur=$? # On stocke le code de retour de la commande précédente.
|
||||
if [ $num_erreur -ne 0 ]; then # Si ce code n'est pas 0, il y a eu une erreur, on arrète le script.
|
||||
echo " Le chemin '$GITEA_DOCKER_DIR' est invalide ! Veuillez vérifier le chemin d'accès..."
|
||||
echo " Abandon, avec code d'erreur $num_erreur"
|
||||
exit $num_erreur
|
||||
fi
|
||||
|
||||
dossier_manquant=""
|
||||
if [ ! -d "$GITEA_BACKUP_DIR" ]; then
|
||||
dossier_manquant = "$GITEA_BACKUP_DIR"
|
||||
fi
|
||||
if [ ! -d "$GITEA_DATA_DIR" ]; then
|
||||
dossier_manquant = dossier_manquant + " ; $GITEA_DATA_DIR"
|
||||
fi
|
||||
if [ "$dossier_manquant" != "" ]; then
|
||||
echo " Le(s) dossier(s) suivant(s) n'existe(nt) pas : $dossier_manquant ."
|
||||
echo " Abandon, avec code d'erreur 999."
|
||||
exit 999
|
||||
else
|
||||
echo "-- Les dossiers $GITEA_BACKUP_DIR et $GITEA_DATA_DIR existent bien. Le script peut continuer."
|
||||
fi
|
||||
|
||||
# Autre méthode, effectuant davantage de tests... donc moins efficace...
|
||||
# if [ ! -d "$GITEA_BACKUP_DIR" ] || [ ! -d "$GITEA_DATA_DIR" ]; then # Au moins un des dossiers n'existe pas
|
||||
# if [ ! -d "$GITEA_BACKUP_DIR" ]; then # Le dossier $GITEA_BACKUP_DIR n'existe pas !
|
||||
# echo " Le dossier '$GITEA_BACKUP_DIR' n'existe pas !"
|
||||
# fi
|
||||
# if [ ! -d "$GITEA_DATA_DIR" ]; then # Le dossier $GITEA_DATA_DIR n'existe pas !
|
||||
# echo " Le dossier '$GITEA_DATA_DIR' n'existe pas !"
|
||||
# fi
|
||||
# echo " Abandon, avec code d'erreur 999"
|
||||
# exit 999
|
||||
# else
|
||||
# echo "-- Les dossiers $GITEA_BACKUP_DIR et $GITEA_DATA_DIR existent bien. On peut continuer."
|
||||
# fi
|
||||
##==============================================================================================
|
||||
|
||||
|
||||
##==============================================================================================
|
||||
## ##
|
||||
## Définition du mode de backup à faire en fonction de la méthode donnée en argument ##
|
||||
case $methode in
|
||||
gitea_dump) # Méthode gitea_dump sélectionnée ##
|
||||
mode_backup=1
|
||||
#echo "mode_backup=$mode_backup"
|
||||
;;
|
||||
|
||||
archive_dossier) # Méthode archive_dossier sélectionnée ##
|
||||
mode_backup=2
|
||||
#echo "mode_backup=$mode_backup"
|
||||
;;
|
||||
|
||||
*) # Aucune méthode sélectionnée ##
|
||||
mode_backup=0
|
||||
#echo "mode_backup=$mode_backup"
|
||||
;;
|
||||
esac
|
||||
##==============================================================================================
|
||||
|
||||
|
||||
##==============================================================================================
|
||||
## ##
|
||||
## Partie concernant les sauvegardes ##
|
||||
# if [ $mode_backup -eq 0 ] || [ $mode_backup -eq 1 ]; then
|
||||
# # Aucune méthode n'est choisie ou bien méthode gitea_dump sélectionnée
|
||||
|
||||
# # Rappel des variables :
|
||||
# # GITEA_DOCKER_DIR=/volume1/docker/gitea
|
||||
# # GITEA_BACKUP_DIR=backup-data
|
||||
# # GITEA_DATA_DIR=data
|
||||
# # NOM_CONTENEUR=gitea
|
||||
# # ID_USER_NAS=1060
|
||||
|
||||
# echo "-- Sauvegarde via Gitea dump. (un peu chiant à restaurer...)"
|
||||
# echo "###############################################################################"
|
||||
# # Dans la commande suivante, les chemins d'accès donnés en paramètres sont des chemins d'accès à l'intérieur du conteneur, montés avec le docker-compose.yml.
|
||||
# # Exemple de commande sans variables :
|
||||
# # docker exec -u 1060 -i -w /backup-data $(docker ps -qf "name=^gitea$") bash -c '/app/gitea/gitea dump -c /data/gitea/conf/app.ini'
|
||||
# # Note : La commande lancée dans une tâche CRON (planifiée) ne permet pas l'utilisation du paramètre -t.
|
||||
# # Commande à lancer dans un terminal :
|
||||
# # docker exec -u 1060 -i -w /backup-data $(docker ps -qf "name=^gitea$") bash -c '/app/gitea/gitea dump -c /data/gitea/conf/app.ini'
|
||||
# # Explication pour $(docker ps -qf "name=^gitea$") ici : https://stackoverflow.com/a/34497614
|
||||
|
||||
# docker exec -u $ID_USER_NAS -i -w /$GITEA_BACKUP_DIR $(docker ps -qf "name=^$NOM_CONTENEUR$") bash -c "/app/gitea/gitea dump -c /$GITEA_DATA_DIR/gitea/conf/app.ini"
|
||||
# num_erreur=$? # On stocke le code de retour de la commande précédente.
|
||||
# if [ $num_erreur -ne 0 ]; then # Si ce code n'est pas 0, il y a eu une erreur, on arrète le script.
|
||||
# echo "!!!!!! Erreur lors de la commande de backup gitea dump."
|
||||
# #echo "!!!!!! Commande lancée :"
|
||||
# #echo " docker exec -u $ID_USER_NAS -it -w /$GITEA_BACKUP_DIR $(docker ps -qf "name=$NOM_CONTENEUR") bash -c "/app/gitea/gitea dump -c /$GITEA_DATA_DIR/gitea/conf/app.ini""
|
||||
# echo "!!!!!! Abandon, avec code d'erreur $num_erreur"
|
||||
# exit $num_erreur
|
||||
# fi
|
||||
# echo "###############################################################################"
|
||||
# echo "-- Sauvegarde via Gitea dump terminée."
|
||||
# fi
|
||||
|
||||
|
||||
if [ $mode_backup -eq 0 ] || [ $mode_backup -eq 2 ]; then
|
||||
# Aucune méthode n'est choisie ou bien méthode archive_dossier sélectionnée
|
||||
echo "-- Sauvegarde par création d'une archive de tout le dossier $GITEA_DATA_DIR"
|
||||
echo "###############################################################################"
|
||||
cd $GITEA_DOCKER_DIR # Même si on est censé déjà être là...
|
||||
|
||||
#retour_cmd=1111 # Valeur reset
|
||||
echo "-- Extinction du conteneur $(docker stop $NOM_CONTENEUR) : OK."
|
||||
# retour_cmd=$? # Le code d'exit de la fonction est stocké dans cette variable.
|
||||
# if [ $retour_cmd -ne 0 ]; then
|
||||
# if [ $retour_cmd -eq 1111 ]; then
|
||||
# echo "### DEBUG : soucis avec la récupération du retour de commande #1470000 "
|
||||
# exit 1470000
|
||||
# fi
|
||||
# echo "!! Le conteneur $NOM_CONTENEUR ne peut pas être arrêté..."
|
||||
# echo "!! Fin du script. Erreur 777"
|
||||
# echo
|
||||
# exit 777
|
||||
# fi
|
||||
echo "-- Création de l'archive du dossier $GITEA_DATA_DIR"
|
||||
|
||||
# Compression tar.gz :
|
||||
#tar -czf $GITEA_BACKUP_DIR/Gitea-Data-Backup-`date +%Y-%m-%d--%Hh%Mm%Ss`.tar.gz ./$GITEA_DATA_DIR
|
||||
|
||||
# Compression 7z après obtention d'un .tar
|
||||
# On Linux/Unix, in order to backup directories you must use tar :
|
||||
# - to backup a directory : tar cf - directory | 7z a -si directory.tar.7z
|
||||
# - to restore your backup : 7z x -so directory.tar.7z | tar xf -
|
||||
tar cf - ./$GITEA_DATA_DIR | 7z a -si $GITEA_BACKUP_DIR/Gitea-Data-Backup-`date +%Y-%m-%d--%Hh%Mm%Ss`.7z
|
||||
|
||||
echo "-- Archive de tout le dossier $GITEA_DATA_DIR créée."
|
||||
|
||||
# retour_cmd=1111 # Valeur reset
|
||||
echo "-- Redémarrage du conteneur $(docker start $NOM_CONTENEUR) : OK."
|
||||
# retour_cmd=$? # Le code d'exit de la fonction est stocké dans cette variable.
|
||||
# if [ $retour_cmd -ne 0 ]; then
|
||||
# if [ $retour_cmd -eq 1111 ]; then
|
||||
# echo "### DEBUG : soucis avec la récupération du retour de commande #1470000 "
|
||||
# exit 1470000
|
||||
# fi
|
||||
# echo "!! Le conteneur $NOM_CONTENEUR ne peut pas être redémarré..."
|
||||
# echo "!! Fin du script. Erreur 777"
|
||||
# echo
|
||||
# exit 777
|
||||
# fi
|
||||
|
||||
# Section concernant la rotation des sauvegardes.
|
||||
echo
|
||||
echo "-- Rotation des sauvegardes anciennes selon le nombre de jours d'archives à garder (=$NB_JOURS_A_GARDER) incluant ce jour :"
|
||||
echo
|
||||
echo
|
||||
echo "-- -- Utilisation de la fonction find pour trouver les fichiers de plus de $nb_jours_a_garder jours (incluant ce jour)."
|
||||
echo "-- -- Les fichiers suivants seront supprimés :"
|
||||
find $GITEA_BACKUP_DIR/* -name 'Gitea-Data-Backup*' -mtime +"$((NB_JOURS_A_GARDER - 1))" -exec ls -lat --color {} \;
|
||||
|
||||
# Utile pour débugguer avant de supprimer réellement les fichiers.
|
||||
#pause '--DEBUG-- Appuyer sur la touche [Entrer] pour continuer...'
|
||||
|
||||
echo "-- -- Suppression de ces fichiers..."
|
||||
find $GITEA_BACKUP_DIR/* -name 'Gitea-Data-Backup*' -mtime +"$((NB_JOURS_A_GARDER - 1))" -exec rm -v {} \;
|
||||
|
||||
############################################################
|
||||
# Cette partie peut être commentée
|
||||
echo
|
||||
echo "-- -- Il reste donc les fichiers suivants :"
|
||||
ls -lat --color $GITEA_BACKUP_DIR/Gitea-Data-Backup*
|
||||
############################################################
|
||||
|
||||
|
||||
echo "###############################################################################"
|
||||
echo "-- Processus de sauvegarde par création d'archive terminé."
|
||||
|
||||
fi
|
||||
|
||||
echo "$(date "+%R:%S - ") Fin du script de sauvegarde des donneés du conteneur Gitea"
|
||||
exit 0
|
||||
## ##
|
||||
##==============================================================================================
|
368
docker-compose/gitea/gitea-restore.sh
Normal file
@ -0,0 +1,368 @@
|
||||
##==============================================================================================
|
||||
## ##
|
||||
## Script gitea-restore.sh ##
|
||||
## ##
|
||||
##==============================================================================================
|
||||
## ##
|
||||
## gitea-restore.sh <méthode de backup> <fichier à restaurer> ##
|
||||
## <méthode de backup> = --gitea_dump ou --gdmp ##
|
||||
## = --archive_dossier ou --ad ##
|
||||
## <fichier à restaurer> = le nom du fichier archive à utiliser pour la restauration. ##
|
||||
## Ne peut être qu'un .zip pour la méthode --gitea_dump, ##
|
||||
## ou bien ##
|
||||
## ne peut être qu'un .tar.gz pour la méthode --archive_dossier #
|
||||
## Il faut impérativement donner le chemin d'accès complet de ce fichier archive... ##
|
||||
## ##
|
||||
##==============================================================================================
|
||||
|
||||
##==============================================================================================
|
||||
## ##
|
||||
## Objectif du script : Restaurer la sauvegarde de Gitea passée en paramètre ##
|
||||
## Il faudra indiquer la méthode de restauration basée sur le type de sauvegarde à restaurer. ##
|
||||
## Il faudra également indiquer l'archive à utiliser pour la restauration. ##
|
||||
## ##
|
||||
##==============================================================================================
|
||||
## ##
|
||||
## Une méthode officielle de restauration, de la base de données est présente ici : ##
|
||||
## https://docs.gitea.io/en-us/backup-and-restore/#restore-command-restore ##
|
||||
## ##
|
||||
##==============================================================================================
|
||||
|
||||
##==============================================================================================
|
||||
## ##
|
||||
## MAJ du 19.04.2021 : La partie de sauvegarde gite_dump ne sera pas programmée car c'est ##
|
||||
## trop galère à mettre en place. ##
|
||||
## Donc soit on ne donne aucun paramètre en argument au script, soit on met archive_dossier. ##
|
||||
## L'autre paramètre n'aura donc plus aucun effet. Ne pas l'utiliser ! ##
|
||||
## Cependant le code pour distinguer les deux paramètres reste, mais il n'y aura rien dans ##
|
||||
## la partie gitea_dump. ##
|
||||
## ##
|
||||
##==============================================================================================
|
||||
|
||||
|
||||
# Récupération des arguments qu'on place dans des variables constantes
|
||||
declare -r nb_arg=$# # Nombre d'argument(s) fourni(s) au script.
|
||||
declare -r methode="$1" # 1er argument fourni
|
||||
declare -r fichier="$2" # 2ème argument fourni
|
||||
declare -r tous_les_args="$*" # Tous les arguments
|
||||
|
||||
##==============================================================================================
|
||||
## VALEURS À PERSONNALISER ##
|
||||
## ##
|
||||
## Chemin d'accès vers votre dossier docker et vers le dossier de backup de gitea ##
|
||||
##==============================================================================================
|
||||
# Chemin complet du dossier qui contient le dossier des données (data) et des backups (backup-data)
|
||||
GITEA_DOCKER_DIR=/volume1/docker/gitea
|
||||
|
||||
# Les noms des dossiers montés dans le conteneur doivent êtres identiques à ceux présents sur la machine hôte. Sinon faudra modifier le script...
|
||||
# Nom du dossier contenant les backups qui doit exister car il doit être monté dans le conteneur à l'aide du docker-compose.yml.
|
||||
GITEA_BACKUP_DIR=backup-data
|
||||
|
||||
# Nom du dossier contenant les donneés de Gitea (data)
|
||||
GITEA_DATA_DIR=data
|
||||
|
||||
# Nom du conteneur
|
||||
NOM_CONTENEUR=gitea
|
||||
|
||||
# ID de l'utilisateur du NAS qui a les droits sur le conteneur
|
||||
ID_USER_NAS=1000
|
||||
##==============================================================================================
|
||||
##==============================================================================================
|
||||
|
||||
echo
|
||||
echo "Le script gitea-restore.sh permet de faire une restauration des données du conteneur Gitea."
|
||||
echo
|
||||
|
||||
##──── ────────────────────────────────────────────────────────────────────────────────────────
|
||||
## Début de la section concernant les fonctions ##
|
||||
##──── ────────────────────────────────────────────────────────────────────────────────────────
|
||||
|
||||
f_affiche_syntaxe(){
|
||||
# Fonction pour afficher la syntaxe d'utilisation du fichier script.
|
||||
# syntax: f_affiche_syntaxe <paramètre1> [<paramètre2>]
|
||||
# 1er paramètre : $1
|
||||
# 2nd paramètre éventuel : $2 Ce sera ce qui a été fourni en argument du script.
|
||||
local f_nb_arg=$#
|
||||
local f_param_1=$1
|
||||
local f_param_2=$2
|
||||
echo
|
||||
if [ "$f_param_1" = "#1" ]; then
|
||||
echo "La méthode de restauration choisie '$f_param_2' est incorrecte."
|
||||
echo
|
||||
elif [ "$f_param_1" = "#2" ]; then
|
||||
if [ -z "$f_param_2" ]; then
|
||||
echo "Aucun paramètre n'a été fourni au script..."
|
||||
else
|
||||
echo "Le nombre de paramètre fourni n'est pas correct. Paramètres fournis : '$f_param_2'"
|
||||
fi
|
||||
echo
|
||||
fi
|
||||
echo "Utilisation : gitea-restore.sh <méthode de backup> <fichier à restaurer>"
|
||||
#echo " * <méthode de backup> : --gitea_dump ou --gdmp pour utiliser la méthode gitea dump."
|
||||
|
||||
echo " * <méthode de backup> : --archive_dossier ou --ad pour utiliser la méthode archive dossier."
|
||||
echo " * <fichier à restaurer> : le nom du fichier archive à utiliser pour la restauration."
|
||||
#echo " Ne peut être qu'un .zip pour la méthode --gitea_dump,"
|
||||
#echo " ou bien ne peut être qu'un .7z ou .tar.gz pour la méthode --archive_dossier"
|
||||
echo " Ne peut être qu'un .7z ou un .tar.gz pour la méthode --archive_dossier."
|
||||
echo " Il faut impérativement donner le chemin d'accès complet de ce fichier archive..."
|
||||
echo
|
||||
|
||||
if [ "$f_param_1" = "#3" ]; then
|
||||
exit 1
|
||||
fi
|
||||
exit 3
|
||||
}
|
||||
|
||||
f_verif_fichier_existe() {
|
||||
# Fonction qui vérifie si le fichier fourni en paramètre existe, et qu'il s'agit d'un
|
||||
# fichier zip ou d'un fichier 7z.
|
||||
# Quoiqu'il arrive, l'appel à cette fonction marque la fin du script.
|
||||
#
|
||||
# syntax: f_verif_fichier_existe [<fichier_a_tester>]
|
||||
|
||||
local fichier_a_tester=$1
|
||||
|
||||
if [ -z "$fichier_a_tester" ]; then
|
||||
echo "!! Erreur fatale, le paramètre à tester de la fonction f_verif_fichier_existe() est vide ! Revoir l'appel à la fonction..."
|
||||
echo "!! Fin du script. Code d'erreur 10."
|
||||
return 11 # On stoppe immédiatement l'exécution de la fonction !
|
||||
fi
|
||||
if [ ! -s "$fichier_a_tester" ]; then # Le fichier 'fichier_a_tester' n'existe pas ou a un taille de 0 !
|
||||
return 1 # C'est le code d'erreur pour indiquer que le fichier n'existe pas.
|
||||
fi
|
||||
|
||||
# Quelle est l'extension du fichier fichier_a_tester ?
|
||||
fullfilename="$fichier_a_tester"
|
||||
filename=$(basename "$fullfilename")
|
||||
ext="${filename#*.}"
|
||||
echo $ext
|
||||
return 0
|
||||
}
|
||||
|
||||
f_verif_dossier_existe() {
|
||||
# Fonction qui vérifie si le dossier fourni en paramètre existe.
|
||||
#
|
||||
# syntax: f_verif_dossier_existe <dossier_a_tester>
|
||||
|
||||
local dossier_a_tester=$1 # On récupère le 1er paramètre passé en argument à la fonction.
|
||||
|
||||
if [ -d "$dossier_a_tester" ]; then # Le dossier 'dossier_a_tester' existe ! Il sera renommé.
|
||||
return 0 # C'est le code d'erreur pour indiquer que le dossier existe bien.
|
||||
else
|
||||
return 1 # C'est le code d'erreur pour indiquer que le dossier n'existe pas.
|
||||
fi
|
||||
|
||||
# Si le script arrive ici, c'est qu'il y a un soucis...
|
||||
echo "BLABLA Si tu lis ça, c'est que y a une couille dans le paté !!! 9988"
|
||||
exit 9988
|
||||
}
|
||||
##──── ────────────────────────────────────────────────────────────────────────────────────────
|
||||
## Fin de la section concernant les fonctions ##
|
||||
##──── ────────────────────────────────────────────────────────────────────────────────────────
|
||||
|
||||
|
||||
##──── ────────────────────────────────────────────────────────────────────────────────────────
|
||||
## Début du programme principal ##
|
||||
##──── ────────────────────────────────────────────────────────────────────────────────────────
|
||||
if [ $nb_arg -ne 2 ]; then
|
||||
f_affiche_syntaxe "#2" "$tous_les_args" # On affiche la syntaxe car le nombre de paramètres n'est pas correct.
|
||||
fi
|
||||
|
||||
mode_backup=""
|
||||
case "$methode" in
|
||||
--[hH][eE][lL][pP] | --[hH] | -[hH][eE][lL][pP] | -[hH] ) # Premier argument --help ou --h
|
||||
f_affiche_syntaxe # On affiche la syntaxe
|
||||
;;
|
||||
|
||||
--gitea_dump | --gdmp)
|
||||
mode_backup="gitea_dump"
|
||||
;; # On ne surcharge pas cette partie avec le code de restauration, ce sera fait plus bas.
|
||||
|
||||
--archive_dossier | --ad)
|
||||
mode_backup="archive_dossier"
|
||||
;; # On ne surcharge pas cette partie avec le code de restauration, ce sera fait plus bas.
|
||||
|
||||
*) # Aucune méthode sélectionnée valide ou bien trop d'arguments
|
||||
mode_backup="non_choisi"
|
||||
f_affiche_syntaxe "#1" "$methode" # On affiche la syntaxe car le paramètre de méthode est incorrect.
|
||||
echo "BLABLA Si tu lis ça, c'est que y a une couille dans le paté !!! 9999"
|
||||
exit 9999
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "La méthode de restauration choisie est : $methode "
|
||||
echo
|
||||
|
||||
# Test si le fichier en argument existe et est valide (archive zip pour ).
|
||||
ext_fichier=""
|
||||
ext_fichier="$(f_verif_fichier_existe $fichier)" # Vérification que le fichier à restaurer existe bien et est bien un .zip ou un .7z
|
||||
retour_fct=$? # Le code d'exit de la fonction est stocké dans cette variable.
|
||||
if [ $retour_fct -ne 0 ]; then
|
||||
case "$retour_fct" in
|
||||
1) # Le fichier n'existe pas.
|
||||
echo "!! Le fichier $fichier n'existe pas. La restauration ne peut pas s'effectuer."
|
||||
echo "!! Fin du script. Erreur 10"
|
||||
echo
|
||||
exit 10
|
||||
;;
|
||||
11) # Problème avec l'appelle de la fonction, revoir le code ci-dessus...
|
||||
exit 11
|
||||
;;
|
||||
*) # Toutes autres valeurs ne devrait pas exister !
|
||||
echo "!! Erreur fatale qui ne devrait pas exister !"
|
||||
echo "!! Code d'erreur 1000"
|
||||
exit 1000
|
||||
;;
|
||||
esac
|
||||
else
|
||||
echo "Le fichier existe et a une taille non nulle. Le script peut continuer."
|
||||
echo
|
||||
echo "Début de la restauration ---"
|
||||
fi
|
||||
|
||||
cd $GITEA_DOCKER_DIR # On se place dans le dossier du conteneur gitea
|
||||
retour_cmd=$? # Le code d'exit de la fonction est stocké dans cette variable.
|
||||
if [ $retour_cmd -ne 0 ]; then
|
||||
echo "!! Le dossier $GITEA_DOCKER_DIR semble ne pas exister. Vérifier la variable GITEA_DOCKER_DIR dans le script."
|
||||
echo "!! Fin du script. Erreur 333"
|
||||
echo
|
||||
exit 333
|
||||
fi
|
||||
|
||||
# Note : Si le dossier GITEA_DATA_DIR existe il sera renommé en GITEA_DATA_DIR--$(date +%Y-%m-%d--%Hh%M)
|
||||
# avec la commande mv "$GITEA_DATA_DIR" "$GITEA_DATA_DIR--$(date +%Y-%m-%d--%Hh%M)"
|
||||
# Ce test sera fait lors de l'appel de la fonction verif_dossier_existe().
|
||||
# Aucun choix ne sera possible, le dossier existant sera forcément renommé.
|
||||
#
|
||||
# Note : Il faut que le dossier GITEA_BACKUP_DIR existe, ce qui semble acquis vu que le fichier backup
|
||||
# à restaurer doit être dedans... Mais il est vital que ce dossier existe car un dossier 'TEMP'
|
||||
# y sera créé pour extraire les données de l'archive (zip, 7z, ou tar.gz)...
|
||||
#
|
||||
# On teste maintenant l'existence des deux dossiers précédents.
|
||||
# Si un des deux dossiers n'est pas présents, le script sera interrompu.
|
||||
|
||||
# 1er test : GITEA_DATA_DIR
|
||||
retour_fct=11111 # Valeur reset.
|
||||
f_verif_dossier_existe $GITEA_DATA_DIR
|
||||
retour_fct=$? # Le code d'exit de la fonction est stocké dans cette variable.
|
||||
if [ $retour_fct -eq 0 ]; then # Le dossier existe, on peut continuer
|
||||
echo "-- Le dossier $dossier_a_tester existe et va être renommé en $dossier_a_tester--$(date +%Y-%m-%d--%Hh%M)"
|
||||
else # Le dossier n'existe pas
|
||||
echo "!! Le dossier $dossier_a_tester n'existe ! Veuillez créer le dossier $dossier_a_tester puis relancer le script."
|
||||
echo "!! Interruption de l'exécution du script. Code 444"
|
||||
exit 444 # C'est le code d'erreur pour indiquer que le dossier n'existe pas et que le script a été interrompu.
|
||||
fi
|
||||
|
||||
# 2ème test : GITEA_BACKUP_DIR
|
||||
retour_fct=11111 # Valeur reset.
|
||||
f_verif_dossier_existe $GITEA_BACKUP_DIR
|
||||
retour_fct=$? # Le code d'exit de la fonction est stocké dans cette variable.
|
||||
if [ $retour_fct -eq 0 ]; then # Le dossier existe, on peut continuer
|
||||
echo "-- Le dossier $dossier_a_tester existe bien. La restauration peut continuer."
|
||||
else # Le dossier n'existe pas
|
||||
echo "!! Le dossier $dossier_a_tester n'existe ! Vérifier que ce dossier est bien paramétré dans le script."
|
||||
echo "!! Interruption de l'exécution du script. Code 555"
|
||||
exit 555 # C'est le code d'erreur pour indiquer que le dossier n'existe pas et que le script a été interrompu.
|
||||
fi
|
||||
|
||||
# Maintenant on sait que les deux dossiers GITEA_BACKUP_DIR et GITEA_DATA_DIR existent.
|
||||
|
||||
case "$mode_backup" in
|
||||
gitea_dump)
|
||||
|
||||
if [ $ext_fichier != "zip" ]; then
|
||||
echo "!! Le fichier archive $(basename "$fichier") n'est pas une archive ZIP."
|
||||
echo "!! Fin du script."
|
||||
f_affiche_syntaxe "#3"
|
||||
fi
|
||||
|
||||
echo -e "\t-- Méthode de restauration à venir, un jour si j'ai le courage...\n"
|
||||
echo -e "\t-- Donc, pour le moment il ne se passera rien avec cette méthode...\n"
|
||||
exit 0
|
||||
|
||||
# Extraction de l'archive zip créé avec gitea dump avec 7z :
|
||||
# 7z x -o/volume1/docker/gitea/backup-data -tzip /volume1/docker/gitea/backup-data/gitea-dump-1618217429.zip
|
||||
|
||||
echo
|
||||
;;
|
||||
|
||||
archive_dossier)
|
||||
|
||||
if [ $ext_fichier != "7z" ] && [ $ext_fichier != "tar.gz" ]; then
|
||||
echo "!! Le fichier archive $(basename "$fichier") n'est pas une archive 7z ou tar.gz."
|
||||
echo "!! Fin du script."
|
||||
f_affiche_syntaxe "#3" # Le script est interrompu.
|
||||
fi
|
||||
|
||||
echo -e "\t-- Restauration de la sauvegarde $fichier \n\t par extraction de l'archive dans le dossier $GITEA_DATA_DIR\n"
|
||||
|
||||
# Comme on sait que le dossier existe, il est renommée après avoir éteint le conteneur.
|
||||
retour_cmd=1111 # Valeur reset
|
||||
echo -e "\t-- Extinction du conteneur $(docker stop $NOM_CONTENEUR)\n"
|
||||
retour_cmd=$? # Le code d'exit de la fonction est stocké dans cette variable.
|
||||
if [ $retour_cmd -ne 0 ]; then
|
||||
if [ $retour_cmd -eq 1111 ]; then
|
||||
echo "### DEBUG : soucis avec la récupération du retour de commande #1470000 "
|
||||
exit 1470000
|
||||
fi
|
||||
echo "!! Le conteneur $NOM_CONTENEUR ne peut pas être arrêté..."
|
||||
echo "!! Fin du script. Erreur 777"
|
||||
echo
|
||||
exit 777
|
||||
fi
|
||||
|
||||
mv "$GITEA_DATA_DIR" "$GITEA_DATA_DIR--$(date +%Y-%m-%d--%Hh%M)"
|
||||
|
||||
# En fonction du type d'archive donnée en paramètre au script, ce n'est pas la même manière d'extraire les données.
|
||||
# Mais quoiqu'il arrive on crée un dossier TEMP dans le dossier GITEA_BACKUP_DIR pour y placer les données extraites.
|
||||
# Ce dossier TEMP sera supprimé à la fin de la restauration.
|
||||
mkdir "$GITEA_BACKUP_DIR/TEMP"
|
||||
|
||||
case "$ext_fichier" in
|
||||
7z)
|
||||
echo -e "\t-- Extraction des données de l'archive 7z utilisée.\n"
|
||||
# Restauration d'un fichier 7z :
|
||||
7z x -so $fichier | tar xf - -C "$GITEA_BACKUP_DIR/TEMP"
|
||||
;;
|
||||
tar.gz)
|
||||
echo -e "\t-- Extraction des données de l'archive tar.gz utilisée.\n"
|
||||
# Restauration d'un fichier tar.gz :
|
||||
tar -xzf $fichier -C "$GITEA_BACKUP_DIR/TEMP"
|
||||
;;
|
||||
*)
|
||||
echo "Erreur d'extension non prévue ! Revoir le code. Erreur 88."
|
||||
exit 88
|
||||
esac
|
||||
|
||||
# On déplace le dossier extrait data dans GITEA_DOCKER_DIR (Rappel on est dans le dossier gitea qui contient le dossiers GITEA_BACKUP_DIR)
|
||||
mv "$GITEA_BACKUP_DIR/TEMP/data" "$GITEA_DOCKER_DIR" # On pourrait utiliser "./" à la place de "$GITEA_DOCKER_DIR"
|
||||
|
||||
# Le dossier TEMP étant maintenant vide, on le supprime
|
||||
rm -rf "$GITEA_BACKUP_DIR/TEMP"
|
||||
|
||||
retour_cmd=1111 # Valeur reset
|
||||
echo -e "\t-- Redémarrage du conteneur $(docker start $NOM_CONTENEUR)\n"
|
||||
retour_cmd=$? # Le code d'exit de la fonction est stocké dans cette variable.
|
||||
if [ $retour_cmd -ne 0 ]; then
|
||||
if [ $retour_cmd -eq 1111 ]; then
|
||||
echo "### DEBUG : soucis avec la récupération du retour de commande #1470000 "
|
||||
exit 1470000
|
||||
fi
|
||||
echo "!! Le conteneur $NOM_CONTENEUR ne peut pas être redémarré..."
|
||||
echo "!! Fin du script. Erreur 777"
|
||||
echo
|
||||
exit 777
|
||||
fi
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "!! Un problème est survenu ! Revoir le script. Code XYZ = 199 !"
|
||||
echo
|
||||
return 199
|
||||
;;
|
||||
esac
|
||||
|
||||
echo
|
||||
echo "Restauration terminée. Bonne journée :)"
|
||||
echo
|
BIN
docker-compose/gitea/tuto-1.png
Normal file
After Width: | Height: | Size: 64 KiB |
BIN
docker-compose/gitea/tuto-2.png
Normal file
After Width: | Height: | Size: 26 KiB |
BIN
docker-compose/gitea/tuto-3.png
Normal file
After Width: | Height: | Size: 174 KiB |