Пример #1
0
	def addEntry(self, passwd, timestamp):	
		xbmc.log('TIMESTAMP: %s' % (timestamp), xbmc.LOGNOTICE)
		try:
			sql = "INSERT INTO parental (password, timeset) VALUES (?, ?)"
			self.dbcur.execute(sql, (passwd, timestamp))
			self.db.commit()
			VSlog('SQL INSERT Successfully')
		except Exception, e:
			VSlog('SQL INSERT ERROR')
			pass
Пример #2
0
    def search_movie_name(self, name):

        meta = {}

        name = name.replace('!', '')
        url = self.SEARCH_MOVIES % (quote_plus(name))
        html = client.request(url)
        fragment = dom_parser2.parse_dom(html, 'div', {'class': 'movie_box'})

        if not fragment:
            meta = {}

        if fragment:
            movie_url = dom_parser2.parse_dom(fragment, 'a', req='href')
            tvtsvod_id = (movie_url[0].attrs['href']).split('/', 5)[4]
            meta = self.search_movie_id(tvtsvod_id)

        xbmc.log('DATA URL: %s' % (str(url)), xbmc.LOGNOTICE)
        xbmc.log('MOVIE NAME: %s' % (str(name)), xbmc.LOGNOTICE)
        # xbmc.log('MOVIE ID: %s' % (str(tvtsvod_id)), xbmc.LOGNOTICE)

        return meta
Пример #3
0
    def _call(self, action, movie_id):

        url = action % movie_id
        html = client.request(url)

        data = {}

        data['tvtsvod_id'] = movie_id

        #récupère le titre du film
        fragment = dom_parser2.parse_dom(html, 'td', {'id': 'videoinfotd'})
        fragment = dom_parser2.parse_dom(fragment, 'span',
                                         {'itemprop': 'name'})
        data['title'] = str(fragment[0][1])

        #récupère l'année de production
        details_container = dom_parser2.parse_dom(html, 'div',
                                                  {'class': 'page_video_info'})
        fragment = dom_parser2.parse_dom(details_container, 'span',
                                         {'itemprop': 'copyrightYear'})

        try:
            sYear = fragment[0][1]
        except Exception as e:
            data['year'] = '2002'
            pass

        #récupère le résumé du film
        fragment = dom_parser2.parse_dom(html, 'div', {'class': 'desc_wrap'})
        fragment = dom_parser2.parse_dom(fragment, 'div',
                                         {'class': 'video_description'})

        try:
            data['overview'] = str(self.TAG_RE.sub('', fragment[0][1]))
        except:
            data['overview'] = ''
            pass

        xbmc.log('OVERVIEW: %s' % (str(data['overview'])), xbmc.LOGNOTICE)

        #récupére les informations de production
        fragment = dom_parser2.parse_dom(details_container, 'span',
                                         {'itemprop': 'productionCompany'})
        fragment = dom_parser2.parse_dom(fragment, 'a', req='title')
        data['studio'] = fragment[0][1]

        fragment = dom_parser2.parse_dom(details_container, 'span',
                                         {'itemprop': 'duration'})
        data['runtime'] = fragment[0][1]

        #convertion de la durée du film en minutes
        try:
            runtime = str(data['runtime'])
            heures = runtime.split(':', 2)[0]
            minutes = runtime.split(':', 2)[1]
            runtime = (int(heures)) * 60 + int(minutes)
        except Exception as e:
            runtime = '120'
            pass

        data['runtime'] = runtime
        xbmc.log('RUNTIME: %s' % (str(runtime)), xbmc.LOGNOTICE)

        #récupère les catégories du film
        fragment = dom_parser2.parse_dom(html, 'div', {'class': 'categories'})
        fragment = dom_parser2.parse_dom(fragment, 'span',
                                         {'itemprop': 'genre'})

        # xbmc.log('CATEGORIES: %s' % (str(fragment)), xbmc.LOGNOTICE)

        category = []
        sCount = len(fragment)
        i = 0

        while i < sCount:
            category.append({'name': str(fragment[i].content)})
            i += 1

        data['genre'] = category
        xbmc.log('DATA META: %s' % (str(category)), xbmc.LOGNOTICE)

        #récupère le poster du film
        page_id = movie_id[:3]
        poster_url = self.poster % (page_id, movie_id)
        data['poster_path'] = poster_url

        #récupére de la liste des acteurs
        fragment = dom_parser2.parse_dom(html, 'div', {'class': 'video_info'})
        actor_info = dom_parser2.parse_dom(fragment, 'div',
                                           {'itemprop': 'actors'})
        actor_url = dom_parser2.parse_dom(actor_info, 'img',
                                          {'class': 'sm_star_image'})
        actor_url = [(i.attrs['key']) for i in actor_url]

        xbmc.log('ACTOR URL: %s' % (str(actor_url)), xbmc.LOGNOTICE)

        actor_name = dom_parser2.parse_dom(actor_info, 'a', req='title')
        actor_name = dom_parser2.parse_dom(actor_name, 'span',
                                           {'itemprop': 'name'})
        actor_name = [(i.content) for i in actor_name]

        xbmc.log('ACTOR NAME: %s' % (str(actor_name)), xbmc.LOGNOTICE)

        cast = []
        actors = {}

        for name, url in zip(actor_name, actor_url):
            cast.append({'name': str(name), 'actor_url': str(url)})

        actors['cast'] = cast

        data['credits'] = actors

        xbmc.log('DATA META: %s' % (str(data)), xbmc.LOGNOTICE)
        return data
Пример #4
0
    def get_meta(self,
                 media_type,
                 name,
                 tvtsvod_id='',
                 year='',
                 overlay=6,
                 update=False):
        '''
        Main method to get meta data for movie or tvshow. Will lookup by name/year
        if no IMDB ID supplied.

        Args:
            media_type (str): 'movie' or 'tvshow'
            name (str): full name of movie/tvshow you are searching
        Kwargs:
            imdb_id (str): IMDB ID
            tmdb_id (str): TMDB ID
            year (str): 4 digit year of video, recommended to include the year whenever possible
                        to maximize correct search results.
            season (int)
            episode (int)
            overlay (int): To set the default watched status (6=unwatched, 7=watched) on new videos

        Returns:
            DICT of meta data or None if cannot be found.
        '''

        #xbmc.log('Adult Stream Meta', 0)
        VSlog('Attempting to retrieve meta data for %s: %s %s %s' %
              (media_type, name, year, tvtsvod_id))
        #recherchedans la base de données
        if not update:
            meta = self._cache_search(media_type, self._clean_title(name),
                                      tvtsvod_id, year)
        else:
            meta = {}

        #recherche online
        # if not meta:

        #     if media_type == 'movie':
        #         meta = self.search_movie_id(tvtsvod_id)
        #     elif name:
        #         meta = self.search_movie_name(name)
        #     else:
        #         meta = {}
        if not meta:
            if media_type == 'transmovie':
                if tvtsvod_id:
                    meta = self.search_movie_id(tvtsvod_id)
                elif name:
                    meta = self.search_movie_name(name)
                else:
                    meta = {}

        #transform les metas
        if meta:
            #ecrit dans le cache
            self._cache_save(meta, self._clean_title(name), media_type,
                             overlay)
        else:
            meta['title'] = name

        meta = self._format(meta, name)

        xbmc.log('META DATA: %s' % (str(meta)), xbmc.LOGNOTICE)

        return meta
Пример #5
0
def WindowsBoxes(sTitle, sFileName, num,year = ''):

    ADDON = addon()
    DIALOG = dialog()

    #Presence de l'addon ExtendedInfo ?
    try:
        if (addon('script.extendedinfo') and ADDON.getSetting('extendedinfo-view') == 'true'):
            if num == "2":
                DIALOG.VSinfo('Lancement de ExtendInfo')
                xbmc.executebuiltin('XBMC.RunScript(script.extendedinfo, info=extendedtvinfo, name=%s)' % sFileName)
                return
            elif num == "1":
                DIALOG.VSinfo('Lancement de ExtendInfo')
                xbmc.executebuiltin('XBMC.RunScript(script.extendedinfo, info=extendedinfo, name=%s)' % sFileName)
                return
    except:
        pass

    #Sinon on gere par Adult Stream via la lib TMDB
    # if num == "1":
    #     try:
    #         from resources.lib.tmdb import cTMDb
    #         grab = cTMDb()
    #         meta = grab.get_meta('movie',sFileName, '', xbmc.getInfoLabel('ListItem.Property(TmdbId)'))
    #     except:
    #         pass
    if num == "1":
        try:
            from resources.lib.scrapers.main import cDEFAULT
            grab = cDEFAULT()
            meta = grab.get_meta('pornmovie', sFileName, '', xbmc.getInfoLabel('ListItem.Property(AebnId)'))
            VSlog('MetaData : ' + str(meta) )
            xbmc.log('MetaData: %s' % (str(meta)), xbmc.LOGNOTICE)
        except:
            pass

    elif num == "2":
        try:
            from resources.lib.scrapers.main import cDEFAULT
            grab = cDEFAULT()
            meta = grab.get_meta('transmovie', sFileName, '', xbmc.getInfoLabel('ListItem.Property(AebnId)'))
            VSlog('MetaData : ' + str(meta) )
            xbmc.log('MetaData: %s' % (str(meta)), xbmc.LOGNOTICE)
        except:
            pass     

    elif num == "3":
        try:
            from resources.lib.scrapers.main import cDEFAULT
            grab = cDEFAULT()
            meta = grab.get_meta('gaymovie', sFileName, '', xbmc.getInfoLabel('ListItem.Property(AebnId)'))
            VSlog('MetaData : ' + str(meta) )
            xbmc.log('MetaData: %s' % (str(meta)), xbmc.LOGNOTICE)
        except:
            pass                           

    #si rien ne marche
    if (not meta['aebn_id']):
        #dialog par defaut
        #xbmc.executebuiltin("Action(Info)")
        #fenetre d'erreur
        DIALOG.VSinfo(ADDON.VSlang(30204))

        return

    #affichage du dialog perso
    class XMLDialog(xbmcgui.WindowXMLDialog):

        ADDON = addon()
        """
        Dialog class that asks user about rating of movie.
        """
        def __init__(self, *args, **kwargs):
            xbmcgui.WindowXMLDialog.__init__( self )
            pass

        # def message(self, message):
            # """
            # Shows xbmc dialog with OK and message.
            # """
            # dialog = xbmcgui.Dialog()
            # dialog.ok(" My message title", message)
            # self.close()

        def onInit(self):
            #par default le resumer#
            color = ADDON.getSetting('deco_color')
            window(10000).setProperty('color', color)

            self.getControl(50).setVisible(False)
            self.getControl(5200).setVisible(False)
            #self.getControl(50).reset()
            listitems = []
            cast = []
        
            try:
                for slabel, slabel2, sicon, sid in meta['cast']:
                    listitem_ = listitem(label = slabel, label2=slabel2, iconImage=sicon)
                #listitem.setInfo('video', {'Title': 'test', 'RatingAndVotes':'6.8'})
                    listitem_.setProperty('id', str(sid))
                    listitems.append(listitem_)
                    cast.append(slabel.encode('ascii', 'ignore'))
                self.getControl(50).addItems(listitems)
                window(10000).setProperty('ListItem.casting', str(cast))
            except: pass
            #title
            #self.getControl(1).setLabel(meta['title'])
            meta['title'] = sTitle

            #self.getControl(49).setVisible(True)
            #self.getControl(2).setImage(meta['cover_url'])
            #self.getControl(3).setLabel(meta['rating'])
 
            for e in meta:
                property = 'ListItem.%s' %(e)
                if isinstance(meta[e], unicode):
                    window(10000).setProperty(property, meta[e].encode('utf-8'))
                else:
                    window(10000).setProperty(property, str(meta[e]))


        def credit(self, meta=""):
            self.getControl(5200).reset()
            listitems = []

            try:
                for i in meta:
                    try:
                        sTitle = unicodedata.normalize('NFKD', i['title']).encode('ascii','ignore')
                    except: sTitle = "Aucune information"
                    try:
                        sThumbnail = 'https://image.tmdb.org/t/p/w342' + i['poster_path']
                    except:
                        sThumbnail = ''
                    sId = i['id']


                    listitem_ = listitem(label = sTitle, iconImage=sThumbnail)
                    try:
                        listitem_.setInfo('video', {'rating': i['vote_average'].encode('utf-8') })
                    except:
                        listitem_.setInfo('video', {'rating': str(i['vote_average'])})

                    #listitem.setProperty('id', str(sId))
                    listitems.append(listitem_)
                self.getControl(5200).addItems(listitems)

            except: pass
            self.getControl(5200).setVisible(True)
            self.setFocusId(5200)
            #self.setFocus(self.getControl(5200))


        def person(self, sid=""):
            from resources.lib.tmdb import cTMDb
            grab = cTMDb(lang='en')
            sUrl = 'person/' + str(sid)
            meta = grab.getUrl(sUrl)

            listitems = []

            try:
                try:
                    sTitle = unicodedata.normalize('NFKD', meta['name']).encode('ascii','ignore')
                except: sTitle = "Aucune information"
                #xbmcgui.Window(10000).setProperty('person_name', sTitle)
                try:
                    sThumbnail = 'https://image.tmdb.org/t/p/w396' + meta['profile_path']
                except:
                    sThumbnail = ''
                sId = meta['id']


                bio = meta['biography'].replace('\n\n', '[CR]').replace('\n', '[CR]')

                #self.getControl(5300).setLabel('[COLOR gold]test[/COLOR]')

                #window(10000).setProperty('biography', bio)
                window(10000).setProperty('birthday', meta['birthday'])
                window(10000).setProperty('place_of_birth', meta['place_of_birth'])
                window(10000).setProperty('deathday', meta['deathday'])

                #self.getControl(20).setVisible(True)
            except: pass


            #description
            #self.getControl(400).setText(meta['plot'])

        def onClick(self, controlId):
            print controlId
            if controlId == 5:
                self.getControl(400).setVisible(False)
                self.getControl(50).setVisible(True)
                self.setFocusId(20)
                return
            elif controlId == 20:
                self.getControl(50).setVisible(False)
                self.getControl(400).setVisible(True)
                self.setFocusId(5)
                return
            elif controlId == 7:
                self.getControl(50).setVisible(True)
                self.setFocusId(50)
                return
            elif controlId == 11:
                from resources.lib.ba import cShowBA
                cBA = cShowBA()
                cBA.SetSearch(sFileName)
                cBA.SearchBA()
                self.close()
                return
            elif controlId == 30:
                self.close()
                return
            elif controlId == 50:
                #print self.getControl(50).ListItem.Property('id')
                item = self.getControl(50).getSelectedItem()
                sid = item.getProperty('id')

                from resources.lib.tmdb import cTMDb
                grab = cTMDb()
                sUrl = 'person/' + str(sid) + '/movie_credits'
                try:
                    meta = grab.getUrl(sUrl)
                    meta = meta['cast']
                    self.credit(meta)
                except:
                    return
                #self.getControl(50).setVisible(True)
            #click sur similaire
            elif controlId == 9:
                #print self.getControl(9000).ListItem.tmdb_id
                sid = window(10000).getProperty("ListItem.tmdb_id")

                from resources.lib.tmdb import cTMDb
                grab = cTMDb()
                sUrl = 'movie/%s/similar' % str(sid)
                try:
                    meta = grab.getUrl(sUrl)
                    meta = meta['results']
                    if meta:
                        self.credit(meta)
                    else:
                        self.getControl(9).setLabel("Aucune Information")
                except: return
            #click sur recommendations
            elif controlId == 13:
                #print self.getControl(9000).ListItem.tmdb_id
                sid = window(10000).getProperty("ListItem.tmdb_id")

                from resources.lib.tmdb import cTMDb
                grab = cTMDb()
                sUrl = 'movie/%s/recommendations' % str(sid)
                try:
                    meta = grab.getUrl(sUrl)
                    meta = meta['results']
                    if meta:
                        self.credit(meta)
                    else:
                        self.getControl(13).setLabel("Aucune Information")
                    
                except: return

            elif controlId == 5200:
            #click sur un film acteur
                import sys
                from resources.lib.util import cUtil
                item = self.getControl(5200).getSelectedItem()
                sTitle = item.getLabel()

                try:
                    sTitle = sTitle.encode("utf-8")
                    sTitle = cUtil().CleanName(sTitle)
                except: return

                sTest = '%s?site=globalSearch&searchtext=%s&sCat=1' % (sys.argv[0], sTitle)
                xbmc.executebuiltin('XBMC.Container.Update(%s)' % sTest )
                self.close()
                return

            #dans le futur permet de retourne le texte du film
            # elif controlId == 5200:
            #     item = self.getControl(5200).getSelectedItem()
            #     sid = item.getLabel()
            #     print sid
            #     return

        def onFocus(self, controlId):
            self.controlId = controlId
            if controlId != 5200:
                #self.getControl(5500).reset()
                self.getControl(5200).setVisible(False)
            if controlId != 50:
                self.getControl(50).setVisible(False)
            #if controlId == 50:
                #item = self.getControl(50).getSelectedItem()
                #sid = item.getProperty('id')
                #self.person(sid)

        def _close_dialog( self ):
            self.close()

        def onAction( self, action ):
            if action.getId() in ( 104, 105, 1, 2):
                # if self.controlId == 50:
                #     item = self.getControl(50).getSelectedItem()
                #     sid = item.getProperty('id')
                #     self.person(sid)
                return

            if action.getId() in ( 9, 10, 11, 30, 92, 216, 247, 257, 275, 61467, 61448, ):
                self.close()


    #path = xbmc.translatePath("special://home/addons/plugin.video.adult.stream").decode("utf-8")
    path = "special://home/addons/plugin.video.adult.stream"
    #self.__oPath.decode("utf-8")
    wd = XMLDialog('DialogInfo2.xml', path , 'default', '720p')
    wd.doModal()
    del wd