Skip to content

Commit

Permalink
add exception condition for invalid type given on isub MusifyCollection
Browse files Browse the repository at this point in the history
  • Loading branch information
geo-martino committed May 26, 2024
1 parent 5bf7036 commit 9942249
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[flake8]
extend-exclude = .venv* jupyter/ notebooks/
extend-exclude = .venv* jupyter/ notebooks/ test.py
extend-ignore = E266
per-file-ignores =
**/__init__.py:F401
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -149,3 +149,5 @@ _site
.jekyll-cache
.jekyll-metadata
vendor

test.py
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ Should you wish to take advantage of some or all of this functionality, install
pip install musify[bars] # dependencies for displaying progress bars on longer running processes
pip install musify[images] # dependencies for processing images
pip install musify[musicbee] # dependencies for working with a local MusicBee library and its playlist types
pip install musify[sqlite] # dependencies for working with a SQLite cache backend for caching API responses
# or you may install any combination of these e.g.
pip install musify[bars,images,musicbee]
Expand Down
3 changes: 3 additions & 0 deletions musify/libraries/core/collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,9 @@ def __sub__(self, __items: Iterable[T]):
return items

def __isub__(self, __items: Iterable[T]):
if not isinstance(__items, Iterable):
raise MusifyTypeError("You must provide an iterable object to use this functionality.")

for item in __items:
self.remove(item)
return self
Expand Down
2 changes: 1 addition & 1 deletion musify/libraries/remote/core/library.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ async def sync(
log_kind = "adding new items only"
if kind != "new":
log_kind = 'all' if kind == 'refresh' else 'extra'
log_kind = f"clearing {log_kind} items from {self.api.source} playlist first"
log_kind = f"clearing {log_kind} items from each {self.api.source} playlist first"
self.logger.info(
f"\33[1;95m ->\33[1;97m Synchronising {len(playlists)} {self.api.source} playlists: {log_kind}"
f"{f' and reloading stored playlists' if reload else ''} \33[0m"
Expand Down

0 comments on commit 9942249

Please sign in to comment.