mirror of
https://github.com/cooperhammond/irs.git
synced 2025-01-02 19:15:26 +00:00
Make sure to call irs --setup
before anything else
This commit is contained in:
parent
0937978496
commit
00523cae88
|
@ -16,13 +16,15 @@ A tool to download your music with metadata. It uses [Spotify](https://www.spoti
|
||||||
|
|
||||||
Works with Python 2 and 3.
|
Works with Python 2 and 3.
|
||||||
|
|
||||||
## Install
|
## Install and Setup
|
||||||
```
|
```
|
||||||
$ sudo pip install irs
|
$ sudo pip install irs
|
||||||
|
$ irs --setup
|
||||||
```
|
```
|
||||||
|
|
||||||
**You will need to have some Spotify tokens, the instructions to set them up are [here](https://github.com/kepoorhampond/irs#spotify-tokens).**
|
**You will need to have some Spotify tokens, the instructions to set them up are [here](https://github.com/kepoorhampond/irs#spotify-tokens).**
|
||||||
|
|
||||||
|
|
||||||
## Demo and Usages
|
## Demo and Usages
|
||||||
|
|
||||||
This is a demo of the CLI displayling its features:
|
This is a demo of the CLI displayling its features:
|
||||||
|
|
|
@ -1 +1,20 @@
|
||||||
from .ripper import Ripper
|
import os
|
||||||
|
import argparse
|
||||||
|
from .setup_binaries import setup
|
||||||
|
|
||||||
|
parser = argparse.ArgumentParser()
|
||||||
|
|
||||||
|
parser.add_argument("-S", "--setup", dest="setup", help="Setup IRS",
|
||||||
|
action="store_true")
|
||||||
|
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
if args.setup:
|
||||||
|
setup()
|
||||||
|
exit(0)
|
||||||
|
elif not os.path.isdir(os.path.expanduser("~/.irs")):
|
||||||
|
print("Please run `irs --setup` to install the youtube-dl and \
|
||||||
|
ffmpeg binaries.")
|
||||||
|
else:
|
||||||
|
from .ripper import Ripper
|
||||||
|
Ripper # PyLinter reasons
|
||||||
|
|
|
@ -1,9 +1,13 @@
|
||||||
import sys
|
import sys
|
||||||
from os import path
|
from os import path
|
||||||
|
|
||||||
|
if path.isfile(path.expanduser("~/.irs/config_.py")):
|
||||||
|
sys.path.append(path.expanduser("~/.irs")) # Add config to path
|
||||||
|
|
||||||
sys.path.append(path.expanduser("~/.irs")) # Add config to path
|
import config_ # from "~/.irs/config_.py"
|
||||||
|
|
||||||
import config_ # from "~/.irs/config_.py"
|
CONFIG = config_.CONFIG
|
||||||
|
else:
|
||||||
CONFIG = config_.CONFIG
|
config = open("irs/config_preset", "r").read()
|
||||||
|
print(config)
|
||||||
|
CONFIG = eval(config)
|
||||||
|
|
|
@ -12,6 +12,7 @@ sys.path.append(os.path.expanduser("~/.irs/bin/youtube-dl"))
|
||||||
|
|
||||||
# Powered by:
|
# Powered by:
|
||||||
import youtube_dl # Locally imported from the binary
|
import youtube_dl # Locally imported from the binary
|
||||||
|
|
||||||
import spotipy
|
import spotipy
|
||||||
from spotipy.oauth2 import SpotifyClientCredentials
|
from spotipy.oauth2 import SpotifyClientCredentials
|
||||||
|
|
||||||
|
|
12
irs/setup_binaries.py
Normal file
12
irs/setup_binaries.py
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
import ydl_binaries
|
||||||
|
from shutil import copyfile
|
||||||
|
import os
|
||||||
|
|
||||||
|
|
||||||
|
def setup():
|
||||||
|
ydl_binaries.download_ffmpeg("~/.irs/bin")
|
||||||
|
ydl_binaries.update_ydl("~/.irs/bin")
|
||||||
|
|
||||||
|
config_file = os.path.expanduser("~/.irs/config_.py")
|
||||||
|
if not os.path.isfile(config_file):
|
||||||
|
copyfile("irs/config_preset", config_file)
|
39
setup.py
39
setup.py
|
@ -1,39 +1,4 @@
|
||||||
from setuptools import setup
|
from setuptools import setup
|
||||||
from setuptools.command.develop import develop
|
|
||||||
from setuptools.command.install import install
|
|
||||||
|
|
||||||
|
|
||||||
class PostDevelopCommand(develop):
|
|
||||||
"""Post-installation for development mode."""
|
|
||||||
def run(self):
|
|
||||||
# PUT YOUR PRE-INSTALL SCRIPT HERE or CALL A FUNCTION
|
|
||||||
develop.run(self)
|
|
||||||
# PUT YOUR POST-INSTALL SCRIPT HERE or CALL A FUNCTION
|
|
||||||
|
|
||||||
|
|
||||||
class PostInstallCommand(install):
|
|
||||||
"""Post-installation for installation mode."""
|
|
||||||
def run(self):
|
|
||||||
install.run(self) # Actually install the module and dependencies
|
|
||||||
|
|
||||||
try:
|
|
||||||
import ydl_binaries
|
|
||||||
except ImportError:
|
|
||||||
import pip
|
|
||||||
pip.main(['install', "ydl-binaries"])
|
|
||||||
|
|
||||||
import ydl_binaries
|
|
||||||
from os import path
|
|
||||||
from shutil import copyfile
|
|
||||||
|
|
||||||
print("\n\nDownloading Dependencies:\n")
|
|
||||||
ydl_binaries.download_ffmpeg("~/.irs/bin")
|
|
||||||
ydl_binaries.update_ydl("~/.irs/bin")
|
|
||||||
|
|
||||||
config_file = path.expanduser("~/.irs/config_.py")
|
|
||||||
if not path.isfile(config_file):
|
|
||||||
copyfile("irs/config_preset", config_file)
|
|
||||||
|
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name = 'irs',
|
name = 'irs',
|
||||||
|
@ -54,8 +19,4 @@ setup(
|
||||||
entry_points = {
|
entry_points = {
|
||||||
'console_scripts': ['irs = irs.cli:main'],
|
'console_scripts': ['irs = irs.cli:main'],
|
||||||
},
|
},
|
||||||
cmdclass = {
|
|
||||||
'develop': PostDevelopCommand,
|
|
||||||
'install': PostInstallCommand,
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue