本文整理匯總了Python中extractor.Extractor.add_to_queue方法的典型用法代碼示例。如果您正苦於以下問題:Python Extractor.add_to_queue方法的具體用法?Python Extractor.add_to_queue怎麽用?Python Extractor.add_to_queue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類extractor.Extractor
的用法示例。
在下文中一共展示了Extractor.add_to_queue方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: Track
# 需要導入模塊: from extractor import Extractor [as 別名]
# 或者: from extractor.Extractor import add_to_queue [as 別名]
fname = metadata.pop('fname')
t = Track(fname, metadata)
t.save()
#def save_and_quit(extractor):
# for meta in extractor.metadata:
# fname = meta.pop('fname')
# t = Track(fname, meta)
# t.save()
# loop.quit()
Gst.init()
ex = Extractor()
for f in argv[1:]:
path = os.path.abspath(f)
if not Track.exists(path):
ex.add_to_queue(path)
else:
print(f, 'exists in dabase. Skiping')
loop = GLib.MainLoop()
ex.eos.connect(save)
ex.finished.connect(lambda ex: loop.quit())
#ex.finished.connect(save_and_quit)
ex.start()
loop.run()
示例2: save_and_quit
# 需要導入模塊: from extractor import Extractor [as 別名]
# 或者: from extractor.Extractor import add_to_queue [as 別名]
from gi.repository import Gst
from gi.repository import GLib
from models import Track
import os
MUSIC_DIR = '/home/isra/Music'
def save_and_quit(extractor):
for meta in extractor.metadata:
fname = meta.pop('fname')
t = Track(fname, meta)
t.save()
loop.quit()
Gst.init()
ex = Extractor()
for f in os.listdir('/home/isra/Music'):
if f[-4:] == '.mp3':
print (f)
ex.add_to_queue(os.path.join(MUSIC_DIR, f))
loop = GLib.MainLoop()
ex.finished.connect(save_and_quit)
ex.start()
loop.run()