Cleanup all imports

* Should fix problems with needing to do inline imports
This commit is contained in:
JonnyWong16 2016-05-07 11:26:00 -07:00
parent 600bca7e8b
commit f4e719749a
40 changed files with 256 additions and 145 deletions

View file

@ -27,13 +27,14 @@ import sys
# Ensure lib added to path, before any other imports # Ensure lib added to path, before any other imports
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'lib/')) sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'lib/'))
from plexpy import webstart, logger, web_socket
import locale
import time
import signal
import argparse import argparse
import locale
import signal
import time
import plexpy import plexpy
from plexpy import logger, web_socket, webstart
# Register signals, such as CTRL + C # Register signals, such as CTRL + C
signal.signal(signal.SIGINT, plexpy.sig_handler) signal.signal(signal.SIGINT, plexpy.sig_handler)

View file

@ -36,9 +36,10 @@ DOCUMENTATION :: END
</%doc> </%doc>
<%! <%!
from plexpy import common
import re import re
from plexpy import common
# Get audio codec file # Get audio codec file
def af(codec): def af(codec):
for pattern, file in common.MEDIA_FLAGS_AUDIO.iteritems(): for pattern, file in common.MEDIA_FLAGS_AUDIO.iteritems():

View file

@ -2,8 +2,9 @@
<%! <%!
import os import os
import sys import sys
import plexpy import plexpy
from plexpy import notifiers, common, versioncheck from plexpy import common, notifiers, versioncheck
from plexpy.helpers import anon_url from plexpy.helpers import anon_url
available_notification_agents = sorted(notifiers.available_notification_agents(), key=lambda k: k['name']) available_notification_agents = sorted(notifiers.available_notification_agents(), key=lambda k: k['name'])

View file

@ -14,11 +14,10 @@
# along with PlexPy. If not, see <http://www.gnu.org/licenses/>. # along with PlexPy. If not, see <http://www.gnu.org/licenses/>.
import os import os
import sqlite3
import sys import sys
import subprocess import subprocess
import threading import threading
import sqlite3
import cherrypy
import datetime import datetime
import uuid import uuid
# Some cut down versions of Python may not include this module and it's not critical for us # Some cut down versions of Python may not include this module and it's not critical for us
@ -28,10 +27,15 @@ try:
except ImportError: except ImportError:
no_browser = True no_browser = True
import cherrypy
from apscheduler.schedulers.background import BackgroundScheduler from apscheduler.schedulers.background import BackgroundScheduler
from apscheduler.triggers.interval import IntervalTrigger from apscheduler.triggers.interval import IntervalTrigger
from plexpy import versioncheck, logger, activity_pinger, plextv, pmsconnect import activity_pinger
import logger
import plextv
import pmsconnect
import versioncheck
import plexpy.config import plexpy.config
PROG_DIR = None PROG_DIR = None

View file

@ -13,10 +13,16 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with PlexPy. If not, see <http://www.gnu.org/licenses/>. # along with PlexPy. If not, see <http://www.gnu.org/licenses/>.
import threading
import time import time
import plexpy
from plexpy import logger, pmsconnect, activity_processor, threading, notification_handler, helpers, notifiers import plexpy
import activity_processor
import helpers
import logger
import notification_handler
import notifiers
import pmsconnect
class ActivityHandler(object): class ActivityHandler(object):

View file

@ -13,12 +13,21 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with PlexPy. If not, see <http://www.gnu.org/licenses/>. # along with PlexPy. If not, see <http://www.gnu.org/licenses/>.
from plexpy import logger, pmsconnect, plextv, notification_handler, database, helpers, activity_processor, libraries, notifiers
import threading import threading
import plexpy
import time import time
import plexpy
import activity_processor
import database
import helpers
import libraries
import logger
import notification_handler
import notifiers
import plextv
import pmsconnect
monitor_lock = threading.Lock() monitor_lock = threading.Lock()
ext_ping_count = 0 ext_ping_count = 0
int_ping_count = 0 int_ping_count = 0

View file

@ -13,12 +13,19 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with PlexPy. If not, see <http://www.gnu.org/licenses/>. # along with PlexPy. If not, see <http://www.gnu.org/licenses/>.
from plexpy import logger, pmsconnect, notification_handler, log_reader, database, notifiers
import threading import threading
import plexpy
import re
import time import time
import re
import plexpy
import database
import libraries
import log_reader
import logger
import notification_handler
import notifiers
import pmsconnect
import users
class ActivityProcessor(object): class ActivityProcessor(object):
@ -102,8 +109,6 @@ class ActivityProcessor(object):
return True return True
def write_session_history(self, session=None, import_metadata=None, is_import=False, import_ignore_interval=0): def write_session_history(self, session=None, import_metadata=None, is_import=False, import_ignore_interval=0):
from plexpy import users, libraries
section_id = session['section_id'] if not is_import else import_metadata['section_id'] section_id = session['section_id'] if not is_import else import_metadata['section_id']
if not is_import: if not is_import:

View file

@ -16,17 +16,26 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with PlexPy. If not, see <http://www.gnu.org/licenses/>. # along with PlexPy. If not, see <http://www.gnu.org/licenses/>.
from plexpy import versioncheck, logger, plextv, pmsconnect, datafactory, graphs, users
import os
import plexpy
import json import json
import traceback
import cherrypy
import re
import hashlib import hashlib
import os
import random import random
import re
import traceback
import cherrypy
import xmltodict import xmltodict
import plexpy
import datafactory
import graphs
import logger
import plextv
import pmsconnect
import users
import versioncheck
cmd_list = ['getLogs', 'getVersion', 'checkGithub', 'shutdown', cmd_list = ['getLogs', 'getVersion', 'checkGithub', 'shutdown',
'getSettings', 'restart', 'update', 'getApikey', 'getHistory', 'getSettings', 'restart', 'update', 'getApikey', 'getHistory',
'getMetadata', 'getUserips', 'getPlayby', 'getSync'] 'getMetadata', 'getUserips', 'getPlayby', 'getSync']

View file

@ -23,15 +23,17 @@ import json
import os import os
import random import random
import re import re
import threading
import time import time
import traceback import traceback
import cherrypy import cherrypy
import xmltodict import xmltodict
import plexpy
import database import database
import logger import logger
import plexpy import pmsconnect
class API2: class API2:
@ -301,6 +303,10 @@ class API2:
self.msg = 'Updating plexpy' self.msg = 'Updating plexpy'
self.result_type = 'success' self.result_type = 'success'
def refresh_libraries_list(self, **kwargs):
threading.Thread(target=pmsconnect.refresh_libraries).start()
self.result_type = 'success'
def _api_make_md(self): def _api_make_md(self):
""" Tries to make a API.md to simplify the api docs """ """ Tries to make a API.md to simplify the api docs """

View file

@ -20,7 +20,7 @@ Created on Aug 1, 2011
''' '''
import platform import platform
from plexpy import version import version
# Identify Our Application # Identify Our Application
USER_AGENT = 'PlexPy/-' + version.PLEXPY_VERSION + ' v' + version.PLEXPY_RELEASE_VERSION + ' (' + platform.system() + \ USER_AGENT = 'PlexPy/-' + version.PLEXPY_VERSION + ' v' + version.PLEXPY_RELEASE_VERSION + ' (' + platform.system() + \

View file

@ -1,7 +1,24 @@
import plexpy.logger # This file is part of PlexPy.
#
# PlexPy is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# PlexPy is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with PlexPy. If not, see <http://www.gnu.org/licenses/>.
import re import re
from configobj import ConfigObj from configobj import ConfigObj
import logger
def bool_int(value): def bool_int(value):
""" """
@ -484,7 +501,7 @@ class Config(object):
subkey.upper() not in _WHITELIST_KEYS and any(bk in subkey.upper() for bk in _BLACKLIST_KEYS): subkey.upper() not in _WHITELIST_KEYS and any(bk in subkey.upper() for bk in _BLACKLIST_KEYS):
blacklist.append(value.strip()) blacklist.append(value.strip())
plexpy.logger._BLACKLIST_WORDS = blacklist logger._BLACKLIST_WORDS = blacklist
def _define(self, name): def _define(self, name):
key = name.upper() key = name.upper()
@ -537,12 +554,12 @@ class Config(object):
new_config[section][ini_key] = self._config[section][ini_key] new_config[section][ini_key] = self._config[section][ini_key]
# Write it to file # Write it to file
plexpy.logger.info("Writing configuration to file") logger.info("Writing configuration to file")
try: try:
new_config.write() new_config.write()
except IOError as e: except IOError as e:
plexpy.logger.error("Error writing configuration file: %s", e) logger.error("Error writing configuration file: %s", e)
self._blacklist() self._blacklist()

View file

@ -20,9 +20,8 @@ import shutil
import threading import threading
import time import time
import logger
import plexpy import plexpy
import logger
db_lock = threading.Lock() db_lock = threading.Lock()

View file

@ -15,7 +15,14 @@
import datetime import datetime
from plexpy import logger, datatables, common, database, helpers, session import plexpy
import common
import database
import datatables
import helpers
import logger
import pmsconnect
import session
class DataFactory(object): class DataFactory(object):
@ -1126,7 +1133,6 @@ class DataFactory(object):
return 'Unable to delete rows. Input row not valid.' return 'Unable to delete rows. Input row not valid.'
def update_metadata(self, old_key_list='', new_key_list='', media_type=''): def update_metadata(self, old_key_list='', new_key_list='', media_type=''):
from plexpy import pmsconnect
pms_connect = pmsconnect.PmsConnect() pms_connect = pmsconnect.PmsConnect()
monitor_db = database.MonitorDatabase() monitor_db = database.MonitorDatabase()

View file

@ -13,10 +13,13 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with PlexPy. If not, see <http://www.gnu.org/licenses/>. # along with PlexPy. If not, see <http://www.gnu.org/licenses/>.
from plexpy import logger, helpers, database
import re import re
import plexpy
import database
import helpers
import logger
class DataTables(object): class DataTables(object):
""" """

View file

@ -13,11 +13,15 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with PlexPy. If not, see <http://www.gnu.org/licenses/>. # along with PlexPy. If not, see <http://www.gnu.org/licenses/>.
from plexpy import logger, database, helpers, common, session
import plexpy
import datetime import datetime
import plexpy
import common
import database
import helpers
import logger
import session
class Graphs(object): class Graphs(object):

View file

@ -35,7 +35,8 @@ from xml.dom import minidom
import xmltodict import xmltodict
import plexpy import plexpy
from plexpy import common import common
import logger
from plexpy.api2 import API2 from plexpy.api2 import API2
@ -388,9 +389,6 @@ def create_https_certificates(ssl_cert, ssl_key):
This code is stolen from SickBeard (http://github.com/midgetspy/Sick-Beard). This code is stolen from SickBeard (http://github.com/midgetspy/Sick-Beard).
""" """
from plexpy import logger
from OpenSSL import crypto from OpenSSL import crypto
from certgen import createKeyPair, createSelfSignedCertificate, TYPE_RSA from certgen import createKeyPair, createSelfSignedCertificate, TYPE_RSA
@ -455,8 +453,6 @@ def get_percent(value1, value2):
return math.trunc(percent) return math.trunc(percent)
def parse_xml(unparsed=None): def parse_xml(unparsed=None):
from plexpy import logger
if unparsed: if unparsed:
try: try:
xml_parse = minidom.parseString(unparsed) xml_parse = minidom.parseString(unparsed)
@ -508,7 +504,6 @@ def is_ip_public(host):
return False return False
def get_ip(host): def get_ip(host):
from plexpy import logger
ip_address = '' ip_address = ''
try: try:
socket.inet_aton(host) socket.inet_aton(host)
@ -530,8 +525,6 @@ def anon_url(*url):
return '' if None in url else '%s%s' % (plexpy.CONFIG.ANON_REDIRECT, ''.join(str(s) for s in url)) return '' if None in url else '%s%s' % (plexpy.CONFIG.ANON_REDIRECT, ''.join(str(s) for s in url))
def uploadToImgur(imgPath, imgTitle=''): def uploadToImgur(imgPath, imgTitle=''):
from plexpy import logger
client_id = '743b1a443ccd2b0' client_id = '743b1a443ccd2b0'
img_url = '' img_url = ''
@ -572,8 +565,6 @@ def cache_image(url, image=None):
Saves an image to the cache directory. Saves an image to the cache directory.
If no image is provided, tries to return the image from the cache directory. If no image is provided, tries to return the image from the cache directory.
""" """
from plexpy import logger
# Create image directory if it doesn't exist # Create image directory if it doesn't exist
imgdir = os.path.join(plexpy.CONFIG.CACHE_DIR, 'images/') imgdir = os.path.join(plexpy.CONFIG.CACHE_DIR, 'images/')
if not os.path.exists(imgdir): if not os.path.exists(imgdir):

View file

@ -19,7 +19,10 @@
from httplib import HTTPSConnection from httplib import HTTPSConnection
from httplib import HTTPConnection from httplib import HTTPConnection
import ssl import ssl
from plexpy import logger, helpers
import plexpy
import helpers
import logger
class HTTPHandler(object): class HTTPHandler(object):

View file

@ -13,12 +13,22 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with PlexPy. If not, see <http://www.gnu.org/licenses/>. # along with PlexPy. If not, see <http://www.gnu.org/licenses/>.
import json
import os
import plexpy import plexpy
from plexpy import logger, datatables, common, database, helpers, session import activity_pinger
import common
import database
import datatables
import helpers
import logger
import plextv
import pmsconnect
import session
def update_section_ids(): def update_section_ids():
from plexpy import pmsconnect, activity_pinger
plexpy.CONFIG.UPDATE_SECTION_IDS = -1 plexpy.CONFIG.UPDATE_SECTION_IDS = -1
monitor_db = database.MonitorDatabase() monitor_db = database.MonitorDatabase()
@ -88,8 +98,6 @@ def update_section_ids():
return True return True
def update_labels(): def update_labels():
from plexpy import pmsconnect
plexpy.CONFIG.UPDATE_LABELS = -1 plexpy.CONFIG.UPDATE_LABELS = -1
monitor_db = database.MonitorDatabase() monitor_db = database.MonitorDatabase()
@ -291,9 +299,6 @@ class Libraries(object):
return dict return dict
def get_datatables_media_info(self, section_id=None, section_type=None, rating_key=None, refresh=False, kwargs=None): def get_datatables_media_info(self, section_id=None, section_type=None, rating_key=None, refresh=False, kwargs=None):
from plexpy import pmsconnect
import json, os
default_return = {'recordsFiltered': 0, default_return = {'recordsFiltered': 0,
'recordsTotal': 0, 'recordsTotal': 0,
'draw': 0, 'draw': 0,
@ -505,9 +510,6 @@ class Libraries(object):
return dict return dict
def get_media_info_file_sizes(self, section_id=None, rating_key=None): def get_media_info_file_sizes(self, section_id=None, rating_key=None):
from plexpy import pmsconnect
import json, os
if not session.allow_session_library(section_id): if not session.allow_session_library(section_id):
return False return False
@ -605,8 +607,6 @@ class Libraries(object):
logger.warn(u"PlexPy Libraries :: Unable to execute database query for set_config: %s." % e) logger.warn(u"PlexPy Libraries :: Unable to execute database query for set_config: %s." % e)
def get_details(self, section_id=None): def get_details(self, section_id=None):
from plexpy import pmsconnect
default_return = {'section_id': 0, default_return = {'section_id': 0,
'section_name': 'Local', 'section_name': 'Local',
'section_type': '', 'section_type': '',
@ -950,8 +950,6 @@ class Libraries(object):
logger.warn(u"PlexPy Libraries :: Unable to delete media info table cache: %s." % e) logger.warn(u"PlexPy Libraries :: Unable to delete media info table cache: %s." % e)
def delete_duplicate_libraries(self): def delete_duplicate_libraries(self):
from plexpy import plextv
monitor_db = database.MonitorDatabase() monitor_db = database.MonitorDatabase()
# Refresh the PMS_URL to make sure the server_id is updated # Refresh the PMS_URL to make sure the server_id is updated

View file

@ -13,10 +13,12 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with PlexPy. If not, see <http://www.gnu.org/licenses/>. # along with PlexPy. If not, see <http://www.gnu.org/licenses/>.
from plexpy import helpers, logger
import re
import os import os
import re
import plexpy import plexpy
import helpers
import logger
def get_log_tail(window=20, parsed=True, log_type="server"): def get_log_tail(window=20, parsed=True, log_type="server"):

View file

@ -13,21 +13,21 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with PlexPy. If not, see <http://www.gnu.org/licenses/>. # along with PlexPy. If not, see <http://www.gnu.org/licenses/>.
from plexpy import helpers
from logutils.queue import QueueHandler, QueueListener from logutils.queue import QueueHandler, QueueListener
from logging import handlers from logging import handlers
import multiprocessing
import contextlib import contextlib
import plexpy
import threading
import traceback
import logging
import errno import errno
import sys import logging
import multiprocessing
import os import os
import re import re
import sys
import threading
import traceback
import plexpy
import helpers
# These settings are for file logging only # These settings are for file logging only
FILENAME = "plexpy.log" FILENAME = "plexpy.log"

View file

@ -22,13 +22,19 @@ import threading
import time import time
import urllib import urllib
from plexpy import logger, config, notifiers, database, helpers, plextv, pmsconnect, datafactory
import plexpy import plexpy
import config
import database
import datafactory
import libraries
import logger
import helpers
import notifiers
import plextv
import pmsconnect
import users
def notify(stream_data=None, notify_action=None): def notify(stream_data=None, notify_action=None):
from plexpy import users, libraries
if stream_data and notify_action: if stream_data and notify_action:
# Check if notifications enabled for user and library # Check if notifications enabled for user and library
user_data = users.Users() user_data = users.Users()

View file

@ -42,7 +42,10 @@ import pythontwitter as twitter
import pythonfacebook as facebook import pythonfacebook as facebook
import plexpy import plexpy
from plexpy import logger, helpers, request, database import database
import helpers
import logger
import request
from plexpy.helpers import checked from plexpy.helpers import checked
AGENT_IDS = {"Growl": 0, AGENT_IDS = {"Growl": 0,

View file

@ -22,7 +22,13 @@ import xmltodict
from xml.dom import minidom from xml.dom import minidom
import plexpy import plexpy
from plexpy import logger, helpers, http_handler, database, users, session, pmsconnect import database
import helpers
import http_handler
import logger
import users
import pmsconnect
import session
def refresh_users(): def refresh_users():

View file

@ -14,11 +14,17 @@
# along with PlexPy. If not, see <http://www.gnu.org/licenses/>. # along with PlexPy. If not, see <http://www.gnu.org/licenses/>.
import sqlite3 import sqlite3
from plexpy import logger, helpers, activity_pinger, activity_processor, users, plextv
from xml.dom import minidom from xml.dom import minidom
import plexpy import plexpy
import activity_pinger
import activity_processor
import database
import helpers
import logger
import plextv
import users
def extract_plexwatch_xml(xml=None): def extract_plexwatch_xml(xml=None):
output = {} output = {}
@ -408,8 +414,6 @@ def import_from_plexwatch(database=None, table_name=None, import_ignore_interval
plexpy.initialize_scheduler() plexpy.initialize_scheduler()
def import_users(): def import_users():
from plexpy import database
logger.debug(u"PlexPy Importer :: Importing PlexWatch Users...") logger.debug(u"PlexPy Importer :: Importing PlexWatch Users...")
monitor_db = database.MonitorDatabase() monitor_db = database.MonitorDatabase()

View file

@ -13,11 +13,19 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with PlexPy. If not, see <http://www.gnu.org/licenses/>. # along with PlexPy. If not, see <http://www.gnu.org/licenses/>.
import threading
import urllib2 import urllib2
from urlparse import urlparse from urlparse import urlparse
import plexpy import plexpy
from plexpy import logger, helpers, users, http_handler, common, database, session import common
import database
import helpers
import http_handler
import libraries
import logger
import session
import users
def get_server_friendly_name(): def get_server_friendly_name():
@ -78,16 +86,10 @@ def refresh_libraries():
plexpy.CONFIG.write() plexpy.CONFIG.write()
if plexpy.CONFIG.UPDATE_SECTION_IDS == 1 or plexpy.CONFIG.UPDATE_SECTION_IDS == -1: if plexpy.CONFIG.UPDATE_SECTION_IDS == 1 or plexpy.CONFIG.UPDATE_SECTION_IDS == -1:
from plexpy import libraries
import threading
# Start library section_id update on it's own thread # Start library section_id update on it's own thread
threading.Thread(target=libraries.update_section_ids).start() threading.Thread(target=libraries.update_section_ids).start()
if plexpy.CONFIG.UPDATE_LABELS == 1 or plexpy.CONFIG.UPDATE_LABELS == -1: if plexpy.CONFIG.UPDATE_LABELS == 1 or plexpy.CONFIG.UPDATE_LABELS == -1:
from plexpy import libraries
import threading
# Start library labels update on it's own thread # Start library labels update on it's own thread
threading.Thread(target=libraries.update_labels).start() threading.Thread(target=libraries.update_labels).start()

View file

@ -13,16 +13,17 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with PlexPy. If not, see <http://www.gnu.org/licenses/>. # along with PlexPy. If not, see <http://www.gnu.org/licenses/>.
from plexpy import logger
from xml.dom import minidom
from bs4 import BeautifulSoup from bs4 import BeautifulSoup
from xml.dom import minidom
import requests
import feedparser import feedparser
import collections
import requests
import plexpy import plexpy
import plexpy.lock import plexpy.lock
import collections import logger
# Dictionary with last request times, for rate limiting. # Dictionary with last request times, for rate limiting.
last_requests = collections.defaultdict(int) last_requests = collections.defaultdict(int)

View file

@ -15,7 +15,9 @@
import cherrypy import cherrypy
from plexpy import common import plexpy
import common
import users
def get_session_info(): def get_session_info():
@ -51,7 +53,6 @@ def get_session_shared_libraries():
""" """
Returns a tuple of section_id for the current logged in session Returns a tuple of section_id for the current logged in session
""" """
from plexpy import users
user_details = users.Users().get_details(user_id=get_session_user_id()) user_details = users.Users().get_details(user_id=get_session_user_id())
return tuple(str(s) for s in user_details['shared_libraries']) return tuple(str(s) for s in user_details['shared_libraries'])
@ -63,7 +64,6 @@ def get_session_library_filters():
'labels': ('label1', label2')}, 'labels': ('label1', label2')},
""" """
from plexpy import users
filters = users.Users().get_filters(user_id=get_session_user_id()) filters = users.Users().get_filters(user_id=get_session_user_id())
return filters return filters

View file

@ -14,7 +14,14 @@
# along with PlexPy. If not, see <http://www.gnu.org/licenses/>. # along with PlexPy. If not, see <http://www.gnu.org/licenses/>.
import plexpy import plexpy
from plexpy import logger, datatables, common, database, helpers, session import common
import database
import datatables
import helpers
import logger
import plextv
import session
class Users(object): class Users(object):
@ -254,8 +261,6 @@ class Users(object):
logger.warn(u"PlexPy Users :: Unable to execute database query for set_config: %s." % e) logger.warn(u"PlexPy Users :: Unable to execute database query for set_config: %s." % e)
def get_details(self, user_id=None, user=None, email=None): def get_details(self, user_id=None, user=None, email=None):
from plexpy import plextv
default_return = {'user_id': 0, default_return = {'user_id': 0,
'username': 'Local', 'username': 'Local',
'friendly_name': 'Local', 'friendly_name': 'Local',

View file

@ -13,14 +13,16 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with PlexPy. If not, see <http://www.gnu.org/licenses/>. # along with PlexPy. If not, see <http://www.gnu.org/licenses/>.
import re
import os import os
import tarfile
import platform import platform
import plexpy import re
import subprocess import subprocess
import tarfile
from plexpy import logger, version, request import plexpy
import logger
import request
import version
def runGit(args): def runGit(args):

View file

@ -15,14 +15,17 @@
# Mostly borrowed from https://github.com/trakt/Plex-Trakt-Scrobbler # Mostly borrowed from https://github.com/trakt/Plex-Trakt-Scrobbler
from plexpy import logger, activity_pinger
import threading
import plexpy
import json import json
import threading
import time import time
import websocket import websocket
import plexpy
import activity_handler
import activity_pinger
import logger
name = 'websocket' name = 'websocket'
opcode_data = (websocket.ABNF.OPCODE_TEXT, websocket.ABNF.OPCODE_BINARY) opcode_data = (websocket.ABNF.OPCODE_TEXT, websocket.ABNF.OPCODE_BINARY)
ws_reconnect = False ws_reconnect = False
@ -132,8 +135,6 @@ def receive(ws):
def process(opcode, data): def process(opcode, data):
from plexpy import activity_handler
if opcode not in opcode_data: if opcode not in opcode_data:
return False return False

View file

@ -19,13 +19,15 @@
# Session tool to be loaded. # Session tool to be loaded.
from cgi import escape from cgi import escape
import cherrypy
from datetime import datetime, timedelta from datetime import datetime, timedelta
from hashing_passwords import check_hash
import re import re
import cherrypy
from hashing_passwords import check_hash
import plexpy import plexpy
from plexpy import logger, plextv import logger
import plextv
from plexpy.database import MonitorDatabase from plexpy.database import MonitorDatabase
from plexpy.users import Users from plexpy.users import Users
from plexpy.plextv import PlexTV from plexpy.plextv import PlexTV

View file

@ -13,24 +13,38 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with PlexPy. If not, see <http://www.gnu.org/licenses/>. # along with PlexPy. If not, see <http://www.gnu.org/licenses/>.
import cherrypy
import hashlib import hashlib
import json import json
import os import os
import random import random
import threading import threading
import cherrypy
from hashing_passwords import make_hash from hashing_passwords import make_hash
from mako.lookup import TemplateLookup from mako.lookup import TemplateLookup
from mako import exceptions from mako import exceptions
import plexpy import plexpy
from plexpy import logger, notifiers, plextv, pmsconnect, common, log_reader, \ import common
datafactory, graphs, users, libraries, database, web_socket import database
import datafactory
import graphs
import http_handler
import libraries
import log_reader
import logger
import notifiers
import plextv
import plexwatch_import
import pmsconnect
import users
import versioncheck
import web_socket
from plexpy.api import Api
from plexpy.api2 import API2 from plexpy.api2 import API2
from plexpy.helpers import checked, addtoapi, get_ip, create_https_certificates from plexpy.helpers import checked, addtoapi, get_ip, create_https_certificates
from plexpy.session import get_session_info, get_session_user_id, allow_session_user, allow_session_library from plexpy.session import get_session_info, get_session_user_id, allow_session_user, allow_session_library
from plexpy.webauth import AuthController, requireAuth, member_of, name_is, SESSION_KEY from plexpy.webauth import AuthController, requireAuth, member_of, name_is
def serve_template(templatename, **kwargs): def serve_template(templatename, **kwargs):

View file

@ -16,14 +16,14 @@
import os import os
import sys import sys
import cherrypy
from plexpy import logger, webauth
import plexpy import plexpy
import cherrypy
import logger
import webauth
from plexpy.helpers import create_https_certificates from plexpy.helpers import create_https_certificates
from plexpy.webserve import WebInterface from plexpy.webserve import WebInterface
def initialize(options): def initialize(options):
# HTTPS stuff stolen from sickbeard # HTTPS stuff stolen from sickbeard