Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor Directors, Actors, Producers and Collections #1843

Merged
merged 6 commits into from
Sep 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
166 changes: 165 additions & 1 deletion Contents/Code/PAactors.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

class PhoenixActors:
actorsTable = []
directorsTable = []
producersTable = []

def addActor(self, newActor, newPhoto):
newActor = newActor.encode('UTF-8') if isinstance(newActor, unicode) else newActor
Expand All @@ -16,9 +18,35 @@ def addActor(self, newActor, newPhoto):
'photo': newPhoto,
})

def addDirector(self, newDirector, newPhoto):
newDirector = newDirector.encode('UTF-8') if isinstance(newDirector, unicode) else newDirector
newPhoto = newPhoto.encode('UTF-8') if isinstance(newPhoto, unicode) else newPhoto

if newDirector not in [directorLink['name'] for directorLink in self.directorsTable]:
self.directorsTable.append({
'name': newDirector,
'photo': newPhoto,
})

def addProducer(self, newProducer, newPhoto):
newProducer = newProducer.encode('UTF-8') if isinstance(newProducer, unicode) else newProducer
newPhoto = newPhoto.encode('UTF-8') if isinstance(newPhoto, unicode) else newPhoto

if newProducer not in [producerLink['name'] for producerLink in self.producersTable]:
self.producersTable.append({
'name': newProducer,
'photo': newPhoto,
})

def clearActors(self):
self.actorsTable = []

def clearDirectors(self):
self.directorsTable = []

def clearProducers(self):
self.producersTable = []

def processActors(self, metadata, siteNum):
for actorLink in self.actorsTable:
skip = False
Expand Down Expand Up @@ -100,6 +128,142 @@ def processActors(self, metadata, siteNum):
role.name = actorName
role.photo = actorPhoto

def processDirectors(self, metadata, siteNum):
for directorLink in self.directorsTable:
skip = False
# Save the potential new Director to a new variable, replace   with a true space, and strip off any surrounding whitespace
directorName = PAutils.parseTitle(directorLink['name'].replace('\xc2\xa0', ' ').replace(',', '').strip().lower(), 0)
directorPhoto = directorLink['photo'].strip()

directorName = ' '.join(directorName.split())

# Skip an Director completely
if not directorName:
skip = True
elif directorName == 'Bad Name':
skip = True
elif directorName == 'Test Model Name':
skip = True

if not skip:
searchStudioIndex = None
for studioIndex, studioList in PAdatabaseActors.ActorsStudioIndexes.items():
if not siteNum == 684 and metadata.studio.lower() in map(str.lower, studioList) or PAsearchSites.getSearchSiteName(siteNum).lower() in map(str.lower, studioList):
searchStudioIndex = studioIndex
break

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

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

break

for newDirectorName, aliases in PAdatabaseActors.ActorsReplace.items():
if searchDirectorName == newDirectorName.lower() or searchDirectorName in map(str.lower, aliases):
directorName = newDirectorName
break

if ',' in directorName:
for newDirector in directorName.split(','):
directorName = newDirector.strip()
displayDirectorName = directorName.replace('\xc2\xa0', '').strip()

(directorPhoto, gender) = actorDBfinder(displayDirectorName, metadata)

Log('Director: %s %s' % (displayDirectorName, directorPhoto))
director = metadata.directors.new()
director.name = directorName
director.photo = directorPhoto
else:
displayDirectorName = directorName.replace('\xc2\xa0', '').strip()
req = None
if directorPhoto:
req = PAutils.HTTPRequest(directorPhoto, 'HEAD', bypass=False)

if not req or not req.ok:
(directorPhoto, gender) = actorDBfinder(displayDirectorName, metadata)

if directorPhoto:
directorPhoto = PAutils.getClearURL(directorPhoto)

Log('Director: %s %s' % (displayDirectorName, directorPhoto))
director = metadata.directors.new()
director.name = directorName
director.photo = directorPhoto

def processProducers(self, metadata, siteNum):
for producerLink in self.producersTable:
skip = False
# Save the potential new producer to a new variable, replace   with a true space, and strip off any surrounding whitespace
producerName = PAutils.parseTitle(producerLink['name'].replace('\xc2\xa0', ' ').replace(',', '').strip().lower(), 0)
producerPhoto = producerLink['photo'].strip()

producerName = ' '.join(producerName.split())

# Skip an producer completely
if not producerName:
skip = True
elif producerName == 'Bad Name':
skip = True
elif producerName == 'Test Model Name':
skip = True

if not skip:
searchStudioIndex = None
for studioIndex, studioList in PAdatabaseActors.ActorsStudioIndexes.items():
if not siteNum == 684 and metadata.studio.lower() in map(str.lower, studioList) or PAsearchSites.getSearchSiteName(siteNum).lower() in map(str.lower, studioList):
searchStudioIndex = studioIndex
break

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

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

break

for newProducerName, aliases in PAdatabaseActors.ActorsReplace.items():
if searchProducerName == newProducerName.lower() or searchProducerName in map(str.lower, aliases):
producerName = newProducerName
break

if ',' in producerName:
for newProducer in producerName.split(','):
producerName = newProducer.strip()
displayProducerName = producerName.replace('\xc2\xa0', '').strip()

(producerPhoto, gender) = actorDBfinder(displayProducerName, metadata)
Log('Producer: %s %s' % (displayProducerName, producerPhoto))

producer = metadata.producers.new()
producer.name = producerName
producer.photo = producerPhoto
else:
displayProducerName = producerName.replace('\xc2\xa0', '').strip()
req = None
if producerPhoto:
req = PAutils.HTTPRequest(producerPhoto, 'HEAD', bypass=False)

if not req or not req.ok:
(producerPhoto, gender) = actorDBfinder(displayProducerName, metadata)

if producerPhoto:
producerPhoto = PAutils.getClearURL(producerPhoto)

Log('Producer: %s %s' % (displayProducerName, producerPhoto))
producer = metadata.producers.new()
producer.name = producerName
producer.photo = producerPhoto


def actorDBfinder(actorName, metadata):
actorEncoded = urllib.quote(re.sub(r'(?<=\w)\.\s(?=\w\.)', '', actorName).replace('.', ''))
Expand Down Expand Up @@ -351,7 +515,7 @@ def getFromJavBus(actorName, actorEncoded, metadata):
actorPhotoURL = ''
actorID = ''

for id, names in PAdatabaseActors.actorsReplaceJavBusSearch.items():
for id, names in PAdatabaseActors.ActorsReplaceJavBusSearch.items():
if actorName.lower() in map(str.lower, names):
actorID = id
break
Expand Down
2 changes: 1 addition & 1 deletion Contents/Code/PAdatabaseActors.py
Original file line number Diff line number Diff line change
Expand Up @@ -6111,7 +6111,7 @@
}


actorsReplaceJavBusSearch = {
ActorsReplaceJavBusSearch = {
'm2c': ['Abeno Miku'],
'mxo': ['Aihara Sarii'],
'9qk': ['Aiki Yuu'],
Expand Down
45 changes: 14 additions & 31 deletions Contents/Code/PAsiteList.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@
import sitePlayboyPlus
import siteMeanaWolf
import siteAmourAngels
import networkR18
import networkBang
import siteVivid
import networkAdultEmpireCash
Expand Down Expand Up @@ -104,7 +103,6 @@
import networkVNA
import siteQueenSnake
import siteScrewMeToo
import siteBoxTruckSex
import siteAussieAss
import network5Kporn
import networkTeenCoreClub
Expand All @@ -122,7 +120,6 @@
import siteSicflics
import networkModelCentro
import siteAlettaOceanLive
import siteCulioneros
import networkPornWorld
import siteMormonGirlz
import sitePurgatoryX
Expand Down Expand Up @@ -964,7 +961,7 @@
767: ('AllAnal', 'https://tour.allanal.com', '/_next/data/'),
768: ('TurningTwistys', 'https://www.twistys.com', 'https://site-api.project1service.com'),
769: ('GirlCum', 'https://www.girlcum.com', '/video/'),
770: ('ZeroTolerance', 'http://www.ztod.com', '/videos?query='),
770: ('Zero Tolerance', 'http://www.ztod.com', '/videos?query='),
771: ('ClubFilly', 'http://www.clubfilly.com', '/scenefocus.php?vnum=V'),
772: ('Insex', 'https://www.insexondemand.com', '/iod/home.php?s='),
773: ('Sexuallybroken', 'https://www.insexondemand.com', '/iod/home.php?d=sexuallybroken.com&s='),
Expand Down Expand Up @@ -1006,7 +1003,7 @@
809: ('True Amateurs', 'https://www.trueamateurs.com', 'https://site-api.project1service.com'),
810: ('Hustler', 'https://hustler.com', '/api'),
811: ('AmourAngels', 'http://www.amourangels.com', '/z_cover_'),
812: ('JAV', 'https://www.r18.com', '/common/search/searchword='),
812: (),
813: ('Bang', 'https://www.bang.com', '/videos?term='),
814: ('Vivid', 'https://www.vivid.com', '/'),
815: ('JAYs POV', 'https://jayspov.net', '/MemberSceneSearch?q='),
Expand Down Expand Up @@ -1133,7 +1130,7 @@
936: ('FetishNetwork', 'http://www.kink.com', '/search?channelIds=fetishnetwork&q='),
937: ('FetishNetwork Male', 'http://www.kink.com', '/search?channelIds=fetishnetworkmale&q='),
938: ('ScrewMeToo', 'https://screwmetoo.com', '/?amp=1&s='),
939: ('Box Truck Sex', 'https://www.boxtrucksex.com', '/tour/search.php?query='),
939: (),
940: ('Aussie Ass', 'https://www.aussieass.com', '/models/'),
941: ('5Kporn', 'https://www.5kporn.com', '/episodes/search?search='),
942: ('5Kteens', 'https://www.5kporn.com', '/episodes/search?search='),
Expand Down Expand Up @@ -1234,17 +1231,17 @@
1037: ('GinaGerson', 'https://www.ginagerson.xxx', '/sapi/'),
1038: (),
1039: ('VinaSkyXXX', 'https://www.vinaskyxxx.com', '/sapi/'),
1040: ('Culioneros', 'http://www.pornditos.com', '/t1/videos/0_'),
1041: ('Sexo en Public', 'http://www.pornditos.com', '/t1/videos/0_'),
1042: ('Mi Primer Porno', 'http://www.pornditos.com', '/t1/videos/0_'),
1043: ('Por el Chiquito', 'http://www.pornditos.com', '/t1/videos/0_'),
1044: ('Chicas de Porno', 'http://www.pornditos.com', '/t1/videos/0_'),
1045: ('Tetangas Espanolas', 'http://www.pornditos.com', '/t1/videos/0_'),
1046: ('Costenas Locas', 'http://www.pornditos.com', '/t1/videos/0_'),
1047: ('Nalgas Grandes', 'http://www.pornditos.com', '/t1/videos/0_'),
1048: ('Tetonas Locas', 'http://www.pornditos.com', '/t1/videos/0_'),
1049: ('Chiva Culiona', 'http://www.pornditos.com', '/t1/videos/0_'),
1050: ('Cuchi Mami', 'http://www.pornditos.com', '/t1/videos/0_'),
1040: (),
1041: (),
1042: (),
1043: (),
1044: (),
1045: (),
1046: (),
1047: (),
1048: (),
1049: (),
1050: (),
1051: ('Bruce and Morgan', 'https://www.bruceandmorgan.net', '/sapi/'),
1052: ('Busted', 'https://www.cherrypimps.com', '/search.php?query='),
1053: ('Cheese.XXX', 'https://www.cherrypimps.com', '/search.php?query='),
Expand Down Expand Up @@ -1903,7 +1900,6 @@
('^btiu ', 'BigTitsinUniform '),
('^btlbd ', 'BigTitsLikeBigDicks '),
('^btra ', 'BigTitsRoundAsses '),
('^bts ', 'BoxTruckSex '),
('^burna ', 'BurningAngel '),
('^bwb ', 'BigWetButts '),
('^byngr ', 'Bang '),
Expand Down Expand Up @@ -2068,7 +2064,6 @@
('^plib ', 'PornstarsLikeitBig '),
('^pml ', 'PornMegaLoad '),
('^pop ', 'PervsOnPatrol '),
('^pornditos', 'Culioneros '),
('^ppu ', 'PublicPickups '),
('^prdi ', 'PrettyDirty '),
('^ps ', 'PropertySex '),
Expand Down Expand Up @@ -2682,10 +2677,6 @@ def getProviderFromSiteNum(siteNum):
elif siteNum == 811:
provider = siteAmourAngels

# JAV
elif siteNum == 812:
provider = networkR18

# Bang
elif siteNum == 813 or siteNum == 1365:
provider = networkBang
Expand Down Expand Up @@ -2870,10 +2861,6 @@ def getProviderFromSiteNum(siteNum):
elif siteNum == 938:
provider = siteScrewMeToo

# Box Truck Sex
elif siteNum == 939:
provider = siteBoxTruckSex

# Aussie Ass
elif siteNum == 940:
provider = siteAussieAss
Expand Down Expand Up @@ -2942,10 +2929,6 @@ def getProviderFromSiteNum(siteNum):
elif (1025 <= siteNum <= 1039) or siteNum == 1051 or siteNum == 1058 or siteNum == 1075 or siteNum == 1191 or siteNum == 1245:
provider = networkModelCentro

# Culioneros
elif (1040 <= siteNum <= 1050):
provider = siteCulioneros

# PornWorld
elif siteNum == 332 or (433 <= siteNum <= 439) or siteNum == 1057:
provider = networkPornWorld
Expand Down
19 changes: 19 additions & 0 deletions Contents/Code/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,19 @@ def update(self, metadata, media, lang):
valid_images = list()

HTTP.ClearCache()
metadata.collections.clear()

metadata.genres.clear()
movieGenres.clearGenres()

metadata.roles.clear()
movieActors.clearActors()

metadata.directors.clear()
movieActors.clearDirectors()

metadata.producers.clear()
movieActors.clearProducers()

Log('******UPDATE CALLED*******')

Expand All @@ -158,6 +169,14 @@ def update(self, metadata, media, lang):
Log('Actors')
movieActors.processActors(metadata, siteNum)

# Cleanup Directors and Add
Log('Directors')
movieActors.processDirectors(metadata, siteNum)

# Cleanup Producers and Add
Log('Producers')
movieActors.processProducers(metadata, siteNum)

# Add Content Rating
metadata.content_rating = 'XXX'

Expand Down
5 changes: 1 addition & 4 deletions Contents/Code/addActors.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ def update(metadata, lang, siteNum, movieGenres, movieActors, art):
metadata.title = sceneActors

# Studio
metadata.collections.clear()
if siteName:
metadata.studio = siteName
metadata.collections.add(siteName)
Expand All @@ -72,14 +71,12 @@ def update(metadata, lang, siteNum, movieGenres, movieActors, art):
metadata.year = metadata.originally_available_at.year

# Genres
movieGenres.clearGenres()
for genreLink in sceneGenres.split(','):
genreName = genreLink.strip()

movieGenres.addGenre(genreName)

# Actors
movieActors.clearActors()
# Actor(s)
for actorLink in sceneActors.split(','):
actorName = actorLink.strip()
actorPhotoURL = ''
Expand Down
Loading