mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-11 15:56:07 -07:00
Rename PlexPy to Tautulli
This commit is contained in:
parent
55bdde808b
commit
19f029cff0
50 changed files with 867 additions and 870 deletions
|
@ -1,17 +1,17 @@
|
|||
# This file is part of PlexPy.
|
||||
# This file is part of Tautulli.
|
||||
#
|
||||
# PlexPy is free software: you can redistribute it and/or modify
|
||||
# Tautulli 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,
|
||||
# Tautulli 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/>.
|
||||
# along with Tautulli. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import base64
|
||||
import datetime
|
||||
|
@ -399,10 +399,10 @@ def create_https_certificates(ssl_cert, ssl_key):
|
|||
ips = ['IP:' + d.strip() for d in plexpy.CONFIG.HTTPS_IP.split(',') if d]
|
||||
altNames = ','.join(domains + ips)
|
||||
|
||||
# Create the self-signed PlexPy certificate
|
||||
# Create the self-signed Tautulli certificate
|
||||
logger.debug(u"Generating self-signed SSL certificate.")
|
||||
pkey = createKeyPair(TYPE_RSA, 2048)
|
||||
cert = createSelfSignedCertificate(("PlexPy", pkey), serial, (0, 60 * 60 * 24 * 365 * 10), altNames) # ten years
|
||||
cert = createSelfSignedCertificate(("Tautulli", pkey), serial, (0, 60 * 60 * 24 * 365 * 10), altNames) # ten years
|
||||
|
||||
# Save the key and certificate to disk
|
||||
try:
|
||||
|
@ -537,27 +537,27 @@ def install_geoip_db():
|
|||
geolite2_db = plexpy.CONFIG.GEOIP_DB or os.path.join(plexpy.DATA_DIR, geolite2_db)
|
||||
|
||||
# Retrieve the GeoLite2 gzip file
|
||||
logger.debug(u"PlexPy Helpers :: Downloading GeoLite2 gzip file from MaxMind...")
|
||||
logger.debug(u"Tautulli Helpers :: Downloading GeoLite2 gzip file from MaxMind...")
|
||||
try:
|
||||
maxmind = urllib.URLopener()
|
||||
maxmind.retrieve(maxmind_url + geolite2_gz, temp_gz)
|
||||
md5_checksum = urllib2.urlopen(maxmind_url + geolite2_md5).read()
|
||||
except Exception as e:
|
||||
logger.error(u"PlexPy Helpers :: Failed to download GeoLite2 gzip file from MaxMind: %s" % e)
|
||||
logger.error(u"Tautulli Helpers :: Failed to download GeoLite2 gzip file from MaxMind: %s" % e)
|
||||
return False
|
||||
|
||||
# Extract the GeoLite2 database file
|
||||
logger.debug(u"PlexPy Helpers :: Extracting GeoLite2 database...")
|
||||
logger.debug(u"Tautulli Helpers :: Extracting GeoLite2 database...")
|
||||
try:
|
||||
with gzip.open(temp_gz, 'rb') as gz:
|
||||
with open(geolite2_db, 'wb') as db:
|
||||
db.write(gz.read())
|
||||
except Exception as e:
|
||||
logger.error(u"PlexPy Helpers :: Failed to extract the GeoLite2 database: %s" % e)
|
||||
logger.error(u"Tautulli Helpers :: Failed to extract the GeoLite2 database: %s" % e)
|
||||
return False
|
||||
|
||||
# Check MD5 hash for GeoLite2 database file
|
||||
logger.debug(u"PlexPy Helpers :: Checking MD5 checksum for GeoLite2 database...")
|
||||
logger.debug(u"Tautulli Helpers :: Checking MD5 checksum for GeoLite2 database...")
|
||||
try:
|
||||
hash_md5 = hashlib.md5()
|
||||
with open(geolite2_db, 'rb') as f:
|
||||
|
@ -566,37 +566,37 @@ def install_geoip_db():
|
|||
md5_hash = hash_md5.hexdigest()
|
||||
|
||||
if md5_hash != md5_checksum:
|
||||
logger.error(u"PlexPy Helpers :: MD5 checksum doesn't match for GeoLite2 database. "
|
||||
logger.error(u"Tautulli Helpers :: MD5 checksum doesn't match for GeoLite2 database. "
|
||||
"Checksum: %s, file hash: %s" % (md5_checksum, md5_hash))
|
||||
return False
|
||||
except Exception as e:
|
||||
logger.error(u"PlexPy Helpers :: Failed to generate MD5 checksum for GeoLite2 database: %s" % e)
|
||||
logger.error(u"Tautulli Helpers :: Failed to generate MD5 checksum for GeoLite2 database: %s" % e)
|
||||
return False
|
||||
|
||||
# Delete temportary GeoLite2 gzip file
|
||||
logger.debug(u"PlexPy Helpers :: Deleting temporary GeoLite2 gzip file...")
|
||||
logger.debug(u"Tautulli Helpers :: Deleting temporary GeoLite2 gzip file...")
|
||||
try:
|
||||
os.remove(temp_gz)
|
||||
except Exception as e:
|
||||
logger.warn(u"PlexPy Helpers :: Failed to remove temporary GeoLite2 gzip file: %s" % e)
|
||||
logger.warn(u"Tautulli Helpers :: Failed to remove temporary GeoLite2 gzip file: %s" % e)
|
||||
|
||||
logger.debug(u"PlexPy Helpers :: GeoLite2 database installed successfully.")
|
||||
logger.debug(u"Tautulli Helpers :: GeoLite2 database installed successfully.")
|
||||
plexpy.CONFIG.__setattr__('GEOIP_DB', geolite2_db)
|
||||
plexpy.CONFIG.write()
|
||||
|
||||
return True
|
||||
|
||||
def uninstall_geoip_db():
|
||||
logger.debug(u"PlexPy Helpers :: Uninstalling the GeoLite2 database...")
|
||||
logger.debug(u"Tautulli Helpers :: Uninstalling the GeoLite2 database...")
|
||||
try:
|
||||
os.remove(plexpy.CONFIG.GEOIP_DB)
|
||||
plexpy.CONFIG.__setattr__('GEOIP_DB', '')
|
||||
plexpy.CONFIG.write()
|
||||
except Exception as e:
|
||||
logger.error(u"PlexPy Helpers :: Failed to uninstall the GeoLite2 database: %s" % e)
|
||||
logger.error(u"Tautulli Helpers :: Failed to uninstall the GeoLite2 database: %s" % e)
|
||||
return False
|
||||
|
||||
logger.debug(u"PlexPy Helpers :: GeoLite2 database uninstalled successfully.")
|
||||
logger.debug(u"Tautulli Helpers :: GeoLite2 database uninstalled successfully.")
|
||||
return True
|
||||
|
||||
def geoip_lookup(ip_address):
|
||||
|
@ -686,14 +686,14 @@ def uploadToImgur(imgPath, imgTitle=''):
|
|||
img_url = ''
|
||||
|
||||
if not client_id:
|
||||
logger.error(u"PlexPy Helpers :: Cannot upload poster to Imgur. No Imgur client id specified in the settings.")
|
||||
logger.error(u"Tautulli Helpers :: Cannot upload poster to Imgur. No Imgur client id specified in the settings.")
|
||||
return img_url
|
||||
|
||||
try:
|
||||
with open(imgPath, 'rb') as imgFile:
|
||||
img = imgFile.read()
|
||||
except IOError as e:
|
||||
logger.error(u"PlexPy Helpers :: Unable to read image file for Imgur: %s" % e)
|
||||
logger.error(u"Tautulli Helpers :: Unable to read image file for Imgur: %s" % e)
|
||||
return img_url
|
||||
|
||||
headers = {'Authorization': 'Client-ID %s' % client_id}
|
||||
|
@ -707,17 +707,17 @@ def uploadToImgur(imgPath, imgTitle=''):
|
|||
|
||||
if response and not err_msg:
|
||||
t = '\'' + imgTitle + '\' ' if imgTitle else ''
|
||||
logger.debug(u"PlexPy Helpers :: Image {}uploaded to Imgur.".format(t))
|
||||
logger.debug(u"Tautulli Helpers :: Image {}uploaded to Imgur.".format(t))
|
||||
img_url = response.json().get('data').get('link', '').replace('http://', 'https://')
|
||||
|
||||
else:
|
||||
if err_msg:
|
||||
logger.error(u"PlexPy Helpers :: Unable to upload image to Imgur: {}".format(err_msg))
|
||||
logger.error(u"Tautulli Helpers :: Unable to upload image to Imgur: {}".format(err_msg))
|
||||
else:
|
||||
logger.error(u"PlexPy Helpers :: Unable to upload image to Imgur.")
|
||||
logger.error(u"Tautulli Helpers :: Unable to upload image to Imgur.")
|
||||
|
||||
if req_msg:
|
||||
logger.debug(u"PlexPy Helpers :: Request response: {}".format(req_msg))
|
||||
logger.debug(u"Tautulli Helpers :: Request response: {}".format(req_msg))
|
||||
|
||||
return img_url
|
||||
|
||||
|
@ -729,7 +729,7 @@ def cache_image(url, image=None):
|
|||
# Create image directory if it doesn't exist
|
||||
imgdir = os.path.join(plexpy.CONFIG.CACHE_DIR, 'images/')
|
||||
if not os.path.exists(imgdir):
|
||||
logger.debug(u"PlexPy Helpers :: Creating image cache directory at %s" % imgdir)
|
||||
logger.debug(u"Tautulli Helpers :: Creating image cache directory at %s" % imgdir)
|
||||
os.makedirs(imgdir)
|
||||
|
||||
# Create a hash of the url to use as the filename
|
||||
|
@ -742,7 +742,7 @@ def cache_image(url, image=None):
|
|||
with open(imagefile, 'wb') as cache_file:
|
||||
cache_file.write(image)
|
||||
except IOError as e:
|
||||
logger.error(u"PlexPy Helpers :: Failed to cache image %s: %s" % (imagefile, e))
|
||||
logger.error(u"Tautulli Helpers :: Failed to cache image %s: %s" % (imagefile, e))
|
||||
|
||||
# Try to return the image from the cache directory
|
||||
if os.path.isfile(imagefile):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue