[ff9f0d]: plugin.video.pelisalacarta / channels / descargacineclasico.py  Maximize  Restore  History

Download this file

186 lines (138 with data), 6.9 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
# -*- coding: iso-8859-1 -*-
#------------------------------------------------------------
# pelisalacarta - XBMC Plugin
# Canal para descargacineclasico
# http://blog.tvalacarta.info/plugin-xbmc/pelisalacarta/
# contribución de ermanitu
#------------------------------------------------------------
import urlparse,urllib2,urllib,re
import os
import sys
import xbmc
import xbmcgui
import xbmcplugin
import scrapertools
import megavideo
import servertools
import binascii
import xbmctools
import anotador
import config
import logger
CHANNELNAME = "descargacineclasico"
# Esto permite su ejecución en modo emulado
try:
pluginhandle = int( sys.argv[ 1 ] )
except:
pluginhandle = ""
# Traza el inicio del canal
logger.info("[descargacineclasico.py] init")
DEBUG = True
Generate = False # poner a true para generar listas de peliculas
LoadThumbnails = True # indica si cargar los carteles
def mainlist(params,url,category):
logger.info("[descargacineclasico.py] mainlist")
xbmctools.addnewfolder( CHANNELNAME , "movielist" , CHANNELNAME , "Aventuras" , "http://descargacineclasico.blogspot.com/search/label/Aventuras?updated-max=&max-results=1000" , "", "" )
xbmctools.addnewfolder( CHANNELNAME , "movielist" , CHANNELNAME , "Ciencia Ficción" , "http://descargacineclasico.blogspot.com/search/label/Ciencia%20Ficcion?updated-max=&max-results=1000" , "", "" )
xbmctools.addnewfolder( CHANNELNAME , "movielist" , CHANNELNAME , "Comedias" , "http://descargacineclasico.blogspot.com/search/label/Comedias?updated-max=&max-results=1000" , "", "" )
xbmctools.addnewfolder( CHANNELNAME , "movielist" , CHANNELNAME , "Drama" , "http://descargacineclasico.blogspot.com/search/label/Drama?updated-max=&max-results=1000" , "", "" )
xbmctools.addnewfolder( CHANNELNAME , "movielist" , CHANNELNAME , "Intriga" , "http://descargacineclasico.blogspot.com/search/label/Intriga?updated-max=&max-results=1000" , "", "" )
xbmctools.addnewfolder( CHANNELNAME , "movielist" , CHANNELNAME , "Románticas" , "http://descargacineclasico.blogspot.com/search/label/Romanticas?updated-max=&max-results=1000" , "", "" )
xbmctools.addnewfolder( CHANNELNAME , "movielist" , CHANNELNAME , "Series" , "http://descargacineclasico.blogspot.com/search/label/Series?updated-max=&max-results=1000" , "", "" )
xbmctools.addnewfolder( CHANNELNAME , "movielist" , CHANNELNAME , "Western" , "http://descargacineclasico.blogspot.com/search/label/Wester?updated-max=&max-results=1000" , "", "" )
xbmctools.addnewfolder( CHANNELNAME , "movielist" , CHANNELNAME , "Novedades" , "http://descargacineclasico.blogspot.com/" , "", "" )
xbmctools.addnewfolder( CHANNELNAME , "movielist" , CHANNELNAME , "Todas" , "http://descargacineclasico.blogspot.com/search?updated-max=&max-results=1000" , "", "" )
# Label (top-right)...
xbmcplugin.setPluginCategory( handle=pluginhandle, category=category )
# Disable sorting...
xbmcplugin.addSortMethod( handle=pluginhandle, sortMethod=xbmcplugin.SORT_METHOD_NONE )
# End of directory...
xbmcplugin.endOfDirectory( handle=pluginhandle, succeeded=True )
def movielist(params,url,category):
logger.info("[descargacineclasico.py] mainlist")
# Descarga la página
data = scrapertools.cachePage(url)
#logger.info(data)
# Extrae las entradas (carpetas)
patronvideos = "<h3>\n<a href='([^']+)'>(.*?)</a>"
patronvideos += '.*?<a onblur=.*?src="(.*?)"' # cartel
# patronvideos += ".*?SINOPSIS:(.*?)(PUBLICADO POR" # sinopsis
matches = re.compile(patronvideos,re.DOTALL).findall(data)
#scrapertools.printMatches(matches)
if (Generate):
f = open(config.DATA_PATH + '/films.tab', 'w') # fichero para obtener las notas
for match in matches:
# Titulo
scrapedtitle = match[1]
scrapedtitle = scrapedtitle.replace('&#161;','') # Ą
scrapedtitle = scrapedtitle.replace('&#191;','') # ż
logger.info(scrapedtitle)
# if (not Generate):
# score = anotador.getscore(match[1])
# if (score != ""):
# scrapedtitle += " " + score
# URL
scrapedurl = urlparse.urljoin(url,match[0]) # url de la ficha descargacineclasico
# Thumbnail
# scrapedthumbnail = urlparse.urljoin(url,match[2])
scrapedthumbnail = ""
if LoadThumbnails:
scrapedthumbnail = match[2].replace("s200","s1600")
# procesa el resto
# scrapeddescription = match[3]
scrapeddescription = ""
# Depuracion
if (DEBUG):
logger.info("scrapedtitle="+scrapedtitle)
logger.info("scrapedurl="+scrapedurl)
logger.info("scrapedthumbnail="+scrapedthumbnail)
if (Generate):
sanio = re.search('(.*?)\((.*?)\)',scrapedtitle)
if (sanio): # si hay anio
fareg = sanio.group(1) + "\t" + sanio.group(2) + "\t" + scrapedtitle
else:
fareg = scrapedtitle + "\t\t" + scrapedtitle
f.write(fareg+"\n")
# Ańade al listado de XBMC
xbmctools.addthumbnailfolder( CHANNELNAME , scrapedtitle , scrapedurl , scrapedthumbnail, "detail" )
# Label (top-right)...
xbmcplugin.setPluginCategory( handle=pluginhandle, category=category )
# Disable sorting...
xbmcplugin.addSortMethod( handle=pluginhandle, sortMethod=xbmcplugin.SORT_METHOD_NONE )
# End of directory...
xbmcplugin.endOfDirectory( handle=pluginhandle, succeeded=True )
if (Generate):
f.close()
def detail(params,url,category):
logger.info("[descargacineclasico.py] detail")
title = urllib.unquote_plus( params.get("title") )
thumbnail = urllib.unquote_plus( params.get("thumbnail") )
logger.info("[descargacineclasico.py] title="+title)
logger.info("[descargacineclasico.py] thumbnail="+thumbnail)
# Descarga la página
data = scrapertools.cachePage(url)
#logger.info(data)
# ------------------------------------------------------------------------------------
# Busca los enlaces a los videos
# ------------------------------------------------------------------------------------
listavideos = servertools.findvideos(data)
for video in listavideos:
xbmctools.addvideo( CHANNELNAME , title+" - "+video[0] , video[1] , category , video[2] )
# ------------------------------------------------------------------------------------
# Label (top-right)...
xbmcplugin.setPluginCategory( handle=pluginhandle, category=category )
# Disable sorting...
xbmcplugin.addSortMethod( handle=pluginhandle, sortMethod=xbmcplugin.SORT_METHOD_NONE )
# End of directory...
xbmcplugin.endOfDirectory( handle=pluginhandle, succeeded=True )
def play(params,url,category):
logger.info("[descargacineclasico.py] play")
title = unicode( xbmc.getInfoLabel( "ListItem.Title" ), "utf-8" )
thumbnail = xbmc.getInfoImage( "ListItem.Thumb" )
plot = unicode( xbmc.getInfoLabel( "ListItem.Plot" ), "utf-8" )
server = params["server"]
logger.info("[descargacineclasico.py] thumbnail="+thumbnail)
logger.info("[descargacineclasico.py] server="+server)
xbmctools.playvideo(CHANNELNAME,server,url,category,title,thumbnail,plot)
#mainlist(None,"","mainlist")
#detail(None,"http://impresionante.tv/ponyo.html","play")