Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Organizr doesn't like missing rating_key from Tautulli #1799

Open
colmconn opened this issue Feb 26, 2022 · 5 comments
Open

Organizr doesn't like missing rating_key from Tautulli #1799

colmconn opened this issue Feb 26, 2022 · 5 comments

Comments

@colmconn
Copy link

colmconn commented Feb 26, 2022

Organizr Version: V2.1.1140
Branch: Master
WebServer: Nginx 1.18.0-6.1 + PHP 7.4.28-1+deb11u1
Operating System: Raspbian GNU/Linux 11 (bullseye)

Problem Description:

I have a new install of plex with very few if any plays. I've also got tautulli (v2.9.4) installed and pointed at the same plex server (1.25.6.5577). I've tried to add tautulli to the organizr homepage but its section does not show up. The API connection between Organizr and tautulli tests successfully in the homepage item tautulli configuration dialog.

When reload organizr, my nginx error log is contains errors such as the following:

2022/02/23 10:15:28 [error] 758#758: *371 FastCGI sent in stderr:
".php on line 181PHP message: PHP Notice: Undefined index: rating_key
in /var/www/websites/kryten/api/homepage/tautulli.php on line 182PHP
message: PHP Notice: Undefined index: rating_key in
/var/www/websites/kryten/api/homepage/tautulli.php on line 179PHP
message: PHP Notice: Undefined index: rating_key in
/var/www/websites/kryten/api/homepage/tautulli.php on line 179PHP
message: PHP Notice: Undefined index: rating_key in
/var/www/websites/kryten/api/homepage/tautulli.php on line 180PHP
message: PHP Notice: Undefined index: rating_key in
/var/www/websites/kryten/api/homepage/tautulli.php on line 180PHP
message: PHP Notice: Undefined index: rating_key in
/var/www/websites/kryten/api/homepage/tautulli.php on line 181PHP
message: PHP Notice: Undefined index: rating_key in
/var/www/websites/kryten/api/homepage/tautulli.php on line 182PHP
message: PHP Notice: Undefined index: rating_key in
/var/www/websites/kryten/api/homepage/tautulli.php on line 179PHP
message: PHP Notice: Undefined index: rating_key in
/var/www/websites/kryten/api/homepage/tautulli.php on line 179PHP
message: PHP Notice: Undefined index: rating_key in
/var/www/websites/kryten/api/homepage/tautulli.php on line 180PHP
message: PHP Notice: Undefined index: rating_key in
/var/www/websites/kryten/api/homepage/tautulli.php on line 180PHP
message: PHP Notice: Undefined index: rating_key in
/var/www/websites/kryten/api/homepage/tautulli.php on line 181PHP
message: PHP Notice: Undefined index: rating_key in
/var/www/websites/kryten/api/homepage/tautulli.php on line 182PHP
message: PHP Notice: Undefined index: platform_name in
/var/www/websites/kryten/api/homepage/tautulli.php on line 187PHP
message: PHP Notice: Trying to access array offset on value of type
null in /var/www/websites/kryten/api/homepage/tautulli.php on line
196PHP message: PHP Notice: Trying to access array offset on value of
type null in /var/www/websites/kryten/api/homepage/tautulli.php on
line 196PHP messa

Calling the homestats URL (as in api/homepage/tautulli.php:159) from within the browser results in the following JSON returned:

http://myhost:8181/api/v2?apikey=REDACTED&cmd=get_home_stats&grouping=1

{
  "response": {
    "result": "success",
    "message": null,
    "data": [
      {
        "stat_id": "top_movies",
        "stat_type": "total_plays",
        "stat_title": "Most Watched Movies",
        "rows": [
          {
            "title": "Venom",
            "year": 2018,
            "total_plays": 1,
            "total_duration": 6355,
            "users_watched": "",
            "rating_key": 4885,
            "grandparent_rating_key": "",
            "last_play": 1644088100,
            "grandparent_thumb": "",
            "thumb": "/library/metadata/4885/thumb/1642806672",
            "art": "/library/metadata/4885/art/1642806672",
            "section_id": 2,
            "media_type": "movie",
            "content_rating": "PG-13",
            "labels": [],
            "user": "",
            "friendly_name": "",
            "platform": "",
            "live": 0,
            "guid": "plex://movie/5d776b95fb0d55001f56c2d0",
            "row_id": 6
          }
        ]
      },
      {
        "stat_id": "popular_movies",
        "stat_title": "Most Popular Movies",
        "rows": [
          {
            "title": "Venom",
            "year": 2018,
            "users_watched": 1,
            "rating_key": 4885,
            "grandparent_rating_key": "",
            "last_play": 1644088100,
            "total_plays": 1,
            "grandparent_thumb": "",
            "thumb": "/library/metadata/4885/thumb/1642806672",
            "art": "/library/metadata/4885/art/1642806672",
            "section_id": 2,
            "media_type": "movie",
            "content_rating": "PG-13",
            "labels": [],
            "user": "",
            "friendly_name": "",
            "platform": "",
            "live": 0,
            "guid": "plex://movie/5d776b95fb0d55001f56c2d0",
            "row_id": 6
          }
        ]
      },
      {
        "stat_id": "top_tv",
        "stat_type": "total_plays",
        "stat_title": "Most Watched TV Shows",
        "rows": []
      },
      {
        "stat_id": "popular_tv",
        "stat_title": "Most Popular TV Shows",
        "rows": []
      },
      {
        "stat_id": "top_music",
        "stat_type": "total_plays",
        "stat_title": "Most Played Artists",
        "rows": []
      },
      {
        "stat_id": "popular_music",
        "stat_title": "Most Popular Artists",
        "rows": []
      },
      {
        "stat_id": "last_watched",
        "stat_title": "Recently Watched",
        "rows": [
          {
            "row_id": 6,
            "user": "colmconn",
            "friendly_name": "colmconn",
            "user_id": 5731867,
            "user_thumb": "https://plex.tv/users/31492b46b38dbde0/avatar?c=1611498255",
            "title": "Venom",
            "grandparent_title": "",
            "grandchild_title": "Venom",
            "year": 2018,
            "media_index": "",
            "parent_media_index": "",
            "rating_key": 4885,
            "grandparent_rating_key": "",
            "thumb": "/library/metadata/4885/thumb/1642806672",
            "grandparent_thumb": "",
            "art": "/library/metadata/4885/art/1642806672",
            "section_id": 2,
            "media_type": "movie",
            "content_rating": "PG-13",
            "labels": [],
            "last_watch": 1644088100,
            "live": 0,
            "guid": "plex://movie/5d776b95fb0d55001f56c2d0",
            "player": "SHIELD Android TV"
          }
        ]
      },
      {
        "stat_id": "top_libraries",
        "stat_type": "total_plays",
        "stat_title": "Most Active Libraries",
        "rows": [
          {
            "total_plays": 1,
            "total_duration": 6355,
            "section_type": "movie",
            "section_name": "HD Movies",
            "section_id": 2,
            "last_play": 1644088100,
            "thumb": "/:/resources/movie.png",
            "grandparent_thumb": "",
            "art": "/:/resources/movie-fanart.jpg",
            "user": "",
            "friendly_name": "",
            "users_watched": "",
            "rating_key": "",
            "grandparent_rating_key": "",
            "title": "",
            "platform": "",
            "row_id": ""
          }
        ]
      },
      {
        "stat_id": "top_users",
        "stat_type": "total_plays",
        "stat_title": "Most Active Users",
        "rows": [
          {
            "user": "colmconn",
            "user_id": 5731867,
            "friendly_name": "colmconn",
            "total_plays": 1,
            "total_duration": 6355,
            "last_play": 1644088100,
            "user_thumb": "https://plex.tv/users/31492b46b38dbde0/avatar?c=1611498255",
            "grandparent_thumb": "",
            "art": "",
            "users_watched": "",
            "rating_key": "",
            "grandparent_rating_key": "",
            "title": "",
            "platform": "",
            "row_id": ""
          }
        ]
      },
      {
        "stat_id": "top_platforms",
        "stat_type": "total_plays",
        "stat_title": "Most Active Platforms",
        "rows": [
          {
            "total_plays": 1,
            "total_duration": 6355,
            "last_play": 1644088100,
            "platform": "Android",
            "platform_name": "android",
            "title": "",
            "thumb": "",
            "grandparent_thumb": "",
            "art": "",
            "users_watched": "",
            "rating_key": "",
            "grandparent_rating_key": "",
            "user": "",
            "friendly_name": "",
            "row_id": ""
          }
        ]
      },
      {
        "stat_id": "most_concurrent",
        "stat_title": "Most Concurrent Streams",
        "rows": [
          {
            "title": "Concurrent Streams",
            "count": 1,
            "started": "1644088100",
            "stopped": "1644094964"
          },
          {
            "title": "Concurrent Direct Plays",
            "count": 1,
            "started": "1644088100",
            "stopped": "1644094964"
          }
        ]
      }
    ]
  }
}

It would be great if Organizr could be a little more robust to a


Reproduction Steps:

See above.


Errors on screen? If so paste here:


@causefx
Copy link
Owner

causefx commented Feb 26, 2022

please try dev commit.

@colmconn
Copy link
Author

colmconn commented Feb 26, 2022

That patch is not applying for me:

$ git pull
remote: Enumerating objects: 84, done.
remote: Counting objects: 100% (84/84), done.
remote: Compressing objects: 100% (23/23), done.
remote: Total 61 (delta 46), reused 52 (delta 37), pack-reused 0
Unpacking objects: 100% (61/61), 6.11 KiB | 149.00 KiB/s, done.
From https://github.com/causefx/Organizr
   8f1a21ab..048ad9b2  v2-develop -> origin/v2-develop
Already up to date.

$ curl -o tautulli_homepage.patch https://github.com/causefx/Organizr/commit/423f3847d1181a03c68155941f273087a2027e45.patch

patch -p1 < tautulli_homepage.patch 
patching file api/homepage/tautulli.php
Hunk #1 FAILED at 179.
1 out of 1 hunk FAILED -- saving rejects to file api/homepage/tautulli.php.rej

Do I need to change branches first?

@causefx
Copy link
Owner

causefx commented Feb 26, 2022

yes. it's on the dev branch... native install or docker?

@colmconn
Copy link
Author

colmconn commented Feb 27, 2022

Native.

To ensure I was on the correct branch, I blew my install away and started again.

sudo git clone https://github.com/causefx/Organizr.git
cd Organizr/
sudo git checkout v2-develop
sudo chown -R www-data:www-data  Organizr/

Then went through the config wizard and set up things again. Went smoothly. I also set the branch to v2-develop in setting -> about -> information to stop it wanting to 'upgrade' to the last stable version.

Unfortunately, tautulli still does not show up on the homepage. New errors are logged in error.log as follows:

2022/02/27 12:08:48 [error] 11788#11788: *6916 FastCGI sent in stderr:
" Notice: Trying to access array offset on value of type null in
/var/www/websites/Organizr/api/homepage/tautulli.php on line 192PHP
message: PHP Warning: count(): Parameter must be an array or an object
that implements Countable in
/var/www/websites/Organizr/api/homepage/tautulli.php on line 192PHP
message: PHP Notice: Trying to access array offset on value of type
null in /var/www/websites/Organizr/api/homepage/tautulli.php on line
204PHP message: PHP Notice: Trying to access array offset on value of
type null in /var/www/websites/Organizr/api/homepage/tautulli.php on
line 204PHP message: PHP Notice: Trying to access array offset on
value of type null in
/var/www/websites/Organizr/api/homepage/tautulli.php on line 204PHP
message: PHP Warning: Invalid argument supplied for foreach() in
/var/www/websites/Organizr/api/homepage/tautulli.php on line 204PHP
message: PHP Notice: Trying to access array offset on value of type
null in /var/www/websites/Organizr/api/homepage/tautulli.php on line
211PHP message: PHP Notice: Trying to access array offset on value of
type null in /var/www/websites/Organizr/api/homepage/tautulli.php on
line 211PHP message: PHP Notice: Trying to access array offset on
value of type null in
/var/www/websites/Organizr/api/homepage/tautulli.php on line 211PHP
message: PHP Warning: array_values() expects parameter 1 to be array,
null given in /var/www/websites/Organizr/api/homepage/tautulli.php on
line 211PHP message: PHP Warning: array_column() expects parameter 1
to be array, null given in
/var/www/websites/Organizr/api/homepage/tautulli.php on line 252PHP
message: PHP Warning: array_search() expects parameter 2 to be array,
null given in /var/www/websites/Organizr/api/homepage/tautulli.php on
line 252PHP message: PHP Warning: array_column() expects parameter 1
to be array, null given in
/var/www/websites/Organizr/api/homepage/tautulli.php on line 252PHP
message: PHP Warning: array_search() expects parameter 2

@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants