Page 1 of 1

--conflict override not working?

Posted: 17 Jun 2013, 19:34
by verysofttoiletpaper
Hi, isn't --conflict override supposed to replace existing symlinks if they exist?

Code: Select all

SYMLINK] Failed to rename [/mnt/media/Media/Deluge/downloads/The.Big.Bang.Theory.S06E24.The.Bon.Voyage.Reaction.576p.WEB-DL.DD5.1.x264-RKH.mkv]
FileAlreadyExistsException: /mnt/media/Media/TV Shows/The Big Bang Theory/Season 06/The Big Bang Theory - S06E24 - The Bon Voyage Reaction.mkv
Thanks

Re: --conflict override not working?

Posted: 18 Jun 2013, 02:10
by rednoah
Works on Windows. Maybe there's some strange behaviour with symlinks on *nix.

EDIT: Tested on Ubuntu and also works.

Re: --conflict override not working?

Posted: 18 Jun 2013, 09:54
by verysofttoiletpaper
rednoah wrote:Works on Windows. Maybe there's some strange behaviour with symlinks on *nix.

EDIT: Tested on Ubuntu and also works.
It is on ubuntu I'm running it..

Re: --conflict override not working?

Posted: 18 Jun 2013, 12:24
by rednoah
But if you do COPY or KEEPLINK it works?

Re: --conflict override not working?

Posted: 19 Jun 2013, 09:18
by verysofttoiletpaper
No, they act like --conflict skip and end with success:

Code: Select all

Skipped [/mnt/media/Media/Movies/The Karate Kid (1984)/The Karate Kid (1984).mkv] because [/mnt/media/Media/Movies/The Karate Kid (1984)/The Karate Kid (1984).mkv] already exists
Symlink only skips if the second file is different from the file which the current link is pointing to. If the file being processed is the one the extisting link is already pointing to, it doesn't do anything, doesn't say "skipping", nor "error", it just completes successfully.

I'm running FileBot 3.5 (r1546) / Java(TM) SE Runtime Environment 1.7.0_21 (headless)
Isn't supposed 3.6 to be in the ubuntu repos already?

Thanks

Re: --conflict override not working?

Posted: 19 Jun 2013, 11:42
by rednoah
Works as expected any way I tried:

Code: Select all

reinhard@serenity:~/test$ filebot -rename . --format "./output/{movie}" --db themoviedb --action symlink
Rename movies using [TheMovieDB]
Auto-detect movie from context: [/home/reinhard/test/The Karate Kid (1984).mkv]
[SYMLINK] Rename [/home/reinhard/test/The Karate Kid (1984).mkv] to [./output/The Karate Kid (1984).mkv]
Processed 1 files
Done ヾ(@⌒ー⌒@)ノ

reinhard@serenity:~/test$ filebot -rename . --format "./output/{movie}" --db themoviedb --action symlink
Rename movies using [TheMovieDB]
Auto-detect movie from context: [/home/reinhard/test/The Karate Kid (1984).mkv]
Skipped [/home/reinhard/test/The Karate Kid (1984).mkv] because [/home/reinhard/test/./output/The Karate Kid (1984).mkv] already exists
Processed 1 files
Done ヾ(@⌒ー⌒@)ノ

reinhard@serenity:~/test$ filebot -rename . --format "./output/{movie}" --db themoviedb --action symlink --conflict override
Rename movies using [TheMovieDB]
Auto-detect movie from context: [/home/reinhard/test/The Karate Kid (1984).mkv]
[SYMLINK] Rename [/home/reinhard/test/The Karate Kid (1984).mkv] to [./output/The Karate Kid (1984).mkv]
Processed 1 files
Done ヾ(@⌒ー⌒@)ノ

Re: --conflict override not working?

Posted: 19 Jun 2013, 12:10
by verysofttoiletpaper
Have you tried the following in the same folder?

Code: Select all

filebot -rename . --format "./output/{movie}" --db themoviedb --action symlink

mv "The Karate Kid (1984).mkv" "The_Karate_Kid_(1984).mkv"

filebot -rename . --format "./output/{movie}" --db themoviedb --action symlink --conflict override
Thanks

Re: --conflict override not working?

Posted: 19 Jun 2013, 12:54
by rednoah
This use-case has an issue. Cause you end up handling to identical movies that resolve to idential paths. The --action override just deletes the original symlink. But then the previous symlink gets symlinked. That works. But then the renamed file gets also symlinked to that path and it already exists.

I probably should add some sanity checks before-hand but i'll still make it abort.

EDIT:
Nevermind that. In anycase Java 6 File.exists() returns false for broken links. I can fix it only by using Java 7 NIO.2 classes but then I break backwards compatibility...

EDIT2:
Decided not to fix this. I'd broken behaviour by Java 7 as it's different from Java 6 (which doesn't understand symlinks and thus works correctly). Once I give up supporting Java 6 I can fix it easily.

In the meanwhile you can just make sure that there's no broken symlinks on folders you run filebot on:
http://www.commandlinefu.com/commands/v ... elete-them

Re: --conflict override not working?

Posted: 19 Jun 2013, 14:34
by verysofttoiletpaper
rednoah wrote:This use-case has an issue. Cause you end up handling to identical movies that resolve to idential paths. The --action override just deletes the original symlink. But then the previous symlink gets symlinked. That works. But then the renamed file gets also symlinked to that path and it already exists.

I probably should add some sanity checks before-hand but i'll still make it abort.

EDIT:
Nevermind that. In anycase Java 6 File.exists() returns false for broken links. I can fix it only by using Java 7 NIO.2 classes but then I break backwards compatibility...

EDIT2:
Decided not to fix this. I'd broken behaviour by Java 7 as it's different from Java 6 (which doesn't understand symlinks and thus works correctly). Once I give up supporting Java 6 I can fix it easily.

In the meanwhile you can just make sure that there's no broken symlinks on folders you run filebot on:
http://www.commandlinefu.com/commands/v ... elete-them
I'm not sure what you mean with "But then the previous symlink gets symlinked". Does the following use case solve the problem you are talking about?

Code: Select all

filebot -rename "The Karate Kid (1984).mkv" --format "./output/{movie}" --db themoviedb --action symlink

mv "The Karate Kid (1984).mkv" "The_Karate_Kid_(1984).mkv"

filebot -rename "The_Karate_Kid_(1984).mkv" --format "./output/{movie}" --db themoviedb --action symlink --conflict override
Thanks

Re: --conflict override not working?

Posted: 19 Jun 2013, 15:42
by rednoah
Ignore what I said before the edits. :P

The problem is that I check if files already exist with File.exists() and then delete it if it does, except Java 7 says "does not exist" if called on a symlink as the target file doesn't exist. So my code doesn't try to delete the symlink cause it thinks it doesn't exist.

I can only fix this by using new Java 7 APIs where I can specifically tell the Files.exists() method to not follow symlinks.

Re: --conflict override not working?

Posted: 19 Jun 2013, 15:45
by verysofttoiletpaper
rednoah wrote:Ignore what I said before the edits. :P

The problem is that I check if files already exist with File.exists() and then delete it if it does, except Java 7 says "does not exist" if called on a symlink as the target file doesn't exist. So my code doesn't try to delete the symlink cause it thinks it doesn't exist.

I can only fix this by using new Java 7 APIs where I can specifically tell the Files.exists() method to not follow symlinks.

Ahh that makes sense :)
Thanks for the great support once again!