Jump to content

recently added/watched Items - limit api results by time - possible?


Recommended Posts

Hi everyone,

recently I discovered the Emby API and the amazing possibilities that come with it. Running Emby on an Server that is monitored by Telegraf/InfluxDB/Grafana makes it even more useful. I already managed to add Grafana Panels for recently played and added episodes and movies and limited the API results by using Limit=xx. So some panels show me the latest watched and added movies and episodes by name, which is great. Now I would love to get those results for a certain time frame. 

I could (i.e. for added episodes) easily do that by using something like this


which would show me all the Episodes that were ever added. I could simply use Grafana to filter these results (i.e. last 24h, last week, last month, last year). But every API call would return a bunch of data I don't need (everything older than a year). Limiting it by using the Limit=xx option could lead to Grafana not all the necessary data (let's say i set a limit of 1000 but there were 1500 items added last year).

Long story short: Is there a way to limit the API results by time (in my example by DateCreated time)? I googled, I read the API wiki but I couldn't find an answer. Thank you in advance.


edit: I just tried this with one library and no limit...it's too much. A way to limit the results by DateCreated or DatePlayed would be nice.

Edited by JanneKah
Link to post
Share on other sites

minPremiereDate and MaxPremiereDate



Datecreated = date added - not returned by default

Edited by PenkethBoy
Link to post
Share on other sites

@PenkethBoyThank you, but that's not what I'm looking for. I already used the "IsPlayed" "LastDatePlayed" and "DateCreated" options(see the example in my first post for "recently added episodes".

What I would like to do is to not only sort the api results by DatePlayed or DateCreated but also limit them by DatePlayed or DateCreated. If I use MinPremiereDate or MaxPremiereDate it only limits the results by....well, the premiere dates. So if I watch an episode of "The Simpsons" from 1993 today, it would not show up in my api call results when setting the option MinPremiereDate to 2020-04-08. On the other hand, using MaxPremiereDate and setting it to 2020-04-08 it will not show me the latest episode of (let's say) "Superstore" I just watched. Maybe I wasn't clear about that. Let me try again.

I'm doing two regular API calls for (let's say) the Item Episode. One of calls is to get "recently watched" items, one is to get "recently added [to my server]" items. So I use these calls:

for "recently watched"



The result is the last 500 watched Episodes sorted by DatePlayed - almost perfect for my purposes. What I would like to have is an option set the limit not to a number but to a date or even better to a timeframe (i.e. LimitDatePlayed=-1y). Why would I need that? Well, 500 results is more than enough for Telegraf/Influx/Grafana to show a nice graph of all the episodes watched in the last 24h, week, month......but probably not a year. Episodes watched in April 2020 would probably be lost in the api results when using a number limit. Your solution unfortunatly doesn't help solving this problem but cuts out too old or too new episodes.

For "recently added" items I use:



Same here...I get the last 500 added items - and again: almost perfect for my purpose. But if I want to show a 1-year-graph this wouldn't be enough. 500 Episodes are easily added within a year. MinPremiereDate or MaxPremiereDate would also cut results, for example when you add an old show. A limit option like LimitDatePlayed=-1y would be great.


Now you could say: Why don't you just set the limit to 1000 or 2000, hell....make it 5000. And that definitely solves my problem because i'll neither watch nor add that many episodes  in a year and Grafana can filter everything older than a year. I was just wondering if there is a way to avoid API calls with (most certainly) lots of unecessay results that go to an influxdb.

edit: I forgot to say this - what I think would be best about something like "LimitDatePlayed=[set your own timeframe here]" and "LimitDateCreated=[set your own timeframe here]" is that it would be dynamic. I wouldn't have to set some strict limit like a number or a specific date like in "Limit" or "MinPremiereDate".


Edited by JanneKah
Link to post
Share on other sites
5 minutes ago, Luke said:

I guess we'd have to add a mindateadded param and others along those lines.

Thanks for your reply, Luke. So I guess this option isn't available yet (that's why I was asking, I often miss things :) ). MinDateAdded and MinDatePlayed would be very nice to have. 

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...