PEP-8 fixes
This commit is contained in:
parent
7a1c0c6173
commit
1fb4c0df40
2 changed files with 10 additions and 10 deletions
18
main.py
18
main.py
|
@ -40,6 +40,7 @@ import datetime
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def run_in_background_thread(f):
|
def run_in_background_thread(f):
|
||||||
"""Decorator for functions that take longer to finish
|
"""Decorator for functions that take longer to finish
|
||||||
|
|
||||||
|
@ -142,8 +143,7 @@ class gPotherSide:
|
||||||
|
|
||||||
def _get_podcasts_sorted(self):
|
def _get_podcasts_sorted(self):
|
||||||
sort_key = self.core.model.podcast_sort_key
|
sort_key = self.core.model.podcast_sort_key
|
||||||
return sorted(self.core.model.get_podcasts(),
|
return sorted(self.core.model.get_podcasts(), key=lambda podcast: (podcast.section, sort_key(podcast)))
|
||||||
key=lambda podcast: (podcast.section, sort_key(podcast)))
|
|
||||||
|
|
||||||
def load_podcasts(self):
|
def load_podcasts(self):
|
||||||
podcasts = self._get_podcasts_sorted()
|
podcasts = self._get_podcasts_sorted()
|
||||||
|
@ -319,8 +319,7 @@ class gPotherSide:
|
||||||
try:
|
try:
|
||||||
podcast.update()
|
podcast.update()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.warn('Could not update %s: %s', podcast.url,
|
logger.warn('Could not update %s: %s', podcast.url, e, exc_info=True)
|
||||||
e, exc_info=True)
|
|
||||||
pyotherside.send('updated-podcast', self.convert_podcast(podcast))
|
pyotherside.send('updated-podcast', self.convert_podcast(podcast))
|
||||||
pyotherside.send('update-stats')
|
pyotherside.send('update-stats')
|
||||||
|
|
||||||
|
@ -336,9 +335,7 @@ class gPotherSide:
|
||||||
return {
|
return {
|
||||||
'title': episode.title,
|
'title': episode.title,
|
||||||
'podcast_title': episode.podcast.title,
|
'podcast_title': episode.podcast.title,
|
||||||
'source': episode.local_filename(False)
|
'source': episode.local_filename(False) if episode.state == gpodder.STATE_DOWNLOADED else episode.url,
|
||||||
if episode.state == gpodder.STATE_DOWNLOADED
|
|
||||||
else episode.url,
|
|
||||||
'position': episode.current_position,
|
'position': episode.current_position,
|
||||||
'total': episode.total_time,
|
'total': episode.total_time,
|
||||||
'video': episode.file_type() == 'video',
|
'video': episode.file_type() == 'video',
|
||||||
|
@ -372,7 +369,9 @@ class gPotherSide:
|
||||||
yield '%.2f MiB' % (episode.file_size / (1024 * 1024))
|
yield '%.2f MiB' % (episode.file_size / (1024 * 1024))
|
||||||
|
|
||||||
if episode.total_time > 0:
|
if episode.total_time > 0:
|
||||||
yield '%02d:%02d:%02d' % (episode.total_time / (60 * 60), (episode.total_time / 60) % 60, episode.total_time % 60)
|
yield '%02d:%02d:%02d' % (episode.total_time / (60 * 60),
|
||||||
|
(episode.total_time / 60) % 60,
|
||||||
|
episode.total_time % 60)
|
||||||
|
|
||||||
def show_podcast(self, podcast_id):
|
def show_podcast(self, podcast_id):
|
||||||
podcast = self._get_podcast_by_id(podcast_id)
|
podcast = self._get_podcast_by_id(podcast_id)
|
||||||
|
@ -404,8 +403,7 @@ class gPotherSide:
|
||||||
return [{
|
return [{
|
||||||
'label': provider.name,
|
'label': provider.name,
|
||||||
'can_search': provider.kind == provider.PROVIDER_SEARCH
|
'can_search': provider.kind == provider.PROVIDER_SEARCH
|
||||||
} for provider in sorted(registry.directory.select(select_provider),
|
} for provider in sorted(registry.directory.select(select_provider), key=provider_sort_key, reverse=True)]
|
||||||
key=provider_sort_key, reverse=True)]
|
|
||||||
|
|
||||||
def get_directory_entries(self, provider, query):
|
def get_directory_entries(self, provider, query):
|
||||||
def match_provider(p):
|
def match_provider(p):
|
||||||
|
|
2
setup.cfg
Normal file
2
setup.cfg
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
[pep8]
|
||||||
|
max-line-length = 120
|
Loading…
Add table
Add a link
Reference in a new issue