[..] Gestion de l'interface Livebox
Posté : sam. 04 juil. 2015 20:58
par Utilisateur 3309 supprimé
Bonjour,
j'ai la chaine de caractères suivante, issue de données JSON de l'interface web de ma Livebox. J'extrais ces données dans un fichier TXT que je lis par la suite.
Je voudrais par exemple récupérer les infos de Manufacturer, dans ma chaine de caractères c'est Sagemcom.
Donc j'ai fait ceci qui évidement ne marche pas:
Si on me montre un exemple pour celui-ci, je pense pouvoir récupérer le reste des données qui m’intéressent.
Merci pour votre aide
j'ai la chaine de caractères suivante, issue de données JSON de l'interface web de ma Livebox. J'extrais ces données dans un fichier TXT que je lis par la suite.
► Afficher le texte
Code : Tout sélectionner
{"objectInfo":{"indexPath":"","keyPath":"","name":"DeviceInfo","key":"DeviceInfo","attributes":{},"state":"ready","parameterCount":24,"childCount":1,"instanceCount":0},"functions":[{"name":"get","type":"variant","attributes":{},"arguments":[]},{"name":"update","type":"bool","attributes":{},"arguments":[]},{"name":"export","type":"bool","attributes":{},"arguments":[{"name":"fileName","type":"string","attributes":{}}]}],"parameters":[{"name":"Manufacturer","type":"string","attributes":{"read_only": true},"state":"ready","value":"Sagemcom","validator":{"max":"64"}},{"name":"ManufacturerOUI","type":"string","attributes":{"read_only": true},"state":"ready","value":"2C3996","validator":{"max":"6"}},{"name":"ModelName","type":"string","attributes":{"read_only": true},"state":"ready","value":"SagemcomFast3965_LB2.8","validator":{"max":"64"}},{"name":"Description","type":"string","attributes":{"read_only": true},"state":"ready","value":"SagemcomFast3965_LB2.8 Sagemcom fr","validator":{"max":"256"}},{"name":"ProductClass","type":"string","attributes":{"read_only": true},"state":"ready","value":"Livebox 3","validator":{"max":"64"}},{"name":"SerialNumber","type":"string","attributes":{"read_only": true},"state":"ready","value":"NQ1315504557065","validator":{"max":"64"}},{"name":"HardwareVersion","type":"string","attributes":{"read_only": true},"state":"ready","value":"SG_LB3_1.2.1","validator":{"max":"64"}},{"name":"SoftwareVersion","type":"string","attributes":{"read_only": true},"state":"ready","value":"SG30_sip-fr-5.12.13.1","validator":{"max":"64"}},{"name":"RescueVersion","type":"string","attributes":{"read_only": true},"state":"ready","value":"SG30_sip-fr-5.7.16.1","validator":{"max":"64"}},{"name":"ModemFirmwareVersion","type":"string","attributes":{"read_only": true},"state":"ready","value":"","validator":{"max":"64"}},{"name":"EnabledOptions","type":"string","attributes":{"read_only": true},"state":"ready","value":"","validator":{"max":"1024"}},{"name":"AdditionalHardwareVersion","type":"string","attributes":{"read_only": true},"state":"ready","value":"","validator":{"max":"64"}},{"name":"AdditionalSoftwareVersion","type":"string","attributes":{"read_only": true},"state":"ready","value":"g5-sip-fr","validator":{"max":"64"}},{"name":"SpecVersion","type":"string","attributes":{"read_only": true},"state":"ready","value":"1.1","validator":{"max":"16"}},{"name":"ProvisioningCode","type":"string","attributes":{"persistent": true},"state":"ready","value":"VSIP.0885.8906.WCOM.1893.3334","validator":{"max":"64"}},{"name":"UpTime","type":"uint32","attributes":{"read_only": true},"state":"ready","value":603951},{"name":"FirstUseDate","type":"date_time","attributes":{"read_only": true},"state":"ready","value":"0001-01-01T00:00:00Z"},{"name":"DeviceLog","type":"string","attributes":{"read_only": true},"state":"ready","value":"","validator":{"max":"32768"}},{"name":"VendorConfigFileNumberOfEntries","type":"uint32","attributes":{"read_only": true},"state":"ready","value":1},{"name":"ManufacturerURL","type":"string","attributes":{"read_only": true},"state":"ready","value":"http://www.sagemcom.com/"},{"name":"Country","type":"string","attributes":{"read_only": true},"state":"ready","value":"fr"},{"name":"ExternalIPAddress","type":"string","attributes":{"read_only": true},"state":"ready","value":"109.210.171.110"},{"name":"DeviceStatus","type":"string","attributes":{},"state":"ready","value":"Up","validator":["Initializing","Up","Synchronized","Error","Disabled"]},{"name":"NumberOfReboots","type":"uint32","attributes":{"read_only": true,"persistent": true},"state":"ready","value":2}],"children":[{"objectInfo":{"indexPath":"DeviceInfo","keyPath":"DeviceInfo","name":"VendorConfigFile","key":"VendorConfigFile","attributes":{"template":true,"persistent":true},"state":"ready","parameterCount":4,"childCount":0,"instanceCount":1},"templateInfo":{ "maxInstances":4294967295 },"functions":[],"parameters":[{"name":"Name","type":"string","attributes":{"read_only": true,"persistent": true},"state":"ready","value":"","validator":{"max":"64"}},{"name":"Version","type":"string","attributes":{"read_only": true,"persistent": true},"state":"ready","value":"","validator":{"max":"16"}},{"name":"Date","type":"date_time","attributes":{"read_only": true,"persistent": true},"state":"ready","value":"0001-01-01T00:00:00Z"},{"name":"Description","type":"string","attributes":{"read_only": true,"persistent": true},"state":"ready","value":"","validator":{"max":"256"}}],"children":[],"instances":[{"objectInfo":{"indexPath":"DeviceInfo.VendorConfigFile","keyPath":"DeviceInfo.VendorConfigFile","name":"1","key":"digitmap","attributes":{"instance":true,"persistent":true},"state":"ready","parameterCount":4,"childCount":0,"instanceCount":0},"functions":[],"parameters":[{"name":"Name","type":"string","attributes":{"read_only": true,"persistent": true},"state":"ready","value":"digitmap","validator":{"max":"64"}},{"name":"Version","type":"string","attributes":{"read_only": true,"persistent": true},"state":"ready","value":"","validator":{"max":"16"}},{"name":"Date","type":"date_time","attributes":{"read_only": true,"persistent": true},"state":"ready","value":"0001-01-01T00:00:00Z"},{"name":"Description","type":"string","attributes":{"read_only": true,"persistent": true},"state":"ready","value":"","validator":{"max":"256"}}],"children":[],"instances":[]}]}],"instances":[]}
Donc j'ai fait ceci qui évidement ne marche pas:
Code : Tout sélectionner
$Manufacturer = StringRegExp($line, 'Manufacturer","type":"string","attributes":\{"read_only": true\},"state":"ready","value":"(.*)","validator', 3)
Merci pour votre aide