Esempio n. 1
0
 def share_size(self, share_uuid, human_readable=False):
     """Total size of share."""
     share_size_mb = self.get_share(share_uuid).get("share_quota_used")
     # Share size is returned in MB so we convert it.
     share_size_bytes = SynoFormatHelper.megabytes_to_bytes(share_size_mb)
     if human_readable:
         return SynoFormatHelper.bytes_to_readable(share_size_bytes)
     return share_size_bytes
Esempio n. 2
0
 def volume_size_used(self, volume_id, human_readable=False):
     """Total used size in volume."""
     volume = self.get_volume(volume_id)
     if volume.get("size"):
         return_data = int(volume["size"]["used"])
         if human_readable:
             return SynoFormatHelper.bytes_to_readable(return_data)
         return return_data
     return None
Esempio n. 3
0
 def memory_available_swap(self, human_readable=False):
     """Total available memory swap."""
     if self.memory:
         # Memory is actually returned in KB's so multiply before converting
         return_data = int(self._data["memory"]["avail_swap"]) * 1024
         if human_readable:
             return SynoFormatHelper.bytes_to_readable(return_data)
         return return_data
     return None
Esempio n. 4
0
 def memory_cached(self, human_readable=False):
     """Total cached memory."""
     if self.memory:
         # Memory is actually returned in KB's so multiply before converting
         return_data = int(self._data["memory"]["cached"]) * 1024
         if human_readable:
             return SynoFormatHelper.bytes_to_readable(return_data)
         return return_data
     return None
Esempio n. 5
0
 def network_down(self, human_readable=False):
     """Total download speed being used."""
     network = self._get_network("total")
     if network:
         return_data = int(network["rx"])
         if human_readable:
             return SynoFormatHelper.bytes_to_readable(return_data)
         return return_data
     return None