Skip to content

Commit

Permalink
Add sentry, update readme (#64)
Browse files Browse the repository at this point in the history
* add check for URL to prevent errors when URL is not provided

* add sentry for error tracking

* add sentry dependency

* readme update

* Update image to match current spotify UI

* prepare for release
  • Loading branch information
SathyaBhat authored Feb 9, 2020
1 parent ac14bb7 commit 7fd4754
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 10 deletions.
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
# spotify_dl
Downloads songs from any Spotify playlist or from your "My Music" collection.

[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)
[![PyPI download month](https://img.shields.io/pypi/dm/spotify_dl.svg)](https://pypi.python.org/pypi/spotify_dl/)
[![PyPI license](https://img.shields.io/pypi/l/spotify_dl.svg)](https://pypi.python.org/pypi/spotify_dl/)
[![PyPI pyversions](https://img.shields.io/pypi/pyversions/spotify_dl.svg)](https://pypi.python.org/pypi/spotify_dl/)
[![GitHub release](https://img.shields.io/github/release/SathyaBhat/spotify-dl.svg)](https://GitHub.com/SathyaBhat/spotify-dl/releases/)
[![GitHub stars](https://img.shields.io/github/stars/SathyaBhat/spotify-dl.svg?style=social&label=Star&maxAge=2592000)](https://GitHub.com/SathyaBhat/spotify-dl/stargazers/)
[![GitHub contributors](https://img.shields.io/github/contributors/SathyaBhat/spotify-dl.svg)](https://GitHub.com/SathyaBhat/spotify-dl/graphs/contributors/)

[![Awesome Badges](https://img.shields.io/badge/badges-awesome-green.svg)](https://github.com/Naereen/badges)


# Tell me more!
I wanted an easy way to grab the songs present in my library so I can download it & use it offline(Spotify still hasn't launched here. Y U NO COME?). [spotify_to_mp3](https://github.com/frosas/spotify-to-mp3) worked well but it relied on grooveshark, which unfortunately is no more.
Expand Down Expand Up @@ -34,7 +44,7 @@ Pre-requisite: You need Python 3+

- `spotify_playlist_link` is a link to Spotify's playlist. You can get it from the 3-dot menu.

![image](https://cloud.githubusercontent.com/assets/25424/25472453/f256c94a-2b48-11e7-8f91-7bfa1ce232c2.png)
![image](images/spotify-playlist.png)

If the Spotify playlist link is skipped then it will download songs from your "My Music" collection
- `download_directory` is the location where the songs must be downloaded to. If you give a `.` then it will download to the current directory.
Expand All @@ -50,6 +60,7 @@ Pre-requisite: You need Python 3+
- Windows users can download FFMPEG pre-built binaries from [here](http://ffmpeg.zeranoe.com/builds/). Extract the file using [7-zip](http://7-zip.org/) to a foldrer and [add the folder to your PATH environment variable](http://www.wikihow.com/Install-FFmpeg-on-Windows)

### How do I set defaults?

You can set defaults per user by creating a file at `~/.spotify_dl_settings`. Create a key with value for every argument you want a default for. Example:
``` json
{
Expand All @@ -58,7 +69,9 @@ You can set defaults per user by creating a file at `~/.spotify_dl_settings`. Cr
, "skip_mp3" : "t"
}
```

### Credits

- [rhnvrm](https://github.com/rhnvrm) for [adding in youtube-dl](https://github.com/SathyaBhat/spotify-dl/pull/1)
- [mr-karan](https://github.com/mr-karan) for [adding save to directory](https://github.com/SathyaBhat/spotify-dl/pull/6)
- [shantanugoel](https://github.com/shantanugoel) for adding in [User playlist](https://github.com/SathyaBhat/spotify-dl/pull/7), [skip MP3 conversion](https://github.com/SathyaBhat/spotify-dl/pull/34) and [Ability to use custom format string support](https://github.com/SathyaBhat/spotify-dl/pull/34)
Expand Down
1 change: 0 additions & 1 deletion build.bat
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
pandoc --from=markdown --to=rst --output=README.rst README.md
del /q dist\*
python setup.py sdist
python setup.py bdist_wheel
Expand Down
Binary file added images/spotify-playlist.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
spotipy==2.3.8
google-api-python-client==1.6.2
youtube-dl>=2015.12.23
sentry-sdk==0.14.1
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
with open('requirements.txt') as f:
requirements = f.read().splitlines()

version = '3.3.0'
version = '3.5.0'

setup(
name='spotify_dl',
Expand Down
4 changes: 3 additions & 1 deletion spotify_dl/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@
YOUTUBE_API_VERSION = "v3"
VIDEO = 'youtube#video'
YOUTUBE_VIDEO_URL = 'https://www.youtube.com/watch?v='
VERSION = '3.0.1'
VERSION = '3.5.0'

import sentry_sdk
sentry_sdk.init("https://[email protected]/2383261")
13 changes: 7 additions & 6 deletions spotify_dl/spotify_dl.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,13 @@ def spotify_dl():
sp = spotipy.Spotify(auth=token)
log.debug('Arguments: {}'.format(args))

url_match = playlist_url_pattern.match(args.url)
if args.url and url_match and len(url_match.groups()) > 0:
uri = "spotify:" + url_match.groups()[0].replace('/', ':')
args.uri = [uri]
else:
raise Exception('Invalid playlist URL ')
if args.url:
url_match = playlist_url_pattern.match(args.url)
if url_match and len(url_match.groups()) > 0:
uri = "spotify:" + url_match.groups()[0].replace('/', ':')
args.uri = [uri]
else:
raise Exception('Invalid playlist URL ')
if args.uri:
current_user_id, playlist_id = extract_user_and_playlist_from_uri(args.uri[0], sp)
else:
Expand Down

0 comments on commit 7fd4754

Please sign in to comment.