* added support for move+linkback via --action keeplink

This commit is contained in:
Reinhard Pointner 2012-03-08 05:11:06 +00:00
parent 8ed996bcd4
commit d3ca067083
4 changed files with 31 additions and 5 deletions

View File

@ -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")

View File

@ -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

View File

@ -173,7 +173,7 @@
<td>TV Series mode: TVRage, AniDB, TheTVDB</td>
</tr>
<tr>
<td>Movie mode: OpenSubtitles, TheMovieDB</td>
<td>Movie mode: OpenSubtitles, IMDb, TheMovieDB</td>
</tr>
</table>
</td>
@ -181,13 +181,18 @@
<tr>
<td>--order</td>
<td>episode numbering</td>
<td>airdate, absolute, dvd</td>
<td>airdate | absolute | dvd</td>
</tr>
<tr>
<td>--format</td>
<td><a href="naming.html">naming scheme</a></td>
<td><a href="naming.html">movie or episode format expression</a></td>
</tr>
<tr>
<td>--action</td>
<td>rename action</td>
<td>move | copy | keeplink | symlink | hardlink</td>
</tr>
<tr>
<td>-get-subtitles</td>
<td>fetch subtitles</td>
@ -238,11 +243,14 @@
<td>
<table>
<tr>
<td>Checksum mode: sfv, md5, sha1</td>
<td>Rename mode: output folder</td>
</tr>
<tr>
<td>Subtitle mode: srt <small class="comment">(re-encode subtitles)</small></td>
</tr>
<tr>
<td>Checksum mode: sfv, md5, sha1</td>
</tr>
</table>
</td>
</tr>

View File

@ -114,7 +114,7 @@
<code><span class="block start">{</span><span class="variable">n</span>.<span class="method">space</span>(<span class="string">'_'</span>)<span class="block end">}</span>_-_<span class="block start">{</span><span class="variable">e</span>.<span class="method">pad</span>(<span class="numeral">2</span>)<span class="block end">}</span>_[<span class="block start">{</span><span class="variable">resolution</span><span class="block end">}</span>_<span class="block start">{</span><span class="variable">vc</span><span class="block end">}</span>_<span class="block start">{</span><span class="variable">ac</span><span class="block end">}</span>][<span class="block start">{</span><span class="variable">crc32</span><span class="block end">}</span>]</code>Juuni_Kokuki_-_01_[1280x720_XviD_MP3][3E16AF40]
</p>
<p>
<code><span class="block start">{</span><span class="variable">n</span>.<span class="method">space</span>(<span class="string">'.'</span>)<span class="block end">}</span>.<span class="block start">{</span><span class="string">'s'</span>+<span class="variable">s</span>.<span class="method">pad</span>(<span class="numeral">2</span>)<span class="block end">}</span>e<span class="block start">{</span><span class="variable">e</span>.<span class="method">pad</span>(<span class="numeral">2</span>)<span class="block end">}</span>.<span class="block start">{</span><span class="variable">t</span>.<span class="method">space</span>(<span class="string">'.'</span>)<span class="block end">}</span>.<span class="block start">{</span><span class="variable">vf</span><span class="block end">}</span>.<span class="block start">{</span><span class="variable">vc</span>.<span class="method">lower</span>()<span class="block end">}</span>.<span class="block start">{</span><span class="variable">ac</span>.<span class="method">lower</span>()<span class="block end">}</span></code>Firefly.s01e01.Serenity.720p.x264.ac3
<code><span class="block start">{</span><span class="variable">n</span>.<span class="method">space</span>(<span class="string">'.'</span>)<span class="block end">}</span>.<span class="block start">{</span><span class="string">'s'</span>+<span class="variable">s</span>.<span class="method">pad</span>(<span class="numeral">2</span>)<span class="block end">}</span>e<span class="block start">{</span><span class="variable">e</span>.<span class="method">pad</span>(<span class="numeral">2</span>)<span class="block end">}</span>.<span class="block start">{</span><span class="variable">t</span>.<span class="method">space</span>(<span class="string">'.'</span>)<span class="block end">}</span>.<span class="block start">{</span><span class="variable">vf</span><span class="block end">}</span>.<span class="block start">{</span><span class="variable">vc</span><span class="block end">}</span>.<span class="block start">{</span><span class="variable">ac</span><span class="block end">}</span></code>Firefly.s01e01.Serenity.720p.x264.ac3
</p>
<p>
<code><span class="block start">{</span><span class="variable">n</span><span class="block end">}</span> [<span class="block start">{</span><span class="variable">airdate</span>.<span class="method">format</span>(<span class="string">'<a style="color:inherit" href="http://download.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html" target="_blank">yyyy.MM.dd</a>'</span>)<span class="block end">}</span>] <span class="block start">{</span><span class="variable">t</span><span class="block end">}</span></code>The Daily Show [2010.01.05] George Lucas