Skip to content

Commit

Permalink
Merge pull request #476 from Petrarka0/report
Browse files Browse the repository at this point in the history
Console final report enhancement
  • Loading branch information
rdavydov authored Oct 6, 2024
2 parents 9ccf689 + 7f2f548 commit de07741
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 12 deletions.
28 changes: 18 additions & 10 deletions TwitchChannelPointsMiner/TwitchChannelPointsMiner.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def is_connected():
self.claim_drops_startup = claim_drops_startup
self.priority = priority if isinstance(priority, list) else [priority]

self.streamers = []
self.streamers: list[Streamer] = []
self.events_predictions = {}
self.minute_watcher_thread = None
self.sync_campaigns_thread = None
Expand Down Expand Up @@ -459,7 +459,7 @@ def __print_report(self):
extra={"emoji": ":hourglass:"},
)

if self.events_predictions != {}:
if not Settings.logger.less and self.events_predictions != {}:
print("")
for event_id in self.events_predictions:
event = self.events_predictions[event_id]
Expand Down Expand Up @@ -488,12 +488,20 @@ def __print_report(self):
self.streamers[streamer_index].channel_points
- self.original_streamers[streamer_index]
)
logger.info(
f"{repr(self.streamers[streamer_index])}, Total Points Gained (after farming - before farming): {_millify(gained)}",
extra={"emoji": ":robot:"},

from colorama import Fore
streamer_highlight = Fore.YELLOW

streamer_gain = (
f"{streamer_highlight}{self.streamers[streamer_index]}{Fore.RESET}, Total Points Gained: {_millify(gained)}"
if Settings.logger.less
else f"{streamer_highlight}{repr(self.streamers[streamer_index])}{Fore.RESET}, Total Points Gained (after farming - before farming): {_millify(gained)}"
)
if self.streamers[streamer_index].history != {}:
logger.info(
f"{self.streamers[streamer_index].print_history()}",
extra={"emoji": ":moneybag:"},
)

indent = ' ' * 25
streamer_history = '\n'.join(f"{indent}{history}" for history in self.streamers[streamer_index].print_history().split('; '))

logger.info(
f"{streamer_gain}\n{streamer_history}",
extra={"emoji": ":moneybag:"},
)
4 changes: 2 additions & 2 deletions TwitchChannelPointsMiner/classes/entities/Streamer.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,9 @@ def set_online(self):
)

def print_history(self):
return ", ".join(
return "; ".join(
[
f"{key}({self.history[key]['counter']} times, {_millify(self.history[key]['amount'])} gained)"
f"{key} ({self.history[key]['counter']} times, {_millify(self.history[key]['amount'])} gained)"
for key in sorted(self.history)
if self.history[key]["counter"] != 0
]
Expand Down

0 comments on commit de07741

Please sign in to comment.