1 # -*- coding: utf-8 -*-
3 # gPodder - A media aggregator and podcast client
4 # Copyright (c) 2005-2018 The gPodder Team
6 # gPodder is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 3 of the License, or
9 # (at your option) any later version.
11 # gPodder is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
20 # gpodder.core - Common functionality used by all UIs
21 # Thomas Perl <thp@gpodder.org>; 2011-02-06
25 from gpodder
import config
, dbsqlite
, extensions
, model
, util
30 config_class
=config
.Config
,
31 database_class
=dbsqlite
.Database
,
32 model_class
=model
.Model
):
33 # Initialize the gPodder home directory
34 util
.make_directory(gpodder
.home
)
36 # Open the database and configuration file
37 self
.db
= database_class(gpodder
.database_file
)
38 self
.model
= model_class(self
.db
)
39 self
.config
= config_class(gpodder
.config_file
)
41 # Load extension modules and install the extension manager
42 gpodder
.user_extensions
= extensions
.ExtensionManager(self
)
44 # Load installed/configured plugins
45 gpodder
.load_plugins()
47 # Update the current device in the configuration
48 self
.config
.mygpo
.device
.type = util
.detect_device_type()
51 # Notify all extensions that we are being shut down
52 gpodder
.user_extensions
.shutdown()
54 # Close the database and store outstanding changes