Jump to content

Series number and episode number


Recommended Posts

plittlefield
Posted

Is there a way to get the series number and episode number from the API when someone is playing content?

I already have this, to get the User, Series Name and Title ...

wget -q -O - "http://localhost:8096/emby/Sessions?api_key=3469e31bbxxxxxxxxxxxxxxxxxxxx" | jq -r -M '.[] | {UserName, SeriesName: .NowPlayingItem.SeriesName, Name: .NowPlayingItem.Name} | select(.Name != null) | {user: .UserName, item: ((if .SeriesName then .SeriesName + " ~ " else "" end) + .Name)} | map(.) | @csv'

... which gives me ...

"Paul","Severance: Goodbye, Mrs. Selvig"

... but would like the 'S2E2' information please.

Thanks,

Paully

Posted

Hi, it should have IndexNumber right?

plittlefield
Posted

Ah, yes ...

  "PlaylistIndex": 1,
    "IndexNumber": 2,
    "ParentIndexNumber": 2,

... so I am guessing that the ParentIndexNumber is the Season and the IndexNumber is the Episode?
 

 

  • Thanks 1
Posted
6 minutes ago, plittlefield said:

Ah, yes ...

  "PlaylistIndex": 1,
    "IndexNumber": 2,
    "ParentIndexNumber": 2,

... so I am guessing that the ParentIndexNumber is the Season and the IndexNumber is the Episode?
 

 

Yes exactly.

  • Like 1
plittlefield
Posted

Great, I will give that a go and report back tomorrow with my edited script 🙂

  • Thanks 1
plittlefield
Posted

Here is the tweaked bash script command line ...

wget -q -O - "http://localhost:8096/emby/Sessions?api_key=xxxxxxxxxxxxxxxxxxx" | jq -r -M '.[] | {UserName, SeriesName: .NowPlayingItem.SeriesName, Name: .NowPlayingItem.Name, Season: .NowPlayingItem.ParentIndexNumber, Episode: .NowPlayingItem.IndexNumber} | select(.Name != null) | {user: .UserName, item: ((if .SeriesName then .SeriesName + " ~ " + "S" + (.Season|tostring) + "E" + (.Episode|tostring) + " ~ " else "" end) + .Name)} | map(.) | @csv'

... which now gives this output ...

"Paul","Severance ~ S2E2 ~ Goodbye, Mrs. Selvig"

🙂

  • Thanks 1

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...