update
Browse files- OBJECTCATALOGUES/OBJECTCATALOGUES-MIX-DEV/{ObjectCatalogue_5_SCEA_2014-02-07_cqa-a-Soul 3_bbe3fc7df122f37288ea55ebee94491d61b3817e.sql → ObjectCatalogue_5_SCEA_2014-02-07-cqa-a-Soul 3_bbe3fc7df122f37288ea55ebee94491d61b3817e.sql} +0 -0
- OBJECTCATALOGUES/OBJECTCATALOGUES-MIX-DEV/{ObjectCatalogue_5_SCEA_2014-11-28-cqa-a-Viciousest_f0adc734b0e117bb1e6b30de1665f0ca69bb300.sql → ObjectCatalogue_5_SCEA_2014-11-28-cqa-a-Viciousest_f0adc734b0e117bb1e6b30de1665f0ca69bb300e.sql} +0 -0
- OBJECTCATALOGUES/OBJECTCATALOGUES-MIX-DEV/{ObjectCatalogue_5_SCEE_2014-05-14_cpreprod-QuantumDoja1_dbbe4f0b6e80422276aa6b77b26ab9bcdc528aec.sql → ObjectCatalogue_5_SCEE_2014-05-14-cpreprod-QuantumDoja1_dbbe4f0b6e80422276aa6b77b26ab9bcdc528aec.sql} +0 -0
- OBJECTCATALOGUES/OBJECTCATALOGUES-MIX-DEV/{ObjectCatalogue_5_SCEE_2014-05-19_cqa-e-QuantumDoja1_84bb0fea2573d2b5db88a682132d2d546622cf9d.sql → ObjectCatalogue_5_SCEE_2014-05-19-cqa-e-QuantumDoja1_84bb0fea2573d2b5db88a682132d2d546622cf9d.sql} +0 -0
- OBJECTCATALOGUES/OBJECTCATALOGUES-MIX-DEV/{ObjectCatalogue_5_SCEE_2014_03_26_cqa-e-Soul 3_a67b4e0559daad72ca523cf7f3722c808610acc9.sql → ObjectCatalogue_5_SCEE_2014_03_26-cqa-e-Soul 3_a67b4e0559daad72ca523cf7f3722c808610acc9.sql} +0 -0
- OBJECTCATALOGUES/scripts/1-dump_tables.py +799 -0
- OBJECTCATALOGUES/scripts/2-combine_tables.py +729 -0
- OBJECTCATALOGUES/scripts/3-create_logs.py +737 -0
- OBJECTCATALOGUES/uniqueobjects.txt +3 -0
- OBJECTCATALOGUES/uuidfirstintroduced.txt +0 -0
- OBJECTS-MAPPED/scripts/archive.org-cli.py +550 -0
- OBJECTS-MAPPED/scripts/log_files.py +13 -6
- OBJECTS-MAPPED/scripts/move_files.py +42 -19
- OBJECTS/OBJECT_QUERY.xlsm +3 -0
- OBJECTS/OBJECT_QUERY.xlsx +2 -2
- OBJECTS/ObjectsGeneralStats.png +3 -0
- OBJECTS/ObjectsProgressAll.png +3 -0
- OBJECTS/ObjectsProgressHomeEnd.png +3 -0
- OBJECTS/uniqueobjects.txt +3 -0
- ODC/scripts/move_files.py +68 -45
- SCENE VERSION XMLS/scripts/VERS_XML_PARSER.py +18 -5
- SCENELISTS/scripts/scenelist_parser.py +30 -25
- SCENES-MAPPED/Mapped_Scenes_Query.xlsm +2 -2
- SCENES-MAPPED/Mapped_Scenes_Query.xlsx +2 -2
OBJECTCATALOGUES/OBJECTCATALOGUES-MIX-DEV/{ObjectCatalogue_5_SCEA_2014-02-07_cqa-a-Soul 3_bbe3fc7df122f37288ea55ebee94491d61b3817e.sql → ObjectCatalogue_5_SCEA_2014-02-07-cqa-a-Soul 3_bbe3fc7df122f37288ea55ebee94491d61b3817e.sql}
RENAMED
|
File without changes
|
OBJECTCATALOGUES/OBJECTCATALOGUES-MIX-DEV/{ObjectCatalogue_5_SCEA_2014-11-28-cqa-a-Viciousest_f0adc734b0e117bb1e6b30de1665f0ca69bb300.sql → ObjectCatalogue_5_SCEA_2014-11-28-cqa-a-Viciousest_f0adc734b0e117bb1e6b30de1665f0ca69bb300e.sql}
RENAMED
|
File without changes
|
OBJECTCATALOGUES/OBJECTCATALOGUES-MIX-DEV/{ObjectCatalogue_5_SCEE_2014-05-14_cpreprod-QuantumDoja1_dbbe4f0b6e80422276aa6b77b26ab9bcdc528aec.sql → ObjectCatalogue_5_SCEE_2014-05-14-cpreprod-QuantumDoja1_dbbe4f0b6e80422276aa6b77b26ab9bcdc528aec.sql}
RENAMED
|
File without changes
|
OBJECTCATALOGUES/OBJECTCATALOGUES-MIX-DEV/{ObjectCatalogue_5_SCEE_2014-05-19_cqa-e-QuantumDoja1_84bb0fea2573d2b5db88a682132d2d546622cf9d.sql → ObjectCatalogue_5_SCEE_2014-05-19-cqa-e-QuantumDoja1_84bb0fea2573d2b5db88a682132d2d546622cf9d.sql}
RENAMED
|
File without changes
|
OBJECTCATALOGUES/OBJECTCATALOGUES-MIX-DEV/{ObjectCatalogue_5_SCEE_2014_03_26_cqa-e-Soul 3_a67b4e0559daad72ca523cf7f3722c808610acc9.sql → ObjectCatalogue_5_SCEE_2014_03_26-cqa-e-Soul 3_a67b4e0559daad72ca523cf7f3722c808610acc9.sql}
RENAMED
|
File without changes
|
OBJECTCATALOGUES/scripts/1-dump_tables.py
ADDED
|
@@ -0,0 +1,799 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import sqlite3
|
| 2 |
+
import csv
|
| 3 |
+
import os
|
| 4 |
+
import glob
|
| 5 |
+
import re
|
| 6 |
+
import xml.etree.ElementTree as ET
|
| 7 |
+
|
| 8 |
+
# -----------------------------
|
| 9 |
+
# CONFIG
|
| 10 |
+
# -----------------------------
|
| 11 |
+
|
| 12 |
+
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
|
| 13 |
+
BASE_ROOT = os.path.dirname(SCRIPT_DIR)
|
| 14 |
+
TABLEDUMPS_DIR = os.path.join(BASE_ROOT, "TABLEDUMPS")
|
| 15 |
+
|
| 16 |
+
FOLDER_ORDER = [
|
| 17 |
+
r"",
|
| 18 |
+
r"OBJECTCATALOGUES-MIX-DEC",
|
| 19 |
+
r"OBJECTCATALOGUES-MIX-BETA",
|
| 20 |
+
r"OBJECTCATALOGUES-MIX-DEV",
|
| 21 |
+
]
|
| 22 |
+
|
| 23 |
+
DB_PATTERNS = [
|
| 24 |
+
"ObjectCatalogue_5_*.sql"
|
| 25 |
+
]
|
| 26 |
+
|
| 27 |
+
XML_PATTERNS = [
|
| 28 |
+
"OBJECTCATALOGUE_*.xml",
|
| 29 |
+
"ObjectCatalogue_*.xml",
|
| 30 |
+
]
|
| 31 |
+
|
| 32 |
+
SHA1_SUFFIX_PATTERN = re.compile(r"_[0-9a-fA-F]{40}$")
|
| 33 |
+
|
| 34 |
+
OBJECTS_HEADER = [
|
| 35 |
+
"ObjectIndex",
|
| 36 |
+
"ObjectId",
|
| 37 |
+
"Version",
|
| 38 |
+
"Location",
|
| 39 |
+
"InventoryEntryType",
|
| 40 |
+
"ArchiveTimeStamp",
|
| 41 |
+
"OdcSha1Digest",
|
| 42 |
+
"EntitlementIndex",
|
| 43 |
+
"RewardIndex",
|
| 44 |
+
"UserLocation",
|
| 45 |
+
"UserDateLastUsed",
|
| 46 |
+
]
|
| 47 |
+
|
| 48 |
+
METADATA_HEADER = [
|
| 49 |
+
"ObjectIndex",
|
| 50 |
+
"KeyName",
|
| 51 |
+
"Value",
|
| 52 |
+
]
|
| 53 |
+
|
| 54 |
+
TAGS_TRANSLATIONS = {
|
| 55 |
+
'00000000-00000000-00000000-00010047': {
|
| 56 |
+
'zh-TW': '牛仔帽(淺褐)',
|
| 57 |
+
'zh-HK': '牛仔帽(淺褐)',
|
| 58 |
+
'ja-JP': 'カウボーイハット(ライトブラウン)',
|
| 59 |
+
'ko-KR': '카우보이 모자(라이트 브라운)',
|
| 60 |
+
'de-DE': 'Beiger Cowboyhut',
|
| 61 |
+
'fr-FR': 'Chapeau cowboy camel',
|
| 62 |
+
'es-ES': 'Sombrero cowboy canela'
|
| 63 |
+
},
|
| 64 |
+
'00000000-00000000-00000000-00030027': {
|
| 65 |
+
'zh-TW': '連帽上衣(灰)',
|
| 66 |
+
'zh-HK': '連帽上衣(灰)',
|
| 67 |
+
'ja-JP': 'パーカー(グレー)',
|
| 68 |
+
'ko-KR': '파카(그레이)',
|
| 69 |
+
'de-DE': 'Grauer Kapuzenpulli',
|
| 70 |
+
'fr-FR': 'Haut capuche gris',
|
| 71 |
+
'es-ES': 'Jersey gris con capucha'
|
| 72 |
+
},
|
| 73 |
+
'00000000-00000000-00000000-00030054': {
|
| 74 |
+
'zh-TW': '軍外套(綠)',
|
| 75 |
+
'zh-HK': '軍外套(綠)',
|
| 76 |
+
'ja-JP': 'ミリタリージャケット(グリーン)',
|
| 77 |
+
'ko-KR': '밀리터리 재킷(그린)',
|
| 78 |
+
'de-DE': 'Grüne Militärjacke',
|
| 79 |
+
'fr-FR': 'Veste militaire verte',
|
| 80 |
+
'es-ES': 'Chaqueta militar verde'
|
| 81 |
+
},
|
| 82 |
+
'00000000-00000000-00000000-00030065': {
|
| 83 |
+
'zh-TW': '套頭杉(黑)',
|
| 84 |
+
'zh-HK': '套頭杉(黑)',
|
| 85 |
+
'ja-JP': 'タートルネック(ブラック)',
|
| 86 |
+
'ko-KR': '넥(블랙)',
|
| 87 |
+
'de-DE': 'Schwarzer Rollkragen',
|
| 88 |
+
'fr-FR': 'Col roulé noir',
|
| 89 |
+
'es-ES': 'Jersey cuello alto negro'
|
| 90 |
+
},
|
| 91 |
+
'00000000-00000000-00000000-00030076': {
|
| 92 |
+
'zh-TW': '綠色條紋開襟衫',
|
| 93 |
+
'zh-HK': '綠色條紋開襟衫',
|
| 94 |
+
'ja-JP': 'グリーンのストライプカーディガン',
|
| 95 |
+
'ko-KR': '녹색 줄무늬 카디건',
|
| 96 |
+
'de-DE': 'Grün gestreifte Strickjacke',
|
| 97 |
+
'fr-FR': 'Cardigan rayures vert',
|
| 98 |
+
'es-ES': 'Rebeca verde'
|
| 99 |
+
},
|
| 100 |
+
'00000000-00000000-00000000-00040013': {
|
| 101 |
+
'zh-TW': '運動褲(紅)',
|
| 102 |
+
'zh-HK': '運動褲(紅)',
|
| 103 |
+
'ja-JP': 'スウェットパンツ(レッド)',
|
| 104 |
+
'ko-KR': '팬츠(레드)',
|
| 105 |
+
'de-DE': 'Rote Jogginghose',
|
| 106 |
+
'fr-FR': 'Bas survêtement rouge',
|
| 107 |
+
'es-ES': 'Pantalones chándal rojos'
|
| 108 |
+
},
|
| 109 |
+
'00000000-00000000-00000000-00040026': {
|
| 110 |
+
'zh-TW': '灰色西裝長褲',
|
| 111 |
+
'zh-HK': '灰色西裝長褲',
|
| 112 |
+
'ja-JP': 'グレーのドレスパンツ',
|
| 113 |
+
'ko-KR': '회색 정장 바지',
|
| 114 |
+
'de-DE': 'Graue Anzughose',
|
| 115 |
+
'fr-FR': 'Pantalon ville gris',
|
| 116 |
+
'es-ES': 'Pantalones etiqueta grises'
|
| 117 |
+
},
|
| 118 |
+
'00000000-00000000-00000000-00040051': {
|
| 119 |
+
'zh-TW': '打折牛仔褲(黑)',
|
| 120 |
+
'zh-HK': '打折牛仔褲(黑)',
|
| 121 |
+
'ja-JP': '折り返したジーンズ(ブラック)',
|
| 122 |
+
'ko-KR': '접어올린 진(블랙)',
|
| 123 |
+
'de-DE': 'Schwarze Jeans umgeschlagen',
|
| 124 |
+
'fr-FR': 'Jean noir retroussé',
|
| 125 |
+
'es-ES': 'Vaqueros negros con dobladillo'
|
| 126 |
+
},
|
| 127 |
+
'00000000-00000000-00000000-00050012': {
|
| 128 |
+
'zh-TW': '籃球鞋(紅)',
|
| 129 |
+
'zh-HK': '籃球鞋(紅)',
|
| 130 |
+
'ja-JP': 'バスケットシューズ(レッド)',
|
| 131 |
+
'ko-KR': '농구화(레드)',
|
| 132 |
+
'de-DE': 'Rote Basketballstiefel',
|
| 133 |
+
'fr-FR': 'Baskets montantes rouges',
|
| 134 |
+
'es-ES': 'Botas baloncesto rojas'
|
| 135 |
+
},
|
| 136 |
+
'00000000-00000000-00000000-00050014': {
|
| 137 |
+
'zh-TW': '棕色時尚運動鞋',
|
| 138 |
+
'zh-HK': '棕色時尚運動鞋',
|
| 139 |
+
'ja-JP': 'ブラウンのファッションスニーカー',
|
| 140 |
+
'ko-KR': '갈색 패션 운동화',
|
| 141 |
+
'de-DE': 'Braune modische Turnschuhe',
|
| 142 |
+
'fr-FR': 'Tennis mode marron',
|
| 143 |
+
'es-ES': 'Zapatillas modernas marrones'
|
| 144 |
+
},
|
| 145 |
+
'00000000-00000000-00000000-00050019': {
|
| 146 |
+
'zh-TW': '懶人鞋(褐)',
|
| 147 |
+
'zh-HK': '懶人鞋(褐)',
|
| 148 |
+
'ja-JP': 'スリップオンスニーカー(ブラウン)',
|
| 149 |
+
'ko-KR': '슬립온 운동화(브라운)',
|
| 150 |
+
'de-DE': 'Braune Sportslipper',
|
| 151 |
+
'fr-FR': 'Tennis sans lacets marron',
|
| 152 |
+
'es-ES': 'Zapatillas sin cordones marrones'
|
| 153 |
+
},
|
| 154 |
+
'00000000-00000000-00000000-00050031': {
|
| 155 |
+
'zh-TW': '尖頭鞋(黑×白)',
|
| 156 |
+
'zh-HK': '尖頭鞋(黑×白)',
|
| 157 |
+
'ja-JP': 'トンガリ靴(ブラック×ホワイト)',
|
| 158 |
+
'ko-KR': '구두(블랙X화이트)',
|
| 159 |
+
'de-DE': 'Schwarz-weiße spitze Schuhe',
|
| 160 |
+
'fr-FR': 'Winkle-pickers noir blanc',
|
| 161 |
+
'es-ES': 'Zapatos punta negros blancos'
|
| 162 |
+
},
|
| 163 |
+
'00000000-00000000-00000000-00060002': {
|
| 164 |
+
'zh-TW': '細框眼鏡',
|
| 165 |
+
'zh-HK': '細框眼鏡',
|
| 166 |
+
'ja-JP': '細いフレームのメガネ',
|
| 167 |
+
'ko-KR': '얇은 테 안경',
|
| 168 |
+
'de-DE': 'Brille mit leichtem Rahmen',
|
| 169 |
+
'fr-FR': 'Lunettes fines',
|
| 170 |
+
'es-ES': 'Gafas montura ligera'
|
| 171 |
+
},
|
| 172 |
+
'00000000-00000000-00000000-01010062': {
|
| 173 |
+
'zh-TW': '綠色貝雷帽',
|
| 174 |
+
'zh-HK': '綠色貝雷帽',
|
| 175 |
+
'ja-JP': 'グリーンのベレー帽',
|
| 176 |
+
'ko-KR': '녹색 베레모',
|
| 177 |
+
'de-DE': 'Grüne Baskenmütze',
|
| 178 |
+
'fr-FR': 'Béret vert',
|
| 179 |
+
'es-ES': 'Boina verde'
|
| 180 |
+
},
|
| 181 |
+
'00000000-00000000-00000000-01030019': {
|
| 182 |
+
'zh-TW': '多層次T-shirt(灰×奶油)',
|
| 183 |
+
'zh-HK': '多層次T-shirt(灰×奶油)',
|
| 184 |
+
'ja-JP': 'レイヤードTシャツ(グリーン×クリーム)',
|
| 185 |
+
'ko-KR': '레이어드 셔츠(그린X크림)',
|
| 186 |
+
'de-DE': 'Grün-cremefarben Lagen T-Shirt',
|
| 187 |
+
'fr-FR': 'T-shirt vert crème',
|
| 188 |
+
'es-ES': 'Camiseta capas verde crema'
|
| 189 |
+
},
|
| 190 |
+
'00000000-00000000-00000000-01030036': {
|
| 191 |
+
'zh-TW': '牛仔衣(藍×褐)',
|
| 192 |
+
'zh-HK': '牛仔衣(藍×褐)',
|
| 193 |
+
'ja-JP': 'デニムジャケット(ブルー×ブラウン)',
|
| 194 |
+
'ko-KR': '재킷(블루X브라운)',
|
| 195 |
+
'de-DE': 'Blau-braune Jeansjacke',
|
| 196 |
+
'fr-FR': 'Veste jean bleu marron',
|
| 197 |
+
'es-ES': 'Chaqueta vaquera azul marrón'
|
| 198 |
+
},
|
| 199 |
+
'00000000-00000000-00000000-01030060': {
|
| 200 |
+
'zh-TW': '灰色背心配白色襯衫',
|
| 201 |
+
'zh-HK': '灰色背心配白色襯衫',
|
| 202 |
+
'ja-JP': 'ホワイトブラウスの上にグレーのタンクトップ',
|
| 203 |
+
'ko-KR': '흰색 블라우스 위에 회색 탱크톱',
|
| 204 |
+
'de-DE': 'Graues Tanktop über weißer Bluse',
|
| 205 |
+
'fr-FR': 'Débardeur gris sur chemisier blanc',
|
| 206 |
+
'es-ES': 'Chaleco gris sobre camiseta blanca'
|
| 207 |
+
},
|
| 208 |
+
'00000000-00000000-00000000-01030078': {
|
| 209 |
+
'zh-TW': '肚兜式禮服(雛菊)',
|
| 210 |
+
'zh-HK': '肚兜式禮服(雛菊)',
|
| 211 |
+
'ja-JP': 'ホルターネックドレス(デイジー)',
|
| 212 |
+
'ko-KR': '홀터넥 드레스(데이지)',
|
| 213 |
+
'de-DE': 'Neckholder-Top mit Blümchen',
|
| 214 |
+
'fr-FR': 'Dos marguerites',
|
| 215 |
+
'es-ES': 'Camiseta sin espalda con margaritas'
|
| 216 |
+
},
|
| 217 |
+
'00000000-00000000-00000000-01040022': {
|
| 218 |
+
'zh-TW': '運動褲(白)',
|
| 219 |
+
'zh-HK': '運動褲(白)',
|
| 220 |
+
'ja-JP': 'スウェットパンツ(ホワイト)',
|
| 221 |
+
'ko-KR': '팬츠(화이트)',
|
| 222 |
+
'de-DE': 'Weiße Jogginghose',
|
| 223 |
+
'fr-FR': 'Bas survêtement blanc',
|
| 224 |
+
'es-ES': 'Pantalones chándal blancos'
|
| 225 |
+
},
|
| 226 |
+
'00000000-00000000-00000000-01040039': {
|
| 227 |
+
'zh-TW': '短褲(花呢)',
|
| 228 |
+
'zh-HK': '短褲(花呢)',
|
| 229 |
+
'ja-JP': 'ショートパンツ(ツイード)',
|
| 230 |
+
'ko-KR': '팬츠(트위드)',
|
| 231 |
+
'de-DE': 'Tweed-Shorts',
|
| 232 |
+
'fr-FR': 'Short tweed',
|
| 233 |
+
'es-ES': 'Pantalones cortos tweed'
|
| 234 |
+
},
|
| 235 |
+
'00000000-00000000-00000000-01040061': {
|
| 236 |
+
'zh-TW': '摺腳牛仔褲(深藍)',
|
| 237 |
+
'zh-HK': '摺腳牛仔褲(深藍)',
|
| 238 |
+
'ja-JP': '折り返したジーンズ(ダークブルー)',
|
| 239 |
+
'ko-KR': '접어올린 진(다크 블루)',
|
| 240 |
+
'de-DE': 'Dunkelblaue Jeans umgeschlagen',
|
| 241 |
+
'fr-FR': 'Jean bleu foncé retroussé',
|
| 242 |
+
'es-ES': 'Vaqueros azules oscuros con dobladillo'
|
| 243 |
+
},
|
| 244 |
+
'00000000-00000000-00000000-01050024': {
|
| 245 |
+
'zh-TW': '籃球鞋(粉紅)',
|
| 246 |
+
'zh-HK': '籃球鞋(粉紅)',
|
| 247 |
+
'ja-JP': 'バスケットシューズ(ピンク)',
|
| 248 |
+
'ko-KR': '농구화(핑크)',
|
| 249 |
+
'de-DE': 'Pinke Basketballstiefel',
|
| 250 |
+
'fr-FR': 'Baskets montantes roses',
|
| 251 |
+
'es-ES': 'Botas baloncesto rosas'
|
| 252 |
+
},
|
| 253 |
+
'00000000-00000000-00000000-01050041': {
|
| 254 |
+
'zh-TW': '工作靴(黑)',
|
| 255 |
+
'zh-HK': '工作靴(黑)',
|
| 256 |
+
'ja-JP': 'ワークブーツ(ブラック)',
|
| 257 |
+
'ko-KR': '부츠(블랙)',
|
| 258 |
+
'de-DE': 'Schwarze Arbeitsstiefel',
|
| 259 |
+
'fr-FR': 'Bottes travail noires',
|
| 260 |
+
'es-ES': 'Botas trabajo negras'
|
| 261 |
+
},
|
| 262 |
+
'00000000-00000000-00000000-01050048': {
|
| 263 |
+
'zh-TW': '健走涼鞋(褐)',
|
| 264 |
+
'zh-HK': '健走涼鞋(褐)',
|
| 265 |
+
'ja-JP': 'ウォーキングサンダル(ブラウン)',
|
| 266 |
+
'ko-KR': '샌들(브라운)',
|
| 267 |
+
'de-DE': 'Braune Trekking-Sandalen',
|
| 268 |
+
'fr-FR': 'Sandales marche marron',
|
| 269 |
+
'es-ES': 'Sandalias para caminar marrones'
|
| 270 |
+
},
|
| 271 |
+
'00000000-00000000-00000000-01050056': {
|
| 272 |
+
'zh-TW': '紅色高跟鞋',
|
| 273 |
+
'zh-HK': '紅色高跟鞋',
|
| 274 |
+
'ja-JP': 'レッドのハイヒール',
|
| 275 |
+
'ko-KR': '빨간색 하이힐',
|
| 276 |
+
'de-DE': 'Rote Schuhe mit hohen Absätzen',
|
| 277 |
+
'fr-FR': 'Chaussures à talons rouges',
|
| 278 |
+
'es-ES': 'Zapatos de tacón rojos'
|
| 279 |
+
},
|
| 280 |
+
'00000000-00000000-00000000-01060001': {
|
| 281 |
+
'zh-TW': '粗框眼鏡',
|
| 282 |
+
'zh-HK': '粗框眼鏡',
|
| 283 |
+
'ja-JP': '太いフレームのメガネ',
|
| 284 |
+
'ko-KR': '두꺼운 테 안경',
|
| 285 |
+
'de-DE': 'Brille mit schwerem Rahmen',
|
| 286 |
+
'fr-FR': 'Lunettes épaisses',
|
| 287 |
+
'es-ES': 'Gafas montura pesada'
|
| 288 |
+
},
|
| 289 |
+
'00000000-00000000-00000000-01060017': {
|
| 290 |
+
'zh-TW': '星形太陽眼鏡',
|
| 291 |
+
'zh-HK': '星形太陽眼鏡',
|
| 292 |
+
'ja-JP': '星型サングラス',
|
| 293 |
+
'ko-KR': '선글래스',
|
| 294 |
+
'de-DE': 'Stern-Sonnenbrille',
|
| 295 |
+
'fr-FR': 'Lunettes soleil étoiles',
|
| 296 |
+
'es-ES': 'Gafas sol estrella'
|
| 297 |
+
},
|
| 298 |
+
'00000000-00000000-00000002-00000017': {
|
| 299 |
+
'ja-JP': 'チェア(サマーハウス)'
|
| 300 |
+
},
|
| 301 |
+
'00000000-00000000-00000002-00000031': {
|
| 302 |
+
'ja-JP': 'サボテン1'
|
| 303 |
+
},
|
| 304 |
+
'00000000-00000000-00000002-00000046': {
|
| 305 |
+
'ja-JP': 'あひるのおもちゃ'
|
| 306 |
+
}
|
| 307 |
+
}
|
| 308 |
+
|
| 309 |
+
|
| 310 |
+
def get_script_dir():
|
| 311 |
+
return os.path.dirname(os.path.abspath(__file__))
|
| 312 |
+
|
| 313 |
+
|
| 314 |
+
def find_sqlite_files(folder):
|
| 315 |
+
files = []
|
| 316 |
+
|
| 317 |
+
for pattern in DB_PATTERNS:
|
| 318 |
+
files.extend(glob.glob(os.path.join(folder, pattern)))
|
| 319 |
+
|
| 320 |
+
return sorted(set(files), key=str.lower)
|
| 321 |
+
|
| 322 |
+
|
| 323 |
+
def find_xml_files(folder):
|
| 324 |
+
files = []
|
| 325 |
+
|
| 326 |
+
for pattern in XML_PATTERNS:
|
| 327 |
+
files.extend(glob.glob(os.path.join(folder, pattern)))
|
| 328 |
+
|
| 329 |
+
return sorted(set(files), key=str.lower)
|
| 330 |
+
|
| 331 |
+
|
| 332 |
+
def strip_sha1(filename):
|
| 333 |
+
base = os.path.splitext(os.path.basename(filename))[0]
|
| 334 |
+
return SHA1_SUFFIX_PATTERN.sub("", base)
|
| 335 |
+
|
| 336 |
+
|
| 337 |
+
def decode_blob(value):
|
| 338 |
+
try:
|
| 339 |
+
return value.decode("utf-8")
|
| 340 |
+
except (UnicodeDecodeError, AttributeError):
|
| 341 |
+
if isinstance(value, (bytes, bytearray)):
|
| 342 |
+
return value.hex().upper()[:40]
|
| 343 |
+
|
| 344 |
+
return value
|
| 345 |
+
|
| 346 |
+
|
| 347 |
+
def ensure_dir(path):
|
| 348 |
+
os.makedirs(path, exist_ok=True)
|
| 349 |
+
|
| 350 |
+
|
| 351 |
+
def csv_exists(base_name, out_dir):
|
| 352 |
+
objects_csv = os.path.join(
|
| 353 |
+
out_dir,
|
| 354 |
+
f"{base_name}_Objects.csv"
|
| 355 |
+
)
|
| 356 |
+
|
| 357 |
+
metadata_csv = os.path.join(
|
| 358 |
+
out_dir,
|
| 359 |
+
f"{base_name}_Metadata.csv"
|
| 360 |
+
)
|
| 361 |
+
|
| 362 |
+
return (
|
| 363 |
+
os.path.exists(objects_csv)
|
| 364 |
+
or os.path.exists(metadata_csv)
|
| 365 |
+
)
|
| 366 |
+
|
| 367 |
+
|
| 368 |
+
def remove_xml_namespace(tag):
|
| 369 |
+
return tag.rsplit("}", 1)[-1]
|
| 370 |
+
|
| 371 |
+
|
| 372 |
+
def parse_hex_integer(value, default=0):
|
| 373 |
+
if value is None:
|
| 374 |
+
return default
|
| 375 |
+
|
| 376 |
+
value = value.strip()
|
| 377 |
+
|
| 378 |
+
if not value:
|
| 379 |
+
return default
|
| 380 |
+
|
| 381 |
+
try:
|
| 382 |
+
return int(value, 16)
|
| 383 |
+
except ValueError:
|
| 384 |
+
print(f"[WARN] Invalid hexadecimal integer: {value}")
|
| 385 |
+
return default
|
| 386 |
+
|
| 387 |
+
|
| 388 |
+
def parse_decimal_integer(value, default=0):
|
| 389 |
+
if value is None:
|
| 390 |
+
return default
|
| 391 |
+
|
| 392 |
+
value = value.strip()
|
| 393 |
+
|
| 394 |
+
if not value:
|
| 395 |
+
return default
|
| 396 |
+
|
| 397 |
+
try:
|
| 398 |
+
return int(value)
|
| 399 |
+
except ValueError:
|
| 400 |
+
print(f"[WARN] Invalid decimal integer: {value}")
|
| 401 |
+
return default
|
| 402 |
+
|
| 403 |
+
|
| 404 |
+
def extract_table(cursor, table_name, out_csv):
|
| 405 |
+
cursor.execute(f"SELECT * FROM {table_name}")
|
| 406 |
+
rows = cursor.fetchall()
|
| 407 |
+
|
| 408 |
+
with open(
|
| 409 |
+
out_csv,
|
| 410 |
+
"w",
|
| 411 |
+
newline="",
|
| 412 |
+
encoding="utf-8"
|
| 413 |
+
) as csv_file:
|
| 414 |
+
|
| 415 |
+
writer = csv.writer(csv_file)
|
| 416 |
+
|
| 417 |
+
writer.writerow([
|
| 418 |
+
description[0]
|
| 419 |
+
for description in cursor.description
|
| 420 |
+
])
|
| 421 |
+
|
| 422 |
+
for row in rows:
|
| 423 |
+
cleaned = [
|
| 424 |
+
decode_blob(value)
|
| 425 |
+
if isinstance(value, (bytes, bytearray))
|
| 426 |
+
else value
|
| 427 |
+
for value in row
|
| 428 |
+
]
|
| 429 |
+
|
| 430 |
+
writer.writerow(cleaned)
|
| 431 |
+
|
| 432 |
+
|
| 433 |
+
def process_db(db_path, out_dir):
|
| 434 |
+
base_name = strip_sha1(db_path)
|
| 435 |
+
|
| 436 |
+
objects_csv = os.path.join(
|
| 437 |
+
out_dir,
|
| 438 |
+
f"{base_name}_Objects.csv"
|
| 439 |
+
)
|
| 440 |
+
|
| 441 |
+
metadata_csv = os.path.join(
|
| 442 |
+
out_dir,
|
| 443 |
+
f"{base_name}_Metadata.csv"
|
| 444 |
+
)
|
| 445 |
+
|
| 446 |
+
if csv_exists(base_name, out_dir):
|
| 447 |
+
print(f"[SKIP SQL] Already exists, nothing changed: {base_name}")
|
| 448 |
+
return
|
| 449 |
+
|
| 450 |
+
print(f"[PROCESS SQL] {db_path}")
|
| 451 |
+
|
| 452 |
+
conn = None
|
| 453 |
+
|
| 454 |
+
try:
|
| 455 |
+
conn = sqlite3.connect(db_path)
|
| 456 |
+
conn.text_factory = bytes
|
| 457 |
+
|
| 458 |
+
cursor = conn.cursor()
|
| 459 |
+
|
| 460 |
+
extract_table(
|
| 461 |
+
cursor,
|
| 462 |
+
"Objects",
|
| 463 |
+
objects_csv
|
| 464 |
+
)
|
| 465 |
+
|
| 466 |
+
extract_table(
|
| 467 |
+
cursor,
|
| 468 |
+
"Metadata",
|
| 469 |
+
metadata_csv
|
| 470 |
+
)
|
| 471 |
+
|
| 472 |
+
print(f"[DONE SQL] {base_name}")
|
| 473 |
+
|
| 474 |
+
except sqlite3.Error as error:
|
| 475 |
+
print(f"[ERROR SQL] {db_path}: {error}")
|
| 476 |
+
|
| 477 |
+
for output_file in (objects_csv, metadata_csv):
|
| 478 |
+
if os.path.exists(output_file):
|
| 479 |
+
os.remove(output_file)
|
| 480 |
+
|
| 481 |
+
finally:
|
| 482 |
+
if conn is not None:
|
| 483 |
+
conn.close()
|
| 484 |
+
|
| 485 |
+
|
| 486 |
+
def get_xml_objects(root):
|
| 487 |
+
for element in root.iter():
|
| 488 |
+
if remove_xml_namespace(element.tag).lower() == "object":
|
| 489 |
+
yield element
|
| 490 |
+
|
| 491 |
+
|
| 492 |
+
def build_xml_rows(xml_path):
|
| 493 |
+
tree = ET.parse(xml_path)
|
| 494 |
+
root = tree.getroot()
|
| 495 |
+
|
| 496 |
+
objects_rows = []
|
| 497 |
+
metadata_rows = []
|
| 498 |
+
|
| 499 |
+
skip_if_blank_elements = {
|
| 500 |
+
"SCENE_ENTITLEMENT",
|
| 501 |
+
"ENTITLEMENT_ID",
|
| 502 |
+
"CATEGORY_ID",
|
| 503 |
+
"PRODUCT_ID",
|
| 504 |
+
"TITLE_ID",
|
| 505 |
+
"COMMUNICATION_ID",
|
| 506 |
+
}
|
| 507 |
+
|
| 508 |
+
skip_if_dummy_elements = {
|
| 509 |
+
"ENTITLEMENT_ID",
|
| 510 |
+
"CATEGORY_ID",
|
| 511 |
+
"PRODUCT_ID",
|
| 512 |
+
}
|
| 513 |
+
|
| 514 |
+
clothing_value_replacements = {
|
| 515 |
+
"TORS LEGS": "OUTFITS",
|
| 516 |
+
"TORS LEGS FEET": "OUTFITS",
|
| 517 |
+
"OUTFITS TORS HANDS LEGS FEET HAT": "OUTFITS",
|
| 518 |
+
"LEGS FEET": "LEGS",
|
| 519 |
+
"TORS LEGS FEET OUTFITS": "OUTFITS",
|
| 520 |
+
"TORSO": "TORS",
|
| 521 |
+
"TORS LEGS OUTFITS": "OUTFITS",
|
| 522 |
+
}
|
| 523 |
+
|
| 524 |
+
furniture_value_replacements = {
|
| 525 |
+
"PICTURE FRAME": "FRAME",
|
| 526 |
+
}
|
| 527 |
+
|
| 528 |
+
category_value_replacements = {
|
| 529 |
+
"24-NPUR30151_00": "UP0024-NPUR30151_00",
|
| 530 |
+
"LUA REWARD": "LUA_REWARD",
|
| 531 |
+
"UP9000-NPUQ0001_00": "UP9000-NPUQ00001_00",
|
| 532 |
+
"UUP9000-NPUQ00001_00": "UP9000-NPUQ00001_00",
|
| 533 |
+
"UP9000-NPUQ00010_": "UP9000-NPUQ00010_00",
|
| 534 |
+
"HP9000-NPHQ00009": "HP9000-NPHQ00009_00",
|
| 535 |
+
"HT4010-NPHR00022_00'": "HT4010-NPHR00022_00",
|
| 536 |
+
"ET0002-NPER00035_00V": "ET0002-NPER00035_00",
|
| 537 |
+
"JT4001-NPJR50210": "JT4001-NPJR50210_00",
|
| 538 |
+
"JP9000-NPJQ50100": "JP9000-NPJQ50100_00",
|
| 539 |
+
"JP9002-NPJQ50280": "JP9002-NPJQ50280_00",
|
| 540 |
+
"JP0082-NPJR50150_0": "JP0082-NPJR50150_00",
|
| 541 |
+
"JP0043-NPJR50420": "JP0043-NPJR50420_00",
|
| 542 |
+
}
|
| 543 |
+
|
| 544 |
+
product_value_replacements = {
|
| 545 |
+
"LUA REWARD": "LUA_REWARD",
|
| 546 |
+
}
|
| 547 |
+
|
| 548 |
+
object_index = 0
|
| 549 |
+
|
| 550 |
+
for object_element in get_xml_objects(root):
|
| 551 |
+
object_index += 1
|
| 552 |
+
|
| 553 |
+
object_id = object_element.get("uuid", "").strip()
|
| 554 |
+
|
| 555 |
+
version = parse_decimal_integer(
|
| 556 |
+
object_element.get("vers"),
|
| 557 |
+
default=0
|
| 558 |
+
)
|
| 559 |
+
|
| 560 |
+
archive_timestamp = parse_hex_integer(
|
| 561 |
+
object_element.get("timestamp"),
|
| 562 |
+
default=0
|
| 563 |
+
)
|
| 564 |
+
|
| 565 |
+
odc_sha1 = object_element.get("sha1", "").strip().upper()
|
| 566 |
+
|
| 567 |
+
objects_rows.append([
|
| 568 |
+
object_index,
|
| 569 |
+
object_id,
|
| 570 |
+
version,
|
| 571 |
+
1,
|
| 572 |
+
"",
|
| 573 |
+
archive_timestamp,
|
| 574 |
+
odc_sha1,
|
| 575 |
+
"",
|
| 576 |
+
"",
|
| 577 |
+
0,
|
| 578 |
+
"",
|
| 579 |
+
])
|
| 580 |
+
|
| 581 |
+
seen_tags = set()
|
| 582 |
+
seen_entitlement_ids = set()
|
| 583 |
+
|
| 584 |
+
for child in object_element:
|
| 585 |
+
tag_name = remove_xml_namespace(child.tag).upper()
|
| 586 |
+
value = (child.text or "").strip()
|
| 587 |
+
|
| 588 |
+
if tag_name in skip_if_blank_elements and not value:
|
| 589 |
+
continue
|
| 590 |
+
|
| 591 |
+
if (
|
| 592 |
+
tag_name in skip_if_dummy_elements
|
| 593 |
+
and value.lower() == "dummy"
|
| 594 |
+
):
|
| 595 |
+
continue
|
| 596 |
+
|
| 597 |
+
if tag_name in {
|
| 598 |
+
"CLOTHING",
|
| 599 |
+
"FURNITURE",
|
| 600 |
+
"WORLD_MAP",
|
| 601 |
+
"ACTIVE",
|
| 602 |
+
"SCENE_ENTITLEMENT",
|
| 603 |
+
"SCENE_TYPE",
|
| 604 |
+
"LEGAL_TAG",
|
| 605 |
+
"CLAN",
|
| 606 |
+
"MINI_GAME",
|
| 607 |
+
"CATEGORY_ID",
|
| 608 |
+
"PRODUCT_ID",
|
| 609 |
+
}:
|
| 610 |
+
value = value.upper()
|
| 611 |
+
|
| 612 |
+
if tag_name == "CLOTHING":
|
| 613 |
+
value = " ".join(value.split())
|
| 614 |
+
|
| 615 |
+
value = clothing_value_replacements.get(
|
| 616 |
+
value,
|
| 617 |
+
value
|
| 618 |
+
)
|
| 619 |
+
|
| 620 |
+
elif tag_name == "FURNITURE":
|
| 621 |
+
value = " ".join(value.split())
|
| 622 |
+
|
| 623 |
+
value = furniture_value_replacements.get(
|
| 624 |
+
value,
|
| 625 |
+
value
|
| 626 |
+
)
|
| 627 |
+
|
| 628 |
+
elif tag_name == "CATEGORY_ID":
|
| 629 |
+
value = " ".join(value.split())
|
| 630 |
+
|
| 631 |
+
value = category_value_replacements.get(
|
| 632 |
+
value,
|
| 633 |
+
value
|
| 634 |
+
)
|
| 635 |
+
|
| 636 |
+
elif tag_name == "PRODUCT_ID":
|
| 637 |
+
value = " ".join(value.split())
|
| 638 |
+
|
| 639 |
+
value = product_value_replacements.get(
|
| 640 |
+
value,
|
| 641 |
+
value
|
| 642 |
+
)
|
| 643 |
+
|
| 644 |
+
if tag_name == "TAGS":
|
| 645 |
+
lang = child.get("lang", "").strip()
|
| 646 |
+
|
| 647 |
+
if object_id in TAGS_TRANSLATIONS:
|
| 648 |
+
replacement = TAGS_TRANSLATIONS[object_id].get(lang)
|
| 649 |
+
|
| 650 |
+
if replacement is not None:
|
| 651 |
+
value = replacement
|
| 652 |
+
|
| 653 |
+
if value in seen_tags:
|
| 654 |
+
continue
|
| 655 |
+
|
| 656 |
+
seen_tags.add(value)
|
| 657 |
+
values = [value]
|
| 658 |
+
|
| 659 |
+
elif tag_name == "ENTITLEMENT_ID":
|
| 660 |
+
if value in seen_entitlement_ids:
|
| 661 |
+
continue
|
| 662 |
+
|
| 663 |
+
seen_entitlement_ids.add(value)
|
| 664 |
+
values = [value]
|
| 665 |
+
|
| 666 |
+
elif tag_name == "TITLE_ID":
|
| 667 |
+
values = value.split() if value else [""]
|
| 668 |
+
|
| 669 |
+
elif tag_name == "WORLD_MAP":
|
| 670 |
+
values = value.split() if value else [""]
|
| 671 |
+
|
| 672 |
+
else:
|
| 673 |
+
values = [value]
|
| 674 |
+
|
| 675 |
+
for metadata_value in values:
|
| 676 |
+
metadata_rows.append([
|
| 677 |
+
object_index,
|
| 678 |
+
tag_name,
|
| 679 |
+
metadata_value,
|
| 680 |
+
])
|
| 681 |
+
|
| 682 |
+
return objects_rows, metadata_rows
|
| 683 |
+
|
| 684 |
+
|
| 685 |
+
def write_xml_csv_files(
|
| 686 |
+
objects_csv,
|
| 687 |
+
metadata_csv,
|
| 688 |
+
objects_rows,
|
| 689 |
+
metadata_rows
|
| 690 |
+
):
|
| 691 |
+
with open(
|
| 692 |
+
objects_csv,
|
| 693 |
+
"w",
|
| 694 |
+
newline="",
|
| 695 |
+
encoding="utf-8"
|
| 696 |
+
) as csv_file:
|
| 697 |
+
|
| 698 |
+
writer = csv.writer(csv_file)
|
| 699 |
+
writer.writerow(OBJECTS_HEADER)
|
| 700 |
+
writer.writerows(objects_rows)
|
| 701 |
+
|
| 702 |
+
with open(
|
| 703 |
+
metadata_csv,
|
| 704 |
+
"w",
|
| 705 |
+
newline="",
|
| 706 |
+
encoding="utf-8"
|
| 707 |
+
) as csv_file:
|
| 708 |
+
|
| 709 |
+
writer = csv.writer(csv_file)
|
| 710 |
+
writer.writerow(METADATA_HEADER)
|
| 711 |
+
writer.writerows(metadata_rows)
|
| 712 |
+
|
| 713 |
+
|
| 714 |
+
def process_xml(xml_path, out_dir):
|
| 715 |
+
base_name = strip_sha1(xml_path)
|
| 716 |
+
|
| 717 |
+
objects_csv = os.path.join(
|
| 718 |
+
out_dir,
|
| 719 |
+
f"{base_name}_Objects.csv"
|
| 720 |
+
)
|
| 721 |
+
|
| 722 |
+
metadata_csv = os.path.join(
|
| 723 |
+
out_dir,
|
| 724 |
+
f"{base_name}_Metadata.csv"
|
| 725 |
+
)
|
| 726 |
+
|
| 727 |
+
if csv_exists(base_name, out_dir):
|
| 728 |
+
print(f"[SKIP XML] Already exists, nothing changed: {base_name}")
|
| 729 |
+
return
|
| 730 |
+
|
| 731 |
+
print(f"[PROCESS XML] {xml_path}")
|
| 732 |
+
|
| 733 |
+
try:
|
| 734 |
+
objects_rows, metadata_rows = build_xml_rows(xml_path)
|
| 735 |
+
|
| 736 |
+
write_xml_csv_files(
|
| 737 |
+
objects_csv,
|
| 738 |
+
metadata_csv,
|
| 739 |
+
objects_rows,
|
| 740 |
+
metadata_rows
|
| 741 |
+
)
|
| 742 |
+
|
| 743 |
+
print(
|
| 744 |
+
f"[DONE XML] {base_name}: "
|
| 745 |
+
f"{len(objects_rows)} object row(s), "
|
| 746 |
+
f"{len(metadata_rows)} metadata row(s)"
|
| 747 |
+
)
|
| 748 |
+
|
| 749 |
+
except (ET.ParseError, OSError, ValueError) as error:
|
| 750 |
+
print(f"[ERROR XML] {xml_path}: {error}")
|
| 751 |
+
|
| 752 |
+
for output_file in (objects_csv, metadata_csv):
|
| 753 |
+
if os.path.exists(output_file):
|
| 754 |
+
os.remove(output_file)
|
| 755 |
+
|
| 756 |
+
|
| 757 |
+
def main():
|
| 758 |
+
script_dir = get_script_dir()
|
| 759 |
+
out_dir = TABLEDUMPS_DIR
|
| 760 |
+
|
| 761 |
+
ensure_dir(out_dir)
|
| 762 |
+
|
| 763 |
+
print(f"Script folder: {script_dir}")
|
| 764 |
+
print(f"Base folder: {BASE_ROOT}")
|
| 765 |
+
print(f"Output folder: {out_dir}")
|
| 766 |
+
print()
|
| 767 |
+
|
| 768 |
+
for folder in FOLDER_ORDER:
|
| 769 |
+
if folder:
|
| 770 |
+
folder_path = os.path.join(BASE_ROOT, folder)
|
| 771 |
+
else:
|
| 772 |
+
folder_path = BASE_ROOT
|
| 773 |
+
|
| 774 |
+
print("--------------------------------------------------")
|
| 775 |
+
print(f"[FOLDER] {folder_path}")
|
| 776 |
+
print("--------------------------------------------------")
|
| 777 |
+
|
| 778 |
+
if not os.path.isdir(folder_path):
|
| 779 |
+
print(f"[WARN] Missing folder: {folder_path}")
|
| 780 |
+
print()
|
| 781 |
+
continue
|
| 782 |
+
|
| 783 |
+
db_files = find_sqlite_files(folder_path)
|
| 784 |
+
|
| 785 |
+
for db_file in db_files:
|
| 786 |
+
process_db(db_file, out_dir)
|
| 787 |
+
|
| 788 |
+
xml_files = find_xml_files(folder_path)
|
| 789 |
+
|
| 790 |
+
for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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import csv
|
| 2 |
+
import os
|
| 3 |
+
import re
|
| 4 |
+
from pathlib import Path
|
| 5 |
+
from collections import defaultdict
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
SCRIPT_DIR = Path(__file__).resolve().parent
|
| 9 |
+
BASE_DIR = SCRIPT_DIR.parent
|
| 10 |
+
TABLEDUMPS_DIR = BASE_DIR / "TABLEDUMPS"
|
| 11 |
+
|
| 12 |
+
OBJECTS_SUFFIX = "_Objects.csv"
|
| 13 |
+
METADATA_SUFFIX = "_Metadata.csv"
|
| 14 |
+
COMBINED_SUFFIX = "_Combined.csv"
|
| 15 |
+
|
| 16 |
+
ERROR_LOG = BASE_DIR / "errors.log"
|
| 17 |
+
|
| 18 |
+
REMOVE_OBJECT_COLUMNS = {
|
| 19 |
+
"Location",
|
| 20 |
+
"InventoryEntryType",
|
| 21 |
+
"EntitlementIndex",
|
| 22 |
+
"RewardIndex",
|
| 23 |
+
"UserLocation",
|
| 24 |
+
"UserDateLastUsed",
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
METADATA_COLUMNS = [
|
| 28 |
+
"CLOTHING",
|
| 29 |
+
"RIGS",
|
| 30 |
+
"GENDER",
|
| 31 |
+
"PORTABLE",
|
| 32 |
+
"MINI_GAME",
|
| 33 |
+
"ACTIVE",
|
| 34 |
+
"TARGETABLE",
|
| 35 |
+
"ARCADE_GAME",
|
| 36 |
+
"FURNITURE",
|
| 37 |
+
"HOST_HEAT",
|
| 38 |
+
"MAIN_HEAT",
|
| 39 |
+
"NET_HEAT",
|
| 40 |
+
"PPU_HEAT",
|
| 41 |
+
"VRAM_HEAT",
|
| 42 |
+
"EMBEDDED_OBJECT",
|
| 43 |
+
"SCENE_ENTITLEMENT",
|
| 44 |
+
"SCENE_TYPE",
|
| 45 |
+
"TAGS",
|
| 46 |
+
"WORLD_MAP",
|
| 47 |
+
"LEGAL_TAG",
|
| 48 |
+
"CLAN",
|
| 49 |
+
"LPID",
|
| 50 |
+
"CATEGORY_ID",
|
| 51 |
+
"PRODUCT_ID",
|
| 52 |
+
"ENTITLEMENT_ID",
|
| 53 |
+
"COMMUNICATION_ID",
|
| 54 |
+
"TITLE_ID",
|
| 55 |
+
]
|
| 56 |
+
|
| 57 |
+
TYPE_COLUMNS = [
|
| 58 |
+
"CLOTHING",
|
| 59 |
+
"GENDER",
|
| 60 |
+
"PORTABLE",
|
| 61 |
+
"MINI_GAME",
|
| 62 |
+
"ARCADE_GAME",
|
| 63 |
+
"FURNITURE",
|
| 64 |
+
"ACTIVE",
|
| 65 |
+
"TARGETABLE",
|
| 66 |
+
"SCENE_ENTITLEMENT",
|
| 67 |
+
"SCENE_TYPE",
|
| 68 |
+
"EMBEDDED_OBJECT",
|
| 69 |
+
]
|
| 70 |
+
|
| 71 |
+
TYPE_COLUMNS_MINIGAME_AFTER_FURNITURE = [
|
| 72 |
+
"CLOTHING",
|
| 73 |
+
"GENDER",
|
| 74 |
+
"PORTABLE",
|
| 75 |
+
"ARCADE_GAME",
|
| 76 |
+
"FURNITURE",
|
| 77 |
+
"MINI_GAME",
|
| 78 |
+
"ACTIVE",
|
| 79 |
+
"TARGETABLE",
|
| 80 |
+
"SCENE_ENTITLEMENT",
|
| 81 |
+
"SCENE_TYPE",
|
| 82 |
+
"EMBEDDED_OBJECT",
|
| 83 |
+
]
|
| 84 |
+
|
| 85 |
+
TYPE_TITLE_ONLY_COLUMNS = {
|
| 86 |
+
"PORTABLE",
|
| 87 |
+
"MINI_GAME",
|
| 88 |
+
"ACTIVE",
|
| 89 |
+
"TARGETABLE",
|
| 90 |
+
"ARCADE_GAME",
|
| 91 |
+
"EMBEDDED_OBJECT",
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
TYPE_TITLE_AND_VALUE_COLUMNS = {
|
| 95 |
+
"CLOTHING",
|
| 96 |
+
"FURNITURE",
|
| 97 |
+
"SCENE_TYPE",
|
| 98 |
+
"SCENE_ENTITLEMENT",
|
| 99 |
+
}
|
| 100 |
+
|
| 101 |
+
SORT_VALUES_COLUMNS = {
|
| 102 |
+
"WORLD_MAP",
|
| 103 |
+
"CATEGORY_ID",
|
| 104 |
+
"PRODUCT_ID",
|
| 105 |
+
"ENTITLEMENT_ID",
|
| 106 |
+
}
|
| 107 |
+
|
| 108 |
+
GENDER_RIGS = {
|
| 109 |
+
"00000000-00000000-00000010-00000000": "MALE",
|
| 110 |
+
"00000000-00000000-00000010-00000001": "FEMALE",
|
| 111 |
+
}
|
| 112 |
+
|
| 113 |
+
CLOTHING_REPLACEMENTS = {
|
| 114 |
+
"TORS|LEGS": "OUTFITS",
|
| 115 |
+
"TORS|LEGS|FEET": "OUTFITS",
|
| 116 |
+
"LEGS|FEET": "LEGS",
|
| 117 |
+
"TORS|LEGS|FEET|OUTFITS": "OUTFITS",
|
| 118 |
+
"TORSO": "TORS",
|
| 119 |
+
"TORS|LEGS|OUTFITS": "OUTFITS",
|
| 120 |
+
"LEGS|TORS|FEET": "OUTFITS",
|
| 121 |
+
"TORS|AND|LEGS": "OUTFITS",
|
| 122 |
+
"TORS|LEG": "OUTFITS",
|
| 123 |
+
}
|
| 124 |
+
|
| 125 |
+
CATEGORY_REPLACEMENTS = {
|
| 126 |
+
"5|EVIL|RESIDENT|T-SHIRT": "RESIDENT|EVIL|5|T-SHIRT",
|
| 127 |
+
"AND|BLACK|DENIM|LEGGINGS|RED|SHORTS|STILETTOS|WITH": "RED|STILETTOS|WITH|BLACK|DENIM|SHORTS|AND|LEGGINGS",
|
| 128 |
+
"24-NPUR30151_00": "UP0024-NPUR30151_00",
|
| 129 |
+
"LUA|REWARD": "LUA_REWARD",
|
| 130 |
+
"UP9000-NPUQ0001_00": "UP9000-NPUQ00001_00",
|
| 131 |
+
"UUP9000-NPUQ00001_00": "UP9000-NPUQ00001_00",
|
| 132 |
+
"UP9000-NPUQ00010_": "UP9000-NPUQ00010_00",
|
| 133 |
+
"HP9000-NPHQ00009": "HP9000-NPHQ00009_00",
|
| 134 |
+
"HT4010-NPHR00022_00'": "HT4010-NPHR00022_00",
|
| 135 |
+
"ET0002-NPER00035_00V": "ET0002-NPER00035_00",
|
| 136 |
+
"JT4001-NPJR50210": "JT4001-NPJR50210_00",
|
| 137 |
+
"JP9000-NPJQ50100": "JP9000-NPJQ50100_00",
|
| 138 |
+
"JP9002-NPJQ50280": "JP9002-NPJQ50280_00",
|
| 139 |
+
"JP0082-NPJR50150_0": "JP0082-NPJR50150_00",
|
| 140 |
+
"JP0043-NPJR50420": "JP0043-NPJR50420_00",
|
| 141 |
+
}
|
| 142 |
+
|
| 143 |
+
PRODUCT_REPLACEMENTS = {
|
| 144 |
+
"LUA|REWARD": "LUA_REWARD",
|
| 145 |
+
}
|
| 146 |
+
|
| 147 |
+
FURNITURE_REPLACEMENTS = {
|
| 148 |
+
"PICTURE|FRAME": "FRAME",
|
| 149 |
+
}
|
| 150 |
+
|
| 151 |
+
DATE_PATTERN = re.compile(r"^(.*?)(\d{4}-\d{2}-\d{2})(.*)$")
|
| 152 |
+
|
| 153 |
+
|
| 154 |
+
def log_error(message):
|
| 155 |
+
with open(ERROR_LOG, "a", encoding="utf-8", newline="\n") as log_file:
|
| 156 |
+
log_file.write(message + "\n")
|
| 157 |
+
|
| 158 |
+
|
| 159 |
+
def strip_suffix(filename, suffix):
|
| 160 |
+
if filename.endswith(suffix):
|
| 161 |
+
return filename[:-len(suffix)]
|
| 162 |
+
|
| 163 |
+
return filename
|
| 164 |
+
|
| 165 |
+
|
| 166 |
+
def get_catalogue_parts(stem):
|
| 167 |
+
match = DATE_PATTERN.match(stem)
|
| 168 |
+
|
| 169 |
+
if not match:
|
| 170 |
+
return None
|
| 171 |
+
|
| 172 |
+
prefix = match.group(1)
|
| 173 |
+
date = match.group(2)
|
| 174 |
+
suffix = match.group(3)
|
| 175 |
+
|
| 176 |
+
return prefix, date, suffix
|
| 177 |
+
|
| 178 |
+
|
| 179 |
+
def get_objectcatalogue_5_date(stem):
|
| 180 |
+
parts = stem.split("_")
|
| 181 |
+
|
| 182 |
+
if len(parts) >= 4:
|
| 183 |
+
date = parts[3]
|
| 184 |
+
|
| 185 |
+
if re.fullmatch(r"\d{4}-\d{2}-\d{2}", date):
|
| 186 |
+
return date
|
| 187 |
+
|
| 188 |
+
return "0000-00-00"
|
| 189 |
+
|
| 190 |
+
|
| 191 |
+
def get_objectcatalogue_date(stem):
|
| 192 |
+
parts = stem.split("_")
|
| 193 |
+
|
| 194 |
+
if len(parts) >= 2:
|
| 195 |
+
date = parts[1]
|
| 196 |
+
|
| 197 |
+
if re.fullmatch(r"\d{4}-\d{2}-\d{2}", date):
|
| 198 |
+
return date
|
| 199 |
+
|
| 200 |
+
return "0000-00-00"
|
| 201 |
+
|
| 202 |
+
|
| 203 |
+
def find_objects_files():
|
| 204 |
+
objects = {}
|
| 205 |
+
|
| 206 |
+
for path in TABLEDUMPS_DIR.glob(f"*{OBJECTS_SUFFIX}"):
|
| 207 |
+
stem = strip_suffix(path.name, OBJECTS_SUFFIX)
|
| 208 |
+
objects[stem] = path
|
| 209 |
+
|
| 210 |
+
return objects
|
| 211 |
+
|
| 212 |
+
|
| 213 |
+
def find_metadata_files():
|
| 214 |
+
metadata = {}
|
| 215 |
+
|
| 216 |
+
for path in TABLEDUMPS_DIR.glob(f"*{METADATA_SUFFIX}"):
|
| 217 |
+
stem = strip_suffix(path.name, METADATA_SUFFIX)
|
| 218 |
+
metadata[stem] = path
|
| 219 |
+
|
| 220 |
+
return metadata
|
| 221 |
+
|
| 222 |
+
|
| 223 |
+
def catalogue_sort_key(stem):
|
| 224 |
+
lower_stem = stem.lower()
|
| 225 |
+
|
| 226 |
+
if lower_stem.startswith("objectcatalogue_"):
|
| 227 |
+
return 0, lower_stem
|
| 228 |
+
|
| 229 |
+
return 1, lower_stem
|
| 230 |
+
|
| 231 |
+
|
| 232 |
+
def find_best_objects_file(metadata_stem, objects_files):
|
| 233 |
+
if metadata_stem in objects_files:
|
| 234 |
+
return objects_files[metadata_stem]
|
| 235 |
+
|
| 236 |
+
metadata_parts = get_catalogue_parts(metadata_stem)
|
| 237 |
+
|
| 238 |
+
if metadata_parts is None:
|
| 239 |
+
return None
|
| 240 |
+
|
| 241 |
+
metadata_prefix, metadata_date, metadata_suffix = metadata_parts
|
| 242 |
+
|
| 243 |
+
candidates = []
|
| 244 |
+
|
| 245 |
+
for objects_stem, objects_path in objects_files.items():
|
| 246 |
+
objects_parts = get_catalogue_parts(objects_stem)
|
| 247 |
+
|
| 248 |
+
if objects_parts is None:
|
| 249 |
+
continue
|
| 250 |
+
|
| 251 |
+
objects_prefix, objects_date, objects_suffix = objects_parts
|
| 252 |
+
|
| 253 |
+
if objects_prefix != metadata_prefix:
|
| 254 |
+
continue
|
| 255 |
+
|
| 256 |
+
if objects_suffix != metadata_suffix:
|
| 257 |
+
continue
|
| 258 |
+
|
| 259 |
+
if objects_date > metadata_date:
|
| 260 |
+
continue
|
| 261 |
+
|
| 262 |
+
candidates.append((objects_date, objects_path))
|
| 263 |
+
|
| 264 |
+
if not candidates:
|
| 265 |
+
return None
|
| 266 |
+
|
| 267 |
+
candidates.sort(key=lambda item: item[0], reverse=True)
|
| 268 |
+
|
| 269 |
+
return candidates[0][1]
|
| 270 |
+
|
| 271 |
+
|
| 272 |
+
def normalize_keyname(keyname):
|
| 273 |
+
return keyname.strip().upper()
|
| 274 |
+
|
| 275 |
+
|
| 276 |
+
def version_to_txxx(version):
|
| 277 |
+
version = str(version).strip()
|
| 278 |
+
|
| 279 |
+
if not version:
|
| 280 |
+
version = "0"
|
| 281 |
+
|
| 282 |
+
try:
|
| 283 |
+
version_int = int(version)
|
| 284 |
+
except ValueError:
|
| 285 |
+
version_int = 0
|
| 286 |
+
|
| 287 |
+
return f"T{version_int:03d}"
|
| 288 |
+
|
| 289 |
+
|
| 290 |
+
def timestamp_to_hex(value):
|
| 291 |
+
value = str(value).strip()
|
| 292 |
+
|
| 293 |
+
if not value:
|
| 294 |
+
return ""
|
| 295 |
+
|
| 296 |
+
try:
|
| 297 |
+
timestamp_int = int(value)
|
| 298 |
+
except ValueError:
|
| 299 |
+
return value.upper()
|
| 300 |
+
|
| 301 |
+
return f"{timestamp_int:X}"
|
| 302 |
+
|
| 303 |
+
|
| 304 |
+
def normalize_joined_values(values):
|
| 305 |
+
cleaned_values = []
|
| 306 |
+
|
| 307 |
+
for value in values:
|
| 308 |
+
value = str(value).strip().upper()
|
| 309 |
+
|
| 310 |
+
if not value:
|
| 311 |
+
continue
|
| 312 |
+
|
| 313 |
+
cleaned_values.append(value)
|
| 314 |
+
|
| 315 |
+
return "|".join(cleaned_values)
|
| 316 |
+
|
| 317 |
+
|
| 318 |
+
def add_field_name(column, value, has_keyname):
|
| 319 |
+
if not has_keyname:
|
| 320 |
+
return ""
|
| 321 |
+
|
| 322 |
+
value = str(value).strip()
|
| 323 |
+
|
| 324 |
+
if not value:
|
| 325 |
+
return f"{column}|"
|
| 326 |
+
|
| 327 |
+
return f"{column}|{value}|"
|
| 328 |
+
|
| 329 |
+
|
| 330 |
+
def strip_field_name(column, value):
|
| 331 |
+
value = str(value).strip()
|
| 332 |
+
|
| 333 |
+
prefix = f"{column}|"
|
| 334 |
+
|
| 335 |
+
if value.startswith(prefix):
|
| 336 |
+
value = value[len(prefix):]
|
| 337 |
+
|
| 338 |
+
if value.endswith("|"):
|
| 339 |
+
value = value[:-1]
|
| 340 |
+
|
| 341 |
+
return value
|
| 342 |
+
|
| 343 |
+
|
| 344 |
+
def furniture_has_value(value):
|
| 345 |
+
value = str(value).strip()
|
| 346 |
+
|
| 347 |
+
if not value:
|
| 348 |
+
return False
|
| 349 |
+
|
| 350 |
+
if not value.startswith("FURNITURE|"):
|
| 351 |
+
return False
|
| 352 |
+
|
| 353 |
+
return value != "FURNITURE|"
|
| 354 |
+
|
| 355 |
+
|
| 356 |
+
def add_type_field_name(column, value):
|
| 357 |
+
value = str(value).strip()
|
| 358 |
+
|
| 359 |
+
if not value:
|
| 360 |
+
return ""
|
| 361 |
+
|
| 362 |
+
if column == "GENDER":
|
| 363 |
+
return f"{value}|"
|
| 364 |
+
|
| 365 |
+
if column in TYPE_TITLE_ONLY_COLUMNS:
|
| 366 |
+
return f"{column}|"
|
| 367 |
+
|
| 368 |
+
if column in TYPE_TITLE_AND_VALUE_COLUMNS:
|
| 369 |
+
return value
|
| 370 |
+
|
| 371 |
+
return value
|
| 372 |
+
|
| 373 |
+
|
| 374 |
+
def build_type_value(combined_row):
|
| 375 |
+
type_value = ""
|
| 376 |
+
|
| 377 |
+
if (
|
| 378 |
+
furniture_has_value(combined_row.get("FURNITURE", ""))
|
| 379 |
+
and combined_row.get("MINI_GAME", "")
|
| 380 |
+
):
|
| 381 |
+
type_columns = TYPE_COLUMNS_MINIGAME_AFTER_FURNITURE
|
| 382 |
+
else:
|
| 383 |
+
type_columns = TYPE_COLUMNS
|
| 384 |
+
|
| 385 |
+
for column in type_columns:
|
| 386 |
+
value = add_type_field_name(
|
| 387 |
+
column,
|
| 388 |
+
combined_row.get(column, "")
|
| 389 |
+
)
|
| 390 |
+
|
| 391 |
+
if value:
|
| 392 |
+
type_value += value
|
| 393 |
+
|
| 394 |
+
return type_value
|
| 395 |
+
|
| 396 |
+
|
| 397 |
+
def normalize_clothing_values(values):
|
| 398 |
+
joined_value = normalize_joined_values(values)
|
| 399 |
+
|
| 400 |
+
return CLOTHING_REPLACEMENTS.get(joined_value, joined_value)
|
| 401 |
+
|
| 402 |
+
|
| 403 |
+
def normalize_category_values(values):
|
| 404 |
+
joined_value = normalize_joined_values(values)
|
| 405 |
+
|
| 406 |
+
return CATEGORY_REPLACEMENTS.get(joined_value, joined_value)
|
| 407 |
+
|
| 408 |
+
|
| 409 |
+
def normalize_product_values(values):
|
| 410 |
+
joined_value = normalize_joined_values(values)
|
| 411 |
+
|
| 412 |
+
return PRODUCT_REPLACEMENTS.get(joined_value, joined_value)
|
| 413 |
+
|
| 414 |
+
|
| 415 |
+
def normalize_furniture_values(values):
|
| 416 |
+
joined_value = normalize_joined_values(values)
|
| 417 |
+
|
| 418 |
+
return FURNITURE_REPLACEMENTS.get(joined_value, joined_value)
|
| 419 |
+
|
| 420 |
+
|
| 421 |
+
def read_objects_csv(objects_path):
|
| 422 |
+
with open(objects_path, "r", encoding="utf-8-sig", newline="") as csv_file:
|
| 423 |
+
reader = csv.DictReader(csv_file)
|
| 424 |
+
|
| 425 |
+
if reader.fieldnames is None:
|
| 426 |
+
raise ValueError(f"Missing header: {objects_path}")
|
| 427 |
+
|
| 428 |
+
if "ObjectIndex" not in reader.fieldnames:
|
| 429 |
+
raise ValueError(f"Missing ObjectIndex column: {objects_path}")
|
| 430 |
+
|
| 431 |
+
if "ObjectId" not in reader.fieldnames:
|
| 432 |
+
raise ValueError(f"Missing ObjectId column: {objects_path}")
|
| 433 |
+
|
| 434 |
+
if "Version" not in reader.fieldnames:
|
| 435 |
+
raise ValueError(f"Missing Version column: {objects_path}")
|
| 436 |
+
|
| 437 |
+
if "ArchiveTimeStamp" not in reader.fieldnames:
|
| 438 |
+
raise ValueError(f"Missing ArchiveTimeStamp column: {objects_path}")
|
| 439 |
+
|
| 440 |
+
objects_header = [
|
| 441 |
+
column
|
| 442 |
+
for column in reader.fieldnames
|
| 443 |
+
if column not in REMOVE_OBJECT_COLUMNS
|
| 444 |
+
]
|
| 445 |
+
|
| 446 |
+
final_objects_header = []
|
| 447 |
+
|
| 448 |
+
for column in objects_header:
|
| 449 |
+
final_objects_header.append(column)
|
| 450 |
+
|
| 451 |
+
if column == "Version":
|
| 452 |
+
final_objects_header.append("UUID_TXXX")
|
| 453 |
+
|
| 454 |
+
if column == "ArchiveTimeStamp":
|
| 455 |
+
final_objects_header.append("ArchiveTimeStampHex")
|
| 456 |
+
|
| 457 |
+
if column == "OdcSha1Digest":
|
| 458 |
+
final_objects_header.append("TYPE")
|
| 459 |
+
|
| 460 |
+
rows = []
|
| 461 |
+
|
| 462 |
+
for row in reader:
|
| 463 |
+
object_index = row.get("ObjectIndex", "").strip()
|
| 464 |
+
|
| 465 |
+
if not object_index:
|
| 466 |
+
log_error(f"[WARN] Blank ObjectIndex in Objects CSV: {objects_path}")
|
| 467 |
+
continue
|
| 468 |
+
|
| 469 |
+
object_id = row.get("ObjectId", "").strip()
|
| 470 |
+
version = row.get("Version", "").strip()
|
| 471 |
+
archive_timestamp = row.get("ArchiveTimeStamp", "").strip()
|
| 472 |
+
|
| 473 |
+
row["UUID_TXXX"] = f"{object_id}_{version_to_txxx(version)}"
|
| 474 |
+
row["ArchiveTimeStampHex"] = timestamp_to_hex(archive_timestamp)
|
| 475 |
+
row["TYPE"] = ""
|
| 476 |
+
|
| 477 |
+
clean_row = {}
|
| 478 |
+
|
| 479 |
+
for column in final_objects_header:
|
| 480 |
+
clean_row[column] = row.get(column, "")
|
| 481 |
+
|
| 482 |
+
rows.append(clean_row)
|
| 483 |
+
|
| 484 |
+
return final_objects_header, rows
|
| 485 |
+
|
| 486 |
+
|
| 487 |
+
def read_metadata_csv(metadata_path):
|
| 488 |
+
metadata_by_object_index = defaultdict(lambda: defaultdict(list))
|
| 489 |
+
unknown_keynames = set()
|
| 490 |
+
|
| 491 |
+
with open(metadata_path, "r", encoding="utf-8-sig", newline="") as csv_file:
|
| 492 |
+
reader = csv.DictReader(csv_file)
|
| 493 |
+
|
| 494 |
+
if reader.fieldnames is None:
|
| 495 |
+
raise ValueError(f"Missing header: {metadata_path}")
|
| 496 |
+
|
| 497 |
+
required_columns = {"ObjectIndex", "KeyName", "Value"}
|
| 498 |
+
missing_columns = required_columns - set(reader.fieldnames)
|
| 499 |
+
|
| 500 |
+
if missing_columns:
|
| 501 |
+
raise ValueError(
|
| 502 |
+
f"Missing Metadata column(s) {sorted(missing_columns)}: {metadata_path}"
|
| 503 |
+
)
|
| 504 |
+
|
| 505 |
+
for row_number, row in enumerate(reader, start=2):
|
| 506 |
+
object_index = row.get("ObjectIndex", "").strip()
|
| 507 |
+
raw_keyname = row.get("KeyName", "").strip()
|
| 508 |
+
value = row.get("Value", "")
|
| 509 |
+
|
| 510 |
+
if not object_index:
|
| 511 |
+
log_error(
|
| 512 |
+
f"[WARN] Blank ObjectIndex in Metadata CSV: {metadata_path}, row {row_number}"
|
| 513 |
+
)
|
| 514 |
+
continue
|
| 515 |
+
|
| 516 |
+
if not raw_keyname:
|
| 517 |
+
log_error(
|
| 518 |
+
f"[WARN] Blank KeyName in Metadata CSV: {metadata_path}, row {row_number}"
|
| 519 |
+
)
|
| 520 |
+
continue
|
| 521 |
+
|
| 522 |
+
keyname = normalize_keyname(raw_keyname)
|
| 523 |
+
|
| 524 |
+
if keyname not in METADATA_COLUMNS:
|
| 525 |
+
unknown_keynames.add(raw_keyname)
|
| 526 |
+
continue
|
| 527 |
+
|
| 528 |
+
metadata_by_object_index[object_index][keyname].append(value)
|
| 529 |
+
|
| 530 |
+
for keyname in sorted(unknown_keynames):
|
| 531 |
+
log_error(f"[UNKNOWN KEYNAME] {metadata_path.name}: {keyname}")
|
| 532 |
+
|
| 533 |
+
return metadata_by_object_index
|
| 534 |
+
|
| 535 |
+
|
| 536 |
+
def get_gender_from_rigs(rig_values):
|
| 537 |
+
gender_values = []
|
| 538 |
+
|
| 539 |
+
for rig_value in rig_values:
|
| 540 |
+
rig_value = str(rig_value).strip()
|
| 541 |
+
gender = GENDER_RIGS.get(rig_value)
|
| 542 |
+
|
| 543 |
+
if gender is None:
|
| 544 |
+
continue
|
| 545 |
+
|
| 546 |
+
if gender not in gender_values:
|
| 547 |
+
gender_values.append(gender)
|
| 548 |
+
|
| 549 |
+
return "|".join(gender_values)
|
| 550 |
+
|
| 551 |
+
|
| 552 |
+
def combine_pair(objects_path, metadata_path):
|
| 553 |
+
metadata_stem = strip_suffix(metadata_path.name, METADATA_SUFFIX)
|
| 554 |
+
output_path = TABLEDUMPS_DIR / f"{metadata_stem}{COMBINED_SUFFIX}"
|
| 555 |
+
|
| 556 |
+
if output_path.exists():
|
| 557 |
+
print(f"[SKIP] Already exists, nothing changed: {output_path.name}")
|
| 558 |
+
return
|
| 559 |
+
|
| 560 |
+
objects_header, objects_rows = read_objects_csv(objects_path)
|
| 561 |
+
metadata_by_object_index = read_metadata_csv(metadata_path)
|
| 562 |
+
|
| 563 |
+
combined_header = objects_header + METADATA_COLUMNS
|
| 564 |
+
|
| 565 |
+
with open(output_path, "w", encoding="utf-8", newline="") as csv_file:
|
| 566 |
+
writer = csv.DictWriter(
|
| 567 |
+
csv_file,
|
| 568 |
+
fieldnames=combined_header,
|
| 569 |
+
extrasaction="ignore"
|
| 570 |
+
)
|
| 571 |
+
|
| 572 |
+
writer.writeheader()
|
| 573 |
+
|
| 574 |
+
for object_row in objects_rows:
|
| 575 |
+
object_index = object_row.get("ObjectIndex", "").strip()
|
| 576 |
+
|
| 577 |
+
metadata_values = metadata_by_object_index.get(object_index, {})
|
| 578 |
+
combined_row = dict(object_row)
|
| 579 |
+
|
| 580 |
+
for column in METADATA_COLUMNS:
|
| 581 |
+
if column == "GENDER":
|
| 582 |
+
combined_row[column] = get_gender_from_rigs(
|
| 583 |
+
metadata_values.get("RIGS", [])
|
| 584 |
+
)
|
| 585 |
+
continue
|
| 586 |
+
|
| 587 |
+
values = metadata_values.get(column, [])
|
| 588 |
+
has_keyname = column in metadata_values
|
| 589 |
+
|
| 590 |
+
if column in SORT_VALUES_COLUMNS:
|
| 591 |
+
values = sorted(values, key=str.lower)
|
| 592 |
+
|
| 593 |
+
if column == "CLOTHING":
|
| 594 |
+
normalized_value = normalize_clothing_values(values)
|
| 595 |
+
|
| 596 |
+
elif column == "CATEGORY_ID":
|
| 597 |
+
normalized_value = normalize_category_values(values)
|
| 598 |
+
|
| 599 |
+
elif column == "PRODUCT_ID":
|
| 600 |
+
normalized_value = normalize_product_values(values)
|
| 601 |
+
|
| 602 |
+
elif column == "FURNITURE":
|
| 603 |
+
normalized_value = normalize_furniture_values(values)
|
| 604 |
+
|
| 605 |
+
else:
|
| 606 |
+
normalized_value = "|".join(values)
|
| 607 |
+
|
| 608 |
+
combined_row[column] = add_field_name(
|
| 609 |
+
column,
|
| 610 |
+
normalized_value,
|
| 611 |
+
has_keyname
|
| 612 |
+
)
|
| 613 |
+
|
| 614 |
+
if not combined_row.get("CLOTHING", ""):
|
| 615 |
+
rigs_value = combined_row.get("RIGS", "")
|
| 616 |
+
|
| 617 |
+
if rigs_value.startswith("RIGS|"):
|
| 618 |
+
combined_row["CLOTHING"] = "CLOTHING|"
|
| 619 |
+
|
| 620 |
+
if combined_row.get("FURNITURE", ""):
|
| 621 |
+
rigs_value = combined_row.get("RIGS", "")
|
| 622 |
+
|
| 623 |
+
if rigs_value.startswith("RIGS|"):
|
| 624 |
+
combined_row["RIGS"] = strip_field_name(
|
| 625 |
+
"RIGS",
|
| 626 |
+
rigs_value
|
| 627 |
+
)
|
| 628 |
+
|
| 629 |
+
combined_row["TYPE"] = build_type_value(combined_row)
|
| 630 |
+
|
| 631 |
+
writer.writerow(combined_row)
|
| 632 |
+
|
| 633 |
+
print(f"[DONE] {output_path.name}")
|
| 634 |
+
|
| 635 |
+
|
| 636 |
+
def main():
|
| 637 |
+
print(f"Script folder: {SCRIPT_DIR}")
|
| 638 |
+
print(f"Base folder: {BASE_DIR}")
|
| 639 |
+
print(f"Table dumps folder: {TABLEDUMPS_DIR}")
|
| 640 |
+
print()
|
| 641 |
+
|
| 642 |
+
if not TABLEDUMPS_DIR.exists():
|
| 643 |
+
print("[ERROR] TABLEDUMPS folder does not exist.")
|
| 644 |
+
print(f"Missing folder: {TABLEDUMPS_DIR}")
|
| 645 |
+
input("")
|
| 646 |
+
return
|
| 647 |
+
|
| 648 |
+
if ERROR_LOG.exists():
|
| 649 |
+
ERROR_LOG.unlink()
|
| 650 |
+
|
| 651 |
+
objects_files = find_objects_files()
|
| 652 |
+
metadata_files = find_metadata_files()
|
| 653 |
+
|
| 654 |
+
print(f"Objects CSV files: {len(objects_files)}")
|
| 655 |
+
print(f"Metadata CSV files: {len(metadata_files)}")
|
| 656 |
+
print()
|
| 657 |
+
|
| 658 |
+
if not objects_files:
|
| 659 |
+
print("[ERROR] No *_Objects.csv files found.")
|
| 660 |
+
input("")
|
| 661 |
+
return
|
| 662 |
+
|
| 663 |
+
if not metadata_files:
|
| 664 |
+
print("[ERROR] No *_Metadata.csv files found.")
|
| 665 |
+
input("")
|
| 666 |
+
return
|
| 667 |
+
|
| 668 |
+
objectcatalogue_5_stems = []
|
| 669 |
+
objectcatalogue_stems = []
|
| 670 |
+
other_stems = []
|
| 671 |
+
|
| 672 |
+
for metadata_stem in metadata_files.keys():
|
| 673 |
+
lower_stem = metadata_stem.lower()
|
| 674 |
+
|
| 675 |
+
if lower_stem.startswith("objectcatalogue_5_"):
|
| 676 |
+
objectcatalogue_5_stems.append(metadata_stem)
|
| 677 |
+
|
| 678 |
+
elif lower_stem.startswith("objectcatalogue_"):
|
| 679 |
+
objectcatalogue_stems.append(metadata_stem)
|
| 680 |
+
|
| 681 |
+
else:
|
| 682 |
+
other_stems.append(metadata_stem)
|
| 683 |
+
|
| 684 |
+
sorted_metadata_stems = (
|
| 685 |
+
sorted(
|
| 686 |
+
objectcatalogue_5_stems,
|
| 687 |
+
key=get_objectcatalogue_5_date,
|
| 688 |
+
reverse=True
|
| 689 |
+
)
|
| 690 |
+
+ sorted(
|
| 691 |
+
objectcatalogue_stems,
|
| 692 |
+
key=get_objectcatalogue_date,
|
| 693 |
+
reverse=True
|
| 694 |
+
)
|
| 695 |
+
+ sorted(other_stems, key=catalogue_sort_key)
|
| 696 |
+
)
|
| 697 |
+
|
| 698 |
+
for metadata_stem in sorted_metadata_stems:
|
| 699 |
+
metadata_path = metadata_files[metadata_stem]
|
| 700 |
+
objects_path = find_best_objects_file(metadata_stem, objects_files)
|
| 701 |
+
|
| 702 |
+
if objects_path is None:
|
| 703 |
+
log_error(f"[MISSING OBJECTS CSV] {metadata_path.name}")
|
| 704 |
+
print(f"[SKIP] Missing Objects CSV for {metadata_path.name}")
|
| 705 |
+
continue
|
| 706 |
+
|
| 707 |
+
print(f"[COMBINE] {objects_path.name}")
|
| 708 |
+
print(f" + {metadata_path.name}")
|
| 709 |
+
|
| 710 |
+
try:
|
| 711 |
+
combine_pair(objects_path, metadata_path)
|
| 712 |
+
except Exception as error:
|
| 713 |
+
log_error(
|
| 714 |
+
f"[ERROR] Failed combining {objects_path.name} + {metadata_path.name}: {error}"
|
| 715 |
+
)
|
| 716 |
+
print(f"[ERROR] {metadata_path.name}: {error}")
|
| 717 |
+
|
| 718 |
+
print()
|
| 719 |
+
|
| 720 |
+
if ERROR_LOG.exists():
|
| 721 |
+
print(f"Finished with log: {ERROR_LOG}")
|
| 722 |
+
else:
|
| 723 |
+
print("Finished with no errors.")
|
| 724 |
+
|
| 725 |
+
input("")
|
| 726 |
+
|
| 727 |
+
|
| 728 |
+
if __name__ == "__main__":
|
| 729 |
+
main()
|
OBJECTCATALOGUES/scripts/3-create_logs.py
ADDED
|
@@ -0,0 +1,737 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import csv
|
| 2 |
+
import os
|
| 3 |
+
import glob
|
| 4 |
+
import re
|
| 5 |
+
from datetime import datetime
|
| 6 |
+
|
| 7 |
+
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
|
| 8 |
+
BASE_DIR = os.path.dirname(SCRIPT_DIR)
|
| 9 |
+
|
| 10 |
+
TARGET_DIR = os.path.join(BASE_DIR, "TABLEDUMPS")
|
| 11 |
+
OUTPUT_FILE = os.path.join(BASE_DIR, "uniqueobjects.txt")
|
| 12 |
+
FIRST_INTRO_OUTPUT_FILE = os.path.join(BASE_DIR, "uuidfirstintroduced.txt")
|
| 13 |
+
DEBUG_UUID_LOG_FILE = os.path.join(BASE_DIR, "debug.log")
|
| 14 |
+
|
| 15 |
+
DEBUG_UUID_LOG_ENABLED = False
|
| 16 |
+
|
| 17 |
+
DEBUG_UUIDS = {
|
| 18 |
+
"C080CDE0-DE51455D-BF85BC62-EF65634A",
|
| 19 |
+
"0BB99D3D-11BD4A6C-9F1300E3-3A8E2592",
|
| 20 |
+
"CAFEF00D-BEEFF00D-FEEDBEEF-000010A2",
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
BUILD_MATCHES = {
|
| 24 |
+
"Env_SCEA-Dusty_2": "DEV",
|
| 25 |
+
"Env_HDK_CDEVC-PixelButts": "DEV",
|
| 26 |
+
"Env_HDK-SingstarDev": "DEV",
|
| 27 |
+
"Env_LBP-imagisphere": "DEV",
|
| 28 |
+
"Env_SingStar-SingStarDev": "DEV",
|
| 29 |
+
"Env_SingStar-bowzark": "DEV",
|
| 30 |
+
"Env_SCEASDFPQA-Spouts": "DEV",
|
| 31 |
+
"Env_scea989-Spounts": "DEV",
|
| 32 |
+
"Env_KungFuFactorydba-PixelButts": "DEV",
|
| 33 |
+
"Env_homecoretest-Soul 1": "DEV",
|
| 34 |
+
"Env_veemeescee-QuantumDoja2": "DEV",
|
| 35 |
+
"Env_veemeetovss-Soul 4 DECH2500": "DEV",
|
| 36 |
+
"cqa-a-Soul 3": "DEV",
|
| 37 |
+
"cqa-a-Viciousest": "DEV",
|
| 38 |
+
"cpreprod-QuantumDoja1": "DEV",
|
| 39 |
+
"cqa-e-QuantumDoja": "DEV",
|
| 40 |
+
"cqa-e-Soul 3": "DEV",
|
| 41 |
+
"ObjectCatalogue_5_SCEA_2012-11-12": "BETA",
|
| 42 |
+
"ObjectCatalogue_5_SCEE_2012-11-12": "BETA",
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
OUTPUT_FIELDS = [
|
| 46 |
+
"UUID_TXXX",
|
| 47 |
+
"ObjectId",
|
| 48 |
+
"Version",
|
| 49 |
+
"Build",
|
| 50 |
+
]
|
| 51 |
+
|
| 52 |
+
FIRST_INTRO_BASE_OUTPUT_FIELDS = [
|
| 53 |
+
"UUID",
|
| 54 |
+
"First Date Introduced",
|
| 55 |
+
"Last Date Removed",
|
| 56 |
+
]
|
| 57 |
+
|
| 58 |
+
READDED_FIELD_NAME = "Removed Date->Added Back Date"
|
| 59 |
+
|
| 60 |
+
|
| 61 |
+
def get_build_from_file_path(file_path):
|
| 62 |
+
path_text = file_path.replace("\\", "/").lower()
|
| 63 |
+
|
| 64 |
+
for text, build in BUILD_MATCHES.items():
|
| 65 |
+
if text.lower() in path_text:
|
| 66 |
+
return build
|
| 67 |
+
|
| 68 |
+
return "RETAIL"
|
| 69 |
+
|
| 70 |
+
|
| 71 |
+
def version_num(value):
|
| 72 |
+
try:
|
| 73 |
+
return int(str(value).strip())
|
| 74 |
+
except:
|
| 75 |
+
return -1
|
| 76 |
+
|
| 77 |
+
|
| 78 |
+
def build_rank(build):
|
| 79 |
+
if build == "RETAIL":
|
| 80 |
+
return 0
|
| 81 |
+
if build == "BETA":
|
| 82 |
+
return 1
|
| 83 |
+
return 2
|
| 84 |
+
|
| 85 |
+
|
| 86 |
+
def should_replace_existing(old_row, new_row):
|
| 87 |
+
old_rank = build_rank(old_row["Build"])
|
| 88 |
+
new_rank = build_rank(new_row["Build"])
|
| 89 |
+
|
| 90 |
+
if new_rank < old_rank:
|
| 91 |
+
return True
|
| 92 |
+
|
| 93 |
+
if new_rank > old_rank:
|
| 94 |
+
return False
|
| 95 |
+
|
| 96 |
+
return version_num(new_row["Version"]) > version_num(old_row["Version"])
|
| 97 |
+
|
| 98 |
+
|
| 99 |
+
def clean_fieldnames(fieldnames):
|
| 100 |
+
return [
|
| 101 |
+
h.strip().replace("\ufeff", "")
|
| 102 |
+
for h in fieldnames
|
| 103 |
+
]
|
| 104 |
+
|
| 105 |
+
|
| 106 |
+
def parse_catalogue_date_from_filename(file_path):
|
| 107 |
+
filename = os.path.basename(file_path)
|
| 108 |
+
|
| 109 |
+
m = re.match(
|
| 110 |
+
r"^ObjectCatalogue_5_[^_]+_(\d{4}-\d{2}-\d{2})(?:_|-|\.|$)",
|
| 111 |
+
filename,
|
| 112 |
+
re.IGNORECASE
|
| 113 |
+
)
|
| 114 |
+
|
| 115 |
+
if m:
|
| 116 |
+
return datetime.strptime(m.group(1), "%Y-%m-%d").date()
|
| 117 |
+
|
| 118 |
+
m = re.match(
|
| 119 |
+
r"^OBJECTCATALOGUE_(\d{4}-\d{2}-\d{2})(?:_|-|\.|$)",
|
| 120 |
+
filename,
|
| 121 |
+
re.IGNORECASE
|
| 122 |
+
)
|
| 123 |
+
|
| 124 |
+
if m:
|
| 125 |
+
return datetime.strptime(m.group(1), "%Y-%m-%d").date()
|
| 126 |
+
|
| 127 |
+
return None
|
| 128 |
+
|
| 129 |
+
|
| 130 |
+
def format_date(date_value):
|
| 131 |
+
if not date_value:
|
| 132 |
+
return ""
|
| 133 |
+
|
| 134 |
+
return date_value.strftime("%Y-%m-%d")
|
| 135 |
+
|
| 136 |
+
|
| 137 |
+
def find_first_intro_csv_files():
|
| 138 |
+
patterns = [
|
| 139 |
+
os.path.join(TARGET_DIR, "**", "*_Combined.csv"),
|
| 140 |
+
os.path.join(TARGET_DIR, "**", "ObjectCatalogue_5_*_Objects.csv"),
|
| 141 |
+
]
|
| 142 |
+
|
| 143 |
+
found = []
|
| 144 |
+
|
| 145 |
+
for pattern in patterns:
|
| 146 |
+
found.extend(glob.glob(pattern, recursive=True))
|
| 147 |
+
|
| 148 |
+
seen = set()
|
| 149 |
+
result = []
|
| 150 |
+
|
| 151 |
+
for path in found:
|
| 152 |
+
key = os.path.abspath(path).lower()
|
| 153 |
+
if key not in seen:
|
| 154 |
+
seen.add(key)
|
| 155 |
+
result.append(path)
|
| 156 |
+
|
| 157 |
+
return result
|
| 158 |
+
|
| 159 |
+
|
| 160 |
+
def get_object_ids_from_csv(csv_file):
|
| 161 |
+
object_ids = set()
|
| 162 |
+
|
| 163 |
+
rows_read = 0
|
| 164 |
+
rows_skipped_missing_objectid = 0
|
| 165 |
+
|
| 166 |
+
with open(csv_file, "r", encoding="utf-8-sig", errors="replace", newline="") as f:
|
| 167 |
+
reader = csv.DictReader(f, delimiter=",")
|
| 168 |
+
|
| 169 |
+
if not reader.fieldnames:
|
| 170 |
+
return object_ids, rows_read, rows_skipped_missing_objectid, "no header found"
|
| 171 |
+
|
| 172 |
+
fieldnames_clean = clean_fieldnames(reader.fieldnames)
|
| 173 |
+
reader.fieldnames = fieldnames_clean
|
| 174 |
+
|
| 175 |
+
if "ObjectId" in fieldnames_clean:
|
| 176 |
+
object_id_field = "ObjectId"
|
| 177 |
+
elif len(fieldnames_clean) >= 2:
|
| 178 |
+
object_id_field = fieldnames_clean[1]
|
| 179 |
+
print(f" WARNING: ObjectId header not found. Using COL B: {repr(object_id_field)}")
|
| 180 |
+
else:
|
| 181 |
+
return object_ids, rows_read, rows_skipped_missing_objectid, "ObjectId missing and COL B does not exist"
|
| 182 |
+
|
| 183 |
+
for row in reader:
|
| 184 |
+
rows_read += 1
|
| 185 |
+
|
| 186 |
+
uuid = row.get(object_id_field, "").strip()
|
| 187 |
+
|
| 188 |
+
if not uuid:
|
| 189 |
+
rows_skipped_missing_objectid += 1
|
| 190 |
+
continue
|
| 191 |
+
|
| 192 |
+
object_ids.add(uuid.upper())
|
| 193 |
+
|
| 194 |
+
return object_ids, rows_read, rows_skipped_missing_objectid, None
|
| 195 |
+
|
| 196 |
+
|
| 197 |
+
def debug_write(debug_file, message):
|
| 198 |
+
if not DEBUG_UUID_LOG_ENABLED:
|
| 199 |
+
return
|
| 200 |
+
|
| 201 |
+
if debug_file is None:
|
| 202 |
+
return
|
| 203 |
+
|
| 204 |
+
debug_file.write(message + "\n")
|
| 205 |
+
debug_file.flush()
|
| 206 |
+
|
| 207 |
+
|
| 208 |
+
def debug_uuid_event(debug_file, uuid, message):
|
| 209 |
+
if uuid.upper() not in DEBUG_UUIDS:
|
| 210 |
+
return
|
| 211 |
+
|
| 212 |
+
debug_write(debug_file, f"{uuid.upper()}\t{message}")
|
| 213 |
+
|
| 214 |
+
|
| 215 |
+
def debug_snapshot_status(debug_file, current_date, current_uuids, previous_uuids, removed_now, added_now, currently_removed):
|
| 216 |
+
if not DEBUG_UUID_LOG_ENABLED:
|
| 217 |
+
return
|
| 218 |
+
|
| 219 |
+
for debug_uuid in sorted(DEBUG_UUIDS):
|
| 220 |
+
status = "PRESENT" if debug_uuid in current_uuids else "MISSING"
|
| 221 |
+
|
| 222 |
+
if debug_uuid in added_now:
|
| 223 |
+
change = "ADDED_SINCE_PREVIOUS"
|
| 224 |
+
elif debug_uuid in removed_now:
|
| 225 |
+
change = "REMOVED_SINCE_PREVIOUS"
|
| 226 |
+
elif debug_uuid in previous_uuids and debug_uuid in current_uuids:
|
| 227 |
+
change = "STILL_PRESENT"
|
| 228 |
+
elif debug_uuid not in previous_uuids and debug_uuid not in current_uuids:
|
| 229 |
+
change = "STILL_MISSING"
|
| 230 |
+
else:
|
| 231 |
+
change = "NO_CHANGE"
|
| 232 |
+
|
| 233 |
+
removed_state = ""
|
| 234 |
+
|
| 235 |
+
if debug_uuid in currently_removed:
|
| 236 |
+
removed_state = f"CURRENTLY_REMOVED_SINCE={format_date(currently_removed[debug_uuid])}"
|
| 237 |
+
|
| 238 |
+
debug_write(
|
| 239 |
+
debug_file,
|
| 240 |
+
f"{debug_uuid}\tDATE={format_date(current_date)}\tSTATUS={status}\tCHANGE={change}\t{removed_state}"
|
| 241 |
+
)
|
| 242 |
+
|
| 243 |
+
|
| 244 |
+
def build_first_intro_log():
|
| 245 |
+
if os.path.exists(FIRST_INTRO_OUTPUT_FILE):
|
| 246 |
+
print("------------------------------------------------------------")
|
| 247 |
+
print("First-introduced output file already exists. Skipping uuidfirstintroduced.txt only.")
|
| 248 |
+
print(f"First-introduced output file: {FIRST_INTRO_OUTPUT_FILE}")
|
| 249 |
+
print("------------------------------------------------------------")
|
| 250 |
+
return
|
| 251 |
+
|
| 252 |
+
debug_file = None
|
| 253 |
+
|
| 254 |
+
if DEBUG_UUID_LOG_ENABLED:
|
| 255 |
+
debug_file = open(DEBUG_UUID_LOG_FILE, "w", encoding="utf-8", newline="")
|
| 256 |
+
debug_write(debug_file, "UUID\tDebug")
|
| 257 |
+
debug_write(debug_file, "------------------------------------------------------------")
|
| 258 |
+
debug_write(debug_file, "Starting UUID debug trace")
|
| 259 |
+
debug_write(debug_file, f"Target dir: {TARGET_DIR}")
|
| 260 |
+
debug_write(debug_file, f"First-introduced output file: {FIRST_INTRO_OUTPUT_FILE}")
|
| 261 |
+
debug_write(debug_file, "Debug UUIDs:")
|
| 262 |
+
|
| 263 |
+
for debug_uuid in sorted(DEBUG_UUIDS):
|
| 264 |
+
debug_write(debug_file, f"{debug_uuid}\tWATCHING")
|
| 265 |
+
|
| 266 |
+
debug_write(debug_file, "------------------------------------------------------------")
|
| 267 |
+
|
| 268 |
+
try:
|
| 269 |
+
first_intro_files = find_first_intro_csv_files()
|
| 270 |
+
|
| 271 |
+
date_to_uuids = {}
|
| 272 |
+
date_to_files = {}
|
| 273 |
+
|
| 274 |
+
files_read = 0
|
| 275 |
+
files_skipped_dev_beta = 0
|
| 276 |
+
files_skipped_no_date = 0
|
| 277 |
+
files_skipped_missing_objectid = 0
|
| 278 |
+
rows_read = 0
|
| 279 |
+
rows_skipped_missing_objectid = 0
|
| 280 |
+
|
| 281 |
+
print()
|
| 282 |
+
print("------------------------------------------------------------")
|
| 283 |
+
print("Building first-introduced / last-removed UUID date log...")
|
| 284 |
+
print(f"First-introduced output file: {FIRST_INTRO_OUTPUT_FILE}")
|
| 285 |
+
|
| 286 |
+
if DEBUG_UUID_LOG_ENABLED:
|
| 287 |
+
print(f"Debug UUID log file: {DEBUG_UUID_LOG_FILE}")
|
| 288 |
+
|
| 289 |
+
print(f"Found {len(first_intro_files)} candidate file(s).")
|
| 290 |
+
print("------------------------------------------------------------")
|
| 291 |
+
print()
|
| 292 |
+
|
| 293 |
+
for csv_file in first_intro_files:
|
| 294 |
+
build = get_build_from_file_path(csv_file)
|
| 295 |
+
|
| 296 |
+
if build != "RETAIL":
|
| 297 |
+
files_skipped_dev_beta += 1
|
| 298 |
+
debug_write(debug_file, f"SKIP_FILE_DEV_BETA\t{csv_file}\tBuild={build}")
|
| 299 |
+
continue
|
| 300 |
+
|
| 301 |
+
catalogue_date = parse_catalogue_date_from_filename(csv_file)
|
| 302 |
+
|
| 303 |
+
if catalogue_date is None:
|
| 304 |
+
files_skipped_no_date += 1
|
| 305 |
+
debug_write(debug_file, f"SKIP_FILE_NO_DATE\t{csv_file}")
|
| 306 |
+
continue
|
| 307 |
+
|
| 308 |
+
print("------------------------------------------------------------")
|
| 309 |
+
print(f"Reading snapshot file: {csv_file}")
|
| 310 |
+
print(f"Date: {format_date(catalogue_date)}")
|
| 311 |
+
print(f"Build: {build}")
|
| 312 |
+
|
| 313 |
+
debug_write(
|
| 314 |
+
debug_file,
|
| 315 |
+
f"READ_FILE\tDate={format_date(catalogue_date)}\tBuild={build}\t{csv_file}"
|
| 316 |
+
)
|
| 317 |
+
|
| 318 |
+
try:
|
| 319 |
+
object_ids, file_rows_read, file_rows_skipped, error = get_object_ids_from_csv(csv_file)
|
| 320 |
+
|
| 321 |
+
rows_read += file_rows_read
|
| 322 |
+
rows_skipped_missing_objectid += file_rows_skipped
|
| 323 |
+
|
| 324 |
+
if error:
|
| 325 |
+
print(f" SKIP: {error}")
|
| 326 |
+
files_skipped_missing_objectid += 1
|
| 327 |
+
debug_write(
|
| 328 |
+
debug_file,
|
| 329 |
+
f"SKIP_FILE_OBJECTID_ERROR\tDate={format_date(catalogue_date)}\tError={error}\t{csv_file}"
|
| 330 |
+
)
|
| 331 |
+
continue
|
| 332 |
+
|
| 333 |
+
if catalogue_date not in date_to_uuids:
|
| 334 |
+
date_to_uuids[catalogue_date] = set()
|
| 335 |
+
date_to_files[catalogue_date] = []
|
| 336 |
+
|
| 337 |
+
date_to_uuids[catalogue_date].update(object_ids)
|
| 338 |
+
date_to_files[catalogue_date].append(csv_file)
|
| 339 |
+
|
| 340 |
+
files_read += 1
|
| 341 |
+
|
| 342 |
+
print(f" Rows read: {file_rows_read}")
|
| 343 |
+
print(f" Skipped missing ObjectId: {file_rows_skipped}")
|
| 344 |
+
print(f" UUIDs found in file: {len(object_ids)}")
|
| 345 |
+
|
| 346 |
+
for debug_uuid in sorted(DEBUG_UUIDS):
|
| 347 |
+
if debug_uuid in object_ids:
|
| 348 |
+
debug_write(
|
| 349 |
+
debug_file,
|
| 350 |
+
f"{debug_uuid}\tFOUND_IN_FILE\tDate={format_date(catalogue_date)}\t{csv_file}"
|
| 351 |
+
)
|
| 352 |
+
else:
|
| 353 |
+
debug_write(
|
| 354 |
+
debug_file,
|
| 355 |
+
f"{debug_uuid}\tNOT_FOUND_IN_FILE\tDate={format_date(catalogue_date)}\t{csv_file}"
|
| 356 |
+
)
|
| 357 |
+
|
| 358 |
+
except Exception as e:
|
| 359 |
+
print(f" ERROR reading file: {e}")
|
| 360 |
+
debug_write(
|
| 361 |
+
debug_file,
|
| 362 |
+
f"ERROR_READING_FILE\tDate={format_date(catalogue_date)}\tError={e}\t{csv_file}"
|
| 363 |
+
)
|
| 364 |
+
continue
|
| 365 |
+
|
| 366 |
+
sorted_dates = sorted(date_to_uuids.keys())
|
| 367 |
+
|
| 368 |
+
first_intro = {}
|
| 369 |
+
last_removed = {}
|
| 370 |
+
currently_removed = {}
|
| 371 |
+
readded_events_by_uuid = {}
|
| 372 |
+
|
| 373 |
+
previous_date = None
|
| 374 |
+
previous_uuids = set()
|
| 375 |
+
ever_seen = set()
|
| 376 |
+
|
| 377 |
+
debug_write(debug_file, "------------------------------------------------------------")
|
| 378 |
+
debug_write(debug_file, "Processing snapshots in date order")
|
| 379 |
+
|
| 380 |
+
for current_date in sorted_dates:
|
| 381 |
+
current_uuids = date_to_uuids[current_date]
|
| 382 |
+
|
| 383 |
+
print("------------------------------------------------------------")
|
| 384 |
+
print(f"Processing snapshot date: {format_date(current_date)}")
|
| 385 |
+
print(f"Files combined for this date: {len(date_to_files[current_date])}")
|
| 386 |
+
print(f"UUIDs in snapshot: {len(current_uuids)}")
|
| 387 |
+
|
| 388 |
+
debug_write(
|
| 389 |
+
debug_file,
|
| 390 |
+
f"SNAPSHOT\tDate={format_date(current_date)}\tFiles={len(date_to_files[current_date])}\tUUIDs={len(current_uuids)}"
|
| 391 |
+
)
|
| 392 |
+
|
| 393 |
+
for path in date_to_files[current_date]:
|
| 394 |
+
debug_write(debug_file, f"SNAPSHOT_FILE\tDate={format_date(current_date)}\t{path}")
|
| 395 |
+
|
| 396 |
+
# First snapshot only establishes the starting set.
|
| 397 |
+
if previous_date is None:
|
| 398 |
+
for uuid in current_uuids:
|
| 399 |
+
first_intro[uuid] = current_date
|
| 400 |
+
ever_seen.add(uuid)
|
| 401 |
+
|
| 402 |
+
if uuid in DEBUG_UUIDS:
|
| 403 |
+
debug_uuid_event(
|
| 404 |
+
debug_file,
|
| 405 |
+
uuid,
|
| 406 |
+
f"FIRST_SNAPSHOT_PRESENT\tFirst Date Introduced={format_date(current_date)}"
|
| 407 |
+
)
|
| 408 |
+
|
| 409 |
+
for debug_uuid in sorted(DEBUG_UUIDS):
|
| 410 |
+
if debug_uuid not in current_uuids:
|
| 411 |
+
debug_uuid_event(
|
| 412 |
+
debug_file,
|
| 413 |
+
debug_uuid,
|
| 414 |
+
f"FIRST_SNAPSHOT_MISSING\tDate={format_date(current_date)}"
|
| 415 |
+
)
|
| 416 |
+
|
| 417 |
+
previous_date = current_date
|
| 418 |
+
previous_uuids = current_uuids
|
| 419 |
+
continue
|
| 420 |
+
|
| 421 |
+
removed_now = previous_uuids - current_uuids
|
| 422 |
+
added_now = current_uuids - previous_uuids
|
| 423 |
+
|
| 424 |
+
debug_snapshot_status(
|
| 425 |
+
debug_file,
|
| 426 |
+
current_date,
|
| 427 |
+
current_uuids,
|
| 428 |
+
previous_uuids,
|
| 429 |
+
removed_now,
|
| 430 |
+
added_now,
|
| 431 |
+
currently_removed
|
| 432 |
+
)
|
| 433 |
+
|
| 434 |
+
for uuid in added_now:
|
| 435 |
+
if uuid not in ever_seen:
|
| 436 |
+
first_intro[uuid] = current_date
|
| 437 |
+
ever_seen.add(uuid)
|
| 438 |
+
|
| 439 |
+
debug_uuid_event(
|
| 440 |
+
debug_file,
|
| 441 |
+
uuid,
|
| 442 |
+
f"FIRST_INTRODUCED\tDate={format_date(current_date)}"
|
| 443 |
+
)
|
| 444 |
+
|
| 445 |
+
if uuid in currently_removed:
|
| 446 |
+
removed_date = currently_removed[uuid]
|
| 447 |
+
event_text = f"{format_date(removed_date)}->{format_date(current_date)}"
|
| 448 |
+
|
| 449 |
+
if uuid not in readded_events_by_uuid:
|
| 450 |
+
readded_events_by_uuid[uuid] = []
|
| 451 |
+
|
| 452 |
+
readded_events_by_uuid[uuid].append(event_text)
|
| 453 |
+
|
| 454 |
+
debug_uuid_event(
|
| 455 |
+
debug_file,
|
| 456 |
+
uuid,
|
| 457 |
+
f"REMOVED_THEN_ADDED_BACK\t{event_text}"
|
| 458 |
+
)
|
| 459 |
+
|
| 460 |
+
del currently_removed[uuid]
|
| 461 |
+
|
| 462 |
+
for uuid in removed_now:
|
| 463 |
+
last_removed[uuid] = previous_date
|
| 464 |
+
currently_removed[uuid] = previous_date
|
| 465 |
+
|
| 466 |
+
debug_uuid_event(
|
| 467 |
+
debug_file,
|
| 468 |
+
uuid,
|
| 469 |
+
f"REMOVED\tLast Date Removed={format_date(previous_date)}\tMissing On={format_date(current_date)}"
|
| 470 |
+
)
|
| 471 |
+
|
| 472 |
+
for debug_uuid in sorted(DEBUG_UUIDS):
|
| 473 |
+
if debug_uuid in current_uuids and debug_uuid not in added_now:
|
| 474 |
+
debug_uuid_event(
|
| 475 |
+
debug_file,
|
| 476 |
+
debug_uuid,
|
| 477 |
+
f"PRESENT_AFTER_DATE_COMPARE\tDate={format_date(current_date)}"
|
| 478 |
+
)
|
| 479 |
+
|
| 480 |
+
if debug_uuid not in current_uuids and debug_uuid not in removed_now:
|
| 481 |
+
debug_uuid_event(
|
| 482 |
+
debug_file,
|
| 483 |
+
debug_uuid,
|
| 484 |
+
f"MISSING_AFTER_DATE_COMPARE\tDate={format_date(current_date)}"
|
| 485 |
+
)
|
| 486 |
+
|
| 487 |
+
print(f" Added since previous snapshot: {len(added_now)}")
|
| 488 |
+
print(f" Removed since previous snapshot: {len(removed_now)}")
|
| 489 |
+
|
| 490 |
+
previous_date = current_date
|
| 491 |
+
previous_uuids = current_uuids
|
| 492 |
+
|
| 493 |
+
final_rows = []
|
| 494 |
+
|
| 495 |
+
for uuid in sorted(first_intro.keys()):
|
| 496 |
+
final_rows.append({
|
| 497 |
+
"UUID": uuid,
|
| 498 |
+
"First Date Introduced": format_date(first_intro[uuid]),
|
| 499 |
+
"Last Date Removed": format_date(last_removed.get(uuid)),
|
| 500 |
+
"Readded Events": readded_events_by_uuid.get(uuid, []),
|
| 501 |
+
})
|
| 502 |
+
|
| 503 |
+
max_readded_event_count = 0
|
| 504 |
+
|
| 505 |
+
for row in final_rows:
|
| 506 |
+
count = len(row["Readded Events"])
|
| 507 |
+
if count > max_readded_event_count:
|
| 508 |
+
max_readded_event_count = count
|
| 509 |
+
|
| 510 |
+
first_intro_output_fields = (
|
| 511 |
+
FIRST_INTRO_BASE_OUTPUT_FIELDS +
|
| 512 |
+
([READDED_FIELD_NAME] * max_readded_event_count)
|
| 513 |
+
)
|
| 514 |
+
|
| 515 |
+
with open(FIRST_INTRO_OUTPUT_FILE, "w", encoding="utf-8", newline="") as f:
|
| 516 |
+
writer = csv.writer(f, delimiter="\t")
|
| 517 |
+
writer.writerow(first_intro_output_fields)
|
| 518 |
+
|
| 519 |
+
for row in final_rows:
|
| 520 |
+
output_row = [
|
| 521 |
+
row["UUID"],
|
| 522 |
+
row["First Date Introduced"],
|
| 523 |
+
row["Last Date Removed"],
|
| 524 |
+
]
|
| 525 |
+
|
| 526 |
+
readded_events = row["Readded Events"]
|
| 527 |
+
|
| 528 |
+
for event_text in readded_events:
|
| 529 |
+
output_row.append(event_text)
|
| 530 |
+
|
| 531 |
+
while len(output_row) < len(first_intro_output_fields):
|
| 532 |
+
output_row.append("")
|
| 533 |
+
|
| 534 |
+
writer.writerow(output_row)
|
| 535 |
+
|
| 536 |
+
debug_write(debug_file, "------------------------------------------------------------")
|
| 537 |
+
debug_write(debug_file, "Finished UUID debug trace")
|
| 538 |
+
debug_write(debug_file, f"Snapshot dates processed: {len(sorted_dates)}")
|
| 539 |
+
|
| 540 |
+
total_readded_events = 0
|
| 541 |
+
for events in readded_events_by_uuid.values():
|
| 542 |
+
total_readded_events += len(events)
|
| 543 |
+
|
| 544 |
+
debug_write(debug_file, f"Removed-then-added events written into uuidfirstintroduced.txt: {total_readded_events}")
|
| 545 |
+
|
| 546 |
+
for debug_uuid in sorted(DEBUG_UUIDS):
|
| 547 |
+
debug_write(debug_file, "------------------------------------------------------------")
|
| 548 |
+
debug_write(debug_file, f"{debug_uuid}\tFINAL")
|
| 549 |
+
debug_write(debug_file, f"{debug_uuid}\tFirst Date Introduced={format_date(first_intro.get(debug_uuid))}")
|
| 550 |
+
debug_write(debug_file, f"{debug_uuid}\tLast Date Removed={format_date(last_removed.get(debug_uuid))}")
|
| 551 |
+
|
| 552 |
+
events = readded_events_by_uuid.get(debug_uuid, [])
|
| 553 |
+
|
| 554 |
+
if events:
|
| 555 |
+
for event_text in events:
|
| 556 |
+
debug_write(debug_file, f"{debug_uuid}\tRemoved Date->Added Back Date={event_text}")
|
| 557 |
+
else:
|
| 558 |
+
debug_write(debug_file, f"{debug_uuid}\tRemoved Date->Added Back Date=")
|
| 559 |
+
|
| 560 |
+
print("------------------------------------------------------------")
|
| 561 |
+
print("First-introduced / last-removed log done.")
|
| 562 |
+
print(f"Candidate files found: {len(first_intro_files)}")
|
| 563 |
+
print(f"Files read: {files_read}")
|
| 564 |
+
print(f"Files skipped DEV/BETA: {files_skipped_dev_beta}")
|
| 565 |
+
print(f"Files skipped missing date in filename: {files_skipped_no_date}")
|
| 566 |
+
print(f"Files skipped missing ObjectId/COL B: {files_skipped_missing_objectid}")
|
| 567 |
+
print(f"Snapshot dates processed: {len(sorted_dates)}")
|
| 568 |
+
print(f"Rows read total: {rows_read}")
|
| 569 |
+
print(f"Skipped missing ObjectId: {rows_skipped_missing_objectid}")
|
| 570 |
+
print(f"Unique UUID rows written: {len(final_rows)}")
|
| 571 |
+
print(f"Removed-then-added events written into uuidfirstintroduced.txt: {total_readded_events}")
|
| 572 |
+
print(f"Extra Removed Date->Added Back Date field count: {max_readded_event_count}")
|
| 573 |
+
print(f"First-introduced output file: {FIRST_INTRO_OUTPUT_FILE}")
|
| 574 |
+
|
| 575 |
+
if DEBUG_UUID_LOG_ENABLED:
|
| 576 |
+
print(f"Debug UUID log file: {DEBUG_UUID_LOG_FILE}")
|
| 577 |
+
|
| 578 |
+
print("------------------------------------------------------------")
|
| 579 |
+
|
| 580 |
+
finally:
|
| 581 |
+
if debug_file is not None:
|
| 582 |
+
debug_file.close()
|
| 583 |
+
|
| 584 |
+
|
| 585 |
+
def main():
|
| 586 |
+
if not os.path.isdir(TARGET_DIR):
|
| 587 |
+
print("ERROR: Target directory does not exist.")
|
| 588 |
+
print(f"Target directory: {TARGET_DIR}")
|
| 589 |
+
input("")
|
| 590 |
+
return
|
| 591 |
+
|
| 592 |
+
if os.path.exists(OUTPUT_FILE):
|
| 593 |
+
print("------------------------------------------------------------")
|
| 594 |
+
print("Main output file already exists. Skipping uniqueobjects.txt only.")
|
| 595 |
+
print(f"Output file: {OUTPUT_FILE}")
|
| 596 |
+
print("Second log will still be checked.")
|
| 597 |
+
print("------------------------------------------------------------")
|
| 598 |
+
|
| 599 |
+
build_first_intro_log()
|
| 600 |
+
|
| 601 |
+
input("")
|
| 602 |
+
return
|
| 603 |
+
|
| 604 |
+
csv_files = glob.glob(
|
| 605 |
+
os.path.join(TARGET_DIR, "**", "*_Combined.csv"),
|
| 606 |
+
recursive=True
|
| 607 |
+
)
|
| 608 |
+
|
| 609 |
+
if not csv_files:
|
| 610 |
+
print("ERROR: No *_Combined.csv files found.")
|
| 611 |
+
print(f"Searched in: {TARGET_DIR}")
|
| 612 |
+
print("Second log will still be checked.")
|
| 613 |
+
build_first_intro_log()
|
| 614 |
+
input("")
|
| 615 |
+
return
|
| 616 |
+
|
| 617 |
+
print(f"Script dir: {SCRIPT_DIR}")
|
| 618 |
+
print(f"Base dir: {BASE_DIR}")
|
| 619 |
+
print(f"Target dir: {TARGET_DIR}")
|
| 620 |
+
print(f"Output file: {OUTPUT_FILE}")
|
| 621 |
+
print(f"First-introduced output file: {FIRST_INTRO_OUTPUT_FILE}")
|
| 622 |
+
|
| 623 |
+
if DEBUG_UUID_LOG_ENABLED:
|
| 624 |
+
print(f"Debug UUID log file: {DEBUG_UUID_LOG_FILE}")
|
| 625 |
+
|
| 626 |
+
print()
|
| 627 |
+
print(f"Found {len(csv_files)} *_Combined.csv file(s).")
|
| 628 |
+
print()
|
| 629 |
+
|
| 630 |
+
unique = {}
|
| 631 |
+
|
| 632 |
+
total_rows_read = 0
|
| 633 |
+
total_skipped_missing_uuid = 0
|
| 634 |
+
total_skipped_missing_fields = 0
|
| 635 |
+
|
| 636 |
+
for csv_file in csv_files:
|
| 637 |
+
build = get_build_from_file_path(csv_file)
|
| 638 |
+
|
| 639 |
+
print("------------------------------------------------------------")
|
| 640 |
+
print(f"Processing: {csv_file}")
|
| 641 |
+
print(f"Build: {build}")
|
| 642 |
+
|
| 643 |
+
rows_in_file = 0
|
| 644 |
+
skipped_in_file = 0
|
| 645 |
+
|
| 646 |
+
try:
|
| 647 |
+
with open(csv_file, "r", encoding="utf-8-sig", errors="replace", newline="") as f:
|
| 648 |
+
reader = csv.DictReader(f, delimiter=",")
|
| 649 |
+
|
| 650 |
+
if not reader.fieldnames:
|
| 651 |
+
print(" SKIP: no header found")
|
| 652 |
+
total_skipped_missing_fields += 1
|
| 653 |
+
continue
|
| 654 |
+
|
| 655 |
+
fieldnames_clean = clean_fieldnames(reader.fieldnames)
|
| 656 |
+
reader.fieldnames = fieldnames_clean
|
| 657 |
+
|
| 658 |
+
required = ["UUID_TXXX", "ObjectId", "Version"]
|
| 659 |
+
missing = [field for field in required if field not in fieldnames_clean]
|
| 660 |
+
|
| 661 |
+
if missing:
|
| 662 |
+
print(f" SKIP: missing field(s): {', '.join(missing)}")
|
| 663 |
+
print(" Headers found:")
|
| 664 |
+
|
| 665 |
+
for h in fieldnames_clean:
|
| 666 |
+
print(f" {repr(h)}")
|
| 667 |
+
|
| 668 |
+
total_skipped_missing_fields += 1
|
| 669 |
+
continue
|
| 670 |
+
|
| 671 |
+
for row in reader:
|
| 672 |
+
total_rows_read += 1
|
| 673 |
+
rows_in_file += 1
|
| 674 |
+
|
| 675 |
+
uuid = row.get("UUID_TXXX", "").strip()
|
| 676 |
+
|
| 677 |
+
if not uuid:
|
| 678 |
+
total_skipped_missing_uuid += 1
|
| 679 |
+
skipped_in_file += 1
|
| 680 |
+
continue
|
| 681 |
+
|
| 682 |
+
cleaned = {
|
| 683 |
+
"UUID_TXXX": uuid,
|
| 684 |
+
"ObjectId": row.get("ObjectId", "").strip(),
|
| 685 |
+
"Version": row.get("Version", "").strip(),
|
| 686 |
+
"Build": build,
|
| 687 |
+
}
|
| 688 |
+
|
| 689 |
+
if uuid not in unique:
|
| 690 |
+
unique[uuid] = cleaned
|
| 691 |
+
else:
|
| 692 |
+
if should_replace_existing(unique[uuid], cleaned):
|
| 693 |
+
unique[uuid] = cleaned
|
| 694 |
+
|
| 695 |
+
except Exception as e:
|
| 696 |
+
print(f" ERROR reading file: {e}")
|
| 697 |
+
continue
|
| 698 |
+
|
| 699 |
+
print(f" Rows read: {rows_in_file}")
|
| 700 |
+
print(f" Skipped missing UUID_TXXX: {skipped_in_file}")
|
| 701 |
+
|
| 702 |
+
final_rows = list(unique.values())
|
| 703 |
+
|
| 704 |
+
final_rows.sort(
|
| 705 |
+
key=lambda r: (
|
| 706 |
+
r["ObjectId"].upper(),
|
| 707 |
+
-version_num(r["Version"]),
|
| 708 |
+
)
|
| 709 |
+
)
|
| 710 |
+
|
| 711 |
+
with open(OUTPUT_FILE, "w", encoding="utf-8", newline="") as f:
|
| 712 |
+
writer = csv.DictWriter(f, fieldnames=OUTPUT_FIELDS, delimiter="\t")
|
| 713 |
+
writer.writeheader()
|
| 714 |
+
writer.writerows(final_rows)
|
| 715 |
+
|
| 716 |
+
build_first_intro_log()
|
| 717 |
+
|
| 718 |
+
print("------------------------------------------------------------")
|
| 719 |
+
print("Done.")
|
| 720 |
+
print(f"CSV files found: {len(csv_files)}")
|
| 721 |
+
print(f"Rows read total: {total_rows_read}")
|
| 722 |
+
print(f"Skipped missing UUID_TXXX: {total_skipped_missing_uuid}")
|
| 723 |
+
print(f"Skipped files missing fields/header: {total_skipped_missing_fields}")
|
| 724 |
+
print(f"Unique UUID_TXXX rows written: {len(final_rows)}")
|
| 725 |
+
print(f"Output file: {OUTPUT_FILE}")
|
| 726 |
+
print(f"First-introduced output file: {FIRST_INTRO_OUTPUT_FILE}")
|
| 727 |
+
|
| 728 |
+
if DEBUG_UUID_LOG_ENABLED:
|
| 729 |
+
print(f"Debug UUID log file: {DEBUG_UUID_LOG_FILE}")
|
| 730 |
+
|
| 731 |
+
print("------------------------------------------------------------")
|
| 732 |
+
|
| 733 |
+
input("")
|
| 734 |
+
|
| 735 |
+
|
| 736 |
+
if __name__ == "__main__":
|
| 737 |
+
main()
|
OBJECTCATALOGUES/uniqueobjects.txt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:423a97c0bf4da26198ca2d7f1e3d105d2839a67d1fdae1098b3a166e33bb9bd9
|
| 3 |
+
size 10062823
|
OBJECTCATALOGUES/uuidfirstintroduced.txt
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
OBJECTS-MAPPED/scripts/archive.org-cli.py
ADDED
|
@@ -0,0 +1,550 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
| 10 |
+
|
| 11 |
+
# SET THIS:
|
| 12 |
+
# "upload" = upload ZIP files from SOURCE_DIR folders 0-9/A-F, starting at START_FOLDER, and skip files already on archive.org
|
| 13 |
+
# "delete" = delete ZIP files listed in log.txt; names can include .zip or no extension
|
| 14 |
+
MODE = "upload"
|
| 15 |
+
|
| 16 |
+
START_FOLDER = "0"
|
| 17 |
+
PAUSE_AFTER_EACH_FOLDER = True
|
| 18 |
+
BATCH_UPLOAD_SIZE = 1000
|
| 19 |
+
|
| 20 |
+
FOLDER_ORDER = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F"]
|
| 21 |
+
UPLOAD_EXTS = {".zip"}
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
def pause_exit():
|
| 25 |
+
input("\nPress Enter to exit...")
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
def is_allowed_upload_file(name):
|
| 29 |
+
return os.path.splitext(name)[1].lower() in UPLOAD_EXTS
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
def clean_name(line):
|
| 33 |
+
text = line.strip().strip('"').strip("'").replace("\\", "/")
|
| 34 |
+
return text.split("/")[-1].strip()
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
def normalize_delete_zip_name(line):
|
| 38 |
+
name = clean_name(line)
|
| 39 |
+
|
| 40 |
+
if not name:
|
| 41 |
+
return None
|
| 42 |
+
|
| 43 |
+
root, ext = os.path.splitext(name)
|
| 44 |
+
|
| 45 |
+
if ext == "":
|
| 46 |
+
return name + ".zip"
|
| 47 |
+
|
| 48 |
+
if ext.lower() == ".zip":
|
| 49 |
+
return name
|
| 50 |
+
|
| 51 |
+
return None
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
def normalize_folder(folder):
|
| 55 |
+
return folder.strip().upper()
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
def get_start_folders():
|
| 59 |
+
start = normalize_folder(START_FOLDER)
|
| 60 |
+
|
| 61 |
+
if start not in FOLDER_ORDER:
|
| 62 |
+
raise ValueError(f"Invalid START_FOLDER: {START_FOLDER}")
|
| 63 |
+
|
| 64 |
+
start_index = FOLDER_ORDER.index(start)
|
| 65 |
+
return FOLDER_ORDER[start_index:]
|
| 66 |
+
|
| 67 |
+
|
| 68 |
+
def get_folder_from_zip_name(name):
|
| 69 |
+
base = normalize_delete_zip_name(name)
|
| 70 |
+
|
| 71 |
+
if not base:
|
| 72 |
+
raise ValueError(f"Invalid zip filename: {name}")
|
| 73 |
+
|
| 74 |
+
first = base[:1].upper()
|
| 75 |
+
|
| 76 |
+
if first not in FOLDER_ORDER:
|
| 77 |
+
raise ValueError(f"Cannot determine archive folder from filename: {name}")
|
| 78 |
+
|
| 79 |
+
return first
|
| 80 |
+
|
| 81 |
+
|
| 82 |
+
def remote_name_from_zip_name(name):
|
| 83 |
+
base = normalize_delete_zip_name(name)
|
| 84 |
+
|
| 85 |
+
if not base:
|
| 86 |
+
raise ValueError(f"Invalid zip filename: {name}")
|
| 87 |
+
|
| 88 |
+
folder = get_folder_from_zip_name(base)
|
| 89 |
+
return f"{folder}/{base}"
|
| 90 |
+
|
| 91 |
+
|
| 92 |
+
def remote_name_from_local(source_dir, local_path):
|
| 93 |
+
rel = os.path.relpath(local_path, source_dir)
|
| 94 |
+
return rel.replace("\\", "/")
|
| 95 |
+
|
| 96 |
+
|
| 97 |
+
def scan_upload_folder(source_dir, folder):
|
| 98 |
+
folder_path = os.path.join(source_dir, folder)
|
| 99 |
+
|
| 100 |
+
if not os.path.isdir(folder_path):
|
| 101 |
+
print(f"[WARN] Missing local folder: {folder_path}")
|
| 102 |
+
return []
|
| 103 |
+
|
| 104 |
+
entries = []
|
| 105 |
+
seen_remote = set()
|
| 106 |
+
|
| 107 |
+
for root, dirs, files in os.walk(folder_path):
|
| 108 |
+
dirs.sort()
|
| 109 |
+
files.sort()
|
| 110 |
+
|
| 111 |
+
for file_name in files:
|
| 112 |
+
if not is_allowed_upload_file(file_name):
|
| 113 |
+
continue
|
| 114 |
+
|
| 115 |
+
local_path = os.path.join(root, file_name)
|
| 116 |
+
remote_name = remote_name_from_local(source_dir, local_path)
|
| 117 |
+
low = remote_name.lower()
|
| 118 |
+
|
| 119 |
+
if low in seen_remote:
|
| 120 |
+
print(f"[WARN] Duplicate remote path skipped: {remote_name}")
|
| 121 |
+
continue
|
| 122 |
+
|
| 123 |
+
seen_remote.add(low)
|
| 124 |
+
entries.append((remote_name, local_path))
|
| 125 |
+
|
| 126 |
+
return entries
|
| 127 |
+
|
| 128 |
+
|
| 129 |
+
def load_file_list(path):
|
| 130 |
+
if not os.path.exists(path):
|
| 131 |
+
raise FileNotFoundError(f"Missing file: {path}")
|
| 132 |
+
|
| 133 |
+
with open(path, "r", encoding="utf-8", errors="ignore") as f:
|
| 134 |
+
raw = [line.strip() for line in f if line.strip()]
|
| 135 |
+
|
| 136 |
+
names = []
|
| 137 |
+
seen = set()
|
| 138 |
+
|
| 139 |
+
for line in raw:
|
| 140 |
+
name = normalize_delete_zip_name(line)
|
| 141 |
+
|
| 142 |
+
if not name:
|
| 143 |
+
continue
|
| 144 |
+
|
| 145 |
+
low = name.lower()
|
| 146 |
+
|
| 147 |
+
if low not in seen:
|
| 148 |
+
seen.add(low)
|
| 149 |
+
names.append(name)
|
| 150 |
+
|
| 151 |
+
return names
|
| 152 |
+
|
| 153 |
+
|
| 154 |
+
def list_item_files(item_id):
|
| 155 |
+
item = internetarchive.get_item(item_id)
|
| 156 |
+
out = []
|
| 157 |
+
|
| 158 |
+
for f in item.files:
|
| 159 |
+
name = f.get("name")
|
| 160 |
+
if name:
|
| 161 |
+
out.append(name)
|
| 162 |
+
|
| 163 |
+
return out
|
| 164 |
+
|
| 165 |
+
|
| 166 |
+
def chunks(items, size):
|
| 167 |
+
for i in range(0, len(items), size):
|
| 168 |
+
yield items[i:i + size]
|
| 169 |
+
|
| 170 |
+
|
| 171 |
+
def upload_batch(item_id, batch_entries, remote_set, batch_num, batch_total):
|
| 172 |
+
uploaded = []
|
| 173 |
+
skipped = []
|
| 174 |
+
failed = []
|
| 175 |
+
|
| 176 |
+
batch_dict = {}
|
| 177 |
+
|
| 178 |
+
for remote_name, local_path in batch_entries:
|
| 179 |
+
remote_low = remote_name.lower()
|
| 180 |
+
|
| 181 |
+
if remote_low in remote_set:
|
| 182 |
+
print(f"[SKIP] Already uploaded: {remote_name}")
|
| 183 |
+
skipped.append(remote_name)
|
| 184 |
+
continue
|
| 185 |
+
|
| 186 |
+
if not os.path.exists(local_path):
|
| 187 |
+
print(f"[ERROR] Missing local file: {local_path}")
|
| 188 |
+
failed.append(remote_name)
|
| 189 |
+
continue
|
| 190 |
+
|
| 191 |
+
batch_dict[remote_name] = local_path
|
| 192 |
+
|
| 193 |
+
if not batch_dict:
|
| 194 |
+
return uploaded, skipped, failed
|
| 195 |
+
|
| 196 |
+
print(f"[BATCH {batch_num}/{batch_total}] Uploading {len(batch_dict)} file(s)...")
|
| 197 |
+
|
| 198 |
+
for remote_name, local_path in batch_dict.items():
|
| 199 |
+
print(f" {remote_name}")
|
| 200 |
+
print(f" {local_path}")
|
| 201 |
+
|
| 202 |
+
print()
|
| 203 |
+
|
| 204 |
+
try:
|
| 205 |
+
result = internetarchive.upload(
|
| 206 |
+
item_id,
|
| 207 |
+
batch_dict,
|
| 208 |
+
verbose=True
|
| 209 |
+
)
|
| 210 |
+
|
| 211 |
+
ok = True
|
| 212 |
+
|
| 213 |
+
if result is not None:
|
| 214 |
+
try:
|
| 215 |
+
for r in result:
|
| 216 |
+
if hasattr(r, "status_code") and r.status_code not in (200, 201):
|
| 217 |
+
ok = False
|
| 218 |
+
except TypeError:
|
| 219 |
+
pass
|
| 220 |
+
|
| 221 |
+
if ok:
|
| 222 |
+
for remote_name in batch_dict:
|
| 223 |
+
print(f"[OK] Uploaded: {remote_name}")
|
| 224 |
+
uploaded.append(remote_name)
|
| 225 |
+
remote_set.add(remote_name.lower())
|
| 226 |
+
else:
|
| 227 |
+
for remote_name in batch_dict:
|
| 228 |
+
print(f"[ERROR] Batch upload may have failed: {remote_name}")
|
| 229 |
+
failed.append(remote_name)
|
| 230 |
+
|
| 231 |
+
except Exception as e:
|
| 232 |
+
print(f"[ERROR] Batch upload failed: {e}")
|
| 233 |
+
print("[INFO] Marking this batch as failed. Rerun the script later and already-uploaded files will be skipped.")
|
| 234 |
+
|
| 235 |
+
for remote_name in batch_dict:
|
| 236 |
+
failed.append(remote_name)
|
| 237 |
+
|
| 238 |
+
print()
|
| 239 |
+
|
| 240 |
+
return uploaded, skipped, failed
|
| 241 |
+
|
| 242 |
+
|
| 243 |
+
def upload_entries(item_id, upload_entries, remote_set):
|
| 244 |
+
uploaded = []
|
| 245 |
+
skipped = []
|
| 246 |
+
failed = []
|
| 247 |
+
|
| 248 |
+
upload_entries = list(upload_entries)
|
| 249 |
+
batch_list = list(chunks(upload_entries, BATCH_UPLOAD_SIZE))
|
| 250 |
+
batch_total = len(batch_list)
|
| 251 |
+
|
| 252 |
+
for batch_num, batch_entries in enumerate(batch_list, start=1):
|
| 253 |
+
batch_uploaded, batch_skipped, batch_failed = upload_batch(
|
| 254 |
+
item_id,
|
| 255 |
+
batch_entries,
|
| 256 |
+
remote_set,
|
| 257 |
+
batch_num,
|
| 258 |
+
batch_total
|
| 259 |
+
)
|
| 260 |
+
|
| 261 |
+
uploaded.extend(batch_uploaded)
|
| 262 |
+
skipped.extend(batch_skipped)
|
| 263 |
+
failed.extend(batch_failed)
|
| 264 |
+
|
| 265 |
+
return uploaded, skipped, failed
|
| 266 |
+
|
| 267 |
+
|
| 268 |
+
def find_delete_targets(all_remote_files, file_names):
|
| 269 |
+
remote_set = {x.lower() for x in all_remote_files}
|
| 270 |
+
matches = []
|
| 271 |
+
missing = []
|
| 272 |
+
seen = set()
|
| 273 |
+
|
| 274 |
+
for name in file_names:
|
| 275 |
+
try:
|
| 276 |
+
remote_name = remote_name_from_zip_name(name)
|
| 277 |
+
except Exception as e:
|
| 278 |
+
print(f"[WARN] {e}")
|
| 279 |
+
missing.append(name)
|
| 280 |
+
continue
|
| 281 |
+
|
| 282 |
+
low = remote_name.lower()
|
| 283 |
+
|
| 284 |
+
if low in remote_set:
|
| 285 |
+
if low not in seen:
|
| 286 |
+
seen.add(low)
|
| 287 |
+
matches.append(remote_name)
|
| 288 |
+
else:
|
| 289 |
+
missing.append(remote_name)
|
| 290 |
+
|
| 291 |
+
return matches, missing
|
| 292 |
+
|
| 293 |
+
|
| 294 |
+
def delete_remote_files(item_id, remote_names):
|
| 295 |
+
deleted = []
|
| 296 |
+
failed = []
|
| 297 |
+
|
| 298 |
+
for name in remote_names:
|
| 299 |
+
print(f"Deleting main file: {name}")
|
| 300 |
+
|
| 301 |
+
try:
|
| 302 |
+
internetarchive.delete(
|
| 303 |
+
item_id,
|
| 304 |
+
files=name,
|
| 305 |
+
cascade_delete=False,
|
| 306 |
+
verbose=True
|
| 307 |
+
)
|
| 308 |
+
print(f"[OK] Deleted: {name}")
|
| 309 |
+
deleted.append(name)
|
| 310 |
+
except Exception as e:
|
| 311 |
+
print(f"[ERROR] Failed deleting {name}: {e}")
|
| 312 |
+
failed.append(name)
|
| 313 |
+
|
| 314 |
+
print()
|
| 315 |
+
|
| 316 |
+
return deleted, failed
|
| 317 |
+
|
| 318 |
+
|
| 319 |
+
def find_matching_history_backups(all_remote_files, target_names):
|
| 320 |
+
target_set = set()
|
| 321 |
+
|
| 322 |
+
for name in target_names:
|
| 323 |
+
try:
|
| 324 |
+
target_set.add(remote_name_from_zip_name(name).lower())
|
| 325 |
+
except Exception:
|
| 326 |
+
pass
|
| 327 |
+
|
| 328 |
+
matches = []
|
| 329 |
+
pattern = re.compile(r"^history/files/(.+?)\.~\d+~$", re.IGNORECASE)
|
| 330 |
+
|
| 331 |
+
for remote_name in all_remote_files:
|
| 332 |
+
m = pattern.match(remote_name)
|
| 333 |
+
|
| 334 |
+
if not m:
|
| 335 |
+
continue
|
| 336 |
+
|
| 337 |
+
backed_up_name = m.group(1).replace("\\", "/").lower()
|
| 338 |
+
|
| 339 |
+
if backed_up_name in target_set:
|
| 340 |
+
matches.append(remote_name)
|
| 341 |
+
|
| 342 |
+
return matches
|
| 343 |
+
|
| 344 |
+
|
| 345 |
+
def delete_backup_files(item_id, backup_names):
|
| 346 |
+
deleted = []
|
| 347 |
+
failed = []
|
| 348 |
+
|
| 349 |
+
for remote_name in backup_names:
|
| 350 |
+
print(f"Deleting backup file: {remote_name}")
|
| 351 |
+
|
| 352 |
+
try:
|
| 353 |
+
internetarchive.delete(
|
| 354 |
+
item_id,
|
| 355 |
+
files=remote_name,
|
| 356 |
+
cascade_delete=False,
|
| 357 |
+
verbose=True
|
| 358 |
+
)
|
| 359 |
+
print(f"[OK] Deleted backup: {remote_name}")
|
| 360 |
+
deleted.append(remote_name)
|
| 361 |
+
except Exception as e:
|
| 362 |
+
print(f"[ERROR] Failed deleting backup {remote_name}: {e}")
|
| 363 |
+
failed.append(remote_name)
|
| 364 |
+
|
| 365 |
+
print()
|
| 366 |
+
|
| 367 |
+
return deleted, failed
|
| 368 |
+
|
| 369 |
+
|
| 370 |
+
def write_log(path, lines):
|
| 371 |
+
with open(path, "w", encoding="utf-8", newline="") as f:
|
| 372 |
+
for line in lines:
|
| 373 |
+
f.write(str(line) + "\n")
|
| 374 |
+
|
| 375 |
+
|
| 376 |
+
def run_upload_mode(item_id, source_dir):
|
| 377 |
+
print("[MODE] UPLOAD")
|
| 378 |
+
print(f"[INFO] Source folder: {source_dir}")
|
| 379 |
+
print(f"[INFO] Start folder: {START_FOLDER}")
|
| 380 |
+
print(f"[INFO] Batch upload size: {BATCH_UPLOAD_SIZE}")
|
| 381 |
+
print()
|
| 382 |
+
|
| 383 |
+
try:
|
| 384 |
+
folders = get_start_folders()
|
| 385 |
+
except Exception as e:
|
| 386 |
+
print(f"[FATAL] {e}")
|
| 387 |
+
pause_exit()
|
| 388 |
+
return
|
| 389 |
+
|
| 390 |
+
print("[INFO] Checking archive.org item for existing files...")
|
| 391 |
+
|
| 392 |
+
try:
|
| 393 |
+
remote_files = list_item_files(item_id)
|
| 394 |
+
remote_set = {x.lower() for x in remote_files}
|
| 395 |
+
print(f"[OK] Remote item has {len(remote_files)} file(s).")
|
| 396 |
+
except Exception as e:
|
| 397 |
+
print(f"[FATAL] Could not list archive.org item files: {e}")
|
| 398 |
+
pause_exit()
|
| 399 |
+
return
|
| 400 |
+
|
| 401 |
+
print()
|
| 402 |
+
|
| 403 |
+
all_uploaded = []
|
| 404 |
+
all_skipped = []
|
| 405 |
+
all_failed = []
|
| 406 |
+
|
| 407 |
+
uploaded_log = os.path.join(SCRIPT_DIR, "_uploaded_ok.txt")
|
| 408 |
+
skipped_log = os.path.join(SCRIPT_DIR, "_upload_skipped_existing.txt")
|
| 409 |
+
failed_log = os.path.join(SCRIPT_DIR, "_upload_failed.txt")
|
| 410 |
+
|
| 411 |
+
for folder in folders:
|
| 412 |
+
print("========================================")
|
| 413 |
+
print(f"[FOLDER] {folder}")
|
| 414 |
+
print("========================================")
|
| 415 |
+
|
| 416 |
+
upload_list = scan_upload_folder(source_dir, folder)
|
| 417 |
+
|
| 418 |
+
print(f"[OK] Found {len(upload_list)} zip file(s) in folder {folder}.")
|
| 419 |
+
print()
|
| 420 |
+
|
| 421 |
+
uploaded, skipped, failed = upload_entries(item_id, upload_list, remote_set)
|
| 422 |
+
|
| 423 |
+
all_uploaded.extend(uploaded)
|
| 424 |
+
all_skipped.extend(skipped)
|
| 425 |
+
all_failed.extend(failed)
|
| 426 |
+
|
| 427 |
+
write_log(uploaded_log, all_uploaded)
|
| 428 |
+
write_log(skipped_log, all_skipped)
|
| 429 |
+
write_log(failed_log, all_failed)
|
| 430 |
+
|
| 431 |
+
print(f"========== FOLDER {folder} SUMMARY ==========")
|
| 432 |
+
print(f"Found: {len(upload_list)}")
|
| 433 |
+
print(f"Uploaded: {len(uploaded)}")
|
| 434 |
+
print(f"Skipped existing: {len(skipped)}")
|
| 435 |
+
print(f"Failed: {len(failed)}")
|
| 436 |
+
print()
|
| 437 |
+
|
| 438 |
+
if PAUSE_AFTER_EACH_FOLDER:
|
| 439 |
+
input(f"[PAUSE] Finished folder {folder}. Press Enter to continue, or close this window to stop...")
|
| 440 |
+
|
| 441 |
+
print()
|
| 442 |
+
|
| 443 |
+
print("========== FINAL SUMMARY ==========")
|
| 444 |
+
print(f"Uploaded: {len(all_uploaded)}")
|
| 445 |
+
print(f"Skipped existing: {len(all_skipped)}")
|
| 446 |
+
print(f"Failed: {len(all_failed)}")
|
| 447 |
+
print()
|
| 448 |
+
print(f"Uploaded log: {uploaded_log}")
|
| 449 |
+
print(f"Skipped log: {skipped_log}")
|
| 450 |
+
print(f"Failed log: {failed_log}")
|
| 451 |
+
|
| 452 |
+
if all_failed:
|
| 453 |
+
print("\nFailed uploads:")
|
| 454 |
+
for name in all_failed:
|
| 455 |
+
print(name)
|
| 456 |
+
|
| 457 |
+
|
| 458 |
+
def run_delete_mode(item_id, file_names):
|
| 459 |
+
print("[MODE] DELETE")
|
| 460 |
+
print(f"[OK] Loaded {len(file_names)} zip file name(s) from {FILE_LIST}")
|
| 461 |
+
print()
|
| 462 |
+
|
| 463 |
+
print("[INFO] Scanning item files...")
|
| 464 |
+
|
| 465 |
+
try:
|
| 466 |
+
all_files = list_item_files(item_id)
|
| 467 |
+
except Exception as e:
|
| 468 |
+
print(f"[ERROR] Could not scan item files: {e}")
|
| 469 |
+
pause_exit()
|
| 470 |
+
return
|
| 471 |
+
|
| 472 |
+
delete_targets, missing_targets = find_delete_targets(all_files, file_names)
|
| 473 |
+
backup_matches = find_matching_history_backups(all_files, file_names)
|
| 474 |
+
|
| 475 |
+
print(f"[INFO] Found {len(delete_targets)} matching main file(s).")
|
| 476 |
+
print(f"[INFO] Missing {len(missing_targets)} requested file(s).")
|
| 477 |
+
print(f"[INFO] Found {len(backup_matches)} matching backup file(s).")
|
| 478 |
+
print()
|
| 479 |
+
|
| 480 |
+
delete_target_log = os.path.join(SCRIPT_DIR, "_delete_resolved_targets.txt")
|
| 481 |
+
missing_target_log = os.path.join(SCRIPT_DIR, "_delete_missing_targets.txt")
|
| 482 |
+
|
| 483 |
+
write_log(delete_target_log, delete_targets)
|
| 484 |
+
write_log(missing_target_log, missing_targets)
|
| 485 |
+
|
| 486 |
+
deleted_main, delete_failed = delete_remote_files(item_id, delete_targets)
|
| 487 |
+
|
| 488 |
+
if backup_matches:
|
| 489 |
+
deleted_backups, backup_failed = delete_backup_files(item_id, backup_matches)
|
| 490 |
+
else:
|
| 491 |
+
deleted_backups = []
|
| 492 |
+
backup_failed = []
|
| 493 |
+
|
| 494 |
+
print("========== SUMMARY ==========")
|
| 495 |
+
print(f"Files requested: {len(file_names)}")
|
| 496 |
+
print(f"Main matched: {len(delete_targets)}")
|
| 497 |
+
print(f"Main missing: {len(missing_targets)}")
|
| 498 |
+
print(f"Main deleted: {len(deleted_main)}")
|
| 499 |
+
print(f"Main delete fail: {len(delete_failed)}")
|
| 500 |
+
print(f"Backups matched: {len(backup_matches)}")
|
| 501 |
+
print(f"Backups deleted: {len(deleted_backups)}")
|
| 502 |
+
print(f"Backup del fail: {len(backup_failed)}")
|
| 503 |
+
print()
|
| 504 |
+
print(f"Resolved delete target log: {delete_target_log}")
|
| 505 |
+
print(f"Missing delete target log: {missing_target_log}")
|
| 506 |
+
|
| 507 |
+
if delete_failed:
|
| 508 |
+
print("\nFailed main deletes:")
|
| 509 |
+
for name in delete_failed:
|
| 510 |
+
print(name)
|
| 511 |
+
|
| 512 |
+
if backup_failed:
|
| 513 |
+
print("\nFailed backup deletes:")
|
| 514 |
+
for name in backup_failed:
|
| 515 |
+
print(name)
|
| 516 |
+
|
| 517 |
+
|
| 518 |
+
def main():
|
| 519 |
+
mode = MODE.strip().lower()
|
| 520 |
+
|
| 521 |
+
if mode == "upload":
|
| 522 |
+
run_upload_mode(ITEM_ID, SOURCE_DIR)
|
| 523 |
+
|
| 524 |
+
elif mode == "delete":
|
| 525 |
+
try:
|
| 526 |
+
file_names = load_file_list(FILE_LIST)
|
| 527 |
+
except Exception as e:
|
| 528 |
+
print(f"[FATAL] {e}")
|
| 529 |
+
pause_exit()
|
| 530 |
+
return
|
| 531 |
+
|
| 532 |
+
if not file_names:
|
| 533 |
+
print(f"[WARN] No zip entries found in: {FILE_LIST}")
|
| 534 |
+
pause_exit()
|
| 535 |
+
return
|
| 536 |
+
|
| 537 |
+
run_delete_mode(ITEM_ID, file_names)
|
| 538 |
+
|
| 539 |
+
else:
|
| 540 |
+
print(f"[FATAL] Invalid MODE: {MODE}")
|
| 541 |
+
print('Use MODE = "upload" or MODE = "delete"')
|
| 542 |
+
pause_exit()
|
| 543 |
+
return
|
| 544 |
+
|
| 545 |
+
print("\nDone.")
|
| 546 |
+
pause_exit()
|
| 547 |
+
|
| 548 |
+
|
| 549 |
+
if __name__ == "__main__":
|
| 550 |
+
main()
|
OBJECTS-MAPPED/scripts/log_files.py
CHANGED
|
@@ -1,17 +1,24 @@
|
|
| 1 |
import os
|
| 2 |
|
|
|
|
| 3 |
def log_zip_files(root_folder, output_file):
|
| 4 |
-
with open(output_file, "w") as f:
|
| 5 |
for dirpath, dirnames, filenames in os.walk(root_folder):
|
| 6 |
for file in filenames:
|
| 7 |
if file.lower().endswith(".zip"):
|
| 8 |
-
# Remove the .zip extension and write only the file name
|
| 9 |
file_name_without_ext, _ = os.path.splitext(file)
|
| 10 |
f.write(file_name_without_ext + "\n")
|
| 11 |
|
|
|
|
| 12 |
if __name__ == "__main__":
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
|
|
|
|
|
|
|
|
|
| 16 |
log_zip_files(root_folder, output_file)
|
| 17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import os
|
| 2 |
|
| 3 |
+
|
| 4 |
def log_zip_files(root_folder, output_file):
|
| 5 |
+
with open(output_file, "w", encoding="utf-8") as f:
|
| 6 |
for dirpath, dirnames, filenames in os.walk(root_folder):
|
| 7 |
for file in filenames:
|
| 8 |
if file.lower().endswith(".zip"):
|
|
|
|
| 9 |
file_name_without_ext, _ = os.path.splitext(file)
|
| 10 |
f.write(file_name_without_ext + "\n")
|
| 11 |
|
| 12 |
+
|
| 13 |
if __name__ == "__main__":
|
| 14 |
+
script_folder = os.path.dirname(os.path.abspath(__file__))
|
| 15 |
+
objects_mapped_folder = os.path.dirname(script_folder)
|
| 16 |
+
|
| 17 |
+
root_folder = objects_mapped_folder
|
| 18 |
+
output_file = os.path.join(objects_mapped_folder, "log.txt")
|
| 19 |
+
|
| 20 |
log_zip_files(root_folder, output_file)
|
| 21 |
+
|
| 22 |
+
print(f"ZIP file names without extension logged in:")
|
| 23 |
+
print(output_file)
|
| 24 |
+
input("\nPress Enter to exit...")
|
OBJECTS-MAPPED/scripts/move_files.py
CHANGED
|
@@ -1,28 +1,51 @@
|
|
| 1 |
import os
|
| 2 |
import shutil
|
| 3 |
|
| 4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
source_dir = os.path.dirname(os.path.abspath(__file__))
|
| 6 |
-
archive_dir = os.path.join(source_dir, "TMP")
|
| 7 |
|
| 8 |
-
# Define valid hex digits in uppercase
|
| 9 |
hex_digits = "0123456789ABCDEF"
|
| 10 |
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
os.makedirs(folder_path, exist_ok=True)
|
| 15 |
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
|
|
|
|
|
|
|
|
| 1 |
import os
|
| 2 |
import shutil
|
| 3 |
|
| 4 |
+
|
| 5 |
+
def pause_exit():
|
| 6 |
+
input("\nPress Enter to exit...")
|
| 7 |
+
|
| 8 |
+
|
| 9 |
source_dir = os.path.dirname(os.path.abspath(__file__))
|
|
|
|
| 10 |
|
|
|
|
| 11 |
hex_digits = "0123456789ABCDEF"
|
| 12 |
|
| 13 |
+
moved_count = 0
|
| 14 |
+
skipped_count = 0
|
| 15 |
+
|
| 16 |
+
for filename in os.listdir(source_dir):
|
| 17 |
+
source_file = os.path.join(source_dir, filename)
|
| 18 |
+
|
| 19 |
+
if not os.path.isfile(source_file):
|
| 20 |
+
continue
|
| 21 |
+
|
| 22 |
+
if not filename.lower().endswith(".zip"):
|
| 23 |
+
continue
|
| 24 |
+
|
| 25 |
+
first_digit = filename[0].upper()
|
| 26 |
+
|
| 27 |
+
if first_digit not in hex_digits:
|
| 28 |
+
print(f"Skipping {filename}: first character '{filename[0]}' is not 0-9 or A-F.")
|
| 29 |
+
skipped_count += 1
|
| 30 |
+
continue
|
| 31 |
+
|
| 32 |
+
folder_path = os.path.join(source_dir, first_digit)
|
| 33 |
+
dest_file = os.path.join(folder_path, filename)
|
| 34 |
+
|
| 35 |
os.makedirs(folder_path, exist_ok=True)
|
| 36 |
|
| 37 |
+
if os.path.exists(dest_file):
|
| 38 |
+
print(f"Skipping {filename}: already exists in {first_digit}\\")
|
| 39 |
+
skipped_count += 1
|
| 40 |
+
continue
|
| 41 |
+
|
| 42 |
+
print(f"Moving {filename} to {first_digit}\\")
|
| 43 |
+
shutil.move(source_file, dest_file)
|
| 44 |
+
moved_count += 1
|
| 45 |
+
|
| 46 |
+
print()
|
| 47 |
+
print(f"Done.")
|
| 48 |
+
print(f"Moved: {moved_count}")
|
| 49 |
+
print(f"Skipped: {skipped_count}")
|
| 50 |
+
|
| 51 |
+
pause_exit()
|
OBJECTS/OBJECT_QUERY.xlsm
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8611dbee345b8f0ddc12236391c84cf954f37f9a14899703e2a535314823e9b8
|
| 3 |
+
size 158175360
|
OBJECTS/OBJECT_QUERY.xlsx
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c650f28e1f0c83604ba5551f9c36db6c1cfb1019b775ac19cb0becb9599fbef7
|
| 3 |
+
size 155166378
|
OBJECTS/ObjectsGeneralStats.png
ADDED
|
Git LFS Details
|
OBJECTS/ObjectsProgressAll.png
ADDED
|
Git LFS Details
|
OBJECTS/ObjectsProgressHomeEnd.png
ADDED
|
Git LFS Details
|
OBJECTS/uniqueobjects.txt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5bb91b9a0aae5649cc3930eb897ae7eb27aad81a12fc5d0d46d5e963b2fdc073
|
| 3 |
+
size 15577866
|
ODC/scripts/move_files.py
CHANGED
|
@@ -1,52 +1,75 @@
|
|
| 1 |
import os
|
| 2 |
import shutil
|
| 3 |
|
| 4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
source_dir = os.path.dirname(os.path.abspath(__file__))
|
| 6 |
-
odcs_decrypted_dir = os.path.join(source_dir, "TMP")
|
| 7 |
|
| 8 |
-
# Define valid hex digits (uppercase)
|
| 9 |
hex_digits = "0123456789ABCDEF"
|
| 10 |
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
for
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import os
|
| 2 |
import shutil
|
| 3 |
|
| 4 |
+
|
| 5 |
+
def pause_exit():
|
| 6 |
+
input("\nPress Enter to exit...")
|
| 7 |
+
|
| 8 |
+
|
| 9 |
source_dir = os.path.dirname(os.path.abspath(__file__))
|
|
|
|
| 10 |
|
|
|
|
| 11 |
hex_digits = "0123456789ABCDEF"
|
| 12 |
|
| 13 |
+
moved_count = 0
|
| 14 |
+
skipped_count = 0
|
| 15 |
+
|
| 16 |
+
for filename in os.listdir(source_dir):
|
| 17 |
+
source_file = os.path.join(source_dir, filename)
|
| 18 |
+
|
| 19 |
+
if not os.path.isfile(source_file):
|
| 20 |
+
continue
|
| 21 |
+
|
| 22 |
+
if not filename.lower().endswith(".odc"):
|
| 23 |
+
continue
|
| 24 |
+
|
| 25 |
+
lower_name = filename.lower()
|
| 26 |
+
|
| 27 |
+
if "$" not in filename:
|
| 28 |
+
print(f"Skipping {filename}: missing '$' in filename.")
|
| 29 |
+
skipped_count += 1
|
| 30 |
+
continue
|
| 31 |
+
|
| 32 |
+
if lower_name.startswith("live2$"):
|
| 33 |
+
prefix = "live2"
|
| 34 |
+
elif lower_name.startswith("live$"):
|
| 35 |
+
prefix = "live"
|
| 36 |
+
else:
|
| 37 |
+
print(f"Skipping {filename}: does not start with live$ or live2$.")
|
| 38 |
+
skipped_count += 1
|
| 39 |
+
continue
|
| 40 |
+
|
| 41 |
+
parts = filename.split("$", 1)
|
| 42 |
+
|
| 43 |
+
if len(parts) != 2 or not parts[1]:
|
| 44 |
+
print(f"Skipping {filename}: unexpected filename format.")
|
| 45 |
+
skipped_count += 1
|
| 46 |
+
continue
|
| 47 |
+
|
| 48 |
+
uuid_part = parts[1]
|
| 49 |
+
first_digit = uuid_part[0].upper()
|
| 50 |
+
|
| 51 |
+
if first_digit not in hex_digits:
|
| 52 |
+
print(f"Skipping {filename}: first UUID character '{uuid_part[0]}' is not 0-9 or A-F.")
|
| 53 |
+
skipped_count += 1
|
| 54 |
+
continue
|
| 55 |
+
|
| 56 |
+
folder_path = os.path.join(source_dir, prefix, first_digit)
|
| 57 |
+
dest_file = os.path.join(folder_path, filename)
|
| 58 |
+
|
| 59 |
+
os.makedirs(folder_path, exist_ok=True)
|
| 60 |
+
|
| 61 |
+
if os.path.exists(dest_file):
|
| 62 |
+
print(f"Skipping {filename}: already exists in {prefix}\\{first_digit}\\")
|
| 63 |
+
skipped_count += 1
|
| 64 |
+
continue
|
| 65 |
+
|
| 66 |
+
print(f"Moving {filename} to {prefix}\\{first_digit}\\")
|
| 67 |
+
shutil.move(source_file, dest_file)
|
| 68 |
+
moved_count += 1
|
| 69 |
+
|
| 70 |
+
print()
|
| 71 |
+
print("Done.")
|
| 72 |
+
print(f"Moved: {moved_count}")
|
| 73 |
+
print(f"Skipped: {skipped_count}")
|
| 74 |
+
|
| 75 |
+
pause_exit()
|
SCENE VERSION XMLS/scripts/VERS_XML_PARSER.py
CHANGED
|
@@ -3,16 +3,21 @@ import sys
|
|
| 3 |
import hashlib
|
| 4 |
from pathlib import Path
|
| 5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
def clean_string(s):
|
| 7 |
-
"""Remove 'http://' and ':10010' from a string."""
|
| 8 |
return s.replace('http://', '').replace(':10010', '')
|
| 9 |
|
|
|
|
| 10 |
def extract_value(pattern, content):
|
| 11 |
match = re.search(pattern, content, re.IGNORECASE | re.DOTALL)
|
| 12 |
return match.group(1) if match else ""
|
| 13 |
|
|
|
|
| 14 |
def calculate_sha1(file_path):
|
| 15 |
-
"""Calculate SHA1 hash of a file and return uppercase hex digest."""
|
| 16 |
try:
|
| 17 |
sha1 = hashlib.sha1()
|
| 18 |
with open(file_path, 'rb') as f:
|
|
@@ -23,8 +28,11 @@ def calculate_sha1(file_path):
|
|
| 23 |
print(f"Error calculating SHA1 for {file_path}: {e}", file=sys.stderr)
|
| 24 |
return "ERROR"
|
| 25 |
|
|
|
|
| 26 |
def main():
|
| 27 |
-
|
|
|
|
|
|
|
| 28 |
xml_dir = base_dir / "XML"
|
| 29 |
log_path = base_dir / "log_VERSXMLS.txt"
|
| 30 |
|
|
@@ -35,10 +43,11 @@ def main():
|
|
| 35 |
xml_files = list(xml_dir.rglob("*.XML"))
|
| 36 |
|
| 37 |
with log_path.open("w", encoding="utf-8") as log:
|
| 38 |
-
# Add header
|
| 39 |
log.write("CDNPATH\tSCENEVERS\tCHECKVER\tSHA1\n")
|
|
|
|
| 40 |
for xml_path in xml_files:
|
| 41 |
counter += 1
|
|
|
|
| 42 |
try:
|
| 43 |
content = xml_path.read_text(encoding="utf-8")
|
| 44 |
except Exception as e:
|
|
@@ -53,5 +62,9 @@ def main():
|
|
| 53 |
log.write(f"{cdnpath}\t{scenevers}\t{checkver}\t{sha1_hash}\n")
|
| 54 |
print(f"{counter} LOGGED {xml_path.name}")
|
| 55 |
|
|
|
|
| 56 |
if __name__ == "__main__":
|
| 57 |
-
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
import hashlib
|
| 4 |
from pathlib import Path
|
| 5 |
|
| 6 |
+
|
| 7 |
+
def pause_exit():
|
| 8 |
+
input("\nPress Enter to exit...")
|
| 9 |
+
|
| 10 |
+
|
| 11 |
def clean_string(s):
|
|
|
|
| 12 |
return s.replace('http://', '').replace(':10010', '')
|
| 13 |
|
| 14 |
+
|
| 15 |
def extract_value(pattern, content):
|
| 16 |
match = re.search(pattern, content, re.IGNORECASE | re.DOTALL)
|
| 17 |
return match.group(1) if match else ""
|
| 18 |
|
| 19 |
+
|
| 20 |
def calculate_sha1(file_path):
|
|
|
|
| 21 |
try:
|
| 22 |
sha1 = hashlib.sha1()
|
| 23 |
with open(file_path, 'rb') as f:
|
|
|
|
| 28 |
print(f"Error calculating SHA1 for {file_path}: {e}", file=sys.stderr)
|
| 29 |
return "ERROR"
|
| 30 |
|
| 31 |
+
|
| 32 |
def main():
|
| 33 |
+
script_dir = Path(__file__).resolve().parent
|
| 34 |
+
base_dir = script_dir.parent
|
| 35 |
+
|
| 36 |
xml_dir = base_dir / "XML"
|
| 37 |
log_path = base_dir / "log_VERSXMLS.txt"
|
| 38 |
|
|
|
|
| 43 |
xml_files = list(xml_dir.rglob("*.XML"))
|
| 44 |
|
| 45 |
with log_path.open("w", encoding="utf-8") as log:
|
|
|
|
| 46 |
log.write("CDNPATH\tSCENEVERS\tCHECKVER\tSHA1\n")
|
| 47 |
+
|
| 48 |
for xml_path in xml_files:
|
| 49 |
counter += 1
|
| 50 |
+
|
| 51 |
try:
|
| 52 |
content = xml_path.read_text(encoding="utf-8")
|
| 53 |
except Exception as e:
|
|
|
|
| 62 |
log.write(f"{cdnpath}\t{scenevers}\t{checkver}\t{sha1_hash}\n")
|
| 63 |
print(f"{counter} LOGGED {xml_path.name}")
|
| 64 |
|
| 65 |
+
|
| 66 |
if __name__ == "__main__":
|
| 67 |
+
try:
|
| 68 |
+
main()
|
| 69 |
+
finally:
|
| 70 |
+
pause_exit()
|
SCENELISTS/scripts/scenelist_parser.py
CHANGED
|
@@ -1,6 +1,11 @@
|
|
| 1 |
import os
|
| 2 |
import xml.etree.ElementTree as ET
|
| 3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
def parse_xml_file(file_path, subfolder_name=""):
|
| 5 |
tree = ET.parse(file_path)
|
| 6 |
root = tree.getroot()
|
|
@@ -9,44 +14,35 @@ def parse_xml_file(file_path, subfolder_name=""):
|
|
| 9 |
def process_scene(scene, region_name=""):
|
| 10 |
scene_data = []
|
| 11 |
file_name = os.path.splitext(os.path.basename(file_path))[0]
|
| 12 |
-
scene_data.append(file_name)
|
| 13 |
|
| 14 |
-
# Add subfolder name
|
| 15 |
scene_data.append(subfolder_name)
|
| 16 |
|
| 17 |
-
# Extract 'ID'/'Name'
|
| 18 |
id_or_name_key = 'ID' if 'ID' in scene.attrib else 'Name'
|
| 19 |
id_or_name_value = scene.get(id_or_name_key, '')
|
| 20 |
-
|
| 21 |
-
# Unique ID logic based on 'desc'
|
| 22 |
desc = scene.get('desc', '')
|
| 23 |
desc_parts = desc.split('/')
|
| 24 |
unique_id = f"{id_or_name_value}${desc_parts[-1]}" if desc_parts else ""
|
| 25 |
alt_name = f"{desc_parts[0]}${desc_parts[-1]}" if desc_parts and desc_parts[0] != id_or_name_value else ""
|
| 26 |
|
| 27 |
-
# Add 'unique id', 'alt name', and 'region' to the scene data
|
| 28 |
scene_data.extend([unique_id, alt_name, region_name])
|
| 29 |
|
| 30 |
-
# Add 'ID'/'Name'
|
| 31 |
scene_data.extend([id_or_name_key, id_or_name_value] if id_or_name_value else ["", ""])
|
| 32 |
|
| 33 |
-
# Process other attributes before 'config'
|
| 34 |
pre_config_attributes = ["Type", "host", "desc"]
|
| 35 |
for attr in pre_config_attributes:
|
| 36 |
value = scene.get(attr, '')
|
| 37 |
scene_data.extend([attr, value] if value else ["", ""])
|
| 38 |
|
| 39 |
-
# Process 'config' attribute
|
| 40 |
config_value = scene.get('config', '')
|
| 41 |
scene_data.extend(["config", config_value] if config_value else ["", ""])
|
| 42 |
|
| 43 |
-
# Extract 'SceneID'/'ChannelID'
|
| 44 |
scene_id_or_channel_id_key = 'SceneID' if 'SceneID' in scene.attrib else 'ChannelID'
|
| 45 |
scene_id_or_channel_id_value = scene.get(scene_id_or_channel_id_key, '')
|
| 46 |
scene_data.extend([scene_id_or_channel_id_key, scene_id_or_channel_id_value] if scene_id_or_channel_id_value else ["", ""])
|
| 47 |
|
| 48 |
-
|
| 49 |
-
post_config_attributes = ["Group", "KEYWORDS", "access", "capacity",
|
| 50 |
"softcap", "flags", "HOMEUID", "version", "sha1"]
|
| 51 |
for attr in post_config_attributes:
|
| 52 |
value = scene.get(attr, '')
|
|
@@ -64,30 +60,27 @@ def parse_xml_file(file_path, subfolder_name=""):
|
|
| 64 |
|
| 65 |
return scenes_info
|
| 66 |
|
|
|
|
| 67 |
def write_log_file(target_folder, log_file_path):
|
| 68 |
headers = ["file name", "env", "unique id", "alt name", "region", "ID/Name attribute", "ID/Name value"]
|
| 69 |
pre_config_attributes = ["Type", "host", "desc"]
|
| 70 |
-
post_config_attributes = ["Group", "KEYWORDS", "access", "capacity",
|
| 71 |
"softcap", "flags", "HOMEUID", "version", "sha1"]
|
| 72 |
|
| 73 |
-
# Add headers for attributes before 'config'
|
| 74 |
for attr in pre_config_attributes:
|
| 75 |
headers.extend([f"{attr} attribute", f"{attr} value"])
|
| 76 |
-
|
| 77 |
-
# Add headers for 'config' and 'SceneID/ChannelID'
|
| 78 |
headers.extend(["config attribute", "config value", "SceneID/ChannelID attribute", "SceneID/ChannelID value"])
|
| 79 |
|
| 80 |
-
# Add headers for attributes after 'config'
|
| 81 |
for attr in post_config_attributes:
|
| 82 |
headers.extend([f"{attr} attribute", f"{attr} value"])
|
| 83 |
|
| 84 |
-
all_rows = []
|
| 85 |
|
| 86 |
-
# Recursively search DEC folder
|
| 87 |
for root_dir, _, files in os.walk(target_folder):
|
| 88 |
subfolder_name = os.path.relpath(root_dir, target_folder)
|
| 89 |
if subfolder_name == ".":
|
| 90 |
-
subfolder_name = ""
|
| 91 |
|
| 92 |
# --- Skip DEC\GDCDEMO0.41 (and its subfolders) ---
|
| 93 |
if subfolder_name.replace("\\", "/").startswith("GDCDEMO0.41"):
|
|
@@ -100,7 +93,6 @@ def write_log_file(target_folder, log_file_path):
|
|
| 100 |
scenes_info = parse_xml_file(file_path, subfolder_name)
|
| 101 |
all_rows.extend(scenes_info)
|
| 102 |
|
| 103 |
-
# Sort: unique id (index 2) Z?A, then file name (index 0) Z?A
|
| 104 |
all_rows.sort(key=lambda r: (r[2].lower(), r[0].lower()), reverse=True)
|
| 105 |
|
| 106 |
with open(log_file_path, 'w', encoding='utf-8') as log_file:
|
|
@@ -108,12 +100,25 @@ def write_log_file(target_folder, log_file_path):
|
|
| 108 |
for scene_info in all_rows:
|
| 109 |
log_file.write('\t'.join(map(str, scene_info)) + '\n')
|
| 110 |
|
|
|
|
| 111 |
def main():
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 115 |
write_log_file(target_folder, log_file_path)
|
| 116 |
print(f"Log file generated at: {log_file_path}")
|
| 117 |
|
|
|
|
| 118 |
if __name__ == "__main__":
|
| 119 |
-
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import os
|
| 2 |
import xml.etree.ElementTree as ET
|
| 3 |
|
| 4 |
+
|
| 5 |
+
def pause_exit():
|
| 6 |
+
input("\nPress Enter to exit...")
|
| 7 |
+
|
| 8 |
+
|
| 9 |
def parse_xml_file(file_path, subfolder_name=""):
|
| 10 |
tree = ET.parse(file_path)
|
| 11 |
root = tree.getroot()
|
|
|
|
| 14 |
def process_scene(scene, region_name=""):
|
| 15 |
scene_data = []
|
| 16 |
file_name = os.path.splitext(os.path.basename(file_path))[0]
|
| 17 |
+
scene_data.append(file_name)
|
| 18 |
|
|
|
|
| 19 |
scene_data.append(subfolder_name)
|
| 20 |
|
|
|
|
| 21 |
id_or_name_key = 'ID' if 'ID' in scene.attrib else 'Name'
|
| 22 |
id_or_name_value = scene.get(id_or_name_key, '')
|
| 23 |
+
|
|
|
|
| 24 |
desc = scene.get('desc', '')
|
| 25 |
desc_parts = desc.split('/')
|
| 26 |
unique_id = f"{id_or_name_value}${desc_parts[-1]}" if desc_parts else ""
|
| 27 |
alt_name = f"{desc_parts[0]}${desc_parts[-1]}" if desc_parts and desc_parts[0] != id_or_name_value else ""
|
| 28 |
|
|
|
|
| 29 |
scene_data.extend([unique_id, alt_name, region_name])
|
| 30 |
|
|
|
|
| 31 |
scene_data.extend([id_or_name_key, id_or_name_value] if id_or_name_value else ["", ""])
|
| 32 |
|
|
|
|
| 33 |
pre_config_attributes = ["Type", "host", "desc"]
|
| 34 |
for attr in pre_config_attributes:
|
| 35 |
value = scene.get(attr, '')
|
| 36 |
scene_data.extend([attr, value] if value else ["", ""])
|
| 37 |
|
|
|
|
| 38 |
config_value = scene.get('config', '')
|
| 39 |
scene_data.extend(["config", config_value] if config_value else ["", ""])
|
| 40 |
|
|
|
|
| 41 |
scene_id_or_channel_id_key = 'SceneID' if 'SceneID' in scene.attrib else 'ChannelID'
|
| 42 |
scene_id_or_channel_id_value = scene.get(scene_id_or_channel_id_key, '')
|
| 43 |
scene_data.extend([scene_id_or_channel_id_key, scene_id_or_channel_id_value] if scene_id_or_channel_id_value else ["", ""])
|
| 44 |
|
| 45 |
+
post_config_attributes = ["Group", "KEYWORDS", "access", "capacity",
|
|
|
|
| 46 |
"softcap", "flags", "HOMEUID", "version", "sha1"]
|
| 47 |
for attr in post_config_attributes:
|
| 48 |
value = scene.get(attr, '')
|
|
|
|
| 60 |
|
| 61 |
return scenes_info
|
| 62 |
|
| 63 |
+
|
| 64 |
def write_log_file(target_folder, log_file_path):
|
| 65 |
headers = ["file name", "env", "unique id", "alt name", "region", "ID/Name attribute", "ID/Name value"]
|
| 66 |
pre_config_attributes = ["Type", "host", "desc"]
|
| 67 |
+
post_config_attributes = ["Group", "KEYWORDS", "access", "capacity",
|
| 68 |
"softcap", "flags", "HOMEUID", "version", "sha1"]
|
| 69 |
|
|
|
|
| 70 |
for attr in pre_config_attributes:
|
| 71 |
headers.extend([f"{attr} attribute", f"{attr} value"])
|
| 72 |
+
|
|
|
|
| 73 |
headers.extend(["config attribute", "config value", "SceneID/ChannelID attribute", "SceneID/ChannelID value"])
|
| 74 |
|
|
|
|
| 75 |
for attr in post_config_attributes:
|
| 76 |
headers.extend([f"{attr} attribute", f"{attr} value"])
|
| 77 |
|
| 78 |
+
all_rows = []
|
| 79 |
|
|
|
|
| 80 |
for root_dir, _, files in os.walk(target_folder):
|
| 81 |
subfolder_name = os.path.relpath(root_dir, target_folder)
|
| 82 |
if subfolder_name == ".":
|
| 83 |
+
subfolder_name = ""
|
| 84 |
|
| 85 |
# --- Skip DEC\GDCDEMO0.41 (and its subfolders) ---
|
| 86 |
if subfolder_name.replace("\\", "/").startswith("GDCDEMO0.41"):
|
|
|
|
| 93 |
scenes_info = parse_xml_file(file_path, subfolder_name)
|
| 94 |
all_rows.extend(scenes_info)
|
| 95 |
|
|
|
|
| 96 |
all_rows.sort(key=lambda r: (r[2].lower(), r[0].lower()), reverse=True)
|
| 97 |
|
| 98 |
with open(log_file_path, 'w', encoding='utf-8') as log_file:
|
|
|
|
| 100 |
for scene_info in all_rows:
|
| 101 |
log_file.write('\t'.join(map(str, scene_info)) + '\n')
|
| 102 |
|
| 103 |
+
|
| 104 |
def main():
|
| 105 |
+
script_folder = os.path.dirname(os.path.abspath(__file__))
|
| 106 |
+
scenelists_folder = os.path.dirname(script_folder)
|
| 107 |
+
|
| 108 |
+
target_folder = os.path.join(scenelists_folder, "DEC")
|
| 109 |
+
log_file_path = os.path.join(scenelists_folder, "SCENELIST.TXT")
|
| 110 |
+
|
| 111 |
+
if os.path.exists(log_file_path):
|
| 112 |
+
print(f"Skipped. File already exists:")
|
| 113 |
+
print(log_file_path)
|
| 114 |
+
return
|
| 115 |
+
|
| 116 |
write_log_file(target_folder, log_file_path)
|
| 117 |
print(f"Log file generated at: {log_file_path}")
|
| 118 |
|
| 119 |
+
|
| 120 |
if __name__ == "__main__":
|
| 121 |
+
try:
|
| 122 |
+
main()
|
| 123 |
+
finally:
|
| 124 |
+
pause_exit()
|
SCENES-MAPPED/Mapped_Scenes_Query.xlsm
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:504888c631f5a1a5a68312f70074347a065feacfc58a0084730b09f58e43ef18
|
| 3 |
+
size 99166567
|
SCENES-MAPPED/Mapped_Scenes_Query.xlsx
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d163a2bfb2c0ebeb63798283b36251da84c7823f10dddeaffa5a2a6702627308
|
| 3 |
+
size 94919144
|