1
# -*- coding: utf-8 -*-
3
# gPodder - A media aggregator and podcast client
4
# Copyright (c) 2005-2011 Thomas Perl and 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
__author__ = 'Thomas Perl <thp@gpodder.org>'
22
__date__ = '2011-05-03'
23
__copyright__ = '© 2005-2011 Thomas Perl and the gPodder Team'
24
__licence__ = 'GNU General Public License, version 3 or later'
25
__url__ = 'http://gpodder.org/'
33
# Check if real hard dependencies are available
38
Error: Module "feedparser" not found. Please install "python-feedparser".
39
The feedparser module can be downloaded from www.feedparser.org.
48
Error: Module "mygpoclient" not found. Please install "python-mygpoclient"
49
or download it from http://thp.io/2010/mygpoclient/
54
# The User-Agent string for downloads
55
user_agent = 'gPodder/%s (+%s)' % (__version__, __url__)
57
# Are we running in GUI, Maemo or console mode?
62
self.fremantle = False
66
return self.diablo or self.fremantle
70
# D-Bus specific interface names
71
dbus_bus_name = 'org.gpodder'
72
dbus_gui_object_path = '/gui'
73
dbus_podcasts_object_path = '/podcasts'
74
dbus_interface = 'org.gpodder.interface'
75
dbus_podcasts = 'org.gpodder.podcasts'
76
dbus_session_bus = None
78
# Set "win32" to True if we are on Windows
79
win32 = (platform.system() == 'Windows')
81
# i18n setup (will result in "gettext" to be available)
82
# Use _ = gpodder.gettext in modules to enable string translations
83
textdomain = 'gpodder'
84
locale_dir = gettext.bindtextdomain(textdomain)
85
t = gettext.translation(textdomain, locale_dir, fallback=True)
87
ngettext = t.ungettext
89
# Workaround for bug 650
90
from gtk.glade import bindtextdomain
91
bindtextdomain(textdomain, locale_dir)
95
# Set up textdomain for gtk.Builder (this accesses the C library functions)
96
if hasattr(locale, 'bindtextdomain'):
97
locale.bindtextdomain(textdomain, locale_dir)
99
# On Win32, the locale module does not have bindtextdomain. We use a
100
# small module that provides similar functionality here (from doc/dev/).
102
import gtkbuilderi18n
103
gtkbuilderi18n.bindtextdomain(textdomain, locale_dir)
104
except ImportError, ioe:
109
# Set up socket timeouts to fix bug 174
112
socket.setdefaulttimeout(SOCKET_TIMEOUT)
116
# Variables reserved for GUI-specific use (will be set accordingly)
123
# Episode states used in the database
124
STATE_NORMAL, STATE_DOWNLOADED, STATE_DELETED = range(3)
126
# Default locations for configuration and data files
127
default_home = os.path.expanduser(os.path.join('~', '.config', 'gpodder'))
128
home = os.environ.get('GPODDER_HOME', None)
132
print >>sys.stderr, 'Using', home, 'to store data (GPODDER_HOME is set)'
133
subscription_file = os.path.join(home, 'channels.opml')
134
config_file = os.path.join(home, 'gpodder.conf')
135
database_file = os.path.join(home, 'database.sqlite')
137
# Plugins to load by default
138
DEFAULT_PLUGINS = ['gpodder.soundcloud', 'gpodder.xspf']
141
"""Load (non-essential) plugin modules
143
This loads a default set of plugins, but you can use
144
the environment variable "GPODDER_PLUGINS" to modify
145
the list of plugins."""
146
global DEFAULT_PLUGINS
147
PLUGINS = os.environ.get('GPODDER_PLUGINS', None)
149
PLUGINS = DEFAULT_PLUGINS
151
PLUGINS = PLUGINS.split()
152
for plugin in PLUGINS:
156
print >>sys.stderr, 'Cannot load plugin: %s (%s)' % (plugin, e)