2 # -*- coding: utf-8 -*-
5 # gPodder - A media aggregator and podcast client
6 # Copyright (c) 2005-2008 Thomas Perl and the gPodder Team
8 # gPodder is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 3 of the License, or
11 # (at your option) any later version.
13 # gPodder is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program. If not, see <http://www.gnu.org/licenses/>.
23 gPodder enables you to subscribe to RSS feeds and download
24 podcast episodes from these feeds. gPodder can operate in
25 GUI mode and in CLI mode. Downloaded podcasts can either
26 be synchronized to portable MP3 players (including iPods)
27 or played back on the user's desktop.
30 # PLEASE DO NOT CHANGE FORMAT OF __version__ LINE (setup.py reads this)
32 __author__
= "Thomas Perl <thp@perli.net>"
33 __version__
= "0.13.0"
34 __date__
= "2008-10-06"
35 __copyright__
= "Copyright (c) 2005-2008 %s. All rights reserved." % __author__
45 from optparse
import OptionParser
50 print 'Warning: Module "feedparser" not found. Please install "python-feedparser".'
51 print ' The feedparser module can also be downloaded from www.feedparser.org'
55 def main( argv
= sys
.argv
):
56 prefix
= os
.path
.abspath( os
.path
.normpath( os
.path
.join( os
.path
.dirname( argv
[0]), '..')))
57 locale_dir
= os
.path
.join( prefix
, 'share', 'locale')
61 gettext
.bindtextdomain( domain
, locale_dir
)
62 gettext
.textdomain( domain
)
63 gettext
.install(domain
, locale_dir
, unicode=True)
65 s_usage
= 'usage: %%prog [options]\n\n%s' % ( __doc__
.strip() )
66 s_version
= '%%prog %s' % ( __version__
)
68 parser
= OptionParser( usage
= s_usage
, version
= s_version
)
70 parser
.add_option("-v", "--verbose",
71 action
="store_true", dest
="verbose", default
=False,
72 help=_("Print debugging output to stdout"))
74 parser
.add_option("-t", "--local",
75 action
="store_true", dest
="local", default
=False,
76 help=_("Run local version in current directory"))
78 parser
.add_option("-m", "--maemo",
79 action
="store_true", dest
="maemo", default
=False,
80 help=_("Start the Maemo user interface of gPodder"))
82 parser
.add_option("-l", "--list",
83 action
="store_true", dest
="list", default
=False,
84 help=_("List all channel subscriptions"))
86 parser
.add_option("-r", "--run",
87 action
="store_true", dest
="run", default
=False,
88 help=_("Update channel list, download new podcasts"))
90 parser
.add_option("-u", "--update",
91 action
="store_true", dest
="update", default
=False,
92 help=_("Update channel list and exit"))
94 parser
.add_option("-s", "--sync",
95 action
="store_true", dest
="sync", default
=False,
96 help=_("Synchronize channels to configured device"))
98 parser
.add_option("-a", "--add", dest
="add",
99 help=_("Subscribe to channel from URL"), metavar
="URL")
101 parser
.add_option("-d", "--delete", dest
="delete",
102 help=_("Delete channel specified by URL"), metavar
="URL")
104 parser
.add_option("-S", "--stats",
105 action
="store_true", dest
="stats", default
=False,
106 help=_("Get sync statistics"))
108 (options
, args
) = parser
.parse_args(argv
)
111 sys
.path
= [ os
.path
.join( prefix
, 'src') ] + sys
.path
114 gpodder
.user_agent
= 'gPodder/%s (+http://gpodder.berlios.de/)' % __version__
117 gpodder
.interface
= gpodder
.MAEMO
118 elif options
.list or options
.run
or options
.update
or \
119 options
.sync
or options
.add
or options
.delete
:
120 gpodder
.interface
= gpodder
.CLI
122 gpodder
.interface
= gpodder
.GUI
125 from gpodder
.liblogger
import enable_verbose
128 from gpodder
import console
130 console
.list_channels()
136 console
.sync_device()
138 console
.add_channel( options
.add
)
140 console
.del_channel( options
.delete
)
145 from gpodder
import gui
146 from gpodder
.SimpleGladeApp
import bindtextdomain
149 # check if we have a X connection
150 from os
import environ
151 if not 'DISPLAY' in environ
or not environ
['DISPLAY']:
152 print 'Your DISPLAY variable is not set correctly. Cannot start GUI.'
155 gui
.glade_dir
= os
.path
.join( prefix
, *gui
.glade_dir
)
156 gui
.icon_dir
= os
.path
.join( prefix
, *gui
.icon_dir
)
157 gui
.scalable_dir
= os
.path
.join( prefix
, *gui
.scalable_dir
)
160 gui
.glade_dir
= os
.path
.join( prefix
, 'data')
161 gui
.icon_dir
= os
.path
.join( prefix
, 'data', 'gpodder.png')
162 gui
.scalable_dir
= os
.path
.join( prefix
, 'data', 'gpodder.svg')
163 locale_dir
= os
.path
.join( prefix
, 'data', 'locale')
165 bindtextdomain( domain
, locale_dir
)
166 gui
.app_version
= __version__
170 if __name__
== "__main__":