Ejemplo n.º 1
0
class Main():
    def __init__(self):
        DBusService(self)

        logger.info('galicaster.__version__: %r', __version__)
        logger.info('galicaster.__file__: %r', __file__)

        self.change_cwd()

        self.conf = context.get_conf()
        self.state = context.get_state()
        self.dispatcher = context.get_dispatcher()
        self.modules = self.conf.get_modules()
        self.load_modules()
        self.dispatcher.connect('net-up', self.check_net, True)
        self.dispatcher.connect('net-down', self.check_net, False)

    def load_modules(self):        
        self.window = context.get_mainwindow()

        # Load plugins after loading the main window (fixes a problem with the plugin 'nocursor')
        plugins.init()
               
        # Recorder
        self.recorder = RecorderClassUI()
        self.window.insert_page(self.recorder, 'REC', REC) 

        if 'scheduler' in self.modules:        
            self.scheduler = context.get_scheduler()

        if 'media_manager' in self.modules:
            self.dispatcher.connect('change-mode', self.change_mode)

            # Distribution
            self.distribution = DistribUI()
            self.window.insert_page(self.distribution, 'DISTRIBUTION', DIS) 

            # Media Manager
            self.listing  = ListingClassUI()
            self.window.insert_page(self.listing, 'LIST', MMA)
        
        if 'player' in self.modules:
            self.player = PlayerClassUI()
            self.window.insert_page(self.player, 'PLAYER', PLA)

        self.window.start()

        self.recorder.go_ahead() # allows record area to load devices and show preview

        if 'media_manager' in self.modules:            
            self.window.set_current_page(DIS)
            self.state.area = DIS
        else:
            self.window.set_current_page(REC)
            self.state.area = REC
            self.recorder.block()  

        context.get_heartbeat().init_timer()
        self.dispatcher.emit("galicaster-init")


    def emit_quit(self):
        self.dispatcher.emit('galicaster-notify-quit')

    def change_mode(self, origin, page):
        old_page = self.window.get_current_page()
        self.window.set_current_page(page)  
        self.state.area = page
        self.dispatcher.emit('galicaster-status', old_page, page)

    def check_net(self, origin, data):
        self.state.net = data

    def change_cwd(self):
        repo = context.get_repository()
        rectemp = repo.get_rectemp_path()

        logger.info("Changing current working dir (cwd) to {}".format(rectemp))
        os.chdir(rectemp)
Ejemplo n.º 2
0
class Main():
    def __init__(self):
        service = DBusService(self)
        self.conf = context.get_conf()
        self.state = context.get_state()
        self.dispatcher = context.get_dispatcher()

        self.modules = []
        self.modules.append('recorder')
             
        if self.conf.get_boolean('basic', 'admin'):
            self.modules.append('media_manager')
            self.modules.append('player')

        if self.conf.get_boolean('ingest', 'active'):
            self.modules.append('scheduler')

        if self.conf.get_boolean('basic', 'pin'):
            self.modules.append('pin')

        self.load_modules()
        self.dispatcher.connect('net-up', self.check_net, True)
        self.dispatcher.connect('net-down', self.check_net, False)

    def load_modules(self):
        self.window = context.get_mainwindow()
               
        # Recorder
        self.recorder = RecorderClassUI()
        self.window.insert_page(self.recorder, 'REC', REC) 

        if 'scheduler' in self.modules:        
            self.scheduler = context.get_scheduler()

        if 'media_manager' in self.modules:
            self.dispatcher.connect('change-mode', self.change_mode)
            self.dispatcher.connect('play-list', self.play_mp)

            # Distribution
            self.distribution = DistribUI()
            self.window.insert_page(self.distribution, 'DISTRIBUTION', DIS) 

            # Media Manager
            self.listing  = ListingClassUI()
            self.window.insert_page(self.listing, 'LIST', MMA)
        
        if 'player' in self.modules:
            self.player = PlayerClassUI()
            self.window.insert_page(self.player, 'PLAYER', PLA)

        self.window.start()

        if 'recorder' and 'media_manager' in self.modules:            
            self.window.set_current_page(DIS)
        else:
            self.window.set_current_page(REC)
            self.recorder.block()  

        plugins.init()
        context.get_heartbeat().init_timer()


    def emit_quit(self):
        self.dispatcher.emit('galicaster-notify-quit')


    def change_mode(self, origin, page):
        old_page = self.window.get_current_page()
        self.window.set_current_page(page)  
        self.state.area = page
        self.dispatcher.emit('galicaster-status', old_page, page)


    def play_mp(self,origin, mediapackage): 
        """
        Plays a mediapackage
        """
        self.change_mode(None, PLA)
        self.player.play_from_list(mediapackage)


    def check_net(self, origin, data):
        context.get_state().net = data
Ejemplo n.º 3
0
class Main:
    def __init__(self):
        DBusService(self)

        logger.info("galicaster.__version__: %r", __version__)
        logger.info("galicaster.__file__: %r", __file__)

        self.conf = context.get_conf()
        self.state = context.get_state()
        self.dispatcher = context.get_dispatcher()
        self.modules = self.conf.get_modules()
        self.load_modules()
        self.dispatcher.connect("net-up", self.check_net, True)
        self.dispatcher.connect("net-down", self.check_net, False)

    def load_modules(self):
        plugins.init()

        self.window = context.get_mainwindow()

        # Recorder
        self.recorder = RecorderClassUI()
        self.window.insert_page(self.recorder, "REC", REC)

        if "scheduler" in self.modules:
            self.scheduler = context.get_scheduler()

        if "media_manager" in self.modules:
            self.dispatcher.connect("change-mode", self.change_mode)

            # Distribution
            self.distribution = DistribUI()
            self.window.insert_page(self.distribution, "DISTRIBUTION", DIS)

            # Media Manager
            self.listing = ListingClassUI()
            self.window.insert_page(self.listing, "LIST", MMA)

        if "player" in self.modules:
            self.player = PlayerClassUI()
            self.window.insert_page(self.player, "PLAYER", PLA)

        self.window.start()

        self.recorder.go_ahead()  # allows record area to load devices and show preview

        if "media_manager" in self.modules:
            self.window.set_current_page(DIS)
            self.state.area = DIS
        else:
            self.window.set_current_page(REC)
            self.state.area = REC
            self.recorder.block()

        context.get_heartbeat().init_timer()
        self.dispatcher.emit("galicaster-init")

    def emit_quit(self):
        self.dispatcher.emit("galicaster-notify-quit")

    def change_mode(self, origin, page):
        old_page = self.window.get_current_page()
        self.window.set_current_page(page)
        self.state.area = page
        self.dispatcher.emit("galicaster-status", old_page, page)

    def check_net(self, origin, data):
        self.state.net = data
Ejemplo n.º 4
0
class Main():
    def __init__(self):
        DBusService(self)

        logger.info('galicaster.__version__: %r', __version__)
        logger.info('galicaster.__file__: %r', __file__)

        self.conf = context.get_conf()
        self.state = context.get_state()
        self.dispatcher = context.get_dispatcher()
        self.modules = self.conf.get_modules()
        self.load_modules()
        self.dispatcher.connect('net-up', self.check_net, True)
        self.dispatcher.connect('net-down', self.check_net, False)

    def load_modules(self):
        self.window = context.get_mainwindow()

        # Recorder
        self.recorder = RecorderClassUI()
        self.window.insert_page(self.recorder, 'REC', REC)

        if 'scheduler' in self.modules:
            self.scheduler = context.get_scheduler()

        if 'media_manager' in self.modules:
            self.dispatcher.connect('change-mode', self.change_mode)

            # Distribution
            self.distribution = DistribUI()
            self.window.insert_page(self.distribution, 'DISTRIBUTION', DIS)

            # Media Manager
            self.listing = ListingClassUI()
            self.window.insert_page(self.listing, 'LIST', MMA)

        if 'player' in self.modules:
            self.player = PlayerClassUI()
            self.window.insert_page(self.player, 'PLAYER', PLA)

        self.window.start()

        self.recorder.go_ahead(
        )  # allows record area to load devices and show preview

        if 'media_manager' in self.modules:
            self.window.set_current_page(DIS)
            self.state.area = DIS
        else:
            self.window.set_current_page(REC)
            self.state.area = REC
            self.recorder.block()

        plugins.init()
        context.get_heartbeat().init_timer()

    def emit_quit(self):
        self.dispatcher.emit('galicaster-notify-quit')

    def change_mode(self, origin, page):
        old_page = self.window.get_current_page()
        self.window.set_current_page(page)
        self.state.area = page
        self.dispatcher.emit('galicaster-status', old_page, page)

    def check_net(self, origin, data):
        self.state.net = data
Ejemplo n.º 5
0
class Main():
    def __init__(self):
        DBusService(self)

        logger.info('galicaster.__version__: %r', __version__)
        logger.info('galicaster.__file__: %r', __file__)

        self.change_cwd()

        self.conf = context.get_conf()
        self.dispatcher = context.get_dispatcher()
        self.modules = self.conf.get_modules()
        self.load_modules()

    def load_modules(self):
        self.window = context.get_mainwindow()
        # Load plugins after loading the main window (fixes a problem with the plugin 'nocursor')
        plugins.init()

        # Recorder
        self.recorder = RecorderClassUI()
        self.insert_page(self.recorder, 'REC')

        if 'scheduler' in self.modules:
            self.scheduler = context.get_scheduler()

        if 'ocservice' in self.modules:
            self.ocservice = context.get_ocservice()

        if 'media_manager' in self.modules:
            self.dispatcher.connect('action-view-change', self.change_mode)

            # Distribution
            self.distribution = DistribUI()
            self.insert_page(self.distribution, 'DIS')

            # Media Manager
            self.listing  = ListingClassUI()
            self.insert_page(self.listing, 'MMA')

        if 'player' in self.modules:
            self.player = PlayerClassUI()
            self.insert_page(self.player, 'PLA')

        self.window.start()

        # Set home page
        homepage = self.conf.get_choice('basic', 'homepage', ['rec', 'pla', 'mma', 'dis'], 'mma').upper()
        if not 'media_manager' in self.modules or PAGES[homepage] not in PAGES_LOADED:
            logger.info("Set REC as home page (default value), modules loaded: {}".format(self.modules))
            self.window.set_current_page(PAGES['REC'])
            self.recorder.block()
        else:
            logger.info("Set {} as home page, modules loaded: {}".format(homepage, self.modules))
            self.window.set_current_page(PAGES[homepage])

        context.get_heartbeat().init_timer()
        self.dispatcher.emit("init")


    def insert_page(self, classui, name):
        self.window.insert_page(classui, name, PAGES[name])
        PAGES_LOADED.append(PAGES[name])

    def emit_quit(self):
        self.dispatcher.emit('quit')

    def change_mode(self, origin, page):
        old_page = self.window.get_current_page()
        self.window.set_current_page(page)
        self.dispatcher.emit('view-changed', old_page, page)

    def check_net(self, origin, data):
        self.state.net = data

    def change_cwd(self):
        repo = context.get_repository()
        rectemp = repo.get_rectemp_path()

        logger.info("Changing current working dir (cwd) to {}".format(rectemp))
        os.chdir(rectemp)

    def quit(self):
        self.window.do_quit()
Ejemplo n.º 6
0
class Main():
    def __init__(self):
        DBusService(self)

        logger.info('galicaster.__version__: %r', __version__)
        logger.info('galicaster.__file__: %r', __file__)

        self.change_cwd()

        self.conf = context.get_conf()
        self.dispatcher = context.get_dispatcher()
        self.modules = self.conf.get_modules()
        self.load_modules()

    def load_modules(self):
        self.window = context.get_mainwindow()
        # Load plugins after loading the main window (fixes a problem with the plugin 'nocursor')
        plugins.init()

        # Recorder
        self.recorder = RecorderClassUI()
        self.insert_page(self.recorder, 'REC')

        if 'scheduler' in self.modules:
            self.scheduler = context.get_scheduler()

        if 'ocservice' in self.modules:
            self.ocservice = context.get_ocservice()

        if 'media_manager' in self.modules:
            self.dispatcher.connect('action-view-change', self.change_mode)

            # Distribution
            self.distribution = DistribUI()
            self.insert_page(self.distribution, 'DIS')

            # Media Manager
            self.listing  = ListingClassUI()
            self.insert_page(self.listing, 'MMA')

        if 'player' in self.modules:
            self.player = PlayerClassUI()
            self.insert_page(self.player, 'PLA')

        self.window.start()

        # Set home page
        homepage = self.conf.get_choice('basic', 'homepage', ['rec', 'pla', 'mma', 'dis'], 'mma').upper()
        if not 'media_manager' in self.modules or PAGES[homepage] not in PAGES_LOADED:
            logger.info("Set REC as home page (default value), modules loaded: {}".format(self.modules))
            self.window.set_current_page(PAGES['REC'])
            self.recorder.block()
        else:
            logger.info("Set {} as home page, modules loaded: {}".format(homepage, self.modules))
            self.window.set_current_page(PAGES[homepage])

        # Notify home page setting by issuing a 'view-changed' signal
        self.dispatcher.emit('view-changed', None, self.window.get_current_page())

        context.get_heartbeat().init_timer()
        self.dispatcher.emit("init")


    def insert_page(self, classui, name):
        self.window.insert_page(classui, name, PAGES[name])
        PAGES_LOADED.append(PAGES[name])

    def emit_quit(self):
        self.dispatcher.emit('quit')

    def change_mode(self, origin, page):
        old_page = self.window.get_current_page()
        self.window.set_current_page(page)
        self.dispatcher.emit('view-changed', old_page, page)

    def check_net(self, origin, data):
        self.state.net = data

    def change_cwd(self):
        repo = context.get_repository()
        rectemp = repo.get_rectemp_path()

        logger.info("Changing current working dir (cwd) to {}".format(rectemp))
        os.chdir(rectemp)

    def quit(self):
        self.window.do_quit()
Ejemplo n.º 7
0
class Main():
    def __init__(self):
        service = DBusService(self)
        self.conf = context.get_conf()
        self.state = context.get_state()
        self.dispatcher = context.get_dispatcher()

        self.modules = []
        self.modules.append('recorder')

        if self.conf.get_boolean('basic', 'admin'):
            self.modules.append('media_manager')
            self.modules.append('player')

        if self.conf.get_boolean('ingest', 'active'):
            self.modules.append('scheduler')

        if self.conf.get_boolean('basic', 'pin'):
            self.modules.append('pin')

        self.load_modules()
        self.dispatcher.connect('net-up', self.check_net, True)
        self.dispatcher.connect('net-down', self.check_net, False)

    def load_modules(self):
        self.window = context.get_mainwindow()

        # Recorder
        self.recorder = RecorderClassUI()
        self.window.insert_page(self.recorder, 'REC', REC)

        if 'scheduler' in self.modules:
            self.scheduler = context.get_scheduler()

        if 'media_manager' in self.modules:
            self.dispatcher.connect('change-mode', self.change_mode)
            self.dispatcher.connect('play-list', self.play_mp)

            # Distribution
            self.distribution = DistribUI()
            self.window.insert_page(self.distribution, 'DISTRIBUTION', DIS)

            # Media Manager
            self.listing = ListingClassUI()
            self.window.insert_page(self.listing, 'LIST', MMA)

        if 'player' in self.modules:
            self.player = PlayerClassUI()
            self.window.insert_page(self.player, 'PLAYER', PLA)

        self.window.start()

        if 'recorder' and 'media_manager' in self.modules:
            self.window.set_current_page(DIS)
        else:
            self.window.set_current_page(REC)
            self.recorder.block()

        plugins.init()
        context.get_heartbeat().init_timer()

    def emit_quit(self):
        self.dispatcher.emit('galicaster-notify-quit')

    def change_mode(self, origin, page):
        old_page = self.window.get_current_page()
        self.window.set_current_page(page)
        self.state.area = page
        self.dispatcher.emit('galicaster-status', old_page, page)

    def play_mp(self, origin, mediapackage):
        """
        Plays a mediapackage
        """
        self.change_mode(None, PLA)
        self.player.play_from_list(mediapackage)

    def check_net(self, origin, data):
        context.get_state().net = data
Ejemplo n.º 8
0
class Main():
    def __init__(self):
        DBusService(self)

        logger.info('galicaster.__version__: %r', __version__)
        logger.info('galicaster.__file__: %r', __file__)

        self.conf = context.get_conf()
        self.state = context.get_state()
        self.dispatcher = context.get_dispatcher()
        self.modules = self.conf.get_modules()
        self.load_modules()
        self.dispatcher.connect('net-up', self.check_net, True)
        self.dispatcher.connect('net-down', self.check_net, False)
        self.dispatcher.connect("reload-profile", self.reload_profile)
        self.reload_profile(None) # To exec the execute to start

    def load_modules(self):
        self.window = context.get_mainwindow()
               
        # Recorder
        self.recorder = RecorderClassUI()
        self.window.insert_page(self.recorder, 'REC', REC) 

        if 'scheduler' in self.modules:        
            self.scheduler = context.get_scheduler()

        if 'media_manager' in self.modules:
            self.dispatcher.connect('change-mode', self.change_mode)

            # Distribution
            self.distribution = DistribUI()
            self.window.insert_page(self.distribution, 'DISTRIBUTION', DIS) 

            # Media Manager
            self.listing  = ListingClassUI()
            self.window.insert_page(self.listing, 'LIST', MMA)
        
        if 'player' in self.modules:
            self.player = PlayerClassUI()
            self.window.insert_page(self.player, 'PLAYER', PLA)

        self.window.start()

        self.recorder.go_ahead() # allows record area to load devices and show preview

        if 'media_manager' in self.modules:            
            self.window.set_current_page(DIS)
        else:
            self.window.set_current_page(REC)
            self.recorder.block()  

        plugins.init()
        context.get_heartbeat().init_timer()


    def emit_quit(self):
        self.dispatcher.emit('galicaster-notify-quit')


    def change_mode(self, origin, page):
        old_page = self.window.get_current_page()
        self.window.set_current_page(page)  
        self.state.area = page
        self.dispatcher.emit('galicaster-status', old_page, page)


    def check_net(self, origin, data):
        self.state.net = data


    def reload_profile(self, origin):
        profile = self.conf.get_current_profile()
        self.state.profile = profile
        if profile.execute:
            out = os.system(profile.execute)
            logger.info("Executing {0} with out {1}".format(profile.execute, out))
            if out:
                self.dispatcher.emit("recorder-error", "Error executing command configuring profile")