GithubHelp home page GithubHelp logo

plexhaxx / dumbtools-for-plex Goto Github PK

View Code? Open in Web Editor NEW

This project forked from coryo/dumbtools-for-plex

0.0 2.0 0.0 13 KB

Addons for Plex Media Server channels. DumbKeyboard allows getting strings from the user via DirectoryObject's instead of InputDirectoryObjects. DumbPrefs replaces PrefsObject and allows changing preferences.

Python 100.00%

dumbtools-for-plex's Introduction

DumbKeyboard

This serves as a replacement for the InputDirectoryObject in the Plex Plug-in framework for clients that don't support it. It uses DirectoryObjects to build a query string, then lets you send that to the Search function. Search queries are saved in the channels Dict so they don't need to be re-entered.

img http://i.imgur.com/Q622vhM.png

Usage:

add DumbTools.py to Channel.bundle/Contents/Code.

in __init__.py add:

from DumbTools import DumbKeyboard

in __init__.py where you have an InputDirectoryObject:

if Client.Product in DumbKeyboard.clients:
        DumbKeyboard(PREFIX, oc, Search,
                dktitle = u'%s' L('search'),
                dkthumb = R(ICONS['search'])
        )
else:
        oc.add(InputDirectoryObject(
                key    = Callback(Search),
                title  = u'%s' L('search'),
                prompt = 'Search',
                thumb  = R(ICONS['search'])
        ))
        
@route(PREFIX + '/search')
def Search(query):
        ...

Definitions:

DumbKeyboard(prefix, oc, callback, dktitle=None, dkthumb=None, dkplaceholder=None, dksecure=False, **kwargs)

Appends a DirectoryObject to oc which will provide a series of DirectoryObjects to build a string. callback is called with the arguments query and **kwargs when the Submit directory is selected.

  • prefix: whatever is used in the @handler(PREFIX, NAME).
  • oc: the object container to add to.
  • callback: the Search function. This must have atleast 1 argument 'query'.
  • dktitle: (optional) the title to use for the search directoryObject.
  • dkthumb: (optional) the thumbnail to use for the search directoryObject.
  • dkplaceholder: (optional) set a default value in the text entry.
  • dksecure: (optional) set the entry to be secure or not (show *'s instead of the characters).
  • **kwargs: additional arguments to send to the callback function.
    • if you have search function Search(query, a=None, b=None) then you can use DumbKeyboard(prefix, oc, Search, a='something' b=123)

DumbKeyboard.clients - Client.Product's that don't have InputDirectoryObjects or don't always work correctly.

  • Plex for iOS
  • Plex Media Player
  • Plex Web

DumbPrefs

a replacement for the PrefsObject. This should allow both displaying and changing channel preferences using only DirectoryObjects.

http://i.imgur.com/fI65O87.png

It may require the following addition to Info.plist:

    <key>PlexPluginCodePolicy</key>
    <string>Elevated</string>

Usage:

from DumbTools import DumbPrefs

@handler(PREFIX, NAME)
def MainMenu():
        oc = ObjectContainer()
        
        if Client.Product in DumbPrefs.clients:
                DumbPrefs(PREFIX, oc,
                        title = L('preferences'),
                        thumb = R(ICONS['preferences']))
        else:
                oc.add(PrefsObject(
                        title = L('preferences'),
                        thumb = R(ICONS['preferences'])
                ))

Definitions:

DumbPrefs(prefix, oc, title=None, thumb=None)

Appends a DirectoryObject to oc which will allow users to change text, bool, and enum channel preferences.

  • prefix: whatever is used in the @handler(PREFIX, NAME).
  • oc: the object container to add to.
  • title: (optional) the title to use for the directoryObject.
  • thumb: (optional) the thumbnail to use for the directoryObject.

DumbPrefs.clients - Client.Product's that don't have Prefs or don't always work correctly.

  • 'Plex for iOS' - doesn't have it
  • 'Plex Media Player' - doesn't have it
  • 'Plex Home Theater' - has it, but it never liked saving text prefs
  • 'OpenPHT'
  • 'Plex for Roku' - I don't think it has it, I'm not sure if this is the correct product name.

dumbtools-for-plex's People

Contributors

coryo avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.