Initial release: n8n Plex Media Server node
CI / build (push) Failing after 46s

Features:
- Server: Get identity, info, preferences, sessions, butler tasks
- Library: Get all, get contents, recently added, on deck, refresh, analyze
- Media: Get, update, delete, refresh, mark watched/unwatched
- Playlist: CRUD operations, add/remove items
- Collection: CRUD operations, add/remove items
- Search: Global and library-specific search
- Session: Get active sessions, history, terminate

Includes CI/CD pipeline for automatic npm publishing on release.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-12-14 10:12:36 +01:00
co-authored by Claude
commit ed55175994
22 changed files with 7347 additions and 0 deletions
@@ -0,0 +1,118 @@
import type { INodeProperties } from 'n8n-workflow';
export const collectionOperations: INodeProperties[] = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
noDataExpression: true,
displayOptions: {
show: {
resource: ['collection'],
},
},
options: [
{
name: 'Get All',
value: 'getAll',
description: 'Get all collections in a library',
action: 'Get all collections',
},
{
name: 'Get',
value: 'get',
description: 'Get a specific collection',
action: 'Get a collection',
},
{
name: 'Get Items',
value: 'getItems',
description: 'Get items in a collection',
action: 'Get collection items',
},
{
name: 'Add Items',
value: 'addItems',
description: 'Add items to a collection',
action: 'Add items to collection',
},
{
name: 'Remove Items',
value: 'removeItems',
description: 'Remove items from a collection',
action: 'Remove items from collection',
},
{
name: 'Delete',
value: 'delete',
description: 'Delete a collection',
action: 'Delete a collection',
},
],
default: 'getAll',
},
];
export const collectionFields: INodeProperties[] = [
// Library Key for getAll
{
displayName: 'Library Key',
name: 'libraryKey',
type: 'string',
required: true,
displayOptions: {
show: {
resource: ['collection'],
operation: ['getAll'],
},
},
default: '',
description: 'The key/ID of the library section',
},
// Collection Rating Key
{
displayName: 'Collection Rating Key',
name: 'collectionRatingKey',
type: 'string',
required: true,
displayOptions: {
show: {
resource: ['collection'],
operation: ['get', 'getItems', 'addItems', 'removeItems', 'delete'],
},
},
default: '',
description: 'The rating key (ID) of the collection',
},
// Machine Identifier (for add/remove items)
{
displayName: 'Machine Identifier',
name: 'machineIdentifier',
type: 'string',
required: true,
displayOptions: {
show: {
resource: ['collection'],
operation: ['addItems', 'removeItems'],
},
},
default: '',
description: 'The machine identifier of the Plex server (found in server identity)',
},
// Item Rating Keys for add/remove
{
displayName: 'Item Rating Keys',
name: 'itemRatingKeys',
type: 'string',
required: true,
displayOptions: {
show: {
resource: ['collection'],
operation: ['addItems', 'removeItems'],
},
},
default: '',
placeholder: '12345,67890',
description: 'Comma-separated list of rating keys (IDs) of items to add or remove',
},
];
@@ -0,0 +1,250 @@
import type { INodeProperties } from 'n8n-workflow';
export const libraryOperations: INodeProperties[] = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
noDataExpression: true,
displayOptions: {
show: {
resource: ['library'],
},
},
options: [
{
name: 'Get All',
value: 'getAll',
description: 'Get all library sections',
action: 'Get all libraries',
},
{
name: 'Get',
value: 'get',
description: 'Get a specific library section',
action: 'Get a library',
},
{
name: 'Get Contents',
value: 'getContents',
description: 'Get all items in a library section',
action: 'Get library contents',
},
{
name: 'Get Recently Added',
value: 'getRecentlyAdded',
description: 'Get recently added items in a library',
action: 'Get recently added items',
},
{
name: 'Get On Deck',
value: 'getOnDeck',
description: 'Get on deck items in a library',
action: 'Get on deck items',
},
{
name: 'Refresh',
value: 'refresh',
description: 'Refresh/scan a library section',
action: 'Refresh a library',
},
{
name: 'Empty Trash',
value: 'emptyTrash',
description: 'Empty the trash for a library section',
action: 'Empty library trash',
},
{
name: 'Analyze',
value: 'analyze',
description: 'Analyze all items in a library section',
action: 'Analyze library',
},
],
default: 'getAll',
},
];
export const libraryFields: INodeProperties[] = [
// Library Key/ID
{
displayName: 'Library Key',
name: 'libraryKey',
type: 'string',
required: true,
displayOptions: {
show: {
resource: ['library'],
operation: [
'get',
'getContents',
'getRecentlyAdded',
'getOnDeck',
'refresh',
'emptyTrash',
'analyze',
],
},
},
default: '',
description: 'The key/ID of the library section',
},
// Return All for getContents
{
displayName: 'Return All',
name: 'returnAll',
type: 'boolean',
displayOptions: {
show: {
resource: ['library'],
operation: ['getContents', 'getRecentlyAdded'],
},
},
default: false,
description: 'Whether to return all results or only up to a given limit',
},
{
displayName: 'Limit',
name: 'limit',
type: 'number',
displayOptions: {
show: {
resource: ['library'],
operation: ['getContents', 'getRecentlyAdded'],
returnAll: [false],
},
},
typeOptions: {
minValue: 1,
maxValue: 500,
},
default: 50,
description: 'Max number of results to return',
},
// Additional Options for getContents
{
displayName: 'Options',
name: 'options',
type: 'collection',
placeholder: 'Add Option',
default: {},
displayOptions: {
show: {
resource: ['library'],
operation: ['getContents'],
},
},
options: [
{
displayName: 'Type',
name: 'type',
type: 'options',
options: [
{
name: 'All',
value: '',
},
{
name: 'Movie',
value: '1',
},
{
name: 'Show',
value: '2',
},
{
name: 'Season',
value: '3',
},
{
name: 'Episode',
value: '4',
},
{
name: 'Trailer',
value: '5',
},
{
name: 'Comic',
value: '6',
},
{
name: 'Person',
value: '7',
},
{
name: 'Artist',
value: '8',
},
{
name: 'Album',
value: '9',
},
{
name: 'Track',
value: '10',
},
{
name: 'Photo Album',
value: '11',
},
{
name: 'Picture',
value: '12',
},
{
name: 'Photo',
value: '13',
},
{
name: 'Clip',
value: '14',
},
{
name: 'Playlist Item',
value: '15',
},
],
default: '',
description: 'Filter by media type',
},
{
displayName: 'Sort',
name: 'sort',
type: 'string',
default: '',
description: 'Sort order (e.g., "titleSort:asc", "addedAt:desc")',
},
{
displayName: 'Unwatched Only',
name: 'unwatched',
type: 'boolean',
default: false,
description: 'Whether to only return unwatched items',
},
],
},
// Refresh Options
{
displayName: 'Options',
name: 'refreshOptions',
type: 'collection',
placeholder: 'Add Option',
default: {},
displayOptions: {
show: {
resource: ['library'],
operation: ['refresh'],
},
},
options: [
{
displayName: 'Force',
name: 'force',
type: 'boolean',
default: false,
description: 'Whether to force a full refresh of all metadata',
},
],
},
];
+214
View File
@@ -0,0 +1,214 @@
import type { INodeProperties } from 'n8n-workflow';
export const mediaOperations: INodeProperties[] = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
noDataExpression: true,
displayOptions: {
show: {
resource: ['media'],
},
},
options: [
{
name: 'Get',
value: 'get',
description: 'Get metadata for a specific media item',
action: 'Get media item',
},
{
name: 'Get Children',
value: 'getChildren',
description: 'Get children of a media item (e.g., episodes of a show)',
action: 'Get media children',
},
{
name: 'Get Related',
value: 'getRelated',
description: 'Get related media items',
action: 'Get related media',
},
{
name: 'Get Similar',
value: 'getSimilar',
description: 'Get similar media items',
action: 'Get similar media',
},
{
name: 'Update',
value: 'update',
description: 'Update metadata for a media item',
action: 'Update media item',
},
{
name: 'Delete',
value: 'delete',
description: 'Delete a media item',
action: 'Delete media item',
},
{
name: 'Refresh',
value: 'refresh',
description: 'Refresh metadata for a media item',
action: 'Refresh media item',
},
{
name: 'Analyze',
value: 'analyze',
description: 'Analyze a media item',
action: 'Analyze media item',
},
{
name: 'Mark Watched',
value: 'markWatched',
description: 'Mark a media item as watched (scrobble)',
action: 'Mark as watched',
},
{
name: 'Mark Unwatched',
value: 'markUnwatched',
description: 'Mark a media item as unwatched (unscrobble)',
action: 'Mark as unwatched',
},
],
default: 'get',
},
];
export const mediaFields: INodeProperties[] = [
// Rating Key (Media ID)
{
displayName: 'Rating Key',
name: 'ratingKey',
type: 'string',
required: true,
displayOptions: {
show: {
resource: ['media'],
operation: [
'get',
'getChildren',
'getRelated',
'getSimilar',
'update',
'delete',
'refresh',
'analyze',
'markWatched',
'markUnwatched',
],
},
},
default: '',
description: 'The rating key (ID) of the media item',
},
// Update Fields
{
displayName: 'Update Fields',
name: 'updateFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: ['media'],
operation: ['update'],
},
},
options: [
{
displayName: 'Title',
name: 'title',
type: 'string',
default: '',
description: 'The title of the media item',
},
{
displayName: 'Sort Title',
name: 'titleSort',
type: 'string',
default: '',
description: 'The sort title of the media item',
},
{
displayName: 'Originally Available At',
name: 'originallyAvailableAt',
type: 'string',
default: '',
description: 'The original release date (YYYY-MM-DD)',
},
{
displayName: 'Studio',
name: 'studio',
type: 'string',
default: '',
description: 'The studio that produced the media',
},
{
displayName: 'Content Rating',
name: 'contentRating',
type: 'string',
default: '',
description: 'The content rating (e.g., PG-13, TV-MA)',
},
{
displayName: 'Summary',
name: 'summary',
type: 'string',
typeOptions: {
rows: 4,
},
default: '',
description: 'The summary/description of the media item',
},
{
displayName: 'Tagline',
name: 'tagline',
type: 'string',
default: '',
description: 'The tagline of the media item',
},
{
displayName: 'Rating',
name: 'rating',
type: 'number',
typeOptions: {
minValue: 0,
maxValue: 10,
numberPrecision: 1,
},
default: 0,
description: 'The rating of the media item (0-10)',
},
],
},
// Options for related/similar
{
displayName: 'Options',
name: 'options',
type: 'collection',
placeholder: 'Add Option',
default: {},
displayOptions: {
show: {
resource: ['media'],
operation: ['getRelated', 'getSimilar'],
},
},
options: [
{
displayName: 'Limit',
name: 'limit',
type: 'number',
typeOptions: {
minValue: 1,
maxValue: 100,
},
default: 10,
description: 'Max number of results to return',
},
],
},
];
@@ -0,0 +1,267 @@
import type { INodeProperties } from 'n8n-workflow';
export const playlistOperations: INodeProperties[] = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
noDataExpression: true,
displayOptions: {
show: {
resource: ['playlist'],
},
},
options: [
{
name: 'Get All',
value: 'getAll',
description: 'Get all playlists',
action: 'Get all playlists',
},
{
name: 'Get',
value: 'get',
description: 'Get a specific playlist',
action: 'Get a playlist',
},
{
name: 'Get Items',
value: 'getItems',
description: 'Get items in a playlist',
action: 'Get playlist items',
},
{
name: 'Create',
value: 'create',
description: 'Create a new playlist',
action: 'Create a playlist',
},
{
name: 'Update',
value: 'update',
description: 'Update a playlist',
action: 'Update a playlist',
},
{
name: 'Delete',
value: 'delete',
description: 'Delete a playlist',
action: 'Delete a playlist',
},
{
name: 'Add Items',
value: 'addItems',
description: 'Add items to a playlist',
action: 'Add items to playlist',
},
{
name: 'Remove Items',
value: 'removeItems',
description: 'Remove items from a playlist',
action: 'Remove items from playlist',
},
],
default: 'getAll',
},
];
export const playlistFields: INodeProperties[] = [
// Playlist Rating Key
{
displayName: 'Playlist Rating Key',
name: 'playlistRatingKey',
type: 'string',
required: true,
displayOptions: {
show: {
resource: ['playlist'],
operation: ['get', 'getItems', 'update', 'delete', 'addItems', 'removeItems'],
},
},
default: '',
description: 'The rating key (ID) of the playlist',
},
// Create Playlist Fields
{
displayName: 'Title',
name: 'title',
type: 'string',
required: true,
displayOptions: {
show: {
resource: ['playlist'],
operation: ['create'],
},
},
default: '',
description: 'The title of the new playlist',
},
{
displayName: 'Playlist Type',
name: 'playlistType',
type: 'options',
required: true,
displayOptions: {
show: {
resource: ['playlist'],
operation: ['create'],
},
},
options: [
{
name: 'Video',
value: 'video',
},
{
name: 'Audio',
value: 'audio',
},
{
name: 'Photo',
value: 'photo',
},
],
default: 'video',
description: 'The type of playlist to create',
},
{
displayName: 'URI',
name: 'uri',
type: 'string',
required: true,
displayOptions: {
show: {
resource: ['playlist'],
operation: ['create'],
},
},
default: '',
placeholder: 'server://client-id/com.plexapp.plugins.library/library/metadata/12345',
description: 'The URI of the first item to add to the playlist',
},
// Update Fields
{
displayName: 'Update Fields',
name: 'updateFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: ['playlist'],
operation: ['update'],
},
},
options: [
{
displayName: 'Title',
name: 'title',
type: 'string',
default: '',
description: 'The new title of the playlist',
},
{
displayName: 'Summary',
name: 'summary',
type: 'string',
typeOptions: {
rows: 4,
},
default: '',
description: 'The summary/description of the playlist',
},
],
},
// Add/Remove Items
{
displayName: 'Item URI',
name: 'itemUri',
type: 'string',
required: true,
displayOptions: {
show: {
resource: ['playlist'],
operation: ['addItems'],
},
},
default: '',
placeholder: 'server://client-id/com.plexapp.plugins.library/library/metadata/12345',
description: 'The URI of the item to add to the playlist',
},
{
displayName: 'Playlist Item ID',
name: 'playlistItemId',
type: 'string',
required: true,
displayOptions: {
show: {
resource: ['playlist'],
operation: ['removeItems'],
},
},
default: '',
description: 'The playlist item ID to remove',
},
// Options for getAll
{
displayName: 'Options',
name: 'options',
type: 'collection',
placeholder: 'Add Option',
default: {},
displayOptions: {
show: {
resource: ['playlist'],
operation: ['getAll'],
},
},
options: [
{
displayName: 'Playlist Type',
name: 'playlistType',
type: 'options',
options: [
{
name: 'All',
value: '',
},
{
name: 'Audio',
value: 'audio',
},
{
name: 'Photo',
value: 'photo',
},
{
name: 'Video',
value: 'video',
},
],
default: '',
description: 'Filter playlists by type',
},
{
displayName: 'Smart',
name: 'smart',
type: 'options',
options: [
{
name: 'All',
value: '',
},
{
name: 'Smart Only',
value: '1',
},
{
name: 'Regular Only',
value: '0',
},
],
default: '',
description: 'Filter by smart/regular playlists',
},
],
},
];
@@ -0,0 +1,152 @@
import type { INodeProperties } from 'n8n-workflow';
export const searchOperations: INodeProperties[] = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
noDataExpression: true,
displayOptions: {
show: {
resource: ['search'],
},
},
options: [
{
name: 'Search',
value: 'search',
description: 'Search across all libraries',
action: 'Search all libraries',
},
{
name: 'Search in Library',
value: 'searchInLibrary',
description: 'Search within a specific library',
action: 'Search in library',
},
],
default: 'search',
},
];
export const searchFields: INodeProperties[] = [
// Query
{
displayName: 'Query',
name: 'query',
type: 'string',
required: true,
displayOptions: {
show: {
resource: ['search'],
operation: ['search', 'searchInLibrary'],
},
},
default: '',
description: 'The search query',
},
// Library Key for searchInLibrary
{
displayName: 'Library Key',
name: 'libraryKey',
type: 'string',
required: true,
displayOptions: {
show: {
resource: ['search'],
operation: ['searchInLibrary'],
},
},
default: '',
description: 'The key/ID of the library section to search in',
},
// Return All
{
displayName: 'Return All',
name: 'returnAll',
type: 'boolean',
displayOptions: {
show: {
resource: ['search'],
operation: ['search', 'searchInLibrary'],
},
},
default: false,
description: 'Whether to return all results or only up to a given limit',
},
{
displayName: 'Limit',
name: 'limit',
type: 'number',
displayOptions: {
show: {
resource: ['search'],
operation: ['search', 'searchInLibrary'],
returnAll: [false],
},
},
typeOptions: {
minValue: 1,
maxValue: 500,
},
default: 50,
description: 'Max number of results to return',
},
// Search Options
{
displayName: 'Options',
name: 'options',
type: 'collection',
placeholder: 'Add Option',
default: {},
displayOptions: {
show: {
resource: ['search'],
operation: ['searchInLibrary'],
},
},
options: [
{
displayName: 'Type',
name: 'type',
type: 'options',
options: [
{
name: 'All',
value: '',
},
{
name: 'Movie',
value: '1',
},
{
name: 'Show',
value: '2',
},
{
name: 'Season',
value: '3',
},
{
name: 'Episode',
value: '4',
},
{
name: 'Artist',
value: '8',
},
{
name: 'Album',
value: '9',
},
{
name: 'Track',
value: '10',
},
],
default: '',
description: 'Filter search results by media type',
},
],
},
];
@@ -0,0 +1,142 @@
import type { INodeProperties } from 'n8n-workflow';
export const serverOperations: INodeProperties[] = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
noDataExpression: true,
displayOptions: {
show: {
resource: ['server'],
},
},
options: [
{
name: 'Get Identity',
value: 'getIdentity',
description: 'Get server identity information',
action: 'Get server identity',
},
{
name: 'Get Info',
value: 'getInfo',
description: 'Get server information',
action: 'Get server info',
},
{
name: 'Get Preferences',
value: 'getPreferences',
description: 'Get server preferences',
action: 'Get server preferences',
},
{
name: 'Get Active Sessions',
value: 'getActiveSessions',
description: 'Get all active playback sessions',
action: 'Get active sessions',
},
{
name: 'Get Transcode Sessions',
value: 'getTranscodeSessions',
description: 'Get all active transcode sessions',
action: 'Get transcode sessions',
},
{
name: 'Get Butler Tasks',
value: 'getButlerTasks',
description: 'Get scheduled butler tasks',
action: 'Get butler tasks',
},
{
name: 'Run Butler Task',
value: 'runButlerTask',
description: 'Run a specific butler task',
action: 'Run butler task',
},
{
name: 'Stop Butler Task',
value: 'stopButlerTask',
description: 'Stop a specific butler task',
action: 'Stop butler task',
},
],
default: 'getInfo',
},
];
export const serverFields: INodeProperties[] = [
// Butler Task Name
{
displayName: 'Task Name',
name: 'taskName',
type: 'options',
required: true,
displayOptions: {
show: {
resource: ['server'],
operation: ['runButlerTask', 'stopButlerTask'],
},
},
options: [
{
name: 'Backup Database',
value: 'BackupDatabase',
},
{
name: 'Build Gracenote Collections',
value: 'BuildGracenoteCollections',
},
{
name: 'Check For Updates',
value: 'CheckForUpdates',
},
{
name: 'Clean Old Bundles',
value: 'CleanOldBundles',
},
{
name: 'Clean Old Cache Files',
value: 'CleanOldCacheFiles',
},
{
name: 'Deep Media Analysis',
value: 'DeepMediaAnalysis',
},
{
name: 'Generate Auto Tags',
value: 'GenerateAutoTags',
},
{
name: 'Generate Chapter Thumbs',
value: 'GenerateChapterThumbs',
},
{
name: 'Generate Media Index Files',
value: 'GenerateMediaIndexFiles',
},
{
name: 'Optimize Database',
value: 'OptimizeDatabase',
},
{
name: 'Refresh Libraries',
value: 'RefreshLibraries',
},
{
name: 'Refresh Local Media',
value: 'RefreshLocalMedia',
},
{
name: 'Refresh Periodic Metadata',
value: 'RefreshPeriodicMetadata',
},
{
name: 'Upgrade Media Analysis',
value: 'UpgradeMediaAnalysis',
},
],
default: 'RefreshLibraries',
description: 'The butler task to run or stop',
},
];
@@ -0,0 +1,146 @@
import type { INodeProperties } from 'n8n-workflow';
export const sessionOperations: INodeProperties[] = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
noDataExpression: true,
displayOptions: {
show: {
resource: ['session'],
},
},
options: [
{
name: 'Get All',
value: 'getAll',
description: 'Get all active playback sessions',
action: 'Get all sessions',
},
{
name: 'Get History',
value: 'getHistory',
description: 'Get playback history',
action: 'Get playback history',
},
{
name: 'Terminate',
value: 'terminate',
description: 'Terminate a playback session',
action: 'Terminate session',
},
],
default: 'getAll',
},
];
export const sessionFields: INodeProperties[] = [
// Session ID for terminate
{
displayName: 'Session ID',
name: 'sessionId',
type: 'string',
required: true,
displayOptions: {
show: {
resource: ['session'],
operation: ['terminate'],
},
},
default: '',
description: 'The ID of the session to terminate',
},
// Terminate Options
{
displayName: 'Reason',
name: 'reason',
type: 'string',
displayOptions: {
show: {
resource: ['session'],
operation: ['terminate'],
},
},
default: '',
description: 'The reason for terminating the session (shown to user)',
},
// History Options
{
displayName: 'Options',
name: 'options',
type: 'collection',
placeholder: 'Add Option',
default: {},
displayOptions: {
show: {
resource: ['session'],
operation: ['getHistory'],
},
},
options: [
{
displayName: 'Sort',
name: 'sort',
type: 'options',
options: [
{
name: 'Newest First',
value: 'viewedAt:desc',
},
{
name: 'Oldest First',
value: 'viewedAt:asc',
},
],
default: 'viewedAt:desc',
description: 'Sort order for history',
},
{
displayName: 'Account ID',
name: 'accountID',
type: 'number',
default: 0,
description: 'Filter by account ID (0 for all accounts)',
},
{
displayName: 'Library Section ID',
name: 'librarySectionID',
type: 'string',
default: '',
description: 'Filter by library section',
},
],
},
{
displayName: 'Return All',
name: 'returnAll',
type: 'boolean',
displayOptions: {
show: {
resource: ['session'],
operation: ['getHistory'],
},
},
default: false,
description: 'Whether to return all results or only up to a given limit',
},
{
displayName: 'Limit',
name: 'limit',
type: 'number',
displayOptions: {
show: {
resource: ['session'],
operation: ['getHistory'],
returnAll: [false],
},
},
typeOptions: {
minValue: 1,
maxValue: 500,
},
default: 50,
description: 'Max number of results to return',
},
];
+7
View File
@@ -0,0 +1,7 @@
export * from './ServerDescription';
export * from './LibraryDescription';
export * from './MediaDescription';
export * from './PlaylistDescription';
export * from './SearchDescription';
export * from './SessionDescription';
export * from './CollectionDescription';