/usr/bin/gpodder is in gpodder 3.5.2-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# gPodder - A media aggregator and podcast client
# Copyright (c) 2005-2013 Thomas Perl and the gPodder Team
#
# gPodder is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# gPodder is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
"""
gPodder enables you to subscribe to media feeds (RSS, Atom, YouTube,
Soundcloud, Vimeo and XSPF) and automatically download new content.
This is the gPodder GUI. See gpo(1) for the command-line interface.
"""
import sys
import os
import os.path
import platform
import logging
import gettext
import subprocess
logger = logging.getLogger(__name__)
try:
import dbus
import dbus.glib
have_dbus = True
except ImportError:
print >>sys.stderr, """
Warning: python-dbus not found. Disabling D-Bus support.
"""
have_dbus = False
from optparse import OptionParser
def main():
# Paths to important files
gpodder_script = sys.argv[0]
while os.path.islink(gpodder_script):
gpodder_script = os.readlink(gpodder_script)
gpodder_dir = os.path.join(os.path.dirname(gpodder_script), '..')
prefix = os.path.abspath(os.path.normpath(gpodder_dir))
src_dir = os.path.join(prefix, 'src')
locale_dir = os.path.join(prefix, 'share', 'locale')
ui_folder = os.path.join(prefix, 'share', 'gpodder', 'ui')
credits_file = os.path.join(prefix, 'share', 'gpodder', 'credits.txt')
images_folder = os.path.join(prefix, 'share', 'gpodder', 'images')
icon_file = os.path.join(prefix, 'share', 'icons', 'hicolor', 'scalable', 'apps', 'gpodder.svg')
if os.path.exists(os.path.join(src_dir, 'gpodder', '__init__.py')):
# Run gPodder from local source folder (not installed)
sys.path.insert(0, src_dir)
# on Mac OS X, read from the defaults database the locale of the user
if platform.system() == 'Darwin' and 'LANG' not in os.environ:
locale_cmd = ('defaults', 'read', 'NSGlobalDomain', 'AppleLocale')
process = subprocess.Popen(locale_cmd, stdout=subprocess.PIPE)
output, error_output = process.communicate()
# the output is a string like 'fr_FR', and we need 'fr_FR.utf-8'
user_locale = output.strip() + '.UTF-8'
os.environ['LANG'] = user_locale
print >>sys.stderr, 'Setting locale to', user_locale
# Set up the path to translation files
gettext.bindtextdomain('gpodder', locale_dir)
import gpodder
gpodder.prefix = prefix
# Platform detection (i.e. MeeGo 1.2 Harmattan, etc..)
gpodder.detect_platform()
# Enable i18n for gPodder translations
_ = gpodder.gettext
# Set up paths to folder with GtkBuilder files and gpodder.svg
gpodder.ui_folders.append(ui_folder)
gpodder.credits_file = credits_file
gpodder.images_folder = images_folder
gpodder.icon_file = icon_file
s_usage = 'usage: %%prog [options]\n\n%s' % ( __doc__.strip() )
s_version = '%%prog %s' % ( gpodder.__version__ )
parser = OptionParser( usage = s_usage, version = s_version)
parser.add_option("-v", "--verbose",
action="store_true", dest="verbose", default=False,
help=_("print logging output on the console"))
parser.add_option("-q", "--qml",
action="store_true", dest="qml", default=False,
help=_("use the QML-based MeeGo 1.2 Harmattan UI"))
parser.add_option('-s', '--subscribe', dest='subscribe', metavar='URL',
help=_('subscribe to the feed at URL'))
# On Mac OS X, support the "psn" parameter for compatibility (bug 939)
if gpodder.ui.osx:
parser.add_option('-p', '--psn', dest='macpsn', metavar='PSN',
help=_('Mac OS X application process number'))
options, args = parser.parse_args(sys.argv)
if options.qml or (gpodder.ui.harmattan or gpodder.ui.sailfish):
gpodder.ui.qml = True
else:
gpodder.ui.gtk = True
gpodder.ui.unity = (os.environ.get('DESKTOP_SESSION', 'unknown').lower() in
('ubuntu', 'ubuntu-2d'))
from gpodder import log
log.setup(options.verbose)
if have_dbus:
# Try to find an already-running instance of gPodder
session_bus = dbus.SessionBus()
# Obtain a reference to an existing instance; don't call get_object if
# such an instance doesn't exist as it *will* create a new instance
if session_bus.name_has_owner(gpodder.dbus_bus_name):
try:
remote_object = session_bus.get_object(gpodder.dbus_bus_name,
gpodder.dbus_gui_object_path)
# An instance of GUI is already running
logger.info('Activating existing instance via D-Bus.')
remote_object.show_gui_window(
dbus_interface=gpodder.dbus_interface)
if options.subscribe:
remote_object.subscribe_to_url(options.subscribe)
return
except dbus.exceptions.DBusException, dbus_exception:
logger.info('Cannot connect to remote object.', exc_info=True)
if not gpodder.ui.win32 and os.environ.get('DISPLAY', '') == '':
logger.error('Cannot start gPodder: $DISPLAY is not set.')
sys.exit(1)
if gpodder.ui.qml:
from gpodder import qmlui
gpodder.ui_folders.insert(0, os.path.join(ui_folder, 'qml'))
sys.exit(qmlui.main(args))
elif gpodder.ui.gtk:
from gpodder.gtkui import main
gpodder.ui_folders.insert(0, os.path.join(ui_folder, 'gtk'))
main.main(options)
else:
logger.error('No GUI selected.')
if __name__ == '__main__':
main()
|