Jump to content

Auto Organize - Expanding its functionality


aaronsomek

Recommended Posts

3 hours ago, TheUrbanXplorer said:

and "Extended Killer Cut"

I wonder if we can use regex to look for the word "Extended" and "Cut", then read all the strings between the two words inorder to get the naming. 

So we should try to loosen the constraints when looking at the naming options.

See if we can get a broader match.

Link to comment
Share on other sites

TheUrbanXplorer
2 hours ago, chef said:

I wonder if we can use regex to look for the word "Extended" and "Cut", then read all the strings between the two words inorder to get the naming. 

So we should try to loosen the constraints when looking at the naming options.

See if we can get a broader match.

That would at least be an idea. The special editions are usually labelled "Special (...) Edition" and "Special (...) Cut".
Could possibly work.

Link to comment
Share on other sites

chef, I just ran into the issue I described here and the following posts:

Anything you could to about it?

Currently, I have to organize those files manually

Edit: The latest version a couple of posts ago does seem to be unavailable.

Edited by neik
Link to comment
Share on other sites

11 minutes ago, neik said:

chef, I just ran into the issue I described here and the following posts:

Anything you could to about it?

Currently, I have to organize those files manually

Edit: The latest version a couple of posts ago does seem to be unavailable.

Perhaps a folder option would work.

Sort movies by resolution.

Let's see here.

I'll try.

Link to comment
Share on other sites

Horray! I have done it with regular expressions. It was surprisingly easy!

Now if the movie name has any of the trigger words we find them and add them to the name result.

class Program
    {
        static void Main(string[] args)
        {
            var sourceFileName = "MovieTest.2021.Bluray.Directors.Cut.DTS.mkv";
            var input = sourceFileName.Replace(".", " ");
            var namingOptions = new NamingOptions();
            var pattern = $"{string.Join("|", namingOptions.VideoReleaseEditionFlags)}";
            var result = Regex.Matches(input, pattern, RegexOptions.IgnoreCase);
            Console.WriteLine(result);
		//Output: ["Directors", "Cut"]
        }
    }

    public class NamingOptions
    {
        public string[] VideoReleaseEditionFlags = new string[]
        {
                "Theatrical",
                "Version",
                "Extended",
                "Special",
                "Edition",
                "Directors",
                "Final" ,
                "Cut",
                "Uncut",
        };
    }

 

Edited by chef
Link to comment
Share on other sites

OMG! watch what happens when I create the greatest movie that has ever been made in cinema history! 😆

MovieTest.2021.Bluray.Ultimate.Unrated.Extended.Directors.Cut.Special.Edition.Version.DTS.mkv

movieVersionNaming.png.6b6b5a60c86a4a2cb745629cd52e5599.png

 

Works like a charm!

 

WOW! That movie sounds awesome! Too bad it's encoded in DTS!  {sarcasm}.

Edited by chef
Link to comment
Share on other sites

TheUrbanXplorer
9 hours ago, chef said:

OMG! watch what happens when I create the greatest movie that has ever been made in cinema history! 😆

MovieTest.2021.Bluray.Ultimate.Unrated.Extended.Directors.Cut.Special.Edition.Version.DTS.mkv

movieVersionNaming.png.6b6b5a60c86a4a2cb745629cd52e5599.png

 

Works like a charm!

 

WOW! That movie sounds awesome! Too bad it's encoded in DTS!  {sarcasm}.

Hello @chef,
something went wrong...🤣

1793637565_Screenshot2021-12-2209_38_13.thumb.png.3b750005e78f1b4dccceb05eae9efc1e.png

Link to comment
Share on other sites

Aw! When I copied the code over from my testing console, I did a poor job of it.

 

I will fix immediately! I apologize.

Link to comment
Share on other sites

guess when testing on a console application the Regex is  lenient, compared to other environments.

Other environments expect you to iterate the MatchCollection.

Here is a fix! I

Emby.AutoOrganize.zip

 

autoo.thumb.png.35acf9fc4cb0dd80de6c41519beae8da.png

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

TheUrbanXplorer
15 hours ago, chef said:

guess when testing on a console application the Regex is  lenient, compared to other environments.

Other environments expect you to iterate the MatchCollection.

Here is a fix! I

Emby.AutoOrganize.zip 133.02 kB · 3 downloads

 

autoo.thumb.png.35acf9fc4cb0dd80de6c41519beae8da.png

Hello @chef,
seems to be running again. I will test a little and then give feedback.

  • Thanks 1
Link to comment
Share on other sites

ttgapers

Updated to latest --- works good after the DB removal. Like the updates...just poking the bear around updates on sub-titles (if even just looking for SRT files that match media name).

Cheers and best wishes going into the new year!

  • Like 2
Link to comment
Share on other sites

Garbonzo17

thanks @chef for pointing me here.

I just installed 1.6.0.5 and it looks like alot has indeed changed.

I really preferred using it anyway, at least for movies beacuse that isn't as automated in Radarr for me as I tend to let Sonarr run the show.  But with Radarr I am still doing a fair bit of ripping my on DVD/Blurays and in general the Auto-Organize plugin gets the job done....

that image I posed (and will below again) seemed like something I hadn't really noticed since last I lost a big part of my collection last year.  But I have only been on UnRAID for like a month, and it wouldn't be the first things that has behaved slightly different (than windows)... but I thought I had adjusted to everything since going to docker (on openmediavault) earlier last year..

Anyway, here is the image agian...

890013414_auto-organizemissingfiles.thumb.png.2ab26397b566e48da738b380dea7845a.png

 

  • Like 1
Link to comment
Share on other sites

chef
1 hour ago, Garbonzo17 said:

thanks @chef for pointing me here.

I just installed 1.6.0.5 and it looks like alot has indeed changed.

I really preferred using it anyway, at least for movies beacuse that isn't as automated in Radarr for me as I tend to let Sonarr run the show.  But with Radarr I am still doing a fair bit of ripping my on DVD/Blurays and in general the Auto-Organize plugin gets the job done....

that image I posed (and will below again) seemed like something I hadn't really noticed since last I lost a big part of my collection last year.  But I have only been on UnRAID for like a month, and it wouldn't be the first things that has behaved slightly different (than windows)... but I thought I had adjusted to everything since going to docker (on openmediavault) earlier last year..

Anyway, here is the image agian...

890013414_auto-organizemissingfiles.thumb.png.2ab26397b566e48da738b380dea7845a.png

 

Welcome. 

At first I thought there could be issues accessing the source file when trying to move it. But it looks as though other files in the source folder have moved with out issue.

I thought also that it was unable to identify the source file, but that  doesn't seem to be the case because the code has indeed identified it.

 

When trying out this new version of the plugin, you'll have to remove the "fileorganization.db" before loading. We have added rows to the data table in the database.

Afterwards, I was wondering if you would want to try to add those files to the source folder again to attempt sorting.

If the problem persists, then maybe you could PM me a log. That will hopefully tell us what happened.

The original plugin was a bit "janky" in some methods. I've tried to smooth out the code, and I've added a lot of logging, so we can see where things go wrong.

I hope that will tell us something.

Link to comment
Share on other sites

Garbonzo17

Yeah, that fileorganization.db was a wall for a few mins, but I just read up a few comments and it was covered.

I will rename the files, but here is a bit of a twinkle of an insight....

I looked at my BACKUP of my media UNRAID media folder (which lives on a windows machine still, using stablebit drivepool) and noticed that the files this was "updating" were all AVI files EXCEPT for S01E21 which happened to be MP4.  So I noticed it OVEREWROTE all of the avi's which was what was expected (that's how it was set, although it seems like on windows with same settings it put them side-by-side but that might just be with mp4 and mkv... something used to behave contrary to my settings of move and replace/overwrite existing, but I can't recall exactly what the settings were and it probably doesnt matter as things have "moved on" with the plugin it seems)

Anyway, I just thought it strange the one file that just got dropped into a black hole, was the one that wasn't overwriting an avi file (doesn't explain why it showed a problem with E20 at all though)... but I still have the windows embyserver installed (disabled) on my backup location, and I need to start that up and disable all of the metadata updating (everytime I start that server it is jacking up my backup script when it makes changes) So I will see how THAT (old plugin handles it on windows VS how the new plugin handles it on UnRAID and let you know if anything is not as expected)

Sorry for rambling... it was kinda stream of consciousness and I don't have time to go back and edit it atm.. 

-G

  • Thanks 1
Link to comment
Share on other sites

chef
On 1/4/2022 at 3:20 PM, Garbonzo17 said:

Yeah, that fileorganization.db was a wall for a few mins, but I just read up a few comments and it was covered.

I will rename the files, but here is a bit of a twinkle of an insight....

I looked at my BACKUP of my media UNRAID media folder (which lives on a windows machine still, using stablebit drivepool) and noticed that the files this was "updating" were all AVI files EXCEPT for S01E21 which happened to be MP4.  So I noticed it OVEREWROTE all of the avi's which was what was expected (that's how it was set, although it seems like on windows with same settings it put them side-by-side but that might just be with mp4 and mkv... something used to behave contrary to my settings of move and replace/overwrite existing, but I can't recall exactly what the settings were and it probably doesnt matter as things have "moved on" with the plugin it seems)

Anyway, I just thought it strange the one file that just got dropped into a black hole, was the one that wasn't overwriting an avi file (doesn't explain why it showed a problem with E20 at all though)... but I still have the windows embyserver installed (disabled) on my backup location, and I need to start that up and disable all of the metadata updating (everytime I start that server it is jacking up my backup script when it makes changes) So I will see how THAT (old plugin handles it on windows VS how the new plugin handles it on UnRAID and let you know if anything is not as expected)

Sorry for rambling... it was kinda stream of consciousness and I don't have time to go back and edit it atm.. 

-G

Oh that is interesting...

just to make sure I understand. The expected behaviour is to replace the file in the library? 

On windows the file is copied, but on Linux the file is replaced? Except for the one file which just disappeared.

 

You guys will have to forgive me, I might be absent for a couple days here. I am battling that famous virus. I will be back! 

Edited by chef
  • Sad 2
Link to comment
Share on other sites

ttgapers
1 hour ago, chef said:

You guys will have to forgive me, I might be absent for a couple days here. I am battling that famous virus. I will be back! 

Good luck bro! It's affecting lots in our neck of the woods this time around. Be safe and get your rest!

  • Thanks 1
Link to comment
Share on other sites

chef

Last night, my auto-copier plugin copied a new version of a movie that already existed in the Emby library, into the auto organize folder for sorting.

It appeared in the table, and should have been marked as an existing item.

Instead it was marked as "Unidentified".

That wasn't expected behaviour, however I was able to use the "Identify" button, and the plugin then marked the file as "Existing Item". 

It was an extra step, but it ended up putting the file into an expected state.

Next, I attempted to sort the file.

The expected behaviour was to have to file copy over the one in the library.

But, unfortunately this didn't happen. 

When a movie is new to emby, and is first sorted (there isn't a version of it already in the library) there doesn't seem to be an issue with creating it. But, if it exists already, there is an issue coping it over the older version.

I know where that code is, and it needs to be looked at. 

I think this could also be what Garbonzo17 is experiencing as well. 

 

 

 

Edited by chef
Link to comment
Share on other sites

Garbonzo17
On 1/6/2022 at 10:14 AM, chef said:

Instead it was marked as "Unidentified".

That wasn't expected behaviour, however I was able to use the "Identify" button, and the plugin then marked the file as "Existing Item". 

It was an extra step, but it ended up putting the file into an expected state.

Next, I attempted to sort the file.

The expected behaviour was to have to file copy over the one in the library.

But, unfortunately this didn't happen. 

When a movie is new to emby, and is first sorted (there isn't a version of it already in the library) there doesn't seem to be an issue with creating it. But, if it exists already, there is an issue coping it over the older version.

I know where that code is, and it needs to be looked at. 

I think this could also be what Garbonzo17 is experiencing as well. 

 

 

 

Some of that I am experiencing with this 1.6.0.5 (probably most >1.6 versions, but I am new to these) and I resolve it in the manner you described. But I think it's just because it is showing my more information than it used too...  for a TV show where I ripped the whole season, then moved them to my organize folder, they all came up as unidentified (in orange) first, then one by one slowly processed and went into the correct folder marked "theatrical version" (green) so it seems to be working slower... but that could be it was faster when replacing series I have never had vs things I have (I have been replacing about 30% of my library that I lost last year)... 

But yes, on windows (which still has version 1.6.0 and earlier same behavior) I noticed over time while tweaking settings in Sonarr, I would get an MKV and an MP4 version of the same show downloaded. And even though AutoOrgainze was handling the renaming at that point (sonarr's disabled) it was copying BOTH (with the settings in AO set to move/overwrite).

Anyway for the most part the newer verison seems to be doing well for me, and I will keep an eye out for any more weird behavior. Still have sometimes when the webui appears hung while processing alot of files, but then I do an F5 refresh firefox and the file it was 'hung' on as well as many beyond have correctly processed, so it may be a browser issue... 

-g

p.s. @chef hope you are coming out the other side of this mess ok!

  • Agree 1
  • Thanks 1
Link to comment
Share on other sites

  • 3 weeks later...
TheUrbanXplorer

Hey @chef

The plugin still has the problem that the original title is assigned, not the country-specific one (here German).
Accordingly, the first episodes are named incorrectly.
Once the series is known in Emby, it works.
The problems persist when the series is newly created.
Strangely enough, the problem does not exist with movies, but only with series.

image.thumb.png.656a9e46af063e27499a839f5bd51307.png

Link to comment
Share on other sites

chef
30 minutes ago, TheUrbanXplorer said:

Hey @chef

The plugin still has the problem that the original title is assigned, not the country-specific one (here German).
Accordingly, the first episodes are named incorrectly.
Once the series is known in Emby, it works.
The problems persist when the series is newly created.
Strangely enough, the problem does not exist with movies, but only with series.

image.thumb.png.656a9e46af063e27499a839f5bd51307.png

 

 

Was that series auto detected during your test? or did you have to identify it?

 

I'm having some serious issues with the metadata providers right now, and I think this related.

 

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