Code Monkey home page Code Monkey logo

displays_info's Introduction

Munki reporting module

Provides info about munki

  • timestamp (string) (string) datetime
  • runtype'] = (string) one of auto, manualcheck, installwithnologout, checkandinstallatstartup and logoutinstall
  • starttime (string) DST datetime
  • endtime (string) DST datetime
  • version (string) Munki version
  • errors (int) Amount of errors
  • error_json (string) Error messages in JSON format
  • warnings (int) Amount of warnings
  • warning_json (string) Warning messages in JSON format
  • manifestname (string) name of the primary manifest

displays_info's People

Contributors

bochoven avatar diwanicki avatar fridomac avatar magervalp avatar morgant avatar mosen avatar poundbangbash avatar tuxudo avatar znerol avatar

Watchers

 avatar  avatar  avatar

displays_info's Issues

macOS 13 - localization paths change FYI

Just noticed that on macOS 13 the localization path for the various SystemProfiler *.spreporter folders is no longer contained with the locale.lproj file, for example:

/System/Library/SystemProfiler/SPDisplaysReporter.spreporter/Contents/Resources/en_AU.lproj

The file is now most likely (there may be another file in the Contents/Resources path named similar to Localizable-J413.loctable:

/System/Library/SystemProfiler/SPDisplaysReporter.spreporter/Contents/Resources/Localizable.loctable

This file is still a binary plist, but the key/values are now different. When reading the Localizable.loctable data, there is a corresponding locale key that contains the localized values to look up.

Python 3.10.8 (v3.10.8:aaaf517424, Oct 11 2022, 10:14:40) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from pathlib import Path
>>> from pprint import pprint
>>> import plistlib
>>> fp = Path("/System/Library/SystemProfiler/SPDisplaysReporter.spreporter/Contents/Resources/Localizable.loctable")
>>> with fp.open("rb") as f:
...     data = plistlib.load(f)
... 
>>> print(data.keys())
dict_keys(['he', 'ko', 'id', 'nl', 'tr', 'ru', 'hu', 'fi', 'it', 'es_419', 'el', 'ca', 'fr_CA', 'zh_TW', 'zh_HK', 'sv', 'pl', 'no', 'da', 'LocProvenance', 'en', 'ar', 'hi', 'th', 'zh_CN', 'en_GB', 'ms', 'cs', 'sk', 'en_AU', 'de', 'vi', 'pt_BR', 'uk', 'fr', 'ro', 'es', 'ja', 'pt_PT', 'hr'])
>>> pprint(data["en_AU"])
{' @ %@Hz': ' @ %@Hz',
 '%@ (%@ %@, %@ %@)': '%1$@ (%2$@ %3$@, %4$@ %5$@)',
 '%@ x %@': '%1$@ x %2$@',
 'CGSDefaultDepth': 'Default',
 'CGSEightBitColor': '8-Bit Colour (Colour Table)',
 'CGSEightBitGray': '8-Bit Grey',
 'CGSSixteenBitColor': '16-Bit Colour (ARGB1555)',
 'CGSSixtyfourBitColor': '64-Bit Colour (ARGB16161616)',
 'CGSThirtyBitColor': '30-Bit Colour (ARGB2101010)',
 'CGSThirtytwoBitColor': '24-Bit Colour (ARGB8888)',
 'SPDisplaysDataType': 'Graphics/Displays',
 'Unknown Display': 'Unknown Display',
 '_name': 'Video Card',
 'display': 'Display',
...
 'sppci_port_name': 'Port',
 'sppci_revision-id': 'Revision ID',
 'sppci_rom-revision': 'ROM Revision',
 'sppci_slot_name': 'Slot',
 'sppci_subsystem-id': 'Subsystem ID',
 'sppci_subsystem-vendor-id': 'Subsystem Vendor ID',
 'sppci_vendor-id': 'Vendor ID',
 'sppci_vendor_Apple': 'Apple (0x106b)',
 'sppci_vendor_Nvidia': 'NVIDIA (0x10de)',
 'sppci_vendor_amd': 'AMD (0x1002)'}
>>> 

Error running the displays-module. Localizable.strings unreadable due to missing path

This module would fail on some of our systems. Turns out we have some systems running 10.14 with Localizable.strings stashed away in:
'/System/Library/SystemProfiler/SPDisplaysReporter.spreporter/Contents/Resources/English.lproj/
-And some uses:
'/System/Library/SystemProfiler/SPDisplaysReporter.spreporter/Contents/Resources/en.lproj/

Changed displays.py to make it work by adding:

import os.path
and replacing the getOsVersion if-statement with:

if os.path.isfile("/System/Library/SystemProfiler/SPDisplaysReporter.spreporter/Contents/Resources/en.lproj"):
         localization = FoundationPlist.readPlist('/System/Library/SystemProfiler/SPDisplaysReporter.spreporter/Contents/Resources/en.lproj/Localizable.strings')
    else:
         localization = FoundationPlist.readPlist('/System/Library/SystemProfiler/SPDisplaysReporter.spreporter/Contents/Resources/English.lproj/Localizable.strings')

    result = flatten_displays_info(info, localization)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.