fix E225 missing whitespace around operator
This commit is contained in:
parent
9272a8a2d4
commit
2075ea8d5f
|
@ -30,15 +30,15 @@ logger = logging.getLogger(__name__)
|
|||
|
||||
class gPodderDevicePlaylist(object):
|
||||
def __init__(self, config, playlist_name):
|
||||
self._config=config
|
||||
self._config = config
|
||||
self.linebreak = '\r\n'
|
||||
self.playlist_file=util.sanitize_filename(playlist_name + '.m3u')
|
||||
self.playlist_file = util.sanitize_filename(playlist_name + '.m3u')
|
||||
self.playlist_folder = os.path.join(self._config.device_sync.device_folder, self._config.device_sync.playlists.folder)
|
||||
self.mountpoint = util.find_mount_point(self.playlist_folder)
|
||||
if self.mountpoint == '/':
|
||||
self.mountpoint = self.playlist_folder
|
||||
logger.warning('MP3 player resides on / - using %s as MP3 player root', self.mountpoint)
|
||||
self.playlist_absolute_filename=os.path.join(self.playlist_folder, self.playlist_file)
|
||||
self.playlist_absolute_filename = os.path.join(self.playlist_folder, self.playlist_file)
|
||||
|
||||
def build_extinf(self, filename):
|
||||
#TO DO: Windows playlists
|
||||
|
|
|
@ -325,8 +325,8 @@ class gPodderEpisodeSelector(BuilderWidget):
|
|||
if total_size > 0:
|
||||
text.append(_('size: %s') % util.format_filesize(total_size))
|
||||
self.labelTotalSize.set_text(', '.join(text))
|
||||
self.btnOK.set_sensitive(count>0)
|
||||
self.btnRemoveAction.set_sensitive(count>0)
|
||||
self.btnOK.set_sensitive(count > 0)
|
||||
self.btnRemoveAction.set_sensitive(count > 0)
|
||||
if count > 0:
|
||||
self.btnCancel.set_label(Gtk.STOCK_CANCEL)
|
||||
else:
|
||||
|
|
|
@ -581,12 +581,12 @@ class gPodderPreferences(BuilderWidget):
|
|||
|
||||
def on_checkbutton_create_playlists_toggled(self, widget,device_type_changed=False):
|
||||
if not widget.get_active():
|
||||
self._config.device_sync.playlists.create=False
|
||||
self._config.device_sync.playlists.create = False
|
||||
self.toggle_playlist_interface(False)
|
||||
#need to read value of checkbutton from interface,
|
||||
#rather than value of parameter
|
||||
else:
|
||||
self._config.device_sync.playlists.create=True
|
||||
self._config.device_sync.playlists.create = True
|
||||
self.toggle_playlist_interface(True)
|
||||
|
||||
def toggle_playlist_interface(self, enabled):
|
||||
|
|
|
@ -53,12 +53,12 @@ class gPodderSyncUI(object):
|
|||
self.show_confirmation = show_confirmation
|
||||
|
||||
self.show_preferences = show_preferences
|
||||
self.channels=channels
|
||||
self.channels = channels
|
||||
self.download_status_model = download_status_model
|
||||
self.download_queue_manager = download_queue_manager
|
||||
self.enable_download_list_update = enable_download_list_update
|
||||
self.commit_changes_to_database = commit_changes_to_database
|
||||
self.delete_episode_list=delete_episode_list
|
||||
self.delete_episode_list = delete_episode_list
|
||||
|
||||
def _filter_sync_episodes(self, channels, only_downloaded=False):
|
||||
"""Return a list of episodes for device synchronization
|
||||
|
@ -176,24 +176,24 @@ class gPodderSyncUI(object):
|
|||
self.commit_changes_to_database()
|
||||
for current_channel in self.channels:
|
||||
#only sync those channels marked for syncing
|
||||
if (self._config.device_sync.device_type=='filesystem' and current_channel.sync_to_mp3_player and self._config.device_sync.playlists.create):
|
||||
if (self._config.device_sync.device_type == 'filesystem' and current_channel.sync_to_mp3_player and self._config.device_sync.playlists.create):
|
||||
|
||||
#get playlist object
|
||||
playlist=gPodderDevicePlaylist(self._config,
|
||||
playlist = gPodderDevicePlaylist(self._config,
|
||||
current_channel.title)
|
||||
#need to refresh episode list so that
|
||||
#deleted episodes aren't included in playlists
|
||||
episodes_for_playlist=sorted(current_channel.get_episodes(gpodder.STATE_DOWNLOADED),
|
||||
episodes_for_playlist = sorted(current_channel.get_episodes(gpodder.STATE_DOWNLOADED),
|
||||
key=lambda ep: ep.published)
|
||||
#don't add played episodes to playlist if skip_played_episodes is True
|
||||
if self._config.device_sync.skip_played_episodes:
|
||||
episodes_for_playlist=[ep for ep in episodes_for_playlist if ep.is_new]
|
||||
episodes_for_playlist = [ep for ep in episodes_for_playlist if ep.is_new]
|
||||
playlist.write_m3u(episodes_for_playlist)
|
||||
|
||||
#enable updating of UI
|
||||
self.enable_download_list_update()
|
||||
|
||||
if (self._config.device_sync.device_type=='filesystem' and self._config.device_sync.playlists.create):
|
||||
if (self._config.device_sync.device_type == 'filesystem' and self._config.device_sync.playlists.create):
|
||||
title = _('Update successful')
|
||||
message = _('The playlist on your MP3 player has been updated.')
|
||||
self.notification(message, title)
|
||||
|
@ -208,20 +208,20 @@ class gPodderSyncUI(object):
|
|||
|
||||
if self._config.device_sync.playlists.create:
|
||||
try:
|
||||
episodes_to_delete=[]
|
||||
episodes_to_delete = []
|
||||
if self._config.device_sync.playlists.two_way_sync:
|
||||
for current_channel in self.channels:
|
||||
#only include channels that are included in the sync
|
||||
if current_channel.sync_to_mp3_player:
|
||||
#get playlist object
|
||||
playlist=gPodderDevicePlaylist(self._config, current_channel.title)
|
||||
playlist = gPodderDevicePlaylist(self._config, current_channel.title)
|
||||
#get episodes to be written to playlist
|
||||
episodes_for_playlist=sorted(current_channel.get_episodes(gpodder.STATE_DOWNLOADED),
|
||||
key=lambda ep: ep.published)
|
||||
episode_keys=list(map(playlist.get_absolute_filename_for_playlist,
|
||||
episodes_for_playlist))
|
||||
episodes_for_playlist = sorted(current_channel.get_episodes(gpodder.STATE_DOWNLOADED),
|
||||
key=lambda ep: ep.published)
|
||||
episode_keys = list(map(playlist.get_absolute_filename_for_playlist,
|
||||
episodes_for_playlist))
|
||||
|
||||
episode_dict=dict(list(zip(episode_keys, episodes_for_playlist)))
|
||||
episode_dict = dict(list(zip(episode_keys, episodes_for_playlist)))
|
||||
|
||||
#then get episodes in playlist (if it exists) already on device
|
||||
episodes_in_playlists = playlist.read_m3u()
|
||||
|
|
|
@ -347,7 +347,7 @@ def progressbar_pixbuf(width, height, percentage):
|
|||
ctx.fill()
|
||||
|
||||
# Border
|
||||
ctx.rectangle(padding- .5, padding - .5, bar_width + 1, bar_height + 1)
|
||||
ctx.rectangle(padding - .5, padding - .5, bar_width + 1, bar_height + 1)
|
||||
ctx.set_source_rgba(* COLOR_BORDER)
|
||||
ctx.set_line_width(1.)
|
||||
ctx.stroke()
|
||||
|
|
|
@ -1082,7 +1082,7 @@ class gPodder(BuilderWidget, dbus.service.Object):
|
|||
return False
|
||||
|
||||
width = treeview.get_allocated_width()
|
||||
height= treeview.get_allocated_height()
|
||||
height = treeview.get_allocated_height()
|
||||
|
||||
if role == TreeViewHelper.ROLE_EPISODES:
|
||||
if self.config.episode_list_view_mode != EpisodeListModel.VIEW_ALL:
|
||||
|
@ -1243,7 +1243,7 @@ class gPodder(BuilderWidget, dbus.service.Object):
|
|||
title.append(N_('synchronizing %(count)d file', 'synchronizing %(count)d files', synchronizing) % {'count':synchronizing})
|
||||
if queued > 0:
|
||||
title.append(N_('%(queued)d task queued', '%(queued)d tasks queued', queued) % {'queued':queued})
|
||||
if (downloading + synchronizing + queued)==0:
|
||||
if (downloading + synchronizing + queued) == 0:
|
||||
self.set_download_progress(1.)
|
||||
self.downloads_finished(self.download_tasks_seen)
|
||||
gpodder.user_extensions.on_all_episodes_downloaded()
|
||||
|
|
|
@ -86,7 +86,7 @@ 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')+ \
|
||||
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)), \
|
||||
|
|
|
@ -72,7 +72,7 @@ from mygpoclient import public
|
|||
|
||||
from mygpoclient import util as mygpoutil
|
||||
|
||||
EPISODE_ACTIONS_BATCH_SIZE=100
|
||||
EPISODE_ACTIONS_BATCH_SIZE = 100
|
||||
|
||||
|
||||
# Database model classes
|
||||
|
|
|
@ -224,10 +224,10 @@ class Device(services.ObservableService):
|
|||
return False
|
||||
|
||||
# XXX: need to check if track is added properly?
|
||||
sync_task=SyncTask(track)
|
||||
sync_task = SyncTask(track)
|
||||
|
||||
sync_task.status=sync_task.QUEUED
|
||||
sync_task.device=self
|
||||
sync_task.status = sync_task.QUEUED
|
||||
sync_task.device = self
|
||||
# New Task, we must wait on the GTK Loop
|
||||
self.download_status_model.register_task(sync_task)
|
||||
# Executes after task has been registered
|
||||
|
@ -415,7 +415,7 @@ class iPodDevice(Device):
|
|||
def add_track(self, episode,reporthook=None):
|
||||
self.notify('status', _('Adding %s') % episode.title)
|
||||
tracklist = gpod.sw_get_playlist_tracks(self.podcasts_playlist)
|
||||
podcasturls=[track.podcasturl for track in tracklist]
|
||||
podcasturls = [track.podcasturl for track in tracklist]
|
||||
|
||||
if episode.url in podcasturls:
|
||||
# Mark as played on iPod if played locally (and set podcast flags)
|
||||
|
@ -431,7 +431,7 @@ class iPodDevice(Device):
|
|||
if util.calculate_size(original_filename) > self.get_free_space():
|
||||
logger.error('Not enough space on %s, sync aborted...', self.mountpoint)
|
||||
d = {'episode': episode.title, 'mountpoint': self.mountpoint}
|
||||
message =_('Error copying %(episode)s: Not enough free space on %(mountpoint)s')
|
||||
message = _('Error copying %(episode)s: Not enough free space on %(mountpoint)s')
|
||||
self.errors.append(message % d)
|
||||
self.cancelled = True
|
||||
return False
|
||||
|
@ -577,7 +577,7 @@ class MP3PlayerDevice(Device):
|
|||
logger.warn('Cannot determine free disk space on device')
|
||||
elif needed > free:
|
||||
d = {'path': self.destination, 'free': util.format_filesize(free), 'need': util.format_filesize(needed)}
|
||||
message =_('Not enough space in %(path)s: %(free)s available, but need at least %(need)s')
|
||||
message = _('Not enough space in %(path)s: %(free)s available, but need at least %(need)s')
|
||||
raise SyncFailedException(message % d)
|
||||
|
||||
# get the filename that will be used on the device
|
||||
|
@ -744,10 +744,10 @@ class MTPDevice(Device):
|
|||
mtp = mtp.replace(" ", "0") # replace blank with 0 to fix some invalid string
|
||||
d = time.strptime(mtp[:8] + mtp[9:13],"%Y%m%d%H%M%S")
|
||||
_date = calendar.timegm(d)
|
||||
if len(mtp)==20:
|
||||
if len(mtp) == 20:
|
||||
# TIME ZONE SHIFTING: the string contains a hour/min shift relative to a time zone
|
||||
try:
|
||||
shift_direction=mtp[15]
|
||||
shift_direction = mtp[15]
|
||||
hour_shift = int(mtp[16:18])
|
||||
minute_shift = int(mtp[18:20])
|
||||
shift_in_sec = hour_shift * 3600 + minute_shift * 60
|
||||
|
@ -895,7 +895,7 @@ class MTPDevice(Device):
|
|||
tracks = []
|
||||
for track in listing:
|
||||
title = track.title
|
||||
if not title or title=="": title=track.filename
|
||||
if not title or title == "": title = track.filename
|
||||
if len(title) > 50: title = title[0:49] + '...'
|
||||
artist = track.artist
|
||||
if artist and len(artist) > 50: artist = artist[0:49] + '...'
|
||||
|
|
|
@ -1394,7 +1394,7 @@ def format_seconds_to_hour_min_sec(seconds):
|
|||
result.append(N_('%(count)d second', '%(count)d seconds', seconds) % {'count':seconds})
|
||||
|
||||
if len(result) > 1:
|
||||
return (' ' +_('and') + ' ').join((', '.join(result[:-1]), result[-1]))
|
||||
return (' ' + _('and') + ' ').join((', '.join(result[:-1]), result[-1]))
|
||||
else:
|
||||
return result[0]
|
||||
|
||||
|
|
Loading…
Reference in New Issue