Skip to content

Commit

Permalink
Add support for emby
Browse files Browse the repository at this point in the history
  • Loading branch information
luigi311 committed Jun 2, 2024
1 parent 5b1933c commit 1f7da2f
Show file tree
Hide file tree
Showing 12 changed files with 1,217 additions and 1,037 deletions.
36 changes: 28 additions & 8 deletions .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ MAX_THREADS = 32
WHITELIST_USERS = "testuser1,testuser2"



# Plex

## Recommended to use token as it is faster to connect as it is direct to the server instead of going through the plex servers
Expand All @@ -77,13 +76,6 @@ PLEX_TOKEN = "SuperSecretToken, SuperSecretToken2"
## Set to True if running into ssl certificate errors
SSL_BYPASS = "False"

## control the direction of syncing. e.g. SYNC_FROM_PLEX_TO_JELLYFIN set to true will cause the updates from plex
## to be updated in jellyfin. SYNC_FROM_PLEX_TO_PLEX set to true will sync updates between multiple plex servers
SYNC_FROM_PLEX_TO_JELLYFIN = "True"
SYNC_FROM_JELLYFIN_TO_PLEX = "True"
SYNC_FROM_PLEX_TO_PLEX = "True"
SYNC_FROM_JELLYFIN_TO_JELLYFIN = "True"


# Jellyfin

Expand All @@ -94,3 +86,31 @@ JELLYFIN_BASEURL = "http://localhost:8096, http://nas:8096"
## Jellyfin api token, created manually by logging in to the jellyfin server admin dashboard and creating an api key
## Comma separated list for multiple servers
JELLYFIN_TOKEN = "SuperSecretToken, SuperSecretToken2"


# Emby

## Emby server URL, use hostname or IP address if the hostname is not resolving correctly
## Comma seperated list for multiple servers
EMBY_BASEURL = "http://localhost:8097"

## Emby api token, created manually by logging in to the Emby server admin dashboard and creating an api key
## Comma seperated list for multiple servers
EMBY_TOKEN = "ed9507cba8d14d469ae4d58e33afc515"


# Syncing Options

## control the direction of syncing. e.g. SYNC_FROM_PLEX_TO_JELLYFIN set to true will cause the updates from plex
## to be updated in jellyfin. SYNC_FROM_PLEX_TO_PLEX set to true will sync updates between multiple plex servers
SYNC_FROM_PLEX_TO_JELLYFIN = "True"
SYNC_FROM_PLEX_TO_PLEX = "True"
SYNC_FROM_PLEX_TO_EMBY = "True"

SYNC_FROM_JELLYFIN_TO_PLEX = "True"
SYNC_FROM_JELLYFIN_TO_JELLYFIN = "True"
SYNC_FROM_JELLYFIN_TO_EMBY = "True"

SYNC_FROM_EMBY_TO_PLEX = "True"
SYNC_FROM_EMBY_TO_JELLYFIN = "True"
SYNC_FROM_EMBY_TO_EMBY = "True"
39 changes: 19 additions & 20 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,43 +40,42 @@ jobs:

- name: "Start containers"
run: |
export PGID=$(id -g)
export PUID=$(id -u)
JellyPlex-Watched-CI/start_containers.sh
sudo chown -R $PUID:$PGID JellyPlex-Watched-CI
docker pull lscr.io/linuxserver/plex &
docker pull lscr.io/linuxserver/jellyfin &
wait
docker-compose -f JellyPlex-Watched-CI/plex/docker-compose.yml up -d
docker-compose -f JellyPlex-Watched-CI/jellyfin/docker-compose.yml up -d
# Wait for containers to start
sleep 10
docker-compose -f JellyPlex-Watched-CI/plex/docker-compose.yml logs
docker-compose -f JellyPlex-Watched-CI/jellyfin/docker-compose.yml logs
for FOLDER in $(find "JellyPlex-Watched-CI" -type f -name "docker-compose.yml" -exec dirname {} \;); do
docker-compose -f "${FOLDER}/docker-compose.yml" logs
done
- name: "Run tests"
run: |
# Test ci1
mv test/ci1.env .env
# Test guids
mv test/ci_guids.env .env
python main.py
# Test ci2
mv test/ci2.env .env
cat mark.log
python test/validate_ci_marklog.py --dry
rm mark.log
# Test locations
mv test/ci_locations.env .env
python main.py
# Test ci3
mv test/ci3.env .env
cat mark.log
python test/validate_ci_marklog.py --dry
rm mark.log
# Test writing to the servers
mv test/ci_write.env .env
python main.py
# Test again to test if it can handle existing data
python main.py
cat mark.log
python test/validate_ci_marklog.py
python test/validate_ci_marklog.py --write
docker:
runs-on: ubuntu-latest
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

[![Codacy Badge](https://app.codacy.com/project/badge/Grade/26b47c5db63942f28f02f207f692dc85)](https://www.codacy.com/gh/luigi311/JellyPlex-Watched/dashboard?utm_source=github.com\&utm_medium=referral\&utm_content=luigi311/JellyPlex-Watched\&utm_campaign=Badge_Grade)

Sync watched between jellyfin and plex locally
Sync watched between jellyfin, plex and emby locally

## Description

Keep in sync all your users watched history between jellyfin and plex servers locally. This uses file names and provider ids to find the correct episode/movie between the two. This is not perfect but it works for most cases. You can use this for as many servers as you want by entering multiple options in the .env plex/jellyfin section separated by commas.
Keep in sync all your users watched history between jellyfin, plex and emby servers locally. This uses file names and provider ids to find the correct episode/movie between the two. This is not perfect but it works for most cases. You can use this for as many servers as you want by entering multiple options in the .env plex/jellyfin section separated by commas.

## Features

Expand All @@ -32,12 +32,12 @@ Keep in sync all your users watched history between jellyfin and plex servers lo

### Emby

* \[ ] Match via filenames
* \[ ] Match via provider ids
* \[ ] Map usernames
* \[ ] Use single login
* \[ ] One way/multi way sync
* \[ ] Sync watched
* \[x] Match via filenames
* \[x] Match via provider ids
* \[x] Map usernames
* \[x] Use single login
* \[x] One way/multi way sync
* \[x] Sync watched
* \[ ] Sync in progress

## Configuration
Expand Down
21 changes: 21 additions & 0 deletions src/emby.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from src.jellyfin_emby import JellyfinEmby


class Emby(JellyfinEmby):
def __init__(self, baseurl, token):
authorization = (
"Emby , "
'Client="JellyPlex-Watched", '
'Device="script", '
'DeviceId="script", '
'Version="0.0.0"'
)
headers = {
"Accept": "application/json",
"X-Emby-Token": token,
"X-Emby-Authorization": authorization,
}

super().__init__(
server_type="Emby", baseurl=baseurl, token=token, headers=headers
)
Loading

0 comments on commit 1f7da2f

Please sign in to comment.