Treat MKV and MP4 as same file and overwrite if new file is better than previous

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
Movieaholic
Posts: 20
Joined: 31 Jul 2017, 03:17

Treat MKV and MP4 as same file and overwrite if new file is better than previous

Post by Movieaholic »

Hi
I use amc script to sort out my media but i spend alot of my time deleting duplicates of files that are there because the i have downloaded either a mkv or mp4 version of the file is there a way to treat those the same and only overwrite the current file if the new file is better quality?
User avatar
rednoah
The Source
Posts: 23003
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Treat MKV and MP4 as same file and overwrite if new file is better than previous

Post by rednoah »

e.g. find duplicates:

Shell: Select all

filebot -script fn:duplicates /path/to/files
e.g. find and delete duplicates:

Shell: Select all

filebot -script fn:duplicates /path/to/files --action delete

:arrow: :arrow: Find Duplicate Movie or Episode Files


EDIT:

:idea: If you are not yet aware of Metadata and Extended Attributes please make sure to read up on that as well.
:idea: Please read the FAQ and How to Request Help.
Movieaholic
Posts: 20
Joined: 31 Jul 2017, 03:17

Re: Treat MKV and MP4 as same file and overwrite if new file is better than previous

Post by Movieaholic »

Thats exactly what i was looking for thanks :D
Movieaholic
Posts: 20
Joined: 31 Jul 2017, 03:17

Re: Treat MKV and MP4 as same file and overwrite if new file is better than previous

Post by Movieaholic »

I gave this a try and it worked mostly, on the odd occasion the 1080p version file will be bigger than the 4k version is there a way to skip that file if this is the case so i can manually look at it and decide for myself?
User avatar
rednoah
The Source
Posts: 23003
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Treat MKV and MP4 as same file and overwrite if new file is better than previous

Post by rednoah »

:idea: The default quality metric will prioritize video resolution over file size (i.e. 4K always beats 2K) so what you're asking for is default behaviour?

:?: Unless you're saying you want to keep the bigger 2K file over the smaller 4K file? You could provide your own "quality function" that decides which is better, but you won't get any kind of "let me decide" on the command-line, unless you do "find duplicates" and then write your own code to work with the results.
:idea: Please read the FAQ and How to Request Help.
Movieaholic
Posts: 20
Joined: 31 Jul 2017, 03:17

Re: Treat MKV and MP4 as same file and overwrite if new file is better than previous

Post by Movieaholic »

:?: Unless you're saying you want to keep the bigger 2K file over the smaller 4K file?
Yeah It doesn't happen very often but it does happen, was just interested to know if there was a way to skip this duplicate match for manual inspection later?
User avatar
rednoah
The Source
Posts: 23003
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Treat MKV and MP4 as same file and overwrite if new file is better than previous

Post by rednoah »

Movieaholic wrote: 07 Oct 2023, 11:14 Yeah It doesn't happen very often but it does happen, was just interested to know if there was a way to skip this duplicate match for manual inspection later?
Unfortunately, this corner case is not supported. There is always one best file and the script does not implement special behaviours for multiple best files or no best files.
:idea: Please read the FAQ and How to Request Help.
User avatar
rednoah
The Source
Posts: 23003
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Treat MKV and MP4 as same file and overwrite if new file is better than previous

Post by rednoah »

FileBot r10089 (latest revision; not latest stable release; at time of writing) improves support for this kind of use case via custom post-processing scripts. See Custom Post-Processing Scripts › Delete duplicates for example.
:idea: Please read the FAQ and How to Request Help.
Movieaholic
Posts: 20
Joined: 31 Jul 2017, 03:17

Re: Treat MKV and MP4 as same file and overwrite if new file is better than previous

Post by Movieaholic »

After playing with this a bit it seems im not sure quite how it works/ doing something wrong it worked exactly as expected for movies but for tv shows not so much
https://tinypic.host/image/filebot.SjVNE
https://tinypic.host/image/plex.SjGfQ

Screenshot
Screenshot
Movieaholic
Posts: 20
Joined: 31 Jul 2017, 03:17

Re: Treat MKV and MP4 as same file and overwrite if new file is better than previous

Post by Movieaholic »

rednoah wrote: 09 Oct 2023, 06:00 :?: Do files have xattr metadata?
I see why its not working the mkv files were originally name with TheMovieDB and the mp4 with TheTVDB so it views it as 2 different shows. Thanks
User avatar
rednoah
The Source
Posts: 23003
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Treat MKV and MP4 as same file and overwrite if new file is better than previous

Post by rednoah »

Ah, yes. If database / ID is different, then the "logical duplicates" detection wouldn't work.
:idea: Please read the FAQ and How to Request Help.
Post Reply