[neteasemusic] PEP8

This commit is contained in:
Yen Chi Hsuan 2015-07-10 18:30:23 +08:00
parent b29280285e
commit 15830339ef

View file

@ -52,7 +52,7 @@ def extract_formats(cls, info):
@classmethod @classmethod
def convert_milliseconds(cls, ms): def convert_milliseconds(cls, ms):
return int(round(ms/1000.0)) return int(round(ms / 1000.0))
def query_api(self, endpoint, video_id, note): def query_api(self, endpoint, video_id, note):
req = compat_urllib_request.Request('%s%s' % (self._API_BASE, endpoint)) req = compat_urllib_request.Request('%s%s' % (self._API_BASE, endpoint))
@ -146,7 +146,7 @@ def _real_extract(self, url):
self._sort_formats(formats) self._sort_formats(formats)
lyrics_info = self.query_api( lyrics_info = self.query_api(
'song/lyric?id=%s&lv=-1&tv=-1' % song_id, 'song/lyric?id=%s&lv=-1&tv=-1' % song_id,
song_id, 'Downloading lyrics data') song_id, 'Downloading lyrics data')
lyrics = self._process_lyrics(lyrics_info) lyrics = self._process_lyrics(lyrics_info)
@ -183,7 +183,7 @@ def _real_extract(self, url):
album_id = self._match_id(url) album_id = self._match_id(url)
info = self.query_api( info = self.query_api(
'album/%s?id=%s' % (album_id, album_id), 'album/%s?id=%s' % (album_id, album_id),
album_id, 'Downloading album data')['album'] album_id, 'Downloading album data')['album']
name = info['name'] name = info['name']
@ -221,7 +221,7 @@ def _real_extract(self, url):
singer_id = self._match_id(url) singer_id = self._match_id(url)
info = self.query_api( info = self.query_api(
'artist/%s?id=%s' % (singer_id, singer_id), 'artist/%s?id=%s' % (singer_id, singer_id),
singer_id, 'Downloading singer data') singer_id, 'Downloading singer data')
name = info['artist']['name'] name = info['artist']['name']
@ -264,7 +264,7 @@ def _real_extract(self, url):
list_id = self._match_id(url) list_id = self._match_id(url)
info = self.query_api( info = self.query_api(
'playlist/detail?id=%s&lv=-1&tv=-1' % list_id, 'playlist/detail?id=%s&lv=-1&tv=-1' % list_id,
list_id, 'Downloading playlist data')['result'] list_id, 'Downloading playlist data')['result']
name = info['name'] name = info['name']
@ -378,7 +378,7 @@ def _real_extract(self, url):
self.to_screen( self.to_screen(
'Downloading just the main audio %s because of --no-playlist' 'Downloading just the main audio %s because of --no-playlist'
% info['mainSong']['id']) % info['mainSong']['id'])
formats = self.extract_formats(info['mainSong']) formats = self.extract_formats(info['mainSong'])
self._sort_formats(formats) self._sort_formats(formats)
@ -429,7 +429,7 @@ def _real_extract(self, url):
entries = [] entries = []
for offset in itertools.count(start=0, step=self._PAGE_SIZE): for offset in itertools.count(start=0, step=self._PAGE_SIZE):
info = self.query_api( info = self.query_api(
'dj/program/byradio?asc=false&limit=%d&radioId=%s&offset=%d' 'dj/program/byradio?asc=false&limit=%d&radioId=%s&offset=%d'
% (self._PAGE_SIZE, dj_id, offset), % (self._PAGE_SIZE, dj_id, offset),
dj_id, 'Downloading dj programs - %d' % offset) dj_id, 'Downloading dj programs - %d' % offset)