mirror of
https://github.com/morpheus65535/bazarr.git
synced 2025-06-28 09:24:56 -04:00
added tld library, fix add space after dot in domain names
- added tld library, so "Common Fixes" mod can detect domain names and won't add spaces after each dot in them. - fix HI_before_colon_noncaps, so it won't remove http: from URLs.
This commit is contained in:
parent
dd5cc8feb2
commit
a430bffe57
19 changed files with 28157 additions and 6 deletions
56
libs/tld/exceptions.py
Normal file
56
libs/tld/exceptions.py
Normal file
|
@ -0,0 +1,56 @@
|
|||
__author__ = 'Artur Barseghyan'
|
||||
__copyright__ = '2013-2020 Artur Barseghyan'
|
||||
__license__ = 'MPL-1.1 OR GPL-2.0-only OR LGPL-2.1-or-later'
|
||||
__all__ = (
|
||||
'TldBadUrl',
|
||||
'TldDomainNotFound',
|
||||
'TldImproperlyConfigured',
|
||||
'TldIOError',
|
||||
)
|
||||
|
||||
|
||||
class TldIOError(IOError):
|
||||
"""TldIOError.
|
||||
|
||||
Supposed to be thrown when problems with reading/writing occur.
|
||||
"""
|
||||
|
||||
|
||||
class TldDomainNotFound(ValueError):
|
||||
"""TldDomainNotFound.
|
||||
|
||||
Supposed to be thrown when domain name is not found (didn't match) the
|
||||
local TLD policy.
|
||||
"""
|
||||
|
||||
def __init__(self, domain_name):
|
||||
super(TldDomainNotFound, self).__init__(
|
||||
"Domain %s didn't match any existing TLD name!" % domain_name
|
||||
)
|
||||
|
||||
|
||||
class TldBadUrl(ValueError):
|
||||
"""TldBadUrl.
|
||||
|
||||
Supposed to be thrown when bad URL is given.
|
||||
"""
|
||||
|
||||
def __init__(self, url):
|
||||
super(TldBadUrl, self).__init__("Is not a valid URL %s!" % url)
|
||||
|
||||
|
||||
class TldImproperlyConfigured(Exception):
|
||||
"""TldImproperlyConfigured.
|
||||
|
||||
Supposed to be thrown when code is improperly configured. Typical use-case
|
||||
is when user tries to use `get_tld` function with both `search_public` and
|
||||
`search_private` set to False.
|
||||
"""
|
||||
|
||||
def __init__(self, msg=None):
|
||||
if msg is None:
|
||||
msg = "Improperly configured."
|
||||
else:
|
||||
msg = "Improperly configured. %s" % msg
|
||||
|
||||
super(TldImproperlyConfigured, self).__init__(msg)
|
Loading…
Add table
Add a link
Reference in a new issue