def RESOLVELINK(url):  # Grab the urls of the embedded videos
    content = utils.grab_url(url)
    screenwave = 'src="(http:\/\/player(?:[0-9]|).screenwavemedia.com(?:\/play|)\/player.php\?id=.+)"(?:\s|\>\<\/s)'
    # This should capture all embedded screenwavemedia videos (i have encountered yet)
    # The brackets that begin with "?:" are non capturing brackets.

    youtube = 'youtube.com/embed/(.+?)"'
    dailymotion = '<iframe frameborder="[0-1]" width="[0-9]{3}" height="[0-9]{3}" src="(//www.dailymotion.com/embed/video/.+?)" allowfullscreen></iframe>'
    sw_match = re.compile(screenwave).findall(content)
    yt_match = re.compile(youtube).findall(content)
    dm_match = re.compile(dailymotion).findall(content)
    videos = sw_match + yt_match + dm_match
    if len(videos) > 1:
        print 'More than one Video on this page'
        video_lst = videos
        select_lst = []
        dialog = xbmcgui.Dialog()
        num = 0
        for entry in video_lst:
            num = num + 1
            selection = 'Part ' + str(num)
            select_lst.append(selection)
        print video_lst
        ret = dialog.select('Choose Part', select_lst)
        if ret == -1:
            print 'Canceled'
            dialog = xbmcgui.Dialog()
            dialog.notification('Selection canceled', 'No Video selected',
                                xbmcgui.NOTIFICATION_INFO, 5000)
            return
        else:
            print ret
            video_url = utils.get_video(video_lst[ret])
    elif len(videos) == 1:
        url = videos[0]
        video_url = utils.get_video(url)
    else:
        soup = BeautifulSoup(content, "html.parser")
        header = soup.find("span", {"itemprop": "name"}).text
        entry = soup.find("div", class_='entry').text
        showText(header, entry)
        dialog = xbmcgui.Dialog()
        dialog.notification('No Video', 'No embedded video found.',
                            xbmcgui.NOTIFICATION_INFO, 3000)
        video_url = None
        return
    listitem = xbmcgui.ListItem(path=video_url)
    return xbmcplugin.setResolvedUrl(pluginhandle, True, listitem)
def RESOLVELINK(url): # Grab the urls of the embedded videos
    content = utils.grab_url(url)
    screenwave = 'src="(http:\/\/player(?:[0-9]|).screenwavemedia.com(?:\/play|)\/player.php\?id=.+)"(?:\s|\>\<\/s)'
    # This should capture all embedded screenwavemedia videos (i have encountered yet)
    # The brackets that begin with "?:" are non capturing brackets.

    youtube = 'youtube.com/embed/(.+?)"'
    dailymotion = '<iframe frameborder="[0-1]" width="[0-9]{3}" height="[0-9]{3}" src="(//www.dailymotion.com/embed/video/.+?)" allowfullscreen></iframe>'
    sw_match = re.compile(screenwave).findall(content)
    yt_match = re.compile(youtube).findall(content)
    dm_match = re.compile(dailymotion).findall(content)
    videos = sw_match + yt_match + dm_match
    if len(videos) > 1:
        print 'More than one Video on this page'
        video_lst = videos
        select_lst = []
        dialog = xbmcgui.Dialog()
        num = 0
        for entry in video_lst:
            num = num + 1
            selection = 'Part ' + str(num)
            select_lst.append(selection)
        print video_lst
        ret = dialog.select('Choose Part', select_lst)
        if ret == -1:
            print 'Canceled'
            dialog = xbmcgui.Dialog()
            dialog.notification('Selection canceled', 'No Video selected', xbmcgui.NOTIFICATION_INFO, 5000)
            return
        else:
            print ret
            video_url = utils.get_video(video_lst[ret])
    elif len(videos) == 1:
        url = videos[0]
        video_url = utils.get_video(url)
    else:
        soup = BeautifulSoup(content, "html.parser")
        header = soup.find("span", {"itemprop" : "name"}).text
        entry = soup.find("div", class_='entry').text
        showText(header, entry)
        dialog = xbmcgui.Dialog()
        dialog.notification('No Video', 'No embedded video found.', xbmcgui.NOTIFICATION_INFO, 3000)
        video_url=None
        return
    listitem = xbmcgui.ListItem(path=video_url)
    return xbmcplugin.setResolvedUrl(pluginhandle, True, listitem)
예제 #3
0
 def save(self, *args, **kwargs):
     if self.image:
         # call the compress function
         new_image = utils.compress(self.image)
         # set self.image to new_image
         self.image = new_image
         # save
         super().save(*args, **kwargs)
     if not self.slug:
         self.slug = slugify({self.name})
     if self.video is not None:
         self.video = utils.get_video(self.video)
     super().save(*args, **kwargs)
예제 #4
0
def video_recom():
    a = json.loads(weibo_count())
    hot = [i[0] for i in a]
    result = get_video(hot)

    return json.dumps(result)
예제 #5
0
파일: views.py 프로젝트: SwoJa/ruman
def video_recom():
    a = json.loads(weibo_count())
    hot = [i[0] for i in a]
    result = get_video(hot)

    return json.dumps(result)
예제 #6
0
CORPUS_PATH = "terrain_images"
GRASS_TERRAIN = "grass"
CONCRETE_TERRAIN = "concrete"

if __name__ == "__main__":

    if not os.path.exists(os.path.join(CORPUS_PATH)):
        os.mkdir(CORPUS_PATH)

    if not os.path.exists(os.path.join(CORPUS_PATH, CONCRETE_TERRAIN)):
        os.mkdir(os.path.join(CORPUS_PATH, CONCRETE_TERRAIN))

    while 1:
        # get a frame from RGB camera
        frame = get_video()
        # get a frame from depth sensor
        depth = get_depth()

        cv2.imwrite(
            os.path.join(CORPUS_PATH, CONCRETE_TERRAIN,
                         "{}.png".format(uuid.uuid4())), frame)

        img = frame
        gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)

        # display RGB image
        cv2.imshow('RGB image', frame)
        # display depth image
        cv2.imshow('Depth image', depth)