rbjtech 5284 Posted August 19, 2021 Posted August 19, 2021 I think GoT is an edge case - if new to the show, then watching the Intro 7 minutes in for s1e1 really isn't a problem - because all other episodes are picked up correctly - and your code did exactly as it should - it reported that s1e1 did not have an Intro (to match any other episode) - which is correct. That is all great for nicely authored shows - but in the case of another GoT source - where people have chopped off the recap, chopped off the HBO etc - then this is where your code understandably struggles because it is simply not being able to match like for like, but that is no fault of the code - the problem is the variable quality media. I've still been unable to properly edit s1e1 to add the Intro (incl the HBO) to after the 7 min mark - but removing it (see below) produces the correct results - so I'm confident it would behave in exactly the same way. I'm going to add a few more shows and see what happens - but I think we are good .. @chef 1
rbjtech 5284 Posted August 19, 2021 Posted August 19, 2021 (edited) Bingo ! So I managed to chop the 'HBO + Intro' out of another episode, and replace the Intro (without the HBO part) in s01e01. Now the Intro's for all are identical - and thus it picks them all up without issues - even after 7 minutes in. We were chasing a problem that didn't exist .. Edited August 19, 2021 by rbjtech
samuelqwe 317 Posted August 19, 2021 Posted August 19, 2021 @chef Ran the fingerprinting overnight, and eventually the task failed like @Sammy. This was the error: One or more errors occurred. (Could not find file '/config/plugins/configurations/introEncoding/426421.bin'.) at System.Threading.Tasks.TaskReplicator.Run[TState](ReplicatableUserAction`1 action, ParallelOptions options, Boolean stopOnFirstFailure) at System.Threading.Tasks.Parallel.ForWorker[TLocal](Int32 fromInclusive, Int32 toExclusive, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState, Func`4 bodyWithLocal, Func`1 localInit, Action`1 localFinally) --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw(Exception source) at System.Threading.Tasks.Parallel.ThrowSingleCancellationExceptionOrOtherException(ICollection exceptions, CancellationToken cancelToken, Exception otherException) at System.Threading.Tasks.Parallel.ForWorker[TLocal](Int32 fromInclusive, Int32 toExclusive, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState, Func`4 bodyWithLocal, Func`1 localInit, Action`1 localFinally) at System.Threading.Tasks.Parallel.ForEachWorker[TSource,TLocal](TSource[] array, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState, Action`3 bodyWithStateAndIndex, Func`4 bodyWithStateAndLocal, Func`5 bodyWithEverything, Func`1 localInit, Action`1 localFinally) at System.Threading.Tasks.Parallel.ForEachWorker[TSource,TLocal](IEnumerable`1 source, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState, Action`3 bodyWithStateAndIndex, Func`4 bodyWithStateAndLocal, Func`5 bodyWithEverything, Func`1 localInit, Action`1 localFinally) at System.Threading.Tasks.Parallel.ForEach[TSource](IEnumerable`1 source, ParallelOptions parallelOptions, Action`2 body) at IntroSkip.AudioFingerprinting.AudioFingerprintScheduledTask.Execute(CancellationToken cancellationToken, IProgress`1 progress) at Emby.Server.Implementations.ScheduledTasks.ScheduledTaskWorker.ExecuteInternal(TaskOptions options) I think I know why it occurred, and I was able to restart the task just fine, but you'll likely need to adjust it so it's not a problem. I think the issue happened because it was trying to fingerprint a file that doesn't exist anymore (deleted recording, etc.) and then the task fails when it tries to read a non-existent .bin file. 1
chef 3810 Posted August 19, 2021 Posted August 19, 2021 35 minutes ago, samuelqwe said: @chef Ran the fingerprinting overnight, and eventually the task failed like @Sammy. This was the error: One or more errors occurred. (Could not find file '/config/plugins/configurations/introEncoding/426421.bin'.) at System.Threading.Tasks.TaskReplicator.Run[TState](ReplicatableUserAction`1 action, ParallelOptions options, Boolean stopOnFirstFailure) at System.Threading.Tasks.Parallel.ForWorker[TLocal](Int32 fromInclusive, Int32 toExclusive, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState, Func`4 bodyWithLocal, Func`1 localInit, Action`1 localFinally) --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw(Exception source) at System.Threading.Tasks.Parallel.ThrowSingleCancellationExceptionOrOtherException(ICollection exceptions, CancellationToken cancelToken, Exception otherException) at System.Threading.Tasks.Parallel.ForWorker[TLocal](Int32 fromInclusive, Int32 toExclusive, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState, Func`4 bodyWithLocal, Func`1 localInit, Action`1 localFinally) at System.Threading.Tasks.Parallel.ForEachWorker[TSource,TLocal](TSource[] array, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState, Action`3 bodyWithStateAndIndex, Func`4 bodyWithStateAndLocal, Func`5 bodyWithEverything, Func`1 localInit, Action`1 localFinally) at System.Threading.Tasks.Parallel.ForEachWorker[TSource,TLocal](IEnumerable`1 source, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState, Action`3 bodyWithStateAndIndex, Func`4 bodyWithStateAndLocal, Func`5 bodyWithEverything, Func`1 localInit, Action`1 localFinally) at System.Threading.Tasks.Parallel.ForEach[TSource](IEnumerable`1 source, ParallelOptions parallelOptions, Action`2 body) at IntroSkip.AudioFingerprinting.AudioFingerprintScheduledTask.Execute(CancellationToken cancellationToken, IProgress`1 progress) at Emby.Server.Implementations.ScheduledTasks.ScheduledTaskWorker.ExecuteInternal(TaskOptions options) I think I know why it occurred, and I was able to restart the task just fine, but you'll likely need to adjust it so it's not a problem. I think the issue happened because it was trying to fingerprint a file that doesn't exist anymore (deleted recording, etc.) and then the task fails when it tries to read a non-existent .bin file. Yes. I'll have to find out why we deleted the bin file before it could be processed.
chef 3810 Posted August 19, 2021 Posted August 19, 2021 Okay I found the fingerprinting error. I made a bad calculation when processing episodes. It totally makes sense that the file wouldn't be there under the conditions I wrote. 2
chef 3810 Posted August 19, 2021 Posted August 19, 2021 This shouldn't try and remove, or read from .bin files that have already been processed. It also shouldn't cause any issues with a database file which has been already semi-processed. DOWNLOAD: IntroSkip_v2.zip 2
Micael456 45 Posted August 19, 2021 Posted August 19, 2021 (edited) 6 hours ago, chef said: maybe allowing the user the ability to alter the rest is okay? @chef, I know I for one would definitely appreciate the ability to modify this, even if it's hidden behind "here be dragons" warnings. A 90%+ automated rate (and presumably increasingly good as the technology advances) is all well and all, but it would make the few "misses" even more annoying. Maybe not for first watch, but upon rewatch I'd like the ability to 'correct' the issue. IMO there's no such thing as perfect data, so should expect to have to fix at some point. Edited August 19, 2021 by Micael456 3
chef 3810 Posted August 19, 2021 Posted August 19, 2021 4 minutes ago, Micael456 said: @chef, I know I for one would definitely appreciate the ability to modify this, even if it's hidden behind "here be dragons" warnings. A 90%+ automated rate (and presumably increasingly good as the technology advances) is all well and all, but it would make the few "misses" even more annoying. Maybe not for first watch, but upon rewatch I'd like the ability to 'correct' the issue. IMO there's no such thing as perfect data, so should expect to have to fix at some point. Okay, this sounds right to me too. I'll make the table configurable, and place a save button on each row... Or maybe a submit for the whole season... That might be a better option. 1
Sammy 790 Posted August 19, 2021 Posted August 19, 2021 It is still failing and this time it lasted less than a minute.. One or more errors occurred. (Could not find file '&programdata&\plugins\configurations\introEncoding\3179764.bin'.) at System.Threading.Tasks.TaskReplicator.Run[TState](ReplicatableUserAction`1 action, ParallelOptions options, Boolean stopOnFirstFailure) at System.Threading.Tasks.Parallel.ForWorker[TLocal](Int32 fromInclusive, Int32 toExclusive, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState, Func`4 bodyWithLocal, Func`1 localInit, Action`1 localFinally) --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw(Exception source) at System.Threading.Tasks.Parallel.ThrowSingleCancellationExceptionOrOtherException(ICollection exceptions, CancellationToken cancelToken, Exception otherException) at System.Threading.Tasks.Parallel.ForWorker[TLocal](Int32 fromInclusive, Int32 toExclusive, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState, Func`4 bodyWithLocal, Func`1 localInit, Action`1 localFinally) at System.Threading.Tasks.Parallel.ForEachWorker[TSource,TLocal](TSource[] array, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState, Action`3 bodyWithStateAndIndex, Func`4 bodyWithStateAndLocal, Func`5 bodyWithEverything, Func`1 localInit, Action`1 localFinally) at System.Threading.Tasks.Parallel.ForEachWorker[TSource,TLocal](IEnumerable`1 source, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState, Action`3 bodyWithStateAndIndex, Func`4 bodyWithStateAndLocal, Func`5 bodyWithEverything, Func`1 localInit, Action`1 localFinally) at System.Threading.Tasks.Parallel.ForEach[TSource](IEnumerable`1 source, ParallelOptions parallelOptions, Action`2 body) at IntroSkip.AudioFingerprinting.AudioFingerprintScheduledTask.Execute(CancellationToken cancellationToken, IProgress`1 progress) at Emby.Server.Implementations.ScheduledTasks.ScheduledTaskWorker.ExecuteInternal(TaskOptions options)
samuelqwe 317 Posted August 19, 2021 Posted August 19, 2021 24 minutes ago, Sammy said: It is still failing and this time it lasted less than a minute.. One or more errors occurred. (Could not find file '&programdata&\plugins\configurations\introEncoding\3179764.bin'.) at System.Threading.Tasks.TaskReplicator.Run[TState](ReplicatableUserAction`1 action, ParallelOptions options, Boolean stopOnFirstFailure) at System.Threading.Tasks.Parallel.ForWorker[TLocal](Int32 fromInclusive, Int32 toExclusive, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState, Func`4 bodyWithLocal, Func`1 localInit, Action`1 localFinally) --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw(Exception source) at System.Threading.Tasks.Parallel.ThrowSingleCancellationExceptionOrOtherException(ICollection exceptions, CancellationToken cancelToken, Exception otherException) at System.Threading.Tasks.Parallel.ForWorker[TLocal](Int32 fromInclusive, Int32 toExclusive, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState, Func`4 bodyWithLocal, Func`1 localInit, Action`1 localFinally) at System.Threading.Tasks.Parallel.ForEachWorker[TSource,TLocal](TSource[] array, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState, Action`3 bodyWithStateAndIndex, Func`4 bodyWithStateAndLocal, Func`5 bodyWithEverything, Func`1 localInit, Action`1 localFinally) at System.Threading.Tasks.Parallel.ForEachWorker[TSource,TLocal](IEnumerable`1 source, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState, Action`3 bodyWithStateAndIndex, Func`4 bodyWithStateAndLocal, Func`5 bodyWithEverything, Func`1 localInit, Action`1 localFinally) at System.Threading.Tasks.Parallel.ForEach[TSource](IEnumerable`1 source, ParallelOptions parallelOptions, Action`2 body) at IntroSkip.AudioFingerprinting.AudioFingerprintScheduledTask.Execute(CancellationToken cancellationToken, IProgress`1 progress) at Emby.Server.Implementations.ScheduledTasks.ScheduledTaskWorker.ExecuteInternal(TaskOptions options) I am not seeing the error anymore myself, in fact, it worked fine after I restarted the task with the first build. The short duration is expected, though. The task fingerprints only missing episodes, so it will skip any that are already done.
samuelqwe 317 Posted August 19, 2021 Posted August 19, 2021 (edited) @chef There's also another issue I've found, and it has to do with episodes that are shorter than the audio fingerprint length. I have certain shows that are only around 10 minutes long, and the intro data seems totally off with the default 20 minute audio fingerprint length. Presumably, this issue happens because the plugins assumes that the fingerprint will be 20 minutes long no matter what. So there will need to be a way to for the plugin to know that the audio fingerprint will not be as long in this case. Also, anytime you manually stop any of the tasks, they will show up as having failed and report an error. That probably shouldn't happen. Edited August 19, 2021 by samuelqwe
chef 3810 Posted August 19, 2021 Posted August 19, 2021 7 minutes ago, samuelqwe said: @chef There's also another issue I've found, and it has to do with episodes that are shorter than the audio fingerprint length. I have certain shows that are only around 10 minutes long, and the intro data seems totally off with the default 20 minute audio fingerprint length. Presumably, this issue happens because the plugins assumes that the fingerprint will be 20 minutes long no matter what. So there will need to be a way to for the plugin to know that the audio fingerprint will not be as long in this case. Also, anytime you manually stop any of the tasks, they will show up as having failed and report an error. That probably shouldn't happen. Okay. The failed task is because I have to make sure to catch the Task.Cancelled exception. That is how c# cancels async task, by throwing the error. I shouldn't have expected the duration to be 20. Can you lower it successfully in the advanced settings? I've gotta figure out why it's removing the .bin file prior to processing the Sammy's data. Shouldn't take long.
chef 3810 Posted August 19, 2021 Posted August 19, 2021 @Sammy can you PM me an entire log. The plugin touches the .bin file three time, once when we make it once when we chunk the binary data into an array, and once when we remove it.
samuelqwe 317 Posted August 19, 2021 Posted August 19, 2021 5 minutes ago, chef said: I shouldn't have expected the duration to be 20. Can you lower it successfully in the advanced settings? I’m trying it now with a duration of 10 minutes. I believe that is what I was using before with the older plugin, so it should be fine with that. Obviously, there are some expected issues following the switch to the built-in chromaprint, but they should be fixable in some way. 1
chef 3810 Posted August 19, 2021 Posted August 19, 2021 1 hour ago, samuelqwe said: I’m trying it now with a duration of 10 minutes. I believe that is what I was using before with the older plugin, so it should be fine with that. Obviously, there are some expected issues following the switch to the built-in chromaprint, but they should be fixable in some way. I added a lot more error handling, and logging. I also added a bit of a delay between ffmpeg writing the .bin file and the plugin attempting to read it. I think that is where Sammy is experiencing the error. I also wrapped the entire task in a Task Canceled exception handler, so hopefully it will cancel silently now. I'll just try it out here, and see what happens.
chef 3810 Posted August 19, 2021 Posted August 19, 2021 (edited) Added more logging Try and kill the ffmpeg process with the cancelationToken if the task is canceled. Why won't it die! Added error handling to the writing and reading of the .bin file added a small delay before attempting to read the .bin file, after ffmpeg has releases it to the file system. fixed task cancelled error Only try and remove the .bin file if it has been read by the binaryReader Default encoding time is 10minutes. You can now increase the encoding time up to 20 minutes. IntroSkip_v2.zip @Sammy if something goes wrong we'll know about it in the logs. There is one small issue I am seeing... rogue ffmpeg instances existing after cancelled tasks. I've tried to stop them, but I get at least two out of four idling in the windows task manager. This may be fixed by giving a slight delay before attempting to kill the process, or let them run... Edited August 19, 2021 by chef
chef 3810 Posted August 20, 2021 Posted August 20, 2021 using a fresh database, I'm get quick results for my collection. I'll have to audit them. Considering there is a lot more places in the code where errors are thrown too stop the task and log a warning, it seems to be working pretty well.
Sammy 790 Posted August 20, 2021 Posted August 20, 2021 (edited) Love you long time.. Fingerprinting kicked off about 12 hours ago. Title Sequence Detection kicked off about 2 hours ago. Edited August 20, 2021 by Sammy 1 1
chef 3810 Posted August 20, 2021 Posted August 20, 2021 (edited) @Micael456 check it out 'contenteditable'. Just have to wire up the backend, and make sure it's not super buggy. I'm not exactly sure what a button looks like for saving en entire season, I'll have think about that... Edited August 20, 2021 by chef 1
Sammy 790 Posted August 20, 2021 Posted August 20, 2021 17 hours ago, chef said: @Sammy can you PM me an entire log. The plugin touches the .bin file three time, once when we make it once when we chunk the binary data into an array, and once when we remove it. Do you still need this log? I have the latest version running now.
chef 3810 Posted August 20, 2021 Posted August 20, 2021 1 hour ago, Sammy said: Do you still need this log? I have the latest version running now. Let's see what happens after it has finished. We should definitely check the results. Make sure sequences where hitting that 90% or higher ratio of success in the task. Thanks Sammy!!
crusher11 1101 Posted August 20, 2021 Posted August 20, 2021 Does anyone have the first season or two of NCIS? They used to do the black and white gimmick before the title sequence, so I'm assuming this would think that sound effect is actually the start of the title sequence?
chef 3810 Posted August 20, 2021 Posted August 20, 2021 (edited) 29 minutes ago, crusher11 said: Does anyone have the first season or two of NCIS? They used to do the black and white gimmick before the title sequence, so I'm assuming this would think that sound effect is actually the start of the title sequence? I'll grab NCIS and check it out. I think that by using the 'contenteditable' flag in the table, it will help us handle episodes that just can't be found, and fall into that grey zone like some DNSP episodes. They'll have an entry in the database, but we'll count them as failures and they'll have to be manually fixed. I can flag items in the UI with an astrix that have been flagged in the db as failures and need attention. If an item for sure has no intro, we can flag items as failures, but they will be able to be set as success by hitting the check mark button that I will add to the table row. Edited August 20, 2021 by chef
rbjtech 5284 Posted August 20, 2021 Posted August 20, 2021 45 minutes ago, chef said: I'll grab NCIS and check it out. I think that by using the 'contenteditable' flag in the table, it will help us handle episodes that just can't be found, and fall into that grey zone like some DNSP episodes. They'll have an entry in the database, but we'll count them as failures and they'll have to be manually fixed. I can flag items in the UI with an astrix that have been flagged in the db as failures and need attention. If an item for sure has no intro, we can flag items as failures, but they will be able to be set as success by hitting the check mark button that I will add to the table row. This is perfect @chef - As long as we can run a 'report' on the failures/no intro found then that's all we need. If you have hundreds of shows with multiple seasons and thousands of episodes, it's not really feasible to hunt for them manually. Nice progress for the end of the week - Fantastic work as always ! ps - I've been using the Auto Organise plugin this week - it's a vast improvement on the old version - so just thought I'd pass on my thanks for that awesome plugin re-work as well 1 1
Recommended Posts