fietsboek.views.browse module¶
Views for browsing all tracks.
- class fietsboek.views.browse.FavouriteFilter(user, favourite)¶
Bases:
FilterA
Filterthat 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:
Trueif the track matches.
- class fietsboek.views.browse.Filter¶
Bases:
objectA 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:
Trueif the track matches.
- class fietsboek.views.browse.FilterCollection(filters)¶
Bases:
FilterA 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:
Trueif 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:
FilterA
Filterthat 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:
Trueif the track matches.
- class fietsboek.views.browse.PersonFilter(names)¶
Bases:
FilterA
Filterthat 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:
Trueif the track matches.
- class fietsboek.views.browse.ResultOrder(*values)¶
Bases:
EnumEnum 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:
FilterA
Filterthat 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:
Trueif the track matches.
- class fietsboek.views.browse.Stream¶
Bases:
RawIOBaseA
Streamrepresents 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:
FilterA
Filterthat 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:
Trueif the track matches.
- class fietsboek.views.browse.UserTaggedFilter(user)¶
Bases:
FilterA
Filterthat 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:
Trueif the track matches.
- fietsboek.views.browse.apply_order(query, track, order)¶
Applies a
ORDER BYclause 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.