from storj_gui_client.UI.utilities import account_manager
from storj_gui_client.UI.engine import StorjEngine

# Module for mirrors for OwnStorj

storj_engine = StorjEngine()  # init StorjEngine

class OwnStorjMirrors:
    def __init__(self, bucket_id, file_id):
        self.mirrors_data  = storj_engine.storj_client.file_mirrors(str(bucket_id), str(file_id))

    def get_established_mirrors_array(self):
        divider = 0
        recent_shard_hash = ''
        established_mirrors_count_for_file = 0
        for file_mirror in self.mirrors_data:
            for mirror in file_mirror.established:
                established_mirrors_count_for_file += 1
                if mirror['shardHash'] != recent_shard_hash:
                    divider = divider + 1

                recent_shard_hash = mirror['shardHash']

    def get_available_mirrors_array(self):
        divider = 0
        recent_shard_hash = ''
        established_mirrors_count_for_file = 0
        for file_mirror in self.mirrors_data:
            for mirror in file_mirror.available:
                established_mirrors_count_for_file += 1
                if mirror['shardHash'] != recent_shard_hash:
                    divider = divider + 1

                recent_shard_hash = mirror['shardHash']

@@ -1,30 +1,13 @@
 from 
-storj_gui_client.
 UI.utili
@@ -43,25 +43,8 @@
 rom 
-storj_gui_client.
 UI.e
@@ -1209,28 +1209,655 @@
 _hash = mirror%5B'shardHash'%5D%0A
+%0A    def get_mirrors_array(self):%0A        return self.mirrors_data%0A%0A    def calculate_geodistribution(self, countries_array):%0A%0A        total_countries = len(countries_array)%0A%0A        country_counting_array = %7B%7D%0A        country_percent_array = %7B%7D%0A        countries_array_deduplicated = list(set(countries_array))%0A        for country_code in countries_array_deduplicated:%0A            country_counting_array%5Bcountry_code%5D = countries_array.count(country_code)%0A            country_percent_array%5Bcountry_code%5D = countries_array.count(country_code) / total_countries%0A%0A        return country_counting_array, country_percent_array%0A%0A%0A%0A%0A

Add geodistribution calculator