fix E502 the backslash is redundant between brackets

This commit is contained in:
MarkusHackspacher 2018-05-08 10:43:56 +02:00
parent b21f3c8795
commit 49bb08c8a3
13 changed files with 183 additions and 183 deletions

View File

@ -27,7 +27,7 @@ import dbus
import gpodder
session_bus = dbus.SessionBus()
proxy = session_bus.get_object(gpodder.dbus_bus_name, \
proxy = session_bus.get_object(gpodder.dbus_bus_name,
gpodder.dbus_gui_object_path)
interface = dbus.Interface(proxy, gpodder.dbus_interface)

View File

@ -55,17 +55,17 @@ class DBusPodcastsProxy(dbus.service.Object):
"""
#DBusPodcastsProxy(lambda: self.channels, self.on_itemUpdate_activate(), self.playback_episodes, self.download_episode_list, bus_name)
def __init__(self, get_podcast_list, \
check_for_updates, playback_episodes, \
download_episodes, episode_from_uri, \
def __init__(self, get_podcast_list,
check_for_updates, playback_episodes,
download_episodes, episode_from_uri,
bus_name):
self._get_podcasts = get_podcast_list
self._on_check_for_updates = check_for_updates
self._playback_episodes = playback_episodes
self._download_episodes = download_episodes
self._episode_from_uri = episode_from_uri
dbus.service.Object.__init__(self, \
object_path=gpodder.dbus_podcasts_object_path, \
dbus.service.Object.__init__(self,
object_path=gpodder.dbus_podcasts_object_path,
bus_name=bus_name)
def _get_episode_refs(self, urls):

View File

@ -816,7 +816,7 @@ class DownloadTask(object):
if disposition_filename is not None and disposition_filename != '':
# The server specifies a download filename - try to use it
disposition_filename = os.path.basename(disposition_filename)
self.filename = self.__episode.local_filename(create=True, \
self.filename = self.__episode.local_filename(create=True,
force_update=True, template=disposition_filename)
new_mimetype, encoding = mimetypes.guess_type(self.filename)
if new_mimetype is not None:

View File

@ -86,7 +86,7 @@ class ConfigModel(Gtk.ListStore):
#else:
# style = Pango.Style.ITALIC
new_value_text = config.config_value_to_string(new_value)
self.set(row.iter, \
self.set(row.iter,
self.C_VALUE_TEXT, new_value_text,
self.C_BOOLEAN_VALUE, bool(new_value),
self.C_FONT_STYLE, style)

View File

@ -478,8 +478,8 @@ class gPodderPreferences(BuilderWidget):
self.preferred_vimeo_format_model.set_index(index)
def on_button_audio_player_clicked(self, widget):
result = self.show_text_edit_dialog(_('Configure audio player'), \
_('Command:'), \
result = self.show_text_edit_dialog(_('Configure audio player'),
_('Command:'),
self._config.player)
if result:
@ -488,8 +488,8 @@ class gPodderPreferences(BuilderWidget):
self.combo_audio_player_app.set_active(index)
def on_button_video_player_clicked(self, widget):
result = self.show_text_edit_dialog(_('Configure video player'), \
_('Command:'), \
result = self.show_text_edit_dialog(_('Configure video player'),
_('Command:'),
self._config.videoplayer)
if result:

View File

@ -72,13 +72,13 @@ class DownloadStatusModel(Gtk.ListStore):
self.C_URL, task.url)
if task.status == task.FAILED:
status_message = '%s: %s' % (\
task.STATUS_MESSAGE[task.status], \
status_message = '%s: %s' % (
task.STATUS_MESSAGE[task.status],
task.error_message)
elif task.status == task.DOWNLOADING:
status_message = '%s (%.0f%%, %s/s)' % (\
task.STATUS_MESSAGE[task.status], \
task.progress * 100, \
status_message = '%s (%.0f%%, %s/s)' % (
task.STATUS_MESSAGE[task.status],
task.progress * 100,
util.format_filesize(task.speed))
else:
status_message = task.STATUS_MESSAGE[task.status]
@ -96,7 +96,7 @@ class DownloadStatusModel(Gtk.ListStore):
progress_message = ' / '.join((current, total))
elif task.total_size > 0:
progress_message = util.format_filesize(task.total_size, \
progress_message = util.format_filesize(task.total_size,
digits=1)
else:
progress_message = ('unknown size')
@ -104,8 +104,8 @@ class DownloadStatusModel(Gtk.ListStore):
self.set(iter,
self.C_NAME, self._format_message(task.episode.title,
status_message, task.episode.channel.title),
self.C_PROGRESS, 100. * task.progress, \
self.C_PROGRESS_TEXT, progress_message, \
self.C_PROGRESS, 100. * task.progress,
self.C_PROGRESS_TEXT, progress_message,
self.C_ICON_NAME, self._status_ids[task.status])
def __add_new_task(self, task):
@ -135,7 +135,7 @@ class DownloadStatusModel(Gtk.ListStore):
for row in self:
task = row[DownloadStatusModel.C_TASK]
if task is not None and \
task.status in (task.DOWNLOADING, \
task.status in (task.DOWNLOADING,
task.QUEUED):
return True

View File

@ -40,7 +40,7 @@ class BuilderWidget(GtkBuilderWidget):
# Enable support for tracking iconified state
if hasattr(self, 'on_iconify') and hasattr(self, 'on_uniconify'):
self.main_window.connect('window-state-event', \
self.main_window.connect('window-state-event',
self._on_window_state_event_iconified)
def _on_window_state_event_iconified(self, widget, event):
@ -89,9 +89,9 @@ class BuilderWidget(GtkBuilderWidget):
dlg.destroy()
return response == Gtk.ResponseType.YES
def show_text_edit_dialog(self, title, prompt, text=None, empty=False, \
def show_text_edit_dialog(self, title, prompt, text=None, empty=False,
is_url=False, affirmative_text=Gtk.STOCK_OK):
dialog = Gtk.Dialog(title, self.get_dialog_parent(), \
dialog = Gtk.Dialog(title, self.get_dialog_parent(),
Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT)
dialog.add_button(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL)

View File

@ -54,7 +54,7 @@ class ProgressIndicator(object):
return True
def _create_progress(self):
self.dialog = Gtk.MessageDialog(self.parent, \
self.dialog = Gtk.MessageDialog(self.parent,
0, 0, Gtk.ButtonsType.CANCEL, self.subtitle or self.title)
self.dialog.set_modal(True)
self.dialog.connect('delete-event', self._on_delete_event)
@ -67,7 +67,7 @@ class ProgressIndicator(object):
if isinstance(label, Gtk.Label):
label.set_selectable(False)
self.dialog.set_response_sensitive(Gtk.ResponseType.CANCEL, \
self.dialog.set_response_sensitive(Gtk.ResponseType.CANCEL,
self.cancellable)
self.progressbar = Gtk.ProgressBar()

View File

@ -589,14 +589,14 @@ class gPodder(BuilderWidget, dbus.service.Object):
def ask():
# We're abusing the Episode Selector again ;) -- thp
gPodderEpisodeSelector(self.main_window, \
title=_('Confirm changes from gpodder.net'), \
instructions=_('Select the actions you want to carry out.'), \
episodes=changes, \
columns=columns, \
size_attribute=None, \
stock_ok_button=Gtk.STOCK_APPLY, \
callback=execute_podcast_actions, \
gPodderEpisodeSelector(self.main_window,
title=_('Confirm changes from gpodder.net'),
instructions=_('Select the actions you want to carry out.'),
episodes=changes,
columns=columns,
size_attribute=None,
stock_ok_button=Gtk.STOCK_APPLY,
callback=execute_podcast_actions,
_config=self.config)
# There are some actions that need the user's attention
@ -631,8 +631,8 @@ class gPodder(BuilderWidget, dbus.service.Object):
def on_send_full_subscriptions(self):
# Send the full subscription list to the gpodder.net client
# (this will overwrite the subscription list on the server)
indicator = ProgressIndicator(_('Uploading subscriptions'), \
_('Your subscriptions are being uploaded to the server.'), \
indicator = ProgressIndicator(_('Uploading subscriptions'),
_('Your subscriptions are being uploaded to the server.'),
False, self.get_dialog_parent())
try:
@ -643,8 +643,8 @@ class gPodder(BuilderWidget, dbus.service.Object):
message = str(e)
if not message:
message = e.__class__.__name__
self.show_message(message, \
_('Error while uploading'), \
self.show_message(message,
_('Error while uploading'),
important=True)
util.idle_add(show_error, e)
@ -659,10 +659,10 @@ class gPodder(BuilderWidget, dbus.service.Object):
def for_each_episode_set_task_status(self, episodes, status):
episode_urls = set(episode.url for episode in episodes)
model = self.treeDownloads.get_model()
selected_tasks = [(Gtk.TreeRowReference.new(model, row.path), \
model.get_value(row.iter, \
DownloadStatusModel.C_TASK)) for row in model \
if model.get_value(row.iter, DownloadStatusModel.C_TASK).url \
selected_tasks = [(Gtk.TreeRowReference.new(model, row.path),
model.get_value(row.iter,
DownloadStatusModel.C_TASK)) for row in model
if model.get_value(row.iter, DownloadStatusModel.C_TASK).url
in episode_urls]
self._for_each_task_set_status(selected_tasks, status)
@ -1012,12 +1012,12 @@ class gPodder(BuilderWidget, dbus.service.Object):
self.treeAvailable.connect('popup-menu', self.treeview_available_show_context_menu)
self.treeAvailable.enable_model_drag_source(Gdk.ModifierType.BUTTON1_MASK, \
self.treeAvailable.enable_model_drag_source(Gdk.ModifierType.BUTTON1_MASK,
(('text/uri-list', 0, 0),), Gdk.DragAction.COPY)
def drag_data_get(tree, context, selection_data, info, timestamp):
uris = ['file://' + e.local_filename(create=False) \
for e in self.get_selected_episodes() \
uris = ['file://' + e.local_filename(create=False)
for e in self.get_selected_episodes()
if e.was_downloaded(and_exists=True)]
uris.append('') # for the trailing '\r\n'
selection_data.set(selection_data.target, 8, '\r\n'.join(uris))
@ -1045,7 +1045,7 @@ class gPodder(BuilderWidget, dbus.service.Object):
cell = Gtk.CellRendererPixbuf()
cell.set_property('stock-size', Gtk.IconSize.BUTTON)
column.pack_start(cell, False)
column.add_attribute(cell, 'icon-name', \
column.add_attribute(cell, 'icon-name',
DownloadStatusModel.C_ICON_NAME)
cell = Gtk.CellRendererText()
@ -1061,7 +1061,7 @@ class gPodder(BuilderWidget, dbus.service.Object):
cell.set_property('yalign', .5)
cell.set_property('ypad', 6)
column = Gtk.TreeViewColumn(_('Progress'), cell,
value=DownloadStatusModel.C_PROGRESS, \
value=DownloadStatusModel.C_PROGRESS,
text=DownloadStatusModel.C_PROGRESS_TEXT)
column.set_sizing(Gtk.TreeViewColumnSizing.AUTOSIZE)
column.set_expand(False)
@ -1387,13 +1387,13 @@ class gPodder(BuilderWidget, dbus.service.Object):
selection = treeview.get_selection()
model, paths = selection.get_selected_rows()
if path is None or (path not in paths and \
if path is None or (path not in paths and
event.button == 3):
# We have right-clicked, but not into the selection,
# assume we don't want to operate on the selection
paths = []
if path is not None and not paths and \
if path is not None and not paths and
event.button == 3:
# No selection or clicked outside selection;
# select the single item where we clicked
@ -1417,27 +1417,27 @@ class gPodder(BuilderWidget, dbus.service.Object):
model, paths = selection.get_selected_rows()
can_queue, can_cancel, can_pause, can_remove, can_force = (True,) * 5
selected_tasks = [(Gtk.TreeRowReference.new(model, path), \
model.get_value(model.get_iter(path), \
selected_tasks = [(Gtk.TreeRowReference.new(model, path),
model.get_value(model.get_iter(path),
DownloadStatusModel.C_TASK)) for path in paths]
for row_reference, task in selected_tasks:
if task.status != download.DownloadTask.QUEUED:
can_force = False
if task.status not in (download.DownloadTask.PAUSED, \
download.DownloadTask.FAILED, \
if task.status not in (download.DownloadTask.PAUSED,
download.DownloadTask.FAILED,
download.DownloadTask.CANCELLED):
can_queue = False
if task.status not in (download.DownloadTask.PAUSED, \
download.DownloadTask.QUEUED, \
download.DownloadTask.DOWNLOADING, \
if task.status not in (download.DownloadTask.PAUSED,
download.DownloadTask.QUEUED,
download.DownloadTask.DOWNLOADING,
download.DownloadTask.FAILED):
can_cancel = False
if task.status not in (download.DownloadTask.QUEUED, \
if task.status not in (download.DownloadTask.QUEUED,
download.DownloadTask.DOWNLOADING):
can_pause = False
if task.status not in (download.DownloadTask.CANCELLED, \
download.DownloadTask.FAILED, \
if task.status not in (download.DownloadTask.CANCELLED,
download.DownloadTask.FAILED,
download.DownloadTask.DONE):
can_remove = False
@ -2050,7 +2050,7 @@ class gPodder(BuilderWidget, dbus.service.Object):
logger.error('Exception in D-Bus call: %s', str(err))
# Fallback: use the command line client
for command in util.format_desktop_command('panucci', \
for command in util.format_desktop_command('panucci',
[filename]):
logger.info('Executing: %s', repr(command))
subprocess.Popen(command)
@ -2058,7 +2058,7 @@ class gPodder(BuilderWidget, dbus.service.Object):
on_error = lambda err: error_handler(filename, err)
# This method only exists in Panucci > 0.9 ('new Panucci')
i.playback_from(filename, resume_position, \
i.playback_from(filename, resume_position,
reply_handler=on_reply, error_handler=on_error)
continue # This file was handled by the D-Bus call
@ -2089,14 +2089,14 @@ class gPodder(BuilderWidget, dbus.service.Object):
def playback_episodes(self, episodes):
# We need to create a list, because we run through it more than once
episodes = list(Model.sort_episodes_by_pubdate(e for e in episodes if \
episodes = list(Model.sort_episodes_by_pubdate(e for e in episodes if
e.was_downloaded(and_exists=True) or self.streaming_possible()))
try:
self.playback_episodes_for_real(episodes)
except Exception as e:
logger.error('Error in playback!', exc_info=True)
self.show_message(_('Please check your media player settings in the preferences dialog.'), \
self.show_message(_('Please check your media player settings in the preferences dialog.'),
_('Error opening player'))
self.episode_list_status_changed(episodes)
@ -2328,8 +2328,8 @@ class gPodder(BuilderWidget, dbus.service.Object):
error_messages = {}
redirections = {}
progress = ProgressIndicator(_('Adding podcasts'), \
_('Please wait while episode information is downloaded.'), \
progress = ProgressIndicator(_('Adding podcasts'),
_('Please wait while episode information is downloaded.'),
parent=self.get_dialog_parent())
def on_after_update():
@ -2373,7 +2373,7 @@ class gPodder(BuilderWidget, dbus.service.Object):
if failed:
title = _('Could not add some podcasts')
message = _('Some podcasts could not be added to your list:') \
+ '\n\n' + '\n'.join(cgi.escape('%s: %s' % (url, \
+ '\n\n' + '\n'.join(cgi.escape('%s: %s' % (url,
error_messages.get(url, _('Unknown')))) for url in failed)
self.show_message(message, title, important=True)
@ -2409,9 +2409,9 @@ class gPodder(BuilderWidget, dbus.service.Object):
episodes.extend(podcast.get_all_episodes())
if episodes:
episodes = list(Model.sort_episodes_by_pubdate(episodes, \
episodes = list(Model.sort_episodes_by_pubdate(episodes,
reverse=True))
self.new_episodes_show(episodes, \
self.new_episodes_show(episodes,
selected=[e.check_is_new() for e in episodes])
@util.run_in_background
@ -2424,8 +2424,8 @@ class gPodder(BuilderWidget, dbus.service.Object):
progress.on_message(title or url)
try:
# The URL is valid and does not exist already - subscribe!
channel = self.model.load_podcast(url=url, create=True, \
authentication_tokens=auth_tokens.get(url, None), \
channel = self.model.load_podcast(url=url, create=True,
authentication_tokens=auth_tokens.get(url, None),
max_episodes=self.config.max_episodes_per_feed)
try:
@ -2491,8 +2491,8 @@ class gPodder(BuilderWidget, dbus.service.Object):
the server to the local database and update the
status of the affected episodes as necessary.
"""
indicator = ProgressIndicator(_('Merging episode actions'), \
_('Episode actions from gpodder.net are merged.'), \
indicator = ProgressIndicator(_('Merging episode actions'),
_('Episode actions from gpodder.net are merged.'),
False, self.get_dialog_parent())
Gtk.main_iteration()
@ -2722,8 +2722,8 @@ class gPodder(BuilderWidget, dbus.service.Object):
if confirm and not self.show_confirmation(message, title):
return False
progress = ProgressIndicator(_('Deleting episodes'), \
_('Please wait while episodes are deleted'), \
progress = ProgressIndicator(_('Deleting episodes'),
_('Please wait while episodes are deleted'),
parent=self.get_dialog_parent())
def finish_deletion(episode_urls, channel_urls):
@ -2799,9 +2799,9 @@ class gPodder(BuilderWidget, dbus.service.Object):
selected = [not e.is_new or not e.file_exists() for e in episodes]
gPodderEpisodeSelector(self.main_window, title = _('Delete episodes'), instructions = instructions, \
episodes = episodes, selected = selected, columns = columns, \
stock_ok_button = 'edit-delete', callback = self.delete_episode_list, \
gPodderEpisodeSelector(self.main_window, title = _('Delete episodes'), instructions = instructions,
episodes = episodes, selected = selected, columns = columns,
stock_ok_button = 'edit-delete', callback = self.delete_episode_list,
selection_buttons = selection_buttons, _config=self.config)
def on_selected_episodes_status_changed(self):
@ -2991,23 +2991,23 @@ class gPodder(BuilderWidget, dbus.service.Object):
# Select all by default
selected = [True] * len(episodes)
self.new_episodes_window = gPodderEpisodeSelector(self.main_window, \
title=_('New episodes available'), \
instructions=instructions, \
episodes=episodes, \
columns=columns, \
selected=selected, \
stock_ok_button = 'gpodder-download', \
callback=download_episodes_callback, \
remove_callback=lambda e: e.mark_old(), \
remove_action=_('Mark as old'), \
remove_finished=self.episode_new_status_changed, \
_config=self.config, \
self.new_episodes_window = gPodderEpisodeSelector(self.main_window,
title=_('New episodes available'),
instructions=instructions,
episodes=episodes,
columns=columns,
selected=selected,
stock_ok_button = 'gpodder-download',
callback=download_episodes_callback,
remove_callback=lambda e: e.mark_old(),
remove_action=_('Mark as old'),
remove_finished=self.episode_new_status_changed,
_config=self.config,
show_notification=False)
def on_itemDownloadAllNew_activate(self, action, param):
if not self.offer_new_episodes():
self.show_message(_('Please check for new episodes later.'), \
self.show_message(_('Please check for new episodes later.'),
_('No new episodes available'))
def get_new_episodes(self, channels=None):
@ -3049,7 +3049,7 @@ class gPodder(BuilderWidget, dbus.service.Object):
def on_download_subscriptions_from_mygpo(self, action=None):
def after_login():
title = _('Subscriptions on %(server)s') \
title = _('Subscriptions on %(server)s')
% {'server': self.config.mygpo.server}
dir = gPodderPodcastDirectory(self.gPodder,
_config=self.config,
@ -3081,7 +3081,7 @@ class gPodder(BuilderWidget, dbus.service.Object):
util.idle_add(after_login)
def on_itemAddChannel_activate(self, action=None, param=None):
self._add_podcast_dialog = gPodderAddPodcast(self.gPodder, \
self._add_podcast_dialog = gPodderAddPodcast(self.gPodder,
add_podcast_list=self.add_podcast_list)
def on_itemEditChannel_activate(self, action, param=None):
@ -3106,14 +3106,14 @@ class gPodder(BuilderWidget, dbus.service.Object):
# We're abusing the Episode Selector for selecting Podcasts here,
# but it works and looks good, so why not? -- thp
gPodderEpisodeSelector(self.main_window, \
title=_('Delete podcasts'), \
instructions=_('Select the podcast you want to delete.'), \
episodes=self.channels, \
columns=columns, \
size_attribute=None, \
stock_ok_button=_('Delete'), \
callback=self.remove_podcast_list, \
gPodderEpisodeSelector(self.main_window,
title=_('Delete podcasts'),
instructions=_('Select the podcast you want to delete.'),
episodes=self.channels,
columns=columns,
size_attribute=None,
stock_ok_button=_('Delete'),
callback=self.remove_podcast_list,
_config=self.config)
def remove_podcast_list(self, channels, confirm=True):
@ -3215,8 +3215,8 @@ class gPodder(BuilderWidget, dbus.service.Object):
dlg.destroy()
if filename is not None:
dir = gPodderPodcastDirectory(self.gPodder, _config=self.config, \
custom_title=_('Import podcasts from OPML file'), \
dir = gPodderPodcastDirectory(self.gPodder, _config=self.config,
custom_title=_('Import podcasts from OPML file'),
add_podcast_list=self.add_podcast_list,
hide_url_entry=True)
dir.download_opml_file(filename)
@ -3332,7 +3332,7 @@ class gPodder(BuilderWidget, dbus.service.Object):
def get_podcast_urls_from_selected_episodes(self):
"""Get a set of podcast URLs based on the selected episodes"""
return set(episode.channel.url for episode in \
return set(episode.channel.url for episode in
self.get_selected_episodes())
def get_selected_episodes(self):
@ -3367,12 +3367,12 @@ class gPodder(BuilderWidget, dbus.service.Object):
GObject.source_remove(self._auto_update_timer_source_id)
self._auto_update_timer_source_id = None
if self.config.auto_update_feeds and \
if self.config.auto_update_feeds and
self.config.auto_update_frequency:
interval = 60 * 1000 * self.config.auto_update_frequency
logger.debug('Setting up auto update timer with interval %d.',
self.config.auto_update_frequency)
self._auto_update_timer_source_id = GObject.timeout_add(\
self._auto_update_timer_source_id = GObject.timeout_add(
interval, self._on_auto_update_timer)
def _on_auto_update_timer(self):
@ -3413,14 +3413,14 @@ class gPodder(BuilderWidget, dbus.service.Object):
if self.wNotebook.get_current_page() == 0:
selection = self.treeAvailable.get_selection()
(model, paths) = selection.get_selected_rows()
urls = [model.get_value(model.get_iter(path), \
urls = [model.get_value(model.get_iter(path),
self.episode_list_model.C_URL) for path in paths]
selected_tasks = [task for task in self.download_tasks_seen \
selected_tasks = [task for task in self.download_tasks_seen
if task.url in urls]
else:
selection = self.treeDownloads.get_selection()
(model, paths) = selection.get_selected_rows()
selected_tasks = [model.get_value(model.get_iter(path), \
selected_tasks = [model.get_value(model.get_iter(path),
self.download_status_model.C_TASK) for path in paths]
self.cancel_task_list(selected_tasks)
@ -3665,7 +3665,7 @@ class gPodderApplication(Gtk.Application):
self.bus_name = dbus.service.BusName(gpodder.dbus_bus_name, bus=gpodder.dbus_session_bus)
except dbus.exceptions.DBusException as dbe:
logger.warn('Cannot get "on the bus".', exc_info=True)
dlg = Gtk.MessageDialog(None, Gtk.DialogFlags.MODAL, Gtk.MessageType.ERROR, \
dlg = Gtk.MessageDialog(None, Gtk.DialogFlags.MODAL, Gtk.MessageType.ERROR,
Gtk.ButtonsType.CLOSE, _('Cannot start gPodder'))
dlg.format_secondary_markup(_('D-Bus error: %s') % (str(dbe),))
dlg.set_title('gPodder')
@ -3689,7 +3689,7 @@ class gPodderApplication(Gtk.Application):
self.window.gPodder.present()
def on_about(self, action, param):
dlg = Gtk.Dialog(_('About gPodder'), self.window.gPodder, \
dlg = Gtk.Dialog(_('About gPodder'), self.window.gPodder,
Gtk.DialogFlags.MODAL)
dlg.add_button(Gtk.STOCK_CLOSE, Gtk.ResponseType.OK).show()
dlg.set_resizable(False)
@ -3735,13 +3735,13 @@ class gPodderApplication(Gtk.Application):
util.open_website('https://gpodder.github.io/docs/')
def on_itemPreferences_activate(self, action, param=None):
gPodderPreferences(self.window.gPodder, \
_config=self.window.config, \
user_apps_reader=self.window.user_apps_reader, \
parent_window=self.window.main_window, \
mygpo_client=self.window.mygpo_client, \
on_send_full_subscriptions=self.window.on_send_full_subscriptions, \
on_itemExportChannels_activate=self.window.on_itemExportChannels_activate, \
gPodderPreferences(self.window.gPodder,
_config=self.window.config,
user_apps_reader=self.window.user_apps_reader,
parent_window=self.window.main_window,
mygpo_client=self.window.mygpo_client,
on_send_full_subscriptions=self.window.on_send_full_subscriptions,
on_itemExportChannels_activate=self.window.on_itemExportChannels_activate,
on_extension_enabled=self.on_extension_enabled,
on_extension_disabled=self.on_extension_disabled)

View File

@ -68,11 +68,11 @@ class GEpisode(model.PodcastEpisode):
length_str = '%s; ' % util.format_filesize(self.file_size)
else:
length_str = ''
return ('<b>%s</b>\n<small>%s' + _('released %s') + \
'; ' + _('from %s') + '</small>') % (\
cgi.escape(re.sub('\s+', ' ', self.title)), \
cgi.escape(length_str), \
cgi.escape(self.pubdate_prop), \
return ('<b>%s</b>\n<small>%s' + _('released %s') +
'; ' + _('from %s') + '</small>') % (
cgi.escape(re.sub('\s+', ' ', self.title)),
cgi.escape(length_str),
cgi.escape(self.pubdate_prop),
cgi.escape(re.sub('\s+', ' ', self.channel.title)))
@property
@ -86,12 +86,12 @@ class GEpisode(model.PodcastEpisode):
downloaded_string = self.get_age_string()
if not downloaded_string:
downloaded_string = _('today')
return ('<b>%s</b>\n<small>%s; %s; ' + _('downloaded %s') + \
'; ' + _('from %s') + '</small>') % (\
cgi.escape(self.title), \
cgi.escape(util.format_filesize(self.file_size)), \
cgi.escape(played_string), \
cgi.escape(downloaded_string), \
return ('<b>%s</b>\n<small>%s; %s; ' + _('downloaded %s') +
'; ' + _('from %s') + '</small>') % (
cgi.escape(self.title),
cgi.escape(util.format_filesize(self.file_size)),
cgi.escape(played_string),
cgi.escape(downloaded_string),
cgi.escape(self.channel.title))
@ -148,11 +148,11 @@ class BackgroundUpdate(object):
class EpisodeListModel(Gtk.ListStore):
C_URL, C_TITLE, C_FILESIZE_TEXT, C_EPISODE, C_STATUS_ICON, \
C_PUBLISHED_TEXT, C_DESCRIPTION, C_TOOLTIP, \
C_VIEW_SHOW_UNDELETED, C_VIEW_SHOW_DOWNLOADED, \
C_VIEW_SHOW_UNPLAYED, C_FILESIZE, C_PUBLISHED, \
C_TIME, C_TIME_VISIBLE, C_TOTAL_TIME, \
C_URL, C_TITLE, C_FILESIZE_TEXT, C_EPISODE, C_STATUS_ICON,
C_PUBLISHED_TEXT, C_DESCRIPTION, C_TOOLTIP,
C_VIEW_SHOW_UNDELETED, C_VIEW_SHOW_DOWNLOADED,
C_VIEW_SHOW_UNPLAYED, C_FILESIZE, C_PUBLISHED,
C_TIME, C_TIME_VISIBLE, C_TOTAL_TIME,
C_LOCKED = list(range(17))
VIEW_ALL, VIEW_UNDELETED, VIEW_DOWNLOADED, VIEW_UNPLAYED = list(range(4))
@ -166,8 +166,8 @@ class EpisodeListModel(Gtk.ListStore):
PROGRESS_STEPS = 20
def __init__(self, config, on_filter_changed=lambda has_episodes: None):
Gtk.ListStore.__init__(self, str, str, str, object, \
str, str, str, str, bool, bool, bool, \
Gtk.ListStore.__init__(self, str, str, str, object,
str, str, str, str, bool, bool, bool,
GObject.TYPE_INT64, GObject.TYPE_INT64, str, bool, GObject.TYPE_INT64, bool)
self._config = config
@ -514,10 +514,10 @@ class PodcastChannelProxy(object):
class PodcastListModel(Gtk.ListStore):
C_URL, C_TITLE, C_DESCRIPTION, C_PILL, C_CHANNEL, \
C_COVER, C_ERROR, C_PILL_VISIBLE, \
C_VIEW_SHOW_UNDELETED, C_VIEW_SHOW_DOWNLOADED, \
C_VIEW_SHOW_UNPLAYED, C_HAS_EPISODES, C_SEPARATOR, \
C_URL, C_TITLE, C_DESCRIPTION, C_PILL, C_CHANNEL,
C_COVER, C_ERROR, C_PILL_VISIBLE,
C_VIEW_SHOW_UNDELETED, C_VIEW_SHOW_DOWNLOADED,
C_VIEW_SHOW_UNPLAYED, C_HAS_EPISODES, C_SEPARATOR,
C_DOWNLOADS, C_COVER_VISIBLE, C_SECTION = list(range(16))
SEARCH_COLUMNS = (C_TITLE, C_DESCRIPTION, C_SECTION)
@ -527,8 +527,8 @@ class PodcastListModel(Gtk.ListStore):
return model.get_value(iter, cls.C_SEPARATOR)
def __init__(self, cover_downloader):
Gtk.ListStore.__init__(self, str, str, str, GdkPixbuf.Pixbuf, \
object, GdkPixbuf.Pixbuf, str, bool, bool, bool, bool, \
Gtk.ListStore.__init__(self, str, str, str, GdkPixbuf.Pixbuf,
object, GdkPixbuf.Pixbuf, str, bool, bool, bool, bool,
bool, bool, int, bool, str)
# Filter to allow hiding some episodes
@ -706,7 +706,7 @@ class PodcastListModel(Gtk.ListStore):
else:
return None
def _format_description(self, channel, total, deleted, \
def _format_description(self, channel, total, deleted,
new, downloaded, unplayed):
title_markup = cgi.escape(channel.title)
if not channel.pause_subscription:
@ -864,22 +864,22 @@ class PodcastListModel(Gtk.ListStore):
return
total, deleted, new, downloaded, unplayed = channel.get_statistics()
description = self._format_description(channel, total, deleted, new, \
description = self._format_description(channel, total, deleted, new,
downloaded, unplayed)
pill_image = self._get_pill_image(channel, downloaded, unplayed)
self.set(iter, \
self.C_TITLE, channel.title, \
self.C_DESCRIPTION, description, \
self.C_SECTION, channel.section, \
self.C_ERROR, self._format_error(channel), \
self.C_PILL, pill_image, \
self.C_PILL_VISIBLE, pill_image is not None, \
self.C_VIEW_SHOW_UNDELETED, total - deleted > 0, \
self.C_VIEW_SHOW_DOWNLOADED, downloaded + new > 0, \
self.C_VIEW_SHOW_UNPLAYED, unplayed + new > 0, \
self.C_HAS_EPISODES, total > 0, \
self.set(iter,
self.C_TITLE, channel.title,
self.C_DESCRIPTION, description,
self.C_SECTION, channel.section,
self.C_ERROR, self._format_error(channel),
self.C_PILL, pill_image,
self.C_PILL_VISIBLE, pill_image is not None,
self.C_VIEW_SHOW_UNDELETED, total - deleted > 0,
self.C_VIEW_SHOW_DOWNLOADED, downloaded + new > 0,
self.C_VIEW_SHOW_UNPLAYED, unplayed + new > 0,
self.C_HAS_EPISODES, total > 0,
self.C_DOWNLOADS, downloaded)
def clear_cover_cache(self, podcast_url):

View File

@ -138,7 +138,7 @@ class PodcastEpisode(PodcastModelObject):
is_locked = property(fget=_deprecated, fset=_deprecated)
def has_website_link(self):
return bool(self.link) and (self.link != self.url or \
return bool(self.link) and (self.link != self.url or
youtube.is_video_link(self.link))
@classmethod
@ -336,7 +336,7 @@ class PodcastEpisode(PodcastModelObject):
self.save()
def age_in_days(self):
return util.file_age_in_days(self.local_filename(create=False, \
return util.file_age_in_days(self.local_filename(create=False,
check_only=True))
age_int_prop = property(fget=age_in_days)
@ -576,8 +576,8 @@ class PodcastEpisode(PodcastModelObject):
value is the canonical representation of this episode
in playlists (for example, M3U playlists).
"""
return '%s - %s (%s)' % (self.channel.title, \
self.title, \
return '%s - %s (%s)' % (self.channel.title,
self.title,
self.cute_pubdate())
def cute_pubdate(self):
@ -616,8 +616,8 @@ class PodcastEpisode(PodcastModelObject):
current position is greater than 99 percent of the
total time or inside the last 10 seconds of a track.
"""
return self.current_position > 0 and self.total_time > 0 and \
(self.current_position + 10 >= self.total_time or \
return self.current_position > 0 and self.total_time > 0 and
(self.current_position + 10 >= self.total_time or
self.current_position >= self.total_time * .99)
def get_play_info_string(self, duration_only=False):
@ -752,8 +752,8 @@ class PodcastChannel(PodcastModelObject):
known_files.add(filename)
existing_files = set(filename for filename in \
glob.glob(os.path.join(self.save_dir, '*')) \
existing_files = set(filename for filename in
glob.glob(os.path.join(self.save_dir, '*'))
if not filename.endswith('.partial'))
ignore_files = ['folder' + ext for ext in
@ -779,7 +779,7 @@ class PodcastChannel(PodcastModelObject):
continue
for episode in all_episodes:
wanted_filename = episode.local_filename(create=True, \
wanted_filename = episode.local_filename(create=True,
return_wanted_filename=True)
if basename == wanted_filename:
logger.info('Importing external download: %s', filename)

View File

@ -47,7 +47,7 @@ mygpoclient.user_agent += ' ' + gpodder.user_agent
# 2013-02-08: We should update this to 1.7 once we use the new features
MYGPOCLIENT_REQUIRED = '1.4'
if not hasattr(mygpoclient, 'require_version') or \
if not hasattr(mygpoclient, 'require_version') or
not mygpoclient.require_version(MYGPOCLIENT_REQUIRED):
print("""
Please upgrade your mygpoclient library.
@ -474,17 +474,17 @@ class MygPoClient(object):
def convert_to_api(action):
dt = datetime.datetime.utcfromtimestamp(action.timestamp)
action_ts = mygpoutil.datetime_to_iso8601(dt)
return api.EpisodeAction(action.podcast_url, \
action.episode_url, action.action, \
action.device_id, action_ts, \
return api.EpisodeAction(action.podcast_url,
action.episode_url, action.action,
action.device_id, action_ts,
action.started, action.position, action.total)
def convert_from_api(action):
dt = mygpoutil.iso8601_to_datetime(action.timestamp)
action_ts = calendar.timegm(dt.timetuple())
return ReceivedEpisodeAction(action.podcast, \
action.episode, action.device, \
action.action, action_ts, \
return ReceivedEpisodeAction(action.podcast,
action.episode, action.device,
action.action, action_ts,
action.started, action.position, action.total)
try:
@ -547,8 +547,8 @@ class MygPoClient(object):
logger.debug('Starting subscription sync.')
try:
# Load the "since" value from the database
since_o = self._store.get(SinceValue, host=self.host, \
device_id=self.device_id, \
since_o = self._store.get(SinceValue, host=self.host,
device_id=self.device_id,
category=SinceValue.PODCASTS)
# Use a default since object for the first-time case
@ -611,7 +611,7 @@ class MygPoClient(object):
def update_device(self, action):
try:
logger.debug('Uploading device settings...')
self._client.update_device_settings(action.device_id, \
self._client.update_device_settings(action.device_id,
action.caption, action.device_type)
logger.debug('Device settings uploaded.')
return True
@ -646,8 +646,8 @@ class MygPoClient(object):
def get_download_user_subscriptions_url(self):
OPML_URL = self._client.locator.subscriptions_uri()
url = util.url_add_authentication(OPML_URL, \
self._config.mygpo.username, \
url = util.url_add_authentication(OPML_URL,
self._config.mygpo.username,
self._config.mygpo.password)
return url

View File

@ -66,15 +66,15 @@ class MediaPlayerDBusReceiver(object):
self.on_play_event = on_play_event
self.bus = gpodder.dbus_session_bus
self.bus.add_signal_receiver(self.on_playback_started, \
self.SIGNAL_STARTED, \
self.INTERFACE, \
None, \
self.bus.add_signal_receiver(self.on_playback_started,
self.SIGNAL_STARTED,
self.INTERFACE,
None,
None)
self.bus.add_signal_receiver(self.on_playback_stopped, \
self.SIGNAL_STOPPED, \
self.INTERFACE, \
None, \
self.bus.add_signal_receiver(self.on_playback_stopped,
self.SIGNAL_STOPPED,
self.INTERFACE,
None,
None)
def on_playback_started(self, position, file_uri):