Skip to content

Commit

Permalink
Merge pull request #63 from jodal/layout+deprecations
Browse files Browse the repository at this point in the history
Change project layout and fix deprecations
  • Loading branch information
jodal authored Feb 23, 2024
2 parents b0521f8 + 3f39c74 commit 09a780e
Show file tree
Hide file tree
Showing 41 changed files with 26 additions and 26 deletions.
15 changes: 7 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
*.egg-info
*.pyc
/.coverage
/.mypy_cache/
/.pytest_cache/
/.tox/
/*.egg-info
/build/
/dist/
/MANIFEST
.coverage
.mypy_cache/
.pytest_cache/
.tox/
build/
dist/
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ ignore = [
]

[tool.ruff.lint.per-file-ignores]
"mopidy_mpd/protocol/*" = [
"src/mopidy_mpd/protocol/*" = [
"ARG001", # unused-function-argument
]
"tests/*" = [
Expand Down
4 changes: 2 additions & 2 deletions mopidy_mpd/__init__.py → src/mopidy_mpd/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import pathlib
from importlib.metadata import version

import pkg_resources
from mopidy import config, ext

__version__ = pkg_resources.get_distribution("Mopidy-MPD").version
__version__ = version("Mopidy-MPD")


class Extension(ext.Extension):
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def play(context, songpos=None):

try:
tl_track = context.core.tracklist.slice(songpos, songpos + 1).get()[0]
return context.core.playback.play(tl_track).get()
return context.core.playback.play(tlid=tl_track.tlid).get()
except IndexError as exc:
raise exceptions.MpdArgError("Bad song index") from exc

Expand All @@ -191,11 +191,11 @@ def _play_minus_one(context):

current_tl_track = context.core.playback.get_current_tl_track().get()
if current_tl_track is not None:
return context.core.playback.play(current_tl_track).get()
return context.core.playback.play(tlid=current_tl_track.tlid).get()

tl_tracks = context.core.tracklist.slice(0, 1).get()
if tl_tracks:
return context.core.playback.play(tl_tracks[0]).get()
return context.core.playback.play(tlid=tl_tracks[0].tlid).get()

return None # Fail silently

Expand Down Expand Up @@ -223,7 +223,7 @@ def playid(context, tlid):
tl_tracks = context.core.tracklist.filter({"tlid": [tlid]}).get()
if not tl_tracks:
raise exceptions.MpdNoExistError("No such song")
return context.core.playback.play(tl_tracks[0]).get()
return context.core.playback.play(tlid=tl_tracks[0].tlid).get()


@protocol.commands.add("previous")
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion tests/network/test_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

import pykka
from gi.repository import GLib

from mopidy_mpd import network

from tests import any_int, any_unicode


Expand Down
1 change: 1 addition & 0 deletions tests/network/test_lineprotocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from unittest.mock import Mock, sentinel

from mopidy_mpd import network

from tests import any_unicode


Expand Down
2 changes: 1 addition & 1 deletion tests/network/test_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
from unittest.mock import Mock, patch, sentinel

from gi.repository import GLib

from mopidy_mpd import network

from tests import any_int


Expand Down
2 changes: 1 addition & 1 deletion tests/protocol/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

import pykka
from mopidy import core

from mopidy_mpd import session, uri_mapper

from tests import dummy_audio, dummy_backend, dummy_mixer


Expand Down
1 change: 1 addition & 0 deletions tests/protocol/test_connection.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from unittest.mock import patch

from mopidy_mpd.protocol import tagtype_list

from tests import protocol


Expand Down
1 change: 1 addition & 0 deletions tests/protocol/test_idle.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from unittest.mock import patch

from mopidy_mpd.protocol.status import SUBSYSTEMS

from tests import protocol


Expand Down
2 changes: 1 addition & 1 deletion tests/protocol/test_music_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
from unittest import mock

from mopidy.models import Album, Artist, Playlist, Ref, SearchResult, Track

from mopidy_mpd.protocol import music_db, stored_playlists

from tests import protocol

# TODO: split into more modules for faster parallel tests?
Expand Down
2 changes: 1 addition & 1 deletion tests/protocol/test_regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
from unittest import mock

from mopidy.models import Playlist, Ref, Track

from mopidy_mpd.protocol import stored_playlists

from tests import protocol


Expand Down
2 changes: 1 addition & 1 deletion tests/protocol/test_stored_playlists.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from unittest import mock

from mopidy.models import Playlist, Track

from mopidy_mpd.protocol import stored_playlists

from tests import protocol


Expand Down
1 change: 0 additions & 1 deletion tests/test_actor.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from unittest import mock

import pytest

from mopidy_mpd import actor

# NOTE: Should be kept in sync with all events from mopidy.core.listener
Expand Down
2 changes: 1 addition & 1 deletion tests/test_dispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
import pytest
from mopidy import core
from mopidy.models import Ref

from mopidy_mpd.dispatcher import MpdContext, MpdDispatcher
from mopidy_mpd.exceptions import MpdAckError
from mopidy_mpd.uri_mapper import MpdUriMapper

from tests import dummy_backend


Expand Down
1 change: 0 additions & 1 deletion tests/test_exceptions.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import unittest

import pytest

from mopidy_mpd.exceptions import (
MpdAckError,
MpdNoCommandError,
Expand Down
2 changes: 1 addition & 1 deletion tests/test_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
from mopidy import core
from mopidy.core import PlaybackState
from mopidy.models import Track

from mopidy_mpd import dispatcher
from mopidy_mpd.protocol import status

from tests import dummy_audio, dummy_backend, dummy_mixer

PAUSED = PlaybackState.PAUSED
Expand Down
2 changes: 1 addition & 1 deletion tests/test_translator.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import unittest

from mopidy.models import Album, Artist, Playlist, TlTrack, Track

from mopidy_mpd import translator
from mopidy_mpd.protocol import tagtype_list

from tests import path_utils


Expand Down

0 comments on commit 09a780e

Please sign in to comment.