本文整理匯總了Python中picard.cluster.UnmatchedFiles.add_files方法的典型用法代碼示例。如果您正苦於以下問題:Python UnmatchedFiles.add_files方法的具體用法?Python UnmatchedFiles.add_files怎麽用?Python UnmatchedFiles.add_files使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類picard.cluster.UnmatchedFiles
的用法示例。
在下文中一共展示了UnmatchedFiles.add_files方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: Tagger
# 需要導入模塊: from picard.cluster import UnmatchedFiles [as 別名]
# 或者: from picard.cluster.UnmatchedFiles import add_files [as 別名]
#.........這裏部分代碼省略.........
if self.nats is None:
self.nats = NatAlbum()
self.albums["NATS"] = self.nats
self.album_added.emit(self.nats)
return self.nats
def move_file_to_nat(self, file, recordingid, node=None):
self.create_nats()
file.move(self.nats.unmatched_files)
nat = self.load_nat(recordingid, node=node)
nat.run_when_loaded(partial(file.move, nat))
if nat.loaded:
self.nats.update()
def exit(self):
log.debug("exit")
self.stopping = True
self._acoustid.done()
self.thread_pool.waitForDone()
self.browser_integration.stop()
self.xmlws.stop()
for f in self.exit_cleanup:
f()
def _run_init(self):
if self._args:
files = []
for file in self._args:
if os.path.isdir(file):
self.add_directory(decode_filename(file))
else:
files.append(decode_filename(file))
if files:
self.add_files(files)
del self._args
def run(self):
if config.setting["browser_integration"]:
self.browser_integration.start()
self.window.show()
QtCore.QTimer.singleShot(0, self._run_init)
res = self.exec_()
self.exit()
return res
def event(self, event):
if isinstance(event, thread.ProxyToMainEvent):
event.run()
elif event.type() == QtCore.QEvent.FileOpen:
f = str(event.file())
self.add_files([f])
# We should just return True here, except that seems to
# cause the event's sender to get a -9874 error, so
# apparently there's some magic inside QFileOpenEvent...
return 1
return QtGui.QApplication.event(self, event)
def _file_loaded(self, file, target=None):
if file is not None and not file.has_error():
recordingid = file.metadata.getall('musicbrainz_recordingid')[0] \
if 'musicbrainz_recordingid' in file.metadata else ''
if target is not None:
self.move_files([file], target)
elif not config.setting["ignore_file_mbids"]:
albumid = file.metadata.getall('musicbrainz_albumid')[0] \
if 'musicbrainz_albumid' in file.metadata else ''
示例2: Tagger
# 需要導入模塊: from picard.cluster import UnmatchedFiles [as 別名]
# 或者: from picard.cluster.UnmatchedFiles import add_files [as 別名]
#.........這裏部分代碼省略.........
album.run_when_loaded(partial(album.match_file, file, trackid))
def create_nats(self):
if self.nats is None:
self.nats = NatAlbum()
self.albums["NATS"] = self.nats
self.album_added.emit(self.nats)
return self.nats
def move_file_to_nat(self, file, trackid, node=None):
self.create_nats()
file.move(self.nats.unmatched_files)
nat = self.load_nat(trackid, node=node)
nat.run_when_loaded(partial(file.move, nat))
if nat.loaded:
self.nats.update()
def exit(self):
self.stopping = True
self._acoustid.done()
self.thread_pool.stop()
self.browser_integration.stop()
self.xmlws.stop()
def _run_init(self):
if self._args:
files = []
for file in self._args:
if os.path.isdir(file):
self.add_directory(decode_filename(file))
else:
files.append(decode_filename(file))
if files:
self.add_files(files)
del self._args
def run(self):
self.browser_integration.start()
self.window.show()
QtCore.QTimer.singleShot(0, self._run_init)
res = self.exec_()
self.exit()
return res
def event(self, event):
if event.type() == QtCore.QEvent.FileOpen:
f = str(event.file())
self.add_files([f])
# We should just return True here, except that seems to
# cause the event's sender to get a -9874 error, so
# apparently there's some magic inside QFileOpenEvent...
return 1
return QtGui.QApplication.event(self, event)
def _file_loaded(self, target, result=None, error=None):
file = result
if file is not None and error is None and not file.has_error():
trackid = file.metadata['musicbrainz_trackid']
if target is not None:
self.move_files([file], target)
elif not self.config.setting["ignore_file_mbids"]:
albumid = file.metadata['musicbrainz_albumid']
if mbid_validate(albumid):
if mbid_validate(trackid):
self.move_file_to_track(file, albumid, trackid)
else:
示例3: Tagger
# 需要導入模塊: from picard.cluster import UnmatchedFiles [as 別名]
# 或者: from picard.cluster.UnmatchedFiles import add_files [as 別名]
#.........這裏部分代碼省略.........
album.run_when_loaded(partial(album.match_file, file, trackid))
def create_nats(self):
if self.nats is None:
self.nats = NatAlbum()
self.albums["NATS"] = self.nats
self.album_added.emit(self.nats)
return self.nats
def move_file_to_nat(self, file, trackid, node=None):
self.create_nats()
file.move(self.nats.unmatched_files)
nat = self.load_nat(trackid, node=node)
nat.run_when_loaded(partial(file.move, nat))
if nat.loaded:
self.nats.update()
def exit(self):
self.stopping = True
self._acoustid.done()
self.thread_pool.waitForDone()
self.browser_integration.stop()
self.xmlws.stop()
def _run_init(self):
if self._args:
files = []
for file in self._args:
if os.path.isdir(file):
self.add_directory(decode_filename(file))
else:
files.append(decode_filename(file))
if files:
self.add_files(files)
del self._args
def run(self):
self.browser_integration.start()
self.window.show()
QtCore.QTimer.singleShot(0, self._run_init)
res = self.exec_()
self.exit()
return res
def event(self, event):
if isinstance(event, thread.ProxyToMainEvent):
event.run()
elif event.type() == QtCore.QEvent.FileOpen:
f = str(event.file())
self.add_files([f])
# We should just return True here, except that seems to
# cause the event's sender to get a -9874 error, so
# apparently there's some magic inside QFileOpenEvent...
return 1
return QtGui.QApplication.event(self, event)
def _file_loaded(self, file, target=None):
if file is not None and not file.has_error():
trackid = file.metadata['musicbrainz_trackid']
if target is not None:
self.move_files([file], target)
elif not config.setting["ignore_file_mbids"]:
albumid = file.metadata['musicbrainz_albumid']
if mbid_validate(albumid):
if mbid_validate(trackid):
self.move_file_to_track(file, albumid, trackid)
示例4: Tagger
# 需要導入模塊: from picard.cluster import UnmatchedFiles [as 別名]
# 或者: from picard.cluster.UnmatchedFiles import add_files [as 別名]
#.........這裏部分代碼省略.........
def create_nats(self):
if self.nats is None:
self.nats = NatAlbum()
self.albums["NATS"] = self.nats
self.album_added.emit(self.nats)
return self.nats
def move_file_to_nat(self, file, trackid, node=None):
self.create_nats()
file.move(self.nats.unmatched_files)
nat = self.load_nat(trackid, node=node)
nat.run_when_loaded(partial(file.move, nat))
if nat.loaded:
self.nats.update()
def exit(self):
self.stopping = True
self._ofa.done()
self._acoustid.done()
self.thread_pool.stop()
self.browser_integration.stop()
self.xmlws.stop()
def _run_init(self):
if self._args:
files = []
for file in self._args:
if os.path.isdir(file):
self.add_directory(decode_filename(file))
else:
files.append(decode_filename(file))
if files:
self.add_files(files)
del self._args
def run(self):
self.browser_integration.start()
self.window.show()
QtCore.QTimer.singleShot(0, self._run_init)
res = self.exec_()
self.exit()
return res
def event(self, event):
if event.type() == QtCore.QEvent.FileOpen:
f = str(event.file())
self.add_files([f])
# We should just return True here, except that seems to
# cause the event's sender to get a -9874 error, so
# apparently there's some magic inside QFileOpenEvent...
return 1
return QtGui.QApplication.event(self, event)
def _file_loaded(self, result=None, error=None):
file = result
if file is not None and error is None and not file.has_error():
puid = file.metadata["musicip_puid"]
trackid = file.metadata["musicbrainz_trackid"]
self.puidmanager.add(puid, trackid)
if not self.config.setting["ignore_file_mbids"]:
albumid = file.metadata["musicbrainz_albumid"]
if mbid_validate(albumid):
if mbid_validate(trackid):
self.move_file_to_track(file, albumid, trackid)
else: