gather-scrobble


Namegather-scrobble JSON
Version 0.1.1 PyPI version JSON
download
home_pagehttps://github.com/pyanderson/gather-scrobble
SummaryGather Scrobble - Scrobble your last.fm or Spotify activity to the Gather status.
upload_time2024-07-27 17:17:49
maintainerNone
docs_urlNone
authorAnderson de Sousa Lima
requires_pythonNone
licenseMIT
keywords gather gather-town lastfm spotify scrobble
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            Gather Scrobble
===============

Inspired by
`gathertown/mod-spotify-as-status <https://github.com/gathertown/mod-spotify-as-status>`__.

Scrobble your ``last.fm`` or ``Spotify`` activity to the ``Gather``
status.

.. figure:: https://github.com/pyanderson/gather-scrobble/blob/main/images/gather-scrobble-at-terminal.gif
   :alt: gather-scrobble

   gather-scrobble

.. figure:: https://github.com/pyanderson/gather-scrobble/blob/main/images/gather-status.png
   :alt: gather-status

   gather-status

Installation
------------

.. code:: bash

   pip install gather-scrobble

As this library has a CLI, you may have permissions issues when
installing, so try it with the ``--user`` flag:

.. code:: bash

   pip install gather-scrobble --user

Documentation
-------------

Configuration
~~~~~~~~~~~~~

It’s necessary to configure the following credentials:

Gather Credentials
^^^^^^^^^^^^^^^^^^

Access `Gather API keis <https://app.gather.town/apikeys>`__ to get your
``API_KEY``.

last.fm Credentials
^^^^^^^^^^^^^^^^^^^

**If you will scrobble from last.fm.**

Create a `last.fm API
account <https://www.last.fm/api/account/create>`__ to get your
``API_KEY`` and ``API_SECRET``.

Spotify Credentials
^^^^^^^^^^^^^^^^^^^

**If you will scrobble from Spotify.**

Access your `Spotify account
dashboard <https://developer.spotify.com/dashboard/applications>`__ and
create a new app (in case you don’t have one or do not want to use an
existing one). And get your ``CLIENT_ID`` and ``CLIENT_SECRET``.

Also add a redirect URI in the ``Edit Settings``. Suggested value:
``http://127.0.0.1:9090``.

The spotispy will instantiate a server to receive the access token. More
info `here <https://spotipy.readthedocs.io/en/2.22.1/#redirect-uri>`__.

You can configure your credentials in 4 ways and with respective
priorities:

keyring (recommended)
^^^^^^^^^^^^^^^^^^^^^

.. code:: bash

   keyring set gather-scrobble GATHER_API_KEY
   keyring set gather-scrobble LASTFM_API_KEY
   keyring set gather-scrobble LASTFM_API_SECRET
   keyring set gather-scrobble LASTFM_USERNAME
   keyring set gather-scrobble SPOTIFY_CLIENT_ID
   keyring set gather-scrobble SPOTIFY_CLIENT_SECRET
   keyring set gather-scrobble SPOTIFY_CLIENT_REDIRECT_URI

environment variables
^^^^^^^^^^^^^^^^^^^^^

.. code:: bash

   export GATHER_API_KEY=<GATHER_API_KEY>
   export LASTFM_API_KEY=<LASTFM_API_KEY>
   export LASTFM_API_SECRET=<LASTFM_API_SECRET>
   export LASTFM_USERNAME=<LASTFM_USERNAME>
   export SPOTIFY_CLIENT_ID=<SPOTIFY_CLIENT_ID>
   export SPOTIFY_CLIENT_SECRET=<SPOTIFY_CLIENT_SECRET>
   export SPOTIFY_CLIENT_REDIRECT_URI=<SPOTIFY_CLIENT_REDIRECT_URI>

.ini file
^^^^^^^^^

.. code:: ini

   [settings]
   GATHER_API_KEY=<GATHER_API_KEY>
   LASTFM_API_KEY=<LASTFM_API_KEY>
   LASTFM_API_SECRET=<LASTFM_API_SECRET>
   LASTFM_USERNAME=<LASTFM_USERNAME>
   SPOTIFY_CLIENT_ID=<SPOTIFY_CLIENT_ID>
   SPOTIFY_CLIENT_SECRET=<SPOTIFY_CLIENT_SECRET>
   SPOTIFY_CLIENT_REDIRECT_URI=<SPOTIFY_CLIENT_REDIRECT_URI>

.env file
^^^^^^^^^

.. code:: dotenv

   GATHER_API_KEY=<GATHER_API_KEY>
   LASTFM_API_KEY=<LASTFM_API_KEY>
   LASTFM_API_SECRET=<LASTFM_API_SECRET>
   LASTFM_USERNAME=<LASTFM_USERNAME>
   SPOTIFY_CLIENT_ID=<SPOTIFY_CLIENT_ID>
   SPOTIFY_CLIENT_SECRET=<SPOTIFY_CLIENT_SECRET>
   SPOTIFY_CLIENT_REDIRECT_URI=<SPOTIFY_CLIENT_REDIRECT_URI>

Usage
~~~~~

Help
^^^^

.. code:: bash

   gather-scrobble --help
   Gather Scrobble v0.1.1
       Usage:
           gather-scrobble start <space_id> [--source SOURCE] [--emojis EMOJIS]
           gather-scrobble info
           gather-scrobble test <space_id>

       Arguments:
           <space_id>          Gather space id.

       Options:
           -h --help           Show this screen.
           -s --source SOURCE  Scrobble source, if not defined the tool will try
                               all available sources configured.
                               Can be: lastfm, spotify, or any.
                               If 'any' it will use the first source configured in
                               the priority: lastfm -> spotify [default: any]
           -e --emojis EMOJIS  It is possible to customize the emojis, by setting
                               the list of emojis that will be chosen randomly,
                               and also you don't like emojis, you can set an
                               empty string here. [default: πŸŽΌπŸŽ΅πŸŽΆπŸŽ§πŸ“»πŸŽ·πŸŽΈπŸŽΉ]
           -v --verbose        Enable verbose logging.

Info
^^^^

Before starting, check if you have configured the services:

.. code:: bash

   gather-scrobble info
   Gather Scrobble
   ┏━━━━━━━━━━━┳━━━━━━━━━━━━━━┓
   ┃ Service   ┃ Configured   ┃
   ┣━━━━━━━━━━━╋━━━━━━━━━━━━━━┫
   ┃ Gather    ┃ True         ┃
   ┣━━━━━━━━━━━╋━━━━━━━━━━━━━━┫
   ┃ last.fm   ┃ True         ┃
   ┣━━━━━━━━━━━╋━━━━━━━━━━━━━━┫
   ┃ Spotify   ┃ False        ┃
   ┗━━━━━━━━━━━┻━━━━━━━━━━━━━━┛

Test
^^^^

And test your configuration:

.. code:: bash

   gather-scrobble test "aAa0aAaAaaA0Aaaa/Name"
   Testing connection with Gather...
   Success
   Testing connection with last.fm...
   Success
   Testing connection with Spotify...
   Success

   ┏━━━━━━━━━━━┳━━━━━━━━━━━━┓
   ┃ Service   ┃ Working?   ┃
   ┣━━━━━━━━━━━╋━━━━━━━━━━━━┫
   ┃ Gather    ┃ True       ┃
   ┣━━━━━━━━━━━╋━━━━━━━━━━━━┫
   ┃ last.fm   ┃ True       ┃
   ┣━━━━━━━━━━━╋━━━━━━━━━━━━┫
   ┃ Spotify   ┃ True       ┃
   ┗━━━━━━━━━━━┻━━━━━━━━━━━━┛

Start
^^^^^

The first time you scrobble for any of the sources, the user will be
asked to authorize your application to access data from the respective
scrobble sources.

.. code:: bash

   gather-scrobble start "aAa0aAaAaaA0Aaaa/Name"
   🎸 - Evil Papagali - Massacration π„›π„™π„˜π„›π„™

Verbose
^^^^^^^

The ``start`` and ``test`` commands accept an optional flag ``-v`` or
``--verbose`` to show more detailed information about the execution:

.. code:: bash

   [2024-07-27 13:29:24,850][DEBUG] Loading credentials
   [2024-07-27 13:29:25,144][DEBUG] Starting application
   [2024-07-27 13:29:25,769][INFO] Connected to wss://ip-00-000-00-000.sa-east-1-a.prod.aws.gather.town:443/
   [2024-07-27 13:29:26,084][INFO] Connected as user a0000bC0DEFgjIjLmnoPqRSTuvxY
   [2024-07-27 13:29:26,085][DEBUG] Receiving messages
   [2024-07-27 13:29:26,086][DEBUG] Heartbeat sent
   [2024-07-27 13:29:26,086][DEBUG] Application started
   [2024-07-27 13:29:26,540][DEBUG] New Status: πŸ“» - Junior's Eyes - Black Sabbath
   [2024-07-27 13:29:26,639][DEBUG] Message received: events {
     transactionStatus {
       txnId: 2550000000
       succeeded: true
     }
   }
   events {
     transactionStatus {
       txnId: 900000000
       succeeded: true
     }
   }

   ^Cbye

Docker
------

Pull
~~~~

.. code:: bash

   docker pull pyanderson/gather-scrobble:0.1.1

Docker Configuration
~~~~~~~~~~~~~~~~~~~~

Keyring
^^^^^^^

The most common way to manage credentials in docker containers is
through environment variables, but in this case, you can still use
`keyring <https://github.com/jaraco/keyring>`__, through the third-party
`keyrings.cryptfile <https://github.com/frispete/keyrings.cryptfile>`__,
you will need to create a file with your credentials, mount a volume
with the file in the path
``/root/.local/share/python_keyring/cryptfile_pass.cfg`` and set the
``KEYRING_CRYPTFILE_PASSWORD`` environment variable with the password
that you used to create the file:

.. code:: bash

   docker run -v $(echo $HOME)/.local/share/python_keyring/cryptfile_pass.csg:/root/.local/share/python_keyring/cryptfile_pass.cfg -e KEYRING_CRYPTFILE_PASSWORD=secret_password ...

.. _env-file-1:

Env File
^^^^^^^^

Add your credentials to a .env file and use it with the –env-file
option:

.. code:: bash

   docker run --env-file /path/to/myfile.env ...

Cache
^^^^^

To avoid being asked to authorize the last.fm/Spotify application in
every usage, you should mount a volume to save the gather-scrobble cache
folder:

.. code:: bash

   docker run -v /path/to/the/host/cache/folder:/root/.config

Docker Usage
~~~~~~~~~~~~

The docker container works as an executable, so you can use the same CLI
command interface, for example, to test your configuration you can do
this:

.. code:: bash

   docker run --env-file /path/to/myfile.env -v /path/to/the/host/cache/folder:/root/.config -it pyanderson/gather-scrobble:0.1.1 test "aAa0aAaAaaA0Aaaa/Name"
   Testing connection with Gather...
   Success
   Testing connection with last.fm...
   Success
   Testing connection with Spotify...
   Success

   ┏━━━━━━━━━━━┳━━━━━━━━━━━━┓
   ┃ Service   ┃ Working?   ┃
   ┣━━━━━━━━━━━╋━━━━━━━━━━━━┫
   ┃ Gather    ┃ True       ┃
   ┣━━━━━━━━━━━╋━━━━━━━━━━━━┫
   ┃ last.fm   ┃ True       ┃
   ┣━━━━━━━━━━━╋━━━━━━━━━━━━┫
   ┃ Spotify   ┃ True       ┃
   ┗━━━━━━━━━━━┻━━━━━━━━━━━━┛

Examples
^^^^^^^^

Validate your credentials:

.. code:: bash

   docker run -it --rm --name gather-scrobble --env-file /path/to/myfile.env -v /path/to/the/host/cache/folder:/root/.config pyanderson/gather-scrobble:0.1.1 test "aAa0aAaAaaA0Aaaa/Name"
   Testing connection with Gather...
   Success
   Testing connection with last.fm...
   Please authorize this script to access your account: https://www.last.fm/api/auth/?api_key=<api_key>
   Success
   Testing connection with Spotify...
   Go to the following URL: https://accounts.spotify.com/authorize?client_id=<client_id>&response_type=code&redirect_uri=http%3A%2F%2F127.0.0.1%3A9090&scope=user-read-currently-playing+user-read-playback-state
   Enter the URL you were redirected to: http://127.0.0.1:9090/?code=<code>
   Success

   ┏━━━━━━━━━━━┳━━━━━━━━━━━━┓
   ┃ Service   ┃ Working?   ┃
   ┣━━━━━━━━━━━╋━━━━━━━━━━━━┫
   ┃ Gather    ┃ True       ┃
   ┣━━━━━━━━━━━╋━━━━━━━━━━━━┫
   ┃ last.fm   ┃ True       ┃
   ┣━━━━━━━━━━━╋━━━━━━━━━━━━┫
   ┃ Spotify   ┃ True       ┃
   ┗━━━━━━━━━━━┻━━━━━━━━━━━━┛

Run gather-scrobble in background:

.. code:: bash

   docker run -d --restart=always --name gather-scrobble --env-file /path/to/myfile.env -v /path/to/the/host/cache/folder:/root/.config pyanderson/gather-scrobble:0.1.1 start "aAa0aAaAaaA0Aaaa/Name"
   cbe4b6c916d8e7977788462a447b8a6c9e526f46f5c9b85d7be5f843e7fd80dc

Check the logs:

.. code:: bash

   docker logs -f gather-scrobble
   [2023-04-29 15:39:30,637][DEBUG] loading credentials
   [2023-04-29 15:39:31,427][DEBUG] starting application
   [2023-04-29 15:39:32,925][DEBUG] application started
   [2023-04-29 15:40:05,650][DEBUG] 🎼 - Madhouse - Anthrax

Stop:

.. code:: bash

   docker rm -r gather-scrobble
   gather-scrobble

Docker Compose
~~~~~~~~~~~~~~

Thanks to @chocoelho for the docker compose example.

compose.yaml:

.. code:: yaml

   services:
     main:
       image: "pyanderson/gather-scrobble:0.1.1"
       command: start $${GATHER_SPACE_ID} -v
       restart: always
       env_file:
         - .env
       volumes:
         - .cache:/root/.config/gather-scrobble

Validate the credentials:

.. code:: bash

   docker compose run --rm main test "aAa0aAaAaaA0Aaaa/Name"

Run in the detached mode:

.. code:: bash

   docker compose up -d service

Logs:

.. code:: bash

   docker compose logs service

FAQ
~~~

-  How to get the ``space_id`` value? First enter in the space you want
   to scrobble, the ``space_id`` will be in the URL after the ``/app/``.
   E.g., in the URL β€œhttps://app.gather.town/app/aAa0aAaAaaA0Aaaa/Name”
   the ``space_id`` is ``aAa0aAaAaaA0Aaaa/Name``.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/pyanderson/gather-scrobble",
    "name": "gather-scrobble",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "gather, gather-town, lastfm, spotify, scrobble",
    "author": "Anderson de Sousa Lima",
    "author_email": "hello@pyanderson.dev",
    "download_url": "https://files.pythonhosted.org/packages/32/39/51e20b87b5e9bf9aaef1c2ae8177a08c14b78ee30694981cdb7b2c37ae6a/gather-scrobble-0.1.1.tar.gz",
    "platform": null,
    "description": "Gather Scrobble\n===============\n\nInspired by\n`gathertown/mod-spotify-as-status <https://github.com/gathertown/mod-spotify-as-status>`__.\n\nScrobble your ``last.fm`` or ``Spotify`` activity to the ``Gather``\nstatus.\n\n.. figure:: https://github.com/pyanderson/gather-scrobble/blob/main/images/gather-scrobble-at-terminal.gif\n   :alt: gather-scrobble\n\n   gather-scrobble\n\n.. figure:: https://github.com/pyanderson/gather-scrobble/blob/main/images/gather-status.png\n   :alt: gather-status\n\n   gather-status\n\nInstallation\n------------\n\n.. code:: bash\n\n   pip install gather-scrobble\n\nAs this library has a CLI, you may have permissions issues when\ninstalling, so try it with the ``--user`` flag:\n\n.. code:: bash\n\n   pip install gather-scrobble --user\n\nDocumentation\n-------------\n\nConfiguration\n~~~~~~~~~~~~~\n\nIt\u2019s necessary to configure the following credentials:\n\nGather Credentials\n^^^^^^^^^^^^^^^^^^\n\nAccess `Gather API keis <https://app.gather.town/apikeys>`__ to get your\n``API_KEY``.\n\nlast.fm Credentials\n^^^^^^^^^^^^^^^^^^^\n\n**If you will scrobble from last.fm.**\n\nCreate a `last.fm API\naccount <https://www.last.fm/api/account/create>`__ to get your\n``API_KEY`` and ``API_SECRET``.\n\nSpotify Credentials\n^^^^^^^^^^^^^^^^^^^\n\n**If you will scrobble from Spotify.**\n\nAccess your `Spotify account\ndashboard <https://developer.spotify.com/dashboard/applications>`__ and\ncreate a new app (in case you don\u2019t have one or do not want to use an\nexisting one). And get your ``CLIENT_ID`` and ``CLIENT_SECRET``.\n\nAlso add a redirect URI in the ``Edit Settings``. Suggested value:\n``http://127.0.0.1:9090``.\n\nThe spotispy will instantiate a server to receive the access token. More\ninfo `here <https://spotipy.readthedocs.io/en/2.22.1/#redirect-uri>`__.\n\nYou can configure your credentials in 4 ways and with respective\npriorities:\n\nkeyring (recommended)\n^^^^^^^^^^^^^^^^^^^^^\n\n.. code:: bash\n\n   keyring set gather-scrobble GATHER_API_KEY\n   keyring set gather-scrobble LASTFM_API_KEY\n   keyring set gather-scrobble LASTFM_API_SECRET\n   keyring set gather-scrobble LASTFM_USERNAME\n   keyring set gather-scrobble SPOTIFY_CLIENT_ID\n   keyring set gather-scrobble SPOTIFY_CLIENT_SECRET\n   keyring set gather-scrobble SPOTIFY_CLIENT_REDIRECT_URI\n\nenvironment variables\n^^^^^^^^^^^^^^^^^^^^^\n\n.. code:: bash\n\n   export GATHER_API_KEY=<GATHER_API_KEY>\n   export LASTFM_API_KEY=<LASTFM_API_KEY>\n   export LASTFM_API_SECRET=<LASTFM_API_SECRET>\n   export LASTFM_USERNAME=<LASTFM_USERNAME>\n   export SPOTIFY_CLIENT_ID=<SPOTIFY_CLIENT_ID>\n   export SPOTIFY_CLIENT_SECRET=<SPOTIFY_CLIENT_SECRET>\n   export SPOTIFY_CLIENT_REDIRECT_URI=<SPOTIFY_CLIENT_REDIRECT_URI>\n\n.ini file\n^^^^^^^^^\n\n.. code:: ini\n\n   [settings]\n   GATHER_API_KEY=<GATHER_API_KEY>\n   LASTFM_API_KEY=<LASTFM_API_KEY>\n   LASTFM_API_SECRET=<LASTFM_API_SECRET>\n   LASTFM_USERNAME=<LASTFM_USERNAME>\n   SPOTIFY_CLIENT_ID=<SPOTIFY_CLIENT_ID>\n   SPOTIFY_CLIENT_SECRET=<SPOTIFY_CLIENT_SECRET>\n   SPOTIFY_CLIENT_REDIRECT_URI=<SPOTIFY_CLIENT_REDIRECT_URI>\n\n.env file\n^^^^^^^^^\n\n.. code:: dotenv\n\n   GATHER_API_KEY=<GATHER_API_KEY>\n   LASTFM_API_KEY=<LASTFM_API_KEY>\n   LASTFM_API_SECRET=<LASTFM_API_SECRET>\n   LASTFM_USERNAME=<LASTFM_USERNAME>\n   SPOTIFY_CLIENT_ID=<SPOTIFY_CLIENT_ID>\n   SPOTIFY_CLIENT_SECRET=<SPOTIFY_CLIENT_SECRET>\n   SPOTIFY_CLIENT_REDIRECT_URI=<SPOTIFY_CLIENT_REDIRECT_URI>\n\nUsage\n~~~~~\n\nHelp\n^^^^\n\n.. code:: bash\n\n   gather-scrobble --help\n   Gather Scrobble v0.1.1\n       Usage:\n           gather-scrobble start <space_id> [--source SOURCE] [--emojis EMOJIS]\n           gather-scrobble info\n           gather-scrobble test <space_id>\n\n       Arguments:\n           <space_id>          Gather space id.\n\n       Options:\n           -h --help           Show this screen.\n           -s --source SOURCE  Scrobble source, if not defined the tool will try\n                               all available sources configured.\n                               Can be: lastfm, spotify, or any.\n                               If 'any' it will use the first source configured in\n                               the priority: lastfm -> spotify [default: any]\n           -e --emojis EMOJIS  It is possible to customize the emojis, by setting\n                               the list of emojis that will be chosen randomly,\n                               and also you don't like emojis, you can set an\n                               empty string here. [default: \ud83c\udfbc\ud83c\udfb5\ud83c\udfb6\ud83c\udfa7\ud83d\udcfb\ud83c\udfb7\ud83c\udfb8\ud83c\udfb9]\n           -v --verbose        Enable verbose logging.\n\nInfo\n^^^^\n\nBefore starting, check if you have configured the services:\n\n.. code:: bash\n\n   gather-scrobble info\n   Gather Scrobble\n   \u250f\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2533\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n   \u2503 Service   \u2503 Configured   \u2503\n   \u2523\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u254b\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u252b\n   \u2503 Gather    \u2503 True         \u2503\n   \u2523\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u254b\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u252b\n   \u2503 last.fm   \u2503 True         \u2503\n   \u2523\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u254b\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u252b\n   \u2503 Spotify   \u2503 False        \u2503\n   \u2517\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u253b\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u251b\n\nTest\n^^^^\n\nAnd test your configuration:\n\n.. code:: bash\n\n   gather-scrobble test \"aAa0aAaAaaA0Aaaa/Name\"\n   Testing connection with Gather...\n   Success\n   Testing connection with last.fm...\n   Success\n   Testing connection with Spotify...\n   Success\n\n   \u250f\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2533\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n   \u2503 Service   \u2503 Working?   \u2503\n   \u2523\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u254b\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u252b\n   \u2503 Gather    \u2503 True       \u2503\n   \u2523\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u254b\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u252b\n   \u2503 last.fm   \u2503 True       \u2503\n   \u2523\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u254b\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u252b\n   \u2503 Spotify   \u2503 True       \u2503\n   \u2517\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u253b\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u251b\n\nStart\n^^^^^\n\nThe first time you scrobble for any of the sources, the user will be\nasked to authorize your application to access data from the respective\nscrobble sources.\n\n.. code:: bash\n\n   gather-scrobble start \"aAa0aAaAaaA0Aaaa/Name\"\n   \ud83c\udfb8 - Evil Papagali - Massacration \ud834\udd1b\ud834\udd19\ud834\udd18\ud834\udd1b\ud834\udd19\n\nVerbose\n^^^^^^^\n\nThe ``start`` and ``test`` commands accept an optional flag ``-v`` or\n``--verbose`` to show more detailed information about the execution:\n\n.. code:: bash\n\n   [2024-07-27 13:29:24,850][DEBUG] Loading credentials\n   [2024-07-27 13:29:25,144][DEBUG] Starting application\n   [2024-07-27 13:29:25,769][INFO] Connected to wss://ip-00-000-00-000.sa-east-1-a.prod.aws.gather.town:443/\n   [2024-07-27 13:29:26,084][INFO] Connected as user a0000bC0DEFgjIjLmnoPqRSTuvxY\n   [2024-07-27 13:29:26,085][DEBUG] Receiving messages\n   [2024-07-27 13:29:26,086][DEBUG] Heartbeat sent\n   [2024-07-27 13:29:26,086][DEBUG] Application started\n   [2024-07-27 13:29:26,540][DEBUG] New Status: \ud83d\udcfb - Junior's Eyes - Black Sabbath\n   [2024-07-27 13:29:26,639][DEBUG] Message received: events {\n     transactionStatus {\n       txnId: 2550000000\n       succeeded: true\n     }\n   }\n   events {\n     transactionStatus {\n       txnId: 900000000\n       succeeded: true\n     }\n   }\n\n   ^Cbye\n\nDocker\n------\n\nPull\n~~~~\n\n.. code:: bash\n\n   docker pull pyanderson/gather-scrobble:0.1.1\n\nDocker Configuration\n~~~~~~~~~~~~~~~~~~~~\n\nKeyring\n^^^^^^^\n\nThe most common way to manage credentials in docker containers is\nthrough environment variables, but in this case, you can still use\n`keyring <https://github.com/jaraco/keyring>`__, through the third-party\n`keyrings.cryptfile <https://github.com/frispete/keyrings.cryptfile>`__,\nyou will need to create a file with your credentials, mount a volume\nwith the file in the path\n``/root/.local/share/python_keyring/cryptfile_pass.cfg`` and set the\n``KEYRING_CRYPTFILE_PASSWORD`` environment variable with the password\nthat you used to create the file:\n\n.. code:: bash\n\n   docker run -v $(echo $HOME)/.local/share/python_keyring/cryptfile_pass.csg:/root/.local/share/python_keyring/cryptfile_pass.cfg -e KEYRING_CRYPTFILE_PASSWORD=secret_password ...\n\n.. _env-file-1:\n\nEnv File\n^^^^^^^^\n\nAdd your credentials to a .env file and use it with the \u2013env-file\noption:\n\n.. code:: bash\n\n   docker run --env-file /path/to/myfile.env ...\n\nCache\n^^^^^\n\nTo avoid being asked to authorize the last.fm/Spotify application in\nevery usage, you should mount a volume to save the gather-scrobble cache\nfolder:\n\n.. code:: bash\n\n   docker run -v /path/to/the/host/cache/folder:/root/.config\n\nDocker Usage\n~~~~~~~~~~~~\n\nThe docker container works as an executable, so you can use the same CLI\ncommand interface, for example, to test your configuration you can do\nthis:\n\n.. code:: bash\n\n   docker run --env-file /path/to/myfile.env -v /path/to/the/host/cache/folder:/root/.config -it pyanderson/gather-scrobble:0.1.1 test \"aAa0aAaAaaA0Aaaa/Name\"\n   Testing connection with Gather...\n   Success\n   Testing connection with last.fm...\n   Success\n   Testing connection with Spotify...\n   Success\n\n   \u250f\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2533\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n   \u2503 Service   \u2503 Working?   \u2503\n   \u2523\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u254b\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u252b\n   \u2503 Gather    \u2503 True       \u2503\n   \u2523\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u254b\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u252b\n   \u2503 last.fm   \u2503 True       \u2503\n   \u2523\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u254b\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u252b\n   \u2503 Spotify   \u2503 True       \u2503\n   \u2517\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u253b\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u251b\n\nExamples\n^^^^^^^^\n\nValidate your credentials:\n\n.. code:: bash\n\n   docker run -it --rm --name gather-scrobble --env-file /path/to/myfile.env -v /path/to/the/host/cache/folder:/root/.config pyanderson/gather-scrobble:0.1.1 test \"aAa0aAaAaaA0Aaaa/Name\"\n   Testing connection with Gather...\n   Success\n   Testing connection with last.fm...\n   Please authorize this script to access your account: https://www.last.fm/api/auth/?api_key=<api_key>\n   Success\n   Testing connection with Spotify...\n   Go to the following URL: https://accounts.spotify.com/authorize?client_id=<client_id>&response_type=code&redirect_uri=http%3A%2F%2F127.0.0.1%3A9090&scope=user-read-currently-playing+user-read-playback-state\n   Enter the URL you were redirected to: http://127.0.0.1:9090/?code=<code>\n   Success\n\n   \u250f\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2533\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n   \u2503 Service   \u2503 Working?   \u2503\n   \u2523\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u254b\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u252b\n   \u2503 Gather    \u2503 True       \u2503\n   \u2523\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u254b\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u252b\n   \u2503 last.fm   \u2503 True       \u2503\n   \u2523\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u254b\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u252b\n   \u2503 Spotify   \u2503 True       \u2503\n   \u2517\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u253b\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u251b\n\nRun gather-scrobble in background:\n\n.. code:: bash\n\n   docker run -d --restart=always --name gather-scrobble --env-file /path/to/myfile.env -v /path/to/the/host/cache/folder:/root/.config pyanderson/gather-scrobble:0.1.1 start \"aAa0aAaAaaA0Aaaa/Name\"\n   cbe4b6c916d8e7977788462a447b8a6c9e526f46f5c9b85d7be5f843e7fd80dc\n\nCheck the logs:\n\n.. code:: bash\n\n   docker logs -f gather-scrobble\n   [2023-04-29 15:39:30,637][DEBUG] loading credentials\n   [2023-04-29 15:39:31,427][DEBUG] starting application\n   [2023-04-29 15:39:32,925][DEBUG] application started\n   [2023-04-29 15:40:05,650][DEBUG] \ud83c\udfbc - Madhouse - Anthrax\n\nStop:\n\n.. code:: bash\n\n   docker rm -r gather-scrobble\n   gather-scrobble\n\nDocker Compose\n~~~~~~~~~~~~~~\n\nThanks to @chocoelho for the docker compose example.\n\ncompose.yaml:\n\n.. code:: yaml\n\n   services:\n     main:\n       image: \"pyanderson/gather-scrobble:0.1.1\"\n       command: start $${GATHER_SPACE_ID} -v\n       restart: always\n       env_file:\n         - .env\n       volumes:\n         - .cache:/root/.config/gather-scrobble\n\nValidate the credentials:\n\n.. code:: bash\n\n   docker compose run --rm main test \"aAa0aAaAaaA0Aaaa/Name\"\n\nRun in the detached mode:\n\n.. code:: bash\n\n   docker compose up -d service\n\nLogs:\n\n.. code:: bash\n\n   docker compose logs service\n\nFAQ\n~~~\n\n-  How to get the ``space_id`` value? First enter in the space you want\n   to scrobble, the ``space_id`` will be in the URL after the ``/app/``.\n   E.g., in the URL \u201chttps://app.gather.town/app/aAa0aAaAaaA0Aaaa/Name\u201d\n   the ``space_id`` is ``aAa0aAaAaaA0Aaaa/Name``.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Gather Scrobble - Scrobble your last.fm or Spotify activity to the Gather status.",
    "version": "0.1.1",
    "project_urls": {
        "Homepage": "https://github.com/pyanderson/gather-scrobble"
    },
    "split_keywords": [
        "gather",
        " gather-town",
        " lastfm",
        " spotify",
        " scrobble"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c934b4f4948dc8bcfb647f3a140bbeabddeb4eb42228cdf458186839c38a1d89",
                "md5": "8357fe192eaca5005c2874dbb066a394",
                "sha256": "3900f3a4b171e22407ac1773fed9d45aa193bc4333b7340ba08477594b67b500"
            },
            "downloads": -1,
            "filename": "gather_scrobble-0.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8357fe192eaca5005c2874dbb066a394",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 12363,
            "upload_time": "2024-07-27T17:17:48",
            "upload_time_iso_8601": "2024-07-27T17:17:48.416090Z",
            "url": "https://files.pythonhosted.org/packages/c9/34/b4f4948dc8bcfb647f3a140bbeabddeb4eb42228cdf458186839c38a1d89/gather_scrobble-0.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "323951e20b87b5e9bf9aaef1c2ae8177a08c14b78ee30694981cdb7b2c37ae6a",
                "md5": "e9c1b2cd48844c2f078c9be5289bfe6a",
                "sha256": "e6f0104e86f168cee3b9b6dac1395177d112a27d877ec98287bf060b594921c2"
            },
            "downloads": -1,
            "filename": "gather-scrobble-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "e9c1b2cd48844c2f078c9be5289bfe6a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 14817,
            "upload_time": "2024-07-27T17:17:49",
            "upload_time_iso_8601": "2024-07-27T17:17:49.899227Z",
            "url": "https://files.pythonhosted.org/packages/32/39/51e20b87b5e9bf9aaef1c2ae8177a08c14b78ee30694981cdb7b2c37ae6a/gather-scrobble-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-07-27 17:17:49",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "pyanderson",
    "github_project": "gather-scrobble",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "gather-scrobble"
}
        
Elapsed time: 0.32787s