Fork me on GitHub
Release:
Date:
0.3.2
Aug 10, 2011
Flattr Flacsync

Table Of Contents

Download

Get latest source archive,
flacsync-0.3.2.tar.gz, or install with:

pip install flacsync --upgrade --user

Found a Bug?

Fill out a report on the issue tracker.

This Page

3.1. flacsync

class flacsync.WorkUnit(opts, max_work)[source]

Bases: object

Processing unit for transcoding a single file.

Multiple instances of this class are asynchronously executed in a multiprocessing worker pool queue.

Parameters:
  • opts (optparse.Values) – Parsed command-line options.
  • max_work (int) – Total number of workers in the pool.
do_work(encoder)[source]

Perform all process steps to convert FLAC file to the defined output format.

Parameters:encoder (flacsync.encoder._Encoder) – Encoder instance object used for conversion.
flacsync.get_dest_orphans(dest_dir, base_dir, sources)[source]

Return a list of destination files that have no matching source file. Only consider files that match paths from source list (if any).

Parameters:
  • dest_dir (str) – Desintation root directory path, to find orpahned files.
  • base_dir (str) – Base directory (of FLAC files) for comparing with dest_dir.
  • sources (list) – List of 0 or more path strings, relative to base_dir for bulding a subset of all source files.
Returns:

List of orphan destination files.

flacsync.del_dest_orphans(dest_dir, base_dir, sources)[source]

Interactively prompt the user to remove all orphaned files located in the destination file path(s).

Parameters:
  • dest_dir (str) – Desintation root directory path, to find orpahned files.
  • base_dir (str) – Base directory (of FLAC files) for comparing with dest_dir.
  • sources (list) – List of 0 or more path strings, relative to base_dir for bulding a subset of all source files.
flacsync.get_src_files(base_dir, sources)[source]

Return a list of source files for transcoding.

Parameters:
  • base_dir (str) – Base directory of FLAC files.
  • sources (list) – List of 0 or more path strings, relative to base_dir for bulding a subset of all source files.
Returns:

List of source files.

flacsync.normalize_sources(base_dir, sources)[source]

Convert all source paths to absolute path, and remove non-existent paths.

Parameters:
  • base_dir (str) – Base directory of FLAC files.
  • sources (list) – List of 0 or more path strings, relative to base_dir for bulding a subset of all source files.
Returns:

List of source files with absolute path names.

flacsync.store_once(option, opt_str, value, parser, *args, **kw)[source]

optparse handler for one-time storage of single option.

See also

Option Callbacks reference.

Parameters:
  • option (Option) – The Option instance that’s calling the callback.
  • opt_str (str) – Option selector value (i.e. -a`).
  • value (str) – Argument to the option from the command-line.
  • parser (OptionParser) – The current parser instance.
Raises :

OptionValueError if option is already defined.

flacsync.store_enc_opt(option, opt_str, value, parser, *args, **kw)[source]

optparse handler for storing an encoder option.

See also

Option Callbacks reference.

Parameters:
  • option (Option) – The Option instance that’s calling the callback.
  • opt_str (str) – Option selector value (i.e. -a`).
  • value (str) – Argument to the option from the command-line.
  • parser (OptionParser) – The current parser instance.
Raises :

OptionValueError if encoder does not support the option.

flacsync.get_opts(argv)[source]

Initializes option parser and reads command-line options.

Parameters:argv (list) – The command-line argument list
Returns:optparse.OptionValue instance of the parsed options.
flacsync.main(argv=None)[source]

Primary entry function.

Parameters:argv (list) – The command-line argument list