Metadata-Version: 2.1
Name: dl621
Version: 2.1.0
Summary: A simple python module and CLI utility to download e621 images with embedded XMP tags and description
Home-page: https://github.com/nimaid/python-dl621
Author: Ella Jameson
Author-email: ellagjameson@gmail.com
License: Copyright (c) 2022, Ella Jameson
        
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
        
        Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
        Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
        THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
        
Platform: UNKNOWN
License-File: LICENSE

dl621
========================

A simple python module and CLI utility to download e621 images with embedded XMP tags and description


Installation
========================

The module requires Exempi, which is only available for Linux and Mac. Hence, this module only works on Linux and Mac.

To easily install everything via conda:

``conda env create -f environment.yml``

To manually install just the module (still needs Exempi installed seperately):

``pip install dl621``

To manually install Exempi on Debian:

``sudo apt-get install -y exempi``

Usage
========================

The program can be used as a simple command line program::

    $ dl621 -h
    usage: dl621 [-h] -i ID [-f FOLDER] [-n NAME] [-t] [-j] [-a USERNAME:API_KEY] [-u USERAGENT]

    Downloads e621 images with embedded XMP tags and description

    optional arguments:
      -h, --help            show this help message and exit
      -i ID, --post_id ID   the ID of the e621 post
      -f FOLDER, --dl_folder FOLDER
                            the folder to download to
      -n NAME, --name_pattern NAME
                            the file name (no extention), Replacements: {m}=md5, {i}=post_id
      -t, --no_tags         don't embedd tags or metadata
      -j, --save_json       saves metadata in a seperate .json file in additon to other options
      -a USERNAME:API_KEY, --authorization USERNAME:API_KEY
                            your e621 username and API key
      -u USERAGENT, --user_agent USERAGENT
                            manual override of the user agent string


It can also be imported and used in your own scripts (default options shown)::

    import dl621

    r = dl621.download_image(post_id, output_folder=".", name_pattern="dl621_{i}_{m}", add_tags=True, save_json=False, use_messages=False, use_warnings=True, custom_json=None, auth=None, download_timeout=5, user_agent="dl621/1.0 (by nimaid on e621)")
    
    if r["saved_image"]:
        print("Image downloaded! Location:", r["path_image")
    else:
        print("Download failed!")

The ``download_image()`` function returns a dictionary with the following items:

* post_exists (bool)
* post_deleted (bool)
* post_missing_url (bool)
* saved_image (bool)
* saved_tags (bool)
* saved_json (bool)
* path_image (string)
* path_json (string)

