Skip to content
This repository has been archived by the owner on Dec 4, 2023. It is now read-only.
/ mtcc-streamlit Public archive

mtcc is a user-friendly tool designed for content creators to easily upload a music torrent.

License

Notifications You must be signed in to change notification settings

GuiEpi/mtcc-streamlit

Repository files navigation

mtcc streamlit (⚠️ OLD VERSION: see the new mtcc)

The quick and easy way to create and share your music torrents!

Code style: black Python 3.10

mtcc is a user-friendly tool designed for content creators to easily upload a music torrent. The application includes an NFO builder and a presentation generator in BBCode format, all accessible through a Streamlit web page.

Simply upload the album of your choice and mtcc will generate a downloadable NFO as well as a presentation for the album that can be copied in one click, without the need to provide any additional information.

mtcc uses MediaInfo to extract data from audio files, ensuring that 100% of the information in the NFO is reliable. Streamlit makes the application easy to use and provides a smooth user experience.

Dependencies

git

Development

MediaInfo, Poetry

Production

Docker

See Prerequisites

Clone the repo

First of all you need to clone the repo

git clone https://github.com/GuiEpi/mtcc.git

Development

If you don't want to contribute, modify or test things you can go to the deployment section

Usage

Install dependencies

poetry install

Run Streamlit

poetry run streamlit run mtcc/app.py

Default url http://localhost:8501

Deployment

(optional) Add infos in config.ini file

The .ini file allows to define default configuration values, however it is optional

[nfo]
ripper = ripper name
uploader = uploader name

[pres]
ygg_link = https://domain_name.com/profile/profile-name
ygg_tag = TAG
default_banners = play_banners_orange

Prerequisites

  1. Install Docker Engine
  2. Intall docker-compose
  3. Check network port accessibility

Install Docker Engine

If you haven't already done so, install Docker on your server. Docker provides .deb and .rpm packages from many Linux distributions, including:

Verify that Docker Engine is installed correctly by running the hello-world Docker image:

sudo docker run hello-world

Follow Docker's official post-installation steps for Linux to run Docker as a non-root user, so that you don't have to preface the docker command with sudo.

Install docker-compose

If you want to use docker-compose to manage your containers, you can install it by following these steps:

  1. Visit the official docker-compose installation guide for detailed instructions.
  2. Choose the installation method that is suitable for your operating system.

Check network port accessibility

As you and your users are behind your corporate VPN, you need to make sure all of you can access a certain network port. Let's say port 8501, as it is the default port used by Streamlit. Contact your IT team and request access to port 8501 for you and your users.

Run mtcc with doker-compose

docker-compose is a powerful tool that allows you to define and manage multi-container applications. While it excels at orchestrating multiple containers, you can also use it for simplifying the build and run process of a single container. Here's how you can use docker-compose to build and run your container with a single command:

docker-compose up --build

The --build flag ensures that the images are rebuilt if there are any changes in the Dockerfiles or build context.

If you prefer to run the container in the background:

docker-compose up -d --build

The -d flag runs the container in detached mode (it runs in the background).

If all goes well, you should see the output indicating that the containers are being built and started. Once the process is complete, you should see a message similar to the following:

Recreating mtcc_streamlit_1 ... done
Attaching to mtcc_streamlit_1
streamlit_1  | 
streamlit_1  | Collecting usage statistics. To deactivate, set browser.gatherUsageStats to False.
streamlit_1  |
streamlit_1  | 
streamlit_1  |   You can now view your Streamlit app in your browser.
streamlit_1  |
streamlit_1  |   URL: http://0.0.0.0:8501
streamlit_1  |

Your mtcc app is now running inside a container.

To view your mtcc app, open a web browser and navigate to http://localhost:8501. You should be able to access and interact with mtcc.

Custom DNS server (Error Resolution)

When the app is deployed on my nas I was getting errors like this:

 Album not found for album name : HTTPSConnectionPool(host='api.deezer.com', port=443): Max retries exceeded with url: /search/album?q=name (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x7f27cc4b02e0>: Failed to resolve 'api.deezer.com' ([Errno -3] Temporary failure in name resolution)"))

To solve this problem I use the Cloudflare DNS server. You can replace this IP address with that of your preferred DNS server in the docker-compose.yml or simply remove it if you don't need it.

Access to the logs

As default:

docker logs mtcc_streamlit_1

If you don't have the default configuration you can:

$ docker ps
CONTAINER ID   IMAGE            COMMAND                  CREATED             STATUS                       PORTS                    NAMES
0b0e21ffce17   mtcc_streamlit   "streamlit run mtcc/…"   About an hour ago   Up About an hour (healthy)   0.0.0.0:8501->8501/tcp   mtcc_streamlit_1

and then:

docker logs <CONTAINER ID or NAMES>

Contribute

Fork the repository

Before you can contribute, you need to make a copy (fork) of the repository to your own GitHub account. You can do this by clicking the "Fork" button in the upper-right corner of the repository page.

Clone the repository

Once you have forked the repository, you can clone it to your local machine using Git. To do this, run the following command in your terminal:

git clone https://github.com/your-username/your-repository.git

Replace "your-username" and "your-repository" with the appropriate values for your fork.

Create a branch

Before you make any changes, it's a good idea to create a new branch to work on. This helps keep your changes separate from the main branch and makes it easier to track changes. You can create a new branch using the following command:

git checkout -b my-branch

Replace "my-branch" with a descriptive name for your branch.

Make your changes

Now you can make your changes to the code, documentation, or other files in the repository.

For the future Test your changes

Before you submit your changes, make sure they work as intended. Run any tests included with the project and make sure they pass. If there are no tests, you may want to consider adding some.

Format your code

To format your code with Black, run the following command:

black .

This will recursively format all Python files in the current directory and its subdirectories.

Check the formatting

After running Black, check the formatting of your code to ensure that it is correct. You can do this by running the following command:

black --check . 

This will check the formatting of all Python files in the current directory and its subdirectories without actually changing anything.

Commit your changes

Once you are satisfied with your changes, you can commit them to your branch using the following command:

git add .
git commit -m "Descriptive commit message"

Replace "Descriptive commit message" with a brief summary of the changes you made.

Push your changes

Once you have committed your changes, you can push them to your fork using the following command:

git push origin my-branch

Replace "my-branch" with the name of your branch.

Open a pull request

Finally, you can open a pull request (PR) to submit your changes to the original repository. To do this, go to your fork on GitHub and click the "New pull request" button. Make sure to select the appropriate branches (your branch and the main branch) and provide a brief description of your changes.

Add banners

If you'd like to add banners to the project, please ensure that they meet the following requirements:

  • Banners must be saved in the banners folder.
  • There must be 6 banners in total, named as follows:
    • information.png
    • track_details.png
    • technical_details.png
    • download.png
    • my_torrents.png
    • mtcc_pres.png

    You can use the mtcc_pres.png banner from one of the four existing banners.

  • Banners must be in PNG format and have a size of 360x50 pixels.
  • Banners must be saved in a folder with a name in the format of {name}_banners_{theme}.
  • Finally, add your banner in config.py within the PRES_BANNERS dictionary, like this:
PRES_BANNERS = {
    "play_banners_purple": f"{PRES_BANNERS_LINK}/play_banners_purple",
    "play_banners_orange": f"{PRES_BANNERS_LINK}/play_banners_orange",
    "kk_banners_blue": f"{PRES_BANNERS_LINK}/kk_banners_blue",
    "kk_banners_orange": f"{PRES_BANNERS_LINK}/kk_banners_orange",
    # Link to the new banners folder
    "your_new_banners": f"{PRES_BANNERS_LINK}/your_new_banners",
}

That's it! Once you've made your changes, submit a pull request. If your banners meet our guidelines, we'll be happy to add them to the project.

Improvement ideas

I already have many ideas for improvement, such as:

  • Linking to other album streams of the same artist in the presentation
  • Adding a function to add a "like" next to a track in the presentation
  • Improving the UI
  • Adding a help section to access the app on a custom domain name
  • Adding tests for better code quality
  • Adding continuous integration (CI) for automated testing and deployment

License

mtcc is completely free and open-source and licensed under the Apache 2.0 license.

About

mtcc is a user-friendly tool designed for content creators to easily upload a music torrent.

Resources

License

Stars

Watchers

Forks

Packages

No packages published