Process

This module is used for performing the rename and parsing information into the correct path

Exposed Functions

kodiRename.process.collectTvRename(config: ConfigSpec, tv_info: List[TVInfo]) List[renameOperation][source]

Collect TV Rename Operations from Movie Information

Parameters:
  • config – Configuration object

  • tv_info – List of TV info

Returns:

List of rename operations to be performed

kodiRename.process.collectMovieRename(config: ConfigSpec, movie_list: list[MovieInfo]) List[renameOperation][source]

Collect Movie Rename Operations from Movie Information

Parameters:
  • config – Configuration object

  • movie_list – List of Movie Info

Returns:

List of rename operations to be performed

kodiRename.process.performRenameOperation(config: ConfigSpec, data: renameOperation, dry_run: bool = False) renameOperation[source]

Perform Rename Operation

Will rename the source file path to the destination file path and create the path if it does not exist. The rename will not be performed if the source and destination file path are the same. If the mode is “copy” will copy the file before renaming. If the mode is “move” will move and rename.

Parameters:
  • config – Configuration object

  • data – Rename operation to perform

Returns:

Rename Operation

kodiRename.process.performCleanDirectory(config: ConfigSpec, data: renameOperation, dry_run: bool = False) bool[source]

Clean Source Directory

Delete parent path of source file information. Will not be performed if the destination parent path is the same as the source parent path

Parameters:
  • config – Configuration object

  • data – Rename Operation to delete src parent path

Internal Functions

kodiRename.process.process.processMovieRename(config: ConfigSpec, movie_info: MovieInfo) fileInfo[source]

Process Movie Information into Output File Information

Parameters:
  • config – Configuration object

  • movie_info – Movie Information

Returns:

File information for output file

kodiRename.process.process.processTvRename(config: ConfigSpec, tv_info: TVInfo, episode_info: EpisodeInfo) fileInfo[source]

Process Episodes Information into Output File Information

Parameters:
  • config – Configuration object

  • tv_info – TV information

  • episode_info – Episode information

Returns:

File information for output file

kodiRename.process.process.formatMovieParent(movie_info: MovieInfo, movie_config: movieConfig) str[source]

Generate the Parent Path for storing Movie

Parameters:
  • movie_info – Movie Information

  • movie_config – Configuration Options for Movies from Base Configuration

Returns:

Directory Name

kodiRename.process.process.formatMovieFile(movie_info: MovieInfo, movie_config: movieConfig) str[source]

Generate the file name for storing Movie

Parameters:
  • movie_info – Movie Information

  • movie_config – Configuration Options for Movies from Base Configuration

Returns:

Filename

kodiRename.process.process.formatTvParent(tv_info: TVInfo, episode_info: EpisodeInfo, tv_config: tvConfig) str[source]

Generate the Parent Path for storing Episodes

Parameters:
  • tv_info – TV Show Information

  • episode_info – Episode Information

  • tv_config – Configuration Options for TV Shows from Base Configuration

Returns:

Directory Name

kodiRename.process.process.formatTvSeason(tv_info: TVInfo, episode_info: EpisodeInfo, tv_config: tvConfig) str[source]

Generate the Season Path for storing Episodes

Parameters:
  • tv_info – TV Show Information

  • episode_info – Episode Information

  • tv_config – Configuration Options for TV Shows from Base Configuration

Returns:

Directory Name

kodiRename.process.process.formatTvEpisode(tv_info: TVInfo, episode_info: EpisodeInfo, tv_config: tvConfig) str[source]

Generate the file name for storing Episodes

Parameters:
  • tv_info – TV Show Information

  • episode_info – Episode Information

  • tv_config – Configuration Options for TV Shows from Base Configuration

Returns:

Filename

Data Classes

class kodiRename.process.renameOperation(src: fileInfo, dest: fileInfo, status: Literal['ok', 'warning', 'fail', 'skip'] | None = None)[source]

Rename Operation

Stores the source and destination and provides a status string

dest: fileInfo

Destination file information

src: fileInfo

Source file information

status: Literal['ok', 'warning', 'fail', 'skip'] | None = None

Status of operation