示例#1
0
文件: vlc.py 项目: nxmirrors/miro
    def __init__(self):
        logging.info("Initializing VLC")
        plugin_dir = os.path.join(resources.appRoot(), 'vlc-plugins')
        self.exc = VLCException()

        # Note: if you need vlc output to stdout, remove the --quiet
        # from the list of arguments.
        vlc_args = [
            "vlc", '--quiet', '--nostats', '--intf', 'dummy',
            '--no-video-title-show', '--plugin-path', plugin_dir
        ]
        self.vlc = libvlc.libvlc_new(len(vlc_args),
                make_string_list(vlc_args), self.exc.ref())
        self.exc.check()
        self.vlc_instance = libvlc.libvlc_get_vlc_instance(self.vlc)
        self.media_player = libvlc.libvlc_media_player_new(self.vlc,
                self.exc.ref())
        self.exc.check()
        self._callback_ref = VLC_EVENT_CALLBACK(self.event_callback)
        self.play_from_time = None
        self.play_state = STOPPED
        self._duration = None
        self._filename = None
        self._rate = 1.0
        self.media_playing = None
        self.callback_info = None
        self._change_subtitle_timout = None
        self.subtitle_info = []
        self._hidden_window = gtk.gdk.Window(
            None, x=0, y=0, width=1, height=1,
            window_type=gtk.gdk.WINDOW_TOPLEVEL,
            wclass=gtk.gdk.INPUT_OUTPUT, event_mask=0)
        self.unset_widget()
示例#2
0
文件: utils.py 项目: nxmirrors/miro
def launch_download_daemon(oldpid, env):
    kill_process(oldpid)
    for key, value in env.items():
        os.environ[key] = value
    os.environ['DEMOCRACY_DOWNLOADER_LOG'] = app.config.get(prefs.DOWNLOADER_LOG_PATHNAME)
    os.environ['MIRO_APP_VERSION'] = app.config.get(prefs.APP_VERSION)
    # Start the downloader.  We use the subprocess module to turn off
    # the console.  One slightly awkward thing is that the current
    # process might not have a valid stdin/stdout/stderr, so we create
    # a pipe to it that we never actually use.

    # Note that we use "Miro" instead of the app name here, so custom
    # versions will work

    # Note that the application filename has to be in double-quotes
    # otherwise it kicks up "%1 is not a valid Win32 application"
    # errors on some Windows machines.  Why it only happens on some is
    # a mystery of the universe.  Bug #9274.
    downloaderPath = '"%s"' % os.path.join(resources.appRoot(),
            "Miro_Downloader.exe") 
    startupinfo = subprocess.STARTUPINFO()
    # TEMPORARY: the STARTF_USESHOWWINDOW has been moved into
    # subprocess._subprocess in Python 2.6.6 and beyond.
    try:
        startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
    except AttributeError:
        startupinfo.dwFlags |= subprocess._subprocess.STARTF_USESHOWWINDOW
    subprocess.Popen(downloaderPath, stdout=subprocess.PIPE,
            stderr=subprocess.PIPE, 
            stdin=subprocess.PIPE,
            startupinfo=startupinfo)
示例#3
0
文件: vlc.py 项目: nxmirrors/miro
    def __init__(self):
        plugin_dir = os.path.join(resources.appRoot(), 'vlc-plugins')
        self.exc = VLCException()

        # Note: if you need vlc output to stdout, remove the --quiet
        # from the list of arguments.  Also, you can add -vvv.
        vlc_args = [
            "vlc", '--quiet',
            '--nostats', '--intf', 'dummy', '--volume=0',
            '--no-video-title-show', '--plugin-path', plugin_dir
        ]
        self.vlc = libvlc.libvlc_new(
            len(vlc_args), make_string_list(vlc_args), self.exc.ref())
        self.exc.check()
        self.media_player = libvlc.libvlc_media_player_new(
            self.vlc, self.exc.ref())
        self.exc.check()
        self._callback_ref = VLC_EVENT_CALLBACK(self.event_callback)
        self._filename = None
        self.media_playing = None
        self.callback_info = None

        self._hidden_window = gtk.gdk.Window(
            None, x=0, y=0, width=1, height=1,
            window_type=gtk.gdk.WINDOW_TOPLEVEL,
            wclass=gtk.gdk.INPUT_OUTPUT, event_mask=0)
        libvlc.libvlc_media_player_set_hwnd(
            self.media_player, self._hidden_window.handle, self.exc.ref())
        self.exc.check()
示例#4
0
 def _set_default_icon(self):
     # we set the icon first (if available) so that it doesn't flash
     # on when the window is realized in Application.build_window()
     icopath = os.path.join(resources.appRoot(), "Miro.ico")
     if app.config.get(prefs.THEME_NAME) and app.config.get(options.WINDOWS_ICON):
         themeIcoPath = resources.theme_path(app.config.get(prefs.THEME_NAME),
                                             app.config.get(options.WINDOWS_ICON))
         if os.path.exists(themeIcoPath):
             icopath = themeIcoPath
             gtk.window_set_default_icon_from_file(icopath)
     return icopath
示例#5
0
# You must obey the GNU General Public License in all respects for all of
# the code used other than OpenSSL. If you modify file(s) with this
# exception, you may extend this exception to your version of the file(s),
# but you are not obligated to do so. If you do not wish to do so, delete
# this exception statement from your version. If you delete this exception
# statement from all source files in the program, then also delete it here.

"""Miro test utility -- console application for running unit tests.
"""

import sys
import logging

from miro.plat import utils
utils.initialize_locale()

from miro import bootstrap
bootstrap.bootstrap()

# from miro import gtcache
# gtcache.init()

if "-v" not in sys.argv:
    logging.basicConfig(level=logging.CRITICAL)

from miro import test
from miro.plat import resources

sys.path.append(resources.appRoot())
test.run_tests()
示例#6
0
文件: utils.py 项目: nxmirrors/miro
def get_ffmpeg2theora_executable_path():
    return os.path.join(resources.appRoot(), "ffmpeg2theora.exe")
示例#7
0
文件: utils.py 项目: nxmirrors/miro
def setup_ffmpeg_presets():
    os.environ['FFMPEG_DATADIR'] = resources.appRoot()
示例#8
0
文件: utils.py 项目: nxmirrors/miro
def movie_data_program_info(movie_path, thumbnail_path):
    exe_path = os.path.join(resources.appRoot(), 'Miro_MovieData.exe')
    cmd_line = (exe_path, movie_path, thumbnail_path)
    env = None
    return (cmd_line, env)