From 6d61a83b54e696b36336bc53454dfe877084b141 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Odd=20Str=C3=A5b=C3=B8?= Date: Sun, 27 Sep 2020 03:47:38 +0200 Subject: [PATCH 1/2] Flake8 linting --- jellyfin_kodi/downloader.py | 1 + jellyfin_kodi/helper/loghandler.py | 1 - jellyfin_kodi/objects/music.py | 3 +-- jellyfin_kodi/objects/tvshows.py | 4 ++-- jellyfin_kodi/views.py | 1 - tests/test_helper_utils.py | 3 +++ 6 files changed, 7 insertions(+), 6 deletions(-) diff --git a/jellyfin_kodi/downloader.py b/jellyfin_kodi/downloader.py index bf2a07d6..0dd37da9 100644 --- a/jellyfin_kodi/downloader.py +++ b/jellyfin_kodi/downloader.py @@ -183,6 +183,7 @@ def get_item_count(parent_id, item_type=None, params=None): return result.get('TotalRecordCount', 1) + def get_items(parent_id, item_type=None, basic=False, params=None): query = { diff --git a/jellyfin_kodi/helper/loghandler.py b/jellyfin_kodi/helper/loghandler.py index 5962cdc9..f8341102 100644 --- a/jellyfin_kodi/helper/loghandler.py +++ b/jellyfin_kodi/helper/loghandler.py @@ -69,7 +69,6 @@ class LogHandler(logging.StreamHandler): xbmc.log(string, level=self.level) - @classmethod def _get_log_level(cls, level): diff --git a/jellyfin_kodi/objects/music.py b/jellyfin_kodi/objects/music.py index 704e7ad6..7cf9e15b 100644 --- a/jellyfin_kodi/objects/music.py +++ b/jellyfin_kodi/objects/music.py @@ -437,8 +437,7 @@ class Music(KodiDb): ''' This updates: Favorite, LastPlayedDate, Playcount, PlaybackPositionTicks Poster with progress bar ''' - server_address = self.server.auth.get_server_info(self.server.auth.server_id)['address'] - API = api.API(item, server_address) + obj = self.objects.map(item, 'SongUserData') try: diff --git a/jellyfin_kodi/objects/tvshows.py b/jellyfin_kodi/objects/tvshows.py index fc04229f..3da519a1 100644 --- a/jellyfin_kodi/objects/tvshows.py +++ b/jellyfin_kodi/objects/tvshows.py @@ -410,7 +410,7 @@ class TVShows(KodiDb): raise PathValidationException("Failed to validate path. User stopped.") obj['Path'] = obj['Path'].replace(obj['Filename'], "") - + '''check dvd directries and point it to ./VIDEO_TS/VIDEO_TS.IFO''' if validate_dvd_dir(obj['Path'] + obj['Filename']): obj['Path'] = obj['Path'] + obj['Filename'] + '/VIDEO_TS/' @@ -422,7 +422,7 @@ class TVShows(KodiDb): obj['Path'] = obj['Path'] + obj['Filename'] + '/BDMV/' obj['Filename'] = 'index.bdmv' LOG.debug("Bluray directry %s", obj['Path']) - + else: obj['Path'] = "plugin://plugin.video.jellyfin/%s/" % obj['SeriesId'] params = { diff --git a/jellyfin_kodi/views.py b/jellyfin_kodi/views.py index 0c036867..186c5729 100644 --- a/jellyfin_kodi/views.py +++ b/jellyfin_kodi/views.py @@ -4,7 +4,6 @@ from __future__ import division, absolute_import, print_function, unicode_litera ################################################################################################# import os -import shutil import xml.etree.ElementTree as etree from six.moves.urllib.parse import urlencode diff --git a/tests/test_helper_utils.py b/tests/test_helper_utils.py index 366ea5a9..2be266ea 100644 --- a/tests/test_helper_utils.py +++ b/tests/test_helper_utils.py @@ -1,3 +1,6 @@ +# -*- coding: utf-8 -*- +from __future__ import division, absolute_import, print_function, unicode_literals + import sys import pytest From 770ca74a07e70b46583f9bf33cc3106e58365619 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Odd=20Str=C3=A5b=C3=B8?= Date: Sun, 27 Sep 2020 05:40:30 +0200 Subject: [PATCH 2/2] Don't use f-strings (yet) --- .config/generate_xml.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.config/generate_xml.py b/.config/generate_xml.py index da4ae367..a854960b 100644 --- a/.config/generate_xml.py +++ b/.config/generate_xml.py @@ -35,12 +35,12 @@ except IndexError: dir_path = os.path.dirname(os.path.realpath(__file__)) # Load template file -with open(f'{dir_path}/template.xml', 'r') as f: +with open('{dir_path}/template.xml'.format(**locals()), 'r') as f: tree = ET.parse(f) root = tree.getroot() # Load version dependencies -with open(f'{dir_path}/{py_version}.yaml', 'r') as f: +with open('{dir_path}/{py_version}.yaml'.format(**locals()), 'r') as f: deps = yaml.safe_load(f) # Load version and changelog @@ -53,7 +53,7 @@ for dep in deps: # Update version string addon_version = data.get('version') -root.attrib['version'] = f'{addon_version}+{py_version}' +root.attrib['version'] = '{addon_version}+{py_version}'.format(**locals()) # Changelog date = datetime.today().strftime('%Y-%m-%d') @@ -61,7 +61,7 @@ changelog = data.get('changelog') for section in root.findall('extension'): news = section.findall('news') if news: - news[0].text = f'v{addon_version} ({date}):\n{changelog}' + news[0].text = 'v{addon_version} ({date}):\n{changelog}'.format(**locals()) # Format xml tree indent(root)