Beispiel #1
0
def posterAlreadyExists(posterUrl, metadata):
    posterUrl = PAutils.getClearURL(posterUrl)
    for url in metadata.posters.keys():
        if url.lower() == posterUrl.lower():
            Log('Found %s in posters collection' % posterUrl)
            return True

    for url in metadata.art.keys():
        if url.lower() == posterUrl.lower():
            Log('Found %s in art collection' % posterUrl)
            return True

    return False
    def processActors(self, metadata):
        for actorLink in self.actorsTable:
            skip = False
            # Save the potential new Actor or Actress to a new variable, replace   with a true space, and strip off any surrounding whitespace
            actorName = actorLink['name'].replace('\xc2\xa0', ' ').replace(',', '').strip().title()
            actorPhoto = actorLink['photo'].strip()

            actorName = ' '.join(actorName.split())

            # Skip an actor completely; this could be used to filter out male actors if desired
            if not actorName:
                skip = True
            elif actorName == 'Bad Name':
                skip = True
            elif actorName == 'Test Model Name':
                skip = True

            if not skip:
                searchStudioIndex = None
                for studioIndex, studioList in PAdatabaseActors.ActorsStudioIndexes.items():
                    if metadata.studio in studioList:
                        searchStudioIndex = studioIndex
                        break

                searchActorName = actorName.lower()
                if searchStudioIndex is not None and searchStudioIndex in PAdatabaseActors.ActorsReplaceStudios:
                    for newActorName, aliases in PAdatabaseActors.ActorsReplaceStudios[searchStudioIndex].items():
                        if searchActorName == newActorName.lower() or searchActorName in map(str.lower, aliases):
                            actorName = newActorName

                            if searchStudioIndex == 32 and actorName != 'QueenSnake':
                                actorName = '%s QueenSnake' % actorName

                            break

                for newActorName, aliases in PAdatabaseActors.ActorsReplace.items():
                    if searchActorName == newActorName.lower() or searchActorName in map(str.lower, aliases):
                        actorName = newActorName
                        break

                if ',' in actorName:
                    for newActor in actorName.split(','):
                        actorName = newActor.strip()
                        displayActorName = actorName.replace('\xc2\xa0', '').strip()
                        actorPhoto = actorDBfinder(displayActorName)

                        Log('Actor: %s %s' % (displayActorName, actorPhoto))

                        role = metadata.roles.new()
                        role.name = actorName
                        role.photo = actorPhoto
                else:
                    displayActorName = actorName.replace('\xc2\xa0', '').strip()
                    req = None
                    if actorPhoto:
                        req = PAutils.HTTPRequest(actorPhoto, 'HEAD', bypass=False)

                    if not req or not req.ok:
                        actorPhoto = actorDBfinder(displayActorName)

                    if actorPhoto:
                        actorPhoto = PAutils.getClearURL(actorPhoto)

                    Log('Actor: %s %s' % (displayActorName, actorPhoto))

                    role = metadata.roles.new()
                    role.name = actorName
                    role.photo = actorPhoto
Beispiel #3
0
    def processActors(self, metadata):
        actorsProcessed = 0
        while actorsProcessed < self.actorsNum:
            skip = False
            # Save the potentional new Actor or Actress to a new variable, replace &nbsp; with a true space, and strip off any surrounding whitespace
            newActor = self.actorsTable[actorsProcessed].replace('\xc2\xa0', ' ').replace(',', '').strip().title()
            newPhoto = str(self.photosTable[actorsProcessed]).strip()

            newActor = ' '.join(newActor.split())

            # Skip an actor completely; this could be used to filter out male actors if desired
            if newActor == 'Bad Name':
                skip = True
            elif newActor == 'Test Model Name':
                skip = True

            if not skip:
                searchStudioIndex = None
                for studioIndex, studioList in PAdatabaseActors.ActorsStudioIndexes.items():
                    if metadata.studio in studioList:
                        searchStudioIndex = studioIndex
                        break

                if searchStudioIndex is not None and searchStudioIndex in PAdatabaseActors.ActorsReplaceStudios:
                    for actorName, aliases in PAdatabaseActors.ActorsReplaceStudios[searchStudioIndex].items():
                        if newActor.lower() == actorName.lower() or newActor in aliases:
                            newActor = actorName

                            if searchStudioIndex == 32 and newActor != 'QueenSnake':
                                newActor = '%s QueenSnake' % newActor

                            break

                for actorName, aliases in PAdatabaseActors.ActorsReplace.items():
                    if newActor.lower() == actorName.lower() or newActor in aliases:
                        newActor = actorName
                        break

                if ',' in newActor:
                    for actorName in newActor.split(','):
                        newActorName = actorName.strip()
                        newPhoto = actorDBfinder(newActorName)

                        Log('Actor: %s %s' % (newActor, newPhoto))

                        role = metadata.roles.new()
                        role.name = newActor
                        role.photo = newPhoto
                else:
                    req = None
                    if newPhoto:
                        req = PAutils.HTTPRequest(newPhoto, 'HEAD')

                    if not req or not req.ok:
                        newPhoto = actorDBfinder(newActor)

                    newPhoto = PAutils.getClearURL(newPhoto)
                    Log('Actor: %s %s' % (newActor, newPhoto))

                    role = metadata.roles.new()
                    role.name = newActor
                    role.photo = newPhoto

                actorsProcessed = actorsProcessed + 1