Beispiel #1
0
    def test_presentation_java_gc_azul(self):
        p = scrap.Presentation(self.iq, "Java-GC-Azul-C4")

        self.assertValidPresentationMetadata(p.metadata)

        self.assertEqual(p.metadata['title'], "Understanding Java Garbage Collection and What You Can Do about It")
        self.assertEqual(p.metadata['date'], datetime.datetime(2012, 10, 17))
        self.assertEqual(p.metadata['auth'], "Gil Tene")
        #self.assertEqual(p.metadata['duration'], 3469)
        self.assertEqual(p.metadata['summary'],
                         "Gil Tene explains how a garbage collector works, covering the fundamentals, mechanism, terminology and metrics. He classifies several GCs, and introduces Azul C4.")
        self.assertEqual(p.metadata['bio'],
                         "Gil Tene is CTO and co-founder of Azul Systems. He has been involved with virtual machine technologies for the past 20 years and has been building Java technology-based products since 1995. Gil pioneered Azul's Continuously Concurrent Compacting Collector (C4), Java Virtualization, Elastic Memory, and various managed runtime and systems stack technologies.")
        self.assertEqual(p.metadata['about'],
                         'Software is changing the world; QCon aims to empower software development by facilitating the spread of knowledge and innovation in the enterprise software development community; to achieve this, QCon is organized as a practitioner-driven conference designed for people influencing innovation in their teams: team leads, architects, project managers, engineering directors.')
        self.assertEqual(p.metadata['timecodes'],
                         [3, 15, 73, 143, 227, 259, 343, 349, 540, 629, 752, 755, 822, 913, 1043, 1210, 1290, 1360, 1386,
                          1462, 1511, 1633, 1765, 1892, 1975, 2009, 2057, 2111, 2117, 2192, 2269, 2328, 2348, 2468, 2558,
                          2655, 2666, 2670, 2684, 2758, 2802, 2820, 2827, 2838, 2862, 2913, 2968, 3015, 3056, 3076, 3113,
                          3115, 3135, 3183, 3187, 3247, 3254, 3281, 3303, 3328, 3344, 3360, 3367, 3376, 3411, 3426, 3469])
        self.assertEqual(p.metadata['slides'],
                         [client.get_url("/resource/presentations/Java-GC-Azul-C4/en/slides/%s.swf" % s) for s in
                          list(range(1, 49)) + list(range(50, 51)) + list(range(52, 53)) + list(range(55, 65)) + list(range(66, 72))])
        self.assertEqual(p.metadata['video_url'],
                         "rtmpe://video.infoq.com/cfx/st/")
        self.assertEqual(p.metadata['video_path'],
                         "mp4:presentations/12-jun-everythingyoueverwanted.mp4")
        self.assertEqual(p.metadata['pdf'],
                         "http://www.infoq.com/pdfdownload.action?filename=presentations%2FQConNY2012-GilTene-EverythingyoueverwantedtoknowaboutJavaCollectionbutweretooafraidtoask.pdf")
        self.assertEqual(p.metadata['mp3'],
                         "http://www.infoq.com/mp3download.action?filename=presentations%2Finfoq-12-jun-everythingyoueverwanted.mp3")
Beispiel #2
0
    def test_swf(self):
        # Fetch a slide
        pres = scrap.Presentation(self.iq, "Java-GC-Azul-C4")
        swf_path = self.iq.download(pres.metadata['slides'][0], self.tmp_dir)

        # SWF -> PNG
        png_path = swf_path.replace('.swf', '.png')
        convert.swf2png(swf_path, png_path)
        stat_info = os.stat(png_path)
        self.assertGreater(stat_info.st_size, 1000)
Beispiel #3
0
        def main(self, infoq_client, args):
            parser = argparse.ArgumentParser(
                prog="%s %s %s" %
                (app_name, PresentationModule.name,
                 PresentationModule.PresentationDownload.name))
            parser.add_argument('-f',
                                '--ffmpeg',
                                nargs="?",
                                type=str,
                                default="ffmpeg",
                                help='ffmpeg binary')
            parser.add_argument('-s',
                                '--swfrender',
                                nargs="?",
                                type=str,
                                default="swfrender",
                                help='swfrender binary')
            parser.add_argument('-r',
                                '--rtmpdump',
                                nargs="?",
                                type=str,
                                default="rtmpdump",
                                help='rtmpdump binary')
            parser.add_argument('-o',
                                '--output',
                                nargs="?",
                                type=str,
                                help='output file')
            parser.add_argument('-y',
                                '--overwrite',
                                action="store_true",
                                help='Overwrite existing video files')
            parser.add_argument('-t',
                                '--type',
                                nargs="?",
                                type=str,
                                default="legacy",
                                help='output type: legacy, h264, h264_overlay')
            parser.add_argument('identifier',
                                help='name of the presentation or url')
            args = parser.parse_args(args)

            # Check required tools are available before doing any useful work
            self.__check_dependencies(
                [args.ffmpeg, args.swfrender, args.rtmpdump])

            # Process arguments
            id = self.__extract_id(args.identifier)
            output = self.__chose_output(args.output, id)

            try:
                pres = scrap.Presentation(infoq_client, id)
            except client.DownloadError as e:
                return warn(
                    "Presentation %s not found. Please check your id or url" %
                    id, 2)

            kwargs = {
                "ffmpeg": args.ffmpeg,
                "rtmpdump": args.rtmpdump,
                "swfrender": args.swfrender,
                "overwrite": args.overwrite,
                "type": args.type,
            }

            with convert.Converter(pres, output, **kwargs) as builder:
                try:
                    builder.create_presentation()
                except (DownloadError, ConversionError) as e:
                    return warn(
                        "Failed to create presentation %s: %s" % (output, e),
                        2)
Beispiel #4
0
 def test_demo_timings_must_contain_a_list(self):
     p = scrap.Presentation(self.iq, "immutable-infrastructure")
     self.assertIsInstance(p.metadata['demo_timings'], list)
Beispiel #5
0
 def test_presentation_clojure_expression_problem(self):
     p = scrap.Presentation(self.iq, "Clojure-Expression-Problem")
     self.assertValidPresentationMetadata(p.metadata)
     self.assertTrue(p.metadata['video_path'].startswith("flv:"))
Beispiel #6
0
def get_latest_presentation(client):
    summary = next(scrap.get_summaries(client))
    return scrap.Presentation(client, summary['id'])