mirror of
https://github.com/jarulsamy/Plex-Bot.git
synced 2024-08-19 15:01:55 +02:00
Compare commits
10 Commits
Author | SHA1 | Date | |
---|---|---|---|
7f49c4d958 | |||
ed1a64cb52 | |||
7471da85f7 | |||
4633247004 | |||
98a36c6cbc | |||
b7ab589f6e | |||
4aadd886d5 | |||
33bbf21bab | |||
253f2a9a82 | |||
af91883635 |
@ -14,7 +14,7 @@ WORKDIR /src
|
||||
COPY requirements.txt .
|
||||
|
||||
# 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/ PlexBot
|
||||
|
17
Jenkinsfile
vendored
17
Jenkinsfile
vendored
@ -49,18 +49,19 @@ pipeline {
|
||||
steps {
|
||||
sh ''' source /var/lib/jenkins/miniconda3/etc/profile.d/conda.sh
|
||||
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.
|
||||
|
||||
Do not import this module, it is intended to be
|
||||
used exclusively within a docker environment.
|
||||
"""
|
||||
Plex music bot for discord.
|
||||
|
||||
Do not import this module, it is intended to be
|
||||
used exclusively within a docker environment.
|
||||
"""
|
||||
import logging
|
||||
import sys
|
||||
|
@ -1,7 +1,6 @@
|
||||
"""Main entrypoint for bot
|
||||
|
||||
Sets up loggers and initiates bot.
|
||||
|
||||
"""
|
||||
Main entrypoint script.
|
||||
Sets up loggers and initiates bot.
|
||||
"""
|
||||
import logging
|
||||
|
||||
|
@ -1,2 +1,5 @@
|
||||
"""Track version number of package"""
|
||||
VERSION = "0.0.6"
|
||||
"""Track version number of package."""
|
||||
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 io
|
||||
import logging
|
||||
|
104
README.md
104
README.md
@ -1,28 +1,70 @@
|
||||
# Plex-Bot
|
||||
|
||||
[](http://perso.crans.org/besson/LICENSE.html)
|
||||

|
||||

|
||||

|
||||
|
||||
A Python-based Plex music bot for discord.
|
||||
|
||||

|
||||
|
||||
## Setup
|
||||
|
||||
Plex-Bot runs entirely in a Docker container. Ensure you have Docker and docker-compose installed according to the official Docker [documentation](https://docs.docker.com/get-docker/).
|
||||
|
||||
1. Clone the repository and `cd` into it:
|
||||
1. Create a new folder and `cd` into it:
|
||||
|
||||
```
|
||||
$ git clone https://github.com/jarulsamy/Plex-Bot
|
||||
$ cd Plex-Bot
|
||||
```
|
||||
```bash
|
||||
mkdir Plex-Bot
|
||||
cd Plex-Bot
|
||||
```
|
||||
|
||||
2. Create a configuration folder:
|
||||
2. Make a `docker-compose.yml` file or use this sample:
|
||||
|
||||
Create a new `config` folder and copy the sample config file into it:
|
||||
```yml
|
||||
version: "3"
|
||||
services:
|
||||
plex-bot:
|
||||
container_name: "PlexBot"
|
||||
image: jarulsamy/plex-bot:latest
|
||||
environment:
|
||||
- PUID=1000
|
||||
- PGID=1000
|
||||
- TZ=America/Denver
|
||||
# Required dir for configuration files
|
||||
volumes:
|
||||
- "./config:/config:ro"
|
||||
restart: "unless-stopped"
|
||||
```
|
||||
|
||||
```
|
||||
$ mkdir config
|
||||
$ cp sample-config.yaml config/config.yaml
|
||||
```
|
||||
3. Create a new `config` folder and create a config file like this::
|
||||
|
||||
3. Create a Discord bot application:
|
||||
```bash
|
||||
mkdir config
|
||||
cd config
|
||||
touch config.yaml
|
||||
```
|
||||
|
||||
```yml
|
||||
# Create a file called config.yaml with the following contents
|
||||
|
||||
root:
|
||||
log_level: "info"
|
||||
|
||||
discord:
|
||||
prefix: "?"
|
||||
token: "<BOT_TOKEN>"
|
||||
log_level: "debug"
|
||||
|
||||
plex:
|
||||
base_url: "<BASE_URL>"
|
||||
token: "<PLEX_TOKEN>"
|
||||
library_name: "<LIBRARY_NAME>"
|
||||
log_level: "debug"
|
||||
```
|
||||
|
||||
4. Create a Discord bot application:
|
||||
|
||||
1. Go to the Discord developer portal, [here](https://discord.com/developers/applications).
|
||||
|
||||
@ -38,23 +80,38 @@ $ cp sample-config.yaml config/config.yaml
|
||||
6. Click Create Bot User
|
||||
This will provide you with your bot Username and Token
|
||||
|
||||
7. Fill in all the necessary numbers in `config/config.yaml`
|
||||
7. Fill in the bot token in `config/config.yaml`
|
||||
|
||||
4. Get your plex token:
|
||||
5. Get your plex token:
|
||||
|
||||
Refer to the official [plex documentation](https://support.plex.tv/articles/204059436-finding-an-authentication-token-x-plex-token/).
|
||||
* Refer to the official [plex documentation](https://support.plex.tv/articles/204059436-finding-an-authentication-token-x-plex-token/).
|
||||
|
||||
Add it to `config/config.yaml` in the appropiate spot.
|
||||
* Add it to `config/config.yaml` in the appropiate spot.
|
||||
|
||||
5. Start the service:
|
||||
6. Customize remaining settings
|
||||
|
||||
```
|
||||
$ docker-compose up --build
|
||||
Set any remaining settings in the config file that you would like. Such as music library, and base url of the Plex server.
|
||||
|
||||
7. Start the service:
|
||||
|
||||
```bash
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
## Logs
|
||||
|
||||
You can view the logs with the following command
|
||||
|
||||
```bash
|
||||
docker-compose logs -f CONTAINER_NAME_OR_ID
|
||||
|
||||
# For example
|
||||
docker-compose logs -f PlexBot
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```
|
||||
```text
|
||||
General:
|
||||
kill - Stop the bot.
|
||||
Plex:
|
||||
@ -71,11 +128,4 @@ Type ?help command for more info on a command.
|
||||
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>
|
||||
|
||||
* * *
|
||||
|
BIN
assets/screenshot.png
Normal file
BIN
assets/screenshot.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
@ -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
|
@ -2,7 +2,7 @@ version: "3"
|
||||
services:
|
||||
plex-bot:
|
||||
container_name: "PlexBot"
|
||||
build: .
|
||||
image: jarulsamy/plex-bot:latest
|
||||
environment:
|
||||
- PUID=1000
|
||||
- PGID=1000
|
||||
@ -10,4 +10,4 @@ services:
|
||||
# Required dir for configuration files
|
||||
volumes:
|
||||
- "./config:/config:ro"
|
||||
restart: "no"
|
||||
restart: "unless-stopped"
|
||||
|
Reference in New Issue
Block a user