mediahandler.handler

Module: mediahandler.handler

Module contains:

  • mediahandler.handler.MHandler

    Main handler object structure which serves as an entry point for the entire module. Contains the core logic for dispatching media to add to their respective submodules for further handling.

  • mediahandler.handler.main()

    Wrapper function for handling CLI input.

class mediahandler.handler.MHandler(config)

Bases: mediahandler.MHObject

Main handler object structure which serves as an entry point for the entire module. Contains the core logic for dispatching media to add to their respective submodules for further handling.

Required argument:

  • config

    Full path to valid mediahandler configuration file. A default file available for customization is located here:

    ~/.config/mediahandler/config.yml
    

Public methods:

  • add_media()

    Main entry point containing the logic sequence for sending media files to the correct submodule processor.

  • extract_files()

    Wrapper function for accessing the mediahandler.util.extract module

class MHSettings(adict)

Bases: object

Object which serves as a simple structure for storing data as attributes.

MHandler.add_media(media, **kwargs)

Entry point function for adding media via the MHandler object.

Required argument:

  • media

    valid path to a file or a folder of media to be added. Assumes structure:

    /path/to/<media type>/<media>
    

Other valid arguments:

  • type

    Int in range [1, 2, 3, 4]. Declare a specific file type. Defaults to a <media type> derived from media path. Valid file types are:

    • 1 - TV
    • 2 - Movies
    • 3 - Music
    • 4 - Audiobooks
  • query

    String. Set a custom query string for audiobooks. Useful for fixing “Unable to match” errors.

  • single

    True/False. Force beets to import music as a single track. Useful for fixing “items were skipped” errors.

  • nopush

    True/False. Disable push notifications. Overrides the “enabled” config file setting.

MHandler.extract_files(raw)

Wrapper function for sending compressed files for extraction via the mediahandler.util.extract module.

Requires the Filebot application for extraction.

MHandler.set_settings(adict)

Iteratively converts a dict into MHSettings objects and subsequently into object attributes.

mediahandler.handler.main(deluge=False)

Wrapper function for passing CLI arguments to the MHandler add_media() function for processing.

Optional argument:
  • deluge

    True/False. Determines whether basic argument parser or deluge argument parser should be used.