package to abstract the database from the rest of the code.
Bases: int
A simple subclass of int to support formatting on it without having to know the exact format or value in the rest of the code.
Bases: exceptions.Exception
Raised when a Song instance accesses Track only attributes without having an audio file attached to it.
Bases: list
A simple subclass of list to support some extra attributes.
This class is returned when you access Track.plays and is a collection of play times of the Track in question.
The collection contains datetime.datetime objects or objects that act the same as such with extra methods (for future additions).
Adds a played entry to the Track object.
The exact time it was played at. :params time: A datetime.datetime instance.
The DJ that played this track at the time. :params dj: A hanyuu.abstractions.users.DJ instance.
Returns None: |
---|
Note
It’s good practice to add the DJ argument to all the code already.
The current database however ignores this argument.
Removes a played entry from the Track object.
The time this was played at. :params time: A datetime.datetime instance.
The DJ that played this track at the time. If this is None it will be ignored otherwise it will be used for exact matching. :params dj: A hanyuu.abstractions.users.DJ instance.
Returns None: |
---|
Note
Currently the dj argument is completely ignored.
Bases: list
A simple subclass of list to support some extra attributes.
Bases: object
An instance of a known track in our database. This can also be used for adding new tracks.
A ‘known’ track is one we have seen before. This means there is no difference between tracks we have an audio file of and ones we only know metadata of. The object easily allows you to check if it has a corresponding audio file available or not.
Returns unicode: | |
---|---|
The filename of the audio file. | |
Raises : | NoTrackEntry if the song has no audio file. |
Note
This is relative to the configured media.directory configuration.
Returns unicode: | |
---|---|
The full path to the audio file. | |
Raises : | NoTrackEntry if the song has no audio file. |
Returns an instance based on the esong table ID.
Warning
Don’t use this method in production code.
Returns an instance based on the tracks table ID.
Warning
Don’t use this method in production code.
Returns: | Length of the song or 0 if none available. |
---|---|
Return type: | Length |
Note
The song length is only 100% accurate if the song has an audio file available. Otherwise it’s an approximation from when it was last played.
Returns: | A metadata string of ‘[artist -] title’ where artist is optional |
---|---|
Return type: | unicode |
Note
This uses the tracks table if available before trying the other table.
Opens the associated file and returns a file object.
This handles the path finding for you.
Params unicode mode: | |
---|---|
The mode to be passed to the open() call. | |
Returns: | An open file object. |
Raises : | NoTrackEntry if the song has no audio file. |
Returns: | A mutable objects with all request data in it. |
---|---|
Return type: | Requests |
Raises : | NoTrackEntry if the song has no audio file. |
Creates a ‘[artist -] title’ string of the hanyuu.db.models.Track instance.
Decorator that raises NoTrackEntry if the song instance has no associated audio file in the database.
Currently this only checks if self._track is falsy.
A module used for the abstractions of the users part of the database.
Bases: object
Encapsulates the concept of a DJ in our system.
This abstracts the database from the rest of the code. But does return a database related object since it’s a simple one.