当前位置: 首页>>代码示例>>Python>>正文


Python myplex.MyPlexAccount方法代码示例

本文整理汇总了Python中plexapi.myplex.MyPlexAccount方法的典型用法代码示例。如果您正苦于以下问题:Python myplex.MyPlexAccount方法的具体用法?Python myplex.MyPlexAccount怎么用?Python myplex.MyPlexAccount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在plexapi.myplex的用法示例。


在下文中一共展示了myplex.MyPlexAccount方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from plexapi import myplex [as 别名]
# 或者: from plexapi.myplex import MyPlexAccount [as 别名]
def __init__(self, server, username, password, *args, **kwargs):
        """
        :param server: Plex server name
        :type server: str

        :param username: Plex username
        :type username: str

        :param password: Plex password
        :type username: str
        """

        from plexapi.myplex import MyPlexAccount
        super().__init__(*args, **kwargs)

        self.resource = MyPlexAccount(username, password).resource(server)
        self._plex = None 
开发者ID:BlackLight,项目名称:platypush,代码行数:19,代码来源:plex.py

示例2: getMyPlexAccount

# 需要导入模块: from plexapi import myplex [as 别名]
# 或者: from plexapi.myplex import MyPlexAccount [as 别名]
def getMyPlexAccount(opts=None):  # pragma: no cover
    """ Helper function tries to get a MyPlex Account instance by checking
        the the following locations for a username and password. This is
        useful to create user-friendly command line tools.
        1. command-line options (opts).
        2. environment variables and config.ini
        3. Prompt on the command line.
    """
    from plexapi import CONFIG
    from plexapi.myplex import MyPlexAccount
    # 1. Check command-line options
    if opts and opts.username and opts.password:
        print('Authenticating with Plex.tv as %s..' % opts.username)
        return MyPlexAccount(opts.username, opts.password)
    # 2. Check Plexconfig (environment variables and config.ini)
    config_username = CONFIG.get('auth.myplex_username')
    config_password = CONFIG.get('auth.myplex_password')
    if config_username and config_password:
        print('Authenticating with Plex.tv as %s..' % config_username)
        return MyPlexAccount(config_username, config_password)
    # 3. Prompt for username and password on the command line
    username = input('What is your plex.tv username: ')
    password = getpass('What is your plex.tv password: ')
    print('Authenticating with Plex.tv as %s..' % username)
    return MyPlexAccount(username, password) 
开发者ID:pkkid,项目名称:python-plexapi,代码行数:27,代码来源:utils.py

示例3: get_account

# 需要导入模块: from plexapi import myplex [as 别名]
# 或者: from plexapi.myplex import MyPlexAccount [as 别名]
def get_account(self):
        username = input("Plex Username: ")
        password = getpass.getpass()

        return MyPlexAccount(username, password) 
开发者ID:alex-phillips,项目名称:plex-autocollections,代码行数:7,代码来源:main.py

示例4: build_config

# 需要导入模块: from plexapi import myplex [as 别名]
# 或者: from plexapi.myplex import MyPlexAccount [as 别名]
def build_config():
    if not os.path.exists(config_path):
        print("Dumping default config to: %s" % config_path)

        configs = dict(url='', token='', auto_delete=False)

        # Get URL
        configs['url'] = input("Plex Server URL: ")

        # Get Credentials for plex.tv
        user = input("Plex Username: ")
        password = getpass('Plex Password: ')

        # Get choice for Auto Deletion
        auto_del = input("Auto Delete duplicates? [y/n]: ")
        while auto_del.strip().lower() not in ['y', 'n']:
            auto_del = input("Auto Delete duplicates? [y/n]: ")
            if auto_del.strip().lower() == 'y':
                configs['auto_delete'] = True
            elif auto_del.strip().lower() == 'n':
                configs['auto_delete'] = False

        account = MyPlexAccount(user, password)
        configs['token'] = account.authenticationToken

        with open(config_path, 'w') as fp:
            json.dump(prefilled_default_config(configs), fp, sort_keys=True, indent=2)

        return True

    else:
        return False 
开发者ID:l3uddz,项目名称:plex_dupefinder,代码行数:34,代码来源:config.py

示例5: myPlexAccount

# 需要导入模块: from plexapi import myplex [as 别名]
# 或者: from plexapi.myplex import MyPlexAccount [as 别名]
def myPlexAccount(self):
        """ Returns a :class:`~plexapi.myplex.MyPlexAccount` object using the same
            token to access this server. If you are not the owner of this PlexServer
            you're likley to recieve an authentication error calling this.
        """
        if self._myPlexAccount is None:
            from plexapi.myplex import MyPlexAccount
            self._myPlexAccount = MyPlexAccount(token=self._token)
        return self._myPlexAccount 
开发者ID:pkkid,项目名称:python-plexapi,代码行数:11,代码来源:server.py

示例6: sync

# 需要导入模块: from plexapi import myplex [as 别名]
# 或者: from plexapi.myplex import MyPlexAccount [as 别名]
def sync(self, videoQuality, limit=None, unwatched=False, **kwargs):
        """ Add current Movie library section as sync item for specified device.
            See description of :func:`plexapi.library.LibrarySection.search()` for details about filtering / sorting and
            :func:`plexapi.library.LibrarySection.sync()` for details on syncing libraries and possible exceptions.

            Parameters:
                videoQuality (int): idx of quality of the video, one of VIDEO_QUALITY_* values defined in
                                    :mod:`plexapi.sync` module.
                limit (int): maximum count of movies to sync, unlimited if `None`.
                unwatched (bool): if `True` watched videos wouldn't be synced.

            Returns:
                :class:`plexapi.sync.SyncItem`: an instance of created syncItem.

            Example:

                .. code-block:: python

                    from plexapi import myplex
                    from plexapi.sync import VIDEO_QUALITY_3_MBPS_720p

                    c = myplex.MyPlexAccount()
                    target = c.device('Plex Client')
                    sync_items_wd = c.syncItems(target.clientIdentifier)
                    srv = c.resource('Server Name').connect()
                    section = srv.library.section('Movies')
                    section.sync(VIDEO_QUALITY_3_MBPS_720p, client=target, limit=1, unwatched=True,
                                 title='Next best movie', sort='rating:desc')

        """
        from plexapi.sync import Policy, MediaSettings
        kwargs['mediaSettings'] = MediaSettings.createVideo(videoQuality)
        kwargs['policy'] = Policy.create(limit, unwatched)
        return super(MovieSection, self).sync(**kwargs) 
开发者ID:pkkid,项目名称:python-plexapi,代码行数:36,代码来源:library.py

示例7: get_account

# 需要导入模块: from plexapi import myplex [as 别名]
# 或者: from plexapi.myplex import MyPlexAccount [as 别名]
def get_account():
    return MyPlexAccount() 
开发者ID:pkkid,项目名称:python-plexapi,代码行数:4,代码来源:conftest.py

示例8: mocked_account

# 需要导入模块: from plexapi import myplex [as 别名]
# 或者: from plexapi.myplex import MyPlexAccount [as 别名]
def mocked_account(requests_mock):
    requests_mock.get("https://plex.tv/users/account", text=ACCOUNT_XML)
    return MyPlexAccount(token="faketoken") 
开发者ID:pkkid,项目名称:python-plexapi,代码行数:5,代码来源:conftest.py

示例9: __init__

# 需要导入模块: from plexapi import myplex [as 别名]
# 或者: from plexapi.myplex import MyPlexAccount [as 别名]
def __init__(self, opts):
        self.opts = opts                                            # command line options
        self.clsnames = [c for c in opts.clsnames.split(',') if c]  # list of clsnames to report (blank=all)
        self.account = MyPlexAccount()                              # MyPlexAccount instance
        self.plex = PlexServer()                                    # PlexServer instance
        self.total = 0                                              # Total objects parsed
        self.attrs = defaultdict(dict)                              # Attrs result set 
开发者ID:pkkid,项目名称:python-plexapi,代码行数:9,代码来源:plex-listattrs.py

示例10: get_plex_account

# 需要导入模块: from plexapi import myplex [as 别名]
# 或者: from plexapi.myplex import MyPlexAccount [as 别名]
def get_plex_account(opts):
    """ Authenitcate with Plex using the command line options. """
    if not opts.unclaimed:
        if opts.token:
            return MyPlexAccount(token=opts.token)
        return plexapi.utils.getMyPlexAccount(opts)
    return None 
开发者ID:pkkid,项目名称:python-plexapi,代码行数:9,代码来源:plex-bootstraptest.py


注:本文中的plexapi.myplex.MyPlexAccount方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。