Skip to main content

Backend for listening to bandcamp

Project description

Latest PyPI version Latest GitHub release Latest GitHub Commits Code Coverage

Mopidy extension for playing music from Bandcamp.

This backend this allows searching bandcamp and playing the free 128kbps MP3 streams.

Initial support has been added for browsing and playing your bandcamp collection. Authentication is a hassle, and described below. Expect things to be wonky, and please create an issue when you encounter things that don’t work. Also this is slow because it requires scraping the bandcamp website instead of using an API.

Installation

Install by running:

sudo python3 -m pip install Mopidy-Bandcamp

Authentication

Authentication is done by grabbing your identity token from the cookies of the bandcamp website. Point your browser at https://bandcamp.com, log in if you aren’t already, and then open up your browser’s developer tools (usually by pressing Ctrl-Shift-I or F12). Reload the page and you should be able to go to the “Network” tab of developer tools and click on the top entry. You should be able to click on a “Headers” subtab and see the Request and Response headers. Find the “Cookie” request header and look for “identity”.

You should see something similar to:

identity=7%09xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx%3D%09%7B%22ex%22%3Ax%2C%22id%22%3Axxxxxxxxxx%7D;

This is what we need. Copy the data (leave out the semi-colon) and add it to your Mopidy config file like:

[bandcamp]
identity = 7%09xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx%3D%09%7B%22ex%22%3Ax%2C%22id%22%3Axxxxxxxxxx%7D

Usage

Albums and tracks can be searched for or browsed. Additionaly, you can force Mopidy-Bandcamp to scrape a bandcamp URL for you by just prepending the url with “bandcamp:” and adding it to Mopidy. For example, using mpc on the command line:

$ mpc add "bandcamp:https://louiezong.bandcamp.com/album/jazz"

Would add the bandcamp album to the queue.

Note: Adding an artist by clicking on the artist in a search result or by manually scraping an artist’s bandcamp page can take a long time depending on the artist. This is because Mopidy-Bandcamp tries to load the entirety of the artist’s discography.

Configuration

example:

[bandcamp]
discover-tags = French House, Brit Pop, Tokyo, New Wave, Industrial
  • identity - Identity token from your bandcamp cookies to authenticate with Bandcamp.

  • collection_items - Number of items (per page) to fetch from your collection (if authenticated). Default: 50

  • discover_tags - List of tags to discover. You’ll really want to change this to any tags that interest you.

  • discover_genres - List of bandcamp’s genres to discover. You’ll only want to edit this to remove unwanted genres.

  • discover_pages - Number of pages to load in the browse discover sections. Default: 1

  • image_sizes - a list of ids for image sizes to return to mopidy for album art. Default: 10, 5, 2 (1200x1200, 700x700, 350x350)

Bandcamp image size ids:

ID

Width

Height

Aspect

1

Original (usually big)

10

1200

1200

Square

20

1024

1024

Square

5

700

700

Square

13

380

380

Square

14

368

368

Square

2

350

350

Square

4

300

300

Square

9

210

210

Square

44

200

200

Square

11

172

172

Square

7

150

150

Square

50

140

140

Square

12

138

138

Square

15

135

135

Square

8

124

124

Square

21

120

120

Square

3

100

100

Square

42

50

50

Square

22

25

25

Square

26

800

600

4:3

36

400

300

4:3

32

380

285

4:3

33

368

276

4:3

37

168

126

4:3

38

144

108

4:3

29

100

75

4:3

28

768

432

16:9

27

715

402

16:9

Project resources

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Mopidy-Bandcamp-1.1.1.tar.gz (11.4 kB view hashes)

Uploaded Source

Built Distribution

Mopidy_Bandcamp-1.1.1-py3-none-any.whl (12.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page