Skip to main content

Last-Shout

PyPI - Version PyPI - Python Pre-Commit

A command line tool to toot a user's top artist statistics from Last.fm to Mastodon.

Installation

Installing the latest version from Github:

pipx install last-shout

Getting started

In order to use Last-Shout, you need at a minimum to get authentication keys for Last.fm and Mastodon.

Help

 usage: last-shout [-h] [-u USER] [--last-access-key LAST_ACCESS_KEY] [--set-lastfm] [-n NUMBER] [-p PERIOD] [-t] [--bluesky-handle BLUESKY_HANDLE] [--bluesky-password BLUESKY_PASSWORD] [--set-bluesky] [--create-mastodon-app]
                  [--create-mastodon-user] [--toot] [--skeet] [--version]

 A program to post last.fm statistics to Twitter and/or Mastodon.

 options:
  -h, --help            show this help message and exit
  -u, --user USER       Last.fm username (default: None)
  --last-access-key LAST_ACCESS_KEY
                        Last.fm access key (default: None)
  --set-lastfm          Set Last.fm credentials (default: False)
  -n, --number NUMBER   Number of last.fm top artists (default: 10)
  -p, --period PERIOD   The time period over which to retrieve top artists. Options are: overall | 7day | 1month | 3month | 6month | 12month (default: 7day)
  -t, --tweet           Post Last.fm stats to Twitter (default: False)
  --bluesky-handle BLUESKY_HANDLE
                        Bluesky handle (default: None)
  --bluesky-password BLUESKY_PASSWORD
                        Bluesky password (default: None)
  --set-bluesky         Set Bluesky credentials (default: False)
  --create-mastodon-app
                        Create mastodon application (default: False)
  --create-mastodon-user
                        Create Mastodon user token (default: False)
  --toot                Post Last.fm stats to Mastodon (default: False)
  --skeet               Post Last.fm stats to Bluesky (default: False)
  --version             Show the version number and exit

Set Systemd Timer

Once you've set your credentials in the application, most users will want it to run on regular intervals, and if you're running a Linux distribution with systemd you can set-up a timer to do that.

Start by a systemd unit file for it in ~/.config/systemd/user/last-shout-weekly.service

[Unit]
Description=Run weekly Last-Shout
After=network.target

[Service]
Type=oneshot
WorkingDirectory=%h
ExecStart=%h/.local/bin/last-shout --toot --skeet

[Install]
WantedBy=default.target

Now let's create a time for it in ~/.config/systemd/user/last-shout-weekly.timer:

[Unit]
Description=Start the Systemd service last-shout-weekly.service every Friday at 11:30

[Timer]
OnCalendar=Fri 11:30
Persistent=true

[Install]
WantedBy=timers.target

Then run the following to enable it:

systemctl --user enable --now last-shout-weekly.timer

Then reload the user daemon:

systemctl --user daemon-reload

Now run the following to verify the timer is enabled by running:

systemctl --user list-timers

If everything is alright you should see output similar to this:

bpepple@faramir:~$ systemctl --user list-timers
NEXT                          LEFT LAST                              PASSED UNIT                         ACTIVATES                     
Tue 2025-01-28 16:53:50 EST    23h Mon 2025-01-27 16:53:50 EST 4min 21s ago systemd-tmpfiles-clean.timer systemd-tmpfiles-clean.service
Fri 2025-01-31 11:30:00 EST 3 days Fri 2025-01-24 11:30:06 EST            - last-shout-weekly.timer      last-shout-weekly.service
-                                - Mon 2025-01-27 16:50:50 EST     7min ago grub-boot-success.timer      grub-boot-success.service

3 timers listed.

Now run the following to make sure the user timer can run even if they aren't logged in when the timer is ran:

sudo loginctl enable-linger username

To verify that the setting has been applied, check for a file with the same name as the user in the /var/lib/systemd/linger directory.

Metadata

Release files for last-shout 0.10.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for last-shout 0.10.2
File Size Uploaded Provenance Actions
last_shout-0.10.2.tar.gz 27.1 kB Without provenance Details for last_shout-0.10.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for last-shout 0.10.2
File Interpreter ABI Platform Actions
last_shout-0.10.2-py3-none-any.whl Python 3 none any Details for last_shout-0.10.2-py3-none-any.whl

Total release size: 54.6 kB

Release files / last_shout-0.10.2.tar.gz

Download URL last_shout-0.10.2.tar.gz
Size 27.1 kB
Tags Source
SHA-256 checksum
How to use checksums
b5285172ea1306f0abf58efb94a3c21ebeaea47b9dc52beaf7d648c1ab71ceb3
BLAKE2b-256 checksum
How to use checksums
a205e536290f86247a1fe880247c9ad3adcdc852162ef9a7c68f75ff2c9d4fc1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / last_shout-0.10.2-py3-none-any.whl

Download URL last_shout-0.10.2-py3-none-any.whl
Size 27.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3e12ca302fe3750273709822261d6daf8a6da297710e70b78c2020f398cd9729
BLAKE2b-256 checksum
How to use checksums
f8cbbdcef8d9a0e1f1710cb19c2a57dfd8cb026e2b0d78b3bbd3ccefaea11e2f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for last-shout 0.10.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page