Esempio n. 1
0
def getShowImage(url, imgNum=None):

    est = eec.set(getShowImage, str(url))
    image_data = None

    if url == None:
        eec.clock(est, False)
        return None

    # if they provided a fanart number try to use it instead
    if imgNum != None:
        tempURL = url.split('-')[0] + "-" + str(imgNum) + ".jpg"
    else:
        tempURL = url

    logger.log(u"Getting show image at "+tempURL, logger.DEBUG)

    image_data = helpers.getURL(tempURL)

    if image_data is None:
        logger.log(u"There was an error trying to retrieve the image, aborting", logger.ERROR)
        eec.clock(est, False)
        return None

    eec.clock(est, True)
    return image_data
Esempio n. 2
0
            logger.log(u"Unable to connect to TVDB while creating meta files - skipping - "+ex(e), logger.ERROR)
            eec.clock(est, False)
            return None
    
        # try all included episodes in case some have thumbs and others don't
        for cur_ep in all_eps:
            try:
                myEp = tvdb_show_obj[cur_ep.season][cur_ep.episode]
            except (tvdb_exceptions.tvdb_episodenotfound, tvdb_exceptions.tvdb_seasonnotfound):
                logger.log(u"Unable to find episode " + str(cur_ep.season) + "x" + str(cur_ep.episode) + " on tvdb... has it been removed? Should I delete from db?")
                continue
    
            thumb_url = myEp["filename"]
            
            if thumb_url:
                eec.clock(est, True)
                return thumb_url

        eec.clock(est, False)
        return None
    
    def write_show_file(self, show_obj):
        """
        Generates and writes show_obj's metadata under the given path to the
        filename given by get_show_file_path()
        
        show_obj: TVShow object for which to create the metadata
        
        path: An absolute or relative path where we should put the file. Note that
                the file name will be the default show_file_name.