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:
|
Stores the results of the checking process. |
|
Runs operations for checking the URIs associated with a collection of items. |
- class musify.processors.check.ItemCheckResult(switched=(), unavailable=(), skipped=())
Bases:
Result
,Generic
Stores the results of the checking process.
Attributes:
Sequence of Items that had URIs switched during the check.
Sequence of Items that were marked as unavailable.
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.
Sequence of Items that were marked as unavailable.
-
skipped:
Sequence
[TypeVar
(T
, bound=MusifyItemSettable
)] = () Sequence of Items that were skipped from the check.
-
switched:
- class musify.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
) – TheItemMatcher
to use when comparing any changes made by the user in remote playlists during the checking operationobject_factory (
RemoteObjectFactory
) – TheRemoteObjectFactory
to use when creating new remote objects. This must have aRemoteAPI
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 thekaraoke_tags
attribute.
Attributes:
The
RemoteAPI
to callThe
MusifyLogger
for this objectThe
ItemMatcher
to use when comparing any changes made by the user in remote playlists during the checking operationThe
RemoteObjectFactory
to use when creating new remote objects.Stop creating playlists after this many playlists have been created and pause for user input
Allow karaoke items when matching on switched items
Methods:
check
(collections)Run the checker for the given
collections
.close
()Close the checker, deleting/syncing all active playlists and returning the result of the check.
as_dict
()Return a dictionary representation of the key attributes of this object.
-
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
- async 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
)]] – AItemCheckResult
object containing the remapped items created during the check. Return None when the user opted to quit (not skip) the checker before completion.
- async close()
Close the checker, deleting/syncing all active playlists and returning the result of the check.
- Return type:
ItemCheckResult
|None
- 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
- When running