A way to keep all time donations rather than monthly?


#1

Is there a way to make the txt files outputted display the top donator and donor lists from the start of time rather than on a monthly basis?


#2

No, there is not. There’s not really much of a reason to hold onto a “top of all time” for most users.


#3

What I do is simply make an additional txt file that you update manually when the Top dog is knocked off. Initially once you start taking donations that changes frequently. After a while the Top dog gets rather big and doesnt get updated frequently.


#4

I keep a all time top 5 txt as well. It actually seems to be quite a common thing. And the reason for keeping one is the same as for keeping and displaying any donation stats. It creates hype and people like seeing their name.


#5

Hello Streamers,

i have coded a little PERL script to save the TOP DOG of all Donations in a textfile.
If you have some basic knwoledge about programming this code is maybe usefull.
I using the Streamtip API:

#!/usr/bin/perl

#Code by LarsiTV using PERL
#Please note: This is only a quick and dirty solution
#I am sure a lot of people can improve this code massively

use LWP::Simple; #used module

$clientID = '123456789123456789123456'; #Enter your Client ID
$tokenID = 'abcdefghijklmnopqrstuvwxyz'; #Enter your Token ID

$apiurl = 'https://streamtip.com/api/tips/csv?client_id='.$clientID.'&access_token='.$tokenID; #using streamtip API
$csvfile = 'archive.csv'; 

while (true)
{
    getstore($apiurl, $csvfile); #download archive CSV
    
    open $csvdata, 'archive.csv';  #open CSV
    @csvtoarray=(<$csvdata>); #Read in CSV 
    close $csvdata; #close CSV
    unlink ("$csvfile"); #remove downloaded CSV file
    @sortedcsv=sort {(split(/\,/,$b))[1]<=>(split(/\,/,$a))[1]} @csvtoarray; #sort CSV, biggest donation to the top
    $firstrow="@sortedcsv[0]"; #safe first row
    @columnstoarray = split(',', $firstrow); #split first row
    $valueandname="@columnstoarray[1]@columnstoarray[2]"; #get amount and username column
    @remquotation = split('\"', $valueandname); #remove " signs
    $output="TOP DONATION: @remquotation[0]\$ from @remquotation[1]"; #get amount and username columns without " signs and add some text

    open OUT, ">topdonator.txt"; 
    print OUT "$output"; #save top donation to topdonator.txt
    close OUT;
    
    sleep(90); #wait 90 seconds to repeat
}

#6

You shouldn’t be using the CSV API for polling, and in which case I’ll be forced to break the functionality sooner rather than later if people do. We have JSON API for grabbing a limited number of tips.


#7

Oh i see. I write another Script next days. Maybe i can handle the limited number of tips with the JSON offset function.


#8

Just wanna let you know that there is a need of getting a topdonator of the day or a specific time period.


#9

You’re bumping a topic from 4 months ago. Please refer to stickied topics: