def __init__(self, parent=None): """ Constructor """ super(MediaController, self).__init__(parent) self.media_players = {} self.display_controllers = {} self.current_media_players = {} # Timer for video state self.live_timer = QtCore.QTimer() self.live_timer.setInterval(TICK_TIME) self.preview_timer = QtCore.QTimer() self.preview_timer.setInterval(TICK_TIME) # Signals self.live_timer.timeout.connect(self.media_state_live) self.preview_timer.timeout.connect(self.media_state_preview) Registry().register_function('playbackPlay', self.media_play_msg) Registry().register_function('playbackPause', self.media_pause_msg) Registry().register_function('playbackStop', self.media_stop_msg) Registry().register_function('playbackLoop', self.media_loop_msg) Registry().register_function('seek_slider', self.media_seek_msg) Registry().register_function('volume_slider', self.media_volume_msg) Registry().register_function('media_hide', self.media_hide) Registry().register_function('media_blank', self.media_blank) Registry().register_function('media_unblank', self.media_unblank) # Signals for background video Registry().register_function('songs_hide', self.media_hide) Registry().register_function('songs_blank', self.media_blank) Registry().register_function('songs_unblank', self.media_unblank) Registry().register_function('mediaitem_media_rebuild', self._set_active_players) Registry().register_function('mediaitem_suffixes', self._generate_extensions_lists) register_endpoint(media_endpoint)
def setup(self): self.vlc_player = None self.current_media_players = {} # Timer for video state self.live_timer = QtCore.QTimer() self.live_timer.setInterval(TICK_TIME) self.preview_timer = QtCore.QTimer() self.preview_timer.setInterval(TICK_TIME) # Signals self.live_timer.timeout.connect(self.media_state_live) self.preview_timer.timeout.connect(self.media_state_preview) Registry().register_function('playbackPlay', self.media_play_msg) Registry().register_function('playbackPause', self.media_pause_msg) Registry().register_function('playbackStop', self.media_stop_msg) Registry().register_function('playbackLoop', self.media_loop_msg) Registry().register_function('seek_slider', self.media_seek_msg) Registry().register_function('volume_slider', self.media_volume_msg) Registry().register_function('media_hide', self.media_hide) Registry().register_function('media_blank', self.media_blank) Registry().register_function('media_unblank', self.media_unblank) # Signals for background video Registry().register_function('songs_hide', self.media_hide) Registry().register_function('songs_blank', self.media_blank) Registry().register_function('songs_unblank', self.media_unblank) register_endpoint(media_endpoint)
def __init__(self): super(BiblePlugin, self).__init__('bibles', __default_settings__, BibleMediaItem, BiblesTab) self.weight = -9 self.icon_path = UiIcons().bible self.icon = UiIcons().bible self.manager = BibleManager(self) register_endpoint(bibles_endpoint) register_endpoint(api_bibles_endpoint)
def __init__(self): super(CustomPlugin, self).__init__('custom', __default_settings__, CustomMediaItem, CustomTab) self.weight = -5 self.db_manager = Manager('custom', init_schema) self.icon_path = UiIcons().clone self.icon = build_icon(self.icon_path) register_endpoint(custom_endpoint) register_endpoint(api_custom_endpoint)
def __init__(self): super(ImagePlugin, self).__init__('images', __default_settings__, ImageMediaItem, ImageTab) self.manager = Manager('images', init_schema, upgrade_mod=upgrade) self.weight = -7 self.icon_path = UiIcons().picture self.icon = build_icon(self.icon_path) register_endpoint(images_endpoint) register_endpoint(api_images_endpoint)
def __init__(self): super(ImagePlugin, self).__init__('images', ImageMediaItem, ImageTab) self.manager = Manager('images', init_schema, upgrade_mod=upgrade) self.weight = -7 self.icon_path = UiIcons().picture self.icon = build_icon(self.icon_path) register_endpoint(images_endpoint) register_endpoint(api_images_endpoint) State().add_service('image', self.weight, is_plugin=True) State().update_pre_conditions('image', self.check_pre_conditions())
def __init__(self): super(MediaPlugin, self).__init__('media', __default_settings__, MediaMediaItem) self.weight = -6 self.icon_path = UiIcons().video self.icon = build_icon(self.icon_path) # passed with drag and drop messages self.dnd_id = 'Media' register_endpoint(media_endpoint) register_endpoint(api_media_endpoint)
def __init__(self): super(BiblePlugin, self).__init__('bibles', BibleMediaItem, BiblesTab) self.weight = -9 self.icon_path = UiIcons().bible self.icon = UiIcons().bible self.manager = BibleManager(self) register_endpoint(bibles_endpoint) register_endpoint(api_bibles_endpoint) State().add_service('bible', self.weight, is_plugin=True) State().update_pre_conditions('bible', self.check_pre_conditions())
def __init__(self): super(CustomPlugin, self).__init__('custom', CustomMediaItem, CustomTab) self.weight = -5 self.db_manager = Manager('custom', init_schema) self.icon_path = UiIcons().clone self.icon = build_icon(self.icon_path) register_endpoint(custom_endpoint) register_endpoint(api_custom_endpoint) State().add_service(self.name, self.weight, is_plugin=True) State().update_pre_conditions(self.name, self.check_pre_conditions())
def __init__(self): """ PluginPresentation constructor. """ log.debug('Initialised') self.controllers = {} Plugin.__init__(self, 'presentations', __default_settings__, __default_settings__) self.weight = -8 self.icon_path = UiIcons().presentation self.icon = build_icon(self.icon_path) register_endpoint(presentations_endpoint) register_endpoint(api_presentations_endpoint)
def __init__(self): super(MediaPlugin, self).__init__('media', MediaMediaItem) self.weight = -6 self.icon_path = UiIcons().video self.icon = build_icon(self.icon_path) # passed with drag and drop messages self.dnd_id = 'Media' register_endpoint(media_endpoint) register_endpoint(api_media_endpoint) State().add_service(self.name, self.weight, requires='mediacontroller', is_plugin=True) State().update_pre_conditions(self.name, self.check_pre_conditions())
def __init__(self): """ PluginPresentation constructor. """ log.debug('Initialised') self.controllers = {} Plugin.__init__(self, 'presentations', None) self.weight = -8 self.icon_path = UiIcons().presentation self.icon = build_icon(self.icon_path) register_endpoint(presentations_endpoint) register_endpoint(api_presentations_endpoint) State().add_service('presentation', self.weight, is_plugin=True) State().update_pre_conditions('presentation', self.check_pre_conditions())
def __init__(self): """ Class __init__ method """ super(AlertsPlugin, self).__init__('alerts', __default_settings__, settings_tab_class=AlertsTab) self.weight = -3 self.icon_path = UiIcons().alert self.icon = self.icon_path AlertsManager(self) self.manager = Manager('alerts', init_schema) self.alert_form = AlertForm(self) register_endpoint(alerts_endpoint) register_endpoint(api_alerts_endpoint)
def __init__(self): """ Class __init__ method """ super(AlertsPlugin, self).__init__('alerts', settings_tab_class=AlertsTab) self.weight = -3 self.icon_path = UiIcons().alert self.icon = self.icon_path AlertsManager(self) self.manager = Manager('alerts', init_schema) self.alert_form = AlertForm(self) register_endpoint(alerts_endpoint) register_endpoint(api_alerts_endpoint) State().add_service(self.name, self.weight, is_plugin=True) State().update_pre_conditions(self.name, self.check_pre_conditions())
def __init__(self): """ Create and set up the Songs plugin. """ super(SongsPlugin, self).__init__('songs', SongMediaItem, SongsTab) self.manager = Manager('songs', init_schema, upgrade_mod=upgrade) self.weight = -10 self.icon_path = UiIcons().music self.icon = build_icon(self.icon_path) self.songselect_form = None self.settings.extend_default_settings(song_footer) register_endpoint(songs_endpoint) register_endpoint(api_songs_endpoint) State().add_service(self.name, self.weight, is_plugin=True) State().update_pre_conditions(self.name, self.check_pre_conditions()) if not self.settings.value('songs/last import type'): self.settings.setValue('songs/last import type', SongFormat.OpenLyrics)
def bootstrap_post_set_up(self): """ Register the poll return service and start the servers. """ self.initialise() self.poller = Poller() Registry().register('poller', self.poller) application.initialise() register_endpoint(controller_endpoint) register_endpoint(api_controller_endpoint) register_endpoint(chords_endpoint) register_endpoint(stage_endpoint) register_endpoint(blank_endpoint) register_endpoint(main_endpoint) register_endpoint(service_endpoint) register_endpoint(api_service_endpoint) register_endpoint(remote_endpoint)
rqst.path = '/test/api' rqst.method = 'GET' with self.assertRaises(NotFound) as context: application.dispatch(rqst) # THEN: the not found returned assert context.exception.args[ 0] == 'Not Found', 'URL not found in dispatcher' # WHEN: when the URL is correct and dispatch called rqst = MagicMock() rqst.path = '/test/image' rqst.method = 'GET' application.dispatch(rqst) # THEN: the not found id called assert 1 == application.route_map['^\\/test\\/image$']['GET'].call_count, \ 'main_index function should have been called' @test_endpoint.route('image') def image(request): pass @test_endpoint.route('') def index(request): pass register_endpoint(test_endpoint)