Skip to content

Commit

Permalink
Fix to run script without setting start time.
Browse files Browse the repository at this point in the history
  • Loading branch information
PetterKraabol committed Mar 3, 2017
1 parent a603704 commit c8433b2
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ def getClientIdParameter():
# Used message ids
#
# Every message has an unique ID, which can be used for checking if we've already stored it.
# Querying a specific timestamp will return messages within the next 30 seconds
messageIds = []

# Open output file
Expand Down Expand Up @@ -155,12 +154,12 @@ def getClientIdParameter():
while timestamp <= stop:

# Wait for cooldown timer and request new messages from Twitch
# The API returns the next 30 seconds of messages
time.sleep(settings['cooldown'])
response = requests.get(apiUrl + '?start=' + str(timestamp) + '&video_id=' + videoId).json()
data = response['data'];

# Increase timestamp by 30 to get the next 30
# seconds of messages in next loop
# Increase timestamp to get the next 30 seconds of messages in the next loop
timestamp += 30

for message in data:
Expand Down Expand Up @@ -213,7 +212,7 @@ def getClientIdParameter():
if percentage > 100.0:
percentage = 100.0

sys.stdout.write('Downloading ' + str(int(message['time'] - start - arguments.start)) + '/' + str(stop - start - arguments.start) + 's (' + str(percentage) + '%) \r')
sys.stdout.write('Downloading ' + str(int(message['time'] - start)) + '/' + str(stop - start) + 's (' + str(percentage) + '%) \r')
sys.stdout.flush()

# Close file
Expand Down

0 comments on commit c8433b2

Please sign in to comment.