Skip to content

Commit

Permalink
Fix verbose option. Add and sort pre-commit hooks.
Browse files Browse the repository at this point in the history
  • Loading branch information
danielhoherd committed Sep 26, 2020
1 parent e7791e2 commit 2e0d149
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ repos:
- id: remove-tabs
exclude_types: [makefile, binary]
- repo: https://github.com/danielhoherd/pre-commit-hooks
rev: 07f5a00b0f7d7856d602baf5e530a4d4472d7bf3
rev: ac0637d7febb88d1b01f876e47bb5224a9a63eae
hooks:
- id: CVE-2017-18342
- id: remove-unicode-zero-width-space
- id: remove-en-dashes
- id: remove-unicode-non-breaking-spaces
- id: remove-unicode-zero-width-non-breaking-spaces
- id: remove-en-dashes
- id: remove-unicode-zero-width-space
- id: sort-gitignore
5 changes: 3 additions & 2 deletions plexdl/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@ def get_logger(ctx, param, value):
"""Get logger and return verbosity value."""
logging.basicConfig(format="%(message)s")
log = logging.getLogger("plexdl")
log.setLevel(50 - (value * 10)) # https://docs.python.org/3.7/library/logging.html#logging-levels
if value > 0:
log.setLevel("DEBUG") # https://docs.python.org/3.7/library/logging.html#logging-levels
return value


@command()
@option("-v", count=True, help="Increase verbosity (max -vvvv)", callback=get_logger)
@option("-v", count=True, help="Be verbose", callback=get_logger)
@option("-u", "--username", help="Your Plex username (env PLEXDL_USER)", envvar="PLEXDL_USER")
@option("-p", "--password", help="Your Plex password (env PLEXDL_PASS)", envvar="PLEXDL_PASS")
@option("-r", "--relay/--no-relay", default=False, help="Output relay servers along with direct servers")
Expand Down
2 changes: 1 addition & 1 deletion plexdl/plexdl.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def __init__(self, **kwargs):
@staticmethod
def print_item_info(self, item, access_token):
"""Print info about a given media item."""
log.critical(f"Filesystem locations: {item.locations}")
log.debug(f"Filesystem locations: {item.locations}")
if hasattr(item, "iterParts"):
locations = [i for i in item.iterParts() if i]
for location in locations:
Expand Down

0 comments on commit 2e0d149

Please sign in to comment.