Merge lp:~renamer-developers/renamer/documentation into lp:renamer

Proposed by Jonathan Jacobs
Status: Merged
Approved by: Tristan Seligmann
Approved revision: 133
Merged at revision: 88
Proposed branch: lp:~renamer-developers/renamer/documentation
Merge into: lp:renamer
Diff against target: 1095 lines (+942/-94)
10 files modified
.bzrignore (+1/-0)
docs/Makefile (+130/-0)
docs/code/plugins_command.py (+42/-0)
docs/conf.py (+216/-0)
docs/index.rst (+16/-0)
docs/make.bat (+155/-0)
docs/manual.rst (+247/-0)
docs/plugins.rst (+134/-0)
docs/rn.1 (+0/-93)
renamer/plugins/undo.py (+1/-1)
To merge this branch: bzr merge lp:~renamer-developers/renamer/documentation
Reviewer Review Type Date Requested Status
Tristan Seligmann Approve
Review via email: mp+39450@code.launchpad.net

Description of the change

Move to using Sphinx for documentation purposes. HTML versions of the documentation are conveniently available for proofreading at <http://slipgate.za.net/~korpse/docs/Renamer/current/html/>

To post a comment you must log in.
132. By Jonathan Jacobs

Merge trunk.

Revision history for this message
Jonathan Jacobs (jjacobs) wrote :

Conflicts between this branch and trunk have been resolved.

133. By Jonathan Jacobs

Merge trunk.

Revision history for this message
Tristan Seligmann (mithrandi) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file '.bzrignore'
--- .bzrignore 2009-05-07 10:45:13 +0000
+++ .bzrignore 2010-11-01 08:51:04 +0000
@@ -1,1 +1,2 @@
1dropin.cache1dropin.cache
2_build
23
=== added file 'docs/Makefile'
--- docs/Makefile 1970-01-01 00:00:00 +0000
+++ docs/Makefile 2010-11-01 08:51:04 +0000
@@ -0,0 +1,130 @@
1# Makefile for Sphinx documentation
2#
3
4# You can set these variables from the command line.
5SPHINXOPTS =
6SPHINXBUILD = sphinx-build
7PAPER = a4
8BUILDDIR = _build
9
10# Internal variables.
11PAPEROPT_a4 = -D latex_paper_size=a4
12PAPEROPT_letter = -D latex_paper_size=letter
13ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
14
15.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest
16
17help:
18 @echo "Please use \`make <target>' where <target> is one of"
19 @echo " html to make standalone HTML files"
20 @echo " dirhtml to make HTML files named index.html in directories"
21 @echo " singlehtml to make a single large HTML file"
22 @echo " pickle to make pickle files"
23 @echo " json to make JSON files"
24 @echo " htmlhelp to make HTML files and a HTML help project"
25 @echo " qthelp to make HTML files and a qthelp project"
26 @echo " devhelp to make HTML files and a Devhelp project"
27 @echo " epub to make an epub"
28 @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
29 @echo " latexpdf to make LaTeX files and run them through pdflatex"
30 @echo " text to make text files"
31 @echo " man to make manual pages"
32 @echo " changes to make an overview of all changed/added/deprecated items"
33 @echo " linkcheck to check all external links for integrity"
34 @echo " doctest to run all doctests embedded in the documentation (if enabled)"
35
36clean:
37 -rm -rf $(BUILDDIR)/*
38
39html:
40 $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
41 @echo
42 @echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
43
44dirhtml:
45 $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
46 @echo
47 @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
48
49singlehtml:
50 $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
51 @echo
52 @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
53
54pickle:
55 $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
56 @echo
57 @echo "Build finished; now you can process the pickle files."
58
59json:
60 $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
61 @echo
62 @echo "Build finished; now you can process the JSON files."
63
64htmlhelp:
65 $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
66 @echo
67 @echo "Build finished; now you can run HTML Help Workshop with the" \
68 ".hhp project file in $(BUILDDIR)/htmlhelp."
69
70qthelp:
71 $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
72 @echo
73 @echo "Build finished; now you can run "qcollectiongenerator" with the" \
74 ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
75 @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/Renamer.qhcp"
76 @echo "To view the help file:"
77 @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/Renamer.qhc"
78
79devhelp:
80 $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
81 @echo
82 @echo "Build finished."
83 @echo "To view the help file:"
84 @echo "# mkdir -p $$HOME/.local/share/devhelp/Renamer"
85 @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/Renamer"
86 @echo "# devhelp"
87
88epub:
89 $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
90 @echo
91 @echo "Build finished. The epub file is in $(BUILDDIR)/epub."
92
93latex:
94 $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
95 @echo
96 @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
97 @echo "Run \`make' in that directory to run these through (pdf)latex" \
98 "(use \`make latexpdf' here to do that automatically)."
99
100latexpdf:
101 $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
102 @echo "Running LaTeX files through pdflatex..."
103 make -C $(BUILDDIR)/latex all-pdf
104 @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
105
106text:
107 $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
108 @echo
109 @echo "Build finished. The text files are in $(BUILDDIR)/text."
110
111man:
112 $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
113 @echo
114 @echo "Build finished. The manual pages are in $(BUILDDIR)/man."
115
116changes:
117 $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
118 @echo
119 @echo "The overview file is in $(BUILDDIR)/changes."
120
121linkcheck:
122 $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
123 @echo
124 @echo "Link check complete; look for any errors in the above output " \
125 "or in $(BUILDDIR)/linkcheck/output.txt."
126
127doctest:
128 $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
129 @echo "Testing of doctests in the sources finished, look at the " \
130 "results in $(BUILDDIR)/doctest/output.txt."
0131
=== added directory 'docs/code'
=== added file 'docs/code/plugins_command.py'
--- docs/code/plugins_command.py 1970-01-01 00:00:00 +0000
+++ docs/code/plugins_command.py 2010-11-01 08:51:04 +0000
@@ -0,0 +1,42 @@
1import os
2import string
3import time
4
5from renamer.plugin import RenamingCommand
6from renamer.errors import PluginError
7
8
9class ReadableTimestamps(RenamingCommand):
10 # The name of our command, as it will be used from the command-line.
11 name = 'timestamp'
12
13 # A brief description of the command's purpose, displayed in --help output.
14 description = 'Rename files with POSIX timestamps to human-readble times.'
15
16 # Command-line parameters we support.
17 optParameters = [
18 ('format', 'f', '%Y-%m-%d %H-%M-%S', 'strftime format.')]
19
20 # The default name template to use if no name template is specified via the
21 # command-line or configuration file.
22 defaultNameTemplate = string.Template('$time')
23
24 # IRenamerCommand
25
26 def processArgument(self, arg):
27 # The extension is not needed as it will be determined from the
28 # original file name.
29 name, ext = arg.splitext()
30 try:
31 # Try convert the filename to a floating point number.
32 timestamp = float(name)
33 except (TypeError, ValueError):
34 # If it is not a floating point number then we raise an exception
35 # to stop the process.
36 raise PluginError('%r is not a valid timestamp' % (name,))
37 else:
38 # Convert and format the timestamp according to the "format"
39 # command-line parameter.
40 t = time.localtime(timestamp)
41 return {
42 'time': time.strftime(self['format'], t)}
043
=== added file 'docs/conf.py'
--- docs/conf.py 1970-01-01 00:00:00 +0000
+++ docs/conf.py 2010-11-01 08:51:04 +0000
@@ -0,0 +1,216 @@
1# -*- coding: utf-8 -*-
2#
3# Renamer documentation build configuration file, created by
4# sphinx-quickstart on Thu Oct 21 09:53:03 2010.
5#
6# This file is execfile()d with the current directory set to its containing dir.
7#
8# Note that not all possible configuration values are present in this
9# autogenerated file.
10#
11# All configuration values have a default; values that are commented out
12# serve to show the default.
13
14import sys, os
15
16# If extensions (or modules to document with autodoc) are in another directory,
17# add these directories to sys.path here. If the directory is relative to the
18# documentation root, use os.path.abspath to make it absolute, like shown here.
19#sys.path.insert(0, os.path.abspath('.'))
20
21# -- General configuration -----------------------------------------------------
22
23# If your documentation needs a minimal Sphinx version, state it here.
24#needs_sphinx = '1.0'
25
26# Add any Sphinx extension module names here, as strings. They can be extensions
27# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
28extensions = ['sphinx.ext.autodoc', 'sphinx.ext.coverage']
29
30# Add any paths that contain templates here, relative to this directory.
31templates_path = ['templates']
32
33# The suffix of source filenames.
34source_suffix = '.rst'
35
36# The encoding of source files.
37#source_encoding = 'utf-8-sig'
38
39# The master toctree document.
40master_doc = 'index'
41
42# General information about the project.
43project = u'Renamer'
44copyright = u'2010, Jonathan Jacobs, Tristan Seligmann, Andrew Snowden'
45
46# The version info for the project you're documenting, acts as replacement for
47# |version| and |release|, also used in various other places throughout the
48# built documents.
49#
50# The short X.Y version.
51version = '0.1.0'
52# The full version, including alpha/beta/rc tags.
53release = '0.1.0'
54
55# The language for content autogenerated by Sphinx. Refer to documentation
56# for a list of supported languages.
57#language = None
58
59# There are two options for replacing |today|: either, you set today to some
60# non-false value, then it is used:
61#today = ''
62# Else, today_fmt is used as the format for a strftime call.
63#today_fmt = '%B %d, %Y'
64
65# List of patterns, relative to source directory, that match files and
66# directories to ignore when looking for source files.
67exclude_patterns = ['_build']
68
69# The reST default role (used for this markup: `text`) to use for all documents.
70#default_role = None
71
72# If true, '()' will be appended to :func: etc. cross-reference text.
73#add_function_parentheses = True
74
75# If true, the current module name will be prepended to all description
76# unit titles (such as .. function::).
77#add_module_names = True
78
79# If true, sectionauthor and moduleauthor directives will be shown in the
80# output. They are ignored by default.
81#show_authors = False
82
83# The name of the Pygments (syntax highlighting) style to use.
84pygments_style = 'sphinx'
85
86# A list of ignored prefixes for module index sorting.
87#modindex_common_prefix = []
88
89
90# -- Options for HTML output ---------------------------------------------------
91
92# The theme to use for HTML and HTML Help pages. See the documentation for
93# a list of builtin themes.
94html_theme = 'default'
95
96# Theme options are theme-specific and customize the look and feel of a theme
97# further. For a list of options available for each theme, see the
98# documentation.
99#html_theme_options = {}
100
101# Add any paths that contain custom themes here, relative to this directory.
102#html_theme_path = []
103
104# The name for this set of Sphinx documents. If None, it defaults to
105# "<project> v<release> documentation".
106#html_title = None
107
108# A shorter title for the navigation bar. Default is the same as html_title.
109#html_short_title = None
110
111# The name of an image file (relative to this directory) to place at the top
112# of the sidebar.
113#html_logo = None
114
115# The name of an image file (within the static path) to use as favicon of the
116# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
117# pixels large.
118#html_favicon = None
119
120# Add any paths that contain custom static files (such as style sheets) here,
121# relative to this directory. They are copied after the builtin static files,
122# so a file named "default.css" will overwrite the builtin "default.css".
123html_static_path = ['static']
124
125# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
126# using the given strftime format.
127#html_last_updated_fmt = '%b %d, %Y'
128
129# If true, SmartyPants will be used to convert quotes and dashes to
130# typographically correct entities.
131#html_use_smartypants = True
132
133# Custom sidebar templates, maps document names to template names.
134#html_sidebars = {}
135
136# Additional templates that should be rendered to pages, maps page names to
137# template names.
138#html_additional_pages = {}
139
140# If false, no module index is generated.
141#html_domain_indices = True
142
143# If false, no index is generated.
144#html_use_index = True
145
146# If true, the index is split into individual pages for each letter.
147#html_split_index = False
148
149# If true, links to the reST sources are added to the pages.
150#html_show_sourcelink = True
151
152# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
153#html_show_sphinx = True
154
155# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
156#html_show_copyright = True
157
158# If true, an OpenSearch description file will be output, and all pages will
159# contain a <link> tag referring to it. The value of this option must be the
160# base URL from which the finished HTML is served.
161#html_use_opensearch = ''
162
163# This is the file name suffix for HTML files (e.g. ".xhtml").
164#html_file_suffix = None
165
166# Output file base name for HTML help builder.
167htmlhelp_basename = 'Renamerdoc'
168
169
170# -- Options for LaTeX output --------------------------------------------------
171
172# The paper size ('letter' or 'a4').
173#latex_paper_size = 'letter'
174
175# The font size ('10pt', '11pt' or '12pt').
176#latex_font_size = '10pt'
177
178# Grouping the document tree into LaTeX files. List of tuples
179# (source start file, target name, title, author, documentclass [howto/manual]).
180latex_documents = [
181 ('index', 'Renamer.tex', u'Renamer Documentation',
182 u'Jonathan Jacobs, Tristan Seligmann, Andrew Snowden', 'manual'),
183]
184
185# The name of an image file (relative to this directory) to place at the top of
186# the title page.
187#latex_logo = None
188
189# For "manual" documents, if this is true, then toplevel headings are parts,
190# not chapters.
191#latex_use_parts = False
192
193# If true, show page references after internal links.
194#latex_show_pagerefs = False
195
196# If true, show URL addresses after external links.
197#latex_show_urls = False
198
199# Additional stuff for the LaTeX preamble.
200#latex_preamble = ''
201
202# Documents to append as an appendix to all manuals.
203#latex_appendices = []
204
205# If false, no module index is generated.
206#latex_domain_indices = True
207
208
209# -- Options for manual page output --------------------------------------------
210
211# One entry per manual page. List of tuples
212# (source start file, name, description, authors, manual section).
213man_pages = [
214 ('manual', 'rn', u'an extensible mass file renamer',
215 [u'Jonathan Jacobs', u'Tristan Seligmann', u'Andrew Snowden'], 1)
216]
0217
=== added file 'docs/index.rst'
--- docs/index.rst 1970-01-01 00:00:00 +0000
+++ docs/index.rst 2010-11-01 08:51:04 +0000
@@ -0,0 +1,16 @@
1Renamer |version| documentation
2===============================
3
4Contents:
5
6.. toctree::
7 :maxdepth: 3
8
9 manual
10 plugins
11
12Indices and tables
13==================
14
15* :ref:`genindex`
16* :ref:`search`
017
=== added file 'docs/make.bat'
--- docs/make.bat 1970-01-01 00:00:00 +0000
+++ docs/make.bat 2010-11-01 08:51:04 +0000
@@ -0,0 +1,155 @@
1@ECHO OFF
2
3REM Command file for Sphinx documentation
4
5if "%SPHINXBUILD%" == "" (
6 set SPHINXBUILD=sphinx-build
7)
8set BUILDDIR=_build
9set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% .
10if NOT "%PAPER%" == "" (
11 set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
12)
13
14if "%1" == "" goto help
15
16if "%1" == "help" (
17 :help
18 echo.Please use `make ^<target^>` where ^<target^> is one of
19 echo. html to make standalone HTML files
20 echo. dirhtml to make HTML files named index.html in directories
21 echo. singlehtml to make a single large HTML file
22 echo. pickle to make pickle files
23 echo. json to make JSON files
24 echo. htmlhelp to make HTML files and a HTML help project
25 echo. qthelp to make HTML files and a qthelp project
26 echo. devhelp to make HTML files and a Devhelp project
27 echo. epub to make an epub
28 echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter
29 echo. text to make text files
30 echo. man to make manual pages
31 echo. changes to make an overview over all changed/added/deprecated items
32 echo. linkcheck to check all external links for integrity
33 echo. doctest to run all doctests embedded in the documentation if enabled
34 goto end
35)
36
37if "%1" == "clean" (
38 for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i
39 del /q /s %BUILDDIR%\*
40 goto end
41)
42
43if "%1" == "html" (
44 %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
45 echo.
46 echo.Build finished. The HTML pages are in %BUILDDIR%/html.
47 goto end
48)
49
50if "%1" == "dirhtml" (
51 %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
52 echo.
53 echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.
54 goto end
55)
56
57if "%1" == "singlehtml" (
58 %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml
59 echo.
60 echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml.
61 goto end
62)
63
64if "%1" == "pickle" (
65 %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle
66 echo.
67 echo.Build finished; now you can process the pickle files.
68 goto end
69)
70
71if "%1" == "json" (
72 %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json
73 echo.
74 echo.Build finished; now you can process the JSON files.
75 goto end
76)
77
78if "%1" == "htmlhelp" (
79 %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp
80 echo.
81 echo.Build finished; now you can run HTML Help Workshop with the ^
82.hhp project file in %BUILDDIR%/htmlhelp.
83 goto end
84)
85
86if "%1" == "qthelp" (
87 %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp
88 echo.
89 echo.Build finished; now you can run "qcollectiongenerator" with the ^
90.qhcp project file in %BUILDDIR%/qthelp, like this:
91 echo.^> qcollectiongenerator %BUILDDIR%\qthelp\Renamer.qhcp
92 echo.To view the help file:
93 echo.^> assistant -collectionFile %BUILDDIR%\qthelp\Renamer.ghc
94 goto end
95)
96
97if "%1" == "devhelp" (
98 %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp
99 echo.
100 echo.Build finished.
101 goto end
102)
103
104if "%1" == "epub" (
105 %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub
106 echo.
107 echo.Build finished. The epub file is in %BUILDDIR%/epub.
108 goto end
109)
110
111if "%1" == "latex" (
112 %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
113 echo.
114 echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.
115 goto end
116)
117
118if "%1" == "text" (
119 %SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text
120 echo.
121 echo.Build finished. The text files are in %BUILDDIR%/text.
122 goto end
123)
124
125if "%1" == "man" (
126 %SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man
127 echo.
128 echo.Build finished. The manual pages are in %BUILDDIR%/man.
129 goto end
130)
131
132if "%1" == "changes" (
133 %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes
134 echo.
135 echo.The overview file is in %BUILDDIR%/changes.
136 goto end
137)
138
139if "%1" == "linkcheck" (
140 %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck
141 echo.
142 echo.Link check complete; look for any errors in the above output ^
143or in %BUILDDIR%/linkcheck/output.txt.
144 goto end
145)
146
147if "%1" == "doctest" (
148 %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest
149 echo.
150 echo.Testing of doctests in the sources finished, look at the ^
151results in %BUILDDIR%/doctest/output.txt.
152 goto end
153)
154
155:end
0156
=== added file 'docs/manual.rst'
--- docs/manual.rst 1970-01-01 00:00:00 +0000
+++ docs/manual.rst 2010-11-01 08:51:04 +0000
@@ -0,0 +1,247 @@
1.. index:: manual, rn
2
3Renamer manual
4==============
5
6========
7SYNOPSIS
8========
9
10rn [*options*] command [*options*] argument ...
11
12
13===========
14DESCRIPTION
15===========
16
17**rn** is a command line interface to Renamer, an extensible utility for
18renaming files that also keeps a log of previous activities, which allows
19actions to be reversed.
20
21The required *command* argument selects which renamer command to execute. Most,
22but not all, commands invoke the renaming process on the provided arguments,
23the :ref:`undo` command is one example that differs. Consult ``--help`` for a
24list of available commands and the :ref:`COMMANDS` section for descriptions of
25the builtin commands.
26
27Renamer can be extended with new commands via Python plugins.
28
29
30=======
31OPTIONS
32=======
33
34-g, --glob
35 Expand arguments as UNIX-style globs.
36
37-x, --one-file-system
38 Don't cross filesystems. This is primarily useful for avoiding copy-delete
39 behavior when renaming will cross file-system boundaries.
40
41-n, --no-act
42 Perform a trial run with no changes made.
43
44--link-src
45 Create a symlink at the source. The file will be moved to its new location
46 and a symlink created at its original location.
47
48--link-dst
49 Create a symlink at the destination. The original file will not be moved
50 but a symlink will be created at the new location.
51
52-c file, --config=file
53 Read configuration defaults from *file*. The default configuration is read
54 from *~/.renamer/renamer.conf*. See the :ref:`CONFIGURATION` section for
55 more information.
56
57-e template, --name=template
58 Formatted filename. See the :ref:`TEMPLATES` section for more information.
59
60-p template, --prefix=template
61 Formatted path to prefix to files before renaming. See the :ref:`TEMPLATES`
62 section for more information.
63
64-l number, --concurrent=number
65 Maximum number of asynchronous tasks to perform concurrently. The default
66 is 10.
67
68--help
69 Display a help message describing Renamer's command-line options.
70
71-q, --quiet
72 Suppress output.
73
74--version
75 Display version information.
76
77-v, --verbose
78 Increase output, use more times for greater effect.
79
80
81.. index:: commands
82
83.. _commands:
84
85========
86COMMANDS
87========
88
89Commands are the parts of Renamer that process arguments and make things
90happen. Most commands will extract metadata from each argument in some fashion
91and store that metadata in template variables which is used to rename the
92files.
93
94.. index:: tvrage
95
96.. _tvrage:
97
98tvrage
99------
100
101--series
102 Override the series name metadata.
103
104--season
105 Override the season number metadata.
106
107--episode
108 Override the episode number metadata.
109
110Use TV episode metadata from filenames (such as ``Lost S01E01.avi``) to consult
111the `TV Rage`_ database for detailed and accurate metadata used in renaming.
112
113.. _TV Rage: http://tvrage.com/
114
115Renamer is able to extract metadata from a wide variety of filename structures.
116Unfortunately, since useful metadata within the video container itself is
117extremely rare, the only reliable way to extract information is from the
118filename, meaning that filenames should be as clear as possible and contain as
119much useful metadata as possible.
120
121In the event a filename does not contain enough information to determine a
122name, season and episode number you can use the override command-line options
123``--series``, ``--season`` and ``--episode``. Specifying any one of these will
124accomplish two things:
125
1261. Override any detected metadata in the filename for that particular
127 component, and;
128
1292. Relax the filename detection techniques so that less specific filenames can
130 match when there is enough combined metadata between filenames and
131 overrides. For example: A file named ``House - 1.avi`` combined with
132 ``--season=2`` means that there is enough metadata to look up information
133 for the *first* episode of the *second* season of the show "House".
134
135
136.. index:: audio
137
138.. _audio:
139
140audio
141-----
142
143Use audio metadata from files for renaming. A wide variety of audio and audio
144metadata formats are supported.
145
146
147.. index:: undo
148
149.. _undo:
150
151undo
152----
153
154--ignore-errors
155 Do not stop the process when encountering OS errors.
156
157
158Undo previous Renamer actions.
159
160The ``action`` subcommand will undo individual actions while the ``changeset``
161subcommand will undo entire changesets, once an item has been undone it is
162removed from the history. The ``forget`` subcommand will remove an item from
163history without undoing it.
164
165Use the ``list`` subcommand to find identifiers for the changesets or actions
166to undo.
167
168
169.. index:: templates
170
171.. _templates:
172
173=========
174TEMPLATES
175=========
176
177A Python template string, as described by the Python `template documentation`_,
178can contain variables that will be substituted with runtime values from Renamer
179commands.
180
181.. _template documentation:
182 http://docs.python.org/library/string.html#template-strings
183
184For example the :ref:`tvrage` command provides variables containing TV episode
185metadata; so a template such as::
186
187 $series S${padded_season}E${padded_episode} - $title
188
189Applied to episode 1 of season 1 of "Lost" (named "Pilot (1)") will result in::
190
191 Lost S01E01 - Pilot (1)
192
193The variables available will differ from command to command, consult the
194``--help`` output for the command to learn more.
195
196
197.. index:: configuration, config file
198
199.. _configuration:
200
201=============
202CONFIGURATION
203=============
204
205Configuration files follow a basic INI syntax. Sections are named after their
206command names, as listed in ``--help``, the global configuration section is
207named ``renamer``. Configuration options are derived from their long
208command-line counterparts without the ``--`` prefix. Flags can be turned on or
209off with values such as: ``true``, ``yes``, ``1``, ``false``, ``no``, ``0``.
210
211For example the command line::
212
213 rn --concurrent=5 --link-src --prefix=~/stuff somecommand --no-thing
214
215can be specified in a configuration file::
216
217 [renamer]
218 concurrent=5
219 link-src=yes
220 prefix=~/stuff
221
222 [somecommand]
223 no-thing=yes
224
225It is also possible to specify global configuration options in a command
226section to override them only for that specific command.
227
228Arguments specified on the command line will override values in the
229configuration file.
230
231
232====
233BUGS
234====
235
236Please report any bugs to the `Renamer Launchpad project`_
237``<http://launchpad.net/renamer/>``.
238
239.. _Renamer Launchpad project: http://launchpad.net/renamer/
240
241
242=====
243FILES
244=====
245
246~/.renamer/renamer.conf
247 Contains the user's default configuration.
0248
=== added file 'docs/plugins.rst'
--- docs/plugins.rst 1970-01-01 00:00:00 +0000
+++ docs/plugins.rst 2010-11-01 08:51:04 +0000
@@ -0,0 +1,134 @@
1.. index:: plugins
2
3Creating a Renamer Plugin
4=========================
5
6Introduction
7------------
8
9Renamer plugins are Python code, discovered by Twisted's `plugin
10system`_, that extends Renamer's functionality without having to modify the
11core of Renamer.
12
13.. _plugin system:
14 http://twistedmatrix.com/documents/current/core/howto/plugin.html
15
16There are two kinds of pluggable code in Renamer:
17
181. Commands that perform actions unrelated to directly renaming a file. An
19 example of this would be the `undo` command.
20
212. Renaming commands that determine new filenames from existing files and
22 ultimately result in an input being renamed. An example of this would be the
23 :ref:`tvrage` command.
24
25Since the topic of creating commands that are not directly related to renaming
26is so broad, this document will primarily focus on creating a command that
27performs renaming.
28
29
30Foundations
31-----------
32
33Renamer commands are simply Twisted `Options`_ subclasses with a few extra bits
34thrown in, so all the usual Options attributes (such as ``optParameters``) are
35available for use and should be how you expose additional options for your
36command.
37
38.. _Options:
39 http://twistedmatrix.com/documents/current/core/howto/options.html
40
41In almost all cases you will want to inherit from the ``RenamingCommand`` base
42class, as it ensure your subclass provides all the right interfaces as well as
43invoking your command and performing the actual file renaming.
44
45At the heart of a renaming command is ``processArgument`` which accepts one
46argument and returns a Python dictionary. That dictionary is then used to
47perform `template substitution`_ on the ``name`` and ``prefix`` command-line
48options (or, if they're not given, command-specific defaults.) This process of
49calling ``processArgument`` is repeated for each argument given, letting your
50command process one argument at a time.
51
52.. _template substitution:
53 http://docs.python.org/library/string.html#template-strings
54
55
56Deferreds
57---------
58
59If your command performs a long-running task, such as fetching data from a web
60server, you can return a `Deferred`_ from ``processArgument`` that should
61ultimately return with a Python dictionary to be used in assembling the
62destination filename.
63
64.. _Deferred:
65 http://twistedmatrix.com/documents/current/core/howto/deferredindepth.html
66
67
68Sample command
69--------------
70
71Below is the complete source code of a command that renames files named as
72POSIX timestamps (e.g. ``1287758780.4690211.txt``) to a human-readable
73representation of the timestamp (e.g. ``2010-10-22 16-46-20.txt``).
74
75.. literalinclude:: code/plugins_command.py
76 :linenos:
77
78
79Installing the plugin
80---------------------
81
82Now that we've constructed our command we need to make it available to Renamer.
83This process consists of the following simple steps:
84
851. Create a directory for your plugins such as ``MyRenamerPlugins`` wherever you
86 usually put your source code, beneath this create a directory named
87 ``renamer`` and beneath that a directory named ``plugins``.
88
89 Your directory tree should look like::
90
91 .
92 |-- MyRenamerPlugins
93 | `-- renamer
94 | | `-- plugins
95
962. Add your directory (``MyRenamerPlugins`` in the previous step) to sys.path
97 (typically by adding it to the PYTHONPATH environment variable.)
98
993. Put your plugin source code file (with a ``.py`` extension) in the
100 ``MyRenamerPlugins/renamer/plugins`` directory. It is important to note that
101 this directory must **not** be a Python package (i.e. it must not contain
102 ``__init__.py``) and will be skipped (i.e. no plugins will be loaded) if it is
103 one.
104
1054. You can verify that your plugin is visible by running an interactive Python
106 prompt and doing something similar to::
107
108 >>> from renamer.plugins.timestamp import ReadableTimestamps
109 >>>
110
111 (This obviously assumes that you used the ``ReadableTimestamps`` example and
112 stored it in a file called ``timestamp.py``.)
113
114 If your plugin is installed correctly there should be no errors importing
115 the module.
116
117
118Using the plugin
119----------------
120
121After your plugin has been installed correctly you can use it::
122
123 $ touch 1287758780.4690211.txt
124 $ rn timestamp 1287758780.4690211.txt
125 $ ls
126 2010-10-22 16-46-20.txt
127
128It is possible that you may need to regenerate the Twisted plugin cache if you
129notice nonsensical errors related to your plugin objects, especially if you're
130actively developing a plugin and testing it. Refer to the Twisted documentation
131regarding `plugin caching`_.
132
133.. _plugin caching:
134 http://twistedmatrix.com/documents/current/core/howto/plugin.html#auto3
0135
=== removed file 'docs/rn.1'
--- docs/rn.1 2009-05-06 10:15:24 +0000
+++ docs/rn.1 1970-01-01 00:00:00 +0000
@@ -1,93 +0,0 @@
1.TH RN 1 2009-05-04 "version 1.0.0" "USER COMMANDS"
2
3.SH NAME
4rn \- scriptable and extensible mass file renamer
5
6.SH SYNOPSYS
7.B rn
8.RB [\| \-g \|]
9.RB [\| \-m \|]
10.RB [\| \-R \|]
11.RB [\| \-s
12.IR file \|]
13.RB [\| \-S
14.IR sort \|]
15.RB [\| \-t \|]
16.RB [\| \-q \|]
17.RB [\| \-v \|]
18.RI [\| argument \|]
19\&\.\.\.
20
21.SH DESCRIPTION
22.B rn
23is a command line interface to Renamer, a utility designed to rename files
24according to a set of user-provided instructions, generally residing in a
25script file.
26
27.SH OPTIONS
28If no arguments are provided,
29.B rn
30is invoked in interactive mode.
31.TP
32.B \-g, \-\-glob
33Expand arguments according to UNIX-style globs.
34.TP
35.B \-m, \-\-move
36Enable \(lqmove mode\(rq, this allows scripts to perform file move operations.
37.TP
38.B \-R, \-\-reverse
39Reverse the sorting order of the arguments.
40.TP
41.BI \-s\ file ,\ \-\-script= file
42Execute
43.I file\c
44, as a script, for each argument. Each argument is invoked in its own script
45environment, meaning that the stack is not retained between executions and
46any stored variables are not persisted.
47.TP
48.BI \-S\ sort ,\ \-\-sort= sort
49Sort arguments according to criteria:
50.BR name , \ size , \ time .
51.TP
52.B \-t, \-\-dry-run
53Perform a dry-run, meaning that no permanent operations are performed, such
54as file renaming.
55.TP
56.B \-q, \-\-quiet
57Reduce verbosity level.
58.TP
59.B \-v, \-\-verbose
60Increase verbosity level.
61
62.SH SCRIPTING
63Renamer operates in a stack based environment. Command line arguments,
64function return values and function parameters are all pushed and popped
65from the stack.
66.PP
67Function arguments are an exception: any arguments passed inline to a function
68are subtracted from the total number of arguments required and appended to
69the arguments popped from the stack. For example:
70.PP
71.nf
72rn> push "foo bar baz"
73rn> split " "
74rn> stack
75--> ['foo', 'bar', 'baz']
76.fi
77.PP
78Renamer's interactive mode should prove valuable in exploring the behaviour
79of Renamer's commands, particularly the
80.I help
81and
82.I commands
83functions.
84
85.SH FILES
86.TP
87.I ~/.renamer/scripts/
88Directory containing user-provided scripts
89.TP
90.I ~/.renamer/plugin_name/config
91Config file for configuring
92.B plugin_name
93individually
940
=== added directory 'docs/static'
=== added directory 'docs/templates'
=== modified file 'renamer/plugins/undo.py'
--- renamer/plugins/undo.py 2010-10-24 17:46:32 +0000
+++ renamer/plugins/undo.py 2010-11-01 08:51:04 +0000
@@ -27,7 +27,7 @@
2727
28class _UndoMixin(object):28class _UndoMixin(object):
29 optFlags = [29 optFlags = [
30 ('ignore-errors', None, 'Do not stop the process when encountering OS errors')]30 ('ignore-errors', None, 'Do not stop the process when encountering OS errors.')]
3131
3232
33 def undoActions(self, options, changeset, actions):33 def undoActions(self, options, changeset, actions):

Subscribers

People subscribed via source and target branches