Example #1
0
    def test_padding(self):
        """Test that proper padding is done in the VideoItem.buildCommandList method"""
        youtube_video = parser_manager.validateURL(test_dict["youtube"])
        youtube_video.title = "Tester"
        youtube_video.setFilePaths(".")
        # youtube_video.setOutputRes (youtube_video.RES_640)

        # Testing against http://www.youtube.com/watch?v=_leYvPpmJGg specs
        command_list = youtube_video.buildCommandList(96, 384, 320, 180)
        padtop = padbottom = None
        for i, value in enumerate(command_list):
            if value == "-padtop":
                padtop = command_list[i + 1]
            elif value == "-padbottom":
                padbottom = command_list[i + 1]

        self.assertEqual(padtop, "30")
        self.assertEqual(padbottom, "30")

        # Testing against http://www.giantbomb.com/50-cent-blood-on-the-sand-video-review/17-289/ specs
        command_list = youtube_video.buildCommandList(96, 384, 640, 368)
        padtop = padbottom = None
        for i, value in enumerate(command_list):
            if value == "-padtop":
                padtop = command_list[i + 1]
            elif value == "-padbottom":
                padbottom = command_list[i + 1]

        self.assertEqual(padtop, "28")
        self.assertEqual(padbottom, "28")

        # Testing against http://video.google.com/videoplay?docid=-8378365891276905720
        # specs
        command_list = youtube_video.buildCommandList(96, 384, 200, 240)
        padleft = padright = None
        for i, value in enumerate(command_list):
            if value == "-padleft":
                padleft = command_list[i + 1]
            elif value == "-padright":
                padright = command_list[i + 1]

        self.assertEqual(padleft, "60")
        self.assertEqual(padright, "60")
Example #2
0
    def test_padding(self):
        """Test that proper padding is done in the VideoItem.buildCommandList method"""
        youtube_video = parser_manager.validateURL(test_dict["youtube"])
        youtube_video.title = "Tester"
        youtube_video.setFilePaths(".")
        #youtube_video.setOutputRes (youtube_video.RES_640)

        # Testing against http://www.youtube.com/watch?v=_leYvPpmJGg specs
        command_list = youtube_video.buildCommandList(96, 384, 320, 180)
        padtop = padbottom = None
        for i, value in enumerate(command_list):
            if value == "-padtop": padtop = command_list[i + 1]
            elif value == "-padbottom": padbottom = command_list[i + 1]

        self.assertEqual(padtop, "30")
        self.assertEqual(padbottom, "30")

        # Testing against http://www.giantbomb.com/50-cent-blood-on-the-sand-video-review/17-289/ specs
        command_list = youtube_video.buildCommandList(96, 384, 640, 368)
        padtop = padbottom = None
        for i, value in enumerate(command_list):
            if value == "-padtop": padtop = command_list[i + 1]
            elif value == "-padbottom": padbottom = command_list[i + 1]

        self.assertEqual(padtop, "28")
        self.assertEqual(padbottom, "28")

        # Testing against http://video.google.com/videoplay?docid=-8378365891276905720
        # specs
        command_list = youtube_video.buildCommandList(96, 384, 200, 240)
        padleft = padright = None
        for i, value in enumerate(command_list):
            if value == "-padleft": padleft = command_list[i + 1]
            elif value == "-padright": padright = command_list[i + 1]

        self.assertEqual(padleft, "60")
        self.assertEqual(padright, "60")
Example #3
0
 def _get_information(self, url):
     video = parser_manager.validateURL(url)
     self.assert_(video, "The URL {0} tested was invalid".format(url))
     video.getVideoInformation()
Example #4
0
 def _get_information(self, url):
     video = parser_manager.validateURL(url)
     self.assert_(video, "The URL {0} tested was invalid".format(url))
     video.getVideoInformation()
Example #5
0
else:
    videos_dir = os.path.join(path, "Videos")

if not os.path.isdir(videos_dir):
    try:
        os.mkdir(videos_dir)
    except OSError:
        print >> sys.stderr, "Could not make videos directory. Exiting."
        sys.exit(42)

parser_manager.importParsers()
#### Iterate through the list of URLs and download  ####
#### and transcode any specified videos             ####
for full_url in command_args:
    print
    youtube_video = parser_manager.validateURL(full_url)
    if not youtube_video:
        print >> sys.stderr, "An invalid url (%s) was passed. Exiting." % full_url
        sys.exit(42)

    try:
        youtube_video.getVideoInformation()
    except (youtube_video.parser.UnknownTitle,
            youtube_video.parser.InvalidCommands, PageNotFound,
            youtube_video.parser.URLBuildFailed,
            youtube_video.parser.InvalidPortal) as e:
        print >> sys.stderr, "%s. Exiting." % e.message
        sys.exit(42)
    except Exception as e:
        print >> sys.stderr, "%s. Exiting." % e.message
        sys.exit(42)
Example #6
0
    videos_dir = os.path.join (path, "Videos")

if not os.path.isdir (videos_dir):
    try:
        os.mkdir (videos_dir)
    except OSError:
        print >> sys.stderr, "Could not make videos directory. Exiting."
        sys.exit (42)


parser_manager.importParsers ()
#### Iterate through the list of URLs and download  ####
#### and transcode any specified videos             ####
for full_url in command_args:
    print
    youtube_video = parser_manager.validateURL (full_url)
    if not youtube_video:
        print >> sys.stderr, "An invalid url (%s) was passed. Exiting." % full_url
        sys.exit (42)

    try:
        youtube_video.getVideoInformation ()
    except (youtube_video.parser.UnknownTitle, youtube_video.parser.InvalidCommands,
            PageNotFound, youtube_video.parser.URLBuildFailed, youtube_video.parser.InvalidPortal) as e:
        print >> sys.stderr, "%s. Exiting." % e.message
        sys.exit (42)
    except Exception as e:
        print >> sys.stderr, "%s. Exiting." % e.message
        sys.exit (42)