diff --git a/API.md b/API.md index c07b6b51..4412aaac 100644 --- a/API.md +++ b/API.md @@ -32,6 +32,21 @@ General optional parameters: ## API methods +### add_notifier_config +Add a new notification agent. + +``` +Required parameters: + agent_id (int): The notification agent to add + +Optional parameters: + None + +Returns: + None +``` + + ### arnold Get to the chopper! @@ -45,7 +60,7 @@ Create a manual backup of the `plexpy.db` file. ### delete_all_library_history -Delete all PlexPy history for a specific library. +Delete all Tautulli history for a specific library. ``` Required parameters: @@ -60,7 +75,7 @@ Returns: ### delete_all_user_history -Delete all PlexPy history for a specific user. +Delete all Tautulli history for a specific user. ``` Required parameters: @@ -97,8 +112,11 @@ Returns: Delete and recreate the image cache directory. +### delete_imgur_poster + + ### delete_library -Delete a library section from PlexPy. Also erases all history for the library. +Delete a library section from Tautulli. Also erases all history for the library. ``` Required parameters: @@ -113,7 +131,7 @@ Returns: ### delete_login_log -Delete the PlexPy login logs. +Delete the Tautulli login logs. ``` Required paramters: @@ -127,8 +145,23 @@ Returns: ``` +### delete_mobile_device +Remove a mobile device from the database. + +``` +Required parameters: + mobile_device_id (int): The device id to delete + +Optional parameters: + None + +Returns: + None +``` + + ### delete_notification_log -Delete the PlexPy notification logs. +Delete the Tautulli notification logs. ``` Required paramters: @@ -142,12 +175,27 @@ Returns: ``` +### delete_notifier +Remove a notifier from the database. + +``` +Required parameters: + notifier_id (int): The notifier to delete + +Optional parameters: + None + +Returns: + None +``` + + ### delete_temp_sessions Flush out all of the temporary sessions in the database. ### delete_user -Delete a user from PlexPy. Also erases all history for the user. +Delete a user from Tautulli. Also erases all history for the user. ``` Required parameters: @@ -169,8 +217,16 @@ Return the api docs as a dict where commands are keys, docstring are value. Return the api docs formatted with markdown. +### download_config +Download the Tautulli configuration file. + + +### download_database +Download the Tautulli database file. + + ### download_log -Download the PlexPy log file. +Download the Tautulli log file. ### download_plex_log @@ -178,7 +234,7 @@ Download the Plex log file. ### edit_library -Update a library section on PlexPy. +Update a library section on Tautulli. ``` Required parameters: @@ -186,8 +242,6 @@ Required parameters: Optional parameters: custom_thumb (str): The URL for the custom library thumbnail - do_notify (int): 0 or 1 - do_notify_created (int): 0 or 1 keep_history (int): 0 or 1 Returns: @@ -196,7 +250,7 @@ Returns: ### edit_user -Update a user on PlexPy. +Update a user on Tautulli. ``` Required parameters: @@ -205,9 +259,8 @@ Required parameters: Optional paramters: friendly_name(str): The friendly name of the user custom_thumb (str): The URL for the custom user thumbnail - do_notify (int): 0 or 1 - do_notify_created (int): 0 or 1 keep_history (int): 0 or 1 + allow_guest (int): 0 or 1 Returns: None @@ -226,67 +279,219 @@ Optional parameters: Returns: json: - {"stream_count": 3, - "session": - [{"art": "/library/metadata/1219/art/1462175063", - "aspect_ratio": "1.78", - "audio_channels": "6", - "audio_codec": "ac3", - "audio_decision": "transcode", - "bif_thumb": "/library/parts/274169/indexes/sd/", - "bitrate": "10617", - "container": "mkv", - "content_rating": "TV-MA", - "duration": "2998290", - "friendly_name": "Mother of Dragons", - "grandparent_rating_key": "1219", - "grandparent_thumb": "/library/metadata/1219/thumb/1462175063", - "grandparent_title": "Game of Thrones", - "height": "1078", - "indexes": 1, - "ip_address": "xxx.xxx.xxx.xxx", - "labels": [], - "machine_id": "83f189w617623ccs6a1lqpby", - "media_index": "1", - "media_type": "episode", - "parent_media_index": "6", - "parent_rating_key": "153036", - "parent_thumb": "/library/metadata/153036/thumb/1462175062", - "parent_title": "", - "platform": "Chrome", - "player": "Plex Web (Chrome)", - "progress_percent": "0", - "rating_key": "153037", - "section_id": "2", - "session_key": "291", - "state": "playing", - "throttled": "1", - "thumb": "/library/metadata/153037/thumb/1462175060", - "title": "The Red Woman", - "transcode_audio_channels": "2", - "transcode_audio_codec": "aac", - "transcode_container": "mkv", - "transcode_height": "1078", - "transcode_key": "tiv5p524wcupe8nxegc26s9k9", - "transcode_progress": 2, - "transcode_protocol": "http", - "transcode_speed": "0.0", - "transcode_video_codec": "h264", - "transcode_width": "1920", - "user": "DanyKhaleesi69", - "user_id": 8008135, - "user_thumb": "https://plex.tv/users/568gwwoib5t98a3a/avatar", - "video_codec": "h264", - "video_decision": "copy", - "video_framerate": "24p", - "video_resolution": "1080", - "view_offset": "", - "width": "1920", - "year": "2016" - }, - {...}, - {...} - ] + {"lan_bandwidth": 25318, + "sessions": [ + { + "actors": [ + "Kit Harington", + "Emilia Clarke", + "Isaac Hempstead-Wright", + "Maisie Williams", + "Liam Cunningham", + ], + "added_at": "1461572396", + "allow_guest": 1, + "art": "/library/metadata/1219/art/1503306930", + "aspect_ratio": "1.78", + "audience_rating": "", + "audio_bitrate": "384", + "audio_bitrate_mode": "", + "audio_channel_layout": "5.1(side)", + "audio_channels": "6", + "audio_codec": "ac3", + "audio_decision": "direct play", + "audio_language": "", + "audio_language_code": "", + "audio_profile": "", + "audio_sample_rate": "48000", + "bandwidth": "25318", + "banner": "/library/metadata/1219/banner/1503306930", + "bif_thumb": "/library/parts/274169/indexes/sd/1000", + "bitrate": "10617", + "channel_stream": 0, + "collections": [], + "container": "mkv", + "content_rating": "TV-MA", + "deleted_user": 0, + "device": "Windows", + "directors": [ + "Jeremy Podeswa" + ], + "do_notify": 0, + "duration": "2998272", + "email": "Jon.Snow.1337@CastleBlack.com", + "file": "/media/TV Shows/Game of Thrones/Season 06/Game of Thrones - S06E01 - The Red Woman.mkv", + "file_size": "3979115377", + "friendly_name": "Jon Snow", + "full_title": "Game of Thrones - The Red Woman", + "genres": [ + "Adventure", + "Drama", + "Fantasy" + ], + "grandparent_rating_key": "1219", + "grandparent_thumb": "/library/metadata/1219/thumb/1503306930", + "grandparent_title": "Game of Thrones", + "guid": "com.plexapp.agents.thetvdb://121361/6/1?lang=en", + "height": "1078", + "id": "", + "indexes": 1, + "ip_address": "10.10.10.1", + "ip_address_public": "64.123.23.111", + "is_admin": 1, + "is_allow_sync": null, + "is_home_user": 1, + "is_restricted": 0, + "keep_history": 1, + "labels": [], + "last_viewed_at": "1462165717", + "library_name": "TV Shows", + "local": "1", + "location": "lan", + "machine_id": "lmd93nkn12k29j2lnm", + "media_index": "1", + "media_type": "episode", + "optimized_version": 0, + "optimized_version_profile": "", + "optimized_version_title": "", + "originally_available_at": "2016-04-24", + "parent_media_index": "6", + "parent_rating_key": "153036", + "parent_thumb": "/library/metadata/153036/thumb/1503889210", + "parent_title": "Season 6", + "platform": "Plex Media Player", + "platform_name": "plex", + "platform_version": "2.4.1.787-54a020cd", + "player": "Castle-PC", + "product": "Plex Media Player", + "product_version": "3.35.2", + "profile": "Konvergo", + "progress_percent": "0", + "quality_profile": "Original", + "rating": "7.8", + "rating_key": "153037", + "section_id": "2", + "session_id": "helf15l3rxgw01xxe0jf3l3d", + "session_key": "27", + "shared_libraries": [ + "10", + "1", + "4", + "5", + "15", + "20", + "2" + ], + "sort_title": "Red Woman", + "state": "playing", + "stream_aspect_ratio": "1.78", + "stream_audio_bitrate": "384", + "stream_audio_bitrate_mode": "", + "stream_audio_channel_layout": "5.1(side)", + "stream_audio_channel_layout_": "5.1(side)", + "stream_audio_channels": "6", + "stream_audio_codec": "ac3", + "stream_audio_decision": "direct play", + "stream_audio_language": "", + "stream_audio_language_code": "", + "stream_audio_sample_rate": "48000", + "stream_bitrate": "10617", + "stream_container": "mkv", + "stream_container_decision": "direct play", + "stream_duration": "2998272", + "stream_subtitle_codec": "", + "stream_subtitle_container": "", + "stream_subtitle_decision": "", + "stream_subtitle_forced": 0, + "stream_subtitle_format": "", + "stream_subtitle_language": "", + "stream_subtitle_language_code": "", + "stream_subtitle_location": "", + "stream_video_bit_depth": "8", + "stream_video_bitrate": "10233", + "stream_video_codec": "h264", + "stream_video_codec_level": "41", + "stream_video_decision": "direct play", + "stream_video_framerate": "24p", + "stream_video_height": "1078", + "stream_video_language": "", + "stream_video_language_code": "", + "stream_video_ref_frames": "4", + "stream_video_resolution": "1080", + "stream_video_width": "1920", + "studio": "HBO", + "subtitle_codec": "", + "subtitle_container": "", + "subtitle_decision": "", + "subtitle_forced": 0, + "subtitle_format": "", + "subtitle_language": "", + "subtitle_language_code": "", + "subtitle_location": "", + "subtitles": 0, + "summary": "Jon Snow is dead. Daenerys meets a strong man. Cersei sees her daughter again.", + "synced_version": 0, + "synced_version_profile": "", + "tagline": "", + "throttled": "0", + "thumb": "/library/metadata/153037/thumb/1503889207", + "title": "The Red Woman", + "transcode_audio_channels": "", + "transcode_audio_codec": "", + "transcode_container": "", + "transcode_decision": "direct play", + "transcode_height": "", + "transcode_hw_decode": "", + "transcode_hw_decode_title": "", + "transcode_hw_decoding": 0, + "transcode_hw_encode": "", + "transcode_hw_encode_title": "", + "transcode_hw_encoding": 0, + "transcode_hw_full_pipeline": 0, + "transcode_hw_requested": 0, + "transcode_key": "", + "transcode_progress": 0, + "transcode_protocol": "", + "transcode_speed": "", + "transcode_throttled": 0, + "transcode_video_codec": "", + "transcode_width": "", + "type": "", + "updated_at": "1503889207", + "user": "LordCommanderSnow", + "user_id": 133788, + "user_rating": "", + "user_thumb": "https://plex.tv/users/k10w42309cynaopq/avatar", + "username": "LordCommanderSnow", + "video_bit_depth": "8", + "video_bitrate": "10233", + "video_codec": "h264", + "video_codec_level": "41", + "video_decision": "direct play", + "video_frame_rate": "23.976", + "video_framerate": "24p", + "video_height": "1078", + "video_language": "", + "video_language_code": "", + "video_profile": "high", + "video_ref_frames": "4", + "video_resolution": "1080", + "video_width": "1920", + "view_offset": "1000", + "width": "1920", + "writers": [ + "David Benioff", + "D. B. Weiss" + ], + "year": "2016" + } + ], + "stream_count": "1", + "stream_count_direct_play": 1, + "stream_count_direct_stream": 0, + "stream_count_transcode": 0, + "total_bandwidth": 25318, + "wan_bandwidth": 0 } ``` @@ -300,8 +505,8 @@ Required parameters: None Optional parameters: - username (str): Your PlexPy username - password (str): Your PlexPy password + username (str): Your Tautulli username + password (str): Your Tautulli password Returns: string: "apikey" @@ -309,7 +514,7 @@ Returns: ### get_date_formats -Get the date and time formats used by PlexPy. +Get the date and time formats used by Tautulli. ``` Required parameters: @@ -355,7 +560,7 @@ Returns: ### get_history -Get the PlexPy history. +Get the Tautulli history. ``` Required parameters: @@ -387,34 +592,38 @@ Returns: "total_duration": "42 days 5 hrs 18 mins", "filter_duration": "10 hrs 12 mins", "data": - [{"year": 2016, - "paused_counter": 0, - "player": "Plex Web (Chrome)", + [{"date": 1462687607, + "duration": 263, + "friendly_name": "Mother of Dragons", + "full_title": "Game of Thrones - The Red Woman", + "grandparent_rating_key": 351, + "grandparent_title": "Game of Thrones", + "group_count": 1, + "group_ids": "1124", + "id": 1124, + "ip_address": "xxx.xxx.xxx.xxx", + "media_index": 17, + "media_type": "episode", + "parent_media_index": 7, "parent_rating_key": 544, "parent_title": "", - "duration": 263, - "transcode_decision": "transcode", - "rating_key": 4348, - "user_id": 8008135, - "thumb": "/library/metadata/4348/thumb/1462414561", - "id": 1124, - "platform": "Chrome", - "media_type": "episode", - "grandparent_rating_key": 351, - "started": 1462688107, - "full_title": "Game of Thrones - The Red Woman", - "reference_id": 1123, - "date": 1462687607, + "paused_counter": 0, "percent_complete": 84, - "ip_address": "xxx.xxx.xxx.xxx", - "group_ids": "1124", - "media_index": 17, - "friendly_name": "Mother of Dragons", - "watched_status": 0, - "group_count": 1, + "platform": "Chrome", + "player": "Plex Web (Chrome)", + "rating_key": 4348, + "reference_id": 1123, + "session_key": null, + "started": 1462688107, + "state": null, "stopped": 1462688370, - "parent_media_index": 7, - "user": "DanyKhaleesi69" + "thumb": "/library/metadata/4348/thumb/1462414561", + "title": "The Red Woman", + "transcode_decision": "transcode", + "user": "DanyKhaleesi69", + "user_id": 8008135, + "watched_status": 0, + "year": 2016 }, {...}, {...} @@ -526,7 +735,7 @@ Returns: ### get_libraries_table -Get the data on the PlexPy libraries table. +Get the data on the Tautulli libraries table. ``` Required parameters: @@ -607,7 +816,7 @@ Returns: ### get_library_media_info -Get the data on the PlexPy media info tables. +Get the data on the Tautulli media info tables. ``` Required parameters: @@ -616,7 +825,7 @@ Required parameters: Optional parameters: section_type (str): "movie", "show", "artist", "photo" - order_column (str): "added_at", "title", "container", "bitrate", "video_codec", + order_column (str): "added_at", "sort_title", "container", "bitrate", "video_codec", "video_resolution", "video_framerate", "audio_codec", "audio_channels", "file_size", "last_played", "play_count" order_dir (str): "desc" or "asc" @@ -743,7 +952,7 @@ Returns: ### get_logs -Get the PlexPy logs. +Get the Tautulli logs. ``` Required parameters: @@ -776,7 +985,6 @@ Get the metadata for a media item. ``` Required parameters: rating_key (str): Rating key of the item - media_info (bool): True or False whether to get media info Optional parameters: None @@ -792,11 +1000,15 @@ Returns: ], "added_at": "1461572396", "art": "/library/metadata/1219/art/1462175063", + "audience_rating": "8", + "banner": "/library/metadata/1219/banner/1462175063", + "collections": [], "content_rating": "TV-MA", "directors": [ "Jeremy Podeswa" ], "duration": "2998290", + "full_title": "Game of Thrones - The Red Woman", "genres": [ "Adventure", "Drama", @@ -810,6 +1022,74 @@ Returns: "last_viewed_at": "1462165717", "library_name": "TV Shows", "media_index": "1", + "media_info": [ + { + "aspect_ratio": "1.78", + "audio_channel_layout": "5.1", + "audio_channels": "6", + "audio_codec": "ac3", + "audio_profile": "", + "bitrate": "10617", + "container": "mkv", + "height": "1078", + "id": "257925", + "optimized_version": 0, + "parts": [ + { + "file": "/media/TV Shows/Game of Thrones/Season 06/Game of Thrones - S06E01 - The Red Woman.mkv", + "file_size": "3979115377", + "id": "274169", + "indexes": 1, + "streams": [ + { + "id": "511663", + "type": "1", + "video_bit_depth": "8", + "video_bitrate": "10233", + "video_codec": "h264", + "video_codec_level": "41", + "video_frame_rate": "23.976", + "video_height": "1078", + "video_language": "", + "video_language_code": "", + "video_profile": "high", + "video_ref_frames": "4", + "video_width": "1920" + }, + { + "audio_bitrate": "384", + "audio_bitrate_mode": "", + "audio_channel_layout": "5.1(side)", + "audio_channels": "6", + "audio_codec": "ac3", + "audio_language": "", + "audio_language_code": "", + "audio_profile": "", + "audio_sample_rate": "48000", + "id": "511664", + "type": "2" + }, + { + "id": "511953", + "subtitle_codec": "srt", + "subtitle_container": "", + "subtitle_forced": 0, + "subtitle_format": "srt", + "subtitle_language": "English", + "subtitle_language_code": "eng", + "subtitle_location": "external", + "type": "3" + } + ] + } + ], + "video_codec": "h264", + "video_framerate": "24p", + "video_profile": "high", + "video_resolution": "1080", + "width": "1920" + } + ], "media_type": "episode", "originally_available_at": "2016-04-24", "parent_media_index": "6", @@ -819,11 +1099,13 @@ Returns: "rating": "7.8", "rating_key": "153037", "section_id": "2", + "sort_title": "Game of Thrones", "studio": "HBO", "summary": "Jon Snow is dead. Daenerys meets a strong man. Cersei sees her daughter again.", "tagline": "", "thumb": "/library/metadata/153037/thumb/1462175060", "title": "The Red Woman", + "user_rating": "9.0", "updated_at": "1462175060", "writers": [ "David Benioff", @@ -852,7 +1134,7 @@ Returns: ### get_notification_log -Get the data on the PlexPy notification logs table. +Get the data on the Tautulli notification logs table. ``` Required parameters: @@ -881,7 +1163,7 @@ Returns: "rating_key": 153037, "script_args": "[]", "session_key": 147, - "subject_text": "PlexPy (Winterfell-Server)", + "subject_text": "Tautulli (Winterfell-Server)", "timestamp": 1462253821, "user": "DanyKhaleesi69", "user_id": 8008135 @@ -893,8 +1175,89 @@ Returns: ``` +### get_notifier_config +Get the configuration for an existing notification agent. + +``` +Required parameters: + notifier_id (int): The notifier config to retrieve + +Optional parameters: + None + +Returns: + json: + {"id": 1, + "agent_id": 13, + "agent_name": "telegram", + "agent_label": "Telegram", + "friendly_name": "", + "config": {"incl_poster": 0, + "html_support": 1, + "chat_id": "123456", + "bot_token": "13456789:fio9040NNo04jLEp-4S", + "incl_subject": 1, + "disable_web_preview": 0 + }, + "config_options": [{...}, ...] + "actions": {"on_play": 0, + "on_stop": 0, + ... + }, + "notify_text": {"on_play": {"subject": "...", + "body": "..." + } + "on_stop": {"subject": "...", + "body": "..." + } + ... + } + } +``` + + +### get_notifier_parameters +Get the list of available notification parameters. + +``` +Required parameters: + None + +Optional parameters: + None + +Returns: + json: + { + } +``` + + +### get_notifiers +Get a list of configured notifiers. + +``` +Required parameters: + None + +Optional parameters: + notify_action (str): The notification action to filter out + +Returns: + json: + [{"id": 1, + "agent_id": 13, + "agent_name": "telegram", + "agent_label": "Telegram", + "friendly_name": "", + "active": 1 + } + ] +``` + + ### get_old_rating_keys -Get a list of old rating keys from the PlexPy database for all of the item's parent/children. +Get a list of old rating keys from the Tautulli database for all of the item's parent/children. ``` Required parameters: @@ -1118,7 +1481,7 @@ Required parameters: None Optional parameters: - time_range (str): The number of days of data to return + time_range (str): The number of months of data to return y_axis (str): "plays" or "duration" user_id (str): The user id to filter the data @@ -1159,7 +1522,7 @@ Returns: ### get_pms_token -Get the user's Plex token used for PlexPy. +Get the user's Plex token used for Tautulli. ``` Required parameters: @@ -1170,7 +1533,7 @@ Optional parameters: None Returns: - string: The Plex token used for PlexPy + string: The Plex token used for Tautulli ``` @@ -1211,6 +1574,7 @@ Required parameters: Optional parameters: start (str): The item number to start at + type (str): The media type: movie, show, artist section_id (str): The id of the Plex library section Returns: @@ -1432,27 +1796,29 @@ Optional parameters: Returns: json: - [{"content_type": "video", + [{"audio_bitrate": "192", + "client_id": "95434se643fsf24f-com-plexapp-android", + "content_type": "video", "device_name": "Tyrion's iPad", "failure": "", - "friendly_name": "Tyrion Lannister", - "item_complete_count": "0", + "item_complete_count": "1", "item_count": "1", - "item_downloaded_count": "0", - "item_downloaded_percent_complete": 0, + "item_downloaded_count": "1", + "item_downloaded_percent_complete": 100, "metadata_type": "movie", - "music_bitrate": "192", "photo_quality": "74", "platform": "iOS", "rating_key": "154092", - "root_title": "Deadpool", - "state": "pending", + "root_title": "Movies", + "state": "complete", "sync_id": "11617019", - "title": "Deadpool", - "total_size": "0", + "sync_title": "Deadpool", + "total_size": "560718134", + "user": "DrukenDwarfMan", "user_id": "696969", "username": "DrukenDwarfMan", - "video_quality": "60" + "video_bitrate": "4000" + "video_quality": "100" }, {...}, {...} @@ -1490,7 +1856,7 @@ Returns: ### get_user_ips -Get the data on PlexPy users IP table. +Get the data on Tautulli users IP table. ``` Required parameters: @@ -1536,7 +1902,7 @@ Returns: ### get_user_logins -Get the data on PlexPy user login table. +Get the data on Tautulli user login table. ``` Required parameters: @@ -1685,7 +2051,7 @@ Returns: ### get_users_table -Get the data on PlexPy users table. +Get the data on Tautulli users table. ``` Required parameters: @@ -1767,7 +2133,7 @@ Returns: ### import_database -Import a PlexWatch or Plexivity database into PlexPy. +Import a PlexWatch or Plexivity database into Tautulli. ``` Required parameters: @@ -1788,32 +2154,13 @@ Downloads and installs the GeoLite2 database ### notify -Send a notification using PlexPy. +Send a notification using Tautulli. ``` Required parameters: - agent_id(str): The id of the notification agent to use - 9 # Boxcar2 - 17 # Browser - 10 # Email - 16 # Facebook - 0 # Growl - 19 # Hipchat - 12 # IFTTT - 18 # Join - 4 # NotifyMyAndroid - 3 # Plex Home Theater - 1 # Prowl - 5 # Pushalot - 6 # Pushbullet - 7 # Pushover - 15 # Scripts - 14 # Slack - 13 # Telegram - 11 # Twitter - 2 # XBMC - subject(str): The subject of the message - body(str): The body of the message + notifier_id (int): The ID number of the notification agent + subject (str): The subject of the message + body (str): The body of the message Optional parameters: None @@ -1823,6 +2170,25 @@ Returns: ``` +### notify_recently_added +Send a recently added notification using Tautulli. + +``` +Required parameters: + rating_key (int): The rating key for the media + +Optional parameters: + notifier_id (int): The ID number of the notification agent. + The notification will send to all enabled notification agents if notifier id is not provided. + +Returns: + json + {"result": "success", + "message": "Notification queued." + } +``` + + ### pms_image_proxy Gets an image from the PMS and saves it to the image cache directory. @@ -1844,15 +2210,31 @@ Returns: ### refresh_libraries_list -Refresh the PlexPy libraries list. +Refresh the Tautulli libraries list. ### refresh_users_list -Refresh the PlexPy users list. +Refresh the Tautulli users list. + + +### register_device +Registers the Tautulli Android App for notifications. + +``` +Required parameters: + device_name (str): The device name of the Tautulli Android App + device_id (str): The OneSignal device id of the Tautulli Android App + +Optional parameters: + friendly_name (str): A friendly name to identify the mobile device + +Returns: + None +``` ### restart -Restart PlexPy. +Restart Tautulli. ### search @@ -1862,6 +2244,9 @@ Get search results from the PMS. Required parameters: query (str): The query string to search for +Optional parameters: + limit (int): The maximum number of items to return per media type + Returns: json: {"results_count": 69, @@ -1881,8 +2266,49 @@ Returns: ``` +### set_mobile_device_config +Configure an exisitng notificaiton agent. + +``` +Required parameters: + mobile_device_id (int): The mobile device config to update + +Optional parameters: + friendly_name (str): A friendly name to identify the mobile device + +Returns: + None +``` + + +### set_notifier_config +Configure an exisitng notificaiton agent. + +``` +Required parameters: + notifier_id (int): The notifier config to update + agent_id (int): The agent of the notifier + +Optional parameters: + Pass all the config options for the agent with the agent prefix: + e.g. For Telegram: telegram_bot_token + telegram_chat_id + telegram_disable_web_preview + telegram_html_support + telegram_incl_poster + telegram_incl_subject + Notify actions (int): 0 or 1, + e.g. on_play, on_stop, etc. + Notify text (str): + e.g. on_play_subject, on_play_body, etc. + +Returns: + None +``` + + ### sql -Query the PlexPy database with raw SQL. Automatically makes a backup of +Query the Tautulli database with raw SQL. Automatically makes a backup of the database if the latest backup is older then 24h. `api_sql` must be manually enabled in the config file. @@ -1898,8 +2324,24 @@ Returns: ``` +### terminate_session +Add a new notification agent. + +``` +Required parameters: + session_id (str): The id of the session to terminate + message (str): A custom message to send to the client + +Optional parameters: + None + +Returns: + None +``` + + ### undelete_library -Restore a deleted library section to PlexPy. +Restore a deleted library section to Tautulli. ``` Required parameters: @@ -1915,7 +2357,7 @@ Returns: ### undelete_user -Restore a deleted user to PlexPy. +Restore a deleted user to Tautulli. ``` Required parameters: @@ -1935,11 +2377,11 @@ Uninstalls the GeoLite2 database ### update -Check for PlexPy updates on Github. +Check for Tautulli updates on Github. ### update_metadata_details -Update the metadata in the PlexPy database by matching rating keys. +Update the metadata in the Tautulli database by matching rating keys. Also updates all parents or children of the media item if it is a show/season/episode or artist/album/track. diff --git a/plexpy/webserve.py b/plexpy/webserve.py index 65b8e62c..d789817a 100644 --- a/plexpy/webserve.py +++ b/plexpy/webserve.py @@ -512,8 +512,6 @@ class WebInterface(object): Optional parameters: custom_thumb (str): The URL for the custom library thumbnail - do_notify (int): 0 or 1 - do_notify_created (int): 0 or 1 keep_history (int): 0 or 1 Returns: @@ -624,7 +622,7 @@ class WebInterface(object): Optional parameters: section_type (str): "movie", "show", "artist", "photo" - order_column (str): "added_at", "title", "container", "bitrate", "video_codec", + order_column (str): "added_at", "sort_title", "container", "bitrate", "video_codec", "video_resolution", "video_framerate", "audio_codec", "audio_channels", "file_size", "last_played", "play_count" order_dir (str): "desc" or "asc" @@ -981,7 +979,7 @@ class WebInterface(object): else: return {'message': 'no data received'} else: - return {'message': 'Cannot refresh library while getting file sizes.'} + return {'message': 'Cannot delete media info cache while getting file sizes.'} @cherrypy.expose @cherrypy.tools.json_out() @@ -1130,9 +1128,8 @@ class WebInterface(object): Optional paramters: friendly_name(str): The friendly name of the user custom_thumb (str): The URL for the custom user thumbnail - do_notify (int): 0 or 1 - do_notify_created (int): 0 or 1 keep_history (int): 0 or 1 + allow_guest (int): 0 or 1 Returns: None @@ -3015,12 +3012,14 @@ class WebInterface(object): Pass all the config options for the agent with the agent prefix: e.g. For Telegram: telegram_bot_token telegram_chat_id - disable_web_preview - html_support - incl_poster - incl_subject - Notify actions with 'trigger_' prefix (trigger_on_play, trigger_on_stop, etc.), - and notify text with 'text_' prefix (text_on_play_subject, text_on_play_body, etc.) are optional. + telegram_disable_web_preview + telegram_html_support + telegram_incl_poster + telegram_incl_subject + Notify actions (int): 0 or 1, + e.g. on_play, on_stop, etc. + Notify text (str): + e.g. on_play_subject, on_play_body, etc. Returns: None @@ -4118,11 +4117,15 @@ class WebInterface(object): ], "added_at": "1461572396", "art": "/library/metadata/1219/art/1462175063", + "audience_rating": "8", + "banner": "/library/metadata/1219/banner/1462175063", + "collections": [], "content_rating": "TV-MA", "directors": [ "Jeremy Podeswa" ], "duration": "2998290", + "full_title": "Game of Thrones - The Red Woman", "genres": [ "Adventure", "Drama", @@ -4136,6 +4139,74 @@ class WebInterface(object): "last_viewed_at": "1462165717", "library_name": "TV Shows", "media_index": "1", + "media_info": [ + { + "aspect_ratio": "1.78", + "audio_channel_layout": "5.1", + "audio_channels": "6", + "audio_codec": "ac3", + "audio_profile": "", + "bitrate": "10617", + "container": "mkv", + "height": "1078", + "id": "257925", + "optimized_version": 0, + "parts": [ + { + "file": "/media/TV Shows/Game of Thrones/Season 06/Game of Thrones - S06E01 - The Red Woman.mkv", + "file_size": "3979115377", + "id": "274169", + "indexes": 1, + "streams": [ + { + "id": "511663", + "type": "1", + "video_bit_depth": "8", + "video_bitrate": "10233", + "video_codec": "h264", + "video_codec_level": "41", + "video_frame_rate": "23.976", + "video_height": "1078", + "video_language": "", + "video_language_code": "", + "video_profile": "high", + "video_ref_frames": "4", + "video_width": "1920" + }, + { + "audio_bitrate": "384", + "audio_bitrate_mode": "", + "audio_channel_layout": "5.1(side)", + "audio_channels": "6", + "audio_codec": "ac3", + "audio_language": "", + "audio_language_code": "", + "audio_profile": "", + "audio_sample_rate": "48000", + "id": "511664", + "type": "2" + }, + { + "id": "511953", + "subtitle_codec": "srt", + "subtitle_container": "", + "subtitle_forced": 0, + "subtitle_format": "srt", + "subtitle_language": "English", + "subtitle_language_code": "eng", + "subtitle_location": "external", + "type": "3" + } + ] + } + ], + "video_codec": "h264", + "video_framerate": "24p", + "video_profile": "high", + "video_resolution": "1080", + "width": "1920" + } + ], "media_type": "episode", "originally_available_at": "2016-04-24", "parent_media_index": "6", @@ -4145,11 +4216,13 @@ class WebInterface(object): "rating": "7.8", "rating_key": "153037", "section_id": "2", + "sort_title": "Game of Thrones", "studio": "HBO", "summary": "Jon Snow is dead. Daenerys meets a strong man. Cersei sees her daughter again.", "tagline": "", "thumb": "/library/metadata/153037/thumb/1462175060", "title": "The Red Woman", + "user_rating": "9.0", "updated_at": "1462175060", "writers": [ "David Benioff", @@ -4388,67 +4461,219 @@ class WebInterface(object): Returns: json: - {"stream_count": 3, - "sessions": - [{"art": "/library/metadata/1219/art/1462175063", - "aspect_ratio": "1.78", - "audio_channels": "6", - "audio_codec": "ac3", - "audio_decision": "transcode", - "bif_thumb": "/library/parts/274169/indexes/sd/", - "bitrate": "10617", - "container": "mkv", - "content_rating": "TV-MA", - "duration": "2998290", - "friendly_name": "Mother of Dragons", - "grandparent_rating_key": "1219", - "grandparent_thumb": "/library/metadata/1219/thumb/1462175063", - "grandparent_title": "Game of Thrones", - "height": "1078", - "indexes": 1, - "ip_address": "xxx.xxx.xxx.xxx", - "labels": [], - "machine_id": "83f189w617623ccs6a1lqpby", - "media_index": "1", - "media_type": "episode", - "parent_media_index": "6", - "parent_rating_key": "153036", - "parent_thumb": "/library/metadata/153036/thumb/1462175062", - "parent_title": "", - "platform": "Chrome", - "player": "Plex Web (Chrome)", - "progress_percent": "0", - "rating_key": "153037", - "section_id": "2", - "session_key": "291", - "state": "playing", - "throttled": "1", - "thumb": "/library/metadata/153037/thumb/1462175060", - "title": "The Red Woman", - "transcode_audio_channels": "2", - "transcode_audio_codec": "aac", - "transcode_container": "mkv", - "transcode_height": "1078", - "transcode_key": "tiv5p524wcupe8nxegc26s9k9", - "transcode_progress": 2, - "transcode_protocol": "http", - "transcode_speed": "0.0", - "transcode_video_codec": "h264", - "transcode_width": "1920", - "user": "DanyKhaleesi69", - "user_id": 8008135, - "user_thumb": "https://plex.tv/users/568gwwoib5t98a3a/avatar", - "video_codec": "h264", - "video_decision": "copy", - "video_framerate": "24p", - "video_resolution": "1080", - "view_offset": "", - "width": "1920", - "year": "2016" - }, - {...}, - {...} - ] + {"lan_bandwidth": 25318, + "sessions": [ + { + "actors": [ + "Kit Harington", + "Emilia Clarke", + "Isaac Hempstead-Wright", + "Maisie Williams", + "Liam Cunningham", + ], + "added_at": "1461572396", + "allow_guest": 1, + "art": "/library/metadata/1219/art/1503306930", + "aspect_ratio": "1.78", + "audience_rating": "", + "audio_bitrate": "384", + "audio_bitrate_mode": "", + "audio_channel_layout": "5.1(side)", + "audio_channels": "6", + "audio_codec": "ac3", + "audio_decision": "direct play", + "audio_language": "", + "audio_language_code": "", + "audio_profile": "", + "audio_sample_rate": "48000", + "bandwidth": "25318", + "banner": "/library/metadata/1219/banner/1503306930", + "bif_thumb": "/library/parts/274169/indexes/sd/1000", + "bitrate": "10617", + "channel_stream": 0, + "collections": [], + "container": "mkv", + "content_rating": "TV-MA", + "deleted_user": 0, + "device": "Windows", + "directors": [ + "Jeremy Podeswa" + ], + "do_notify": 0, + "duration": "2998272", + "email": "Jon.Snow.1337@CastleBlack.com", + "file": "/media/TV Shows/Game of Thrones/Season 06/Game of Thrones - S06E01 - The Red Woman.mkv", + "file_size": "3979115377", + "friendly_name": "Jon Snow", + "full_title": "Game of Thrones - The Red Woman", + "genres": [ + "Adventure", + "Drama", + "Fantasy" + ], + "grandparent_rating_key": "1219", + "grandparent_thumb": "/library/metadata/1219/thumb/1503306930", + "grandparent_title": "Game of Thrones", + "guid": "com.plexapp.agents.thetvdb://121361/6/1?lang=en", + "height": "1078", + "id": "", + "indexes": 1, + "ip_address": "10.10.10.1", + "ip_address_public": "64.123.23.111", + "is_admin": 1, + "is_allow_sync": null, + "is_home_user": 1, + "is_restricted": 0, + "keep_history": 1, + "labels": [], + "last_viewed_at": "1462165717", + "library_name": "TV Shows", + "local": "1", + "location": "lan", + "machine_id": "lmd93nkn12k29j2lnm", + "media_index": "1", + "media_type": "episode", + "optimized_version": 0, + "optimized_version_profile": "", + "optimized_version_title": "", + "originally_available_at": "2016-04-24", + "parent_media_index": "6", + "parent_rating_key": "153036", + "parent_thumb": "/library/metadata/153036/thumb/1503889210", + "parent_title": "Season 6", + "platform": "Plex Media Player", + "platform_name": "plex", + "platform_version": "2.4.1.787-54a020cd", + "player": "Castle-PC", + "product": "Plex Media Player", + "product_version": "3.35.2", + "profile": "Konvergo", + "progress_percent": "0", + "quality_profile": "Original", + "rating": "7.8", + "rating_key": "153037", + "section_id": "2", + "session_id": "helf15l3rxgw01xxe0jf3l3d", + "session_key": "27", + "shared_libraries": [ + "10", + "1", + "4", + "5", + "15", + "20", + "2" + ], + "sort_title": "Red Woman", + "state": "playing", + "stream_aspect_ratio": "1.78", + "stream_audio_bitrate": "384", + "stream_audio_bitrate_mode": "", + "stream_audio_channel_layout": "5.1(side)", + "stream_audio_channel_layout_": "5.1(side)", + "stream_audio_channels": "6", + "stream_audio_codec": "ac3", + "stream_audio_decision": "direct play", + "stream_audio_language": "", + "stream_audio_language_code": "", + "stream_audio_sample_rate": "48000", + "stream_bitrate": "10617", + "stream_container": "mkv", + "stream_container_decision": "direct play", + "stream_duration": "2998272", + "stream_subtitle_codec": "", + "stream_subtitle_container": "", + "stream_subtitle_decision": "", + "stream_subtitle_forced": 0, + "stream_subtitle_format": "", + "stream_subtitle_language": "", + "stream_subtitle_language_code": "", + "stream_subtitle_location": "", + "stream_video_bit_depth": "8", + "stream_video_bitrate": "10233", + "stream_video_codec": "h264", + "stream_video_codec_level": "41", + "stream_video_decision": "direct play", + "stream_video_framerate": "24p", + "stream_video_height": "1078", + "stream_video_language": "", + "stream_video_language_code": "", + "stream_video_ref_frames": "4", + "stream_video_resolution": "1080", + "stream_video_width": "1920", + "studio": "HBO", + "subtitle_codec": "", + "subtitle_container": "", + "subtitle_decision": "", + "subtitle_forced": 0, + "subtitle_format": "", + "subtitle_language": "", + "subtitle_language_code": "", + "subtitle_location": "", + "subtitles": 0, + "summary": "Jon Snow is dead. Daenerys meets a strong man. Cersei sees her daughter again.", + "synced_version": 0, + "synced_version_profile": "", + "tagline": "", + "throttled": "0", + "thumb": "/library/metadata/153037/thumb/1503889207", + "title": "The Red Woman", + "transcode_audio_channels": "", + "transcode_audio_codec": "", + "transcode_container": "", + "transcode_decision": "direct play", + "transcode_height": "", + "transcode_hw_decode": "", + "transcode_hw_decode_title": "", + "transcode_hw_decoding": 0, + "transcode_hw_encode": "", + "transcode_hw_encode_title": "", + "transcode_hw_encoding": 0, + "transcode_hw_full_pipeline": 0, + "transcode_hw_requested": 0, + "transcode_key": "", + "transcode_progress": 0, + "transcode_protocol": "", + "transcode_speed": "", + "transcode_throttled": 0, + "transcode_video_codec": "", + "transcode_width": "", + "type": "", + "updated_at": "1503889207", + "user": "LordCommanderSnow", + "user_id": 133788, + "user_rating": "", + "user_thumb": "https://plex.tv/users/k10w42309cynaopq/avatar", + "username": "LordCommanderSnow", + "video_bit_depth": "8", + "video_bitrate": "10233", + "video_codec": "h264", + "video_codec_level": "41", + "video_decision": "direct play", + "video_frame_rate": "23.976", + "video_framerate": "24p", + "video_height": "1078", + "video_language": "", + "video_language_code": "", + "video_profile": "high", + "video_ref_frames": "4", + "video_resolution": "1080", + "video_width": "1920", + "view_offset": "1000", + "width": "1920", + "writers": [ + "David Benioff", + "D. B. Weiss" + ], + "year": "2016" + } + ], + "stream_count": "1", + "stream_count_direct_play": 1, + "stream_count_direct_stream": 0, + "stream_count_transcode": 0, + "total_bandwidth": 25318, + "wan_bandwidth": 0 } ``` """ @@ -4585,27 +4810,29 @@ class WebInterface(object): Returns: json: - [{"content_type": "video", + [{"audio_bitrate": "192", + "client_id": "95434se643fsf24f-com-plexapp-android", + "content_type": "video", "device_name": "Tyrion's iPad", "failure": "", - "friendly_name": "Tyrion Lannister", - "item_complete_count": "0", + "item_complete_count": "1", "item_count": "1", - "item_downloaded_count": "0", - "item_downloaded_percent_complete": 0, + "item_downloaded_count": "1", + "item_downloaded_percent_complete": 100, "metadata_type": "movie", - "music_bitrate": "192", "photo_quality": "74", "platform": "iOS", "rating_key": "154092", - "root_title": "Deadpool", - "state": "pending", + "root_title": "Movies", + "state": "complete", "sync_id": "11617019", - "title": "Deadpool", - "total_size": "0", + "sync_title": "Deadpool", + "total_size": "560718134", + "user": "DrukenDwarfMan", "user_id": "696969", "username": "DrukenDwarfMan", - "video_quality": "60" + "video_bitrate": "4000" + "video_quality": "100" }, {...}, {...}