fix E502 the backslash is redundant between brackets
This commit is contained in:
parent
b21f3c8795
commit
49bb08c8a3
|
@ -27,7 +27,7 @@ import dbus
|
||||||
import gpodder
|
import gpodder
|
||||||
|
|
||||||
session_bus = dbus.SessionBus()
|
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)
|
gpodder.dbus_gui_object_path)
|
||||||
interface = dbus.Interface(proxy, gpodder.dbus_interface)
|
interface = dbus.Interface(proxy, gpodder.dbus_interface)
|
||||||
|
|
||||||
|
|
|
@ -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)
|
#DBusPodcastsProxy(lambda: self.channels, self.on_itemUpdate_activate(), self.playback_episodes, self.download_episode_list, bus_name)
|
||||||
def __init__(self, get_podcast_list, \
|
def __init__(self, get_podcast_list,
|
||||||
check_for_updates, playback_episodes, \
|
check_for_updates, playback_episodes,
|
||||||
download_episodes, episode_from_uri, \
|
download_episodes, episode_from_uri,
|
||||||
bus_name):
|
bus_name):
|
||||||
self._get_podcasts = get_podcast_list
|
self._get_podcasts = get_podcast_list
|
||||||
self._on_check_for_updates = check_for_updates
|
self._on_check_for_updates = check_for_updates
|
||||||
self._playback_episodes = playback_episodes
|
self._playback_episodes = playback_episodes
|
||||||
self._download_episodes = download_episodes
|
self._download_episodes = download_episodes
|
||||||
self._episode_from_uri = episode_from_uri
|
self._episode_from_uri = episode_from_uri
|
||||||
dbus.service.Object.__init__(self, \
|
dbus.service.Object.__init__(self,
|
||||||
object_path=gpodder.dbus_podcasts_object_path, \
|
object_path=gpodder.dbus_podcasts_object_path,
|
||||||
bus_name=bus_name)
|
bus_name=bus_name)
|
||||||
|
|
||||||
def _get_episode_refs(self, urls):
|
def _get_episode_refs(self, urls):
|
||||||
|
|
|
@ -816,7 +816,7 @@ class DownloadTask(object):
|
||||||
if disposition_filename is not None and disposition_filename != '':
|
if disposition_filename is not None and disposition_filename != '':
|
||||||
# The server specifies a download filename - try to use it
|
# The server specifies a download filename - try to use it
|
||||||
disposition_filename = os.path.basename(disposition_filename)
|
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)
|
force_update=True, template=disposition_filename)
|
||||||
new_mimetype, encoding = mimetypes.guess_type(self.filename)
|
new_mimetype, encoding = mimetypes.guess_type(self.filename)
|
||||||
if new_mimetype is not None:
|
if new_mimetype is not None:
|
||||||
|
|
|
@ -86,7 +86,7 @@ class ConfigModel(Gtk.ListStore):
|
||||||
#else:
|
#else:
|
||||||
# style = Pango.Style.ITALIC
|
# style = Pango.Style.ITALIC
|
||||||
new_value_text = config.config_value_to_string(new_value)
|
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_VALUE_TEXT, new_value_text,
|
||||||
self.C_BOOLEAN_VALUE, bool(new_value),
|
self.C_BOOLEAN_VALUE, bool(new_value),
|
||||||
self.C_FONT_STYLE, style)
|
self.C_FONT_STYLE, style)
|
||||||
|
|
|
@ -478,8 +478,8 @@ class gPodderPreferences(BuilderWidget):
|
||||||
self.preferred_vimeo_format_model.set_index(index)
|
self.preferred_vimeo_format_model.set_index(index)
|
||||||
|
|
||||||
def on_button_audio_player_clicked(self, widget):
|
def on_button_audio_player_clicked(self, widget):
|
||||||
result = self.show_text_edit_dialog(_('Configure audio player'), \
|
result = self.show_text_edit_dialog(_('Configure audio player'),
|
||||||
_('Command:'), \
|
_('Command:'),
|
||||||
self._config.player)
|
self._config.player)
|
||||||
|
|
||||||
if result:
|
if result:
|
||||||
|
@ -488,8 +488,8 @@ class gPodderPreferences(BuilderWidget):
|
||||||
self.combo_audio_player_app.set_active(index)
|
self.combo_audio_player_app.set_active(index)
|
||||||
|
|
||||||
def on_button_video_player_clicked(self, widget):
|
def on_button_video_player_clicked(self, widget):
|
||||||
result = self.show_text_edit_dialog(_('Configure video player'), \
|
result = self.show_text_edit_dialog(_('Configure video player'),
|
||||||
_('Command:'), \
|
_('Command:'),
|
||||||
self._config.videoplayer)
|
self._config.videoplayer)
|
||||||
|
|
||||||
if result:
|
if result:
|
||||||
|
|
|
@ -72,13 +72,13 @@ class DownloadStatusModel(Gtk.ListStore):
|
||||||
self.C_URL, task.url)
|
self.C_URL, task.url)
|
||||||
|
|
||||||
if task.status == task.FAILED:
|
if task.status == task.FAILED:
|
||||||
status_message = '%s: %s' % (\
|
status_message = '%s: %s' % (
|
||||||
task.STATUS_MESSAGE[task.status], \
|
task.STATUS_MESSAGE[task.status],
|
||||||
task.error_message)
|
task.error_message)
|
||||||
elif task.status == task.DOWNLOADING:
|
elif task.status == task.DOWNLOADING:
|
||||||
status_message = '%s (%.0f%%, %s/s)' % (\
|
status_message = '%s (%.0f%%, %s/s)' % (
|
||||||
task.STATUS_MESSAGE[task.status], \
|
task.STATUS_MESSAGE[task.status],
|
||||||
task.progress * 100, \
|
task.progress * 100,
|
||||||
util.format_filesize(task.speed))
|
util.format_filesize(task.speed))
|
||||||
else:
|
else:
|
||||||
status_message = task.STATUS_MESSAGE[task.status]
|
status_message = task.STATUS_MESSAGE[task.status]
|
||||||
|
@ -96,7 +96,7 @@ class DownloadStatusModel(Gtk.ListStore):
|
||||||
|
|
||||||
progress_message = ' / '.join((current, total))
|
progress_message = ' / '.join((current, total))
|
||||||
elif task.total_size > 0:
|
elif task.total_size > 0:
|
||||||
progress_message = util.format_filesize(task.total_size, \
|
progress_message = util.format_filesize(task.total_size,
|
||||||
digits=1)
|
digits=1)
|
||||||
else:
|
else:
|
||||||
progress_message = ('unknown size')
|
progress_message = ('unknown size')
|
||||||
|
@ -104,8 +104,8 @@ class DownloadStatusModel(Gtk.ListStore):
|
||||||
self.set(iter,
|
self.set(iter,
|
||||||
self.C_NAME, self._format_message(task.episode.title,
|
self.C_NAME, self._format_message(task.episode.title,
|
||||||
status_message, task.episode.channel.title),
|
status_message, task.episode.channel.title),
|
||||||
self.C_PROGRESS, 100. * task.progress, \
|
self.C_PROGRESS, 100. * task.progress,
|
||||||
self.C_PROGRESS_TEXT, progress_message, \
|
self.C_PROGRESS_TEXT, progress_message,
|
||||||
self.C_ICON_NAME, self._status_ids[task.status])
|
self.C_ICON_NAME, self._status_ids[task.status])
|
||||||
|
|
||||||
def __add_new_task(self, task):
|
def __add_new_task(self, task):
|
||||||
|
@ -135,7 +135,7 @@ class DownloadStatusModel(Gtk.ListStore):
|
||||||
for row in self:
|
for row in self:
|
||||||
task = row[DownloadStatusModel.C_TASK]
|
task = row[DownloadStatusModel.C_TASK]
|
||||||
if task is not None and \
|
if task is not None and \
|
||||||
task.status in (task.DOWNLOADING, \
|
task.status in (task.DOWNLOADING,
|
||||||
task.QUEUED):
|
task.QUEUED):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ class BuilderWidget(GtkBuilderWidget):
|
||||||
|
|
||||||
# Enable support for tracking iconified state
|
# Enable support for tracking iconified state
|
||||||
if hasattr(self, 'on_iconify') and hasattr(self, 'on_uniconify'):
|
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)
|
self._on_window_state_event_iconified)
|
||||||
|
|
||||||
def _on_window_state_event_iconified(self, widget, event):
|
def _on_window_state_event_iconified(self, widget, event):
|
||||||
|
@ -89,9 +89,9 @@ class BuilderWidget(GtkBuilderWidget):
|
||||||
dlg.destroy()
|
dlg.destroy()
|
||||||
return response == Gtk.ResponseType.YES
|
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):
|
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)
|
Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT)
|
||||||
|
|
||||||
dialog.add_button(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL)
|
dialog.add_button(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL)
|
||||||
|
|
|
@ -54,7 +54,7 @@ class ProgressIndicator(object):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def _create_progress(self):
|
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)
|
0, 0, Gtk.ButtonsType.CANCEL, self.subtitle or self.title)
|
||||||
self.dialog.set_modal(True)
|
self.dialog.set_modal(True)
|
||||||
self.dialog.connect('delete-event', self._on_delete_event)
|
self.dialog.connect('delete-event', self._on_delete_event)
|
||||||
|
@ -67,7 +67,7 @@ class ProgressIndicator(object):
|
||||||
if isinstance(label, Gtk.Label):
|
if isinstance(label, Gtk.Label):
|
||||||
label.set_selectable(False)
|
label.set_selectable(False)
|
||||||
|
|
||||||
self.dialog.set_response_sensitive(Gtk.ResponseType.CANCEL, \
|
self.dialog.set_response_sensitive(Gtk.ResponseType.CANCEL,
|
||||||
self.cancellable)
|
self.cancellable)
|
||||||
|
|
||||||
self.progressbar = Gtk.ProgressBar()
|
self.progressbar = Gtk.ProgressBar()
|
||||||
|
|
|
@ -589,14 +589,14 @@ class gPodder(BuilderWidget, dbus.service.Object):
|
||||||
|
|
||||||
def ask():
|
def ask():
|
||||||
# We're abusing the Episode Selector again ;) -- thp
|
# We're abusing the Episode Selector again ;) -- thp
|
||||||
gPodderEpisodeSelector(self.main_window, \
|
gPodderEpisodeSelector(self.main_window,
|
||||||
title=_('Confirm changes from gpodder.net'), \
|
title=_('Confirm changes from gpodder.net'),
|
||||||
instructions=_('Select the actions you want to carry out.'), \
|
instructions=_('Select the actions you want to carry out.'),
|
||||||
episodes=changes, \
|
episodes=changes,
|
||||||
columns=columns, \
|
columns=columns,
|
||||||
size_attribute=None, \
|
size_attribute=None,
|
||||||
stock_ok_button=Gtk.STOCK_APPLY, \
|
stock_ok_button=Gtk.STOCK_APPLY,
|
||||||
callback=execute_podcast_actions, \
|
callback=execute_podcast_actions,
|
||||||
_config=self.config)
|
_config=self.config)
|
||||||
|
|
||||||
# There are some actions that need the user's attention
|
# 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):
|
def on_send_full_subscriptions(self):
|
||||||
# Send the full subscription list to the gpodder.net client
|
# Send the full subscription list to the gpodder.net client
|
||||||
# (this will overwrite the subscription list on the server)
|
# (this will overwrite the subscription list on the server)
|
||||||
indicator = ProgressIndicator(_('Uploading subscriptions'), \
|
indicator = ProgressIndicator(_('Uploading subscriptions'),
|
||||||
_('Your subscriptions are being uploaded to the server.'), \
|
_('Your subscriptions are being uploaded to the server.'),
|
||||||
False, self.get_dialog_parent())
|
False, self.get_dialog_parent())
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -643,8 +643,8 @@ class gPodder(BuilderWidget, dbus.service.Object):
|
||||||
message = str(e)
|
message = str(e)
|
||||||
if not message:
|
if not message:
|
||||||
message = e.__class__.__name__
|
message = e.__class__.__name__
|
||||||
self.show_message(message, \
|
self.show_message(message,
|
||||||
_('Error while uploading'), \
|
_('Error while uploading'),
|
||||||
important=True)
|
important=True)
|
||||||
util.idle_add(show_error, e)
|
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):
|
def for_each_episode_set_task_status(self, episodes, status):
|
||||||
episode_urls = set(episode.url for episode in episodes)
|
episode_urls = set(episode.url for episode in episodes)
|
||||||
model = self.treeDownloads.get_model()
|
model = self.treeDownloads.get_model()
|
||||||
selected_tasks = [(Gtk.TreeRowReference.new(model, row.path), \
|
selected_tasks = [(Gtk.TreeRowReference.new(model, row.path),
|
||||||
model.get_value(row.iter, \
|
model.get_value(row.iter,
|
||||||
DownloadStatusModel.C_TASK)) for row in model \
|
DownloadStatusModel.C_TASK)) for row in model
|
||||||
if model.get_value(row.iter, DownloadStatusModel.C_TASK).url \
|
if model.get_value(row.iter, DownloadStatusModel.C_TASK).url
|
||||||
in episode_urls]
|
in episode_urls]
|
||||||
self._for_each_task_set_status(selected_tasks, status)
|
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.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)
|
(('text/uri-list', 0, 0),), Gdk.DragAction.COPY)
|
||||||
|
|
||||||
def drag_data_get(tree, context, selection_data, info, timestamp):
|
def drag_data_get(tree, context, selection_data, info, timestamp):
|
||||||
uris = ['file://' + e.local_filename(create=False) \
|
uris = ['file://' + e.local_filename(create=False)
|
||||||
for e in self.get_selected_episodes() \
|
for e in self.get_selected_episodes()
|
||||||
if e.was_downloaded(and_exists=True)]
|
if e.was_downloaded(and_exists=True)]
|
||||||
uris.append('') # for the trailing '\r\n'
|
uris.append('') # for the trailing '\r\n'
|
||||||
selection_data.set(selection_data.target, 8, '\r\n'.join(uris))
|
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 = Gtk.CellRendererPixbuf()
|
||||||
cell.set_property('stock-size', Gtk.IconSize.BUTTON)
|
cell.set_property('stock-size', Gtk.IconSize.BUTTON)
|
||||||
column.pack_start(cell, False)
|
column.pack_start(cell, False)
|
||||||
column.add_attribute(cell, 'icon-name', \
|
column.add_attribute(cell, 'icon-name',
|
||||||
DownloadStatusModel.C_ICON_NAME)
|
DownloadStatusModel.C_ICON_NAME)
|
||||||
|
|
||||||
cell = Gtk.CellRendererText()
|
cell = Gtk.CellRendererText()
|
||||||
|
@ -1061,7 +1061,7 @@ class gPodder(BuilderWidget, dbus.service.Object):
|
||||||
cell.set_property('yalign', .5)
|
cell.set_property('yalign', .5)
|
||||||
cell.set_property('ypad', 6)
|
cell.set_property('ypad', 6)
|
||||||
column = Gtk.TreeViewColumn(_('Progress'), cell,
|
column = Gtk.TreeViewColumn(_('Progress'), cell,
|
||||||
value=DownloadStatusModel.C_PROGRESS, \
|
value=DownloadStatusModel.C_PROGRESS,
|
||||||
text=DownloadStatusModel.C_PROGRESS_TEXT)
|
text=DownloadStatusModel.C_PROGRESS_TEXT)
|
||||||
column.set_sizing(Gtk.TreeViewColumnSizing.AUTOSIZE)
|
column.set_sizing(Gtk.TreeViewColumnSizing.AUTOSIZE)
|
||||||
column.set_expand(False)
|
column.set_expand(False)
|
||||||
|
@ -1387,13 +1387,13 @@ class gPodder(BuilderWidget, dbus.service.Object):
|
||||||
selection = treeview.get_selection()
|
selection = treeview.get_selection()
|
||||||
model, paths = selection.get_selected_rows()
|
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):
|
event.button == 3):
|
||||||
# We have right-clicked, but not into the selection,
|
# We have right-clicked, but not into the selection,
|
||||||
# assume we don't want to operate on the selection
|
# assume we don't want to operate on the selection
|
||||||
paths = []
|
paths = []
|
||||||
|
|
||||||
if path is not None and not paths and \
|
if path is not None and not paths and
|
||||||
event.button == 3:
|
event.button == 3:
|
||||||
# No selection or clicked outside selection;
|
# No selection or clicked outside selection;
|
||||||
# select the single item where we clicked
|
# select the single item where we clicked
|
||||||
|
@ -1417,27 +1417,27 @@ class gPodder(BuilderWidget, dbus.service.Object):
|
||||||
model, paths = selection.get_selected_rows()
|
model, paths = selection.get_selected_rows()
|
||||||
|
|
||||||
can_queue, can_cancel, can_pause, can_remove, can_force = (True,) * 5
|
can_queue, can_cancel, can_pause, can_remove, can_force = (True,) * 5
|
||||||
selected_tasks = [(Gtk.TreeRowReference.new(model, path), \
|
selected_tasks = [(Gtk.TreeRowReference.new(model, path),
|
||||||
model.get_value(model.get_iter(path), \
|
model.get_value(model.get_iter(path),
|
||||||
DownloadStatusModel.C_TASK)) for path in paths]
|
DownloadStatusModel.C_TASK)) for path in paths]
|
||||||
|
|
||||||
for row_reference, task in selected_tasks:
|
for row_reference, task in selected_tasks:
|
||||||
if task.status != download.DownloadTask.QUEUED:
|
if task.status != download.DownloadTask.QUEUED:
|
||||||
can_force = False
|
can_force = False
|
||||||
if task.status not in (download.DownloadTask.PAUSED, \
|
if task.status not in (download.DownloadTask.PAUSED,
|
||||||
download.DownloadTask.FAILED, \
|
download.DownloadTask.FAILED,
|
||||||
download.DownloadTask.CANCELLED):
|
download.DownloadTask.CANCELLED):
|
||||||
can_queue = False
|
can_queue = False
|
||||||
if task.status not in (download.DownloadTask.PAUSED, \
|
if task.status not in (download.DownloadTask.PAUSED,
|
||||||
download.DownloadTask.QUEUED, \
|
download.DownloadTask.QUEUED,
|
||||||
download.DownloadTask.DOWNLOADING, \
|
download.DownloadTask.DOWNLOADING,
|
||||||
download.DownloadTask.FAILED):
|
download.DownloadTask.FAILED):
|
||||||
can_cancel = False
|
can_cancel = False
|
||||||
if task.status not in (download.DownloadTask.QUEUED, \
|
if task.status not in (download.DownloadTask.QUEUED,
|
||||||
download.DownloadTask.DOWNLOADING):
|
download.DownloadTask.DOWNLOADING):
|
||||||
can_pause = False
|
can_pause = False
|
||||||
if task.status not in (download.DownloadTask.CANCELLED, \
|
if task.status not in (download.DownloadTask.CANCELLED,
|
||||||
download.DownloadTask.FAILED, \
|
download.DownloadTask.FAILED,
|
||||||
download.DownloadTask.DONE):
|
download.DownloadTask.DONE):
|
||||||
can_remove = False
|
can_remove = False
|
||||||
|
|
||||||
|
@ -2050,7 +2050,7 @@ class gPodder(BuilderWidget, dbus.service.Object):
|
||||||
logger.error('Exception in D-Bus call: %s', str(err))
|
logger.error('Exception in D-Bus call: %s', str(err))
|
||||||
|
|
||||||
# Fallback: use the command line client
|
# Fallback: use the command line client
|
||||||
for command in util.format_desktop_command('panucci', \
|
for command in util.format_desktop_command('panucci',
|
||||||
[filename]):
|
[filename]):
|
||||||
logger.info('Executing: %s', repr(command))
|
logger.info('Executing: %s', repr(command))
|
||||||
subprocess.Popen(command)
|
subprocess.Popen(command)
|
||||||
|
@ -2058,7 +2058,7 @@ class gPodder(BuilderWidget, dbus.service.Object):
|
||||||
on_error = lambda err: error_handler(filename, err)
|
on_error = lambda err: error_handler(filename, err)
|
||||||
|
|
||||||
# This method only exists in Panucci > 0.9 ('new Panucci')
|
# 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)
|
reply_handler=on_reply, error_handler=on_error)
|
||||||
|
|
||||||
continue # This file was handled by the D-Bus call
|
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):
|
def playback_episodes(self, episodes):
|
||||||
# We need to create a list, because we run through it more than once
|
# 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()))
|
e.was_downloaded(and_exists=True) or self.streaming_possible()))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.playback_episodes_for_real(episodes)
|
self.playback_episodes_for_real(episodes)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error('Error in playback!', exc_info=True)
|
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'))
|
_('Error opening player'))
|
||||||
|
|
||||||
self.episode_list_status_changed(episodes)
|
self.episode_list_status_changed(episodes)
|
||||||
|
@ -2328,8 +2328,8 @@ class gPodder(BuilderWidget, dbus.service.Object):
|
||||||
error_messages = {}
|
error_messages = {}
|
||||||
redirections = {}
|
redirections = {}
|
||||||
|
|
||||||
progress = ProgressIndicator(_('Adding podcasts'), \
|
progress = ProgressIndicator(_('Adding podcasts'),
|
||||||
_('Please wait while episode information is downloaded.'), \
|
_('Please wait while episode information is downloaded.'),
|
||||||
parent=self.get_dialog_parent())
|
parent=self.get_dialog_parent())
|
||||||
|
|
||||||
def on_after_update():
|
def on_after_update():
|
||||||
|
@ -2373,7 +2373,7 @@ class gPodder(BuilderWidget, dbus.service.Object):
|
||||||
if failed:
|
if failed:
|
||||||
title = _('Could not add some podcasts')
|
title = _('Could not add some podcasts')
|
||||||
message = _('Some podcasts could not be added to your list:') \
|
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)
|
error_messages.get(url, _('Unknown')))) for url in failed)
|
||||||
self.show_message(message, title, important=True)
|
self.show_message(message, title, important=True)
|
||||||
|
|
||||||
|
@ -2409,9 +2409,9 @@ class gPodder(BuilderWidget, dbus.service.Object):
|
||||||
episodes.extend(podcast.get_all_episodes())
|
episodes.extend(podcast.get_all_episodes())
|
||||||
|
|
||||||
if episodes:
|
if episodes:
|
||||||
episodes = list(Model.sort_episodes_by_pubdate(episodes, \
|
episodes = list(Model.sort_episodes_by_pubdate(episodes,
|
||||||
reverse=True))
|
reverse=True))
|
||||||
self.new_episodes_show(episodes, \
|
self.new_episodes_show(episodes,
|
||||||
selected=[e.check_is_new() for e in episodes])
|
selected=[e.check_is_new() for e in episodes])
|
||||||
|
|
||||||
@util.run_in_background
|
@util.run_in_background
|
||||||
|
@ -2424,8 +2424,8 @@ class gPodder(BuilderWidget, dbus.service.Object):
|
||||||
progress.on_message(title or url)
|
progress.on_message(title or url)
|
||||||
try:
|
try:
|
||||||
# The URL is valid and does not exist already - subscribe!
|
# The URL is valid and does not exist already - subscribe!
|
||||||
channel = self.model.load_podcast(url=url, create=True, \
|
channel = self.model.load_podcast(url=url, create=True,
|
||||||
authentication_tokens=auth_tokens.get(url, None), \
|
authentication_tokens=auth_tokens.get(url, None),
|
||||||
max_episodes=self.config.max_episodes_per_feed)
|
max_episodes=self.config.max_episodes_per_feed)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -2491,8 +2491,8 @@ class gPodder(BuilderWidget, dbus.service.Object):
|
||||||
the server to the local database and update the
|
the server to the local database and update the
|
||||||
status of the affected episodes as necessary.
|
status of the affected episodes as necessary.
|
||||||
"""
|
"""
|
||||||
indicator = ProgressIndicator(_('Merging episode actions'), \
|
indicator = ProgressIndicator(_('Merging episode actions'),
|
||||||
_('Episode actions from gpodder.net are merged.'), \
|
_('Episode actions from gpodder.net are merged.'),
|
||||||
False, self.get_dialog_parent())
|
False, self.get_dialog_parent())
|
||||||
|
|
||||||
Gtk.main_iteration()
|
Gtk.main_iteration()
|
||||||
|
@ -2722,8 +2722,8 @@ class gPodder(BuilderWidget, dbus.service.Object):
|
||||||
if confirm and not self.show_confirmation(message, title):
|
if confirm and not self.show_confirmation(message, title):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
progress = ProgressIndicator(_('Deleting episodes'), \
|
progress = ProgressIndicator(_('Deleting episodes'),
|
||||||
_('Please wait while episodes are deleted'), \
|
_('Please wait while episodes are deleted'),
|
||||||
parent=self.get_dialog_parent())
|
parent=self.get_dialog_parent())
|
||||||
|
|
||||||
def finish_deletion(episode_urls, channel_urls):
|
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]
|
selected = [not e.is_new or not e.file_exists() for e in episodes]
|
||||||
|
|
||||||
gPodderEpisodeSelector(self.main_window, title = _('Delete episodes'), instructions = instructions, \
|
gPodderEpisodeSelector(self.main_window, title = _('Delete episodes'), instructions = instructions,
|
||||||
episodes = episodes, selected = selected, columns = columns, \
|
episodes = episodes, selected = selected, columns = columns,
|
||||||
stock_ok_button = 'edit-delete', callback = self.delete_episode_list, \
|
stock_ok_button = 'edit-delete', callback = self.delete_episode_list,
|
||||||
selection_buttons = selection_buttons, _config=self.config)
|
selection_buttons = selection_buttons, _config=self.config)
|
||||||
|
|
||||||
def on_selected_episodes_status_changed(self):
|
def on_selected_episodes_status_changed(self):
|
||||||
|
@ -2991,23 +2991,23 @@ class gPodder(BuilderWidget, dbus.service.Object):
|
||||||
# Select all by default
|
# Select all by default
|
||||||
selected = [True] * len(episodes)
|
selected = [True] * len(episodes)
|
||||||
|
|
||||||
self.new_episodes_window = gPodderEpisodeSelector(self.main_window, \
|
self.new_episodes_window = gPodderEpisodeSelector(self.main_window,
|
||||||
title=_('New episodes available'), \
|
title=_('New episodes available'),
|
||||||
instructions=instructions, \
|
instructions=instructions,
|
||||||
episodes=episodes, \
|
episodes=episodes,
|
||||||
columns=columns, \
|
columns=columns,
|
||||||
selected=selected, \
|
selected=selected,
|
||||||
stock_ok_button = 'gpodder-download', \
|
stock_ok_button = 'gpodder-download',
|
||||||
callback=download_episodes_callback, \
|
callback=download_episodes_callback,
|
||||||
remove_callback=lambda e: e.mark_old(), \
|
remove_callback=lambda e: e.mark_old(),
|
||||||
remove_action=_('Mark as old'), \
|
remove_action=_('Mark as old'),
|
||||||
remove_finished=self.episode_new_status_changed, \
|
remove_finished=self.episode_new_status_changed,
|
||||||
_config=self.config, \
|
_config=self.config,
|
||||||
show_notification=False)
|
show_notification=False)
|
||||||
|
|
||||||
def on_itemDownloadAllNew_activate(self, action, param):
|
def on_itemDownloadAllNew_activate(self, action, param):
|
||||||
if not self.offer_new_episodes():
|
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'))
|
_('No new episodes available'))
|
||||||
|
|
||||||
def get_new_episodes(self, channels=None):
|
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 on_download_subscriptions_from_mygpo(self, action=None):
|
||||||
def after_login():
|
def after_login():
|
||||||
title = _('Subscriptions on %(server)s') \
|
title = _('Subscriptions on %(server)s')
|
||||||
% {'server': self.config.mygpo.server}
|
% {'server': self.config.mygpo.server}
|
||||||
dir = gPodderPodcastDirectory(self.gPodder,
|
dir = gPodderPodcastDirectory(self.gPodder,
|
||||||
_config=self.config,
|
_config=self.config,
|
||||||
|
@ -3081,7 +3081,7 @@ class gPodder(BuilderWidget, dbus.service.Object):
|
||||||
util.idle_add(after_login)
|
util.idle_add(after_login)
|
||||||
|
|
||||||
def on_itemAddChannel_activate(self, action=None, param=None):
|
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)
|
add_podcast_list=self.add_podcast_list)
|
||||||
|
|
||||||
def on_itemEditChannel_activate(self, action, param=None):
|
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,
|
# We're abusing the Episode Selector for selecting Podcasts here,
|
||||||
# but it works and looks good, so why not? -- thp
|
# but it works and looks good, so why not? -- thp
|
||||||
gPodderEpisodeSelector(self.main_window, \
|
gPodderEpisodeSelector(self.main_window,
|
||||||
title=_('Delete podcasts'), \
|
title=_('Delete podcasts'),
|
||||||
instructions=_('Select the podcast you want to delete.'), \
|
instructions=_('Select the podcast you want to delete.'),
|
||||||
episodes=self.channels, \
|
episodes=self.channels,
|
||||||
columns=columns, \
|
columns=columns,
|
||||||
size_attribute=None, \
|
size_attribute=None,
|
||||||
stock_ok_button=_('Delete'), \
|
stock_ok_button=_('Delete'),
|
||||||
callback=self.remove_podcast_list, \
|
callback=self.remove_podcast_list,
|
||||||
_config=self.config)
|
_config=self.config)
|
||||||
|
|
||||||
def remove_podcast_list(self, channels, confirm=True):
|
def remove_podcast_list(self, channels, confirm=True):
|
||||||
|
@ -3215,8 +3215,8 @@ class gPodder(BuilderWidget, dbus.service.Object):
|
||||||
dlg.destroy()
|
dlg.destroy()
|
||||||
|
|
||||||
if filename is not None:
|
if filename is not None:
|
||||||
dir = gPodderPodcastDirectory(self.gPodder, _config=self.config, \
|
dir = gPodderPodcastDirectory(self.gPodder, _config=self.config,
|
||||||
custom_title=_('Import podcasts from OPML file'), \
|
custom_title=_('Import podcasts from OPML file'),
|
||||||
add_podcast_list=self.add_podcast_list,
|
add_podcast_list=self.add_podcast_list,
|
||||||
hide_url_entry=True)
|
hide_url_entry=True)
|
||||||
dir.download_opml_file(filename)
|
dir.download_opml_file(filename)
|
||||||
|
@ -3332,7 +3332,7 @@ class gPodder(BuilderWidget, dbus.service.Object):
|
||||||
|
|
||||||
def get_podcast_urls_from_selected_episodes(self):
|
def get_podcast_urls_from_selected_episodes(self):
|
||||||
"""Get a set of podcast URLs based on the selected episodes"""
|
"""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())
|
self.get_selected_episodes())
|
||||||
|
|
||||||
def get_selected_episodes(self):
|
def get_selected_episodes(self):
|
||||||
|
@ -3367,12 +3367,12 @@ class gPodder(BuilderWidget, dbus.service.Object):
|
||||||
GObject.source_remove(self._auto_update_timer_source_id)
|
GObject.source_remove(self._auto_update_timer_source_id)
|
||||||
self._auto_update_timer_source_id = None
|
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:
|
self.config.auto_update_frequency:
|
||||||
interval = 60 * 1000 * self.config.auto_update_frequency
|
interval = 60 * 1000 * self.config.auto_update_frequency
|
||||||
logger.debug('Setting up auto update timer with interval %d.',
|
logger.debug('Setting up auto update timer with interval %d.',
|
||||||
self.config.auto_update_frequency)
|
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)
|
interval, self._on_auto_update_timer)
|
||||||
|
|
||||||
def _on_auto_update_timer(self):
|
def _on_auto_update_timer(self):
|
||||||
|
@ -3413,14 +3413,14 @@ class gPodder(BuilderWidget, dbus.service.Object):
|
||||||
if self.wNotebook.get_current_page() == 0:
|
if self.wNotebook.get_current_page() == 0:
|
||||||
selection = self.treeAvailable.get_selection()
|
selection = self.treeAvailable.get_selection()
|
||||||
(model, paths) = selection.get_selected_rows()
|
(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]
|
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]
|
if task.url in urls]
|
||||||
else:
|
else:
|
||||||
selection = self.treeDownloads.get_selection()
|
selection = self.treeDownloads.get_selection()
|
||||||
(model, paths) = selection.get_selected_rows()
|
(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.download_status_model.C_TASK) for path in paths]
|
||||||
self.cancel_task_list(selected_tasks)
|
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)
|
self.bus_name = dbus.service.BusName(gpodder.dbus_bus_name, bus=gpodder.dbus_session_bus)
|
||||||
except dbus.exceptions.DBusException as dbe:
|
except dbus.exceptions.DBusException as dbe:
|
||||||
logger.warn('Cannot get "on the bus".', exc_info=True)
|
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'))
|
Gtk.ButtonsType.CLOSE, _('Cannot start gPodder'))
|
||||||
dlg.format_secondary_markup(_('D-Bus error: %s') % (str(dbe),))
|
dlg.format_secondary_markup(_('D-Bus error: %s') % (str(dbe),))
|
||||||
dlg.set_title('gPodder')
|
dlg.set_title('gPodder')
|
||||||
|
@ -3689,7 +3689,7 @@ class gPodderApplication(Gtk.Application):
|
||||||
self.window.gPodder.present()
|
self.window.gPodder.present()
|
||||||
|
|
||||||
def on_about(self, action, param):
|
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)
|
Gtk.DialogFlags.MODAL)
|
||||||
dlg.add_button(Gtk.STOCK_CLOSE, Gtk.ResponseType.OK).show()
|
dlg.add_button(Gtk.STOCK_CLOSE, Gtk.ResponseType.OK).show()
|
||||||
dlg.set_resizable(False)
|
dlg.set_resizable(False)
|
||||||
|
@ -3735,13 +3735,13 @@ class gPodderApplication(Gtk.Application):
|
||||||
util.open_website('https://gpodder.github.io/docs/')
|
util.open_website('https://gpodder.github.io/docs/')
|
||||||
|
|
||||||
def on_itemPreferences_activate(self, action, param=None):
|
def on_itemPreferences_activate(self, action, param=None):
|
||||||
gPodderPreferences(self.window.gPodder, \
|
gPodderPreferences(self.window.gPodder,
|
||||||
_config=self.window.config, \
|
_config=self.window.config,
|
||||||
user_apps_reader=self.window.user_apps_reader, \
|
user_apps_reader=self.window.user_apps_reader,
|
||||||
parent_window=self.window.main_window, \
|
parent_window=self.window.main_window,
|
||||||
mygpo_client=self.window.mygpo_client, \
|
mygpo_client=self.window.mygpo_client,
|
||||||
on_send_full_subscriptions=self.window.on_send_full_subscriptions, \
|
on_send_full_subscriptions=self.window.on_send_full_subscriptions,
|
||||||
on_itemExportChannels_activate=self.window.on_itemExportChannels_activate, \
|
on_itemExportChannels_activate=self.window.on_itemExportChannels_activate,
|
||||||
on_extension_enabled=self.on_extension_enabled,
|
on_extension_enabled=self.on_extension_enabled,
|
||||||
on_extension_disabled=self.on_extension_disabled)
|
on_extension_disabled=self.on_extension_disabled)
|
||||||
|
|
||||||
|
|
|
@ -68,11 +68,11 @@ class GEpisode(model.PodcastEpisode):
|
||||||
length_str = '%s; ' % util.format_filesize(self.file_size)
|
length_str = '%s; ' % util.format_filesize(self.file_size)
|
||||||
else:
|
else:
|
||||||
length_str = ''
|
length_str = ''
|
||||||
return ('<b>%s</b>\n<small>%s' + _('released %s') + \
|
return ('<b>%s</b>\n<small>%s' + _('released %s') +
|
||||||
'; ' + _('from %s') + '</small>') % (\
|
'; ' + _('from %s') + '</small>') % (
|
||||||
cgi.escape(re.sub('\s+', ' ', self.title)), \
|
cgi.escape(re.sub('\s+', ' ', self.title)),
|
||||||
cgi.escape(length_str), \
|
cgi.escape(length_str),
|
||||||
cgi.escape(self.pubdate_prop), \
|
cgi.escape(self.pubdate_prop),
|
||||||
cgi.escape(re.sub('\s+', ' ', self.channel.title)))
|
cgi.escape(re.sub('\s+', ' ', self.channel.title)))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -86,12 +86,12 @@ class GEpisode(model.PodcastEpisode):
|
||||||
downloaded_string = self.get_age_string()
|
downloaded_string = self.get_age_string()
|
||||||
if not downloaded_string:
|
if not downloaded_string:
|
||||||
downloaded_string = _('today')
|
downloaded_string = _('today')
|
||||||
return ('<b>%s</b>\n<small>%s; %s; ' + _('downloaded %s') + \
|
return ('<b>%s</b>\n<small>%s; %s; ' + _('downloaded %s') +
|
||||||
'; ' + _('from %s') + '</small>') % (\
|
'; ' + _('from %s') + '</small>') % (
|
||||||
cgi.escape(self.title), \
|
cgi.escape(self.title),
|
||||||
cgi.escape(util.format_filesize(self.file_size)), \
|
cgi.escape(util.format_filesize(self.file_size)),
|
||||||
cgi.escape(played_string), \
|
cgi.escape(played_string),
|
||||||
cgi.escape(downloaded_string), \
|
cgi.escape(downloaded_string),
|
||||||
cgi.escape(self.channel.title))
|
cgi.escape(self.channel.title))
|
||||||
|
|
||||||
|
|
||||||
|
@ -148,11 +148,11 @@ class BackgroundUpdate(object):
|
||||||
|
|
||||||
|
|
||||||
class EpisodeListModel(Gtk.ListStore):
|
class EpisodeListModel(Gtk.ListStore):
|
||||||
C_URL, C_TITLE, C_FILESIZE_TEXT, C_EPISODE, C_STATUS_ICON, \
|
C_URL, C_TITLE, C_FILESIZE_TEXT, C_EPISODE, C_STATUS_ICON,
|
||||||
C_PUBLISHED_TEXT, C_DESCRIPTION, C_TOOLTIP, \
|
C_PUBLISHED_TEXT, C_DESCRIPTION, C_TOOLTIP,
|
||||||
C_VIEW_SHOW_UNDELETED, C_VIEW_SHOW_DOWNLOADED, \
|
C_VIEW_SHOW_UNDELETED, C_VIEW_SHOW_DOWNLOADED,
|
||||||
C_VIEW_SHOW_UNPLAYED, C_FILESIZE, C_PUBLISHED, \
|
C_VIEW_SHOW_UNPLAYED, C_FILESIZE, C_PUBLISHED,
|
||||||
C_TIME, C_TIME_VISIBLE, C_TOTAL_TIME, \
|
C_TIME, C_TIME_VISIBLE, C_TOTAL_TIME,
|
||||||
C_LOCKED = list(range(17))
|
C_LOCKED = list(range(17))
|
||||||
|
|
||||||
VIEW_ALL, VIEW_UNDELETED, VIEW_DOWNLOADED, VIEW_UNPLAYED = list(range(4))
|
VIEW_ALL, VIEW_UNDELETED, VIEW_DOWNLOADED, VIEW_UNPLAYED = list(range(4))
|
||||||
|
@ -166,8 +166,8 @@ class EpisodeListModel(Gtk.ListStore):
|
||||||
PROGRESS_STEPS = 20
|
PROGRESS_STEPS = 20
|
||||||
|
|
||||||
def __init__(self, config, on_filter_changed=lambda has_episodes: None):
|
def __init__(self, config, on_filter_changed=lambda has_episodes: None):
|
||||||
Gtk.ListStore.__init__(self, str, str, str, object, \
|
Gtk.ListStore.__init__(self, str, str, str, object,
|
||||||
str, str, str, str, bool, bool, bool, \
|
str, str, str, str, bool, bool, bool,
|
||||||
GObject.TYPE_INT64, GObject.TYPE_INT64, str, bool, GObject.TYPE_INT64, bool)
|
GObject.TYPE_INT64, GObject.TYPE_INT64, str, bool, GObject.TYPE_INT64, bool)
|
||||||
|
|
||||||
self._config = config
|
self._config = config
|
||||||
|
@ -514,10 +514,10 @@ class PodcastChannelProxy(object):
|
||||||
|
|
||||||
|
|
||||||
class PodcastListModel(Gtk.ListStore):
|
class PodcastListModel(Gtk.ListStore):
|
||||||
C_URL, C_TITLE, C_DESCRIPTION, C_PILL, C_CHANNEL, \
|
C_URL, C_TITLE, C_DESCRIPTION, C_PILL, C_CHANNEL,
|
||||||
C_COVER, C_ERROR, C_PILL_VISIBLE, \
|
C_COVER, C_ERROR, C_PILL_VISIBLE,
|
||||||
C_VIEW_SHOW_UNDELETED, C_VIEW_SHOW_DOWNLOADED, \
|
C_VIEW_SHOW_UNDELETED, C_VIEW_SHOW_DOWNLOADED,
|
||||||
C_VIEW_SHOW_UNPLAYED, C_HAS_EPISODES, C_SEPARATOR, \
|
C_VIEW_SHOW_UNPLAYED, C_HAS_EPISODES, C_SEPARATOR,
|
||||||
C_DOWNLOADS, C_COVER_VISIBLE, C_SECTION = list(range(16))
|
C_DOWNLOADS, C_COVER_VISIBLE, C_SECTION = list(range(16))
|
||||||
|
|
||||||
SEARCH_COLUMNS = (C_TITLE, C_DESCRIPTION, C_SECTION)
|
SEARCH_COLUMNS = (C_TITLE, C_DESCRIPTION, C_SECTION)
|
||||||
|
@ -527,8 +527,8 @@ class PodcastListModel(Gtk.ListStore):
|
||||||
return model.get_value(iter, cls.C_SEPARATOR)
|
return model.get_value(iter, cls.C_SEPARATOR)
|
||||||
|
|
||||||
def __init__(self, cover_downloader):
|
def __init__(self, cover_downloader):
|
||||||
Gtk.ListStore.__init__(self, str, str, str, GdkPixbuf.Pixbuf, \
|
Gtk.ListStore.__init__(self, str, str, str, GdkPixbuf.Pixbuf,
|
||||||
object, GdkPixbuf.Pixbuf, str, bool, bool, bool, bool, \
|
object, GdkPixbuf.Pixbuf, str, bool, bool, bool, bool,
|
||||||
bool, bool, int, bool, str)
|
bool, bool, int, bool, str)
|
||||||
|
|
||||||
# Filter to allow hiding some episodes
|
# Filter to allow hiding some episodes
|
||||||
|
@ -706,7 +706,7 @@ class PodcastListModel(Gtk.ListStore):
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def _format_description(self, channel, total, deleted, \
|
def _format_description(self, channel, total, deleted,
|
||||||
new, downloaded, unplayed):
|
new, downloaded, unplayed):
|
||||||
title_markup = cgi.escape(channel.title)
|
title_markup = cgi.escape(channel.title)
|
||||||
if not channel.pause_subscription:
|
if not channel.pause_subscription:
|
||||||
|
@ -864,22 +864,22 @@ class PodcastListModel(Gtk.ListStore):
|
||||||
return
|
return
|
||||||
|
|
||||||
total, deleted, new, downloaded, unplayed = channel.get_statistics()
|
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)
|
downloaded, unplayed)
|
||||||
|
|
||||||
pill_image = self._get_pill_image(channel, downloaded, unplayed)
|
pill_image = self._get_pill_image(channel, downloaded, unplayed)
|
||||||
|
|
||||||
self.set(iter, \
|
self.set(iter,
|
||||||
self.C_TITLE, channel.title, \
|
self.C_TITLE, channel.title,
|
||||||
self.C_DESCRIPTION, description, \
|
self.C_DESCRIPTION, description,
|
||||||
self.C_SECTION, channel.section, \
|
self.C_SECTION, channel.section,
|
||||||
self.C_ERROR, self._format_error(channel), \
|
self.C_ERROR, self._format_error(channel),
|
||||||
self.C_PILL, pill_image, \
|
self.C_PILL, pill_image,
|
||||||
self.C_PILL_VISIBLE, pill_image is not None, \
|
self.C_PILL_VISIBLE, pill_image is not None,
|
||||||
self.C_VIEW_SHOW_UNDELETED, total - deleted > 0, \
|
self.C_VIEW_SHOW_UNDELETED, total - deleted > 0,
|
||||||
self.C_VIEW_SHOW_DOWNLOADED, downloaded + new > 0, \
|
self.C_VIEW_SHOW_DOWNLOADED, downloaded + new > 0,
|
||||||
self.C_VIEW_SHOW_UNPLAYED, unplayed + new > 0, \
|
self.C_VIEW_SHOW_UNPLAYED, unplayed + new > 0,
|
||||||
self.C_HAS_EPISODES, total > 0, \
|
self.C_HAS_EPISODES, total > 0,
|
||||||
self.C_DOWNLOADS, downloaded)
|
self.C_DOWNLOADS, downloaded)
|
||||||
|
|
||||||
def clear_cover_cache(self, podcast_url):
|
def clear_cover_cache(self, podcast_url):
|
||||||
|
|
|
@ -138,7 +138,7 @@ class PodcastEpisode(PodcastModelObject):
|
||||||
is_locked = property(fget=_deprecated, fset=_deprecated)
|
is_locked = property(fget=_deprecated, fset=_deprecated)
|
||||||
|
|
||||||
def has_website_link(self):
|
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))
|
youtube.is_video_link(self.link))
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
@ -336,7 +336,7 @@ class PodcastEpisode(PodcastModelObject):
|
||||||
self.save()
|
self.save()
|
||||||
|
|
||||||
def age_in_days(self):
|
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))
|
check_only=True))
|
||||||
|
|
||||||
age_int_prop = property(fget=age_in_days)
|
age_int_prop = property(fget=age_in_days)
|
||||||
|
@ -576,8 +576,8 @@ class PodcastEpisode(PodcastModelObject):
|
||||||
value is the canonical representation of this episode
|
value is the canonical representation of this episode
|
||||||
in playlists (for example, M3U playlists).
|
in playlists (for example, M3U playlists).
|
||||||
"""
|
"""
|
||||||
return '%s - %s (%s)' % (self.channel.title, \
|
return '%s - %s (%s)' % (self.channel.title,
|
||||||
self.title, \
|
self.title,
|
||||||
self.cute_pubdate())
|
self.cute_pubdate())
|
||||||
|
|
||||||
def cute_pubdate(self):
|
def cute_pubdate(self):
|
||||||
|
@ -616,8 +616,8 @@ class PodcastEpisode(PodcastModelObject):
|
||||||
current position is greater than 99 percent of the
|
current position is greater than 99 percent of the
|
||||||
total time or inside the last 10 seconds of a track.
|
total time or inside the last 10 seconds of a track.
|
||||||
"""
|
"""
|
||||||
return self.current_position > 0 and self.total_time > 0 and \
|
return self.current_position > 0 and self.total_time > 0 and
|
||||||
(self.current_position + 10 >= self.total_time or \
|
(self.current_position + 10 >= self.total_time or
|
||||||
self.current_position >= self.total_time * .99)
|
self.current_position >= self.total_time * .99)
|
||||||
|
|
||||||
def get_play_info_string(self, duration_only=False):
|
def get_play_info_string(self, duration_only=False):
|
||||||
|
@ -752,8 +752,8 @@ class PodcastChannel(PodcastModelObject):
|
||||||
|
|
||||||
known_files.add(filename)
|
known_files.add(filename)
|
||||||
|
|
||||||
existing_files = set(filename for filename in \
|
existing_files = set(filename for filename in
|
||||||
glob.glob(os.path.join(self.save_dir, '*')) \
|
glob.glob(os.path.join(self.save_dir, '*'))
|
||||||
if not filename.endswith('.partial'))
|
if not filename.endswith('.partial'))
|
||||||
|
|
||||||
ignore_files = ['folder' + ext for ext in
|
ignore_files = ['folder' + ext for ext in
|
||||||
|
@ -779,7 +779,7 @@ class PodcastChannel(PodcastModelObject):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
for episode in all_episodes:
|
for episode in all_episodes:
|
||||||
wanted_filename = episode.local_filename(create=True, \
|
wanted_filename = episode.local_filename(create=True,
|
||||||
return_wanted_filename=True)
|
return_wanted_filename=True)
|
||||||
if basename == wanted_filename:
|
if basename == wanted_filename:
|
||||||
logger.info('Importing external download: %s', filename)
|
logger.info('Importing external download: %s', filename)
|
||||||
|
|
|
@ -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
|
# 2013-02-08: We should update this to 1.7 once we use the new features
|
||||||
MYGPOCLIENT_REQUIRED = '1.4'
|
MYGPOCLIENT_REQUIRED = '1.4'
|
||||||
|
|
||||||
if not hasattr(mygpoclient, 'require_version') or \
|
if not hasattr(mygpoclient, 'require_version') or
|
||||||
not mygpoclient.require_version(MYGPOCLIENT_REQUIRED):
|
not mygpoclient.require_version(MYGPOCLIENT_REQUIRED):
|
||||||
print("""
|
print("""
|
||||||
Please upgrade your mygpoclient library.
|
Please upgrade your mygpoclient library.
|
||||||
|
@ -474,17 +474,17 @@ class MygPoClient(object):
|
||||||
def convert_to_api(action):
|
def convert_to_api(action):
|
||||||
dt = datetime.datetime.utcfromtimestamp(action.timestamp)
|
dt = datetime.datetime.utcfromtimestamp(action.timestamp)
|
||||||
action_ts = mygpoutil.datetime_to_iso8601(dt)
|
action_ts = mygpoutil.datetime_to_iso8601(dt)
|
||||||
return api.EpisodeAction(action.podcast_url, \
|
return api.EpisodeAction(action.podcast_url,
|
||||||
action.episode_url, action.action, \
|
action.episode_url, action.action,
|
||||||
action.device_id, action_ts, \
|
action.device_id, action_ts,
|
||||||
action.started, action.position, action.total)
|
action.started, action.position, action.total)
|
||||||
|
|
||||||
def convert_from_api(action):
|
def convert_from_api(action):
|
||||||
dt = mygpoutil.iso8601_to_datetime(action.timestamp)
|
dt = mygpoutil.iso8601_to_datetime(action.timestamp)
|
||||||
action_ts = calendar.timegm(dt.timetuple())
|
action_ts = calendar.timegm(dt.timetuple())
|
||||||
return ReceivedEpisodeAction(action.podcast, \
|
return ReceivedEpisodeAction(action.podcast,
|
||||||
action.episode, action.device, \
|
action.episode, action.device,
|
||||||
action.action, action_ts, \
|
action.action, action_ts,
|
||||||
action.started, action.position, action.total)
|
action.started, action.position, action.total)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -547,8 +547,8 @@ class MygPoClient(object):
|
||||||
logger.debug('Starting subscription sync.')
|
logger.debug('Starting subscription sync.')
|
||||||
try:
|
try:
|
||||||
# Load the "since" value from the database
|
# Load the "since" value from the database
|
||||||
since_o = self._store.get(SinceValue, host=self.host, \
|
since_o = self._store.get(SinceValue, host=self.host,
|
||||||
device_id=self.device_id, \
|
device_id=self.device_id,
|
||||||
category=SinceValue.PODCASTS)
|
category=SinceValue.PODCASTS)
|
||||||
|
|
||||||
# Use a default since object for the first-time case
|
# Use a default since object for the first-time case
|
||||||
|
@ -611,7 +611,7 @@ class MygPoClient(object):
|
||||||
def update_device(self, action):
|
def update_device(self, action):
|
||||||
try:
|
try:
|
||||||
logger.debug('Uploading device settings...')
|
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)
|
action.caption, action.device_type)
|
||||||
logger.debug('Device settings uploaded.')
|
logger.debug('Device settings uploaded.')
|
||||||
return True
|
return True
|
||||||
|
@ -646,8 +646,8 @@ class MygPoClient(object):
|
||||||
|
|
||||||
def get_download_user_subscriptions_url(self):
|
def get_download_user_subscriptions_url(self):
|
||||||
OPML_URL = self._client.locator.subscriptions_uri()
|
OPML_URL = self._client.locator.subscriptions_uri()
|
||||||
url = util.url_add_authentication(OPML_URL, \
|
url = util.url_add_authentication(OPML_URL,
|
||||||
self._config.mygpo.username, \
|
self._config.mygpo.username,
|
||||||
self._config.mygpo.password)
|
self._config.mygpo.password)
|
||||||
return url
|
return url
|
||||||
|
|
||||||
|
|
|
@ -66,15 +66,15 @@ class MediaPlayerDBusReceiver(object):
|
||||||
self.on_play_event = on_play_event
|
self.on_play_event = on_play_event
|
||||||
|
|
||||||
self.bus = gpodder.dbus_session_bus
|
self.bus = gpodder.dbus_session_bus
|
||||||
self.bus.add_signal_receiver(self.on_playback_started, \
|
self.bus.add_signal_receiver(self.on_playback_started,
|
||||||
self.SIGNAL_STARTED, \
|
self.SIGNAL_STARTED,
|
||||||
self.INTERFACE, \
|
self.INTERFACE,
|
||||||
None, \
|
None,
|
||||||
None)
|
None)
|
||||||
self.bus.add_signal_receiver(self.on_playback_stopped, \
|
self.bus.add_signal_receiver(self.on_playback_stopped,
|
||||||
self.SIGNAL_STOPPED, \
|
self.SIGNAL_STOPPED,
|
||||||
self.INTERFACE, \
|
self.INTERFACE,
|
||||||
None, \
|
None,
|
||||||
None)
|
None)
|
||||||
|
|
||||||
def on_playback_started(self, position, file_uri):
|
def on_playback_started(self, position, file_uri):
|
||||||
|
|
Loading…
Reference in New Issue