Skip to content

Commit

Permalink
fixed #14 and release v0.0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
jheidecker committed Jul 9, 2023
1 parent c79c01a commit 7e809e5
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ WORKDIR /app
RUN pip3 install build
COPY . .
RUN python3 -m build
RUN pip3 install dist/lemmony-0.0.4-py3-none-any.whl
RUN pip3 install dist/lemmony-0.0.5-py3-none-any.whl

CMD ["lemmony-cli"]
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,17 @@ Per: [https://join-lemmy.org/docs/users/01-getting-started.html](https://join-le
Use is not limited to small instances, that's just what I wrote it for.

## DISCLAIMER
## BIG DISCLAIMER

IF YOU DON'T UNDERSTAND WHAT THIS TOOL DOES, PLEASE CONSIDER CAREFULLY THE IMPLICATIONS OF RUNNING IT.

If you get errors (specifically KeyError,) the server is responding with rate-limit errors as a payload, instead of expected data. Try lowering the rate-limit. (`-r`)

This will cause load and subsequent incoming network activity on your instance and the network overall! A raspberry-pi or your internet may not be able to accommodate updates from all of the lemmyverse's communities!

## What lemmony does

1. Get a list of all communities/magazines in the Lemmyverse that have > 0 posts
1. Get a list of communities/magazines in the Lemmyverse from [lemmyverse.net](lemmyverse.net) that have > 0 posts, are not listed as suspicious, and meet the top and include/exclude conditions
2. Login to local instance as a specified user
3. "Makes known" (see above) any communities or magazines fetched above that have never been known on your local instance
4. Subscribes a user (follows) to all known communities on your local instance that are shown as "Unsubscribed" or, re-subscribes if the status is "Pending."
Expand Down Expand Up @@ -62,7 +64,7 @@ Pass these flags to the command for more control:
- `-s` : subscribe only. skips the discovery and adding of new lemmyverse communities
- `-d` : discover only. skips subscribing to any communities for the user
- `-r [number]` : if specified, will rate limit requests to LOCAL to this many per second (default: 15)
- `-t [number]` : if specified, only discover top X communities **PER INSTANCE** based on active users per day (Lemmy only) (default: get all non-empty communities per. instance)
- `-t [number]` : if specified, only discover top X communities **PER INSTANCE** based on active users per day (Lemmy only) (default: 10)
- `-k` : if specified, will not discover kbin communities (will still subscribe if they are communities on instance)

### Build and Run Manually
Expand Down
6 changes: 3 additions & 3 deletions lemmony/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def main():
parser.add_argument('-s', '--subscribe-only', help='only subscribe to unsubscribed (-n) or unsubscribed/pending communities, do not scrape for and add new communities', action='store_true')
parser.add_argument('-d', '--discover-only', help='only add new communities to instance list, do not subscribe', action='store_true')
parser.add_argument('-r', '--rate-limit', help='if specified, will rate limit requests to LOCAL to this many per second (default: 15)', type=int, default=15)
parser.add_argument('-t', '--top-only', help='if specified, only discover top X communities based on active users per day (Lemmy only) (default: get all non-empty communities)', type=int)
parser.add_argument('-t', '--top-only', help='top X communities based on active users per day (Lemmy only) (default: 10)', type=int, default=10)
parser.add_argument('-k', '--skip-kbin', help='if specified, will not discover kbin communities (will still subscribe if they are communities on instance)', action='store_true')
parser.add_argument('-x', '--unsubscribe-all', help='forgo all other functions and unsubscribe the USER from all communities on instance', action='store_true')
args = parser.parse_args()
Expand Down Expand Up @@ -81,7 +81,7 @@ def discover():
while communities_pages >= 0:
communities = requests.get('https://lemmyverse.net/data/community/' + str(communities_pages) + '.json')
for community in communities.json():
if community['counts']['posts'] > 0 and not community['baseurl'] in exclude_instances and (include_instances == [] or community['baseurl'] in include_instances):
if community['counts']['posts'] > 0 and not community['isSuspicious'] == True and not community['baseurl'] in exclude_instances and (include_instances == [] or community['baseurl'] in include_instances):
tmp_dict = {'baseurl': community['baseurl'], 'users_active_day': community['counts']['users_active_day'], 'url': community['url'].lower()}
with_baseurl.append(tmp_dict)
communities_pages -= 1
Expand All @@ -99,7 +99,7 @@ def discover():
while communities_pages >= 0:
communities = requests.get('https://lemmyverse.net/data/community/' + str(communities_pages) + '.json')
for community in communities.json():
if community['counts']['posts'] > 0 and not community['baseurl'] in exclude_instances and (include_instances == [] or community['baseurl'] in include_instances):
if community['counts']['posts'] > 0 and not community['isSuspicious'] == True and not community['baseurl'] in exclude_instances and (include_instances == [] or community['baseurl'] in include_instances):
community_actors.append(community['url'].lower())
communities_pages -= 1
community_count = str(len(community_actors))
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = lemmony
version = 0.0.4
version = 0.0.5

[options]
packages = lemmony
Expand Down

0 comments on commit 7e809e5

Please sign in to comment.