Fix switching to __future__ module

- Fixes #507
This commit is contained in:
croneter 2018-07-12 18:46:02 +02:00
parent 141234c8b8
commit 4e0429fcc9
52 changed files with 126 additions and 50 deletions

View file

@ -1,6 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import absolute_import, division, unicode_literals
###############################################################################
from logging import getLogger from logging import getLogger
from Queue import Queue, Empty from Queue import Queue, Empty
from urllib import quote_plus, unquote from urllib import quote_plus, unquote

View file

@ -1,6 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import absolute_import, division, unicode_literals
###############################################################################
from logging import getLogger from logging import getLogger
from . import utils from . import utils

View file

@ -1,5 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
############################################################################### from __future__ import absolute_import, division, unicode_literals
import logging import logging
from threading import Thread from threading import Thread
from xbmc import sleep from xbmc import sleep

View file

@ -1,6 +1,9 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" """
Processes Plex companion inputs from the plexbmchelper to Kodi commands Processes Plex companion inputs from the plexbmchelper to Kodi commands
""" """
from __future__ import absolute_import, division, unicode_literals
from logging import getLogger from logging import getLogger
from xbmc import Player from xbmc import Player

View file

@ -1,5 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
############################################################################### from __future__ import absolute_import, division, unicode_literals
from logging import getLogger from logging import getLogger
import xbmcgui import xbmcgui

View file

@ -1,5 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
############################################################################### from __future__ import absolute_import, division, unicode_literals
from logging import getLogger from logging import getLogger
import xbmc import xbmc
import xbmcgui import xbmcgui

View file

@ -1,6 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import absolute_import, division, unicode_literals
###############################################################################
from logging import getLogger from logging import getLogger
import xml.etree.ElementTree as etree import xml.etree.ElementTree as etree
import requests import requests

View file

@ -1,9 +1,10 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# """
# Loads of different functions called in SEPARATE Python instances through Loads of different functions called in SEPARATE Python instances through
# e.g. plugin://... calls. Hence be careful to only rely on window variables. e.g. plugin://... calls. Hence be careful to only rely on window variables.
# """
############################################################################### from __future__ import absolute_import, division, unicode_literals
from logging import getLogger from logging import getLogger
from sys import argv from sys import argv
from urllib import urlencode from urllib import urlencode

View file

@ -1,5 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
############################################################################### from __future__ import absolute_import, division, unicode_literals
from logging import getLogger from logging import getLogger
from Queue import Queue from Queue import Queue
import xml.etree.ElementTree as etree import xml.etree.ElementTree as etree

View file

@ -1,5 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
############################################################################### from __future__ import absolute_import, division, unicode_literals
from logging import getLogger from logging import getLogger
from ntpath import dirname from ntpath import dirname
from datetime import datetime from datetime import datetime

View file

@ -1,7 +1,10 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" """
Collection of functions using the Kodi JSON RPC interface. Collection of functions using the Kodi JSON RPC interface.
See http://kodi.wiki/view/JSON-RPC_API See http://kodi.wiki/view/JSON-RPC_API
""" """
from __future__ import absolute_import, division, unicode_literals
from json import loads, dumps from json import loads, dumps
from xbmc import executeJSONRPC from xbmc import executeJSONRPC

View file

@ -1,8 +1,9 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# """
# Connect to the Kodi databases (video and music) and operate on them Connect to the Kodi databases (video and music) and operate on them
# """
############################################################################### from __future__ import absolute_import, division, unicode_literals
from logging import getLogger from logging import getLogger
from ntpath import dirname from ntpath import dirname
from sqlite3 import IntegrityError from sqlite3 import IntegrityError

View file

@ -1,6 +1,9 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" """
PKC Kodi Monitoring implementation PKC Kodi Monitoring implementation
""" """
from __future__ import absolute_import, division, unicode_literals
from logging import getLogger from logging import getLogger
from json import loads from json import loads
from threading import Thread from threading import Thread

View file

@ -1,4 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import absolute_import, division, unicode_literals
from logging import getLogger from logging import getLogger
from threading import Thread from threading import Thread
from Queue import Empty from Queue import Empty

View file

@ -1,4 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import absolute_import, division, unicode_literals
from logging import getLogger from logging import getLogger
from threading import Thread from threading import Thread
from Queue import Empty from Queue import Empty

View file

@ -1,4 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import absolute_import, division, unicode_literals
from logging import getLogger from logging import getLogger
from threading import Thread from threading import Thread
from Queue import Empty from Queue import Empty

View file

@ -1,4 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import absolute_import, division, unicode_literals
from logging import getLogger from logging import getLogger
from threading import Thread, Lock from threading import Thread, Lock
from xbmc import sleep from xbmc import sleep

View file

@ -1,5 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
############################################################################### from __future__ import absolute_import, division, unicode_literals
from logging import getLogger from logging import getLogger
from threading import Thread from threading import Thread
import Queue import Queue

View file

@ -1,5 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
############################################################################### from __future__ import absolute_import, division, unicode_literals
import logging import logging
import xbmc import xbmc
############################################################################### ###############################################################################

View file

@ -1,3 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, unicode_literals
from logging import getLogger from logging import getLogger
from . import variables as v from . import variables as v

View file

@ -1,4 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import absolute_import, division, unicode_literals
from logging import getLogger from logging import getLogger
from xml.etree.ElementTree import ParseError from xml.etree.ElementTree import ParseError

View file

@ -1,12 +1,16 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# File and Path operations """
# File and Path operations
# Kodi xbmc*.*() functions usually take utf-8 encoded commands, thus try_encode
# works. Kodi xbmc*.*() functions usually take utf-8 encoded commands, thus try_encode
# Unfortunatly, working with filenames and paths seems to require an encoding in works.
# the OS' getfilesystemencoding - it will NOT always work with unicode paths. Unfortunatly, working with filenames and paths seems to require an encoding in
# However, sys.getfilesystemencoding might return None. the OS' getfilesystemencoding - it will NOT always work with unicode paths.
# Feed unicode to all the functions below and you're fine. However, sys.getfilesystemencoding might return None.
Feed unicode to all the functions below and you're fine.
"""
from __future__ import absolute_import, division, unicode_literals
import shutil import shutil
import os import os
from os import path # allows to use path_ops.path.join, for example from os import path # allows to use path_ops.path.join, for example

View file

@ -1,5 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
############################################################################### from __future__ import absolute_import, division, unicode_literals
from cPickle import dumps, loads from cPickle import dumps, loads
from xbmcgui import Window from xbmcgui import Window
from xbmc import log, LOGDEBUG from xbmc import log, LOGDEBUG

View file

@ -1,5 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
############################################################################### from __future__ import absolute_import, division, unicode_literals
from xbmcgui import ListItem from xbmcgui import ListItem

View file

@ -1,6 +1,9 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" """
Used to kick off Kodi playback Used to kick off Kodi playback
""" """
from __future__ import absolute_import, division, unicode_literals
from logging import getLogger from logging import getLogger
from threading import Thread from threading import Thread
from xbmc import Player, sleep from xbmc import Player, sleep

View file

@ -1,5 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
############################################################################### from __future__ import absolute_import, division, unicode_literals
from logging import getLogger from logging import getLogger
from threading import Thread from threading import Thread
from urlparse import parse_qsl from urlparse import parse_qsl

View file

@ -3,6 +3,7 @@
""" """
Collection of functions associated with Kodi and Plex playlists and playqueues Collection of functions associated with Kodi and Plex playlists and playqueues
""" """
from __future__ import absolute_import, division, unicode_literals
from logging import getLogger from logging import getLogger
import urllib import urllib
from urlparse import parse_qsl, urlsplit from urlparse import parse_qsl, urlsplit

View file

@ -14,6 +14,7 @@ Triggers a full re-sync of playlists
PlaylistError is thrown if anything wierd happens PlaylistError is thrown if anything wierd happens
""" """
from __future__ import absolute_import, division, unicode_literals
from logging import getLogger from logging import getLogger
from .common import Playlist, PlaylistError, PlaylistObserver from .common import Playlist, PlaylistError, PlaylistObserver

View file

@ -1,5 +1,6 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import absolute_import, division, unicode_literals
from logging import getLogger from logging import getLogger
import Queue import Queue
import time import time
@ -64,6 +65,8 @@ class Playlist(object):
self.kodi_hash = None self.kodi_hash = None
def __repr__(self): def __repr__(self):
for attr in self.__dict__:
LOG.debug('attr %s: %s', attr, type(attr))
return ("{{" return ("{{"
"'plex_id': {self.plex_id}, " "'plex_id': {self.plex_id}, "
"'plex_name': '{self.plex_name}', " "'plex_name': '{self.plex_name}', "

View file

@ -4,6 +4,7 @@
Synced playlists are stored in our plex.db. Interact with it through this Synced playlists are stored in our plex.db. Interact with it through this
module module
""" """
from __future__ import absolute_import, division, unicode_literals
from logging import getLogger from logging import getLogger
from .common import Playlist, PlaylistError from .common import Playlist, PlaylistError

View file

@ -3,6 +3,7 @@
""" """
Create and delete playlists on the Kodi side of things Create and delete playlists on the Kodi side of things
""" """
from __future__ import absolute_import, division, unicode_literals
from logging import getLogger from logging import getLogger
from .common import Playlist, PlaylistError from .common import Playlist, PlaylistError

View file

@ -3,6 +3,7 @@
""" """
Create and delete playlists on the Plex side of things Create and delete playlists on the Plex side of things
""" """
from __future__ import absolute_import, division, unicode_literals
from logging import getLogger from logging import getLogger
from .common import PlaylistError from .common import PlaylistError

View file

@ -4,6 +4,7 @@
Functions to communicate with the currently connected PMS in order to Functions to communicate with the currently connected PMS in order to
manipulate playlists manipulate playlists
""" """
from __future__ import absolute_import, division, unicode_literals
from logging import getLogger from logging import getLogger
import urllib import urllib

View file

@ -1,6 +1,9 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" """
Monitors the Kodi playqueue and adjusts the Plex playqueue accordingly Monitors the Kodi playqueue and adjusts the Plex playqueue accordingly
""" """
from __future__ import absolute_import, division, unicode_literals
from logging import getLogger from logging import getLogger
from threading import Thread from threading import Thread
import xbmc import xbmc

View file

@ -1,6 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import absolute_import, division, unicode_literals
###############################################################################
from logging import getLogger from logging import getLogger
from .downloadutils import DownloadUtils as DU from .downloadutils import DownloadUtils as DU

View file

@ -1,3 +1,4 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
""" """
Taken from iBaa, https://github.com/iBaa/PlexConnect Taken from iBaa, https://github.com/iBaa/PlexConnect
@ -29,6 +30,7 @@ http://stackoverflow.com/questions/2407126/python-urllib2-basic-auth-problem
http://stackoverflow.com/questions/111945/is-there-any-way-to-do-http-put-in-python http://stackoverflow.com/questions/111945/is-there-any-way-to-do-http-put-in-python
(and others...) (and others...)
""" """
from __future__ import absolute_import, division, unicode_literals
from logging import getLogger from logging import getLogger
from re import sub from re import sub
from urllib import urlencode, unquote, quote from urllib import urlencode, unquote, quote

View file

@ -1,6 +1,9 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" """
The Plex Companion master python file The Plex Companion master python file
""" """
from __future__ import absolute_import, division, unicode_literals
from logging import getLogger from logging import getLogger
from threading import Thread from threading import Thread
from Queue import Empty from Queue import Empty

View file

@ -1,4 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import absolute_import, division, unicode_literals
from logging import getLogger from logging import getLogger
from urllib import urlencode, quote_plus from urllib import urlencode, quote_plus
from ast import literal_eval from ast import literal_eval

View file

@ -1,4 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import absolute_import, division, unicode_literals
from logging import getLogger from logging import getLogger
from xbmc import sleep, executebuiltin from xbmc import sleep, executebuiltin

View file

@ -1,3 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, unicode_literals
from logging import getLogger from logging import getLogger
import httplib import httplib
import traceback import traceback

View file

@ -1,6 +1,9 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" """
Plex Companion listener Plex Companion listener
""" """
from __future__ import absolute_import, division, unicode_literals
from logging import getLogger from logging import getLogger
from re import sub from re import sub
from SocketServer import ThreadingMixIn from SocketServer import ThreadingMixIn

View file

@ -1,3 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" """
PlexGDM.py - Version 0.2 PlexGDM.py - Version 0.2
@ -21,6 +23,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. MA 02110-1301, USA.
""" """
from __future__ import absolute_import, division, unicode_literals
import logging import logging
import socket import socket
import threading import threading

View file

@ -1,7 +1,10 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" """
Manages getting playstate from Kodi and sending it to the PMS as well as Manages getting playstate from Kodi and sending it to the PMS as well as
subscribed Plex Companion clients. subscribed Plex Companion clients.
""" """
from __future__ import absolute_import, division, unicode_literals
from logging import getLogger from logging import getLogger
from threading import Thread from threading import Thread

View file

@ -1,5 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
############################################################################### from __future__ import absolute_import, division, unicode_literals
from . import utils from . import utils
from . import variables as v from . import variables as v

View file

@ -1,5 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
############################################################################### from __future__ import absolute_import, division, unicode_literals
import logging import logging
import sys import sys
import xbmc import xbmc

View file

@ -1,5 +1,9 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# THREAD SAFE """
THREAD SAFE
"""
from __future__ import absolute_import, division, unicode_literals
from threading import Lock, RLock from threading import Lock, RLock

View file

@ -1,5 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
############################################################################### from __future__ import absolute_import, division, unicode_literals
from logging import getLogger from logging import getLogger
from threading import Thread from threading import Thread

View file

@ -1,8 +1,9 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
""" """
Various functions and decorators for PKC Various functions and decorators for PKC
""" """
############################################################################### from __future__ import absolute_import, division, unicode_literals
from logging import getLogger from logging import getLogger
from cProfile import Profile from cProfile import Profile
from pstats import Stats from pstats import Stats

View file

@ -1,4 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import absolute_import, division, unicode_literals
import os import os
import sys import sys
import xbmc import xbmc

View file

@ -1,5 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
############################################################################### from __future__ import absolute_import, division, unicode_literals
from logging import getLogger from logging import getLogger
import xml.etree.ElementTree as etree import xml.etree.ElementTree as etree
import xbmc import xbmc

View file

@ -1,3 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" """
websocket - WebSocket client library for Python websocket - WebSocket client library for Python
@ -18,8 +20,6 @@ Copyright (C) 2010 Hiroki Ohtani(liris)
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
""" """
import socket import socket
try: try:

View file

@ -1,18 +1,13 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
###############################################################################
from logging import getLogger from logging import getLogger
import websocket
from json import loads from json import loads
import xml.etree.ElementTree as etree import xml.etree.ElementTree as etree
from threading import Thread from threading import Thread
from ssl import CERT_NONE from ssl import CERT_NONE
from xbmc import sleep from xbmc import sleep
from . import utils from . import websocket, utils, companion, state, variables as v
from . import companion
from . import state
from . import variables as v
############################################################################### ###############################################################################