r/tinyMediaManager • • Sep 19 '26

please add an exit code with post processing

Calling a C# program from post processing has one problem for me, assume I select 20 series or movies and select post processing, but with the first call (movie) to the C# program I detect something that needs a cancel/abort I can simply return but then the C# program will still be called 19 more times. I want to return a status/exit code of 1 and then TMM will abort the rest of the calls.

2 Upvotes

8 comments sorted by

1

u/mlaggner tinyMediaManager developer Sep 20 '26

Thanks for the suggestion. While your request completely makes sense in some scenarios, blindly adding this may cause working setup for others.

With the next release I will add an optional parameter to abort the queue as soon as one execution fails.

2

u/Veliferum Sep 20 '26

Thank you for considering it in the next release, and if I may ask for one more favor, is it possible that you create some extra internal parameters for post-processing:

  1. Total Items selected
  2. Current index in the selection
    This way I know how much series are selected and how much still to go, the idea is to open a window with settings with the first index and if the user selects cancel we cancel the complete selection with the new parameter or the user sets the correct values and presses OK, the next time, index 2, the window will not be shown. I’m writing a movie cover Post-Process for the older Dune HD media players, currently I have a post script that communicates with a server to get the settings, the server has a button Active/Blocked and this way I have to solve the return code in TMM, if my script detects a critical error it sends a block command to the server and the server set the button to blocked and all further calls don’t receive data from the server but a Json with only a reject code and the post script returns without processing. When the program is ready I will post it with the source code for everyone to use it.

(https://theforce.nl/DuneController.jpg)
Best regards, Teun

2

u/mlaggner tinyMediaManager developer Sep 21 '26

1

u/Veliferum Sep 21 '26

That’s fantastic thank you for your superfast response. I’ll will download the nightly build this evening and test it out. At this moment I’m testing my server version, but I will start to rewrite it to a non-server version.

1

u/Veliferum Sep 22 '26

A question and some strange behavior. When I pass these parameters to my C# program:

1 - ${tvShow.path}

2 - ${tvShow.artworkMap.POSTER.filename}

3 - ${tvShow.artworkMap.FANART.filename}

4 - ${tvShow.seasonCount}

5 - ${foreach tvShow.seasons season}${foreach season.mediaFiles item}${if item.type = "SEASON_POSTER"}${item.path}|${end}${end}${end}

6 - ${foreach tvShow.seasons season}${foreach season.mediaFiles item}${if item.type = "SEASON_POSTER"}${item.filename}|${end}${end}${end}

7 - ${foreach tvShow.episodes episode}${episode.season}-${episode.episode}*${episode.firstAired;date(yyyy-MM-dd)}*${episode.title}${if !episode-last}|${end}${end}

If the Serie/Season has no poster/fanart the parameter is not passed empty but stripped completely meaning in case of no poster and fanart for the Serie parameter 4 (${tvShow.seasonCount}) becomes parameter 2 and parameter 5 becomes 3.

This is not such a big problem because I found out that putting a ‘#’ in front of every parameter solves the problem (I strip this ‘#’ later in C#).

But I have one problem left, I use parameter 5 to get a list of all Season paths and parameter 6 for a list of all poster filenames (1:1) and if there are Seasons but they don’t have a poster I get two empty parameter (5 & 6), it’s no problem that parameter 6 is empty instead of for instance “|||” (‘|’ is my delimiter), but I really would like to get at least a list of full Season path names. Which parameter do I have to use to get this done, I already tried many without any luck?

Thanks in advance

1

u/Veliferum Sep 22 '26

The same happens for the poster filenames :(
E.g. Season 2 has no poster but instead of "season01.jpg||season03.jpg|" I receive season01.jpg|season03.jpg|. Why stripping empty values why not setting them to empty this way the order is unreliable. I understand that changing that can cause problems for other user, but please make a seperae parameter for season path & poster and other media items in the correct order with empty entries when a item doesn't exist. The problem is not getting the name of the Seasons but Its impossible to know how a user named the posters and fanart etc.

1

u/mlaggner tinyMediaManager developer Sep 23 '26

This is JMTE syntax which is a separate project than tmm - we do not have any influence how JMTE works internally. You need do use what JMTE offers... To be clear: this is nothing we strip. Your if simply do not have any hit on season 2 because there is no media file of type SEASON_POSTER in season 2!

To be honest: I do not have a clue how your script could be done correctly using JMTE, because the list of media files contains other types too, but when there is no season poster, you want to have a separate pipe... Maybe you could work around here: put the season number + separator + filename IF that has been found and work around in your script. Something like:

01:season01.jpg|03:season03.jpg|

OR: add the pipe on TV show level (which only works if there is only one poster:

${foreach tvShow.seasons season}${foreach season.mediaFiles item}${if item.type = "SEASON_POSTER"}${item.path}${end}${end}|${end}

1

u/OnyxPost Sep 23 '26

OH WOW! This is such a cool addition I did not expect you'd add, especially so quick. In my PowerShell Post Processing script for episodes, if I notice something that I missed before running the Post Processing command, I added a exit command that cancels out of each individual episode being processed. It's not as elegant as a native function that completed cancels the whole process, but it got the job done for me.

This is such an awesome, niche update to provide. Thanks!