Skip to content

Commit

Permalink
Stable version 1.0.0-beta. words fix, info loggin
Browse files Browse the repository at this point in the history
Showing to user if are logged in or not.
Fixing Some works witch are in portuguese to english
  • Loading branch information
kilerhg committed Sep 27, 2021
1 parent 439f4e8 commit c80da74
Show file tree
Hide file tree
Showing 11 changed files with 86 additions and 34 deletions.
37 changes: 27 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Listador de livros lidos e para ler em python
### Instalando
Clone este repositorio:

```https://github.com/kilerhg/TodoBook.git```
```git clone https://github.com/kilerhg/TodoBook.git```

Entre no repositorio:
```cd TodoBook```
Expand All @@ -20,18 +20,35 @@ Instalar Requisitos:

## Abrindo

Abrir o Cmd ou PowerShell Na pasta e rodar o comando: ```python main.py```
Abrir o Cmd ou PowerShell Na pasta e rodar o comando: ```python app.py```

## Task-List

- [X] Desenvolver a ideia
- [ ] Prototipagem
- [ ] Criar funções Consumo APIs
- [ ] Criar Funções separando primeiros Conteúdos
- [ ] Criar interface básica
- [ ] Criar ligação entre back e front
- [ ] Lapidar projeto
- [ ] Compilar para .EXE
- [X] funções Consumo APIs
- [X] Funções separando primeiros Conteúdos
- [X] Função Limpa Dados
- [X] Função olhar elementos individualmente
- [X] Estudos SQLite3
- [X] Desenhar Banco de dados Biblioteca
- [X] Criar Banco
- [X] Conectar & Testar Banco
- [X] Função Enviar Biblioteca
- [X] Função Excluir livro Biblioteca
- [X] Função Editar livro Biblioteca
- [X] Pesquisar Templates Html
- [X] Estudar Api Google & seus filtros
- [ ] Opções para organizar biblioteca internamente (Genero, nome, status)


Extras:

- [ ] Mostrar semelhantes ao adicionar livro biblioteca
- [ ] API amazon book


## Screenshot

![homepage]('./Screenshot/home_page.png')
![search]('./Screenshot/search.png')
![my_library]('./Screenshot/my_library.png')
![my_library_book_settings]('./Screenshot/my_library_book_settings.png')
Binary file added Screenshot/home_page.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Screenshot/my_library.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Screenshot/my_library_book_settings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Screenshot/search.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 5 additions & 2 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@

@app.route("/")
def index():
return render_template('index.html')
is_logged = bool(dict(session))
print(is_logged)
return render_template('index.html', is_logged=is_logged)


@app.route('/login')
Expand Down Expand Up @@ -78,11 +80,12 @@ def authorize():

@app.route("/busca", methods=["GET", "POST"])
def search():
is_logged = bool(dict(session))
lista_livros = []
if request.method == "POST":
livro = request.form["book_name"]
lista_livros = funcoes.search_book(busca=livro)
return render_template('search.html', books=lista_livros)
return render_template('search.html', books=lista_livros, is_logged=is_logged)


@app.route("/biblioteca")
Expand Down
42 changes: 29 additions & 13 deletions funcoes.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@
- [X] funções Consumo APIs
- [X] Funções separando primeiros Conteúdos
- [X] Função Limpa Dados
- [ ] Função olhar elementos individualmente
- [ ] Estudos SQLite3
- [ ] Desenhar Banco de dados Biblioteca
- [ ] Criar Banco
- [ ] Conectar & Testar Banco
- [ ] Função Enviar Biblioteca
- [ ] Função Excluir livro Blibioteca
- [ ] Função Editar livro Biblioteca
- [ ] Pesquisar Templates Html
- [ ] Estudar Api Google & seus filtros
- [X] Função olhar elementos individualmente
- [X] Estudos SQLite3
- [X] Desenhar Banco de dados Biblioteca
- [X] Criar Banco
- [X] Conectar & Testar Banco
- [X] Função Enviar Biblioteca
- [X] Função Excluir livro Blibioteca
- [X] Função Editar livro Biblioteca
- [X] Pesquisar Templates Html
- [X] Estudar Api Google & seus filtros
- [ ] Opções para organizar biblioteca internamente (Genero, nome, status)
Expand All @@ -43,6 +43,19 @@ def head(resposta, qtd_resposta=10):
return limpo

def limpa_requisicao_livro(livro, book_id): # good

# dict_livro = {}

# dict_livro['titulo']
# dict_livro['titulo']
# dict_livro['titulo']
# dict_livro['titulo']
# dict_livro['titulo']
# dict_livro['titulo']
# dict_livro['titulo']
# dict_livro['titulo']


dict_livro = {
'titulo' : livro['title'],
'autores' : '; '.join(livro['authors']),
Expand Down Expand Up @@ -109,7 +122,10 @@ def get_books_by_id(list_books_id : list):
for book in list_books_id:
link_book = base_url+book
dados = consumir_api(link_book)
dados_limpos = limpa_requisicao_livro(livro=dados['volumeInfo'], book_id=dados['id'])
# dados_limpos['']
list_book_library.append(dados_limpos)
try:
dados_limpos = limpa_requisicao_livro(livro=dados['volumeInfo'], book_id=dados['id'])
except:
pass
else:
list_book_library.append(dados_limpos)
return list_book_library
2 changes: 1 addition & 1 deletion notebook.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@
" sql_query_generate_library = '''\n",
" CREATE TABLE library (\n",
" id_register INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,\n",
" id_user INTEGER NOT NULL,\n",
" id_user INTEGER NOT NULL UNIQUE,\n",
" book_unique_key TEXT(40),\n",
" id_status_book INTEGER,\n",
" percent_book FLOAT(3),\n",
Expand Down
8 changes: 8 additions & 0 deletions templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,15 @@
<li class="nav-item nav-link"><a class="nav-link active" href=" {{ url_for('library') }} ">My Library</a></li>
<li class="nav-item nav-link"><a class="nav-link active" href="#about">About</a></li>
<li class="nav-item nav-link"><a class="nav-link" href="#contact">contact</a></li>
{% if is_logged %}

<li class="nav-item nav-link"><a class="nav-link" href=" {{ url_for('logout') }} ">Logout</a></li>

{% else %}

<li class="nav-item nav-link"><a class="nav-link" href=" {{ url_for('login') }} ">sign in/up</a></li>

{% endif %}
</ul>
</div>
</div>
Expand Down
12 changes: 6 additions & 6 deletions templates/library.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ <h3 class="title-a">
Library
</h3>
<p class="subtitle-a">
Click on the book to change status
Click in book to edit.
</p>
<div class="line-mf"></div>
</div>
Expand Down Expand Up @@ -100,7 +100,7 @@ <h3 class="title-a">
{% elif item['id_status_book'] == 1 %}
<div id="texto">Reading</div>
{% elif item['id_status_book'] == 2 %}
<div id="texto">Readed</div>
<div id="texto">Read</div>
{% else %}
<div id="texto">Undefined</div>
{% endif %}
Expand All @@ -109,9 +109,9 @@ <h3 class="title-a">
<div class="col-sm-12">
<h2 class="w-title"> {{ item['titulo'] }} </h2>
<div class="w-more">
<span class="w-ctegory">{{ item['autores']}}</span> / <a href="{{ item['link'] }}" style="text-decoration: none"><span class="w-ctegory">Link</span></a>
<span class="w-ctegory">{{ item['autores']}}</span> / <a href="{{ item['link'] }}" style="text-decoration: none"><span class="w-ctegory">Link google books</span></a>
</br>
<a href="{{ item['link'] }}" style="text-decoration: none"><span class="w-ctegory">Editar</span></a> / <a href="/biblioteca/remove/{{ item['book_id'] }}" style="text-decoration: none"><span class="w-ctegory">Deletar</span></a>
<a href="/biblioteca/remove/{{ item['book_id'] }}" style="text-decoration: none"><span class="w-ctegory">Delete</span></a>
</div>
</div>
</div>
Expand Down Expand Up @@ -147,11 +147,11 @@ <h3>{{item['titulo']}}</h3>
<option value="">Select</option>
<option value="0">To Read</option>
<option value="1">Reading</option>
<option value="2">Readed</option>
<option value="2">Read</option>
</select>
</div>
<div class="col-md-6" class="black">
<label for="percent" class="black"><a class="black"> Porcentagem</a></label>
<label for="percent" class="black"><a class="black"> Percent</a></label>
<input type="number" id="percent" name="percent" min="0" max="100">
</div>
</div>
Expand Down
12 changes: 10 additions & 2 deletions templates/search.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,15 @@
<ul class="navbar-nav ms-auto">
<li class="nav-item nav-link"><a class="nav-link active" href=" {{ url_for('library') }} ">My Library</a></li>
<li class="nav-item nav-link"><a class="nav-link active" href=" {{ url_for('index') }}">Home</a></li>
{% if is_logged %}

<li class="nav-item nav-link"><a class="nav-link" href=" {{ url_for('logout') }} ">Logout</a></li>

{% else %}

<li class="nav-item nav-link"><a class="nav-link" href=" {{ url_for('login') }} ">sign in/up</a></li>

{% endif %}
</ul>
</div>
</div>
Expand Down Expand Up @@ -65,11 +73,11 @@ <h3 class="title-a">
</br>
</br>
<form action="{{ url_for('search') }}", method="POST">
<input type="text" name="book_name" placeholder="Nome Livro">
<input type="text" name="book_name" placeholder="Book Name">
</br>
</br>
</br>
<input type="submit" value="Buscar">
<input type="submit" value="Search">
</form>
</br>
</br>
Expand Down

0 comments on commit c80da74

Please sign in to comment.