<%doc> USAGE DOCUMENTATION :: PLEASE LEAVE THIS AT THE TOP OF THIS FILE For Mako templating syntax documentation please visit: http://docs.makotemplates.org/en/latest/ Filename: home_stats.html Version: 0.1 Variable names: data [array] data[array_index] :: Usable parameters data['stat_id'] Returns the name of the stat. Either 'top_tv', 'popular_tv', 'top_user' or 'top_platform' data['rows'] Returns an array containing stat data data[array_index]['rows'] :: Usable parameters row_id Return the db row id for a metadata item if one exists == Only if 'stat_id' is 'top_tv' or 'popular_tv' == grandparent_thumb Returns location of the item's thumbnail. Use with pms_image_proxy. rating_key Returns the unique identifier for the media item. title Returns the title for the associated stat. == Only if 'stat_id' is 'top_tv' or 'top_user' or 'top_platform' == total_plays Returns the count for the associated stat. == Only of 'stat_id' is 'popular_tv' == users_watched Returns the count for the associated stat. == Only if 'stat_id' is 'top_user' == thumb Returns url of the user's gravatar. Returns '' if none exists. user Returns the username for the associated stat. user_id Returns the user id for the associated stat. friendly_name Returns the friendly name of the user for the associated stat. == Only if 'stat_id' is 'top_platform' == platform_type Returns the platform name for the associated stat. DOCUMENTATION :: END % if data: % if data[0]['rows'] or data[2]['rows']:

% for a in data: % if a['stat_id'] == 'top_tv' and a['rows']:
- % if a['rows'][0]['grandparent_thumb']: % else: % endif

  #### Most Watched TV

  ##### ${a['rows'][0]['title']}

  ### ${a['rows'][0]['total_plays']}

  plays

% elif a['stat_id'] == 'popular_tv' and a['rows']:
- % if a['rows'][0]['grandparent_thumb'] != '': % else: % endif

  #### Most Popular TV

  ##### ${a['rows'][0]['title']}

  ### ${a['rows'][0]['users_watched']}

  users

% elif a['stat_id'] == 'top_users' and a['rows']:
- % if a['rows'][0]['user_id']: % else: % endif % if a['rows'][0]['thumb'] != '': % else: % endif

  #### Most Active User

  ##### % if a['rows'][0]['user_id']: % else: % endif ${a['rows'][0]['friendly_name']}

  ### ${a['rows'][0]['total_plays']}

  plays

% elif a['stat_id'] == 'top_platforms' and a['rows']:

- #### Most Active Platform

  ##### ${a['rows'][0]['platform_type']}

  ### ${a['rows'][0]['total_plays']}

  plays

% endif % endfor

% else:
No stats for selected period.
% endif % else:
Unable to retrieve data from database. Please check your settings.
% endif