Git Product home page Git Product logo

pyedid's People

Contributors

dd4e avatar jojonas avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

pyedid's Issues

一个小问题

Windows上使用to_csv出现编码错误
def to_csv(self, csv_path: str):
"""Dump registry to csv file"""
with open(csv_path, "w") as csv_file:
writer = csv.writer(csv_file)
writer.writerows(self.items())
return self
建议增加encoding="utf-8",修改后
def to_csv(self, csv_path: str):
"""Dump registry to csv file"""
with open(csv_path, "w", encoding="utf-8") as csv_file:
writer = csv.writer(csv_file)
writer.writerows(self.items())
return self
以及 from_csv

PNP ID update script

Hi and thanks for the script. Just though I'd post a script for updating the pnp_id.csv CSV.

foo@bar ~ $ python /path/to/script.py > /path/to/pnp_id.csv

See python /path/to/script.py --help for more options. Requires BeautifulSoup4 and requests.

import csv
import datetime
import os.path
import shutil
import sys
from argparse import ArgumentParser
from contextlib import suppress
from pathlib import Path

from bs4 import BeautifulSoup

import requests


def log(*args, **kwargs):
    return print(*args, file=sys.stderr, **kwargs)


def main():
    # Parse command line arguments
    log('Parsing command line arguments')
    parser = ArgumentParser()
    parser.add_argument('-c', '--clear-cache', action='store_true',
                        default=False)
    parser.add_argument('-a', '--include-approved', action='store_true',
                        default=False)
    parser.add_argument('-u', '--url',
                        default='https://www.uefi.org/pnp_id_list')
    parser.add_argument('cache', nargs='?', default='~/.cache/edid')
    args = parser.parse_args()
    args.cache = Path(os.path.expanduser(args.cache)).absolute()

    # Prepare cache
    if args.clear_cache:
        log(f'Clearing cache {args.cache}')
        shutil.rmtree(args.cache)
    log(f'Ensuring cache {args.cache}')
    args.cache.mkdir(parents=True, exist_ok=True)

    # Load HTML from cache or the web
    html_path = args.cache / 'src.html'
    if html_path.exists():
        log(f'Loading cached HTML from {html_path}')
        html = html_path.read_text()
    else:
        log(f'Downloading HTML from {args.url}')
        response = requests.get(args.url)
        html = response.text
        with html_path.open('w') as html_file:
            html_file.write(html)

    # Extract data from HTML
    log(f'Extracting data from HTML')
    soup = BeautifulSoup(html, 'html5lib')
    rows = []
    for tr in soup.find('tbody').find_all('tr'):
        name_td, pnp_id_td, approved_td = tr.find_all('td')
        name = name_td.text.strip()
        pnp_id = pnp_id_td.text.strip()
        row = [pnp_id, name]
        if args.include_approved:
            approved = datetime.datetime.strptime(approved_td.text.strip(),
                                                  '%m/%d/%Y').date()
            row.append(approved)
        rows.append(row)

    # Write CSV file
    log(f'Writing CSV file')
    rows.sort()
    csv.writer(sys.stdout).writerows(rows)
    sys.stdout.close()


if __name__ == '__main__':
    with suppress(KeyboardInterrupt):
        main()

Problem with resolution enum

The "Standard timing" resolutions are not shown correctly, since the bitwise detection (line 151) is incorrect.

Can you replace:
bit = raw_edid.timings_supported & 1

With this:
bit = raw_edid.timings_supported & (1 << i)

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.