How to use the pyexpander.config.AMAZON_MOVIE_PATH function in pyexpander

To help you get started, we’ve selected a few pyexpander examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github omerbenamram / py-expander / pyexpander / upload.py View on Github external
video_type = guess_results.get('type')
    title = guess_results.get('title')
    # Make sure every word starts with a capital letter.
    if title:
        title = title.title()
    if video_type == 'episode' and title:
        season = guess_results.get('season')
        if season:
            episode = guess_results.get('episode')
            if episode:
                cloud_dir = '{}/{}/Season {:02d}'.format(config.AMAZON_TV_PATH, title, season)
                cloud_file = '{} - S{:02d}E{:02d}'.format(title, season, episode)
    elif video_type == 'movie' and title:
        year = guess_results.get('year')
        if year:
            cloud_dir = '{}/{} ({})'.format(config.AMAZON_MOVIE_PATH, title, year)
            cloud_file = '{} ({})'.format(title, year)
    if cloud_dir and cloud_file:
        if language_extension:
            cloud_file += language_extension
        cloud_file += file_extension
        logger.info('Cloud path: {}'.format(posixpath.join(cloud_dir, cloud_file)))
        # Rename local file before upload.
        base_dir = os.path.dirname(file_path)
        new_path = os.path.join(base_dir, cloud_file)
        os.rename(file_path, new_path)
        # Sync first.
        _sync()
        # Create cloud dirs.
        logger.info('Creating directories...')
        current_dir = ''
        for directory in cloud_dir.split('/'):