extralifedonations

Grabs donor JSON data and outputs to files.

class eldonationtracker.extralifedonations.Participant(participant_conf)

Bases: object

Owns all the attributes under the participant API.

Also owns the results of any calculated data.

Participant.conf variables:

Parameters
  • ExtraLifeID (int) – the participant’s extra life ID

  • textFolder (str) – where the output txt files will be written on disk

  • CurrencySymbol (str) – for the output txt files

  • donors_to_display (int) – for txt files that display multiple donors (or donations), the number of them that should be written to the text file.

Donor Drive API api info at https://github.com/DonorDrive/PublicAPI

Donor Drive Variables:

Parameters
  • participant_url (str) – API info for participant

  • donorURL (str) – donation API info (should be renamed to donationURL)

  • participant_donor_URL (str) – API info for donors. Useful for calculating top donor.

  • participantinfo (dict) –

    a dictionary holding data from participantURL:

    • totalRaised: total money raised

    • numDonations: number of donations

    • averageDonation: this doesn’t come from the API, it’s calculated in this class.

    • goal: the participant’s fundraising goal

  • myteam (cls: eldonationtracker.team) – An instantiation of a team class for the participant’s team.

  • donationlist (list) – a list of Donation class ojects made of donations to this participant

Helper Variables:

Parameters
  • donorcalcs (dict) –

    a dictionary holding values for txt ouput:

    • LastDonationNameAmnt: most recent donation,

      donor name, amount of donation

    • TopDonorNameAmnt: top donor name and sum of donations

    • lastNDonationNameAmts: based on value of donors_to_display

      above, a list of the last N donor names and donation amounts

    • lastNDonationNameAmtsMessage: same with messages

    • lastNDonationNameAmtsMessageHorizontal: same, but horizontal

    • lastNDonationNameAmtsHorizontal: same, but no message

  • loop (bool) – set to true on init, it’s there so that the GUI can stop the loop.(if the GUI is being used. Otherwise, no big deal)

run()

Run loop to get participant data.

This should run getParticipantJSON, getDonors, the calculations methnods, and the methods to write to text files.

Warning

This will be changed in a future version to no longer be a loop and instead the loop will be in the if __name__=__main__ part. This will make it more consistent with the way team.py works and will enable some better efficiencies with the GUI.

stop()

Stop the loop.

write_text_files(dictionary)

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.