Browse Source

Use 7x11x13 fork

master
7x11x13 8 months ago
parent
commit
0d8380939f
  1. 1
      AUTHORS
  2. 71
      README.md
  3. 3
      config/scdl.cfg
  4. 29
      scdl/__init__.py
  5. 29
      scdl/client.py
  6. 17
      scdl/scdl.cfg
  7. 978
      scdl/scdl.py
  8. 3
      scdl/utils.py
  9. 49
      setup.py

1
AUTHORS

@ -3,6 +3,7 @@ Main Developers
* @FlyinGrub
* David Fischer @davidfischer-ch
* @7x11x13
Contributors
============

71
README.md

@ -36,34 +36,49 @@ scdl me -f
## Options:
```
-h --help Show this screen
--version Show version
me Use the user profile from the auth_token
-l [url] URL can be track/playlist/user
-s Download the stream of a user (token needed)
-a Download all tracks of user (including reposts)
-t Download all uploads of a user (no reposts)
-f Download all favorites of a user
-C Download all commented by a user
-p Download all playlists of a user
-m Download all liked and owned playlists of user
-c Continue if a downloaded file already exists
-o [offset] Begin with a custom offset
--addtimestamp Add track creation timestamp to filename, which allows for chronological sorting
--addtofile Add artist to filename if missing
--debug Set log level to DEBUG
--download-archive [file] Keep track of track IDs in an archive file, and skip already-downloaded files
--error Set log level to ERROR
--extract-artist Set artist tag from title instead of username
--flac Convert WAV files to FLAC
--hide-progress Hide the wget progress bar
--hidewarnings Hide Warnings. (use with precaution)
--max-size [max-size] Skip tracks larger than size (k/m/g)
--min-size [min-size] Skip tracks smaller than size (k/m/g)
--no-playlist-folder Download playlist tracks into main directory, instead of making a playlist subfolder
--onlymp3 Download only the streamable mp3 file, even if track has a Downloadable file
--path [path] Use a custom path for downloaded files
--remove Remove any files not downloaded from execution
-h --help Show this screen
--version Show version
-l [url] URL can be track/playlist/user
-n [maxtracks] Download the n last tracks of a playlist according to the creation date
-s Download the stream of a user (token needed)
-a Download all tracks of user (including reposts)
-t Download all uploads of a user (no reposts)
-f Download all favorites of a user
-C Download all commented by a user
-p Download all playlists of a user
-r Download all reposts of user
-c Continue if a downloaded file already exists
--force-metadata This will set metadata on already downloaded track
-o [offset] Begin with a custom offset
--addtimestamp Add track creation timestamp to filename,
which allows for chronological sorting
--addtofile Add artist to filename if missing
--debug Set log level to DEBUG
--download-archive [file] Keep track of track IDs in an archive file,
and skip already-downloaded files
--error Set log level to ERROR
--extract-artist Set artist tag from title instead of username
--hide-progress Hide the wget progress bar
--hidewarnings Hide Warnings. (use with precaution)
--max-size [max-size] Skip tracks larger than size (k/m/g)
--min-size [min-size] Skip tracks smaller than size (k/m/g)
--no-playlist-folder Download playlist tracks into main directory,
instead of making a playlist subfolder
--onlymp3 Download only the streamable mp3 file,
even if track has a Downloadable file
--path [path] Use a custom path for downloaded files
--remove Remove any files not downloaded from execution
--flac Convert original files to .flac
--no-album-tag On some player track get the same cover art if from the same album, this prevent it
--original-art Download original cover art
--original-name Do not change name of original file downloads
--no-original Do not download original file; only mp3 or m4a
--only-original Only download songs with original file available
--name-format [format] Specify the downloaded file name format
--playlist-name-format [format] Specify the downloaded file name format, if it is being downloaded as part of a playlist
--client-id [id] Specify the client_id to use
--auth-token [token] Specify the auth token to use
--overwrite Overwrite file if it already exists
```

3
config/scdl.cfg

@ -1,3 +0,0 @@
[scdl]
auth_token =
path = .

29
scdl/__init__.py

@ -2,31 +2,4 @@
"""Python Soundcloud Music Downloader."""
import os
__version__ = 'v1.6.12'
CLIENT_ID = 'a3e059563d7fd3372b49b37f00a00bcf'
ALT_CLIENT_ID = '2t9loNQH90kzJcsFCODdigxfp325aq4z'
ALT2_CLIENT_ID = 'NONE'
USER_AGENT = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36'
default_config = """[scdl]
auth_token =
path = .
"""
if 'XDG_CONFIG_HOME' in os.environ:
config_dir = os.path.join(os.environ['XDG_CONFIG_HOME'], 'scdl')
else:
config_dir = os.path.join(os.path.expanduser('~'), '.config', 'scdl')
config_file = os.path.join(config_dir, 'scdl.cfg')
if not os.path.exists(config_file):
if not os.path.exists(config_dir):
os.makedirs(config_dir)
with open(config_file, 'w') as f:
f.write(default_config)
__version__ = "v2.2.0"

29
scdl/client.py

@ -1,29 +0,0 @@
# -*- encoding: utf-8 -*-
import requests
from scdl import CLIENT_ID, USER_AGENT
class Client():
def get_collection(self, url, token):
params = {
'client_id': CLIENT_ID,
'linked_partitioning': '1',
}
if token:
params['oauth_token'] = token
resources = list()
while url:
response = requests.get(url, params=params, headers={'User-Agent': USER_AGENT})
response.raise_for_status()
json_data = response.json()
if 'collection' in json_data:
resources.extend(json_data['collection'])
else:
resources.extend(json_data)
if 'next_href' in json_data:
url = json_data['next_href']
else:
url = None
return resources

17
scdl/scdl.cfg

@ -0,0 +1,17 @@
[scdl]
client_id = a3e059563d7fd3372b49b37f00a00bcf
auth_token =
path = .
name_format = {title}
playlist_name_format = {playlist[title]}_{playlist[tracknumber]}_{title}
# example name_format values:
# {timestamp}_{user[username]}_{title}
# {id}_{user[username]}_{title}
# {id}_{user[id]}_{title}
# list of all BasicTrack attributes can be found at: https://github.com/7x11x13/soundcloud.py/blob/main/soundcloud/resource/track.py#L35
# playlist_name_format playlist attributes:
# playlist[author] - username of playlist author
# playlist[title] - name of playlist
# playlist[tracknumber] - tracknumber of track in playlist (zero-padded)

978
scdl/scdl.py

File diff suppressed because it is too large Load Diff

3
scdl/utils.py

@ -15,7 +15,8 @@ __all__ = ('ColorizeFilter', )
class ColorizeFilter(logging.Filter):
color_by_level = {
logging.DEBUG: 'yellow',
logging.DEBUG: 'blue',
logging.WARNING: 'yellow',
logging.ERROR: 'red',
logging.INFO: 'white'
}

49
setup.py

@ -6,39 +6,46 @@ from setuptools import setup, find_packages
import scdl
from os import path
this_directory = path.abspath(path.dirname(__file__))
with open(path.join(this_directory, 'README.md'), encoding='utf-8') as f:
with open(path.join(this_directory, "README.md"), encoding="utf-8") as f:
long_description = f.read()
setup(
name='scdl',
name="scdl",
version=scdl.__version__,
packages=find_packages(),
author='FlyinGrub',
author_email='flyinggrub@gmail.com',
description='Download Music from Souncloud',
author="FlyinGrub",
author_email="flyinggrub@gmail.com",
description="Download Music from Souncloud",
long_description=long_description,
long_description_content_type='text/markdown',
long_description_content_type="text/markdown",
install_requires=[
'docopt',
'mutagen',
'termcolor',
'requests',
'clint'
"docopt",
"mutagen",
"termcolor",
"requests",
"clint",
"pathvalidate",
"soundcloud-v2>=1.1.4"
],
url='https://github.com/flyingrub/scdl',
url="https://github.com/flyingrub/scdl",
classifiers=[
'Programming Language :: Python',
'Development Status :: 5 - Production/Stable',
'License :: OSI Approved :: GNU General Public License v2 (GPLv2)',
'Operating System :: OS Independent',
'Programming Language :: Python :: 3.4',
'Topic :: Internet',
'Topic :: Multimedia :: Sound/Audio',
"Programming Language :: Python",
"Development Status :: 5 - Production/Stable",
"License :: OSI Approved :: GNU General Public License v2 (GPLv2)",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Topic :: Internet",
"Topic :: Multimedia :: Sound/Audio",
],
python_requires = ">=3.6",
entry_points={
'console_scripts': [
'scdl = scdl.scdl:main',
"console_scripts": [
"scdl = scdl.scdl:main",
],
},
)

Loading…
Cancel
Save