User:Pedro Sá Couto/TW/NewTitles

From XPUB & Lens-Based wiki
< User:Pedro Sá Couto‎ | TW
Revision as of 02:54, 16 June 2020 by Pedro Sá Couto (talk | contribs) (→‎Python View)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

STEPS

Asking for a new title is separated in 4 steps:

1. Checking if the file was already asked for
2. Filling the form with info from the title
3. Submiting the request
4. Displaying the request

WHY?

Tactical Watermarks will exist alongside its use.

Not only I intend Tactical Watermarks to become a tool, in this route I wanted to create a stimulus where users can ask for titles they need. This feature increases the sociability within the web platform and also augments the sense of community and solidarity that exists in this online space. Requesting a new title is also an approach to populate Library Genesis with files that might be missing to other users of this shadow-library aswell.

PREVIEW

Printscreen from https://hub.xpub.nl/uploadbook/ and https://hub.xpub.nl/republish/

Python View

db = dataset.connect('sqlite:///file.db?check_same_thread=False')

# create table
table = db['requested']

@app.route('/request_form', methods=['GET'])
def request_form():
    return render_template('public/request_form.html')

# from GET /bookrequest render request.html
@app.route('/uploadbook', methods=['GET'])
def bookrequest():
    books = table.find(order_by='-id')
    return render_template('public/upload_book.html', books=books)

# from POST /submit store data in the database and forward to the request
@app.route('/submit', methods=['POST'])
def submit():
    book = dict(title=request.form['title'], author=request.form['author'], publisher=request.form['publisher'], year=request.form['year'], extention=re$
    table.insert(book)
    return redirect(url_for('index'))

#Request a book
#REQUEST IN REPUBLISH
# from GET /bookrequest render request.html
@app.route('/republish', methods=['GET'])
def bookrepublish():
    books = table.find(order_by='-id')
    return render_template('public/republish.html', books=books)