Cover cropper - Creating Kodi style poster files from covers

SamKook

Grand Wizard
Staff member
Super Moderator
Uploader
May 10, 2009
3,755
5,154
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
101
5
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,755
5,154
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
101
5
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,755
5,154
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
101
5
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,755
5,154
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
101
5
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: 8
  • Capture2.JPG
    Capture2.JPG
    65.1 KB · Views: 8

SamKook

Grand Wizard
Staff member
Super Moderator
Uploader
May 10, 2009
3,755
5,154
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
101
5
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,755
5,154
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
101
5
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: 7
Last edited:

SamKook

Grand Wizard
Staff member
Super Moderator
Uploader
May 10, 2009
3,755
5,154
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.
 

Fetterbr

Member
Dec 10, 2010
101
5
Hi.
I feel it would be useful with some extra help when making Cover or Posters. So a few idears.
1) When it stops and aske you to select a picture i am still not sure that i click the right picture, Please change the text to " Click the picture you want to use as your new "Poster""
2) When you don't have a Fanart picture but only a Poster size picture there should be a selection where you can say, "Copy Fanart picture as Poster".
3)After finish the program run there should be a selection " Show final result for possible errors" When you click this selection a explorer window will open and show you the new Posters where you can select the Posters what are wrong and they will rerun where you can redo the chance.

thanks for you consideration.

I have another request if you can help. I need a way to see in my movie folder what movies are missing subtitle files. I haven't found a way yet how to do this yet. Was thinking if a little program could scan according to my selection of extensions and file name maybe first 6 letters in the file name.
 
Last edited:

SamKook

Grand Wizard
Staff member
Super Moderator
Uploader
May 10, 2009
3,755
5,154
Hi, sorry I haven't done anything from you're previous post, been too busy to work on it.

It can be re-worded to make it obvious it's meant to be used to make the poster, yes.

Even if it's poster sized, it needs to be processed to keep the correct aspect ratio so it's handled no differently than a normal cover for that reason. With that said, it might be a good idea to have the option to copy it too if it's close enough since jpg is lossy,

I'm not sure why you want to verify the posters after instead of during, you don't have to go through the trouble of selecting them all that way and the semi-auto mode(confirm on threshold) can skip all of those that are almost certain to be correct.
I do plan to add a separate option to verify the posters though since that would definitely be useful. Likely just display the poster in the app and have a button to re-select the cover to redo it if wrong or something like that, haven't thought it through.

Redoing only specific folders wouldn't work the way I do things right now since it forces the scan of every subfolders which could be problematic in some cases, but I do need to add the option to only do 1 specific poster so I can use this instead of the code from my script I ported over to this app(to avoid maintaining both), which fixed a few bugs I had. That means I could do multiple selection if I wanted to instead of showing them one by one but I'm just not sure how I would display many in a way that's good enough to tell if there's an issue with the poster or not since it might just be a few pixels off in some cases.


Might be able to make a simple bat file to do that, but javluv handles subtitles so are you sure there's not a way to tell with it already?
Also not sure what you mean by "and file name maybe first 6 letters in the file name.". I would expect the filenames to follow the movie names so they'll never have a fixed first few characters, what would specifying those achieve?
 

Fetterbr

Member
Dec 10, 2010
101
5
Hi, sorry I haven't done anything from you're previous post, been too busy to work on it.

It can be re-worded to make it obvious it's meant to be used to make the poster, yes.

Even if it's poster sized, it needs to be processed to keep the correct aspect ratio so it's handled no differently than a normal cover for that reason. With that said, it might be a good idea to have the option to copy it too if it's close enough since jpg is lossy,

I'm not sure why you want to verify the posters after instead of during, you don't have to go through the trouble of selecting them all that way and the semi-auto mode(confirm on threshold) can skip all of those that are almost certain to be correct.
I do plan to add a separate option to verify the posters though since that would definitely be useful. Likely just display the poster in the app and have a button to re-select the cover to redo it if wrong or something like that, haven't thought it through.

Redoing only specific folders wouldn't work the way I do things right now since it forces the scan of every subfolders which could be problematic in some cases, but I do need to add the option to only do 1 specific poster so I can use this instead of the code from my script I ported over to this app(to avoid maintaining both), which fixed a few bugs I had. That means I could do multiple selection if I wanted to instead of showing them one by one but I'm just not sure how I would display many in a way that's good enough to tell if there's an issue with the poster or not since it might just be a few pixels off in some cases.


Might be able to make a simple bat file to do that, but javluv handles subtitles so are you sure there's not a way to tell with it already?
Also not sure what you mean by "and file name maybe first 6 letters in the file name.". I would expect the filenames to follow the movie names so they'll never have a fixed first few characters, what would specifying those achieve?
quick answer, Javluv doesn't save the file in the movie folder automatically, when you have a new movie and a new subtitle file javluv will put them together but not if you get the subtitle after the movie is in the new folder. You have to do it manually one by one.
The best solution i have found is to Use Subtitle Edit/Whisper and make a new subtitle, it save in the same folder as the movie. For that i need a small bat file what shows me wich subtitle i still need to make.
 

Fetterbr

Member
Dec 10, 2010
101
5
Ok sorry i just saw it now.
I need a bat file what will show me or maybe the way for me to show the search result in win explorer.
1) List of movie files in win explorer what don't have a .srt file in the same folder as the movie.
2) List of expanded Folders where there is 2 or more files with -Fanart in the end of the filename.
 

Fetterbr

Member
Dec 10, 2010
101
5
I was thinking would it be easy to make the program embedder the cover or in my case the poster picture in the movie file ?
 

SamKook

Grand Wizard
Staff member
Super Moderator
Uploader
May 10, 2009
3,755
5,154
I think only mkv supports that. You'd have to remux everything into that and embed the file at the same time. Can be done with a simple bat file controlling mkvtoolnix but there's the risk of weird stuff happening so I wouldn't want to delete the original file and that would eat a ton of space.
 

Fetterbr

Member
Dec 10, 2010
101
5
i tried a free app called mp3tag and i did add the cover in mp4 file was very easy but i could not figure how to do it in batch