participant¶
Grabs Participant JSON data and outputs to files.
-
class
eldonationtracker.participant.
Participant
(participant_conf)¶ Bases:
object
Owns all the attributes under the participant API.
Also owns the results of any calculated data.
Donor Drive API api info at https://github.com/DonorDrive/PublicAPI
- Parameters
self.extralife_id (int) – the participant’s extra life ID
self.text_folder (str) – where the output text files will be written on disk
self.currency_symbol (str) – for the output text files
self.donors_to_display (int) – for text files that display multiple donors (or donations), the number of them that should be written to the text file.
self.participant_url (str) – API info for participant
self.donation_url (str) – donation API info
self.participant_donor_url (str) – API info for donors. Useful for calculating top donor.
self.total_raised (int) – total amount raised by the participant
self.number_of_donations (int) – the number of donations received by the participant
self.average_donation (int) – The average amount of donations for this participant
self.goal (int) – The goal for the amount of the money the participant wishes to raise
self.participant_formatted_output (dict) – a dictionary holding data about the participant
self.my_team (cls: eldonationtracker.team) – An instantiation of a team class for the participant’s team.
self.donation_list (list) – a list of Donation class objects made of donations to this participant
self.donation_formatted_output (dict) – a dictionary holding values for txt output
-
output_donation_data
() → None¶ Write out text files for donation data.
If there have been donations, format the data (eg horizontally, vertically, etc) and output to text files. If there have not yet been donations, write default data to the files.
-
output_donor_data
() → None¶ Write out text files for donor data.
If there have been donations, format the data (eg horizontally, vertically, etc) and output to text files. If there have not yet been donations, write default data to the files.
-
output_participant_data
() → None¶ Format participant data and write to text files for use by OBS or XSplit.
A public method to do the above. Also called from the main loop.
-
run
() → None¶ Run to get participant, donation, donor, and team data and output to text files.
-
update_donation_data
() → None¶ Update donation data.
As of 5.0 it just updates the list of donations. There may be more donation-related updating in future versions.
-
update_donor_data
() → None¶ Update donor data.
As of 5.0 it only grabs the top donor. There may be more donor-related updates in the future.
-
update_participant_attributes
() → None¶ Update participant attributes.
A public method that will update the Participant object with data from self.participant_url.
Also called from the main loop.
-
write_text_files
(dictionary: dict) → None¶ Write OBS/XSplit display info to text files.
It uses the helper function extralife_IO.write_text_files to handle the task.
- Parameters
dictionary (dict) – Dictionary containing values to write to text files . The key will become the filename. The value will be written to the file.