bib2web/gscholar.py
def rename_file(pdf, bibitem):
    """Attempt to rename pdf according to bibitem."""
    year = _get_bib_element(bibitem, "year")
    author = _get_bib_element(bibitem, "author")
    if author:
        author = author.split(",")[0]
    title = _get_bib_element(bibitem, "title")
    l = []
    for i in year, author, title:
        if i:
            l.append(i)
    filename = " - ".join(l) + ".pdf"
    newfile = pdf.replace(os.path.basename(pdf), filename)
    print()
    print("Will rename:")
    print()
    print("  %s" % pdf)
    print()
    print("to")
    print()
    print("  %s" % newfile)
    print()
    print("Proceed? [y/N]")
    answer = raw_input()
    if answer == 'y':
        print("Renaming %s to %s" % (pdf, newfile))
        os.rename(pdf, newfile)
    else:
        print("Aborting.")
Attempt to rename pdf according to bibitem.
Attempt to rename pdf according to bibitem.
Attempt to rename pdf according to bibitem .
def rename_file(pdf, bibitem):
    year = _get_bib_element(bibitem, "year")
    author = _get_bib_element(bibitem, "author")
    if author:
        author = author.split(",")[0]
    title = _get_bib_element(bibitem, "title")
    l = []
    for i in year, author, title:
        if i:
            l.append(i)
    filename = " - ".join(l) + ".pdf"
    newfile = pdf.replace(os.path.basename(pdf), filename)
    print()
    print("Will rename:")
    print()
    print("  %s" % pdf)
    print()
    print("to")
    print()
    print("  %s" % newfile)
    print()
    print("Proceed? [y/N]")
    answer = raw_input()
    if answer == 'y':
        print("Renaming %s to %s" % (pdf, newfile))
        os.rename(pdf, newfile)
    else:
        print("Aborting.")
def rename_file ( pdf , bibitem ) : year = _get_bib_element ( bibitem , "year" ) author = _get_bib_element ( bibitem , "author" ) if author : author = author . split ( "," ) [ 0 ] title = _get_bib_element ( bibitem , "title" ) l = [ ] for i in year , author , title : if i : l . append ( i ) filename = " - " . join ( l ) + ".pdf" newfile = pdf . replace ( os . path . basename ( pdf ) , filename ) print ( ) print ( "Will rename:" ) print ( ) print ( "  %s" % pdf ) print ( ) print ( "to" ) print ( ) print ( "  %s" % newfile ) print ( ) print ( "Proceed? [y/N]" ) answer = raw_input ( ) if answer == 'y' : print ( "Renaming %s to %s" % ( pdf , newfile ) ) os . rename ( pdf , newfile ) else : print ( "Aborting." )
Attempt to rename pdf according to bibitem.
Attempt to rename pdf according to bibitem .
"""Attempt to rename pdf according to bibitem."""
pdf
bibitem