Jump to content

Extra spaces in episode name being returned from the API


muzicman0

Recommended Posts

muzicman0

Recently (not sure how long), I have been getting extra spaces in the names of episodes being returned from the API.  Below is an example of watched episodes, and what Emby is returning as the info.  '^' is the delimiter in the output:

"Name"^"ServerId"^"Id"^"Path"^"RunTimeTicks"^"IndexNumber"^"ParentIndexNumber"^"IsFolder"^"Type"^"ParentLogoItemId"^"ParentBackdropItemId"^"ParentBackdropImageTags"^"UserData"^"SeriesName"^"SeriesId"^"SeasonId"^"SeriesPrimaryImageTag"^"SeasonName"^"ImageTags"^"BackdropImageTags"^"ParentLogoImageTag"^"ParentThumbItemId"^"ParentThumbImageTag"^"MediaType"^"Width"^"Height"
"Rule 91 "^"xxxxxxxxxxxxxxxxxxxxxxxxxx"^"72399"^"nfs://10.3.0.140/RecordedTV/Recorded TV/NCIS/Season 18/NCIS.S18E16.Rule 91.ts"^"37191872780"^"16"^"18"^"False"^"Episode"^"45690"^"45690"^"System.Object[]"^"@{PlaybackPositionTicks=0; PlayCount=1; IsFavorite=False; LastPlayedDate=2021-05-29T14:28:56.0000000+00:00; Played=True}"^"NCIS"^"45690"^"45693"^"f7492a1793e1dfbcce36d02139b0b45b"^"Season 18"^"@{Primary=69c3ea4512c4cbf22dd3f70cb1cd384a}"^"System.Object[]"^"6c2182ea389b0e5a8a81b877234fbf94"^"45690"^"96d27e4774cb03be14184d532ca6ddc9"^"Video"^"1920"^"1080"
"Family Matters (2)"^"xxxxxxxxxxxxxxxxxxxxxxxxxx"^"72401"^"nfs://10.3.0.140/RecordedTV/Recorded TV/The Flash/Season 07/The Flash.S07E11.Family Matters, Part 2.ts"^"37194758780"^"11"^"7"^"False"^"Episode"^"46000"^"46000"^"System.Object[]"^"@{PlaybackPositionTicks=0; PlayCount=1; IsFavorite=False; LastPlayedDate=2021-05-29T14:28:50.0000000+00:00; Played=True}"^"The Flash (2014)"^"46000"^"46005"^"e465b897a5be181fc8ded717debd2846"^"Season 7"^"@{Primary=6e8cdffe94eced7c096532e9f5b8ec82}"^"System.Object[]"^"abe6fdff60966cac0ce32794175e9f83"^"46000"^"68bbc196075ccad92348f68dbc4873c4"^"Video"^"1920"^"1080"
"Family Matters (1)"^"xxxxxxxxxxxxxxxxxxxxxxxxxx"^"46320"^"nfs://10.3.0.140/RecordedTV/Recorded TV/The Flash/Season 07/The Flash.S07E10.Family Matters, Part 1.ts"^"37196233550"^"10"^"7"^"False"^"Episode"^"46000"^"46000"^"System.Object[]"^"@{PlaybackPositionTicks=0; PlayCount=1; IsFavorite=False; LastPlayedDate=2021-05-29T14:28:50.0000000+00:00; Played=True}"^"The Flash (2014)"^"46000"^"46005"^"e465b897a5be181fc8ded717debd2846"^"Season 7"^"@{Primary=6d3eb5cfd370d9b6d969f283f6a33e9d}"^"System.Object[]"^"abe6fdff60966cac0ce32794175e9f83"^"46000"^"68bbc196075ccad92348f68dbc4873c4"^"Video"^"1920"^"1080"
"Man of Steel"^"xxxxxxxxxxxxxxxxxxxxxxxxxx"^"72400"^"nfs://10.3.0.140/RecordedTV/Recorded TV/Superman & Lois/Season 01/Superman & Lois.S01E07.Man of Steel.ts"^"37205519780"^"7"^"1"^"False"^"Episode"^"46313"^"46313"^"System.Object[]"^"@{PlaybackPositionTicks=0; PlayCount=1; IsFavorite=False; LastPlayedDate=2021-05-29T14:28:47.0000000+00:00; Played=True}"^"Superman & Lois"^"46313"^"46318"^"c34b65102af8d2b54faf180444964c71"^"Season 1"^"@{Primary=7633a51ecab4fadea8ccb8693d439271}"^"System.Object[]"^"a32b68e08702c10ca79b44a502a3a5a5"^"46313"^"937b2ea5baf8f1d5a9932f04916244d9"^"Video"^"1920"^"1080"
" Broken Trust "^"xxxxxxxxxxxxxxxxxxxxxxxxxx"^"46319"^"nfs://10.3.0.140/RecordedTV/Recorded TV/Superman & Lois/Season 01/Superman & Lois.S01E06.Broken Trust.ts"^"35996431670"^"6"^"1"^"False"^"Episode"^"46313"^"46313"^"System.Object[]"^"@{PlaybackPositionTicks=0; PlayCount=1; IsFavorite=False; LastPlayedDate=2021-05-29T14:28:47.0000000+00:00; Played=True}"^"Superman & Lois"^"46313"^"46318"^"c34b65102af8d2b54faf180444964c71"^"Season 1"^"@{Primary=ebe5765368a8baa2161ce992ea172a32}"^"System.Object[]"^"a32b68e08702c10ca79b44a502a3a5a5"^"46313"^"937b2ea5baf8f1d5a9932f04916244d9"^"Video"^"1920"^"1080"

It does not happen on every episode, and does not appear to be series dependent.  But if you look above, you will see "Rule 91 " and " Broken Trust " have extra spaces (either side of the name).

Here is the API request (I left the variables from the script, they should be self explanitory):

$embyServerUrl + "/emby/users/" + $User.User.Id + "/items?Fields=width,height,Path&Recursive=true&IncludeItemTypes=Episode&IsPlayed=True&IsMissing=False&ParentId=dfbd84266bb0ba7ec7c4222ea7441f47&SortBy=IndexNumber&SortOrder=Descending" + "&api_key=" + $User.AccessToken

 

Link to comment
Share on other sites

That must have come from wherever the episode name came from (internet metadata).

Link to comment
Share on other sites

muzicman0

Not sure how I would check that.  Here is a thetvdb.com page: Superman & Lois - Broken Trust - TheTVDB.com.

It appears that is where the info came from (same episode synopsis, etc), but I don't know where the extra spaces would have come from.

Is there any way to confirm that it is coming from that data?  It's not the end of the world, I just edited my script to remove leading and trailing spaces, but it would be nice to know what changed.  Never got this before a few weeks ago.

Link to comment
Share on other sites

Quote

Is there any way to confirm that it is coming from that data?

The database doesn't keep a record of where data come from. To really chase down the source you'd have to reproduce it with a new file and look at the activity that occurred when importing it.

Link to comment
Share on other sites

Happy2Play

TVDB you can see it in the cache folder

example for Rule 91

Quote

<?xml version="1.0" encoding="utf-8"?><Episode><id>8398153</id><Combined_episodenumber>16</Combined_episodenumber><Combined_season>18</Combined_season><DVD_chapter>0</DVD_chapter><DVD_discid></DVD_discid><DVD_episodenumber>16</DVD_episodenumber><DVD_season>18</DVD_season><Director></Director><EpImgFlag></EpImgFlag><EpisodeName>Rule 91 </EpisodeName><EpisodeNumber>16</EpisodeNumber><FirstAired>2021-05-25</FirstAired><GuestStars></GuestStars><IMDB_ID>tt14286674</IMDB_ID><Language>en</Language><Overview>While pursuing a dangerous arms dealer, the team is shocked when Bishop is implicated in an old NSA leak while Gibbs and Marcie realize the killer they've been tracking may be onto them.</Overview><ProductionCode></ProductionCode><Rating>0</Rating><RatingCount>0</RatingCount><SeasonNumber>18</SeasonNumber><Writer></Writer><absolute_number>0</absolute_number><airsafter_season>0</airsafter_season><airsbefore_episode>0</airsbefore_episode><airsbefore_season>0</airsbefore_season><filename></filename><lastupdated>1620477508</lastupdated><seasonid>1873630</seasonid><seriesid>72108</seriesid><thumb_added></thumb_added><thumb_height></thumb_height><thumb_width></thumb_width></Episode>

Broken Trust

Quote

<?xml version="1.0" encoding="utf-8"?><Episode><id>8260624</id><Combined_episodenumber>6</Combined_episodenumber><Combined_season>1</Combined_season><DVD_chapter>0</DVD_chapter><DVD_discid></DVD_discid><DVD_episodenumber>6</DVD_episodenumber><DVD_season>1</DVD_season><Director>|Sudz Sutherland|</Director><EpImgFlag></EpImgFlag><EpisodeName> Broken Trust </EpisodeName><EpisodeNumber>6</EpisodeNumber><FirstAired>2021-05-18</FirstAired><GuestStars></GuestStars><IMDB_ID>tt11949924</IMDB_ID><Language>en</Language><Overview>Clark reconsiders his decision to let Jordan play football. Lois' continued investigation of Morgan Edge requires her to trust an unexpected ally.</Overview><ProductionCode>T13.22406</ProductionCode><Rating>0</Rating><RatingCount>0</RatingCount><SeasonNumber>1</SeasonNumber><Writer>|Katie Aldrin|</Writer><absolute_number>0</absolute_number><airsafter_season>0</airsafter_season><airsbefore_episode>0</airsbefore_episode><airsbefore_season>0</airsbefore_season><filename>v4/episode/8260624/screencap/609192cc843ca.jpg</filename><lastupdated>1619760160</lastupdated><seasonid>1814886</seasonid><seriesid>375655</seriesid><thumb_added>2021-05-04 18:30:36</thumb_added><thumb_height>360</thumb_height><thumb_width>640</thumb_width></Episode>

Edited by Happy2Play
Link to comment
Share on other sites

muzicman0
8 minutes ago, Happy2Play said:

TVDB you can see it in the cache folder

example for Rule 91

Broken Trust

Thanks for looking.  I guess I will just keep filtering it out for now.  I can't think of a reason that deleting a leading or trailing space will hurt my script.

Link to comment
Share on other sites

Happy2Play

Fixed both on TVDB, at least the English translations.

translate1.thumb.jpg.31a9651ca4fb36c2c7d76c08cbe5f450.jpg

Link to comment
Share on other sites

muzicman0

It's been happening on random episodes for a bit.  I first noticed it a week or so ago on an episode of The Equalizer.  

Link to comment
Share on other sites

Happy2Play

Don't know if Luke can normalize these but you could complain to TVDB, but do not know if this is a Legacy api issue or if it happens in v4 also.

 

I know my MCM xml metadata does not contain these extra spaces.

Edited by Happy2Play
added info
Link to comment
Share on other sites

We should normalize all text values that come from internet metadata to prevent this sort of thing, yes. But until then at least we know that it's not caused by Emby.

Link to comment
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...