Skip to content

Commit

Permalink
Merging with private repo, but removing the telegram and docker crede…
Browse files Browse the repository at this point in the history
…ntials
  • Loading branch information
MaxBubblegum47 committed Jun 5, 2024
1 parent 48b1074 commit 8b0a53f
Show file tree
Hide file tree
Showing 18 changed files with 535 additions and 32 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
run: pip install -r src/requirements.txt

- name: Run Test on Python code with flake8
run: flake8 --ignore=E501,E121,E126 .
run: flake8 --ignore=E501,E121,E126,E302,E305,W291 .

- name: Run Pytest
working-directory: src/
Expand Down
66 changes: 66 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]

# Python env
pyvenv.cfg

# C extensions
*.so

# Distribution / packaging
.Python
env/
bin/
.conda/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover

# Translations
*.mo
*.pot

# Django stuff:
*.log

# Sphinx documentation
docs/_build/

# PyBuilder
target/

venv/
.vscode/
bot.db
48 changes: 30 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# VictoriaCinemaBot
Little Bot that collects information from my local movie theater's website: https://www.victoriacinema.it/victoria_cinema/index.php and displays information about movies:
# CinemaBot
CinemaBot is a little telegram bot that collects information from my local movie theater's website: https://www.victoriacinema.it/victoria_cinema/index.php and displays them as messages via telegram. There's a chat thanks to that you can interact with the bot and get this informatios:
* When they are in the theater
* Duration
* Cast
Expand All @@ -8,22 +8,26 @@ Little Bot that collects information from my local movie theater's website: http
* Movie trailer
* Reservation link

## How to make it works?
The first thigs to do is to create a file inside of src folder: _config.py_ and adding the following line:
## How does it work?
The first thigs is to create a file: _config.py_ and add the following line:

```python
TOKEN = "place your API key here"
BOTNAME = "place here the name of your bot"
```
Then, after installing the requirements (I auto generated it with _pipreqs_), you can execute the following line:

Then, after installing the requirements with `pip install -r requirements.txt`, you can execute the following line:

```bash
bash src/main.sh
bash main.sh
```
Note that: in all bash scripts I used _python3_ as python command. Make sure that your system has this command available, otherwise the script may not works at all.

I want to remember you that now to use pip you need to create a virtual envirorment before.

### Available Commands
* film/start: display all the film that are available on https://www.victoriacinema.it/victoria_cinema/index.php
* prezzi/price: shows movie's ticket price
* info: show all other information related with the movie theater
* film/start: shows all the film that are available on https://www.victoriacinema.it/victoria_cinema/index.php
* prezzi/price: shows ticket's prices
* info: shows all other infos (e.g. discount)

### Screenshots
![screenshot_1](https://user-images.githubusercontent.com/59342085/165149574-523d1478-945d-4156-9f17-e4c8f50d6c48.png)
Expand All @@ -32,21 +36,29 @@ Note that: in all bash scripts I used _python3_ as python command. Make sure tha

### How it works?
The bot has two parts:
* bot itself
* bot
* movie updater

The first aim to display information to the user every time he presses the button on the telegram chat. The movie updater is responsible for retrieves the movies information (once every hour) and saving them into files. I handle both with a _containter_ written in _bash_. It makes run the updater once per hour and keep alive the bot.
The aim of the bot is to display information to the user in the telegram chat, while the movie updater is responsible for retrieves information about the movies.

### About the website
The website is done by https://www.creaweb.it/creaweb/index.php, a company that seems to create website (_php_ based) for movie theaters. It has curious html configurations, in which movies are divided in Even and Odd, so I had two to write similar funcion to catch the _even movies_ and the _odd_ ones. Then I put everything into two differnts list (_even, odd_) saving everything in files. The bot open the right file (even one or the odd one), read the content and print movie's information to the user. I dump just one time the hrml webpage then I start to analyze it.
The website was done by https://www.creaweb.it/creaweb/index.php
The company that seems to create website (_php_ based) for movie theaters. It has curious html configurations, in which movies are divided in Even and Odd `div class`.

##### About messy commits
I did a wrong commit, committing something like 4 file at once, but I'm lazy so I don't think I'm gonna fix it for now :(
### Information for the Developer
#### How to run the program
Simply do `bash main.sh`


#### How to push to docker
Commands list:
#### How to push to docker hub
Commands list (**you need to change maxbubblegum wit your user**):
- docker login --username maxbubblegum
- docker build . -t maxbubblegum47/victoriacinemabot:latest
- docker tag "tag from the build" maxbubblegum/victoriacinemabot
- docker push maxbubblegum/victoriacinemabot

#### How to run the docker image
If you want to run the program without thinking to much about docker, just `CTRL + C CTRL + V` this two commands in your terminal:
- `docker build -t my-bot-image .` (in VictoriaCinema main folder)
- `docker run --name my-bot-container my-bot-image`

If for some reason you have done this in advance and now the terminal is telling you that this image exists yet, you can check it by using `docker images` to list all the possible images and the simply `docker run <name of the image>`.
Binary file removed __pycache__/config.cpython-310.pyc
Binary file not shown.
Binary file removed __pycache__/info.cpython-310.pyc
Binary file not shown.
Binary file removed __pycache__/movie.cpython-310.pyc
Binary file not shown.
Binary file not shown.
Binary file removed database/movies.db
Binary file not shown.
Loading

0 comments on commit 8b0a53f

Please sign in to comment.