Пример #1
0
    def _on_column_toggled(self, page, column_name, visible):
        if visible:
            # Make column visible
            self._config['visible_columns'].append(column_name)
        else:
            # Make column invisible
            if len(self._config['visible_columns']) <= 1:
                return  # There should be at least 1 column visible

            self._config['visible_columns'].remove(column_name)

        for page in self._pages.values():
            page.set_column_visible(column_name, visible)

        utils.save_config(self._config, self._configfile)
Пример #2
0
    def _column_toggled(self, w, column_name, visible):
        if visible:
            # Make column visible
            self._config['visible_columns'].append(column_name)

            for view in self.show_lists.values():
                view.cols[column_name].set_visible(True)
        else:
            # Make column invisible
            if len(self._config['visible_columns']) <= 1:
                return  # There should be at least 1 column visible

            self._config['visible_columns'].remove(column_name)
            for view in self.show_lists.values():
                view.cols[column_name].set_visible(False)

        utils.save_config(self._config, self._configfile)
Пример #3
0
    def _save(self):
        engine = self.worker.engine

        engine.set_config('tracker_enabled',       self.tracker_enabled.isChecked())
        engine.set_config('tracker_type',          self.tracker_type.itemData(self.tracker_type.currentIndex()))
        engine.set_config('tracker_interval',      self.tracker_interval.value())
        engine.set_config('tracker_process',       str(self.tracker_process.text()))
        engine.set_config('tracker_update_wait_s', self.tracker_update_wait.value())
        engine.set_config('tracker_update_close',  self.tracker_update_close.isChecked())
        engine.set_config('tracker_update_prompt', self.tracker_update_prompt.isChecked())
        engine.set_config('tracker_not_found_prompt', self.tracker_not_found_prompt.isChecked())

        engine.set_config('player',            self.player.text())
        engine.set_config('library_autoscan',  self.library_autoscan.isChecked())
        engine.set_config('scan_whole_list', self.scan_whole_list.isChecked())
        engine.set_config('library_full_path', self.library_full_path.isChecked())
        engine.set_config('plex_host',         self.plex_host.text())
        engine.set_config('plex_port',         self.plex_port.text())
        engine.set_config('plex_obey_update_wait_s', self.plex_obey_wait.isChecked())
        engine.set_config('plex_user',         self.plex_user.text())
        engine.set_config('plex_passwd',       self.plex_passw.text())

        engine.set_config('searchdir',         [self.searchdirs.item(i).text() for i in range(self.searchdirs.count())])

        if self.autoretrieve_always.isChecked():
            engine.set_config('autoretrieve', 'always')
        elif self.autoretrieve_days.isChecked():
            engine.set_config('autoretrieve', 'days')
        else:
            engine.set_config('autoretrieve', 'off')

        engine.set_config('autoretrieve_days',   self.autoretrieve_days_n.value())

        if self.autosend_always.isChecked():
            engine.set_config('autosend', 'always')
        elif self.autosend_minutes.isChecked():
            engine.set_config('autosend', 'minutes')
        elif self.autosend_size.isChecked():
            engine.set_config('autosend', 'size')
        else:
            engine.set_config('autosend', 'off')

        engine.set_config('autosend_minutes', self.autosend_minutes_n.value())
        engine.set_config('autosend_size',  self.autosend_size_n.value())

        engine.set_config('autosend_at_exit',   self.autosend_at_exit.isChecked())
        engine.set_config('auto_status_change', self.auto_status_change.isChecked())
        engine.set_config('auto_status_change_if_scored', self.auto_status_change_if_scored.isChecked())
        engine.set_config('auto_date_change',   self.auto_date_change.isChecked())

        engine.save_config()

        self.config['show_tray'] = self.tray_icon.isChecked()
        self.config['close_to_tray'] = self.close_to_tray.isChecked()
        self.config['start_in_tray'] = self.start_in_tray.isChecked()
        self.config['tray_api_icon'] = self.tray_api_icon.isChecked()
        self.config['notifications'] = self.notifications.isChecked()
        self.config['remember_geometry'] = self.remember_geometry.isChecked()
        self.config['remember_columns'] = self.remember_columns.isChecked()
        self.config['columns_per_api'] = self.columns_per_api.isChecked()
        self.config['filter_bar_position'] = self.filter_bar_position.itemData(self.filter_bar_position.currentIndex())
        self.config['inline_edit'] = self.inline_edit.isChecked()

        self.config['episodebar_style'] = self.ep_bar_style.itemData(self.ep_bar_style.currentIndex())
        self.config['episodebar_text'] = self.ep_bar_text.isChecked()

        self.config['colors'] = self.color_values

        utils.save_config(self.config, self.configfile)

        self.saved.emit()
Пример #4
0
 def _save_userconfig(self):
     self.msg.debug(self.name, "Saving userconfig...")
     utils.save_config(self.userconfig, self.userconfig_file)
Пример #5
0
    def save_config(self):
        """Writes all configuration files to disk."""

        # Save config file
        utils.save_config(self.config, self.configfile)
Пример #6
0
    def save_config(self):
        """Engine Configuration"""
        self.engine.set_config('player', self.btn_file_chooser_executable.get_filename() or '')
        self.engine.set_config('tracker_process', self.entry_player_process.get_text())
        self.engine.set_config('library_autoscan',
                               self.checkbox_library_startup.get_active())
        self.engine.set_config('scan_whole_list',
                               self.checkbox_library_entire_list.get_active())
        self.engine.set_config('library_full_path',
                               self.checkbox_library_full_path.get_active())
        self.engine.set_config('plex_host', self.entry_plex_host.get_text())
        self.engine.set_config('plex_port', str(int(self.spin_plex_port.get_value())))
        self.engine.set_config('plex_obey_update_wait_s', self.checkbox_plex_obey_wait.get_active())
        self.engine.set_config('plex_user', self.entry_plex_username.get_text())
        self.engine.set_config('plex_passwd', self.entry_plex_password.get_text())
        self.engine.set_config('tracker_enabled', self.switch_tracker.get_active())
        self.engine.set_config('autosend_at_exit', self.checkbox_upload_exit.get_active())
        self.engine.set_config('tracker_update_wait_s', self.spin_tracker_update_wait.get_value())
        self.engine.set_config('tracker_update_close', self.checkbox_tracker_update_close.get_active())
        self.engine.set_config('tracker_update_prompt', self.checkbox_tracker_update_prompt.get_active())
        self.engine.set_config('tracker_not_found_prompt', self.checkbox_tracker_not_found_prompt.get_active())

        self.engine.set_config('searchdir', [row.directory for row in self.listbox_directories.get_children()])

        # Tracker type
        if self.radio_tracker_local.get_active():
            self.engine.set_config('tracker_type', 'local')
        elif self.radio_tracker_plex.get_active():
            self.engine.set_config('tracker_type', 'plex')

        # Auto-retrieve
        if self.radiobutton_download_always.get_active():
            self.engine.set_config('autoretrieve', 'always')
        elif self.radiobutton_download_days.get_active():
            self.engine.set_config('autoretrieve', 'days')
        else:
            self.engine.set_config('autoretrieve', 'off')

        # Auto-send
        if self.radiobutton_upload_always.get_active():
            self.engine.set_config('autosend', 'always')
        elif self.radiobutton_upload_minutes.get_active():
            self.engine.set_config('autosend', 'minutes')
        elif self.radiobutton_upload_size.get_active():
            self.engine.set_config('autosend', 'size')
        else:
            self.engine.set_config('autosend', 'off')

        self.engine.set_config('autoretrieve_days', self.spinbutton_download_days.get_value_as_int())
        self.engine.set_config('autosend_minutes', self.spinbutton_upload_minutes.get_value_as_int())
        self.engine.set_config('autosend_size', self.spinbutton_upload_size.get_value_as_int())

        self.engine.set_config('auto_status_change', self.checkbox_auto_status_change.get_active())
        self.engine.set_config('auto_status_change_if_scored', self.checkbox_auto_status_change_if_scored.get_active())
        self.engine.set_config('auto_date_change', self.checkbox_auto_date_change.get_active())
        self.engine.save_config()

        """GTK Interface configuration"""
        self.config['show_tray'] = self.checkbox_show_tray.get_active()

        if self.checkbox_show_tray.get_active():
            self.config['close_to_tray'] = self.checkbox_close_to_tray.get_active()
            self.config['start_in_tray'] = self.checkbox_start_in_tray.get_active()
            self.config['tray_api_icon'] = self.checkbox_tray_api_icon.get_active()
        else:
            self.config['close_to_tray'] = False
            self.config['start_in_tray'] = False
            self.config['tray_api_icon'] = False

        self.config['remember_geometry'] = self.checkbox_remember_geometry.get_active()
        self.config['episodebar_style'] = int(not self.checkbox_classic_progress.get_active())

        """Update Colors"""
        self.config['colors'] = {key: reprColor(col.get_color()) for key, col in self._color_buttons.items()}

        utils.save_config(self.config, self.configfile)
Пример #7
0
 def _store_geometry(self):
     (width, height) = self.get_size()
     self._config['last_width'] = width
     self._config['last_height'] = height
     utils.save_config(self._config, self._configfile)
Пример #8
0
    def _save(self):
        engine = self.worker.engine

        engine.set_config('tracker_enabled', self.tracker_enabled.isChecked())
        engine.set_config(
            'tracker_type',
            self.tracker_type.itemData(self.tracker_type.currentIndex()))
        engine.set_config('tracker_interval', self.tracker_interval.value())
        engine.set_config('tracker_process', str(self.tracker_process.text()))
        engine.set_config('tracker_update_wait_s',
                          self.tracker_update_wait.value())
        engine.set_config('tracker_update_close',
                          self.tracker_update_close.isChecked())
        engine.set_config('tracker_update_prompt',
                          self.tracker_update_prompt.isChecked())
        engine.set_config('tracker_not_found_prompt',
                          self.tracker_not_found_prompt.isChecked())
        engine.set_config('tracker_ignore_not_next',
                          self.tracker_ignore_not_next.isChecked())

        engine.set_config('player', self.player.text())
        engine.set_config('library_autoscan',
                          self.library_autoscan.isChecked())
        engine.set_config('scan_whole_list', self.scan_whole_list.isChecked())
        engine.set_config('library_full_path',
                          self.library_full_path.isChecked())

        engine.set_config('plex_host', self.plex_host.text())
        engine.set_config('plex_port', self.plex_port.text())
        engine.set_config('plex_obey_update_wait_s',
                          self.plex_obey_wait.isChecked())
        engine.set_config('plex_user', self.plex_user.text())
        engine.set_config('plex_passwd', self.plex_passw.text())

        engine.set_config('jellyfin_host', self.jellyfin_host.text())
        engine.set_config('jellyfin_port', self.jellyfin_port.text())
        engine.set_config('jellyfin_user', self.jellyfin_user.text())
        engine.set_config('jellyfin_apikey', self.jellyfin_apikey.text())

        engine.set_config('kodi_host', self.kodi_host.text())
        engine.set_config('kodi_port', self.kodi_port.text())
        engine.set_config('kodi_obey_update_wait_s',
                          self.kodi_obey_wait.isChecked())
        engine.set_config('kodi_user', self.kodi_user.text())
        engine.set_config('kodi_passwd', self.kodi_passw.text())

        engine.set_config('searchdir', [
            self.searchdirs.item(i).text()
            for i in range(self.searchdirs.count())
        ])

        if self.autoretrieve_always.isChecked():
            engine.set_config('autoretrieve', 'always')
        elif self.autoretrieve_days.isChecked():
            engine.set_config('autoretrieve', 'days')
        else:
            engine.set_config('autoretrieve', 'off')

        engine.set_config('autoretrieve_days',
                          self.autoretrieve_days_n.value())

        if self.autosend_always.isChecked():
            engine.set_config('autosend', 'always')
        elif self.autosend_minutes.isChecked():
            engine.set_config('autosend', 'minutes')
        elif self.autosend_size.isChecked():
            engine.set_config('autosend', 'size')
        else:
            engine.set_config('autosend', 'off')

        engine.set_config('autosend_minutes', self.autosend_minutes_n.value())
        engine.set_config('autosend_size', self.autosend_size_n.value())

        engine.set_config('autosend_at_exit',
                          self.autosend_at_exit.isChecked())
        engine.set_config('auto_status_change',
                          self.auto_status_change.isChecked())
        engine.set_config('auto_status_change_if_scored',
                          self.auto_status_change_if_scored.isChecked())
        engine.set_config('auto_date_change',
                          self.auto_date_change.isChecked())

        engine.save_config()

        self.config['show_tray'] = self.tray_icon.isChecked()
        self.config['close_to_tray'] = self.close_to_tray.isChecked()
        self.config['start_in_tray'] = self.start_in_tray.isChecked()
        self.config['tray_api_icon'] = self.tray_api_icon.isChecked()
        self.config['notifications'] = self.notifications.isChecked()
        self.config['remember_geometry'] = self.remember_geometry.isChecked()
        self.config['remember_columns'] = self.remember_columns.isChecked()
        self.config['columns_per_api'] = self.columns_per_api.isChecked()
        self.config['filter_bar_position'] = self.filter_bar_position.itemData(
            self.filter_bar_position.currentIndex())
        self.config['inline_edit'] = self.inline_edit.isChecked()

        self.config['episodebar_style'] = self.ep_bar_style.itemData(
            self.ep_bar_style.currentIndex())
        self.config['episodebar_text'] = self.ep_bar_text.isChecked()

        self.config['colors'] = self.color_values

        utils.save_config(self.config, self.configfile)

        self.saved.emit()
Пример #9
0
    def save_config(self):
        """Writes all configuration files to disk."""

        # Save config file
        utils.save_config(self.config, self.configfile)
Пример #10
0
    def save_config(self):
        """Engine Configuration"""
        self.engine.set_config(
            'player',
            self.btn_file_chooser_executable.get_filename() or '')
        self.engine.set_config('tracker_process',
                               self.entry_player_process.get_text())
        self.engine.set_config('library_autoscan',
                               self.checkbox_library_startup.get_active())
        self.engine.set_config('scan_whole_list',
                               self.checkbox_library_entire_list.get_active())
        self.engine.set_config('library_full_path',
                               self.checkbox_library_full_path.get_active())
        self.engine.set_config('plex_host', self.entry_plex_host.get_text())
        self.engine.set_config('plex_port',
                               str(int(self.spin_plex_port.get_value())))
        self.engine.set_config('plex_obey_update_wait_s',
                               self.checkbox_plex_obey_wait.get_active())
        self.engine.set_config('plex_user',
                               self.entry_plex_username.get_text())
        self.engine.set_config('plex_passwd',
                               self.entry_plex_password.get_text())
        self.engine.set_config('tracker_enabled',
                               self.switch_tracker.get_active())
        self.engine.set_config('autosend_at_exit',
                               self.checkbox_upload_exit.get_active())
        self.engine.set_config('tracker_update_wait_s',
                               self.spin_tracker_update_wait.get_value())
        self.engine.set_config('tracker_update_close',
                               self.checkbox_tracker_update_close.get_active())
        self.engine.set_config(
            'tracker_update_prompt',
            self.checkbox_tracker_update_prompt.get_active())
        self.engine.set_config(
            'tracker_not_found_prompt',
            self.checkbox_tracker_not_found_prompt.get_active())

        self.engine.set_config(
            'searchdir',
            [row.directory for row in self.listbox_directories.get_children()])

        # Tracker type
        if self.radio_tracker_local.get_active():
            self.engine.set_config('tracker_type', 'local')
        elif self.radio_tracker_plex.get_active():
            self.engine.set_config('tracker_type', 'plex')

        # Auto-retrieve
        if self.radiobutton_download_always.get_active():
            self.engine.set_config('autoretrieve', 'always')
        elif self.radiobutton_download_days.get_active():
            self.engine.set_config('autoretrieve', 'days')
        else:
            self.engine.set_config('autoretrieve', 'off')

        # Auto-send
        if self.radiobutton_upload_always.get_active():
            self.engine.set_config('autosend', 'always')
        elif self.radiobutton_upload_minutes.get_active():
            self.engine.set_config('autosend', 'minutes')
        elif self.radiobutton_upload_size.get_active():
            self.engine.set_config('autosend', 'size')
        else:
            self.engine.set_config('autosend', 'off')

        self.engine.set_config(
            'autoretrieve_days',
            self.spinbutton_download_days.get_value_as_int())
        self.engine.set_config(
            'autosend_minutes',
            self.spinbutton_upload_minutes.get_value_as_int())
        self.engine.set_config('autosend_size',
                               self.spinbutton_upload_size.get_value_as_int())

        self.engine.set_config('auto_status_change',
                               self.checkbox_auto_status_change.get_active())
        self.engine.set_config(
            'auto_status_change_if_scored',
            self.checkbox_auto_status_change_if_scored.get_active())
        self.engine.set_config('auto_date_change',
                               self.checkbox_auto_date_change.get_active())
        self.engine.save_config()
        """GTK Interface configuration"""
        self.config['show_tray'] = self.checkbox_show_tray.get_active()

        if self.checkbox_show_tray.get_active():
            self.config[
                'close_to_tray'] = self.checkbox_close_to_tray.get_active()
            self.config[
                'start_in_tray'] = self.checkbox_start_in_tray.get_active()
            self.config[
                'tray_api_icon'] = self.checkbox_tray_api_icon.get_active()
        else:
            self.config['close_to_tray'] = False
            self.config['start_in_tray'] = False
            self.config['tray_api_icon'] = False

        self.config[
            'remember_geometry'] = self.checkbox_remember_geometry.get_active(
            )
        self.config['episodebar_style'] = int(
            not self.checkbox_classic_progress.get_active())
        """Update Colors"""
        self.config['colors'] = {
            key: reprColor(col.get_color())
            for key, col in self._color_buttons.items()
        }

        utils.save_config(self.config, self.configfile)
Пример #11
0
    manager.set_default(1)
else:
    account_exists = False
    for num, account in manager.get_accounts():
        if account["username"] == username and account["api"] == api:
            account_exists = True
            if account["password"] != password:
                print("Account password mismatch, updating...")
                manager.edit_account(num, username, password, api)
            if manager.get_default() != manager.get_account(num):
                print("Setting account as default")
                manager.set_default(num)
            break
    if not account_exists:
        print ("Could not find account, adding account...")
        manager.add_account(username, password, api)
        manager.set_default(len(manager.get_accounts()))

config_path = utils.to_config_path('config.json')

try:
    config = utils.parse_config(config_path, utils.config_defaults)
except IOError:
    raise utils.EngineFatal("Couldn't open config file.")

for key, value in config.items():
    config[key] = env(key.upper(), cast=type(value), default=value)

utils.save_config(config, config_path)