mirror of
https://github.com/jarulsamy/Plex-Bot.git
synced 2024-08-19 15:01:55 +02:00
commit
c1cba637b8
@ -14,7 +14,7 @@ WORKDIR /src
|
|||||||
COPY requirements.txt .
|
COPY requirements.txt .
|
||||||
|
|
||||||
# Install all dependencies.
|
# Install all dependencies.
|
||||||
RUN pip install --only-binary all --no-cache-dir -r requirements.txt
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
# Copy PlexBot over to src.
|
# Copy PlexBot over to src.
|
||||||
COPY PlexBot/ PlexBot
|
COPY PlexBot/ PlexBot
|
||||||
|
17
Jenkinsfile
vendored
17
Jenkinsfile
vendored
@ -49,17 +49,18 @@ pipeline {
|
|||||||
steps {
|
steps {
|
||||||
sh ''' source /var/lib/jenkins/miniconda3/etc/profile.d/conda.sh
|
sh ''' source /var/lib/jenkins/miniconda3/etc/profile.d/conda.sh
|
||||||
conda activate ${BUILD_TAG}
|
conda activate ${BUILD_TAG}
|
||||||
python deploy/build.py
|
./deploy/build.sh
|
||||||
'''
|
'''
|
||||||
}
|
}
|
||||||
post {
|
|
||||||
always {
|
|
||||||
// Archive unit tests for the future
|
|
||||||
archiveArtifacts (allowEmptyArchive: true,
|
|
||||||
artifacts: 'dist/*whl',
|
|
||||||
fingerprint: true)
|
|
||||||
sh 'python deploy/push.py'
|
|
||||||
}
|
}
|
||||||
|
stage('Push Image') {
|
||||||
|
when {
|
||||||
|
expression {
|
||||||
|
currentBuild.result == 'SUCCESS'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
steps {
|
||||||
|
sh './deploy/push.sh'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
"""Plex music bot for discord.
|
"""
|
||||||
|
Plex music bot for discord.
|
||||||
Do not import this module, it is intended to be
|
|
||||||
used exclusively within a docker environment.
|
|
||||||
|
|
||||||
|
Do not import this module, it is intended to be
|
||||||
|
used exclusively within a docker environment.
|
||||||
"""
|
"""
|
||||||
import logging
|
import logging
|
||||||
import sys
|
import sys
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
"""Main entrypoint for bot
|
"""
|
||||||
|
Main entrypoint script.
|
||||||
Sets up loggers and initiates bot.
|
Sets up loggers and initiates bot.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
@ -1,2 +1,5 @@
|
|||||||
"""Track version number of package"""
|
"""Track version number of package."""
|
||||||
VERSION = "0.0.6"
|
VERSION = "1.0.0"
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
print(VERSION)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
""" All discord bot and Plex api interactions"""
|
"""All discord bot and Plex api interactions."""
|
||||||
import asyncio
|
import asyncio
|
||||||
import io
|
import io
|
||||||
import logging
|
import logging
|
||||||
|
78
README.md
78
README.md
@ -3,7 +3,7 @@
|
|||||||
[![GPLv3 license](https://img.shields.io/badge/License-GPLv3-blue.svg)](http://perso.crans.org/besson/LICENSE.html)
|
[![GPLv3 license](https://img.shields.io/badge/License-GPLv3-blue.svg)](http://perso.crans.org/besson/LICENSE.html)
|
||||||
![docker pulls](https://img.shields.io/docker/pulls/jarulsamy/plex-bot)
|
![docker pulls](https://img.shields.io/docker/pulls/jarulsamy/plex-bot)
|
||||||
![docker img size](https://img.shields.io/docker/image-size/jarulsamy/plex-bot)
|
![docker img size](https://img.shields.io/docker/image-size/jarulsamy/plex-bot)
|
||||||
<a href="https://github.com/psf/black"><img alt="Code style: black" src="https://img.shields.io/badge/code%20style-black-000000.svg"></a>
|
![black badge](https://img.shields.io/badge/code%20style-black-000000.svg)
|
||||||
|
|
||||||
A Python-based Plex music bot for discord.
|
A Python-based Plex music bot for discord.
|
||||||
|
|
||||||
@ -15,16 +15,16 @@ Plex-Bot runs entirely in a Docker container. Ensure you have Docker and docker-
|
|||||||
|
|
||||||
1. Create a new folder and `cd` into it:
|
1. Create a new folder and `cd` into it:
|
||||||
|
|
||||||
```
|
```bash
|
||||||
$ mkdir Plex-Bot
|
mkdir Plex-Bot
|
||||||
$ cd Plex-Bot
|
cd Plex-Bot
|
||||||
```
|
```
|
||||||
|
|
||||||
2. Make a `docker-compose.yml` file or use this sample:
|
2. Make a `docker-compose.yml` file or use this sample:
|
||||||
|
|
||||||
```yml
|
```yml
|
||||||
version: "3"
|
version: "3"
|
||||||
services:
|
services:
|
||||||
plex-bot:
|
plex-bot:
|
||||||
container_name: "PlexBot"
|
container_name: "PlexBot"
|
||||||
image: jarulsamy/plex-bot:latest
|
image: jarulsamy/plex-bot:latest
|
||||||
@ -36,52 +36,51 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- "./config:/config:ro"
|
- "./config:/config:ro"
|
||||||
restart: "unless-stopped"
|
restart: "unless-stopped"
|
||||||
```
|
```
|
||||||
|
|
||||||
3. Create a configuration folder:
|
3. Create a new `config` folder and create a config file like this::
|
||||||
|
|
||||||
Create a new `config` folder and create a config file like this:
|
```bash
|
||||||
|
mkdir config
|
||||||
|
cd config
|
||||||
|
touch config.yaml
|
||||||
|
```
|
||||||
|
|
||||||
```
|
```yml
|
||||||
$ mkdir config
|
# Create a file called config.yaml with the following contents
|
||||||
$ cd config
|
|
||||||
```
|
|
||||||
|
|
||||||
```yml
|
root:
|
||||||
# Create a file called config.yaml with the following contents
|
|
||||||
|
|
||||||
root:
|
|
||||||
log_level: "info"
|
log_level: "info"
|
||||||
|
|
||||||
discord:
|
discord:
|
||||||
prefix: "?"
|
prefix: "?"
|
||||||
token: "<BOT_TOKEN>"
|
token: "<BOT_TOKEN>"
|
||||||
log_level: "debug"
|
log_level: "debug"
|
||||||
|
|
||||||
plex:
|
plex:
|
||||||
base_url: "<BASE_URL>"
|
base_url: "<BASE_URL>"
|
||||||
token: "<PLEX_TOKEN>"
|
token: "<PLEX_TOKEN>"
|
||||||
library_name: "<LIBRARY_NAME>"
|
library_name: "<LIBRARY_NAME>"
|
||||||
log_level: "debug"
|
log_level: "debug"
|
||||||
```
|
```
|
||||||
|
|
||||||
4. Create a Discord bot application:
|
4. Create a Discord bot application:
|
||||||
|
|
||||||
* Go to the Discord developer portal, [here](https://discord.com/developers/applications).
|
1. Go to the Discord developer portal, [here](https://discord.com/developers/applications).
|
||||||
|
|
||||||
* Log in or create an account
|
2. Log in or create an account
|
||||||
|
|
||||||
* Click New App
|
3. Click New App
|
||||||
|
|
||||||
* Fill in App Name and anything else you'd like to include
|
4. Fill in App Name and anything else you'd like to include
|
||||||
|
|
||||||
* Click Create App
|
5. Click Create App
|
||||||
This will provide you with your Client ID and Client Secret
|
This will provide you with your Client ID and Client Secret
|
||||||
|
|
||||||
* Click Create Bot User
|
6. Click Create Bot User
|
||||||
This will provide you with your bot Username and Token
|
This will provide you with your bot Username and Token
|
||||||
|
|
||||||
* Fill in the bot token in `config/config.yaml`
|
7. Fill in the bot token in `config/config.yaml`
|
||||||
|
|
||||||
5. Get your plex token:
|
5. Get your plex token:
|
||||||
|
|
||||||
@ -95,24 +94,24 @@ plex:
|
|||||||
|
|
||||||
7. Start the service:
|
7. Start the service:
|
||||||
|
|
||||||
```
|
```bash
|
||||||
$ docker-compose up -d
|
docker-compose up -d
|
||||||
```
|
```
|
||||||
|
|
||||||
## Logs
|
## Logs
|
||||||
|
|
||||||
You can view the logs with the following command
|
You can view the logs with the following command
|
||||||
|
|
||||||
```
|
```bash
|
||||||
$ docker-compose logs -f CONTAINER_NAME_OR_ID
|
docker-compose logs -f CONTAINER_NAME_OR_ID
|
||||||
|
|
||||||
# For example
|
# For example
|
||||||
$ docker-compose logs -f PlexBot
|
docker-compose logs -f PlexBot
|
||||||
```
|
```
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
```
|
```text
|
||||||
General:
|
General:
|
||||||
kill - Stop the bot.
|
kill - Stop the bot.
|
||||||
Plex:
|
Plex:
|
||||||
@ -129,11 +128,4 @@ Type ?help command for more info on a command.
|
|||||||
You can also type ?help category for more info on a category.
|
You can also type ?help category for more info on a category.
|
||||||
```
|
```
|
||||||
|
|
||||||
## Support
|
|
||||||
|
|
||||||
Reach out to me at one of the following places!
|
|
||||||
|
|
||||||
- Email (Best) at joshua.gf.arul@gmail.com
|
|
||||||
- Twitter at <a href="http://twitter.com/jarulsamy_" target="_blank">`@jarulsamy_`</a>
|
|
||||||
|
|
||||||
* * *
|
* * *
|
||||||
|
@ -1,8 +0,0 @@
|
|||||||
import os
|
|
||||||
import sys
|
|
||||||
|
|
||||||
sys.path.append("PlexBot")
|
|
||||||
|
|
||||||
from __version__ import VERSION
|
|
||||||
|
|
||||||
sys.exit(os.system(f"docker build -t jarulsamy/plex-bot:{VERSION} ."))
|
|
14
deploy/build.sh
Executable file
14
deploy/build.sh
Executable file
@ -0,0 +1,14 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
VERSION=$(python PlexBot/__version__.py)
|
||||||
|
|
||||||
|
docker build -t "jarulsamy/plex-bot:$VERSION" .
|
||||||
|
|
||||||
|
if [ $? -eq 0 ]
|
||||||
|
then
|
||||||
|
echo "Successfully build docker image."
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
echo "Failed to build docker image." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
@ -1,8 +0,0 @@
|
|||||||
import os
|
|
||||||
import sys
|
|
||||||
|
|
||||||
sys.path.append("PlexBot")
|
|
||||||
|
|
||||||
from __version__ import VERSION
|
|
||||||
|
|
||||||
sys.exit(os.system(f"docker push jarulsamy/plex-bot:{VERSION}"))
|
|
14
deploy/push.sh
Executable file
14
deploy/push.sh
Executable file
@ -0,0 +1,14 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
VERSION=$(python PlexBot/__version__.py)
|
||||||
|
|
||||||
|
docker push "jarulsamy/plex-bot:$VERSION"
|
||||||
|
|
||||||
|
if [ $? -eq 0 ]
|
||||||
|
then
|
||||||
|
echo "Successfully pushed docker image."
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
echo "Failed to push docker image." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
Loading…
Reference in New Issue
Block a user