mirror of
				https://github.com/KevinMidboe/spotify-downloader.git
				synced 2025-10-29 18:00:15 +00:00 
			
		
		
		
	Compare commits
	
		
			15 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | b808265c38 | ||
|  | 21a1f1a150 | ||
|  | 951ae02e08 | ||
|  | dfd48f75ce | ||
|  | bb385a3bfd | ||
|  | a9477c7873 | ||
|  | c225e5821b | ||
|  | d61309b0ce | ||
|  | 5b2a073033 | ||
|  | f17e5f58d8 | ||
|  | d3668f55bb | ||
|  | 6ca136f039 | ||
|  | e2a136d885 | ||
|  | d10f3e9df0 | ||
|  | 46eb2e3e32 | 
| @@ -14,6 +14,14 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. | ||||
| ### Changed | ||||
| - | ||||
|  | ||||
| ## [1.2.1] - 2019-04-28 | ||||
| ### Fixed | ||||
| - Patch bug in Pafy when fetching audiostreams with latest youtube-dl ([@ritiek](https://github.com/ritiek)) (#539) | ||||
|  | ||||
| ### Changed | ||||
| - Removed duplicate debug log entry from `internals.trim_song` ([@ritiek](https://github.com/ritiek)) (#519) | ||||
| - Fix YAMLLoadWarning ([@cyberboysumanjay](https://github.com/cyberboysumanjay)) (#517) | ||||
|  | ||||
| ## [1.2.0] - 2019-03-01 | ||||
| ### Added | ||||
| - `--write-to` parameter for setting custom file to write Spotify track URLs to ([@ritiek](https://github.com/ritiek)) (#507) | ||||
|   | ||||
| @@ -30,7 +30,7 @@ If you still need to use Python 2 - check out the (outdated) | ||||
| spotify-downloader works with all major distributions and even on low-powered devices such as a Raspberry Pi. | ||||
|  | ||||
| spotify-downloader can be installed via pip with: | ||||
| ``` | ||||
| ```console | ||||
| $ pip3 install spotdl | ||||
| ``` | ||||
|  | ||||
| @@ -41,7 +41,7 @@ page for detailed OS-specific instructions to get it and other dependencies it r | ||||
|  | ||||
| For the most basic usage, downloading tracks is as easy as | ||||
|  | ||||
| ``` | ||||
| ```console | ||||
| $ spotdl --song https://open.spotify.com/track/2DGa7iaidT5s0qnINlwMjJ | ||||
| $ spotdl --song "ncs - spectre" | ||||
| ``` | ||||
| @@ -49,7 +49,7 @@ $ spotdl --song "ncs - spectre" | ||||
| For downloading playlist and albums, you need to first load all the tracks into text file and then pass | ||||
| this text file to `--list` argument. Here is how you would do it for a playlist | ||||
|  | ||||
| ``` | ||||
| ```console | ||||
| $ spotdl --playlist https://open.spotify.com/user/nocopyrightsounds/playlist/7sZbq8QGyMnhKPcLJvCUFD | ||||
| INFO: Writing 62 tracks to ncs-releases.txt | ||||
| $ spotdl --list ncs-releases.txt | ||||
| @@ -73,7 +73,7 @@ Check out [CONTRIBUTING.md](CONTRIBUTING.md) for more info. | ||||
|  | ||||
| ## Running Tests | ||||
|  | ||||
| ``` | ||||
| ```console | ||||
| $ python3 -m pytest test | ||||
| ``` | ||||
|  | ||||
|   | ||||
| @@ -1 +1 @@ | ||||
| __version__ = "1.2.0" | ||||
| __version__ = "1.2.1" | ||||
|   | ||||
| @@ -58,7 +58,7 @@ def merge(default, config): | ||||
| def get_config(config_file): | ||||
|     try: | ||||
|         with open(config_file, "r") as ymlfile: | ||||
|             cfg = yaml.load(ymlfile) | ||||
|             cfg = yaml.safe_load(ymlfile) | ||||
|     except FileNotFoundError: | ||||
|         log.info("Writing default configuration to {0}:".format(config_file)) | ||||
|         with open(config_file, "w") as ymlfile: | ||||
|   | ||||
| @@ -51,7 +51,6 @@ def input_link(links): | ||||
|  | ||||
| def trim_song(tracks_file): | ||||
|     """ Remove the first song from file. """ | ||||
|     log.debug("Removing downloaded song from tracks file") | ||||
|     with open(tracks_file, "r") as file_in: | ||||
|         data = file_in.read().splitlines(True) | ||||
|     with open(tracks_file, "w") as file_out: | ||||
|   | ||||
| @@ -1,3 +1,4 @@ | ||||
| from pafy import backend_youtube_dl | ||||
| import pafy | ||||
|  | ||||
| from spotdl import internals | ||||
| @@ -20,12 +21,25 @@ def _getbestthumb(self): | ||||
|         if self._content_available(url): | ||||
|             return url | ||||
|  | ||||
| def _process_streams(self): | ||||
|     for format_index in range(len(self._ydl_info['formats'])): | ||||
|         try: | ||||
|             self._ydl_info['formats'][format_index]['url'] = self._ydl_info['formats'][format_index]['fragment_base_url'] | ||||
|         except KeyError: | ||||
|             pass | ||||
|     return backend_youtube_dl.YtdlPafy._old_process_streams(self) | ||||
|  | ||||
| @classmethod | ||||
| def _content_available(cls, url): | ||||
|     return internals.content_available(url) | ||||
|  | ||||
| def patch_pafy(): | ||||
|     pafy.backend_shared.BasePafy._bestthumb = None | ||||
|     pafy.backend_shared.BasePafy._content_available = _content_available | ||||
|     pafy.backend_shared.BasePafy.getbestthumb = _getbestthumb | ||||
|  | ||||
| class PatchPafy: | ||||
|     def patch_getbestthumb(self): | ||||
|         pafy.backend_shared.BasePafy._bestthumb = None | ||||
|         pafy.backend_shared.BasePafy._content_available = _content_available | ||||
|         pafy.backend_shared.BasePafy.getbestthumb = _getbestthumb | ||||
|  | ||||
|     def patch_process_streams(self): | ||||
|         backend_youtube_dl.YtdlPafy._old_process_streams = backend_youtube_dl.YtdlPafy._process_streams | ||||
|         backend_youtube_dl.YtdlPafy._process_streams = _process_streams | ||||
|   | ||||
| @@ -18,7 +18,9 @@ pafy.g.opener.addheaders.append(("Range", "bytes=0-")) | ||||
| # More info: https://github.com/mps-youtube/pafy/pull/211 | ||||
| if pafy.__version__ <= "0.5.4": | ||||
|     from spotdl import patcher | ||||
|     patcher.patch_pafy() | ||||
|     pafy_patcher = patcher.PatchPafy() | ||||
|     pafy_patcher.patch_getbestthumb() | ||||
|     pafy_patcher.patch_process_streams() | ||||
|  | ||||
|  | ||||
| def set_api_key(): | ||||
|   | ||||
| @@ -176,6 +176,7 @@ class TestFFmpeg: | ||||
|  | ||||
|  | ||||
| class TestAvconv: | ||||
|     @pytest.mark.skip(reason="avconv is no longer provided with FFmpeg") | ||||
|     def test_convert_from_m4a_to_mp3(self, filename_fixture, monkeypatch): | ||||
|         monkeypatch.setattr("os.remove", lambda x: None) | ||||
|         expect_command = "avconv -loglevel 0 -i {0}.m4a -ab 192k {0}.mp3 -y".format( | ||||
|   | ||||
| @@ -3,7 +3,8 @@ import pafy | ||||
|  | ||||
| import pytest | ||||
|  | ||||
| patcher.patch_pafy() | ||||
| pafy_patcher = patcher.PatchPafy() | ||||
| pafy_patcher.patch_getbestthumb() | ||||
|  | ||||
| class TestPafyContentAvailable: | ||||
|     pass | ||||
|   | ||||
		Reference in New Issue
	
	Block a user