Skip to content

Commit

Permalink
Change directories to lowercase
Browse files Browse the repository at this point in the history
  • Loading branch information
reconman committed Apr 11, 2023
1 parent 7c49910 commit c0e0f2e
Show file tree
Hide file tree
Showing 28 changed files with 59 additions and 79 deletions.
4 changes: 2 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
logo.png
Examples
Scripts
examples
venv
.venv
.github
6 changes: 3 additions & 3 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ jobs:
- name: Lint with flake8 and pylint
run: |
poetry run flake8 .
poetry run pylint sync.py TautulliSyncHelper.py ./plexanisync || poetry run pylint-exit --error-fail --warn-fail $?
poetry run pylint ./scripts/*.py ./plexanisync || poetry run pylint-exit --error-fail --warn-fail $?
- run: poetry run pytest

build-docker-plexanisync:
needs: lint-and-test
uses: ./.github/workflows/build-docker-image.yml
with:
dockerfile: ./Docker/PlexAniSync/Dockerfile
dockerfile: ./docker/PlexAniSync/Dockerfile
imagename: ${{ github.repository_owner }}/plexanisync
eventname: ${{ github.event_name }}
platforms: linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64
Expand All @@ -59,7 +59,7 @@ jobs:
needs: build-docker-plexanisync
uses: ./.github/workflows/build-docker-image.yml
with:
dockerfile: ./Docker/Tautulli/Dockerfile
dockerfile: ./docker/Tautulli/Dockerfile
imagename: ${{ github.repository_owner }}/tautulli-plexanisync
eventname: ${{ github.event_name }}
platforms: linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64
Expand Down
23 changes: 0 additions & 23 deletions Docker/PlexAniSync/run/settingsupdater.py

This file was deleted.

16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ https://github.com/RickDB/PlexAniSync/archive/master.zip

### Step 3 - Configuration

From the project directory rename `settings.ini.example` to `settings.ini`, open `settings.ini` with your favorite text editor and edit where needed.
In the `data` directory copy `settings.ini.example` to `settings.ini`, open `settings.ini` with your favorite text editor and edit where needed.


#### Plex
Expand Down Expand Up @@ -141,7 +141,7 @@ Install the addtional requirements using the Python package installer (pip) from

Now that configuration is finished and requirements have been installed we can finally start the sync script:

`python PlexAniSync.py`
`python scripts/PlexAniSync.py`

Depending on library size and server can take a few minutes to finish, for scheduled syncing you can create a cronjob, systemd timer or windows task which runs it every 30 minutes for instance.

Expand All @@ -153,7 +153,7 @@ See [Systemd service](https://github.com/RickDB/PlexAniSync/wiki/Systemd-service

You can manually link a Plex title and season to an AniList ID, to do so:

- From the project folder copy `custom_mappings.yaml.example` to `custom_mappings.yaml`
- In the `data` directory, copy `custom_mappings.yaml.example` to `custom_mappings.yaml`
- Add new entries there in the following format:

```yaml
Expand Down Expand Up @@ -199,11 +199,11 @@ The feature of synonyms was introduced for the community mappings where you can

If you want to load a different settings.in file you can do so by supplying it in the first argument like so:

`python PlexAniSync.py settings_alternate.ini`
`python scripts/PlexAniSync.py data/settings_alternate.ini`

In case of the Tautulli sync helper script you can do as well, first argument will then be settings filename and second will be the series name like so:

`python TautulliSyncHelper.py settings_alternate.ini <plex show name>`
`python scripts/TautulliSyncHelper.py data/settings_alternate.ini <plex show name>`

### Make Plex watched episode count take priority

Expand Down Expand Up @@ -247,7 +247,7 @@ In the project folder you will find `TautulliSyncHelper.py` which you can use to

Usage is as follows:

`python TautulliSyncHelper.py <plex show name>`
`python scripts/TautulliSyncHelper.py <plex show name>`

Depending on your OS make sure to place the show name between single or double quotes, for more information see the wiki page:

Expand All @@ -258,11 +258,11 @@ https://github.com/RickDB/PlexAniSync/wiki/Tautulli-sync-script
PlexAniSync is available as Docker image.

[PlexAniSync](https://github.com/RickDB/PlexAniSync/pkgs/container/plexanisync)<br/>
[Documentation](Docker/PlexAniSync/README.md)
[Documentation](docker/PlexAniSync/README.md)

Another docker container for Tautulli with built-in PlexAniSync can be found here:<br/>
[Tautulli-PlexAniSync](https://github.com/RickDB/PlexAniSync/pkgs/container/tautulli-plexanisync)<br/>
[Documentation](Docker/Tautulli/README.md)
[Documentation](docker/Tautulli/README.md)

## Requirements

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ ENV PLEX_SECTION=Anime \
ANI_TOKEN='' \
INTERVAL=3600

COPY requirements.txt Docker/PlexAniSync/run/. /plexanisync/
COPY Data /plexanisync/Data
COPY Scripts /plexanisync/Scripts
COPY requirements.txt docker/PlexAniSync/run/. /plexanisync/
COPY data /plexanisync/data
COPY scripts /plexanisync/scripts
COPY plexanisync /plexanisync/plexanisync

LABEL org.opencontainers.image.documentation=https://github.com/RickDB/PlexAniSync/blob/master/Docker/PlexAniSync/README.md
LABEL org.opencontainers.image.documentation=https://github.com/RickDB/PlexAniSync/blob/master/docker/PlexAniSync/README.md

CMD ["/plexanisync/runsync.sh"]
4 changes: 2 additions & 2 deletions Docker/PlexAniSync/README.md → docker/PlexAniSync/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ docker run -d \
-e ANI_TOKEN=SomeToken \
-e INTERVAL=3600 \
-v /etc/localtime:/etc/localtime:ro \
-v /path/to/your/custom_mappings.yaml:/plexanisync/custom_mappings.yaml \
-v /path/to/your/custom_mappings.yaml:/plexanisync/data/custom_mappings.yaml \
ghcr.io/rickdb/plexanisync:latest
```

Expand All @@ -37,7 +37,7 @@ services:
- INTERVAL=3600
volumes:
- '/etc/localtime:/etc/localtime:ro'
- '/path/to/your/custom_mappings.yaml:/plexanisync/custom_mappings.yaml'
- '/path/to/your/custom_mappings.yaml:/plexanisync/data/custom_mappings.yaml'
```
### Environment Variables
Expand Down
4 changes: 2 additions & 2 deletions Docker/PlexAniSync/run/runsync.sh → docker/PlexAniSync/run/runsync.sh
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
run() {
while true
do
(cd /plexanisync && python Scripts/PlexAniSync.py)
(cd /plexanisync && python scriptsPlexAniSync.py)
sleep ${INTERVAL}
done
}
Expand All @@ -13,7 +13,7 @@ run() {

if [[ -z ${SETTINGS_FILE} ]]; then
echo "Updating settings.ini"
python /plexanisync/settingsupdater.py
python /plexanisync/scripts/settingsupdater.py
run
else
echo "Using custom config: "${SETTINGS_FILE}
Expand Down
3 changes: 2 additions & 1 deletion Docker/PlexAniSync/run/update.sh → docker/PlexAniSync/run/update.sh
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ echo "Updating PlexAniSync"
wget https://github.com/RickDB/PlexAniSync/archive/master.zip &&\
unzip master.zip &&\
rm master.zip &&\
cp -f /PlexAniSync-master/*.py /plexanisync
cp -rf /PlexAniSync-master/plexanisync /plexanisync/plexanisync
cp -rf /PlexAniSync-master/scripts /plexanisync/scripts
cp -rf /PlexAniSync-master/data /plexanisync/data
cp -f /PlexAniSync-master/requirements.txt /plexanisync/requirements.txt
rm -rf /PlexAniSync-master
cd /plexanisync &&\
Expand Down
8 changes: 5 additions & 3 deletions Docker/Tautulli/Dockerfile → docker/Tautulli/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,14 @@ ENV PLEX_SECTION=Anime \
ANI_TOKEN=''

# copy code itself from context to image
COPY Docker/Tautulli/run/start.sh /app/
COPY TautulliSyncHelper.py custom_mappings_schema.json Docker/Tautulli/run/settingsupdater.py /plexanisync/
COPY docker/Tautulli/run/start.sh /app/
COPY data /plexanisync/data
COPY scripts /plexanisync/scripts
COPY plexanisync /plexanisync/plexanisync
COPY plexanisync /plexanisync/plexanisync

# reset workdir to default one from tautulli
WORKDIR /app

LABEL autoheal=true
LABEL org.opencontainers.image.documentation=https://github.com/RickDB/PlexAniSync/blob/master/Docker/Tautulli/README.md
LABEL org.opencontainers.image.documentation=https://github.com/RickDB/PlexAniSync/blob/master/docker/Tautulli/README.md
6 changes: 3 additions & 3 deletions Docker/Tautulli/README.md → docker/Tautulli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ docker run -d \
-e ANI_TOKEN=<anilist-token> \
-p 8181:8181 \
-v <path to tautulli data directory>:/config \
-v <path to custom_mappings.yaml>:/plexanisync/custom_mappings.yaml \
-v <path to custom_mappings.yaml>:/plexanisync/data/custom_mappings.yaml \
--restart unless-stopped \
ghcr.io/rickdb/tautulli-plexanisync
```
Expand All @@ -40,7 +40,7 @@ services:
- ANI_TOKEN=SomeToken
volumes:
- '/path/to/tautulli-data-directory:/config'
- '/path/to/your/custom_mappings.yaml:/plexanisync/custom_mappings.yaml'
- '/path/to/your/custom_mappings.yaml:/plexanisync/data/custom_mappings.yaml'

ports:
- '8181:8181'
Expand All @@ -53,7 +53,7 @@ Since this is a combination of docker images, environment variables of both imag
See:
- [Tautulli](https://github.com/Tautulli/Tautulli-Wiki/wiki/Installation#docker)
- [PlexAniSync](https://github.com/RickDB/PlexAniSync/Docker/PlexAniSync/README.md#environment-variables)
- [PlexAniSync](https://github.com/RickDB/PlexAniSync/docker/PlexAniSync/README.md#environment-variables)
### Configure Tautulli to use PlexAniSync
Expand Down
2 changes: 1 addition & 1 deletion Docker/Tautulli/run/start.sh → docker/Tautulli/run/start.sh
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ chown -R tautulli:tautulli /plexanisync

if [[ -z "${SETTINGS_FILE}" ]]; then
echo "Updating settings.ini"
gosu tautulli "python" "/plexanisync/settingsupdater.py"
gosu tautulli "python" "/plexanisync/scripts/settingsupdater.py"
else
echo "Using custom config: "${SETTINGS_FILE}
fi
Expand Down
4 changes: 2 additions & 2 deletions plexanisync/custom_mappings.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from plexanisync.logger_adapter import PrefixLoggerAdapter

logger = PrefixLoggerAdapter(logging.getLogger("PlexAniSync"), {"prefix": "MAPPING"})
MAPPING_FILE = "Data/custom_mappings.yaml"
MAPPING_FILE = "data/custom_mappings.yaml"


@dataclass
Expand Down Expand Up @@ -84,7 +84,7 @@ def read_custom_mappings() -> Dict[str, List[AnilistCustomMapping]]:

yaml = YAML(typ='safe')
yaml.Constructor = MyConstructor
with open('Data/custom_mappings_schema.json', 'r', encoding='utf-8') as f:
with open('data/custom_mappings_schema.json', 'r', encoding='utf-8') as f:
schema = json.load(f)

# Create a Data object
Expand Down
2 changes: 1 addition & 1 deletion Scripts/PlexAniSync.py → scripts/PlexAniSync.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def read_settings(settings_file) -> configparser.ConfigParser:
return settings


SETTINGS_FILE = os.getenv("SETTINGS_FILE") or "Data/settings.ini"
SETTINGS_FILE = os.getenv("SETTINGS_FILE") or "data/settings.ini"

if len(sys.argv) > 1:
SETTINGS_FILE = sys.argv[1]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ param(
# these are set from Tautulli and cause a crash if not unset
Remove-Item Env:PYTHONPATH, Env:PYTHONHOME 2>&1 | Out-Null

poetry run TautulliSyncHelper.py $Args
python TautulliSyncHelper.py $Args
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def read_settings(settings_file) -> configparser.ConfigParser:
return settings


SETTINGS_FILE = os.getenv("SETTINGS_FILE") or "Data/settings.ini"
SETTINGS_FILE = os.getenv("SETTINGS_FILE") or "data/settings.ini"

if len(sys.argv) < 2:
logger.error("No show title specified in arguments so cancelling updating")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[Unit]
Description=One-shot execution of Plex to Anilist tracking sync

[Service]
Type=oneshot
User=YOUR_USER
Group=YOUR_USER
WorkingDirectory=YOUR_PLEXANYSYNC_FOLDER_PATH
ExecStart=$POETRY_HOME/bin/poetry python /YOUR_PLEXANYSYNC_FOLDER_PATH/sync.py
RemainAfterExit=no

[Install]
WantedBy=multi-user.target
[Unit]
Description=One-shot execution of Plex to Anilist tracking sync

[Service]
Type=oneshot
User=YOUR_USER
Group=YOUR_USER
WorkingDirectory=YOUR_PLEXANYSYNC_FOLDER_PATH
ExecStart=/usr/bin/python3 /YOUR_PLEXANYSYNC_FOLDER_PATH/scripts/PlexAniSync.py
RemainAfterExit=no

[Install]
WantedBy=multi-user.target
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[Unit]
Description=Execution timer for Plex Anilist Sync service
[Timer]
OnCalendar=*:0/15 #(This is every 15 minutes, but you can also put in "daily" for example)
[Install]
WantedBy=timers.target
[Unit]
Description=Execution timer for Plex Anilist Sync service

[Timer]
OnCalendar=*:0/15 #(This is every 15 minutes, but you can also put in "daily" for example)

[Install]
WantedBy=timers.target
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@
'sync_ratings': os.environ.get('SYNC_RATINGS') or False
}

with open('/plexanisync/Data/settings.ini', 'w', encoding="UTF-8") as configfile:
with open('/plexanisync/data/settings.ini', 'w', encoding="UTF-8") as configfile:
config.write(configfile)

0 comments on commit c0e0f2e

Please sign in to comment.