Jump to content

New Plugin - Custom Scripting | Emby ScripterX


Anthony Musgrove

Recommended Posts

PenkethBoy

item.library.x appears to be resolved for some events itemadded,itemremoved etc

 

but depending on the type of item itemupdated for a movie extra still shows %item.library.name% but is fine for a episode

Link to comment
Share on other sites

PenkethBoy

That's a very interesting one mate ill have a look into it, but definitely if it shows in the emby log it should definitely be being passed to the command line

 

Anthony

 

trying out the new global variables and getting a slightly odd result

 

with Session start or end the scripterx.version is not returning the value

 

In my log i see

 

[05/05/2020 18:58:17.859] - EventType: SessionStart User: TimPercy Device: Chrome ScripterX: %scripterx.version%

 

however in the emby log

 

2020-05-05 18:58:18.060 Info Emby ScripterX: onSessionStarted: -EventType "SessionStart" -UserName "TimPercy" -DevName "Chrome" -ScripterVersion "2.2.8.0"

 

the variable does work on things like libscancomplete, scheduled task start/end etc

 

Any insight on why that would be?

 

(the times recorded are interesting as it appears the emby log happens after my script gets the info - i assume this is because you pass the info off to emby to post to the log and it has a queue that need to be worked through)

 

This is now fixed - not sure which version - but reporting correctly in 2.3.1

Link to comment
Share on other sites

PenkethBoy

for me it happens with a single script writing to its own log - each instance of the script writes to the same log file - so if i have two events within a very short interval ~20ms - then that appears to be too short a window for script instance one to finish writing before instance two trys to do the same

 

i was comparing the emby log entries for ScripterX with my log and noticed that a couple got missed

 

this was specifically with a load of scheduled tasks all firing at once after starting my test server that had been off for a while so emby does a catch up on these and fires them off almost at the same time

 

I wonder if Anthony could add a delay and queue up the events to overcome this? @@Anthony.Musgrove

As the time an event fires - is not time critical for me at least - so a short (ms) added delay would not impact what the scripts are going to do.

 

So say create a queue of events that fire off with a delay of say 50/100 ms between them or something similar - just to give the scripts a chance to do their stuff etc.....

 

Anthony

 

You can ignore this now as adding a mutex to the PS script has sorted this issue for me

Link to comment
Share on other sites

PenkethBoy

Anthony

 

Just tested ScripterX on my QNAP - and it works fine

 

Had a couple of hiccups but nothing that was a show stopper

 

1. I used your media.sh as an example

1.1 You have to use the full path to the media.sh file - i initially thought i could use the /sharename/scripts/media.sh - but that failed - however using the full path worked fine in the ScripterX config page and for the logfile

1.2 I just copied your example to a file i created on my PC then uploaded that to my QNAP - this gave an error on line 3 in the emby log from ScripterX "line 3: : command not found" - which was a blank line

1.3 As the file was saved for a PC - changing this to a unix file type - solved the blank line issue - although even with the error ScripterX was posting to the log file.

 

5eb8303259342_Annotation20200510174655.j

I did not have any permission issues - my PC user - that owns the media.sh file is an administrator on my QNAP - the log file gets created for user admin - as there is no embyuser on a QNAP

  • Like 1
Link to comment
Share on other sites

ginjaninja

Anthony

 

You can ignore this now as adding a mutex to the PS script has sorted this issue for me

 

Hi @@PenkethBoy

If youve got that far, would it be possible to show an example as to how its best for separate scripts to instance a mutex, waiting until mutex is available before continuing, and when required properly timeout and exit  if the mutex just isnt available ie not execute the script block (is try, catch, finally the answer? what does that look like?). Also when is $mtx.dispose() necessary..im not using it and things seem to be ok...

 

This is what i have so far.

I cant be certain from the interweb, and was wondering  if its ok for separate scripts to create "new-object" or should they first check if mutex exists and then reference rather than "new-object" straight away...

#Wait incase ProcessAdded is writing to csv
$createdNew = $null
$mtx = New-Object System.Threading.Mutex($false, "LogMutex",[ref]$createdNew)

#Dangerous if mutex is held open in another script due to crash/poor coding as this script will permanently hang and emby will stop ingesting content.
$mtx.WaitOne()
<perform code here>
$mtx.ReleaseMutex()

I have learnt that it is very dangerous to instance $mtx.waitone() in a loop because it is necessary to $mtx.ReleaseMutex() as many times as as you waitone.

oh and if it helps, i found a script which tests for whether a mutex is available or if one of yourscripts is not releasing it. (how i found the issue above)

 

Function Test-IsMutexAvailable.zip

 

thank you

Link to comment
Share on other sites

PenkethBoy

i only use the mutex in my log function

Function Log ($logString)
{
  # create a mutex for when multiple writes to log might clash in short timescale
  $Mtx = New-Object System.Threading.Mutex($false, "ScripterX")
  $Mtx.WaitOne() | Out-Null
  Write-Output $logString | Out-File -FilePath $Log -Encoding utf8 -Append | Out-Null
  $Mtx.ReleaseMutex() | Out-Null
}

So each event from ScripterX - runs up an instance of the script that contains the above - each then write to the log file but wait for others to release the mutex - the mutex "name" ScripterX above is the thing that links them together

 

All explained here - not that complex - https://learn-powershell.net/2014/09/30/using-mutexes-to-write-data-to-the-same-logfile-across-processes-with-powershell/

 

it shows how to do a loop - and read the comments at the bottom as one poster shows how to deal with a failed mutex exception - which i have not bothered with

  • Like 1
Link to comment
Share on other sites

ginjaninja

%episode.number% does not seem to work on added, ok for removed and updated..

is scripterx firing before these values have been determined in the database.

0-05-10 21:58:39.884 Info LibraryMonitor: Season 1 (J:\TV17\Castlevania\Season 01) will be refreshed.
2020-05-10 21:58:39.995 Debug BaseItem: Removed item: J:\TV17\Castlevania\Season 01\S01E01 - Witchbottle.mkv
2020-05-10 21:58:39.995 Info App: Removing item from database, Type: Episode, Name: Witchbottle, Path: J:\TV17\Castlevania\Season 01\S01E01 - Witchbottle.mkv, Id: 319597
2020-05-10 21:58:39.995 Info App: Deleting path C:\Users\Nicholas Bird\AppData\Roaming\Emby-Server\programdata\metadata\library\f9\f9d95c2fd766f925a823a0e41df4472e
2020-05-10 21:58:40.555 Info Emby ScripterX: Output from script '-File "A:\PSScript\Integromat\LogMediaAdds.ps1" -Name "Witchbottle" -ID "319597" -Type "Episode" -Path "J:\TV17\Castlevania\Season 01\S01E01 - Witchbottle.mkv" -SeriesName "Castlevania" -SeasonName "Season 1" -SeasonNumber "1" -EpisodeNumber 1 -LibName "%item.library.name%" -EventType "onMediaItemRemoved" -IsVirtual "False"': True

2020-05-10 21:58:40.555 Info Emby ScripterX: onItemRemoved: -Name "Witchbottle" -ID "319597" -Type "Episode" -Path "J:\TV17\Castlevania\Season 01\S01E01 - Witchbottle.mkv" -SeriesName "Castlevania" -SeasonName "Season 1" -SeasonNumber "1" -EpisodeNumber 1 -LibName "%item.library.name%" -EventType "onMediaItemRemoved" -IsVirtual "False"
2020-05-10 21:58:41.139 Error Emby ScripterX: Error executing script '-File "A:\PSScript\Integromat\LogMediaAdds.ps1" -Name "S01E01 - Witchbottle" -ID "319598" -Type "Episode" -Path "J:\TV17\Castlevania\Season 01\S01E01 - Witchbottle.mp4" -SeriesName "Castlevania" -SeasonName "Season 1" -SeasonNumber "1" -EpisodeNumber  -LibName "%item.library.name%" -EventType "onMediaItemAdded" -IsVirtual "False"': [91mLogMediaAdds.ps1: [91mMissing an argument for parameter 'EpisodeNumber'. Specify a parameter of type 'System.String' and try again.[0m

2020-05-10 21:58:41.139 Info Emby ScripterX: onItemAdded: -Name "S01E01 - Witchbottle" -ID "319598" -Type "Episode" -Path "J:\TV17\Castlevania\Season 01\S01E01 - Witchbottle.mp4" -SeriesName "Castlevania" -SeasonName "Season 1" -SeasonNumber "1" -EpisodeNumber  -LibName "%item.library.name%" -EventType "onMediaItemAdded" -IsVirtual "False"
2020-05-10 21:58:41.139 Debug App: Refreshing Episode J:\TV17\Castlevania\Season 01\S01E01 - Witchbottle.mp4 due to configured automatic refresh interval
2020-05-10 21:58:41.141 Debug App: Running FFProbeProvider for J:\TV17\Castlevania\Season 01\S01E01 - Witchbottle.mp4
2020-05-10 21:58:41.142 Info MediaProbeManager: ProcessRun 'ffprobe' Execute: C:\Users\Nicholas Bird\AppData\Roaming\Emby-Server\system\ffprobe.exe -i file:"J:\TV17\Castlevania\Season 01\S01E01 - Witchbottle.mp4" -threads 0 -v info -print_format json -show_streams -show_chapters -show_format -show_data
2020-05-10 21:58:41.143 Debug MediaProbeManager: ProcessRun 'ffprobe' Started.
2020-05-10 21:58:41.204 Info MediaProbeManager: ProcessRun 'ffprobe' Process exited with code 0
2020-05-10 21:58:41.209 Debug App: Running EpisodeNfoProvider for J:\TV17\Castlevania\Season 01\S01E01 - Witchbottle.mp4
2020-05-10 21:58:41.209 Debug App: EpisodeNfoProvider returned no metadata for J:\TV17\Castlevania\Season 01\S01E01 - Witchbottle.mp4
2020-05-10 21:58:41.209 Debug App: Running TvdbEpisodeProvider for J:\TV17\Castlevania\Season 01\S01E01 - Witchbottle.mp4
2020-05-10 21:58:41.210 Debug App: Running MovieDbEpisodeProvider for J:\TV17\Castlevania\Season 01\S01E01 - Witchbottle.mp4
2020-05-10 21:58:41.210 Debug App: Running OmdbEpisodeProvider for J:\TV17\Castlevania\Season 01\S01E01 - Witchbottle.mp4
2020-05-10 21:58:41.699 Info Emby ScripterX: Output from script '-File "A:\PSScript\Integromat\LogMediaAdds.ps1" -Name "Witchbottle" -ID "319598" -Type "Episode" -Path "J:\TV17\Castlevania\Season 01\S01E01 - Witchbottle.mp4" -SeriesName "Castlevania" -SeasonName "Season 1" -SeasonNumber "1" -EpisodeNumber 1 -LibName "%item.library.name%" -EventType "onMediaItemUpdated" -IsVirtual "False" -UpdateReason "None, MetadataImport, ImageUpdate, MetadataDownload': True

2020-05-10 21:58:41.699 Info Emby ScripterX: onItemUpdated: -Name "Witchbottle" -ID "319598" -Type "Episode" -Path "J:\TV17\Castlevania\Season 01\S01E01 - Witchbottle.mp4" -SeriesName "Castlevania" -SeasonName "Season 1" -SeasonNumber "1" -EpisodeNumber 1 -LibName "%item.library.name%" -EventType "onMediaItemUpdated" -IsVirtual "False" -UpdateReason "None, MetadataImport, ImageUpdate, MetadataDownload
2
Link to comment
Share on other sites

PenkethBoy

ItemAdded - episode.number is returning " " a space when virtual is false

ItemAdded - It does work when the episode is virtual - oddly

ItemAdded Name: Penny Dreadful - City of Angels - S01E03 - Wicked Old World Emby ID: 109627 Emby Item Type: Episode Emby Library: TV Shows Series: Penny Dreadful - City of Angels Season: Season 1 Episode No:  IsVirtual: False ScripterX: 2.3.1.0
..
ItemAdded Name: Episode 10 Emby ID: 109628 Emby Item Type: Episode Emby Library: TV Shows Series: Penny Dreadful: City of Angels Season: Season 1 Episode No: 10 IsVirtual: True ScripterX: 2.3.1.0

did you see this in your log - "91mLogMediaAdds.ps1: [91mMissing an argument for parameter 'EpisodeNumber'. Specify a parameter of type 'System.String' and try again.[0m"

 
also are you using 2.3.1 as you have missing -Libname which is fixed in 2.3.1
Link to comment
Share on other sites

ginjaninja

 

ItemAdded - episode.number is returning " " a space when virtual is false

ItemAdded - It does work when the episode is virtual - oddly

ItemAdded Name: Penny Dreadful - City of Angels - S01E03 - Wicked Old World Emby ID: 109627 Emby Item Type: Episode Emby Library: TV Shows Series: Penny Dreadful - City of Angels Season: Season 1 Episode No:  IsVirtual: False ScripterX: 2.3.1.0
..
ItemAdded Name: Episode 10 Emby ID: 109628 Emby Item Type: Episode Emby Library: TV Shows Series: Penny Dreadful: City of Angels Season: Season 1 Episode No: 10 IsVirtual: True ScripterX: 2.3.1.0

did you see this in your log - "91mLogMediaAdds.ps1: [91mMissing an argument for parameter 'EpisodeNumber'. Specify a parameter of type 'System.String' and try again.[0m"

 
also are you using 2.3.1 as you have missing -Libname which is fixed in 2.3.1

 

 

i did see that error thanks and yes on 2.3.1, it was either because i forgot to enclose a token resolved to null, in quotes on the parameters line, or "%token%" resolves to null if the token is null. Anyways i believe  that made powershell think i was supplying a switch when the parameter is strongly typed as string.

"DateTime","Type","ID","Name","Series","SeasonNumber","EpisodeNumber","Path","Library","EventType","UpdateReason","IsVirtual","Processed","Range","Index","Spare1"
"11 May 2020 11:30:54","Episode","319705","Necropolis","Castlevania","1","2","J:\TV17\Castlevania\Season 01\S01E02 - Necropolis.mkv","%item.library.name%","onMediaItemRemoved","","False","Yes","","",""
"11 May 2020 11:30:55","Episode","319706","Labyrinth","Castlevania","1","3","J:\TV17\Castlevania\Season 01\S01E03 - Labyrinth.mkv","%item.library.name%","onMediaItemRemoved","","False","Yes","","",""
"11 May 2020 11:30:55","Episode","319707","Monument","Castlevania","1","4","J:\TV17\Castlevania\Season 01\S01E04 - Monument.mkv","%item.library.name%","onMediaItemRemoved","","False","Yes","","",""

"11 May 2020 11:53:18","Episode","319710","Episode 2","Castlevania","1","2","%item.path%","%item.library.name%","onMediaItemAdded","","True","Yes","","",""
"11 May 2020 11:53:18","Episode","319710","Necropolis","Castlevania","1","2","%item.path%","%item.library.name%","onMediaItemUpdated","None, MetadataImport, MetadataDownload","True","Yes","","",""
"11 May 2020 11:53:19","Episode","319711","Episode 3","Castlevania","1","3","%item.path%","%item.library.name%","onMediaItemAdded","","True","Yes","","",""
"11 May 2020 11:53:19","Episode","319711","Labyrinth","Castlevania","1","3","%item.path%","%item.library.name%","onMediaItemUpdated","None, MetadataImport, MetadataDownload","True","Yes","","",""
"11 May 2020 11:53:20","Episode","319712","Episode 4","Castlevania","1","4","%item.path%","%item.library.name%","onMediaItemAdded","","True","Yes","","",""
"11 May 2020 11:53:20","Episode","319712","Monument","Castlevania","1","4","%item.path%","%item.library.name%","onMediaItemUpdated","None, MetadataImport, MetadataDownload","True","Yes","","",""

"11 May 2020 11:56:49","Episode","319713","S01E02 - Necropolis","Castlevania","1","","J:\TV17\Castlevania\Season 01\S01E02 - Necropolis.mkv","%item.library.name%","onMediaItemAdded","","False","No","","",""
"11 May 2020 11:56:49","Episode","319714","S01E03 - Labyrinth","Castlevania","1","","J:\TV17\Castlevania\Season 01\S01E03 - Labyrinth.mkv","%item.library.name%","onMediaItemAdded","","False","No","","",""
"11 May 2020 11:56:49","Episode","319715","S01E04 - Monument","Castlevania","1","","J:\TV17\Castlevania\Season 01\S01E04 - Monument.mkv","%item.library.name%","onMediaItemAdded","","False","No","","",""

"11 May 2020 11:56:50","Episode","319710","Necropolis","Castlevania","1","2","%item.path%","%item.library.name%","onMediaItemRemoved","","True","Yes","","",""
"11 May 2020 11:56:51","Episode","319711","Labyrinth","Castlevania","1","3","%item.path%","%item.library.name%","onMediaItemRemoved","","True","Yes","","",""
"11 May 2020 11:56:51","Episode","319712","Monument","Castlevania","1","4","%item.path%","%item.library.name%","onMediaItemRemoved","","True","Yes","","",""

"11 May 2020 11:56:52","Episode","319713","Necropolis","Castlevania","1","2","J:\TV17\Castlevania\Season 01\S01E02 - Necropolis.mkv","%item.library.name%","onMediaItemUpdated","None, MetadataImport, ImageUpdate, MetadataDownload","False","Yes","","",""
"11 May 2020 11:56:53","Episode","319714","Labyrinth","Castlevania","1","3","J:\TV17\Castlevania\Season 01\S01E03 - Labyrinth.mkv","%item.library.name%","onMediaItemUpdated","None, MetadataImport, ImageUpdate, MetadataDownload","False","Yes","","",""
"11 May 2020 11:56:53","Episode","319715","Monument","Castlevania","1","4","J:\TV17\Castlevania\Season 01\S01E04 - Monument.mkv","%item.library.name%","onMediaItemUpdated","None, MetadataImport, ImageUpdate, MetadataDownload","False","Yes","","",""
 

heres a log of 

three episodes being removed from library (configured for show missing episodes)

[actual remove events]

[virtual add events coupled with virtual update events]

three episodes put back into library

[actual add events]

[virtual remove events]

[actual update events]

 

ie an end to end picture..

 

The Library "TVSHOWS" is made up of multiple folders TV01,TV02,etc

 

%item.library.name% never works and %episodenumber.number% never works on non virtual mediaitemadded as mentioned

 

maybe it becuase i have multiple media folders?

 

Queue.zip

Edited by ginjaninja
Link to comment
Share on other sites

PenkethBoy

%item.library.name% works fine now for me but i never use multi folders in my libraries as use drive pooling saves a lot of hassle :)

 

Do you have 17 tv folders then?

 

I guess Anthony does not look for multiple folders when looking for the library name.

 

Question - why record the virtual episodes to you csv when you set it to processed Yes - so essentially might as well not be written? or its it just for testing?

Link to comment
Share on other sites

ginjaninja

%item.library.name% works fine now for me but i never use multi folders in my libraries as use drive pooling saves a lot of hassle :)

 

Do you have 17 tv folders then?

 

I guess Anthony does not look for multiple folders when looking for the library name.

 

Question - why record the virtual episodes to you csv when you set it to processed Yes - so essentially might as well not be written? or its it just for testing?

yes 22 TV Folders and  yes processed virtual is for testing..

Link to comment
Share on other sites

ginjaninja
New Content
"DateTime","Type","ID","Name","Series","SeasonNumber","EpisodeNumber","Path","Library","EventType","UpdateReason","IsVirtual","Processed","Range","Index","Spare1"
"12 May 2020 13:10:27","Episode","319823","S01E02 - Necropolis","Castlevania","1","","J:\TV17\Castlevania\Season 01\S01E02 - Necropolis.mkv","%item.library.name%","onMediaItemAdded","","False","No","","",""
"12 May 2020 13:10:27","Episode","319824","S01E03 - Labyrinth","Castlevania","1","","J:\TV17\Castlevania\Season 01\S01E03 - Labyrinth.mkv","%item.library.name%","onMediaItemAdded","","False","No","","",""
"12 May 2020 13:10:28","Episode","319825","S01E04 - Monument","Castlevania","1","","J:\TV17\Castlevania\Season 01\S01E04 - Monument.mkv","%item.library.name%","onMediaItemAdded","","False","No","","",""
"12 May 2020 13:10:28","Episode","319823","Necropolis","Castlevania","1","2","J:\TV17\Castlevania\Season 01\S01E02 - Necropolis.mkv","%item.library.name%","onMediaItemUpdated","None, MetadataImport, ImageUpdate, MetadataDownload","False","No","","",""
"12 May 2020 13:10:29","Episode","319824","Labyrinth","Castlevania","1","3","J:\TV17\Castlevania\Season 01\S01E03 - Labyrinth.mkv","%item.library.name%","onMediaItemUpdated","None, MetadataImport, ImageUpdate, MetadataDownload","False","No","","",""
"12 May 2020 13:10:30","Episode","319825","Monument","Castlevania","1","4","J:\TV17\Castlevania\Season 01\S01E04 - Monument.mkv","%item.library.name%","onMediaItemUpdated","None, MetadataImport, ImageUpdate, MetadataDownload","False","No","","",""

Updated Content
"12 May 2020 13:29:47","Episode","319758","Witchbottle","Castlevania","1","1","J:\TV17\Castlevania\Season 01\S01E01 - Witchbottle.mkv","%item.library.name%","onMediaItemRemoved","","False","Yes","","",""

"12 May 2020 13:29:47","Episode","319828","S01E01 - Witchbottle","Castlevania","1","","J:\TV17\Castlevania\Season 01\S01E01 - Witchbottle.mp4","%item.library.name%","onMediaItemAdded","","False","No","","",""
"12 May 2020 13:29:48","Episode","319828","Witchbottle","Castlevania","1","1","J:\TV17\Castlevania\Season 01\S01E01 - Witchbottle.mp4","%item.library.name%","onMediaItemUpdated","None, MetadataImport, ImageUpdate, MetadataDownload","False","No","","",""

i dont think i see any difference (for episodes) in event "onmediaitemupdate - update reason" between a new file and a swapped out file, both show  "None, MetadataImport, ImageUpdate, MetadataDownload"

 

so am starting to think the best way to identify "real media upgrade" events is look out for an associated 'onmediaitemremoved event' (associated by same series, season, episode number)...so really episode token to work :-)

Edited by ginjaninja
Link to comment
Share on other sites

PenkethBoy

from emby's perspective its a new item as original item has been removed

 

item id for Upgrade is different to the original 319758 vs 319828 - emby does not keep track via DB ID - only providerids which you could also check is the same as you have that now as a scripter variable (item.meta.*) - not sure if its reported on a delete though

 

So if you want to see if its an "upgrade" then you need to track the remove events and hope they happen in a short time scale

Link to comment
Share on other sites

Anthony Musgrove

Amazing amazing testing and work guys, this is helping me greatly :)  I am sorry for the absence of late, I have been working on conditions - totally drag and droppable, still in progress.   This is going to allow you to separate for example, onMediaItemAdded, you'll be able to have separate actions with different conditions to process different types of media, by (for example) : 

 

5ebb640c9dd05_conditionsdragdrop.png

 

This is all on the path for the way ItemAdded, ItemUpdated, ItemRemoved operates .. there's some business rules we need to address, for example ItemAdded is called when a new file is processed in a media library, and doesn't yet have the proper metadata, so its very basic, then ItemUpdated is called when metadata is retrieved for the new item, which provides proper information (Episode number, name, season, series, etc), which is unavailable on ItemAdded because at that stage, the metadata hasn't been received, so this is why we're getting some issues too.  ItemAdded in the current sense isn't exactly an Item completely added properly to the library, with metadata etc.  So we need to look at introducing some new VIRTUAL/ABSTRACT events, for say,   onNewMediaItem - which would be called AFTER an ItemAdded, and ItemUpdated (with Metadata) is completed.  For cases where the item doesn't match for metadata (thus possibly not having an ItemUpdated), we should have a configurable timeout period the system should wait until it calls the onNewMediaItem, with a token %metadata.processed% for example, so when the event is called, you can check to see if the metadata was successful or if it timed out waiting for an ItemUpdated... then the current ItemAdded, ItemUpdated needs to be 'hidden' from ScripterX (unless we leave them there but explain that they're basically raw events that aren't exactly meaningful without post processing.

 

Does this all sound alright? thank you guys!

  • Like 1
Link to comment
Share on other sites

Anthony Musgrove

Coming together so awesomely, completely drag and drop.   This is going to work fantastically when its ready for release.  5ebbe560bddb0_Newconditionsworking.png

Link to comment
Share on other sites

PenkethBoy

...unless we leave them there but explain that they're basically raw events that aren't exactly meaningful without post processing

 

For me - keep the existing events and add replacements as necessary so for now we can compare and contrast - probably we can remove them later once confident of the new process

  • Like 1
Link to comment
Share on other sites

Anthony Musgrove

It's coming together nicely guys!  It's functioning, it's alive, its alive!  However, because a significant portion of the core has been rewritten, when its ready for release I'll put it on Github as a beta until we know that everything is running 100% smoothly :)  I'll let you guys know as soon as a beta is up! <3 thank you so much for all your suggestions.. I'm going to start looking at creating the more 'abstract' events soon as mentioned above!

 

5ebf5b5ca1e84_conditionsnew.png

 

Just for debug purposes, 

 

2020-05-16 13:40:53.423 Info Emby ScripterX: onPlaybackStart: Conditions to check: ('Movie' == 'Episode' ) && ('Anthony' != 'Anthony' )
2020-05-16 13:40:53.425 Info Emby ScripterX: onPlaybackStart: Skipped action 2c908bdc-8f8a-4a6f-888d-ff090240231b as conditions were not met.

 

:)

Edited by Anthony.Musgrove
  • Like 1
Link to comment
Share on other sites

spaceman07

Hey guys,  new version is up now in the catalog; addressing many github issues, case-insensitive variables, etc.  

 

Transcoding is in progress, because it will rely on onPlaybackChange (which isn't implemented yet) :)

 

I hope everyone is going great tonight!

Hello.. do we know when this might be available? if not can you possibly suggest how I can maybe get this functionality?

 

Thanks

  • Like 1
Link to comment
Share on other sites

Anthony Musgrove

Hey guys, please note that I've just put v2.3.2 BETA up on Github for testing.  Conditions are now fully functional - I just want to make sure its all working fine before releasing into the catalog :)

 

https://github.com/AnthonyMusgrove/Emby-ScripterX/tree/master/Beta

 

Conditions are drag/drop, and some of the operators are click-to-edit.  It's been a big task getting it to this level and throughout the entire process I've had in mind the ease-of-use factor for the user.  I don't like convoluted interfaces, I like them to be very self explanatory and smooth.  If there is anything that is confusing please let me know.   

 

When you create or edit an action now, you'll see a conditions 'scratch-pad' appear, with a list of operators above the scratch pad.   You can drag tokens from the action interface into the scratchpad area - and you can also drag operators into the scratchpad area.   The scratchpad area is sortable too, so if you want to re-order your conditions elements you can.   To delete an element from the scratch pad, simply drag it outside the scratch pad (I will eventually put a recycle bin icon somewhere to make this more self explanatory).

 

Thank you so much guys.

 

PS. @@spaceman07 I'm looking into the transcoding stuff now.  @@PenkethBoy might have some input too regarding how to get the transcoding information from the api after playbackstart event occurs, but I'm working on it.   So basically you would like to see if an playback item is transcoding, I can create the new event onPlaybackChanged and we should be able to set a condition for 'IsTranscoding' so it will only execute the action if its transcoding, let me look into this now!

 

So so excited.  <3 

Link to comment
Share on other sites

spaceman07

That sounds awesome.. I been looking into the API as well for the functionality.. we can look into the sessionservices and be looking for the 4k video part if it's transcoding.. as I believe it's ok to have direct play on the video with transcoding for the audio side.

 

I posted some information on the API forum and I believe @@PenkethBoy can help with this.

 

Let me know when in position to be able to test.. I be more than happy to help with the testing

 

Thanks

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

Anthony Musgrove

I've also added a new event, called onMediaItemAddedComplete - and the log for this output is :-

 

(It basically waits 20 seconds after the item is added to gather its metadata, then calls the Complete event)

 

 

 

MediaAdded: [iD: 53561] [Type: Movie] [Name: "Cast Away"] [Path: "D:\Media\Movies\Cast.Away.2000.1080p.BrRip.x264.YIFY.mp4"] 
MediaAdded: [iD: 53562] [Type: Series] [Name: "The Witcher"] [Path: "D:\Media\TV\The Witcher"] 
MediaAdded: [iD: 53563] [Type: Season] [Name: "Season 1"] [Path: "D:\Media\TV\The Witcher\Season 01"] 
MediaAdded: [iD: 53566] [Type: Episode] [Name: "Betrayer Moon"] [Path: "D:\Media\TV\The Witcher\Season 01\The.Witcher.S01E03.720p.NF.WEBRip.x264-GalaxyTV.mkv"] 
MediaAdded: [iD: 53567] [Type: Episode] [Name: "Of Banquets, Bastards and Burials"] [Path: "D:\Media\TV\The Witcher\Season 01\The.Witcher.S01E04.720p.NF.WEBRip.x264-GalaxyTV.mkv"] 
MediaAdded: [iD: 53569] [Type: Episode] [Name: "The.Witcher.S01E06.720p.NF.WEBRip.x264-GalaxyTV"] [Path: "D:\Media\TV\The Witcher\Season 01\The.Witcher.S01E06.720p.NF.WEBRip.x264-GalaxyTV.mkv"] 
MediaAdded: [iD: 53564] [Type: Episode] [Name: "The End's Beginning"] [Path: "D:\Media\TV\The Witcher\Season 01\The.Witcher.S01E01.720p.NF.WEBRip.x264-GalaxyTV.mkv"] 
MediaAdded: [iD: 53565] [Type: Episode] [Name: "Four Marks"] [Path: "D:\Media\TV\The Witcher\Season 01\The.Witcher.S01E02.720p.NF.WEBRip.x264-GalaxyTV.mkv"] 
MediaAdded: [iD: 53568] [Type: Episode] [Name: "Bottled Appetites"] [Path: "D:\Media\TV\The Witcher\Season 01\The.Witcher.S01E05.720p.NF.WEBRip.x264-GalaxyTV.mkv"] 
MediaAdded: [iD: 53571] [Type: Episode] [Name: "The.Witcher.S01E08.720p.NF.WEBRip.x264-GalaxyTV"] [Path: "D:\Media\TV\The Witcher\Season 01\The.Witcher.S01E08.720p.NF.WEBRip.x264-GalaxyTV.mkv"] 
 
 
Achieved with:
 
5ec0c593bb717_MediaItemAddedComplete.png
 
media_added_complete.bat:
 
@@Echo MediaAdded: [iD: %1] [Type: %2] [Name: %3] [Path: %4] >> D:\embyscripts\add_mediacomplete.log
 
 
Now, lets get creative and setup some conditions for this Event ...
Edited by Anthony.Musgrove
Link to comment
Share on other sites

Anthony Musgrove

Don't you just love it when creativity comes to life;  media_tv.log:

Added Series [ID: 53672] [Name: "The Witcher"] [Path: "D:\Media\TV\The Witcher"] 
Added Season to Series "The Witcher": [ID: 53673] [Season Number: 1] [Name: "Season 1"] [Path: "D:\Media\TV\The Witcher\Season 01"] 
Added Episode to Season 1 ("Season 1") of "The Witcher": [ID: 53674] [Episode Number: 1] [Name: "The End's Beginning"] [Path: "D:\Media\TV\The Witcher\Season 01\The.Witcher.S01E01.720p.NF.WEBRip.x264-GalaxyTV.mkv"] 
Added Episode to Season 1 ("Season 1") of "The Witcher": [ID: 53675] [Episode Number: 2] [Name: "Four Marks"] [Path: "D:\Media\TV\The Witcher\Season 01\The.Witcher.S01E02.720p.NF.WEBRip.x264-GalaxyTV.mkv"] 
Added Episode to Season 1 ("Season 1") of "The Witcher": [ID: 53676] [Episode Number: 3] [Name: "Betrayer Moon"] [Path: "D:\Media\TV\The Witcher\Season 01\The.Witcher.S01E03.720p.NF.WEBRip.x264-GalaxyTV.mkv"] 
Added Episode to Season 1 ("Season 1") of "The Witcher": [ID: 53677] [Episode Number: 4] [Name: "Of Banquets, Bastards and Burials"] [Path: "D:\Media\TV\The Witcher\Season 01\The.Witcher.S01E04.720p.NF.WEBRip.x264-GalaxyTV.mkv"] 
Added Episode to Season 1 ("Season 1") of "The Witcher": [ID: 53678] [Episode Number: 5] [Name: "Bottled Appetites"] [Path: "D:\Media\TV\The Witcher\Season 01\The.Witcher.S01E05.720p.NF.WEBRip.x264-GalaxyTV.mkv"] 
Added Episode to Season 1 ("Season 1") of "The Witcher": [ID: 53679] [Episode Number: 6] [Name: "Rare Species"] [Path: "D:\Media\TV\The Witcher\Season 01\The.Witcher.S01E06.720p.NF.WEBRip.x264-GalaxyTV.mkv"] 
Added Episode to Season 1 ("Season 1") of "The Witcher": [ID: 53680] [Episode Number: 7] [Name: "Before a Fall"] [Path: "D:\Media\TV\The Witcher\Season 01\The.Witcher.S01E07.720p.NF.WEBRip.x264-GalaxyTV.mkv"] 
Added Episode to Season 1 ("Season 1") of "The Witcher": [ID: 53681] [Episode Number: 8] [Name: "Much More"] [Path: "D:\Media\TV\The Witcher\Season 01\The.Witcher.S01E08.720p.NF.WEBRip.x264-GalaxyTV.mkv"] 

Achieved via:

 

5ec0d11b9aaab_onMediaItemAddedComplete_E

 

 

I've uploaded the example scripts to:

 

 

https://github.com/AnthonyMusgrove/Emby-ScripterX/tree/master/ExampleScripts/BatchFiles

 

and the Beta v2.3.3 is available for download via:

 

https://github.com/AnthonyMusgrove/Emby-ScripterX/tree/master/Beta

 

and a video demonstrating the conditions is available via:

 

https://www.youtube.com/watch?v=3IeNT7UT6FM

Edited by Anthony.Musgrove
Link to comment
Share on other sites

Anthony Musgrove

I've uploaded the example scripts to:

 

 

https://github.com/AnthonyMusgrove/Emby-ScripterX/tree/master/ExampleScripts/BatchFiles

 

and the Beta v2.3.3 is available for download via:

 

https://github.com/AnthonyMusgrove/Emby-ScripterX/tree/master/Beta

 

and a video demonstrating the conditions is available via:

 

https://www.youtube.com/watch?v=3IeNT7UT6FM

Edited by Anthony.Musgrove
Link to comment
Share on other sites

maegibbons

Hi Anthony

 

Absolutely awesome work.

 

I have checked out the video

 

One thing that surprised me is why the "Parameters" section is not drag and drop as well instead of having to type in the parameter names?

 

Krs

 

Mark

 

A 'like' is always appreciated!

Edited by maegibbons
  • Like 1
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...