mirror of
https://github.com/davegallant/rfd.git
synced 2025-08-06 00:33:40 +00:00
Add view count to each thread (#53)
This commit is contained in:
11
.github/PULL_REQUEST_TEMPLATE.md
vendored
11
.github/PULL_REQUEST_TEMPLATE.md
vendored
@@ -1,8 +1,9 @@
|
|||||||
|
|
||||||
*Description of changes:*
|
**What this PR does / why we need it:**
|
||||||
|
-
|
||||||
|
|
||||||
*Checklist:*
|
**Which issue(s) this PR fixes:**
|
||||||
|
-
|
||||||
|
|
||||||
- [ ] Write unit tests
|
**Additional Notes:**
|
||||||
- [ ] `make pr` passes
|
-
|
||||||
- [ ] Write documentation
|
|
||||||
|
14
README.md
14
README.md
@@ -8,18 +8,18 @@ Hot deals on the command line.
|
|||||||
[](https://lgtm.com/projects/g/davegallant/rfd/alerts/)
|
[](https://lgtm.com/projects/g/davegallant/rfd/alerts/)
|
||||||
[](https://lgtm.com/projects/g/davegallant/rfd/context:python)
|
[](https://lgtm.com/projects/g/davegallant/rfd/context:python)
|
||||||
|
|
||||||
## Installation
|
|
||||||
|

|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pip install rfd
|
pip install rfd
|
||||||
```
|
```
|
||||||
|
|
||||||
## Usage
|
## Use
|
||||||
|
|
||||||

|
### view threads
|
||||||
|
|
||||||
|
|
||||||
### threads
|
|
||||||
```bash
|
```bash
|
||||||
rfd threads [--forum-id 9] [--limit 10]
|
rfd threads [--forum-id 9] [--limit 10]
|
||||||
```
|
```
|
||||||
@@ -29,7 +29,7 @@ rfd threads [--forum-id 9] [--limit 10]
|
|||||||
rfd search pizza [--num-pages 100]
|
rfd search pizza [--num-pages 100]
|
||||||
```
|
```
|
||||||
|
|
||||||
## Tab Completion
|
## Support Tab Completion
|
||||||
|
|
||||||
### bash
|
### bash
|
||||||
|
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
beautifulsoup4>=4.6.0
|
beautifulsoup4>=4.8.1
|
||||||
click>=7.0
|
click>=7.0
|
||||||
colorama>=0.3.9
|
colorama>=0.4.3
|
||||||
requests>=2.18.0
|
requests>=2.22.0
|
||||||
|
@@ -1 +1 @@
|
|||||||
0.3.3
|
0.3.4
|
||||||
|
@@ -116,6 +116,9 @@ def threads(limit, forum_id):
|
|||||||
+ get_vote_color(thread.score)
|
+ get_vote_color(thread.score)
|
||||||
+ Fore.RESET
|
+ Fore.RESET
|
||||||
+ "[%s] %s" % (thread.dealer_name, thread.title)
|
+ "[%s] %s" % (thread.dealer_name, thread.title)
|
||||||
|
+ Fore.LIGHTYELLOW_EX
|
||||||
|
+ " (%d views)" % thread.total_views
|
||||||
|
+ Fore.RESET
|
||||||
)
|
)
|
||||||
click.echo(Fore.BLUE + " {}".format(thread.url))
|
click.echo(Fore.BLUE + " {}".format(thread.url))
|
||||||
click.echo(Style.RESET_ALL)
|
click.echo(Style.RESET_ALL)
|
||||||
|
@@ -1,10 +1,11 @@
|
|||||||
# pylint: disable=old-style-class
|
# pylint: disable=old-style-class
|
||||||
class Thread:
|
class Thread:
|
||||||
def __init__(self, title, dealer_name, score, url):
|
def __init__(self, title, dealer_name, score, url, total_views):
|
||||||
self.dealer_name = dealer_name
|
self.dealer_name = dealer_name
|
||||||
self.score = score
|
self.score = score
|
||||||
self.title = title
|
self.title = title
|
||||||
self.url = url
|
self.url = url
|
||||||
|
self.total_views = total_views
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return "Thread(%s)" % self.title
|
return "Thread(%s)" % self.title
|
||||||
|
@@ -29,6 +29,7 @@ def parse_threads(threads, limit):
|
|||||||
dealer_name=topic["offer"].get("dealer_name"),
|
dealer_name=topic["offer"].get("dealer_name"),
|
||||||
score=calculate_score(topic),
|
score=calculate_score(topic),
|
||||||
url=build_web_path(topic.get("web_path")),
|
url=build_web_path(topic.get("web_path")),
|
||||||
|
total_views=topic.get("total_views"),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
return parsed_threads
|
return parsed_threads
|
||||||
|
Reference in New Issue
Block a user