mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
french translation of cards
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -2908,6 +2908,7 @@ lblHeal=Heilen
|
||||
lblTempHitPoints=Temporäre Trefferpunkte
|
||||
#CardDetailUtil.java
|
||||
lblChosenColors=Chosen colors:
|
||||
lblLoyalty=Loyalty
|
||||
#Achievement.java
|
||||
lblCommon=Common
|
||||
lblUncommon=Uncommon
|
||||
|
||||
@@ -2911,6 +2911,7 @@ lblHeal=Heal
|
||||
lblTempHitPoints=Temporary Hit Points
|
||||
#CardDetailUtil.java
|
||||
lblChosenColors=Chosen colors:
|
||||
lblLoyalty=Loyalty
|
||||
#Achievement.java
|
||||
lblCommon=Common
|
||||
lblUncommon=Uncommon
|
||||
|
||||
@@ -2911,6 +2911,7 @@ lblHeal=Curar
|
||||
lblTempHitPoints=Puntos de golpe temporales
|
||||
#CardDetailUtil.java
|
||||
lblChosenColors=Chosen colors:
|
||||
lblLoyalty=Loyalty
|
||||
#Achievement.java
|
||||
lblCommon=Common
|
||||
lblUncommon=Uncommon
|
||||
|
||||
@@ -18,8 +18,8 @@ lblerrLoadingLayoutFile=Votre fichier de mise en page %s n''a pas pu être lu. I
|
||||
lblLoadingQuest=Chargement de la quête...
|
||||
#FScreen.java
|
||||
#translate lblHomeWithSpaces,lblDeckEditorWithSpaces need keep spaces in text
|
||||
lblHomeWithSpaces=Accueil
|
||||
lblDeckEditorWithSpaces=Éditeur de deck
|
||||
lblHomeWithSpaces=Accueil
|
||||
lblDeckEditorWithSpaces=Éditeur de deck
|
||||
lblWorkshop=Atelier
|
||||
lblBacktoHome=Retour à l''accueil
|
||||
lblCloseEditor=Fermer l''éditeur
|
||||
@@ -70,7 +70,7 @@ cbLoadCardsLazily=Charger les scripts de carte paresseusement
|
||||
cbLoadArchivedFormats=Charger les formats archivés
|
||||
cbWorkshopSyntax=Vérificateur de syntaxe de l''atelier
|
||||
cbEnforceDeckLegality=Conformité du deck
|
||||
cbSideboardForAI=Buffet humain pour l''IA
|
||||
cbSideboardForAI=Réserve humain pour l''IA
|
||||
cbPerformanceMode=Mode Performances
|
||||
cbFilteredHands=Mains filtrées
|
||||
cbImageFetcher=Télécharger automatiquement l''illustration de la carte manquante
|
||||
@@ -438,7 +438,7 @@ btnBuildNewSealedDeck=Construire un nouveau deck scellé
|
||||
lblSealedModeInstruction=INSTRUCTIONS POUR LE MODE DECK SCELLÉ\r\n\r\nDans les tournois Sealed Deck, chaque joueur reçoit six boosters à partir desquels construire son deck.\r\n\r\nSelon les sets à utiliser dans un deck scellé événement, la distribution des packs peut varier considérablement.\r\n\r\nCrédit : Wikipedia
|
||||
#FDeckChooser.java
|
||||
lblViewDeck=Voir le deck
|
||||
lblRandomDeck=Plateau aléatoire
|
||||
lblRandomDeck=Deck aléatoire
|
||||
lblRandomColors=Couleurs aléatoires
|
||||
lblMustSelectGenerateNewDeck=Vous devez sélectionner quelque chose avant de pouvoir générer un nouveau deck.
|
||||
lblOK=OK
|
||||
@@ -450,7 +450,7 @@ lblChooseAllowedDeckTypeOpponents=Choisir les types de deck autorisés pour les
|
||||
lblSelectOpponentDeck=Sélectionner le deck de l''adversaire
|
||||
lblGenerateNewDeck=Générer un nouveau deck
|
||||
lblRandomTheme=Thème aléatoire
|
||||
lblTestDeck=Plateau de test
|
||||
lblTestDeck=Deck de test
|
||||
lblLoading=Chargement
|
||||
#GameType.java
|
||||
lblSealed=Scellé
|
||||
@@ -512,7 +512,7 @@ lblStartingPool=Pool de départ
|
||||
lblAllCardsAvailable=Toutes les cartes seront disponibles pour jouer.
|
||||
lblStarterEventdeck=Deck Starter/Événement :
|
||||
lblSanctionedFormat=Format sanctionné
|
||||
lblCustomdeck=Plateau personnalisé
|
||||
lblCustomdeck=Deck personnalisé
|
||||
lblDefineCustomFormat=Définir le format personnalisé
|
||||
lblSelectFormat=Sélectionner le format
|
||||
lblStartWithAllCards=Commencer avec toutes les cartes des ensembles sélectionnés
|
||||
@@ -599,7 +599,7 @@ lblUndetermined=Indéterminé
|
||||
btnSpendTokenTT=Crée un nouveau tournoi qui peut être joué immédiatement.
|
||||
lblPastResults=Résultats passés
|
||||
#VSubmenuQuestDecks.java
|
||||
lblQuestDecks=Plateaux de quêtes
|
||||
lblQuestDecks=Decks de quêtes
|
||||
lblQuestDesc1=En mode Quête, vous construisez un deck à partir d''un inventaire limité.
|
||||
lblQuestDesc2=Construisez et améliorez les decks à partir des cartes de votre inventaire de quête au fur et à mesure qu''il grandit.
|
||||
lblQuestDesc3=Ensuite, passez au sous-menu Duels ou Challenges pour jouer contre des adversaires IA et débloquer plus de cartes.
|
||||
@@ -613,7 +613,7 @@ lblRandomCommanderCard-basedDecks=Decks aléatoires basés sur des cartes Comman
|
||||
lblOathbreakerDecks=Decks de briseur de serment
|
||||
lblTinyLeadersDecks=Decks de petits leaders
|
||||
lblBrawlDecks=Decks de bagarre
|
||||
lblSchemeDecks=Plateaux de schémas
|
||||
lblSchemeDecks=Decks de schémas
|
||||
lblPlanarDecks=Decks planaires
|
||||
lblPreconstructedDecks=Decks préconstruits
|
||||
lblPreconCommanderDecks=Decks Commandant Precon
|
||||
@@ -636,7 +636,7 @@ lblNetArchivePioneerDecks=Decks pionniers de l''archivage net
|
||||
lblNetArchiveModernDecks=Net Archiver les decks modernes
|
||||
lblNetArchiveLegacyDecks=Decks hérités de Net Archive
|
||||
lblNetArchiveVintageDecks=Net Archiver les decks vintage
|
||||
lblNetArchiveBlockDecks=Plateaux de blocs d''archives réseau
|
||||
lblNetArchiveBlockDecks=Decks de blocs d''archives réseau
|
||||
lblNetArchivePauperDecks=Decks Pauper Net Archive
|
||||
#VSubmenuTutorial
|
||||
lblTutorial=Tutoriel
|
||||
@@ -717,7 +717,7 @@ lblUnlocked=Vous avez réussi à déverrouiller %n !
|
||||
titleUnlocked=%n déverrouillé !
|
||||
lblStartADuel=Commencer un duel.
|
||||
lblSelectAQuestDeck=Veuillez sélectionner un deck de quête.
|
||||
lblInvalidDeck=Plateau invalide
|
||||
lblInvalidDeck=Deck invalide
|
||||
lblInvalidDeckDesc=Votre deck %n\nVeuillez modifier ou choisir un autre deck.
|
||||
#VSubmenuQuestPrefs.java
|
||||
lblQuestPreferences=Préférences de quête
|
||||
@@ -867,7 +867,7 @@ lblJumptopnexttable=Aller au tableau suivant
|
||||
lblJumptotextfilter=Aller au filtre de texte
|
||||
lblChooseavalueforX=Choisir une valeur pour X
|
||||
#VCurrentDeck.java
|
||||
lblVCurrentDeck=Plateau actuel
|
||||
lblVCurrentDeck=Deck actuel
|
||||
ttbtnSave=Enregistrer le deck (Ctrl+S)
|
||||
ttbtnSaveAs=Enregistrer le deck sous (Ctrl+E)
|
||||
ttbtnLoadDeck=Ouvrir le deck (Ctrl+O)
|
||||
@@ -890,8 +890,8 @@ lblCatalog=Catalogue
|
||||
lblAdd=Ajouter
|
||||
lbltodeck=vers le deck
|
||||
lblfromdeck=du deck
|
||||
lbltosideboard=au buffet
|
||||
lblfromsideboard=du buffet
|
||||
lbltosideboard=à la réserve
|
||||
lblfromsideboard=de la réserve
|
||||
lblascommander=comme commandant
|
||||
lblasoathbreaker=en tant que briseur de serment
|
||||
lblassignaturespell=comme sort de signature
|
||||
@@ -956,7 +956,7 @@ ttbtnRandDeck3=Générer un deck construit de 3 couleurs dans la zone de deck ac
|
||||
btnRandDeck5=Construit (5 couleurs)
|
||||
ttbtnRandDeck5=Générer un deck construit en 5 couleurs dans la zone de deck actuelle
|
||||
#DeckCotroller.java
|
||||
lblCurrentDeck2=Plateau actuel
|
||||
lblCurrentDeck2=Deck actuel
|
||||
lblUntitled=Sans titre
|
||||
#VPrompt.java
|
||||
lblPrompt=Invite
|
||||
@@ -981,7 +981,7 @@ ttMain=Deck principal
|
||||
lblQty=Qté
|
||||
lblQuantity=Quantité
|
||||
lblSide=Côté
|
||||
lblSideboard=Buffet
|
||||
lblSideboard=Réserve
|
||||
lblNew=Nouveau
|
||||
lblOwned=Possédé
|
||||
lblPower=Puissance
|
||||
@@ -1221,7 +1221,7 @@ lblNoKnownCardsOnClipboard=Aucune carte connue trouvée dans le presse-papiers.\
|
||||
lblChangeSection=Changer de section
|
||||
lblDeckListCopiedClipboard=Liste des decks pour ''{0}'' copiée dans le presse-papiers.
|
||||
#FSideboardDialog.java
|
||||
lblUpdateMainFromSideboard=Mettre à jour le deck principal depuis le buffet%s
|
||||
lblUpdateMainFromSideboard=Mettre à jour le deck principal depuis la réserve%s
|
||||
#FVanguardChooser.java
|
||||
lblRandomVanguard=Avant-garde aléatoire
|
||||
#FOptionPane.java
|
||||
@@ -1267,7 +1267,7 @@ lblAssignCombatDamageAsChoose=Voulez-vous diviser les dégâts de combat de {0}
|
||||
lblAssignCombatDamageToCreature=Voulez-vous assigner les blessures de combat de {0} à une créature contrôlée par le joueur défenseur ?
|
||||
lblChooseCreature=Choisir une créature
|
||||
lblChosenCards=Cartes choisies
|
||||
lblAttaquant=Attaquant
|
||||
lblAttacker=Attaquant
|
||||
lblTriggeredby=Déclencher par
|
||||
lblChooseWhichCardstoReveal=Choisissez quelle(s) carte(s) révéler
|
||||
lblChooseCardsActivateOpeningHandandOrder=Choisissez les cartes à activer à partir de la main d''ouverture et leur ordre
|
||||
@@ -1423,7 +1423,7 @@ btnStartNewMatch=Commencer une nouvelle correspondance
|
||||
btnQuitMatch=Quitter la correspondance
|
||||
lblItsADraw=C''est un match nul !
|
||||
lblTeamWon=l''équipe %s a gagné !
|
||||
lblWinnerWon=%s gagné !
|
||||
lblWinnerWon=%s a gagné !
|
||||
lblGameLog=Journal du jeu
|
||||
#NewDraftScreen.java
|
||||
lblLoadingNewDraft=Chargement du nouveau brouillon...
|
||||
@@ -1481,7 +1481,7 @@ lblLogPlayerHasRestoredControlThemself={0} a restauré le contrôle sur lui-mêm
|
||||
lblLogPlayerControlledTargetPlayer={0} est contrôlé par {1}
|
||||
lblDeathtouch=Deathtouch
|
||||
lblAsM1M1Counters=As -1/-1 Compteurs
|
||||
lblRemovingNLoyaltyCounter=Suppression de {0} compteur de fidélité
|
||||
lblRemovingNLoyaltyCounter=Suppression de {0} compteur de loyauté
|
||||
lblSourceDealsNDamageToDest={0} inflige {1} dégâts ({2}) à {3}.
|
||||
lblLogPlayerPlayedLand={0} a joué {1}
|
||||
lblLogTurnNOwnerByPlayer=Tourner {0} ({1})
|
||||
@@ -2109,7 +2109,7 @@ lblExileZone=exil
|
||||
lblFlashbackZone=flashback
|
||||
lblCommandZone=commande
|
||||
lblStackZone=pile
|
||||
lblSideboardZone=buffet
|
||||
lblSideboardZone=réserve
|
||||
lblAnteZone=anté
|
||||
lblSchemeDeckZone=schemedeck
|
||||
lblPlanarDeckZone=planardeck
|
||||
@@ -2248,7 +2248,7 @@ lblArtist=Artiste
|
||||
lblAverageCMC=Valeur de mana moyenne
|
||||
lblMainDeck=Deck principal
|
||||
lblMainDeckSize=Taille du deck principal
|
||||
lblSideboardSize=Taille du buffet
|
||||
lblSideboardSize=Taille de la réserve
|
||||
lblOrigin=Origine
|
||||
lblDeckAverageCMC=Valeur moyenne du mana du deck
|
||||
lblDeckContents=Contenu du deck
|
||||
@@ -2446,7 +2446,7 @@ lblErrorSavingFile=Erreur lors de l''enregistrement du fichier
|
||||
lblCardNameAndCost=Nom et coût de la carte
|
||||
lblCardType=Type de carte
|
||||
lblCardID=ID de la carte
|
||||
lblCardPTOrLoyalty=Carte P/T ou fidélité
|
||||
lblCardPTOrLoyalty=Carte P/T ou loyauté
|
||||
#ArcaneMaster.java
|
||||
lblArcaneMaster=Maître des arcanes
|
||||
lblWinGameWithOutCasting=Gagner une partie sans lancer
|
||||
@@ -2587,7 +2587,7 @@ lblTotalManaCost=Coût total en mana
|
||||
lblAverageManaCost=Coût de mana moyen
|
||||
lblCardByColorTypeCMC=CARTES PAR COULEUR, TYPE ET VALEUR MANA :
|
||||
lblBreakdownOfColorTypeCMC=Répartition des cartes par couleur, type et valeur de mana
|
||||
lblColoredManaSymbolsINManaCost=SYMBOLES DE MANA COLORÉS DANS LE COÛT DE MANA :
|
||||
lblColoredManaSymbolsINManaCost=SYMBOLES DE MANA COLORÉS DANS LE COÛT DE MANA :
|
||||
lblAmountOfManaSymbolsInManaCostOfCards=Nombre de symboles de mana dans le coût en mana des cartes
|
||||
lblMulticolorCardCount=Nombre de cartes multicolores
|
||||
lblBlackCardCount=Nombre de cartes noires
|
||||
@@ -2662,7 +2662,7 @@ lblExileNCards=Exil ({0})
|
||||
lblFlashbackNCards=Cartes Flashback ({0})
|
||||
lblCommandZoneNCards=Zone de commande ({0})
|
||||
lblAnteZoneNCards=Zone ante ({0})
|
||||
lblSideboardNCards=Buffet ({0})
|
||||
lblSideboardNCards=Réserve ({0})
|
||||
lblWhiteManaOfN=Mana blanc ({0})
|
||||
lblBlueManaOfN=Mana bleu ({0})
|
||||
lblBlackManaOfN=Mana noir ({0})
|
||||
@@ -2914,6 +2914,7 @@ lblHeal=Guérir
|
||||
lblTempHitPoints=Points de vie temporaires
|
||||
#CardDetailUtil.java
|
||||
lblChosenColors=Couleurs choisies :
|
||||
lblLoyalty=Loyauté
|
||||
#Achievement.java
|
||||
lblCommon=Commun
|
||||
lblUncommon=Peu commun
|
||||
|
||||
@@ -2914,6 +2914,7 @@ lblHeal=Guarire
|
||||
lblTempHitPoints=Punti ferita temporanei
|
||||
#CardDetailUtil.java
|
||||
lblChosenColors=Chosen colors:
|
||||
lblLoyalty=Loyalty
|
||||
#Achievement.java
|
||||
lblCommon=Common
|
||||
lblUncommon=Uncommon
|
||||
|
||||
@@ -2910,6 +2910,7 @@ lblHeal=癒し
|
||||
lblTempHitPoints=一時的なヒットポイント
|
||||
#CardDetailUtil.java
|
||||
lblChosenColors=Chosen colors:
|
||||
lblLoyalty=Loyalty
|
||||
#Achievement.java
|
||||
lblCommon=Common
|
||||
lblUncommon=Uncommon
|
||||
|
||||
@@ -3000,6 +3000,7 @@ lblHeal=Curar
|
||||
lblTempHitPoints=Pontos de vida temporários
|
||||
#CardDetailUtil.java
|
||||
lblChosenColors=Chosen colors:
|
||||
lblLoyalty=Loyalty
|
||||
#Achievement.java
|
||||
lblCommon=Common
|
||||
lblUncommon=Uncommon
|
||||
|
||||
@@ -2893,6 +2893,7 @@ lblHeal=愈合
|
||||
lblTempHitPoints=临时生命值
|
||||
#CardDetailUtil.java
|
||||
lblChosenColors=Chosen colors:
|
||||
lblLoyalty=Loyalty
|
||||
#Achievement.java
|
||||
lblCommon=Common
|
||||
lblUncommon=Uncommon
|
||||
|
||||
@@ -198,7 +198,7 @@ public class CardDetailUtil {
|
||||
ptText.insert(0, "P/T: ");
|
||||
ptText.append(" - ").append("Loy: ");
|
||||
} else {
|
||||
ptText.append("Loyalty: ");
|
||||
ptText.append(Localizer.getInstance().getMessage("lblLoyalty")).append(": ");
|
||||
}
|
||||
|
||||
ptText.append(card.getLoyalty());
|
||||
|
||||
@@ -6,15 +6,20 @@
|
||||
"""
|
||||
__author__ = 'add-le'
|
||||
|
||||
import sys
|
||||
import requests
|
||||
import signal
|
||||
import json
|
||||
import sys
|
||||
import re
|
||||
|
||||
from bs4 import BeautifulSoup
|
||||
|
||||
file = open('../res/languages/cardnames-fr-FR.txt', 'r', encoding='utf-8')
|
||||
lines = file.readlines()
|
||||
file.close()
|
||||
|
||||
counter = 0
|
||||
output = open('./cardnames-fr-FR-missing.txt', 'a', encoding='utf-8')
|
||||
notfound = open('./cardnames-fr-FR-notfound.txt', 'a', encoding='utf-8')
|
||||
|
||||
# Scrap from play-in.com
|
||||
url = 'https://www.play-in.com/recherche/result.php?s='
|
||||
@@ -23,8 +28,23 @@ url = 'https://www.play-in.com/recherche/result.php?s='
|
||||
SUCCESS_STATUS = 200
|
||||
|
||||
# Generate by the method mapAlphabet()
|
||||
utils = {'A': 0, 'B': 1275, 'C': 2541, 'D': 4121, 'E': 5443, 'F': 6195, 'G': 7172, 'H': 8389, 'I': 9169, 'J': 9712, 'K': 9948, 'L': 10570, 'M': 11248, 'N': 12564, 'O': 13110, 'P': 13575, 'Q': 14594, 'R': 14678, 'S': 15887, 'T': 18948, 'U':
|
||||
20261, 'V': 20549, 'W': 21167, 'X': 21967, 'Y': 21983, 'Z': 22068}
|
||||
utils = {'A': 0, 'B': 1396, 'C': 2795, 'D': 4515, 'E': 5927, 'F': 6804, 'G': 7869, 'H': 9184, 'I': 10029, 'J': 10639, 'K': 10914, 'L': 11584, 'M': 12336, 'N': 13765, 'O': 14349, 'P': 14849, 'Q': 15970, 'R': 16063, 'S': 17391, 'T': 20691, 'U': 22167, 'V': 22485, 'W': 23145, 'X': 23978, 'Y': 23999, 'Z': 24099}
|
||||
|
||||
"""
|
||||
" Function to get all missing cards in the french translation
|
||||
" thanks to the scryfall bulk data.
|
||||
"""
|
||||
def getMissingCards():
|
||||
bulkfile = open('./scryfallcards.json', 'r', encoding='utf-8')
|
||||
bulk = json.load(bulkfile)
|
||||
bulkfile.close()
|
||||
|
||||
allcards = open('./cardnames-fr-FR.txt', 'w', encoding='utf-8')
|
||||
for cards in bulk:
|
||||
allcards.writelines(cards['name'] + '|||\n')
|
||||
|
||||
allcards.close()
|
||||
exit(0)
|
||||
|
||||
|
||||
"""
|
||||
@@ -62,7 +82,7 @@ def findNewCards():
|
||||
"""
|
||||
def mapAlphabet():
|
||||
alphabet = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']
|
||||
alphaMap: dict = {"A": 0}
|
||||
alphaMap: dict = {'A': 0}
|
||||
index = 1
|
||||
|
||||
for line in lines:
|
||||
@@ -76,98 +96,140 @@ def mapAlphabet():
|
||||
else:
|
||||
# Change to next letter
|
||||
index = index + 1
|
||||
exit(0)
|
||||
|
||||
|
||||
def convertMana(cardInfo: str) -> str:
|
||||
"""Convert HTML tag to Forge MTG compatible tags."""
|
||||
cardInfo = cardInfo.replace('<br />', '\\n')
|
||||
# Replace all symbol by its correspondance
|
||||
symbol = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '100', '(', ')', '!']
|
||||
|
||||
card: str = str(cardInfo)
|
||||
card = card.replace('\n', '')
|
||||
card = card.replace('<br/>', '\\n')
|
||||
card = card.replace('<br />', '\\n')
|
||||
card = card.replace('<br>', '\\n')
|
||||
card = card.replace('</img>', '')
|
||||
card = card.replace('<div class="txt">', '')
|
||||
card = card.replace('</div>', '')
|
||||
card = card.replace('/>', '')
|
||||
card = card.replace('>', '')
|
||||
|
||||
#Replace all correspondances of [0-9A-Z]
|
||||
symbol = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '100', '(', ')']
|
||||
for sym in symbol:
|
||||
cardInfo = cardInfo.replace("<img src='/img/symbole/mana/" + sym + ".png' />", '{' + sym + '}')
|
||||
card = card.replace('<img src="/img/symbole/mana/' + sym + '.png"', '{' + sym + '}')
|
||||
|
||||
return cardInfo
|
||||
return card
|
||||
|
||||
|
||||
#Manuel scrap
|
||||
if len(sys.argv) >= 2:
|
||||
if sys.argv[1] == '-m' or sys.argv[1] == '--map':
|
||||
mapAlphabet()
|
||||
"""
|
||||
" Get the differents part of the translatedInfo for a split card.
|
||||
"""
|
||||
def getSplittedInfo(cardInfo: str):
|
||||
cardSplitted = re.split(r'- - [- ]*', cardInfo)
|
||||
cardSplitted[0] = cardSplitted[0].replace('\\n', '')
|
||||
cardSplitted[1] = cardSplitted[1].replace('\\n', '')
|
||||
return [cardSplitted[0], cardSplitted[1]]
|
||||
|
||||
if sys.argv[1] == '-f' or sys.argv[1] == '--find':
|
||||
findNewCards()
|
||||
|
||||
if sys.argv[1] == '-u' or sys.argv[1] == '--url':
|
||||
if len(sys.argv) <= 2:
|
||||
print('Missing second arg : url to scrap')
|
||||
exit(1)
|
||||
|
||||
output = open('./cardnames-fr-FR-missing.txt', 'a', encoding='utf-8')
|
||||
|
||||
response = requests.get(sys.argv[2])
|
||||
|
||||
#Founded
|
||||
"""
|
||||
" Main function to scrap play-in website and create the translation unit.
|
||||
"""
|
||||
def scrap(url: str):
|
||||
# Request the website with the url of the card on play-in
|
||||
response = requests.get(url)
|
||||
try:
|
||||
# Use BeautifulSoup to scrap the html page
|
||||
soup = BeautifulSoup(response.content.decode('utf-8'), features='html.parser')
|
||||
# Check if the request returns HTTP Code OK
|
||||
if response.status_code == SUCCESS_STATUS:
|
||||
#Get brut chaos the data from web page
|
||||
|
||||
# Check if the card is found on the website
|
||||
title = soup.find('title').text
|
||||
if 'Résultat recherche' in title:
|
||||
notfound.writelines(response.url + '\n')
|
||||
return
|
||||
else:
|
||||
orignalName = title.split(' - ')[1]
|
||||
translatedName = title.split(' - ')[0]
|
||||
|
||||
# If the english name and french name is the same
|
||||
if orignalName == 'Carte Magic The Gathering':
|
||||
orignalName = translatedName
|
||||
|
||||
try:
|
||||
match = re.search(re.compile('<div class="text_card text_fr txt_fr_right"><div class="type">.+?<\/div><div class="clear"><\/div><div class="cout (1|hide)">.+?<\/div><div class="clear"><\/div><div class="txt">.+?<\/div>(<div class="forc_end">|<\/div>)'), response.content.decode('utf-8').replace('\n', '')).group()
|
||||
translatedGroup = list(soup.find('div', {'class': 'text_card text_fr txt_fr_right'}).children)
|
||||
translatedType = translatedGroup[0].text.replace(' ', ' ') # Replace nbsp to a regular space
|
||||
translatedInfo = convertMana(translatedGroup[6])
|
||||
|
||||
#Split in different tags, interesting data
|
||||
translatedName: str = re.findall(r'<title>.+?<\/title>', response.content.decode('utf-8').replace('\n', ''))[0].split('<title>')[1].split(' -')[0]
|
||||
orignalName: str = re.findall(r'<title>.+?<\/title>', response.content.decode('utf-8').replace('\n', ''))[0].split('<title>')[1].split(' -')[1].split(' -')[0]
|
||||
translatedType: str = match.split('<div class="text_card text_fr txt_fr_right"><div class="type">')[1].split('</div>')[0]
|
||||
translatedInfo: str = convertMana(match.split('<div class="txt">')[1].split('</div>')[0])
|
||||
|
||||
#print(orignalName + '|' + translatedName + '|' + translatedType.replace(' ', '') + '|' + translatedInfo)
|
||||
output.writelines(orignalName + '|' + translatedName + '|' + translatedType.replace(' ', '') + '|' + translatedInfo + '\n')
|
||||
except IndexError:
|
||||
#Request probably gives multiple value
|
||||
print(response.url)
|
||||
output.close()
|
||||
exit(0)
|
||||
|
||||
output = open('./cardnames-fr-FR-missing.txt', 'a', encoding='utf-8')
|
||||
|
||||
# Show only missing lines
|
||||
for line in lines:
|
||||
# None complete line
|
||||
if line.endswith('||\n'):
|
||||
engName = line.split('|')[0]
|
||||
|
||||
# Check already done
|
||||
with open('cardnames-fr-FR-missing.txt', 'r', encoding='utf-8') as f:
|
||||
if engName in f.read():
|
||||
continue
|
||||
|
||||
response = requests.get(url + engName)
|
||||
# Founded
|
||||
if response.url.endswith(engName) == False and response.status_code == SUCCESS_STATUS:
|
||||
#print(counter, end='\r', flush=True)
|
||||
|
||||
# Get brut chaos the data from web page
|
||||
try:
|
||||
match = re.search(re.compile('<div class="text_card text_fr txt_fr_right"><div class="type">.+?<\/div><div class="clear"><\/div><div class="cout (1|hide)">.+?<\/div><div class="clear"><\/div><div class="txt">.+?<\/div>(<div class="forc_end">|<\/div>)'), response.content.decode('utf-8').replace('\n', '')).group()
|
||||
|
||||
# Split in different tags, interesting data
|
||||
translatedName: str = re.findall(r'<title>.+?<\/title>', response.content.decode('utf-8').replace('\n', ''))[0].split('<title>')[1].split(' -')[0]
|
||||
translatedType: str = match.split('<div class="text_card text_fr txt_fr_right"><div class="type">')[1].split('</div>')[0]
|
||||
translatedInfo: str = convertMana(match.split('<div class="txt">')[1].split('</div>')[0])
|
||||
|
||||
#print(engName + '|' + translatedName + '|' + translatedType.replace(' ', '') + '|' + translatedInfo)
|
||||
output.writelines(engName + '|' + translatedName + '|' + translatedType.replace(' ', '') + '|' + translatedInfo + '\n')
|
||||
except IndexError:
|
||||
# Request probably gives multiple value
|
||||
print(response.url)
|
||||
# Is a split card or a double faced card?
|
||||
if '//' in orignalName:
|
||||
# Is a split card
|
||||
if '- - -' in translatedInfo:
|
||||
splittedInfo = getSplittedInfo(translatedInfo)
|
||||
if ' - ' in translatedType:
|
||||
output.writelines(orignalName.split(' // ')[0] + '|' + translatedName.split(' / ')[0] + '|' + translatedType.split(' - ')[0] + '|' + splittedInfo[0] + '\n')
|
||||
output.writelines(orignalName.split(' // ')[1] + '|' + translatedName.split(' / ')[1] + '|' + translatedType.split(' - ')[1] + '|' + splittedInfo[1] + '\n')
|
||||
else:
|
||||
output.writelines(orignalName.split(' // ')[0] + '|' + translatedName.split(' / ')[0] + '|' + translatedType + '|' + splittedInfo[0] + '\n')
|
||||
output.writelines(orignalName.split(' // ')[1] + '|' + translatedName.split(' / ')[1] + '|' + translatedType + '|' + splittedInfo[1] + '\n')
|
||||
else:
|
||||
# Is a double faced card
|
||||
output.writelines(orignalName.split(' // ')[0] + '|' + translatedName.split(' / ')[0] + '|' + translatedType + '|' + translatedInfo + '\n')
|
||||
translatedGroup = list(soup.find('div', {'class': 'text_card text_fr txt_fr_back img_hidden'}).children)
|
||||
translatedType = translatedGroup[3].text.split('\n')[0]
|
||||
translatedInfo = convertMana(translatedGroup[3])
|
||||
output.writelines(orignalName.split(' // ')[1] + '|' + translatedName.split(' / ')[1] + '|' + translatedType + '|' + translatedInfo + '\n')
|
||||
else:
|
||||
# Write the translated line in the missing file
|
||||
output.writelines(orignalName + '|' + translatedName + '|' + translatedType + '|' + translatedInfo + '\n')
|
||||
except AttributeError:
|
||||
# Request probably gives multiple value
|
||||
print(response.url)
|
||||
except UnicodeDecodeError:
|
||||
# Request probably gives multiple value
|
||||
print(response.url)
|
||||
|
||||
counter += 1
|
||||
notfound.writelines(response.url + '\n')
|
||||
except IndexError:
|
||||
notfound.writelines(response.url + '\n')
|
||||
except UnicodeDecodeError:
|
||||
notfound.writelines(response.url + '\n')
|
||||
|
||||
|
||||
output.close()
|
||||
print('end: ', counter)
|
||||
# Handler to Ctrl+C
|
||||
def signal_handler(sig, frame):
|
||||
output.close()
|
||||
notfound.close()
|
||||
exit(0)
|
||||
|
||||
# Main program
|
||||
if __name__ == "__main__":
|
||||
signal.signal(signal.SIGINT, signal_handler)
|
||||
# Manuel scrap
|
||||
if len(sys.argv) >= 2:
|
||||
if sys.argv[1] == '-m' or sys.argv[1] == '--map':
|
||||
mapAlphabet()
|
||||
|
||||
if sys.argv[1] == '-f' or sys.argv[1] == '--find':
|
||||
findNewCards()
|
||||
|
||||
if sys.argv[1] == '-g' or sys.argv[1] == '--get':
|
||||
getMissingCards()
|
||||
|
||||
if sys.argv[1] == '-u' or sys.argv[1] == '--url':
|
||||
if len(sys.argv) <= 2:
|
||||
print('Missing second arg : url to scrap')
|
||||
exit(1)
|
||||
scrap(sys.argv[2])
|
||||
else:
|
||||
# Show only missing lines
|
||||
for line in lines:
|
||||
# None complete line
|
||||
if line.endswith('||\n'):
|
||||
engName = line.split('|')[0]
|
||||
|
||||
# Check already done
|
||||
with open('cardnames-fr-FR-missing.txt', 'r', encoding='utf-8') as f:
|
||||
if engName in f.read():
|
||||
continue
|
||||
|
||||
# Launch the scrapping on all missing translation cards
|
||||
scrap(url + engName)
|
||||
|
||||
output.close()
|
||||
notfound.close()
|
||||
exit(0)
|
||||
|
||||
Reference in New Issue
Block a user