コード例 #1
0
    def test_loading_project_with_moved_asset(self):
        """Loads a project with moved asset."""
        app = common.create_pitivi(proxyingStrategy=ProxyingStrategy.NOTHING)

        proj_uri = self.create_project_file_from_xges(
            app, """<ges version='0.3'>
            <project properties='properties;' metadatas='metadatas;'>
                <ressources>
                    <asset id='file://this/is/a/moved/asset.mp4' extractable-type-name='GESUriClip'
                        properties='properties, supported-formats=(int)6, duration=(guint64)1228000000;' metadatas='metadatas' />
                </ressources>
            </project>
            </ges>""")
        project_manager = app.project_manager
        medialib = medialibrary.MediaLibraryWidget(app)

        mainloop = common.create_main_loop()

        def new_project_loaded_cb(*args, **kwargs):
            mainloop.quit()

        def missing_uri_cb(project_manager, project, unused_error, asset):
            return common.get_sample_uri("1sec_simpsons_trailer.mp4")

        project_manager.connect("missing-uri", missing_uri_cb)
        project_manager.connect("new-project-loaded", new_project_loaded_cb)

        project_manager.load_project(proj_uri)
        with common.cloned_sample("1sec_simpsons_trailer.mp4"):
            mainloop.run()
        self.assertEqual(medialib._progressbar.get_fraction(), 1.0)
コード例 #2
0
ファイル: test_render.py プロジェクト: pitivi/pitivi
    def test_rendering_with_scale(self):
        """Tests rendering with a smaller scale."""
        sample_name = "30fps_numeroted_frames_red.mkv"
        with common.cloned_sample(sample_name):
            self.check_import([sample_name])

            project = self.app.project_manager.current_project
            timeline_container = TimelineContainer(self.app)
            timeline_container.setProject(project)

            assets = project.list_assets(GES.UriClip)
            asset, = [a for a in assets if "proxy" in a.props.id]
            layer, = project.ges_timeline.get_layers()
            clip = asset.extract()
            layer.add_clip(clip)
            video_source = clip.find_track_element(None, GES.VideoUriSource)
            self.assertEqual(video_source.get_child_property("width")[1], 320)
            self.assertEqual(video_source.get_child_property("height")[1], 240)

            dialog = self.create_rendering_dialog(project)

            # Simulate setting the scale to 10%.
            with mock.patch.object(dialog.scale_spinbutton, "get_value",
                                   return_value=10):
                dialog._scaleSpinbuttonChangedCb(None)
                self.render(dialog)

            self.mainloop.run(until_empty=True)

            video_source = clip.find_track_element(None, GES.VideoUriSource)
            self.assertEqual(video_source.get_child_property("width")[1], 320)
            self.assertEqual(video_source.get_child_property("height")[1], 240)
コード例 #3
0
    def test_rendering_with_scale(self):
        """Tests rendering with a smaller scale."""
        sample_name = "30fps_numeroted_frames_red.mkv"
        with common.cloned_sample(sample_name):
            self.check_import([sample_name])

            project = self.app.project_manager.current_project
            timeline_container = TimelineContainer(self.app)
            timeline_container.setProject(project)

            assets = project.list_assets(GES.UriClip)
            asset, = [a for a in assets if "proxy" in a.props.id]
            layer, = project.ges_timeline.get_layers()
            clip = asset.extract()
            layer.add_clip(clip)
            video_source = clip.find_track_element(None, GES.VideoUriSource)
            self.assertEqual(video_source.get_child_property("width")[1], 320)
            self.assertEqual(video_source.get_child_property("height")[1], 240)

            dialog = self.create_rendering_dialog(project)

            # Simulate setting the scale to 10%.
            with mock.patch.object(dialog.scale_spinbutton,
                                   "get_value",
                                   return_value=10):
                dialog._scaleSpinbuttonChangedCb(None)
                self.render(dialog)

            self.mainloop.run(until_empty=True)

            video_source = clip.find_track_element(None, GES.VideoUriSource)
            self.assertEqual(video_source.get_child_property("width")[1], 320)
            self.assertEqual(video_source.get_child_property("height")[1], 240)
コード例 #4
0
    def test_delete_proxy(self):
        sample_name = "30fps_numeroted_frames_red.mkv"
        with common.cloned_sample(sample_name):
            self.stop_using_proxies(delete_proxies=True)

            asset = self.medialibrary.store[0].asset
            proxy_uri = self.app.proxy_manager.get_proxy_uri(asset)

            # Requesting UriClip sync will return None if the asset is not in cache
            # this way we make sure that this asset used to exist
            proxy = GES.Asset.request(GES.UriClip, proxy_uri)
            self.assertIsNotNone(proxy)
            self.assertFalse(os.path.exists(Gst.uri_get_location(proxy_uri)))

            self.assertIsNone(asset.get_proxy())

            # And let's recreate the proxy file.
            self.app.project_manager.current_project.use_proxies_for_assets(
                [asset])
            self.assertEqual(asset.creation_progress, 0)

            # Check that the info column notifies the user about progress
            self.assertTrue("Proxy creation progress:" in
                            self.medialibrary.store[0].infotext)

            # Run the mainloop and let _progress_bar_cb stop it when the proxy is
            # ready
            self.mainloop.run()

            self.assertEqual(asset.creation_progress, 100)
            self.assertEqual(asset.get_proxy(), proxy)
コード例 #5
0
    def test_mixed_proxies(self):
        sample_name = "30fps_numeroted_frames_red.mkv"
        with common.cloned_sample(sample_name):
            self.check_import([sample_name],
                              proxying_strategy=ProxyingStrategy.NOTHING)
            asset = self.medialibrary.store[0].asset

            # Create and disable scaled proxy
            proxy = self.check_add_proxy(asset, scaled=True)
            scaled_uri = self.app.proxy_manager.get_proxy_uri(asset,
                                                              scaled=True)
            self.check_disable_proxy(proxy, asset)

            # Create and disable HQ proxy
            proxy = self.check_add_proxy(asset)
            hq_uri = self.app.proxy_manager.get_proxy_uri(asset)
            self.check_disable_proxy(proxy, asset)

            # Check both files exist
            self.assertTrue(os.path.exists(Gst.uri_get_location(hq_uri)))
            self.assertTrue(os.path.exists(Gst.uri_get_location(scaled_uri)))

            # Enable and delete scaled proxy
            proxy = self.check_add_proxy(asset,
                                         scaled=True,
                                         check_progress=False)
            self.check_disable_proxy(proxy, asset, delete=True)

            # Check that only HQ Proxy exists
            self.assertFalse(os.path.exists(Gst.uri_get_location(scaled_uri)))
            self.assertTrue(os.path.exists(Gst.uri_get_location(hq_uri)))

            # Enable and delete HQ proxy
            proxy = self.check_add_proxy(asset, check_progress=False)
            self.check_disable_proxy(proxy, asset, delete=True)
コード例 #6
0
ファイル: test_media_library.py プロジェクト: p-murli/pitivi
 def test_missing_uri_displayed(self):
     with common.cloned_sample():
         asset_uri = common.get_sample_uri("missing.png")
         with common.created_project_file(asset_uri) as uri:
             self._customSetUp(project_uri=uri)
     self.assertTrue(
         self.medialibrary._import_warning_infobar.props.visible)
コード例 #7
0
    def test_save_project_with_removed_proxy(self):
        sample_name = "30fps_numeroted_frames_red.mkv"
        with common.cloned_sample(sample_name):
            self.check_import([sample_name])

            project = self.app.project_manager.current_project
            asset = GES.UriClipAsset.request_sync(
                common.get_sample_uri(sample_name))
            target = asset.get_proxy_target()
            self.assertEqual(set(project.list_assets(GES.Extractable)),
                             set([target, asset]))

            # Remove the asset
            self.medialibrary.remove_assets_action.emit("activate", None)

            # Make sure that the project has not assets anymore
            self.assertEqual(project.list_assets(GES.Extractable), [])

            # Save the project and reload it, making sure there is no asset
            # in that new project
            project_uri = Gst.filename_to_uri(
                tempfile.NamedTemporaryFile().name)
            project.save(project.ges_timeline, project_uri, None, True)

            self._custom_set_up(project_uri)
            self.assertNotEqual(project,
                                self.app.project_manager.current_project)
            project = self.app.project_manager.current_project
            self.assertEqual(project.list_assets(GES.Extractable), [])
コード例 #8
0
    def test_regenerate_scaled_proxy(self):
        sample_name = "30fps_numeroted_frames_red.mkv"
        with common.cloned_sample(sample_name):
            self.check_import([sample_name],
                              proxying_strategy=ProxyingStrategy.NOTHING)
            asset = self.medialibrary.store[0].asset
            asset_uri = common.get_sample_uri(sample_name)

            # Create scaled proxy
            proxy = self.check_add_proxy(asset, scaled=True)
            proxy_uri = self.app.proxy_manager.get_proxy_uri(asset,
                                                             scaled=True)

            # Change target resolution and trigger regeneration (1/4 Asset width)
            self.app.project_manager.current_project.scaled_proxy_width = 80
            self.app.project_manager.current_project.scaled_proxy_height = 60

            self.app.project_manager.current_project.regenerate_scaled_proxies(
            )
            self.assertTrue("Proxy creation progress:" in
                            self.medialibrary.store[0].infotext)
            self.mainloop.run()

            proxy = self.medialibrary.store[0].asset
            self.assertNotEqual(proxy.props.id, proxy_uri)

            stream = proxy.get_info().get_video_streams()[0]
            resolution = [stream.get_width(), stream.get_height()]
            self.assertEqual(resolution, [80, 60])
            self.assertEqual(proxy.props.proxy_target.props.id, asset_uri)

            # Delete proxy
            self.check_disable_proxy(proxy, asset, delete=True)
            self.assertFalse(os.path.exists(Gst.uri_get_location(proxy_uri)))
コード例 #9
0
    def test_proxy_duration_mismatch(self):
        sample_name = "30fps_numeroted_frames_red.mkv"
        with common.cloned_sample(sample_name):
            self.check_import([sample_name],
                              proxying_strategy=ProxyingStrategy.NOTHING)
            timeline = self.app.project_manager.current_project.ges_timeline

            asset = self.medialibrary.store[0].asset
            clip = timeline.append_layer().add_asset(asset, 0, 0,
                                                     Gst.CLOCK_TIME_NONE,
                                                     GES.TrackType.VIDEO)

            duration = 2.5 * Gst.SECOND
            fake_duration = 3 * Gst.SECOND

            asset.set_uint64(ASSET_DURATION_META, fake_duration)
            clip.props.max_duration = fake_duration
            clip.props.duration = fake_duration
            self.assertEqual(clip.props.duration, fake_duration)
            proxy = self.check_add_proxy(asset)

            self.assertEqual(asset_get_duration(asset), duration)
            self.assertEqual(asset_get_duration(proxy), duration)
            self.assertEqual(clip.props.duration, duration)
            self.assertEqual(clip.props.max_duration, duration)
コード例 #10
0
    def test_scaled_proxy_for_unsupported_asset(self):
        sample_name = "1sec_simpsons_trailer.mp4"
        with common.cloned_sample(sample_name):
            self.check_import([sample_name],
                              proxying_strategy=ProxyingStrategy.AUTOMATIC)
            asset = self.medialibrary.store[0].asset

            # Mark all formats as unsupported
            with mock.patch.object(self.app.proxy_manager,
                                   "is_asset_format_well_supported",
                                   return_value=False):
                # Create scaled proxy
                proxy = self.check_add_proxy(asset, scaled=True, w=80, h=34)
                proxy_uri = self.app.proxy_manager.get_proxy_uri(asset,
                                                                 scaled=True)
                self.mainloop.run(until_empty=True)

                # Check that HQ proxy was created
                hq_uri = self.app.proxy_manager.get_proxy_uri(asset)
                self.assertTrue(os.path.exists(Gst.uri_get_location(hq_uri)))

                # Delete scaled proxy
                self.check_disable_proxy(proxy, asset, delete=True)
                self.mainloop.run()

                # Check that we revert to HQ proxy
                proxy = self.medialibrary.store[0].asset
                proxy_uri = self.app.proxy_manager.get_proxy_uri(asset,
                                                                 scaled=False)
                self.assertEqual(proxy.props.id, proxy_uri)

                # Delete HQ Proxy
                self.check_disable_proxy(proxy, asset, delete=True)
コード例 #11
0
ファイル: test_media_library.py プロジェクト: pitivi/pitivi
    def test_delete_proxy(self):
        sample_name = "30fps_numeroted_frames_red.mkv"
        with common.cloned_sample(sample_name):
            self.stop_using_proxies(delete_proxies=True)

            asset = self.medialibrary.storemodel[0][medialibrary.COL_ASSET]
            proxy_uri = self.app.proxy_manager.getProxyUri(asset)

            # Requesting UriClip sync will return None if the asset is not in cache
            # this way we make sure that this asset used to exist
            proxy = GES.Asset.request(GES.UriClip, proxy_uri)
            self.assertIsNotNone(proxy)
            self.assertFalse(os.path.exists(Gst.uri_get_location(proxy_uri)))

            self.assertIsNone(asset.get_proxy())

            # And let's recreate the proxy file.
            self.app.project_manager.current_project.use_proxies_for_assets([asset])
            self.assertEqual(asset.creation_progress, 0)

            # Check that the info column notifies the user about progress
            self.assertTrue("Proxy creation progress:" in
                            self.medialibrary.storemodel[0][medialibrary.COL_INFOTEXT])

            # Run the mainloop and let _progressBarCb stop it when the proxy is
            # ready
            self.mainloop.run()

            self.assertEqual(asset.creation_progress, 100)
            self.assertEqual(asset.get_proxy(), proxy)
コード例 #12
0
ファイル: test_media_library.py プロジェクト: pitivi/pitivi
    def testSaveProjectWithRemovedProxy(self):
        sample_name = "30fps_numeroted_frames_red.mkv"
        with common.cloned_sample(sample_name):
            self.check_import([sample_name])

            project = self.app.project_manager.current_project
            asset = GES.UriClipAsset.request_sync(common.get_sample_uri(sample_name))
            target = asset.get_proxy_target()
            self.assertEqual(set(project.list_assets(GES.Extractable)), set([target, asset]))

            # Remove the asset
            self.medialibrary.remove_assets_action.emit("activate", None)

            # Make sure that the project has not assets anymore
            self.assertEqual(project.list_assets(GES.Extractable), [])

            # Save the project and reload it, making sure there is no asset
            # in that new project
            project_uri = Gst.filename_to_uri(tempfile.NamedTemporaryFile().name)
            project.save(project.ges_timeline, project_uri, None, True)

            self._customSetUp(project_uri)
            self.assertNotEqual(project, self.app.project_manager.current_project)
            project = self.app.project_manager.current_project
            self.assertEqual(project.list_assets(GES.Extractable), [])
コード例 #13
0
ファイル: test_project.py プロジェクト: pitivi/pitivi
    def test_loading_project_with_moved_asset(self):
        """Loads a project with moved asset."""
        app = common.create_pitivi(proxyingStrategy=ProxyingStrategy.NOTHING)

        proj_uri = self.create_project_file_from_xges(app, """<ges version='0.3'>
            <project properties='properties;' metadatas='metadatas;'>
                <ressources>
                    <asset id='file://this/is/a/moved/asset.mp4' extractable-type-name='GESUriClip'
                        properties='properties, supported-formats=(int)6, duration=(guint64)1228000000;' metadatas='metadatas' />
                </ressources>
            </project>
            </ges>""")
        project_manager = app.project_manager
        medialib = medialibrary.MediaLibraryWidget(app)

        mainloop = common.create_main_loop()

        def new_project_loaded_cb(*args, **kwargs):
            mainloop.quit()

        def missing_uri_cb(project_manager, project, unused_error, asset):
            return common.get_sample_uri("1sec_simpsons_trailer.mp4")

        project_manager.connect("missing-uri", missing_uri_cb)
        project_manager.connect("new-project-loaded", new_project_loaded_cb)

        project_manager.load_project(proj_uri)
        with common.cloned_sample("1sec_simpsons_trailer.mp4"):
            mainloop.run()
        self.assertEqual(medialib._progressbar.get_fraction(), 1.0)
コード例 #14
0
    def test_loading_project_with_moved_assets_and_deleted_proxy(self):
        """Loads a project with moved asset and deleted proxy file."""
        mainloop = common.create_main_loop()

        created_proxies = []

        def proxy_ready_cb(unused_proxy_manager, asset, proxy):
            created_proxies.append(asset)
            if len(created_proxies) == 2:
                mainloop.quit()

        app = common.create_pitivi(proxying_strategy=ProxyingStrategy.ALL)
        app.proxy_manager.connect("proxy-ready", proxy_ready_cb)

        proj_uri = self.create_project_file_from_xges(r"""<ges version='0.3'>
  <project properties='properties;' metadatas='metadatas, name=(string)&quot;New\ Project&quot;, author=(string)Unknown, render-scale=(double)100, format-version=(string)0.3;'>
    <ressources>
      <asset id='file:///nop/1sec_simpsons_trailer.mp4' extractable-type-name='GESUriClip' properties='properties, supported-formats=(int)6, duration=(guint64)1228000000;' metadatas='metadatas, audio-codec=(string)&quot;MPEG-4\ AAC\ audio&quot;, maximum-bitrate=(uint)130625, bitrate=(uint)130625, datetime=(datetime)2007-02-19T05:03:04Z, encoder=(string)Lavf54.6.100, container-format=(string)&quot;ISO\ MP4/M4A&quot;, video-codec=(string)&quot;H.264\ /\ AVC&quot;, file-size=(guint64)232417;'  proxy-id='file:///nop/1sec_simpsons_trailer.mp4.232417.proxy.mov' />
      <asset id='file:///nop/tears_of_steel.webm' extractable-type-name='GESUriClip' properties='properties, supported-formats=(int)6, duration=(guint64)2003000000;' metadatas='metadatas, container-format=(string)Matroska, language-code=(string)und, application-name=(string)Lavc56.60.100, encoder=(string)&quot;Xiph.Org\ libVorbis\ I\ 20150105\ \(\342\233\204\342\233\204\342\233\204\342\233\204\)&quot;, encoder-version=(uint)0, audio-codec=(string)Vorbis, nominal-bitrate=(uint)80000, bitrate=(uint)80000, video-codec=(string)&quot;VP8\ video&quot;, file-size=(guint64)223340;' proxy-id='file:///nop/tears_of_steel.webm.223340.proxy.mov'/>
      <asset id='file:///nop/1sec_simpsons_trailer.mp4.232417.proxy.mov' extractable-type-name='GESUriClip' properties='properties, supported-formats=(int)6, duration=(guint64)1228020833;' metadatas='metadatas, container-format=(string)Matroska, audio-codec=(string)Opus, language-code=(string)en, encoder=(string)Lavf54.6.100, bitrate=(uint)64000, video-codec=(string)&quot;Motion\ JPEG&quot;, file-size=(guint64)4694708;' />
      <asset id='file:///nop/tears_of_steel.webm.223340.proxy.mov' extractable-type-name='GESUriClip' properties='properties, supported-formats=(int)6, duration=(guint64)2003000000;' metadatas='metadatas, container-format=(string)Matroska, language-code=(string)und, application-name=(string)Lavc56.60.100, encoder=(string)&quot;Xiph.Org\ libVorbis\ I\ 20150105\ \(\342\233\204\342\233\204\342\233\204\342\233\204\)&quot;, encoder-version=(uint)0, audio-codec=(string)Vorbis, nominal-bitrate=(uint)80000, bitrate=(uint)80000, video-codec=(string)&quot;VP8\ video&quot;, file-size=(guint64)223340;' />
    </ressources>
</project>
</ges>""")
        project_manager = app.project_manager
        medialib = MediaLibraryWidget(app)

        # Remove proxy
        with common.cloned_sample("1sec_simpsons_trailer.mp4",
                                  "tears_of_steel.webm"):

            def new_project_loaded_cb(*args, **kwargs):
                mainloop.quit()

            missing_uris = []

            def missing_uri_cb(project_manager, project, unused_error, asset):
                missing_uris.append(asset.props.id)
                return common.get_sample_uri(os.path.basename(asset.props.id))

            project_manager.connect("missing-uri", missing_uri_cb)
            project_manager.connect("new-project-loaded",
                                    new_project_loaded_cb)

            project_manager.load_project(proj_uri)
            mainloop.run()
            self.assertEqual(
                len(missing_uris), 1,
                "missing_uri_cb should be called only once, got %s." %
                missing_uris)
            self.assertEqual(medialib._progressbar.get_fraction(), 1.0)
            mainloop.run()
            self.assertEqual(
                medialib.store.get_n_items(), 2,
                "We should have one asset displayed in the MediaLibrary.")

            self.assertEqual(medialib.store[0].thumb_decorator.state,
                             AssetThumbnail.PROXIED)
            self.assertEqual(medialib.store[1].thumb_decorator.state,
                             AssetThumbnail.PROXIED)
コード例 #15
0
    def test_select_missing_asset(self):
        """Exercise the MissingAssetDialog when loading a project."""
        app = common.create_pitivi(proxyingStrategy=ProxyingStrategy.NOTHING,
                                   FCpreviewWidth=640,
                                   FCpreviewHeight=480)

        proj_uri = self.create_project_file_from_xges(
            app, """<ges version='0.3'>
            <project properties='properties;' metadatas='metadatas;'>
                <ressources>
                    <asset id='file://this/is/a/moved/asset.mp4' extractable-type-name='GESUriClip'
                        properties='properties, supported-formats=(int)6, duration=(guint64)1228000000;' metadatas='metadatas' />
                </ressources>
            </project>
            </ges>""")
        project_manager = app.project_manager

        # Use a cloned sample so the asset is not in GES's asset cache.
        # This combination of calls can lead to a mainloop freeze:
        # - MissingAssetDialog.get_new_uri() through the "missing-uri" signal handler,
        # - MissingAssetDialog.run() through MissingAssetDialog.get_new_uri(),
        # - GES.UriClipAsset.request_sync() through PreviewWidget.preview_uri,
        with common.cloned_sample("1sec_simpsons_trailer.mp4"):
            asset_uri = common.get_sample_uri("1sec_simpsons_trailer.mp4")

            mainloop = common.create_main_loop()

            def missing_uri_cb(project_manager, project, unused_error, asset):
                with mock.patch.object(MissingAssetDialog,
                                       "set_transient_for"):
                    mad = MissingAssetDialog(app, asset, asset.get_id())
                mad._chooser.select_uri(asset_uri)
                # Close the dialog when idle so get_new_uri does not get stuck.
                GLib.idle_add(mad.close)
                uri = mad.get_new_uri()
                return uri

            project_manager.connect("missing-uri", missing_uri_cb)

            preview_loaded_for_uri = ""

            def preview_uri(preview_widget, uri):
                nonlocal preview_loaded_for_uri
                original_preview_uri(preview_widget, uri)
                # If it gets past the original_preview_uri call, it's all fine!
                preview_loaded_for_uri = uri
                mainloop.quit()

            original_preview_uri = PreviewWidget.preview_uri
            PreviewWidget.preview_uri = preview_uri
            try:
                # Our mainloop timeout mechanism cannot be used,
                # because the mainloop gets blocked.
                with common.checked_operation_duration(seconds=2):
                    project_manager.load_project(proj_uri)
                    mainloop.run()
                self.assertEqual(preview_loaded_for_uri, asset_uri)
            finally:
                PreviewWidget.preview_uri = original_preview_uri
コード例 #16
0
ファイル: test_media_library.py プロジェクト: pitivi/pitivi
    def testNewlyImportedAssetSelected(self):
        samples = ["30fps_numeroted_frames_red.mkv",
                   "30fps_numeroted_frames_blue.webm"]
        with common.cloned_sample(*samples):
            self.check_import(samples)

        self.assertEqual(len(list(self.medialibrary.getSelectedPaths())),
                         len(self.samples))
コード例 #17
0
ファイル: test_media_library.py プロジェクト: sumchege/vdwll
    def testNewlyImportedAssetSelected(self):
        samples = ["30fps_numeroted_frames_red.mkv",
                   "30fps_numeroted_frames_blue.webm"]
        with common.cloned_sample(*samples):
            self.check_import(samples)

        self.assertEqual(len(list(self.medialibrary.getSelectedPaths())),
                         len(self.samples))
コード例 #18
0
    def test_transcoding_and_reusing(self):
        sample_name = "30fps_numeroted_frames_red.mkv"
        with common.cloned_sample(sample_name):
            # Create proxies.
            self.check_import([sample_name])

            # Try to import again, checking that no transcoding is done.
            self.check_import([sample_name], check_no_transcoding=True)
コード例 #19
0
    def test_scale_proxy_audio_post_import(self):
        sample = "mp3_sample.mp3"
        with common.cloned_sample(sample):
            self.check_import([sample],
                              proxying_strategy=ProxyingStrategy.NOTHING)
            asset = self.medialibrary.store[0].asset

            project = self.app.project_manager.current_project
            project.use_proxies_for_assets([asset], scaled=True)
コード例 #20
0
 def check_selection_post_import(self, **kwargs):
     samples = [
         "30fps_numeroted_frames_red.mkv",
         "30fps_numeroted_frames_blue.webm"
     ]
     with common.cloned_sample(*samples):
         self.check_import(samples, **kwargs)
     self.assertEqual(len(list(self.medialibrary.get_selected_paths())),
                      len(self.samples))
コード例 #21
0
ファイル: test_media_library.py プロジェクト: pitivi/pitivi
    def test_transcoding_and_reusing(self):
        sample_name = "30fps_numeroted_frames_red.mkv"
        with common.cloned_sample(sample_name):
            # Create proxies.
            self.check_import([sample_name])

            # Try to import again, checking that no transcoding is done.
            self.check_import([sample_name],
                              check_no_transcoding=True)
コード例 #22
0
    def import_assets_in_medialibrary(self):
        samples = [
            "30fps_numeroted_frames_red.mkv",
            "30fps_numeroted_frames_blue.webm", "1sec_simpsons_trailer.mp4"
        ]
        with common.cloned_sample(*samples):
            self.check_import(samples,
                              proxying_strategy=ProxyingStrategy.NOTHING)

        self.assertTrue(self.medialibrary.tags_button.is_sensitive())
コード例 #23
0
    def __loading_failure(self, has_proxy):
        mainloop = common.create_main_loop()

        app = common.create_pitivi_mock(lastProjectFolder="/tmp",
                                        edgeSnapDeadband=32)
        app.project_manager = ProjectManager(app)
        editorperspective = EditorPerspective(app)
        editorperspective.setup_ui()
        editorperspective.viewer = mock.MagicMock()
        editorperspective.medialibrary._import_warning_infobar = mock.MagicMock(
        )
        editorperspective.clipconfig.effect_expander._infobar = mock.MagicMock(
        )

        def __pm_missing_uri_cb(project_manager, project, error, asset):
            nonlocal mainloop
            nonlocal editorperspective
            nonlocal self
            nonlocal app
            nonlocal has_proxy

            with mock.patch.object(MissingAssetDialog,
                                   "__new__") as constructor:
                failed_cb = mock.MagicMock()
                app.project_manager.connect("new-project-failed", failed_cb)

                dialog = constructor.return_value
                dialog.get_new_uri.return_value = None

                # Call the actual callback
                app.proxy_manager.checkProxyLoadingSucceeded =  \
                    mock.MagicMock(return_value=has_proxy)

                editorperspective._projectManagerMissingUriCb(
                    project_manager, project, error, asset)

                self.assertTrue(constructor.called)
                self.assertTrue(dialog.get_new_uri.called)
                self.assertEqual(failed_cb.called, not has_proxy)

            app.project_manager.connect(
                "missing-uri", editorperspective._projectManagerMissingUriCb)
            mainloop.quit()

        disconnectAllByFunc(app.project_manager,
                            editorperspective._projectManagerMissingUriCb)

        app.project_manager.connect("missing-uri", __pm_missing_uri_cb)

        with common.cloned_sample():
            asset_uri = common.get_sample_uri("missing.png")
            with common.created_project_file(asset_uri) as uri:
                app.project_manager.load_project(uri)

        mainloop.run()
コード例 #24
0
ファイル: test_project.py プロジェクト: thiblahute/pitivi
    def test_load_project_with_missing_proxy(self):
        """Checks loading a project with missing proxies."""
        with common.cloned_sample("1sec_simpsons_trailer.mp4"):
            mainloop, app, medialib, proxy_uri = self.load_project_with_missing_proxy()
            mainloop.run()

        self.assertEqual(len(medialib.storemodel), 1)
        self.assertEqual(medialib.storemodel[0][medialibrary.COL_ASSET].props.id,
                         proxy_uri)
        self.assertEqual(medialib.storemodel[0][medialibrary.COL_THUMB_DECORATOR].state,
                         medialibrary.AssetThumbnail.PROXIED)
コード例 #25
0
ファイル: test_project.py プロジェクト: pitivi/pitivi
    def test_load_project_with_missing_proxy(self):
        """Checks loading a project with missing proxies."""
        with common.cloned_sample("1sec_simpsons_trailer.mp4"):
            mainloop, app, medialib, proxy_uri = self.load_project_with_missing_proxy()
            mainloop.run()

        self.assertEqual(len(medialib.storemodel), 1)
        self.assertEqual(medialib.storemodel[0][medialibrary.COL_ASSET].props.id,
                         proxy_uri)
        self.assertEqual(medialib.storemodel[0][medialibrary.COL_THUMB_DECORATOR].state,
                         medialibrary.AssetThumbnail.PROXIED)
コード例 #26
0
    def test_load_project_with_missing_proxy(self):
        """Checks loading a project with missing proxies."""
        with common.cloned_sample("1sec_simpsons_trailer.mp4"):
            mainloop, _app, medialib, proxy_uri = self.load_project_with_missing_proxy()
            mainloop.run()

        self.assertEqual(medialib.store.get_n_items(), 1)
        self.assertEqual(medialib.store[0].asset.props.id,
                         proxy_uri)
        self.assertEqual(medialib.store[0].thumb_decorator.state,
                         AssetThumbnail.PROXIED)
コード例 #27
0
    def test_loading_project_with_moved_asset_and_deleted_proxy(self):
        """Loads a project with moved asset as deleted proxy file."""

        mainloop = common.create_main_loop()

        def proxy_ready_cb(unused_proxy_manager, asset, proxy):
            mainloop.quit()

        app = common.create_pitivi()
        app.proxy_manager.connect("proxy-ready", proxy_ready_cb)

        proj_uri = self.create_project_file_from_xges(
            app, """<ges version='0.3'>
  <project properties='properties;' metadatas='metadatas, name=(string)&quot;New\ Project&quot;, author=(string)Unknown, render-scale=(double)100, format-version=(string)0.3;'>
    <ressources>
      <asset id='file:///nop/1sec_simpsons_trailer.mp4' extractable-type-name='GESUriClip' properties='properties, supported-formats=(int)6, duration=(guint64)1228000000;' metadatas='metadatas, audio-codec=(string)&quot;MPEG-4\ AAC\ audio&quot;, maximum-bitrate=(uint)130625, bitrate=(uint)130625, datetime=(datetime)2007-02-19T05:03:04Z, encoder=(string)Lavf54.6.100, container-format=(string)&quot;ISO\ MP4/M4A&quot;, video-codec=(string)&quot;H.264\ /\ AVC&quot;, file-size=(guint64)232417;'  proxy-id='file:///nop/1sec_simpsons_trailer.mp4.232417.proxy.mkv' />
      <asset id='file:///nop/1sec_simpsons_trailer.mp4.232417.proxy.mkv' extractable-type-name='GESUriClip' properties='properties, supported-formats=(int)6, duration=(guint64)1228020833;' metadatas='metadatas, container-format=(string)Matroska, audio-codec=(string)Opus, language-code=(string)en, encoder=(string)Lavf54.6.100, bitrate=(uint)64000, video-codec=(string)&quot;Motion\ JPEG&quot;, file-size=(guint64)4694708;' />
    </ressources>
</project>
</ges>""")
        project_manager = app.project_manager
        medialib = medialibrary.MediaLibraryWidget(app)

        # Remove proxy
        with common.cloned_sample("1sec_simpsons_trailer.mp4"):

            def new_project_loaded_cb(*args, **kwargs):
                mainloop.quit()

            missing_uris = []

            def missing_uri_cb(project_manager, project, unused_error, asset):
                missing_uris.append(asset.props.id)
                return common.get_sample_uri("1sec_simpsons_trailer.mp4")

            project_manager.connect("missing-uri", missing_uri_cb)
            project_manager.connect("new-project-loaded",
                                    new_project_loaded_cb)

            project_manager.loadProject(proj_uri)
            mainloop.run()
            self.assertEqual(
                len(missing_uris), 1,
                "missing_uri_cb should be called only once, got %s." %
                missing_uris)
            self.assertEqual(medialib._progressbar.get_fraction(), 1.0)
            mainloop.run()
            self.assertEqual(
                len(medialib.storemodel), 1,
                "We should have one asset displayed in the MediaLibrary.")
            self.assertEqual(
                medialib.storemodel[0][medialibrary.COL_THUMB_DECORATOR].state,
                medialibrary.AssetThumbnail.PROXIED)
コード例 #28
0
    def test_create_and_delete_scaled_proxy(self):
        sample_name = "30fps_numeroted_frames_red.mkv"
        with common.cloned_sample(sample_name):
            self.check_import([sample_name],
                              proxying_strategy=ProxyingStrategy.NOTHING)
            asset = self.medialibrary.store[0].asset

            # Create scaled proxy
            proxy = self.check_add_proxy(asset, scaled=True)

            # Delete scaled proxy
            self.check_disable_proxy(proxy, asset, delete=True)
コード例 #29
0
    def __loading_failure(self, has_proxy):
        mainloop = common.create_main_loop()

        app = common.create_pitivi_mock(lastProjectFolder="/tmp",
                                        edgeSnapDeadband=32)
        app.project_manager = ProjectManager(app)
        editorperspective = EditorPerspective(app)
        editorperspective.setup_ui()
        editorperspective.viewer = mock.MagicMock()
        editorperspective.medialibrary._import_warning_infobar = mock.MagicMock()
        editorperspective.clipconfig.effect_expander._infobar = mock.MagicMock()

        def __pm_missing_uri_cb(project_manager, project, error, asset):
            nonlocal mainloop
            nonlocal editorperspective
            nonlocal self
            nonlocal app
            nonlocal has_proxy

            with mock.patch.object(MissingAssetDialog, "__new__") as constructor:
                failed_cb = mock.MagicMock()
                app.project_manager.connect("new-project-failed", failed_cb)

                dialog = constructor.return_value
                dialog.get_new_uri.return_value = None

                # Call the actual callback
                app.proxy_manager.checkProxyLoadingSucceeded =  \
                    mock.MagicMock(return_value=has_proxy)

                editorperspective._projectManagerMissingUriCb(
                    project_manager, project, error, asset)

                self.assertTrue(constructor.called)
                self.assertTrue(dialog.get_new_uri.called)
                self.assertEqual(failed_cb.called, not has_proxy)

            app.project_manager.connect("missing-uri",
                                        editorperspective._projectManagerMissingUriCb)
            mainloop.quit()

        disconnectAllByFunc(app.project_manager,
                            editorperspective._projectManagerMissingUriCb)

        app.project_manager.connect("missing-uri", __pm_missing_uri_cb)

        with common.cloned_sample():
            asset_uri = common.get_sample_uri("missing.png")
            with common.created_project_file(asset_uri) as uri:
                app.project_manager.load_project(uri)

        mainloop.run()
コード例 #30
0
ファイル: test_project.py プロジェクト: pitivi/pitivi
    def test_loading_project_with_moved_assets_and_deleted_proxy(self):
        """Loads a project with moved asset as deleted proxy file."""

        mainloop = common.create_main_loop()

        def proxy_ready_cb(unused_proxy_manager, asset, proxy):
            mainloop.quit()

        app = common.create_pitivi(proxyingStrategy=ProxyingStrategy.ALL)
        app.proxy_manager.connect("proxy-ready", proxy_ready_cb)

        proj_uri = self.create_project_file_from_xges(app, """<ges version='0.3'>
  <project properties='properties;' metadatas='metadatas, name=(string)&quot;New\ Project&quot;, author=(string)Unknown, render-scale=(double)100, format-version=(string)0.3;'>
    <ressources>
      <asset id='file:///nop/1sec_simpsons_trailer.mp4' extractable-type-name='GESUriClip' properties='properties, supported-formats=(int)6, duration=(guint64)1228000000;' metadatas='metadatas, audio-codec=(string)&quot;MPEG-4\ AAC\ audio&quot;, maximum-bitrate=(uint)130625, bitrate=(uint)130625, datetime=(datetime)2007-02-19T05:03:04Z, encoder=(string)Lavf54.6.100, container-format=(string)&quot;ISO\ MP4/M4A&quot;, video-codec=(string)&quot;H.264\ /\ AVC&quot;, file-size=(guint64)232417;'  proxy-id='file:///nop/1sec_simpsons_trailer.mp4.232417.proxy.mkv' />
      <asset id='file:///nop/tears_of_steel.webm' extractable-type-name='GESUriClip' properties='properties, supported-formats=(int)6, duration=(guint64)2003000000;' metadatas='metadatas, container-format=(string)Matroska, language-code=(string)und, application-name=(string)Lavc56.60.100, encoder=(string)&quot;Xiph.Org\ libVorbis\ I\ 20150105\ \(\342\233\204\342\233\204\342\233\204\342\233\204\)&quot;, encoder-version=(uint)0, audio-codec=(string)Vorbis, nominal-bitrate=(uint)80000, bitrate=(uint)80000, video-codec=(string)&quot;VP8\ video&quot;, file-size=(guint64)223340;' />
      <asset id='file:///nop/1sec_simpsons_trailer.mp4.232417.proxy.mkv' extractable-type-name='GESUriClip' properties='properties, supported-formats=(int)6, duration=(guint64)1228020833;' metadatas='metadatas, container-format=(string)Matroska, audio-codec=(string)Opus, language-code=(string)en, encoder=(string)Lavf54.6.100, bitrate=(uint)64000, video-codec=(string)&quot;Motion\ JPEG&quot;, file-size=(guint64)4694708;' />
      <asset id='file:///nop/tears_of_steel.webm.223340.proxy.mkv' extractable-type-name='GESUriClip' properties='properties, supported-formats=(int)6, duration=(guint64)2003000000;' metadatas='metadatas, container-format=(string)Matroska, language-code=(string)und, application-name=(string)Lavc56.60.100, encoder=(string)&quot;Xiph.Org\ libVorbis\ I\ 20150105\ \(\342\233\204\342\233\204\342\233\204\342\233\204\)&quot;, encoder-version=(uint)0, audio-codec=(string)Vorbis, nominal-bitrate=(uint)80000, bitrate=(uint)80000, video-codec=(string)&quot;VP8\ video&quot;, file-size=(guint64)223340;' />
    </ressources>
</project>
</ges>""")
        project_manager = app.project_manager
        medialib = medialibrary.MediaLibraryWidget(app)

        # Remove proxy
        with common.cloned_sample("1sec_simpsons_trailer.mp4", "tears_of_steel.webm"):
            def new_project_loaded_cb(*args, **kwargs):
                mainloop.quit()

            missing_uris = []

            def missing_uri_cb(project_manager, project, unused_error, asset):
                missing_uris.append(asset.props.id)
                return common.get_sample_uri(os.path.basename(asset.props.id))

            project_manager.connect("missing-uri", missing_uri_cb)
            project_manager.connect("new-project-loaded", new_project_loaded_cb)

            project_manager.load_project(proj_uri)
            mainloop.run()
            self.assertEqual(len(missing_uris), 1,
                "missing_uri_cb should be called only once, got %s." % missing_uris)
            self.assertEqual(medialib._progressbar.get_fraction(), 1.0)
            mainloop.run()
            self.assertEqual(len(medialib.storemodel), 2,
                "We should have one asset displayed in the MediaLibrary.")
            self.assertEqual(medialib.storemodel[0][medialibrary.COL_THUMB_DECORATOR].state,
                             medialibrary.AssetThumbnail.PROXIED)
            self.assertEqual(medialib.storemodel[1][medialibrary.COL_THUMB_DECORATOR].state,
                             medialibrary.AssetThumbnail.IN_PROGRESS)
コード例 #31
0
    def test_waveform_creation(self):
        """Checks the waveform generation."""
        sample_name = "1sec_simpsons_trailer.mp4"
        with common.cloned_sample(sample_name):
            self.check_import([sample_name])

            sample_uri = common.get_sample_uri(sample_name)
            wavefile = get_wavefile_location_for_uri(sample_uri)

        self.assertTrue(os.path.exists(wavefile), wavefile)

        with open(wavefile, "rb") as fsamples:
            samples = list(numpy.load(fsamples))

        self.assertEqual(samples, SIMPSON_WAVFORM_VALUES)
コード例 #32
0
ファイル: test_previewers.py プロジェクト: pitivi/pitivi
    def test_waveform_creation(self):
        """Checks the waveform generation."""
        sample_name = "1sec_simpsons_trailer.mp4"
        with common.cloned_sample(sample_name):
            self.check_import([sample_name])

            sample_uri = common.get_sample_uri(sample_name)
            wavefile = get_wavefile_location_for_uri(sample_uri)

        self.assertTrue(os.path.exists(wavefile), wavefile)

        with open(wavefile, "rb") as fsamples:
            samples = list(numpy.load(fsamples))

        self.assertEqual(samples, SIMPSON_WAVFORM_VALUES)
コード例 #33
0
    def testMissingUriForwarded(self):
        mainloop = common.create_main_loop()

        def missingUriCb(self, project, error, clip_asset, result):
            result[0] = True
            mainloop.quit()

        result = [False]
        self.manager.connect("missing-uri", missingUriCb, result)

        with common.cloned_sample():
            asset_uri = common.get_sample_uri("missing.png")
            with common.created_project_file(asset_uri) as uri:
                self.assertTrue(self.manager.loadProject(uri))
                mainloop.run()
        self.assertTrue(result[0], "missing-uri has not been emitted")
コード例 #34
0
    def test_missing_uri_forwarded(self):
        self.setup_app(app=common.create_pitivi_mock())
        mainloop = common.create_main_loop()

        def missing_uri_cb(self, project, error, clip_asset, result):
            result[0] = True
            mainloop.quit()

        result = [False]
        self.manager.connect("missing-uri", missing_uri_cb, result)

        with common.cloned_sample():
            asset_uri = common.get_sample_uri("missing.png")
            with common.created_project_file(asset_uri) as uri:
                self.assertIsNotNone(self.manager.load_project(uri))
                mainloop.run()
        self.assertTrue(result[0], "missing-uri has not been emitted")
コード例 #35
0
ファイル: test_render.py プロジェクト: isabella232/pitivi
    def test_rendering_with_unsupported_asset_scaled_proxies(self):
        """Tests rendering with scaled proxies."""
        sample_name = "30fps_numeroted_frames_red.mkv"
        with common.cloned_sample(sample_name):
            self.check_import([sample_name],
                              proxying_strategy=ProxyingStrategy.AUTOMATIC)

            project = self.app.project_manager.current_project
            proxy_manager = self.app.proxy_manager
            timeline_container = TimelineContainer(
                self.app, editor_state=self.app.gui.editor.editor_state)
            timeline_container.set_project(project)
            rendering_asset = None

            asset, = project.list_assets(GES.UriClip)
            with mock.patch.object(proxy_manager,
                                   "is_asset_format_well_supported",
                                   return_value=False):
                proxy = self.check_add_proxy(asset, scaled=True)

                # Check that HQ proxy was created
                hq_uri = self.app.proxy_manager.get_proxy_uri(asset)
                self.assertTrue(os.path.exists(Gst.uri_get_location(hq_uri)),
                                hq_uri)

                layer, = project.ges_timeline.get_layers()
                clip = proxy.extract()
                layer.add_clip(clip)

                def _use_proxy_assets():
                    nonlocal layer, asset, rendering_asset
                    clip, = layer.get_clips()
                    rendering_asset = clip.get_asset()
                    old_use_proxy_assets()

                dialog = self.create_rendering_dialog(project)
                old_use_proxy_assets = dialog._use_proxy_assets
                dialog._use_proxy_assets = _use_proxy_assets
                self.render(dialog)
                self.mainloop.run(until_empty=True)

                # Check rendering used HQ proxy
                self.assertTrue(proxy_manager.is_hq_proxy(rendering_asset))
                # Check asset was replaced with scaled proxy after rendering
                self.assertTrue(proxy_manager.is_scaled_proxy(
                    clip.get_asset()))
コード例 #36
0
ファイル: test_project.py プロジェクト: pitivi/pitivi
    def testMissingUriForwarded(self):
        self.setupApp(app=common.create_pitivi_mock())
        mainloop = common.create_main_loop()

        def missingUriCb(self, project, error, clip_asset, result):
            result[0] = True
            mainloop.quit()

        result = [False]
        self.manager.connect("missing-uri", missingUriCb, result)

        with common.cloned_sample():
            asset_uri = common.get_sample_uri("missing.png")
            with common.created_project_file(asset_uri) as uri:
                self.assertIsNotNone(self.manager.load_project(uri))
                mainloop.run()
        self.assertTrue(result[0], "missing-uri has not been emitted")
コード例 #37
0
ファイル: test_project.py プロジェクト: pitivi/pitivi
    def testLoaded(self):
        mainloop = common.create_main_loop()

        def new_project_loaded_cb(project_manager, project):
            mainloop.quit()

        self.manager.connect("new-project-loaded", new_project_loaded_cb)

        with common.cloned_sample("flat_colour1_640x480.png"):
            asset_uri = common.get_sample_uri("flat_colour1_640x480.png")
            with common.created_project_file(asset_uri=asset_uri) as uri:
                project = self.manager.load_project(uri)
                self.assertIsNotNone(project)
                mainloop.run()

        self.assertFalse(project.at_least_one_asset_missing)
        self.assertTrue(project.loaded)
        self.assertFalse(project.hasUnsavedModifications())
コード例 #38
0
    def testLoaded(self):
        mainloop = common.create_main_loop()

        def new_project_loaded_cb(project_manager, project):
            mainloop.quit()

        self.manager.connect("new-project-loaded", new_project_loaded_cb)

        with common.cloned_sample("flat_colour1_640x480.png"):
            asset_uri = common.get_sample_uri("flat_colour1_640x480.png")
            with common.created_project_file(asset_uri=asset_uri) as uri:
                project = self.manager.load_project(uri)
                self.assertIsNotNone(project)
                mainloop.run()

        self.assertFalse(project.at_least_one_asset_missing)
        self.assertTrue(project.loaded)
        self.assertFalse(project.hasUnsavedModifications())
コード例 #39
0
ファイル: test_render.py プロジェクト: isabella232/pitivi
    def test_rendering_with_scaled_proxies(self):
        """Tests rendering with scaled proxies."""
        sample_name = "30fps_numeroted_frames_red.mkv"
        with common.cloned_sample(sample_name):
            self.check_import([sample_name],
                              proxying_strategy=ProxyingStrategy.NOTHING)

            project = self.app.project_manager.current_project
            proxy_manager = self.app.proxy_manager
            timeline_container = TimelineContainer(
                self.app, editor_state=self.app.gui.editor.editor_state)
            timeline_container.set_project(project)
            rendering_asset = None

            asset, = project.list_assets(GES.UriClip)
            proxy = self.check_add_proxy(asset, scaled=True)

            layer, = project.ges_timeline.get_layers()
            clip = proxy.extract()
            layer.add_clip(clip)

            # Patch the function that reverts assets to proxies after rendering.
            from pitivi.render import RenderDialog
            old_use_proxy_assets = RenderDialog._use_proxy_assets

            def check_use_proxy_assets(self):
                nonlocal layer, asset, rendering_asset
                clip, = layer.get_clips()
                rendering_asset = clip.get_asset()
                old_use_proxy_assets(self)

            RenderDialog._use_proxy_assets = check_use_proxy_assets
            try:
                dialog = self.create_rendering_dialog(project)
                self.render(dialog)
                self.mainloop.run(until_empty=True)
            finally:
                RenderDialog._use_proxy_assets = old_use_proxy_assets

            # Check rendering did not use scaled proxy
            self.assertFalse(proxy_manager.is_scaled_proxy(rendering_asset))
            # Check asset was replaced with scaled proxy after rendering
            self.assertTrue(proxy_manager.is_scaled_proxy(clip.get_asset()))
コード例 #40
0
ファイル: test_project.py プロジェクト: pitivi/pitivi
    def test_load_project_with_missing_proxy_progress_tracking(self):
        """Checks progress tracking of loading project with missing proxies."""
        from gi.repository import GstTranscoder

        with common.cloned_sample("1sec_simpsons_trailer.mp4"):
            # Disable proxy generation by not making it start ever.
            # This way we are sure it will not finish before we test
            # the state while it is being rebuilt.
            with mock.patch.object(GstTranscoder.Transcoder, "run_async"):
                mainloop, app, medialib, proxy_uri = self.load_project_with_missing_proxy()
                uri = common.get_sample_uri("1sec_simpsons_trailer.mp4")

                app.project_manager.connect("new-project-loaded", lambda x, y: mainloop.quit())
                mainloop.run()

        self.assertEqual(len(medialib.storemodel), 1)
        self.assertEqual(medialib.storemodel[0][medialibrary.COL_ASSET].props.id,
                         uri)
        self.assertEqual(medialib.storemodel[0][medialibrary.COL_THUMB_DECORATOR].state,
                         medialibrary.AssetThumbnail.IN_PROGRESS)
コード例 #41
0
    def test_load_project_with_missing_proxy_progress_tracking(self):
        """Checks progress tracking of loading project with missing proxies."""
        from gi.repository import GstTranscoder

        with common.cloned_sample("1sec_simpsons_trailer.mp4"):
            # Disable proxy generation by not making it start ever.
            # This way we are sure it will not finish before we test
            # the state while it is being rebuilt.
            with mock.patch.object(GstTranscoder.Transcoder, "run_async"):
                mainloop, app, medialib, _proxy_uri = self.load_project_with_missing_proxy()
                uri = common.get_sample_uri("1sec_simpsons_trailer.mp4")

                app.project_manager.connect("new-project-loaded", lambda x, y: mainloop.quit())
                mainloop.run()

        self.assertEqual(medialib.store.get_n_items(), 1)
        self.assertEqual(medialib.store[0].asset.props.id,
                         uri)
        self.assertEqual(medialib.store[0].thumb_decorator.state,
                         AssetThumbnail.IN_PROGRESS)
コード例 #42
0
    def test_load_project_with_missing_proxy_stop_generating_and_proxy(self):
        """Checks cancelling creation of a missing proxies and forcing it again."""
        from gi.repository import GstTranscoder

        with common.cloned_sample("1sec_simpsons_trailer.mp4"):
            # Disable proxy generation by not making it start ever.
            # This way we are sure it will not finish before we test
            # stop generating the proxy and restart it.
            with mock.patch.object(GstTranscoder.Transcoder, "run_async"):
                mainloop, app, medialib, proxy_uri = self.load_project_with_missing_proxy(
                )

                app.project_manager.connect("new-project-loaded",
                                            lambda x, y: mainloop.quit())
                mainloop.run()
                asset = medialib.storemodel[0][medialibrary.COL_ASSET]
                app.project_manager.current_project.disable_proxies_for_assets(
                    [asset])

            row, = medialib.storemodel
            asset = row[medialibrary.COL_ASSET]
            self.assertEqual(medialib._progressbar.get_fraction(), 1.0)
            uri = common.get_sample_uri("1sec_simpsons_trailer.mp4")
            self.assertEqual(asset.props.id, uri)
            self.assertEqual(asset.ready, True)
            self.assertEqual(asset.creation_progress, 100)
            self.assertEqual(row[medialibrary.COL_THUMB_DECORATOR].state,
                             medialibrary.AssetThumbnail.NO_PROXY)

            app.project_manager.current_project.use_proxies_for_assets([asset])
            mainloop.run()

        row, = medialib.storemodel
        asset = row[medialibrary.COL_ASSET]
        self.assertEqual(medialib._progressbar.is_visible(), False)
        self.assertEqual(asset.props.id, proxy_uri)
        self.assertEqual(asset.ready, True)
        self.assertEqual(asset.creation_progress, 100)
        self.assertEqual(row[medialibrary.COL_THUMB_DECORATOR].state,
                         medialibrary.AssetThumbnail.PROXIED)
コード例 #43
0
ファイル: test_project.py プロジェクト: pitivi/pitivi
    def test_load_project_with_missing_proxy_stop_generating_and_proxy(self):
        """Checks cancelling creation of a missing proxies and forcing it again."""
        from gi.repository import GstTranscoder

        with common.cloned_sample("1sec_simpsons_trailer.mp4"):
            # Disable proxy generation by not making it start ever.
            # This way we are sure it will not finish before we test
            # stop generating the proxy and restart it.
            with mock.patch.object(GstTranscoder.Transcoder, "run_async"):
                mainloop, app, medialib, proxy_uri = self.load_project_with_missing_proxy()

                app.project_manager.connect("new-project-loaded", lambda x, y: mainloop.quit())
                mainloop.run()
                asset = medialib.storemodel[0][medialibrary.COL_ASSET]
                app.project_manager.current_project.disable_proxies_for_assets([asset])

            row, = medialib.storemodel
            asset = row[medialibrary.COL_ASSET]
            self.assertEqual(medialib._progressbar.get_fraction(), 1.0)
            uri = common.get_sample_uri("1sec_simpsons_trailer.mp4")
            self.assertEqual(asset.props.id, uri)
            self.assertEqual(asset.ready, True)
            self.assertEqual(asset.creation_progress, 100)
            self.assertEqual(row[medialibrary.COL_THUMB_DECORATOR].state,
                             medialibrary.AssetThumbnail.NO_PROXY)

            app.project_manager.current_project.use_proxies_for_assets([asset])
            mainloop.run()

        row, = medialib.storemodel
        asset = row[medialibrary.COL_ASSET]
        self.assertEqual(medialib._progressbar.is_visible(), False)
        self.assertEqual(asset.props.id, proxy_uri)
        self.assertEqual(asset.ready, True)
        self.assertEqual(asset.creation_progress, 100)
        self.assertEqual(row[medialibrary.COL_THUMB_DECORATOR].state,
                         medialibrary.AssetThumbnail.PROXIED)
コード例 #44
0
ファイル: test_medialibrary.py プロジェクト: owlrana/pitivi
    def test_timeline_proxy_switching(self):
        sample_name = "30fps_numeroted_frames_red.mkv"
        with common.cloned_sample(sample_name):
            self.check_import([sample_name],
                              proxying_strategy=ProxyingStrategy.NOTHING)

            common.create_timeline_container(self.app)
            timeline = self.app.project_manager.current_project.ges_timeline

            asset = self.medialibrary.store[0].asset
            timeline.append_layer().add_asset(asset, 0, 0, Gst.CLOCK_TIME_NONE,
                                              GES.TrackType.VIDEO)

            def check_timeline_clip(expected_asset):
                for layer in timeline.layers:
                    for clip in layer.get_clips():
                        self.assertEqual(clip.get_asset(), expected_asset)

            # Check asset is in the timeline
            check_timeline_clip(asset)

            # Check asset is replaced by scaled proxy
            scaled_proxy = self.check_add_proxy(asset, scaled=True)
            check_timeline_clip(scaled_proxy)

            # Check proxy is replaced back by asset
            self.check_disable_proxy(scaled_proxy, asset, delete=True)
            check_timeline_clip(asset)

            # Check asset is replaced by HQ proxy
            hq_proxy = self.check_add_proxy(asset)
            check_timeline_clip(hq_proxy)

            # Check proxy was replaced back by asset
            self.check_disable_proxy(hq_proxy, asset, delete=True)
            check_timeline_clip(asset)
コード例 #45
0
ファイル: test_media_library.py プロジェクト: pitivi/pitivi
 def testDisableProxies(self):
     sample_name = "30fps_numeroted_frames_red.mkv"
     with common.cloned_sample(sample_name):
         self.check_import([sample_name],
                           proxying_strategy=ProxyingStrategy.NOTHING,
                           check_no_transcoding=True)
コード例 #46
0
ファイル: test_media_library.py プロジェクト: pitivi/pitivi
 def test_stop_using_proxies(self):
     sample_name = "30fps_numeroted_frames_red.mkv"
     with common.cloned_sample(sample_name):
         self.stop_using_proxies()
コード例 #47
0
ファイル: test_media_library.py プロジェクト: pitivi/pitivi
 def test_supported_out_of_container_audio(self):
     sample = "mp3_sample.mp3"
     with common.cloned_sample(sample):
         self.check_import([sample], check_no_transcoding=True,
             proxying_strategy=ProxyingStrategy.AUTOMATIC)
コード例 #48
0
ファイル: test_media_library.py プロジェクト: pitivi/pitivi
 def test_missing_uri_displayed(self):
     with common.cloned_sample():
         asset_uri = common.get_sample_uri("missing.png")
         with common.created_project_file(asset_uri) as uri:
             self._customSetUp(project_uri=uri)
     self.assertTrue(self.medialibrary._import_warning_infobar.props.visible)