Cover cropper - Creating Kodi style poster files from covers

SamKook

Grand Wizard
Staff member
Super Moderator
Uploader
May 10, 2009
3,609
4,967
The cover structure you have doesn't check for the suffix so in that state, it just loads the first thing it can get an image size of, which ended up being a movie for some reason(you can see it in the status bar)... not sure how that's possible and that's why it stopped, it's trying to load a movie as an image.

Using [code]/[any][suffix][any].[any] should detect the cover better in your case, but I'll see if I can reproduce this to figure out how it did that.

Edit: I see, the code gets set to "AEGE-017 ((Unknown))" because that's the dir name so the only match is the mp4 and there must be a bug where it gets loaded anyway if it's a perfect match somehow, gotta figure that one out.

Edit2: ... it doesn't do the image check if there's only one result, that's definitely a problem I need to fix.
 
Last edited:

Fetterbr

Member
Dec 10, 2010
57
2
Hi.
After a day or 2 i tryed to rerun the folder because i downloaded a few new muvies, but now it stops randomly on any number, some times it stops on 25,tham 82 or whatever. the total is also wrong i think. see picture
 

Attachments

  • Capture.JPG
    Capture.JPG
    94.9 KB · Views: 3

SamKook

Grand Wizard
Staff member
Super Moderator
Uploader
May 10, 2009
3,609
4,967
Does it always stop at 749 for the total?

Since the status bar is still showing the root path, that means it skipped all the ones it processed and seems to crash while checking all of the folders for covers. The numbers start going up as soon as you open up the path so it must stop pretty quickly if the first number is random.

I'm assuming something is different inside one of the new folders you added and somehow made it crash, that's one gonna be trickier to figure out. If you can see something that would be different in one of them, it would help, else I'll likely have to add an output for the errors and have you try it, unless I can see something obvious that's not handled.

Edit: Made a new version with the fix from last time and extra error handling at the most likely place it could crash for this problem(should show a message box and continue after. Let me know what the message box says if it appears) and it'll display the last folder it scanned in the status bar so the problematic one should be the one after(knowing what it is and its content would help me reproduce the problem).
I added the link to the first post but here it is also: https://www.mediafire.com/file/mkjnt4ddd18ai6b/Cover_cropper_v1.1.7z/file

I did try a fully auto scan with poster skip and it was keeping up with the total so seems a bit odd you're so far behind, but it could be because I was doing it over the network or something.
 
Last edited:

Fetterbr

Member
Dec 10, 2010
57
2
When the system brings up a box like this i assume when it says press the cover it means the picture with left and right picture. The one i call Fanart.
The right picture only is for me the Poster. Its just because i have got some funnt pictures as Poster and i believe its because i press the wrong.
 

Attachments

  • Capture 1.JPG
    Capture 1.JPG
    126.3 KB · Views: 2

SamKook

Grand Wizard
Staff member
Super Moderator
Uploader
May 10, 2009
3,609
4,967
I used the term cover for the source image since usually it will be a DVD or BluRay cover, but it can be anything. And yes, I use the term poster for the cropped final image, which is usually the right part of said covers but can be any part if you select it manually.

The detection has maybe a 90% success rate so you have to fix a few since you used full auto(I made the semi-auto mode to detect potential duds and fix them right away instead of later and still have most of them get cropped automatically).
Looking at that first one dimensions on your screenshot, it's not the usual aspect ratio for them(looks like poster dimensions) so it'll likely give a weird result on auto-mode since that picks the first. It's supported to use a poster as the source if you manually resize the selection but I haven't added detection for that scenario yet. I plan to though since studios like Dandy have the front and back separate on their website.

Does this mean the previous problem you had went away since you're not mentioning it now?
 

Fetterbr

Member
Dec 10, 2010
57
2
I used the term cover for the source image since usually it will be a DVD or BluRay cover, but it can be anything. And yes, I use the term poster for the cropped final image, which is usually the right part of said covers but can be any part if you select it manually.

The detection has maybe a 90% success rate so you have to fix a few since you used full auto(I made the semi-auto mode to detect potential duds and fix them right away instead of later and still have most of them get cropped automatically).
Looking at that first one dimensions on your screenshot, it's not the usual aspect ratio for them(looks like poster dimensions) so it'll likely give a weird result on auto-mode since that picks the first. It's supported to use a poster as the source if you manually resize the selection but I haven't added detection for that scenario yet. I plan to though since studios like Dandy have the front and back separate on their website.

Does this mean the previous problem you had went away since you're not mentioning it now?
I have been reading up about issues with windows explorer and Javluv and it seams to be a problem when you get around 4000 movies and in connection with Onedrive somehow. I am not quite sure but it has problems showing the right data in explorer sometimes, seams like its slow in updating. As soon as i see the problem in your program i make a restart of windows and the problem is gone for the time being. its for sure not your program i think. I have got an issue that the program makes copies of the cover and gives same name just with Poster at the end but i haven't been able to replicate it.
 

SamKook

Grand Wizard
Staff member
Super Moderator
Uploader
May 10, 2009
3,609
4,967
Oh, I see, windows with syncing folder could possibly cause issues, good to know. I was already handling permission errors and I've added a catch all for other issues with listing the folder in v1.1, but I guess if it has issue writing back to those folders when trying to save the poster if they're temporarily locked by syncing or something like that, it could produce the behavior you had.

Do make sure you check the actual picture if you see the poster shows up as a cover and not just tell by looking at a thumbnail. I ran into this issue when testing with my covers. A few of the cover files had internal thumbnails that remained once cropped. I added code to strip those out so they shouldn't remain but I didn't have many to test with so maybe they could remain for some files.
If the actual poster image is still the cover, the only way this could happen, that I can think of, would be if imagemagick thought the values for cropping didn't make sense and it just did nothing and outputted same size as the original but I'm not sure how this could happen.
 

Fetterbr

Member
Dec 10, 2010
57
2
here for instance it has created a poster but with a totally different name. As you can see i have clicked ignore when poster excists.
 

Attachments

  • Capture1.JPG
    Capture1.JPG
    70.6 KB · Views: 5
  • Capture2.JPG
    Capture2.JPG
    65.1 KB · Views: 5

SamKook

Grand Wizard
Staff member
Super Moderator
Uploader
May 10, 2009
3,609
4,967
The way it works is that it lists all the files in a folder when it scans it, finds the cover for the folder, decides which poster files should be saved, in your case it uses the movie name so it'll scan all the movie files in the current folder and save a poster for each of them.
It doesn't match the movie filename to the cover name in case the person uses different names for them.

What it looks like to me is that you had 2 video files in the same folder when it got scanned, "JKNK-041 (2016)" and "VVVD-205 (2022)" so it made poster files for both from the first cover it found.

You're only showing image files in the folder so I don't know if you happened to scan when javluv had multiple videos in a processing folder or something(not sure how it works exactly) or if there's more than one video in there now.

It can save more than one poster file for cases like this where there can be multiple version of the same movie:
Multi-version.jpg
 

Fetterbr

Member
Dec 10, 2010
57
2
The way it works is that it lists all the files in a folder when it scans it, finds the cover for the folder, decides which poster files should be saved, in your case it uses the movie name so it'll scan all the movie files in the current folder and save a poster for each of them.
It doesn't match the movie filename to the cover name in case the person uses different names for them.

What it looks like to me is that you had 2 video files in the same folder when it got scanned, "JKNK-041 (2016)" and "VVVD-205 (2022)" so it made poster files for both from the first cover it found.

You're only showing image files in the folder so I don't know if you happened to scan when javluv had multiple videos in a processing folder or something(not sure how it works exactly) or if there's more than one video in there now.

It can save more than one poster file for cases like this where there can be multiple version of the same movie:
View attachment 3486999
no i only have one movie in each folder, its the only way Kodi will read it. see picture.
 

Attachments

  • Capture.JPG
    Capture.JPG
    74.7 KB · Views: 2

SamKook

Grand Wizard
Staff member
Super Moderator
Uploader
May 10, 2009
3,609
4,967
If it wasn't in a temp folder with another video, I'm really not sure how this could happen, the only way it can save to a different folder than the file it scanned is located in is if "Save path override" is set and everything would go there in that case. And since the poster was the same as the one for that folder, I'm even more confused at how it's possible.

Kodi can read many files in the same folder btw, my normal movies are all in 1 folder and it never had any issues with it, unless they changed something. As long as the nfo and images are named after the video, it can detect and associate it with them fine, even if other files are around, it might just choose a random one to display for the main folder.

I see the window says search results. Is it displaying all the search result now or did you search for the folder name and then opened it? It would obviously not show the other potential files in there if it's only displaying the search results matching that name, but it does seem to be the latter, although I'm not super familiar with how the "recent" windows search works since I never use it.

Are they both located in the same folder and Is VVVD-205 (2022) the next folder after JKNK-041 (2016)? If it's the next scanned folder maybe it could have desynced somehow but that shouldn't be possible either since everything is based on the folder path, it should never look at any file outside of that.
 

Fetterbr

Member
Dec 10, 2010
57
2
1: Selecting the folder to work on. Make so you can select several folders or files if needed.
2: After finish batch make so you can see the result and remake single pictures if needed.
also a question, see picture, how can this happen in 2 % of the time
 

Attachments

  • Capture10.JPG
    Capture10.JPG
    229.4 KB · Views: 3
Last edited:

SamKook

Grand Wizard
Staff member
Super Moderator
Uploader
May 10, 2009
3,609
4,967
I guess it could be useful to select multiple if you're trying to fix a few of them afterwards. The issue is that the UI I used doesn't support selecting multiple folders at once, it only allows for one so selecting them all one by one, you might as well run it in between for each folder selection, there's not much difference.
I'll see if I can get around that limitation somehow.

That is the whole point of the crop method, so you can check as you go if you want to, but you chose fully auto so it never asked. Might not be a bad idea to have a way to double check existing ones though, would also be useful for pre-existing poster files so I'll try to add that.

Like I said, the detection algorithm isn't perfect, there's still improvements to be made. The black of the front of the cover blends in with the spine enough that it doesn't know where the edge is and the current way I handle it, it looks for the first edge a little bit to the right of the center of the image and that can be super far if it didn't detect anything in the expected location, like in this case.
You can enable toggle edges in the debug panel to see what it detected as edges and increase the amount of them by changing detected edges, but having too many also create problems.
I have ideas but just haven't had the time to spend a whole lot of time on it.