fietsboek.views.browse module¶
Views for browsing all tracks.
- class fietsboek.views.browse.FavouriteFilter(user, favourite)¶
Bases:
Filter
A
Filter
that accepts only favoured or non-favoured tracks.- apply(track)¶
Check if the given track matches the filter.
- Parameters:
track (
TrackWithMetadata
) – The track to check.- Return type:
- Returns:
True
if the track matches.
- class fietsboek.views.browse.Filter¶
Bases:
object
A class representing a filter that the user can apply to the track list.
- apply(track)¶
Check if the given track matches the filter.
- Parameters:
track (
TrackWithMetadata
) – The track to check.- Return type:
- Returns:
True
if the track matches.
- class fietsboek.views.browse.FilterCollection(filters)¶
Bases:
Filter
A class that applies multiple
Filter
.- apply(track)¶
Check if the given track matches the filter.
- Parameters:
track (
TrackWithMetadata
) – The track to check.- Return type:
- Returns:
True
if the track matches.
- compile(query, track)¶
Compile the filter into the SQL query.
Returns the modified query.
This method is optional, as a pure-Python filtering can be done via
apply()
.
- class fietsboek.views.browse.LambdaFilter(compiler, matcher)¶
Bases:
Filter
A
Filter
that works by provided lambda functions.- apply(track)¶
Check if the given track matches the filter.
- Parameters:
track (
TrackWithMetadata
) – The track to check.- Return type:
- Returns:
True
if the track matches.
- class fietsboek.views.browse.PersonFilter(names)¶
Bases:
Filter
A
Filter
that looks for the given tagged people, based on their name.- apply(track)¶
Check if the given track matches the filter.
- Parameters:
track (
TrackWithMetadata
) – The track to check.- Return type:
- Returns:
True
if the track matches.
- class fietsboek.views.browse.ResultOrder(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
Enum
Enum representing the different ways in which the tracks can be sorted in the result.
- DATE_ASC = 'date-asc'¶
- DATE_DESC = 'date-desc'¶
- DURATION_ASC = 'duration-asc'¶
- DURATION_DESC = 'duration-desc'¶
- LENGTH_ASC = 'length-asc'¶
- LENGTH_DESC = 'length-desc'¶
- class fietsboek.views.browse.SearchFilter(search_terms)¶
Bases:
Filter
A
Filter
that looks for the given search terms.- apply(track)¶
Check if the given track matches the filter.
- Parameters:
track (
TrackWithMetadata
) – The track to check.- Return type:
- Returns:
True
if the track matches.
- class fietsboek.views.browse.Stream¶
Bases:
RawIOBase
A
Stream
represents an in-memory buffered FIFO.This is useful for the zipfile module, as it needs a file-like object, but we do not want to create an actual temporary file.
- class fietsboek.views.browse.TagFilter(tags)¶
Bases:
Filter
A
Filter
that looks for the given tags.- apply(track)¶
Check if the given track matches the filter.
- Parameters:
track (
TrackWithMetadata
) – The track to check.- Return type:
- Returns:
True
if the track matches.
- class fietsboek.views.browse.UserTaggedFilter(user)¶
Bases:
Filter
A
Filter
that looks for a specific user to be tagged.- apply(track)¶
Check if the given track matches the filter.
- Parameters:
track (
TrackWithMetadata
) – The track to check.- Return type:
- Returns:
True
if the track matches.
- fietsboek.views.browse.apply_order(query, track, order)¶
Applies a
ORDER BY
clause to the query.- Raises:
ValueError – If the given order does not exist.
- Parameters:
query (
Select
) – The query to adjust.order (
ResultOrder
) – The order, one of the values given above.
- Return type:
- Returns:
The modified query with the ORDER BY clause applied.
- fietsboek.views.browse.archive(request)¶
Packs multiple tracks into a single archive.