Giter Club home page Giter Club logo

spoonie's Introduction

Spoonie - Sync a spotify playlist with a Creative Tonie

This (ugly) script can be used to sync a spotify playlist with a creative tonie of your choice. A free (burner) spotify account is enough - no premium is required(thanks to https://github.com/kokarare1212/librespot-python).

Installation

git clone https://github.com/Seji64/spoonie
cd spoonie
pip3 install virtualenv
virtualenv venv
source venv/bin/activate
pip3 install -r requirements.txt

Usage

Local

cd spoonie
source venv/bin/activate
python3 spoonie.py --spotify-username <username> --spotify-password <password> --tonie-username <tonies.com user> --tonie-password <password> --tonie-household <eg. Sejis Haushalt> --creative-tonie <creative tonie name> --playlist <spotify-playist-url>

Docker

docker run -d --restart=unless-stopped \
  -v /folder/data:/app/data \
  -e SPOTIFY_USERNAME=<spotify user> \
  -e SPOTIFY_PASSWORD=<password> \
  -e TONIE_USERNAME=<tonies.com username> \
  -e TONIE_PASSWORD=<tonies.com password> \
  -e TONIE_HOUSEHOLD=<household name> \
  -e CREATIVE_TONIE=<tonie name> \
  -e PLAYLIST=<playlist_url> \
  --name spoonie ghcr.io/seji64/spoonie:latest

Inspiration and used libs

spoonie's People

Contributors

seji64 avatar

Stargazers

 avatar  avatar Fabian Gebhart avatar

Watchers

 avatar Kostas Georgiou avatar

spoonie's Issues

Failed to parse TRACKS_URL response: 'NoneType' object is not subscriptable

If i add a Podcast like "Anna und die wilden Tiere" or "Checkpod", the get_song_info function fails. It is probably because of the podcast format. The data looks empty and there are no tracks found.

Hope there is a simple solution for this, like using dummy data for the necessary fields.

Example spotify track:
https://open.spotify.com/episode/4bK5cKclzHMhPYo4YpNeNp?si=80a31887561d4ac2

2024-04-01 06:15:05,177 | Failed to parse TRACKS_URL response: 'NoneType' object is not subscriptable
{
  "tracks" : [ null ]
}
Traceback (most recent call last):
  File "/app/spoonie.py", line 166, in get_song_info
    for data in info['tracks'][0]['artists']:
                ~~~~~~~~~~~~~~~~~^^^^^^^^^^^
TypeError: 'NoneType' object is not subscriptable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/app/spoonie.py", line 375, in main
    (artists, raw_artists, album_name, name, image_url, release_year, disc_number,track_number, scraped_song_id, is_playable, duration_ms) = get_song_info(spotifySession,track_id)
                                                                                                                                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/spoonie.py", line 186, in get_song_info
    raise ValueError(f'Failed to parse TRACKS_URL response: {str(e)}\n{raw}')
ValueError: Failed to parse TRACKS_URL response: 'NoneType' object is not subscriptable
{
  "tracks" : [ null ]
}

FileNotFoundError

Thank you very very much for your work. It was the first repository for Spotify to Tonie Sync i got running and had no further problems.

Small issue with file names that have special characters in the name.

Probably because of the artist name with the dot in the name.

2024-04-01 05:30:07,900 | [Errno 2] No such file or directory: '/app/data/download/Josh. - Cordula Grün.mp3'
Traceback (most recent call last):
  File "/app/spoonie.py", line 449, in main
    tonie_api.upload_file_to_tonie(creative_tonie,value,key)
  File "/usr/local/lib/python3.12/site-packages/tonie_api/api.py", line 129, in upload_file_to_tonie
    with file.open("rb") as _fs:
         ^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/pathlib.py", line 1013, in open
    return io.open(self, mode, buffering, encoding, errors, newline)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/app/data/download/Josh. - Cordula Grün.mp3'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.