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 -*-
###############################################################################
from __future__ import absolute_import, division, unicode_literals
from logging import getLogger
from Queue import Queue, Empty
from urllib import quote_plus, unquote

View file

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

View file

@ -1,5 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
from __future__ import absolute_import, division, unicode_literals
import logging
from threading import Thread
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
"""
from __future__ import absolute_import, division, unicode_literals
from logging import getLogger
from xbmc import Player

View file

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

View file

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

View file

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

View file

@ -1,9 +1,10 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Loads of different functions called in SEPARATE Python instances through
# e.g. plugin://... calls. Hence be careful to only rely on window variables.
#
###############################################################################
"""
Loads of different functions called in SEPARATE Python instances through
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 sys import argv
from urllib import urlencode

View file

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

View file

@ -1,5 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
from __future__ import absolute_import, division, unicode_literals
from logging import getLogger
from ntpath import dirname
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.
See http://kodi.wiki/view/JSON-RPC_API
"""
from __future__ import absolute_import, division, unicode_literals
from json import loads, dumps
from xbmc import executeJSONRPC

View file

@ -1,8 +1,9 @@
#!/usr/bin/env python
# -*- 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 ntpath import dirname
from sqlite3 import IntegrityError

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,5 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
from __future__ import absolute_import, division, unicode_literals
import logging
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 . import variables as v

View file

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

View file

@ -1,12 +1,16 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# File and Path operations
#
# Kodi xbmc*.*() functions usually take utf-8 encoded commands, thus try_encode
# works.
# Unfortunatly, working with filenames and paths seems to require an encoding in
# the OS' getfilesystemencoding - it will NOT always work with unicode paths.
# However, sys.getfilesystemencoding might return None.
# Feed unicode to all the functions below and you're fine.
"""
File and Path operations
Kodi xbmc*.*() functions usually take utf-8 encoded commands, thus try_encode
works.
Unfortunatly, working with filenames and paths seems to require an encoding in
the OS' getfilesystemencoding - it will NOT always work with unicode paths.
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 os
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 -*-
###############################################################################
from __future__ import absolute_import, division, unicode_literals
from cPickle import dumps, loads
from xbmcgui import Window
from xbmc import log, LOGDEBUG

View file

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

View file

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

View file

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

View file

@ -3,6 +3,7 @@
"""
Collection of functions associated with Kodi and Plex playlists and playqueues
"""
from __future__ import absolute_import, division, unicode_literals
from logging import getLogger
import urllib
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
"""
from __future__ import absolute_import, division, unicode_literals
from logging import getLogger
from .common import Playlist, PlaylistError, PlaylistObserver

View file

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

View file

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

View file

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

View file

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

View file

@ -4,6 +4,7 @@
Functions to communicate with the currently connected PMS in order to
manipulate playlists
"""
from __future__ import absolute_import, division, unicode_literals
from logging import getLogger
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
"""
from __future__ import absolute_import, division, unicode_literals
from logging import getLogger
from threading import Thread
import xbmc

View file

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

View file

@ -1,3 +1,4 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
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
(and others...)
"""
from __future__ import absolute_import, division, unicode_literals
from logging import getLogger
from re import sub
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
"""
from __future__ import absolute_import, division, unicode_literals
from logging import getLogger
from threading import Thread
from Queue import Empty

View file

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

View file

@ -1,4 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, unicode_literals
from logging import getLogger
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
import httplib
import traceback

View file

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

View file

@ -1,3 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
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,
MA 02110-1301, USA.
"""
from __future__ import absolute_import, division, unicode_literals
import logging
import socket
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
subscribed Plex Companion clients.
"""
from __future__ import absolute_import, division, unicode_literals
from logging import getLogger
from threading import Thread

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,3 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
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
"""
import socket
try:

View file

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