rarslave2.git
17 years ago[RARSLAVE] Refactoring of PAR2Set
Ira W. Snyder [Thu, 28 Dec 2006 19:40:17 +0000 (11:40 -0800)]
[RARSLAVE] Refactoring of PAR2Set

This patch moves much of the functionality required only by the PAR2Set
class from the global scope into the PAR2Set class itself. It is now much
more careful about only generating sets of data once (where possible).
Also, it is much more careful to re-generate a set of data when it is
possible (and likely) that it has changed.

Fixes: Failure to remove original versions (.1 extension) of repaired
files.

Signed-off-by: Ira W. Snyder <devel@irasnyder.com>
17 years ago[RARSLAVE] Eliminate duplicates when finding deleteable files
Ira W. Snyder [Thu, 28 Dec 2006 07:28:34 +0000 (23:28 -0800)]
[RARSLAVE] Eliminate duplicates when finding deleteable files

Use a set() to eliminate duplicates when searching for deletable files.
This fixes the OSError that happens when the file cannot be found because
it was already deleted.

Signed-off-by: Ira W. Snyder <devel@irasnyder.com>
17 years ago[RARSLAVE] Have find_deleteable_files() search when called
Ira W. Snyder [Thu, 28 Dec 2006 07:19:23 +0000 (23:19 -0800)]
[RARSLAVE] Have find_deleteable_files() search when called

Changes the function find_deleteable_files() to do a search when it is
called, rather than operating on old (and probably out-of-date) data.

Signed-off-by: Ira W. Snyder <devel@irasnyder.com>
17 years ago[RARSLAVE] Fix exception syntax
Ira W. Snyder [Thu, 28 Dec 2006 05:12:26 +0000 (21:12 -0800)]
[RARSLAVE] Fix exception syntax

Fixes a stupid error in syntax made in the last commit.

Signed-off-by: Ira W. Snyder <devel@irasnyder.com>
17 years ago[PAR2PARSER] Fix Par2Parser class
Ira W. Snyder [Thu, 28 Dec 2006 05:09:36 +0000 (21:09 -0800)]
[PAR2PARSER] Fix Par2Parser class

The original class was registering every PAR2 file as corrupt, even though
the old parser handled them fine. This reverts to the old parser, fixing
the problem.

Signed-off-by: Ira W. Snyder <devel@irasnyder.com>
17 years ago[RARSLAVE] Fix default deletion option
Ira W. Snyder [Thu, 28 Dec 2006 04:42:38 +0000 (20:42 -0800)]
[RARSLAVE] Fix default deletion option

Change the default null response to the deletion prompt to not delete
anything.

Signed-off-by: Ira W. Snyder <devel@irasnyder.com>
17 years ago[RARSLAVE] Update par2parser calls
Ira W. Snyder [Thu, 28 Dec 2006 04:18:53 +0000 (20:18 -0800)]
[RARSLAVE] Update par2parser calls

Update calls to the par2parser class to Par2Parser to reflect the name
change made in the previous commit.

Signed-off-by: Ira W. Snyder <devel@irasnyder.com>
17 years ago[RARSLAVE] Rename par2parser to Par2Parser
Ira W. Snyder [Thu, 28 Dec 2006 04:14:54 +0000 (20:14 -0800)]
[RARSLAVE] Rename par2parser to Par2Parser

Renamed the par2parser module to Par2Parser. Updated rarslave.py with the
change.

Signed-off-by: Ira W. Snyder <devel@irasnyder.com>
17 years ago[RARSLAVE] Catch exceptions from par2parser
Ira W. Snyder [Thu, 28 Dec 2006 04:00:17 +0000 (20:00 -0800)]
[RARSLAVE] Catch exceptions from par2parser

Add try / except blocks to catch exceptions that happen in the par2parser
class.

Signed-off-by: Ira W. Snyder <devel@irasnyder.com>
17 years ago[PAR2PARSER] Add extra corrupt file checks
Ira W. Snyder [Thu, 28 Dec 2006 03:56:01 +0000 (19:56 -0800)]
[PAR2PARSER] Add extra corrupt file checks

Add checks to calls of file.read() and file.seek() to make sure that
exceptions caused by these calls are caught. They usually occur because of
corrupt PAR2 files.

Signed-off-by: Ira W. Snyder <devel@irasnyder.com>
17 years ago[PAR2PARSER] Tabify the file properly
Ira W. Snyder [Thu, 28 Dec 2006 03:53:18 +0000 (19:53 -0800)]
[PAR2PARSER] Tabify the file properly

Tabify the par2parser.py file properly.

Signed-off-by: Ira W. Snyder <devel@irasnyder.com>
17 years ago[TESTS] Remove old tests
Ira W. Snyder [Thu, 28 Dec 2006 02:55:16 +0000 (18:55 -0800)]
[TESTS] Remove old tests

Remove some tests that correspond to features that were removed.

Signed-off-by: Ira W. Snyder <devel@irasnyder.com>
17 years ago[RARSLAVE] Fix interactive deletion
Ira W. Snyder [Wed, 27 Dec 2006 06:52:46 +0000 (22:52 -0800)]
[RARSLAVE] Fix interactive deletion

Adds the accidentally ommitted list of files to the prompt that gets
displayed during interactive deletion.

Signed-off-by: Ira W. Snyder <devel@irasnyder.com>
17 years ago[RARSLAVE] Change message log-level
Ira W. Snyder [Wed, 27 Dec 2006 06:48:43 +0000 (22:48 -0800)]
[RARSLAVE] Change message log-level

Change the message of using the default extractor to be a verbose message,
since it is likely to come up when extracting mp3 sets, etc.

Signed-off-by: Ira W. Snyder <devel@irasnyder.com>
17 years ago[RARSLAVE] Improve "likely file" detection
Ira W. Snyder [Wed, 27 Dec 2006 06:43:01 +0000 (22:43 -0800)]
[RARSLAVE] Improve "likely file" detection

Improve the likely file detection by using not only the name of the par2
files, but also what they are protecting. This should help a lot.

Update all uses of find_likely_files() to the new API.

Also, fix the filetype detectors so that they work, and move the duplicate
code to a new function.

Signed-off-by: Ira W. Snyder <devel@irasnyder.com>
17 years ago[RARSLAVE] Fix delete_list()
Ira W. Snyder [Wed, 27 Dec 2006 04:44:46 +0000 (20:44 -0800)]
[RARSLAVE] Fix delete_list()

Fixes the delete_list() function so that it looks in the corrent directory
for the files to delete.

Signed-off-by: Ira W. Snyder <devel@irasnyder.com>
17 years ago[RARSLAVE] Fix directory switching 2
Ira W. Snyder [Tue, 26 Dec 2006 19:54:13 +0000 (11:54 -0800)]
[RARSLAVE] Fix directory switching 2

Important bugfix. This resets the directory we are in after running the
command given to run_command(). This is the expected behavior, but was
overlooked.

None of the current code relies on this behavior, but it's good to act as
expected, anyway.

Signed-off-by: Ira W. Snyder <devel@irasnyder.com>
17 years ago[RARSLAVE] Enable production actions
Ira W. Snyder [Tue, 26 Dec 2006 19:42:01 +0000 (11:42 -0800)]
[RARSLAVE] Enable production actions

Remove all of the non-production testing actions, and enable all of the
real actions, including running commands, deleting files, etc.

Signed-off-by: Ira W. Snyder <devel@irasnyder.com>
17 years ago[RARSLAVE] Fix noextract extraction
Ira W. Snyder [Wed, 27 Dec 2006 04:25:15 +0000 (20:25 -0800)]
[RARSLAVE] Fix noextract extraction

This adds a fix to the noextract type of extraction (usually mv), which
will exit early (and successfully) if the same file is being moved between.

Signed-off-by: Ira W. Snyder <devel@irasnyder.com>
17 years ago[RARSLAVE] Fix working directory option
Ira W. Snyder [Wed, 27 Dec 2006 04:00:52 +0000 (20:00 -0800)]
[RARSLAVE] Fix working directory option

Add a check to make sure the working directory is valid before trying
anything, that way we don't fail later.

Signed-off-by: Ira W. Snyder <devel@irasnyder.com>
17 years ago[RARSLAVE] Add porcelain
Ira W. Snyder [Wed, 27 Dec 2006 03:49:49 +0000 (19:49 -0800)]
[RARSLAVE] Add porcelain

Add all of the user-level polish, such as the option parser, and all
related functions which are needed to implement its actions.

Signed-off-by: Ira W. Snyder <devel@irasnyder.com>
17 years ago[CONFIG] Remove unneeded option
Ira W. Snyder [Wed, 27 Dec 2006 03:42:14 +0000 (19:42 -0800)]
[CONFIG] Remove unneeded option

Remove an unnecessary option from the RarslaveConfig class' default
options. Also, change the default loglevel to 0. (Fatal and Normal
messages only)

Signed-off-by: Ira W. Snyder <devel@irasnyder.com>
17 years ago[RARSLAVE] Add debug logging messages
Ira W. Snyder [Tue, 26 Dec 2006 22:41:09 +0000 (14:41 -0800)]
[RARSLAVE] Add debug logging messages

Add a couple of debug-level messages.

Signed-off-by: Ira W. Snyder <devel@irasnyder.com>
17 years ago[LOGGER] Change inner workings (again)
Ira W. Snyder [Tue, 26 Dec 2006 21:37:23 +0000 (13:37 -0800)]
[LOGGER] Change inner workings (again)

Change the inner workings of the RarslaveLogger class so that it has
four different message types: Fatal, Normal, Verbose, Debug. This also
adds the function printLoglevel() to the RarslaveLogger class. It will
print all messages at a certain loglevel.

Also update the unit tests so that they behave with the current workings of
the RarslaveLogger class.

Signed-off-by: Ira W. Snyder <devel@irasnyder.com>
17 years ago[RARSLAVE] Add logging messages
Ira W. Snyder [Tue, 26 Dec 2006 05:05:22 +0000 (21:05 -0800)]
[RARSLAVE] Add logging messages

Adds a lot of logging messages. Also audited (and added) many error return
values, as well as missing success paths.

Signed-off-by: Ira W. Snyder <devel@irasnyder.com>
17 years ago[RARSLAVE] Remove id requirement from RarslaveLogger
Ira W. Snyder [Tue, 26 Dec 2006 03:51:34 +0000 (19:51 -0800)]
[RARSLAVE] Remove id requirement from RarslaveLogger

Remove the id requirement from RarslaveLogger. This reduces the class'
utility, but makes it much easier to use in the existing rarslave
infrastructure.

Signed-off-by: Ira W. Snyder <devel@irasnyder.com>
17 years ago[RARSLAVE] Change RarslaveLogger operation
Ira W. Snyder [Mon, 25 Dec 2006 18:55:07 +0000 (10:55 -0800)]
[RARSLAVE] Change RarslaveLogger operation

Changes the RarslaveLogger class' method of operation to not require a
pre-generated id. Instead, it still requires an id, but keeps track of all
id's given to it.

This also removes the unit tests that tested the old behavior.

Signed-off-by: Ira W. Snyder <devel@irasnyder.com>
17 years ago[CONFIG] Fix automatic absolutizing of directories
Ira W. Snyder [Wed, 27 Dec 2006 00:00:07 +0000 (16:00 -0800)]
[CONFIG] Fix automatic absolutizing of directories

Fix the automatic absolutizing of directories in the RarslaveConfig class.

Signed-off-by: Ira W. Snyder <devel@irasnyder.com>
17 years ago[CONFIG] Automatically absolute-ize directories
Ira W. Snyder [Tue, 26 Dec 2006 23:52:57 +0000 (15:52 -0800)]
[CONFIG] Automatically absolute-ize directories

This patch makes the RarslaveConfig class automatically return the absolute
paths to directories, even though they are not stored in the config that
way.

Signed-off-by: Ira W. Snyder <devel@irasnyder.com>
17 years ago[RARSLAVE] Config-ify rarslave
Ira W. Snyder [Tue, 26 Dec 2006 23:42:10 +0000 (15:42 -0800)]
[RARSLAVE] Config-ify rarslave

Have rarslave rely on the RarslaveConfig class for all of its configuration
needs, such as options, regexes, etc.

Signed-off-by: Ira W. Snyder <devel@irasnyder.com>
17 years ago[CONFIG] Update RarslaveConfig for rarslave2
Ira W. Snyder [Tue, 26 Dec 2006 23:28:28 +0000 (15:28 -0800)]
[CONFIG] Update RarslaveConfig for rarslave2

Updates the RarslaveConfig class for rarslave2, removing things that were
only needed in the original rarslave, and adding new things that we need.

Signed-off-by: Ira W. Snyder <devel@irasnyder.com>
17 years ago[CONFIG] Add RarslaveConfig class
Ira W. Snyder [Tue, 26 Dec 2006 22:43:55 +0000 (14:43 -0800)]
[CONFIG] Add RarslaveConfig class

Add the RarslaveConfig class, which is almost entirely imported from the
original rarslave program.

Signed-off-by: Ira W. Snyder <devel@irasnyder.com>
17 years ago[RARSLAVE] Fix extraction
Ira W. Snyder [Tue, 26 Dec 2006 23:45:25 +0000 (15:45 -0800)]
[RARSLAVE] Fix extraction

Important bugfix. If the extraction directory is None, then we can safely
assume that we just don't want to do anything but a default extraction, not
outputting the files anywhere special.

Signed-off-by: Ira W. Snyder <devel@irasnyder.com>
17 years ago[RARSLAVE] Fix directory switching
Ira W. Snyder [Tue, 26 Dec 2006 19:49:48 +0000 (11:49 -0800)]
[RARSLAVE] Fix directory switching

Important bugfix. This fixes the directory switching code in the
run_command() function. Without this fix, the directory never gets switched
as expected.

Signed-off-by: Ira W. Snyder <devel@irasnyder.com>
17 years ago[RARSLAVE] Improve error handling
Ira W. Snyder [Mon, 25 Dec 2006 09:13:51 +0000 (01:13 -0800)]
[RARSLAVE] Improve error handling

Improve the error handling, mostly of the main operations that occur during
a program run (check, repair, join, extract, delete).

Signed-off-by: Ira W. Snyder <devel@irasnyder.com>
17 years ago[RARSLAVE] Improve deletion
Ira W. Snyder [Mon, 25 Dec 2006 08:21:23 +0000 (00:21 -0800)]
[RARSLAVE] Improve deletion

Improve the deletion capabilities. This has initial support for deleting
interactively as well.

Signed-off-by: Ira W. Snyder <devel@irasnyder.com>
17 years ago[RARSLAVE] Add main program logic
Ira W. Snyder [Mon, 25 Dec 2006 04:56:05 +0000 (20:56 -0800)]
[RARSLAVE] Add main program logic

Add the main program logic to the PAR2Set class. This handles verifying,
repairing, joining, extraction, and deletion of the leftover files in the
PAR set.

This also converts over the main() code to use this function exclusively.

Signed-off-by: Ira W. Snyder <devel@irasnyder.com>
17 years ago[RARSLAVE] Add PAR2 Parser
Ira W. Snyder [Mon, 25 Dec 2006 01:45:56 +0000 (17:45 -0800)]
[RARSLAVE] Add PAR2 Parser

Add the class par2parser which parses PAR2 files to extract the list of
files which are "protected" by them.

Signed-off-by: Ira W. Snyder <devel@irasnyder.com>
17 years ago[RARSLAVE] Add PAR2Set class
Ira W. Snyder [Mon, 25 Dec 2006 01:39:24 +0000 (17:39 -0800)]
[RARSLAVE] Add PAR2Set class

Add the PAR2Set class, which is able to tell whether a parset is the same
as another set.

Signed-off-by: Ira W. Snyder <devel@irasnyder.com>
17 years ago[RARSLAVE] Add repairer
Ira W. Snyder [Sun, 24 Dec 2006 20:33:36 +0000 (12:33 -0800)]
[RARSLAVE] Add repairer

Add the class RarslaveRepairer which will repair / join par sets.

Also, change the no-extract heads to return the files that are protected by
the rar set, so that they can be mv'd later.

Signed-off-by: Ira W. Snyder <devel@irasnyder.com>
17 years agoMerge with add-logger
Ira W. Snyder [Sun, 24 Dec 2006 03:14:22 +0000 (19:14 -0800)]
Merge with add-logger

17 years ago[RARSLAVE] Add extraction class
Ira W. Snyder [Sun, 24 Dec 2006 03:08:11 +0000 (19:08 -0800)]
[RARSLAVE] Add extraction class

Adds the RarslaveExtractor class which handles extraction of all types of
set supported by rarslave.

Signed-off-by: Ira W. Snyder <devel@irasnyder.com>
17 years ago[RARSLAVE] Add logging class
Ira W. Snyder [Sun, 24 Dec 2006 03:04:21 +0000 (19:04 -0800)]
[RARSLAVE] Add logging class

This adds the RarslaveLogger class, used for logging of messages on a
per-set basis. It also adds the support class RarslaveMessage, which is
used within RarslaveLogger.

Signed-off-by: Ira W. Snyder <devel@irasnyder.com>
17 years agoInitial work on extraction.
Ira W. Snyder [Sat, 16 Dec 2006 21:19:03 +0000 (13:19 -0800)]
Initial work on extraction.

17 years agoAdd type detection code.
Ira W. Snyder [Sat, 16 Dec 2006 07:22:34 +0000 (23:22 -0800)]
Add type detection code.

17 years agoInitial commit of the rarslave project.
Ira W. Snyder [Sat, 16 Dec 2006 05:17:23 +0000 (21:17 -0800)]
Initial commit of the rarslave project.