Override existing file - different extension

Any questions? Need some help?
Post Reply
Achandab
Donor
Posts: 109
Joined: 04 Nov 2013, 21:20

Override existing file - different extension

Post by Achandab »

Is it possible for the override command to overwrite existing file if the extension is different? At the moment when AMC is importing movie file i seem to have duplicates of the files with different extensions

Example

Gladiator\Gladiator.mvk
Gladiator\Gladiator.mp4
Gladiator\Gladiator..avi

I only wish to have one copy, preferably the latest and largest file size. I thought override handled this?
User avatar
rednoah
The Source
Posts: 23000
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Override existing file - different extension

Post by rednoah »

1.
I thought override handled this?
The amc script does not support those kind of "duplicate" checks. Conflict behaviour doesn't come into play if the file path is different.


2.
I only wish to have one copy, preferably the latest and largest file size.
That might be conceivable as a separate script that detects and delete semantic duplicates.
:idea: Please read the FAQ and How to Request Help.
Achandab
Donor
Posts: 109
Joined: 04 Nov 2013, 21:20

Re: Override existing file - different extension

Post by Achandab »

Ah okay, so override only works if the file extension is the same?

Is this script something you are looking at developing? At the moment im using a file duplicator software to manually remove them each time
User avatar
rednoah
The Source
Posts: 23000
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Override existing file - different extension

Post by rednoah »

I guess this is already half of the solution:

Code: Select all

args.getFiles{ it.isVideo() }.groupBy{ it.metadata }.each{ m, fs ->
   println "$m => $fs.name"
}
Just add a few more lines to select the one you want, and the delete the others.

@see viewtopic.php?f=8&t=3791#p21206
:idea: Please read the FAQ and How to Request Help.
User avatar
rednoah
The Source
Posts: 23000
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Override existing file - different extension

Post by rednoah »

You can play with something like this and see if it works for you:

Code: Select all

def args = '/Users/reinhard/Development/test/OUTPUT' as File

args.getFiles{ it.isVideo() }.groupBy{ it.metadata }.each{ m, fs ->
	if (fs.size() > 1) {
		println m
		fs.toSorted(new VideoQuality()).eachWithIndex{ f, i ->
			if (i == 0) {
				println "[+] 1. $f"
			} else {
				println "[-] ${i+1}. $f"
				// f.delete()
			}
		}
	}
}
:idea: Please read the FAQ and How to Request Help.
Achandab
Donor
Posts: 109
Joined: 04 Nov 2013, 21:20

Re: Override existing file - different extension

Post by Achandab »

Cheers mate, will have a go
User avatar
rednoah
The Source
Posts: 23000
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Override existing file - different extension

Post by rednoah »

Here's the other thread with the same issue: viewtopic.php?t=3791
:idea: Please read the FAQ and How to Request Help.
Achandab
Donor
Posts: 109
Joined: 04 Nov 2013, 21:20

Re: Override existing file - different extension

Post by Achandab »

thanks again!
crunchypancake
Posts: 1
Joined: 19 Mar 2024, 17:26

Re: Override existing file - different extension

Post by crunchypancake »

In case it could be helpful for anybody else, this is a simple post-processing script I am using to delete duplicates, in cases where the --action replace doesn't cut it.

Groovy: Select all

{ source, target, metadata ->
    def fileName = target.nameWithoutExtension
    target.dir.listFiles { file ->
        file != target && file.video && file.nameWithoutExtension == fileName
    }.each { fileToDelete ->
        trash(fileToDelete)
    }
}
This is only for absolute overriding and doesn't do any quality checks whatsoever.

Below is a sample output from using the script.

Console Output: Select all

Lookup via [Westworld] [Westworld]
Fetching episode data for [Westworld]
* Westworld [296762] | 36 episodes | 1x01-10 .. 2x01-10 .. 3x01-08 .. 4x01-08
[MOVE] from [/library/downloads/complete/Westworld.S04.1080p.BluRay.x265-RARBG/Westworld.S04E01.1080p.BluRay.x265-RARBG.mp4] to [/library/library/shows/Westworld (2016)/Season 04/Westworld (2016) - S04E01 - The Auguries.mp4]
[MOVE] from [/library/downloads/complete/Westworld.S04.1080p.BluRay.x265-RARBG/Westworld.S04E02.1080p.BluRay.x265-RARBG.mp4] to [/library/library/shows/Westworld (2016)/Season 04/Westworld (2016) - S04E02 - Well Enough Alone.mp4]
[MOVE] from [/library/downloads/complete/Westworld.S04.1080p.BluRay.x265-RARBG/Westworld.S04E03.1080p.BluRay.x265-RARBG.mp4] to [/library/library/shows/Westworld (2016)/Season 04/Westworld (2016) - S04E03 - Années Folles.mp4]
[MOVE] from [/library/downloads/complete/Westworld.S04.1080p.BluRay.x265-RARBG/Westworld.S04E04.1080p.BluRay.x265-RARBG.mp4] to [/library/library/shows/Westworld (2016)/Season 04/Westworld (2016) - S04E04 - Generation Loss.mp4]
[MOVE] from [/library/downloads/complete/Westworld.S04.1080p.BluRay.x265-RARBG/Westworld.S04E05.1080p.BluRay.x265-RARBG.mp4] to [/library/library/shows/Westworld (2016)/Season 04/Westworld (2016) - S04E05 - Zhuangzi.mp4]
[MOVE] from [/library/downloads/complete/Westworld.S04.1080p.BluRay.x265-RARBG/Westworld.S04E06.1080p.BluRay.x265-RARBG.mp4] to [/library/library/shows/Westworld (2016)/Season 04/Westworld (2016) - S04E06 - Fidelity.mp4]
[MOVE] from [/library/downloads/complete/Westworld.S04.1080p.BluRay.x265-RARBG/Westworld.S04E07.1080p.BluRay.x265-RARBG.mp4] to [/library/library/shows/Westworld (2016)/Season 04/Westworld (2016) - S04E07 - Metanoia.mp4]
[MOVE] from [/library/downloads/complete/Westworld.S04.1080p.BluRay.x265-RARBG/Westworld.S04E08.1080p.BluRay.x265-RARBG.mp4] to [/library/library/shows/Westworld (2016)/Season 04/Westworld (2016) - S04E08 - Que Será, Será.mp4]
[CLEAN] Delete clutter files (/library/downloads/complete/Westworld.S04.1080p.BluRay.x265-RARBG)
[SCRIPT] Run Script (remove-duplicates.groovy)
[SCRIPT] TRASH /library/library/shows/Westworld (2016)/Season 04/Westworld (2016) - S04E01 - The Auguries.mkv (remove-duplicates.groovy)
[SCRIPT] TRASH /library/library/shows/Westworld (2016)/Season 04/Westworld (2016) - S04E02 - Well Enough Alone.mkv (remove-duplicates.groovy)
[SCRIPT] TRASH /library/library/shows/Westworld (2016)/Season 04/Westworld (2016) - S04E03 - Années Folles.mkv (remove-duplicates.groovy)
[SCRIPT] TRASH /library/library/shows/Westworld (2016)/Season 04/Westworld (2016) - S04E04 - Generation Loss.mkv (remove-duplicates.groovy)
[SCRIPT] TRASH /library/library/shows/Westworld (2016)/Season 04/Westworld (2016) - S04E05 - Zhuangzi.mkv (remove-duplicates.groovy)
[SCRIPT] TRASH /library/library/shows/Westworld (2016)/Season 04/Westworld (2016) - S04E06 - Fidelity.mkv (remove-duplicates.groovy)
[SCRIPT] TRASH /library/library/shows/Westworld (2016)/Season 04/Westworld (2016) - S04E07 - Metanoia.mkv (remove-duplicates.groovy)
[SCRIPT] TRASH /library/library/shows/Westworld (2016)/Season 04/Westworld (2016) - S04E08 - Que Será, Será.mkv (remove-duplicates.groovy)
Processed 8 files
Post Reply