Skip to content

Commit

Permalink
[HardDisk]
Browse files Browse the repository at this point in the history
* improve debug print
  • Loading branch information
jbleyel committed Jan 8, 2025
1 parent 4b900aa commit 781f8d4
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions lib/python/Components/Harddisk.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,30 +405,30 @@ def init(self):

def debugPrint(self, text):
if self.debug:
print(text)
print(f"[{MODULE_NAME}] DEBUG: {text}")

def refreshMountPoints(self):
# Remove old mounts
self.debugPrint(f"[Harddisk] DEBUG refreshMountPoints")
self.debugPrint(f"refreshMountPoints")
for partition in self.partitions:
if partition.mountpoint and partition.mountpoint != "/":
newMountpoint = self.getMountpoint(partition.device)
if partition.mountpoint != newMountpoint:
self.debugPrint(f"[Harddisk] DEBUG remove mountpoint old: {partition.mountpoint} / new: {newMountpoint}")
self.debugPrint(f"remove mountpoint old: {partition.mountpoint} / new: {newMountpoint}")
self.triggerAddRemovePartion("remove", partition=partition)
partition.mountpoint = newMountpoint

# Add new mount
for partition in self.partitions:
if partition.mountpoint != "/":
newMountpoint = self.getMountpoint(partition.device)
self.debugPrint(f"[Harddisk] DEBUG add mountpoint old: {partition.mountpoint} / new: {newMountpoint}")
self.debugPrint(f"add mountpoint old: {partition.mountpoint} / new: {newMountpoint}")
if newMountpoint and partition.mountpoint != newMountpoint:
partition.mountpoint = newMountpoint
self.triggerAddRemovePartion("add", partition=partition)

def refresh(self, disk):
self.debugPrint(f"[Harddisk] DEBUG refresh", disk)
self.debugPrint(f"refresh", disk)
removeList = []
appedList = []
oldPartitions = []
Expand Down Expand Up @@ -631,12 +631,12 @@ def getMountpoint(self, device):
return None

def triggerAddRemovePartion(self, action, partition):
self.debugPrint(f"[Harddisk] {action} partition {partition.device} -> {partition.mountpoint}")
self.debugPrint(f"{action} partition {partition.device} -> {partition.mountpoint}")
self.on_partition_list_change(action, partition)

def addHotplugPartition(self, device, physdev=None, model=None):
device = device.replace("/dev/", "")
self.debugPrint(f"[Harddisk] DEBUG addHotplugPartition {device}")
self.debugPrint(f"addHotplugPartition {device}")
# device -> the device name, without /dev.
# physdev -> the physical device path, which we (might) use to determine the user friendly name.
if not physdev:
Expand Down Expand Up @@ -682,7 +682,7 @@ def addHotplugAudiocd(self, device, physdev=None):

def removeHotplugPartition(self, device):
device = device.replace("/dev/", "")
self.debugPrint(f"[Harddisk] DEBUG removeHotplugPartition {device}")
self.debugPrint(f"removeHotplugPartition {device}")
for x in self.partitions[:]:
if x.device == device:
self.partitions.remove(x)
Expand Down

0 comments on commit 781f8d4

Please sign in to comment.