Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ jobs:
python: "3.14"
tox: "3.14"
coverage: true
# - name: "pyright"
# python: "3.14"
# tox: "pyright"
- name: "pyright"
python: "3.14"
tox: "pyright"
- name: "ruff check"
python: "3.14"
tox: "ruff-check"
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ classifiers = [
]
dynamic = ["version"]
dependencies = [
"mopidy >= 4.0.0a8",
"mopidy >= 4.0.0a10",
"pygobject >= 3.50",
"pykka >= 4.1",
]
Expand Down
4 changes: 3 additions & 1 deletion src/mopidy_mpd/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
from typing import TYPE_CHECKING, Any, Never

import pykka
from gi.repository import GLib # pyright: ignore[reportMissingModuleSource]
from gi.repository import (
GLib, # pyright: ignore[reportAttributeAccessIssue, reportMissingModuleSource]
)

logger = logging.getLogger(__name__)

Expand Down
8 changes: 5 additions & 3 deletions src/mopidy_mpd/protocol/current_playlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
from typing import TYPE_CHECKING
from urllib.parse import urlparse

from mopidy.types import TracklistId

from mopidy_mpd import exceptions, protocol, translator

if TYPE_CHECKING:
Expand Down Expand Up @@ -153,7 +155,7 @@ def moveid(context: MpdContext, tlid: int, to: int) -> None:
the playlist. If ``TO`` is negative, it is relative to the current
song in the playlist (if there is one).
"""
position = context.core.tracklist.index(tlid=tlid).get()
position = context.core.tracklist.index(tlid=TracklistId(tlid)).get()
if position is None:
raise exceptions.MpdNoExistError("No such song")
context.core.tracklist.move(position, position + 1, to)
Expand Down Expand Up @@ -428,8 +430,8 @@ def swapid(context: MpdContext, tlid1: int, tlid2: int) -> None:

Swaps the positions of ``SONG1`` and ``SONG2`` (both song ids).
"""
position1 = context.core.tracklist.index(tlid=tlid1).get()
position2 = context.core.tracklist.index(tlid=tlid2).get()
position1 = context.core.tracklist.index(tlid=TracklistId(tlid1)).get()
position2 = context.core.tracklist.index(tlid=TracklistId(tlid2)).get()
if position1 is None or position2 is None:
raise exceptions.MpdNoExistError("No such song")
swap(context, position1, position2)
Expand Down
8 changes: 4 additions & 4 deletions src/mopidy_mpd/protocol/music_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def _artist_as_track(artist: Artist) -> Track:
return Track(
uri=artist.uri,
name=f"Artist: {artist.name}",
artists=[artist],
artists=frozenset([artist]),
)


Expand Down Expand Up @@ -192,7 +192,7 @@ def findadd(context: MpdContext, *args: str) -> None:
return

results = context.core.library.search(query=query, exact=True).get()
uris = [track.uri for track in _get_tracks(results)]
uris = [track.uri for track in _get_tracks(results) if track.uri is not None]
context.core.tracklist.add(uris=uris).get()


Expand Down Expand Up @@ -498,8 +498,8 @@ def searchadd(context: MpdContext, *args: str) -> None:
return

results = context.core.library.search(query).get()

context.core.tracklist.add(uris=[track.uri for track in _get_tracks(results)]).get()
uris = [track.uri for track in _get_tracks(results) if track.uri is not None]
context.core.tracklist.add(uris=uris).get()


@protocol.commands.add("searchaddpl")
Expand Down
7 changes: 4 additions & 3 deletions src/mopidy_mpd/protocol/stored_playlists.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def listplaylist(context: MpdContext, name: str) -> protocol.Result:
file: relative/path/to/file3.mp3
"""
playlist = _get_playlist(context, name, must_exist=True)
return [("file", track.uri) for track in playlist.tracks]
return [("file", track.uri) for track in playlist.tracks if track.uri is not None]


@protocol.commands.add("listplaylistinfo")
Expand All @@ -83,7 +83,7 @@ def listplaylistinfo(context: MpdContext, name: str) -> protocol.Result:
Album, Artist, Track
"""
playlist = _get_playlist(context, name, must_exist=True)
track_uris = [track.uri for track in playlist.tracks]
track_uris = [track.uri for track in playlist.tracks if track.uri is not None]
tracks_map = context.core.library.lookup(uris=track_uris).get()
tracks = []
for uri in track_uris:
Expand Down Expand Up @@ -180,7 +180,7 @@ def load(
"tuple[Track]",
playlist.tracks[playlist_slice], # pyright: ignore[reportIndexIssue]
)
track_uris = [track.uri for track in tracks]
track_uris = [track.uri for track in tracks if track.uri is not None]
context.core.tracklist.add(uris=track_uris).get()


Expand Down Expand Up @@ -358,6 +358,7 @@ def rename(context: MpdContext, old_name: str, new_name: str) -> None:
_check_playlist_name(new_name)

old_playlist = _get_playlist(context, old_name, must_exist=True)
assert old_playlist.uri

if _get_playlist(context, new_name, must_exist=False):
raise exceptions.MpdExistError("Playlist already exists")
Expand Down