Example #1
0
def getPitiviMock(settings=None, proxyingStrategy=ProxyingStrategy.NOTHING,
                  numTranscodingJobs=4):
    def __create_settings():
        settings = mock.MagicMock()

        settings.proxyingStrategy = proxyingStrategy
        settings.numTranscodingJobs = numTranscodingJobs

        return settings

    app = mock.MagicMock()

    app.write_action = mock.MagicMock(spec=Pitivi.write_action)
    check.check_requirements()

    if not settings:
        settings = __create_settings()
    elif isinstance(settings, dict):
        nsettings = __create_settings()

        for key, value in settings.items():
            setattr(nsettings, key, value)
        settings = nsettings

    app.settings = settings
    app.proxy_manager = ProxyManager(app)

    return app
Example #2
0
def create_pitivi_mock(**settings):
    app = mock.MagicMock()

    app.write_action = mock.MagicMock(spec=Pitivi.write_action)
    check.check_requirements()

    app.settings = __create_settings(**settings)
    app.proxy_manager = ProxyManager(app)

    return app
Example #3
0
def create_pitivi_mock(**settings):
    app = mock.MagicMock()

    app.write_action = mock.MagicMock(spec=Pitivi.write_action)
    check.check_requirements()

    app.settings = __create_settings(**settings)
    app.proxy_manager = ProxyManager(app)

    return app
Example #4
0
def create_pitivi_mock(**settings):
    app = mock.MagicMock()

    app.write_action = mock.MagicMock(spec=Pitivi.write_action)
    check.check_requirements()

    app.settings = __create_settings(**settings)
    app.proxy_manager = ProxyManager(app)

    # TODO: Get rid of Zoomable.app.
    from pitivi.utils.timeline import Zoomable
    Zoomable.app = app

    return app
Example #5
0
def setup():
    """Sets paths and initializes modules, to be able to run the tests."""
    res = True

    # Make available to configure.py the top level dir.
    pitivi_dir = get_pitivi_dir()
    sys.path.insert(0, pitivi_dir)

    from pitivi import configure

    # Make available the compiled C code.
    sys.path.append(configure.BUILDDIR)
    subproject_paths = os.path.join(configure.BUILDDIR, "subprojects", "gst-transcoder")

    _prepend_env_paths(LD_LIBRARY_PATH=subproject_paths,
                       GST_PLUGIN_PATH=subproject_paths,
                       GI_TYPELIB_PATH=subproject_paths,
                       GST_PRESET_PATH=[os.path.join(pitivi_dir, "data", "videopresets"),
                                        os.path.join(pitivi_dir, "data", "audiopresets")],
                       GST_ENCODING_TARGET_PATH=[os.path.join(pitivi_dir, "data", "encoding-profiles")])
    os.environ.setdefault('PITIVI_TOP_LEVEL_DIR', pitivi_dir)

    # Make sure the modules are initialized correctly.
    from pitivi import check
    check.initialize_modules()
    res = check.check_requirements()

    from pitivi.utils import loggable as log
    log.init('PITIVI_DEBUG')

    return res
Example #6
0
def setup():
    res = True
    # Make available to configure.py the top level dir.
    pitivi_dir = get_pitivi_dir()
    os.environ.setdefault('PITIVI_TOP_LEVEL_DIR', pitivi_dir)

    _prepend_env_path("GST_PRESET_PATH", [
        os.path.join(pitivi_dir, "data", "videopresets"),
        os.path.join(pitivi_dir, "data", "audiopresets")])

    _prepend_env_path("GST_ENCODING_TARGET_PATH", [
        os.path.join(pitivi_dir, "data", "encoding-profiles")])

    # Make available the compiled C code.
    build_dir = get_build_dir()
    libs_dir = os.path.join(build_dir, "pitivi/coptimizations/.libs")
    sys.path.append(libs_dir)

    # Make sure the modules are initialized correctly.
    from pitivi import check
    check.initialize_modules()
    res = check.check_requirements()

    from pitivi.utils import loggable as log
    log.init('PITIVI_DEBUG')

    return res
Example #7
0
def getPitiviMock(settings=None, proxyingStrategy=ProxyingStrategy.NOTHING,
                  numTranscodingJobs=4):
    app = mock.MagicMock()

    app.write_action = mock.MagicMock(spec=Pitivi.write_action)
    check.check_requirements()

    if not settings:
        settings = mock.MagicMock()

        settings.proxyingStrategy = proxyingStrategy
        settings.numTranscodingJobs = numTranscodingJobs

    app.settings = settings
    app.proxy_manager = ProxyManager(app)

    return app
Example #8
0
def setup():
    """Sets paths and initializes modules, to be able to run the tests."""
    # Make sure xdg_*_home return temp dirs, to avoid touching
    # the config files of the developer.
    os.environ['XDG_DATA_HOME'] = mkdtemp()
    os.environ['XDG_CONFIG_HOME'] = mkdtemp()
    os.environ['XDG_CACHE_HOME'] = mkdtemp()

    # Make available to configure.py the top level dir.
    pitivi_dir = get_pitivi_dir()
    sys.path.insert(0, pitivi_dir)

    from pitivi import configure

    # Let Gst overrides from our prefix take precedence over any
    # other, making sure they are used. This allows us to ensure that
    # Gst overrides from gst-python are used when within flatpak
    local_overrides = os.path.join(configure.LIBDIR,
                                   "python" + sys.version[:3], "site-packages",
                                   "gi", "overrides")
    gi.overrides.__path__.insert(0, local_overrides)

    # Make available the compiled C code.
    sys.path.append(configure.BUILDDIR)
    subproject_paths = os.path.join(configure.BUILDDIR, "subprojects",
                                    "gst-transcoder")

    _prepend_env_paths(LD_LIBRARY_PATH=subproject_paths,
                       GST_PLUGIN_PATH=subproject_paths,
                       GI_TYPELIB_PATH=subproject_paths,
                       GST_PRESET_PATH=[
                           os.path.join(pitivi_dir, "data", "videopresets"),
                           os.path.join(pitivi_dir, "data", "audiopresets")
                       ],
                       GST_ENCODING_TARGET_PATH=[
                           os.path.join(pitivi_dir, "tests",
                                        "test-encoding-targets"),
                           os.path.join(pitivi_dir, "data",
                                        "encoding-profiles")
                       ])
    os.environ.setdefault('PITIVI_TOP_LEVEL_DIR', pitivi_dir)

    # Make sure the modules are initialized correctly.
    from pitivi import check
    check.initialize_modules()
    res = check.check_requirements()

    from pitivi.utils import loggable as log
    log.init('PITIVI_DEBUG')

    return res
Example #9
0
def setup():
    """Sets paths and initializes modules, to be able to run the tests."""
    # Make sure xdg_*_home return temp dirs, to avoid touching
    # the config files of the developer.
    os.environ['XDG_DATA_HOME'] = mkdtemp()
    os.environ['XDG_CONFIG_HOME'] = mkdtemp()
    os.environ['XDG_CACHE_HOME'] = mkdtemp()

    # Make available to configure.py the top level dir.
    pitivi_dir = get_pitivi_dir()
    sys.path.insert(0, pitivi_dir)

    from pitivi import configure

    # Let Gst overrides from our prefix take precedence over any
    # other, making sure they are used.
    local_overrides = os.path.join(configure.LIBDIR,
                                   "python" + sys.version[:3],
                                   "site-packages", "gi", "overrides")
    gi.overrides.__path__.insert(0, local_overrides)

    # Make sure that flatpak gst-python overrides are always used first.
    flatpak_gst_python_path = os.path.join("/app/lib/", "python" + sys.version[:3],
                                           "site-packages", "gi", "overrides")
    if os.path.exists(flatpak_gst_python_path):
        gi.overrides.__path__.insert(0, flatpak_gst_python_path)

    # Make available the compiled C code.
    sys.path.append(configure.BUILDDIR)
    subproject_paths = os.path.join(configure.BUILDDIR, "subprojects", "gst-transcoder")

    _prepend_env_paths(LD_LIBRARY_PATH=subproject_paths,
                       GST_PLUGIN_PATH=subproject_paths,
                       GI_TYPELIB_PATH=subproject_paths,
                       GST_PRESET_PATH=[os.path.join(pitivi_dir, "data", "videopresets"),
                                        os.path.join(pitivi_dir, "data", "audiopresets")],
                       GST_ENCODING_TARGET_PATH=[os.path.join(pitivi_dir, "tests", "test-encoding-targets"),
                                                 os.path.join(pitivi_dir, "data", "encoding-profiles")])
    os.environ.setdefault('PITIVI_TOP_LEVEL_DIR', pitivi_dir)

    # Make sure the modules are initialized correctly.
    from pitivi import check
    check.initialize_modules()
    res = check.check_requirements()

    from pitivi.utils import loggable as log
    log.init('PITIVI_DEBUG')

    return res
Example #10
0
def setup():
    # Make available to configure.py the top level dir.
    pitivi_dir = get_pitivi_dir()
    os.environ.setdefault("PITIVI_TOP_LEVEL_DIR", pitivi_dir)

    # Make available the compiled C code.
    build_dir = get_build_dir()
    libs_dir = os.path.join(build_dir, "pitivi/coptimizations/.libs")
    sys.path.append(libs_dir)

    # Make sure the modules are initialized correctly.
    from pitivi import check

    check.initialize_modules()
    assert check.check_requirements()

    from pitivi.utils import loggable as log

    log.init("PITIVI_DEBUG")
Example #11
0
def setup():
    """Sets paths and initializes modules, to be able to run the tests."""
    # Make sure xdg_*_home return temp dirs, to avoid touching
    # the config files of the developer.
    os.environ['XDG_DATA_HOME'] = mkdtemp()
    os.environ['XDG_CONFIG_HOME'] = mkdtemp()
    os.environ['XDG_CACHE_HOME'] = mkdtemp()

    # Make available to configure.py the top level dir.
    pitivi_dir = get_pitivi_dir()
    sys.path.insert(0, pitivi_dir)

    from pitivi import configure

    # Make available the compiled C code.
    sys.path.append(configure.BUILDDIR)
    subproject_paths = os.path.join(configure.BUILDDIR, "subprojects",
                                    "gst-transcoder")

    _prepend_env_paths(LD_LIBRARY_PATH=subproject_paths,
                       GST_PLUGIN_PATH=subproject_paths,
                       GI_TYPELIB_PATH=subproject_paths,
                       GST_PRESET_PATH=[
                           os.path.join(pitivi_dir, "data", "videopresets"),
                           os.path.join(pitivi_dir, "data", "audiopresets")
                       ],
                       GST_ENCODING_TARGET_PATH=[
                           os.path.join(pitivi_dir, "tests",
                                        "test-encoding-targets"),
                           os.path.join(pitivi_dir, "data",
                                        "encoding-profiles")
                       ])
    os.environ.setdefault('PITIVI_TOP_LEVEL_DIR', pitivi_dir)

    # Make sure the modules are initialized correctly.
    from pitivi import check
    check.initialize_modules()
    res = check.check_requirements()

    from pitivi.utils import loggable as log
    log.init('PITIVI_DEBUG')

    return res
import os, sys

from gi.repository import Gst, GES, GLib
Gst.init(None)
GES.init()

from gi.repository import GstPbutils

# The joys of globals, this needs to be done before
# importing Pipeline
if __name__=='__main__':
    from pitivi.check import check_requirements
    check_requirements()

from pitivi.utils.pipeline import Pipeline

here = os.path.abspath(os.path.dirname(__file__))

CLAP_ASSET = GLib.filename_to_uri(os.path.join(here, '15388__pitx__palma-08.wav'))

class ClapMixer(object):
    def __init__(self):
        self.__timeline = GES.Timeline.new()
        self.__timeline.add_track(GES.AudioTrack.new())
        self.pipeline = Pipeline()
        self.pipeline.set_timeline(self.__timeline)

        self.__clap_asset = None
        self.__clap_layer = None
        self.__asset_layer = None
Example #13
0
import os, sys

from gi.repository import Gst, GES, GLib
Gst.init(None)
GES.init()

from gi.repository import GstPbutils

# The joys of globals, this needs to be done before
# importing Pipeline
if __name__ == '__main__':
    from pitivi.check import check_requirements
    check_requirements()

from pitivi.utils.pipeline import Pipeline

here = os.path.abspath(os.path.dirname(__file__))

CLAP_ASSET = GLib.filename_to_uri(
    os.path.join(here, '15388__pitx__palma-08.wav'))


class ClapMixer(object):
    def __init__(self):
        self.__timeline = GES.Timeline.new()
        self.__timeline.add_track(GES.AudioTrack.new())
        self.pipeline = Pipeline()
        self.pipeline.set_timeline(self.__timeline)

        self.__clap_asset = None
        self.__clap_layer = None