Skip to content

Commit

Permalink
restructure for v1 (#99)
Browse files Browse the repository at this point in the history
* remove remote.core.processors package

* finalise restructure

* clean up code

* update release history
  • Loading branch information
geo-martino authored Jun 11, 2024
1 parent 86acb28 commit c7fed14
Show file tree
Hide file tree
Showing 93 changed files with 469 additions and 870 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from p3 import *

from musify.libraries.remote.spotify.processors import SpotifyDataWrangler
from musify.libraries.remote.spotify.wrangle import SpotifyDataWrangler

playlist = asyncio.run(load_playlist("<PATH TO A PLAYLIST>", remote_wrangler=SpotifyDataWrangler()))
2 changes: 1 addition & 1 deletion docs/_howto/scripts/local.track.load-save/p1_wrangler.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from p1_load import *

from musify.libraries.remote.spotify.processors import SpotifyDataWrangler
from musify.libraries.remote.spotify.wrangle import SpotifyDataWrangler

track = asyncio.run(load_track("<PATH TO A TRACK>", remote_wrangler=SpotifyDataWrangler()))
2 changes: 1 addition & 1 deletion docs/_howto/scripts/setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import logging
import sys

from musify.log import STAT
from musify.logger import STAT

logging.basicConfig(format="%(message)s", level=STAT, stream=sys.stdout)
4 changes: 2 additions & 2 deletions docs/_howto/scripts/sync/p1.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

from musify.libraries.core.collection import MusifyCollection
from musify.libraries.remote.core.factory import RemoteObjectFactory
from musify.libraries.remote.core.processors.search import RemoteItemSearcher
from musify.libraries.remote.core.processors.check import RemoteItemChecker
from musify.processors.search import RemoteItemSearcher
from musify.processors.check import RemoteItemChecker
from musify.processors.match import ItemMatcher


Expand Down
7 changes: 7 additions & 0 deletions docs/release-history.rst
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,11 @@ Changed
* :py:class:`.RemoteItemChecker` also uses the new :py:meth:`.RemoteAPI.follow_playlist` method
when creating playlists to ensure that a user is following the playlists it creates to avoid 'ghost playlist' issue.
* :py:meth:`.SpotifyAPI.create_playlist` now returns the full response rather than just the URL of the playlist.
* Moved :py:class:`.RemoteItemChecker` and :py:class:`.RemoteItemSearcher` to `musify.processors` package.
* Moved :py:class:`.RemoteDataWrangler` up a level to `musify.libraries.remote.core`.
* Renamed `musify.libraries.remote.spotify.processors` module to `musify.libraries.remote.spotify.wrangle`.
* Moved `musify.logger` module to `musify` base package.
* Restructured contents of `musify.core` package to modules in `musify` base package.

Fixed
-----
Expand Down Expand Up @@ -128,6 +133,8 @@ Removed
* ThreadPoolExecutor use on :py:class:`.RemoteItemSearcher`. Now uses asynchronous logic instead.
* `last_modified` field as attribute to ignore when getting attributes
to print on `LocalCollection` to improve performance
* Removed logger filters and handlers. Moved to CLI repo.
* Deleted `musify.libraries.remote.core.processors` package.

Documentation
-------------
Expand Down
2 changes: 1 addition & 1 deletion musify/api/authorise.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

from musify import PROGRAM_NAME
from musify.api.exception import APIError
from musify.log.logger import MusifyLogger
from musify.logger import MusifyLogger


class APIAuthoriser:
Expand Down
4 changes: 2 additions & 2 deletions musify/api/cache/backend/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
from datetime import datetime, timedelta
from typing import Any, Self

from dateutil.relativedelta import relativedelta
from aiohttp import RequestInfo, ClientRequest, ClientResponse
from dateutil.relativedelta import relativedelta
from yarl import URL

from musify.api.exception import CacheError
from musify.log.logger import MusifyLogger
from musify.logger import MusifyLogger
from musify.types import UnitCollection
from musify.utils import to_collection

Expand Down
2 changes: 1 addition & 1 deletion musify/api/cache/backend/sqlite.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
from tempfile import gettempdir
from typing import Any, Self

from dateutil.relativedelta import relativedelta
from aiohttp import RequestInfo, ClientRequest, ClientResponse
from dateutil.relativedelta import relativedelta
from yarl import URL

from musify import PROGRAM_NAME
Expand Down
2 changes: 1 addition & 1 deletion musify/api/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from musify.api.cache.backend import ResponseCache
from musify.api.cache.session import CachedSession
from musify.api.exception import APIError, RequestError
from musify.log.logger import MusifyLogger
from musify.logger import MusifyLogger
from musify.utils import clean_kwargs


Expand Down
14 changes: 12 additions & 2 deletions musify/core/base.py → musify/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,22 @@
from __future__ import annotations

from abc import ABCMeta, abstractmethod
from dataclasses import dataclass
from typing import Any

from musify.core.enum import TagField
from musify.core.printer import AttributePrinter
from musify.field import TagField
from musify.printer import AttributePrinter


@dataclass(frozen=True)
class Result(metaclass=ABCMeta):
"""Stores the results of an operation"""
pass


###########################################################################
## Core item/object types
###########################################################################
class MusifyObject(AttributePrinter, metaclass=ABCMeta):
"""Generic base class for any nameable and taggable object."""

Expand Down
3 changes: 0 additions & 3 deletions musify/core/__init__.py

This file was deleted.

Loading

0 comments on commit c7fed14

Please sign in to comment.