gPodder 2.0 "Day of the Tentacle" released
[gpodder.git] / src / gpodder / __init__.py
blob7967cc7000fe11f19884024910a54f8b165ee991
1 # -*- coding: utf-8 -*-
3 # gPodder - A media aggregator and podcast client
4 # Copyright (c) 2005-2009 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>'
21 __version__ = '2.0'
22 __date__ = '2009-09-15'
23 __copyright__ = '© 2005-2009 Thomas Perl and the gPodder Team'
24 __licence__ = 'GNU General Public License, version 3 or later'
25 __url__ = 'http://gpodder.org/'
27 import os
28 import sys
29 import platform
30 import gettext
31 import locale
33 # Check if real hard dependencies are available
34 try:
35 import feedparser
36 except ImportError:
37 print """
38 Error: Module "feedparser" not found. Please install "python-feedparser".
39 The feedparser module can be downloaded from www.feedparser.org.
40 """
41 sys.exit(1)
42 del feedparser
45 # The User-Agent string for downloads
46 user_agent = 'gPodder/%s (+%s)' % (__version__, __url__)
48 # Interface type enums
49 (CLI, GUI, MAEMO) = range(3)
51 # Are we running in GUI, Maemo or console mode?
52 interface = CLI
54 # D-Bus specific interface names
55 dbus_bus_name = 'org.godder'
56 dbus_gui_object_path = '/gui'
57 dbus_interface = 'org.gpodder.interface'
59 # Set "win32" to True if we are on Windows
60 win32 = (platform.system() == 'Windows')
62 # i18n setup (will result in "gettext" to be available)
63 # Use _ = gpodder.gettext in modules to enable string translations
64 textdomain = 'gpodder'
65 locale_dir = gettext.bindtextdomain(textdomain)
66 t = gettext.translation(textdomain, locale_dir, fallback=True)
67 gettext = t.ugettext
68 del t
70 # Set up textdomain for gtk.Builder (this accesses the C library functions)
71 if hasattr(locale, 'bindtextdomain'):
72 locale.bindtextdomain(textdomain, locale_dir)
73 else:
74 # On Win32, the locale module does not have bindtextdomain. We use a
75 # small module that provides similar functionality here (from doc/dev/).
76 try:
77 import gtkbuilderi18n
78 gtkbuilderi18n.bindtextdomain(textdomain, locale_dir)
79 except ImportError, ioe:
80 pass
82 del locale_dir
84 # Set up socket timeouts to fix bug 174
85 SOCKET_TIMEOUT = 60
86 import socket
87 socket.setdefaulttimeout(SOCKET_TIMEOUT)
88 del socket
89 del SOCKET_TIMEOUT
91 # Variables reserved for GUI-specific use (will be set accordingly)
92 ui_folders = []
93 credits_file = None
94 icon_file = None
96 # Episode states used in the database
97 STATE_NORMAL, STATE_DOWNLOADED, STATE_DELETED = range(3)
99 # Default locations for configuration and data files
100 home = os.path.expanduser(os.path.join('~', '.config', 'gpodder'))
101 subscription_file = os.path.join(home, 'channels.opml')
102 config_file = os.path.join(home, 'gpodder.conf')
103 database_file = os.path.join(home, 'database.sqlite')