Metadata-Version: 1.0
Name: magma
Version: 0.1
Summary: Magma - Readout and create Magma lists. 
Home-page: http://freehg.org/u/ArneBab/magma
Author: Arne Babenhauserheide
Author-email: arne_bab@web.de
License: GNU GPL-3 or later
Description: 
        Magma lists are lists of files which can be downloaded via magnet links.
        
        They are written in yaml format to be easily readable as well as flexible and powerful.
        
        It depends on U{pyyaml <http://pyyaml.org/>}.
        
        An example magma file is I{example-0.4.magma}.
        
        This API documentation is avaible from U{http://gnuticles.gnufu.net/pymagma/}, and the code is avaible from a U{Mercurial repository <http://freehg.org/u/ArneBab/magma/>}.
        
        Manage Magma lists.
        
        Magma lists are lists of files which can be downloaded via magnet links.
        
        They are written in yaml format to be easily readable as well as flexible and powerful.
        
        It depends on U{pyyaml <http://pyyaml.org/>}.
        
        An example magma file is I{example-0.4.magma}.
        
        This API documentation is avaible from U{http://gnuticles.gnufu.net/pymagma/}, and the code is avaible from a U{Mercurial repository <http://freehg.org/u/ArneBab/magma/>}.
        
        Usage of this module
        ====================
        
        from magma import Magma
        
        >>> magma = Magma(magma_file="example-0.4.magma")
        
        or
        
        >>> magma = Magma(input_files=["input_file.txt", "input_file2.txt"])
        
        
        API / usage
        ===========
        
        B{Creating magma lists from input files}
        
        Then create a list from input files.
        >>> magma = Magma(input_files=["input_file.txt"])
        
        And save the list.
        >>> magma.save(path="example.magma")
        
        Or output the list.
        >>> print magma
        #MAGMAv0.4
        files:
        - hash:
        sha1: 3UJCLAOIZVCNAIT7TQYFLAP7ZNFW6G2G
        name: input_file.txt
        <BLANKLINE>
        
        Or just return a list of its files.
        >>> files = magma.files
        
        or output all magnet links inside the magma list.
        >>> magnets = magma.magnets
        >>> print magnets
        ['magnet:?xt=urn:sha1:3UJCLAOIZVCNAIT7TQYFLAP7ZNFW6G2G&dn=input_file.txt']
        
        
        B{Reading from magma lists}
        
        Then create the list.
        >>> magma = Magma(magma_file="example.magma")
        
        Now get the files
        >>> files = magma.files
        >>> for i in files: print i
        input_file.txt 3UJCLAOIZVCNAIT7TQYFLAP7ZNFW6G2G
        
        Get the first file from the list.
        >>> one_file = files[0]
        >>> print one_file
        input_file.txt 3UJCLAOIZVCNAIT7TQYFLAP7ZNFW6G2G
        
        And output its magnet.
        >>> file_magnet = one_file.magnet
        >>> print file_magnet
        magnet:?xt=urn:sha1:3UJCLAOIZVCNAIT7TQYFLAP7ZNFW6G2G&dn=input_file.txt
        
        Or output all its (meta-) data.
        >>> file_data = one_file.data
        >>> print file_data
        {'hash': {'sha1': '3UJCLAOIZVCNAIT7TQYFLAP7ZNFW6G2G'}, 'name': 'input_file.txt'}
        
        Output all magnet links inside the magma list.
        >>> magnets = magma.magnets
        >>> print magnets
        ['magnet:?xt=urn:sha1:3UJCLAOIZVCNAIT7TQYFLAP7ZNFW6G2G&dn=input_file.txt']
        
        
Keywords: magma,yaml,p2p,magnet
Platform: any
