WIP: Initial work on deduplicating the minifigures and parts #57
@ -52,8 +52,8 @@ class RebrickableSet(BrickRecord):
|
|||||||
if record is not None:
|
if record is not None:
|
||||||
self.ingest(record)
|
self.ingest(record)
|
||||||
|
|
||||||
# Import the set from Rebrickable
|
# Insert the set from Rebrickable
|
||||||
def download_rebrickable(self, /) -> None:
|
def insert_rebrickable(self, /) -> bool:
|
||||||
# Insert the Rebrickable set to the database
|
# Insert the Rebrickable set to the database
|
||||||
rows, _ = self.insert(
|
rows, _ = self.insert(
|
||||||
commit=False,
|
commit=False,
|
||||||
@ -61,10 +61,14 @@ class RebrickableSet(BrickRecord):
|
|||||||
override_query=RebrickableSet.insert_query
|
override_query=RebrickableSet.insert_query
|
||||||
)
|
)
|
||||||
|
|
||||||
if rows > 0:
|
inserted = rows > 0
|
||||||
|
|
||||||
|
if inserted:
|
||||||
if not current_app.config['USE_REMOTE_IMAGES']:
|
if not current_app.config['USE_REMOTE_IMAGES']:
|
||||||
RebrickableImage(self).download()
|
RebrickableImage(self).download()
|
||||||
|
|
||||||
|
return inserted
|
||||||
|
|
||||||
# Ingest a set
|
# Ingest a set
|
||||||
def ingest(self, record: Row | dict[str, Any], /):
|
def ingest(self, record: Row | dict[str, Any], /):
|
||||||
super().ingest(record)
|
super().ingest(record)
|
||||||
|
@ -54,7 +54,7 @@ class BrickSet(RebrickableSet):
|
|||||||
self.insert(commit=False)
|
self.insert(commit=False)
|
||||||
|
|
||||||
# Execute the parent download method
|
# Execute the parent download method
|
||||||
self.download_rebrickable()
|
self.insert_rebrickable()
|
||||||
|
|
||||||
# Load the inventory
|
# Load the inventory
|
||||||
RebrickableParts(self.socket, self).download()
|
RebrickableParts(self.socket, self).download()
|
||||||
|
Loading…
Reference in New Issue
Block a user