All Projects → pylast → Pylast

pylast / Pylast

Licence: apache-2.0
A Python interface to Last.fm and Libre.fm

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Pylast

Spotifycurrentlyplaying.js
Display your currently playing Spotify song(s) using Last.fm scrobbling.
Stars: ✭ 71 (-83.56%)
Mutual labels:  music, lastfm
Tauonmusicbox
The Linux desktop music player from the future! 🌆
Stars: ✭ 494 (+14.35%)
Mutual labels:  music, lastfm
Strawberry
🍓 Strawberry Music Player
Stars: ✭ 972 (+125%)
Mutual labels:  music, lastfm
Shazamscrobbler Macos
Last.fm scrobbler for the Shazam Mac app
Stars: ✭ 86 (-80.09%)
Mutual labels:  music, lastfm
Last Fm
Simple, robust LastFM API client (for public data)
Stars: ✭ 142 (-67.13%)
Mutual labels:  music, lastfm
Cloudtunes
Web-based music player for the cloud ☁️ 🎶 Play music from YouTube, Dropbox, etc.
Stars: ✭ 2,449 (+466.9%)
Mutual labels:  music, lastfm
Musaicfm
Screensaver inspired by Apple’s inbuilt iTunes Screensaver. It can display Artwork by Spotify or last.fm Profile Data.
Stars: ✭ 144 (-66.67%)
Mutual labels:  music, lastfm
Swift Radio Pro
Professional Radio Station App for iOS!
Stars: ✭ 2,644 (+512.04%)
Mutual labels:  music, lastfm
Alda
A music programming language for musicians. 🎶
Stars: ✭ 4,808 (+1012.96%)
Mutual labels:  music
Matchering
🎚️ Open Source Audio Matching and Mastering
Stars: ✭ 398 (-7.87%)
Mutual labels:  music
Supercolliderjs
The JavaScript client library for SuperCollider
Stars: ✭ 381 (-11.81%)
Mutual labels:  music
Warezz
It's illegal cuz they can't tax you!
Stars: ✭ 386 (-10.65%)
Mutual labels:  music
Lofi Player
🔥 Virtual room in your browser that lets you play with the Lo-Fi VIBE and relax
Stars: ✭ 404 (-6.48%)
Mutual labels:  music
Playpauseview
Let the play and pause button transition gracefully
Stars: ✭ 383 (-11.34%)
Mutual labels:  music
Bitmidi.com
🎹 Listen to free MIDI songs, download the best MIDI files, and share the best MIDIs on the web
Stars: ✭ 422 (-2.31%)
Mutual labels:  music
Midiwriterjs
♬ A JavaScript library which provides an API for programmatically generating and creating expressive multi-track MIDI files and JSON objects.
Stars: ✭ 381 (-11.81%)
Mutual labels:  music
Aplayer Typecho
在线音乐播放器插件 for typecho 1.0
Stars: ✭ 381 (-11.81%)
Mutual labels:  music
Music Player
Vue高仿网易云音乐(Vue入门实践)——在线预览 -- 暂时停止
Stars: ✭ 428 (-0.93%)
Mutual labels:  music
Sky31radio
湘潭大学三翼校园 "四季电台" Android 客户端
Stars: ✭ 422 (-2.31%)
Mutual labels:  music
Dx7 Supercollider
My accurate Yamaha DX-7 clone. Programmed in Supercollider.
Stars: ✭ 395 (-8.56%)
Mutual labels:  music

pyLast

PyPI version Supported Python versions PyPI downloads Test Coverage (Codecov) Code style: black DOI

A Python interface to Last.fm and other API-compatible websites such as Libre.fm.

Use the pydoc utility for help on usage or see tests/ for examples.

Installation

Install via pip:

python3 -m pip install pylast

Install latest development version:

python3 -m pip install -U git+https://github.com/pylast/pylast

Or from requirements.txt:

-e git://github.com/pylast/pylast.git#egg=pylast

Note:

  • pyLast 4.0+ supports Python 3.6-3.9.
  • pyLast 3.2 - 3.3 supports Python 3.5-3.8.
  • pyLast 3.0 - 3.1 supports Python 3.5-3.7.
  • pyLast 2.2 - 2.4 supports Python 2.7.10+, 3.4-3.7.
  • pyLast 2.0 - 2.1 supports Python 2.7.10+, 3.4-3.6.
  • pyLast 1.7 - 1.9 supports Python 2.7, 3.3-3.6.
  • pyLast 1.0 - 1.6 supports Python 2.7, 3.3-3.4.
  • pyLast 0.5 supports Python 2, 3.
  • pyLast < 0.5 supports Python 2.

Features

  • Simple public interface.
  • Access to all the data exposed by the Last.fm web services.
  • Scrobbling support.
  • Full object-oriented design.
  • Proxy support.
  • Internal caching support for some web services calls (disabled by default).
  • Support for other API-compatible networks like Libre.fm.

Getting started

Here's some simple code example to get you started. In order to create any object from pyLast, you need a Network object which represents a social music network that is Last.fm or any other API-compatible one. You can obtain a pre-configured one for Last.fm and use it as follows:

import pylast

# You have to have your own unique two values for API_KEY and API_SECRET
# Obtain yours from https://www.last.fm/api/account/create for Last.fm
API_KEY = "b25b959554ed76058ac220b7b2e0a026"  # this is a sample key
API_SECRET = "425b55975eed76058ac220b7b4e8a054"

# In order to perform a write operation you need to authenticate yourself
username = "your_user_name"
password_hash = pylast.md5("your_password")

network = pylast.LastFMNetwork(
    api_key=API_KEY,
    api_secret=API_SECRET,
    username=username,
    password_hash=password_hash,
)

# Now you can use that object everywhere
artist = network.get_artist("System of a Down")
artist.shout("<3")


track = network.get_track("Iron Maiden", "The Nomad")
track.love()
track.add_tags(("awesome", "favorite"))

# Type help(pylast.LastFMNetwork) or help(pylast) in a Python interpreter
# to get more help about anything and see examples of how it works

More examples in hugovk/lastfm-tools and tests/.

Testing

The tests/ directory contains integration and unit tests with Last.fm, and plenty of code examples.

For integration tests you need a test account at Last.fm that will become cluttered with test data, and an API key and secret. Either copy example_test_pylast.yaml to test_pylast.yaml and fill out the credentials, or set them as environment variables like:

export PYLAST_USERNAME=TODO_ENTER_YOURS_HERE
export PYLAST_PASSWORD_HASH=TODO_ENTER_YOURS_HERE
export PYLAST_API_KEY=TODO_ENTER_YOURS_HERE
export PYLAST_API_SECRET=TODO_ENTER_YOURS_HERE

To run all unit and integration tests:

python3 -m pip install -e ".[tests]"
pytest

Or run just one test case:

pytest -k test_scrobble

To run with coverage:

pytest -v --cov pylast --cov-report term-missing
coverage report # for command-line report
coverage html   # for HTML report
open htmlcov/index.html

Logging

To enable from your own code:

import logging
import pylast

logging.basicConfig(level=logging.DEBUG)

network = pylast.LastFMNetwork(...)

To enable from pytest:

pytest --log-cli-level debug -k test_album_search_images
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].