fixed config file error
This commit is contained in:
@ -18,7 +18,7 @@ Once *feediverse* is configured you can add it to your crontab:
|
|||||||
|
|
||||||
*/15 * * * * /usr/local/bin/feediverse
|
*/15 * * * * /usr/local/bin/feediverse
|
||||||
|
|
||||||
Run `feediverse --help` to show the comand line options.
|
Run `feediverse --help` to show the command line options.
|
||||||
|
|
||||||
|
|
||||||
## Post Format
|
## Post Format
|
||||||
|
|||||||
@ -28,8 +28,6 @@ def __urlencodereplace_errors(exc):
|
|||||||
codecs.register_error("urlencodereplace", __urlencodereplace_errors)
|
codecs.register_error("urlencodereplace", __urlencodereplace_errors)
|
||||||
|
|
||||||
|
|
||||||
DEFAULT_CONFIG_FILE = os.path.join("~", ".feediverse")
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument("-n", "--dry-run", action="store_true",
|
parser.add_argument("-n", "--dry-run", action="store_true",
|
||||||
@ -37,12 +35,15 @@ def main():
|
|||||||
"don't toot, don't save config"))
|
"don't toot, don't save config"))
|
||||||
parser.add_argument("-v", "--verbose", action="store_true",
|
parser.add_argument("-v", "--verbose", action="store_true",
|
||||||
help="be verbose")
|
help="be verbose")
|
||||||
parser.add_argument("config_file", nargs="?", metavar="CONFIG-FILE",
|
parser.add_argument("-c", "--config",
|
||||||
help=("config file to use, default: %s" %
|
help="config file to use",
|
||||||
DEFAULT_CONFIG_FILE),
|
|
||||||
default=os.path.expanduser(DEFAULT_CONFIG_FILE))
|
default=os.path.expanduser(DEFAULT_CONFIG_FILE))
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
config_file = args.config_file
|
config_file = args.config
|
||||||
|
|
||||||
|
if args.verbose:
|
||||||
|
print("using config file", config_file)
|
||||||
|
|
||||||
if not os.path.isfile(config_file):
|
if not os.path.isfile(config_file):
|
||||||
setup(config_file)
|
setup(config_file)
|
||||||
@ -88,7 +89,7 @@ def main():
|
|||||||
print("trial run, not saving the config")
|
print("trial run, not saving the config")
|
||||||
else:
|
else:
|
||||||
if args.verbose:
|
if args.verbose:
|
||||||
print("saving the config")
|
print("saving the config", config_file)
|
||||||
save_config(config, config_file)
|
save_config(config, config_file)
|
||||||
|
|
||||||
def save_config(config, config_file):
|
def save_config(config, config_file):
|
||||||
@ -140,10 +141,10 @@ def collect_images(entry, generator=None):
|
|||||||
soup = BeautifulSoup(part, 'html.parser')
|
soup = BeautifulSoup(part, 'html.parser')
|
||||||
for tag in soup.find_all(["a", "img"]):
|
for tag in soup.find_all(["a", "img"]):
|
||||||
if tag.name == "a":
|
if tag.name == "a":
|
||||||
url = tag["href"]
|
url = tag.get("href")
|
||||||
elif tag.name == "img":
|
elif tag.name == "img":
|
||||||
url = tag["src"]
|
url = tag.get("src")
|
||||||
if url not in urls:
|
if url and url not in urls:
|
||||||
urls.append(url)
|
urls.append(url)
|
||||||
|
|
||||||
urls = []
|
urls = []
|
||||||
|
|||||||
2
setup.py
2
setup.py
@ -5,7 +5,7 @@ with open("README.md") as f:
|
|||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='feediverse',
|
name='feediverse',
|
||||||
version='0.1.4',
|
version='0.2.0',
|
||||||
python_requires='>=3.3',
|
python_requires='>=3.3',
|
||||||
url='https://github.com/edsu/feediverse',
|
url='https://github.com/edsu/feediverse',
|
||||||
author='Ed Summers',
|
author='Ed Summers',
|
||||||
|
|||||||
Reference in New Issue
Block a user