diff --git a/README.md b/README.md index 8605f50..ff9e371 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ $ rfd threads --sort-by score ``` ```console -$ rfd threads --sort-by total_views --limit 40 +$ rfd threads --sort-by views --limit 40 ``` ### Simple Search diff --git a/rfd/VERSION b/rfd/VERSION index 1d0ba9e..267577d 100644 --- a/rfd/VERSION +++ b/rfd/VERSION @@ -1 +1 @@ -0.4.0 +0.4.1 diff --git a/rfd/cli.py b/rfd/cli.py index 26ef501..008723f 100644 --- a/rfd/cli.py +++ b/rfd/cli.py @@ -56,7 +56,7 @@ def display_thread(click, thread, count): # pylint: disable=redefined-outer-nam + Fore.RESET + "%s%s" % (dealer, thread.title) + Fore.LIGHTYELLOW_EX - + " (%d views)" % thread.total_views + + " (%d views)" % thread.views + Fore.RESET ) click.echo(Fore.BLUE + " {}".format(thread.url)) diff --git a/rfd/threads.py b/rfd/threads.py index 58f2158..5c9f5c7 100644 --- a/rfd/threads.py +++ b/rfd/threads.py @@ -4,12 +4,12 @@ from .scores import calculate_score # pylint: disable=old-style-class class Thread: - def __init__(self, title, dealer_name, score, url, total_views): + def __init__(self, title, dealer_name, score, url, views): self.dealer_name = dealer_name self.score = score self.title = title self.url = url - self.total_views = total_views + self.views = views def __repr__(self): return "Thread(%s)" % self.title @@ -48,7 +48,7 @@ def parse_threads(threads, limit): dealer_name=get_dealer(topic), score=calculate_score(topic), url=build_web_path(topic.get("web_path")), - total_views=topic.get("total_views"), + views=topic.get("total_views"), ) ) return parsed_threads @@ -58,7 +58,7 @@ def sort_threads(threads, sort_by): """Sort threads by an attribute""" if sort_by is None: return threads - assert sort_by in ["total_views", "score", "title"] + assert sort_by in ["views", "score", "title"] threads = sorted(threads, key=lambda x: getattr(x, sort_by), reverse=True) return threads