β¨ Welcome to the Alfred Plex repository: An Alfred Workflow β¨
- MacOS.
- Alfred 5. Note that the Alfred Powerpack is required to use workflows.
- An access to a plex media server.
- Requires python 3.8 or above.
- Download the workflow.
- Double click the
.alfredworkflow
file to install.
This workflow uses the Python-PlexAPI but doesn't cover all capabilities of this tool. If you see a good feature from the Python-PlexAPI that can be incorporated in this workflow, please let me know by opening an issue or sending a pull request.
Install Python 3.8 or above. Check your version with:
python --version
Launch the menu with plex
. You can edit this trigger in the Workflow Configuration panel.
The workflow is divided in 6 parts :
- Search medias throughout your servers.
- Search medias using discover.
- Manage your plex accounts.
- Manage servers and perform actions.
- Manage presets to rapidly search medias.
- Workflow configuration + filter & sort options.
To use this workflow, you need to add server(s).In order to do so, you must connect to an account that have access to a plex media server with your credentials. If you're not the owner of the server, you won't have access to the server settings.
Go to the Plex Account
section to know more on how to manage your accounts.
In this mode, you search medias on your servers directly by typing your request. You can optionally add a /
followed by one of the following media types: track, album, artist, collection, actor, director, genre, movie, photo, photoalbum, playlist, show, episode, clip.
Link to the Python-PlexAPI documentation.
In this mode, you search medias on your library sections. To enter this mode, you can use filters
and/or advanced filters
.
To know how to use them, go to the section : Plex Help
.
Link to the Python-PlexAPI documentation.
The following example libtype=movie/decade=1980/country=france
returns movies
released between 1980
and 1990
in the country France
.
The following actions can be configured in the user configuration panel
- Nested search. Press β on one of the following media types: actor, director, collection, artist, album, genre, show, season, to trigger a nested search.
- Open the media on the web. Simply press ββ to open the media on plex. Not available for genre media type.
- Stream the media with VLC / IINA. This is only available for the following media types: movie, episode, clip, track, album. Press β₯β to open the media in VLC / IINA. It requires VLC 3.0+ or IINA 1.0.0+ and the corresponding cli. See below to know how to install the cli. If you have multiple versions of the same movie, episode, clip, you'll be asked to choose the file you want to play.
- Get infos of movies and tv shows using the Movie and TV Show Search Alfred workflow by Tom McKnight. Press ββ to trigger the workflow. It requires Movie and TV Show Search Alfred workflow 2.16.0 or above. Only available for movie, show media types.
- Add or remove the media from your plex watchlist. This is only available for the following media types: movie, show. Press β§β to add or remove the media.
If you don't have VLC / IINA on your mac, run the following command to install it via homebrew:
brew install --cask vlc
brew install --cask iina
If you already have VLC / IINA installed check the presence of the cli with:
which vlc
which iina
If it is not found, uninstall VLC / IINA and reinstall it using homebrew.
Link to the VLC homebrew formulae. Link to the IINA homebrew formulae.
Search medias and people on Plex Discover. You can perform the same actions ** listed above.
** Except streaming with VLC / IINA. Note that nested search allows you to search media title within your servers.
Connect one or more accounts to add plex media servers. Use one of the following methods to connect to your plex account :
- Use your plex credentials (username + password + OTP if you enabled 2FA).
- Use a plex account token. This can be useful if you use a third party application to sign in to plex. In order to get your account auth token, you'll need to :
- Go to https://app.plex.tv/desktop/#!/settings/account.
- Open the browser developper tool with ββ₯I.
- Inspect a request with https://clients.plex.tv/ as base url.
- Copy the
X-Plex-Token
and insert in the workflow.
In this section you can :
- See the list of your servers. Servers that aren't added to the workflow are greyed out.
- Manage connected users.
- Manage connected devices.
- Manage your watchlist.
Removing a plex account will remove all the servers connected. You can also remove a server directly in the Plex Media Servers section.
When connected to the workflow, you'll be able to see the device under the Authorized Devices
section. Follow this documentation to know more. Note that when using an authentication token, you'll use the web session from which you obtained the token.
Select the server to view its informations and perform actions.
- Download last version of plex media server from the web.
- Backup logs and databases.
- Display connected account.
- Manage running sessions.
- Perform actions on library sections:
- Scan library sections (search for new medias).
- Refresh library sections (download fresh media info from the internet).
- Display history.
- Display library sections sizes.
- Display and modify settings of the server.
- Display real time server statistics.
New values for settings must match the setting type and must be valid python. For example, boolean must be True or False with capital letter and string must be quoted.
Create easily preset by pressing β on Add a new Preset
. Input a value
for the preset WITH FULL FILTERS NAMES. Then input a title
and a subtitle
separated by a /
.
Simply press ββ to enter in the modified mode. Press β to edit the title/subtitle
or the value
.
Simply press β on a preset to apply its value to the search workflow.
You can manage workflow cache, data and edit filter alias.
Filters, fields and sorts options are generated based on your libraries metadata. This will vary regarding your medias and agents used to gather information.
Filters can be aliased, see section
4. Alias
below
Plex filters can be applied by typing filterName=value
. Use /
to separate them. Find the list of filters under each library sections of your servers.
Example: libtype=movie/actor=adam driver
. It returns movies
with Adam Driver
.
Plex fields (or advanced filters) can be applied by typing advancedFilters={<FILTER>}
(or af={<FILTER>}
in alias mode
). There is certain conditions you have to respect to make advance filters working:
- Use
/
to separate advanced filter from other filters. - You must use them along with a
libtype
. - You must provide a valid Python dict or valid JSON syntax. Double quotes
"
and single quotes'
are valid.
To know more on how to use these filters, check the Python-PlexAPI documentation.
Find the list of fields under each library sections of your servers.
Example: libtype=episode/advancedFilters={'show.title': 'one piece', 'episode.index': '1074'}
. It returns episodes
where episode number
is 1074
and the title of the show contains one piece
.
You can sort results by typing sort=sortName:dir
(or so=sortName:dir
in alias mode
). Direction can be :asc
for ascending or :desc
for descending.
Example: libtype=movie/sort=originallyAvailableAt:desc
. This will display movies
from the most recent
to the older
one.
Alias are enabled by default, and allows you, when activated, to write filters more easily. libtype
becomes lt
, studio
becomes st
...
You can disable this behavior in the user control panel by unticking the π Use alias
parameter.
Alias file can be edited, but be careful about double values. It is the alias.json
file located under the π Data folder
(~/Library/Application Support/Alfred/Workflow Data/com.benjamino.plex
by default).
Example: af={'addedAt>>': '30d'}/lt=show
. It returns shows
added or shows
containing new elements (seasons, epidodes) in plex during the last 30 days
.
MIT License Β© Benjamin Oddou