mirror of
https://github.com/fergalmoran/picard.git
synced 2026-02-22 15:44:59 +00:00
Minor code simplification
Use yield from in iterfiles, removed redundant logic when calling album.match_files
This commit is contained in:
@@ -142,11 +142,9 @@ class Album(DataObject, Item):
|
|||||||
|
|
||||||
def iterfiles(self, save=False):
|
def iterfiles(self, save=False):
|
||||||
for track in self.tracks:
|
for track in self.tracks:
|
||||||
for file in track.iterfiles():
|
yield from track.iterfiles()
|
||||||
yield file
|
|
||||||
if not save:
|
if not save:
|
||||||
for file in self.unmatched_files.iterfiles():
|
yield from self.unmatched_files.iterfiles()
|
||||||
yield file
|
|
||||||
|
|
||||||
def enable_update_metadata_images(self, enabled):
|
def enable_update_metadata_images(self, enabled):
|
||||||
self.update_metadata_images_enabled = enabled
|
self.update_metadata_images_enabled = enabled
|
||||||
|
|||||||
@@ -420,8 +420,7 @@ class ClusterList(list, Item):
|
|||||||
|
|
||||||
def iterfiles(self, save=False):
|
def iterfiles(self, save=False):
|
||||||
for cluster in self:
|
for cluster in self:
|
||||||
for file in cluster.iterfiles(save):
|
yield from cluster.iterfiles(save)
|
||||||
yield file
|
|
||||||
|
|
||||||
def can_save(self):
|
def can_save(self):
|
||||||
return len(self) > 0
|
return len(self) > 0
|
||||||
|
|||||||
@@ -336,11 +336,7 @@ class Tagger(QtWidgets.QApplication):
|
|||||||
"""Move `files` to tracks on album `albumid`."""
|
"""Move `files` to tracks on album `albumid`."""
|
||||||
if album is None:
|
if album is None:
|
||||||
album = self.load_album(albumid)
|
album = self.load_album(albumid)
|
||||||
if album.loaded:
|
album.match_files(files)
|
||||||
album.match_files(files)
|
|
||||||
else:
|
|
||||||
for file in list(files):
|
|
||||||
file.move(album.unmatched_files)
|
|
||||||
|
|
||||||
def move_file_to_album(self, file, albumid):
|
def move_file_to_album(self, file, albumid):
|
||||||
"""Move `file` to a track on album `albumid`."""
|
"""Move `file` to a track on album `albumid`."""
|
||||||
|
|||||||
Reference in New Issue
Block a user