Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Console final report enhancement #476

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
28 changes: 18 additions & 10 deletions TwitchChannelPointsMiner/TwitchChannelPointsMiner.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,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 @@ -457,7 +457,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 @@ -486,12 +486,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 @@ -149,9 +149,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