More rename, more -python2
This commit is contained in:
@@ -15,26 +15,15 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Tautulli. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from __future__ import unicode_literals
|
||||
from future.builtins import str
|
||||
from future.builtins import range
|
||||
from future.builtins import object
|
||||
|
||||
import datetime
|
||||
|
||||
import jellypy
|
||||
if jellypy.PYTHON2:
|
||||
import common
|
||||
import database
|
||||
import logger
|
||||
import libraries
|
||||
import session
|
||||
else:
|
||||
from jellypy import common
|
||||
from jellypy import database
|
||||
from jellypy import logger
|
||||
from jellypy import libraries
|
||||
from jellypy import session
|
||||
|
||||
from jellypy import common
|
||||
from jellypy import database
|
||||
from jellypy import logger
|
||||
from jellypy import libraries
|
||||
from jellypy import session
|
||||
|
||||
|
||||
class Graphs(object):
|
||||
@@ -224,7 +213,8 @@ class Graphs(object):
|
||||
|
||||
result = monitor_db.select(query)
|
||||
except Exception as e:
|
||||
logger.warn("Tautulli Graphs :: Unable to execute database query for get_total_plays_per_dayofweek: %s." % e)
|
||||
logger.warn(
|
||||
"Tautulli Graphs :: Unable to execute database query for get_total_plays_per_dayofweek: %s." % e)
|
||||
return None
|
||||
|
||||
if jellypy.CONFIG.WEEK_START_MONDAY:
|
||||
@@ -339,7 +329,8 @@ class Graphs(object):
|
||||
|
||||
result = monitor_db.select(query)
|
||||
except Exception as e:
|
||||
logger.warn("Tautulli Graphs :: Unable to execute database query for get_total_plays_per_hourofday: %s." % e)
|
||||
logger.warn(
|
||||
"Tautulli Graphs :: Unable to execute database query for get_total_plays_per_hourofday: %s." % e)
|
||||
return None
|
||||
|
||||
hours_list = ['00', '01', '02', '03', '04', '05',
|
||||
@@ -460,11 +451,11 @@ class Graphs(object):
|
||||
dt_today = datetime.date.today()
|
||||
dt = dt_today
|
||||
month_range = [dt]
|
||||
for n in range(int(time_range)-1):
|
||||
if not ((dt_today.month-n) % 12)-1:
|
||||
dt = datetime.date(dt.year-1, 12, 1)
|
||||
for n in range(int(time_range) - 1):
|
||||
if not ((dt_today.month - n) % 12) - 1:
|
||||
dt = datetime.date(dt.year - 1, 12, 1)
|
||||
else:
|
||||
dt = datetime.date(dt.year, dt.month-1, 1)
|
||||
dt = datetime.date(dt.year, dt.month - 1, 1)
|
||||
month_range.append(dt)
|
||||
|
||||
categories = []
|
||||
@@ -578,7 +569,8 @@ class Graphs(object):
|
||||
|
||||
result = monitor_db.select(query)
|
||||
except Exception as e:
|
||||
logger.warn("Tautulli Graphs :: Unable to execute database query for get_total_plays_by_top_10_platforms: %s." % e)
|
||||
logger.warn(
|
||||
"Tautulli Graphs :: Unable to execute database query for get_total_plays_by_top_10_platforms: %s." % e)
|
||||
return None
|
||||
|
||||
categories = []
|
||||
@@ -682,7 +674,8 @@ class Graphs(object):
|
||||
|
||||
result = monitor_db.select(query)
|
||||
except Exception as e:
|
||||
logger.warn("Tautulli Graphs :: Unable to execute database query for get_total_plays_by_top_10_users: %s." % e)
|
||||
logger.warn(
|
||||
"Tautulli Graphs :: Unable to execute database query for get_total_plays_by_top_10_users: %s." % e)
|
||||
return None
|
||||
|
||||
categories = []
|
||||
@@ -787,7 +780,8 @@ class Graphs(object):
|
||||
|
||||
result = monitor_db.select(query)
|
||||
except Exception as e:
|
||||
logger.warn("Tautulli Graphs :: Unable to execute database query for get_total_plays_per_stream_type: %s." % e)
|
||||
logger.warn(
|
||||
"Tautulli Graphs :: Unable to execute database query for get_total_plays_per_stream_type: %s." % e)
|
||||
return None
|
||||
|
||||
# create our date range as some days may not have any data
|
||||
@@ -893,7 +887,8 @@ class Graphs(object):
|
||||
|
||||
result = monitor_db.select(query)
|
||||
except Exception as e:
|
||||
logger.warn("Tautulli Graphs :: Unable to execute database query for get_total_plays_by_source_resolution: %s." % e)
|
||||
logger.warn(
|
||||
"Tautulli Graphs :: Unable to execute database query for get_total_plays_by_source_resolution: %s." % e)
|
||||
return None
|
||||
|
||||
categories = []
|
||||
@@ -954,7 +949,7 @@ class Graphs(object):
|
||||
'THEN 1 ELSE 0 END) AS dp_count, ' \
|
||||
'SUM(CASE WHEN session_history_media_info.transcode_decision = "copy" ' \
|
||||
'THEN 1 ELSE 0 END) AS ds_count, ' \
|
||||
'SUM(CASE WHEN session_history_media_info.transcode_decision = "transcode" '\
|
||||
'SUM(CASE WHEN session_history_media_info.transcode_decision = "transcode" ' \
|
||||
'THEN 1 ELSE 0 END) AS tc_count, ' \
|
||||
'COUNT(session_history.id) AS total_count ' \
|
||||
'FROM (SELECT * FROM session_history GROUP BY %s) AS session_history ' \
|
||||
@@ -1003,7 +998,8 @@ class Graphs(object):
|
||||
|
||||
result = monitor_db.select(query)
|
||||
except Exception as e:
|
||||
logger.warn("Tautulli Graphs :: Unable to execute database query for get_total_plays_by_stream_resolution: %s." % e)
|
||||
logger.warn(
|
||||
"Tautulli Graphs :: Unable to execute database query for get_total_plays_by_stream_resolution: %s." % e)
|
||||
return None
|
||||
|
||||
categories = []
|
||||
@@ -1092,7 +1088,8 @@ class Graphs(object):
|
||||
|
||||
result = monitor_db.select(query)
|
||||
except Exception as e:
|
||||
logger.warn("Tautulli Graphs :: Unable to execute database query for get_stream_type_by_top_10_platforms: %s." % e)
|
||||
logger.warn(
|
||||
"Tautulli Graphs :: Unable to execute database query for get_stream_type_by_top_10_platforms: %s." % e)
|
||||
return None
|
||||
|
||||
categories = []
|
||||
@@ -1190,7 +1187,8 @@ class Graphs(object):
|
||||
|
||||
result = monitor_db.select(query)
|
||||
except Exception as e:
|
||||
logger.warn("Tautulli Graphs :: Unable to execute database query for get_stream_type_by_top_10_users: %s." % e)
|
||||
logger.warn(
|
||||
"Tautulli Graphs :: Unable to execute database query for get_stream_type_by_top_10_users: %s." % e)
|
||||
return None
|
||||
|
||||
categories = []
|
||||
|
Reference in New Issue
Block a user