Giter VIP home page Giter VIP logo

Comments (4)

ReenigneArcher avatar ReenigneArcher commented on June 12, 2024

+1 for this

from screeninfo.

gitagogaming avatar gitagogaming commented on June 12, 2024

+1 for this as well, would be great to be able to access this with screeninfo

from screeninfo.

KillerBOSS2019 avatar KillerBOSS2019 commented on June 12, 2024

+1 for this too

from screeninfo.

nsde avatar nsde commented on June 12, 2024

Thanks for providing the code snippet!
Mi Monitor sounds much better than \\\\.\\DISPLAY1.

I know this isn't going to be implemented, as this is way too much bloat for a simple screen info checker. But for anyone interested – I'd just like to mention that using the following script, you can get the actual monitor name:

import wmi
import bs4
import requests

from pprint import pprint

wmi_ = wmi.WMI() 

for monitor in wmi_.Win32_DesktopMonitor():
    monitor_code = monitor.PNPDeviceID.split('\\')[1]
    # monitor_code = 'gbt2701'
    url = f'https://linux-hardware.org/?view=search&name={monitor_code}#list'

    # get the HTML
    html = requests.get(url=url, timeout=10, headers={'User-Agent': 'Mozilla'}).text

    soup = bs4.BeautifulSoup(html, 'html.parser')

    # get the table
    table = soup.select_one('#devices.tbl.highlight.dev_info.dev_list')

    device = table.select_one('td.device').text.split('-inch')[0].replace('.0', '') + '"'
    brand = table.select_one('td.vendor').text

    # now turn the table into a dictionary
    specs = {
        'code': monitor_code,
        'product': ' '.join(device.split()[:-4]),
        'resolution': device.split()[-3],
        'size': device.split()[-2],
        'inches': float(device.split()[-1].replace('"', '')),
        'brand': brand,
    }

    pprint(specs)

Which returns something like:

{
    'brand': 'Gigabyte Technology',
    'code': 'gbt2701',
    'inches': 27.8,
    'product': 'AORUS AD27QD',
    'resolution': '2560x1440',
    'size': '609x355mm'
}

from screeninfo.

Related Issues (20)

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.