Check

Inheritance diagram of musify.libraries.remote.core.processors.check

Processor operations that help a user to check whether the currently matched ID is valid for given items.

Provides the user the ability to modify associated IDs using a Remote player as an interface for reviewing matches through temporary playlist creation.

Classes:

ItemCheckResult([switched, unavailable, skipped])

Stores the results of the checking process.

RemoteItemChecker(matcher, object_factory[, ...])

Runs operations for checking the URIs associated with a collection of items.

class musify.libraries.remote.core.processors.check.ItemCheckResult(switched=(), unavailable=(), skipped=())

Bases: Result, Generic

Stores the results of the checking process.

Attributes:

switched

Sequence of Items that had URIs switched during the check.

unavailable

Sequence of Items that were marked as unavailable.

skipped

Sequence of Items that were skipped from the check.

switched: Sequence[TypeVar(T, bound= MusifyItemSettable)] = ()

Sequence of Items that had URIs switched during the check.

unavailable: Sequence[TypeVar(T, bound= MusifyItemSettable)] = ()

Sequence of Items that were marked as unavailable.

skipped: Sequence[TypeVar(T, bound= MusifyItemSettable)] = ()

Sequence of Items that were skipped from the check.

class musify.libraries.remote.core.processors.check.RemoteItemChecker(matcher, object_factory, interval=10, allow_karaoke=False)

Bases: InputProcessor

Runs operations for checking the URIs associated with a collection of items.

When running check(), the object will do the following:
  • Make temporary playlists for each collection up to a interval limit of playlists. At which point, playlist creation pauses.

  • User can then check and modify the temporary playlists to match items to correct items or otherwise.

  • When operations resume at the user’s behest, the program will search each playlist to find changes and attempt to match any new items to a source item.

  • If no matches are found for certain items, the program will prompt the user to determine how they wish to deal with these items.

  • Operation completes once user exists or all items have an associated URI.

Parameters:
  • matcher (ItemMatcher) – The ItemMatcher to use when comparing any changes made by the user in remote playlists during the checking operation

  • object_factory (RemoteObjectFactory) – The RemoteObjectFactory to use when creating new remote objects. This must have a RemoteAPI assigned for this processor to work as expected.

  • interval (int (default: 10)) – Stop creating playlists after this many playlists have been created and pause for user input.

  • allow_karaoke (bool (default: False)) – When True, items determined to be karaoke are allowed when matching switched items. Skip karaoke results otherwise. Karaoke items are identified using the karaoke_tags attribute.

Attributes:

api

The RemoteAPI to call

logger

The MusifyLogger for this object

matcher

The ItemMatcher to use when comparing any changes made by the user in remote playlists during the checking operation

factory

The RemoteObjectFactory to use when creating new remote objects.

interval

Stop creating playlists after this many playlists have been created and pause for user input

allow_karaoke

Allow karaoke items when matching on switched items

Methods:

check(collections)

Run the checker for the given collections.

as_dict()

Return a dictionary representation of the key attributes of this object.

property api: RemoteAPI

The RemoteAPI to call

logger: MusifyLogger

The MusifyLogger for this object

matcher

The ItemMatcher to use when comparing any changes made by the user in remote playlists during the checking operation

factory

The RemoteObjectFactory to use when creating new remote objects.

interval

Stop creating playlists after this many playlists have been created and pause for user input

allow_karaoke

Allow karaoke items when matching on switched items

check(collections)

Run the checker for the given collections.

Parameters:

collections (Collection[MusifyCollection[TypeVar(T, bound= MusifyItemSettable)]]) – A list of collections to check.

Returns:

Optional[ItemCheckResult[TypeVar(T, bound= MusifyItemSettable)]] – A ItemCheckResult object containing the remapped items created during the check. Return None when the user opted to quit (not skip) the checker before completion.

as_dict()

Return a dictionary representation of the key attributes of this object.

Return type:

dict[str, Any]

The results of this function are used to produce the following:
  • A JSON representation of the object when calling json()

  • The string representation of the object when calling str() on the object

  • The representation of the object when calling repr() on the object