completed more
This commit is contained in:
parent
fc98998cdb
commit
fab76fc165
@ -51,3 +51,12 @@ class Target(DatabaseObject):
|
||||
|
||||
def create_path(self):
|
||||
self._path.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
def copy_content(self, copy_to: "Target"):
|
||||
if not self.exists:
|
||||
return
|
||||
|
||||
with open(self.file_path, "rb") as read_from:
|
||||
copy_to.create_path()
|
||||
with open(self.file_path, "wb") as write_to:
|
||||
write_to.write(read_from.read())
|
||||
|
@ -312,6 +312,19 @@ class Page:
|
||||
if song.target_collection.empty:
|
||||
return
|
||||
|
||||
target: Target
|
||||
if any(target.exists for target in song.target_collection):
|
||||
existing_target: Target
|
||||
for existing_target in song.target_collection:
|
||||
if existing_target.exists:
|
||||
break
|
||||
|
||||
for target in song.target_collection:
|
||||
if target is existing_target:
|
||||
continue
|
||||
|
||||
existing_target.copy_content(target)
|
||||
|
||||
sources = song.source_collection.get_sources_from_page(cls.SOURCE_TYPE)
|
||||
if len(sources) == 0:
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user