zSeriesGuy / Tautulli

A Python based monitoring and tracking tool for Plex Media Server.
http://tautulli.com
GNU General Public License v3.0
27 stars 9 forks source link

Newsletter Errror: Cant locate template for uri 'recently_added.html' #9

Closed prinzpi closed 5 years ago

prinzpi commented 5 years ago

Reporting Issues: I have upgraded from the offical Tautulli version to the 3.0.0.0 version for using multiple servers. Now I'm facing an issue regarding the newsletter, no matter if I'm using an imported newsletter (backup of the master branch) or creating a new newsletter. If I'm checking the preview of the newsletter there will displayed followoing error message:

Error ! TopLevelLookupException: Cant locate template for uri 'recently_added.html' return self._load(srcfile, uri) else: raise exceptions.TopLevelLookupException( "Cant locate template for uri %r" % uri) def adjust_uri(self, uri, relativeto): """Adjust the given ``uri`` based on the given relative URI.""" key = (uri, relativeto) /opt/Tautulli/lib/mako/lookup.py, line 248: "Cant locate template for uri %r" % uri) /opt/Tautulli/plexpy/newsletters.py, line 308: template = _hplookup.get_template(templatename)

Version: 3.0.0.0

Operating system: Ubuntu 16.04.5

Do you may have a workaround for this issue? Thanks and thanks again for your work regarding the multiple server support, just awesome.

Regards.

zSeriesGuy commented 5 years ago

The default location for the newsletter template is /opt/Tautulli/data/interfaces/newsletters/recently_added.html. Are you using the default or do you have something specified in Settings->Notifications and Newsletters->Custom Newsletters Templates Folder? Do both recently_added.html and recently_added.internal.html exist in that folder?

The newsletter works for me. So we have to figure out what's different with your setup. I haven't seen this issue before.

prinzpi commented 5 years ago

Missed that I was using a custom template on the master branch. I have now added again my custom template (now it will be found again) which I was also using on the master branch, but now I'm receiving a "KeyError: 'pms_web_url'" error message. Do you may have a idea why this PMS_web_url issue is occuring?

Thanks.

The error message in detail:

Error ! KeyError: 'pms_web_url' <tbody> <tr> <td style="font-family: 'Open Sans', Helvetica, Arial, sans-serif;font-size: 14px;vertical-align: top;"> <a href="${parameters['pms_web_url']}#!/server/${parameters['pms_identifier']}/details?key=%2Flibrary%2Fmetadata%2F${movie['rating_key']}" title="${movie['title']}" target="_blank" style="text-decoration: underline;"> <img class="card-poster-overlay" src="${base_url_image + 'images/newsletter/view-on-plex-poster.png' if base_url_image else 'http://tautulli.com/images/newsletter/view-on-plex-poster.png'}" width="150" height="225" style="border: none;-ms-interpolation-mode: bicubic;max-width: 100%;display: block;"> </a> </td> </tr> </tbody> /opt/Tautulli/custom_newsletter/recently_added.html, line 683: <a href="${parameters['pms_web_url']}#!/server/${parameters['pms_identifier']}/details?key=%2Flibrary%2Fmetadata%2F${movie['rating_key']}" title="${movie['title']}" target="_blank" style="text-decoration: underline;"> /opt/Tautulli/lib/mako/runtime.py, line 860: callable_(context, *args, **kwargs) /opt/Tautulli/lib/mako/runtime.py, line 835: _exec_template(inherit, lclcontext, args=args, kwargs=kwargs) /opt/Tautulli/lib/mako/runtime.py, line 803: **_kwargs_for_callable(callable_, data)) /opt/Tautulli/lib/mako/template.py, line 443: return runtime._render(self, self.callable_, args, data) /opt/Tautulli/plexpy/newsletters.py, line 309: return template.render(**kwargs), False

zSeriesGuy commented 5 years ago

To support multiple plex servers, I had to make changes to the newsletter template. PMS_WEB_URL is not used in that template anymore. You will have to rebuild your custom template using the updated recently_added template. Sorry about that.

prinzpi commented 5 years ago

No worry about that, thanks for the information and keep up the great work.