Coder Social home page Coder Social logo

mania's Introduction

โš ๏ธ No longer maintained.

Check out https://github.com/yarrm80s/orpheusdl and https://github.com/Dniel97/orpheusdl-tidal instead.

Mania ๐Ÿ‘ป

Mania is a command-line tool for downloading music from TIDAL. It is intended for educational and private use only, and not as a tool for pirating and distributing music.

Installation

pip3 install --user --upgrade "https://github.com/evan-goode/mania/archive/master.zip"

Mania requires Python 3.6 or higher and has been tested on GNU/Linux and macOS.

Usage

Instead of asking for your username and password, Mania now uses TIDAL's TV login process. The first time you run it, it will ask you to link a TIDAL account. Simply follow the link it gives you and log in.

To download a track, an album, or even an artist's entire discography:

mania track the great gig in the sky
mania album the dark side of the moon
mania artist pink floyd

To include EPs and singles in the discography:

mania artist pink floyd --include-eps-singles

You can also give it a URL to something in the TIDAL catalog and Mania will try to parse it:

mania url https://tidal.com/browse/track/140538043

Optional flags can go anywhere in the command. For example, to automatically select the top search result:

mania track the great gig in the sky --lucky

Configuration

Each option (except --config-file) can be specified either as a command-line argument or using the TOML config file at ~/.config/mania/config.toml. On the command line, prefix the option with --, or --no-, as in --output-directory ~/music or --no-full-structure.

The first time it's run, Mania populates ~/.config/mania/config.toml with some default values. For more information on the TOML format, see https://github.com/toml-lang/toml.

To point Mania to a different configuration file, use --config-file <file>.

Available options are:

  • quality <quality>: default value is lossless. Possible values are master (MQA in a FLAC container, usually 96 kHz, 24 bit), lossless (44.1 kHz, 16 bit FLAC), high (~320 kbps VBR AAC), and low (~96 kbps VBR AAC). If the content you request isn't available in the specified quality, Mania will try to download the "next best" option (master > lossless > high > low). Note that master and lossless require a TIDAL HiFi subscription.
  • output-directory <path>: where to put downloaded music. Default value is . (your working directory when you run Mania).
  • by-id: find something using its ID instead of searching TIDAL. For example, mania album --by-id 79419393.
  • lucky: automatically download the top search result. Default value is false.
  • search-count <number>: how many results to include in the search. Default value is 16.
  • quiet: don't log any output. Default value is false.
  • nice-format: rename downloaded material to follow kebab-case and strip out special characters. "Maxwell's Silver Hammer (Remastered).mp3" becomes "maxwells-silver-hammer-remastered.mp3". Default value is false.
  • full-structure: always organize content by artist and album. For example, mania track --full-structure --lucky "isn't she lovely" would create Stevie Wonder/Songs In The Key Of Life/Disc 2/01 Isn't She Lovely.flac. Default value is false.
  • skip-metadata: don't download cover art or set tags. Not sure why someone would want this. Overrides replay-gain. Default value is false.
  • replay-gain: tag FLAC files with ReplayGain data from TIDAL (for normalization). Overridden by skip-metadata. Default value is true.
  • include-eps-singles: include EPs and singles when downloading discographies with mania artist. Default value is false; prolific artists can have a lot of singles/remixes and often you just want the studio albums.
  • track-format: filename format for tracks. Default value is {track_number} {track_name}.
  • individual-track-format: filename format for tracks when a track is downloaded without the rest of the album. full-structure will force the use of the long format. Default value is {track_name}
  • album-format: filename format for albums. Default value is {album_name}.
  • individual-album-format: filename format for albums when an album is downloaded without the rest of the artist's discography. full-structure will force the use of the long format. Default value is {album_name}, the same as the default album-format. These options are kept distinct in case you want to, for example, include the year only for albums in a discography.

Formatting Variables

The following variables are available for use in the *-format options. All are surrounded with {}:

  • {track_id}: the ID of the track in TIDAL
  • {track_name}
  • {track_artists}: ", "-delimited list of artists
  • {track_first_artist}: the first listed artist
  • {track_number}: number of the track in the album. Automatically zero-padded according to the total number of tracks.
  • {album_id}: the ID of the album in TIDAL
  • {album_name}
  • {album_artists}: comma + delimited list of album artists
  • {album_first_artist}: the first listed album artist
  • {album_year}: the year of release, or Unknown Year

For example:

mania track the great gig in the sky --lucky --individual-track-format "{track_artists} - {track_name} ({album_year})"

will download:

Pink Floyd - The Great Gig in the Sky (1973).flac

License

The Unlicense

See also

mania's People

Contributors

corewala avatar evan-goode avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

mania's Issues

Need to set requirement prompt_toolkit==1.0.14

Doesn't work on latest version of prompt_toolkit.

You can do this:
pip install 'prompt_toolkit==1.0.14'

Maybe better change the version of prompt_toolkit in requirements.txt:
prompt_toolkit==1.0.14

Broken login

It seems tidal has changed there token. But from testing the mobile app 1.9.1 Mobile login isn't working on that version either.

Replacing the API_TOKEN with updated one allows the first login but it fails on the second login using MASTER_API_TOKEN. I have no clue where this MASTER_API_TOKEN comes from digging around in mitmproxy I can't seem to dig any value up that works

Also whats weird is tidal doesn't return a

<Response [401]>
Authentication failed: Invalid token

With the old token which I would expect it would. Instead it returns

<Response [401]>
Authentication failed: None

Authentication is not working

Looks like a new TIDAL update broke authentication again:

Traceback (most recent call last):
  File "/home/corewala/.local/lib/python3.9/site-packages/mania/tidal.py", line 199, in _refresh
    refresh_response.raise_for_status()
  File "/usr/lib/python3.9/site-packages/requests/models.py", line 943, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://auth.tidal.com/v1/oauth2/token

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/corewala/.local/bin/mania", line 8, in <module>
    sys.exit(main())
  File "/home/corewala/.local/lib/python3.9/site-packages/mania/mania.py", line 444, in main
    run()
  File "/home/corewala/.local/lib/python3.9/site-packages/mania/mania.py", line 420, in run
    session.check_valid()
  File "/home/corewala/.local/lib/python3.9/site-packages/mania/tidal.py", line 90, in check_valid
    self._refresh()
  File "/home/corewala/.local/lib/python3.9/site-packages/mania/tidal.py", line 200, in _refresh
    except requests.response.HTTPError as error:
AttributeError: module 'requests' has no attribute 'response'

Downloading is broken

Attempting to download anything (url, track, artist or album) returns this error:

Warning: MQA support is currently broken. Files requested as `master` quality will download as `lossless`.
Authenticating...
Uncaught HTTP Error:
b'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">\n<HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">\n<TITLE>ERROR: The request could not be satisfied</TITLE>\n</HEAD><BODY>\n<H1>403 ERROR</H1>\n<H2>The request could not be satisfied.</H2>\n<HR noshade size="1px">\nRequest blocked.\nWe can\'t connect to the server for this app or website at this time. There might be too much traffic or a configuration error. Try again later, or contact the app or website owner.\n<BR clear="all">\nIf you provide content to customers through CloudFront, you can find steps to troubleshoot and help prevent this error by reviewing the CloudFront documentation.\n<BR clear="all">\n<HR noshade size="1px">\n<PRE>\nGenerated by cloudfront (CloudFront)\nRequest ID: Y49J2AVA0R1ORyg0ii9vfybH_Wn_NaXG5mQK7YMzqZ8xe9KOKe210Q==\n</PRE>\n<ADDRESS>\n</ADDRESS>\n</BODY></HTML>

How to add Year in the Album Title

Hi, I would like to know how to add the option for downloading the artist's albums including the year, as in the following format:

Artist-Name --> [201X] - Album Name --> Track Number - Artist Name - Song Name.

Thanks!

Download by URL/ID

I'd love support for Tidal URLs, ie
mania https://tidal.com/browse/track/140538043 (no need for lucky in these cases)

Examples/variants:

https://listen.tidal.com/album/140538042
https://tidal.com/browse/album/140538042

https://listen.tidal.com/artist/4332277
https://tidal.com/browse/artist/4332277

https://tidal.com/browse/track/140538043
https://embed.tidal.com/tracks/140538043

It looks like tidalapi has direct support for it, if it helps:

tracks = session.get_album_tracks(album_id=16909093)
for track in tracks:
    print(track.name)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.