Jump to content

Script: Post Media Additions to Web Hook


ginjaninja

Recommended Posts

JasonNalley

Hmm, since I Made the change to use Complete instead of the normal MediaAdded, it hasn't posted anything, including 6 new movies that were not  upgrades or TV shows.  I followed and copied/pasted from the installation post in this thread.

 

ScripterX Config
Event-OnMediaItemAddedComplete
Interpreter:

pwsh.exe
Script File:

-File "C:\Example\LogMediaAdds.ps1"
Parameters:

-EventType "onMediaItemAdded" -Type "%item.type%" -Name "%item.name%" -ID "%item.id%" -Path "%item.path%" -SeriesName "%series.name%" -SeasonName "%season.name%" -SeasonNumber "%season.number%" -EpisodeNumber "%episode.number%" -LibName "%item.library.name%" -IsVirtual "%item.isvirtual%" -SeriesID "%series.id%"

Could be be that the -EventType is supposed to be -EventType "OnMediaItemAddedComplete" instead of just "OnMediaItemAdded" ?

Link to comment
Share on other sites

ginjaninja
14 hours ago, JasonNalley said:

Could be be that the -EventType is supposed to be -EventType "OnMediaItemAddedComplete" instead of just "OnMediaItemAdded" ?

eventtype parameter should be "onmediaitemadded", the instructions are correct.

 

need to find out where in the chain things are falling over

eg.

  • added movie added to queue?
  • Processadds on screen feedback when run manually from pwsh? 
  • movie reference added to postlog? removed from queue?
  • Integromat healthy? shows post received? queue health not stalled?

(i have noticed an issue with postadded which doesnt populate type, name, path properly but its not stopping the log providing a neccessary level of feedback to troubleshoot this issue, you can still see the post to integromat - when its working)

Link to comment
Share on other sites

JasonNalley

The "New" items in question never made it to "Processed.csv" even though they were on the "Queue.csv" nor did they make it to "PostLog.csv".  So not sure what that means exactly... Integromat still has 50% of it's posts left for the month, the operation is still running and not paused on their end.  All of the upgraded items, however, did make it to the Processed.csv, but also did not go to the PostLog.csv (expected since they're upgrades).

Here's the Processed.csv for you to check out.

Edit: I *may* have misspoke.  I am working on a new movie now, I will double check to make sure it makes it to Queue.csv just to be certain.  But the movies are definitely present in my Emby Library, and everything else seems to be added just fine.  it seems like it's only  "new" content which isn't being added at all.

Edit 2: So I was able to confirm, new movies/shows/albums are NOT getting added to Queue.csv, only upgraded content is...  Which is odd...


Edit 3: lol, I think I figured it out... I had forgot to change "example" in C:\Example\ProcessMediaAdds.ps1 to my  directory >.< ffs... lol
 

Processed.CSV

Edited by JasonNalley
Link to comment
Share on other sites

ginjaninja
22 hours ago, JasonNalley said:

lol, I think I figured it out

good to hear you got it sorted, in the mean time i was doing a bit of checking and it seems that something has changed in scripterx which has indeed broken the script as you suspected, namely when removing parent objects (series,season), child objects (season,episode) are not firing an onmediaitemremoved event and hence child object removals are not being logged, which in turn is breaking the suppression.

I will publish a fix shortly and include a wait state for 'integromat queue full/status code 400" so that the script pauses for 5 seconds before trying again upto 2 more times to post. (time will tell what the appropriate delay and qty is). I havent been able to replicate queue full so havent been able to test so this may introduce a bug.

  • Like 1
Link to comment
Share on other sites

ginjaninja

have posted v0.0.1.1.

I dont know how you are getting on with scheduling, but i strongly recommend running this manually to begin with from within a pwsh session so you can see the output to aid troubleshooting. (nb the tab key can be used to cycle through files and run processadds from within a pwsh session once you change directory to the script's location)

there is now a loop/wait state in the integromat post, and it would be a shame to loose a months integromat allowance due to a runaway condition. its not likely but if you can replicate the queue full situation and then confirm the script handles it well (stops after no more than 4 attempts) then that would be a good test.

as always when running manually, backup the queue so you can repeat test if applicable.

 

Link to comment
Share on other sites

JasonNalley

I'll give it a whirl, just gotta find 20-ish new things to encode :) I will see about it over the next couple days.

Link to comment
Share on other sites

  • 2 weeks later...
JasonNalley

@ginjaninja is there a way to change it from using the MusicBrainz link to using the Last.fm link?  The reason I ask is because facebook keeps flagging all of the music posts as spam, and I think it's because it's using MusicBrainz.org

Link to comment
Share on other sites

ginjaninja
18 hours ago, JasonNalley said:

@ginjaninja is there a way to change it from using the MusicBrainz link to using the Last.fm link?  The reason I ask is because facebook keeps flagging all of the music posts as spam, and I think it's because it's using MusicBrainz.org

Emby's lastfm plugin does not store the lastfm link for albums afaik, so the url would have to constructed (somewhat prone to error)  or additional code added to search lastfm api for the albums last fm url.

i am surprised facebooks 'decides' spam due to musicbrainz in url, but i have done no investigation.

helperfunctions line 392, constructs the album message, you could tweak it a bit (open ps1 in text editor) to confirm what it is about the message that Facebook doesnt like or  try my attempt at a guestimation of the lastfm url

If ($IDInfo.Items.Type -eq "MusicAlbum") {
    $hash.add("Content1", "$($IDInfo.Items.AlbumArtist) - $Name")
    $hash.add("Content2", "https://musicbrainz.org/release/$($IDInfo.Items.ProviderIDs.MusicBrainzAlbum)")
  }

eg. change content2 line

$hash.add("Content2", "https://www.last.fm/music/$($IDInfo.Items.AlbumArtist)/$Name")

($Name here is the Music Album Name and $($IDInfo.Items.AlbumArtist) is the albumartist , as supplied by emby)

is spam the ultimate issue or would you just prefer lastfm link in any case? Before i go added token customisation into the messages it would be good to confirm the Movies and TV (suppression) is working ok or not.

Link to comment
Share on other sites

JasonNalley

The spam thing is the ultimate issue.  It only happens on Music posts, TV and Movie posts go without a hitch... the only difference between them is the link being used, so... I dunno... It's my best guess.  

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