Hey everyone! I’m hoping there is someone out there how can help with compiling an agent that will work for Movie Mountain. I am specifically asking because they have a very comprehensive index of gay titles… And the other agents I’ve found so far (specifically Adult DVD Empire and Adult Film DB) do a great job with straight titles, but return absolute garbage for gay titles.
I am admittedly very amateur with scripting anything, so I have had a swing at modifying the existing AdultDVDEmpire agent… So thanks to all who have been involved in getting IT up and running!
A couple differences I have found between AdultDVDEmpire and Movie Mountain:
- Movie Mountain uses “type=1” for gay listings and “type=2” for straight - which should allow a customized pair of agents to be easily created depending on your proclivity.
- A text search of a movie title returns a listing which strips direct text titles and instead has links to the relevant product ID, which is about the only useful data returned from the initial query. Following the link returns the product page which as all of the other goodies.
Any help in taking this further than I have been able to would be immensely appreciated! … Or any help un-mincing what I’ve done to the script would be great too
Here is the modified work i’ve attempted so far, with some notes included:
MovieMountain
import re
URLS
MMG_BASEURL = ‘http://www.moviemountain.com/’
MMG_PHOTO_BASEURL = ‘http://images.freyacomm.com/ShopKeeper/products/ximages/’
MMG_PHOTO_URL = MMG_PHOTO_BASEURL + ‘%s’ + ‘xf.jpg’ #HELP Base URL + Returned product ID Code after scoring results
MMG_SEARCH_MOVIES = MMG_BASEURL + ‘index.cfm?Zmethod=Verity_Search&type=1&SearchValue=%s’
MMG_MOVIE_INFO = MMG_BASEURL + ‘index.cfm?Zmethod=product&ID=’ #HELP ID=Returned Prod ID Code after scoring results
def Start():
HTTP.CacheTime = CACHE_1DAY
HTTP.SetHeader(‘User-agent’, ‘Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.2; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0)’)
class MMOAgent(Agent.Movies):
name = ‘Movie Mountain - Gay’
languages = [Locale.Language.English]
primary_provider = True
def ParseScene(self,title,filename):
Log(“ParseScene: checking " + title)
# Special case: if the filename has a number in brackets, that’s the scene number, but Plex eats it
# so we have to check the filename rather than title
result = re.search(r”([\d{1,2}])",filename)
if result:
sceneNumber = result.group(1)
return “Scene " + sceneNumber
# If it’s an intro, credits, trailer, etc, use that name
if re.search(r”(^intro$)",title,re.IGNORECASE):
return “Intro”
if re.search(r"(opening\scredits|open\scredits)",title,re.IGNORECASE):
return “Opening credits”
if re.search(r"(ending\scredits|end\scredits)",title,re.IGNORECASE):
return “End credits”
if re.search(r"^end$",title,re.IGNORECASE):
return “End”
if re.search(r"^credits$",title,re.IGNORECASE):
return “Credits”
result = re.match(r"(s?\d{1,2}\s|scene\s?\d{1,2}|sc?\s?\d{1,2}\s|[\d{1,2}])(.)",title,re.IGNORECASE)
if result:
Log(“Got scene match: " + result.group(1))
scene = result.group(1)
extra = result.group(2)
# We have S01 or Scene1 or Sc1 or something, get the numbers
result = re.search(r”(\d+)",scene)
return “Scene " + scene.strip() + " : " + extra.strip()
# If the title is in the form “Movie name - Scene XX”, get scene name
result = re.search(r”(.+)\s(scene\s?\d{1,2}|s\d{1,2}|sc\d{1,2})(?:\s|$|,)(.)",title,re.IGNORECASE)
if result:
Log(“Got embedded scene number” + result.group(2))
scene = result.group(2)
extra = result.group(3)
result = re.search(r"(\d+)",scene)
return “Scene " + scene.strip() + " : " + extra.strip()
return False
def search(self, results, media, lang):
title = media.name
Log(“Processing " + title)
if media.primary_metadata is not None:
title = media.primary_metadata.title
if title.startswith(‘The ‘):
if title.count(’:’):
title = title.split(’:’,1)[0].replace(‘The ‘,’’,1) + ‘, The:’ + title.split(’:’,1)[1]
else:
title = title.replace(‘The ‘,’’,1) + ‘, The’
sceneName = self.ParseScene(title,media.items[0].parts[0].file.decode(‘utf-8’))
if (sceneName):
Log(“Got scene name '” + sceneName + “’, using parent dir name”)
file = media.items[0].parts[0].file.decode(‘utf-8’)
pathList = file.split(”/”)
pathList.pop()
parentPath = pathList.pop()
Log(“Parent path: " + parentPath)
# We don’t want to pass in the year if it’s there
title = re.sub(r’(\d{4})’,’’,parentPath)
# Replace dots and underscores with spaces
title = re.sub(r’[\s.]’,’ ',title)
Log(“Got title " + title)
# If our title includes metadata, remove it
result = re.search(r”(.?)(cheggit|bdrip|dvdrip|xxx\sdvdrip|720|split\s?scene|(split|xvid)",title,re.IGNORECASE)
if result:
Log(“Stripping scene info: " + result.group(2))
title = result.group(1)
Log(“New title: " + title)
# Special case: if our title has " 1” at the end, trim that
result = re.search(r”(.)\s1”,title)
if result:
Log(“Removing trailing ‘1’”)
title = result.group(1)
Log("New title: " + title)
query = String.URLEncode(String.StripDiacritics(title.replace(’-’,’’)))
for movie in HTML.ElementFromURL(MMO_SEARCH_MOVIES % query).xpath(’//div[contains(@class,“productName”)]/a’): #Help HERE
curName = movie.text_content().strip()
curID = movie.get(‘href’).split(’/’,2)[1]
score = 100 - Util.LevenshteinDistance(title.lower(), curName.lower())
if score >= 85:
if curName.count(’, The’):
curName = ‘The ’ + curName.replace(’, The’,’’,1)
if curName.count(’, A’):
curName = ‘A ’ + curName.replace(’, A’,’’,1)
if sceneName:
# ISSUE: If you set one file’s title to hold the scene name, all files in that dir are
# affected (you end up with 5 files called “movie : scene 5”)
#curName = curName + " : " + sceneName
Log("Setting full title to " + curName)
results.Append(MetadataSearchResult(id = curID, name = curName, score = score, lang = lang))
results.Sort(‘score’, descending=True)
def update(self, metadata, media, lang):
html = HTML.ElementFromURL(MMO_MOVIE_INFO % metadata.id)
Log("Current metadata title: " + metadata.title)
Log("Current media title: " + media.title)
metadata.title = media.title
# Get Thumb and Poster
try:
img = html.xpath(’//div[@id=“ctl00_ContentPlaceHolder_ctl00_pnl_Default”]/a/img[contains(@src,“m.jpg”)]’)[0]
thumbUrl = img.get(‘src’)
thumb = HTTP.Request(thumbUrl)
posterUrl = img.get(‘src’).replace(‘m.jpg’,‘h.jpg’)
metadata.posters[posterUrl] = Proxy.Preview(thumb)
except:
pass
# Get tagline
try: metadata.tagline = html.xpath(’//span[@class=“descrShort”]’)[0].text_content().strip() #changed from original
except: pass
# Summary.
try:
metadata.summary = html.xpath(’//div[@class=“descrptLong”]’)[0].text_content().replace(’ ‘,’’).strip() #changed from original
if metadata.summary.find(metadata.tagline) != -1:
metadata.summary = metadata.summary.replace(metadata.tagline, ‘’).strip()
except: pass
# Other data.
data = {}
for div in html.xpath(’//div[@class=“info”]/div’):#changed from original
name, value = div.text_content().split(’:’)
data[name.strip()] = value.strip()
if data.has_key(‘Rating’):
metadata.content_rating = data[‘Rating’]
if data.has_key(‘productsingle’): #changed from original
metadata.studio = data[‘productsingle’] #changed from original
if data.has_key(‘Release Date’):
try:
metadata.originally_available_at = Datetime.ParseDate(data[‘Release Date’]).date()
metadata.year = metadata.originally_available_at.year
except: pass
#Get Cast
try:
metadata.roles.clear()
htmlcast = HTML.ElementFromURL(ADE_CAST_INFO % metadata.id)
for femcast in htmlcast.xpath(’//div[@class=“Item_Performer”]/a[@class=“Item_CastListPrimaryName”]’):
castf = femcast.text_content().strip()
if ((castf != “Bio”) and (castf != “Interview”) and (len(castf) > 0)):
role = metadata.roles.new()
role.actor = castf
# Log(“Update Femalecast: %s” % (role.actor))
for malecast in htmlcast.xpath(’//td[@class=“Item_CastListSecondaryName”]/a[not(@class)]’):
castm = malecast.text_content().strip()
if ((castm != “(bio)”) and (castm != “(Interview)”) and (len(castm) > 0)):
role = metadata.roles.new()
role.actor = castm
# Log(“Update Malecast: %s” % (role.actor))
except: pass
Here is a clipping of additional sample info provided in the product page that is, of course important… But I have no idea how to properly include. The sample is based on the video “Entrapment” (source code located at the returned product ID page from the text search result page, in this case: http://www.moviemountain.com/index.cfm?Zmethod=product&ID=258675
Synopsis:
ENTRAPMENT highlights the ongoing struggle between New York City's gay community and the police department. Lucas Entertainment Exclusive Dimitri Romanov stars as an innocent bystander, roped into a sick game of cat and mouse. Only through sheer force of sexual will can he survive his imprisonment and sexual manipulation.
Format:
DVD
Studio:
Lucas Entertainment
Year:
2009
DVD Length:
120 Minutes
Director:
Michael Lucas
Pornstars:
Trae Angle
,
Vin Costes
,
Isaiah Foxx
,
Andrew James
,
Murphy Maxwell
,
Kayl O'Riley
,
Ryan Raz
,
Dimitri Romanov
,
Lars Svenson
Themes:
■■■■ Sex,
Blow Jobs/Oral Sex,
Cops,
Europeans,
Facials,
Interracial,
Muscular/Beefy,
Prisons,
Sports/Jocks,
Threesomes,
Uncut