From d3ca067083e285d1df4bdea746d090857950cc2e Mon Sep 17 00:00:00 2001
From: Reinhard Pointner
Date: Thu, 8 Mar 2012 05:11:06 +0000
Subject: [PATCH] * added support for move+linkback via --action keeplink
---
.../sourceforge/filebot/cli/ArgumentBean.java | 2 +-
.../filebot/cli/StandardRenameAction.java | 18 ++++++++++++++++++
website/cli.html | 14 +++++++++++---
website/naming.html | 2 +-
4 files changed, 31 insertions(+), 5 deletions(-)
diff --git a/source/net/sourceforge/filebot/cli/ArgumentBean.java b/source/net/sourceforge/filebot/cli/ArgumentBean.java
index 75082123..782e8f30 100644
--- a/source/net/sourceforge/filebot/cli/ArgumentBean.java
+++ b/source/net/sourceforge/filebot/cli/ArgumentBean.java
@@ -31,7 +31,7 @@ public class ArgumentBean {
@Option(name = "--order", usage = "Episode order", metaVar = "[Airdate, Absolute, DVD]")
public String order = "Airdate";
- @Option(name = "--action", usage = "Rename action", metaVar = "[move, copy, symlink, test]")
+ @Option(name = "--action", usage = "Rename action", metaVar = "[move, copy, keeplink, symlink, hardlink, test]")
public String action = "move";
@Option(name = "--format", usage = "Episode naming scheme", metaVar = "expression")
diff --git a/source/net/sourceforge/filebot/cli/StandardRenameAction.java b/source/net/sourceforge/filebot/cli/StandardRenameAction.java
index d53a5912..3725e488 100644
--- a/source/net/sourceforge/filebot/cli/StandardRenameAction.java
+++ b/source/net/sourceforge/filebot/cli/StandardRenameAction.java
@@ -26,6 +26,24 @@ public enum StandardRenameAction implements RenameAction {
}
},
+ KEEPLINK {
+
+ @Override
+ public File rename(File from, File to) throws Exception {
+ File destionation = FileUtilities.resolveDestination(from, to);
+
+ // move file and the create a symlink to the new location via NIO.2
+ try {
+ java.nio.file.Files.move(from.toPath(), destionation.toPath());
+ java.nio.file.Files.createSymbolicLink(from.toPath(), destionation.toPath());
+ } catch (LinkageError e) {
+ throw new Exception("Unsupported Operation: move, createSymbolicLink");
+ }
+
+ return destionation;
+ }
+ },
+
SYMLINK {
@Override
diff --git a/website/cli.html b/website/cli.html
index aa08fea9..8329ae46 100644
--- a/website/cli.html
+++ b/website/cli.html
@@ -173,7 +173,7 @@
TV Series mode: TVRage, AniDB, TheTVDB |
- Movie mode: OpenSubtitles, TheMovieDB |
+ Movie mode: OpenSubtitles, IMDb, TheMovieDB |
@@ -181,13 +181,18 @@
--order |
episode numbering |
- airdate, absolute, dvd |
+ airdate | absolute | dvd |
--format |
naming scheme |
movie or episode format expression |
+
+ --action |
+ rename action |
+ move | copy | keeplink | symlink | hardlink |
+
-get-subtitles |
fetch subtitles |
@@ -238,11 +243,14 @@
- Checksum mode: sfv, md5, sha1 |
+ Rename mode: output folder |
Subtitle mode: srt |
+
+ Checksum mode: sfv, md5, sha1 |
+
|
diff --git a/website/naming.html b/website/naming.html
index fd592238..eb71c228 100644
--- a/website/naming.html
+++ b/website/naming.html
@@ -114,7 +114,7 @@
{n.space('_')}_-_{e.pad(2)}_[{resolution}_{vc}_{ac}][{crc32}]
Juuni_Kokuki_-_01_[1280x720_XviD_MP3][3E16AF40]
- {n.space('.')}.{'s'+s.pad(2)}e{e.pad(2)}.{t.space('.')}.{vf}.{vc.lower()}.{ac.lower()}
Firefly.s01e01.Serenity.720p.x264.ac3
+ {n.space('.')}.{'s'+s.pad(2)}e{e.pad(2)}.{t.space('.')}.{vf}.{vc}.{ac}
Firefly.s01e01.Serenity.720p.x264.ac3
{n} [{airdate.format('yyyy.MM.dd')}] {t}
The Daily Show [2010.01.05] George Lucas