-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate from Travis CI to GitHub Actions (#10)
* Create ci.yaml Add example setup from https://github.com/pypa/cibuildwheel#example-setup * Delete .travis.yml * Remove shields * Use reusable workflow * Delete setup.py * Create pyproject.toml * Remove Python 2 classifiers * `prettier` * `pyupgrade --py36-plus` * Require minimum setuptools that supports project key in pyproject.toml * `prettier` * Remove six * Don't specify Python 3 minor versions * Set black line length to 120 * `black` * Add direnv * Add development instructions and remove mention of SoundCloud API * Install youtube-dl from GitHub * Enable setuptools-scm * Add pre-commit hooks for formatting, etc. * Add lint and test steps * Replace `pafy` with `youtube-dl` Since `pafy` is no longer maintained, replace it with calling `youtube-dl` directly. * Format * Add verbose flag * Expose __version__ * Show info logging during pytest * Replace soundcloud with sclib Not working yet but it's a start. * Add TODO * Add TODO * Only test latest push * Add download limit * Set minimum Python to 3.8 * Set job name to package name
- Loading branch information
Showing
15 changed files
with
308 additions
and
189 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
layout python |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
audioscrape: | ||
uses: carlthome/workflows/.github/workflows/python.yaml@main | ||
with: | ||
package-name: audioscrape |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -94,3 +94,6 @@ ENV/ | |
.idea | ||
*.iml | ||
|
||
|
||
.direnv | ||
version.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# See https://pre-commit.com for more information | ||
# See https://pre-commit.com/hooks.html for more hooks | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.4.0 | ||
hooks: | ||
- id: trailing-whitespace | ||
- id: end-of-file-fixer | ||
- id: check-yaml | ||
- id: check-added-large-files | ||
|
||
- repo: https://github.com/asottile/pyupgrade | ||
rev: v3.7.0 | ||
hooks: | ||
- id: pyupgrade | ||
args: [--py310-plus] | ||
|
||
- repo: https://github.com/pycqa/autoflake | ||
rev: v2.2.0 | ||
hooks: | ||
- id: autoflake | ||
|
||
- repo: https://github.com/psf/black | ||
rev: "23.3.0" | ||
hooks: | ||
- id: black |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,56 @@ | ||
# Audioscrape | ||
[![Build Status](https://travis-ci.org/carlthome/audio-scraper.svg?branch=master)](https://travis-ci.org/carlthome/audio-scraper) | ||
[![PyPI](https://img.shields.io/pypi/v/audioscrape.svg)](https://pypi.python.org/pypi/audioscrape) | ||
[![PyPI](https://img.shields.io/pypi/pyversions/audioscrape.svg)](http://py3readiness.org/) | ||
[![license](https://img.shields.io/github/license/mashape/apistatus.svg)](LICENSE) | ||
|
||
Scrape audio from various websites with a simple command-line interface. | ||
|
||
# Install | ||
First make sure Python and pip are installed, then run: | ||
## Usage | ||
|
||
First make sure Python is installed, then run: | ||
|
||
```sh | ||
pip install audioscrape | ||
``` | ||
|
||
# Usage | ||
Then you can use the program as: | ||
|
||
```sh | ||
audioscrape "acoustic guitar" | ||
``` | ||
|
||
See `audioscrape --help` for more details. | ||
|
||
## Python API | ||
You could also use the scraper directly in Python, as: | ||
### Python API | ||
|
||
You can also use the scraper directly in Python, as: | ||
|
||
```python | ||
import audioscrape | ||
|
||
audioscrape.download(query='Cerulean Crayons', | ||
include=['guitar'], | ||
exclude=['remix'], | ||
audioscrape.download(query="Cerulean Crayons", | ||
include=["guitar"], | ||
exclude=["remix"], | ||
quiet=True) | ||
``` | ||
|
||
## SoundCloud API key and download limits | ||
This program uses SoundCloud's official Python API which requires a registered API key. SoundCloud says an API key can be used for 15,000 requests per any 24-hour time window, and a key has been included in the program. However, in case the key stops working, register another one [as described by SoundCloud here](https://github.com/soundcloud/soundcloud-python#basic-use), and use the scraper after setting the environment variable `SOUNDCLOUD_API_KEY`, as `SOUNDCLOUD_API_KEY="your_key" audioscrape "piano music"`. | ||
## Develop | ||
|
||
First clone the repo and set it as working directory. Then install the package in development mode (preferably within its own virtual environment): | ||
|
||
```sh | ||
pip install -e . | ||
``` | ||
|
||
If you have `direnv` installed, you can run `direnv allow` to automatically create and activate a Python virtual environment when you enter the directory. | ||
|
||
### Test | ||
|
||
```sh | ||
pytest | ||
``` | ||
|
||
### Lint | ||
|
||
```sh | ||
pre-commit run --all-files | ||
``` | ||
|
||
Or `pre-commit install` to run automatically on `git commit`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
# coding=utf-8 | ||
"""YouTube audio scraper package.""" | ||
from .__main__ import download | ||
__all__ = ['download'] | ||
from .version import version | ||
|
||
__all__ = ["download"] | ||
__version__ = version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# TODO Add machine listening help functionality to easily categorize downloaded audio. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# TODO |
Oops, something went wrong.