From bc032ec25e998d3cbd958cf0f6179b4fe2fe28d2 Mon Sep 17 00:00:00 2001 From: Phillip Berndt Date: Sun, 25 Mar 2018 12:19:03 +0200 Subject: [PATCH] Allow wildcard matching in EDIDs See #100. --- README.md | 1 + autorandr.py | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/README.md b/README.md index 3632e8d..1b63cc2 100644 --- a/README.md +++ b/README.md @@ -199,6 +199,7 @@ running `xrandr`. * *2018-01-04* Fixed vertical/horizontal/clone-largest virtual profiles * *2018-03-07* Output all non-error messages to stdout instead of stderr * *2018-03-25* Add --detected and --current to filter the profile list output +* *2018-03-25* Allow wildcard matching in EDIDs **autorandr 1.4** diff --git a/autorandr.py b/autorandr.py index b363b9e..d54ade8 100755 --- a/autorandr.py +++ b/autorandr.py @@ -26,6 +26,7 @@ from __future__ import print_function import binascii import copy +import fnmatch import getopt import hashlib import os @@ -399,6 +400,10 @@ class XrandrOutput(object): return hashlib.md5(binascii.unhexlify(other.edid)).hexdigest() == self.edid if len(self.edid) != 32 and len(other.edid) == 32 and not self.edid.startswith(XrandrOutput.EDID_UNAVAILABLE): return hashlib.md5(binascii.unhexlify(self.edid)).hexdigest() == other.edid + if "*" in self.edid: + return fnmatch.fnmatch(other.edid, self.edid) + elif "*" in other.edid: + return fnmatch.fnmatch(self.edid, other.edid) return self.edid == other.edid def __ne__(self, other): -- 2.39.2