Skip to content

Commit

Permalink
better filenames, less installation steps and binary
Browse files Browse the repository at this point in the history
  • Loading branch information
donmerendolo committed Nov 5, 2024
1 parent cf8eaa7 commit 7385f1c
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 17 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ config.cfg
playlists/
Pipfile
Pipfile.lock
dist/
build/
*.spec
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# exportify-cli
![](exportify.png?raw=true "exportify-cli") \
![](image.png?raw=true "exportify-cli") \
Export Spotify playlists to CSV directly from the terminal, inspired by [pavelkomarov/exportify](https://github.com/pavelkomarov/exportify).

This tool can export all saved playlists, including liked songs.

## Installation:
**If you use Windows, you can use the binary in [releases](https://github.com/donmerendolo/exportify-cli/releases/latest) and skip steps 1 and 2.**
1. **Clone this repository:**
```bash
$ git clone https://github.com/donmerendolo/exportify-cli.git
Expand All @@ -17,18 +18,17 @@ $ pip install -r requirements.txt
```
(recommended to use a virtual environment)

3. **Create an app on Spotify Developer Dashboard:**
- Go to [Spotify Developer Dashboard](https://developer.spotify.com/dashboard).
- Set a name and description for your app.
- In the "Redirect URIs" field, use: `http://localhost:3000/callback` (for example).
3. **Set up Client ID, Client Secret and Redirect URI:**

4. **Configure your credentials:**
- Replace `CLIENT_ID`, `CLIENT_SECRET`, and `REDIRECT_URI` in the `config.cfg.RENAME` file.
- These values can be found in the "Settings" section of your app on the Spotify Developer Dashboard.

6. **Rename `config.cfg.RENAME` to `config.cfg`**
The first time you run exportify-cli, it will guide you through the setup:
```
1. Go to Spotify Developer Dashboard (https://developer.spotify.com/dashboard).
2. Create a new app.
3. Set a name and description for your app.
4. Add a redirect URI (e.g. http://localhost:8080).
```

After running `python exportify.py` the first time, it should keep you authenticated so you don't have to log in each time. If you wish to log out, simply remove the `.cache` file.
After running `python exportify-cli.py` or `exportify-cli.exe` the first time, it should keep you authenticated so you don't have to log in each time. If you wish to log out, simply remove the `.cache` file.

---

Expand Down
4 changes: 0 additions & 4 deletions config.cfg.RENAME

This file was deleted.

30 changes: 28 additions & 2 deletions exportify.py → exportify-cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,29 @@
# Load configuration from config.cfg
config = configparser.ConfigParser()
config.read('config.cfg')
if not os.path.exists('config.cfg'):
print("""config.cfg not found. Let's create it.
1. Go to Spotify Developer Dashboard (https://developer.spotify.com/dashboard).
2. Create a new app.
3. Set a name and description for your app.
4. Add a redirect URI (e.g. http://localhost:8080).
Now after creating the app, press the Settings button on the upper right corner.
Copy the Client ID, Client Secret and Redirect URI and paste them below.
""")
client_id = input("Client ID: ")
client_secret = input("Client Secret: ")
redirect_uri = input("Redirect URI: ")

config['spotify'] = {
'client_id': client_id,
'client_secret': client_secret,
'redirect_uri': redirect_uri
}

with open('config.cfg', 'w') as configfile:
config.write(configfile)

client_id = config.get('spotify', 'client_id')
client_secret = config.get('spotify', 'client_secret')
Expand Down Expand Up @@ -160,9 +183,12 @@ def main():
parser.add_argument('-l', '--list', action='store_true', help="List all playlists")

args = parser.parse_args()

output_dir = args.output


# This line opens the Spotify authorization page in the browser
sp.current_user()

if args.list:
list_playlists()
elif args.all:
Expand Down
Binary file removed exportify.png
Binary file not shown.
Binary file added image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 7385f1c

Please sign in to comment.