Ejemplo n.º 1
0
def getSubject(uri, metadata, modules):
    
    pool = MainloopThreadPool()
    engine = Engine(pool)
    for module in modules:
        engine.registerModule(module)    

    def c(error, subject):
        if error:
            raise error

        print subject
        pool.quit()
    
    subject = Subject("", metadata)

    print "Running heimdall upon", subject

    engine.get(subject, c)

    try:
        pool.join()
    except KeyboardInterrupt:
        pool.quit()

    return subject
Ejemplo n.º 2
0
def main(uri):
    if uri == None:
        uri = "file:///E:\\Games\\Testsets\\Scraper tests\\The Legend of Zelda - Links Awakening DX.gbc"

    if urlparse.urlparse(uri).scheme == "":
        uri = urlparse.urlunparse(("file", "", uri, "", "", ""))

    print "Running Heimdall upon:", uri

    pool = MainloopThreadPool()
    engine = Engine(pool)
    engine.registerModule(item.module)
    engine.registerModule(game_item.module)
    engine.registerModule(thegamesdb.module)

    def c(error, subject):
        if error:
            pass
            #raise error
        print subject
        pool.quit()

    metadata = dict()
    metadata[dc.identifier] = uri
    subject = Subject("", metadata)

    engine.get(subject, c)

    try:
        pool.join()
    except KeyboardInterrupt:
        pool.quit()
Ejemplo n.º 3
0
def main(uri):
    if uri == None:
        uri = "file:///E:/Games/Testsets/RCB 3.0/SNES/Roms/Super Mario Kart.zip"

    if urlparse.urlparse(uri).scheme == "":
        uri = urlparse.urlunparse(("file", "", uri, "", "", ""))

    print "Running heimdall upon", uri

    pool = MainloopThreadPool()
    engine = Engine(pool)
    engine.registerModule(item.module)
    engine.registerModule(thegamesdb.module)

    def c(error, subject):
        if error:
            raise error

        print subject
        pool.quit()

    metadata = dict()
    metadata[dc.identifier] = uri
    metadata['itemtype'] = 'game'
    metadata['platform'] = 'Super Nintendo (SNES)'
    
    #TODO How to pass configuration to scraper?
    metadata['pathboxfront'] = 'E:\\Games\\Testsets\\Scraper Tests\\SNES\\Artwork\\boxfront'
    metadata['pathfanart'] = 'E:\\Games\\Testsets\\Scraper Tests\\SNES\\Artwork\\fanart'
    subject = Subject("", metadata)

    print "Running heimdall upon", subject

    engine.get(subject, c)

    try:
        pool.join()
    except KeyboardInterrupt:
        pool.quit()
Ejemplo n.º 4
0
def main(folder):
    print "Running heimdall on folder", folder
    pool = MainloopThreadPool()
    engine = Engine(pool)
    engine.registerModule(themoviedb.module)
    engine.registerModule(theaudiodb.module)
    engine.registerModule(item.module)
    engine.registerModule(video_item.module)
    engine.registerModule(audio_item.module)
    engine.registerModule(media_item.module)

    subjects = list()

    fileList = []
    for root, subFolders, files in os.walk(folder):
        for f in files:
            p = os.path.join("file://", root, f)
            fileList.append(p)

    print "Files to process", len(fileList)

    fileList = fileList[:]

    nbrBeforeQuit = len(fileList)

    def c(error, subject):
        if error:
            raise error

        print subject
        subjects.append(subject)

        if len(subjects) >= nbrBeforeQuit:
            pool.quit()

    for uri in fileList:
        metadata = dict()
        metadata[dc.identifier] = uri
        subject = Subject("", metadata)

        engine.get(subject, c)

    try:
        pool.join()
    except KeyboardInterrupt:
        pool.quit()

    print "done"
Ejemplo n.º 5
0
def main(uri):
    if uri == None:
        uri = "file:///home/SomeUser/movies/Horrible Bosses.mkv" # A file which doesn't exist, just used for testing

    if urlparse.urlparse(uri).scheme == "":
        uri = urlparse.urlunparse(("file", "", uri, "", "", ""))

    print "Running heimdall upon", uri

    pool = MainloopThreadPool()
    engine = Engine(pool)
    engine.registerModule(themoviedb.module)
    engine.registerModule(theaudiodb.module)
    engine.registerModule(item.module)
    engine.registerModule(video_item.module)
    engine.registerModule(audio_item.module)
    engine.registerModule(media_item.module)

    def c(error, subject):
        if error:
            raise error

        print subject
        pool.quit()

    metadata = dict()
    metadata[dc.identifier] = uri
    subject = Subject("", metadata)

    print "Running heimdall upon", subject

    engine.get(subject, c)

    try:
        pool.join()
    except KeyboardInterrupt:
        pool.quit()