mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-08-14 02:26:58 -07:00
Create DummyObject to not crash when starting with Python 2
* This disables the collections, playlists, and exporter features
This commit is contained in:
parent
4a463f04f1
commit
5ca8184948
1 changed files with 24 additions and 1 deletions
|
@ -19,7 +19,7 @@ from __future__ import unicode_literals
|
|||
from future.builtins import object
|
||||
from future.builtins import str
|
||||
|
||||
from plexapi.server import PlexServer
|
||||
import sys
|
||||
|
||||
import plexpy
|
||||
if plexpy.PYTHON2:
|
||||
|
@ -28,6 +28,29 @@ else:
|
|||
from plexpy import logger
|
||||
|
||||
|
||||
class DummyObject(object):
|
||||
def __init__(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
def __call__(self, *args, **kwargs):
|
||||
return self
|
||||
|
||||
def __getattr__(self, attr):
|
||||
return self
|
||||
|
||||
def __iter__(self):
|
||||
return self
|
||||
|
||||
def __next__(self):
|
||||
raise StopIteration
|
||||
|
||||
|
||||
if sys.version_info >= (3, 6):
|
||||
from plexapi.server import PlexServer
|
||||
else:
|
||||
PlexServer = DummyObject
|
||||
|
||||
|
||||
class Plex(object):
|
||||
def __init__(self, url, token):
|
||||
self.plex = PlexServer(url, token)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue