Skip to content

Commit

Permalink
more pep8
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelveldt committed Nov 20, 2016
1 parent e4abc78 commit 7c326cd
Show file tree
Hide file tree
Showing 10 changed files with 40 additions and 23 deletions.
12 changes: 9 additions & 3 deletions lib/artutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from helpers.studiologos import StudioLogos
from helpers.musicartwork import MusicArtwork
from helpers.utils import log_msg, get_duration, ADDON_ID
from helpers.utils import extend_dict, get_clean_image, detect_plugin_content
from helpers.utils import extend_dict, get_clean_image
from simplecache import use_cache, SimpleCache
from thetvdb import TheTvDb
import xbmcaddon
Expand Down Expand Up @@ -271,7 +271,13 @@ def translate_string(self, _str):
return translation


def process_method_on_list(method_to_run, items):
def process_method_on_list(*args, **kwargs):
'''expose our process_method_on_list method to public'''
from helpers.utils import process_method_on_list as _process_method_on_list
return _process_method_on_list(method_to_run, items)
return _process_method_on_list(*args, **kwargs)


def detect_plugin_content(method_to_run, items):
'''expose our detect_plugin_content method to public'''
from helpers.utils import detect_plugin_content as _detect_plugin_content
return _detect_plugin_content(method_to_run, items)
11 changes: 5 additions & 6 deletions lib/helpers/animatedart.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@
'''Retrieve animated artwork for kodi movies'''

from utils import get_json, DialogSelect
from kodidb import KodiDb
import xbmc
import xbmcvfs
import xbmcgui
from simplecache import SimpleCache, use_cache
from simplecache import use_cache


class AnimatedArt(object):
Expand Down Expand Up @@ -112,10 +111,10 @@ def select_art(items, manual_select=False, art_type=""):
listitem = xbmcgui.ListItem(label=label, iconImage=item["thumb"])
results_list.append(listitem)
if manual_select and results_list:
w = DialogSelect("DialogSelect.xml", "", listing=results_list, window_title=art_type)
w.doModal()
selected_item = w.result
del w
dialog = DialogSelect("DialogSelect.xml", "", listing=results_list, window_title=art_type)
dialog.doModal()
selected_item = dialog.result
del dialog
if selected_item == 1:
# browse for image
dialog = xbmcgui.Dialog()
Expand Down
1 change: 1 addition & 0 deletions lib/helpers/channellogos.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def get_channellogo(self, channelname):
return result

def search_logosdb(self, searchphrase):
'''search logo on thelogosdb'''
result = ""
for searchphrase in [searchphrase, searchphrase.lower().replace(" hd", "")]:
if result:
Expand Down
10 changes: 5 additions & 5 deletions lib/helpers/google.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ def search_image(self, search_query, manual_select=False):
listitem = xbmcgui.ListItem(label=img, iconImage=img)
images_list.append(listitem)
if manual_select and images_list:
w = DialogSelect("DialogSelect.xml", "", listing=images_list, window_title="%s - Google"
% xbmc.getLocalizedString(283))
w.doModal()
selected_item = w.result
del w
dialog = DialogSelect("DialogSelect.xml", "", listing=images_list, window_title="%s - Google"
% xbmc.getLocalizedString(283))
dialog.doModal()
selected_item = dialog.result
del dialog
if selected_item != -1:
selected_item = images_list[selected_item]
image = selected_item.getLabel()
Expand Down
7 changes: 7 additions & 0 deletions lib/helpers/imdb.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-

'''
script.module.skin.helper.artutils
imdb.py
Get metadata from imdb
'''

from utils import requests, try_parse_int
import BeautifulSoup
from simplecache import use_cache
Expand Down
6 changes: 6 additions & 0 deletions lib/helpers/kodi_constants.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-

'''
script.module.skin.helper.artutils
kodi_constants.py
Several common constants for use with Kodi json api
'''

FIELDS_BASE = ["dateadded", "file", "lastplayed","plot", "title", "art", "playcount"]
FIELDS_FILE = FIELDS_BASE + ["streamdetails", "director", "resume", "runtime"]
FIELDS_MOVIES = FIELDS_FILE + ["plotoutline", "sorttitle", "cast", "votes", "showlink", "top250", "trailer", "year",
Expand Down
5 changes: 2 additions & 3 deletions lib/helpers/musicartwork.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
'''

from utils import log_msg, extend_dict, get_clean_image, ADDON_ID, DialogSelect, strip_newlines
from simplecache import use_cache
from mbrainz import MusicBrainz
from lastfm import LastFM
from theaudiodb import TheAudioDb
Expand Down Expand Up @@ -164,7 +163,7 @@ def get_artist_metadata(self, artist, album, track, ignore_cache=False):
local_path = ""
local_path_custom = ""
# get metadata from kodi db
extend_dict(details, self.get_artist_kodi_metadata(artist, album))
extend_dict(details, self.get_artist_kodi_metadata(artist))
# get artwork from songlevel path
if details.get("diskpath") and self.artutils.addon.getSetting("music_art_musicfolders") == "true":
extend_dict(details["art"], self.lookup_artistart_in_folder(details["diskpath"]))
Expand Down Expand Up @@ -263,7 +262,7 @@ def get_album_metadata(self, artist, album, track, disc, ignore_cache=False):
self.artutils.cache.set(cache_str, details)
return details

def get_artist_kodi_metadata(self, artist, album):
def get_artist_kodi_metadata(self, artist):
'''get artist details from the kodi database'''
details = {}
filters = [{"operator": "is", "field": "artist", "value": artist}]
Expand Down
8 changes: 4 additions & 4 deletions lib/helpers/pvrartwork.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,11 +185,11 @@ def manual_set_pvr_artwork(self, title, channel, genre):
listitem = xbmcgui.ListItem(label=arttype, iconImage=artwork["art"].get(arttype, ""))
listitem.setProperty("icon", artwork["art"].get(arttype, ""))
listitems.append(listitem)
w = DialogSelect("DialogSelect.xml", "", listing=listitems,
dialog = DialogSelect("DialogSelect.xml", "", listing=listitems,
windowtitle=xbmc.getLocalizedString(13511), multiselect=False)
w.doModal()
selected_item = w.result
del w
dialog.doModal()
selected_item = dialog.result
del dialog
if selected_item == -1:
abort = True
else:
Expand Down
1 change: 0 additions & 1 deletion lib/helpers/studiologos.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

'''Helper for studio logo images'''

import xbmc
import xbmcvfs
import os
from datetime import timedelta
Expand Down
2 changes: 1 addition & 1 deletion lib/helpers/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
from requests.adapters import HTTPAdapter
import urllib
import unicodedata
import re

try:
import simplejson as json
Expand Down Expand Up @@ -96,6 +95,7 @@ def urlencode(text):


def formatted_number(number):
'''try to format a number to formatted string with thousands'''
try:
number = int(number)
if number < 0:
Expand Down

0 comments on commit 7c326cd

Please sign in to comment.