calliope.utils
¶
Utility functions for resolving items
Module Contents¶
Classes¶
Action to take for tracks which have "featured artists" listed. |
Functions¶
|
Remove featuring artists from title and append them to the artist string |
|
Delete all fields with None value from dct. |
|
Parse a potentially incomplete date string of the format YYYY-MM-DD and |
|
Get the value from a nested dict/list data structure, returning None if one |
|
Find the ISRCs of item and return them as list |
- class calliope.utils.FeatMode(*args, **kwds)¶
Bases:
enum.Enum
Action to take for tracks which have “featured artists” listed.
- KEEP¶
- DROP¶
- TO_CREATOR¶
- TO_TITLE¶
- calliope.utils.normalize_creator_title(creator, title, feat_mode=FeatMode.TO_CREATOR)¶
Remove featuring artists from title and append them to the artist string
- Parameters:
creator (Optional[str]) –
title (Optional[str]) –
- Return type:
Tuple[Optional[str], Optional[str]]
- calliope.utils.drop_none_values(dct)¶
Delete all fields with None value from dct.
- Parameters:
dct (calliope.playlist.Item) –
- Return type:
calliope.playlist.Item
- calliope.utils.parse_sort_date(date_str)¶
Parse a potentially incomplete date string of the format YYYY-MM-DD and return a datetime.date object with conservative defaults for missing data.
- Parameters:
date_str (Optional[str]) –
- Return type:
Optional[datetime.date]
- calliope.utils.get_nested(sequence, keys)¶
Get the value from a nested dict/list data structure, returning None if one of the keys is invalid.
- Parameters:
sequence (Dict) –
keys (Iterable) –
- calliope.utils.get_isrcs(el)¶
Find the ISRCs of item and return them as list