-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
1,628 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: Publish Docker image | ||
|
||
on: | ||
release: | ||
types: | ||
- created | ||
|
||
jobs: | ||
publish_to_docker_hub: | ||
name: Publish Docker image to Docker Hub | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v3 | ||
|
||
- name: Log in to Docker Hub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: ratoaq2/plexy | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: Publish | ||
|
||
on: | ||
release: | ||
types: | ||
- created | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup python | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: 3.11 | ||
|
||
- name: Install poetry | ||
uses: snok/[email protected] | ||
with: | ||
virtualenvs-in-project: true | ||
|
||
- name: Load cached venv | ||
id: cached-poetry-dependencies | ||
uses: actions/cache@v3 | ||
with: | ||
path: .venv | ||
key: venv-${{ runner.os }}-${{ hashFiles('pyproject.toml') }} | ||
|
||
- name: Install dependencies | ||
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | ||
run: poetry install --no-interaction --no-root | ||
|
||
- name: Install library | ||
run: poetry install --no-interaction | ||
|
||
- name: Publish | ||
env: | ||
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN }} | ||
run: poetry publish --build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: Test | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: [3.8, 3.9, '3.10', 3.11] | ||
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup python | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install poetry | ||
uses: snok/[email protected] | ||
with: | ||
virtualenvs-in-project: true | ||
|
||
- name: Load cached venv | ||
id: cached-poetry-dependencies | ||
uses: actions/cache@v3 | ||
with: | ||
path: .venv | ||
key: venv-${{ runner.os }}-${{ hashFiles('pyproject.toml') }} | ||
|
||
- name: Install dependencies | ||
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | ||
run: poetry install --no-interaction --no-root | ||
|
||
- name: Install library | ||
run: poetry install --no-interaction | ||
|
||
- name: Run tests | ||
run: | | ||
source .venv/bin/activate | ||
bash scripts/test.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -127,3 +127,6 @@ dmypy.json | |
|
||
# Pyre type checker | ||
.pyre/ | ||
|
||
# PyCharm | ||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
# Plexy | ||
Your Plex, your way | ||
|
||
[![Latest | ||
Version](https://img.shields.io/pypi/v/plexy.svg)](https://pypi.python.org/pypi/plexy) | ||
|
||
[![tests](https://github.com/ratoaq2/plexy/actions/workflows/test.yml/badge.svg)](https://github.com/ratoaq2/plexy/actions/workflows/test.yml) | ||
|
||
[![License](https://img.shields.io/github/license/ratoaq2/plexy.svg)](https://github.com/ratoaq2/plexy/blob/master/LICENSE) | ||
|
||
- Project page | ||
<https://github.com/ratoaq2/plexy> | ||
|
||
## Info | ||
|
||
**Plexy** is a command line tool to save your watching preferences in Plex. | ||
|
||
**Dubbed** or **Original audio**, it's up to you. | ||
|
||
- For **Dubbed** preference, Plexy will auto-select the audio track with your desired language. | ||
If no audio track is found, Plexy will auto-select the subtitle track with your desired language. | ||
- For **Original** preference, Plexy will auto-select the default/original audio track | ||
and the subtitle track in your desired language. | ||
|
||
Priorities: | ||
- Commentary audio tracks have lower priority when selecting audio tracks | ||
- Closed caption and SDH subtitle tracks also have lower priority when selecting subtitles | ||
|
||
|
||
To select Brazilian Portuguese language with original audio | ||
```bash | ||
>> plexy --url http://mylocalplex:32400 --token ABCDEF1234567890 preferences --language pt-BR original | ||
``` | ||
|
||
To select English language with dubbed audio | ||
```bash | ||
>> plexy --url http://mylocalplex:32400 --token ABCDEF1234567890 preferences --language en dubbed | ||
``` | ||
|
||
To select French language with original audio only for Game of Thrones | ||
```bash | ||
>> plexy --url http://mylocalplex:32400 --token ABCDEF1234567890 preferences --language fr --title "Game of Thrones" original | ||
``` | ||
|
||
To select German language with dubbed audio only for Mandalorian Season 2 | ||
```bash | ||
>> plexy --url http://mylocalplex:32400 --token ABCDEF1234567890 preferences --language fr --title "Mandalorian s02" dubbed | ||
``` | ||
|
||
To select German language with dubbed audio only for Game of Thrones, season 3 and episode 9 | ||
```bash | ||
>> plexy --url http://mylocalplex:32400 --token ABCDEF1234567890 preferences --language fr --title "Game of Thrones s03e09" dubbed | ||
``` | ||
|
||
To select Spanish language with dubbed audio only for all Matrix movies and the first Avatar movie | ||
```bash | ||
>> plexy --url http://mylocalplex:32400 --token ABCDEF1234567890 preferences --language es --title "Matrix" --title "Avatar (2009)" dubbed | ||
``` | ||
|
||
To select Portuguese language with original audio for everything added to your libraries in the last week | ||
```bash | ||
>> plexy --url http://mylocalplex:32400 --token ABCDEF1234567890 preferences --language pt --newer 1w original | ||
``` | ||
|
||
To select Brazilian Portuguese language with original audio for everything added to your "Movie" library before the last week | ||
```bash | ||
>> plexy --url http://mylocalplex:32400 --token ABCDEF1234567890 preferences --library Movie --language pt-BR --older 1w original | ||
``` | ||
|
||
You can also select or exclude tracks based on their codec/format. | ||
For instance, you have a Chromecast with Google TV which doesn't support Dolby TrueHD audio codec. | ||
You can exclude this codec when saving your preferences: | ||
```bash | ||
>> plexy --url http://mylocalplex:32400 --token ABCDEF1234567890 preferences --language pt-BR -A truehd original | ||
``` | ||
|
||
|
||
All available CLI options: | ||
```bash | ||
>> plexy --url <PLEX_URL> --token <USER_TOKEN> preferences --help | ||
Usage: plexy preferences [OPTIONS] {original|dubbed} | ||
|
||
Your watching preferences | ||
|
||
Dubbed prefers an audio track with the desired language. | ||
Original prefers the original audio and an additional subtitle track if the audio is not in the desired language. | ||
|
||
Options: | ||
-L, --library TEXT Library to be used. e.g: Movies, Shows | ||
-t, --title TITLE Filter for titles in your library. It could refer to a movie, a | ||
show, a season or an episode. e.g: Avatar, The Matrix (1999), | ||
The Boys s2, Chernobyl s01e03, Game of Thrones (2011) s03e09 | ||
-l, --language LANGUAGE Desired watching language as IETF code, e.g.: en, pt-BR | ||
-a, --audio-codec [dca|aac|ac3|eac3|truehd|flac|mp2|mp3|vorbis|pcm] | ||
Accepted audio codec | ||
-A, --excluded-audio-codec [dca|aac|ac3|eac3|truehd|flac|mp2|mp3|vorbis|pcm] | ||
Excluded audio codec | ||
-s, --subtitle-codec [srt|pgs|vobsub|ass|mov_text|eia_608|dvb_subtitle] | ||
Accepted subtitle codec | ||
-S, --excluded-subtitle-codec [srt|pgs|vobsub|ass|mov_text|eia_608|dvb_subtitle] | ||
Excluded subtitle codec | ||
-n, --newer AGE Filter movies/episodes newer than AGE, e.g. 12h, 1w2d. | ||
-o, --older AGE Filter movies/episodes older than AGE, e.g. 12h, 1w2d. | ||
-f, --full-summary Print the full summary of changed preferences. | ||
--debug Print useful information for debugging and for reporting bugs. | ||
--help Show this message and exit. | ||
``` | ||
## Installation | ||
**Plexy** can be installed as a regular python module by running: | ||
$ [sudo] pip install plexy | ||
For a better isolation with your system you should use a dedicated | ||
virtualenv or install for your user only using the `--user` flag. | ||
## Dependencies | ||
* [Diaoul/babelfish](https://github.com/Diaoul/babelfish) | ||
* [pkkid/python-plexapi](https://github.com/pkkid/python-plexapi) | ||
* [ratoaq2/trakit](https://github.com/ratoaq2/trakit) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from importlib import metadata | ||
|
||
__title__ = metadata.metadata(__package__)['name'] | ||
__version__ = metadata.version(__package__) | ||
__short_version__ = '.'.join(__version__.split('.')[:2]) | ||
__author__ = metadata.metadata(__package__)['author'] | ||
__license__ = metadata.metadata(__package__)['license'] | ||
__url__ = metadata.metadata(__package__)['home_page'] | ||
|
||
del metadata | ||
|
||
from .api import ( | ||
AudioCodec, | ||
Change, | ||
Criteria, | ||
InvalidTitle, | ||
Plex, | ||
Preferences, | ||
Settings, | ||
SubtitleCodec, | ||
Title, | ||
WatchingPreference, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
from plexy.cli import plexy | ||
|
||
if __name__ == '__main__': | ||
plexy() |
Oops, something went wrong.