semvec/pypi-packages huggingface dataset:
django-simple-settings 0.3.1
A very simple settings configurable in Django Admin Panel.
License: MIT License

======================
Django Simple Settings
======================

Supported types: bool, float, int, str.

.. image:: https://badge.fury.io/py/django-simple-settings.png
   :target: http://badge.fury.io/py/django-simple-settings

.. image:: https://api.travis-ci.org/alikus/django-simple-settings.png
   :target: https://travis-ci.org/alikus/django-simple-settings

.. image:: https://coveralls.io/repos/alikus/django-simple-settings/badge.png?branch=master
    :target: https://coveralls.io/r/alikus/django-simple-settings?branch=master

Installation
------------

1. Install a package.

.. code-block:: bash

    $ pip install django-simple-settings

2. Add "simple_settings" to your INSTALLED_APPS setting:

.. code-block:: python

    INSTALLED_APPS = (
        ...
        'simple_settings',
    )

3. Add context processor if you would like:

.. code-block:: python

    TEMPLATE_CONTEXT_PROCESSORS = (
        '...',
        'simple_settings.context_processors.simple_settings',
    )

4. Create models:

.. code-block:: bash

    $ python manage.py migrate || python manage.py syncdb

Usage
-----

Get settings:

.. code-block:: python

    from simple_settings import settings

    print settings.get('is_feature_available')
    print settings.get('is_feature_available', default=False)
    print settings['is_feature_available']

Get all settings as dict:

.. code-block:: python

    print settings.all()

Get settings in template if you include context processor:

.. code-block:: html+django

    {{ simple_settings.is_feature_available }}

Set settings:

.. code-block:: python

    settings.set('is_feature_available', True)
    settings.set('pi', 3.14159265359)
    settings.set('answer', 42)
    settings.set('metallica', 'Yeah!')

Delete settings:

.. code-block:: python

    settings.delete('is_feature_available')

Settings
--------
Default application settings can be overriden in settings.py:

.. code-block:: python

    SIMPLE_SETTINGS_CACHE_TIMEOUT = 60 * 60 * 24 #  default cache timeout is one day
    SIMPLE_SETTINGS_CACHE_ALIAS = 'default' # default cache backend

Requirements
------------

* Python 2.6, 2.7, 3.3
* Django 1.3+
pympris 1.4
Library to control media players using MPRIS2 interfaces
License: MIT License
Keywords: mpris,dbus

pympris is a Python library used
to control media players using MPRIS2 interfaces.

Usage
=====

::

import gobject
import dbus
from dbus.mainloop.glib import DBusGMainLoop

import pympris

dbus_loop = DBusGMainLoop()
bus = dbus.SessionBus(mainloop=dbus_loop)

# get unique ids for all available players
players_ids = list(pympris.available_players())
mp = pympris.MediaPlayer(players_ids[1], bus)

# mp.root implements org.mpris.MediaPlayer2 interface
# mp.player implements org.mpris.MediaPlayer2.Player
# mp.track_list implements org.mpris.MediaPlayer2.TrackList
# mp.playlists implements org.mpris.MediaPlayer2.Playlists

# print player Identity
print mp.root.Identity

if mp.root.CanRaise:
    mp.root.Raise()

if mp.player.CanPlay and mp.player.CanPause:
    mp.player.PlayPause()

mp.player.Volume = mp.player.Volume*2

if mp.player.CanGoNext:
    mp.player.Next()

tracks = mp.track_list.Tracks
for track_id in tracks:
    print track_id

if len(tracks) > 1:
    mp.track_list.RemoveTrack(tracks[-1])
    mp.track_list.GoTo(tracks[0])

n = mp.playlists.PlaylistCount
ordering = pympris.PlaylistOrdering.LastPlayDate
playlists = mp.playlists.GetPlaylists(0, n, ordering, reversed=False)
pl_id, pl_name, pl_icon = playlists[-2]
mp.playlists.ActivatePlaylist(pl_id)

# setup signal handlers


def seeked(x):
    print(x)


def PlaylistChanged(arg):
    print "PlaylistChanged", arg


def TrackMetadataChanged(track_id, metadata):
    print "TrackMetadataChanged", track_id, metadata


def TrackListReplaced(tracks, current_track):
    print "TrackListReplaced", tracks, current_track


def TrackAdded(metadata, after_track):
    print "TrackAdded", metadata, after_track


def TrackRemoved(track_id):
    print "TrackRemoved", track_id


mp.player.register_signal_handler('Seeked', seeked)
mp.playlists.register_signal_handler('PlaylistChanged', PlaylistChanged)
mp.track_list.register_signal_handler('TrackMetadataChanged',
                                      TrackMetadataChanged)
mp.track_list.register_signal_handler('TrackListReplaced', TrackListReplaced)
mp.track_list.register_signal_handler('TrackAdded', TrackAdded)
mp.track_list.register_signal_handler('TrackRemoved', TrackRemoved)

loop = gobject.MainLoop()
loop.run()