refactor: fix typo from 'podcats' to 'podcasts' (#141)

* fix typo from 'podcats' to 'podcasts'

* missed on first check

* Deprecate resolve_podcats method

The resolve_podcats method is marked as deprecated, and a warning message is added to inform users. It is recommended to use the resolve_podcasts method. This commit helps to phase out the resolve_podcats method, aiming to eliminate any spelling errors in method naming.

* Fix typo in variable name

A typo in the variable name 'resolve_podcats' was corrected to 'resolve_podcasts'. This ensures that the conditional check operates as designed, without causing errors due to referencing a non-existent variable.

* Fix typos and improve readability in CHANGELOG.md

The commit fixes several typos including changing `resolve_podcats` to `resolve_podcasts` and fixing spelling of 'titles'. In addition, it formalizes the formatting of terms and phrases by using backticks around them for more readability. Furthermore, a missing comma has also been added to enhance sentence clarity.

---------

Co-authored-by: mkb79 <mkb79@hackitall.de>
This commit is contained in:
Isaac Lyons 2024-04-16 14:10:17 -04:00 committed by GitHub
parent 705d6f0959
commit efcad39b8e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 24 additions and 9 deletions

View file

@ -28,6 +28,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
Additional keyword arguments to this method are now passed through the metadata
request.
- Update httpx version range to >=0.23.3 and <0.28.0.
- fix typo from `resolve_podcats` to `resolve_podcasts`
- `models.Library.resolve_podcats` is now deprecated and will be removed in a future version
## [0.3.1] - 2024-03-19
@ -118,7 +120,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- by default a licenserequest (voucher) will not include chapter information by default
- moved licenserequest part from `models.LibraryItem.get_aaxc_url` to its own `models.LibraryItem.get_license` function
- allow book tiltes with hyphens (#96)
- allow book titles with hyphens (#96)
- if there is no title fallback to an empty string (#98)
- reduce `response_groups` for the download command to speed up fetching the library (#109)
@ -126,7 +128,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- `Extreme` quality is not supported by the Audible API anymore (#107)
- download command continued execution after error (#104)
- Currently paths with dots will break the decryption (#97)
- Currently, paths with dots will break the decryption (#97)
- `models.Library.from_api_full_sync` called `models.Library.from_api` with incorrect keyword arguments
### Misc
@ -189,7 +191,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Added
- the `--version` option now checks if an update for `audible-cli` is available
- build macOS releases in onedir mode
- build macOS releases in `onedir` mode
### Bugfix

View file

@ -790,9 +790,9 @@ async def cli(session, api_client, **params):
overwrite_existing = params.get("overwrite")
ignore_errors = params.get("ignore_errors")
no_confirm = params.get("no_confirm")
resolve_podcats = params.get("resolve_podcasts")
resolve_podcasts = params.get("resolve_podcasts")
ignore_podcasts = params.get("ignore_podcasts")
if all([resolve_podcats, ignore_podcasts]):
if all([resolve_podcasts, ignore_podcasts]):
logger.error("Do not mix *ignore-podcasts* with *resolve-podcasts* option.")
raise click.Abort()
bunch_size = session.params.get("bunch_size")
@ -836,8 +836,8 @@ async def cli(session, api_client, **params):
status="Active",
)
if resolve_podcats:
await library.resolve_podcats(start_date=start_date, end_date=end_date)
if resolve_podcasts:
await library.resolve_podcasts(start_date=start_date, end_date=end_date)
[library.data.remove(i) for i in library if i.is_parent_podcast()]
# collect jobs

View file

@ -45,7 +45,7 @@ async def _get_library(session, client, resolve_podcasts):
)
if resolve_podcasts:
await library.resolve_podcats(start_date=start_date, end_date=end_date)
await library.resolve_podcasts(start_date=start_date, end_date=end_date)
return library

View file

@ -6,6 +6,7 @@ import unicodedata
from datetime import datetime
from math import ceil
from typing import List, Optional, Union
from warnings import warn
import audible
import httpx
@ -603,6 +604,18 @@ class Library(BaseList):
self,
start_date: Optional[datetime] = None,
end_date: Optional[datetime] = None
):
warn(
"resolve_podcats is deprecated, use resolve_podcasts instead",
DeprecationWarning,
stacklevel=2
)
return self.resolve_podcasts(start_date, end_date)
async def resolve_podcasts(
self,
start_date: Optional[datetime] = None,
end_date: Optional[datetime] = None
):
podcast_items = await asyncio.gather(
*[i.get_child_items(start_date=start_date, end_date=end_date)
@ -668,7 +681,7 @@ class Catalog(BaseList):
return cls(resp, api_client=api_client)
async def resolve_podcats(self):
async def resolve_podcasts(self):
podcast_items = await asyncio.gather(
*[i.get_child_items() for i in self if i.is_parent_podcast()]
)