Jump to content

Additional Webhook Triggers


JasonNalley

Recommended Posts

ginjaninja

and my proccessadded task looks like.

 

but perhaps should not worry about task until we get to stage of proving it works manually.e136a913c432df110e346a7998cfda9d.jpg

 

Sent from my SM-G955F using Tapatalk

Link to comment
Share on other sites

JasonNalley

Yep, it works manually, I got it sorted (see the edit in the previous post).  Trying your settings for taskscheduler also fixed that issue.  So now it's completing successfully.

The only other issue that's now coming up is for some reason it's posting episodes individually even though I added them in groups.  Here's a screenshot of my LogMediaAdded.csv:
5eb23e80028e5_LogMediaAddscsv.jpg
And my PostAdded.csv:
5eb23e9a5c453_PostAddedcsv.jpg

Link to comment
Share on other sites

ginjaninja

Yep, it works manually, I got it sorted (see the edit in the previous post). Trying your settings for taskscheduler also fixed that issue. So now it's completing successfully.

 

The only other issue that's now coming up is for some reason it's posting episodes individually even though I added them in groups. Here's a screenshot of my LogMediaAdded.csv:

5eb23e80028e5_LogMediaAddscsv.jpg

And my PostAdded.csv:

5eb23e9a5c453_PostAddedcsv.jpg

goods news so you have done your bit.

 

i will look into episodes not being summarised..i think the whole function needs to be improved and i broke it when moving to 'escaped regular expressions' to deal with special characters in paths.

 

but note by current design multiple eg. episodes are only summarised to eg. season, if their season exists in logmediaadds.csv... processed at the time as the episodes.

edit - in my testing episodes are summarised into season when season is present in queue (logmediaadds.csv)

 

would you suggest any other design?

 

in the mean time for single items, is the structure / content of post to integromat correct?

 

please keep highlighting issues as you find them.

 

edit version 0.0.0.3 updated in earlier post

 

Sent from my SM-G955F using Tapatalk

Edited by ginjaninja
Link to comment
Share on other sites

JasonNalley

Well, %season.number% is given as a parameter for OnMediaItemAdded.  So maybe if the %Item.Name% and the %season.number% match multiple entries that have not been processed, it only posts the season, and if the Item name in the table is associated with multiple season numbers in the table that have not been processed, it just posts the series?  I dunno, it might require a little more information on what gets logged.  I think maybe the "item.productionyear might be important too, with all the remake shows coming out.  But I am not sure.

Link to comment
Share on other sites

ginjaninja

As it turns out, the fields i gave you to put into ScripterX were more than whats was strictly required by logmediaadds.ps1.

The script actually only requires, item.id and item.type and item.path.....all other data (including, season name/number, production year) comes from a lookup of item.id against the database during postadd.ps1

 

i have rechecked and rewritten/tidied/commented the logic to process the queue and find parent objects and i think it is reliably grouping objects, please let me know if you think otherwise.

I have included lots of troubleshooting output, so if you manually run processadd (from an open pwsh.exe), it will show its workings.

 

updated to v0.0.0.4 in earlier post

 

post-165-0-69864300-1588779183_thumb.jpg

Edited by ginjaninja
Link to comment
Share on other sites

JasonNalley

@@ginjaninja Thanks so much for building this, it's pretty awesome, and works wonderfully.  I wonder if maybe (since the constant upgrading means having to constantly go and get the API, Webhook Link, and Server IP) you should include a "Insert information here" spreadsheet.  Where we only have to put the information into it once, and then we don't overwrite it again.  And the script(s) would just reference the fields for said information.  Might make it a little more user friendly.

Link to comment
Share on other sites

ginjaninja

@@ginjaninja Thanks so much for building this, it's pretty awesome, and works wonderfully.  I wonder if maybe (since the constant upgrading means having to constantly go and get the API, Webhook Link, and Server IP) you should include a "Insert information here" spreadsheet.  Where we only have to put the information into it once, and then we don't overwrite it again.  And the script(s) would just reference the fields for said information.  Might make it a little more user friendly.

 

no worries, it was a good learning opportunity and My family are pleased with the android push notifications.

i suspect its not all perfect yet, i am expecting some gremlins as its tested more thoroughly.

 

a Configuration  file to store options is a good idea.

  • Like 1
Link to comment
Share on other sites

JasonNalley

So, it's still choosing to post some episodes as episodes rather than wrap it up in the season/show.  Just happened when I added High School DxD specials.  Funny thing is it labeled them like this: SE04 instead of SE00E04 or Specials E04.  It did the same thing for every episode of Season 02, but it labeled those right and gave the correct trakt link.

Link to comment
Share on other sites

ginjaninja

So, it's still choosing to post some episodes as episodes rather than wrap it up in the season/show.  Just happened when I added High School DxD specials.  Funny thing is it labeled them like this: SE04 instead of SE00E04 or Specials E04.  It did the same thing for every episode of Season 02, but it labeled those right and gave the correct trakt link.

 

thanks, i think there are two issues

1. special season is not being enumerated properly, can fix that...I will just label them S00EXX for now.

2. ? over roll up of episodes to seasons

 

In your season 2 example,

can you confirm

that "Season 2" Type Season was in the logmediaadds.csv (Queue) at the same time as the episodes.(all unprocessed)

(or to put it another way you had just copied the folder "Season 2" (along with its contained episodes) into the library?)

that the the structure of your data is Show\Season XX\Episodes.ext?

 

A copy of the logmediaadds.csv related to the issue would help

Link to comment
Share on other sites

JasonNalley

Here's a screenshot of LogMediaAdds.csv
5eb428dacf6aa_LogMediaAddscsv.jpg

 

and here's PostAdded.csv
5eb428f4033f3_PostAddedcsv.jpg


I did not see a Season 02 type entry in the logs for this batch of Season 02 files, I did however see one for the Earlier Season 02 episodes I added (ie. E01-E06).  It seems it relies on the season folder just being created to create the Season 02 entry.  The problem with that is 2-fold.

1) I transcode media and output all into a single folder.  I move from that folder directly to the library at random intervals (whether my transcode queue is still going or not).  So sometimes I may get all of Season 01, and part of Season 02 when I move them, and then the next go round I get the rest of season 02 and part of season 03, etc.

2) I am constantly upgrading my Library from say HDTV DVR Recordings, or DVDs, to BluRay (that's why I have the tags on the end, to help me keep track of what I need to upgrade).  So if it relies on a Season folder to get created, when I upgrade one of the shows, that season folder is already created a long time ago, and I just replace the episodes in the season folder with the upgraded content.

It wouldn't be so much of an issue if Integromat gave me unlimited actions, but since I am limited to 1,000/month for free, having multi-episode batches wrapped up in Season or series posts would be most beneficial.  If you would prefer a copy of the .csv rather than screenshots, let me know, I'd be more than happy to add that.  I just  figured screenshots may be easier.

Link to comment
Share on other sites

ginjaninja

Here's a screenshot of LogMediaAdds.csv

5eb428dacf6aa_LogMediaAddscsv.jpg

 

and here's PostAdded.csv

5eb428f4033f3_PostAddedcsv.jpg

 

I did not see a Season 02 type entry in the logs for this batch of Season 02 files, I did however see one for the Earlier Season 02 episodes I added (ie. E01-E06). It seems it relies on the season folder just being created to create the Season 02 entry. The problem with that is 2-fold.

 

1) I transcode media and output all into a single folder. I move from that folder directly to the library at random intervals (whether my transcode queue is still going or not). So sometimes I may get all of Season 01, and part of Season 02 when I move them, and then the next go round I get the rest of season 02 and part of season 03, etc.

 

2) I am constantly upgrading my Library from say HDTV DVR Recordings, or DVDs, to BluRay (that's why I have the tags on the end, to help me keep track of what I need to upgrade). So if it relies on a Season folder to get created, when I upgrade one of the shows, that season folder is already created a long time ago, and I just replace the episodes in the season folder with the upgraded content.

 

It wouldn't be so much of an issue if Integromat gave me unlimited actions, but since I am limited to 1,000/month for free, having multi-episode batches wrapped up in Season or series posts would be most beneficial. If you would prefer a copy of the .csv rather than screenshots, let me know, I'd be more than happy to add that. I just figured screenshots may be easier.

ok so currently the script uses the creation of the season folder ..the season event type ...to roll up episodes to season. thats why no season roll up currently..but open to suggestions...

 

how / when would you suggest episodes are rolled up to season...

when more than 1 episode in season is added? at least x episodes added?...

 

or are you saying you want multiple episodes to be grouped together...eg "s01 e01-e04 have been added"

 

i sometimes add two last episodes to an existing season...imo it wouldnt make sense to be told a season has been added in this case. for instance...

 

thinking aloud if an internet api could confirm that all remaining episodes of a season (a big if) a message saying season x completed could make sense...i dont think its available as people have been asking for some time for emby to notify when a season is complete.

 

what did tautulli do out of interest?

 

 

 

 

 

Sent from my SM-G955F using Tapatalk

Link to comment
Share on other sites

JasonNalley

Tautulli, anytime more than one episode was added to a particular season, grouped them as a season add.  And any time multiple seasons were added, grouped them as a series addition.  So it would conserve the number of integromat actions.  Since each post consumes 2 actions (1 for the initial webhook and 1 for the post to facebook).  It also only did it for "new" content being added.  Things that were already in my library and simply being upgraded did not generate a post.  I can live with it posting for upgraded content, but I'd say if at all possible, any time more than one episode per season gets added, or at the very least, any time more than two episodes per season get added, it should count it as a season addition, and the same for seasons, anytime more than one season gets added, it should post it as a series addition.

Link to comment
Share on other sites

ginjaninja

Tautulli, anytime more than one episode was added to a particular season, grouped them as a season add. And any time multiple seasons were added, grouped them as a series addition. So it would conserve the number of integromat actions. Since each post consumes 2 actions (1 for the initial webhook and 1 for the post to facebook). It also only did it for "new" content being added. Things that were already in my library and simply being upgraded did not generate a post. I can live with it posting for upgraded content, but I'd say if at all possible, any time more than one episode per season gets added, or at the very least, any time more than two episodes per season get added, it should count it as a season addition, and the same for seasons, anytime more than one season gets added, it should post it as a series addition.

so adding s01e01 to e04 on monday evening and s01e05 to e08 on tuesday morning would result in two season 1 add notifications....is that what youd expect/want? and when season 01 folder created on sunday (and no episodes) prior you want a season add message?

 

it maybe that the itemupdated events can be used to supress itemadded events....but before that i wonder why scripterx/emby is reporting itemsupdated as adds given there is an itemupdated event specifically.perhaps @@PenkethBoy has a view on that?

 

Sent from my SM-G955F using Tapatalk

Link to comment
Share on other sites

PenkethBoy

not looked into this in detail

 

But what you are not recording is itemremoved/itemupdated as well as itemadded

 

you could get the other two events related to the itemadded as emby can add something then quickly remove it and add it again with new id and then update it!! Scripterx is not reporting updates as additions!

 

but - a better approach is count up you added events over your period - if you have episodes - report you have an updated season, if the episodes cover more than one season - you have two seasons update to report - remember if the season folder already existed and was empty you would not get an added event only an updated one - so you cant hang your hat on that one.

 

if you do get a new season added then irrespective of how many episodes of that season you get - you only report season updated - unless there are no episodes - so you would probably not report that

 

So for me - it would just be about seasons updated - with maybe a special for a series being added - but that might be redundant as season 1 was updated of series xxxx - depends how you want to report it

 

That would keep the reporting to a minimum - and users would know that season1 was updated - do they need to know how many epsiodes - probably not - because as soon as they login in to emby and go to the series it will be obvious which episodes are new as they will be unwatched etc etc 

Edited by PenkethBoy
Link to comment
Share on other sites

JasonNalley

so adding s01e01 to e04 on monday evening and s01e05 to e08 on tuesday morning would result in two season 1 add notifications....is that what youd expect/want? 

 

That's what I'm used to, yeah.  I am open for better ways of doing it, or working to meet somewhere in the middle though.  Typically, (using your example) if I do a partial season addition Monday evening, and then do the rest Tuesday morning, I will just go to facebook and delete the second post it generated.  That is a lot easier to do and manage than deleting 15 individual episodes though :-D and it still saves the amount of actions used up by Integromat.

 

If I look at this from a sheer user perspective, the Tautulli way makes the most sense because it conserves actions, and most people aren't going to want to pay for more actions through Integromat.  However, if I look at it from a functionality/informational point, I completely get where you're coming from too, it does seem a bit absurd to put two episodes togther and call that a "season" addition, because it's not.  The compromise might be to make a post that says "S01E01 - E05" added, and then either use the Trakt link from Episode 05, or use the Trakt link from season 01.  

 

And if you could stop "upgraded" episodes from being posted, that would be awesome.  I think the reason Emby is creating new ID's is because the tags in the filenames change.  Like 'Showname - S01E01 - Episode Name-HDTV-1080p.mkv'  changes to 'Showname - S01E01 - Episode Name-BluRay-1080p.mkv'  This also causes Emby to create a new .nfo file, and download a new Thumbnail for the episode.  I wish this didn't happen, but I think it's the way Emby's database works vs the way Plex's Database works.  Plex assigns an Item ID based solely on the Show Season Episode, and not the file.  Therefore, if a new file matches that same Show Season Episode, it gets nested under the same item ID.  I don't think that's the same for Emby, though I could be mistaken.

Edited by JasonNalley
Link to comment
Share on other sites

PenkethBoy

emby keeps the providerid - i.e. tvdb id - for watched status etc but does not track and db ID's

 

a file with the same name - does not generate a new db ID - IIRC

 

but as you are adding and taking away a file because the names are different (as Emby sees it) thats why an itemadded event is created when you add the bluray version

Link to comment
Share on other sites

JasonNalley

You put it better than I did, but that's what I was getting at.  It's generating a new DB ID because the filename is changing, and the old file is being removed.  I don't believe Plex does this, it uses a unique ID (Unsure if it's self generated by plex or if it uses the Provider ID like tvdb or moviedb) and nests any others that match the provider ID underneath the single Database entry.  Even if I remove and add and change the filenames, as long as it picks up as a match from the provider, it stays where it is and doesn't show up on the front page as a recently added item regardless of its watched status.

Edited by JasonNalley
Link to comment
Share on other sites

PenkethBoy

yep emby is different - but the ninja should be able to cover that in his script if he logs itemremoved as well and matches by say season and episode number as the remove should be close in time to the "re" itemadded

  • Like 1
Link to comment
Share on other sites

ginjaninja

So for me - it would just be about seasons updated

 

 

 

The compromise might be to make a post that says "S01E01 - E05" added, and then either use the Trakt link from Episode 05, or use the Trakt link from season 01.  

 

 

thanks for feedback.

 

For single episodes i do like the reference and link to the specific episode (most of my changes of interest are this and a new season added..although what i really want is season completed/ready to watch - but that is a can of worms)

For multiple episodes added, i see merit in both season updated or Episode Range Added, i like that range carries more information

For range link, i think i would be more interested in 1st episode than last, but perhaps season link is the easier answer.

 

Initially i will amend the logger so it captures all added,updated,removed events so we can see what we have to work with and code to that.

then will ask you Jason, to do some of that upgrade activity and post the results.

Depending on how it looks i may be able to turn multiple episodes into a single range post before tackling the update integration.

 

edit - in mean time have posted an update for specials and a config file.

Edited by ginjaninja
Link to comment
Share on other sites

JasonNalley

Range link being first episode of the range vs last of the range doesn't matter to me :)  I just picked one when I posted heh.  

If you want, you can DM me your facebook url and I can friend you and add you to the group, so that you can monitor the progress for yourself.

Link to comment
Share on other sites

JasonNalley

@@ginjaninja have you already implemented the logic that disregards upgraded files?  If you have,  it seems to be working.  If you have not, then I think something is broken in the new script(s).  I added about 10 BluRay copies of movies (ones that were already in my library) about an hour ago.  They didn't get logged in any of the .csv files, and did not post to facebook.

I will try adding some new content here in a bit, and see if it's still posting new content.  But I just wanted to get this out here while it was on my mind...


Edit:  Nevermind, it would seem maybe it only needed an Emby restart, my Emby was hung up not wanting to scan the libraries...  The movies posted almost immediately after that.

However, 3 of the TV Episodes that just got added also got added a bit awkward.  it seems they all somehow got labeled as S00 when being posted to facebook, despite them having S03, S01, and S02, in their filenames.  This was the output message posted to facebook for one of the items:
 

Added to TV: 
Legends of the Wild - S00E - Legends of the Wild - S01E06 - Executioner of the Andes-WEBRip-720p

As you can see, it has the correct S01E06 in the filename, and it somehow kept the tag. in the post message.  Any ideas?
Edited by JasonNalley
Link to comment
Share on other sites

ginjaninja

 

@@ginjaninja have you already implemented the logic that disregards upgraded files?  If you have,  it seems to be working.  If you have not, then I think something is broken in the new script(s).  I added about 10 BluRay copies of movies (ones that were already in my library) about an hour ago.  They didn't get logged in any of the .csv files, and did not post to facebook.

 

I will try adding some new content here in a bit, and see if it's still posting new content.  But I just wanted to get this out here while it was on my mind...

 

 

Edit:  Nevermind, it would seem maybe it only needed an Emby restart, my Emby was hung up not wanting to scan the libraries...  The movies posted almost immediately after that.

 

However, 3 of the TV Episodes that just got added also got added a bit awkward.  it seems they all somehow got labeled as S00 when being posted to facebook, despite them having S03, S01, and S02, in their filenames.  This was the output message posted to facebook for one of the items:

 

Added to TV: 
Legends of the Wild - S00E - Legends of the Wild - S01E06 - Executioner of the Andes-WEBRip-720p

 

As you can see, it has the correct S01E06 in the filename, and it somehow kept the tag. in the post message.  Any ideas?

 

 

Posted 0.0.0.6

Havent done upgrade functionality yet. 

Think 0.0.0.5 was busted, have since learnt i had made a mistake on some functions should be sorted in 0.0.0.6, although cant readily account for S01E06 showing up S00E (spitballing that perhaps emby had not analysed/populated file data yet..related to cause of need to reboot maybe)

Episode Numbers do not come from the filename name, they come from the database, which should match if the files have been detected properly in metadata editor.

The ultimate check is use the api option on the dashboard and try out the /Items api endpoint in swagger with the id in question. maybe a transitory issue suggest try with 0.0.0.6.

To match script... In swagger...set fields to: ProviderIds,ParentId,ItemType,Path,ProductionYear...and IDs to the ID

Eventually Anthony wants swagger to export all meaning full data directly, so a query via the api will become redundant - but at the moment its required still i believe eg for library name.

 

the hung emby 'could be a stuck mutex', i have included a test script which you can run when ever and leave running....it should return true most of time...unless a real script is doing something...if it returns false all the time...its because the scripts have not disposed of the mutex properly on exit (or crash even ) and i need to improve the code, let me know. Alternative it might just of been emby.

 

next stage is to improve the logger to log all the added,updated,removed events into 1 file and see what info that provides the scripts to work with.

Edited by ginjaninja
  • Like 1
Link to comment
Share on other sites

JasonNalley

Upgraded to 0.0.0.6, will keep you posted.  Config file working beautifully heh.  I don't have to re-enter data every time :-D

Link to comment
Share on other sites

ginjaninja

Upgraded to 0.0.0.6, will keep you posted.  Config file working beautifully heh.  I don't have to re-enter data every time :-D

 

it will get better as the configuration options settles i guess. There was typo in ProcessAdds.PS1, wont affect functionality just a false error in console.will update 0.0.0.6...

 

will highlight the changes so you can copy options accross rather then reenter everything

 

 

should have said, there is now quite a lot of troubleshooting output in processadds.ps1, it gives a running commentary on its analysis of the queue, related items, siblings, post...worth running manually rather than scheduled task when troubleshooting so you can see the output.

 

 

 

Edit found a bug 0.0.0.6  items with no siblings are still being turned into ranges

Season 01-01

Episode S04E06-06

 

should have said generally for now it is important to delete csv files between versions as new fields are being introduced.

Edit - posted 0.0.0.7 fix for above.

Edited by ginjaninja
Link to comment
Share on other sites

ginjaninja

oh @#%$"£ the options are not coming into effect... Siblings and Post are always on.....looking into

 

posted 0.0.0.7fix...

 

was fixed but not 'properly'

next release will make them true boolean values $true or $false

Edited by ginjaninja
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...