176 lines
5.6 KiB
Python
176 lines
5.6 KiB
Python
# -*- coding: utf-8 -*-
|
|
# vStream https://github.com/Kodi-vStream/venom-xbmc-addons
|
|
# jordigarnacho
|
|
|
|
import re
|
|
|
|
from resources.lib.gui.hoster import cHosterGui
|
|
from resources.lib.gui.gui import cGui
|
|
from resources.lib.handler.inputParameterHandler import cInputParameterHandler
|
|
from resources.lib.handler.outputParameterHandler import cOutputParameterHandler
|
|
from resources.lib.handler.requestHandler import cRequestHandler
|
|
from resources.lib.parser import cParser
|
|
from resources.lib.comaddon import progress
|
|
|
|
SITE_IDENTIFIER = 'mamcin'
|
|
SITE_NAME = 'Mamcin'
|
|
SITE_DESC = 'plus belle la vie, streaming, séries, récent'
|
|
|
|
URL_MAIN = 'https://www.mamcin.com/'
|
|
|
|
# FUNCTION_SEARCH = 'showMovies'
|
|
|
|
SERIE_NEWS = (URL_MAIN, 'showMovies')
|
|
SERIE_SERIES = (URL_MAIN, 'showMovies')
|
|
# SERIE_GENRES = (True, 'showGenres')
|
|
|
|
|
|
# loader function
|
|
def load():
|
|
oGui = cGui()
|
|
|
|
oOutputParameterHandler = cOutputParameterHandler()
|
|
oOutputParameterHandler.addParameter('siteUrl', SERIE_NEWS[0])
|
|
oGui.addDir(SITE_IDENTIFIER, SERIE_NEWS[1], 'Plus Belle La Vie (Derniers ajouts)', 'news.png', oOutputParameterHandler)
|
|
|
|
oGui.setEndOfDirectory()
|
|
|
|
|
|
# search function
|
|
# def showSearch():
|
|
# oGui = cGui()
|
|
|
|
# sSearchText = oGui.showKeyBoard()
|
|
# if (sSearchText != False):
|
|
# sUrl = URL_SEARCH[0] + sSearchText
|
|
# showMovies(sUrl)
|
|
# oGui.setEndOfDirectory()
|
|
# return
|
|
|
|
|
|
# genre definition
|
|
def showGenres():
|
|
oGui = cGui()
|
|
|
|
liste = []
|
|
liste.append( ['News', URL_MAIN + 'non-classe/'] )
|
|
|
|
for sTitle, sUrl in liste:
|
|
|
|
oOutputParameterHandler = cOutputParameterHandler()
|
|
oOutputParameterHandler.addParameter('siteUrl', sUrl)
|
|
oGui.addDir(SITE_IDENTIFIER, 'showMovies', sTitle, 'genres.png', oOutputParameterHandler)
|
|
|
|
oGui.setEndOfDirectory()
|
|
|
|
|
|
# function to extract episodes
|
|
def showMovies(sSearch=''):
|
|
oGui = cGui()
|
|
if sSearch:
|
|
sUrl = sSearch
|
|
else:
|
|
oInputParameterHandler = cInputParameterHandler()
|
|
sUrl = oInputParameterHandler.getValue('siteUrl')
|
|
|
|
oRequestHandler = cRequestHandler(sUrl)
|
|
sHtmlContent = oRequestHandler.request()
|
|
|
|
sPattern = '<div class="featured-image"><a href="([^"]+)" title="([^"]+)"><img width=".+?" height=".+?" src="([^"]+)"'
|
|
|
|
oParser = cParser()
|
|
aResult = oParser.parse(sHtmlContent, sPattern)
|
|
|
|
if (aResult[0] == False):
|
|
oGui.addText(SITE_IDENTIFIER)
|
|
|
|
if (aResult[0] == True):
|
|
total = len(aResult[1])
|
|
progress_ = progress().VScreate(SITE_NAME)
|
|
|
|
for aEntry in aResult[1]:
|
|
progress_.VSupdate(progress_, total)
|
|
if progress_.iscanceled():
|
|
break
|
|
|
|
# first post filter
|
|
if (str(aEntry[2]) != "https://www.mamcin.com/wp-content/uploads/2017/10/plus-belle-la-vie-episode-suivant-en-avance.jpg"):
|
|
sUrl = aEntry[0]
|
|
sTitle = aEntry[1]
|
|
sThumb = aEntry[2]
|
|
|
|
oOutputParameterHandler = cOutputParameterHandler()
|
|
oOutputParameterHandler.addParameter('siteUrl', sUrl)
|
|
oOutputParameterHandler.addParameter('sMovieTitle', sTitle)
|
|
oOutputParameterHandler.addParameter('sThumb', sThumb)
|
|
oGui.addMovie(SITE_IDENTIFIER, 'showHosters', sTitle, '', sThumb, '', oOutputParameterHandler)
|
|
|
|
progress_.VSclose(progress_)
|
|
|
|
sNextPage = __checkForNextPage(sHtmlContent)
|
|
if (sNextPage != False):
|
|
oOutputParameterHandler = cOutputParameterHandler()
|
|
oOutputParameterHandler.addParameter('siteUrl', sNextPage)
|
|
number = re.search('page/([0-9]+)', sNextPage).group(1)
|
|
oGui.addNext(SITE_IDENTIFIER, 'showMovies', '[COLOR teal]Page ' + number + ' >>>[/COLOR]', oOutputParameterHandler)
|
|
|
|
if not sSearch:
|
|
oGui.setEndOfDirectory()
|
|
|
|
|
|
# search the next page
|
|
def __checkForNextPage(sHtmlContent):
|
|
oParser = cParser()
|
|
sPattern = '<li class="previous"><a href="([^"]+)"'
|
|
aResult = oParser.parse(sHtmlContent, sPattern)
|
|
|
|
if (aResult[0] == True):
|
|
return aResult[1][0]
|
|
|
|
return False
|
|
|
|
|
|
# search hosts
|
|
def showHosters():
|
|
oGui = cGui()
|
|
oInputParameterHandler = cInputParameterHandler()
|
|
sUrl = oInputParameterHandler.getValue('siteUrl')
|
|
sMovieTitle = oInputParameterHandler.getValue('sMovieTitle')
|
|
sThumb = oInputParameterHandler.getValue('sThumb')
|
|
|
|
oRequestHandler = cRequestHandler(sUrl)
|
|
sHtmlContent = oRequestHandler.request()
|
|
|
|
oParser = cParser()
|
|
|
|
# add dailymotion sources
|
|
sPattern = '<iframe.+?src="(.+?)?logo=0&info=0"'
|
|
aResult = oParser.parse(sHtmlContent, sPattern)
|
|
if (aResult[0] == True):
|
|
for aEntry in aResult[1]:
|
|
if not aEntry.startswith('http'):
|
|
sHosterUrl = 'https:' + aEntry
|
|
else:
|
|
sHosterUrl = aEntry
|
|
oHoster = cHosterGui().checkHoster(sHosterUrl)
|
|
if (oHoster != False):
|
|
oHoster.setDisplayName(sMovieTitle)
|
|
oHoster.setFileName(sMovieTitle)
|
|
cHosterGui().showHoster(oGui, oHoster, sHosterUrl, sThumb)
|
|
|
|
# add sendvid sources
|
|
sPattern = '<(?:source|iframe) src="(.+?)" width'
|
|
aResult = oParser.parse(sHtmlContent, sPattern)
|
|
if (aResult[0] == True):
|
|
for aEntry in aResult[1]:
|
|
sHosterUrl = aEntry
|
|
if not sHosterUrl.startswith('http'):
|
|
sHosterUrl = 'https:' + aEntry
|
|
oHoster = cHosterGui().checkHoster(sHosterUrl)
|
|
if (oHoster != False):
|
|
oHoster.setDisplayName(sMovieTitle)
|
|
oHoster.setFileName(sMovieTitle)
|
|
cHosterGui().showHoster(oGui, oHoster, sHosterUrl, sThumb)
|
|
|
|
oGui.setEndOfDirectory()
|