# Path: Pyblio/Open.py
# def url_to_local (url):
# def get_by_name (entity, method):
# def get_by_regexp (entity, method):
# def bibopen (entity, how = None):
#     def simple_try (url, how):
# def bibiter (entity, how = None):
#     def simple_try (url, how):
# def bibwrite (iter, out = None, how = None, database=None):
# def bibnew (name, type = None):


import sys
import string
import locale
from gettext import gettext as _
from Pyblio import Open
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
# 
# 



charset = locale.getlocale () [1] or 'ascii'

if len (sys.argv) < 4 or len (sys.argv) > 5:
    print _("usage: pyblioconvert <source>..<target> <input> [output]").encode (charset)
    sys.exit (1)


format = sys.argv [2]

try:
    source, target = string.split (format, '..')
except:
    print _("pyblioconvert: error: bad conversion format").encode (charset)
    sys.exit (1)



f_in = sys.argv [3]

if len (sys.argv) == 4:
    f_out = sys.stdout
else:
    f_out = open (sys.argv [4], 'w')


# Path: Pyblio/Open.py
# def url_to_local (url):
# def get_by_name (entity, method):
# def get_by_regexp (entity, method):
# def bibopen (entity, how = None):
#     def simple_try (url, how):
# def bibiter (entity, how = None):
#     def simple_try (url, how):
# def bibwrite (iter, out = None, how = None, database=None):
# def bibnew (name, type = None):


# Path: scripts/pyblioconvert.py
import sys
import string
import locale
from gettext import gettext as _
from Pyblio import Open

# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
# 
# 



charset = locale.getlocale () [1] or 'ascii'

if len (sys.argv) < 4 or len (sys.argv) > 5:
    print _("usage: pyblioconvert <source>..<target> <input> [output]").encode (charset)
    sys.exit (1)


format = sys.argv [2]

try:
    source, target = string.split (format, '..')
except:
    print _("pyblioconvert: error: bad conversion format").encode (charset)
    sys.exit (1)



f_in = sys.argv [3]

if len (sys.argv) == 4:
    f_out = sys.stdout
else:
    f_out = open (sys.argv [4], 'w')


database = Open.bibopen (f_in, source)