added a basis for configuration of X17 and X19 miners by getting pool info from config file.

This commit is contained in:
UpstreamData
2022-06-02 16:06:36 -06:00
parent 3ee49e6fd7
commit 4bbb9d0b08
5 changed files with 21 additions and 10 deletions

View File

@@ -76,3 +76,13 @@ SAMPLE CONFIG
} }
} }
""" """
def general_config_convert_pools(config: dict):
out_config = {}
pools = config.get("pool_groups")
if pools:
if len(pools) > 0:
pools = pools[0]
out_config = pools["pools"][:3]
return out_config

View File

@@ -7,6 +7,7 @@ class MinerData:
"""A Dataclass to standardize data returned from miners (specifically AnyMiner().get_data()) """A Dataclass to standardize data returned from miners (specifically AnyMiner().get_data())
:param ip: The IP of the miner as a str. :param ip: The IP of the miner as a str.
:param datetime: The time and date this data was generated.
:param model: The model of the miner as a str. :param model: The model of the miner as a str.
:param hostname: The network hostname of the miner as a str. :param hostname: The network hostname of the miner as a str.
:param hashrate: The hashrate of the miner in TH/s as a int. :param hashrate: The hashrate of the miner in TH/s as a int.

View File

@@ -4,6 +4,9 @@ from miners._types import S17 # noqa - Ignore access to _module
import httpx import httpx
# TODO add config
class BMMinerS17(BMMiner, S17): class BMMinerS17(BMMiner, S17):
def __init__(self, ip: str) -> None: def __init__(self, ip: str) -> None:
super().__init__(ip) super().__init__(ip)

View File

@@ -5,6 +5,9 @@ import httpx
import json import json
# TODO add config
class BMMinerS19(BMMiner, S19): class BMMinerS19(BMMiner, S19):
def __init__(self, ip: str) -> None: def __init__(self, ip: str) -> None:
super().__init__(ip) super().__init__(ip)

View File

@@ -1,32 +1,26 @@
from datetime import datetime, timedelta from io import BytesIO
from typing import List, Dict from typing import List, Dict
from data import MinerData
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
from matplotlib.ticker import MultipleLocator
from matplotlib.dates import DateFormatter from matplotlib.dates import DateFormatter
import numpy as np from matplotlib.ticker import MultipleLocator
from reportlab.lib import colors
from reportlab.lib.pagesizes import letter, inch from reportlab.lib.pagesizes import letter, inch
from reportlab.lib.styles import ( from reportlab.lib.styles import (
ParagraphStyle, ParagraphStyle,
TA_CENTER, # noqa - not declared in __all__ TA_CENTER, # noqa - not declared in __all__
) )
from reportlab.lib.utils import ImageReader
from reportlab.platypus import ( from reportlab.platypus import (
SimpleDocTemplate, SimpleDocTemplate,
KeepInFrame, KeepInFrame,
Table,
Image, Image,
Paragraph, Paragraph,
TableStyle,
PageBreak, PageBreak,
Spacer, Spacer,
) )
from io import BytesIO
from svglib.svglib import svg2rlg from svglib.svglib import svg2rlg
from data import MinerData
async def generate_pdf(data: Dict[str, List[MinerData]], file_loc): async def generate_pdf(data: Dict[str, List[MinerData]], file_loc):
doc = SimpleDocTemplate( doc = SimpleDocTemplate(