mirror of
https://github.com/pkkid/python-plexapi
synced 2024-11-22 03:33:08 +00:00
Prefix all tools with plex- allows us to add this directory to bin and still find them with tab complete
This commit is contained in:
parent
24f3e640e6
commit
fe68c8f590
7 changed files with 89 additions and 72 deletions
|
@ -1,8 +1,5 @@
|
|||
General Settings
|
||||
~~~~~~~~~~~~~~~~
|
||||
**butlerTaskCheckForUpdates (bool)**
|
||||
Automatically check for updates. (default: True)
|
||||
|
||||
----------------
|
||||
**butlerUpdateChannel (text)**
|
||||
Update Channel. (default: 16; choices: 16:Public|8:Plex Pass)
|
||||
|
||||
|
@ -23,7 +20,7 @@ General Settings
|
|||
|
||||
|
||||
Scheduled Task Settings
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
-----------------------
|
||||
**butlerDatabaseBackupPath (text)**
|
||||
Backup directory. The directory in which database backups are stored. (default: /var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-in Support/Databases)
|
||||
|
||||
|
@ -68,7 +65,7 @@ Scheduled Task Settings
|
|||
|
||||
|
||||
Channels Settings
|
||||
~~~~~~~~~~~~~~~~~
|
||||
-----------------
|
||||
**disableCapabilityChecking (bool)**
|
||||
Disable capability checking. Capability checking ensures that plug-ins that are incompatible with this version of the server or the current client application you are using are hidden. Disabling capability checking is useful during development, but will enable access to plug-ins that may perform unreliably with certain client applications.
|
||||
|
||||
|
@ -83,7 +80,7 @@ Channels Settings
|
|||
|
||||
|
||||
DLNA Settings
|
||||
~~~~~~~~~~~~~
|
||||
-------------
|
||||
**dlnaAnnouncementLeaseTime (int)**
|
||||
DLNA server announcement lease time. Duration in seconds of DLNA Server SSDP announcement lease time. (default: 1800)
|
||||
|
||||
|
@ -110,7 +107,7 @@ DLNA Settings
|
|||
|
||||
|
||||
Extras Settings
|
||||
~~~~~~~~~~~~~~~
|
||||
---------------
|
||||
**cinemaTrailersFromBluRay (bool)**
|
||||
Include Cinema Trailers from new and upcoming movies on Blu-ray. This feature is Plex Pass only.
|
||||
|
||||
|
@ -128,9 +125,9 @@ Extras Settings
|
|||
|
||||
|
||||
Library Settings
|
||||
~~~~~~~~~~~~~~~~
|
||||
----------------
|
||||
**allowMediaDeletion (bool)**
|
||||
Allow media deletion. The owner of the server will be allowed to delete media files from disk.
|
||||
Allow media deletion. The owner of the server will be allowed to delete media files from disk. (default: True)
|
||||
|
||||
**autoEmptyTrash (bool)**
|
||||
Empty trash automatically after every scan. (default: True)
|
||||
|
@ -164,7 +161,7 @@ Library Settings
|
|||
|
||||
|
||||
Network Settings
|
||||
~~~~~~~~~~~~~~~~
|
||||
----------------
|
||||
**allowedNetworks (text)**
|
||||
List of IP addresses and networks that are allowed without auth. Comma separated list of IP addresses or IP/netmask entries for networks that are allowed to access Plex Media Server without logging in. When the server is signed out and this value is set, only localhost and addresses on this list will be allowed.
|
||||
|
||||
|
@ -206,7 +203,7 @@ Network Settings
|
|||
|
||||
|
||||
Transcoder Settings
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
-------------------
|
||||
**hardwareAcceleratedCodecs (bool)**
|
||||
Use hardware acceleration when available (Experimental). Plex Media Server will attempt to use hardware-accelerated video codecs when encoding and decoding video. Hardware acceleration can make transcoding faster and allow more simultaneous video transcodes, but it can also reduce video quality and compatibility.
|
||||
|
||||
|
@ -236,7 +233,7 @@ Transcoder Settings
|
|||
|
||||
|
||||
Misc Settings
|
||||
~~~~~~~~~~~~~
|
||||
-------------
|
||||
**acceptedEULA (bool)**
|
||||
Has the user accepted the EULA.
|
||||
|
||||
|
@ -266,14 +263,17 @@ Misc Settings
|
|||
|
||||
|
||||
Undocumented Settings
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
---------------------
|
||||
* **aBRKeepOldTranscodes (bool)**
|
||||
* **allowHighOutputBitrates (bool)**
|
||||
* **backgroundQueueIdlePaused (bool)**
|
||||
* **butlerTaskGenerateMediaIndexFiles (bool)**
|
||||
* **certificateVersion (int)**: default: 2
|
||||
* **disableHlsAuthorization (bool)**
|
||||
* **dvrShowUnsupportedDevices (bool)**
|
||||
* **enableABRDebugOverlay (bool)**
|
||||
* **enableAirplay (bool)**
|
||||
* **eyeQUser (text)**
|
||||
* **forceAutoAdjustQuality (bool)**
|
||||
* **generateIndexFilesDuringAnalysis (bool)**
|
||||
* **gracenoteUser (text)**
|
||||
* **hardwareDevicePath (text)**: default: /dev/dri/renderD128
|
||||
|
@ -291,5 +291,6 @@ Undocumented Settings
|
|||
* **transcoderH264Options (text)**
|
||||
* **transcoderH264OptionsOverride (text)**
|
||||
* **transcoderH264Preset (text)**: default: veryfast
|
||||
* **transcoderLivePruneBuffer (int)**: default: 5400
|
||||
* **transcoderLogLevel (text)**: default: error
|
||||
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
This will find every item marked with the collection 'markwatched' and mark
|
||||
it watched. Just set run every so often in a scheduled task. This will only
|
||||
work for the user you connect to the PlexServer as.
|
||||
"""
|
||||
from plexapi.server import PlexServer
|
||||
|
||||
plex = PlexServer()
|
||||
for section in plex.library.sections():
|
||||
if section.type in ('movie', 'artist', 'show'):
|
||||
for item in section.search(collection='markwatched'):
|
||||
print('Marking %s watched.' % item.title)
|
||||
item.watched()
|
|
@ -1,9 +1,10 @@
|
|||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
This script loops through all media items to build a collection of attributes on
|
||||
each media type. The resulting list can be compared with the current object
|
||||
implementation in python-plex api to track new attributes and depricate old ones.
|
||||
Plex-ListAttrs is used during development of PlexAPI and loops through all media
|
||||
items to build a collection of attributes on each media type. The resulting list
|
||||
can be compared with the current object implementation in python-plexapi to track
|
||||
new attributes and depricate old ones.
|
||||
"""
|
||||
import argparse, copy, pickle, plexapi, os, re, sys, time
|
||||
from os.path import abspath, dirname, join
|
||||
|
@ -16,7 +17,7 @@ from plexapi.server import PlexServer
|
|||
from plexapi.playqueue import PlayQueue
|
||||
|
||||
CACHEPATH = join(dirname(abspath(__file__)), 'findattrs.pickle')
|
||||
NAMESPACE = {
|
||||
NAMESPACE = {
|
||||
'xml': defaultdict(int),
|
||||
'obj': defaultdict(int),
|
||||
'docs': defaultdict(int),
|
||||
|
@ -55,9 +56,10 @@ TAGATTRS = {
|
|||
'Country': 'countries',
|
||||
}
|
||||
STOP_RECURSING_AT = (
|
||||
#'media.MediaPart',
|
||||
# 'media.MediaPart',
|
||||
)
|
||||
|
||||
|
||||
class PlexAttributes():
|
||||
|
||||
def __init__(self, opts):
|
||||
|
@ -70,17 +72,17 @@ class PlexAttributes():
|
|||
|
||||
def run(self):
|
||||
starttime = time.time()
|
||||
# self._parse_myplex()
|
||||
# self._parse_server()
|
||||
# self._parse_search()
|
||||
# self._parse_library()
|
||||
self._parse_myplex()
|
||||
self._parse_server()
|
||||
self._parse_search()
|
||||
self._parse_library()
|
||||
self._parse_audio()
|
||||
# self._parse_photo()
|
||||
# self._parse_movie()
|
||||
# self._parse_show()
|
||||
# self._parse_client()
|
||||
# self._parse_playlist()
|
||||
# self._parse_sync()
|
||||
self._parse_photo()
|
||||
self._parse_movie()
|
||||
self._parse_show()
|
||||
self._parse_client()
|
||||
self._parse_playlist()
|
||||
self._parse_sync()
|
||||
self.runtime = round((time.time() - starttime) / 60.0, 1)
|
||||
return self
|
||||
|
||||
|
@ -106,7 +108,7 @@ class PlexAttributes():
|
|||
def _parse_library(self):
|
||||
cat = 'lib'
|
||||
self._load_attrs(self.plex.library, cat)
|
||||
#self._load_attrs(self.plex.library.all()[:50], 'all')
|
||||
# self._load_attrs(self.plex.library.all()[:50], 'all')
|
||||
self._load_attrs(self.plex.library.onDeck()[:50], 'deck')
|
||||
self._load_attrs(self.plex.library.recentlyAdded()[:50], 'add')
|
||||
for search in ('cat', 'dog', 'rat', 'gir', 'mou'):
|
||||
|
@ -248,7 +250,7 @@ class PlexAttributes():
|
|||
if self._clsname_match(clsname):
|
||||
meta = self.attrs[clsname]
|
||||
count = meta['total']
|
||||
print(_('\n%s (%s)\n%s' % (clsname, count, '-'*30), 'yellow'))
|
||||
print(_('\n%s (%s)\n%s' % (clsname, count, '-' * 30), 'yellow'))
|
||||
attrs = sorted(set(list(meta['xml'].keys()) + list(meta['obj'].keys())))
|
||||
for attr in attrs:
|
||||
state = self._attr_state(clsname, attr, meta)
|
||||
|
@ -257,7 +259,7 @@ class PlexAttributes():
|
|||
examples = '; '.join(list(meta['examples'].get(attr, ['--']))[:3])[:80]
|
||||
print('%7s %3s %-30s %-20s %s' % (count, state, attr, categories, examples))
|
||||
total_attrs += count
|
||||
print(_('\nSUMMARY\n%s' % ('-'*30), 'yellow'))
|
||||
print(_('\nSUMMARY\n%s' % ('-' * 30), 'yellow'))
|
||||
print('%7s %3s %3s %3s %-20s %s' % ('total', 'new', 'old', 'doc', 'categories', 'clsname'))
|
||||
for clsname in sorted(self.attrs.keys()):
|
||||
if self._clsname_match(clsname):
|
||||
|
@ -311,6 +313,7 @@ def _(text, color):
|
|||
|
||||
|
||||
if __name__ == '__main__':
|
||||
print(__doc__)
|
||||
parser = argparse.ArgumentParser(description='resize and copy starred photos')
|
||||
parser.add_argument('-f', '--force', default=False, action='store_true', help='force a full refresh of attributes.')
|
||||
parser.add_argument('-m', '--max', default=99999, help='max number of objects to load.')
|
|
@ -1,36 +1,38 @@
|
|||
from collections import OrderedDict
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Plex-ListDocAttrs is used during development of PlexAPI.
|
||||
Example usage: AttDS(dict or object).write()
|
||||
"""
|
||||
import re
|
||||
from collections import OrderedDict
|
||||
|
||||
|
||||
def type_finder(s):
|
||||
type_string = str(type(s))
|
||||
x = re.search("'(.+)'", type_string)
|
||||
if x:
|
||||
return x.group(1)
|
||||
|
||||
return ''
|
||||
|
||||
|
||||
class AttDS(object):
|
||||
"""Helper that prints docstring attrs"""
|
||||
""" Helper that prints docstring attrs. """
|
||||
|
||||
def __init__(self, o, keys=None, style='google'):
|
||||
self.__o = o
|
||||
|
||||
if not isinstance(o, dict):
|
||||
self.o = o.__dict__.items()
|
||||
self._as_dict = o.__dict__
|
||||
else:
|
||||
self.o = o.items()
|
||||
self._as_dict = o
|
||||
|
||||
if keys is None:
|
||||
self.keys = self._as_dict.keys()
|
||||
else:
|
||||
self.keys = keys
|
||||
|
||||
if style == 'google':
|
||||
self.template = '%s (%s): %s'
|
||||
|
||||
self.res_dict = OrderedDict()
|
||||
self.parse()
|
||||
|
||||
|
@ -42,12 +44,8 @@ class AttDS(object):
|
|||
ds += '%s=%s ' % (key, self._as_dict.get(key, ''))
|
||||
else:
|
||||
ds = ''
|
||||
|
||||
self.res_dict[k] = self.template % (k, type_finder(v), ds)
|
||||
|
||||
def write(self):
|
||||
for k, v in self.res_dict.items():
|
||||
print v
|
||||
|
||||
|
||||
#x = AttDS(dict or object).write()
|
||||
print(v)
|
|
@ -1,5 +1,10 @@
|
|||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Plex-ListSettings is used during development of PlexAPI and loops through available
|
||||
setting items and separates them by group as well as display the variable type. The
|
||||
resulting list is used for the creation of docs/settingslist.rst.
|
||||
"""
|
||||
from collections import defaultdict
|
||||
from os.path import abspath, dirname, join
|
||||
from plexapi import utils
|
||||
|
@ -17,8 +22,8 @@ def _setting_group(setting):
|
|||
|
||||
def _write_settings(handle, groups, group):
|
||||
title = GROUPNAMES.get(group, group.title())
|
||||
print('\n%s Settings\n%s' % (title, '~' * (len(title) + 9)))
|
||||
handle.write('%s Settings\n%s\n' % (title, '~' * (len(title) + 9)))
|
||||
print('\n%s Settings\n%s' % (title, '-' * (len(title) + 9)))
|
||||
handle.write('%s Settings\n%s\n' % (title, '-' * (len(title) + 9)))
|
||||
for setting in groups[group]:
|
||||
print(' %s (%s)' % (utils.lowerFirst(setting.id), setting.type))
|
||||
# Special case undocumented settings
|
||||
|
@ -66,4 +71,5 @@ def list_settings():
|
|||
|
||||
|
||||
if __name__ == '__main__':
|
||||
print(__doc__)
|
||||
list_settings()
|
|
@ -1,9 +1,17 @@
|
|||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Plex-ListTokens is a simple utility to fetch and list all known Plex
|
||||
Server tokens your plex.tv account has access to. Because this information
|
||||
comes from the plex.tv website, we need to ask for your username
|
||||
and password. Alternatively, if you do not wish to enter your login
|
||||
information below, you can retrieve the same information from plex.tv
|
||||
at the URL: https://plex.tv/api/resources?includeHttps=1
|
||||
"""
|
||||
from getpass import getpass
|
||||
from plexapi import utils
|
||||
from plexapi.exceptions import BadRequest
|
||||
from plexapi.myplex import MyPlexAccount, MyPlexResource, _connect
|
||||
from plexapi.myplex import MyPlexAccount, _connect
|
||||
from plexapi.server import PlexServer
|
||||
|
||||
FORMAT = ' %-17s %-25s %-20s %s'
|
||||
|
@ -51,14 +59,7 @@ def _test_servers(servers):
|
|||
|
||||
|
||||
if __name__ == '__main__':
|
||||
print('List Plex Tokens')
|
||||
print('----------------')
|
||||
print('This is a simple utility to fetch and list all known Plex Server')
|
||||
print('tokens your plex.tv account has access to. Because this information')
|
||||
print('comes from the plex.tv website, we need to ask for your username')
|
||||
print('and password. Alternatively, if you do not wish to enter your login')
|
||||
print('information below, you can retrieve the same information from plex.tv')
|
||||
print('directly at the URL: %s\n' % MyPlexResource.key)
|
||||
print(__doc__)
|
||||
username = input('What is your plex.tv username: ')
|
||||
password = getpass('What is your plex.tv password: ')
|
||||
try:
|
23
tools/plex-markwatched.py
Executable file
23
tools/plex-markwatched.py
Executable file
|
@ -0,0 +1,23 @@
|
|||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Plex-MarkWatched is a useful to always mark a show as watched. This comes in
|
||||
handy when you have a show you keep downloaded, but do not religiously watch
|
||||
every single episode that is downloaded. By marking everything watched, it
|
||||
will keep the show out of your OnDeck list inside Plex.
|
||||
|
||||
Usage:
|
||||
Intended usage is to add the tak 'markwatched' to any show you want to have
|
||||
this behaviour. Then simply add this script to run on a schedule and you
|
||||
should be all set.
|
||||
"""
|
||||
from plexapi.server import PlexServer
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
plex = PlexServer()
|
||||
for section in plex.library.sections():
|
||||
if section.type in ('movie', 'artist', 'show'):
|
||||
for item in section.search(collection='markwatched'):
|
||||
print('Marking %s watched.' % item.title)
|
||||
item.watched()
|
Loading…
Reference in a new issue