diff --git a/begoneads/begoneads.py b/begoneads/begoneads.py index d568aa2..5a1b395 100644 --- a/begoneads/begoneads.py +++ b/begoneads/begoneads.py @@ -45,7 +45,9 @@ def install(sources, local_sources): 'This program needs to be run as root to work properly') sources = [i.strip() for i in sources.split(',')] - local_sources = [i.strip() for i in local_sources.split(',')] + + if local_sources: + local_sources = [i.strip() for i in local_sources.split(',')] url_pattern = re.compile( r'^(?:http|ftp)s?://' # http:// or https:// @@ -73,19 +75,22 @@ def install(sources, local_sources): print('✓ Remote hosts collected') - # Collect local host files - local_collector = LocalCollector(local_sources) + local_hosts = "" + + if local_sources: + # Collect local host files + local_collector = LocalCollector(local_sources) - print('⋯ Collecting and parsing local hosts') - local_hosts = local_collector.get_result() + print('⋯ Collecting and parsing local hosts') + local_hosts = local_collector.get_result() + + print('✓ Local hosts collected') hosts = "\n".join([ remote_hosts, local_hosts ]) - print('✓ Local hosts collected') - if sys.platform.startswith('win'): path = r'c:\windows\system32\drivers\etc\hosts' else: diff --git a/setup.py b/setup.py index 48f0385..03d3dd9 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ def readme(): setup( name='begoneads', - version='0.0.5', + version='0.0.6', description='BeGoneAds puts some popular hosts file lists into the hosts file as a adblocker measure.', long_description=readme(), long_description_content_type="text/markdown",